From patchwork Fri Jan 20 17:26:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 137067 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 F24AE1007D1 for ; Sat, 21 Jan 2012 05:11:36 +1100 (EST) Received: from localhost ([::1]:55456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoIIr-0005Yc-PF for incoming@patchwork.ozlabs.org; Fri, 20 Jan 2012 12:31:05 -0500 Received: from eggs.gnu.org ([140.186.70.92]:34571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoIIE-0004l2-Ui for qemu-devel@nongnu.org; Fri, 20 Jan 2012 12:30:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RoIIC-0006ET-VL for qemu-devel@nongnu.org; Fri, 20 Jan 2012 12:30:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoIIC-0006Dk-0h for qemu-devel@nongnu.org; Fri, 20 Jan 2012 12:30:24 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0KHUNtv014768 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 Jan 2012 12:30:23 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0KHUM2f025847; Fri, 20 Jan 2012 12:30:22 -0500 Received: from amt.cnet (vpn1-5-58.ams2.redhat.com [10.36.5.58]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q0KHUIk3011726; Fri, 20 Jan 2012 12:30:21 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id D6F966523C1; Fri, 20 Jan 2012 15:27:36 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id q0KHRYwQ007287; Fri, 20 Jan 2012 15:27:34 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Fri, 20 Jan 2012 15:26:42 -0200 Message-Id: <9b5b76d44930dc9266bb6d30862704cb3c86d2ca.1327080406.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Jan Kiszka , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 16/20] 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 From: Jan Kiszka 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 04304e0..38d787a 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 fa9d92d..88f1156 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1307,6 +1307,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 dd2d4f0..ad430fd 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 ddef2bb..caff268 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 ba55b35..132c387 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;