[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 07/23] i386/kvm: Squash getting/putting guest state for TDX V
From: |
Isaku Yamahata |
Subject: |
[RFC PATCH 07/23] i386/kvm: Squash getting/putting guest state for TDX VMs |
Date: |
Mon, 15 Feb 2021 18:13:03 -0800 |
From: Sean Christopherson <sean.j.christopherson@intel.com>
Ignore get/put state of TDX VMs as accessing/mutating guest state of
producation TDs is not supported.
Allow kvm_arch_get_registers() to run as normal, except for MSRs, for
debug TDs, and silently ignores attempts to read guest state for
non-debug TDs.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
target/i386/kvm/kvm.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index ab7a896bd2..9c5f669b7c 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2565,6 +2565,11 @@ void kvm_put_apicbase(X86CPU *cpu, uint64_t value)
{
int ret;
+ /* TODO: Allow accessing guest state for debug TDs. */
+ if (vm_type == KVM_X86_TDX_VM) {
+ return;
+ }
+
ret = kvm_put_one_msr(cpu, MSR_IA32_APICBASE, value);
assert(ret == 1);
}
@@ -4019,6 +4024,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 (vm_type == KVM_X86_TDX_VM) {
+ return 0;
+ }
+
/* must be before kvm_put_nested_state so that EFER.SVME is set */
ret = kvm_put_sregs(x86_cpu);
if (ret < 0) {
@@ -4129,9 +4139,11 @@ int kvm_arch_get_registers(CPUState *cs)
if (ret < 0) {
goto out;
}
- ret = kvm_get_msrs(cpu);
- if (ret < 0) {
- goto out;
+ if (vm_type != KVM_X86_TDX_VM) {
+ ret = kvm_get_msrs(cpu);
+ if (ret < 0) {
+ goto out;
+ }
}
ret = kvm_get_apic(cpu);
if (ret < 0) {
--
2.17.1
- [RFC PATCH 00/23] [RFC PATCH 00/24] TDX support, Isaku Yamahata, 2021/02/15
- [RFC PATCH 05/23] vl: Introduce machine_init_done_late notifier, Isaku Yamahata, 2021/02/15
- [RFC PATCH 06/23] hw/i386: Introduce kvm-type for TDX guest, Isaku Yamahata, 2021/02/15
- [RFC PATCH 02/23] kvm: Switch KVM_CAP_READONLY_MEM to a per-VM ioctl(), Isaku Yamahata, 2021/02/15
- [RFC PATCH 07/23] i386/kvm: Squash getting/putting guest state for TDX VMs,
Isaku Yamahata <=
- [RFC PATCH 03/23] KVM: i386: use VM capability check for KVM_CAP_X86_SMM, Isaku Yamahata, 2021/02/15
- [RFC PATCH 08/23] i386/kvm: Skip KVM_X86_SETUP_MCE for TDX guests, Isaku Yamahata, 2021/02/15
- [RFC PATCH 04/23] i386/kvm: Move architectural CPUID leaf generation to separarte helper, Isaku Yamahata, 2021/02/15
- [RFC PATCH 09/23] target/i386: kvm: don't synchronize guest tsc for TD guest, Isaku Yamahata, 2021/02/15
- [RFC PATCH 01/23] target/i386: Expose x86_cpu_get_supported_feature_word() for TDX, Isaku Yamahata, 2021/02/15
- [RFC PATCH 10/23] linux-headers: Update headers to pull in TDX API changes, Isaku Yamahata, 2021/02/15
- [RFC PATCH 13/23] i386/tdx: Frame in tdx_get_supported_cpuid with KVM_TDX_CAPABILITIES, Isaku Yamahata, 2021/02/15
- [RFC PATCH 11/23] hw/i386: Initialize TDX via KVM ioctl() when kvm_type is TDX, Isaku Yamahata, 2021/02/15
- [RFC PATCH 14/23] i386/tdx: Frame in the call for KVM_TDX_INIT_VCPU, Isaku Yamahata, 2021/02/15