Patchwork vgabios update: handle compatibility with older qemu versions

login
register
mail settings
Submitter Gerd Hoffmann
Date Nov. 17, 2010, 11:06 a.m.
Message ID <1289992004-6291-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/71545/
State New
Headers show

Comments

Gerd Hoffmann - Nov. 17, 2010, 11:06 a.m.
As pointed out by avi the vgabios update is guest-visible and thus has
migration implications.

One change is that the vga has a valid pci rom bar now.  We already have
a pci bus property to enable/disable the rom bar and we'll load the bios
via fw_cfg as fallback for the no-rom-bar case.  So we just have to add
compat properties to handle this case.

A second change is that the magic bochs lfb @ 0xe0000000 is gone.  When
live-migrating a guest from a older qemu version it might be using the
lfb though, so we have to keep it for the old machine types.  The patch
enables the bochs lfb in case we don't have the pci rom bar enabled
(i.e. we are in 0.13+older compat mode).

This patch depends on these patches which add (and use) the pc-0.13
machine type:
  http://patchwork.ozlabs.org/patch/70797/
  http://patchwork.ozlabs.org/patch/70798/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: avi@redhat.com
---
 hw/pc_piix.c    |   16 ++++++++++++++++
 hw/vga-pci.c    |    5 +++++
 hw/vmware_vga.c |    5 +++++
 3 files changed, 26 insertions(+), 0 deletions(-)
Anthony Liguori - Nov. 21, 2010, 3:18 p.m.
On 11/17/2010 05:06 AM, Gerd Hoffmann wrote:
> As pointed out by avi the vgabios update is guest-visible and thus has
> migration implications.
>
> One change is that the vga has a valid pci rom bar now.  We already have
> a pci bus property to enable/disable the rom bar and we'll load the bios
> via fw_cfg as fallback for the no-rom-bar case.  So we just have to add
> compat properties to handle this case.
>
> A second change is that the magic bochs lfb @ 0xe0000000 is gone.  When
> live-migrating a guest from a older qemu version it might be using the
> lfb though, so we have to keep it for the old machine types.  The patch
> enables the bochs lfb in case we don't have the pci rom bar enabled
> (i.e. we are in 0.13+older compat mode).
>
> This patch depends on these patches which add (and use) the pc-0.13
> machine type:
>    http://patchwork.ozlabs.org/patch/70797/
>    http://patchwork.ozlabs.org/patch/70798/
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

> Cc: avi@redhat.com
> ---
>   hw/pc_piix.c    |   16 ++++++++++++++++
>   hw/vga-pci.c    |    5 +++++
>   hw/vmware_vga.c |    5 +++++
>   3 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pc_piix.c b/hw/pc_piix.c
> index e9752db..a85d58e 100644
> --- a/hw/pc_piix.c
> +++ b/hw/pc_piix.c
> @@ -231,6 +231,14 @@ static QEMUMachine pc_machine_v0_13 = {
>               .driver   = "virtio-9p-pci",
>               .property = "vectors",
>               .value    = stringify(0),
> +        },{
> +            .driver   = "VGA",
> +            .property = "rombar",
> +            .value    = stringify(0),
> +        },{
> +            .driver   = "vmware-svga",
> +            .property = "rombar",
> +            .value    = stringify(0),
>           },
>           { /* end of list */ }
>       },
> @@ -250,6 +258,14 @@ static QEMUMachine pc_machine_v0_12 = {
>               .driver   = "virtio-serial-pci",
>               .property = "vectors",
>               .value    = stringify(0),
> +        },{
> +            .driver   = "VGA",
> +            .property = "rombar",
> +            .value    = stringify(0),
> +        },{
> +            .driver   = "vmware-svga",
> +            .property = "rombar",
> +            .value    = stringify(0),
>           },
>           { /* end of list */ }
>       }
> diff --git a/hw/vga-pci.c b/hw/vga-pci.c
> index 28b174b..4931eee 100644
> --- a/hw/vga-pci.c
> +++ b/hw/vga-pci.c
> @@ -96,6 +96,11 @@ static int pci_vga_initfn(PCIDevice *dev)
>        pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
>                         PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map);
>
> +     if (!dev->rom_bar) {
> +         /* compatibility with pc-0.13 and older */
> +         vga_init_vbe(s);
> +     }
> +
>        return 0;
>   }
>
> diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
> index e96b7db..e852620 100644
> --- a/hw/vmware_vga.c
> +++ b/hw/vmware_vga.c
> @@ -1305,6 +1305,11 @@ static int pci_vmsvga_initfn(PCIDevice *dev)
>
>       vmsvga_init(&s->chip, VGA_RAM_SIZE);
>
> +    if (!dev->rom_bar) {
> +        /* compatibility with pc-0.13 and older */
> +        vga_init_vbe(&s->chip.vga);
> +    }
> +
>       return 0;
>   }
>
>

Patch

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index e9752db..a85d58e 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -231,6 +231,14 @@  static QEMUMachine pc_machine_v0_13 = {
             .driver   = "virtio-9p-pci",
             .property = "vectors",
             .value    = stringify(0),
+        },{
+            .driver   = "VGA",
+            .property = "rombar",
+            .value    = stringify(0),
+        },{
+            .driver   = "vmware-svga",
+            .property = "rombar",
+            .value    = stringify(0),
         },
         { /* end of list */ }
     },
@@ -250,6 +258,14 @@  static QEMUMachine pc_machine_v0_12 = {
             .driver   = "virtio-serial-pci",
             .property = "vectors",
             .value    = stringify(0),
+        },{
+            .driver   = "VGA",
+            .property = "rombar",
+            .value    = stringify(0),
+        },{
+            .driver   = "vmware-svga",
+            .property = "rombar",
+            .value    = stringify(0),
         },
         { /* end of list */ }
     }
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 28b174b..4931eee 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -96,6 +96,11 @@  static int pci_vga_initfn(PCIDevice *dev)
      pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
                       PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map);
 
+     if (!dev->rom_bar) {
+         /* compatibility with pc-0.13 and older */
+         vga_init_vbe(s);
+     }
+
      return 0;
 }
 
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index e96b7db..e852620 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1305,6 +1305,11 @@  static int pci_vmsvga_initfn(PCIDevice *dev)
 
     vmsvga_init(&s->chip, VGA_RAM_SIZE);
 
+    if (!dev->rom_bar) {
+        /* compatibility with pc-0.13 and older */
+        vga_init_vbe(&s->chip.vga);
+    }
+
     return 0;
 }