qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 05/33] i386: Add 'sgx-epc' device to expose EPC sections to gu


From: Thomas Huth
Subject: Re: [PULL 05/33] i386: Add 'sgx-epc' device to expose EPC sections to guest
Date: Tue, 9 Nov 2021 15:25:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

On 28/09/2021 14.50, Paolo Bonzini wrote:
From: Sean Christopherson <sean.j.christopherson@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.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-5-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]