From patchwork Fri Dec 13 14:49:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13907280 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 60207E7717D for ; Fri, 13 Dec 2024 14:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=15AaAK2+TNf0pjNDy/UAqLLtCRlZm3/kpGALTDknfLk=; b=ItoToSXX4YKt2ocZEJJqGNCBeA nrS0e6DfxBifM79jumu8lrt+l53J7CE62C3HHLDxmr8HV9OwYWrdRCEPlssToV5CGR6MEeK4gYrwG Ro7czyaFlEdsymGWVSOc2TeQM7GHz8o9bGE5eqN5AEnRj1qEOytMijwBFeYk+pbWmDBiLBOIIWrx1 xrs6Y86OalY/M5mPIMHNXuSDzd6wC1Q9eLq65vs1H9m1VC+jWU7fShcRLpp43ejUgm+qFsDVz1e8Z lYGor3ag8ydMg9ddchtNJXa6sqFU4W2JgJ6bz/VrAaav/UVqN6Ix6UzBjY4729eJ2PpFZvlcfc9R7 NOzokE5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tM711-000000049kp-0hH2; Fri, 13 Dec 2024 14:51:39 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tM6ys-000000049CE-1j8c for linux-arm-kernel@lists.infradead.org; Fri, 13 Dec 2024 14:49:27 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-385d7f19f20so892823f8f.1 for ; Fri, 13 Dec 2024 06:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734101365; x=1734706165; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=15AaAK2+TNf0pjNDy/UAqLLtCRlZm3/kpGALTDknfLk=; b=aMjBUzRrSN52aAHChVJBhrYi+qBZ8u+PMc9WL2g8FUXwjvXpAFT0U00vZbwoziJ+56 Erp5/5WZ6QHdqP4v1TtWYgkundm/r1PmYtgDlPy3x0XcrqF+s7rp/4EtzG0ugkshncVb JKcuE+/oHnSnk60vPaXCY7TD1sTgu+hcvLsy8NdytaImXY+BKWymO8CnAfR6P9WMkJdI buCFFTOvqg9DVl7DhlSaB4b2W2kmfwN9Njc493P26EJehdTZ/JIKrg3YMvkFSyuLmIlv IsjFzyPmJUAQuhHI/USW2D9ThyY2nUFdBF6K9RQTkdnUrQi03dkXdac8MXjMrdrAwmVP GSbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734101365; x=1734706165; h=content-transfer-encoding:mime-version: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=15AaAK2+TNf0pjNDy/UAqLLtCRlZm3/kpGALTDknfLk=; b=tzSSbZ7LwH+6GI3M12sq3R3qtzDsd1/4rbE0bfsbqQreEIBUWP4WUu+WgPY+tcrRoD S6aoMuSjGtXJUSNtp5/xx7ZJZnD32W3XIr2gQ4KlUe/hNAg8OTqtuK5KnlihRRMZ057+ f2jIYeAK1qwTb5BocZIkju2/CBXdNIjBD6Hrd40fEtRlQKAAHJjkSDjQI40T/Vw+t+xx AzZ+Frllis646uzhY/aV1CuNv3aN2DydkffX3oSCcI70fnXR2POIXoQ3Eq7nwiGZbrsz GOcSGOMicRtVe1IFMsOjg6ZFSApVq96Jz8AtC7r+XBATWCIu+9WJ2lcQE7AnylsC18OK Zk5w== X-Forwarded-Encrypted: i=1; AJvYcCV0/wTJvWVWFgD+rVE9d6FJLtvd+rzj4Ca3WWduIDKqA/EAjK2QMzMv3U2PDy4yDf0ANHetLDTjzwklh6Az2KDO@lists.infradead.org X-Gm-Message-State: AOJu0Yyc4xfTqSsHZcuaTAUmfCO8qhOVwTBMtNFMveOllqdDStCVxy6B Ry9CedynEoegWjGVOivhSOaCvJPDhRHStzOEvLUV8LKPLU0pTLTOXB7aL+xJqfk= X-Gm-Gg: ASbGncuqG3LINpu3MMNbqIvNs3qc3SWPjG4n1QmhgzWdbRL4sfvqzQTG7NQG7nOEYV4 vqsfQq5oeSfUyphrOlrzh1/LsnA6h0WSdnBOepGXzsJsFvplSpzBUqFhCVWM0clOsd8NiwgE/Gr lo7lFN0LQciphGUJHEjQH7FEkThO6sKaj2U35VAWHlYyVSps2y2obk2nnFF/1wgYCwiJyiLw/G5 bJ6PEDMLcaw695KeEN1xqYw1boybnYIaGG/K3I5dDhnJ37RjLjuq6CmKA== X-Google-Smtp-Source: AGHT+IHO0M2mkaBgTv2bRXcbzSWDj4N1+DMABwuK3YzAtH8N7NuvAFA9fIE961ZHfmLSmGa1Mu+Zcg== X-Received: by 2002:a05:6000:2ad:b0:385:df6b:7ef6 with SMTP id ffacd0b85a97d-3888e0be442mr1907627f8f.51.1734101364916; Fri, 13 Dec 2024 06:49:24 -0800 (PST) Received: from linaro.org ([2a00:23c5:6829:901:dd7a:c2d:2b46:b1a9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-387824c50b7sm7196295f8f.57.2024.12.13.06.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 06:49:24 -0800 (PST) From: Mike Leach To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Cc: james.clark@linaro.org, mike.leach@linaro.org, suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com Subject: [PATCH v2 1/3] coresight: Update timeout functions to allow return of test register value Date: Fri, 13 Dec 2024 14:49:17 +0000 Message-Id: <20241213144919.110642-2-mike.leach@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241213144919.110642-1-mike.leach@linaro.org> References: <20241213144919.110642-1-mike.leach@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_064926_447280_C23D959F X-CRM114-Status: GOOD ( 19.80 ) 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: , 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 | 2 + 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index ea38ecf26fcb..feb1a1db355f 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1017,32 +1017,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; + } } /* @@ -1054,7 +1059,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 055ce5cd5c44..29cb71e82b0b 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -639,6 +639,8 @@ extern int coresight_enable_sysfs(struct coresight_device *csdev); extern void coresight_disable_sysfs(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); From patchwork Fri Dec 13 14:49:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13907281 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 B8C33E7717D for ; Fri, 13 Dec 2024 14:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qoj5GqPpJoW7JmFtjxPMWybNEJbYYEOKTO2N9SmSlgA=; b=xr5BszvRZvtlmIYBQHZdmvvjwE NhySPRqJWNCFTjL0kGR1Q1Rw8PZ3opnabiFtFoAb8O8GZXMG9C2Rfoi84M1Ko6SszqmB1AVfNwEOu LIvKb9OE8mJEn45gtXvuAZck26uL6IYG38sT0wyh2VFrOYu7JoJmywXz9iSW0xbhuIyo/DAg9CLIt wch6dA8y576Ji0jR/viKkvrjkdHYDO6rTzMhHo8grLYh0AI3YbyoMv8K0kxyaZAB9WEz116YqAgFX 0gT9L+2KpuqtLK9Ju2ZxkOnaE4aKOtjTqNmmbXneNP6rNiCpNitXZvRo7msqSXAwEmIl/qnzCHA6k 1pRulVSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tM724-00000004A2d-2kpY; Fri, 13 Dec 2024 14:52:44 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tM6yu-000000049Cm-2ce0 for linux-arm-kernel@lists.infradead.org; Fri, 13 Dec 2024 14:49:29 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3863494591bso962209f8f.1 for ; Fri, 13 Dec 2024 06:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734101367; x=1734706167; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qoj5GqPpJoW7JmFtjxPMWybNEJbYYEOKTO2N9SmSlgA=; b=tZmKW7NRdEpFJRA58NEwn43O3sPOFggY6yz/oySF/SdSm4P1GbyE86rxvTezuHq0Yi EquTtjGr2c6NLpIiY/4eKBbuf1uLjR8+T4apfcfqLPdw3hewZVcXrKiFXQ7KQjCdRfw8 0X6Tz15nHpHBaM3Gp3opbTnRygcY8KgoiE3AUni+VT125qLaWzjiQz+zExhvs15KkYMi PosySEqwZxZwNb3q+qYAGbOmLcA3MTHGn/Qt819s007wVpjnm9tU7qy1DVR9fubxaraf mkgFLyjIoI6+XdwxoAe71NlnOBMlFxoQWeQsxMTDrYkM7Qe0S85d5d5uQOntWh0jgu/s tmEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734101367; x=1734706167; h=content-transfer-encoding:mime-version: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=qoj5GqPpJoW7JmFtjxPMWybNEJbYYEOKTO2N9SmSlgA=; b=H8l48QXlCr69L9q9o3qK9xBOpkOvMmolUxn0H3nNqpUNrdeVlZ3N+G79eIgVhf5D6L 9FRz+lS+a3BOwNsppbD3hba36V36MZIQDrd1tJnWDuwd+ON+w+j1+LPdXBcxsrAEYaS5 uA9GLgwOHtpYxU+iUI0m1fPJQkeDMiS8myBieushtx30BEdcGkSwmTcLtAG1nNgr7Uey IenEbHi0QIG86R75tWHBVs9P83QJEtudKP+JaziwVygdbhwwCaAGDeFlQjrEAf1x07s+ BazghVFVybBcYtjE3ex0AvtQ4eizAY+d+9ur1hwqB+P5sVl0gQ6xzFY4kwnNAycJ3la3 pbaA== X-Forwarded-Encrypted: i=1; AJvYcCXt7gRhkJI5+kTTZE+/V+89+eYdM+CG88tm0oKssjX/4VtBuPzkCtnscWTmrPCuZBS9MO/gUmBJyXPqQLLLdJKb@lists.infradead.org X-Gm-Message-State: AOJu0Yyzje+pa3JwdDwgePSCImtG7yQ8rXW3gHo4QBwT+6LZnzErtJsj CnNZKTlh+cJY8XKLFWt7SBQAaBv0ip+DafzEKELz9iPsBdaOkxcslgK1xTkG3ah9kJ9ZJ2wtiQJ t X-Gm-Gg: ASbGnct35rkgxRJ9tkR/azFvDWPkMpvMBEwb3SLX+/GVXo4MM7ODvfJv/2Uxd8+sA3O BYJS6/D+oG78I3fzfZEwz+XzA81Q4Xq+Hgl1R3U+FetGZTF1acroJl6biYuFdUSiUB5dQUCE/x0 spg4xCHxW19M54gTtPBLdmDQzQGqynZT4nAXi5LZJ25h9FT9FZD+6vDyqYK/f2TM6qypiOhaj4E 56FXleEWpsd98btN4JPBBAMgEm0Q7A3vytKk6OR/XkatTaVPIsansHnYg== X-Google-Smtp-Source: AGHT+IG89RNTzAe/9DbcvL6vbr1RIH/IF1uo8b6fNVKeWEEIDb5CO4Aje6k8AftMtkfUVUDJ7opmpQ== X-Received: by 2002:a5d:59a8:0:b0:385:f5c4:b30d with SMTP id ffacd0b85a97d-3888e0b882emr2286934f8f.39.1734101366915; Fri, 13 Dec 2024 06:49:26 -0800 (PST) Received: from linaro.org ([2a00:23c5:6829:901:dd7a:c2d:2b46:b1a9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-387824c50b7sm7196295f8f.57.2024.12.13.06.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 06:49:25 -0800 (PST) From: Mike Leach To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Cc: james.clark@linaro.org, mike.leach@linaro.org, suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com Subject: [PATCH v2 2/3] coresight: tmc: Update error logging in tmc common functions Date: Fri, 13 Dec 2024 14:49:18 +0000 Message-Id: <20241213144919.110642-3-mike.leach@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241213144919.110642-1-mike.leach@linaro.org> References: <20241213144919.110642-1-mike.leach@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_064928_661657_E1C8EB78 X-CRM114-Status: GOOD ( 14.94 ) 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: , 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 e9876252a789..1a9299adae93 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -34,25 +34,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; @@ -60,12 +71,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 2671926be62a..34513f07c3aa 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -259,7 +259,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 Dec 13 14:49:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13907282 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 DA781E7717D for ; Fri, 13 Dec 2024 14:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QqYUm1i7e1fblFqY9jJKn51mYoOB0b0xVEyAilyqTvk=; b=mKP1z08jwHjx3pA0/z3LeNsWew cmi01sgBEnu6EnPhFPMTTDG8Qi4IDibX5juPcL1GBkvLlRRSTGKQdnSwyEL7lHI7rNA4rstguBwi/ gloG8do3UvojqzieaP9PMdYpn9bCtaR30DJG6Nqz1rIZ0aIKWkyxiaSE6tnVbpHWVkkxkveCaDYE/ 9VURcgCIdzuoPTeqPJY1NcZAhIlcEqKIfd2DCGawBJf2R0LSrQu09MQbec9gknfkihjUSGJQtFqxk ilWVzeioh44P2EGFV/z6hRr8N96vAJnZypoBoC8EyuZ7PFZRVQoU6zZBjbQEoh9mkLtG0DfXlgrjQ opTRqe+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tM737-00000004AIE-1IND; Fri, 13 Dec 2024 14:53:49 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tM6yv-000000049Cr-31rT for linux-arm-kernel@lists.infradead.org; Fri, 13 Dec 2024 14:49:30 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-38632b8ae71so1340812f8f.0 for ; Fri, 13 Dec 2024 06:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734101368; x=1734706168; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QqYUm1i7e1fblFqY9jJKn51mYoOB0b0xVEyAilyqTvk=; b=y2ozYIWydS2nhd58OsmrxgjUlrcZdL4a5LzzoVVZ+hGioitXXhwWjMhYkYRW4kCgdk hEZsfSVwAtYRdHw4a9IyzgoGpDr8OLokknwM2GN8fFmx0ELk3xXtt/LK1XZ+yCFYj7xg apQ8wlRglTGs/T4EmCJbfdJjL5f/YheUeTipTLHNXNVJWTKWTnEzNwgRuSwFeBag3h+V /yH2de8cWokNpHGpCUIw8E9+VWjqHo2l7Acads2cfRPsDRm/PgQVnxNLNFjno/XDSYc0 Q2z6O7NhnTr3MRiGguSh8aUDo8oHZs/wcZvnsgM3b92RrcmpqSke9EnSDqYtE5MFOHnm WcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734101368; x=1734706168; h=content-transfer-encoding:mime-version: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=QqYUm1i7e1fblFqY9jJKn51mYoOB0b0xVEyAilyqTvk=; b=vB8DsQbLyMqkPnonHM0f1vZbmLc6U3wpNWmCYkiqTkZtSoMGUzWvtx+X3EuywAkwwi 1ZAsolKxPRa0dvMrYo6KTPSfofyvJDr/qTJl/ETmDRexQ0ZItOaNygNV3SjDaux45wXI yBdCSjxzSaL6xxYgStMTO0WKkQT5IUAYLAkQpBJ0NgDC6LWh3YUcKSdHrXmzRo39oZgY xdHUyU9fLakpJY+4PoZnOx99iziq2UMWBtnzwSdv3uf0Sf6kYbIxwtAtRjVRrUFlUZOg on19QK6EoSJP8MiBSdVPN5J6wxvnDQ8hzycacjSt0XkPQwCeJKPgqlSF7OCzsBvI/Ark k6pA== X-Forwarded-Encrypted: i=1; AJvYcCVzzz/WLqsGBLCWC4KaGZ9kEMovvVvkp8GMJtg3nJWD1rGpfhFYHgycpGSH9R2X8Z3PPKKO6ZJ92hEQFGSwpZbG@lists.infradead.org X-Gm-Message-State: AOJu0YwJ9S20b/e4yJFPnA3ifYy2hNcqEXr+gD/Vvm48B0u1qAG7t51m ELyWdYDMqyywCwhDc4mzlDRfKFTZDqcC8PxEGDN6rhnCDBiZ+QNOF+iIlyop167cN7HptCZbuWC J X-Gm-Gg: ASbGnctssx6hd7HYB+oP2lM1bdUpazFp9hkEFElswqrRcV0MKEwt3qfNjRTSxGRJ+mE LKTmd/YiTfjfVi40APVfuvBJYotp/74B4JsGK95zMm49sJ0jDocc3OQj+frb1KgsfQLqWlsGhO0 ppwyQdN9+xeOaAfzpUDgl9TQmfsxgvdMz2M9tSrIQqIUDL7iMmr9hv3xuRIEzWX2fZzkgzz23Hu FpTB/KobYDRo0HGatzYFlH6Z5/qUnY3sosVuCUxkOb2ruTbapp+fbD+qw== X-Google-Smtp-Source: AGHT+IFDVH3ne6sNymKAo1QgYJon0YdqlPVHMjDohMOhYt3kQjiXEykwiHRGKr2ebn9u641ZWv+SCw== X-Received: by 2002:a05:6000:3cd:b0:385:df5d:622c with SMTP id ffacd0b85a97d-38880adb0b3mr2087916f8f.30.1734101367931; Fri, 13 Dec 2024 06:49:27 -0800 (PST) Received: from linaro.org ([2a00:23c5:6829:901:dd7a:c2d:2b46:b1a9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-387824c50b7sm7196295f8f.57.2024.12.13.06.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 06:49:27 -0800 (PST) From: Mike Leach To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Cc: james.clark@linaro.org, mike.leach@linaro.org, suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com Subject: [PATCH v2 3/3] coresight: etf: etr: Update logging around flush_and_stop() errors Date: Fri, 13 Dec 2024 14:49:19 +0000 Message-Id: <20241213144919.110642-4-mike.leach@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241213144919.110642-1-mike.leach@linaro.org> References: <20241213144919.110642-1-mike.leach@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_064929_761691_6213AB89 X-CRM114-Status: GOOD ( 10.99 ) 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: , 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 d4f641cd9de6..62b4b685c1a1 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); @@ -496,7 +500,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 a48bb85d0e7f..122a067d1bb8 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1139,7 +1139,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. @@ -1578,7 +1580,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);