Skip to content

KVM Planes + SEV-SNP Support

Jörg Rödel coconut-svsm kvm kvm-riscv kvmarm linux-mips linuxppc-dev lkml loongarch syzbot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest60 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/60x86/sev: Define the #HV doorbell page structurearch/x86/include/asm/svm.h+33 -00 replies
2/60KVM: SVM: Add support for the SEV-SNP #HV doorbell page NAE eventarch/x86/include/uapi/asm/svm.h arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c +1 more+81 -02 replies
3/60KVM: SVM: Inject #HV when Restricted Injection is activearch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+197 -20 replies
4/60KVM: SVM: Inject NMIs when Restricted Injection is activearch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+25 -30 replies
5/60KVM: SVM: Inject MCEs when Restricted Injection is activearch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/sev.c +6 more+58 -20 replies
6/60KVM: SVM: Enable Restricted Injection for an SEV-SNP guestarch/x86/include/asm/cpufeatures.h arch/x86/include/asm/sev-common.h arch/x86/kvm/svm/sev.c+27 -10 replies
7/60KVM: SVM: Add support for the SEV-SNP #HV IPI NAE eventarch/x86/include/uapi/asm/svm.h arch/x86/kvm/lapic.c arch/x86/kvm/lapic.h +1 more+54 -11 reply
8/60Documentation: kvm: introduce "VM plane" conceptDocumentation/virt/kvm/api.rst+72 -300 replies
9/60kvm: Introduce struct kvm_planeinclude/linux/kvm_host.h include/uapi/linux/kvm.h virt/kvm/kvm_main.c+54 -00 replies
10/60kvm: Move vcpu_array to struct kvm_planeinclude/linux/kvm_host.h virt/kvm/kvm_main.c+46 -170 replies
11/60kvm: Introduce struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+44 -20 replies
12/60kvm: Move vcpu accounting to struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+68 -420 replies
13/60kvm: Add read accessors for kvm_vcpu scheduling statearch/arm64/kvm/arm.c arch/arm64/kvm/nested.c arch/loongarch/kvm/vcpu.c +11 more+42 -210 replies
14/60kvm: Make kvm_running_vcpus point to struct kvm_vcpu_commonarch/arm64/kvm/arch_timer.c arch/arm64/kvm/vgic/vgic-init.c include/linux/kvm_host.h +1 more+16 -100 replies
15/60kvm: Move VCPU scheduling state to struct kvm_vcpu_commonarch/x86/kvm/svm/svm.c include/linux/kvm_host.h virt/kvm/kvm_main.c+39 -340 replies
16/60kvm: Add accessors for kvm_vcpu->mutexarch/arm64/kvm/arm.c arch/arm64/kvm/inject_fault.c arch/powerpc/kvm/book3s_xics.c +11 more+53 -380 replies
17/60kvm: Move VCPU locking to struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+19 -150 replies
18/60kvm: Move kvm_vcpu->rcuwait to struct kvm_vcpu_commonarch/loongarch/kvm/timer.c arch/mips/kvm/mips.c include/linux/kvm_host.h +1 more+12 -100 replies
19/60kvm: Introduce accessors for kvm_vcpu->modearch/arm64/kvm/arm.c arch/loongarch/kvm/vcpu.c arch/mips/kvm/mips.c +11 more+52 -260 replies
20/60kvm: Move kvm_vcpu mode and requests field to struct kvm_vcpu_commonarch/powerpc/kvm/trace.h arch/x86/kvm/trace.h include/linux/kvm_host.h+16 -150 replies
21/60kvm: Introduce per-plane VCPU requestsinclude/linux/kvm_host.h+19 -40 replies
22/60kvm: Move kvm_vcpu pid members to struct kvm_vcpu_commonarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c include/linux/kvm_host.h +1 more+28 -250 replies
23/60kvm: Move kvm_vcpu sigset members to struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+14 -80 replies
24/60kvm: Move kvm_vcpu spinloop members to struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+39 -340 replies
25/60kvm: Move kvm_vcpu->dirty_ring to struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/dirty_ring.c virt/kvm/kvm_main.c+14 -150 replies
26/60kvm: Introduce arch-specific plane statearch/arm64/include/asm/kvm_host.h arch/loongarch/include/asm/kvm_host.h arch/mips/include/asm/kvm_host.h +7 more+96 -00 replies
27/60kvm: Introduce arch-specific part of struct kvm_vcpu_commonarch/arm64/include/asm/kvm_host.h arch/loongarch/include/asm/kvm_host.h arch/mips/include/asm/kvm_host.h +7 more+46 -00 replies
28/60kvm: Implement KVM_CAP_PLANESarch/arm64/kvm/arm.c arch/loongarch/kvm/vm.c arch/mips/kvm/mips.c +6 more+41 -00 replies
29/60kvm: Implement KVM_CREATE_PLANE ioctlinclude/uapi/linux/kvm.h virt/kvm/kvm_main.c+77 -01 reply
30/60kvm: Add KVM_EXIT_PLANE_EVENTinclude/linux/kvm_host.h include/uapi/linux/kvm.h virt/kvm/kvm_main.c+24 -00 replies
31/60kvm: Allocate struct kvm_plane in architecture codearch/arm64/kvm/arm.c arch/loongarch/kvm/vm.c arch/mips/kvm/mips.c +6 more+96 -30 replies
32/60kvm: Allocate struct kvm_run only for struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+19 -130 replies
33/60KVM: Implement KVM_CREATE_VCPU ioctl for planesarch/arm64/kvm/arm.c arch/loongarch/kvm/vcpu.c arch/mips/kvm/mips.c +6 more+141 -270 replies
34/60kvm: Keep track of plane VCPUs in struct kvm_vcpu_commoninclude/linux/kvm_host.h virt/kvm/kvm_main.c+9 -00 replies
35/60kvm: Add VCPU plane-scheduling state and helpersinclude/linux/kvm_host.h virt/kvm/kvm_main.c+61 -013 replies
36/60kvm: Add plane_level to kvm_kernel_irq_routing_entryarch/arm64/kvm/vgic/vgic-irqfd.c arch/loongarch/kvm/irqfd.c arch/powerpc/kvm/mpic.c +4 more+7 -00 replies
37/60kvm: Pass plane_level to kvm_set_routing_entry()arch/arm64/kvm/vgic/vgic-irqfd.c arch/loongarch/kvm/irqfd.c arch/powerpc/kvm/mpic.c +5 more+23 -140 replies
38/60kvm: Make KVM_SIGNAL_MSI per planeinclude/linux/kvm_host.h virt/kvm/irqchip.c virt/kvm/kvm_main.c+17 -140 replies
39/60kvm: Make KVM_SET_GSI_ROUTING per planearch/arm64/kvm/vgic/vgic-irqfd.c arch/loongarch/kvm/intc/pch_pic.c arch/powerpc/kvm/mpic.c +5 more+44 -410 replies
40/60kvm: x86: Handle IOAPIC EOIs per planearch/x86/include/asm/kvm_host.h arch/x86/kvm/irq.c arch/x86/kvm/x86.c+11 -40 replies
41/60kvm: x86: Make apic_map per planearch/x86/include/asm/kvm_host.h arch/x86/kvm/i8254.c arch/x86/kvm/lapic.c +1 more+61 -540 replies
42/60kvm: x86: Make local APIC code aware of planesarch/x86/kvm/hyperv.c arch/x86/kvm/ioapic.c arch/x86/kvm/irq.c +4 more+45 -430 replies
43/60kvm: x86: Move CPUID state to struct kvm_vcpu_arch_commonarch/x86/include/asm/kvm_host.h arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h +5 more+58 -340 replies
44/60kvm: x86: Move cpu_caps to struct kvm_vcpu_arch_commonarch/x86/include/asm/kvm_host.h arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h +2 more+38 -360 replies
45/60kvm: x86: Update state for all plane VCPUs after CPUID updatearch/x86/kvm/cpuid.c+11 -50 replies
46/60kvm: x86: Share MTRR state across planesarch/x86/include/asm/kvm_host.h arch/x86/kvm/mtrr.c+9 -60 replies
47/60kvm: x86: Select a plane to runarch/x86/kvm/x86.c+28 -10 replies
48/60kvm: x86: Make event injection VCPU requests per-planearch/x86/include/asm/kvm_host.h+6 -60 replies
49/60kvm: x86: Allow hardware backend to overwrite struct kvm_plane allocationarch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm.c +3 more+30 -30 replies
50/60kvm: x86: Make KVM_REQ_UPDATE_PROTECTED_GUEST_STATE per planearch/x86/include/asm/kvm_host.h+1 -10 replies
51/60kvm: x86: Share pio_data across planesarch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c virt/kvm/kvm_main.c+14 -100 replies
52/60kvm: x86: Switch to plane0 if it has eventsarch/x86/kvm/x86.c+29 -50 replies
53/60kvm: x86: Introduce max_planes x86-oparch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm.c +3 more+13 -10 replies
54/60kvm: x86: Restrict KVM planes support to KVM_IRQCHIP_SPLITarch/x86/kvm/x86.c include/linux/kvm_host.h virt/kvm/kvm_main.c+12 -20 replies
55/60kvm: svm: Track vmsa_features per planearch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+60 -220 replies
56/60kvm: svm: Implement GET_AP_APIC_IDS NAE eventarch/x86/include/asm/sev-common.h arch/x86/include/uapi/asm/svm.h arch/x86/kvm/svm/sev.c+86 -30 replies
57/60kvm: sev: Allow for VMPL level specification in AP createarch/x86/include/asm/svm.h arch/x86/include/uapi/asm/svm.h arch/x86/kvm/svm/sev.c +2 more+126 -290 replies
58/60kvm: svm: Invoke a specified VMPL level VMSA for the vCPUarch/x86/include/asm/sev-common.h arch/x86/kvm/svm/sev.c+77 -00 replies
59/60kvm: svm: Implement max_planes x86 operationarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+26 -30 replies
60/60kvm: svm: Advertise full multi-VMPL support to the SNP guestarch/x86/kvm/svm/sev.c+2 -10 replies

Reviews trailers per patch

None of the 60 patches has a Reviewed-by or Acked-by.

PatchMushahid Hussain
SeriesNot-signed-off-by Not-signed-off-by Not-signed-off-by
1/60
2/60
3/60
4/60
5/60
6/60
7/60
8/60
9/60
10/60
11/60
12/60
13/60
14/60
15/60
16/60
17/60
18/60
19/60
20/60
21/60
22/60
23/60
24/60
25/60
26/60
27/60
28/60
29/60
30/60
31/60
32/60
33/60
34/60
35/60
36/60
37/60
38/60
39/60
40/60
41/60
42/60
43/60
44/60
45/60
46/60
47/60
48/60
49/60
50/60
51/60
52/60
53/60
54/60
55/60
56/60
57/60
58/60
59/60
60/60

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/60] KVM Planes + SEV-SNP Support

From: Joerg Roedel <[email protected]>

Hi,

Here is the updated patch-set implementing support for planes in KVM. Planes is KVMs name for supporting various privilege separation features of hardware (AMD SEV-SNP VMPLs, Intel TDX, ARM CCA Planes) or software (Hyper-V VSM) in KVM.

The code posted here is based on prior work by Tom Lendacky, Roy Hopkins[1] and Paolo Bonzini[2] as well as the numerous participants of the KVM Planes BoF at KVM Forum 2024.

The user-space interface has slightly changed compared to the previous patches posted by Paolo. The Documentation patch has the details.

The changes implement the base-support in KVM and X86 as well as the parts required for AMD SEV-SNP VMPLs. The patches are based on v7.1-rc7 and can be used to run an SEV-SNP VM with COCONUT-SVSM[3] in VMPL0 with a Linux guest in VMPL2. An updated QEMU is needed as well, the changes for that will be posted separately.

This changes depend on Melodys patches for supporting restricted injection. As they are required to run COCONUT-SVSM, they are included here for completeness.

KVM planes support as posted here has a number of known limitations:

- Using planes requires IRQ-Chip in split mode
- IRQFD not yet supported
- Memory attributes are not per-plane yet - this is required for VSM

The patches are also in this git branch:

https://github.com/joergroedel/linux/tree/kvm-planes-v7.1

And can be used together with this QEMU tree:

https://github.com/joergroedel/qemu/tree/qemu-planes-linux-v7.1

Please review.

-Joerg

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://github.com/coconut-svsm/svsm/

Joerg Roedel (37):
kvm: Introduce struct kvm_vcpu_common
kvm: Move vcpu accounting to struct kvm_vcpu_common
kvm: Add read accessors for kvm_vcpu scheduling state
kvm: Make kvm_running_vcpus point to struct kvm_vcpu_common
kvm: Move VCPU scheduling state to struct kvm_vcpu_common
kvm: Add accessors for kvm_vcpu->mutex
kvm: Move VCPU locking to struct kvm_vcpu_common
kvm: Move kvm_vcpu->rcuwait to struct kvm_vcpu_common
kvm: Introduce accessors for kvm_vcpu->mode
kvm: Move kvm_vcpu mode and requests field to struct kvm_vcpu_common
kvm: Introduce per-plane VCPU requests
kvm: Move kvm_vcpu pid members to struct kvm_vcpu_common
kvm: Move kvm_vcpu sigset members to struct kvm_vcpu_common
kvm: Move kvm_vcpu spinloop members to struct kvm_vcpu_common
kvm: Move kvm_vcpu->dirty_ring to struct kvm_vcpu_common
kvm: Introduce arch-specific plane state
kvm: Introduce arch-specific part of struct kvm_vcpu_common
kvm: Allocate struct kvm_plane in architecture code
KVM: Implement KVM_CREATE_VCPU ioctl for planes
kvm: Keep track of plane VCPUs in struct kvm_vcpu_common
kvm: Add VCPU plane-scheduling state and helpers
kvm: Add plane_level to kvm_kernel_irq_routing_entry
kvm: Pass plane_level to kvm_set_routing_entry()
kvm: Make KVM_SET_GSI_ROUTING per plane
kvm: x86: Handle IOAPIC EOIs per plane
kvm: x86: Move CPUID state to struct kvm_vcpu_arch_common
kvm: x86: Move cpu_caps to struct kvm_vcpu_arch_common
kvm: x86: Update state for all plane VCPUs after CPUID update
kvm: x86: Share MTRR state across planes
kvm: x86: Select a plane to run
kvm: x86: Make event injection VCPU requests per-plane
kvm: x86: Allow hardware backend to overwrite struct kvm_plane
allocation
kvm: x86: Make KVM_REQ_UPDATE_PROTECTED_GUEST_STATE per plane
kvm: x86: Share pio_data across planes
kvm: x86: Switch to plane0 if it has events
kvm: x86: Restrict KVM planes support to KVM_IRQCHIP_SPLIT
kvm: svm: Track vmsa_features per plane

Melody Wang (7):
x86/sev: Define the #HV doorbell page structure
KVM: SVM: Add support for the SEV-SNP #HV doorbell page NAE event
KVM: SVM: Inject #HV when Restricted Injection is active
KVM: SVM: Inject NMIs when Restricted Injection is active
KVM: SVM: Inject MCEs when Restricted Injection is active
KVM: SVM: Enable Restricted Injection for an SEV-SNP guest
KVM: SVM: Add support for the SEV-SNP #HV IPI NAE event

Paolo Bonzini (11):
Documentation: kvm: introduce "VM plane" concept
kvm: Introduce struct kvm_plane
kvm: Move vcpu_array to struct kvm_plane
kvm: Implement KVM_CAP_PLANES
kvm: Implement KVM_CREATE_PLANE ioctl
kvm: Add KVM_EXIT_PLANE_EVENT
kvm: Allocate struct kvm_run only for struct kvm_vcpu_common
kvm: Make KVM_SIGNAL_MSI per plane
kvm: x86: Make apic_map per plane
kvm: x86: Make local APIC code aware of planes
kvm: x86: Introduce max_planes x86-op

Tom Lendacky (5):
kvm: svm: Implement GET_AP_APIC_IDS NAE event
kvm: sev: Allow for VMPL level specification in AP create
kvm: svm: Invoke a specified VMPL level VMSA for the vCPU
kvm: svm: Implement max_planes x86 operation
kvm: svm: Advertise full multi-VMPL support to the SNP guest

 Documentation/virt/kvm/api.rst        | 102 +++-
 arch/arm64/include/asm/kvm_host.h     |  19 +-
 arch/arm64/kvm/arch_timer.c           |   3 +-
 arch/arm64/kvm/arm.c                  |  37 +-
 arch/arm64/kvm/inject_fault.c         |   4 +-
 arch/arm64/kvm/nested.c               |   2 +-
 arch/arm64/kvm/vgic/vgic-init.c       |   3 +-
 arch/arm64/kvm/vgic/vgic-irqfd.c      |   7 +-
 arch/loongarch/include/asm/kvm_host.h |  17 +
 arch/loongarch/kvm/intc/pch_pic.c     |   2 +-
 arch/loongarch/kvm/irqfd.c            |   5 +-
 arch/loongarch/kvm/timer.c            |   2 +-
 arch/loongarch/kvm/vcpu.c             |  16 +-
 arch/loongarch/kvm/vm.c               |  18 +
 arch/mips/include/asm/kvm_host.h      |  17 +
 arch/mips/kvm/mips.c                  |  35 +-
 arch/powerpc/include/asm/kvm_host.h   |  17 +
 arch/powerpc/kvm/book3s_pr.c          |   2 +-
 arch/powerpc/kvm/book3s_xics.c        |   4 +-
 arch/powerpc/kvm/book3s_xive.c        |   4 +-
 arch/powerpc/kvm/book3s_xive_native.c |   4 +-
 arch/powerpc/kvm/booke.c              |   2 +-
 arch/powerpc/kvm/mpic.c               |   6 +-
 arch/powerpc/kvm/powerpc.c            |  27 +-
 arch/powerpc/kvm/trace.h              |   2 +-
 arch/riscv/include/asm/kvm_host.h     |  17 +
 arch/riscv/kvm/aia_device.c           |   4 +-
 arch/riscv/kvm/main.c                 |  18 +
 arch/riscv/kvm/vcpu.c                 |  13 +-
 arch/riscv/kvm/vm.c                   |   6 +-
 arch/s390/include/asm/kvm_host.h      |  17 +
 arch/s390/kvm/interrupt.c             |  11 +-
 arch/s390/kvm/kvm-s390.c              |  33 +-
 arch/s390/kvm/pv.c                    |   2 +-
 arch/x86/include/asm/cpufeatures.h    |   1 +
 arch/x86/include/asm/kvm-x86-ops.h    |   4 +
 arch/x86/include/asm/kvm_host.h       |  96 ++--
 arch/x86/include/asm/sev-common.h     |   8 +
 arch/x86/include/asm/svm.h            |  42 ++
 arch/x86/include/uapi/asm/svm.h       |   9 +
 arch/x86/kvm/cpuid.c                  |  70 ++-
 arch/x86/kvm/cpuid.h                  |  31 +-
 arch/x86/kvm/hyperv.c                 |   2 +-
 arch/x86/kvm/i8254.c                  |   2 +-
 arch/x86/kvm/ioapic.c                 |   8 +-
 arch/x86/kvm/irq.c                    |  19 +-
 arch/x86/kvm/lapic.c                  | 144 +++--
 arch/x86/kvm/lapic.h                  |  14 +-
 arch/x86/kvm/mmu/mmu.c                |   4 +-
 arch/x86/kvm/mtrr.c                   |  12 +-
 arch/x86/kvm/smm.c                    |   2 +-
 arch/x86/kvm/svm/sev.c                | 644 ++++++++++++++++++++--
 arch/x86/kvm/svm/svm.c                |  85 ++-
 arch/x86/kvm/svm/svm.h                |  52 +-
 arch/x86/kvm/trace.h                  |   2 +-
 arch/x86/kvm/vmx/common.h             |   2 +-
 arch/x86/kvm/vmx/main.c               |  16 +-
 arch/x86/kvm/vmx/nested.h             |   4 +-
 arch/x86/kvm/vmx/posted_intr.c        |   2 +-
 arch/x86/kvm/vmx/vmx.c                |  11 +-
 arch/x86/kvm/vmx/x86_ops.h            |   1 +
 arch/x86/kvm/x86.c                    | 237 ++++++--
 arch/x86/kvm/x86.h                    |   5 +
 arch/x86/kvm/xen.c                    |   2 +-
 arch/x86/kvm/xen.h                    |   2 +-
 include/linux/kvm_host.h              | 278 ++++++++--
 include/linux/kvm_types.h             |   2 +
 include/uapi/linux/kvm.h              |  18 +
 virt/kvm/dirty_ring.c                 |   4 +-
 virt/kvm/irqchip.c                    |  13 +-
 virt/kvm/kvm_main.c                   | 764 +++++++++++++++++++-------
 71 files changed, 2460 insertions(+), 630 deletions(-)
Signature · 1 line
2.53.0