public inbox for opensbi@lists.infradead.org
 help / color / mirror / Atom feed
* [RFC PATCH v3 0/6] Extend the reserved PMP entries
@ 2025-11-30 11:16 Yu-Chien Peter Lin
  2025-11-30 11:16 ` [RFC PATCH v3 1/6] include: sbi: sbi_platform: add sbi_platform_reserved_pmp_count() Yu-Chien Peter Lin
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Yu-Chien Peter Lin @ 2025-11-30 11:16 UTC (permalink / raw)
  To: opensbi; +Cc: zong.li, greentime.hu, samuel.holland, Yu-Chien Peter Lin

This series extends OpenSBI to support multiple reserved PMP entries
that platforms can configure for critical memory protection needs.

Key characteristics of reserved PMP entries:

- Have highest priority
- Available in ToR mode for platform-specific use cases
- Persistent across domain context switches (cannot be disabled)
- Support runtime allocation through a dedicated allocator API

Motivation:

Reserved PMP entries address the need to protect memory regions that
cannot be covered by domain-managed PMP entries. For example, platforms
can enforce PMA_UNSAFE regions [1] parsed from the device tree. These
regions often cannot be precisely covered by one or two NAPOT entries,
so using reserved entries allocated in ToR mode optimizes PMP usage.

Additionally, reserved entries remain unchanged across domain transitions
and persist until hart reset, ensure consistent protections.

Use case demonstration:

This series includes a demonstration on the SiFive FU540 platform, which
uses a reserved PMP entry to protect the memory region at 0x0-0x1000
during early boot. This serves as a reference implementation showing how
platforms can leverage the reserved PMP allocator.

Changes v2->v3:
- Instead of using reserved-pmp-count DT property, this version adds
  sbi_platform_reserved_pmp_count() to determine the reserved PMP count

[1] https://lore.kernel.org/all/20251113014656.2605447-20-samuel.holland@sifive.com/

Yu-Chien Peter Lin (6):
  include: sbi: sbi_platform: add sbi_platform_reserved_pmp_count()
  lib: sbi_init: print total and reserved PMP counts
  lib: sbi: riscv_asm: support reserved PMP allocator
  lib: sbi: sbi_hart: extend PMP handling to support multiple reserved
    entries
  lib: sbi: sbi_init: call sbi_hart_init() earlier
  [TEMP] demonstrate hole protection using reserved PMP

 include/sbi/riscv_asm.h         |  6 +++
 include/sbi/sbi_hart.h          | 15 ------
 include/sbi/sbi_platform.h      | 35 +++++++++++++
 lib/sbi/riscv_asm.c             | 92 +++++++++++++++++++++++++++++++++
 lib/sbi/sbi_domain_context.c    |  6 ++-
 lib/sbi/sbi_hart.c              | 57 ++++++++++++++------
 lib/sbi/sbi_init.c              | 15 +++---
 platform/generic/sifive/fu540.c | 56 ++++++++++++++++++++
 8 files changed, 243 insertions(+), 39 deletions(-)

-- 
2.39.3


-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-02-11 15:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-30 11:16 [RFC PATCH v3 0/6] Extend the reserved PMP entries Yu-Chien Peter Lin
2025-11-30 11:16 ` [RFC PATCH v3 1/6] include: sbi: sbi_platform: add sbi_platform_reserved_pmp_count() Yu-Chien Peter Lin
2025-11-30 11:16 ` [RFC PATCH v3 2/6] lib: sbi_init: print total and reserved PMP counts Yu-Chien Peter Lin
2025-11-30 11:16 ` [RFC PATCH v3 3/6] lib: sbi: riscv_asm: support reserved PMP allocator Yu-Chien Peter Lin
2025-11-30 11:16 ` [RFC PATCH v3 4/6] lib: sbi: sbi_hart: extend PMP handling to support multiple reserved entries Yu-Chien Peter Lin
2025-11-30 11:16 ` [RFC PATCH v3 5/6] lib: sbi: sbi_init: call sbi_hart_init() earlier Yu-Chien Peter Lin
2025-11-30 11:16 ` [RFC PATCH v3 6/6] [TEMP] demonstrate hole protection using reserved PMP Yu-Chien Peter Lin
2026-02-11 15:29 ` [RFC PATCH v3 0/6] Extend the reserved PMP entries Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox