OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Raymond Mao <raymondmaoca@gmail.com>
To: opensbi@lists.infradead.org
Cc: scott@riscstar.com, dave.patel@riscstar.com,
	raymond.mao@riscstar.com, robin.randhawa@sifive.com,
	samuel.holland@sifive.com, anup.patel@qti.qualcomm.com,
	anuppate@qti.qualcomm.com, anup@brainfault.org,
	dhaval@rivosinc.com, peter.lin@sifive.com
Subject: [PATCH 0/7] Add WorldGuard hwiso support
Date: Tue, 19 May 2026 16:33:24 -0400	[thread overview]
Message-ID: <20260519203331.2773185-1-raymondmaoca@gmail.com> (raw)

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

This series adds WorldGuard implementation for OpenSBI on top of the
generic hardware isolation (HWISO) hooks.

The goal is to let OpenSBI:
- program platform WorldGuard checker state at boot
- parse per-domain WorldGuard metadata from the device tree
- reprogram hart WorldGuard runtime state during domain transitions

The current implementation targets the WorldGuard model of
`sifive,wgchecker2` checker plus per-hart and per-domain WorldGuard
metadata from DT.

The series is organized as follows:
1. add the WorldGuard CSR definitions and hart extension flags needed
   to detect support for MLWID, MWIDDELEG, and SLWID
2. document the HWISO / WorldGuard device-tree metadata used by the
   current implementation
3. add a QEMU virt DT overlay that describes domain WID/WID list
   assignment and checker permission policy for the current test flow
4. add generic-platform WorldGuard runtime support together with
   `wgchecker2` checker parsing and boot-time MMIO programming
5. add generic HWISO SBIUNIT coverage
6. add QEMU virt WorldGuard mechanism-specific SBIUNIT checks for
   boot-time checker programming and runtime CSR state
7. add a QEMU virt failure-mode SBIUNIT test that intentionally
   triggers a denied WorldGuard access and verifies the expected trap

Notes:
- The implementation has been verified with QEMU virt that supports
  `wg=on`[1].
- This series depends on previous patches ([2] and [3]) for
  introducing HWISO framework.

[1] https://github.com/cwshu/qemu/tree/riscv-wg-dts
[2] [PATCH 1/2] sbi: add hardware isolation abstraction framework 
    https://lore.kernel.org/opensbi/20260504173948.1663823-1-raymondmaoca@gmail.com/
[3] [PATCH 2/2] sbi: route domain lifecycle transitions through hwiso hooks
    https://lore.kernel.org/opensbi/20260504173948.1663823-2-raymondmaoca@gmail.com/

Raymond Mao (7):
  hart: add WorldGuard CSR IDs and hart extension flags
  docs: document hwiso WorldGuard DT bindings
  [NOT-FOR-UPSTREAM] platform: virt: add QEMU WorldGuard hwiso overlay
  platform: generic: add WorldGuard hwiso support with wgchecker2
  test: add generic hwiso SBI unit coverage
  platform: virt: add QEMU virt WorldGuard hwiso tests
  platform: virt: add WorldGuard HWISO failure-mode SBIUNIT test

 docs/domain_support.md                        | 159 +++++
 include/sbi/riscv_encoding.h                  |   3 +
 include/sbi/sbi_hart.h                        |   4 +
 include/sbi/sbi_hwiso_test.h                  |  35 ++
 lib/sbi/objects.mk                            |   3 +
 lib/sbi/sbi_hart.c                            |   2 +
 lib/sbi/sbi_hwiso_test.c                      | 173 ++++++
 lib/sbi/sbi_hwiso_testlib.c                   | 119 ++++
 platform/generic/include/wgchecker2.h         |  55 ++
 platform/generic/include/worldguard.h         |  45 ++
 platform/generic/objects.mk                   |   4 +
 platform/generic/platform.c                   |  11 +
 .../generic/virt/qemu-virt-hwiso-overlay.dts  | 121 ++++
 .../generic/virt/qemu_virt_wgchecker_test.c   | 356 +++++++++++
 platform/generic/virt/qemu_virt_worldguard.c  |  42 ++
 platform/generic/wgchecker2.c                 | 585 ++++++++++++++++++
 platform/generic/worldguard.c                 | 522 ++++++++++++++++
 17 files changed, 2239 insertions(+)
 create mode 100644 include/sbi/sbi_hwiso_test.h
 create mode 100644 lib/sbi/sbi_hwiso_test.c
 create mode 100644 lib/sbi/sbi_hwiso_testlib.c
 create mode 100644 platform/generic/include/wgchecker2.h
 create mode 100644 platform/generic/include/worldguard.h
 create mode 100644 platform/generic/virt/qemu-virt-hwiso-overlay.dts
 create mode 100644 platform/generic/virt/qemu_virt_wgchecker_test.c
 create mode 100644 platform/generic/virt/qemu_virt_worldguard.c
 create mode 100644 platform/generic/wgchecker2.c
 create mode 100644 platform/generic/worldguard.c

-- 
2.25.1

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

             reply	other threads:[~2026-05-19 20:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 20:33 Raymond Mao [this message]
2026-05-19 20:33 ` [PATCH 1/7] hart: add WorldGuard CSR IDs and hart extension flags Raymond Mao
2026-05-19 20:33 ` [PATCH 2/7] docs: document hwiso WorldGuard DT bindings Raymond Mao
2026-05-19 20:33 ` [PATCH 3/7] [NOT-FOR-UPSTREAM] platform: virt: add QEMU WorldGuard hwiso overlay Raymond Mao
2026-05-19 20:33 ` [PATCH 4/7] platform: generic: add WorldGuard hwiso support with wgchecker2 Raymond Mao
2026-05-19 20:33 ` [PATCH 5/7] test: add generic hwiso SBI unit coverage Raymond Mao
2026-05-19 20:33 ` [PATCH 6/7] platform: virt: add QEMU virt WorldGuard hwiso tests Raymond Mao
2026-05-19 20:33 ` [PATCH 7/7] platform: virt: add WorldGuard HWISO failure-mode SBIUNIT test Raymond Mao

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=20260519203331.2773185-1-raymondmaoca@gmail.com \
    --to=raymondmaoca@gmail.com \
    --cc=anup.patel@qti.qualcomm.com \
    --cc=anup@brainfault.org \
    --cc=anuppate@qti.qualcomm.com \
    --cc=dave.patel@riscstar.com \
    --cc=dhaval@rivosinc.com \
    --cc=opensbi@lists.infradead.org \
    --cc=peter.lin@sifive.com \
    --cc=raymond.mao@riscstar.com \
    --cc=robin.randhawa@sifive.com \
    --cc=samuel.holland@sifive.com \
    --cc=scott@riscstar.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox