public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v4 0/3] OvmfPkg: Don't make APIC MMIO accesses with encryption bit set
@ 2024-05-01 19:03 Roth, Michael via groups.io
  2024-05-01 19:03 ` [edk2-devel] [PATCH v4 1/3] OvmfPkg/ResetVector: Clear SEV encryption bit for non-leaf PTEs Roth, Michael via groups.io
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Roth, Michael via groups.io @ 2024-05-01 19:03 UTC (permalink / raw)
  To: devel; +Cc: Gerd Hoffmann, Ard Biesheuvel, Tom Lendacky

For the most part, OVMF will clear the encryption bit for MMIO regions,
but there is currently one known exception during SEC when the APIC
base address is accessed via MMIO with the encryption bit set for
SEV-ES/SEV-SNP guests. In the case of SEV-SNP, this requires special
handling on the hypervisor side which may not be available in the
future[1], so make the necessary changes in the SEC-configured page
table to clear the encryption bit for 4K region containing the APIC
base address.

Since CpuPageTableLib is used to handle the splitting, some additional
care must be taken to clear the C-bit in all non-leaf PTEs since the
library expects that to be the case. Add handling for that when setting
up the SEC page table.

While here, drop special handling for the APIC base address in the
SEV-ES/SNP #VC handler.

[1] https://lore.kernel.org/lkml/20240208002420.34mvemnzrwwsaesw@amd.com/#t

Thanks!

-Mike

v4:
  - split original patch out into 3 patches for each functional change (Gerd)
v3:
  - also clear C-bit for non-leaf PTEs containing GHCB range
  - add missing Cc's to commit log
v2:
  - use CpuPageTableLib to handle splitting (Gerd, Tom)


----------------------------------------------------------------
Michael Roth (3):
      OvmfPkg/ResetVector: Clear SEV encryption bit for non-leaf PTEs
      OvmfPkg: Don't make APIC MMIO accesses with encryption bit set
      OvmfPkg/CcExitLib: Drop special handling for Encrypted MMIO to APIC

 OvmfPkg/AmdSev/AmdSevX64.fdf                |  5 ++-
 OvmfPkg/Bhyve/BhyveX64.dsc                  |  1 +
 OvmfPkg/CloudHv/CloudHvX64.fdf              |  5 ++-
 OvmfPkg/Library/CcExitLib/CcExitVcHandler.c | 12 +-----
 OvmfPkg/Microvm/MicrovmX64.fdf              |  3 ++
 OvmfPkg/OvmfPkg.dec                         |  5 +++
 OvmfPkg/OvmfPkgX64.fdf                      |  5 ++-
 OvmfPkg/ResetVector/Ia32/AmdSev.asm         |  5 ++-
 OvmfPkg/ResetVector/Ia32/PageTables64.asm   | 20 +++++-----
 OvmfPkg/Sec/AmdSev.c                        | 58 +++++++++++++++++++++++++++++
 OvmfPkg/Sec/AmdSev.h                        | 14 +++++++
 OvmfPkg/Sec/SecMain.c                       |  1 +
 OvmfPkg/Sec/SecMain.inf                     |  3 ++
 13 files changed, 112 insertions(+), 25 deletions(-)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118470): https://edk2.groups.io/g/devel/message/118470
Mute This Topic: https://groups.io/mt/105849106/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-02 11:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01 19:03 [edk2-devel] [PATCH v4 0/3] OvmfPkg: Don't make APIC MMIO accesses with encryption bit set Roth, Michael via groups.io
2024-05-01 19:03 ` [edk2-devel] [PATCH v4 1/3] OvmfPkg/ResetVector: Clear SEV encryption bit for non-leaf PTEs Roth, Michael via groups.io
2024-05-01 19:03 ` [edk2-devel] [PATCH v4 2/3] OvmfPkg: Don't make APIC MMIO accesses with encryption bit set Roth, Michael via groups.io
2024-05-01 19:03 ` [edk2-devel] [PATCH v4 3/3] OvmfPkg/CcExitLib: Drop special handling for Encrypted MMIO to APIC Roth, Michael via groups.io
2024-05-02  9:06 ` [edk2-devel] [PATCH v4 0/3] OvmfPkg: Don't make APIC MMIO accesses with encryption bit set Gerd Hoffmann
2024-05-02 11:50   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox