From patchwork Thu Aug 6 14:25:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 30851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 59DC1B8152 for ; Fri, 7 Aug 2009 00:26:43 +1000 (EST) Received: from localhost ([127.0.0.1]:42572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZ3vP-00044i-Kd for incoming@patchwork.ozlabs.org; Thu, 06 Aug 2009 10:26:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZ3uw-00044c-Eh for qemu-devel@nongnu.org; Thu, 06 Aug 2009 10:26:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZ3ur-000412-DQ for qemu-devel@nongnu.org; Thu, 06 Aug 2009 10:26:06 -0400 Received: from [199.232.76.173] (port=60007 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZ3ur-00040z-70 for qemu-devel@nongnu.org; Thu, 06 Aug 2009 10:26:01 -0400 Received: from mx20.gnu.org ([199.232.41.8]:64449) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MZ3uq-0001MK-RA for qemu-devel@nongnu.org; Thu, 06 Aug 2009 10:26:01 -0400 Received: from relay1.sgi.com ([192.48.179.29] helo=relay.sgi.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MZ3uq-0001uv-AG for qemu-devel@nongnu.org; Thu, 06 Aug 2009 10:26:00 -0400 Received: from eye3.emea.sgi.com (eye3.emea.sgi.com [144.253.156.24]) by relay1.corp.sgi.com (Postfix) with ESMTP id 8DA6D8F80A3; Thu, 6 Aug 2009 07:25:51 -0700 (PDT) Message-ID: <4A7AE7EE.6070308@sgi.com> Date: Thu, 06 Aug 2009 16:25:50 +0200 From: Jes Sorensen User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: Anthony Liguori X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Kevin O'Connor , qemu-devel , Avi Kivity Subject: [Qemu-devel] [PATCH] QEMU set irq0override in fw_cfg X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi, After discussing the issue with Avi, Gleb and a couple others on irq, we came to the conclusion that it is preferred to have QEMU request features from the BIOS, rather than notifying the BIOS that it is running on QEMU or KVM. This way memory ranges can change etc. and an older BIOS will continue to work on newer QEMU if it receives the info as a fw_cfg value. This one also matches what qemu-kvm does for irq0override, except I haven't made it configurable. I leave that as an exercise for whoever would be interested in switching off irq0override. Thanks, Jes Set irq0 override in fw_cfg, informing the BIOS that QEMU expects override on irq0. This matches qemu-kvm, and will help sharing a single BIOS binary. Signed-off-by: Jes Sorensen --- hw/pc.c | 2 ++ sysemu.h | 1 + vl.c | 1 + 3 files changed, 4 insertions(+) Index: qemu/hw/pc.c =================================================================== --- qemu.orig/hw/pc.c +++ qemu/hw/pc.c @@ -54,6 +54,7 @@ #define BIOS_CFG_IOPORT 0x510 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) +#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) #define MAX_IDE_BUS 2 @@ -476,6 +477,7 @@ static void *bochs_bios_init(void) fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); + fw_cfg_add_bytes(fw_cfg, FW_CFG_IRQ0_OVERRIDE, &irq0override, 1); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) Index: qemu/sysemu.h =================================================================== --- qemu.orig/sysemu.h +++ qemu/sysemu.h @@ -113,6 +113,7 @@ extern int xenfb_enabled; extern int graphic_width; extern int graphic_height; extern int graphic_depth; +extern uint8_t irq0override; extern DisplayType display_type; extern const char *keyboard_layout; extern int win2k_install_hack; Index: qemu/vl.c =================================================================== --- qemu.orig/vl.c +++ qemu/vl.c @@ -229,6 +229,7 @@ int no_reboot = 0; int no_shutdown = 0; int cursor_hide = 1; int graphic_rotate = 0; +uint8_t irq0override = 1; #ifndef _WIN32 int daemonize = 0; #endif