Skip to content

Alternate Injection: Secure Interrupt Delivery for SEV-SNP Guests - Guest Support

Melody Wang lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest7 patches 1 replyIn review
  2. v57 patches 0 repliesSuperseded
  3. v47 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v38 patches13 repliesSuperseded
v28 patches7 repliesApplied
v18 patches9 repliesSuperseded

Changelog from the cover letter

v5
--

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7x86/sev: Add support for Alternate Injectionarch/x86/Kconfig arch/x86/boot/compressed/sev.c arch/x86/coco/core.c +4 more+31 -61 reply
2/7x86/apic: Add an SVSM APIC driverarch/x86/include/asm/sev-common.h arch/x86/include/asm/sev.h arch/x86/kernel/apic/Makefile +1 more+263 -00 replies
3/7x86/sev: Route unsupported APIC register accesses to the hypervisor APIC emulationarch/x86/coco/sev/core.c arch/x86/include/asm/sev-common.h arch/x86/include/asm/sev.h +2 more+31 -410 replies
4/7x86/sev: Add a function to contain all SEV-specific setup operationsdrivers/firmware/efi/libstub/x86-stub.c+4 -40 replies
5/7x86/sev: Register Alternate Injection protocol during OVMF bootdrivers/firmware/efi/libstub/efistub.h drivers/firmware/efi/libstub/x86-stub.c include/linux/efi.h+48 -10 replies
6/7x86/sev: Allow the guest to configure interrupt vectors for the hypervisorarch/x86/boot/startup/sev-startup.c arch/x86/boot/startup/sme.c arch/x86/include/asm/sev.h+32 -00 replies
7/7x86/sev: Indicate that Alternate Injection is supported in the guestarch/x86/boot/compressed/sev.c+8 -10 replies

Reviews trailers per patch

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

Read the v6 thread

Cover letter [PATCH v6 0/7] Alternate Injection: Secure Interrupt Delivery for SEV-SNP Guests - Guest Support

Hi all,

This revision addresses all version 5 review comments from Sashiko.

Key Changes

1. svsm_apic driver cleanups: Removed the read-only MSR from the SVSM APIC filter in svsm_apic_msr_write(), and the write-only MSR from svsm_apic_msr_read().

2. Clarified and updated the commit message for patch 5 to improve readability and context.

Thanks,
Melody

Changelog:
v5
--

This revision addresses all review comments from version 4.

1. As Ard suggested, used a bool as return value for svsm_register_alt_inj() instead of int. Adjusted code with it.

2. Added more comments here for better understanding.

Changelog:
v4
--

This revision addresses all review comments from version 3.

1. As Ard suggested, handed over the registeration of kernel guest for Alternate Injection with the SVSM to the OVMF insteading of calling the SVSM for registration from kernel guest before ExitBootsService().

2. Added a common function for SVSM APIC ICR read and write.

3. Added a common function for sev_apic_ghcb_msr_read/write.

4. Changed some comments for better understanding.

5. Patch "Make-SVSM-calls-preemption-safe.patch" was merged to the tip tree.

v3
--

This revision addresses all review comments from version 2.

The changes include:

1. Moved sev_prepare() from decompressor to EFI stub.

2. Changed "Register Alternate Injection" and "configure all interrupt vectors" as two APIs located in compressed/sev.c since they are self-contained, avoiding exporting functions.

3. Added more comments for better understanding.

v2
--

This revision fixes all the review comments from version 1.

The changes include:

1. Changed a few comments for better understanding, deleted some unnecessary code, corrected some typos, and some minor code fixes from the review comments by Sashiko and Boris.

2. Unified sev_apic_ghcb_msr_write() and sev_apic_ghcb_msr_read().

3. Move x2apic_svsm.o after x2apic_savic.o so that the secure AVIC gets preferred on machines supporting it.

4. Reworked svsm_apic_probe() as Boris suggested.

5. Updated tools with renamed MSR_AMD64_SNP_ALTERNATE_INJ_BIT and MSR_AMD64_SNP_ALT_INJ for completeness' sake.

6. Changed svsm_apic_send_IPI_self() with writing to the dedicated APIC_SELF_IPI instead of writing to APIC_ICR.

v1
--

The revision fixes all of the review comments from version 0.

The changes include:

1. Changed a few commit messages, new file names, variables name and order, function names and more comments for better understanding.

2. Added a pre-patch to fix the problem that in two functions in the the SVSM vTPM guest implementation do not disable preemption when fetching CAA. It is moving the CAA fetching operation inside svsm_perform_call_protocol().

This series relies on this fix too.

3. Removed svsm_do_call() helper function and some intermediary layer functions in SVSM APIC driver.

4. Removed the Secure AVIC check in SVSM APIC driver since it will never be touched.

5. Terminate boot when Alternate Injection is enabled in vmpl0.

6. Added a common function for SVSM APIC read and write.

7. Added a new SEV_TERM_SET_LINUX value for Alternate Injection and APIC ghcb msr read/write.

8. Reworked sev_prepare() to reflect the error conditions correctly.

9. Moved allowing all of interrupts right after registering the SVSM APIC protocol.

v0
--

Alternate Injection is a method to provide secure interrupt delivery for SEV-SNP guests against malicious injection attacks. By handing over the control of the interrupt injection to the guest itself, the security is applied. Alternate Injection use Secure VM Service Module (SVSM), and APIC emulation in the SVSM to secure interrupt delivery.

This is the guest side patches. The patch set includes the following:
1. Add support for enabling Alternate Injection.
2. Add support for the SVSM APIC protocol which uses a subset of the X2APIC MSRs.
3. Add support to allow the guest OS to request Alternate Injection.

Melody Wang (7):
x86/sev: Add support for Alternate Injection
x86/apic: Add an SVSM APIC driver
x86/sev: Route unsupported APIC register accesses to the hypervisor
APIC emulation
x86/sev: Add a function to contain all SEV-specific setup operations x86/sev: Register Alternate Injection protocol during OVMF boot x86/sev: Allow the guest to configure interrupt vectors for the
hypervisor
x86/sev: Indicate that Alternate Injection is supported in the guest

 arch/x86/Kconfig                        |  14 ++
 arch/x86/boot/compressed/sev.c          |  11 +-
 arch/x86/boot/startup/sev-startup.c     |  20 ++
 arch/x86/boot/startup/sme.c             |   3 +
 arch/x86/coco/core.c                    |   3 +
 arch/x86/coco/sev/core.c                |  48 ++---
 arch/x86/include/asm/msr-index.h        |   4 +-
 arch/x86/include/asm/sev-common.h       |   2 +
 arch/x86/include/asm/sev.h              |  26 ++-
 arch/x86/kernel/apic/Makefile           |   1 +
 arch/x86/kernel/apic/x2apic_savic.c     |   8 +-
 arch/x86/kernel/apic/x2apic_svsm.c      | 253 ++++++++++++++++++++++++
 drivers/firmware/efi/libstub/efistub.h  |  11 ++
 drivers/firmware/efi/libstub/x86-stub.c |  42 +++-
 include/linux/cc_platform.h             |   8 +
 include/linux/efi.h                     |   2 +
 tools/arch/x86/include/asm/msr-index.h  |   4 +-
 17 files changed, 412 insertions(+), 48 deletions(-)
 create mode 100644 arch/x86/kernel/apic/x2apic_svsm.c
Signature · 1 line
2.43.0