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

[Xen-changelog] [xen-unstable] [IA64] Code clean up using xen machine vector.



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1178642919 21600
# Node ID 3ecf1cea58b1709a3fc6dfdeb8f9ba4f0fbc68a5
# Parent  8b96374670680257cbb988a17dfb88516ef0e7d7
[IA64] Code clean up using xen machine vector.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c    |  131 ++++++++++----------
 linux-2.6-xen-sparse/arch/ia64/kernel/setup.c       |   13 +
 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c     |   17 ++
 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h  |    2 
 linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h |   10 +
 5 files changed, 100 insertions(+), 73 deletions(-)

diff -r 8b9637467068 -r 3ecf1cea58b1 
linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c  Tue May 08 10:39:51 
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c  Tue May 08 10:48:39 
2007 -0600
@@ -514,6 +514,69 @@ void xen_smp_intr_init(void)
 #endif /* CONFIG_SMP */
 }
 
+void
+xen_irq_init(void)
+{
+       struct callback_register event = {
+               .type = CALLBACKTYPE_event,
+               .address = (unsigned long)&xen_event_callback,
+       };
+
+       xen_init_IRQ();
+       BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
+       late_time_init = xen_bind_early_percpu_irq;
+#ifdef CONFIG_SMP
+       register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
+#endif
+}
+
+void
+xen_platform_send_ipi(int cpu, int vector, int delivery_mode, int redirect)
+{
+       int irq = -1;
+
+#ifdef CONFIG_SMP
+       /* TODO: we need to call vcpu_up here */
+       if (unlikely(vector == ap_wakeup_vector)) {
+               extern void xen_send_ipi (int cpu, int vec);
+
+               /* XXX
+                * This should be in __cpu_up(cpu) in ia64 smpboot.c
+                * like x86. But don't want to modify it,
+                * keep it untouched.
+                */
+               xen_smp_intr_init_early(cpu);
+
+               xen_send_ipi (cpu, vector);
+               //vcpu_prepare_and_up(cpu);
+               return;
+       }
+#endif
+
+       switch (vector) {
+               case IA64_IPI_VECTOR:
+                       irq = per_cpu(ipi_to_irq, cpu)[IPI_VECTOR];
+                       break;
+               case IA64_IPI_RESCHEDULE:
+                       irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR];
+                       break;
+               case IA64_CMCP_VECTOR:
+                       irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR];
+                       break;
+               case IA64_CPEP_VECTOR:
+                       irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR];
+                       break;
+               default:
+                       printk(KERN_WARNING "Unsupported IPI type 0x%x\n",
+                              vector);
+                       irq = 0;
+                       break;
+       }               
+       
+       BUG_ON(irq < 0);
+       notify_remote_via_irq(irq);
+       return;
+}
 #endif /* CONFIG_XEN */
 
 void
@@ -541,21 +604,6 @@ void __init
 void __init
 init_IRQ (void)
 {
-#ifdef CONFIG_XEN
-       /* Maybe put into platform_irq_init later */
-       if (is_running_on_xen()) {
-               struct callback_register event = {
-                       .type = CALLBACKTYPE_event,
-                       .address = (unsigned long)&xen_event_callback,
-               };
-               xen_init_IRQ();
-               BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
-               late_time_init = xen_bind_early_percpu_irq;
-#ifdef CONFIG_SMP
-               register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
-#endif /* CONFIG_SMP */
-       }
-#endif /* CONFIG_XEN */
        register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
 #ifdef CONFIG_SMP
        register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
@@ -564,6 +612,10 @@ init_IRQ (void)
        pfm_init_percpu();
 #endif
        platform_irq_init();
+#ifdef CONFIG_XEN
+       if (is_running_on_xen() && !ia64_platform_is("xen"))
+               xen_irq_init();
+#endif
 }
 
 void
@@ -574,52 +626,11 @@ ia64_send_ipi (int cpu, int vector, int 
        unsigned long phys_cpu_id;
 
 #ifdef CONFIG_XEN
-        if (is_running_on_xen()) {
-               int irq = -1;
-
-#ifdef CONFIG_SMP
-               /* TODO: we need to call vcpu_up here */
-               if (unlikely(vector == ap_wakeup_vector)) {
-                       extern void xen_send_ipi (int cpu, int vec);
-
-                       /* XXX
-                        * This should be in __cpu_up(cpu) in ia64 smpboot.c
-                        * like x86. But don't want to modify it,
-                        * keep it untouched.
-                        */
-                       xen_smp_intr_init_early(cpu);
-
-                       xen_send_ipi (cpu, vector);
-                       //vcpu_prepare_and_up(cpu);
-                       return;
-               }
-#endif
-
-               switch(vector) {
-               case IA64_IPI_VECTOR:
-                       irq = per_cpu(ipi_to_irq, cpu)[IPI_VECTOR];
-                       break;
-               case IA64_IPI_RESCHEDULE:
-                       irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR];
-                       break;
-               case IA64_CMCP_VECTOR:
-                       irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR];
-                       break;
-               case IA64_CPEP_VECTOR:
-                       irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR];
-                       break;
-               default:
-                       printk(KERN_WARNING "Unsupported IPI type 0x%x\n",
-                              vector);
-                       irq = 0;
-                       break;
-               }               
-       
-               BUG_ON(irq < 0);
-               notify_remote_via_irq(irq);
+       if (is_running_on_xen()) {
+               xen_platform_send_ipi(cpu, vector, delivery_mode, redirect);
                return;
-        }
-#endif /* CONFIG_XEN */
+       }
+#endif
 
 #ifdef CONFIG_SMP
        phys_cpu_id = cpu_physical_id(cpu);
diff -r 8b9637467068 -r 3ecf1cea58b1 
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Tue May 08 10:39:51 
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Tue May 08 10:48:39 
2007 -0600
@@ -603,7 +603,10 @@ setup_arch (char **cmdline_p)
 
        platform_setup(cmdline_p);
 #ifdef CONFIG_XEN
-       xen_setup();
+       if (!is_running_on_xen() && !ia64_platform_is("xen")) {
+               extern ia64_mv_setup_t xen_setup;
+               xen_setup(cmdline_p);
+       }
 #endif
        paging_init();
 #ifdef CONFIG_XEN
@@ -993,12 +996,10 @@ cpu_init (void)
        /* size of physical stacked register partition plus 8 bytes: */
        __get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
        platform_cpu_init();
-
 #ifdef CONFIG_XEN
-       /* Need to be moved into platform_cpu_init later */
-       if (is_running_on_xen()) {
-               extern void xen_smp_intr_init(void);
-               xen_smp_intr_init();
+       if (is_running_on_xen() && !ia64_platform_is("xen")) {
+               extern ia64_mv_cpu_init_t xen_cpu_init;
+               xen_cpu_init();
        }
 #endif
 
diff -r 8b9637467068 -r 3ecf1cea58b1 
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Tue May 08 10:39:51 
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Tue May 08 10:48:39 
2007 -0600
@@ -53,9 +53,13 @@ static int p2m_expose_init(void);
 
 EXPORT_SYMBOL(__hypercall);
 
-void
-xen_setup(void)
-{
+void __init
+xen_setup(char **cmdline_p)
+{
+       extern void dig_setup(char **cmdline_p);
+       if (ia64_platform_is("xen"))
+               dig_setup(cmdline_p);
+       
        if (!is_running_on_xen() || !is_initial_xendomain())
                return;
 
@@ -69,6 +73,13 @@ xen_setup(void)
        }
        xen_start_info->console.domU.mfn = 0;
        xen_start_info->console.domU.evtchn = 0;
+}
+
+void __cpuinit
+xen_cpu_init(void)
+{
+       extern void xen_smp_intr_init(void);
+       xen_smp_intr_init();
 }
 
 //XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
diff -r 8b9637467068 -r 3ecf1cea58b1 
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Tue May 08 
10:39:51 2007 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Tue May 08 
10:48:39 2007 -0600
@@ -36,7 +36,6 @@
 #ifdef CONFIG_XEN
 extern int running_on_xen;
 #define is_running_on_xen()                    (running_on_xen)
-extern void xen_setup(void);
 #else /* CONFIG_XEN */
 # ifdef CONFIG_VMX_GUEST
 #  define is_running_on_xen()                  (1)
@@ -44,7 +43,6 @@ extern void xen_setup(void);
 #  define is_running_on_xen()                  (0)
 #  define HYPERVISOR_ioremap(offset, size)     (offset)
 # endif /* CONFIG_VMX_GUEST */
-#define xen_setup()                            do { } while (0)
 #endif /* CONFIG_XEN */
 
 #if defined(CONFIG_XEN) || defined(CONFIG_VMX_GUEST)
diff -r 8b9637467068 -r 3ecf1cea58b1 
linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h       Tue May 08 
10:39:51 2007 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h       Tue May 08 
10:48:39 2007 -0600
@@ -1,7 +1,10 @@
 #ifndef _ASM_IA64_MACHVEC_XEN_h
 #define _ASM_IA64_MACHVEC_XEN_h
 
-extern ia64_mv_setup_t                 dig_setup;
+extern ia64_mv_setup_t                 xen_setup;
+extern ia64_mv_cpu_init_t              xen_cpu_init;
+extern ia64_mv_irq_init_t              xen_irq_init;
+extern ia64_mv_send_ipi_t              xen_platform_send_ipi;
 extern ia64_mv_dma_alloc_coherent      xen_alloc_coherent;
 extern ia64_mv_dma_free_coherent       xen_free_coherent;
 extern ia64_mv_dma_map_single          xen_map_single;
@@ -19,7 +22,10 @@ extern ia64_mv_dma_mapping_error     xen_dma
  * the macros are used directly.
  */
 #define platform_name                          "xen"
-#define platform_setup                         dig_setup
+#define platform_setup                         xen_setup
+#define platform_cpu_init                      xen_cpu_init
+#define platform_irq_init                      xen_irq_init
+#define platform_send_ipi                      xen_platform_send_ipi
 #define platform_dma_init                      machvec_noop
 #define platform_dma_alloc_coherent            xen_alloc_coherent
 #define platform_dma_free_coherent             xen_free_coherent

_______________________________________________
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®.