Patchwork [v2] update bochs vbe interface

login
register
mail settings
Submitter Gerd Hoffmann
Date March 24, 2010, 7:50 p.m.
Message ID <1269460245-31941-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/48467/
State New
Headers show

Comments

Gerd Hoffmann - March 24, 2010, 7:50 p.m.
The bochs vbe interface got a new register a while back, which specifies
the linear framebuffer size in 64k units.  This patch adds support for
the new register to qemu.  With this patch applied vgabios 0.6c works
with qemu.

[ v2:  Don't savevm the new register.  Doing so breaks migration,
       and as it carries read-only information for the guest there
       is no need to save it. ]
---
 hw/vga.c     |    5 +++--
 hw/vga_int.h |    6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
Juan Quintela - March 24, 2010, 10:18 p.m.
Gerd Hoffmann <kraxel@redhat.com> wrote:
> The bochs vbe interface got a new register a while back, which specifies
> the linear framebuffer size in 64k units.  This patch adds support for
> the new register to qemu.  With this patch applied vgabios 0.6c works
> with qemu.
>
> [ v2:  Don't savevm the new register.  Doing so breaks migration,
>        and as it carries read-only information for the guest there
>        is no need to save it. ]


It don't compile (as expected).  VMSTATE_UINT16_ARRAY() checks that you
sent the whole array.


/mnt/kvm/qemu/qemu-negotiate/hw/vga.c:2219: error: invalid operands to binary - (have ‘uint16_t (*)[10]’ and ‘uint16_t (*)[11]’)
make[1]: *** [vga.o] Error 1
make[1]: *** Waiting for unfinished jobs....
^Cmake[1]: *** [translate.o] Interrupt
make[1]: *** [op_helper.o] Interrupt
make: *** [subdir-x86_64-softmmu] Interrupt

> ---
>  hw/vga.c     |    5 +++--
>  hw/vga_int.h |    6 +++++-
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/hw/vga.c b/hw/vga.c
> index 6a1a059..f9e07cf 100644
> --- a/hw/vga.c
> +++ b/hw/vga.c
> @@ -1955,7 +1955,8 @@ void vga_common_reset(VGACommonState *s)
>  #ifdef CONFIG_BOCHS_VBE
>      s->vbe_index = 0;
>      memset(s->vbe_regs, '\0', sizeof(s->vbe_regs));
> -    s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0;
> +    s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID5;

Now, to show my ignorance, what does this change means?

I can't understand it looking at the whole file (but I don't understand
vga.c too well anyways).

Later, Juan.
Gerd Hoffmann - March 25, 2010, 8:32 a.m.
> /mnt/kvm/qemu/qemu-negotiate/hw/vga.c:2219: error: invalid operands to binary - (have ‘uint16_t (*)[10]’ and ‘uint16_t (*)[11]’)

Huh?  I was pretty sure I've compiled it, but obviously I didn't ...

/me goes look for a brown paperbag.

cheers,
   Gerd

Patch

diff --git a/hw/vga.c b/hw/vga.c
index 6a1a059..f9e07cf 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1955,7 +1955,8 @@  void vga_common_reset(VGACommonState *s)
 #ifdef CONFIG_BOCHS_VBE
     s->vbe_index = 0;
     memset(s->vbe_regs, '\0', sizeof(s->vbe_regs));
-    s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0;
+    s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID5;
+    s->vbe_regs[VBE_DISPI_INDEX_VIDEO_MEMORY_64K] = s->vram_size / (64 * 1024);
     s->vbe_start_addr = 0;
     s->vbe_line_offset = 0;
     s->vbe_bank_mask = (s->vram_size >> 16) - 1;
@@ -2215,7 +2216,7 @@  const VMStateDescription vmstate_vga_common = {
         VMSTATE_UINT8_EQUAL(is_vbe_vmstate, VGACommonState),
 #ifdef CONFIG_BOCHS_VBE
         VMSTATE_UINT16(vbe_index, VGACommonState),
-        VMSTATE_UINT16_ARRAY(vbe_regs, VGACommonState, VBE_DISPI_INDEX_NB),
+        VMSTATE_UINT16_ARRAY(vbe_regs, VGACommonState, VBE_DISPI_INDEX_NB_VMSTATE),
         VMSTATE_UINT32(vbe_start_addr, VGACommonState),
         VMSTATE_UINT32(vbe_line_offset, VGACommonState),
         VMSTATE_UINT32(vbe_bank_mask, VGACommonState),
diff --git a/hw/vga_int.h b/hw/vga_int.h
index 23a42ef..c3c5e21 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -47,13 +47,17 @@ 
 #define VBE_DISPI_INDEX_VIRT_HEIGHT     0x7
 #define VBE_DISPI_INDEX_X_OFFSET        0x8
 #define VBE_DISPI_INDEX_Y_OFFSET        0x9
-#define VBE_DISPI_INDEX_NB              0xa
+#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
+
+#define VBE_DISPI_INDEX_NB_VMSTATE      0xa
+#define VBE_DISPI_INDEX_NB              0xb
 
 #define VBE_DISPI_ID0                   0xB0C0
 #define VBE_DISPI_ID1                   0xB0C1
 #define VBE_DISPI_ID2                   0xB0C2
 #define VBE_DISPI_ID3                   0xB0C3
 #define VBE_DISPI_ID4                   0xB0C4
+#define VBE_DISPI_ID5                   0xB0C5
 
 #define VBE_DISPI_DISABLED              0x00
 #define VBE_DISPI_ENABLED               0x01