On Wed, 12 Jan 2022 at 10:14, Daniel P. Berrangé <berra...@redhat.com> wrote: > > On Wed, Jan 12, 2022 at 11:55:17AM -0500, Yang Zhong wrote: > > When Libvirt start, it get the vcpu's unavailable-features from > > /machine/unattached/device[0] path by qom-get command, but in SGX > > guest, since the sgx-epc virtual device is initialized before VCPU > > creation(virtual sgx need set the virtual EPC info in the cpuid). This > > /machine/unattached/device[0] is occupied by sgx-epc device, which > > fail to get the unvailable-features from /machine/unattached/device[0]. > > If libvirt decides to enable SGX in a VM, then surely it knows > that it should just query /machine/unattached/device[1] to get > the CPU features instead. Why do we need to do anything in QEMU ?
libvirt having to know it needs to look at /machine/unattached/device[n] for anything is a bit fragile, really... it's effectively encoding knowledge about what order things happen to get created inside QEMU. -- PMM