WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 30 of 38] xen: implement io_apic_ops

To: Ingo Molnar <mingo@xxxxxxx>
Subject: [Xen-devel] [PATCH 30 of 38] xen: implement io_apic_ops
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Thu, 13 Nov 2008 11:10:28 -0800
Cc: the arch/x86 maintainers <x86@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 13 Nov 2008 11:55:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1226603398@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Writes to the IO APIC are paravirtualized via hypercalls, so implement
the appropriate operations.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
 arch/x86/xen/Makefile    |    3 +-
 arch/x86/xen/apic.c      |   66 ++++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/xen/enlighten.c |    2 +
 arch/x86/xen/xen-ops.h   |    2 +
 4 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -9,4 +9,5 @@
                        time.o xen-asm_$(BITS).o grant-table.o suspend.o
 
 obj-$(CONFIG_SMP)              += smp.o spinlock.o
-obj-$(CONFIG_XEN_DEBUG_FS)     += debugfs.o
\ No newline at end of file
+obj-$(CONFIG_XEN_DEBUG_FS)     += debugfs.o
+obj-$(CONFIG_XEN_DOM0)         += apic.o
diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
new file mode 100644
--- /dev/null
+++ b/arch/x86/xen/apic.c
@@ -0,0 +1,66 @@
+#include <linux/kernel.h>
+#include <linux/threads.h>
+#include <linux/bitmap.h>
+
+#include <asm/io_apic.h>
+#include <asm/acpi.h>
+
+#include <asm/xen/hypervisor.h>
+#include <asm/xen/hypercall.h>
+
+#include <xen/interface/xen.h>
+#include <xen/interface/physdev.h>
+
+static void __init xen_io_apic_init(void)
+{
+       printk("xen apic init\n");
+       dump_stack();
+}
+
+static unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
+{
+       struct physdev_apic apic_op;
+       int ret;
+
+       apic_op.apic_physbase = mp_ioapics[apic].mp_apicaddr;
+       apic_op.reg = reg;
+       ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
+       if (ret)
+               BUG();
+       return apic_op.value;
+}
+
+
+static void xen_io_apic_write(unsigned int apic, unsigned int reg, unsigned 
int value)
+{
+       struct physdev_apic apic_op;
+
+       apic_op.apic_physbase = mp_ioapics[apic].mp_apicaddr;
+       apic_op.reg = reg;
+       apic_op.value = value;
+       if (HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op))
+               BUG();
+}
+
+static struct io_apic_ops __initdata xen_ioapic_ops = {
+       .init = xen_io_apic_init,
+       .read = xen_io_apic_read,
+       .write = xen_io_apic_write,
+       .modify = xen_io_apic_write,
+};
+
+void xen_init_apic(void)
+{
+       if (!xen_initial_domain())
+               return;
+
+       set_io_apic_ops(&xen_ioapic_ops);
+
+#ifdef CONFIG_ACPI
+       /*
+        * Pretend ACPI found our lapic even though we've disabled it,
+        * to prevent MP tables from setting up lapics.
+        */
+       acpi_lapic = 1;
+#endif
+}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1750,6 +1750,8 @@
                set_iopl.iopl = 1;
                if (HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl) == -1)
                        BUG();
+
+               xen_init_apic();
        }
 
        /* set the limit of our address space */
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -64,6 +64,8 @@
 #endif
 
 
+void xen_init_apic(void);
+
 /* Declare an asm function, along with symbols needed to make it
    inlineable */
 #define DECL_ASM(ret, name, ...)               \



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

<Prev in Thread] Current Thread [Next in Thread>