[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Clean up IO-APIC handling in domain0, and the hypercall interface



ChangeSet 1.1444, 2005/05/05 18:58:59+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Clean up IO-APIC handling in domain0, and the hypercall interface
        exported by Xen (inc. removal of PCI-related calls). This hopefully
        fixes acpi=off.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/apic.c      |   32 
 b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/io_apic.c   |  111 +
 b/tools/libxc/xc_physdev.c                                 |   12 
 b/xen/arch/ia64/domain.c                                   |    8 
 b/xen/arch/ia64/xenmisc.c                                  |   27 
 b/xen/arch/ia64/xensetup.c                                 |    3 
 b/xen/arch/x86/domain.c                                    |    3 
 b/xen/arch/x86/io_apic.c                                   |   84 +
 b/xen/arch/x86/physdev.c                                   |  145 ++
 b/xen/common/Makefile                                      |    1 
 b/xen/common/dom0_ops.c                                    |   11 
 b/xen/common/domain.c                                      |   11 
 b/xen/drivers/char/serial.c                                |    7 
 b/xen/include/asm-x86/config.h                             |    2 
 b/xen/include/asm-x86/physdev.h                            |   17 
 b/xen/include/public/dom0_ops.h                            |   14 
 b/xen/include/public/physdev.h                             |   55 
 b/xen/include/xen/sched.h                                  |    4 
 linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/io_apic.h |  229 ---
 xen/common/physdev.c                                       |  832 -------------
 xen/include/xen/physdev.h                                  |   19 
 21 files changed, 358 insertions(+), 1269 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/apic.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/apic.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/apic.c       2005-05-05 
14:06:46 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/apic.c       2005-05-05 
14:06:46 -04:00
@@ -16,8 +16,32 @@
 
 #include <linux/config.h>
 #include <linux/init.h>
-#include <asm/apic.h>
 
+#include <linux/mm.h>
+#include <linux/irq.h>
+#include <linux/delay.h>
+#include <linux/bootmem.h>
+#include <linux/smp_lock.h>
+#include <linux/interrupt.h>
+#include <linux/mc146818rtc.h>
+#include <linux/kernel_stat.h>
+#include <linux/sysdev.h>
+
+#include <asm/atomic.h>
+#include <asm/smp.h>
+#include <asm/mtrr.h>
+#include <asm/mpspec.h>
+#include <asm/desc.h>
+#include <asm/arch_hooks.h>
+#include <asm/hpet.h>
+
+#include <mach_apic.h>
+
+#include "io_ports.h"
+
+/*
+ * Debug level
+ */
 int apic_verbosity;
 
 int get_physical_broadcast(void)
@@ -49,5 +73,11 @@
  */
 int __init APIC_init_uniprocessor (void)
 {
+#ifdef CONFIG_X86_IO_APIC
+       if (smp_found_config)
+               if (!skip_ioapic_setup && nr_ioapics)
+                       setup_IO_APIC();
+#endif
+
        return 0;
 }
diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/io_apic.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/io_apic.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/io_apic.c    2005-05-05 
14:06:47 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/io_apic.c    2005-05-05 
14:06:47 -04:00
@@ -37,18 +37,56 @@
 #include <asm/smp.h>
 #include <asm/desc.h>
 #include <asm/timer.h>
-#include <asm/io_apic.h>
-#include <asm/apic.h>
 
 #include <mach_apic.h>
 
 #include "io_ports.h"
 
-int (*ioapic_renumber_irq)(int ioapic, int irq);
-atomic_t irq_mis_count;
+#ifdef CONFIG_XEN
+
+#include <asm-xen/xen-public/xen.h>
+#include <asm-xen/xen-public/physdev.h>
+
+/* Fake i8259 */
+#define make_8259A_irq(_irq)     (io_apic_irqs &= ~(1UL<<(_irq)))
+#define disable_8259A_irq(_irq)  ((void)0)
+#define i8259A_irq_pending(_irq) (0)
 
 unsigned long io_apic_irqs;
 
+static inline unsigned int xen_io_apic_read(unsigned int apic, unsigned int 
reg)
+{
+       physdev_op_t op;
+       int ret;
+
+       op.cmd = PHYSDEVOP_APIC_READ;
+       op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid;
+       op.u.apic_op.offset = reg;
+       ret = HYPERVISOR_physdev_op(&op);
+       if (ret)
+               return ret;
+       return op.u.apic_op.value;
+}
+
+static inline void xen_io_apic_write(unsigned int apic, unsigned int reg, 
unsigned int value)
+{
+       physdev_op_t op;
+
+       op.cmd = PHYSDEVOP_APIC_WRITE;
+       op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid;
+       op.u.apic_op.offset = reg;
+       op.u.apic_op.value = value;
+       HYPERVISOR_physdev_op(&op);
+}
+
+#define io_apic_read(a,r)    xen_io_apic_read(a,r)
+#define io_apic_write(a,r,v) xen_io_apic_write(a,r,v)
+
+#endif /* CONFIG_XEN */
+
+int (*ioapic_renumber_irq)(int ioapic, int irq);
+atomic_t irq_mis_count;
+
 static DEFINE_SPINLOCK(ioapic_lock);
 
 /*
@@ -111,6 +149,7 @@
        entry->pin = pin;
 }
 
+#ifndef CONFIG_XEN
 /*
  * Reroute an IRQ to a different pin.
  */
@@ -247,6 +286,9 @@
        }
        spin_unlock_irqrestore(&ioapic_lock, flags);
 }
+#else
+#define clear_IO_APIC() ((void)0)
+#endif
 
 #if defined(CONFIG_IRQBALANCE)
 # include <asm/processor.h>    /* kernel_thread() */
@@ -668,9 +710,7 @@
 #ifndef CONFIG_SMP
 void fastcall send_IPI_self(int vector)
 {
-#if 1
-       return;
-#else
+#ifndef CONFIG_XEN
        unsigned int cfg;
 
        /*
@@ -686,7 +726,6 @@
 }
 #endif /* !CONFIG_SMP */
 
-
 /*
  * support for broken MP BIOSs, enables hand-redirection of PIRQ0-7 to
  * specific CPU-side IRQs.
@@ -752,6 +791,7 @@
        return -1;
 }
 
+#ifndef CONFIG_XEN
 /*
  * Find the pin to which IRQ[irq] (ISA) is connected
  */
@@ -774,6 +814,7 @@
        }
        return -1;
 }
+#endif
 
 /*
  * Find a specific PCI IRQ entry.
@@ -821,6 +862,7 @@
        return best_guess;
 }
 
+#ifndef CONFIG_XEN
 /*
  * This function currently is only a helper for the i386 smp boot process 
where 
  * we need to reprogram the ioredtbls to cater for the cpus which have come 
online
@@ -844,6 +886,7 @@
 
        }
 }
+#endif /* !CONFIG_XEN */
 
 /*
  * EISA Edge/Level control register, ELCR
@@ -1133,7 +1176,7 @@
 }
 
 /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
-u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 };
+u8 irq_vector[NR_IRQ_VECTORS]; /* = { FIRST_DEVICE_VECTOR , 0 }; */
 
 int assign_irq_vector(int irq)
 {
@@ -1157,6 +1200,7 @@
        return current_vector;
 }
 
+#ifndef CONFIG_XEN
 static struct hw_interrupt_type ioapic_level_type;
 static struct hw_interrupt_type ioapic_edge_type;
 
@@ -1172,20 +1216,19 @@
                        irq_desc[vector].handler = &ioapic_level_type;
                else
                        irq_desc[vector].handler = &ioapic_edge_type;
-#if 0
                set_intr_gate(vector, interrupt[vector]);
-#endif
        } else  {
                if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
                                trigger == IOAPIC_LEVEL)
                        irq_desc[irq].handler = &ioapic_level_type;
                else
                        irq_desc[irq].handler = &ioapic_edge_type;
-#if 0
                set_intr_gate(vector, interrupt[irq]);
-#endif
        }
 }
+#else
+#define ioapic_register_intr(_irq,_vector,_trigger) ((void)0)
+#endif
 
 void __init setup_IO_APIC_irqs(void)
 {
@@ -1241,7 +1284,7 @@
                else
                        add_pin_to_irq(irq, apic, pin);
 
-               if (!apic && !IO_APIC_IRQ(irq))
+               if (/*!apic &&*/ !IO_APIC_IRQ(irq))
                        continue;
 
                if (IO_APIC_IRQ(irq)) {
@@ -1249,10 +1292,8 @@
                        entry.vector = vector;
                        ioapic_register_intr(irq, vector, IOAPIC_AUTO);
                
-#if 0
                        if (!apic && (irq < 16))
                                disable_8259A_irq(irq);
-#endif
                }
                spin_lock_irqsave(&ioapic_lock, flags);
                io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
@@ -1268,6 +1309,7 @@
 /*
  * Set up the 8259A-master output pin:
  */
+#ifndef CONFIG_XEN
 void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.