Skip to content

RFC arm64: Support for Arm CCA in KVM

Steven Price kvm kvmarm linux-arm-kernel linux-coco lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest28 patches 49 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28arm64: RME: Handle Granule Protection Faults (GPFs)arch/arm64/mm/fault.c+24 -50 replies
2/28arm64: RME: Add SMC definitions for calling the RMMarch/arm64/include/asm/rmi_smc.h+235 -00 replies
3/28arm64: RME: Add wrappers for RMI callsarch/arm64/include/asm/rmi_cmds.h+259 -03 replies
4/28arm64: RME: Check for RME support at KVM initarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_rme.h +4 more+103 -16 replies
5/28arm64: RME: Define the user ABIDocumentation/virt/kvm/api.rst arch/arm64/include/uapi/asm/kvm.h include/uapi/linux/kvm.h+66 -03 replies
6/28arm64: RME: ioctls to create and configure realmsarch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/arm.c arch/arm64/kvm/mmu.c +2 more+429 -09 replies
7/28arm64: kvm: Allow passing machine type in KVM creationarch/arm64/kvm/arm.c arch/arm64/kvm/mmu.c arch/arm64/kvm/reset.c +1 more+28 -102 replies
8/28arm64: RME: Keep a spare page delegated to the RMMarch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/rme.c+9 -03 replies
9/28arm64: RME: RTT handlingarch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/mmu.c arch/arm64/kvm/rme.c+162 -35 replies
10/28arm64: RME: Allocate/free RECs to match vCPUsarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_rme.h +3 more+171 -03 replies
11/28arm64: RME: Support for the VGIC in realmsarch/arm64/kvm/arm.c arch/arm64/kvm/vgic/vgic-v3.c arch/arm64/kvm/vgic/vgic.c+54 -70 replies
12/28KVM: arm64: Support timers in realm RECsarch/arm64/kvm/arch_timer.c include/kvm/arm_arch_timer.h+49 -62 replies
13/28arm64: RME: Allow VMM to set RIPASarch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/rme.c+292 -02 replies
14/28arm64: RME: Handle realm enter/exitarch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/Makefile arch/arm64/kvm/arm.c +2 more+205 -60 replies
15/28KVM: arm64: Handle realm MMIO emulationarch/arm64/kvm/mmio.c+7 -04 replies
16/28arm64: RME: Allow populating initial contentsarch/arm64/kvm/rme.c+366 -04 replies
17/28arm64: RME: Runtime faulting of memoryarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/mmu.c +1 more+128 -63 replies
18/28KVM: arm64: Handle realm VCPU loadarch/arm64/kvm/arm.c+13 -70 replies
19/28KVM: arm64: Validate register access for a Realm VMarch/arm64/kvm/guest.c+26 -00 replies
20/28KVM: arm64: Handle Realm PSCI requestsarch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/psci.c arch/arm64/kvm/rme.c+37 -00 replies
21/28KVM: arm64: WARN on injected undef exceptionsarch/arm64/kvm/inject_fault.c+2 -00 replies
22/28arm64: Don't expose stolen time for realm guestsarch/arm64/kvm/arm.c+4 -10 replies
23/28KVM: arm64: Allow activating realmsarch/arm64/kvm/rme.c+18 -10 replies
24/28arm64: rme: allow userspace to inject abortsDocumentation/virt/kvm/api.rst arch/arm64/kvm/guest.c+26 -00 replies
25/28arm64: rme: support RSI_HOST_CALLarch/arm64/kvm/rme-exit.c+26 -00 replies
26/28arm64: rme: Allow checking SVE on VM instancearch/arm64/include/asm/kvm_rme.h arch/arm64/kvm/arm.c arch/arm64/kvm/rme.c+12 -20 replies
27/28arm64: RME: Always use 4k pages for realmsarch/arm64/kvm/mmu.c arch/arm64/kvm/rme.c+7 -10 replies
28/28HACK: Accept prototype RMI versionsarch/arm64/include/asm/rmi_smc.h arch/arm64/kvm/Kconfig arch/arm64/kvm/rme.c+23 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/28] arm64: Support for Arm CCA in KVM

This series is an RFC adding support for running protected VMs using KVM under the new Arm Confidential Compute Architecture (CCA). The purpose of this series is to gather feedback on the proposed changes to the architecture code for CCA.

The user ABI is not in it's final form, we plan to make use of the memfd_restricted() allocator[1] and associated infrastructure which will avoid problems in the current user ABI where a malicious VMM may be able to cause a Granule Protection Fault in the kernel (which is fatal).

The ABI to the RMM (the RMI) is based on the Beta 0 specification[2] and will be updated in the future when a final version of the specification is published.

This series is based on v6.2-rc1. It is also available as a git repository:

https://gitlab.arm.com/linux-arm/linux-cca cca-host/rfc-v1

Introduction
============
A more general introduction to Arm CCA is available on the Arm website[3], and links to the other components involved are available in the overall cover letter[4].

Arm Confidential Compute Architecture adds two new 'worlds' to the
architecture: Root and Realm. A new software component known as the RMM (Realm Management Monitor) runs in Realm EL2 and is trusted by both the Normal World and VMs running within Realms. This enables mutual distrust between the Realm VMs and the Normal World.

Virtual machines running within a Realm can decide on a (4k) page-by-page granularity whether to share a page with the (Normal World) host or to keep it private (protected). This protection is provided by the hardware and attempts to access a page which isn't shared by the Normal World will trigger a Granule Protection Fault. The series starts by adding handling for these; faults within user space can be handled by killing the process, faults within kernel space are considered fatal.

The Normal World host can communicate with the RMM via an SMC interface known as RMI (Realm Management Interface), and Realm VMs can communicate with the RMM via another SMC interface known as RSI (Realm Services Interface). This series adds wrappers for the full set of RMI commands and uses them to manage the realm guests.

The Normal World can use RMI commands to delegate pages to the Realm world and to create, manage and run Realm VMs. Once delegated the pages are inaccessible to the Normal World (unless explicitly shared by the guest). However the Normal World may destroy the Realm VM at any time to be able to reclaim (undelegate) the pages.

Entry/exit of a Realm VM attempts to reuse the KVM infrastructure, but ultimately the final mechanism is different. So this series has a bunch of commits handling the differences. As much as possible is placed in a two new files: rme.c and rme-exit.c.

The RMM specification provides a new mechanism for a guest to communicate with host which goes by the name "Host Call". For now this is simply hooked up to the existing support for HVC calls from a normal guest.

[1] https://lore.kernel.org/r/20221202061347.1070246-1-chao.p.peng%40linux.intel.com
[2] https://developer.arm.com/documentation/den0137/1-0bet0/
[3] https://www.arm.com/architecture/security-features/arm-confidential-compute-architecture
[4] .. cover letter ..

Joey Gouly (2):
arm64: rme: allow userspace to inject aborts
arm64: rme: support RSI_HOST_CALL

Steven Price (25):
arm64: RME: Handle Granule Protection Faults (GPFs)
arm64: RME: Add SMC definitions for calling the RMM
arm64: RME: Add wrappers for RMI calls
arm64: RME: Check for RME support at KVM init
arm64: RME: Define the user ABI
arm64: RME: ioctls to create and configure realms
arm64: kvm: Allow passing machine type in KVM creation
arm64: RME: Keep a spare page delegated to the RMM
arm64: RME: RTT handling
arm64: RME: Allocate/free RECs to match vCPUs
arm64: RME: Support for the VGIC in realms
KVM: arm64: Support timers in realm RECs
arm64: RME: Allow VMM to set RIPAS
arm64: RME: Handle realm enter/exit
KVM: arm64: Handle realm MMIO emulation
arm64: RME: Allow populating initial contents
arm64: RME: Runtime faulting of memory
KVM: arm64: Handle realm VCPU load
KVM: arm64: Validate register access for a Realm VM
KVM: arm64: Handle Realm PSCI requests
KVM: arm64: WARN on injected undef exceptions
arm64: Don't expose stolen time for realm guests
KVM: arm64: Allow activating realms
arm64: RME: Always use 4k pages for realms
HACK: Accept prototype RMI versions

Suzuki K Poulose (1):
arm64: rme: Allow checking SVE on VM instance

 Documentation/virt/kvm/api.rst       |    3 +
 arch/arm64/include/asm/kvm_emulate.h |   29 +
 arch/arm64/include/asm/kvm_host.h    |    7 +
 arch/arm64/include/asm/kvm_rme.h     |   98 ++
 arch/arm64/include/asm/rmi_cmds.h    |  259 +++++
 arch/arm64/include/asm/rmi_smc.h     |  242 +++++
 arch/arm64/include/asm/virt.h        |    1 +
 arch/arm64/include/uapi/asm/kvm.h    |   63 ++
 arch/arm64/kvm/Kconfig               |    8 +
 arch/arm64/kvm/Makefile              |    3 +-
 arch/arm64/kvm/arch_timer.c          |   53 +-
 arch/arm64/kvm/arm.c                 |  105 +-
 arch/arm64/kvm/guest.c               |   50 +
 arch/arm64/kvm/inject_fault.c        |    2 +
 arch/arm64/kvm/mmio.c                |    7 +
 arch/arm64/kvm/mmu.c                 |   80 +-
 arch/arm64/kvm/psci.c                |   23 +
 arch/arm64/kvm/reset.c               |   41 +
 arch/arm64/kvm/rme-exit.c            |  194 ++++
 arch/arm64/kvm/rme.c                 | 1453 ++++++++++++++++++++++++++
 arch/arm64/kvm/vgic/vgic-v3.c        |    9 +-
 arch/arm64/kvm/vgic/vgic.c           |   37 +-
 arch/arm64/mm/fault.c                |   29 +-
 include/kvm/arm_arch_timer.h         |    2 +
 include/uapi/linux/kvm.h             |   21 +-
 25 files changed, 2772 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm64/include/asm/kvm_rme.h
 create mode 100644 arch/arm64/include/asm/rmi_cmds.h
 create mode 100644 arch/arm64/include/asm/rmi_smc.h
 create mode 100644 arch/arm64/kvm/rme-exit.c
 create mode 100644 arch/arm64/kvm/rme.c
Signature · 1 line
2.34.1