* [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter
@ 2026-01-27 23:58 Charlie Jenkins via B4 Relay
2026-02-02 19:28 ` Atish Patra
2026-02-23 4:59 ` Anup Patel
0 siblings, 2 replies; 4+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-01-27 23:58 UTC (permalink / raw)
To: opensbi; +Cc: Charlie Jenkins
From: Charlie Jenkins <thecharlesjenkins@gmail.com>
When a SBI_PMU_FW_PLATFORM starts, add the counter to the counter array
instead of returning early. This will cause fw_counter_stop() to be
called when a SBI_PMU_FW_PLATFORM counter should be stopped.
Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
lib/sbi/sbi_pmu.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
index e084005d..3c61079b 100644
--- a/lib/sbi/sbi_pmu.c
+++ b/lib/sbi/sbi_pmu.c
@@ -448,6 +448,8 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
uint64_t event_data, uint64_t ival,
bool ival_update)
{
+ int rc = 0;
+
if ((event_code >= SBI_PMU_FW_MAX &&
event_code <= SBI_PMU_FW_RESERVED_MAX) ||
event_code > SBI_PMU_FW_PLATFORM)
@@ -468,9 +470,9 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
cidx - num_hw_ctrs,
ival);
- return pmu_dev->fw_counter_start(phs->hartid,
- cidx - num_hw_ctrs,
- event_data);
+ rc = pmu_dev->fw_counter_start(phs->hartid,
+ cidx - num_hw_ctrs,
+ event_data);
} else {
if (ival_update)
phs->fw_counters_data[cidx - num_hw_ctrs] = ival;
@@ -478,7 +480,7 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
phs->fw_counters_started |= BIT(cidx - num_hw_ctrs);
- return 0;
+ return rc;
}
static void pmu_update_inhibit_flags(unsigned long flags, uint64_t *mhpmevent_val)
---
base-commit: 74434f255873d74e56cc50aa762d1caf24c099f8
change-id: 20260127-pmu_platform_stop-febef65abf54
- Charlie
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter
2026-01-27 23:58 [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter Charlie Jenkins via B4 Relay
@ 2026-02-02 19:28 ` Atish Patra
2026-02-23 4:59 ` Anup Patel
1 sibling, 0 replies; 4+ messages in thread
From: Atish Patra @ 2026-02-02 19:28 UTC (permalink / raw)
To: thecharlesjenkins, opensbi
On 1/27/26 3:58 PM, Charlie Jenkins via B4 Relay wrote:
> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
>
> When a SBI_PMU_FW_PLATFORM starts, add the counter to the counter array
> instead of returning early. This will cause fw_counter_stop() to be
> called when a SBI_PMU_FW_PLATFORM counter should be stopped.
>
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
> ---
> lib/sbi/sbi_pmu.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
> index e084005d..3c61079b 100644
> --- a/lib/sbi/sbi_pmu.c
> +++ b/lib/sbi/sbi_pmu.c
> @@ -448,6 +448,8 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> uint64_t event_data, uint64_t ival,
> bool ival_update)
> {
> + int rc = 0;
> +
> if ((event_code >= SBI_PMU_FW_MAX &&
> event_code <= SBI_PMU_FW_RESERVED_MAX) ||
> event_code > SBI_PMU_FW_PLATFORM)
> @@ -468,9 +470,9 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> cidx - num_hw_ctrs,
> ival);
>
> - return pmu_dev->fw_counter_start(phs->hartid,
> - cidx - num_hw_ctrs,
> - event_data);
> + rc = pmu_dev->fw_counter_start(phs->hartid,
> + cidx - num_hw_ctrs,
> + event_data);
> } else {
> if (ival_update)
> phs->fw_counters_data[cidx - num_hw_ctrs] = ival;
> @@ -478,7 +480,7 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
>
> phs->fw_counters_started |= BIT(cidx - num_hw_ctrs);
>
> - return 0;
> + return rc;
> }
>
> static void pmu_update_inhibit_flags(unsigned long flags, uint64_t *mhpmevent_val)
>
Reviewed-by: Atish Patra <atishp@meta.com>
> ---
> base-commit: 74434f255873d74e56cc50aa762d1caf24c099f8
> change-id: 20260127-pmu_platform_stop-febef65abf54
>
> - Charlie
>
>
>
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter
2026-01-27 23:58 [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter Charlie Jenkins via B4 Relay
2026-02-02 19:28 ` Atish Patra
@ 2026-02-23 4:59 ` Anup Patel
2026-02-26 0:35 ` Charlie Jenkins
1 sibling, 1 reply; 4+ messages in thread
From: Anup Patel @ 2026-02-23 4:59 UTC (permalink / raw)
To: thecharlesjenkins; +Cc: opensbi
On Wed, Jan 28, 2026 at 5:28 AM Charlie Jenkins via B4 Relay
<devnull+thecharlesjenkins.gmail.com@kernel.org> wrote:
>
> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
>
> When a SBI_PMU_FW_PLATFORM starts, add the counter to the counter array
> instead of returning early. This will cause fw_counter_stop() to be
> called when a SBI_PMU_FW_PLATFORM counter should be stopped.
>
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
This is already covered by the following patch:
"lib: sbi_pmu: Fix multiple FW counter start operations with custom PMU device"
Regards,
Anup
> ---
> lib/sbi/sbi_pmu.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
> index e084005d..3c61079b 100644
> --- a/lib/sbi/sbi_pmu.c
> +++ b/lib/sbi/sbi_pmu.c
> @@ -448,6 +448,8 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> uint64_t event_data, uint64_t ival,
> bool ival_update)
> {
> + int rc = 0;
> +
> if ((event_code >= SBI_PMU_FW_MAX &&
> event_code <= SBI_PMU_FW_RESERVED_MAX) ||
> event_code > SBI_PMU_FW_PLATFORM)
> @@ -468,9 +470,9 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> cidx - num_hw_ctrs,
> ival);
>
> - return pmu_dev->fw_counter_start(phs->hartid,
> - cidx - num_hw_ctrs,
> - event_data);
> + rc = pmu_dev->fw_counter_start(phs->hartid,
> + cidx - num_hw_ctrs,
> + event_data);
> } else {
> if (ival_update)
> phs->fw_counters_data[cidx - num_hw_ctrs] = ival;
> @@ -478,7 +480,7 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
>
> phs->fw_counters_started |= BIT(cidx - num_hw_ctrs);
>
> - return 0;
> + return rc;
> }
>
> static void pmu_update_inhibit_flags(unsigned long flags, uint64_t *mhpmevent_val)
>
> ---
> base-commit: 74434f255873d74e56cc50aa762d1caf24c099f8
> change-id: 20260127-pmu_platform_stop-febef65abf54
>
> - Charlie
>
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter
2026-02-23 4:59 ` Anup Patel
@ 2026-02-26 0:35 ` Charlie Jenkins
0 siblings, 0 replies; 4+ messages in thread
From: Charlie Jenkins @ 2026-02-26 0:35 UTC (permalink / raw)
To: Anup Patel; +Cc: opensbi
On Mon, Feb 23, 2026 at 10:29:44AM +0530, Anup Patel wrote:
> On Wed, Jan 28, 2026 at 5:28 AM Charlie Jenkins via B4 Relay
> <devnull+thecharlesjenkins.gmail.com@kernel.org> wrote:
> >
> > From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> >
> > When a SBI_PMU_FW_PLATFORM starts, add the counter to the counter array
> > instead of returning early. This will cause fw_counter_stop() to be
> > called when a SBI_PMU_FW_PLATFORM counter should be stopped.
> >
> > Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
>
> This is already covered by the following patch:
> "lib: sbi_pmu: Fix multiple FW counter start operations with custom PMU device"
>
> Regards,
> Anup
Great, thanks for applying that one!
- Charlie
>
> > ---
> > lib/sbi/sbi_pmu.c | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
> > index e084005d..3c61079b 100644
> > --- a/lib/sbi/sbi_pmu.c
> > +++ b/lib/sbi/sbi_pmu.c
> > @@ -448,6 +448,8 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> > uint64_t event_data, uint64_t ival,
> > bool ival_update)
> > {
> > + int rc = 0;
> > +
> > if ((event_code >= SBI_PMU_FW_MAX &&
> > event_code <= SBI_PMU_FW_RESERVED_MAX) ||
> > event_code > SBI_PMU_FW_PLATFORM)
> > @@ -468,9 +470,9 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> > cidx - num_hw_ctrs,
> > ival);
> >
> > - return pmu_dev->fw_counter_start(phs->hartid,
> > - cidx - num_hw_ctrs,
> > - event_data);
> > + rc = pmu_dev->fw_counter_start(phs->hartid,
> > + cidx - num_hw_ctrs,
> > + event_data);
> > } else {
> > if (ival_update)
> > phs->fw_counters_data[cidx - num_hw_ctrs] = ival;
> > @@ -478,7 +480,7 @@ static int pmu_ctr_start_fw(struct sbi_pmu_hart_state *phs,
> >
> > phs->fw_counters_started |= BIT(cidx - num_hw_ctrs);
> >
> > - return 0;
> > + return rc;
> > }
> >
> > static void pmu_update_inhibit_flags(unsigned long flags, uint64_t *mhpmevent_val)
> >
> > ---
> > base-commit: 74434f255873d74e56cc50aa762d1caf24c099f8
> > change-id: 20260127-pmu_platform_stop-febef65abf54
> >
> > - Charlie
> >
> >
> >
> > --
> > opensbi mailing list
> > opensbi@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-26 0:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 23:58 [PATCH] lib: sbi_pmu: Track SBI_PMU_FW_PLATFORM started counter Charlie Jenkins via B4 Relay
2026-02-02 19:28 ` Atish Patra
2026-02-23 4:59 ` Anup Patel
2026-02-26 0:35 ` Charlie Jenkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox