diff mbox series

[v4,10/15] lib: utils: fdt_fixup: Allow preserving PMU properties

Message ID 20231130124213.2590640-11-peterlin@andestech.com
State Accepted
Headers show
Series Add Andes PMU extension support | expand

Commit Message

Yu Chien Peter Lin Nov. 30, 2023, 12:42 p.m. UTC
Add a Kconfig option to control PMU fixup, so the next
stage software can dump the PMU node including event
mapping information for debugging purposes.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
Changes v1 -> v2:
  - New patch
Changes v2 -> v3:
  - Rename to SBI_SCRATCH_PRESERVE_PMU_NODE (suggested by Anup)
  - Include Anup's RB tag
Changes v3 -> v4:
  - Use Kconfig instead (suggested by Anup)
---
 lib/utils/fdt/Kconfig     | 7 +++++++
 lib/utils/fdt/fdt_fixup.c | 3 +++
 2 files changed, 10 insertions(+)

Comments

Atish Patra Dec. 4, 2023, 9:05 a.m. UTC | #1
On Thu, Nov 30, 2023 at 4:43 AM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> Add a Kconfig option to control PMU fixup, so the next
> stage software can dump the PMU node including event
> mapping information for debugging purposes.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Changes v1 -> v2:
>   - New patch
> Changes v2 -> v3:
>   - Rename to SBI_SCRATCH_PRESERVE_PMU_NODE (suggested by Anup)
>   - Include Anup's RB tag
> Changes v3 -> v4:
>   - Use Kconfig instead (suggested by Anup)
> ---
>  lib/utils/fdt/Kconfig     | 7 +++++++
>  lib/utils/fdt/fdt_fixup.c | 3 +++
>  2 files changed, 10 insertions(+)
>
> diff --git a/lib/utils/fdt/Kconfig b/lib/utils/fdt/Kconfig
> index 23b003b..9a42d15 100644
> --- a/lib/utils/fdt/Kconfig
> +++ b/lib/utils/fdt/Kconfig
> @@ -15,4 +15,11 @@ config FDT_PMU
>         bool "FDT performance monitoring unit (PMU) support"
>         default n
>
> +config FDT_FIXUPS_PRESERVE_PMU_NODE
> +       bool "Preserve PMU node in device-tree"
> +       depends on FDT_PMU
> +       default n
> +       help
> +         Preserve PMU node properties for debugging purposes.
> +
>  endif
> diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c
> index e213ded..5fc7673 100644
> --- a/lib/utils/fdt/fdt_fixup.c
> +++ b/lib/utils/fdt/fdt_fixup.c
> @@ -394,5 +394,8 @@ void fdt_fixups(void *fdt)
>         fdt_plic_fixup(fdt);
>
>         fdt_reserved_memory_fixup(fdt);
> +
> +#ifndef CONFIG_FDT_FIXUPS_PRESERVE_PMU_NODE
>         fdt_pmu_fixup(fdt);
> +#endif
>  }
> --
> 2.34.1
>


Reviewed-by: Atish Patra <atishp@rivosinc.com>
Anup Patel Dec. 6, 2023, 12:31 p.m. UTC | #2
On Thu, Nov 30, 2023 at 6:13 PM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> Add a Kconfig option to control PMU fixup, so the next
> stage software can dump the PMU node including event
> mapping information for debugging purposes.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
> Changes v1 -> v2:
>   - New patch
> Changes v2 -> v3:
>   - Rename to SBI_SCRATCH_PRESERVE_PMU_NODE (suggested by Anup)
>   - Include Anup's RB tag
> Changes v3 -> v4:
>   - Use Kconfig instead (suggested by Anup)
> ---
>  lib/utils/fdt/Kconfig     | 7 +++++++
>  lib/utils/fdt/fdt_fixup.c | 3 +++
>  2 files changed, 10 insertions(+)
>
> diff --git a/lib/utils/fdt/Kconfig b/lib/utils/fdt/Kconfig
> index 23b003b..9a42d15 100644
> --- a/lib/utils/fdt/Kconfig
> +++ b/lib/utils/fdt/Kconfig
> @@ -15,4 +15,11 @@ config FDT_PMU
>         bool "FDT performance monitoring unit (PMU) support"
>         default n
>
> +config FDT_FIXUPS_PRESERVE_PMU_NODE
> +       bool "Preserve PMU node in device-tree"
> +       depends on FDT_PMU
> +       default n
> +       help
> +         Preserve PMU node properties for debugging purposes.
> +
>  endif
> diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c
> index e213ded..5fc7673 100644
> --- a/lib/utils/fdt/fdt_fixup.c
> +++ b/lib/utils/fdt/fdt_fixup.c
> @@ -394,5 +394,8 @@ void fdt_fixups(void *fdt)
>         fdt_plic_fixup(fdt);
>
>         fdt_reserved_memory_fixup(fdt);
> +
> +#ifndef CONFIG_FDT_FIXUPS_PRESERVE_PMU_NODE
>         fdt_pmu_fixup(fdt);
> +#endif
>  }
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/lib/utils/fdt/Kconfig b/lib/utils/fdt/Kconfig
index 23b003b..9a42d15 100644
--- a/lib/utils/fdt/Kconfig
+++ b/lib/utils/fdt/Kconfig
@@ -15,4 +15,11 @@  config FDT_PMU
 	bool "FDT performance monitoring unit (PMU) support"
 	default n
 
+config FDT_FIXUPS_PRESERVE_PMU_NODE
+	bool "Preserve PMU node in device-tree"
+	depends on FDT_PMU
+	default n
+	help
+	  Preserve PMU node properties for debugging purposes.
+
 endif
diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c
index e213ded..5fc7673 100644
--- a/lib/utils/fdt/fdt_fixup.c
+++ b/lib/utils/fdt/fdt_fixup.c
@@ -394,5 +394,8 @@  void fdt_fixups(void *fdt)
 	fdt_plic_fixup(fdt);
 
 	fdt_reserved_memory_fixup(fdt);
+
+#ifndef CONFIG_FDT_FIXUPS_PRESERVE_PMU_NODE
 	fdt_pmu_fixup(fdt);
+#endif
 }