From patchwork Fri Feb 10 15:10:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13135920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FFFDC636CD for ; Fri, 10 Feb 2023 15:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u81Chbml+DMTMPnYJ/Dev8HeBd6pCCiXXwmb/42cTkg=; b=cRAPv4gDhG/jxW Xrs76UQbwfdt0twxxKXFyAiN4dVcpl8Vn3wvMEKrxi2UNRWGrK29XJvuhQi59u5H9tHHemmGMr79m R557a1+XXqfHnNQFtp+ubcL1JwOFOaCtOz3HCcVoNUbLfMU+gEOr+XtIJSq6SwZJIaRRKxN3ubDds 1mrNW6gv6zJnYrOnceURGbkSA77JtRc96yb8Itf60FU+tG/GXLHabs8QEYkQSEALZz3Z3xzcILueZ yqolNrzS1Woc0Q1jmMNU8w8K0HLI9nwLWGrAhlGlWmyXb1o95LEWmaCsjcjaMShdBK7akPZvDB3oI NlqNixYiSJ6O+OGOKYIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQV32-006EbJ-Ty; Fri, 10 Feb 2023 15:10:49 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQV2V-006ELf-O8 for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 15:10:17 +0000 Received: by mail-wm1-x332.google.com with SMTP id bg26so4086020wmb.0 for ; Fri, 10 Feb 2023 07:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=0+nb49xfCO7TD3Kw+7mvNnwEcPqxWc5InnfsnZGnCRs=; b=Vf9PtwnuqpDb3fAhMflYECBHkp7KeCBtEl+u5e4CZLHluK63I/51FVapv1/EYp0ODv 3uWlEYgRD3tR9ihgjZQfL/UVF5+xyBQGahpE7piBa8f43rmOk0/darZ3iAzh2B2oY4ZQ 3RPyTj8KdeMSAyQ8vWWXCoYqF3is9+RVtHZ4u4EZBWoXNW8FtbjIKEtW6+3re5e1b2Di otYjLP/0wDcw5aFb6COJfdCqg4FIpd4Z0v6fH3tzScbp2Q8bxDFaTaL1K4y+mBoVL7l6 5Sa4wW7fvZ2ZAvFcDoZ5e19Aj/I+hzAvrSOHnm2G/I0SRw7rjqiBxI/m01u1liOdLTNt Rf5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0+nb49xfCO7TD3Kw+7mvNnwEcPqxWc5InnfsnZGnCRs=; b=hKVevQ4GixPyAWIeDcp8Iqyw2D0fp/uHStwm/DPUUWnUnV+xhACMvpq6i31F+iPBRb PmQpkDCPxUswWXcqmhsMYs/mOMy1sJwenWzJWOKtcG7Xsl3AMF9o1LfuV8kj9+Ps8h5a F353LFebhtP6hw2wycmH2bUxmBPfTyldiTGxHEnMkj4AU/E48FGuxPxeI42qLxQvSFVd bqQ4/rQb0zFbb3gRwRzJ4nNXJnd8xHymxjyjHnNn1nEItaDIyXZqcQEuvHJQguYCUDyy GqgUxMaLJ54ikznHa8SXfadNh4R1xdeyVX8SHJmAY/yzjZwm0acTxJZtFRS0/dYJN3/z N9bw== X-Gm-Message-State: AO0yUKUa+Ua5dfVUJOvU/lJgPZmbg2P2LjAYdwzLWgwRssyZGpYrbGV9 89xl8jAZL98RAF2QN6M277D9hUJ0YXy8qhiK X-Google-Smtp-Source: AK7set8PgXQAjv0wyRo2U+xZEUpv6yGnZQRS3itBN5CqTvpSKRQOJRUkgpMti9J7JmvAwsTjZBymag== X-Received: by 2002:a05:600c:a692:b0:3df:d86d:797a with SMTP id ip18-20020a05600ca69200b003dfd86d797amr14892869wmb.25.1676041813610; Fri, 10 Feb 2023 07:10:13 -0800 (PST) Received: from linaro.org ([2a00:23c5:680a:d01:61c3:70d8:6500:e102]) by smtp.gmail.com with ESMTPSA id a1-20020a05600c348100b003db0ee277b2sm8587771wmq.5.2023.02.10.07.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 07:10:12 -0800 (PST) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, suzuki.poulose@arm.com, leo.yan@linaro.org, yabinc@google.com, Mike Leach Subject: [PATCH 1/3] coresight: Update timeout functions to allow return of test register value Date: Fri, 10 Feb 2023 15:10:06 +0000 Message-Id: <20230210151008.4587-2-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230210151008.4587-1-mike.leach@linaro.org> References: <20230210151008.4587-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230210_071015_896473_CB23F29C X-CRM114-Status: GOOD ( 20.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Current coresight_timeout function spins on a bit on a test register, till bit value achieved or timeout hit. Add another function to return the full value of the register being tested. Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-core.c | 50 +++++++++++++++----- include/linux/coresight.h | 10 +++- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index d3bf82c0de1d..c4db111ab32b 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1456,32 +1456,37 @@ static void coresight_remove_conns(struct coresight_device *csdev) } /** - * coresight_timeout - loop until a bit has changed to a specific register - * state. + * coresight_timeout_retval - loop until a bit has changed to a specific register + * state. Return final register value * @csa: coresight device access for the device * @offset: Offset of the register from the base of the device. * @position: the position of the bit of interest. * @value: the value the bit should have. + * @rval: the last read value of the register being tested. * * Return: 0 as soon as the bit has taken the desired state or -EAGAIN if * TIMEOUT_US has elapsed, which ever happens first. */ -int coresight_timeout(struct csdev_access *csa, u32 offset, - int position, int value) +int coresight_timeout_retval(struct csdev_access *csa, u32 offset, + int position, int value, u32 *rval) { - int i; - u32 val; + int i, rc = -EAGAIN; + u32 val = 0; for (i = TIMEOUT_US; i > 0; i--) { val = csdev_access_read32(csa, offset); /* waiting on the bit to go from 0 to 1 */ if (value) { - if (val & BIT(position)) - return 0; + if (val & BIT(position)) { + rc = 0; + goto return_rval; + } /* waiting on the bit to go from 1 to 0 */ } else { - if (!(val & BIT(position))) - return 0; + if (!(val & BIT(position))) { + rc = 0; + goto return_rval; + } } /* @@ -1493,7 +1498,30 @@ int coresight_timeout(struct csdev_access *csa, u32 offset, udelay(1); } - return -EAGAIN; +return_rval: + *rval = val; + + return rc; +} +EXPORT_SYMBOL_GPL(coresight_timeout_retval); + +/** + * coresight_timeout - loop until a bit has changed to a specific register + * state + * @csa: coresight device access for the device + * @offset: Offset of the register from the base of the device. + * @position: the position of the bit of interest. + * @value: the value the bit should have. + * + * Return: 0 as soon as the bit has taken the desired state or -EAGAIN if + * TIMEOUT_US has elapsed, which ever happens first. + */ +int coresight_timeout(struct csdev_access *csa, u32 offset, + int position, int value) +{ + u32 rval = 0; + + return coresight_timeout_retval(csa, offset, position, value, &rval); } EXPORT_SYMBOL_GPL(coresight_timeout); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index f19a47b9bb5a..6b6b45ef6971 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -500,7 +500,8 @@ extern int coresight_enable(struct coresight_device *csdev); extern void coresight_disable(struct coresight_device *csdev); extern int coresight_timeout(struct csdev_access *csa, u32 offset, int position, int value); - +extern int coresight_timeout_retval(struct csdev_access *csa, u32 offset, + int position, int value, u32 *rval); extern int coresight_claim_device(struct coresight_device *csdev); extern int coresight_claim_device_unlocked(struct coresight_device *csdev); @@ -536,6 +537,13 @@ static inline int coresight_timeout(struct csdev_access *csa, u32 offset, return 1; } +static inline int coresight_timeout_retval(struct csdev_access *csa, u32 offset, + int position, int value, u32 *rval) +{ + *rval = 0; + return 1; +} + static inline int coresight_claim_device_unlocked(struct coresight_device *csdev) { return -EINVAL; From patchwork Fri Feb 10 15:10:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13135921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E6B1C05027 for ; Fri, 10 Feb 2023 15:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1E837vSor5IYm69ztyDTVcluM6K6dEXajuAIZILKh3M=; b=1kuWzHWj8DlEuP 0VRqjlU1oCtHvO93A3lGWz67BIHk9o3JgEC+Lh5vO6jqvFTCpiBrfsPwxKJ85ZJ3W+Y9ttbSayNLQ xZ43E0VD0VYf9/uYjbcIO7KzdsjOx4MZ5B3OcRh2zVBHzMHdrU0+jSt+jkm5Ji5blF61hUk1Ti2l2 c8hoaBHF0ovYWHq40CVaz4Wddq5k0yoPpXWfoZXG8YImYrWoSpPfHNIwX2B79v798UNYCiifvBA+r 9+G7KjB8bjBrYOR9AJXxZpMZIBCeO2Av9Zg88MLuYxVyQlYhR+Qof2LESyuU30Vbixttk/xXkyrJ9 UHE5/CoukvTKxI1yARWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQV3t-006Ets-2m; Fri, 10 Feb 2023 15:11:41 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQV2Y-006EMA-Vb for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 15:10:20 +0000 Received: by mail-wm1-x335.google.com with SMTP id u10so4039271wmj.3 for ; Fri, 10 Feb 2023 07:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=adIPNQyKxDd1RuPK4zL9OpTeZ2XD9I/+wxj+DVdGgI0=; b=ps/i48xY7OTd8AHo0A09urvF94RXGDUUF2uqa3Qb3qPCVs6MBw2zl72LuGRcivC0n5 Zf60Yr+29BTihaSvM/AVfvJoiIYUCde8S59w7wqg4AI98ueD0otRTQoWa4AvTYvapTc8 MprdpV4zxU8u8k6mbwGiFH4dZpBI5KwjNZLLEb5yMCea1iIjva9QO7aFCibo5RNilHZ8 +V+3e2b3qXqlQvAsEzCQ6mmjZ6IBwIV+QtNY1WPKDruiuD/vGMchgDL+rtwcO19ZrY9e bDI0000zOtUY9IHvZztVfw8p0HklEmgB0Dnf/kUFF5pgo/s8ap4vuqNRgdrIe3Qjy2Qe Wt0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=adIPNQyKxDd1RuPK4zL9OpTeZ2XD9I/+wxj+DVdGgI0=; b=77/lsctjg/nc9u0rWxp0FT96VCQ9soDVTs3QDUreRw4e1CyOj39KNoz2PEd2W/8pQq ZNZbGBDvrXUTOJqnLCvOqNRsQr2bWKAFJzIDEiEBuZJmFCkwjrmzOreanOOzx3SGaTeg g2P8O6kPMUe55IUB7K3HVNpjGGJDioJ2dsX97DDR+NKCxbMFlKffalPx8kwmxz3IvDtd 5WrnsMfxGpsOziIfyGV2SFIWgSIwwMBwXqpDcPXswd0Ha/9jumm3KNWuS/LQ4f3tTh9f +O8x0ih8FBbWTg4Jdgi0axjYF3/WjF9DzrY8lRlwvPvgjdNxmL51cTW0imBcneT0iw2e bmqA== X-Gm-Message-State: AO0yUKUCgcqXPzDharcGjBf5ey4yvhkThX2pwYqb3/foZQQS0nIoKA4a YpIyYFB1NkW9BuRSa9i2zQoKBa2e9/ePaNsD X-Google-Smtp-Source: AK7set9fKSGwP/RWViQy85RqPAZSLf97pmWbONz27jW18E4EKt6F9/VhTsH1UFLZlcOFQQo0nPVXRQ== X-Received: by 2002:a05:600c:4910:b0:3dc:1dc3:7a05 with SMTP id f16-20020a05600c491000b003dc1dc37a05mr13295789wmp.10.1676041815276; Fri, 10 Feb 2023 07:10:15 -0800 (PST) Received: from linaro.org ([2a00:23c5:680a:d01:61c3:70d8:6500:e102]) by smtp.gmail.com with ESMTPSA id a1-20020a05600c348100b003db0ee277b2sm8587771wmq.5.2023.02.10.07.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 07:10:14 -0800 (PST) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, suzuki.poulose@arm.com, leo.yan@linaro.org, yabinc@google.com, Mike Leach Subject: [PATCH 2/3] coresight: tmc: Update error logging in tmc common functions Date: Fri, 10 Feb 2023 15:10:07 +0000 Message-Id: <20230210151008.4587-3-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230210151008.4587-1-mike.leach@linaro.org> References: <20230210151008.4587-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230210_071019_061104_7A8D4554 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enhance the error logging in the tmc_wait_for_tmcready() and tmc_flush_and_stop() to print key tmc register values on error conditions to improve hardware debug information. Signed-off-by: Mike Leach --- .../hwtracing/coresight/coresight-tmc-core.c | 37 +++++++++++++++---- drivers/hwtracing/coresight/coresight-tmc.h | 2 +- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c index c106d142e632..f048f450843d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -31,25 +31,36 @@ DEFINE_CORESIGHT_DEVLIST(etb_devs, "tmc_etb"); DEFINE_CORESIGHT_DEVLIST(etf_devs, "tmc_etf"); DEFINE_CORESIGHT_DEVLIST(etr_devs, "tmc_etr"); +#define TMC_WAIT_READY_FMT_STR "timeout while waiting for TMC to be Ready [STS=0x%04x]\n" + int tmc_wait_for_tmcready(struct tmc_drvdata *drvdata) { struct coresight_device *csdev = drvdata->csdev; struct csdev_access *csa = &csdev->access; + u32 tmc_sts = 0; /* Ensure formatter, unformatter and hardware fifo are empty */ - if (coresight_timeout(csa, TMC_STS, TMC_STS_TMCREADY_BIT, 1)) { - dev_err(&csdev->dev, - "timeout while waiting for TMC to be Ready\n"); + if (coresight_timeout_retval(csa, TMC_STS, TMC_STS_TMCREADY_BIT, 1, + &tmc_sts)) { + dev_err(&csdev->dev, TMC_WAIT_READY_FMT_STR, tmc_sts); return -EBUSY; } return 0; } -void tmc_flush_and_stop(struct tmc_drvdata *drvdata) +int tmc_flush_and_stop(struct tmc_drvdata *drvdata) { struct coresight_device *csdev = drvdata->csdev; struct csdev_access *csa = &csdev->access; - u32 ffcr; + u32 ffcr, ffsr, tmc_sts; + int rc = 0; + + /* note any MemErr present when stopping TMC */ + tmc_sts = readl_relaxed(drvdata->base + TMC_STS); + if (tmc_sts & TMC_STS_MEMERR) + dev_err(&csdev->dev, + "MemErr detected before Manual Flush; STS[0x%02x]\n", + tmc_sts); ffcr = readl_relaxed(drvdata->base + TMC_FFCR); ffcr |= TMC_FFCR_STOP_ON_FLUSH; @@ -57,12 +68,22 @@ void tmc_flush_and_stop(struct tmc_drvdata *drvdata) ffcr |= BIT(TMC_FFCR_FLUSHMAN_BIT); writel_relaxed(ffcr, drvdata->base + TMC_FFCR); /* Ensure flush completes */ - if (coresight_timeout(csa, TMC_FFCR, TMC_FFCR_FLUSHMAN_BIT, 0)) { + if (coresight_timeout_retval(csa, TMC_FFCR, TMC_FFCR_FLUSHMAN_BIT, 0, + &ffcr)) { + ffsr = readl_relaxed(drvdata->base + TMC_FFSR); dev_err(&csdev->dev, - "timeout while waiting for completion of Manual Flush\n"); + "timeout while waiting for completion of Manual Flush\n"); + dev_err(&csdev->dev, + "regs: FFCR[0x%02x] FFSR[0x%02x] STS[0x%02x]\n", + ffcr, ffsr, tmc_sts); + rc = -EBUSY; } - tmc_wait_for_tmcready(drvdata); + if (tmc_wait_for_tmcready(drvdata)) { + dev_err(&csdev->dev, "TMC ready error after Manual flush\n"); + rc = -EBUSY; + } + return rc; } void tmc_enable_hw(struct tmc_drvdata *drvdata) diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 01c0382a29c0..314f8244787f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -256,7 +256,7 @@ struct tmc_sg_table { /* Generic functions */ int tmc_wait_for_tmcready(struct tmc_drvdata *drvdata); -void tmc_flush_and_stop(struct tmc_drvdata *drvdata); +int tmc_flush_and_stop(struct tmc_drvdata *drvdata); void tmc_enable_hw(struct tmc_drvdata *drvdata); void tmc_disable_hw(struct tmc_drvdata *drvdata); u32 tmc_get_memwidth_mask(struct tmc_drvdata *drvdata); From patchwork Fri Feb 10 15:10:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13135922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01A93C636CD for ; Fri, 10 Feb 2023 15:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WyG41U8U3rAJFvaTRZoCbRPaGQJHbfEnWWMp9iu7zz8=; b=Dh9nc3/vRkyjD7 P/ixbevts8j0vITusOFXG925BDR5GArDLbIR7tdhBdaKuBeVl8eVFe0OpzrFmAvn4FhrWEL8aWabV sBNvz3QQj2GXQnwnc70+sWW3UGCu75Jl8s+u+5/HmE81Q7eCSTgahtJvKXakOc4mO9TcSyqojfBoe t5P3be/DyiYIboAaxPGKFJ0hCMAL+C5lMoP/jU9bv9kHQ3JELnuw6DBUBSsaKcmF/K7J31djlnP++ c+S/cXaB8C8MzlFK3ebaB1tx/NzGgbZVRL1Vo9Ge5+Jg40syDBV9GLMDNGo9C4LXq13EdT31fWTS7 aBkWcWWu8AVScUsmhIDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQV4i-006FBt-DE; Fri, 10 Feb 2023 15:12:33 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQV2a-006EMw-BY for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 15:10:21 +0000 Received: by mail-wm1-x334.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso6530252wms.0 for ; Fri, 10 Feb 2023 07:10:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=y30ATMpLL1p4sSwUhQyjHL/c3brIpR/bscArWLHO7lI=; b=GGmHtQVXt/y7Gf70PAxFkbRl2K3rbN4eQbpOp9jBgJIVukppqlJ4dIqqyjbLHzcC90 49LbKn/X4chqRjUB5AU7itVq2yGdaBZ9EPK5ibJbrwFPBbw9b+jq2MrxKpOLX2iNU5l2 CzPchIYQXKdAaN0+ukZU4doAloHwNmXJPlDyXpM/itGD/uWX/v7j4ar/hCFuhjbaGvTS SNRt4Mrkat2plsvjmEstWqmvO3mg1qF7NNKFBCFw9WuqpLoJEcFPgiNHA90/s2wHV/A3 G7X3yebzB5o87am0AOxRi9yzv1pbzQFBIIneoQNvo8HKT36bdbN6KmmkG+eRiMhwHX4L 1bmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y30ATMpLL1p4sSwUhQyjHL/c3brIpR/bscArWLHO7lI=; b=xPf0M7vauV6fcm92OjFA+LlDGxWfojcYdUEpgZryvmMbcCTaokk/GZF14Nil+SwDQn QU2YyLkHoYHZ0Fl/lIq0yeVm9FwqDggF+PQ7yHB9aLWs0nL5jYiW+kzBvYcz9WA5XstU mwPW56Vtl8O0Qpm71KdBWWJB6Y440x+ByX42+45FTISrQngL/KsBVqyAW6RPsUfw9Ims TMLP0JBdMTon3ZtkAP4pJqlJ6BeIkzD4HyghNzkxfTPGDUcsERofi8Jq10Om3PbW9y0z 3W80BbJJKot+AE6cpr78AoRY9F9klnARhqCNEuJvuHSD5oZ+l0mCTDAGS0p1m8+KWt04 4PoQ== X-Gm-Message-State: AO0yUKWeDxUQ9XxPsBClUnbajp3B4z4sV2+EMrVo8ZNGSxOLNxDs9G4F 9pgGghBWPEQvLpMJJZLoIMyQO7W9ONVzqj0W X-Google-Smtp-Source: AK7set8eCMDn9dJoiFXBhY9Qctg7aCPwRdmw5nKICGViJS8cWrEchk5Wh2a2gkwdmFoIs0Z/wSoYkg== X-Received: by 2002:a05:600c:9a2:b0:3dc:576c:ab07 with SMTP id w34-20020a05600c09a200b003dc576cab07mr13027845wmp.14.1676041816571; Fri, 10 Feb 2023 07:10:16 -0800 (PST) Received: from linaro.org ([2a00:23c5:680a:d01:61c3:70d8:6500:e102]) by smtp.gmail.com with ESMTPSA id a1-20020a05600c348100b003db0ee277b2sm8587771wmq.5.2023.02.10.07.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 07:10:15 -0800 (PST) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, suzuki.poulose@arm.com, leo.yan@linaro.org, yabinc@google.com, Mike Leach Subject: [PATCH 3/3] coresight: etf: etr: Update logging around flush_and_stop() errors Date: Fri, 10 Feb 2023 15:10:08 +0000 Message-Id: <20230210151008.4587-4-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230210151008.4587-1-mike.leach@linaro.org> References: <20230210151008.4587-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230210_071020_446118_939BDD1C X-CRM114-Status: GOOD ( 11.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Insert additional context around tmc_flush_and_stop() errors. Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 12 +++++++++--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 0ab1f73c2d06..c8a4d4eff64f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -84,7 +84,9 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata) { CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (tmc_flush_and_stop(drvdata)) + dev_err(&drvdata->csdev->dev, + "Flush and stop error disabling ETB\n"); /* * When operating in sysFS mode the content of the buffer needs to be * read before the TMC is disabled. @@ -146,7 +148,9 @@ static void tmc_etf_disable_hw(struct tmc_drvdata *drvdata) CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (tmc_flush_and_stop(drvdata)) + dev_err(&drvdata->csdev->dev, + "Flush and stop error disabling ETF\n"); tmc_disable_hw(drvdata); coresight_disclaim_device_unlocked(csdev); CS_LOCK(drvdata->base); @@ -492,7 +496,9 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (tmc_flush_and_stop(drvdata)) + dev_err(&drvdata->csdev->dev, + "Flush and stop error updating perf buffer\n"); read_ptr = tmc_read_rrp(drvdata); write_ptr = tmc_read_rwp(drvdata); diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 918d461fcf4a..ceae6a093612 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1145,7 +1145,9 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (tmc_flush_and_stop(drvdata)) + dev_err(&drvdata->csdev->dev, + "Flush and stop error disabling ETR\n"); /* * When operating in sysFS mode the content of the buffer needs to be * read before the TMC is disabled. @@ -1548,7 +1550,9 @@ tmc_update_etr_buffer(struct coresight_device *csdev, CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (tmc_flush_and_stop(drvdata)) + dev_err(&csdev->dev, + "Flush and Stop error updating perf buffer\n"); tmc_sync_etr_buf(drvdata); CS_LOCK(drvdata->base);