qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/18] Implements RISC-V WorldGuard extension v0.4
@ 2025-04-17 10:52 Jim Shu
  2025-04-17 10:52 ` [PATCH v2 01/18] accel/tcg: Store section pointer in CPUTLBEntryFull Jim Shu
                   ` (18 more replies)
  0 siblings, 19 replies; 40+ messages in thread
From: Jim Shu @ 2025-04-17 10:52 UTC (permalink / raw)
  To: qemu-devel, qemu-riscv
  Cc: Richard Henderson, Paolo Bonzini, Palmer Dabbelt,
	Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
	Eduardo Habkost, Marcel Apfelbaum, Philippe Mathieu-Daudé,
	Yanan Wang, Zhao Liu, Peter Xu, David Hildenbrand, Michael Rolnik,
	Helge Deller, Song Gao, Laurent Vivier, Edgar E. Iglesias,
	Aurelien Jarno, Jiaxun Yang, Aleksandar Rikalo, Stafford Horne,
	Nicholas Piggin, Ilya Leoshkevich, Thomas Huth, Mark Cave-Ayland,
	Artyom Tarasenko, Bastian Koppelmann, Max Filippov,
	open list:PowerPC TCG CPUs, open list:S390 TCG CPUs, Jim Shu

This patchset implements Smwg/Smwgd/Sswg CPU extension and wgChecker
device defined in WorldGuard spec v0.4.

The WG v0.4 spec could be found here:
https://lists.riscv.org/g/security/attachment/711/0/worldguard_rvia_spec-v0.4.pdf

To enable WG in QEMU, pass "wg=on" as machine parameter to virt machine.
It enables both WG CPU CSRs to apply WID of CPU and wgCheckers on
the DRAM, FLASH, and UART to protect these resources.

This patchset contains 5 parts:

1. Commit  1 ~ 2: Bugfix of IOMMUMemoryRegion
2. Commit  3 ~ 4: Extend IOMMUMemoryRegion and MemTxAttr for WG support
3. Commit  5 ~ 13: Add WG global device and CPU extensions
4. Commit 14 ~ 17: Add WG checker device
5. Commit 18: Add WG support to the virt machine

QEMU code can be found at [1]

[1] https://github.com/cwshu/qemu/tree/riscv-wg-v2

Changed since v1:
- Remove the assertion of 4k sections limitation. Remove
  iotlb_to_section() and rename 'xlat_section' to 'xlat'.
- Fix RST issue and typo in virt machine doc

Changed since RFCv1:
- Rebase to latest QEMU (v10.0.0-rc3)
- Add the description of HW config and CPU option of WG in the
  virt machine documentation
- Expose CPU options of WG after WG CPU code has been implemented
- Change 'mwid' and 'mwidlist' options to experimental options
- Change 'world_id' to unsigned int type + bit field.

Jim Shu (18):
  accel/tcg: Store section pointer in CPUTLBEntryFull
  system/physmem: Remove the assertion of page-aligned section number
  accel/tcg: memory access from CPU will pass access_type to IOMMU
  exec: Add RISC-V WorldGuard WID to MemTxAttrs
  hw/misc: riscv_worldguard: Add RISC-V WorldGuard global config
  target/riscv: Add CPU options of WorldGuard CPU extension
  target/riscv: Add hard-coded CPU state of WG extension
  target/riscv: Add defines for WorldGuard CSRs
  target/riscv: Allow global WG config to set WG CPU callbacks
  target/riscv: Implement WorldGuard CSRs
  target/riscv: Add WID to MemTxAttrs of CPU memory transactions
  target/riscv: Expose CPU options of WorldGuard
  hw/misc: riscv_worldguard: Add API to enable WG extension of CPU
  hw/misc: riscv_wgchecker: Implement RISC-V WorldGuard Checker
  hw/misc: riscv_wgchecker: Implement wgchecker slot registers
  hw/misc: riscv_wgchecker: Implement correct block-access behavior
  hw/misc: riscv_wgchecker: Check the slot settings in translate
  hw/riscv: virt: Add WorldGuard support

 accel/tcg/cputlb.c                   |   49 +-
 docs/system/riscv/virt.rst           |   20 +
 hw/misc/Kconfig                      |    3 +
 hw/misc/meson.build                  |    1 +
 hw/misc/riscv_wgchecker.c            | 1160 ++++++++++++++++++++++++++
 hw/misc/riscv_worldguard.c           |  272 ++++++
 hw/misc/trace-events                 |    9 +
 hw/riscv/Kconfig                     |    1 +
 hw/riscv/virt.c                      |  163 +++-
 include/exec/cputlb.h                |   13 +-
 include/exec/exec-all.h              |   18 +-
 include/exec/memattrs.h              |    8 +-
 include/hw/core/cpu.h                |   12 +-
 include/hw/misc/riscv_worldguard.h   |  123 +++
 include/hw/riscv/virt.h              |   15 +-
 system/physmem.c                     |   39 +-
 target/alpha/helper.c                |    2 +-
 target/avr/helper.c                  |    2 +-
 target/hppa/mem_helper.c             |    1 -
 target/i386/tcg/system/excp_helper.c |    3 +-
 target/loongarch/tcg/tlb_helper.c    |    2 +-
 target/m68k/helper.c                 |   10 +-
 target/microblaze/helper.c           |    8 +-
 target/mips/tcg/system/tlb_helper.c  |    4 +-
 target/openrisc/mmu.c                |    2 +-
 target/ppc/mmu_helper.c              |    2 +-
 target/riscv/cpu.c                   |   17 +-
 target/riscv/cpu.h                   |   12 +
 target/riscv/cpu_bits.h              |    5 +
 target/riscv/cpu_cfg.h               |    5 +
 target/riscv/cpu_helper.c            |   69 +-
 target/riscv/csr.c                   |  107 +++
 target/riscv/tcg/tcg-cpu.c           |   11 +
 target/rx/cpu.c                      |    3 +-
 target/s390x/tcg/excp_helper.c       |    2 +-
 target/sh4/helper.c                  |    2 +-
 target/sparc/mmu_helper.c            |    6 +-
 target/tricore/helper.c              |    2 +-
 target/xtensa/helper.c               |    3 +-
 39 files changed, 2074 insertions(+), 112 deletions(-)
 create mode 100644 hw/misc/riscv_wgchecker.c
 create mode 100644 hw/misc/riscv_worldguard.c
 create mode 100644 include/hw/misc/riscv_worldguard.h

-- 
2.17.1



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

end of thread, other threads:[~2025-10-16  3:33 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 10:52 [PATCH v2 00/18] Implements RISC-V WorldGuard extension v0.4 Jim Shu
2025-04-17 10:52 ` [PATCH v2 01/18] accel/tcg: Store section pointer in CPUTLBEntryFull Jim Shu
2025-04-17 10:52 ` [PATCH v2 02/18] system/physmem: Remove the assertion of page-aligned section number Jim Shu
2025-04-17 10:52 ` [PATCH v2 03/18] accel/tcg: memory access from CPU will pass access_type to IOMMU Jim Shu
2025-04-17 10:52 ` [PATCH v2 04/18] exec: Add RISC-V WorldGuard WID to MemTxAttrs Jim Shu
2025-08-09 12:34   ` Daniel Henrique Barboza
2025-10-08  5:54     ` Jim Shu
2025-10-12 17:27       ` Daniel Henrique Barboza
2025-10-16  3:33         ` Jim Shu
2025-04-17 10:52 ` [PATCH v2 05/18] hw/misc: riscv_worldguard: Add RISC-V WorldGuard global config Jim Shu
2025-08-09 12:37   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 06/18] target/riscv: Add CPU options of WorldGuard CPU extension Jim Shu
2025-08-09 12:47   ` Daniel Henrique Barboza
2025-10-08  7:22     ` Jim Shu
2025-04-17 10:52 ` [PATCH v2 07/18] target/riscv: Add hard-coded CPU state of WG extension Jim Shu
2025-04-17 10:52 ` [PATCH v2 08/18] target/riscv: Add defines for WorldGuard CSRs Jim Shu
2025-08-09 12:49   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 09/18] target/riscv: Allow global WG config to set WG CPU callbacks Jim Shu
2025-08-09 12:50   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 10/18] target/riscv: Implement WorldGuard CSRs Jim Shu
2025-08-09 12:54   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 11/18] target/riscv: Add WID to MemTxAttrs of CPU memory transactions Jim Shu
2025-04-17 10:52 ` [PATCH v2 12/18] target/riscv: Expose CPU options of WorldGuard Jim Shu
2025-08-09 12:55   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 13/18] hw/misc: riscv_worldguard: Add API to enable WG extension of CPU Jim Shu
2025-08-09 13:07   ` Daniel Henrique Barboza
2025-08-13  3:07     ` Chao Liu
2025-10-08  6:19       ` Jim Shu
2025-04-17 10:52 ` [PATCH v2 14/18] hw/misc: riscv_wgchecker: Implement RISC-V WorldGuard Checker Jim Shu
2025-08-09 16:39   ` Daniel Henrique Barboza
2025-10-08  7:23     ` Jim Shu
2025-04-17 10:52 ` [PATCH v2 15/18] hw/misc: riscv_wgchecker: Implement wgchecker slot registers Jim Shu
2025-08-09 16:42   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 16/18] hw/misc: riscv_wgchecker: Implement correct block-access behavior Jim Shu
2025-04-17 10:52 ` [PATCH v2 17/18] hw/misc: riscv_wgchecker: Check the slot settings in translate Jim Shu
2025-08-09 16:43   ` Daniel Henrique Barboza
2025-04-17 10:52 ` [PATCH v2 18/18] hw/riscv: virt: Add WorldGuard support Jim Shu
2025-08-09 16:53   ` Daniel Henrique Barboza
2025-10-08  7:23     ` Jim Shu
2025-08-09 17:00 ` [PATCH v2 00/18] Implements RISC-V WorldGuard extension v0.4 Daniel Henrique Barboza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).