@@ -16,8 +16,10 @@
#if defined(CONFIG_MMU)
# include <asm/mmu/mm.h>
-#elif !defined(CONFIG_MPU)
-# error "Unknown memory management layout"
+#elif defined(CONFIG_MPU)
+# include <asm/mpu/mm.h>
+#else
+#error "Unknown memory management layout"
#endif
/* Align Xen to a 2 MiB boundary. */
@@ -261,10 +263,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)
/* Page-align address and convert to frame number format */
#define paddr_to_pfn_aligned(paddr) paddr_to_pfn(PAGE_ALIGN(paddr))
-#define virt_to_maddr(va) ({ \
- vaddr_t va_ = (vaddr_t)(va); \
- (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \
-})
+#if defined(CONFIG_MMU)
#ifdef CONFIG_ARM_32
/**
@@ -310,6 +309,8 @@ static inline void *maddr_to_virt(paddr_t ma)
}
#endif
+#endif /* CONFIG_MMU */
+
/*
* Translate a guest virtual address to a machine address.
* Return the fault information if the translation has failed else 0.
@@ -2,6 +2,8 @@
#ifndef __ARM_MMU_MM_H__
#define __ARM_MMU_MM_H__
+#include <asm/page.h>
+
/* Non-boot CPUs use this to find the correct pagetables. */
extern uint64_t init_ttbr;
@@ -14,6 +16,11 @@ extern unsigned long directmap_base_pdx;
#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+#define virt_to_maddr(va) ({ \
+ vaddr_t va_ = (vaddr_t)(va); \
+ (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \
+})
+
/*
* Print a walk of a page table or p2m
*
new file mode 100644
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ARM_MPU_MM__
+#define __ARM_MPU_MM__
+
+#include <xen/macros.h>
+
+#define virt_to_maddr(va) ({ \
+ (paddr_t)va; \
+})
+
+/* On MPU systems there is no translation, ma == va. */
+static inline void *maddr_to_virt(paddr_t ma)
+{
+ return _p(ma);
+}
+
+#endif /* __ARM_MPU_MM__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */