On 11/2/23 13:22, Dan Carpenter wrote:
> This code was changed from using coresight_get_platform_data() which
> returns error pointers to devm_kzalloc() which returns NULL. Update
> the check to match.
>
> Fixes: 4817af577b82 ("coresight: trbe: Add a representative coresight_platform_data for TRBE")
> Signed-off-by: Dan Carpenter <dan.carpenter(a)linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index a3954be7b1f3..228ea85cfc74 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -1265,7 +1265,7 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
> * into the device for that purpose.
> */
> desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL);
> - if (IS_ERR(desc.pdata))
> + if (!desc.pdata)
Although this might not be applicable here, given the input size is always
valid, devm_kzalloc() might also return ZERO_SIZE_PTR as well.
/*
* ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
*
* Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
*
* ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
* Both make kfree a no-op.
*/
#define ZERO_SIZE_PTR ((void *)16)
#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
(unsigned long)ZERO_SIZE_PTR)
Hence should ZERO_OR_NULL_PTR() check be used instead ?
> goto cpu_clear;
>
> desc.type = CORESIGHT_DEV_TYPE_SINK;
Introduction of TPDM CMB(Continuous Multi Bit) subunit
CMB subunit is responsible for creating a dataset element, and is also
optionally responsible for packing it to fit multiple elements on a
single ATB transfer if possible in the configuration. The TPDM Core
Datapath requests timestamps be stored by the TPDA and then delivering
ATB sized data (depending on ATB width and element size, this could
be smaller or larger than a dataset element) to the ATB Mast FSM.
The CMB makes trace elements in two modes. In �continuous� mode, every
valid data cycle creates an element. In �trace on change� mode, when
valid data changes on the bus, a trace element is created. In
continuous mode, all cycles where this condition is true create trace
elements. In trace on change mode, a data element is only when the
previously sampled input is different from the current sampled input.
The CMB subunit must be configured prior to enablement. This series
adds support for TPDM to configure the configure CMB subunit.
Once this series patches are applied properly, the new tpdm nodes for
should be observed at the tpdm path /sys/bus/coresight/devices/tpdm*
which supports CMB subunit.
e.g.
root@qemuarm64:/sys/devices/platform/soc@0/684c000.tpdm/tpdm0# ls -l
-rw-r--r-- 1 root root 4096 Jan 1 00:00 cmb_mode
drwxr-xr-x 2 root root 0 Jan 1 00:00 cmb_msr
drwxr-xr-x 2 root root 0 Jan 1 00:00 cmb_patt
drwxr-xr-x 2 root root 0 Jan 1 00:00 cmb_trig_patt
-rw-r--r-- 1 root root 4096 Jan 1 00:00 cmb_trig_ts
-rw-r--r-- 1 root root 4096 Jan 1 00:00 cmb_ts_all
drwxr-xr-x 2 root root 0 Jan 1 00:00 connections
drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_edge
drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_msr
drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_patt
drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_trig_patt
-rw-r--r-- 1 root root 4096 Jan 1 00:00 enable_source
--w------- 1 root root 4096 Jan 1 00:00 integration_test
drwxr-xr-x 2 root root 0 Ja? 1 00:00 power
--w------- 1 root root 4096 Jan 1 00:00 reset_dataset
lrwxrwxrwx 1 root root 0 Apr 5 2021 subsystem -> ../../../../../bus/coresight
-rw-r--r-- 1 root root 4096 Apr 5 2021 uevent
-r--r--r-- 1 root root 4096 Jan 1 00:00 waiting_for_supplier
We can use the commands are similar to the below to configure the
TPDMs which support CMB subunit. Enable coresight sink first.
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
echo 1 > /sys/bus/coresight/devices/tpdm0/reset_dataset
echo 1 > /sys/bus/coresight/devices/tpdm0/cmb_mode
echo 1 > /sys/bus/coresight/devices/tpdm0/cmb_patt/enable_ts
echo 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/cmb_patt/tpmr0
echo 0 > /sys/bus/coresight/devices/tpdm0/cmb_trig_ts
echo 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/cmb_trig_patt/xpr1
echo 1 > /sys/bus/coresight/devices/tpdm0/enable_source
This patch series depends on patch "[v1] coresight-tpdm: Correct the property name of MSR number"
https://patchwork.kernel.org/project/linux-arm-kernel/patch/1698128353-3115…
codelinaro link:
https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/tpdm-cmb-v2
Changes in V2:
1. Optimizate and modify this patch series based on the patch series
"Add support to configure TPDM CMB subunit".
2. Modify the functions that read the element size of DSB/CMB in TPDA driver.
Tao Zhang (8):
dt-bindings: arm: Add support for CMB element size
coresight-tpda: Add support to configure CMB element
coresight-tpdm: Add CMB dataset support
coresight-tpdm: Add support to configure CMB
coresight-tpdm: Add pattern registers support for CMB
coresight-tpdm: Add timestamp control register support for the CMB
dt-bindings: arm: Add support for TPDM CMB MSR register
coresight-tpdm: Add msr register support for CMB
.../ABI/testing/sysfs-bus-coresight-devices-tpdm | 83 +++++
.../bindings/arm/qcom,coresight-tpdm.yaml | 37 ++
drivers/hwtracing/coresight/coresight-tpda.c | 108 +++---
drivers/hwtracing/coresight/coresight-tpda.h | 6 +
drivers/hwtracing/coresight/coresight-tpdm.c | 390 ++++++++++++++++++++-
drivers/hwtracing/coresight/coresight-tpdm.h | 87 +++++
6 files changed, 663 insertions(+), 48 deletions(-)
--
2.7.4
Correct the property name of the DSB MSR number that needs to be
read in TPDM driver. The right property name is
"qcom,dsb-msrs-num".
Fixes: 90a7371cb08d ("coresight-tpdm: Add nodes for dsb msr support")
Signed-off-by: Tao Zhang <quic_taozha(a)quicinc.com>
---
drivers/hwtracing/coresight/coresight-tpdm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index b25284e..97654aa 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -892,7 +892,7 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
if (drvdata && tpdm_has_dsb_dataset(drvdata))
of_property_read_u32(drvdata->dev->of_node,
- "qcom,dsb_msr_num", &drvdata->dsb_msr_num);
+ "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
/* Set up coresight component description */
desc.name = coresight_alloc_device_name(&tpdm_devs, dev);
--
2.7.4
CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16.
This probably wasn't an issue previously because values higher than 255
never occurred.
But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN
on errata affected cpus"), a comparison with 256 was done to enable the
errata, generating the following W=1 build error:
coresight-etm4x-core.c:1188:24: error: result of comparison of
constant 256 with expression of type 'u8' (aka 'unsigned char') is
always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (drvdata->ccitmin == 256)
Cc: stable(a)vger.kernel.org
Fixes: 2e1cdfe184b5 ("coresight-etm4x: Adding CoreSight ETM4x driver")
Reviewed-by: Mike Leach <mike.leach(a)linaro.org>
Signed-off-by: James Clark <james.clark(a)arm.com>
---
Changes since V1:
* Change the fixes commit to the original addition of ccitmin, rather
than the last refactor of the struct.
drivers/hwtracing/coresight/coresight-etm4x.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
index 20e2e4cb7614..da17b6c49b0f 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.h
+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
@@ -1036,7 +1036,7 @@ struct etmv4_drvdata {
u8 ctxid_size;
u8 vmid_size;
u8 ccsize;
- u8 ccitmin;
+ u16 ccitmin;
u8 s_ex_level;
u8 ns_ex_level;
u8 q_support;
--
2.34.1
On 10/27/2023 5:27 AM, Rob Herring wrote:
> On Wed, Oct 25, 2023 at 10:53:27AM +0800, Tao Zhang wrote:
>> Add property "qcom,cmb_msr_num" to support CMB MSR(mux select register)
>> for TPDM. It specifies the number of CMB MSR registers supported by
>> the TDPM.
>>
>> Signed-off-by: Tao Zhang <quic_taozha(a)quicinc.com>
>> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
>> ---
>> Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
>> index f9a2025..a586b80a 100644
>> --- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
>> +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
>> @@ -69,6 +69,15 @@ properties:
>> minimum: 0
>> maximum: 32
>>
>> + qcom,cmb-msrs-num:
>> + description:
>> + Specifies the number of CMB MSR(mux select register) registers supported
>> + by the monitor. If this property is not configured or set to 0, it means
>> + this TPDM doesn't support CMB MSR.
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + minimum: 0
>> + maximum: 32
> default: 0
If the TPDM doesn't support CMB MSR, we will not configure this
property. Set to 0 to indicate
that CMB MSR is not supported and is only an optional method.
Is it necessary to add this "default" value here?
Best,
Tao
>> +
>> clocks:
>> maxItems: 1
>>
>> @@ -124,6 +133,7 @@ examples:
>> reg-names = "tpdm-base";
>>
>> qcom,cmb-element-size = /bits/ 8 <64>;
>> + qcom,cmb-msrs-num = <32>;
>>
>> clocks = <&aoss_qmp>;
>> clock-names = "apb_pclk";
>> --
>> 2.7.4
>>
On 30/10/2023 12:44, Greg KH wrote:
> On Mon, Oct 30, 2023 at 12:04:55PM +0000, Suzuki K Poulose wrote:
>> Hi Greg
>>
>> On 30/10/2023 11:32, Greg KH wrote:
>>> On Mon, Oct 30, 2023 at 11:02:04AM +0000, Suzuki K Poulose wrote:
>>>> Hi Greg
>>>>
>>>> Please find the updates for Linux v6.7. Kindly pull.
>>>
>>> It's too late, sorry. Last week might have been too late too, why the
>>> last-minute pull request?
>>
>> Apologies, I was out sick last week. I was hoping that there would be
>> an rc8. The tree wasn't changed since last two weeks. I will try to
>> send the pull request at rc5-rc6 now onwards.
>
> Thank you.
>
>>> Please send new changes after -rc1 is out for bugfixes and for normal
>>> new features.
>>
>> Just to make sure I understand this correctly,
>> - I can send a pull request with handpicked fixes for rc1
>
> Yes, after -rc1 is out.
>
>> - What about the other new features ?
Ok
>
> They need to wait until 6.8-rc1, you can send me a pull request for them
> after -rc1 is out as well, for my -next branch.
Ok.
>
>> (I can summaries the features below)
>> - TRBE ACPI support ( Parts of this feature went into v6.6 via
>> Will's perf subsystem, the coresight part was dropped due to
>> a conflict. I queued it for v6.7 - 2patches)
>> - CoreSight TPDM support for DSB feature (~10patches)
>> - Support for configuring cycle count threshold for ETM (3 patches)
>> Do they need to wait for v6.8 or could some of them go in for v6.7 ?
>>
>>
>>>
>>>> Please note the changes were queued and rebased onto v6.6-rc6 (which added
>>>> some of the fixes in the cycle).
>>>
>>> Why rebase? What required that?
>>
>> This was to be on the safer side. I don't think there was any conflict.
>
> As Linus constantly says, NEVER rebase unless you have to. That just
> makes history messy, and makes me think that something actually changed.
> Merge conflicts are fine, we can handle them trivially, do not rewrite
> history just for that.
Noted.
Thanks
Suzuki
>
> thanks,
>
> greg k-h
Hi Greg
On 30/10/2023 11:32, Greg KH wrote:
> On Mon, Oct 30, 2023 at 11:02:04AM +0000, Suzuki K Poulose wrote:
>> Hi Greg
>>
>> Please find the updates for Linux v6.7. Kindly pull.
>
> It's too late, sorry. Last week might have been too late too, why the
> last-minute pull request?
Apologies, I was out sick last week. I was hoping that there would be
an rc8. The tree wasn't changed since last two weeks. I will try to
send the pull request at rc5-rc6 now onwards.
>
> Please send new changes after -rc1 is out for bugfixes and for normal
> new features.
Just to make sure I understand this correctly,
- I can send a pull request with handpicked fixes for rc1
- What about the other new features ?
(I can summaries the features below)
- TRBE ACPI support ( Parts of this feature went into v6.6 via
Will's perf subsystem, the coresight part was dropped due to
a conflict. I queued it for v6.7 - 2patches)
- CoreSight TPDM support for DSB feature (~10patches)
- Support for configuring cycle count threshold for ETM (3 patches)
Do they need to wait for v6.8 or could some of them go in for v6.7 ?
>
>> Please note the changes were queued and rebased onto v6.6-rc6 (which added
>> some of the fixes in the cycle).
>
> Why rebase? What required that?
This was to be on the safer side. I don't think there was any conflict.
Suzuki
>
> thanks,
>
> greg k-h
Hi Greg
Please find the updates for Linux v6.7. Kindly pull.
Please note the changes were queued and rebased onto v6.6-rc6 (which added
some of the fixes in the cycle).
Suzuki
The following changes since commit 58720809f52779dc0f08e53e54b014209d13eebb:
Linux 6.6-rc6 (2023-10-15 13:34:39 -0700)
are available in the Git repository at:
git//git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git tags/coresight-next-v6.7
for you to fetch changes up to fa55e63584f2c3c84e0c3acdace42544e1832cc2:
Documentation: coresight: fix `make refcheckdocs` warning (2023-10-25 11:21:29 +0100)
----------------------------------------------------------------
coresight: Updates for Linux v6.7
Updates for the hwtracing subsystem includes :
- Support for CoreSight TPDM DSB set
- Support for tuning Cycle count Threshold for CoreSight ETM via perf
- Support for TRBE on ACPI based systems
- Several fixes for the HiSilcon PTT tracing driver
- Fix crash with CoreSight ETM mixing perf and sysfs mode
- Remove Leo Yan from Reviewers
Signed-off-by: Suzuki K Poulose <suzuki.poulose(a)arm.com>
----------------------------------------------------------------
Anshuman Khandual (6):
coresight: trbe: Add a representative coresight_platform_data for TRBE
coresight: trbe: Enable ACPI based TRBE devices
coresight: etm: Override TRCIDR3.CCITMIN on errata affected cpus
coresight: etm: Make cycle count threshold user configurable
Documentation: coresight: Add cc_threshold tunable
coresight: tmc: Make etr buffer mode user configurable from sysfs
Bagas Sanjaya (1):
Documentation: ABI: coresight-tpdm: Fix Bit[3] description indentation
James Clark (1):
coresight: Fix crash when Perf and sysfs modes are used concurrently
Junhao He (1):
hwtracing: hisi_ptt: Add dummy callback pmu::read()
Leo Yan (1):
MAINTAINERS: Remove myself as a Arm CoreSight reviewer
Tao Zhang (13):
coresight-tpdm: Remove the unnecessary lock
dt-bindings: arm: Add support for DSB element size
coresight-tpdm: Introduce TPDM subtype to TPDM driver
coresight-tpda: Add DSB dataset support
coresight-tpdm: Initialize DSB subunit configuration
coresight-tpdm: Add reset node to TPDM node
coresight-tpdm: Add nodes to set trigger timestamp and type
coresight-tpdm: Add node to set dsb programming mode
coresight-tpdm: Add nodes for dsb edge control
coresight-tpdm: Add nodes to configure pattern match output
coresight-tpdm: Add nodes for timestamp request
dt-bindings: arm: Add support for DSB MSR register
coresight-tpdm: Add nodes for dsb msr support
Uwe Kleine-K��nig (1):
coresight: etm4x: Remove bogous __exit annotation for some functions
Vegard Nossum (1):
Documentation: coresight: fix `make refcheckdocs` warning
Yicong Yang (4):
hwtracing: hisi_ptt: Disable interrupt after trace end
hwtracing: hisi_ptt: Handle the interrupt in hardirq context
hwtracing: hisi_ptt: Optimize the trace data committing
hwtracing: hisi_ptt: Don't try to attach a task
.../ABI/testing/sysfs-bus-coresight-devices-tmc | 16 +
.../ABI/testing/sysfs-bus-coresight-devices-tpdm | 159 +++++
Documentation/arch/arm64/silicon-errata.rst | 10 +
.../bindings/arm/qcom,coresight-tpdm.yaml | 20 +
Documentation/trace/coresight/coresight.rst | 6 +-
MAINTAINERS | 1 -
drivers/hwtracing/coresight/coresight-core.c | 3 +
drivers/hwtracing/coresight/coresight-etm-perf.c | 6 +-
drivers/hwtracing/coresight/coresight-etm4x-core.c | 52 +-
drivers/hwtracing/coresight/coresight-tmc-core.c | 15 +-
drivers/hwtracing/coresight/coresight-tmc-etr.c | 111 +++-
drivers/hwtracing/coresight/coresight-tmc.h | 3 +
drivers/hwtracing/coresight/coresight-tpda.c | 126 +++-
drivers/hwtracing/coresight/coresight-tpda.h | 2 +
drivers/hwtracing/coresight/coresight-tpdm.c | 718 ++++++++++++++++++++-
drivers/hwtracing/coresight/coresight-tpdm.h | 161 +++++
drivers/hwtracing/coresight/coresight-trbe.c | 23 +-
drivers/hwtracing/coresight/coresight-trbe.h | 2 +
drivers/hwtracing/ptt/hisi_ptt.c | 33 +-
drivers/hwtracing/ptt/hisi_ptt.h | 1 +
include/linux/coresight.h | 1 +
21 files changed, 1411 insertions(+), 58 deletions(-)
There are two reasons to do this, firstly there is a shellcheck warning
in cs_etm_dev_name(), which can be completely deleted. And secondly the
current iteration method doesn't support systems with both ETE and ETM
because it picks one or the other. There isn't a known system with this
configuration, but it could happen in the future.
Iterating over all the sources for each CPU can be done by going through
/sys/bus/event_source/devices/cs_etm/cpu* and following the symlink back
to the Coresight device in /sys/bus/coresight/devices. This will work
whether the device is ETE, ETM or any future name, and is much simpler
and doesn't require any hard coded version numbers
Suggested-by: Suzuki K Poulose <suzuki.poulose(a)arm.com>
Signed-off-by: James Clark <james.clark(a)arm.com>
---
This was discussed here previously:
https://lore.kernel.org/all/20230929041133.95355-2-atrajeev@linux.vnet.ibm.…
I chose not to add a fixes tag like the original because shellcheck
isn't part of the build so it doesn't really fix any real issue yet and
is just a refactor.
tools/perf/tests/shell/test_arm_coresight.sh | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
index fe78c4626e45..65dd85207125 100755
--- a/tools/perf/tests/shell/test_arm_coresight.sh
+++ b/tools/perf/tests/shell/test_arm_coresight.sh
@@ -11,19 +11,6 @@
glb_err=0
-cs_etm_dev_name() {
- cs_etm_path=$(find /sys/bus/event_source/devices/cs_etm/ -name cpu* -print -quit)
- trcdevarch=$(cat ${cs_etm_path}/mgmt/trcdevarch)
- archhver=$((($trcdevarch >> 12) & 0xf))
- archpart=$(($trcdevarch & 0xfff))
-
- if [ $archhver -eq 5 -a "$(printf "0x%X\n" $archpart)" = "0xA13" ] ; then
- echo "ete"
- else
- echo "etm"
- fi
-}
-
skip_if_no_cs_etm_event() {
perf list | grep -q 'cs_etm//' && return 0
@@ -149,7 +136,9 @@ arm_cs_iterate_devices() {
arm_cs_etm_traverse_path_test() {
# Iterate for every ETM device
- for dev in /sys/bus/coresight/devices/$(cs_etm_dev_name)*; do
+ for dev in /sys/bus/event_source/devices/cs_etm/cpu*; do
+ # Canonicalize the path
+ dev=`readlink -f $dev`
# Find the ETM device belonging to which CPU
cpu=`cat $dev/cpu`
--
2.34.1
On Sun, 22 Oct 2023 20:58:06 +0200, Vegard Nossum wrote:
> This reference uses a glob pattern to match multiple files, but the
> asterisk was escaped as \* in order to not be interpreted by sphinx
> as reStructuredText markup.
>
> refcheckdocs/documentation-file-ref-check doesn't know about rST syntax
> and tries to interpret the \* literally (instead of as a glob).
>
> [...]
Applied, thanks!
[1/1] Documentation: coresight: fix `make refcheckdocs` warning
https://git.kernel.org/coresight/c/fa55e63584f2
Best regards,
--
Suzuki K Poulose <suzuki.poulose(a)arm.com>