[Xen-ia64-devel] [PATCH] code clean up using xen machine vector.

2007-05-08 Thread Isaku Yamahata
code clean up using xen machine vector.

-- 
yamahata
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1178619507 -32400
# Node ID 1c42e2281e1679d7cd662ecbeb5d929967a2d24a
# Parent  89b0cc16c053c917adf6219d55356f969b029a38
code clean up using xen machine vector.
PATCHNAME: ia64_machine_vector_clean_up

Signed-off-by: Isaku Yamahata [EMAIL PROTECTED]

diff -r 89b0cc16c053 -r 1c42e2281e16 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 15:40:08 2007 +0900
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue May 08 19:18:27 2007 +0900
@@ -514,6 +514,68 @@ 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 /* CONFIG_SMP */
+}
+
+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 +603,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 +611,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 +625,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 89b0cc16c053 -r 1c42e2281e16 linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Tue May 08 15:40:08 2007 +0900
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Tue May 08 19:18:27 2007 +0900
@@ -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 

Re: [Xen-ia64-devel] [PATCH] code clean up using xen machine vector.

2007-05-08 Thread Alex Williamson
On Tue, 2007-05-08 at 19:25 +0900, Isaku Yamahata wrote:
 code clean up using xen machine vector.

  Nice cleanup, that machine vector is working out already.  Thanks,

Alex

-- 
Alex Williamson HP Open Source  Linux Org.


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel