[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 23/44] i386/tdx: Use KVM_TDX_INIT_VCPU to pass HOB to TDVF
From: |
isaku . yamahata |
Subject: |
[RFC PATCH v2 23/44] i386/tdx: Use KVM_TDX_INIT_VCPU to pass HOB to TDVF |
Date: |
Wed, 7 Jul 2021 17:54:53 -0700 |
From: Isaku Yamahata <isaku.yamahata@intel.com>
Specify the initial value for RCX/R8 to be the address of the HOB.
Don't propagate the value to Qemu's cache of the registers so as to
avoid implying that the register state is valid, e.g. Qemu doesn't model
TDX-SEAM behavior for initializing other GPRs.
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
---
target/i386/kvm/tdx.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 0cd649dd01..c348626dbf 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -285,10 +285,17 @@ out:
void tdx_post_init_vcpu(CPUState *cpu)
{
- CPUX86State *env = &X86_CPU(cpu)->env;
+ MachineState *ms = MACHINE(qdev_get_machine());
+ TdxGuest *tdx = (TdxGuest *)object_dynamic_cast(OBJECT(ms->cgs),
+ TYPE_TDX_GUEST);
+ TdxFirmwareEntry *hob;
+
+ if (!tdx) {
+ return;
+ }
- _tdx_ioctl(cpu, KVM_TDX_INIT_VCPU, 0,
- (void *)(unsigned long)env->regs[R_ECX]);
+ hob = tdx_get_hob_entry(tdx);
+ _tdx_ioctl(cpu, KVM_TDX_INIT_VCPU, 0, (void *)hob->address);
}
static bool tdx_guest_get_debug(Object *obj, Error **errp)
--
2.25.1
- [RFC PATCH v2 41/44] ioapic: add property to disallow INIT/SIPI delivery mode, (continued)
- [RFC PATCH v2 41/44] ioapic: add property to disallow INIT/SIPI delivery mode, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 20/44] i386/tdx: Parse tdx metadata and store the result into TdxGuestState, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 22/44] i386/tdx: Add TDVF memory via INIT_MEM_REGION, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 21/44] i386/tdx: Create the TD HOB list upon machine init done, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 40/44] hw/i386: add a flag to disallow SMI, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 43/44] i386/tdx: disallow level interrupt and SMI/INIT/SIPI delivery mode, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 44/44] i386/tdx: disable S3/S4 unconditionally, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 25/44] q35: Move PCIe BAR check above PAM check in mch_write_config(), isaku . yamahata, 2021/07/07
- [RFC PATCH v2 24/44] i386/tdx: Add MMIO HOB entries, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 42/44] hw/i386: add a flag to disable init/sipi delivery mode of interrupt, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 23/44] i386/tdx: Use KVM_TDX_INIT_VCPU to pass HOB to TDVF,
isaku . yamahata <=
- [RFC PATCH v2 27/44] q35: Introduce smm_ranges property for q35-pci-host, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 28/44] i386/tdx: Force x2apic mode and routing for TDs, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 26/44] pci-host/q35: Move PAM initialization above SMRAM initialization, isaku . yamahata, 2021/07/07