diff mbox

[05/21] irq0override provided by qemu.

Message ID 1255017566-26220-6-git-send-email-gleb@redhat.com
State Not Applicable
Headers show

Commit Message

Gleb Natapov Oct. 8, 2009, 3:59 p.m. UTC
Read it instead of relying on compile time flag.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 src/acpi.c     |    2 +-
 src/mptable.c  |    9 ++-------
 src/paravirt.c |   12 ++++++++++++
 src/paravirt.h |    2 ++
 src/util.h     |    3 ---
 5 files changed, 17 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/src/acpi.c b/src/acpi.c
index 1b4f4c5..fb57860 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -314,7 +314,7 @@  build_madt(void)
     io_apic->interrupt = cpu_to_le32(0);
 
     struct madt_intsrcovr *intsrcovr = (void*)&io_apic[1];
-    if (irq0override) {
+    if (qemu_cfg_irq0_override()) {
         memset(intsrcovr, 0, sizeof(*intsrcovr));
         intsrcovr->type   = APIC_XRUPT_OVERRIDE;
         intsrcovr->length = sizeof(*intsrcovr);
diff --git a/src/mptable.c b/src/mptable.c
index aeb1f94..4aaff1e 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -8,12 +8,7 @@ 
 #include "util.h" // dprintf
 #include "config.h" // CONFIG_*
 #include "mptable.h" // MPTABLE_SIGNATURE
-
-#if CONFIG_KVM
-int irq0override = 1;
-#else
-int irq0override = 0;
-#endif
+#include "paravirt.h"
 
 void
 mptable_init(void)
@@ -103,7 +98,7 @@  mptable_init(void)
         intsrc->srcbusirq = i;
         intsrc->dstapic = ioapic_id;
         intsrc->dstirq = i;
-        if (irq0override) {
+        if (qemu_cfg_irq0_override()) {
             /* Destination 2 is covered by irq0->inti2 override (i ==
                0). Source IRQ 2 is unused */
             if (i == 0)
diff --git a/src/paravirt.c b/src/paravirt.c
index 9637f87..8c08ce7 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -79,6 +79,18 @@  int qemu_cfg_show_boot_menu(void)
     return v;
 }
 
+int qemu_cfg_irq0_override(void)
+{
+    u8 v;
+
+    if (!qemu_cfg_present)
+        return 0;
+
+    qemu_cfg_read_entry(&v, QEMU_CFG_IRQ0_OVERRIDE, sizeof(v));
+
+    return v;
+}
+
 u16 qemu_cfg_acpi_additional_tables(void)
 {
     u16 cnt;
diff --git a/src/paravirt.h b/src/paravirt.h
index da01c0c..2b2f314 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -34,12 +34,14 @@  static inline int kvm_para_available(void)
 #define QEMU_CFG_ARCH_LOCAL		0x8000
 #define QEMU_CFG_ACPI_TABLES		(QEMU_CFG_ARCH_LOCAL + 0)
 #define QEMU_CFG_SMBIOS_ENTRIES		(QEMU_CFG_ARCH_LOCAL + 1)
+#define QEMU_CFG_IRQ0_OVERRIDE		(QEMU_CFG_ARCH_LOCAL + 1)
 
 extern int qemu_cfg_present;
 
 void qemu_cfg_port_probe(void);
 int qemu_cfg_show_boot_menu(void);
 void qemu_cfg_get_uuid(u8 *uuid);
+int qemu_cfg_irq0_override(void);
 u16 qemu_cfg_acpi_additional_tables(void);
 u16 qemu_cfg_next_acpi_table_len(void);
 void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
diff --git a/src/util.h b/src/util.h
index dd8619b..ca16ac7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -302,9 +302,6 @@  void reset_vector() __attribute__ ((noreturn));
 // misc.c
 extern u8 BiosChecksum;
 
-// mptable.c
-extern int irq0override;
-
 // version (auto generated file out/version.c)
 extern const char VERSION[];