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

[Xen-changelog] [linux-2.6.18-xen] [IA64] Make some of xen hyperprivops transparent



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1183667819 21600
# Node ID e9426682eb0c31a8a4d25363eb2d180f493d01d5
# Parent  b13d92a565ba38cd2101f4d840190d7d116c82a3
[IA64] Make some of xen hyperprivops transparent

Some of definitions of xen hyperprivops aren't transparent.
This patch fixes them.  While this is done in assembler code
long before, But I chose the easy C version because binary
patching woule eliminate the overhead.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 include/asm-ia64/xen/privop.h |   75 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 65 insertions(+), 10 deletions(-)

diff -r b13d92a565ba -r e9426682eb0c include/asm-ia64/xen/privop.h
--- a/include/asm-ia64/xen/privop.h     Thu Jul 05 14:33:49 2007 -0600
+++ b/include/asm-ia64/xen/privop.h     Thu Jul 05 14:36:59 2007 -0600
@@ -101,8 +101,24 @@ extern unsigned long xen_thash(unsigned 
 extern unsigned long xen_thash(unsigned long addr);
 #endif
 
-#define ia64_fc(addr)                  xen_fc((unsigned long)(addr))
-#define ia64_thash(addr)               xen_thash((unsigned long)(addr))
+#define ia64_fc(addr)                                                  \
+do {                                                                   \
+       if (is_running_on_xen())                                        \
+               xen_fc((unsigned long)(addr));                          \
+       else                                                            \
+               __ia64_fc(addr);                                        \
+} while (0)
+
+#define ia64_thash(addr)                                               \
+({                                                                     \
+       unsigned long ia64_intri_res;                                   \
+       if (is_running_on_xen())                                        \
+               ia64_intri_res =                                        \
+                       xen_thash((unsigned long)(addr));               \
+       else                                                            \
+               ia64_intri_res = __ia64_thash(addr);                    \
+       ia64_intri_res;                                                 \
+})
 
 /* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
  * is not currently used (though it may be in a long-format VHPT system!)
@@ -138,9 +154,25 @@ extern unsigned long xen_get_pmd(int ind
 extern unsigned long xen_get_pmd(int index);
 #endif
 
-#define        ia64_get_cpuid(i)               xen_get_cpuid(i)
-#define        ia64_get_pmd(i)                 xen_get_pmd(i)
-
+#define ia64_get_cpuid(i)                                              \
+({                                                                     \
+       unsigned long ia64_intri_res;                                   \
+       if (is_running_on_xen())                                        \
+               ia64_intri_res = xen_get_cpuid(i);                      \
+       else                                                            \
+               ia64_intri_res = __ia64_get_cpuid(i);                   \
+       ia64_intri_res;                                                 \
+})
+
+#define ia64_get_pmd(i)                                                \
+({                                                                     \
+       unsigned long ia64_intri_res;                                   \
+       if (is_running_on_xen())                                        \
+               ia64_intri_res = xen_get_pmd(i);                        \
+       else                                                            \
+               ia64_intri_res = __ia64_get_pmd(i);                     \
+       ia64_intri_res;                                                 \
+})
 
 #ifdef ASM_SUPPORTED
 static inline unsigned long
@@ -424,14 +456,37 @@ xen_set_kr(unsigned long index, unsigned
        }                                                               \
 })
 
+#define ia64_ptcga(addr, size)                                         \
+do {                                                                   \
+       if (is_running_on_xen())                                        \
+               xen_ptcga((addr), (size));                              \
+       else                                                            \
+               __ia64_ptcga((addr), (size));                           \
+} while (0)
+
+#define ia64_set_rr(index, val)                                                
\
+do {                                                                   \
+       if (is_running_on_xen())                                        \
+               xen_set_rr((index), (val));                             \
+       else                                                            \
+               __ia64_set_rr((index), (val));                          \
+} while (0)
+
+#define ia64_get_rr(index)                                             \
+({                                                                     \
+       __u64 ia64_intri_res;                                           \
+       if (is_running_on_xen())                                        \
+               ia64_intri_res = xen_get_rr((index));                   \
+       else                                                            \
+               ia64_intri_res = __ia64_get_rr((index));                \
+       ia64_intri_res;                                                 \
+})
+
+#define ia64_getreg                    xen_ia64_getreg
+#define ia64_setreg                    xen_ia64_setreg
 #define ia64_ssm                       xen_ia64_ssm
 #define ia64_rsm                       xen_ia64_rsm
 #define ia64_intrin_local_irq_restore  xen_ia64_intrin_local_irq_restore
-#define        ia64_ptcga                      xen_ptcga
-#define        ia64_set_rr(index,val)          xen_set_rr(index,val)
-#define        ia64_get_rr(index)              xen_get_rr(index)
-#define ia64_getreg                    xen_ia64_getreg
-#define ia64_setreg                    xen_ia64_setreg
 #define        ia64_get_psr_i                  xen_get_psr_i
 
 /* the remainder of these are not performance-sensitive so its

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