[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/70] target/i386: Parse TDX vm type
|
From: |
Xiaoyao Li |
|
Subject: |
[PATCH v3 15/70] target/i386: Parse TDX vm type |
|
Date: |
Wed, 15 Nov 2023 02:14:24 -0500 |
TDX VM requires VM type KVM_X86_TDX_VM to be passed to
kvm_ioctl(KVM_CREATE_VM).
If tdx-guest object is specified to confidential-guest-support, like,
qemu -machine ...,confidential-guest-support=tdx0 \
-object tdx-guest,id=tdx0,...
it parses VM type as KVM_X86_TDX_VM.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
target/i386/kvm/kvm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 2e47fda25f95..c4050cbf998e 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -32,6 +32,7 @@
#include "sysemu/runstate.h"
#include "kvm_i386.h"
#include "sev.h"
+#include "tdx.h"
#include "xen-emu.h"
#include "hyperv.h"
#include "hyperv-proto.h"
@@ -164,12 +165,17 @@ static int kvm_get_one_msr(X86CPU *cpu, int index,
uint64_t *value);
static const char* vm_type_name[] = {
[KVM_X86_DEFAULT_VM] = "default",
[KVM_X86_SW_PROTECTED_VM] = "sw-protected-vm",
+ [KVM_X86_TDX_VM] = "tdx",
};
int kvm_get_vm_type(MachineState *ms, const char *vm_type)
{
int kvm_type = KVM_X86_DEFAULT_VM;
+ if (ms->cgs && object_dynamic_cast(OBJECT(ms->cgs), TYPE_TDX_GUEST)) {
+ kvm_type = KVM_X86_TDX_VM;
+ }
+
/*
* old KVM doesn't support KVM_CAP_VM_TYPES and KVM_X86_DEFAULT_VM
* is always supported
--
2.34.1
- [PATCH v3 08/70] physmem: replace function name with __func__ in ram_block_discard_range(), (continued)
- [PATCH v3 08/70] physmem: replace function name with __func__ in ram_block_discard_range(), Xiaoyao Li, 2023/11/15
- [PATCH v3 10/70] kvm: handle KVM_EXIT_MEMORY_FAULT, Xiaoyao Li, 2023/11/15
- [PATCH v3 12/70] *** HACK *** linux-headers: Update headers to pull in TDX API changes, Xiaoyao Li, 2023/11/15
- [PATCH v3 13/70] i386: Introduce tdx-guest object, Xiaoyao Li, 2023/11/15
- [PATCH v3 14/70] target/i386: Implement mc->kvm_type() to get VM type, Xiaoyao Li, 2023/11/15
- [PATCH v3 15/70] target/i386: Parse TDX vm type,
Xiaoyao Li <=
- [PATCH v3 11/70] trace/kvm: Add trace for page convertion between shared and private, Xiaoyao Li, 2023/11/15
- [PATCH v3 16/70] target/i386: Introduce kvm_confidential_guest_init(), Xiaoyao Li, 2023/11/15
- [PATCH v3 17/70] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context, Xiaoyao Li, 2023/11/15
- [PATCH v3 18/70] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES, Xiaoyao Li, 2023/11/15
- [PATCH v3 19/70] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object, Xiaoyao Li, 2023/11/15
- [PATCH v3 20/70] i386/tdx: Adjust the supported CPUID based on TDX restrictions, Xiaoyao Li, 2023/11/15
- [PATCH v3 21/70] i386/tdx: Update tdx_cpuid_lookup[].tdx_fixed0/1 by tdx_caps.cpuid_config[], Xiaoyao Li, 2023/11/15