From patchwork Wed May 9 15:23:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 157995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 23745B6FAA for ; Thu, 10 May 2012 01:23:32 +1000 (EST) Received: from localhost ([::1]:43077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS8ji-0002DP-0T for incoming@patchwork.ozlabs.org; Wed, 09 May 2012 11:23:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS8jW-0002D5-Dv for qemu-devel@nongnu.org; Wed, 09 May 2012 11:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SS8jP-0000lC-UC for qemu-devel@nongnu.org; Wed, 09 May 2012 11:23:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS8jP-0000ky-Le for qemu-devel@nongnu.org; Wed, 09 May 2012 11:23:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q49FNAVN029302 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 May 2012 11:23:10 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q49FN8Ul012344; Wed, 9 May 2012 11:23:09 -0400 From: Avi Kivity To: qemu-devel@nongnu.org, Michael Tokarev Date: Wed, 9 May 2012 18:23:06 +0300 Message-Id: <1336576986-14390-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] vga: fix vram double-mapping with -vga std and -M pc-0.12 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With pc-0.12, we map the video RAM both through the PCI BAR (the guest does this) and through a fixed mapping at 0xe0000000. The memory API doesn't allow this double map, and aborts. Fix by using an alias. Reported-by: Michael Tokarev Signed-off-by: Avi Kivity Tested-By: Michael Tokarev --- hw/vga.c | 7 ++++++- hw/vga_int.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/vga.c b/hw/vga.c index 5824f85..d784df7 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2357,10 +2357,15 @@ void vga_init(VGACommonState *s, MemoryRegion *address_space, void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory) { #ifdef CONFIG_BOCHS_VBE + /* With pc-0.12 and below we map both the PCI BAR and the fixed VBE region, + * so use an alias to avoid double-mapping the same region. + */ + memory_region_init_alias(&s->vram_vbe, "vram.vbe", + &s->vram, 0, memory_region_size(&s->vram)); /* XXX: use optimized standard vga accesses */ memory_region_add_subregion(system_memory, VBE_DISPI_LFB_PHYSICAL_ADDRESS, - &s->vram); + &s->vram_vbe); s->vbe_mapped = 1; #endif } diff --git a/hw/vga_int.h b/hw/vga_int.h index 7685b2b..d244d8f 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -105,6 +105,7 @@ typedef struct VGACommonState { MemoryRegion *legacy_address_space; uint8_t *vram_ptr; MemoryRegion vram; + MemoryRegion vram_vbe; uint32_t vram_size; uint32_t latch; MemoryRegion *chain4_alias;