From: Rahul Pathak <rahul.pathak@oss.qualcomm.com>
To: opensbi@lists.infradead.org
Cc: rahul.pathak@oss.qualcomm, rahul@summations.net,
Rahul Pathak <rahul.pathak@oss.qualcomm.com>
Subject: [RFC PATCH v4 4/4] lib: sbi: Initialize SMMPT during coldboot
Date: Mon, 24 Aug 2026 07:39:52 +0530 [thread overview]
Message-ID: <20260824020953.2438946-5-rahul.pathak@oss.qualcomm.com> (raw)
In-Reply-To: <20260824020953.2438946-1-rahul.pathak@oss.qualcomm.com>
Call sbi_mpt_init() function from coldboot path of
sbi_hart_init() to initialize the SMMPT core. It will
create and the MPT tables for each SBI domain and maps
its memregions with appropriate permissions in MPT tables.
Also each MPT table requires to memory to install tables
so reserve more space in heap for MPT tables
Signed-off-by: Rahul Pathak <rahul.pathak@oss.qualcomm.com>
---
lib/sbi/sbi_hart.c | 8 +++++++-
platform/generic/platform.c | 9 +++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 4261fea8..cc18b2c5 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -1,4 +1,4 @@
-/*
+/*sbi_hart.
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
@@ -21,6 +21,7 @@
#include <sbi/sbi_pmu.h>
#include <sbi/sbi_string.h>
#include <sbi/sbi_trap.h>
+#include <sbi/sbi_hart_mpt.h>
extern void __sbi_expected_trap(void);
extern void __sbi_expected_trap_hext(void);
@@ -731,6 +732,11 @@ int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot)
rc = sbi_hart_pmp_init(scratch);
if (rc)
return rc;
+
+ /* Smmpt is optional. Continue if the Smmpt is not present. */
+ rc = sbi_mpt_init();
+ if (rc && rc != SBI_ENODEV)
+ return rc;
}
return sbi_hart_reinit(scratch);
diff --git a/platform/generic/platform.c b/platform/generic/platform.c
index 1df0280d..ccf6f756 100644
--- a/platform/generic/platform.c
+++ b/platform/generic/platform.c
@@ -42,6 +42,15 @@ static u32 fw_platform_calculate_heap_size(u32 hart_count)
/* For TLB fifo */
heap_size += SBI_TLB_INFO_SIZE * (hart_count) * (hart_count);
+ /*
+ * MPT table budget
+ * 1 MiB memory for MPT allocated currently.
+ *
+ * TODO: Need better way to get the memory budget based on active
+ * SMMPT mode.
+ */
+ heap_size += 1024 * 1024;
+
return BIT_ALIGN(heap_size, HEAP_BASE_ALIGN);
}
--
2.53.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-08-24 2:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 2:09 [RFC PATCH v4 0/4] Add Smsdid and Smmpt supervisor domain protection Rahul Pathak
2026-08-24 2:09 ` [RFC PATCH v4 1/4] lib: sbi_domain: Add finalize callback for per-domain state Rahul Pathak
2026-08-25 16:19 ` Pawandeep Oza
2026-08-24 2:09 ` [RFC PATCH v4 2/4] riscv: Add Smsdid and Smmpt hart extensions Rahul Pathak
2026-08-24 2:09 ` [RFC PATCH v4 3/4] mpt: Add Smsdid and Smmpt supervisor domain core Rahul Pathak
2026-08-24 2:09 ` Rahul Pathak [this message]
2026-08-24 5:30 ` [RFC PATCH v4 4/4] lib: sbi: Initialize SMMPT during coldboot Ranbir Singh
2026-08-24 5:43 ` Rahul Pathak
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=20260824020953.2438946-5-rahul.pathak@oss.qualcomm.com \
--to=rahul.pathak@oss.qualcomm.com \
--cc=opensbi@lists.infradead.org \
--cc=rahul.pathak@oss.qualcomm \
--cc=rahul@summations.net \
/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.