From patchwork Thu May 7 14:57:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beth Kon X-Patchwork-Id: 22349 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n47EupSI018614 for ; Thu, 7 May 2009 14:56:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755885AbZEGO4o (ORCPT ); Thu, 7 May 2009 10:56:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755602AbZEGO4n (ORCPT ); Thu, 7 May 2009 10:56:43 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:52433 "EHLO e8.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060AbZEGO4m (ORCPT ); Thu, 7 May 2009 10:56:42 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e8.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n47El2Ts022921 for ; Thu, 7 May 2009 10:47:02 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n47Euf03142202 for ; Thu, 7 May 2009 10:56:41 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n47Eufh5017527 for ; Thu, 7 May 2009 10:56:41 -0400 Received: from localhost.localdomain (sig-9-65-9-1.mts.ibm.com [9.65.9.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n47Eud8f017273; Thu, 7 May 2009 10:56:40 -0400 From: Beth Kon To: avi@redhat.com Cc: kvm@vger.kernel.org, Beth Kon Subject: [PATCH 2/4] Userspace changes for configuring irq0->inti2 override (v2) Date: Thu, 7 May 2009 10:57:00 -0400 Message-Id: <1241708222-11101-2-git-send-email-eak@us.ibm.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1241708222-11101-1-git-send-email-eak@us.ibm.com> References: <1241708222-11101-1-git-send-email-eak@us.ibm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Beth Kon --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index e1b19d7..bb74f38 100644 --- a/hw/fw_cfg.c +++ b/hw/fw_cfg.c @@ -279,6 +279,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)nographic); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); + fw_cfg_add_i16(s, FW_CFG_IRQ0_OVERRIDE, (uint16_t)irq0override); register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s); qemu_register_reset(fw_cfg_reset, s); diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index f616ed2..498c1e3 100644 --- a/hw/fw_cfg.h +++ b/hw/fw_cfg.h @@ -15,6 +15,7 @@ #define FW_CFG_INITRD_SIZE 0x0b #define FW_CFG_BOOT_DEVICE 0x0c #define FW_CFG_NUMA 0x0d +#define FW_CFG_IRQ0_OVERRIDE 0x0e #define FW_CFG_MAX_ENTRY 0x10 #define FW_CFG_WRITE_CHANNEL 0x4000 diff --git a/hw/ioapic.c b/hw/ioapic.c index 0b70cf6..2d77a2c 100644 --- a/hw/ioapic.c +++ b/hw/ioapic.c @@ -23,6 +23,7 @@ #include "hw.h" #include "pc.h" +#include "sysemu.h" #include "qemu-timer.h" #include "host-utils.h" @@ -95,14 +96,13 @@ void ioapic_set_irq(void *opaque, int vector, int level) { IOAPICState *s = opaque; -#if 0 /* ISA IRQs map to GSI 1-1 except for IRQ0 which maps * to GSI 2. GSI maps to ioapic 1-1. This is not * the cleanest way of doing it but it should work. */ - if (vector == 0) + if (vector == 0 && irq0override) { vector = 2; -#endif + } if (vector >= 0 && vector < IOAPIC_NUM_PINS) { uint32_t mask = 1 << vector; diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 8cb6faa..2e52c87 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -879,7 +879,11 @@ int kvm_arch_init_irq_routing(void) return r; } for (i = 0; i < 24; ++i) { - r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i); + if (i == 0) { + r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2); + } else if (i != 2) { + r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i); + } if (r < 0) return r; } diff --git a/qemu-kvm.h b/qemu-kvm.h index 8226001..c64718c 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -165,6 +165,7 @@ void qemu_kvm_cpu_stop(CPUState *env); #define kvm_enabled() (kvm_allowed) #define qemu_kvm_irqchip_in_kernel() kvm_irqchip_in_kernel(kvm_context) #define qemu_kvm_pit_in_kernel() kvm_pit_in_kernel(kvm_context) +#define qemu_kvm_has_gsi_routing() kvm_has_gsi_routing(kvm_context) #define kvm_has_sync_mmu() qemu_kvm_has_sync_mmu() void kvm_init_vcpu(CPUState *env); void kvm_load_tsc(CPUState *env); @@ -173,6 +174,7 @@ void kvm_load_tsc(CPUState *env); #define kvm_nested 0 #define qemu_kvm_irqchip_in_kernel() (0) #define qemu_kvm_pit_in_kernel() (0) +#define qemu_kvm_has_gsi_routing() (0) #define kvm_has_sync_mmu() (0) #define kvm_load_registers(env) do {} while(0) #define kvm_save_registers(env) do {} while(0) diff --git a/sysemu.h b/sysemu.h index 1f45fd6..292bbc3 100644 --- a/sysemu.h +++ b/sysemu.h @@ -93,6 +93,7 @@ extern int graphic_width; extern int graphic_height; extern int graphic_depth; extern int nographic; +extern int irq0override; extern const char *keyboard_layout; extern int win2k_install_hack; extern int rtc_td_hack; diff --git a/vl.c b/vl.c index 6b4b7d2..f9a72b3 100644 --- a/vl.c +++ b/vl.c @@ -207,6 +207,7 @@ static int vga_ram_size; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; static DisplayState *display_state; int nographic; +int irq0override; static int curses; static int sdl; const char* keyboard_layout = NULL; @@ -5039,6 +5040,7 @@ int main(int argc, char **argv, char **envp) vga_ram_size = VGA_RAM_SIZE; snapshot = 0; nographic = 0; + irq0override = 1; curses = 0; kernel_filename = NULL; kernel_cmdline = ""; @@ -6135,8 +6137,14 @@ int main(int argc, char **argv, char **envp) } } - if (kvm_enabled()) - kvm_init_ap(); + if (kvm_enabled()) { + kvm_init_ap(); +#ifdef USE_KVM + if (kvm_irqchip && !qemu_kvm_has_gsi_routing()) { + irq0override = 0; + } +#endif + } machine->init(ram_size, vga_ram_size, boot_devices, kernel_filename, kernel_cmdline, initrd_filename, cpu_model);