diff mbox series

[v3,06/15] platform: generic: Introduce pmu_init() platform override

Message ID 20231122073617.379441-7-peterlin@andestech.com
State Changes Requested
Headers show
Series Add Andes PMU extension support | expand

Commit Message

Yu-Chien Peter Lin Nov. 22, 2023, 7:36 a.m. UTC
Add pmu_init() platform override which will be used to register
PMU device and populate event mappings.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
Changes v2 -> v3:
  - New patch
---
 platform/generic/include/platform_override.h | 1 +
 platform/generic/platform.c                  | 3 +++
 2 files changed, 4 insertions(+)

Comments

Atish Patra Nov. 23, 2023, 12:25 a.m. UTC | #1
On Tue, Nov 21, 2023 at 11:40 PM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> Add pmu_init() platform override which will be used to register
> PMU device and populate event mappings.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Changes v2 -> v3:
>   - New patch
> ---
>  platform/generic/include/platform_override.h | 1 +
>  platform/generic/platform.c                  | 3 +++
>  2 files changed, 4 insertions(+)
>
> diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h
> index bf4b112..f2a4327 100644
> --- a/platform/generic/include/platform_override.h
> +++ b/platform/generic/include/platform_override.h
> @@ -27,6 +27,7 @@ struct platform_override {
>         int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
>         int (*extensions_init)(const struct fdt_match *match,
>                                struct sbi_hart_features *hfeatures);
> +       int (*pmu_init)(const struct fdt_match *match);
>         void (*fw_init)(void *fdt, const struct fdt_match *match);
>         int (*vendor_ext_provider)(long funcid,
>                                    const struct sbi_trap_regs *regs,
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index fa400b9..54a913b 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -267,6 +267,9 @@ static int generic_pmu_init(void)
>  {
>         int rc;
>
> +       if (generic_plat && generic_plat->pmu_init)
> +               return generic_plat->pmu_init(generic_plat_match);
> +


Reviewed-by: Atish Patra <atishp@rivosinc.com>

>         rc = fdt_pmu_setup(fdt_get_address());
>         if (rc && rc != SBI_ENOENT)
>                 return rc;
> --
> 2.34.1
>
Lad, Prabhakar Nov. 24, 2023, 2:49 p.m. UTC | #2
On Wed, Nov 22, 2023 at 7:41 AM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> Add pmu_init() platform override which will be used to register
> PMU device and populate event mappings.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Changes v2 -> v3:
>   - New patch
> ---
>  platform/generic/include/platform_override.h | 1 +
>  platform/generic/platform.c                  | 3 +++
>  2 files changed, 4 insertions(+)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Cheers,
Prabhakar

> diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h
> index bf4b112..f2a4327 100644
> --- a/platform/generic/include/platform_override.h
> +++ b/platform/generic/include/platform_override.h
> @@ -27,6 +27,7 @@ struct platform_override {
>         int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
>         int (*extensions_init)(const struct fdt_match *match,
>                                struct sbi_hart_features *hfeatures);
> +       int (*pmu_init)(const struct fdt_match *match);
>         void (*fw_init)(void *fdt, const struct fdt_match *match);
>         int (*vendor_ext_provider)(long funcid,
>                                    const struct sbi_trap_regs *regs,
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index fa400b9..54a913b 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -267,6 +267,9 @@ static int generic_pmu_init(void)
>  {
>         int rc;
>
> +       if (generic_plat && generic_plat->pmu_init)
> +               return generic_plat->pmu_init(generic_plat_match);
> +
>         rc = fdt_pmu_setup(fdt_get_address());
>         if (rc && rc != SBI_ENOENT)
>                 return rc;
> --
> 2.34.1
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h
index bf4b112..f2a4327 100644
--- a/platform/generic/include/platform_override.h
+++ b/platform/generic/include/platform_override.h
@@ -27,6 +27,7 @@  struct platform_override {
 	int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
 	int (*extensions_init)(const struct fdt_match *match,
 			       struct sbi_hart_features *hfeatures);
+	int (*pmu_init)(const struct fdt_match *match);
 	void (*fw_init)(void *fdt, const struct fdt_match *match);
 	int (*vendor_ext_provider)(long funcid,
 				   const struct sbi_trap_regs *regs,
diff --git a/platform/generic/platform.c b/platform/generic/platform.c
index fa400b9..54a913b 100644
--- a/platform/generic/platform.c
+++ b/platform/generic/platform.c
@@ -267,6 +267,9 @@  static int generic_pmu_init(void)
 {
 	int rc;
 
+	if (generic_plat && generic_plat->pmu_init)
+		return generic_plat->pmu_init(generic_plat_match);
+
 	rc = fdt_pmu_setup(fdt_get_address());
 	if (rc && rc != SBI_ENOENT)
 		return rc;