direct-io.hg

changeset 15108:3ecf1cea58b1

[IA64] Code clean up using xen machine vector.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Tue May 08 10:48:39 2007 -0600 (2007-05-08)
parents 8b9637467068
children c4755f856627
files linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c linux-2.6-xen-sparse/arch/ia64/kernel/setup.c linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue May 08 10:39:51 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue May 08 10:48:39 2007 -0600
     1.3 @@ -514,6 +514,69 @@ void xen_smp_intr_init(void)
     1.4  #endif /* CONFIG_SMP */
     1.5  }
     1.6  
     1.7 +void
     1.8 +xen_irq_init(void)
     1.9 +{
    1.10 +	struct callback_register event = {
    1.11 +		.type = CALLBACKTYPE_event,
    1.12 +		.address = (unsigned long)&xen_event_callback,
    1.13 +	};
    1.14 +
    1.15 +	xen_init_IRQ();
    1.16 +	BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
    1.17 +	late_time_init = xen_bind_early_percpu_irq;
    1.18 +#ifdef CONFIG_SMP
    1.19 +	register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
    1.20 +#endif
    1.21 +}
    1.22 +
    1.23 +void
    1.24 +xen_platform_send_ipi(int cpu, int vector, int delivery_mode, int redirect)
    1.25 +{
    1.26 +	int irq = -1;
    1.27 +
    1.28 +#ifdef CONFIG_SMP
    1.29 +	/* TODO: we need to call vcpu_up here */
    1.30 +	if (unlikely(vector == ap_wakeup_vector)) {
    1.31 +		extern void xen_send_ipi (int cpu, int vec);
    1.32 +
    1.33 +		/* XXX
    1.34 +		 * This should be in __cpu_up(cpu) in ia64 smpboot.c
    1.35 +		 * like x86. But don't want to modify it,
    1.36 +		 * keep it untouched.
    1.37 +		 */
    1.38 +		xen_smp_intr_init_early(cpu);
    1.39 +
    1.40 +		xen_send_ipi (cpu, vector);
    1.41 +		//vcpu_prepare_and_up(cpu);
    1.42 +		return;
    1.43 +	}
    1.44 +#endif
    1.45 +
    1.46 +	switch (vector) {
    1.47 +		case IA64_IPI_VECTOR:
    1.48 +			irq = per_cpu(ipi_to_irq, cpu)[IPI_VECTOR];
    1.49 +			break;
    1.50 +		case IA64_IPI_RESCHEDULE:
    1.51 +			irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR];
    1.52 +			break;
    1.53 +		case IA64_CMCP_VECTOR:
    1.54 +			irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR];
    1.55 +			break;
    1.56 +		case IA64_CPEP_VECTOR:
    1.57 +			irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR];
    1.58 +			break;
    1.59 +		default:
    1.60 +			printk(KERN_WARNING "Unsupported IPI type 0x%x\n",
    1.61 +			       vector);
    1.62 +			irq = 0;
    1.63 +			break;
    1.64 +	}		
    1.65 +	
    1.66 +	BUG_ON(irq < 0);
    1.67 +	notify_remote_via_irq(irq);
    1.68 +	return;
    1.69 +}
    1.70  #endif /* CONFIG_XEN */
    1.71  
    1.72  void
    1.73 @@ -541,21 +604,6 @@ register_percpu_irq (ia64_vector vec, st
    1.74  void __init
    1.75  init_IRQ (void)
    1.76  {
    1.77 -#ifdef CONFIG_XEN
    1.78 -	/* Maybe put into platform_irq_init later */
    1.79 -	if (is_running_on_xen()) {
    1.80 -		struct callback_register event = {
    1.81 -			.type = CALLBACKTYPE_event,
    1.82 -			.address = (unsigned long)&xen_event_callback,
    1.83 -		};
    1.84 -		xen_init_IRQ();
    1.85 -		BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
    1.86 -		late_time_init = xen_bind_early_percpu_irq;
    1.87 -#ifdef CONFIG_SMP
    1.88 -		register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
    1.89 -#endif /* CONFIG_SMP */
    1.90 -	}
    1.91 -#endif /* CONFIG_XEN */
    1.92  	register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
    1.93  #ifdef CONFIG_SMP
    1.94  	register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
    1.95 @@ -564,6 +612,10 @@ init_IRQ (void)
    1.96  	pfm_init_percpu();
    1.97  #endif
    1.98  	platform_irq_init();
    1.99 +#ifdef CONFIG_XEN
   1.100 +	if (is_running_on_xen() && !ia64_platform_is("xen"))
   1.101 +		xen_irq_init();
   1.102 +#endif
   1.103  }
   1.104  
   1.105  void
   1.106 @@ -574,53 +626,12 @@ ia64_send_ipi (int cpu, int vector, int 
   1.107  	unsigned long phys_cpu_id;
   1.108  
   1.109  #ifdef CONFIG_XEN
   1.110 -        if (is_running_on_xen()) {
   1.111 -		int irq = -1;
   1.112 -
   1.113 -#ifdef CONFIG_SMP
   1.114 -		/* TODO: we need to call vcpu_up here */
   1.115 -		if (unlikely(vector == ap_wakeup_vector)) {
   1.116 -			extern void xen_send_ipi (int cpu, int vec);
   1.117 -
   1.118 -			/* XXX
   1.119 -			 * This should be in __cpu_up(cpu) in ia64 smpboot.c
   1.120 -			 * like x86. But don't want to modify it,
   1.121 -			 * keep it untouched.
   1.122 -			 */
   1.123 -			xen_smp_intr_init_early(cpu);
   1.124 -
   1.125 -			xen_send_ipi (cpu, vector);
   1.126 -			//vcpu_prepare_and_up(cpu);
   1.127 -			return;
   1.128 -		}
   1.129 +	if (is_running_on_xen()) {
   1.130 +		xen_platform_send_ipi(cpu, vector, delivery_mode, redirect);
   1.131 +		return;
   1.132 +	}
   1.133  #endif
   1.134  
   1.135 -		switch(vector) {
   1.136 -		case IA64_IPI_VECTOR:
   1.137 -			irq = per_cpu(ipi_to_irq, cpu)[IPI_VECTOR];
   1.138 -			break;
   1.139 -		case IA64_IPI_RESCHEDULE:
   1.140 -			irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR];
   1.141 -			break;
   1.142 -		case IA64_CMCP_VECTOR:
   1.143 -			irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR];
   1.144 -			break;
   1.145 -		case IA64_CPEP_VECTOR:
   1.146 -			irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR];
   1.147 -			break;
   1.148 -		default:
   1.149 -			printk(KERN_WARNING "Unsupported IPI type 0x%x\n",
   1.150 -			       vector);
   1.151 -			irq = 0;
   1.152 -			break;
   1.153 -		}		
   1.154 -	
   1.155 -		BUG_ON(irq < 0);
   1.156 -		notify_remote_via_irq(irq);
   1.157 -		return;
   1.158 -        }
   1.159 -#endif /* CONFIG_XEN */
   1.160 -
   1.161  #ifdef CONFIG_SMP
   1.162  	phys_cpu_id = cpu_physical_id(cpu);
   1.163  #else
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Tue May 08 10:39:51 2007 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Tue May 08 10:48:39 2007 -0600
     2.3 @@ -603,7 +603,10 @@ setup_arch (char **cmdline_p)
     2.4  
     2.5  	platform_setup(cmdline_p);
     2.6  #ifdef CONFIG_XEN
     2.7 -	xen_setup();
     2.8 +	if (!is_running_on_xen() && !ia64_platform_is("xen")) {
     2.9 +		extern ia64_mv_setup_t xen_setup;
    2.10 +		xen_setup(cmdline_p);
    2.11 +	}
    2.12  #endif
    2.13  	paging_init();
    2.14  #ifdef CONFIG_XEN
    2.15 @@ -993,12 +996,10 @@ cpu_init (void)
    2.16  	/* size of physical stacked register partition plus 8 bytes: */
    2.17  	__get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
    2.18  	platform_cpu_init();
    2.19 -
    2.20  #ifdef CONFIG_XEN
    2.21 -	/* Need to be moved into platform_cpu_init later */
    2.22 -	if (is_running_on_xen()) {
    2.23 -		extern void xen_smp_intr_init(void);
    2.24 -		xen_smp_intr_init();
    2.25 +	if (is_running_on_xen() && !ia64_platform_is("xen")) {
    2.26 +		extern ia64_mv_cpu_init_t xen_cpu_init;
    2.27 +		xen_cpu_init();
    2.28  	}
    2.29  #endif
    2.30  
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Tue May 08 10:39:51 2007 -0600
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Tue May 08 10:48:39 2007 -0600
     3.3 @@ -53,9 +53,13 @@ static int p2m_expose_init(void);
     3.4  
     3.5  EXPORT_SYMBOL(__hypercall);
     3.6  
     3.7 -void
     3.8 -xen_setup(void)
     3.9 +void __init
    3.10 +xen_setup(char **cmdline_p)
    3.11  {
    3.12 +	extern void dig_setup(char **cmdline_p);
    3.13 +	if (ia64_platform_is("xen"))
    3.14 +		dig_setup(cmdline_p);
    3.15 +	
    3.16  	if (!is_running_on_xen() || !is_initial_xendomain())
    3.17  		return;
    3.18  
    3.19 @@ -71,6 +75,13 @@ xen_setup(void)
    3.20  	xen_start_info->console.domU.evtchn = 0;
    3.21  }
    3.22  
    3.23 +void __cpuinit
    3.24 +xen_cpu_init(void)
    3.25 +{
    3.26 +	extern void xen_smp_intr_init(void);
    3.27 +	xen_smp_intr_init();
    3.28 +}
    3.29 +
    3.30  //XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
    3.31  // move those to lib/contiguous_bitmap?
    3.32  //XXX discontigmem/sparsemem
     4.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Tue May 08 10:39:51 2007 -0600
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Tue May 08 10:48:39 2007 -0600
     4.3 @@ -36,7 +36,6 @@
     4.4  #ifdef CONFIG_XEN
     4.5  extern int running_on_xen;
     4.6  #define is_running_on_xen()			(running_on_xen)
     4.7 -extern void xen_setup(void);
     4.8  #else /* CONFIG_XEN */
     4.9  # ifdef CONFIG_VMX_GUEST
    4.10  #  define is_running_on_xen()			(1)
    4.11 @@ -44,7 +43,6 @@ extern void xen_setup(void);
    4.12  #  define is_running_on_xen()			(0)
    4.13  #  define HYPERVISOR_ioremap(offset, size)	(offset)
    4.14  # endif /* CONFIG_VMX_GUEST */
    4.15 -#define xen_setup()				do { } while (0)
    4.16  #endif /* CONFIG_XEN */
    4.17  
    4.18  #if defined(CONFIG_XEN) || defined(CONFIG_VMX_GUEST)
     5.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h	Tue May 08 10:39:51 2007 -0600
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/machvec_xen.h	Tue May 08 10:48:39 2007 -0600
     5.3 @@ -1,7 +1,10 @@
     5.4  #ifndef _ASM_IA64_MACHVEC_XEN_h
     5.5  #define _ASM_IA64_MACHVEC_XEN_h
     5.6  
     5.7 -extern ia64_mv_setup_t			dig_setup;
     5.8 +extern ia64_mv_setup_t			xen_setup;
     5.9 +extern ia64_mv_cpu_init_t		xen_cpu_init;
    5.10 +extern ia64_mv_irq_init_t		xen_irq_init;
    5.11 +extern ia64_mv_send_ipi_t		xen_platform_send_ipi;
    5.12  extern ia64_mv_dma_alloc_coherent	xen_alloc_coherent;
    5.13  extern ia64_mv_dma_free_coherent	xen_free_coherent;
    5.14  extern ia64_mv_dma_map_single		xen_map_single;
    5.15 @@ -19,7 +22,10 @@ extern ia64_mv_dma_mapping_error	xen_dma
    5.16   * the macros are used directly.
    5.17   */
    5.18  #define platform_name				"xen"
    5.19 -#define platform_setup				dig_setup
    5.20 +#define platform_setup				xen_setup
    5.21 +#define platform_cpu_init			xen_cpu_init
    5.22 +#define platform_irq_init			xen_irq_init
    5.23 +#define platform_send_ipi			xen_platform_send_ipi
    5.24  #define platform_dma_init			machvec_noop
    5.25  #define platform_dma_alloc_coherent		xen_alloc_coherent
    5.26  #define platform_dma_free_coherent		xen_free_coherent