On Mon, Dec 18, 2023, Peter Gonda wrote: > SEV guests rely on an encyption bit (C-bit) which resides within the > physical address range, i.e. is stolen from the guest's GPA space. Guest > code in selftests will expect the C-Bit to be set appropriately in the > guest's page tables, whereas the rest of the kvm_util functions will > generally expect these bits to not be present. Introduce pte_me_mask and > struct kvm_vm_arch to allow for arch specific address tagging. > > Currently just adding x86 c_bit and s_bit support for > SEV and TDX. > > Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> > Cc: Sean Christopherson <seanjc@xxxxxxxxxx> > Cc: Vishal Annapurve <vannapurve@xxxxxxxxxx> > Cc: Ackerly Tng <ackerleytng@xxxxxxxxxx> > cc: Andrew Jones <andrew.jones@xxxxxxxxx> > Cc: Tom Lendacky <thomas.lendacky@xxxxxxx> > Cc: Michael Roth <michael.roth@xxxxxxx> > Originally-by: Michael Roth <michael.roth@xxxxxxx> > Signed-off-by: Peter Gonda <pgonda@xxxxxxxxxx> > --- > tools/arch/arm64/include/asm/kvm_host.h | 7 +++++ > tools/arch/riscv/include/asm/kvm_host.h | 7 +++++ > tools/arch/s390/include/asm/kvm_host.h | 7 +++++ > tools/arch/x86/include/asm/kvm_host.h | 13 +++++++++ > .../selftests/kvm/include/kvm_util_base.h | 13 +++++++++ > tools/testing/selftests/kvm/lib/kvm_util.c | 27 ++++++++++++++++--- > .../selftests/kvm/lib/x86_64/processor.c | 15 ++++++++++- > 7 files changed, 85 insertions(+), 4 deletions(-) > create mode 100644 tools/arch/arm64/include/asm/kvm_host.h > create mode 100644 tools/arch/riscv/include/asm/kvm_host.h > create mode 100644 tools/arch/s390/include/asm/kvm_host.h > create mode 100644 tools/arch/x86/include/asm/kvm_host.h As I said in the previous version, kvm_host.h is a bad name. There's also zero reason to put this in tools/arch/<arch>/include, the header is specific to KVM selftests *and* we already have per-arch directories.