mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinlong Mao <quic_jinlmao@quicinc.com>
To: Suzuki K Poulose <suzuki.poulose@arm.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>
Cc: 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>,
	Tingwei Zhang <quic_tingweiz@quicinc.com>,
	Yuanfang Zhang <quic_yuanfang@quicinc.com>,
	Tao Zhang <quic_taozha@quicinc.com>,
	Trilok Soni <quic_tsoni@quicinc.com>,
	Hao Zhang <quic_hazha@quicinc.com>,
	<linux-arm-msm@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH v7 04/10] coresight-tpdm: Add DSB dataset support
Date: Tue, 24 May 2022 15:07:13 +0800	[thread overview]
Message-ID: <f162a07b-bf45-431e-7f16-d314d7d466b4@quicinc.com> (raw)
In-Reply-To: <00c30f02-de4e-6bd1-f220-00ae114ef91f@arm.com>

Hi Suzuki,

On 5/23/2022 5:11 PM, Suzuki K Poulose wrote:
> Hi
>
> On 09/05/2022 14:39, Mao Jinlong wrote:
>> TPDM serves as data collection component for various dataset types.
>> DSB(Discrete Single Bit) is one of the dataset types. DSB subunit
>> can be enabled for data collection by writing 1 to the first bit of
>> DSB_CR register. This change is to add enable/disable function for
>> DSB dataset by writing DSB_CR register.
>
> The patch looks good to me, except for some minor comment below.
>
>>
>> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-tpdm.c | 58 ++++++++++++++++++++
>>   drivers/hwtracing/coresight/coresight-tpdm.h | 23 ++++++++
>>   2 files changed, 81 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c 
>> b/drivers/hwtracing/coresight/coresight-tpdm.c
>> index 6a4e2a35053d..70df888ac565 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
>> @@ -20,7 +20,28 @@
>>     DEFINE_CORESIGHT_DEVLIST(tpdm_devs, "tpdm");
>>   +static void tpdm_enable_dsb(struct tpdm_drvdata *drvdata)
>> +{
>> +    u32 val;
>> +
>> +    /* Set the enable bit of DSB control register to 1 */
>> +    val = readl_relaxed(drvdata->base + TPDM_DSB_CR);
>> +    val |= TPDM_DSB_CR_ENA;
>> +    writel_relaxed(val, drvdata->base + TPDM_DSB_CR);
>> +}
>> +
>>   /* TPDM enable operations */
>> +static void _tpdm_enable(struct tpdm_drvdata *drvdata)
>> +{
>> +    CS_UNLOCK(drvdata->base);
>> +
>> +    /* Check if DSB datasets is present for TPDM. */
>> +    if (drvdata->datasets & BIT(TPDM_DS_DSB))
>> +        tpdm_enable_dsb(drvdata);
>> +
>> +    CS_LOCK(drvdata->base);
>> +}
>> +
>>   static int tpdm_enable(struct coresight_device *csdev,
>>                  struct perf_event *event, u32 mode)
>>   {
>> @@ -32,6 +53,7 @@ static int tpdm_enable(struct coresight_device *csdev,
>>           return -EBUSY;
>>       }
>>   +    _tpdm_enable(drvdata);
>>       drvdata->enable = true;
>>       mutex_unlock(&drvdata->lock);
>>   @@ -39,7 +61,29 @@ static int tpdm_enable(struct coresight_device 
>> *csdev,
>>       return 0;
>>   }
>>   +static void tpdm_disable_dsb(struct tpdm_drvdata *drvdata)
>> +{
>> +    u32 val;
>> +
>> +    /* Set the enable bit of DSB control register to 0 */
>> +    val = readl_relaxed(drvdata->base + TPDM_DSB_CR);
>> +    val &= ~TPDM_DSB_CR_ENA;
>> +    writel_relaxed(val, drvdata->base + TPDM_DSB_CR);
>> +}
>> +
>>   /* TPDM disable operations */
>> +static void _tpdm_disable(struct tpdm_drvdata *drvdata)
>> +{
>> +    CS_UNLOCK(drvdata->base);
>> +
>> +    /* Check if DSB datasets is present for TPDM. */
>> +    if (drvdata->datasets & BIT(TPDM_DS_DSB))
>> +        tpdm_disable_dsb(drvdata);
>> +
>> +    CS_LOCK(drvdata->base);
>> +
>
> nit: extra new line.
I will remove it.
>> +}
>> +
>>   static void tpdm_disable(struct coresight_device *csdev,
>>                struct perf_event *event)
>>   {
>> @@ -51,6 +95,7 @@ static void tpdm_disable(struct coresight_device 
>> *csdev,
>>           return;
>>       }
>>   +    _tpdm_disable(drvdata);
>>       drvdata->enable = false;
>>       mutex_unlock(&drvdata->lock);
>>   @@ -66,6 +111,18 @@ static const struct coresight_ops tpdm_cs_ops = {
>>       .source_ops    = &tpdm_source_ops,
>>   };
>>   +static void tpdm_init_default_data(struct tpdm_drvdata *drvdata)
>> +{
>> +    int i;
>> +    u32 pidr;
>> +
>> +    CS_UNLOCK(drvdata->base);
>> +    /*  Get the datasets present on the TPDM. */
>> +    pidr = readl_relaxed(drvdata->base + CORESIGHT_PERIPHIDR0);
>> +    drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0);
>> +    CS_LOCK(drvdata->base);
>> +}
>> +
>>   static int tpdm_probe(struct amba_device *adev, const struct 
>> amba_id *id)
>>   {
>>       struct device *dev = &adev->dev;
>> @@ -104,6 +161,7 @@ static int tpdm_probe(struct amba_device *adev, 
>> const struct amba_id *id)
>>       if (IS_ERR(drvdata->csdev))
>>           return PTR_ERR(drvdata->csdev);
>>   +    tpdm_init_default_data(drvdata);
>>       /* Decrease pm refcount when probe is done.*/
>>       pm_runtime_put(&adev->dev);
>>   diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h 
>> b/drivers/hwtracing/coresight/coresight-tpdm.h
>> index 94a7748a5426..f95aaad9c653 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpdm.h
>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h
>> @@ -6,6 +6,27 @@
>>   #ifndef _CORESIGHT_CORESIGHT_TPDM_H
>>   #define _CORESIGHT_CORESIGHT_TPDM_H
>>   +/* The max number of the datasets that TPDM supports */
>> +#define TPDM_DATASETS       7
>> +
>> +/* DSB Subunit Registers */
>> +#define TPDM_DSB_CR        (0x780)
>> +/* Enable bit for DSB subunit */
>> +#define TPDM_DSB_CR_ENA        BIT(0)
>> +
>> +/**
>> + * This enum is for PERIPHIDR0 register of TPDM.
>> + * The fields [6:0] of PERIPHIDR0 are used to determine what
>> + * interfaces and subunits are present on a given TPDM.
>> + *
>> + * PERIPHIDR0[0] : Fix to 1 if ImplDef subunit present, else 0
>> + * PERIPHIDR0[1] : Fix to 1 if DSB subunit present, else 0
>> + */
>> +enum tpdm_dataset {
>> +    TPDM_DS_IMPLDEF,
>> +    TPDM_DS_DSB,
>> +};
>
> Please could we name this explicitly to indicate the register field 
> they appear in ? e.g,
>
> #define TPDM_PIDR0_DS_IMPDEF    BIT(0)
> #define    TPDM_PIDR0_DS_DSB    BIT(1)
I will check and update.
>
> Suzuki

  parent reply	other threads:[~2022-05-24  7:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 13:39 [PATCH v7 00/10] Coresight: Add support for TPDM and TPDA Mao Jinlong
2022-05-09 13:39 ` [PATCH v7 01/10] coresight: core: Use IDR for non-cpu bound sources' paths Mao Jinlong
2022-05-09 13:39 ` [PATCH v7 02/10] Coresight: Add coresight TPDM source driver Mao Jinlong
2022-05-23  8:57   ` Suzuki K Poulose
2022-05-24  7:00     ` Jinlong Mao
2022-06-01  9:21       ` Jinlong Mao
2022-06-01  9:30         ` Suzuki K Poulose
2022-06-01  9:56           ` Jinlong Mao
2022-06-02  3:14             ` Jinlong Mao
2022-05-09 13:39 ` [PATCH v7 03/10] dt-bindings: arm: Adds CoreSight TPDM hardware definitions Mao Jinlong
2022-05-23  9:02   ` Suzuki K Poulose
2022-05-09 13:39 ` [PATCH v7 04/10] coresight-tpdm: Add DSB dataset support Mao Jinlong
2022-05-23  9:11   ` Suzuki K Poulose
2022-05-23  9:24     ` Suzuki K Poulose
2022-05-24  7:15       ` Jinlong Mao
2022-05-24  7:07     ` Jinlong Mao [this message]
2022-05-09 13:39 ` [PATCH v7 05/10] coresight-tpdm: Add integration test support Mao Jinlong
2022-05-23  9:17   ` Suzuki K Poulose
2022-05-24  7:14     ` Jinlong Mao
2022-05-09 13:39 ` [PATCH v7 06/10] docs: sysfs: coresight: Add sysfs ABI documentation for TPDM Mao Jinlong
2022-05-09 13:39 ` [PATCH v7 07/10] Coresight: Add TPDA link driver Mao Jinlong
2022-05-23  9:40   ` Suzuki K Poulose
2022-05-24  7:32     ` Jinlong Mao
2022-05-09 13:39 ` [PATCH v7 08/10] dt-bindings: arm: Adds CoreSight TPDA hardware definitions Mao Jinlong
2022-05-23  9:44   ` Suzuki K Poulose
2022-05-23 14:24     ` Rob Herring
2022-05-24  7:34       ` Jinlong Mao
2022-05-09 13:39 ` [PATCH v7 09/10] arm64: dts: qcom: sm8250: Add coresight components Mao Jinlong
2022-05-09 13:39 ` [PATCH v7 10/10] arm64: dts: qcom: sm8250: Add tpdm mm/prng Mao Jinlong

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=f162a07b-bf45-431e-7f16-d314d7d466b4@quicinc.com \
    --to=quic_jinlmao@quicinc.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konradybcio@gmail.com \
    --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_taozha@quicinc.com \
    --cc=quic_tingweiz@quicinc.com \
    --cc=quic_tsoni@quicinc.com \
    --cc=quic_yuanfang@quicinc.com \
    --cc=suzuki.poulose@arm.com \
    /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

all inboxes | Powered by JetHome®