All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 6/6] lib: sbi: Do not enter OpenSBI with mseccfg.MML == 1
Date: Tue, 12 Dec 2023 15:29:26 +0530	[thread overview]
Message-ID: <20231212095926.13371-7-apatel@ventanamicro.com> (raw)
In-Reply-To: <20231212095926.13371-1-apatel@ventanamicro.com>

On platforms with Smepmp, the previous booting stage must enter
OpenSBI with mseccfg.MML == 0. This allows OpenSBI to configure
it's own M-mode only regions without depending on the previous
booting stage.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 lib/sbi/sbi_hart.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 6acff37..16da38d 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -975,6 +975,16 @@ __pmp_skip:
 	/* Mark hart feature detection done */
 	hfeatures->detected = true;
 
+	/*
+	 * On platforms with Smepmp, the previous booting stage must
+	 * enter OpenSBI with mseccfg.MML == 0. This allows OpenSBI
+	 * to configure it's own M-mode only regions without depending
+	 * on the previous booting stage.
+	 */
+	if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMEPMP) &&
+	    (csr_read(CSR_MSECCFG) & MSECCFG_MML))
+		return SBI_EILL;
+
 	return 0;
 }
 
-- 
2.34.1



  parent reply	other threads:[~2023-12-12  9:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  9:59 [PATCH v2 0/6] Assorted improvements Anup Patel
2023-12-12  9:59 ` [PATCH v2 1/6] lib: sbi_tlb: Reduce size of struct sbi_tlb_info Anup Patel
2023-12-12  9:59 ` [PATCH v2 2/6] platform: generic: Fine tune fw_platform_calculate_heap_size() Anup Patel
2023-12-12  9:59 ` [PATCH v2 3/6] lib: utils/irqchip: Add shared MMIO region for PLIC in root domain Anup Patel
2023-12-12  9:59 ` [PATCH v2 4/6] lib: sbi: Allow ecall handlers to directly update register state Anup Patel
2023-12-12  9:59 ` [PATCH v2 5/6] lib: sbi: Remove the SBI_ETRAP error code Anup Patel
2023-12-12  9:59 ` Anup Patel [this message]
2023-12-19 13:54 ` [PATCH v2 0/6] Assorted improvements Anup Patel

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=20231212095926.13371-7-apatel@ventanamicro.com \
    --to=apatel@ventanamicro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.