Skip to contentSkip to conversation

xen: Fix xenpv machine initialisation

PATCH Superseded Anthony PERARD 2 participants 4 messages Nov 7, 2016 – Nov 8, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Fix xenpv machine initialisation

When using QEMU for Xen PV guest, QEMU abort with:
xen-common.c:118:xen_init: Object 0x7f2b8325dcb0 is not an instance of type generic-pc-machine

This is because the machine 'xenpv' also use accel=xen.

This fix 021746c131cdfeab9d82ff918795a9f18d20d7ae

---
CC: Wei Liu <[email protected]>
CC: Eduardo Habkost <[email protected]>

---
 xen-common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
xen-common.c +5 -3
index bacf962..22683b0 100644
@@ -115,10 +115,12 @@ static void xen_change_state_handler(void *opaque, int running,
 
 static int xen_init(MachineState *ms)
 {
-    PCMachineState *pcms = PC_MACHINE(ms);
+    if (object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE)) {
+        PCMachineState *pcms = PC_MACHINE(ms);
 
-    /* Disable ACPI build because Xen handles it */
-    pcms->acpi_build_enabled = false;
+        /* Disable ACPI build because Xen handles it */
+        pcms->acpi_build_enabled = false;
+    }
 
     xen_xc = xc_interface_open(0, 0, 0);
     if (xen_xc == NULL) {
Signature · 1 line
Anthony PERARD
#1 lore raw
Quoted 8 lines · Anthony PERARD

When using QEMU for Xen PV guest, QEMU abort with:
xen-common.c:118:xen_init: Object 0x7f2b8325dcb0 is not an instance of type generic-pc-machine

This is because the machine 'xenpv' also use accel=xen.

This fix 021746c131cdfeab9d82ff918795a9f18d20d7ae

What about moving the acpi_build_enabled initialization to xen_hvm_init?

Quoted 29 lines
CC Wei Liu <[email protected]>
CC Eduardo Habkost <[email protected]>
---
 xen-common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
xen-common.c +5 -3
index bacf962..22683b0 100644
@@ -115,10 +115,12 @@ static void xen_change_state_handler(void *opaque, int running,
 
 static int xen_init(MachineState *ms)
 {
-    PCMachineState *pcms = PC_MACHINE(ms);
+    if (object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE)) {
+        PCMachineState *pcms = PC_MACHINE(ms);
 
-    /* Disable ACPI build because Xen handles it */
-    pcms->acpi_build_enabled = false;
+        /* Disable ACPI build because Xen handles it */
+        pcms->acpi_build_enabled = false;
+    }
 
     xen_xc = xc_interface_open(0, 0, 0);
     if (xen_xc == NULL) {
Signature · 1 line
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 4 lines · Stefano Stabellini
Quoted 3 lines · Anthony PERARD

When using QEMU for Xen PV guest, QEMU abort with:
xen-common.c:118:xen_init: Object 0x7f2b8325dcb0 is not an instance of type generic-pc-machine

Quoted 8 lines
Quoted 5 lines

This is because the machine 'xenpv' also use accel=xen.

This fix 021746c131cdfeab9d82ff918795a9f18d20d7ae

What about moving the acpi_build_enabled initialization to xen_hvm_init?

Yes, that would be better, I'll do that.

Thanks.

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
In reply to Stefano Stabellini
Quoted 4 lines · Stefano Stabellini
Quoted 3 lines · Anthony PERARD

When using QEMU for Xen PV guest, QEMU abort with:
xen-common.c:118:xen_init: Object 0x7f2b8325dcb0 is not an instance of type generic-pc-machine

Quoted 8 lines
Quoted 5 lines

This is because the machine 'xenpv' also use accel=xen.

This fix 021746c131cdfeab9d82ff918795a9f18d20d7ae

What about moving the acpi_build_enabled initialization to xen_hvm_init?

Yes, that would be better, I'll do that.

Thanks.

Signature · 1 line
Anthony PERARD