hw/i386: QOM-attach CPUs/SGX-EPC objects to their parents
v2 cover hw/i386: QOM-attach CPUs/SGX-EPC objects to their parents
Trying to fix the issue reported here:
https://lists.nongnu.org/archive/html/qemu-devel/2021-11/msg05670.html
First attach the CPUs and SGX-EPC objects to the machine.
Since v1:
- addressed Paolo & Daniel review feedbacks
Philippe Mathieu-Daudé (2):
hw/i386: Attach CPUs to machine
hw/i386/sgx: Attach SGX-EPC objects to machine
hw/i386/sgx.c | 2 ++ hw/i386/x86.c | 1 + 2 files changed, 3 insertions(+)
Signature · 1 line
2.34.1
PATCH v2 1/2 hw/i386: Attach CPUs to machine
Previously CPUs were exposed in the QOM tree at a path
/machine/unattached/device[nn]
where the 'nn' of the first CPU is usually zero, but can vary depending on what devices were already created.
With this change the CPUs are now at
/machine/cpu[nn]
where the 'nn' of the first CPU is always zero.
--- hw/i386/x86.c | 1 + 1 file changed, 1 insertion(+)
hw/i386/x86.c +1 -0
@@ -108,6 +108,7 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) {Object *cpu =object_new (MACHINE (x86ms)->cpu_type); +object_property_add_child (OBJECT (x86ms),"cpu[*]" ,OBJECT (cpu));if (!object_property_set_uint (cpu,"apic-id" , apic_id, errp)) { goto out; }
Signature · 1 line
2.34.1
RFC PATCH v2 2/2 hw/i386/sgx: Attach SGX-EPC objects to machine
In reply to Philippe Mathieu-Daudé viaPreviously SGX-EPC objects were exposed in the QOM tree at a path
/machine/unattached/device[nn]
where the 'nn' varies depending on what devices were already created.
With this change the SGX-EPC objects are now at
/machine/sgx-epc[nn]
where the 'nn' of the first SGX-EPC object is always zero.
--- hw/i386/sgx.c | 2 ++ 1 file changed, 2 insertions(+)
hw/i386/sgx.c +2 -0
@@ -297,6 +297,8 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)for (list = x86ms->sgx_epc_list; list; list = list->next) { obj =object_new ("sgx-epc" ); +object_property_add_child (OBJECT (pcms),"sgx-epc" ,OBJECT (obj)); +/* set the memdev link with memory backend */ object_property_parse (obj,SGX_EPC_MEMDEV_PROP , list->value->memdev, &error_fatal);
Signature · 1 line
2.34.1