[PATCH v3 10/15] lib: utils: fdt_fixup: Allow preserving PMU properties
Atish Patra
atishp at atishpatra.org
Wed Nov 22 15:41:28 PST 2023
On Tue, Nov 21, 2023 at 11:40 PM Yu Chien Peter Lin
<peterlin at andestech.com> wrote:
>
> Add a scratch 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 at andestech.com>
> Reviewed-by: Anup Patel <anup at brainfault.org>
> ---
> Changes v1 -> v2:
> - New patch
> Changes v2 -> v3:
> - Rename to SBI_SCRATCH_PRESERVE_PMU_NODE (suggested by Anup)
> - Include Anup's RB tag
> ---
> include/sbi/sbi_scratch.h | 2 ++
> lib/utils/fdt/fdt_fixup.c | 6 +++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
> index e6a33ba..0f67cde 100644
> --- a/include/sbi/sbi_scratch.h
> +++ b/include/sbi/sbi_scratch.h
> @@ -151,6 +151,8 @@ enum sbi_scratch_options {
> SBI_SCRATCH_NO_BOOT_PRINTS = (1 << 0),
> /** Enable runtime debug prints */
> SBI_SCRATCH_DEBUG_PRINTS = (1 << 1),
> + /** Preserve PMU node properties */
> + SBI_SCRATCH_PRESERVE_PMU_NODE = (1 << 2),
> };
>
> /** Get pointer to sbi_scratch for current HART */
> diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c
> index e213ded..cf20edf 100644
> --- a/lib/utils/fdt/fdt_fixup.c
> +++ b/lib/utils/fdt/fdt_fixup.c
> @@ -387,6 +387,8 @@ int fdt_reserved_memory_fixup(void *fdt)
>
> void fdt_fixups(void *fdt)
> {
> + struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
> +
> fdt_aplic_fixup(fdt);
>
> fdt_imsic_fixup(fdt);
> @@ -394,5 +396,7 @@ void fdt_fixups(void *fdt)
> fdt_plic_fixup(fdt);
>
> fdt_reserved_memory_fixup(fdt);
> - fdt_pmu_fixup(fdt);
> +
> + if (!(scratch->options & SBI_SCRATCH_PRESERVE_PMU_NODE))
> + fdt_pmu_fixup(fdt);
> }
> --
> 2.34.1
>
Reviewed-by: Atish Patra <atishp at rivosinc.com>
--
Regards,
Atish
More information about the opensbi
mailing list