arm64: Move some macros under #ifndef __ASSEMBLY__
authorLaura Abbott <labbott@redhat.com>
Tue, 10 Jan 2017 21:35:47 +0000 (13:35 -0800)
committerWill Deacon <will.deacon@arm.com>
Thu, 12 Jan 2017 15:05:39 +0000 (15:05 +0000)
Several macros for various x_to_y exist outside the bounds of an
__ASSEMBLY__ guard. Move them in preparation for support for
CONFIG_DEBUG_VIRTUAL.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/memory.h

index bfe632808d7724c0a51562efb60501e67f6bf157..f80a8e403847a061887402d0ee728d394c9be364 100644 (file)
 #define KASAN_SHADOW_SIZE      (0)
 #endif
 
-/*
- * Physical vs virtual RAM address space conversion.  These are
- * private definitions which should NOT be used outside memory.h
- * files.  Use virt_to_phys/phys_to_virt/__pa/__va instead.
- */
-#define __virt_to_phys(x) ({                                           \
-       phys_addr_t __x = (phys_addr_t)(x);                             \
-       __x & BIT(VA_BITS - 1) ? (__x & ~PAGE_OFFSET) + PHYS_OFFSET :   \
-                                (__x - kimage_voffset); })
-
-#define __phys_to_virt(x)      ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)
-#define __phys_to_kimg(x)      ((unsigned long)((x) + kimage_voffset))
-
-/*
- * Convert a page to/from a physical address
- */
-#define page_to_phys(page)     (__pfn_to_phys(page_to_pfn(page)))
-#define phys_to_page(phys)     (pfn_to_page(__phys_to_pfn(phys)))
-
 /*
  * Memory types available.
  */
@@ -186,6 +167,25 @@ static inline unsigned long kaslr_offset(void)
  */
 #define PHYS_PFN_OFFSET        (PHYS_OFFSET >> PAGE_SHIFT)
 
+/*
+ * Physical vs virtual RAM address space conversion.  These are
+ * private definitions which should NOT be used outside memory.h
+ * files.  Use virt_to_phys/phys_to_virt/__pa/__va instead.
+ */
+#define __virt_to_phys(x) ({                                           \
+       phys_addr_t __x = (phys_addr_t)(x);                             \
+       __x & BIT(VA_BITS - 1) ? (__x & ~PAGE_OFFSET) + PHYS_OFFSET :   \
+                                (__x - kimage_voffset); })
+
+#define __phys_to_virt(x)      ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)
+#define __phys_to_kimg(x)      ((unsigned long)((x) + kimage_voffset))
+
+/*
+ * Convert a page to/from a physical address
+ */
+#define page_to_phys(page)     (__pfn_to_phys(page_to_pfn(page)))
+#define phys_to_page(phys)     (pfn_to_page(__phys_to_pfn(phys)))
+
 /*
  * Note: Drivers should NOT use these.  They are the wrong
  * translation for translating DMA addresses.  Use the driver