[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250731132538.000043a3@huawei.com>
Date: Thu, 31 Jul 2025 13:25:38 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Yushan Wang <wangyushan12@...wei.com>
CC: <will@...nel.org>, <mark.rutland@....com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<prime.zeng@...ilicon.com>, <fanghao11@...wei.com>, <linuxarm@...wei.com>,
<yangyicong@...ilicon.com>
Subject: Re: [PATCH 6/8] drivers/perf: hisi: Refactor the event
configuration of L3C PMU
On Tue, 29 Jul 2025 23:38:21 +0800
Yushan Wang <wangyushan12@...wei.com> wrote:
> From: Yicong Yang <yangyicong@...ilicon.com>
>
> The event register is configured using hisi_pmu::base directly since
> only one address space is supported for L3C PMU. We need to extend if
> events configuration locates in different address space. In order to
> make preparation for such hardware, extract the event register
> configuration to separate function using hw_perf_event::event_base as
> each event's base address. Implement a private
> hisi_uncore_ops::get_event_idx() callback for initialize the event_base
> besides get the hardware index.
>
> No functional changes intended.
>
> Signed-off-by: Yicong Yang <yangyicong@...ilicon.com>
> Signed-off-by: Yushan Wang <wangyushan12@...wei.com>
One tiny thing inline.
Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
> ---
> drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 128 ++++++++++++-------
> 1 file changed, 83 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
> index 39444f11cbad..6ac0ea74cda3 100644
> --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
> +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
> @@ -60,51 +60,86 @@ HISI_PMU_EVENT_ATTR_EXTRACTOR(datasrc_cfg, config1, 15, 11);
> HISI_PMU_EVENT_ATTR_EXTRACTOR(datasrc_skt, config1, 16, 16);
> HISI_PMU_EVENT_ATTR_EXTRACTOR(tt_core, config2, 15, 0);
>
> -static void hisi_l3c_pmu_config_req_tracetag(struct perf_event *event)
> +static int hisi_l3c_pmu_get_event_idx(struct perf_event *event)
> {
> struct hisi_pmu *l3c_pmu = to_hisi_pmu(event->pmu);
> + unsigned long *used_mask = l3c_pmu->pmu_events.used_mask;
> + u32 num_counters = l3c_pmu->num_counters;
> + int idx;
> +
> + idx = find_first_zero_bit(used_mask, num_counters);
> + if (idx == num_counters)
> + return -EAGAIN;
> +
> + set_bit(idx, used_mask);
> + event->hw.event_base = (unsigned long)l3c_pmu->base;
Trivial but blank line here.
> + return idx;
> +}
Powered by blists - more mailing lists