[PATCH 10/15] arm: get PHYS_MASK from pgtable-hwdef.h

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

 



This allows it to be different for arm64, even with setup.h
shared.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/arm/asm/mmu.h           | 2 +-
 lib/arm/asm/page.h          | 5 ++---
 lib/arm/asm/pgtable-hwdef.h | 6 ++++++
 lib/arm/asm/setup.h         | 6 ++----
 lib/arm/mmu.c               | 1 -
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/arm/asm/mmu.h b/lib/arm/asm/mmu.h
index 1117aeaf06a57..8090a1b554820 100644
--- a/lib/arm/asm/mmu.h
+++ b/lib/arm/asm/mmu.h
@@ -5,7 +5,7 @@
  *
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
-#include <asm/page.h>
+#include <asm/setup.h>
 #include <asm/barrier.h>
 #include <alloc.h>
 
diff --git a/lib/arm/asm/page.h b/lib/arm/asm/page.h
index 304c80b9ddfd7..039e2ddfb8e0f 100644
--- a/lib/arm/asm/page.h
+++ b/lib/arm/asm/page.h
@@ -16,7 +16,7 @@
 
 #define PAGE_ALIGN(addr)	ALIGN(addr, PAGE_SIZE)
 
-#include <asm/setup.h>
+#include <alloc.h>
 
 typedef u64 pteval_t;
 typedef u64 pmdval_t;
@@ -51,6 +51,5 @@ typedef struct { pgd_t pgd; } pud_t;
 #define virt_to_pfn(kaddr)	(__pa(kaddr) >> PAGE_SHIFT)
 #define pfn_to_virt(pfn)	__va((pfn) << PAGE_SHIFT)
 
-#endif /* __ASSEMBLY__ */
-
+#endif /* !__ASSEMBLY__ */
 #endif /* _ASMARM_PAGE_H_ */
diff --git a/lib/arm/asm/pgtable-hwdef.h b/lib/arm/asm/pgtable-hwdef.h
index a2564aaca05a3..b6850f64b0f52 100644
--- a/lib/arm/asm/pgtable-hwdef.h
+++ b/lib/arm/asm/pgtable-hwdef.h
@@ -62,4 +62,10 @@
 #define PTE_EXT_NG		(_AT(pteval_t, 1) << 11)	/* nG */
 #define PTE_EXT_XN		(_AT(pteval_t, 1) << 54)	/* XN */
 
+/*
+ * 40-bit physical address supported.
+ */
+#define PHYS_MASK_SHIFT		(40)
+#define PHYS_MASK		((_AC(1, ULL) << PHYS_MASK_SHIFT) - 1)
+
 #endif /* _ASMARM_PGTABLE_HWDEF_H_ */
diff --git a/lib/arm/asm/setup.h b/lib/arm/asm/setup.h
index 3ef3b2c99a9de..450501cc6e8e3 100644
--- a/lib/arm/asm/setup.h
+++ b/lib/arm/asm/setup.h
@@ -6,7 +6,8 @@
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
 #include <libcflat.h>
-#include <alloc.h>
+#include <asm/page.h>
+#include <asm/pgtable-hwdef.h>
 
 #define NR_CPUS			8
 extern u32 cpus[NR_CPUS];
@@ -16,9 +17,6 @@ extern phys_addr_t __phys_offset, __phys_end;
 
 #define PHYS_OFFSET		(__phys_offset)
 #define PHYS_END		(__phys_end)
-#define PHYS_SHIFT		40
-#define PHYS_SIZE		(1ULL << PHYS_SHIFT)
-#define PHYS_MASK		(PHYS_SIZE - 1ULL)
 
 #define L1_CACHE_SHIFT		6
 #define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
index a42ae84bcec1f..7a975c6708de4 100644
--- a/lib/arm/mmu.c
+++ b/lib/arm/mmu.c
@@ -7,7 +7,6 @@
  */
 #include <asm/setup.h>
 #include <asm/mmu.h>
-#include <asm/pgtable-hwdef.h>
 
 static bool mmu_on;
 static pgd_t idmap[PTRS_PER_PGD] __attribute__((aligned(L1_CACHE_BYTES)));
-- 
1.9.3

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux