Skip to contentSkip to conversation

Fix vga_interface_type for command '-device VGA'

PATCH Superseded Mark Wu 3 participants 10 messages Mar 7, 2014 – Mar 10, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mark Wu

author
#0 lore raw

PATCH v2 1/2 Fix vga_interface_type for command '-device VGA'

Some machine (like ppc) initialization code determines if it has grahicis according to vga_interface_type. In the original code, vga_interface_type is evaluated to VGA_NONE even if a vga is added by '-device VGA'. It causes the machine not aware of the graphics device configured. This patch adds a new vga device type to indicate that it has a vga device, which will be initliazed in qom devices initialization.

---
 include/sysemu/sysemu.h |  2 +-
 vl.c                    | 42 ++++++++++++++++++++++--------------------
 2 files changed, 23 insertions(+), 21 deletions(-)
include/sysemu/sysemu.h +1 -1
index b90df9a..c01304d 100644
@@ -104,7 +104,7 @@ extern int autostart;
 
 typedef enum {
     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
-    VGA_TCX, VGA_CG3,
+    VGA_TCX, VGA_CG3, VGA_DEVICE
 } VGAInterfaceType;
 
 extern int vga_interface_type;
vl.c +22 -20

92 lines not on this page · raw message

Signature · 1 line
1.8.4.2
author
#1 lore raw

PATCH v2 2/2 Fix return value of vga initlization on ppc

Before spapr_vga_init will returned false if the vga is specified by the command '-device VGA' because vga_interface_type was evaluated to VGA_NONE. With the change in previous patch of this series, spapr_vga_init should return true if it's told that the vga will be initialized in flow of the generic devices initialization.

This patch also makes two cleanups:
1. skip initialization for VGA_NONE
2. remove the useless 'break'

---
 hw/ppc/spapr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +3 -1
index 93d02c1..4d0ac56 100644
@@ -765,13 +765,15 @@ static int spapr_vga_init(PCIBus *pci_bus)
 {
     switch (vga_interface_type) {
     case VGA_NONE:
+        return false;
+    case VGA_DEVICE:
+        return true;
     case VGA_STD:
         return pci_vga_init(pci_bus) != NULL;
     default:
         fprintf(stderr, "This vga model is not supported,"
                 "currently it only supports -vga std\n");
         exit(0);
-        break;
     }
 }
 
Signature · 1 line
1.8.4.2
#2 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Il 07/03/2014 10:37, Mark Wu ha scritto:

Quoted 9 lines

Before spapr_vga_init will returned false if the vga is specified by the command '-device VGA' because vga_interface_type was evaluated to VGA_NONE. With the change in previous patch of this series, spapr_vga_init should return true if it's told that the vga will be initialized in flow of the generic devices initialization.

This patch also makes two cleanups:
1. skip initialization for VGA_NONE
2. remove the useless 'break'

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

Perhaps this in vl.c:

bool usb_enabled(bool default_usb)

{
    return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb);
}

should be

bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
!no_defaults && default_usb);
}

?

Thanks,

Paolo

Quoted 27 lines
---
 hw/ppc/spapr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +3 -1
index 93d02c1..4d0ac56 100644
@@ -765,13 +765,15 @@ static int spapr_vga_init(PCIBus *pci_bus)
 {
     switch (vga_interface_type) {
     case VGA_NONE:
+        return false;
+    case VGA_DEVICE:
+        return true;
     case VGA_STD:
         return pci_vga_init(pci_bus) != NULL;
     default:
         fprintf(stderr, "This vga model is not supported,"
                 "currently it only supports -vga std\n");
         exit(0);
-        break;
     }
 }
 
#3 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Quoted 7 lines · Paolo Bonzini

Il 07/03/2014 10:37, Mark Wu ha scritto:

Quoted 6 lines

Before spapr_vga_init will returned false if the vga is specified by the command '-device VGA' because vga_interface_type was evaluated to VGA_NONE. With the change in previous patch of this series, spapr_vga_init should return true if it's told that the vga will be initialized in flow of the generic devices initialization.

Quoted 6 lines
Quoted 3 lines

This patch also makes two cleanups:
1. skip initialization for VGA_NONE
2. remove the useless 'break'

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

I suspect what was meant by "the machine not aware of the graphics device"
is that the guest won't work with VGA and without keyboard (default
console will be vga + keyboard and not serial) which is USB and this is why the patch is trying to add USB.

Quoted 51 lines

Perhaps this in vl.c:

bool usb_enabled(bool default_usb)

{
    return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb);
}

should be

bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
!no_defaults && default_usb);
}

?

Thanks,

Paolo

Quoted 27 lines
---
 hw/ppc/spapr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +3 -1
index 93d02c1..4d0ac56 100644
@@ -765,13 +765,15 @@ static int spapr_vga_init(PCIBus *pci_bus)
 {
     switch (vga_interface_type) {
     case VGA_NONE:
+        return false;
+    case VGA_DEVICE:
+        return true;
     case VGA_STD:
         return pci_vga_init(pci_bus) != NULL;
     default:
         fprintf(stderr, "This vga model is not supported,"
                 "currently it only supports -vga std\n");
         exit(0);
-        break;
     }
 }
 
Signature · 1 line
Alexey
#4 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Il 08/03/2014 14:26, Alexey Kardashevskiy ha scritto:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

I suspect what was meant by "the machine not aware of the graphics device"
is that the guest won't work with VGA and without keyboard (default
console will be vga + keyboard and not serial) which is USB and this is why the patch is trying to add USB.

But with -nodefaults QEMU should never be adding USB.

Paolo

#5 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Quoted 10 lines · Paolo Bonzini

Il 08/03/2014 14:26, Alexey Kardashevskiy ha scritto:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

I suspect what was meant by "the machine not aware of the graphics device"
is that the guest won't work with VGA and without keyboard (default
console will be vga + keyboard and not serial) which is USB and this is why the patch is trying to add USB.

But with -nodefaults QEMU should never be adding USB.

As I was told in this list before, even with -nodefaults, QEMU should not create a machine which is known for not working or not being supported. Having VGA and not having any input device is kind of such a config, no?

Signature · 1 line
Alexey
#6 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Il 10/03/2014 13:23, Alexey Kardashevskiy ha scritto:

Quoted 10 lines · Paolo Bonzini
Quoted 9 lines

Il 08/03/2014 14:26, Alexey Kardashevskiy ha scritto:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

I suspect what was meant by "the machine not aware of the graphics device"
is that the guest won't work with VGA and without keyboard (default
console will be vga + keyboard and not serial) which is USB and this is why the patch is trying to add USB.

Quoted 5 lines
Quoted 1 line

But with -nodefaults QEMU should never be adding USB.

As I was told in this list before, even with -nodefaults, QEMU should not create a machine which is known for not working or not being supported. Having VGA and not having any input device is kind of such a config, no?

-nodefaults is exactly the opposite of that: no magic whatsoever. No VGA, no serial, nothing.

And especially, with -nodefaults adding a VGA means just that: adding a VGA.

Paolo

#7 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Quoted 12 lines · Paolo Bonzini

Il 10/03/2014 13:23, Alexey Kardashevskiy ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 10 lines

Il 08/03/2014 14:26, Alexey Kardashevskiy ha scritto:

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

I suspect what was meant by "the machine not aware of the graphics device"
is that the guest won't work with VGA and without keyboard (default
console will be vga + keyboard and not serial) which is USB and this is why
the patch is trying to add USB.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

But with -nodefaults QEMU should never be adding USB.

As I was told in this list before, even with -nodefaults, QEMU should not create a machine which is known for not working or not being supported. Having VGA and not having any input device is kind of such a config, no?

-nodefaults is exactly the opposite of that: no magic whatsoever. No VGA, no serial, nothing.

qemu-system-x86_64 -enable-kvm -nographic -nodefaults -monitor stdio

"info qtree" shows a whole bunch of devices like "i440FX-pcihost", "isa-fdc", "piix3-ide", "vmmouse", "vmport" (what are the last two?). I was told here that 8042 is to emulate A20, ok, but others - I do not really understand. "q35" is bit different than "pc" but not smaller. The point was made that there is no point in emulating a machine which does not exist in the real world. Has it changed recently?

Quoted 1 line

And especially, with -nodefaults adding a VGA means just that: adding a VGA.

Usual issue - libvirt expects keyboard with VGA and x86 provides this as it always has keyboard. PPC does not have such default.

Signature · 1 line
Alexey
#8 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/2] Fix return value of vga initlization on ppc

Il 10/03/2014 13:45, Alexey Kardashevskiy ha scritto:

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

As I was told in this list before, even with -nodefaults, QEMU should not create a machine which is known for not working or not being supported. Having VGA and not having any input device is kind of such a config, no?

-nodefaults is exactly the opposite of that: no magic whatsoever. No VGA, no serial, nothing.

Quoted 8 lines

qemu-system-x86_64 -enable-kvm -nographic -nodefaults -monitor stdio

"info qtree" shows a whole bunch of devices like "i440FX-pcihost", "isa-fdc", "piix3-ide", "vmmouse", "vmport" (what are the last two?). I was told here that 8042 is to emulate A20, ok, but others - I do not really understand. "q35" is bit different than "pc" but not smaller. The point was made that there is no point in emulating a machine which does not exist in the real world. Has it changed recently?

-nodefaults should be the bare minimum that is necessary for the VM firmware to work. On x86, isa-fdc/vmmouse/vmport are there only for backwards compatibility reasons.

Quoted 4 lines
Quoted 1 line

And especially, with -nodefaults adding a VGA means just that: adding a VGA.

Usual issue - libvirt expects keyboard with VGA and x86 provides this as it always has keyboard. PPC does not have such default.

I don't think it's even a libvirt bug. Then in the libvirt XML you should have:

<devices>

     <input type='keyboard' bus='usb'/>

</devices>

explicitly. If libvirt uses -nodefaults, it's up to virt-manager or oVirt or whatever management layer you're using to add all the necessary controllers (USB in this case) and devices (keyboard) for the machine to be usable.

Paolo

author
#9 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] Fix return value of vga initlization on ppc

In reply to Paolo Bonzini
Quoted 20 lines · Paolo Bonzini

Il 07/03/2014 10:37, Mark Wu ha scritto:

Quoted 9 lines

Before spapr_vga_init will returned false if the vga is specified by the command '-device VGA' because vga_interface_type was evaluated to VGA_NONE. With the change in previous patch of this series, spapr_vga_init should return true if it's told that the vga will be initialized in flow of the generic devices initialization.

This patch also makes two cleanups:
1. skip initialization for VGA_NONE
2. remove the useless 'break'

I think that after this patch, "-nodefaults -device VGA" will get a USB controller that it didn't get before.

Perhaps this in vl.c:

bool usb_enabled(bool default_usb)

{
     return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb);
}
Quoted 7 lines

should be

bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
!no_defaults && default_usb);
}

Yes, it changes the semantics of 'nodefaults'. I will fix it in v3 and let the management app add usb controller.

Quoted 33 lines

?

Thanks,

Paolo

Quoted 27 lines
---
  hw/ppc/spapr.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +3 -1
index 93d02c1..4d0ac56 100644
@@ -765,13 +765,15 @@ static int spapr_vga_init(PCIBus *pci_bus)
  {
      switch (vga_interface_type) {
      case VGA_NONE:
+        return false;
+    case VGA_DEVICE:
+        return true;
      case VGA_STD:
          return pci_vga_init(pci_bus) != NULL;
      default:
          fprintf(stderr, "This vga model is not supported,"
                  "currently it only supports -vga std\n");
          exit(0);
-        break;
      }
  }