update bochs vbe interface
PATCH 1/1 update bochs vbe interface
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.
--- hw/vga.c | 3 ++- hw/vga_int.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
hw/vga.c +2 -1
@@ -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 ;
hw/vga_int.h +3 -1
@@ -47,13 +47,15 @@#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 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
Signature · 1 line
1.6.6.1
Quoted 6 lines · Gerd Hoffmann
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.
Signed-off-by Gerd Hoffmann <[email protected]>
It breaks migration.
vga.c:525: if (s->vbe_index <= VBE_DISPI_INDEX_NB) {
vga.c:564: if (s->vbe_index <= VBE_DISPI_INDEX_NB) {
vga.c:2218: VMSTATE_UINT16_ARRAY(vbe_regs, VGACommonState, VBE_DISPI_INDEX_NB),
vga_int.h:50:#define VBE_DISPI_INDEX_NB 0xa
vga_int.h:71: uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; \
2218 is the interesting line. Can we freeze this patch until the subsections stuff is done?
I hope to sent a proposal Friday? And can use this as guinea pig?
Later, Juan.
Quoted 40 lines
--- hw/vga.c | 3 ++- hw/vga_int.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)hw/vga.c +2
-1@@ -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 ;hw/vga_int.h +3
-1@@ -47,13 +47,15 @@#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 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
Quoted 6 lines · Juan Quintela
Quoted 5 lines · Gerd Hoffmann
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.
Quoted 8 lines
Quoted 1 line
Signed-off-by Gerd Hoffmann<[email protected]>It breaks migration.
vga.c:2218:
VMSTATE_UINT16_ARRAY(vbe_regs, VGACommonState, VBE_DISPI_INDEX_NB),2218 is the interesting line. Can we freeze this patch until the subsections stuff is done?
Yea, I see. Well, the new register doesn't carry any state, it is read-only information for the guest. So the easy way out is to simply not save it as we don't have to.
cheers,
Gerd
Quoted 11 lines · Gerd Hoffmann
Quoted 10 lines · Juan Quintela
Quoted 6 lines · Gerd Hoffmann
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.
Signed-off-by Gerd Hoffmann<[email protected]>It breaks migration.
Quoted 8 lines
Quoted 4 lines
vga.c:2218:
VMSTATE_UINT16_ARRAY(vbe_regs, VGACommonState, VBE_DISPI_INDEX_NB),2218 is the interesting line. Can we freeze this patch until the subsections stuff is done?
Yea, I see. Well, the new register doesn't carry any state, it is read-only information for the guest. So the easy way out is to simply not save it as we don't have to.
Thinking a bit more about it.
Humm, I think it means. Can you migrate from a "new" vga to an old one, and maintain it working?
- 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);
After migration, vbe_regs[VBE_DISPI_INDEX_ID] would have the value VBE_DISPI_ID5, but vbe_regs[VBE_DISPI_INDEX_VIDEO_MEMORY_64K] will have any random value, no?
Quoted 3 lines
cheers,
Gerd
Quoted 2 lines · Juan Quintela
Humm, I think it means. Can you migrate from a "new" vga to an old one, and maintain it working?
Depends on the vgabios version.
vgabios 0.6c will not support vesa gfx modes on older qemu, no matter whenever you started fresh or migrated to it.
Quoted 7 lines
hw/vga.c +2
-1- 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 );After migration, vbe_regs[VBE_DISPI_INDEX_ID] would have the value
VBE_DISPI_ID5, but vbe_regs[VBE_DISPI_INDEX_VIDEO_MEMORY_64K] will have any random value, no?
vgabios uses both once at init time. resetting vga will reset the vbe regs too. So when migrating from new to old qemu: Before reset vgabios will have the video memory size saved somewhere. After reset ID will reset to ID0, and in case you are running vgabios 0.6c vesa gfx modes will stop working.
cheers,
Gerd
Quoted 13 lines · Gerd Hoffmann
Quoted 2 lines · Juan Quintela
Humm, I think it means. Can you migrate from a "new" vga to an old one, and maintain it working?
Depends on the vgabios version.
vgabios 0.6c will not support vesa gfx modes on older qemu, no matter whenever you started fresh or migrated to it.
Quoted 3 lines
hw/vga.c +2
-1- 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 );
Quoted 5 lines
Quoted 3 lines
After migration, vbe_regs[VBE_DISPI_INDEX_ID] would have the value
VBE_DISPI_ID5, but vbe_regs[VBE_DISPI_INDEX_VIDEO_MEMORY_64K] will have any random value, no?vgabios uses both once at init time.
Then our big problem is migration between read of the 1st register and of the 2nd register, no?
Furthermore, older vga bios, seing VBE_DISPI_ID5, what are they going to do?
Quoted 2 lines
resetting vga will reset the vbe
regs too.
Yes, but I guess you agree that forcing a reset in the middle of a live migration makes the whole point of migration moot :-)
Quoted 4 lines
So when migrating from new to old qemu: Before reset
vgabios will have the video memory size saved somewhere. After reset ID will reset to ID0, and in case you are running vgabios 0.6c vesa gfx modes will stop working.
I see this part, but I still think that we have a window where we can be in very bad shape, no? I guess that we don't support anything different that vgabios, so ....
Quoted 2 lines
cheers,
Gerd
Hi,
Quoted 2 lines
Then our big problem is migration between read of the 1st register and of the 2nd register, no?
"big"? The window is quite small, and I think we have a bunch of simliar issues elsewhere in qemu. They are hardly avoidable for new -> old migration when adding new features to emulated devices.
Well, maybe sections can fix it, but probably only in case the old qemu is new enougth that it can handle sections too.
Quoted 2 lines
Furthermore, older vga bios, seing
VBE_DISPI_ID5, what are they going to do?
Work as they did before ;)
Quoted 8 lines
Quoted 4 lines
So when migrating from new to old qemu: Before reset
vgabios will have the video memory size saved somewhere. After reset ID will reset to ID0, and in case you are running vgabios 0.6c vesa gfx modes will stop working.I see this part, but I still think that we have a window where we can be in very bad shape, no? I guess that we don't support anything different that vgabios, so ....
See above. Worst case is that vesa graphics modes stop working, even if you hit the race window (vgabios will think you have 0 MB video ram then and refuse all gfx modes).
cheers,
Gerd
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
Then our big problem is migration between read of the 1st register and of the 2nd register, no?
"big"?
That is why I asked. I have no clue about how many times that register is read.
Quoted 4 lines
The window is quite small, and I think we have a bunch of simliar issues elsewhere in qemu. They are hardly avoidable for new ->
old migration when adding new features to emulated devices.
yeap, but normally we don't allow migration from new to old for this very reason. Not allowing from new to old fixes this issue. Sections can't help here :(
Quoted 2 lines
Well, maybe sections can fix it, but probably only in case the old qemu is new enougth that it can handle sections too.
sections don't help here :(
We are changing how hardware works under the BIOS code, we told 1st that we have a feature and when BIOS go to use it, feature has disappeared.
Quoted 4 lines
Quoted 2 lines
Furthermore, older vga bios, seing
VBE_DISPI_ID5, what are they going to do?Work as they did before ;)
/me just like BIOS :)
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
So when migrating from new to old qemu: Before reset
vgabios will have the video memory size saved somewhere. After reset ID will reset to ID0, and in case you are running vgabios 0.6c vesa gfx modes will stop working.
Quoted 7 lines
Quoted 3 lines
I see this part, but I still think that we have a window where we can be in very bad shape, no? I guess that we don't support anything different that vgabios, so ....
See above. Worst case is that vesa graphics modes stop working, even if you hit the race window (vgabios will think you have 0 MB video ram then and refuse all gfx modes).
If it is only read during startup, once, I think that geting 0 size is ok. Extra bonus for modifying vgabios to handle this case nicely?
Should be a case of
if (val == 0) {
do like old bios
}
no?
Later, Juan.
Quoted 10 lines · Juan Quintela
Quoted 6 lines · Gerd Hoffmann
Hi,Quoted 2 lines
Then our big problem is migration between read of the 1st register and of the 2nd register, no?
"big"?
That is why I asked. I have no clue about how many times that register is read.
Once at boot.
Quoted 2 lines
If it is only read during startup, once, I think that geting 0 size is ok. Extra bonus for modifying vgabios to handle this case nicely?
I doubt it is worth the trouble. Also note that the current qemu vgabios doesn't care at all. It matters once we actually update vgabios to 0.6c.
cheers,
Gerd