From patchwork Tue Sep 11 15:53:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 183144 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 C81482C0084 for ; Wed, 12 Sep 2012 01:54:21 +1000 (EST) Received: from localhost ([::1]:47970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBSn5-0001cD-7r for incoming@patchwork.ozlabs.org; Tue, 11 Sep 2012 11:54:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBSmu-0001bn-24 for qemu-devel@nongnu.org; Tue, 11 Sep 2012 11:54:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBSmo-00088S-7A for qemu-devel@nongnu.org; Tue, 11 Sep 2012 11:54:07 -0400 Received: from david.siemens.de ([192.35.17.14]:17428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBSmn-000886-Tl for qemu-devel@nongnu.org; Tue, 11 Sep 2012 11:54:02 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id q8BFrv31016093; Tue, 11 Sep 2012 17:53:57 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id q8BFruwa018470; Tue, 11 Sep 2012 17:53:56 +0200 Message-ID: <504F5E94.9070108@siemens.com> Date: Tue, 11 Sep 2012 17:53:56 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori , qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.14 Cc: Kevin O'Connor , Avi Kivity Subject: [Qemu-devel] [PATCH] isapc: Shadow ISA BIOS by default 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 Our one and only BIOS depends on a writable shadowed BIOS in the ISA range. As we have no interface to control the write property, make that region writable by default. Signed-off-by: Jan Kiszka --- This unbreaks isapc for TCG, and keep it working for KVM once it starts supporting read-only memslots. hw/pc_sysfw.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c index b45f0ac..027d98a 100644 --- a/hw/pc_sysfw.c +++ b/hw/pc_sysfw.c @@ -136,6 +136,7 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory) { char *filename; MemoryRegion *bios, *isa_bios; + void *isa_bios_ptr; int bios_size, isa_bios_size; int ret; @@ -167,19 +168,23 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory) g_free(filename); } - /* map the last 128KB of the BIOS in ISA space */ + /* Shadow the last 128KB of the BIOS in ISA space as RAM - + * Seabios depends on this */ isa_bios_size = bios_size; if (isa_bios_size > (128 * 1024)) { isa_bios_size = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); - memory_region_init_alias(isa_bios, "isa-bios", bios, - bios_size - isa_bios_size, isa_bios_size); + memory_region_init_ram(isa_bios, "isa-bios", isa_bios_size); + vmstate_register_ram_global(isa_bios); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); - memory_region_set_readonly(isa_bios, true); + + /* copy ISA rom image from top of the ROM */ + isa_bios_ptr = memory_region_get_ram_ptr(isa_bios); + rom_copy(isa_bios_ptr, (uint32_t)(-isa_bios_size), isa_bios_size); /* map all the bios at the top of memory */ memory_region_add_subregion(rom_memory,