[PATCH v6 00/23] Add Realm support to QEMU-VMM

Mathieu Poirier posted 23 patches 1 week, 6 days ago
Failed in applying to current master (apply log)
docs/interop/firmware.json                 |   5 +-
docs/system/arm/virt.rst                   |   9 +-
docs/system/confidential-guest-support.rst |   1 +
hw/arm/boot.c                              |  70 +++-
hw/arm/virt.c                              | 142 ++++++--
hw/core/loader.c                           |  24 ++
include/hw/arm/boot.h                      |   9 +
include/hw/arm/virt.h                      |   2 +-
include/hw/core/loader.h                   |  14 +
linux-headers/linux/kvm.h                  |  18 +-
qapi/qom.json                              |   1 +
target/arm/arm-qmp-cmds.c                  |   1 +
target/arm/cpu.c                           |   5 +
target/arm/cpu.h                           |   7 +
target/arm/cpu64.c                         | 135 +++++++
target/arm/kvm-rme.c                       | 395 +++++++++++++++++++++
target/arm/kvm-stub.c                      |   4 +
target/arm/kvm.c                           | 198 ++++++++++-
target/arm/kvm_arm.h                       |  10 +
target/arm/meson.build                     |   5 +-
20 files changed, 1005 insertions(+), 50 deletions(-)
create mode 100644 target/arm/kvm-rme.c
[PATCH v6 00/23] Add Realm support to QEMU-VMM
Posted by Mathieu Poirier 1 week, 6 days ago
This patchset provides minimal functionality to start a Realm VM
from an Arm RME capable host using the following command line:

qemu-system-aarch64 \
 -M confidential-guest-support=rme0,memory-backend=ram0 \
 -object rme-guest,id=rme0 \
 -object memory-backend-memfd,id=ram0,size=1G,share=on \
 -cpu host -M virt -enable-kvm -M gic-version=3,its=on -nodefaults ..

It is a refactoring of Jean-Philippe Brucker's initial work dating from a while
back.  It is based on Steven Price's latest work [1] and the integration branch
that comes with it.  It is also compatible with Michael Roth's third revision of
his work on guest-memfd convert-in-place [2], rebased to QEMU master.

It was tested on the QEMU SBSA machine.

For convenience a repository is hosted here [3], along with the TF-A [4],
RMM [5] and kernel [6].  Instructions to compile and run the entire stack are
here [7].

Gavin raised a number of relevant issues in this post [8].  Due to the time
needed to look at each and the importance to keep up with the latest kernel
work [1], those issues have not been included in this release.  They will be
discussed further on the mailing list and addressed in upcoming releases if
need be.

[1]. https://lore.kernel.org/kvm/20261102141304.126883-1-steven.price@arm.com/  
[2]. https://lore.kernel.org/kvm/20261007134323.1606088-1-michael.roth@amd.com/
[3]. https://gitlab.com/Linaro/cca-public/qemu/-/tree/upstream-v6?ref_type=heads
[4]. https://gitlab.com/Linaro/cca-public/tf-a/trusted-firmware-a/-/tree/cca/v13?ref_type=heads
[5]. https://gitlab.com/Linaro/cca-public/rmm/-/tree/cca/v20?ref_type=heads
[6]. https://gitlab.com/Linaro/cca-public/linux/-/tree/upstream-v6?ref_type=heads
[7]. https://gitlab.com/Linaro/cca-public/build-instructions/-/tree/upstream-v6?ref_type=heads
[8]. https://lore.kernel.org/kvm/20260903193611.1058589-1-mathieu.poirier@linaro.org/T/#ma596f1f403f045262a39cbddd796349eb7d02e63


RFC v5: https://lore.kernel.org/kvm/20261002202026.1204110-1-mathieu.poirier@linaro.org/
RFC v4: https://lore.kernel.org/kvm/20260903193611.1058589-1-mathieu.poirier@linaro.org/
RFC v3: https://lore.kernel.org/kvm/20260825220101.3443954-1-mathieu.poirier@linaro.org/
RFC v2: https://lore.kernel.org/kvm/20260728192630.240375-1-mathieu.poirier@linaro.org/
RFC v1: https://lists.gnu.org/archive/html/qemu-devel/2026-07/msg02307.html

Changes for V6:
- Several code alignment fixes (Gavin)
- Use MACHINE()->cgs instead of dedicated function (Gavin)
- Code simplifications and imporvements in several places (Gavin)
- Fixed changelog [06/23] (Enju)
- Respect alignement constraints when images are transferred to Realms (Gavin, Lorenzo)
- New patch [08/23] to set t he KVM_CAP_ARM_PSCI_0_2 extension (Lorenzo)

Jean-Philippe Brucker (20):
  [NOT-FOR-MERGE] linux-headers: Add RME related definitions
  target/arm: Add confidential guest support
  target/arm/kvm: Split kvm_arch_get/put_registers
  target/arm/kvm-rme: Initialize vCPU
  target/arm/kvm: Create scratch Realm VM when requested
  target/arm/kvm: Use kvm_vm_check_extension() where necessary
  target/arm/kvm-rme: Keep track of images loaded in Realm memory
  target/arm/cpu: Set number of breakpoints and watchpoints in KVM
  target/arm/cpu: Set number of PMU counters in KVM
  target/arm/cpu: Don't read Realm registers
  hw/arm/virt: Set proper conduit method for Realms
  hw/arm/virt: Embed Realm VM type with IPA address space
  hw/arm/virt: Reserve one bit of guest physical address for RME
  hw/arm/virt: Disable DTB randomness for confidential VMs
  hw/arm/virt: Move virt_flash_create() to machvirt_init()
  hw/arm/virt: Use RAM instead of flash for confidential guest firmware
  target/arm/kvm-rme: Add DMA remapping for the shared memory region
  docs/interop/firmware.json: Add arm-rme firmware feature
  hw/arm/boot: Load DTB as is for confidential VMs
  hw/arm/boot: Skip bootloader for confidential guests

Lorenzo Pieralisi (1):
  target/arm/kvm: Add support for PSCI 0.2 to 'features' flag

Mathieu Poirier (2):
  target/arm/kvm-rme: Add mechanic to initialize realms
  target/arm/kvm-rme: Populate Realm with runtime images

 docs/interop/firmware.json                 |   5 +-
 docs/system/arm/virt.rst                   |   9 +-
 docs/system/confidential-guest-support.rst |   1 +
 hw/arm/boot.c                              |  70 +++-
 hw/arm/virt.c                              | 142 ++++++--
 hw/core/loader.c                           |  24 ++
 include/hw/arm/boot.h                      |   9 +
 include/hw/arm/virt.h                      |   2 +-
 include/hw/core/loader.h                   |  14 +
 linux-headers/linux/kvm.h                  |  18 +-
 qapi/qom.json                              |   1 +
 target/arm/arm-qmp-cmds.c                  |   1 +
 target/arm/cpu.c                           |   5 +
 target/arm/cpu.h                           |   7 +
 target/arm/cpu64.c                         | 135 +++++++
 target/arm/kvm-rme.c                       | 395 +++++++++++++++++++++
 target/arm/kvm-stub.c                      |   4 +
 target/arm/kvm.c                           | 198 ++++++++++-
 target/arm/kvm_arm.h                       |  10 +
 target/arm/meson.build                     |   5 +-
 20 files changed, 1005 insertions(+), 50 deletions(-)
 create mode 100644 target/arm/kvm-rme.c

-- 
2.53.0