On Tue, Sep 14, 2021 at 08:36:24AM +0200, Philippe Mathieu-Daudé wrote: > On 7/19/21 1:21 PM, Yang Zhong 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> > > --- > > hw/i386/meson.build | 1 + > > hw/i386/sgx-epc.c | 161 ++++++++++++++++++++++++++++++++++++++ > > include/hw/i386/sgx-epc.h | 44 +++++++++++ > > 3 files changed, 206 insertions(+) > > create mode 100644 hw/i386/sgx-epc.c > > create mode 100644 include/hw/i386/sgx-epc.h > > > > diff --git a/hw/i386/meson.build b/hw/i386/meson.build > > index 80dad29f2b..27476b36bb 100644 > > --- a/hw/i386/meson.build > > +++ b/hw/i386/meson.build > > @@ -5,6 +5,7 @@ i386_ss.add(files( > > 'e820_memory_layout.c', > > 'multiboot.c', > > 'x86.c', > > + 'sgx-epc.c', > > )) > > > > i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'), > > diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c > > new file mode 100644 > > index 0000000000..aa487dea79 > > --- /dev/null > > +++ b/hw/i386/sgx-epc.c > > @@ -0,0 +1,161 @@ > > +/* > > + * SGX EPC device > > + * > > + * Copyright (C) 2019 Intel Corporation > > + * > > + * Authors: > > + * Sean Christopherson <sean.j.christopher...@intel.com> > > + * > > + * This work is licensed under the terms of the GNU GPL, version 2 or > > later. > > + * See the COPYING file in the top-level directory. > > + */ > > +#include "qemu/osdep.h" > > +#include "hw/i386/pc.h" > > +#include "hw/i386/sgx-epc.h" > > +#include "hw/mem/memory-device.h" > > +#include "hw/qdev-properties.h" > > +#include "monitor/qdev.h" > > Is that include used? > > > +#include "qapi/error.h" > > +#include "qapi/visitor.h" > > +#include "qemu/config-file.h" > > Ditto. > > > +#include "qemu/error-report.h" > > Ditto. > > > +#include "qemu/option.h" > > Ditto. > > > +#include "qemu/units.h" > > Ditto. > Thanks Philippe, those header files have been removed in the Paolo's gitlab(sgx branch), thanks!
Yang > > +#include "target/i386/cpu.h" > > +#include "exec/address-spaces.h"