[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 07/33] i386: Add SGX CPUID leaf FEAT_SGX_12_0_EAX
From: |
Yang Zhong |
Subject: |
[PATCH v3 07/33] i386: Add SGX CPUID leaf FEAT_SGX_12_0_EAX |
Date: |
Fri, 9 Jul 2021 19:09:29 +0800 |
From: Sean Christopherson <sean.j.christopherson@intel.com>
CPUID leaf 12_0_EAX is an Intel-defined feature bits leaf enumerating
the CPU's SGX capabilities, e.g. supported SGX instruction sets.
Currently there are four enumerated capabilities:
- SGX1 instruction set, i.e. "base" SGX
- SGX2 instruction set for dynamic EPC management
- ENCLV instruction set for VMM oversubscription of EPC
- ENCLS-C instruction set for thread safe variants of ENCLS
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
---
target/i386/cpu.c | 20 ++++++++++++++++++++
target/i386/cpu.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b82674c8d9..4d60e62f9e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -653,6 +653,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
/* missing:
CPUID_XSAVE_XSAVEC, CPUID_XSAVE_XSAVES */
#define TCG_14_0_ECX_FEATURES 0
+#define TCG_SGX_12_0_EAX_FEATURES 0
FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
[FEAT_1_EDX] = {
@@ -1181,6 +1182,25 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.tcg_features = TCG_14_0_ECX_FEATURES,
},
+ [FEAT_SGX_12_0_EAX] = {
+ .type = CPUID_FEATURE_WORD,
+ .feat_names = {
+ "sgx1", "sgx2", NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ },
+ .cpuid = {
+ .eax = 0x12,
+ .needs_ecx = true, .ecx = 0,
+ .reg = R_EAX,
+ },
+ .tcg_features = TCG_SGX_12_0_EAX_FEATURES,
+ },
};
typedef struct FeatureMask {
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index dfa5f7296c..054aeae92d 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -559,6 +559,7 @@ typedef enum FeatureWord {
FEAT_VMX_BASIC,
FEAT_VMX_VMFUNC,
FEAT_14_0_ECX,
+ FEAT_SGX_12_0_EAX, /* CPUID[EAX=0x12,ECX=0].EAX (SGX) */
FEATURE_WORDS,
} FeatureWord;
--
2.29.2.334.gfaefdd61ec
- [PATCH v3 00/33] Qemu SGX virtualization, Yang Zhong, 2021/07/09
- [PATCH v3 02/33] hostmem: Add hostmem-epc as a backend for SGX EPC, Yang Zhong, 2021/07/09
- [PATCH v3 03/33] qom: Add memory-backend-epc ObjectOptions support, Yang Zhong, 2021/07/09
- [PATCH v3 04/33] i386: Add 'sgx-epc' device to expose EPC sections to guest, Yang Zhong, 2021/07/09
- [PATCH v3 01/33] memory: Add RAM_PROTECTED flag to skip IOMMU mappings, Yang Zhong, 2021/07/09
- [PATCH v3 05/33] vl: Add sgx compound properties to expose SGX EPC sections to guest, Yang Zhong, 2021/07/09
- [PATCH v3 06/33] i386: Add primary SGX CPUID and MSR defines, Yang Zhong, 2021/07/09
- [PATCH v3 07/33] i386: Add SGX CPUID leaf FEAT_SGX_12_0_EAX,
Yang Zhong <=
- [PATCH v3 08/33] i386: Add SGX CPUID leaf FEAT_SGX_12_0_EBX, Yang Zhong, 2021/07/09
- [PATCH v3 09/33] i386: Add SGX CPUID leaf FEAT_SGX_12_1_EAX, Yang Zhong, 2021/07/09
- [PATCH v3 10/33] i386: Add get/set/migrate support for SGX_LEPUBKEYHASH MSRs, Yang Zhong, 2021/07/09
- [PATCH v3 11/33] i386: Add feature control MSR dependency when SGX is enabled, Yang Zhong, 2021/07/09
- [PATCH v3 12/33] i386: Update SGX CPUID info according to hardware/KVM/user input, Yang Zhong, 2021/07/09
- [PATCH v3 14/33] i386: Propagate SGX CPUID sub-leafs to KVM, Yang Zhong, 2021/07/09
- [PATCH v3 13/33] i386: kvm: Add support for exposing PROVISIONKEY to guest, Yang Zhong, 2021/07/09
- [PATCH v3 15/33] Adjust min CPUID level to 0x12 when SGX is enabled, Yang Zhong, 2021/07/09
- [PATCH v3 16/33] hw/i386/fw_cfg: Set SGX bits in feature control fw_cfg accordingly, Yang Zhong, 2021/07/09
- [PATCH v3 17/33] hw/i386/pc: Account for SGX EPC sections when calculating device memory, Yang Zhong, 2021/07/09