From 08251d35eafe5bafff42d226ccd56277014b16e9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 21 Apr 2009 15:45:18 +0100 Subject: [PATCH] Fix hvm guest cirrus_vga hvm s3 resume failure This patch is for fixing hvm guest cirrus_vga hvm s3 resume failure. We found latest Qemu (after Mar 3.10) will cause HVM guest vga fails to resume back from S3. It's because vga_bios_init is not only needed during init, but also needed after cirrus_vga reset (hvm s3 will do qemu_reset). Also, we found the outdated s->vram_ptr reset will cause s3 resume screen black, so we remove it. (win2000 boot up does not need it now) We verified the fix with the latest cs/qemu. [ Patch modified slightly by Ian Jackson to reduce code motion. ] Signed-off-by: Liping Ke Signed-off-by: Ke Yu Signed-off-by: Ian Jackson --- hw/cirrus_vga.c | 6 ------ hw/vga.c | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index d95472e29..8da0c60cb 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -3192,12 +3192,6 @@ static void cirrus_reset(void *opaque) s->sr[0x15] = 0x03; /* memory size, 3=2MB, 4=4MB */ } s->cr[0x27] = s->device_id; - - if (s->vram_ptr) - /* Win2K seems to assume that the pattern buffer is at 0xff - initially ! */ - memset(s->vram_ptr, 0xff, s->real_vram_size); - s->cirrus_hidden_dac_lockindex = 5; s->cirrus_hidden_dac_data = 0; } diff --git a/hw/vga.c b/hw/vga.c index 7b8572af9..90bd544cf 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -158,6 +158,7 @@ static uint32_t expand4[256]; static uint16_t expand2[256]; static uint8_t expand4to8[16]; +static void vga_bios_init(VGAState *s); static void vga_screen_dump(void *opaque, const char *filename); static void vga_dumb_update_retrace_info(VGAState *s) @@ -1957,6 +1958,7 @@ void vga_reset(void *opaque) memset(&s->retrace_info, 0, sizeof (s->retrace_info)); break; } + vga_bios_init(s); } #define TEXTMODE_X(x) ((x) % width) @@ -2584,7 +2586,6 @@ void vga_common_init(VGAState *s, uint8_t *vga_ram_base, s->vram_gmfn = VRAM_RESERVED_ADDRESS; } - vga_bios_init(s); switch (vga_retrace_method) { case VGA_RETRACE_DUMB: s->retrace = vga_dumb_retrace; -- 2.39.5