devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Tao Zhang <quic_taozha@quicinc.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Konrad Dybcio <konradybcio@gmail.com>,
	Mike Leach <mike.leach@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Jinlong Mao <quic_jinlmao@quicinc.com>,
	Leo Yan <leo.yan@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Tingwei Zhang <quic_tingweiz@quicinc.com>,
	Yuanfang Zhang <quic_yuanfang@quicinc.com>,
	Trilok Soni <quic_tsoni@quicinc.com>,
	Hao Zhang <quic_hazha@quicinc.com>,
	linux-arm-msm@vger.kernel.org, andersson@kernel.org
Subject: Re: [PATCH v8 09/13] coresight-tpdm: Add nodes for dsb edge control
Date: Tue, 5 Sep 2023 10:36:06 +0100	[thread overview]
Message-ID: <4370a34d-e36f-421c-aa02-48dd96c0af77@arm.com> (raw)
In-Reply-To: <27042351-ba5d-7048-adc1-f58955c6d116@quicinc.com>

On 01/09/2023 17:01, Tao Zhang wrote:
> 
> On 9/1/2023 10:07 PM, Suzuki K Poulose wrote:
>> On 22/08/2023 06:26, Tao Zhang wrote:
>>> Add the nodes to set value for DSB edge control and DSB edge
>>> control mask. Each DSB subunit TPDM has maximum of n(n<16) EDCR
>>> resgisters to configure edge control. DSB edge detection control
>>> 00: Rising edge detection
>>> 01: Falling edge detection
>>> 10: Rising and falling edge detection (toggle detection)
>>> And each DSB subunit TPDM has maximum of m(m<8) ECDMR registers to
>>> configure mask. Eight 32 bit registers providing DSB interface
>>> edge detection mask control.
>>>
>>> Add the nodes to configure DSB edge control and DSB edge control
>>> mask. Each DSB subunit TPDM maximum of 256 edge detections can be
>>> configured. The index and value sysfs files need to be paired and
>>> written to order. The index sysfs file is to set the index number
>>> of the edge detection which needs to be configured. And the value
>>> sysfs file is to set the control or mask for the edge detection.
>>> DSB edge detection control should be set as the following values.
>>> 00: Rising edge detection
>>> 01: Falling edge detection
>>> 10: Rising and falling edge detection (toggle detection)
>>> And DSB edge mask should be set as 0 or 1.
>>> Each DSB subunit TPDM has maximum of n(n<16) EDCR resgisters to
>>> configure edge control. And each DSB subunit TPDM has maximum of
>>> m(m<8) ECDMR registers to configure mask.
>>>
>>> Add the nodes to read a set of the edge control value and mask
>>> of the DSB in TPDM.
>>>
>>> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
>>> ---
>>>   .../ABI/testing/sysfs-bus-coresight-devices-tpdm   |  51 ++++++
>>>   drivers/hwtracing/coresight/coresight-tpdm.c       | 177 
>>> ++++++++++++++++++++-
>>>   drivers/hwtracing/coresight/coresight-tpdm.h       |  63 ++++++++
>>>   3 files changed, 288 insertions(+), 3 deletions(-)
>>>
>>> diff --git 
>>> a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm 
>>> b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
>>> index e17d1b4..097fdc4 100644
>>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
>>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
>>> @@ -57,3 +57,54 @@ Description:
>>>           Bit[3] : Set to 0 for low performance mode.
>>>                    Set to 1 for high performance mode.
>>>           Bit[4:8] : Select byte lane for high performance mode.
>>> +
>>> +What: /sys/bus/coresight/devices/<tpdm-name>/dsb_edge/ctrl_idx
>>> +Date:        March 2023
>>> +KernelVersion    6.5
>>
>> s/6.5/6.7
> Sure, I will update this in the next patch series.
>>
>>> +Contact:    Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang 
>>> (QUIC) <quic_taozha@quicinc.com>
>>> +Description:
>>> +        (RW) Set/Get the index number of the edge detection for the DSB
>>> +        subunit TPDM. Since there are at most 256 edge detections, this
>>> +        value ranges from 0 to 255.
>>> +
>>> +What: /sys/bus/coresight/devices/<tpdm-name>/dsb_edge/ctrl_val
>>> +Date:        March 2023
>>> +KernelVersion    6.5
>>
>> same as above
>>
>>> +Contact:    Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang 
>>> (QUIC) <quic_taozha@quicinc.com>
>>> +Description:
>>> +        Write a data to control the edge detection corresponding to
>>> +        the index number. Before writing data to this sysfs file,
>>> +        "ctrl_idx" should be written first to configure the index
>>> +        number of the edge detection which needs to be controlled.
>>> +
>>> +        Accepts only one of the following values.
>>> +        0 - Rising edge detection
>>> +        1 - Falling edge detection
>>> +        2 - Rising and falling edge detection (toggle detection)
>>> +
>>> +
>>> +What: /sys/bus/coresight/devices/<tpdm-name>/dsb_edge/ctrl_mask
>>> +Date:        March 2023
>>> +KernelVersion    6.5
>>> +Contact:    Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang 
>>> (QUIC) <quic_taozha@quicinc.com>
>>> +Description:
>>> +        Write a data to mask the edge detection corresponding to the 
>>> index
>>> +        number. Before writing data to this sysfs file, "ctrl_idx" 
>>> should
>>> +        be written first to configure the index number of the edge 
>>> detection
>>> +        which needs to be masked.
>>> +
>>> +        Accepts only one of the 2 values -  0 or 1.
>>> +
>>> +What: /sys/bus/coresight/devices/<tpdm-name>/dsb_edge/edcr[0:15]
>>> +Date:        March 2023
>>> +KernelVersion    6.5
>>> +Contact:    Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang 
>>> (QUIC) <quic_taozha@quicinc.com>
>>> +Description:
>>> +        Read a set of the edge control value of the DSB in TPDM.
>>
>> Read edge control register n for edcr<n>.
> 
> In fact, we don't read the register directly through this sysfs file, 
> but read the value
> 
> we set to be written to the registers. Do I still need to modify it here?

thats fine.

> 
>>
>>> +
>>> +What: /sys/bus/coresight/devices/<tpdm-name>/dsb_edge/edcmr[0:7]
>>> +Date:        March 2023
>>> +KernelVersion    6.5
>>> +Contact:    Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang 
>>> (QUIC) <quic_taozha@quicinc.com>
>>> +Description:
>>> +        Read a set of the edge control mask of the DSB in TPDM.
>>> \ No newline at end of file
>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c 
>>> b/drivers/hwtracing/coresight/coresight-tpdm.c
>>> index 2424eb7..ba61e6a 100644
>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
>>> @@ -21,6 +21,29 @@
>>>     DEFINE_CORESIGHT_DEVLIST(tpdm_devs, "tpdm");
>>>   +/* Read dataset array member with the index number */
>>> +static ssize_t tpdm_simple_dataset_show(struct device *dev,
>>> +               struct device_attribute *attr, char *buf)
>>> +{
>>> +    struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
>>> +    struct tpdm_dataset_attribute *tpdm_attr =
>>> +        container_of(attr, struct tpdm_dataset_attribute, attr);
>>> +
>>> +    if (tpdm_attr->idx >= tpdm_attr->max)
>>
>> minor nit: See my comment on max below. We could skip max.
> I will update this in the next patch series.
>>
>>> +        return -EINVAL;
>>> +
>>> +    switch (tpdm_attr->mem) {
>>> +    case DSB_EDGE_CTRL:
>>         if (tmp_attr->idx > TPDM_DSB_MAX_EDCR)
>>             break;
>>
>>> +        return sysfs_emit(buf, "0x%x\n",
>>> + drvdata->dsb->edge_ctrl[tpdm_attr->idx]);
>>> +    case DSB_EDGE_CTRL_MASK:
>>         if (tmp_attr->idx > TPDM_DSB_MAX_EDCMR)
>>             break;
>>
>>> +        return sysfs_emit(buf, "0x%x\n",
>>> + drvdata->dsb->edge_ctrl_mask[tpdm_attr->idx]);
>>     }
>>
>>     return -EINVAL;
> Why do we need to return this error code here?
>>


The whole block would look like :

	switch (tpdm->attr->mem) {
	case DSB_EDGE_CTRL:
		if (tmp_attr->idx > TPDM_DSB_MAX_EDCR)
			break;
		return sysfs_...
	case DSB_EDGE_CTRL_MASK:
		if (tmp_attr->idx > TPDM_DSB_MAX_EDCMR)
			break;
		return sysfs_...
	}

	return -EINVAL;

Suzuki


  reply	other threads:[~2023-09-05 16:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22  5:26 [PATCH v8 00/13] Add support to configure TPDM DSB subunit Tao Zhang
2023-08-22  5:26 ` [PATCH v8 01/13] coresight-tpdm: Remove the unnecessary lock Tao Zhang
2023-08-22  5:26 ` [PATCH v8 02/13] dt-bindings: arm: Add support for DSB element size Tao Zhang
2023-08-22  5:26 ` [PATCH v8 03/13] coresight-tpdm: Introduce TPDM subtype to TPDM driver Tao Zhang
2023-08-22  5:26 ` [PATCH v8 04/13] coresight-tpda: Add DSB dataset support Tao Zhang
2023-08-23  1:35   ` kernel test robot
2023-08-31 15:51   ` Suzuki K Poulose
2023-08-22  5:26 ` [PATCH v8 05/13] coresight-tpdm: Initialize DSB subunit configuration Tao Zhang
2023-08-22  5:26 ` [PATCH v8 06/13] coresight-tpdm: Add reset node to TPDM node Tao Zhang
2023-08-31 20:34   ` Suzuki K Poulose
2023-09-01  2:09     ` Tao Zhang
2023-08-22  5:26 ` [PATCH v8 07/13] coresight-tpdm: Add nodes to set trigger timestamp and type Tao Zhang
2023-09-01 10:43   ` Suzuki K Poulose
2023-09-01 14:41     ` Tao Zhang
2023-09-08  8:27       ` Suzuki K Poulose
2023-08-22  5:26 ` [PATCH v8 08/13] coresight-tpdm: Add node to set dsb programming mode Tao Zhang
2023-09-01 10:55   ` Suzuki K Poulose
2023-08-22  5:26 ` [PATCH v8 09/13] coresight-tpdm: Add nodes for dsb edge control Tao Zhang
2023-09-01 14:07   ` Suzuki K Poulose
2023-09-01 16:01     ` Tao Zhang
2023-09-05  9:36       ` Suzuki K Poulose [this message]
2023-09-07  6:47         ` Tao Zhang
2023-08-22  5:26 ` [PATCH v8 10/13] coresight-tpdm: Add nodes to configure pattern match output Tao Zhang
2023-09-05  9:41   ` Suzuki K Poulose
2023-09-07  6:41     ` Tao Zhang
2023-08-22  5:26 ` [PATCH v8 11/13] coresight-tpdm: Add nodes for timestamp request Tao Zhang
2023-09-06  9:09   ` Suzuki K Poulose
2023-09-08  1:11     ` Tao Zhang
2023-08-22  5:26 ` [PATCH v8 12/13] dt-bindings: arm: Add support for DSB MSR register Tao Zhang
2023-08-22  5:26 ` [PATCH v8 13/13] coresight-tpdm: Add nodes for dsb msr support Tao Zhang
2023-09-06  9:32   ` Suzuki K Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4370a34d-e36f-421c-aa02-48dd96c0af77@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andersson@kernel.org \
    --cc=coresight@lists.linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konradybcio@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=quic_hazha@quicinc.com \
    --cc=quic_jinlmao@quicinc.com \
    --cc=quic_taozha@quicinc.com \
    --cc=quic_tingweiz@quicinc.com \
    --cc=quic_tsoni@quicinc.com \
    --cc=quic_yuanfang@quicinc.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).