On 28/09/2021 14.50, Paolo Bonzini wrote:
From: Sean Christopherson <sean.j.christopher...@intel.com>
SGX EPC is enumerated through CPUID, i.e. EPC "devices" need to be
realized prior to realizing the vCPUs themselves, which occurs long
before generic devices are parsed and realized. Because of this,
do not allow 'sgx-epc' devices to be instantiated after vCPUS have
been created.
The 'sgx-epc' device is essentially a placholder at this time, it will
be fully implemented in a future patch along with a dedicated command
to create 'sgx-epc' devices.
Signed-off-by: Sean Christopherson <sean.j.christopher...@intel.com>
Signed-off-by: Yang Zhong <yang.zh...@intel.com>
Message-Id: <20210719112136.57018-5-yang.zh...@intel.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
hw/i386/meson.build | 1 +
hw/i386/sgx-epc.c | 167 ++++++++++++++++++++++++++++++++++++++
include/hw/i386/sgx-epc.h | 44 ++++++++++
3 files changed, 212 insertions(+)
create mode 100644 hw/i386/sgx-epc.c
create mode 100644 include/hw/i386/sgx-epc.h
...
+static void sgx_epc_class_init(ObjectClass *oc, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(oc);
+ MemoryDeviceClass *mdc = MEMORY_DEVICE_CLASS(oc);
+
+ dc->hotpluggable = false;
+ dc->realize = sgx_epc_realize;
+ dc->unrealize = sgx_epc_unrealize;
+ dc->desc = "SGX EPC section";
+ device_class_set_props(dc, sgx_epc_properties);
+
+ mdc->get_addr = sgx_epc_md_get_addr;
+ mdc->set_addr = sgx_epc_md_set_addr;
+ mdc->get_plugged_size = sgx_epc_md_get_plugged_size;
+ mdc->get_memory_region = sgx_epc_md_get_memory_region;
+ mdc->fill_device_info = sgx_epc_md_fill_device_info;
+}
Hi!
Our device-crash-test script reports that this new device can be used to
crash QEMU:
$ ./qemu-system-x86_64 -M none -device sgx-epc
/home/thuth/devel/qemu/include/hw/i386/pc.h:128:PC_MACHINE: Object
0x55c80d332290 is not an instance of type generic-pc-machine
Should it be marked with:
dc->user_creatable = false
?
Thomas