ia64/xen-unstable

changeset 10198:c2aedb26d124

[IA64] use is_running_on_xen()

Now xen drivers use is_running_on_xen() to check whether it runs on
xen or bare metal. There remains many if (running_on_xen) in ia64
specific codes. This patch replaces running_on_xen with is_running_on_xen()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Tue May 30 10:31:19 2006 -0600 (2006-05-30)
parents 31ffbf4116ec
children fca97f3ab031
files linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c 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/arch/ia64/xen/xenconsole.c linux-2.6-xen-sparse/include/asm-ia64/hypercall.h linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Tue May 30 10:30:12 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Tue May 30 10:31:19 2006 -0600
     1.3 @@ -171,7 +171,7 @@ static inline void xen_iosapic_write(cha
     1.4  
     1.5  static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
     1.6  {
     1.7 -	if (!running_on_xen) {
     1.8 +	if (!is_running_on_xen()) {
     1.9  		writel(reg, iosapic + IOSAPIC_REG_SELECT);
    1.10  		return readl(iosapic + IOSAPIC_WINDOW);
    1.11  	} else
    1.12 @@ -180,7 +180,7 @@ static inline unsigned int iosapic_read(
    1.13  
    1.14  static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
    1.15  {
    1.16 -	if (!running_on_xen) {
    1.17 +	if (!is_running_on_xen()) {
    1.18  		writel(reg, iosapic + IOSAPIC_REG_SELECT);
    1.19  		writel(val, iosapic + IOSAPIC_WINDOW);
    1.20  	} else
    1.21 @@ -1015,7 +1015,7 @@ iosapic_system_init (int system_pcat_com
    1.22  
    1.23  	pcat_compat = system_pcat_compat;
    1.24  #ifdef CONFIG_XEN
    1.25 -	if (running_on_xen)
    1.26 +	if (is_running_on_xen())
    1.27  		return;
    1.28  #endif
    1.29  	if (pcat_compat) {
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue May 30 10:30:12 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue May 30 10:31:19 2006 -0600
     2.3 @@ -68,7 +68,7 @@ assign_irq_vector (int irq)
     2.4  	int pos, vector;
     2.5  #ifdef CONFIG_XEN
     2.6  	extern int xen_assign_irq_vector(int);
     2.7 -	if (running_on_xen)
     2.8 +	if (is_running_on_xen())
     2.9  		return xen_assign_irq_vector(irq);
    2.10  #endif /* CONFIG_XEN */
    2.11   again:
    2.12 @@ -382,7 +382,7 @@ register_percpu_irq (ia64_vector vec, st
    2.13  	for (irq = 0; irq < NR_IRQS; ++irq)
    2.14  		if (irq_to_vector(irq) == vec) {
    2.15  #ifdef CONFIG_XEN
    2.16 -			if (running_on_xen)
    2.17 +			if (is_running_on_xen())
    2.18  				return xen_register_percpu_irq(vec, action, 1);
    2.19  #endif
    2.20  			desc = irq_descp(irq);
    2.21 @@ -428,7 +428,7 @@ ia64_send_ipi (int cpu, int vector, int 
    2.22  	unsigned long phys_cpu_id;
    2.23  
    2.24  #ifdef CONFIG_XEN
    2.25 -        if (running_on_xen) {
    2.26 +        if (is_running_on_xen()) {
    2.27  		int irq = -1;
    2.28  
    2.29  		/* TODO: we need to call vcpu_up here */
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Tue May 30 10:30:12 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Tue May 30 10:31:19 2006 -0600
     3.3 @@ -248,7 +248,7 @@ reserve_memory (void)
     3.4  	n++;
     3.5  
     3.6  #ifdef CONFIG_XEN
     3.7 -	if (running_on_xen) {
     3.8 +	if (is_running_on_xen()) {
     3.9  		rsvd_region[n].start = (unsigned long)__va((HYPERVISOR_shared_info->arch.start_info_pfn << PAGE_SHIFT));
    3.10  		rsvd_region[n].end   = rsvd_region[n].start + PAGE_SIZE;
    3.11  		n++;
    3.12 @@ -411,7 +411,7 @@ setup_arch (char **cmdline_p)
    3.13  {
    3.14  	unw_init();
    3.15  #ifdef CONFIG_XEN
    3.16 -	if (running_on_xen)
    3.17 +	if (is_running_on_xen())
    3.18  		setup_xen_features();
    3.19  #endif
    3.20  
    3.21 @@ -512,7 +512,7 @@ setup_arch (char **cmdline_p)
    3.22  # endif
    3.23  	}
    3.24  #ifdef CONFIG_XEN
    3.25 -	if (running_on_xen) {
    3.26 +	if (is_running_on_xen()) {
    3.27  		extern shared_info_t *HYPERVISOR_shared_info;
    3.28  		extern int xen_init (void);
    3.29  
     4.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Tue May 30 10:30:12 2006 -0600
     4.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Tue May 30 10:31:19 2006 -0600
     4.3 @@ -672,7 +672,7 @@ privcmd_mmap(struct file * file, struct 
     4.4  	struct xen_ia64_privcmd_vma* privcmd_vma = NULL;
     4.5  	struct resource* res = NULL;
     4.6  	unsigned long i;
     4.7 -	BUG_ON(!running_on_xen);
     4.8 +	BUG_ON(!is_running_on_xen());
     4.9  
    4.10  	BUG_ON(file->private_data != NULL);
    4.11  
    4.12 @@ -737,7 +737,7 @@ direct_remap_pfn_range(struct vm_area_st
    4.13  	unsigned long i;
    4.14  	unsigned long offset;
    4.15  	int error = 0;
    4.16 -	BUG_ON(!running_on_xen);
    4.17 +	BUG_ON(!is_running_on_xen());
    4.18  
    4.19  #if 0
    4.20  	if (prot != vm->vm_page_prot) {
     5.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c	Tue May 30 10:30:12 2006 -0600
     5.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c	Tue May 30 10:31:19 2006 -0600
     5.3 @@ -1,13 +1,13 @@
     5.4  #include <linux/config.h>
     5.5  #include <linux/console.h>
     5.6 +#include <asm/hypervisor.h>
     5.7  
     5.8  int
     5.9  early_xen_console_setup (char *cmdline)
    5.10  {
    5.11  #ifdef CONFIG_XEN
    5.12  #ifndef CONFIG_IA64_HP_SIM
    5.13 -	extern int running_on_xen;
    5.14 -	if (running_on_xen) {
    5.15 +	if (is_running_on_xen()) {
    5.16  		extern struct console hpsim_cons;
    5.17  		hpsim_cons.flags |= CON_BOOT;
    5.18  		register_console(&hpsim_cons);
     6.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Tue May 30 10:30:12 2006 -0600
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Tue May 30 10:31:19 2006 -0600
     6.3 @@ -429,7 +429,7 @@ static inline unsigned long
     6.4  HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
     6.5  {
     6.6  	unsigned long ret = ioaddr;
     6.7 -	if (running_on_xen) {
     6.8 +	if (is_running_on_xen()) {
     6.9  		ret = __HYPERVISOR_ioremap(ioaddr, size);
    6.10  		if (unlikely(ret == -ENOSYS))
    6.11  			panic("hypercall %s failed with %ld. "
    6.12 @@ -452,7 +452,7 @@ static inline unsigned long
    6.13  HYPERVISOR_phystomach(unsigned long gpfn)
    6.14  {
    6.15  	unsigned long ret = gpfn;
    6.16 -	if (running_on_xen) {
    6.17 +	if (is_running_on_xen()) {
    6.18  		ret = __HYPERVISOR_phystomach(gpfn);
    6.19  	}
    6.20  	return ret;
    6.21 @@ -469,7 +469,7 @@ static inline unsigned long
    6.22  HYPERVISOR_machtophys(unsigned long mfn)
    6.23  {
    6.24  	unsigned long ret = mfn;
    6.25 -	if (running_on_xen) {
    6.26 +	if (is_running_on_xen()) {
    6.27  		ret = __HYPERVISOR_machtophys(mfn);
    6.28  	}
    6.29  	return ret;
    6.30 @@ -486,7 +486,7 @@ static inline unsigned long
    6.31  HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
    6.32  {
    6.33  	unsigned long ret = 0;
    6.34 -	if (running_on_xen) {
    6.35 +	if (is_running_on_xen()) {
    6.36  		ret = __HYPERVISOR_zap_physmap(gpfn, extent_order);
    6.37  	}
    6.38  	return ret;
    6.39 @@ -506,8 +506,8 @@ HYPERVISOR_add_physmap(unsigned long gpf
    6.40  		       unsigned long flags, domid_t domid)
    6.41  {
    6.42  	unsigned long ret = 0;
    6.43 -	BUG_ON(!running_on_xen);//XXX
    6.44 -	if (running_on_xen) {
    6.45 +	BUG_ON(!is_running_on_xen());//XXX
    6.46 +	if (is_running_on_xen()) {
    6.47  		ret = __HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
    6.48  	}
    6.49  	return ret;
     7.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Tue May 30 10:30:12 2006 -0600
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Tue May 30 10:31:19 2006 -0600
     7.3 @@ -46,15 +46,13 @@
     7.4  #include <asm/hypercall.h>
     7.5  #include <asm/ptrace.h>
     7.6  #include <asm/page.h>
     7.7 -#include <asm/xen/privop.h> // for running_on_xen
     7.8 +#include <asm/xen/privop.h> // for is_running_on_xen()
     7.9  
    7.10  extern shared_info_t *HYPERVISOR_shared_info;
    7.11  extern start_info_t *xen_start_info;
    7.12  
    7.13  void force_evtchn_callback(void);
    7.14  
    7.15 -#define is_running_on_xen() running_on_xen
    7.16 -
    7.17  /* Turn jiffies into Xen system time. XXX Implement me. */
    7.18  #define jiffies_to_st(j)	0
    7.19  
     8.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Tue May 30 10:30:12 2006 -0600
     8.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Tue May 30 10:31:19 2006 -0600
     8.3 @@ -43,6 +43,7 @@
     8.4  
     8.5  #ifndef __ASSEMBLY__
     8.6  extern int running_on_xen;
     8.7 +#define is_running_on_xen() running_on_xen
     8.8  
     8.9  #define	XEN_HYPER_SSM_I		asm("break %0" : : "i" (HYPERPRIVOP_SSM_I))
    8.10  #define	XEN_HYPER_GET_IVR	asm("break %0" : : "i" (HYPERPRIVOP_GET_IVR))
    8.11 @@ -122,7 +123,7 @@ extern void xen_set_eflag(unsigned long)
    8.12  
    8.13  #define xen_ia64_intrin_local_irq_restore(x)				\
    8.14  {									\
    8.15 -     if (running_on_xen) {						\
    8.16 +     if (is_running_on_xen()) {						\
    8.17  	if ((x) & IA64_PSR_I) { xen_ssm_i(); }				\
    8.18  	else { xen_rsm_i(); }						\
    8.19      }									\
    8.20 @@ -131,7 +132,7 @@ extern void xen_set_eflag(unsigned long)
    8.21  
    8.22  #define	xen_get_psr_i()							\
    8.23  (									\
    8.24 -	(running_on_xen) ?						\
    8.25 +	(is_running_on_xen()) ?						\
    8.26  		(xen_get_virtual_psr_i() ? IA64_PSR_I : 0)		\
    8.27  		: __ia64_get_psr_i()					\
    8.28  )
    8.29 @@ -139,7 +140,7 @@ extern void xen_set_eflag(unsigned long)
    8.30  #define xen_ia64_ssm(mask)						\
    8.31  {									\
    8.32  	if ((mask)==IA64_PSR_I) {					\
    8.33 -		if (running_on_xen) { xen_ssm_i(); }			\
    8.34 +		if (is_running_on_xen()) { xen_ssm_i(); }			\
    8.35  		else { __ia64_ssm(mask); }				\
    8.36  	}								\
    8.37  	else { __ia64_ssm(mask); }					\
    8.38 @@ -148,7 +149,7 @@ extern void xen_set_eflag(unsigned long)
    8.39  #define xen_ia64_rsm(mask)						\
    8.40  {									\
    8.41  	if ((mask)==IA64_PSR_I) {					\
    8.42 -		if (running_on_xen) { xen_rsm_i(); }			\
    8.43 +		if (is_running_on_xen()) { xen_rsm_i(); }			\
    8.44  		else { __ia64_rsm(mask); }				\
    8.45  	}								\
    8.46  	else { __ia64_rsm(mask); }					\
    8.47 @@ -168,9 +169,9 @@ extern void xen_set_rr(unsigned long ind
    8.48  extern unsigned long xen_get_rr(unsigned long index);
    8.49  extern void xen_set_kr(unsigned long index, unsigned long val);
    8.50  
    8.51 -/* Note: It may look wrong to test for running_on_xen in each case.
    8.52 +/* Note: It may look wrong to test for is_running_on_xen() in each case.
    8.53   * However regnum is always a constant so, as written, the compiler
    8.54 - * eliminates the switch statement, whereas running_on_xen must be
    8.55 + * eliminates the switch statement, whereas is_running_on_xen() must be
    8.56   * tested dynamically. */
    8.57  #define xen_ia64_getreg(regnum)						\
    8.58  ({									\
    8.59 @@ -178,17 +179,17 @@ extern void xen_set_kr(unsigned long ind
    8.60  									\
    8.61  	switch(regnum) {						\
    8.62  	case _IA64_REG_CR_IVR:						\
    8.63 -		ia64_intri_res = (running_on_xen) ?			\
    8.64 +		ia64_intri_res = (is_running_on_xen()) ?			\
    8.65  			xen_get_ivr() :					\
    8.66  			__ia64_getreg(regnum);				\
    8.67  		break;							\
    8.68  	case _IA64_REG_CR_TPR:						\
    8.69 -		ia64_intri_res = (running_on_xen) ?			\
    8.70 +		ia64_intri_res = (is_running_on_xen()) ?			\
    8.71  			xen_get_tpr() :					\
    8.72  			__ia64_getreg(regnum);				\
    8.73  		break;							\
    8.74  	case _IA64_REG_AR_EFLAG:					\
    8.75 -		ia64_intri_res = (running_on_xen) ?			\
    8.76 +		ia64_intri_res = (is_running_on_xen()) ?			\
    8.77  			xen_get_eflag() :				\
    8.78  			__ia64_getreg(regnum);				\
    8.79  		break;							\
    8.80 @@ -203,27 +204,27 @@ extern void xen_set_kr(unsigned long ind
    8.81  ({									\
    8.82  	switch(regnum) {						\
    8.83  	case _IA64_REG_AR_KR0 ... _IA64_REG_AR_KR7:			\
    8.84 -		(running_on_xen) ?					\
    8.85 +		(is_running_on_xen()) ?					\
    8.86  			xen_set_kr((regnum-_IA64_REG_AR_KR0), val) :	\
    8.87  			__ia64_setreg(regnum,val);			\
    8.88  		break;							\
    8.89  	case _IA64_REG_CR_ITM:						\
    8.90 -		(running_on_xen) ?					\
    8.91 +		(is_running_on_xen()) ?					\
    8.92  			xen_set_itm(val) :				\
    8.93  			__ia64_setreg(regnum,val);			\
    8.94  		break;							\
    8.95  	case _IA64_REG_CR_TPR:						\
    8.96 -		(running_on_xen) ?					\
    8.97 +		(is_running_on_xen()) ?					\
    8.98  			xen_set_tpr(val) :				\
    8.99  			__ia64_setreg(regnum,val);			\
   8.100  		break;							\
   8.101  	case _IA64_REG_CR_EOI:						\
   8.102 -		(running_on_xen) ?					\
   8.103 +		(is_running_on_xen()) ?					\
   8.104  			xen_eoi() :					\
   8.105  			__ia64_setreg(regnum,val);			\
   8.106  		break;							\
   8.107  	case _IA64_REG_AR_EFLAG:					\
   8.108 -		(running_on_xen) ?					\
   8.109 +		(is_running_on_xen()) ?					\
   8.110  			xen_set_eflag(val) :				\
   8.111  			__ia64_setreg(regnum,val);			\
   8.112  		break;							\