[IA64] fix __virt_to_maddr()

__virt_to_maddr() should be updated acording to xen relocation.

Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>

diff --git a/xen/include/asm-ia64/linux-xen/linux/efi.h 
b/xen/include/asm-ia64/linux-xen/linux/efi.h
--- a/xen/include/asm-ia64/linux-xen/linux/efi.h
+++ b/xen/include/asm-ia64/linux-xen/linux/efi.h
@@ -23,6 +23,9 @@
 
 #include <asm/page.h>
 #include <asm/system.h>
+#ifdef XEN
+#include <asm/pgtable.h>
+#endif
 
 #define EFI_SUCCESS            0
 #define EFI_LOAD_ERROR          ( 1 | (1UL << (BITS_PER_LONG-1)))
diff --git a/xen/include/asm-ia64/xenpage.h b/xen/include/asm-ia64/xenpage.h
--- a/xen/include/asm-ia64/xenpage.h
+++ b/xen/include/asm-ia64/xenpage.h
@@ -17,18 +17,22 @@ extern int ia64_mfn_valid (unsigned long
 
 #include <asm/xensystem.h>
 
-static inline unsigned long __virt_to_maddr(unsigned long va)
-{
-       if (va - KERNEL_START < xenheap_size)
-               return xen_pstart + (va - KERNEL_START);
-       else
-               /* 
-                * Because the significant 8 bits of VA are used by Xen,
-                * and xen uses cached/uncached identity mapping.
-                * IA64_MAX_PHYS_BITS can't be larger than 56
-                */
-               return (va & ((1UL << IA64_MAX_PHYS_BITS) - 1));
-}
+/*
+ * macro: avoid header inclustion hell
+ * static inline unsigned long __virt_to_maddr(unsigned long va)
+ */
+/*
+ * Because the significant 8 bits of VA are used by Xen,
+ * and xen uses cached/uncached identity mapping.
+ * IA64_MAX_PHYS_BITS can't be larger than 56
+ */
+#define __virt_to_maddr(va)                                            \
+       ({                                                              \
+               unsigned long __va__ = (va);                            \
+               (__va__ - KERNEL_START < KERNEL_TR_PAGE_SIZE) ?         \
+                       xen_pstart + (__va__ - KERNEL_START) :          \
+                       (__va__ & ((1UL << IA64_MAX_PHYS_BITS) - 1));   \
+       })
 
 #define virt_to_maddr(va)      (__virt_to_maddr((unsigned long)va))
 
[IA64] fix __virt_to_maddr()

__virt_to_maddr() should be updated acording to xen relocation.

Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>

diff --git a/xen/include/asm-ia64/linux-xen/linux/efi.h b/xen/include/asm-ia64/linux-xen/linux/efi.h
--- a/xen/include/asm-ia64/linux-xen/linux/efi.h
+++ b/xen/include/asm-ia64/linux-xen/linux/efi.h
@@ -23,6 +23,9 @@
 
 #include <asm/page.h>
 #include <asm/system.h>
+#ifdef XEN
+#include <asm/pgtable.h>
+#endif
 
 #define EFI_SUCCESS		0
 #define EFI_LOAD_ERROR          ( 1 | (1UL << (BITS_PER_LONG-1)))
diff --git a/xen/include/asm-ia64/xenpage.h b/xen/include/asm-ia64/xenpage.h
--- a/xen/include/asm-ia64/xenpage.h
+++ b/xen/include/asm-ia64/xenpage.h
@@ -17,18 +17,22 @@ extern int ia64_mfn_valid (unsigned long
 
 #include <asm/xensystem.h>
 
-static inline unsigned long __virt_to_maddr(unsigned long va)
-{
-	if (va - KERNEL_START < xenheap_size)
-		return xen_pstart + (va - KERNEL_START);
-	else
-		/* 
-		 * Because the significant 8 bits of VA are used by Xen,
-		 * and xen uses cached/uncached identity mapping.
-		 * IA64_MAX_PHYS_BITS can't be larger than 56
-		 */
-		return (va & ((1UL << IA64_MAX_PHYS_BITS) - 1));
-}
+/*
+ * macro: avoid header inclustion hell
+ * static inline unsigned long __virt_to_maddr(unsigned long va)
+ */
+/*
+ * Because the significant 8 bits of VA are used by Xen,
+ * and xen uses cached/uncached identity mapping.
+ * IA64_MAX_PHYS_BITS can't be larger than 56
+ */
+#define __virt_to_maddr(va)						\
+	({								\
+		unsigned long __va__ = (va);				\
+		(__va__ - KERNEL_START < KERNEL_TR_PAGE_SIZE) ?		\
+			xen_pstart + (__va__ - KERNEL_START) :		\
+			(__va__ & ((1UL << IA64_MAX_PHYS_BITS) - 1));	\
+	})
 
 #define virt_to_maddr(va)	(__virt_to_maddr((unsigned long)va))
 
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel

Reply via email to