VMware registers each per-CPU steal-time GPA with the host. An encrypted
guest must first convert that storage to shared memory, but the existing
setup publishes the address without conversion.
Patch 1 makes the decrypted per-CPU section available with
CONFIG_X86_MEM_ENCRYPT, including TDX-only configurations. Patch 2 defers
encrypted-guest setup until allocator-backed page-table splitting is
available, converts every possible CPU's storage before publishing any
GPA, and attempts to roll back all conversions on failure.
TDX's conversion callback uses __pa(), so patch 2 preflights every possible
CPU and leaves steal time disabled if a TDX guest uses vmalloc-backed
per-CPU storage. This covers percpu_alloc=page and automatic allocator
fallback. AMD encrypted guests support those mappings and are not rejected.
Supporting them in TDX would require a separate conversion-API change.
Conversion need not preserve zeroes, and the host initializes only the
8-byte counter. Patch 2 therefore clears each 64-byte object after
conversion and before registration, without disturbing other decrypted
objects that can share its page.
The intended merge path is tip's x86/vmware branch, following
commit ac26963a1175 ("percpu: Introduce DEFINE_PER_CPU_DECRYPTED").
Per-CPU and asm-generic maintainer Acks are requested for patch 1.
This replaces patch 4 of Alexey's v2 posting:
https://lore.kernel.org/all/[email protected]/
Zack Rusin (2):
percpu: Use X86_MEM_ENCRYPT for decrypted per-CPU data
x86/vmware: Decrypt steal-time storage before sharing it
arch/x86/kernel/cpu/vmware.c | 96 ++++++++++++++++++++++++++++++-
include/asm-generic/vmlinux.lds.h | 2 +-
include/linux/percpu-defs.h | 2 +-
3 files changed, 97 insertions(+), 3 deletions(-)
base-commit: fd73f4a6659897191fa0d40695fe370925dd3780
--
2.53.0