[PATCH v3 0/5] Add WorldGuard support with SiFive WG checker

Raymond Mao raymondmaoca at gmail.com
Fri Sep 4 09:29:10 PDT 2026


From: Raymond Mao <raymond.mao at riscstar.com>

This series adds WorldGuard support according to the wgchecker2 DT-
binding proposal from SiFive [1] with QEMU virt integration.

The implementation:
- reuse sbi_hart_protection for hart-local runtime reconfiguration
- reuse sbi_domain_data for per-domain WorldGuard state
- keep WorldGuard-specific setup and checker programming in platform
  code

At boot, the generic platform code invokes a QEMU virt WorldGuard
setup path which:
- parses wgchecker2 checker instances
- parses provider partition at N entries and programs checker MMIO
- parses per-hart CPU defaults from /cpus
- parses per-domain WorldGuard metadata under hw-isolation

Checker programming is provider-driven. Consumer-side
access-controllers references are carried for DT-binding alignment.

During domain transitions, the WorldGuard hart protection
implementation reprograms MLWID and, when available, MLWIDLIST,
MWIDDELEG, and SLWID.

The series is split as follows:
1. add reusable FDT helpers needed by the WorldGuard parser
2. add WorldGuard CSR definitions and hart extension flags
3. document the current DT layout consumed by the implementation
4. add the wgchecker2 / WorldGuard runtime and QEMU virt integration

Tested with:
- QEMU riscv-wg-v4-260821 [2] with arg 'worlds=on' and the merged
  WorldGuard test DTB.

[1] dt-bindings: riscv: Add RISC-V Worlds and SiFive WorldGuard DT
    bindings
    https://lore.kernel.org/linux-devicetree/20260812122131.1534906-1-peter.lin@sifive.com/
[2] https://github.com/cwshu/qemu/tree/riscv-wg-v4-260821

Raymond Mao (5):
  lib: utils: fdt: add generic domain and property parsing helpers
  hart: add WorldGuard CSR IDs and hart extension flags
  docs: document WorldGuard DT bindings
  platform: generic: add WorldGuard checker support
  [NOT-FOR-UPSTREAM] platform: virt: add QEMU WorldGuard overlay

 docs/domain_support.md                        | 212 +++++++
 include/sbi/riscv_encoding.h                  |   4 +
 include/sbi/sbi_hart.h                        |  10 +
 include/sbi_utils/fdt/fdt_domain.h            |  13 +
 include/sbi_utils/fdt/fdt_helper.h            |  10 +
 lib/sbi/sbi_hart.c                            |   5 +
 lib/utils/fdt/fdt_domain.c                    |  46 +-
 lib/utils/fdt/fdt_helper.c                    |  76 +++
 .../generic/include/qemu_virt_worldguard.h    |  13 +
 platform/generic/include/wgchecker.h          |  91 +++
 platform/generic/include/worldguard.h         |  36 ++
 platform/generic/objects.mk                   |   3 +
 platform/generic/platform.c                   |  15 +-
 .../generic/virt/qemu-virt-wg-overlay.dts     | 198 +++++++
 platform/generic/virt/qemu_virt_worldguard.c  |  25 +
 platform/generic/wgchecker.c                  | 546 ++++++++++++++++++
 platform/generic/worldguard.c                 | 544 +++++++++++++++++
 17 files changed, 1845 insertions(+), 2 deletions(-)
 create mode 100644 platform/generic/include/qemu_virt_worldguard.h
 create mode 100644 platform/generic/include/wgchecker.h
 create mode 100644 platform/generic/include/worldguard.h
 create mode 100644 platform/generic/virt/qemu-virt-wg-overlay.dts
 create mode 100644 platform/generic/virt/qemu_virt_worldguard.c
 create mode 100644 platform/generic/wgchecker.c
 create mode 100644 platform/generic/worldguard.c

-- 
2.25.1



More information about the opensbi mailing list