All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Will Deacon <will@kernel.org>
Cc: Yicong Yang <yangyicong@huawei.com>, <mark.rutland@arm.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <prime.zeng@hisilicon.com>,
	<linuxarm@huawei.com>, <yangyicong@hisilicon.com>,
	<wangyushan12@huawei.com>
Subject: Re: [PATCH 4/9] drivers/perf: hisi: Use ACPI driver_data to retrieve SLLC PMU information
Date: Tue, 4 Mar 2025 17:49:19 +0800	[thread overview]
Message-ID: <20250304174919.00001e24@huawei.com> (raw)
In-Reply-To: <20250301064347.GB27700@willie-the-truck>

On Sat, 1 Mar 2025 06:43:49 +0000
Will Deacon <will@kernel.org> wrote:

> On Tue, Feb 18, 2025 at 05:19:55PM +0800, Yicong Yang wrote:
> > From: Junhao He <hejunhao3@huawei.com>
> > 
> > Make use of struct acpi_device_id::driver_data for version specific
> > information rather than judge the version register. This will help
> > to simplify the probe process and also a bit easier for extension.
> > 
> > Factor out SLLC register definition to struct hisi_sllc_pmu_regs.
> > No functional changes intended.
> > 
> > Signed-off-by: Junhao He <hejunhao3@huawei.com>
> > Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> > ---
> >  drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 191 ++++++++++++------
> >  1 file changed, 125 insertions(+), 66 deletions(-)
> > 
> > diff --git a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
> > index dbd079016fc4..c1fd60d397c3 100644
> > --- a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
> > +++ b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
> > @@ -36,11 +36,14 @@
> >  #define SLLC_SRCID_NONE			0x0
> >  #define SLLC_TGTID_EN			BIT(5)
> >  #define SLLC_TGTID_NONE			0x0
> > -#define SLLC_TGTID_MIN_SHIFT		1
> > -#define SLLC_TGTID_MAX_SHIFT		12
> > -#define SLLC_SRCID_CMD_SHIFT		1
> > -#define SLLC_SRCID_MSK_SHIFT		12
> > +#define SLLC_TGTID_MIN_MSK		GENMASK(11, 1)
> > +#define SLLC_TGTID_MAX_MSK		GENMASK(22, 12)
> > +#define SLLC_SRCID_CMD_MSK		GENMASK(11, 1)
> > +#define SLLC_SRCID_MSK_MSK		GENMASK(22, 12)
> >  #define SLLC_NR_EVENTS			0x80
> > +#define SLLC_EVENT_CNTn(cnt0, n)	((cnt0) + (n) * 8)
> > +#define SLLC_FIRST_BIT(_mask)		(find_first_bit((const unsigned long *)&(_mask), 32))
> > +#define SLLC_FIELD_PREP(_mask, _val)	(_mask & (_val << SLLC_FIRST_BIT(_mask)))  
> 
> It's a bit of a shame to have to compute this dynamically given that th
> input mask is constant for a given device. Is it not possible to use the
> generic FIELD_PREP macro in per-device code and then just dispatch to
> that, instead of funneling everything through hisi_sllc_pmu_regs?
There is yet another ongoing discussion of handling non const
field cases:
https://lore.kernel.org/all/cover.1739540679.git.geert+renesas@glider.be/

Maybe that will resolve with a nicer solution but I doubt it.

Alternatively best plan may be a shift (and length) instead
of the neat solution of FIELD_PREP().

Jonathan

> 
> Will



  reply	other threads:[~2025-03-04  9:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18  9:19 [PATCH 0/9] General updates and two new drivers for HiSilicon Uncore PMU Yicong Yang
2025-02-18  9:19 ` [PATCH 1/9] drivers/perf: hisi: Extend struct hisi_pmu_dev_info Yicong Yang
2025-03-01  6:23   ` Will Deacon
2025-03-03 14:43     ` Yicong Yang
2025-03-04  9:21       ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 2/9] drivers/perf: hisi: Simplify the probe process for each DDRC version Yicong Yang
2025-03-04  9:26   ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 3/9] drivers/perf: hisi: Add support for HiSilicon DDRC v3 PMU driver Yicong Yang
2025-03-04  9:27   ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 4/9] drivers/perf: hisi: Use ACPI driver_data to retrieve SLLC PMU information Yicong Yang
2025-03-01  6:43   ` Will Deacon
2025-03-04  9:49     ` Jonathan Cameron [this message]
2025-03-04 10:00   ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 5/9] drivers/perf: hisi: Add support for HiSilicon SLLC v3 PMU driver Yicong Yang
2025-03-04 10:02   ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 6/9] drivers/perf: hisi: Relax the event number check of v2 PMUs Yicong Yang
2025-03-04 10:11   ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 7/9] drivers/perf: hisi: Support PMUs with no interrupt Yicong Yang
2025-03-04 10:16   ` Jonathan Cameron
2025-02-18  9:19 ` [PATCH 8/9] drivers/perf: hisi: Add support for HiSilicon NoC PMU Yicong Yang
2025-03-04 10:22   ` Jonathan Cameron
2025-02-18  9:20 ` [PATCH 9/9] drivers/perf: hisi: Add support for HiSilicon MN PMU driver Yicong Yang
2025-03-04 10:24   ` Jonathan Cameron

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=20250304174919.00001e24@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=wangyushan12@huawei.com \
    --cc=will@kernel.org \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.