diff mbox

xen: Fix xenpv machine initialisation

Message ID 20161107150504.6567-1-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anthony PERARD Nov. 7, 2016, 3:05 p.m. UTC
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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
CC: Wei Liu <wei.liu2@citrix.com>
CC: Eduardo Habkost <ehabkost@redhat.com>
---
 xen-common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Nov. 7, 2016, 8:53 p.m. UTC | #1
On Mon, 7 Nov 2016, Anthony PERARD wrote:
> 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
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

What about moving the acpi_build_enabled initialization to
xen_hvm_init?


> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  xen-common.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/xen-common.c b/xen-common.c
> index bacf962..22683b0 100644
> --- a/xen-common.c
> +++ b/xen-common.c
> @@ -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) {
> -- 
> Anthony PERARD
>
Anthony PERARD Nov. 8, 2016, 11:32 a.m. UTC | #2
On Mon, Nov 07, 2016 at 12:53:29PM -0800, Stefano Stabellini wrote:
> On Mon, 7 Nov 2016, Anthony PERARD wrote:
> > 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
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> What about moving the acpi_build_enabled initialization to
> xen_hvm_init?

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

Thanks.
diff mbox

Patch

diff --git a/xen-common.c b/xen-common.c
index bacf962..22683b0 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -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) {