Linux Documentation
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@huawei.com>
To: Will Deacon <will@kernel.org>
Cc: <yangyicong@hisilicon.com>, <catalin.marinas@arm.com>,
	<lpieralisi@kernel.org>, <mark.rutland@arm.com>,
	<robin.murphy@arm.com>, <guohanjun@huawei.com>, <corbet@lwn.net>,
	<rafael@kernel.org>, <linux-arm-kernel@lists.infradead.org>,
	<linux-doc@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <jonathan.cameron@huawei.com>,
	<shameerali.kolothum.thodi@huawei.com>, <hejunhao3@huawei.com>,
	<linuxarm@huawei.com>, <prime.zeng@hisilicon.com>,
	<zhurui3@huawei.com>
Subject: Re: [PATCH] perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09
Date: Mon, 14 Aug 2023 16:53:35 +0800	[thread overview]
Message-ID: <56309be3-cf3b-821d-b6d8-7f407b160fbb@huawei.com> (raw)
In-Reply-To: <20230811111739.GD6993@willie-the-truck>

On 2023/8/11 19:17, Will Deacon wrote:
> On Wed, Aug 09, 2023 at 06:06:54PM +0800, Yicong Yang wrote:
>> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
>> index 25a269d431e4..b854b67b81fc 100644
>> --- a/drivers/perf/arm_smmuv3_pmu.c
>> +++ b/drivers/perf/arm_smmuv3_pmu.c
>> @@ -115,6 +115,7 @@
>>  #define SMMU_PMCG_PA_SHIFT              12
>>  
>>  #define SMMU_PMCG_EVCNTR_RDONLY         BIT(0)
>> +#define SMMU_PMCG_HARDEN_DISABLE        BIT(1)
>>  
>>  static int cpuhp_state_num;
>>  
>> @@ -150,6 +151,22 @@ SMMU_PMU_EVENT_ATTR_EXTRACTOR(filter_stream_id, config1, 0, 31);
>>  SMMU_PMU_EVENT_ATTR_EXTRACTOR(filter_span, config1, 32, 32);
>>  SMMU_PMU_EVENT_ATTR_EXTRACTOR(filter_enable, config1, 33, 33);
>>  
>> +static int smmu_pmu_apply_event_filter(struct smmu_pmu *smmu_pmu,
>> +				       struct perf_event *event, int idx);
>> +
>> +static inline void smmu_pmu_enable_quirk_hip08_09(struct pmu *pmu)
>> +{
>> +	struct smmu_pmu *smmu_pmu = to_smmu_pmu(pmu);
>> +	unsigned int idx;
>> +
>> +	for_each_set_bit(idx, smmu_pmu->used_counters, smmu_pmu->num_counters)
>> +		smmu_pmu_apply_event_filter(smmu_pmu, smmu_pmu->events[idx], idx);
>> +
>> +	writel(SMMU_PMCG_IRQ_CTRL_IRQEN,
>> +	       smmu_pmu->reg_base + SMMU_PMCG_IRQ_CTRL);
>> +	writel(SMMU_PMCG_CR_ENABLE, smmu_pmu->reg_base + SMMU_PMCG_CR);
> 
> Can you tail-call smmu_pmu_enable() instead of duplicating it here?
> 
>> +static inline void smmu_pmu_disable_quirk_hip08_09(struct pmu *pmu)
>> +{
>> +	struct smmu_pmu *smmu_pmu = to_smmu_pmu(pmu);
>> +	unsigned int idx;
>> +
>> +	/*
>> +	 * The global disable of PMU sometimes fail to stop the counting.
>> +	 * Harden this by writing an invalid event type to each used counter
>> +	 * to forcibly stop counting.
>> +	 */
>> +	for_each_set_bit(idx, smmu_pmu->used_counters, smmu_pmu->num_counters)
>> +		writel(0xffff, smmu_pmu->reg_base + SMMU_PMCG_EVTYPER(idx));
>> +
>> +	writel(0, smmu_pmu->reg_base + SMMU_PMCG_CR);
>> +	writel(0, smmu_pmu->reg_base + SMMU_PMCG_IRQ_CTRL);
> 
> Same things here, but with smmu_pmu_disable()
> 

Sure. Will tail call smmu_pmu_{enable, disable} in both case to avoid duplication.
Thanks for the comments.

Thanks.


      reply	other threads:[~2023-08-14  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 10:06 [PATCH] perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09 Yicong Yang
2023-08-11 11:17 ` Will Deacon
2023-08-14  8:53   ` Yicong Yang [this message]

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=56309be3-cf3b-821d-b6d8-7f407b160fbb@huawei.com \
    --to=yangyicong@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=guohanjun@huawei.com \
    --cc=hejunhao3@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=will@kernel.org \
    --cc=yangyicong@hisilicon.com \
    --cc=zhurui3@huawei.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