[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v4 35/36] i386/tdx: Don't get/put guest state for TDX VMs
From: |
Xiaoyao Li |
Subject: |
[RFC PATCH v4 35/36] i386/tdx: Don't get/put guest state for TDX VMs |
Date: |
Thu, 12 May 2022 11:18:02 +0800 |
From: Sean Christopherson <sean.j.christopherson@intel.com>
Don't get/put state of TDX VMs since accessing/mutating guest state of
production TDs is not supported.
Note, it will be allowed for a debug TD. Corresponding support will be
introduced when debug TD support is implemented in the future.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
target/i386/kvm/kvm.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 4d520d0e34bd..3e26dacf7807 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -4478,6 +4478,11 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu));
+ /* TODO: Allow accessing guest state for debug TDs. */
+ if (is_tdx_vm()) {
+ return 0;
+ }
+
/* must be before kvm_put_nested_state so that EFER.SVME is set */
ret = has_sregs2 ? kvm_put_sregs2(x86_cpu) : kvm_put_sregs(x86_cpu);
if (ret < 0) {
@@ -4572,6 +4577,12 @@ int kvm_arch_get_registers(CPUState *cs)
if (ret < 0) {
goto out;
}
+
+ /* TODO: Allow accessing guest state for debug TDs. */
+ if (is_tdx_vm()) {
+ return 0;
+ }
+
ret = kvm_getput_regs(cpu, 0);
if (ret < 0) {
goto out;
--
2.27.0
- Re: [RFC PATCH v4 27/36] i386/tdx: Disable SMM for TDX VMs, (continued)
- [RFC PATCH v4 29/36] i386/tdx: Don't allow system reset for TDX VMs, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 30/36] hw/i386: add eoi_intercept_unsupported member to X86MachineState, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 26/36] i386/tdx: Finalize TDX VM, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 28/36] i386/tdx: Disable PIC for TDX VMs, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 33/36] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 35/36] i386/tdx: Don't get/put guest state for TDX VMs,
Xiaoyao Li <=
- [RFC PATCH v4 32/36] i386/tdx: Don't synchronize guest tsc for TDs, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 34/36] i386/tdx: Skip kvm_put_apicbase() for TDs, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 31/36] hw/i386: add option to forcibly report edge trigger in acpi tables, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 36/36] docs: Add TDX documentation, Xiaoyao Li, 2022/05/11