From patchwork Thu Dec 15 12:33:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 131606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 523371007D4 for ; Fri, 16 Dec 2011 00:26:48 +1100 (EST) Received: from localhost ([::1]:38918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbAVy-0003iJ-Jq for incoming@patchwork.ozlabs.org; Thu, 15 Dec 2011 07:34:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbAVL-0002FZ-6a for qemu-devel@nongnu.org; Thu, 15 Dec 2011 07:33:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbAVH-0000Zm-5z for qemu-devel@nongnu.org; Thu, 15 Dec 2011 07:33:43 -0500 Received: from goliath.siemens.de ([192.35.17.28]:21393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbAVG-0000YY-SU for qemu-devel@nongnu.org; Thu, 15 Dec 2011 07:33:39 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id pBFCXaKi000455; Thu, 15 Dec 2011 13:33:36 +0100 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id pBFCXW5O003584; Thu, 15 Dec 2011 13:33:36 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Thu, 15 Dec 2011 13:33:27 +0100 Message-Id: X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.28 Cc: Blue Swirl , Anthony Liguori , qemu-devel , kvm@vger.kernel.org, "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v5 12/16] kvm: x86: Establish IRQ0 override control 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 KVM is forced to disable the IRQ0 override when we run with in-kernel irqchip but without IRQ routing support of the kernel. Set the fwcfg value correspondingly. This aligns us with qemu-kvm. Signed-off-by: Jan Kiszka --- hw/pc.c | 3 ++- kvm-all.c | 5 +++++ kvm-stub.c | 5 +++++ kvm.h | 2 ++ sysemu.h | 1 - vl.c | 1 - 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index ee6e59b..066edc4 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -39,6 +39,7 @@ #include "msi.h" #include "sysbus.h" #include "sysemu.h" +#include "kvm.h" #include "blockdev.h" #include "ui/qemu-spice.h" #include "memory.h" @@ -609,7 +610,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); + fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) diff --git a/kvm-all.c b/kvm-all.c index 8958abd..7387dd3 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1271,6 +1271,11 @@ int kvm_has_gsi_routing(void) return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING); } +int kvm_allows_irq0_override(void) +{ + return !kvm_enabled() || !kvm_irqchip_in_kernel() || kvm_has_gsi_routing(); +} + void kvm_setup_guest_memory(void *start, size_t size) { if (!kvm_has_sync_mmu()) { diff --git a/kvm-stub.c b/kvm-stub.c index 06064b9..6c2b06b 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -78,6 +78,11 @@ int kvm_has_many_ioeventfds(void) return 0; } +int kvm_allows_irq0_override(void) +{ + return 1; +} + void kvm_setup_guest_memory(void *start, size_t size) { } diff --git a/kvm.h b/kvm.h index 0d6c453..a3c87af 100644 --- a/kvm.h +++ b/kvm.h @@ -53,6 +53,8 @@ int kvm_has_xcrs(void); int kvm_has_many_ioeventfds(void); int kvm_has_gsi_routing(void); +int kvm_allows_irq0_override(void); + #ifdef NEED_CPU_H int kvm_init_vcpu(CPUState *env); diff --git a/sysemu.h b/sysemu.h index 22cd720..3bd896e 100644 --- a/sysemu.h +++ b/sysemu.h @@ -102,7 +102,6 @@ extern int vga_interface_type; 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; diff --git a/vl.c b/vl.c index de5ecef..f9a8caf 100644 --- a/vl.c +++ b/vl.c @@ -218,7 +218,6 @@ int no_reboot = 0; int no_shutdown = 0; int cursor_hide = 1; int graphic_rotate = 0; -uint8_t irq0override = 1; const char *watchdog; QEMUOptionRom option_rom[MAX_OPTION_ROMS]; int nb_option_roms;