[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 13/20] i386: Propagate SGX CPUID sub-leafs to KV
From: |
Sean Christopherson |
Subject: |
[Qemu-devel] [RFC PATCH 13/20] i386: Propagate SGX CPUID sub-leafs to KVM |
Date: |
Tue, 6 Aug 2019 11:56:42 -0700 |
The SGX sub-leafs are enumerated at CPUID 0x12. Indices 0 and 1 are
always present when SGX is supported, and enumerate SGX features and
capabilities. Indices >=2 are directly correlated with the platform's
EPC sections. Because the number of EPC sections is dynamic and user
defined, the number of SGX sub-leafs is "NULL" terminated.
Signed-off-by: Sean Christopherson <address@hidden>
---
target/i386/kvm.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index dcda0bb0e9..8a3dccf54e 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1497,6 +1497,25 @@ int kvm_arch_init_vcpu(CPUState *cs)
c = &cpuid_data.entries[cpuid_i++];
}
break;
+ case 0x12:
+ for (j = 0; ; j++) {
+ c->function = i;
+ c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
+ c->index = j;
+ cpu_x86_cpuid(env, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx);
+
+ if (j > 1 && (c->eax & 0xf) != 1) {
+ break;
+ }
+
+ if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
+ fprintf(stderr, "cpuid_data is full, no space for "
+ "cpuid(eax:0x12,ecx:0x%x)\n", j);
+ abort();
+ }
+ c = &cpuid_data.entries[cpuid_i++];
+ }
+ break;
case 0x14: {
uint32_t times;
--
2.22.0
- [Qemu-devel] [RFC PATCH 12/20] i386: kvm: Add support for exposing PROVISIONKEY to guest, (continued)
- [Qemu-devel] [RFC PATCH 12/20] i386: kvm: Add support for exposing PROVISIONKEY to guest, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 07/20] i386: Add SGX CPUID leaf FEAT_SGX_12_1_EBX, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 11/20] linux-headers: Add temporary placeholder for KVM_CAP_SGX_ATTRIBUTE, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 02/20] i386: Add 'sgx-epc' device to expose EPC sections to guest, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 03/20] vl: Add "sgx-epc" option to expose SGX EPC sections to guest, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 20/20] i440fx: Add support for SGX EPC, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 18/20] i386: acpi: Add SGX EPC entry to ACPI tables, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 16/20] hw/i386/pc: Account for SGX EPC sections when calculating device memory, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 19/20] q35: Add support for SGX EPC, Sean Christopherson, 2019/08/06
- [Qemu-devel] [RFC PATCH 13/20] i386: Propagate SGX CPUID sub-leafs to KVM,
Sean Christopherson <=
- Re: [Qemu-devel] [RFC PATCH 00/20] i386: Add support for Intel SGX, no-reply, 2019/08/06
- Re: [Qemu-devel] [RFC PATCH 00/20] i386: Add support for Intel SGX, no-reply, 2019/08/06