From 7ead76d9444ad38538033a070836121cb4a7e20f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 18 Jul 2025 18:03:49 +0200 Subject: [PATCH 099/115] i386/tdx: Remove enumeration of GetQuote in tdx_handle_get_tdvmcall_info() RH-Author: Paolo Bonzini RH-MergeRequest: 391: TDX support, including attestation and device assignment RH-Jira: RHEL-15710 RHEL-20798 RHEL-49728 RH-Acked-by: Yash Mankad RH-Acked-by: Peter Xu RH-Acked-by: David Hildenbrand RH-Commit: [99/115] 0d402fadbfd0059369166a44d98f51fa46fd7ca3 (bonzini/rhel-qemu-kvm) GHCI is finalized with the being one of the base VMCALLs, and not enuemrated via . Adjust tdx_handle_get_tdvmcall_info() to match with GHCI. Opportunistically fix the wrong indentation and explicitly set the ret to TDG_VP_VMCALL_SUCCESS (in case KVM leaves unexpected value). Signed-off-by: Xiaoyao Li Link: https://lore.kernel.org/r/20250703024021.3559286-2-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini (cherry picked from commit b57999bb258349fabe497c8ff70277b5e5b281e2) Signed-off-by: Paolo Bonzini --- target/i386/kvm/tdx.c | 6 ++++-- target/i386/kvm/tdx.h | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 201da78b06..2ca661cbc4 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -1259,13 +1259,15 @@ out_free: void tdx_handle_get_tdvmcall_info(X86CPU *cpu, struct kvm_run *run) { if (run->tdx.get_tdvmcall_info.leaf != 1) { - return; + return; } - run->tdx.get_tdvmcall_info.r11 = TDG_VP_VMCALL_SUBFUNC_GET_QUOTE; + run->tdx.get_tdvmcall_info.r11 = 0; run->tdx.get_tdvmcall_info.r12 = 0; run->tdx.get_tdvmcall_info.r13 = 0; run->tdx.get_tdvmcall_info.r14 = 0; + + run->tdx.get_tdvmcall_info.ret = TDG_VP_VMCALL_SUCCESS; } static void tdx_panicked_on_fatal_error(X86CPU *cpu, uint64_t error_code, diff --git a/target/i386/kvm/tdx.h b/target/i386/kvm/tdx.h index 35a09c19c5..d439078a87 100644 --- a/target/i386/kvm/tdx.h +++ b/target/i386/kvm/tdx.h @@ -32,8 +32,6 @@ typedef struct TdxGuestClass { #define TDG_VP_VMCALL_GPA_INUSE 0x8000000000000001ULL #define TDG_VP_VMCALL_ALIGN_ERROR 0x8000000000000002ULL -#define TDG_VP_VMCALL_SUBFUNC_GET_QUOTE 0x0000000000000001ULL - enum TdxRamType { TDX_RAM_UNACCEPTED, TDX_RAM_ADDED, -- 2.50.1