OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Chien Peter Lin <peterlin@andestech.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 08/11] lib: utils: fdt_fixup: Allow preserving PMU properties
Date: Thu, 19 Oct 2023 19:37:10 +0800	[thread overview]
Message-ID: <20231019113713.3508153-9-peterlin@andestech.com> (raw)
In-Reply-To: <20231019113713.3508153-1-peterlin@andestech.com>

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@andestech.com>
---
Changes v1 -> v2:
  - New patch
---
 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..7914dfb 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_PROP = (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 67e2e2e..b0c885f 100644
--- a/lib/utils/fdt/fdt_fixup.c
+++ b/lib/utils/fdt/fdt_fixup.c
@@ -482,6 +482,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);
@@ -489,5 +491,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_PROP))
+		fdt_pmu_fixup(fdt);
 }
-- 
2.34.1



  parent reply	other threads:[~2023-10-19 11:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 11:37 [PATCH v2 00/11] Add Andes PMU extension support Yu Chien Peter Lin
2023-10-19 11:37 ` [PATCH v2 01/11] sbi: sbi_pmu: Improve sbi_pmu_init() error handling Yu Chien Peter Lin
2023-11-16  6:32   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 02/11] sbi: sbi_pmu: Add hw_counter_filter_mode() to pmu device Yu Chien Peter Lin
2023-11-16  6:36   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 03/11] platform: include: andes45: Add PMU related CSR defines Yu Chien Peter Lin
2023-11-16  6:39   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 04/11] platform: andes: Add Andes custom PMU support Yu Chien Peter Lin
2023-11-16  6:41   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 05/11] platform: andes: Enable Andes PMU for AE350 Yu Chien Peter Lin
2023-11-16  6:45   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 06/11] platform: rzfive: Enable Andes PMU for RZ/Five Yu Chien Peter Lin
2023-11-16  6:45   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 07/11] lib: utils: fdt_fixup: Add fdt_add_pmu_mappings() helper function Yu Chien Peter Lin
2023-10-21 12:25   ` [PATCH v2 10/11] platform: andes: Implement andes_fdt_add_pmu_mappings platform override Inochi Amaoto
2023-10-22  6:50     ` Yu-Chien Peter Lin
2023-11-16  6:59   ` [PATCH v2 07/11] lib: utils: fdt_fixup: Add fdt_add_pmu_mappings() helper function Anup Patel
2023-10-19 11:37 ` Yu Chien Peter Lin [this message]
2023-11-16  6:48   ` [PATCH v2 08/11] lib: utils: fdt_fixup: Allow preserving PMU properties Anup Patel
2023-10-19 11:37 ` [PATCH v2 09/11] platform: andes: Factor out is_andes() helper Yu Chien Peter Lin
2023-11-16  6:49   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 10/11] platform: andes: Implement andes_fdt_add_pmu_mappings platform override Yu Chien Peter Lin
2023-11-16  6:58   ` Anup Patel
2023-10-19 11:37 ` [PATCH v2 11/11] docs: pmu: Add Andes PMU node example Yu Chien Peter Lin
2023-11-16  7:00   ` Anup Patel
2023-11-16  7:01 ` [PATCH v2 00/11] Add Andes PMU extension support Anup Patel
2023-11-21  7:44   ` Yu-Chien Peter Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019113713.3508153-9-peterlin@andestech.com \
    --to=peterlin@andestech.com \
    --cc=opensbi@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox