* [PATCH 00/10] coresight: next v4.2-rc4
@ 2015-07-31 15:37 Mathieu Poirier
2015-07-31 15:37 ` [PATCH 01/10] coresight: binding for ETMv4 coresight drivers Mathieu Poirier
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
Good day Greg,
Those are the latest coresight enhancement for the 4.3 cycle. Please consider
for inclusion.
Thanks,
Mathieu
Chunyan Zhang (5):
coresight-etm3x: Change the name of the ctxid_val to ctxid_pid
coresight-etm4x: Change the name of the ctxid_val to ctxid_pid
Coresight: Add an interface for supporting ETM3/4 Context ID tracing
coresight-etm3x: Support context-ID tracing when PID namespace is
enabled
coresight-etm4x: Support context-ID tracing when PID namespace is
enabled
Ivan T. Ivanov (1):
coresight-etm3x: Add Qualcomm PTM v1.1 peripheral ID
Mark Brown (1):
coresight: Fix implicit inclusion of linux/sched.h
Masanari Iida (1):
Doc: trace: Fix typo in coresight.txt
Mathieu Poirier (1):
coresight: binding for ETMv4 coresight drivers
Vaishali Thakkar (1):
coresight: replicator: Use builtin_platform_driver()
.../ABI/testing/sysfs-bus-coresight-devices-etm3x | 2 +-
.../ABI/testing/sysfs-bus-coresight-devices-etm4x | 2 +-
.../devicetree/bindings/arm/coresight.txt | 1 +
Documentation/trace/coresight.txt | 4 +--
drivers/hwtracing/coresight/coresight-etm.h | 7 ++--
drivers/hwtracing/coresight/coresight-etm3x.c | 33 ++++++++++++-------
drivers/hwtracing/coresight/coresight-etm4x.c | 37 ++++++++++++++--------
drivers/hwtracing/coresight/coresight-etm4x.h | 7 ++--
drivers/hwtracing/coresight/coresight-replicator.c | 13 +-------
include/linux/coresight.h | 21 ++++++++++++
10 files changed, 82 insertions(+), 45 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 01/10] coresight: binding for ETMv4 coresight drivers
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 02/10] coresight-etm3x: Add Qualcomm PTM v1.1 peripheral ID Mathieu Poirier
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
Adding compatible string for new coresight ETMv4 tracer.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
Documentation/devicetree/bindings/arm/coresight.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt
index 65a6db2271a2..62938eb9697f 100644
--- a/Documentation/devicetree/bindings/arm/coresight.txt
+++ b/Documentation/devicetree/bindings/arm/coresight.txt
@@ -17,6 +17,7 @@ its hardware characteristcs.
- "arm,coresight-tmc", "arm,primecell";
- "arm,coresight-funnel", "arm,primecell";
- "arm,coresight-etm3x", "arm,primecell";
+ - "arm,coresight-etm4x", "arm,primecell";
- "qcom,coresight-replicator1x", "arm,primecell";
* reg: physical base address and length of the register
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 02/10] coresight-etm3x: Add Qualcomm PTM v1.1 peripheral ID
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
2015-07-31 15:37 ` [PATCH 01/10] coresight: binding for ETMv4 coresight drivers Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 03/10] coresight: replicator: Use builtin_platform_driver() Mathieu Poirier
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: "Ivan T. Ivanov" <ivan.ivanov@linaro.org>
Add Qualcomm's PTM v1.1 peripheral ID to supported devices.
This device could be found at least in MSM8974 and APQ8064
chipsets.
Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/hwtracing/coresight/coresight-etm3x.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
index 018a00fda611..cca98a8b2527 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x.c
@@ -1912,6 +1912,11 @@ static struct amba_id etm_ids[] = {
.mask = 0x0003ffff,
.data = "PTM 1.1",
},
+ { /* PTM 1.1 Qualcomm */
+ .id = 0x0003006f,
+ .mask = 0x0003ffff,
+ .data = "PTM 1.1",
+ },
{ 0, 0},
};
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 03/10] coresight: replicator: Use builtin_platform_driver()
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
2015-07-31 15:37 ` [PATCH 01/10] coresight: binding for ETMv4 coresight drivers Mathieu Poirier
2015-07-31 15:37 ` [PATCH 02/10] coresight-etm3x: Add Qualcomm PTM v1.1 peripheral ID Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 04/10] coresight-etm3x: Change the name of the ctxid_val to ctxid_pid Mathieu Poirier
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Vaishali Thakkar <vthakkar1994@gmail.com>
Macro builtin_platform_driver can be used for builtin drivers
that don't do anything in driver init. This file depends on
Kconfig CONFIG_CORESIGHT_LINKS_AND_SINKS which eventually
depends on CORESIGHT. Both CONFIG_CORESIGHT_LINKS_AND_SINKS and
CORESIGHT are bool. So, use builtin_platform_driver and remove
some boilerplate code.
Also, remove header file init.h as functionality like module_init
and module_exit is now relocated to module.h.
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Suggested-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/hwtracing/coresight/coresight-replicator.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index 7974b7c3da6b..963ac197c253 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -12,7 +12,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/init.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/io.h>
@@ -184,17 +183,7 @@ static struct platform_driver replicator_driver = {
},
};
-static int __init replicator_init(void)
-{
- return platform_driver_register(&replicator_driver);
-}
-module_init(replicator_init);
-
-static void __exit replicator_exit(void)
-{
- platform_driver_unregister(&replicator_driver);
-}
-module_exit(replicator_exit);
+builtin_platform_driver(replicator_driver);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("CoreSight Replicator driver");
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 04/10] coresight-etm3x: Change the name of the ctxid_val to ctxid_pid
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (2 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 03/10] coresight: replicator: Use builtin_platform_driver() Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 05/10] coresight-etm4x: " Mathieu Poirier
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Chunyan Zhang <zhang.chunyan@linaro.org>
'ctxid_val' array was used to store the value of ETM context ID comparator
which actually stores the process ID to be traced, so using 'ctxid_pid' as
its name instead make it easier to understand.
This patch also changes the ABI, it is normally not allowed, but
fortunately it is a testing ABI and very new for now. Nevertheless,
if you don't think it should be changed, we could always add an alias
for userspace.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
.../ABI/testing/sysfs-bus-coresight-devices-etm3x | 2 +-
drivers/hwtracing/coresight/coresight-etm.h | 4 ++--
drivers/hwtracing/coresight/coresight-etm3x.c | 16 ++++++++--------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm3x b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm3x
index b4d0b99afffb..d72ca1736ba4 100644
--- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm3x
+++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm3x
@@ -112,7 +112,7 @@ KernelVersion: 3.19
Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
Description: (RW) Mask to apply to all the context ID comparator.
-What: /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/ctxid_val
+What: /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/ctxid_pid
Date: November 2014
KernelVersion: 3.19
Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
diff --git a/drivers/hwtracing/coresight/coresight-etm.h b/drivers/hwtracing/coresight/coresight-etm.h
index 098ffbec0a44..52af5f0adbed 100644
--- a/drivers/hwtracing/coresight/coresight-etm.h
+++ b/drivers/hwtracing/coresight/coresight-etm.h
@@ -183,7 +183,7 @@
* @seq_13_event: event causing the transition from 1 to 3.
* @seq_curr_state: current value of the sequencer register.
* @ctxid_idx: index for the context ID registers.
- * @ctxid_val: value for the context ID to trigger on.
+ * @ctxid_pid: value for the context ID to trigger on.
* @ctxid_mask: mask applicable to all the context IDs.
* @sync_freq: Synchronisation frequency.
* @timestamp_event: Defines an event that requests the insertion
@@ -235,7 +235,7 @@ struct etm_drvdata {
u32 seq_13_event;
u32 seq_curr_state;
u8 ctxid_idx;
- u32 ctxid_val[ETM_MAX_CTXID_CMP];
+ u32 ctxid_pid[ETM_MAX_CTXID_CMP];
u32 ctxid_mask;
u32 sync_freq;
u32 timestamp_event;
diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
index cca98a8b2527..361b82068dda 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x.c
@@ -238,7 +238,7 @@ static void etm_set_default(struct etm_drvdata *drvdata)
drvdata->seq_curr_state = 0x0;
drvdata->ctxid_idx = 0x0;
for (i = 0; i < drvdata->nr_ctxid_cmp; i++)
- drvdata->ctxid_val[i] = 0x0;
+ drvdata->ctxid_pid[i] = 0x0;
drvdata->ctxid_mask = 0x0;
}
@@ -289,7 +289,7 @@ static void etm_enable_hw(void *info)
for (i = 0; i < drvdata->nr_ext_out; i++)
etm_writel(drvdata, ETM_DEFAULT_EVENT_VAL, ETMEXTOUTEVRn(i));
for (i = 0; i < drvdata->nr_ctxid_cmp; i++)
- etm_writel(drvdata, drvdata->ctxid_val[i], ETMCIDCVRn(i));
+ etm_writel(drvdata, drvdata->ctxid_pid[i], ETMCIDCVRn(i));
etm_writel(drvdata, drvdata->ctxid_mask, ETMCIDCMR);
etm_writel(drvdata, drvdata->sync_freq, ETMSYNCFR);
/* No external input selected */
@@ -1386,20 +1386,20 @@ static ssize_t ctxid_idx_store(struct device *dev,
}
static DEVICE_ATTR_RW(ctxid_idx);
-static ssize_t ctxid_val_show(struct device *dev,
+static ssize_t ctxid_pid_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
unsigned long val;
struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
spin_lock(&drvdata->spinlock);
- val = drvdata->ctxid_val[drvdata->ctxid_idx];
+ val = drvdata->ctxid_pid[drvdata->ctxid_idx];
spin_unlock(&drvdata->spinlock);
return sprintf(buf, "%#lx\n", val);
}
-static ssize_t ctxid_val_store(struct device *dev,
+static ssize_t ctxid_pid_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
@@ -1412,12 +1412,12 @@ static ssize_t ctxid_val_store(struct device *dev,
return ret;
spin_lock(&drvdata->spinlock);
- drvdata->ctxid_val[drvdata->ctxid_idx] = val;
+ drvdata->ctxid_pid[drvdata->ctxid_idx] = val;
spin_unlock(&drvdata->spinlock);
return size;
}
-static DEVICE_ATTR_RW(ctxid_val);
+static DEVICE_ATTR_RW(ctxid_pid);
static ssize_t ctxid_mask_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -1609,7 +1609,7 @@ static struct attribute *coresight_etm_attrs[] = {
&dev_attr_seq_13_event.attr,
&dev_attr_seq_curr_state.attr,
&dev_attr_ctxid_idx.attr,
- &dev_attr_ctxid_val.attr,
+ &dev_attr_ctxid_pid.attr,
&dev_attr_ctxid_mask.attr,
&dev_attr_sync_freq.attr,
&dev_attr_timestamp_event.attr,
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 05/10] coresight-etm4x: Change the name of the ctxid_val to ctxid_pid
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (3 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 04/10] coresight-etm3x: Change the name of the ctxid_val to ctxid_pid Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Mathieu Poirier
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Chunyan Zhang <zhang.chunyan@linaro.org>
'ctxid_val' array was used to store the value of ETM context ID comparator
which actually stores the process ID to be traced, so using 'ctxid_pid' as
its name instead make it easier to understand.
This patch also changes the ABI, it is normally not allowed, but
fortunately it is a testing ABI and very new for now. Nevertheless,
if you don't think it should be changed, we could always add an alias
for userspace.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
.../ABI/testing/sysfs-bus-coresight-devices-etm4x | 2 +-
drivers/hwtracing/coresight/coresight-etm4x.c | 20 ++++++++++----------
drivers/hwtracing/coresight/coresight-etm4x.h | 4 ++--
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
index 2fe2e3dae487..2355ed8ae31f 100644
--- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
+++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
@@ -249,7 +249,7 @@ KernelVersion: 4.01
Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
Description: (RW) Select which context ID comparator to work with.
-What: /sys/bus/coresight/devices/<memory_map>.etm/ctxid_val
+What: /sys/bus/coresight/devices/<memory_map>.etm/ctxid_pid
Date: April 2015
KernelVersion: 4.01
Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index 1312e993c501..9afbda54b013 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -155,7 +155,7 @@ static void etm4_enable_hw(void *info)
drvdata->base + TRCACATRn(i));
}
for (i = 0; i < drvdata->numcidc; i++)
- writeq_relaxed(drvdata->ctxid_val[i],
+ writeq_relaxed(drvdata->ctxid_pid[i],
drvdata->base + TRCCIDCVRn(i));
writel_relaxed(drvdata->ctxid_mask0, drvdata->base + TRCCIDCCTLR0);
writel_relaxed(drvdata->ctxid_mask1, drvdata->base + TRCCIDCCTLR1);
@@ -507,7 +507,7 @@ static ssize_t reset_store(struct device *dev,
drvdata->ctxid_idx = 0x0;
for (i = 0; i < drvdata->numcidc; i++)
- drvdata->ctxid_val[i] = 0x0;
+ drvdata->ctxid_pid[i] = 0x0;
drvdata->ctxid_mask0 = 0x0;
drvdata->ctxid_mask1 = 0x0;
@@ -1815,7 +1815,7 @@ static ssize_t ctxid_idx_store(struct device *dev,
}
static DEVICE_ATTR_RW(ctxid_idx);
-static ssize_t ctxid_val_show(struct device *dev,
+static ssize_t ctxid_pid_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
@@ -1825,12 +1825,12 @@ static ssize_t ctxid_val_show(struct device *dev,
spin_lock(&drvdata->spinlock);
idx = drvdata->ctxid_idx;
- val = (unsigned long)drvdata->ctxid_val[idx];
+ val = (unsigned long)drvdata->ctxid_pid[idx];
spin_unlock(&drvdata->spinlock);
return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
}
-static ssize_t ctxid_val_store(struct device *dev,
+static ssize_t ctxid_pid_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
@@ -1850,11 +1850,11 @@ static ssize_t ctxid_val_store(struct device *dev,
spin_lock(&drvdata->spinlock);
idx = drvdata->ctxid_idx;
- drvdata->ctxid_val[idx] = (u64)val;
+ drvdata->ctxid_pid[idx] = (u64)val;
spin_unlock(&drvdata->spinlock);
return size;
}
-static DEVICE_ATTR_RW(ctxid_val);
+static DEVICE_ATTR_RW(ctxid_pid);
static ssize_t ctxid_masks_show(struct device *dev,
struct device_attribute *attr,
@@ -1949,7 +1949,7 @@ static ssize_t ctxid_masks_store(struct device *dev,
*/
for (j = 0; j < 8; j++) {
if (maskbyte & 1)
- drvdata->ctxid_val[i] &= ~(0xFF << (j * 8));
+ drvdata->ctxid_pid[i] &= ~(0xFF << (j * 8));
maskbyte >>= 1;
}
/* Select the next ctxid comparator mask value */
@@ -2193,7 +2193,7 @@ static struct attribute *coresight_etmv4_attrs[] = {
&dev_attr_res_idx.attr,
&dev_attr_res_ctrl.attr,
&dev_attr_ctxid_idx.attr,
- &dev_attr_ctxid_val.attr,
+ &dev_attr_ctxid_pid.attr,
&dev_attr_ctxid_masks.attr,
&dev_attr_vmid_idx.attr,
&dev_attr_vmid_val.attr,
@@ -2514,7 +2514,7 @@ static void etm4_init_default_data(struct etmv4_drvdata *drvdata)
}
for (i = 0; i < drvdata->numcidc; i++)
- drvdata->ctxid_val[i] = 0x0;
+ drvdata->ctxid_pid[i] = 0x0;
drvdata->ctxid_mask0 = 0x0;
drvdata->ctxid_mask1 = 0x0;
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
index e08e983dd2d9..1e8fb369daaf 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.h
+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
@@ -265,7 +265,7 @@
* @addr_type: Current status of the comparator register.
* @ctxid_idx: Context ID index selector.
* @ctxid_size: Size of the context ID field to consider.
- * @ctxid_val: Value of the context ID comparator.
+ * @ctxid_pid: Value of the context ID comparator.
* @ctxid_mask0:Context ID comparator mask for comparator 0-3.
* @ctxid_mask1:Context ID comparator mask for comparator 4-7.
* @vmid_idx: VM ID index selector.
@@ -352,7 +352,7 @@ struct etmv4_drvdata {
u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP];
u8 ctxid_idx;
u8 ctxid_size;
- u64 ctxid_val[ETMv4_MAX_CTXID_CMP];
+ u64 ctxid_pid[ETMv4_MAX_CTXID_CMP];
u32 ctxid_mask0;
u32 ctxid_mask1;
u8 vmid_idx;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (4 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 05/10] coresight-etm4x: " Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 07/10] coresight-etm3x: Support context-ID tracing when PID namespace is enabled Mathieu Poirier
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Chunyan Zhang <zhang.chunyan@linaro.org>
If PID namespace is enabled, everytime users configure the Context ID
register to trace the specific process, there needs to be a translation
between the real PID seen from the kernel and VPID seen from the
namespace in which the user's process resides .
This patch just adds the translation interface for ETMs.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
include/linux/coresight.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 3486b9082adb..626da6948ca2 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -248,4 +248,24 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data(
struct device *dev, struct device_node *node) { return NULL; }
#endif
+#ifdef CONFIG_PID_NS
+static inline unsigned long
+coresight_vpid_to_pid(unsigned long vpid)
+{
+ struct task_struct *task = NULL;
+ unsigned long pid = 0;
+
+ rcu_read_lock();
+ task = find_task_by_vpid(vpid);
+ if (task)
+ pid = task_pid_nr(task);
+ rcu_read_unlock();
+
+ return pid;
+}
+#else
+static inline unsigned long
+coresight_vpid_to_pid(unsigned long vpid) { return vpid; }
+#endif
+
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 07/10] coresight-etm3x: Support context-ID tracing when PID namespace is enabled
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (5 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 08/10] coresight-etm4x: " Mathieu Poirier
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Chunyan Zhang <zhang.chunyan@linaro.org>
The Coresight ETM drivers already support context-ID tracing, but it won't
work when PID namespace is enabled. This is because when using PID
namespace a process id (ie. VPID) seen from the current namespace differs
from the id (ie. PID) seen by kernel.
So when users write the process id seen by themselves to ETM, there needs
to be a translation from VPID to PID, as such ETM drivers will write the
PID into the Context ID register correctly.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/hwtracing/coresight/coresight-etm.h | 3 +++
drivers/hwtracing/coresight/coresight-etm3x.c | 16 +++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm.h b/drivers/hwtracing/coresight/coresight-etm.h
index 52af5f0adbed..b4481eb29304 100644
--- a/drivers/hwtracing/coresight/coresight-etm.h
+++ b/drivers/hwtracing/coresight/coresight-etm.h
@@ -184,6 +184,8 @@
* @seq_curr_state: current value of the sequencer register.
* @ctxid_idx: index for the context ID registers.
* @ctxid_pid: value for the context ID to trigger on.
+ * @ctxid_vpid: Virtual PID seen by users if PID namespace is enabled, otherwise
+ * the same value of ctxid_pid.
* @ctxid_mask: mask applicable to all the context IDs.
* @sync_freq: Synchronisation frequency.
* @timestamp_event: Defines an event that requests the insertion
@@ -236,6 +238,7 @@ struct etm_drvdata {
u32 seq_curr_state;
u8 ctxid_idx;
u32 ctxid_pid[ETM_MAX_CTXID_CMP];
+ u32 ctxid_vpid[ETM_MAX_CTXID_CMP];
u32 ctxid_mask;
u32 sync_freq;
u32 timestamp_event;
diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
index 361b82068dda..bf2476ed9356 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x.c
@@ -237,8 +237,11 @@ static void etm_set_default(struct etm_drvdata *drvdata)
drvdata->seq_curr_state = 0x0;
drvdata->ctxid_idx = 0x0;
- for (i = 0; i < drvdata->nr_ctxid_cmp; i++)
+ for (i = 0; i < drvdata->nr_ctxid_cmp; i++) {
drvdata->ctxid_pid[i] = 0x0;
+ drvdata->ctxid_vpid[i] = 0x0;
+ }
+
drvdata->ctxid_mask = 0x0;
}
@@ -1393,7 +1396,7 @@ static ssize_t ctxid_pid_show(struct device *dev,
struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
spin_lock(&drvdata->spinlock);
- val = drvdata->ctxid_pid[drvdata->ctxid_idx];
+ val = drvdata->ctxid_vpid[drvdata->ctxid_idx];
spin_unlock(&drvdata->spinlock);
return sprintf(buf, "%#lx\n", val);
@@ -1404,15 +1407,18 @@ static ssize_t ctxid_pid_store(struct device *dev,
const char *buf, size_t size)
{
int ret;
- unsigned long val;
+ unsigned long vpid, pid;
struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
- ret = kstrtoul(buf, 16, &val);
+ ret = kstrtoul(buf, 16, &vpid);
if (ret)
return ret;
+ pid = coresight_vpid_to_pid(vpid);
+
spin_lock(&drvdata->spinlock);
- drvdata->ctxid_pid[drvdata->ctxid_idx] = val;
+ drvdata->ctxid_pid[drvdata->ctxid_idx] = pid;
+ drvdata->ctxid_vpid[drvdata->ctxid_idx] = vpid;
spin_unlock(&drvdata->spinlock);
return size;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 08/10] coresight-etm4x: Support context-ID tracing when PID namespace is enabled
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (6 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 07/10] coresight-etm3x: Support context-ID tracing when PID namespace is enabled Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 09/10] Doc: trace: Fix typo in coresight.txt Mathieu Poirier
2015-07-31 15:37 ` [PATCH 10/10] coresight: Fix implicit inclusion of linux/sched.h Mathieu Poirier
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Chunyan Zhang <zhang.chunyan@linaro.org>
Like ETTv3, ETMv4 also needs the similar modifications to support Context
ID tracing when PID namespace is enabled.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/hwtracing/coresight/coresight-etm4x.c | 21 +++++++++++++++------
drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index 9afbda54b013..254a81a4e6f4 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -506,8 +506,11 @@ static ssize_t reset_store(struct device *dev,
}
drvdata->ctxid_idx = 0x0;
- for (i = 0; i < drvdata->numcidc; i++)
+ for (i = 0; i < drvdata->numcidc; i++) {
drvdata->ctxid_pid[i] = 0x0;
+ drvdata->ctxid_vpid[i] = 0x0;
+ }
+
drvdata->ctxid_mask0 = 0x0;
drvdata->ctxid_mask1 = 0x0;
@@ -1825,7 +1828,7 @@ static ssize_t ctxid_pid_show(struct device *dev,
spin_lock(&drvdata->spinlock);
idx = drvdata->ctxid_idx;
- val = (unsigned long)drvdata->ctxid_pid[idx];
+ val = (unsigned long)drvdata->ctxid_vpid[idx];
spin_unlock(&drvdata->spinlock);
return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
}
@@ -1835,7 +1838,7 @@ static ssize_t ctxid_pid_store(struct device *dev,
const char *buf, size_t size)
{
u8 idx;
- unsigned long val;
+ unsigned long vpid, pid;
struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
/*
@@ -1845,12 +1848,15 @@ static ssize_t ctxid_pid_store(struct device *dev,
*/
if (!drvdata->ctxid_size || !drvdata->numcidc)
return -EINVAL;
- if (kstrtoul(buf, 16, &val))
+ if (kstrtoul(buf, 16, &vpid))
return -EINVAL;
+ pid = coresight_vpid_to_pid(vpid);
+
spin_lock(&drvdata->spinlock);
idx = drvdata->ctxid_idx;
- drvdata->ctxid_pid[idx] = (u64)val;
+ drvdata->ctxid_pid[idx] = (u64)pid;
+ drvdata->ctxid_vpid[idx] = (u64)vpid;
spin_unlock(&drvdata->spinlock);
return size;
}
@@ -2513,8 +2519,11 @@ static void etm4_init_default_data(struct etmv4_drvdata *drvdata)
drvdata->addr_type[1] = ETM_ADDR_TYPE_RANGE;
}
- for (i = 0; i < drvdata->numcidc; i++)
+ for (i = 0; i < drvdata->numcidc; i++) {
drvdata->ctxid_pid[i] = 0x0;
+ drvdata->ctxid_vpid[i] = 0x0;
+ }
+
drvdata->ctxid_mask0 = 0x0;
drvdata->ctxid_mask1 = 0x0;
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
index 1e8fb369daaf..c34100205ca9 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.h
+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
@@ -266,6 +266,8 @@
* @ctxid_idx: Context ID index selector.
* @ctxid_size: Size of the context ID field to consider.
* @ctxid_pid: Value of the context ID comparator.
+ * @ctxid_vpid: Virtual PID seen by users if PID namespace is enabled, otherwise
+ * the same value of ctxid_pid.
* @ctxid_mask0:Context ID comparator mask for comparator 0-3.
* @ctxid_mask1:Context ID comparator mask for comparator 4-7.
* @vmid_idx: VM ID index selector.
@@ -353,6 +355,7 @@ struct etmv4_drvdata {
u8 ctxid_idx;
u8 ctxid_size;
u64 ctxid_pid[ETMv4_MAX_CTXID_CMP];
+ u64 ctxid_vpid[ETMv4_MAX_CTXID_CMP];
u32 ctxid_mask0;
u32 ctxid_mask1;
u8 vmid_idx;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 09/10] Doc: trace: Fix typo in coresight.txt
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (7 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 08/10] coresight-etm4x: " Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
2015-07-31 15:37 ` [PATCH 10/10] coresight: Fix implicit inclusion of linux/sched.h Mathieu Poirier
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Masanari Iida <standby24x7@gmail.com>
This patch fix spelling typos found in coresight.txt
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
Documentation/trace/coresight.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
index 77d14d51a670..0a5c3290e732 100644
--- a/Documentation/trace/coresight.txt
+++ b/Documentation/trace/coresight.txt
@@ -15,7 +15,7 @@ HW assisted tracing is becoming increasingly useful when dealing with systems
that have many SoCs and other components like GPU and DMA engines. ARM has
developed a HW assisted tracing solution by means of different components, each
being added to a design at synthesis time to cater to specific tracing needs.
-Compoments are generally categorised as source, link and sinks and are
+Components are generally categorised as source, link and sinks and are
(usually) discovered using the AMBA bus.
"Sources" generate a compressed stream representing the processor instruction
@@ -138,7 +138,7 @@ void coresight_unregister(struct coresight_device *csdev);
The registering function is taking a "struct coresight_device *csdev" and
register the device with the core framework. The unregister function takes
-a reference to a "strut coresight_device", obtained at registration time.
+a reference to a "struct coresight_device", obtained at registration time.
If everything goes well during the registration process the new devices will
show up under /sys/bus/coresight/devices, as showns here for a TC2 platform:
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 10/10] coresight: Fix implicit inclusion of linux/sched.h
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
` (8 preceding siblings ...)
2015-07-31 15:37 ` [PATCH 09/10] Doc: trace: Fix typo in coresight.txt Mathieu Poirier
@ 2015-07-31 15:37 ` Mathieu Poirier
9 siblings, 0 replies; 11+ messages in thread
From: Mathieu Poirier @ 2015-07-31 15:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Mark Brown <broonie@kernel.org>
The patch "Coresight: Add an interface for supporting ETM3/4 Context ID
tracing" adds uses of find_task_by_vpid() and task_pid_nr() from
linux/sched.h but does not include that header causing build errors in
at least an ARM allmodconfig where it is not implicitly included. Add an
explicit include to fix that.
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
include/linux/coresight.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 626da6948ca2..c69e1b932809 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -14,6 +14,7 @@
#define _LINUX_CORESIGHT_H
#include <linux/device.h>
+#include <linux/sched.h>
/* Peripheral id registers (0xFD0-0xFEC) */
#define CORESIGHT_PERIPHIDR4 0xfd0
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-07-31 15:37 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31 15:37 [PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier
2015-07-31 15:37 ` [PATCH 01/10] coresight: binding for ETMv4 coresight drivers Mathieu Poirier
2015-07-31 15:37 ` [PATCH 02/10] coresight-etm3x: Add Qualcomm PTM v1.1 peripheral ID Mathieu Poirier
2015-07-31 15:37 ` [PATCH 03/10] coresight: replicator: Use builtin_platform_driver() Mathieu Poirier
2015-07-31 15:37 ` [PATCH 04/10] coresight-etm3x: Change the name of the ctxid_val to ctxid_pid Mathieu Poirier
2015-07-31 15:37 ` [PATCH 05/10] coresight-etm4x: " Mathieu Poirier
2015-07-31 15:37 ` [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Mathieu Poirier
2015-07-31 15:37 ` [PATCH 07/10] coresight-etm3x: Support context-ID tracing when PID namespace is enabled Mathieu Poirier
2015-07-31 15:37 ` [PATCH 08/10] coresight-etm4x: " Mathieu Poirier
2015-07-31 15:37 ` [PATCH 09/10] Doc: trace: Fix typo in coresight.txt Mathieu Poirier
2015-07-31 15:37 ` [PATCH 10/10] coresight: Fix implicit inclusion of linux/sched.h Mathieu Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).