Prepare memregion handling for future isolation primitives
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | lib: sbi: Separate domain-handling code from memregion-handling codeinclude/ include/ lib/ +2 more | +507 | 0 replies | |
| 2/8 | lib: sbi: Create sbi_domain_dump_memregions()include/ lib/ lib/ | +45 | 0 replies | |
| 3/8 | lib: sbi: Rename domain_memregion -> memregiondocs/ include/ include/ +19 more | +254 | 0 replies | |
| 4/8 | lib: sbi: memregion: Introduce memregion_start/end macrosinclude/ lib/ | +16 | 0 replies | |
| 5/8 | lib: sbi: memregion: Make memregions keep track of raw size rather than orderdocs/ include/ include/ +5 more | +102 | 0 replies | |
| 6/8 | lib: sbi: Do a merging pass on memregions whenever a domain is sanitizedlib/ lib/ | +94 | 0 replies | |
| 7/8 | lib: sbi: Remove PMP assumptions from memregioninclude/ include/ include/ +5 more | +128 | 0 replies | |
| 8/8 | lib: sbi: memregion: Move memregion_sanitize_pmp() closer to its call sitelib/ | +22 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/8] Prepare memregion handling for future isolation primitives
The existing memregion handling code deeply embeds the assumption that we will be isolating domains using PMP/SMEPMP rather than another isolation primitive. I am currently working on a series of patches that will enable SMMTT [1] support in both OpenSBI and QEMU. SMMTT is a much more granular, table-based isolation primitive which does not have the same alignment/sizing requirements as PMP.
This patch series lays some of the groundwork for landing SMMTT support in OpenSBI. Perhaps the most significant change here is that memregions now keep track of their raw sizes (rather than power-of-two rounded orders) throughout most of their lifetime. Then, when OpenSBI is about to apply its isolation configuration at the end of the coldboot/warmboot paths, the memregions for each domain are "sanitized" according to isolation primitive-specific rules.
The first two patches in this series are optional to apply, although I've found them useful when developing SMMTT. The first moves the memregion-related functionality out of sbi_domain.c into a new sbi_memregion.c. The second renames struct sbi_domain_memregion to struct sbi_memregion, while also renaming all of the memregion permission macros similarly. This makes the code somewhat more readable, especially since domain-handling and memregion-handling become more decoupled throughout this patch series.
[1] https://github.com/riscv/riscv-smmtt
Gregor Haas (8):
lib: sbi: Separate domain-handling code from memregion-handling code
lib: sbi: Create sbi_domain_dump_memregions()
lib: sbi: Rename domain_memregion -> memregion
lib: sbi: memregion: Introduce memregion_start/end macros
lib: sbi: memregion: Make memregions keep track of raw size rather
than order
lib: sbi: Do a merging pass on memregions whenever a domain is
sanitized
lib: sbi: Remove PMP assumptions from memregion
lib: sbi: memregion: Move memregion_sanitize_pmp() closer to its call
site
docs/domain_support.md | 45 ++- include/sbi/sbi_domain.h | 192 +--------- include/sbi/sbi_hart.h | 2 +- include/sbi/sbi_memregion.h | 215 +++++++++++ include/sbi/sbi_platform.h | 2 +- lib/sbi/objects.mk | 1 + lib/sbi/sbi_domain.c | 444 +++------------------- lib/sbi/sbi_domain_context.c | 2 +- lib/sbi/sbi_hart.c | 91 +++-- lib/sbi/sbi_init.c | 6 +- lib/sbi/sbi_memregion.c | 459 +++++++++++++++++++++++ lib/utils/fdt/fdt_domain.c | 53 +-- lib/utils/fdt/fdt_fixup.c | 20 +- lib/utils/ipi/aclint_mswi.c | 12 +- lib/utils/ipi/andes_plicsw.c | 6 +- lib/utils/irqchip/aplic.c | 12 +- lib/utils/irqchip/imsic.c | 13 +- lib/utils/irqchip/plic.c | 4 +- lib/utils/regmap/fdt_regmap_syscon.c | 4 +- lib/utils/serial/cadence-uart.c | 4 +- lib/utils/serial/fdt_serial_htif.c | 4 +- lib/utils/serial/uart8250.c | 4 +- lib/utils/timer/aclint_mtimer.c | 24 +- lib/utils/timer/andes_plmt.c | 6 +- platform/generic/renesas/rzfive/rzfive.c | 2 +- platform/generic/sophgo/sg2042.c | 6 +- 26 files changed, 910 insertions(+), 723 deletions(-) create mode 100644 include/sbi/sbi_memregion.h create mode 100644 lib/sbi/sbi_memregion.c
Signature · 1 line
2.45.2