Skip to content

RFC KVM: SVM: Add support for SEV-SNP Secure AVIC

Naveen N Rao (AMD) kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 RFC Latest27 patches 26 repliesIn review

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27x86/apic: Propagate APIC_SPIV writes to hv for Secure AVICarch/x86/kernel/apic/x2apic_savic.c+4 -15 replies
2/27x86/apic: Drop savic_eoi() in favor of native_apic_msr_eoi() for Secure AVICarch/x86/kernel/apic/x2apic_savic.c+1 -309 replies
3/27x86/kvm: Disable PV_SEND_IPI if Secure AVIC is enabledarch/x86/kernel/kvm.c+2 -12 replies
4/27x86/apic: Use AVIC_INCOMPLETE_IPI VMGEXIT for Secure AVIC IPI handlingarch/x86/coco/sev/core.c arch/x86/include/asm/svm.h+18 -12 replies
5/27x86/cpufeatures: Add Secure AVIC CPU featurearch/x86/include/asm/cpufeatures.h+1 -01 reply
6/27KVM: SVM: Add helper to check if Secure AVIC is enabled for a guestarch/x86/include/asm/svm.h arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.h+11 -01 reply
7/27KVM: SVM: Set guest_apic_protected if Secure AVIC is enabledarch/x86/kvm/svm/avic.c+3 -00 replies
8/27kvm: irqfd: Have kvm_arch_has_irq_bypass() take struct kvm pointerarch/arm64/include/asm/kvm_host.h arch/powerpc/kvm/powerpc.c arch/x86/include/asm/kvm_host.h +4 more+7 -70 replies
9/27KVM: SVM: Disable IRQ bypass for Secure AVICarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/avic.c arch/x86/kvm/svm/sev.c +1 more+19 -60 replies
10/27KVM: SVM: Add avic_ipiv_is_soft_disabled() as a wrapper around enable_ipivarch/x86/kvm/svm/avic.c+11 -20 replies
11/27KVM: SVM: Disable IPIv for Secure AVICarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.h+26 -20 replies
12/27KVM: SVM: Short-circuit a few AVIC flows for Secure AVICarch/x86/kvm/svm/avic.c+24 -70 replies
13/27KVM: SVM: Warn if we ever receive AVIC_UNACCELERATED_ACCESS #VMEXITarch/x86/kvm/svm/avic.c+4 -00 replies
14/27KVM: SVM: Do not inhibit AVIC for SEV-SNP guests if Secure AVIC is enabledarch/x86/kvm/svm/sev.c+2 -20 replies
15/27KVM: SVM: Set VGIF in VMSA area for Secure AVIC guestsarch/x86/kvm/svm/sev.c+4 -00 replies
16/27KVM: SVM: Add handler for VMGEXIT Secure AVIC NAE eventarch/x86/include/uapi/asm/svm.h arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.h+71 -05 replies
17/27KVM: SVM: Do not intercept SECURE_AVIC_CONTROL MSR for Secure AVIC guestsarch/x86/kvm/svm/avic.c+3 -10 replies
18/27KVM: x86: Add a new kvm_x86_op protected_apic_has_injectable_intr()arch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/irq.c +1 more+10 -10 replies
19/27KVM: SVM: Implement kvm_x86_ops->protected_apic_has_injectable_intr() for Secure AVICarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+10 -00 replies
20/27KVM: SVM: Implement kvm_x86_ops->protected_apic_has_interrupt() for Secure AVICarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+8 -00 replies
21/27KVM: SVM: Add interrupt delivery support for Secure AVIC guestsarch/x86/include/asm/svm.h arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c +1 more+58 -30 replies
22/27KVM: SVM: Add support for incomplete IPI handling for Secure AVICarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c +1 more+29 -30 replies
23/27KVM: SVM: Add support for injecting NMIs for Secure AVIC guestsarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/x86.c+16 -20 replies
24/27KVM: SVM: Mandate use of split irqchip for Secure AVICarch/x86/kvm/svm/avic.c+10 -10 replies
25/27KVM: SVM: Do not inject exceptions for Secure AVICarch/x86/kvm/svm/svm.c+4 -00 replies
26/27KVM: SVM: Do not intercept exceptions for Secure AVIC guestsarch/x86/kvm/svm/sev.c+16 -00 replies
27/27KVM: SVM: Advertise Secure AVIC support for SEV-SNP guestsarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c+19 -110 replies

Reviews trailers per patch

2 of 27 patches have a Reviewed-by or Acked-by.

PatchTom Lendacky
1/27
2/27
3/27
4/27
5/27R-b
6/27R-b
7/27
8/27
9/27
10/27
11/27
12/27
13/27
14/27
15/27
16/27
17/27
18/27
19/27
20/27
21/27
22/27
23/27
24/27
25/27
26/27
27/27

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

Read the v3 thread

Cover letter [RFC PATCH v3 00/27] KVM: SVM: Add support for SEV-SNP Secure AVIC

This is RFC v3 of the patches adding KVM support for Secure AVIC. RFC v2:
http://lore.kernel.org/r/[email protected]

There are significant changes throughout the series since the last RFC, with some of the highlights being:
- Integrate with AVIC code since Secure AVIC is APICv, but for protected APIC guests. This aligns with TDX which also requires APICv and enables reuse of APICv code paths in KVM. Patches #8 to #14.
- Mandate use of split irqchip, and drop changes related to the KVM IOAPIC. KVM PIC/PIT can't be supported (described more fully in the commit log of the relevant patches). Patch #24.
- Enable use of SVM_AVIC_INCOMPLETE_IPI VMGEXIT for vCPU notification request from the guest. Patch #22.
- Utilize vNMI injection path for NMI handling. Patch #23.
- Introduce a new kvm_x86_op to distinguish need for injectable interrupts vs. IPI notifications. Patches #18 and #19.
- Retain KVM PV ops, and instead require guests to opt-in/disable. Patch #3.

Patches #1 to #4 are changes to the guest x2APIC Secure AVIC driver.

These patches apply on top of Sean's recent fixes changing AVIC init code (since I was carrying a similar patch):
http://lore.kernel.org/r/[email protected]

There are still some rough edges to iron out, but I wanted to get some feedback on the overall direction. Please let me know if you see any major red flags.

Thanks,
- Naveen

Kishon Vijay Abraham I (2):
KVM: SVM: Set VGIF in VMSA area for Secure AVIC guests
KVM: SVM: Do not inject exceptions for Secure AVIC

Naveen N Rao (AMD) (20):
x86/apic: Drop savic_eoi() in favor of native_apic_msr_eoi() for
Secure AVIC
x86/kvm: Disable PV_SEND_IPI if Secure AVIC is enabled x86/apic: Use AVIC_INCOMPLETE_IPI VMGEXIT for Secure AVIC IPI handling
KVM: SVM: Add helper to check if Secure AVIC is enabled for a guest
KVM: SVM: Set guest_apic_protected if Secure AVIC is enabled
kvm: irqfd: Have kvm_arch_has_irq_bypass() take struct kvm pointer
KVM: SVM: Disable IRQ bypass for Secure AVIC
KVM: SVM: Add avic_ipiv_is_soft_disabled() as a wrapper around
enable_ipiv
KVM: SVM: Disable IPIv for Secure AVIC
KVM: SVM: Short-circuit a few AVIC flows for Secure AVIC
KVM: SVM: Warn if we ever receive AVIC_UNACCELERATED_ACCESS #VMEXIT
KVM: SVM: Do not inhibit AVIC for SEV-SNP guests if Secure AVIC is
enabled
KVM: x86: Add a new kvm_x86_op protected_apic_has_injectable_intr()
KVM: SVM: Implement kvm_x86_ops->protected_apic_has_injectable_intr()
for Secure AVIC
KVM: SVM: Implement kvm_x86_ops->protected_apic_has_interrupt() for
Secure AVIC
KVM: SVM: Add interrupt delivery support for Secure AVIC guests
KVM: SVM: Add support for incomplete IPI handling for Secure AVIC
KVM: SVM: Add support for injecting NMIs for Secure AVIC guests
KVM: SVM: Mandate use of split irqchip for Secure AVIC
KVM: SVM: Advertise Secure AVIC support for SEV-SNP guests

Neeraj Upadhyay (5):
x86/apic: Propagate APIC_SPIV writes to hv for Secure AVIC x86/cpufeatures: Add Secure AVIC CPU feature
KVM: SVM: Add handler for VMGEXIT Secure AVIC NAE event
KVM: SVM: Do not intercept SECURE_AVIC_CONTROL MSR for Secure AVIC
guests
KVM: SVM: Do not intercept exceptions for Secure AVIC guests

 arch/arm64/include/asm/kvm_host.h   |   2 +-
 arch/x86/include/asm/cpufeatures.h  |   1 +
 arch/x86/include/asm/kvm-x86-ops.h  |   1 +
 arch/x86/include/asm/kvm_host.h     |   9 +-
 arch/x86/include/asm/svm.h          |   9 +-
 arch/x86/include/uapi/asm/svm.h     |   1 +
 arch/x86/kvm/svm/svm.h              |  12 ++
 include/linux/kvm_host.h            |   2 +-
 arch/powerpc/kvm/powerpc.c          |   2 +-
 arch/x86/coco/sev/core.c            |  18 ++-
 arch/x86/kernel/apic/x2apic_savic.c |  36 +-----
 arch/x86/kernel/kvm.c               |   3 +-
 arch/x86/kvm/irq.c                  |   5 +-
 arch/x86/kvm/svm/avic.c             | 105 ++++++++++++++++--
 arch/x86/kvm/svm/sev.c              | 164 +++++++++++++++++++++++++++-
 arch/x86/kvm/svm/svm.c              |  59 ++++++++--
 arch/x86/kvm/vmx/posted_intr.c      |   2 +-
 arch/x86/kvm/x86.c                  |  21 +++-
 virt/kvm/eventfd.c                  |   2 +-
 19 files changed, 382 insertions(+), 72 deletions(-)

base-commit: 50406d35f5635e1cc523e61409d57e851b5f5df8
prerequisite-patch-id: 1428b4903537b426ee3822a74adf29fbbbeb8e02
prerequisite-patch-id: c88b0c2cb26fb85fc7ef07409aeaf643565b8600
prerequisite-patch-id: a3f8fc507b7809645b001e9394a51f8b299aae47

Signature · 1 line
2.54.0