]> git.proxmox.com Git - mirror_qemu.git/commitdiff
kvm: x86: Establish IRQ0 override control
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 15 Oct 2011 12:08:26 +0000 (14:08 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 19 Jan 2012 11:14:42 +0000 (12:14 +0100)
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 <jan.kiszka@siemens.com>
hw/pc.c
kvm-all.c
kvm-stub.c
kvm.h
sysemu.h
vl.c

diff --git a/hw/pc.c b/hw/pc.c
index 04304e0ca345c9f56a68beb67e895f2ab23eda04..38d787a74ae4ca94e8472e74c5e3762a18347ce6 100644 (file)
--- 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)
index fa9d92d00584d206fa21c9f7fe9b5df0485490ed..88f11567f7fde7e2b9047a6823a0b148ebec32ff 100644 (file)
--- 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()) {
index 06064b9a8694aa8e035774b952bfc8d3cc5408fb..6c2b06ba3204261953fcbe2a79a6c988b13f49bc 100644 (file)
@@ -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 dd2d4f0a94889709eb4ce50b94847071b52f1d96..ad430fd09ac43cfe22457ff928979b5fa1727a24 100644 (file)
--- 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);
 
index ddef2bb0c1b7082ee934699015e3b85e40821b36..caff268bd2c19e1cc40f989e4a1b632406f82b47 100644 (file)
--- 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 ba55b356cf71398f0a887fb2eaa86812040b22f4..132c387c2ff01a9287bffd48aa3eeb10d61d9756 100644 (file)
--- 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;