Mailing List Archive

[IA64] use is_running_on_xen()
# HG changeset patch
# User awilliam@xenbuild.aw
# Node ID c2aedb26d1240a80756ecea222aa3c4a84b7074f
# Parent 31ffbf4116ecc9265c013471eef7fc0a38fcfcf8
[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>
---
linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c | 6 ++--
linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c | 6 ++--
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c | 6 ++--
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c | 4 +-
linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c | 4 +-
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h | 12 ++++----
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h | 4 --
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h | 29 ++++++++++-----------
8 files changed, 35 insertions(+), 36 deletions(-)

diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c Tue May 30 10:31:19 2006 -0600
@@ -171,7 +171,7 @@ static inline void xen_iosapic_write(cha

static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
{
- if (!running_on_xen) {
+ if (!is_running_on_xen()) {
writel(reg, iosapic + IOSAPIC_REG_SELECT);
return readl(iosapic + IOSAPIC_WINDOW);
} else
@@ -180,7 +180,7 @@ static inline unsigned int iosapic_read(

static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
{
- if (!running_on_xen) {
+ if (!is_running_on_xen()) {
writel(reg, iosapic + IOSAPIC_REG_SELECT);
writel(val, iosapic + IOSAPIC_WINDOW);
} else
@@ -1015,7 +1015,7 @@ iosapic_system_init (int system_pcat_com

pcat_compat = system_pcat_compat;
#ifdef CONFIG_XEN
- if (running_on_xen)
+ if (is_running_on_xen())
return;
#endif
if (pcat_compat) {
diff -r 31ffbf4116ec -r c2aedb26d124 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 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Tue May 30 10:31:19 2006 -0600
@@ -68,7 +68,7 @@ assign_irq_vector (int irq)
int pos, vector;
#ifdef CONFIG_XEN
extern int xen_assign_irq_vector(int);
- if (running_on_xen)
+ if (is_running_on_xen())
return xen_assign_irq_vector(irq);
#endif /* CONFIG_XEN */
again:
@@ -382,7 +382,7 @@ register_percpu_irq (ia64_vector vec, st
for (irq = 0; irq < NR_IRQS; ++irq)
if (irq_to_vector(irq) == vec) {
#ifdef CONFIG_XEN
- if (running_on_xen)
+ if (is_running_on_xen())
return xen_register_percpu_irq(vec, action, 1);
#endif
desc = irq_descp(irq);
@@ -428,7 +428,7 @@ ia64_send_ipi (int cpu, int vector, int
unsigned long phys_cpu_id;

#ifdef CONFIG_XEN
- if (running_on_xen) {
+ if (is_running_on_xen()) {
int irq = -1;

/* TODO: we need to call vcpu_up here */
diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Tue May 30 10:31:19 2006 -0600
@@ -248,7 +248,7 @@ reserve_memory (void)
n++;

#ifdef CONFIG_XEN
- if (running_on_xen) {
+ if (is_running_on_xen()) {
rsvd_region[n].start = (unsigned long)__va((HYPERVISOR_shared_info->arch.start_info_pfn << PAGE_SHIFT));
rsvd_region[n].end = rsvd_region[n].start + PAGE_SIZE;
n++;
@@ -411,7 +411,7 @@ setup_arch (char **cmdline_p)
{
unw_init();
#ifdef CONFIG_XEN
- if (running_on_xen)
+ if (is_running_on_xen())
setup_xen_features();
#endif

@@ -512,7 +512,7 @@ setup_arch (char **cmdline_p)
# endif
}
#ifdef CONFIG_XEN
- if (running_on_xen) {
+ if (is_running_on_xen()) {
extern shared_info_t *HYPERVISOR_shared_info;
extern int xen_init (void);

diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c Tue May 30 10:31:19 2006 -0600
@@ -672,7 +672,7 @@ privcmd_mmap(struct file * file, struct
struct xen_ia64_privcmd_vma* privcmd_vma = NULL;
struct resource* res = NULL;
unsigned long i;
- BUG_ON(!running_on_xen);
+ BUG_ON(!is_running_on_xen());

BUG_ON(file->private_data != NULL);

@@ -737,7 +737,7 @@ direct_remap_pfn_range(struct vm_area_st
unsigned long i;
unsigned long offset;
int error = 0;
- BUG_ON(!running_on_xen);
+ BUG_ON(!is_running_on_xen());

#if 0
if (prot != vm->vm_page_prot) {
diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c Tue May 30 10:31:19 2006 -0600
@@ -1,13 +1,13 @@
#include <linux/config.h>
#include <linux/console.h>
+#include <asm/hypervisor.h>

int
early_xen_console_setup (char *cmdline)
{
#ifdef CONFIG_XEN
#ifndef CONFIG_IA64_HP_SIM
- extern int running_on_xen;
- if (running_on_xen) {
+ if (is_running_on_xen()) {
extern struct console hpsim_cons;
hpsim_cons.flags |= CON_BOOT;
register_console(&hpsim_cons);
diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Tue May 30 10:31:19 2006 -0600
@@ -429,7 +429,7 @@ HYPERVISOR_ioremap(unsigned long ioaddr,
HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
{
unsigned long ret = ioaddr;
- if (running_on_xen) {
+ if (is_running_on_xen()) {
ret = __HYPERVISOR_ioremap(ioaddr, size);
if (unlikely(ret == -ENOSYS))
panic("hypercall %s failed with %ld. "
@@ -452,7 +452,7 @@ HYPERVISOR_phystomach(unsigned long gpfn
HYPERVISOR_phystomach(unsigned long gpfn)
{
unsigned long ret = gpfn;
- if (running_on_xen) {
+ if (is_running_on_xen()) {
ret = __HYPERVISOR_phystomach(gpfn);
}
return ret;
@@ -469,7 +469,7 @@ HYPERVISOR_machtophys(unsigned long mfn)
HYPERVISOR_machtophys(unsigned long mfn)
{
unsigned long ret = mfn;
- if (running_on_xen) {
+ if (is_running_on_xen()) {
ret = __HYPERVISOR_machtophys(mfn);
}
return ret;
@@ -486,7 +486,7 @@ HYPERVISOR_zap_physmap(unsigned long gpf
HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
{
unsigned long ret = 0;
- if (running_on_xen) {
+ if (is_running_on_xen()) {
ret = __HYPERVISOR_zap_physmap(gpfn, extent_order);
}
return ret;
@@ -506,8 +506,8 @@ HYPERVISOR_add_physmap(unsigned long gpf
unsigned long flags, domid_t domid)
{
unsigned long ret = 0;
- BUG_ON(!running_on_xen);//XXX
- if (running_on_xen) {
+ BUG_ON(!is_running_on_xen());//XXX
+ if (is_running_on_xen()) {
ret = __HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
}
return ret;
diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Tue May 30 10:31:19 2006 -0600
@@ -46,14 +46,12 @@
#include <asm/hypercall.h>
#include <asm/ptrace.h>
#include <asm/page.h>
-#include <asm/xen/privop.h> // for running_on_xen
+#include <asm/xen/privop.h> // for is_running_on_xen()

extern shared_info_t *HYPERVISOR_shared_info;
extern start_info_t *xen_start_info;

void force_evtchn_callback(void);
-
-#define is_running_on_xen() running_on_xen

/* Turn jiffies into Xen system time. XXX Implement me. */
#define jiffies_to_st(j) 0
diff -r 31ffbf4116ec -r c2aedb26d124 linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h Tue May 30 10:30:12 2006 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h Tue May 30 10:31:19 2006 -0600
@@ -43,6 +43,7 @@

#ifndef __ASSEMBLY__
extern int running_on_xen;
+#define is_running_on_xen() running_on_xen

#define XEN_HYPER_SSM_I asm("break %0" : : "i" (HYPERPRIVOP_SSM_I))
#define XEN_HYPER_GET_IVR asm("break %0" : : "i" (HYPERPRIVOP_GET_IVR))
@@ -122,7 +123,7 @@ extern void xen_set_eflag(unsigned long)

#define xen_ia64_intrin_local_irq_restore(x) \
{ \
- if (running_on_xen) { \
+ if (is_running_on_xen()) { \
if ((x) & IA64_PSR_I) { xen_ssm_i(); } \
else { xen_rsm_i(); } \
} \
@@ -131,7 +132,7 @@ extern void xen_set_eflag(unsigned long)

#define xen_get_psr_i() \
( \
- (running_on_xen) ? \
+ (is_running_on_xen()) ? \
(xen_get_virtual_psr_i() ? IA64_PSR_I : 0) \
: __ia64_get_psr_i() \
)
@@ -139,7 +140,7 @@ extern void xen_set_eflag(unsigned long)
#define xen_ia64_ssm(mask) \
{ \
if ((mask)==IA64_PSR_I) { \
- if (running_on_xen) { xen_ssm_i(); } \
+ if (is_running_on_xen()) { xen_ssm_i(); } \
else { __ia64_ssm(mask); } \
} \
else { __ia64_ssm(mask); } \
@@ -148,7 +149,7 @@ extern void xen_set_eflag(unsigned long)
#define xen_ia64_rsm(mask) \
{ \
if ((mask)==IA64_PSR_I) { \
- if (running_on_xen) { xen_rsm_i(); } \
+ if (is_running_on_xen()) { xen_rsm_i(); } \
else { __ia64_rsm(mask); } \
} \
else { __ia64_rsm(mask); } \
@@ -168,9 +169,9 @@ extern unsigned long xen_get_rr(unsigned
extern unsigned long xen_get_rr(unsigned long index);
extern void xen_set_kr(unsigned long index, unsigned long val);

-/* Note: It may look wrong to test for running_on_xen in each case.
+/* Note: It may look wrong to test for is_running_on_xen() in each case.
* However regnum is always a constant so, as written, the compiler
- * eliminates the switch statement, whereas running_on_xen must be
+ * eliminates the switch statement, whereas is_running_on_xen() must be
* tested dynamically. */
#define xen_ia64_getreg(regnum) \
({ \
@@ -178,17 +179,17 @@ extern void xen_set_kr(unsigned long ind
\
switch(regnum) { \
case _IA64_REG_CR_IVR: \
- ia64_intri_res = (running_on_xen) ? \
+ ia64_intri_res = (is_running_on_xen()) ? \
xen_get_ivr() : \
__ia64_getreg(regnum); \
break; \
case _IA64_REG_CR_TPR: \
- ia64_intri_res = (running_on_xen) ? \
+ ia64_intri_res = (is_running_on_xen()) ? \
xen_get_tpr() : \
__ia64_getreg(regnum); \
break; \
case _IA64_REG_AR_EFLAG: \
- ia64_intri_res = (running_on_xen) ? \
+ ia64_intri_res = (is_running_on_xen()) ? \
xen_get_eflag() : \
__ia64_getreg(regnum); \
break; \
@@ -203,27 +204,27 @@ extern void xen_set_kr(unsigned long ind
({ \
switch(regnum) { \
case _IA64_REG_AR_KR0 ... _IA64_REG_AR_KR7: \
- (running_on_xen) ? \
+ (is_running_on_xen()) ? \
xen_set_kr((regnum-_IA64_REG_AR_KR0), val) : \
__ia64_setreg(regnum,val); \
break; \
case _IA64_REG_CR_ITM: \
- (running_on_xen) ? \
+ (is_running_on_xen()) ? \
xen_set_itm(val) : \
__ia64_setreg(regnum,val); \
break; \
case _IA64_REG_CR_TPR: \
- (running_on_xen) ? \
+ (is_running_on_xen()) ? \
xen_set_tpr(val) : \
__ia64_setreg(regnum,val); \
break; \
case _IA64_REG_CR_EOI: \
- (running_on_xen) ? \
+ (is_running_on_xen()) ? \
xen_eoi() : \
__ia64_setreg(regnum,val); \
break; \
case _IA64_REG_AR_EFLAG: \
- (running_on_xen) ? \
+ (is_running_on_xen()) ? \
xen_set_eflag(val) : \
__ia64_setreg(regnum,val); \
break; \

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