All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] coresight: tmc error handling and misc fixes
@ 2019-07-24 11:43 Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-24 11:43 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: coresight, mathieu.poirier, Suzuki K Poulose

This series is a collection of fixes and cleanups I gathered from trying
to get coresight up on a new platform.

The TMC-ETR reports MemErr in the status register if there was an error
in in the AXI transaction. So far we have ignored it and assumed that we
are running on perfect platforms. Let us add the support for handling
the MemErr reports and discard the buffer in such case. Also verify that
the ETR can do non-secure transactions on the platform at probe time,
in order to avoid presenting the user with a non-useable ETR.

Suzuki K Poulose (5):
  coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute
  coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings
  coresight: etr_buf: Consolidate refcount initialization
  coresight: tmc-etr: Handle memory errors
  coresight: tmc-etr: Check if non-secure access is enabled

 .../hwtracing/coresight/coresight-etm-perf.c  |  1 +
 .../hwtracing/coresight/coresight-funnel.c    |  2 +-
 .../hwtracing/coresight/coresight-tmc-etr.c   | 26 +++++++++++--------
 drivers/hwtracing/coresight/coresight-tmc.c   | 12 +++++++++
 drivers/hwtracing/coresight/coresight-tmc.h   |  4 +++
 5 files changed, 33 insertions(+), 12 deletions(-)

-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute
  2019-07-24 11:43 [PATCH 0/5] coresight: tmc error handling and misc fixes Suzuki K Poulose
@ 2019-07-24 11:43 ` Suzuki K Poulose
  2019-07-29 16:27   ` Mathieu Poirier
  2019-07-24 11:43 ` [PATCH 2/5] coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings Suzuki K Poulose
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-24 11:43 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: coresight, mathieu.poirier, Suzuki K Poulose

While running the linux-nex with CONFIG_DEBUG_LOCKS_ALLOC enabled,
I get the following splat.

 BUG: key ffffcb5636929298 has not been registered!
 ------------[ cut here ]------------
 DEBUG_LOCKS_WARN_ON(1)
 WARNING: CPU: 1 PID: 53 at kernel/locking/lockdep.c:3669 lockdep_init_map+0x164/0x1f0
 CPU: 1 PID: 53 Comm: kworker/1:1 Tainted: G        W         5.2.0-next-20190712-00015-g00ad4634222e-dirty #603
 Workqueue: events amba_deferred_retry_func
 pstate: 60c00005 (nZCv daif +PAN +UAO)
 pc : lockdep_init_map+0x164/0x1f0
 lr : lockdep_init_map+0x164/0x1f0

 [ trimmed ]

 Call trace:
  lockdep_init_map+0x164/0x1f0
  __kernfs_create_file+0x9c/0x158
  sysfs_add_file_mode_ns+0xa8/0x1d0
  sysfs_add_file_to_group+0x88/0xd8
  etm_perf_add_symlink_sink+0xcc/0x138
  coresight_register+0x110/0x280
  tmc_probe+0x160/0x420

 [ trimmed ]

 ---[ end trace ab4cc669615ba1b0 ]---

Fix this by initialising the dynamically allocated attribute properly.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Fixes: bb8e370bdc141ddf ("coresight: perf: Add "sinks" group to PMU directory")
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 5c1ca0df5cb0..84f1dcb69827 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev)
 	/* See function coresight_get_sink_by_id() to know where this is used */
 	hash = hashlen_hash(hashlen_string(NULL, name));
 
+	sysfs_attr_init(&ea->attr.attr);
 	ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL);
 	if (!ea->attr.attr.name)
 		return -ENOMEM;
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings
  2019-07-24 11:43 [PATCH 0/5] coresight: tmc error handling and misc fixes Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
@ 2019-07-24 11:43 ` Suzuki K Poulose
  2019-07-29 17:00   ` Mathieu Poirier
  2019-07-24 11:43 ` [PATCH 3/5] coresight: etr_buf: Consolidate refcount initialization Suzuki K Poulose
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-24 11:43 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: coresight, mathieu.poirier, Suzuki K Poulose

We warn the users of obsolete bindings in the DT for coresight funnel.
However we use pr_warn_once() which doesn't give a clue about which device
it is bound to. Let us use dev_warn_once() to give the context.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-funnel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
index fa97cb9ab4f9..84ca30f4e5ec 100644
--- a/drivers/hwtracing/coresight/coresight-funnel.c
+++ b/drivers/hwtracing/coresight/coresight-funnel.c
@@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
 
 	if (is_of_node(dev_fwnode(dev)) &&
 	    of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
-		pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
+		dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n");
 
 	desc.name = coresight_alloc_device_name(&funnel_devs, dev);
 	if (!desc.name)
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] coresight: etr_buf: Consolidate refcount initialization
  2019-07-24 11:43 [PATCH 0/5] coresight: tmc error handling and misc fixes Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 2/5] coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings Suzuki K Poulose
@ 2019-07-24 11:43 ` Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 4/5] coresight: tmc-etr: Handle memory errors Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 5/5] coresight: tmc-etr: Check if non-secure access is enabled Suzuki K Poulose
  4 siblings, 0 replies; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-24 11:43 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: coresight, mathieu.poirier, Suzuki K Poulose

We now use refcounts for the etr_buf users. Let us initialize it
while we allocate it.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc-etr.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 17006705287a..3116d1f28e66 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -871,6 +871,7 @@ static struct etr_buf *tmc_alloc_etr_buf(struct tmc_drvdata *drvdata,
 		return ERR_PTR(rc);
 	}
 
+	refcount_set(&etr_buf->refcount, 1);
 	dev_dbg(dev, "allocated buffer of size %ldKB in mode %d\n",
 		(unsigned long)size >> 10, etr_buf->mode);
 	return etr_buf;
@@ -1263,8 +1264,6 @@ get_perf_etr_buf_cpu_wide(struct tmc_drvdata *drvdata,
 	if (IS_ERR(etr_buf))
 		return etr_buf;
 
-	refcount_set(&etr_buf->refcount, 1);
-
 	/* Now that we have a buffer, add it to the IDR. */
 	mutex_lock(&drvdata->idr_mutex);
 	ret = idr_alloc(&drvdata->idr, etr_buf, pid, pid + 1, GFP_KERNEL);
@@ -1291,19 +1290,11 @@ get_perf_etr_buf_per_thread(struct tmc_drvdata *drvdata,
 			    struct perf_event *event, int nr_pages,
 			    void **pages, bool snapshot)
 {
-	struct etr_buf *etr_buf;
-
 	/*
 	 * In per-thread mode the etr_buf isn't shared, so just go ahead
 	 * with memory allocation.
 	 */
-	etr_buf = alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot);
-	if (IS_ERR(etr_buf))
-		goto out;
-
-	refcount_set(&etr_buf->refcount, 1);
-out:
-	return etr_buf;
+	return alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot);
 }
 
 static struct etr_buf *
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] coresight: tmc-etr: Handle memory errors
  2019-07-24 11:43 [PATCH 0/5] coresight: tmc error handling and misc fixes Suzuki K Poulose
                   ` (2 preceding siblings ...)
  2019-07-24 11:43 ` [PATCH 3/5] coresight: etr_buf: Consolidate refcount initialization Suzuki K Poulose
@ 2019-07-24 11:43 ` Suzuki K Poulose
  2019-07-24 11:43 ` [PATCH 5/5] coresight: tmc-etr: Check if non-secure access is enabled Suzuki K Poulose
  4 siblings, 0 replies; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-24 11:43 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: coresight, mathieu.poirier, Suzuki K Poulose

We have so far ignored the memory errors, assuming that we have perfect
hardware and driver ;-). Let us handle the memory errors reported by the
TMC ETR in status and truncate the buffer.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc-etr.c | 13 +++++++++++++
 drivers/hwtracing/coresight/coresight-tmc.h     |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 3116d1f28e66..2246c1e6744a 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -928,6 +928,19 @@ static void tmc_sync_etr_buf(struct tmc_drvdata *drvdata)
 	rrp = tmc_read_rrp(drvdata);
 	rwp = tmc_read_rwp(drvdata);
 	status = readl_relaxed(drvdata->base + TMC_STS);
+
+	/*
+	 * If there were memory errors in the session, truncate the
+	 * buffer.
+	 */
+	if (WARN_ON_ONCE(status & TMC_STS_MEMERR)) {
+		dev_dbg(&drvdata->csdev->dev,
+			"tmc memory error detected, truncating buffer\n");
+		etr_buf->len = 0;
+		etr_buf->full = 0;
+		return;
+	}
+
 	etr_buf->full = status & TMC_STS_FULL;
 
 	WARN_ON(!etr_buf->ops || !etr_buf->ops->sync);
diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h
index 1ed50411cc3c..95d2e2747970 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.h
+++ b/drivers/hwtracing/coresight/coresight-tmc.h
@@ -47,6 +47,7 @@
 #define TMC_STS_TMCREADY_BIT	2
 #define TMC_STS_FULL		BIT(0)
 #define TMC_STS_TRIGGERED	BIT(1)
+#define TMC_STS_MEMERR		BIT(5)
 /*
  * TMC_AXICTL - 0x110
  *
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/5] coresight: tmc-etr: Check if non-secure access is enabled
  2019-07-24 11:43 [PATCH 0/5] coresight: tmc error handling and misc fixes Suzuki K Poulose
                   ` (3 preceding siblings ...)
  2019-07-24 11:43 ` [PATCH 4/5] coresight: tmc-etr: Handle memory errors Suzuki K Poulose
@ 2019-07-24 11:43 ` Suzuki K Poulose
  2019-07-29 19:49   ` Mathieu Poirier
  4 siblings, 1 reply; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-24 11:43 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: coresight, mathieu.poirier, Suzuki K Poulose

CoreSight TMC-ETR must have the non-secure invasive debug access
enabled for use by self-hosted tracing. Without it, there is no
point in enabling the ETR. So, let us check it in the TMC_AUTHSTATUS
register and fail the probe if it is disabled.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc.c | 12 ++++++++++++
 drivers/hwtracing/coresight/coresight-tmc.h |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index be37aff573b4..3055bf8e2236 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -236,6 +236,7 @@ coresight_tmc_reg(ffcr, TMC_FFCR);
 coresight_tmc_reg(mode, TMC_MODE);
 coresight_tmc_reg(pscr, TMC_PSCR);
 coresight_tmc_reg(axictl, TMC_AXICTL);
+coresight_tmc_reg(authstatus, TMC_AUTHSTATUS);
 coresight_tmc_reg(devid, CORESIGHT_DEVID);
 coresight_tmc_reg64(rrp, TMC_RRP, TMC_RRPHI);
 coresight_tmc_reg64(rwp, TMC_RWP, TMC_RWPHI);
@@ -255,6 +256,7 @@ static struct attribute *coresight_tmc_mgmt_attrs[] = {
 	&dev_attr_devid.attr,
 	&dev_attr_dba.attr,
 	&dev_attr_axictl.attr,
+	&dev_attr_authstatus.attr,
 	NULL,
 };
 
@@ -342,6 +344,13 @@ static inline bool tmc_etr_can_use_sg(struct device *dev)
 	return fwnode_property_present(dev->fwnode, "arm,scatter-gather");
 }
 
+static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata)
+{
+	u32 auth = readl_relaxed(drvdata->base + TMC_AUTHSTATUS);
+
+	return (auth & TMC_AUTH_NSID_MASK) == 0x3;
+}
+
 /* Detect and initialise the capabilities of a TMC ETR */
 static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps)
 {
@@ -349,6 +358,9 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps)
 	u32 dma_mask = 0;
 	struct tmc_drvdata *drvdata = dev_get_drvdata(parent);
 
+	if (!tmc_etr_has_non_secure_access(drvdata))
+		return -EACCES;
+
 	/* Set the unadvertised capabilities */
 	tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps);
 
diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h
index 95d2e2747970..4c59f2a4ad0e 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.h
+++ b/drivers/hwtracing/coresight/coresight-tmc.h
@@ -39,6 +39,7 @@
 #define TMC_ITATBCTR2		0xef0
 #define TMC_ITATBCTR1		0xef4
 #define TMC_ITATBCTR0		0xef8
+#define TMC_AUTHSTATUS		0xfb8
 
 /* register description */
 /* TMC_CTL - 0x020 */
@@ -90,6 +91,8 @@
 #define TMC_DEVID_AXIAW_SHIFT	17
 #define TMC_DEVID_AXIAW_MASK	0x7f
 
+#define TMC_AUTH_NSID_MASK	GENMASK(1, 0)
+
 enum tmc_config_type {
 	TMC_CONFIG_TYPE_ETB,
 	TMC_CONFIG_TYPE_ETR,
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute
  2019-07-24 11:43 ` [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
@ 2019-07-29 16:27   ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2019-07-29 16:27 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: coresight, linux-arm-kernel

Hi Suzuki,

On Wed, Jul 24, 2019 at 12:43:08PM +0100, Suzuki K Poulose wrote:
> While running the linux-nex with CONFIG_DEBUG_LOCKS_ALLOC enabled,
> I get the following splat.
> 
>  BUG: key ffffcb5636929298 has not been registered!
>  ------------[ cut here ]------------
>  DEBUG_LOCKS_WARN_ON(1)
>  WARNING: CPU: 1 PID: 53 at kernel/locking/lockdep.c:3669 lockdep_init_map+0x164/0x1f0
>  CPU: 1 PID: 53 Comm: kworker/1:1 Tainted: G        W         5.2.0-next-20190712-00015-g00ad4634222e-dirty #603
>  Workqueue: events amba_deferred_retry_func
>  pstate: 60c00005 (nZCv daif +PAN +UAO)
>  pc : lockdep_init_map+0x164/0x1f0
>  lr : lockdep_init_map+0x164/0x1f0
> 
>  [ trimmed ]
> 
>  Call trace:
>   lockdep_init_map+0x164/0x1f0
>   __kernfs_create_file+0x9c/0x158
>   sysfs_add_file_mode_ns+0xa8/0x1d0
>   sysfs_add_file_to_group+0x88/0xd8
>   etm_perf_add_symlink_sink+0xcc/0x138
>   coresight_register+0x110/0x280
>   tmc_probe+0x160/0x420
> 
>  [ trimmed ]
> 
>  ---[ end trace ab4cc669615ba1b0 ]---
> 
> Fix this by initialising the dynamically allocated attribute properly.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Fixes: bb8e370bdc141ddf ("coresight: perf: Add "sinks" group to PMU directory")
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etm-perf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
> index 5c1ca0df5cb0..84f1dcb69827 100644
> --- a/drivers/hwtracing/coresight/coresight-etm-perf.c
> +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
> @@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev)
>  	/* See function coresight_get_sink_by_id() to know where this is used */
>  	hash = hashlen_hash(hashlen_string(NULL, name));
>  
> +	sysfs_attr_init(&ea->attr.attr);
>  	ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL);
>  	if (!ea->attr.attr.name)
>  		return -ENOMEM;

I've picked this up and marked it for stable.

Thanks,
Mathieu

> -- 
> 2.21.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings
  2019-07-24 11:43 ` [PATCH 2/5] coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings Suzuki K Poulose
@ 2019-07-29 17:00   ` Mathieu Poirier
  2019-07-30  9:37       ` Suzuki K Poulose
  0 siblings, 1 reply; 13+ messages in thread
From: Mathieu Poirier @ 2019-07-29 17:00 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: coresight, linux-arm-kernel

On Wed, Jul 24, 2019 at 12:43:09PM +0100, Suzuki K Poulose wrote:
> We warn the users of obsolete bindings in the DT for coresight funnel.
> However we use pr_warn_once() which doesn't give a clue about which device
> it is bound to. Let us use dev_warn_once() to give the context.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-funnel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index fa97cb9ab4f9..84ca30f4e5ec 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
>  
>  	if (is_of_node(dev_fwnode(dev)) &&
>  	    of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
> -		pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
> +		dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n");

Please do the same for replicators.

Thanks,
Mathieu

>  
>  	desc.name = coresight_alloc_device_name(&funnel_devs, dev);
>  	if (!desc.name)
> -- 
> 2.21.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/5] coresight: tmc-etr: Check if non-secure access is enabled
  2019-07-24 11:43 ` [PATCH 5/5] coresight: tmc-etr: Check if non-secure access is enabled Suzuki K Poulose
@ 2019-07-29 19:49   ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2019-07-29 19:49 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: coresight, linux-arm-kernel

On Wed, Jul 24, 2019 at 12:43:12PM +0100, Suzuki K Poulose wrote:
> CoreSight TMC-ETR must have the non-secure invasive debug access
> enabled for use by self-hosted tracing. Without it, there is no
> point in enabling the ETR. So, let us check it in the TMC_AUTHSTATUS
> register and fail the probe if it is disabled.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-tmc.c | 12 ++++++++++++
>  drivers/hwtracing/coresight/coresight-tmc.h |  3 +++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
> index be37aff573b4..3055bf8e2236 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc.c
> @@ -236,6 +236,7 @@ coresight_tmc_reg(ffcr, TMC_FFCR);
>  coresight_tmc_reg(mode, TMC_MODE);
>  coresight_tmc_reg(pscr, TMC_PSCR);
>  coresight_tmc_reg(axictl, TMC_AXICTL);
> +coresight_tmc_reg(authstatus, TMC_AUTHSTATUS);
>  coresight_tmc_reg(devid, CORESIGHT_DEVID);
>  coresight_tmc_reg64(rrp, TMC_RRP, TMC_RRPHI);
>  coresight_tmc_reg64(rwp, TMC_RWP, TMC_RWPHI);
> @@ -255,6 +256,7 @@ static struct attribute *coresight_tmc_mgmt_attrs[] = {
>  	&dev_attr_devid.attr,
>  	&dev_attr_dba.attr,
>  	&dev_attr_axictl.attr,
> +	&dev_attr_authstatus.attr,
>  	NULL,
>  };
>  
> @@ -342,6 +344,13 @@ static inline bool tmc_etr_can_use_sg(struct device *dev)
>  	return fwnode_property_present(dev->fwnode, "arm,scatter-gather");
>  }
>  
> +static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata)
> +{
> +	u32 auth = readl_relaxed(drvdata->base + TMC_AUTHSTATUS);
> +
> +	return (auth & TMC_AUTH_NSID_MASK) == 0x3;
> +}
> +
>  /* Detect and initialise the capabilities of a TMC ETR */
>  static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps)
>  {
> @@ -349,6 +358,9 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps)
>  	u32 dma_mask = 0;
>  	struct tmc_drvdata *drvdata = dev_get_drvdata(parent);
>  
> +	if (!tmc_etr_has_non_secure_access(drvdata))
> +		return -EACCES;
> +
>  	/* Set the unadvertised capabilities */
>  	tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps);
>  
> diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h
> index 95d2e2747970..4c59f2a4ad0e 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc.h
> +++ b/drivers/hwtracing/coresight/coresight-tmc.h
> @@ -39,6 +39,7 @@
>  #define TMC_ITATBCTR2		0xef0
>  #define TMC_ITATBCTR1		0xef4
>  #define TMC_ITATBCTR0		0xef8
> +#define TMC_AUTHSTATUS		0xfb8
>  
>  /* register description */
>  /* TMC_CTL - 0x020 */
> @@ -90,6 +91,8 @@
>  #define TMC_DEVID_AXIAW_SHIFT	17
>  #define TMC_DEVID_AXIAW_MASK	0x7f
>  
> +#define TMC_AUTH_NSID_MASK	GENMASK(1, 0)
> +
>  enum tmc_config_type {
>  	TMC_CONFIG_TYPE_ETB,
>  	TMC_CONFIG_TYPE_ETR,

I have also picked-up patches 3-5.

Thanks,
Mathieu

> -- 
> 2.21.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/5] [UPDATED] coresight: Convert pr_warn to dev_warn for obsolete bindings
  2019-07-29 17:00   ` Mathieu Poirier
@ 2019-07-30  9:37       ` Suzuki K Poulose
  0 siblings, 0 replies; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-30  9:37 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, mathieu.poirier, Suzuki K Poulose

We warn the users of obsolete bindings in the DT for coresight replicator
and funnel drivers. However we use pr_warn_once() which doesn't give a clue
about which device it is bound to. Let us use dev_warn_once() to give the
context.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---

Changes since previous version:
 - Update replicator driver too.
---
 drivers/hwtracing/coresight/coresight-funnel.c     | 2 +-
 drivers/hwtracing/coresight/coresight-replicator.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
index fa97cb9ab4f9..84ca30f4e5ec 100644
--- a/drivers/hwtracing/coresight/coresight-funnel.c
+++ b/drivers/hwtracing/coresight/coresight-funnel.c
@@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
 
 	if (is_of_node(dev_fwnode(dev)) &&
 	    of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
-		pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
+		dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n");
 
 	desc.name = coresight_alloc_device_name(&funnel_devs, dev);
 	if (!desc.name)
diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index b7d6d59d56db..b29ba640eb25 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -184,7 +184,8 @@ static int replicator_probe(struct device *dev, struct resource *res)
 
 	if (is_of_node(dev_fwnode(dev)) &&
 	    of_device_is_compatible(dev->of_node, "arm,coresight-replicator"))
-		pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n");
+		dev_warn_once(dev,
+			      "Uses OBSOLETE CoreSight replicator binding\n");
 
 	desc.name = coresight_alloc_device_name(&replicator_devs, dev);
 	if (!desc.name)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] [UPDATED] coresight: Convert pr_warn to dev_warn for obsolete bindings
@ 2019-07-30  9:37       ` Suzuki K Poulose
  0 siblings, 0 replies; 13+ messages in thread
From: Suzuki K Poulose @ 2019-07-30  9:37 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, mathieu.poirier, Suzuki K Poulose

We warn the users of obsolete bindings in the DT for coresight replicator
and funnel drivers. However we use pr_warn_once() which doesn't give a clue
about which device it is bound to. Let us use dev_warn_once() to give the
context.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---

Changes since previous version:
 - Update replicator driver too.
---
 drivers/hwtracing/coresight/coresight-funnel.c     | 2 +-
 drivers/hwtracing/coresight/coresight-replicator.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
index fa97cb9ab4f9..84ca30f4e5ec 100644
--- a/drivers/hwtracing/coresight/coresight-funnel.c
+++ b/drivers/hwtracing/coresight/coresight-funnel.c
@@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
 
 	if (is_of_node(dev_fwnode(dev)) &&
 	    of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
-		pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
+		dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n");
 
 	desc.name = coresight_alloc_device_name(&funnel_devs, dev);
 	if (!desc.name)
diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index b7d6d59d56db..b29ba640eb25 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -184,7 +184,8 @@ static int replicator_probe(struct device *dev, struct resource *res)
 
 	if (is_of_node(dev_fwnode(dev)) &&
 	    of_device_is_compatible(dev->of_node, "arm,coresight-replicator"))
-		pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n");
+		dev_warn_once(dev,
+			      "Uses OBSOLETE CoreSight replicator binding\n");
 
 	desc.name = coresight_alloc_device_name(&replicator_devs, dev);
 	if (!desc.name)
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] [UPDATED] coresight: Convert pr_warn to dev_warn for obsolete bindings
  2019-07-30  9:37       ` Suzuki K Poulose
@ 2019-07-30 17:12         ` Mathieu Poirier
  -1 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2019-07-30 17:12 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: linux-arm-kernel, Linux Kernel Mailing List

On Tue, 30 Jul 2019 at 03:37, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>
> We warn the users of obsolete bindings in the DT for coresight replicator
> and funnel drivers. However we use pr_warn_once() which doesn't give a clue
> about which device it is bound to. Let us use dev_warn_once() to give the
> context.
>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>
> Changes since previous version:
>  - Update replicator driver too.
> ---
>  drivers/hwtracing/coresight/coresight-funnel.c     | 2 +-
>  drivers/hwtracing/coresight/coresight-replicator.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index fa97cb9ab4f9..84ca30f4e5ec 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
>
>         if (is_of_node(dev_fwnode(dev)) &&
>             of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
> -               pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
> +               dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n");
>
>         desc.name = coresight_alloc_device_name(&funnel_devs, dev);
>         if (!desc.name)
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index b7d6d59d56db..b29ba640eb25 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -184,7 +184,8 @@ static int replicator_probe(struct device *dev, struct resource *res)
>
>         if (is_of_node(dev_fwnode(dev)) &&
>             of_device_is_compatible(dev->of_node, "arm,coresight-replicator"))
> -               pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n");
> +               dev_warn_once(dev,
> +                             "Uses OBSOLETE CoreSight replicator binding\n");

Applied - thanks
Mathieu

>
>         desc.name = coresight_alloc_device_name(&replicator_devs, dev);
>         if (!desc.name)
> --
> 2.21.0
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] [UPDATED] coresight: Convert pr_warn to dev_warn for obsolete bindings
@ 2019-07-30 17:12         ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2019-07-30 17:12 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: Linux Kernel Mailing List, linux-arm-kernel

On Tue, 30 Jul 2019 at 03:37, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>
> We warn the users of obsolete bindings in the DT for coresight replicator
> and funnel drivers. However we use pr_warn_once() which doesn't give a clue
> about which device it is bound to. Let us use dev_warn_once() to give the
> context.
>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>
> Changes since previous version:
>  - Update replicator driver too.
> ---
>  drivers/hwtracing/coresight/coresight-funnel.c     | 2 +-
>  drivers/hwtracing/coresight/coresight-replicator.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index fa97cb9ab4f9..84ca30f4e5ec 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
>
>         if (is_of_node(dev_fwnode(dev)) &&
>             of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
> -               pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
> +               dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n");
>
>         desc.name = coresight_alloc_device_name(&funnel_devs, dev);
>         if (!desc.name)
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index b7d6d59d56db..b29ba640eb25 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -184,7 +184,8 @@ static int replicator_probe(struct device *dev, struct resource *res)
>
>         if (is_of_node(dev_fwnode(dev)) &&
>             of_device_is_compatible(dev->of_node, "arm,coresight-replicator"))
> -               pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n");
> +               dev_warn_once(dev,
> +                             "Uses OBSOLETE CoreSight replicator binding\n");

Applied - thanks
Mathieu

>
>         desc.name = coresight_alloc_device_name(&replicator_devs, dev);
>         if (!desc.name)
> --
> 2.21.0
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-07-30 17:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 11:43 [PATCH 0/5] coresight: tmc error handling and misc fixes Suzuki K Poulose
2019-07-24 11:43 ` [PATCH 1/5] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
2019-07-29 16:27   ` Mathieu Poirier
2019-07-24 11:43 ` [PATCH 2/5] coresight: funnel: Convert pr_warn to dev_warn for obsolete bindings Suzuki K Poulose
2019-07-29 17:00   ` Mathieu Poirier
2019-07-30  9:37     ` [PATCH 2/5] [UPDATED] coresight: " Suzuki K Poulose
2019-07-30  9:37       ` Suzuki K Poulose
2019-07-30 17:12       ` Mathieu Poirier
2019-07-30 17:12         ` Mathieu Poirier
2019-07-24 11:43 ` [PATCH 3/5] coresight: etr_buf: Consolidate refcount initialization Suzuki K Poulose
2019-07-24 11:43 ` [PATCH 4/5] coresight: tmc-etr: Handle memory errors Suzuki K Poulose
2019-07-24 11:43 ` [PATCH 5/5] coresight: tmc-etr: Check if non-secure access is enabled Suzuki K Poulose
2019-07-29 19:49   ` Mathieu Poirier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.