]> xenbits.xensource.com Git - xen.git/commitdiff
arm/mpu: Create the skeleton for MPU compilation
authorLuca Fancellu <luca.fancellu@arm.com>
Tue, 1 Apr 2025 08:58:58 +0000 (09:58 +0100)
committerMichal Orzel <michal.orzel@amd.com>
Wed, 2 Apr 2025 09:15:10 +0000 (11:15 +0200)
This commit introduces the skeleton for the MPU memory management
subsystem that allows the compilation on Arm64.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
xen/arch/arm/arm64/mpu/Makefile
xen/arch/arm/arm64/mpu/p2m.c [new file with mode: 0644]
xen/arch/arm/arm64/mpu/smpboot.c [new file with mode: 0644]
xen/arch/arm/include/asm/mpu/p2m.h [new file with mode: 0644]
xen/arch/arm/include/asm/p2m.h
xen/arch/arm/mpu/Makefile
xen/arch/arm/mpu/mm.c
xen/arch/arm/mpu/p2m.c [new file with mode: 0644]
xen/arch/arm/mpu/setup.c [new file with mode: 0644]
xen/arch/arm/mpu/vmap.c [new file with mode: 0644]

index 3340058c08c662fef193595cea7aeba62a25b210..cf0540aecc8446468b9942f3074e515e579816f8 100644 (file)
@@ -1 +1,3 @@
 obj-y += head.o
+obj-y += p2m.o
+obj-y += smpboot.o
diff --git a/xen/arch/arm/arm64/mpu/p2m.c b/xen/arch/arm/arm64/mpu/p2m.c
new file mode 100644 (file)
index 0000000..b6d8b27
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/init.h>
+#include <asm/p2m.h>
+
+void __init setup_virt_paging(void)
+{
+    BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/arm64/mpu/smpboot.c b/xen/arch/arm/arm64/mpu/smpboot.c
new file mode 100644 (file)
index 0000000..5090f44
--- /dev/null
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/errno.h>
+#include <xen/mm.h>
+#include <xen/stdbool.h>
+
+int prepare_secondary_mm(int cpu)
+{
+    BUG_ON("unimplemented");
+    return -EINVAL;
+}
+
+void update_boot_mapping(bool enable)
+{
+    BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/mpu/p2m.h b/xen/arch/arm/include/asm/mpu/p2m.h
new file mode 100644 (file)
index 0000000..e46d9e7
--- /dev/null
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ARM_MPU_P2M_H__
+#define __ARM_MPU_P2M_H__
+
+struct p2m_domain;
+
+static inline void p2m_clear_root_pages(struct p2m_domain *p2m) {}
+
+static inline void p2m_tlb_flush_sync(struct p2m_domain *p2m) {}
+
+#endif /* __ARM_MPU_P2M_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
index 594dc40041387fd819813648e87c2017d2d96770..2d53bf9b617745c2473e55c46bd6b54cdee0c84d 100644 (file)
@@ -168,7 +168,7 @@ typedef enum {
 #if defined(CONFIG_MMU)
 # include <asm/mmu/p2m.h>
 #else
-# error "Unknown memory management layout"
+# include <asm/mpu/p2m.h>
 #endif
 
 static inline bool arch_acquire_resource_check(struct domain *d)
index b18cec4836716700d57f17a6c588b83574ef06b6..21bbc517b51aa01846420ac9b209903383ac9dfc 100644 (file)
@@ -1 +1,4 @@
 obj-y += mm.o
+obj-y += p2m.o
+obj-y += setup.init.o
+obj-y += vmap.o
index 4e9a2405d8c5fee8440d972154dd7fabd4d90677..07c8959f4ee916240b44414da544c545a9f09ce7 100644 (file)
@@ -1,9 +1,12 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bug.h>
+#include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/mm.h>
 #include <xen/sizes.h>
+#include <xen/types.h>
 
 struct page_info *frame_table;
 
@@ -17,6 +20,28 @@ static void __init __maybe_unused build_assertions(void)
     BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
 }
 
+void __init setup_mm(void)
+{
+    BUG_ON("unimplemented");
+}
+
+int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
+{
+    BUG_ON("unimplemented");
+    return -EINVAL;
+}
+
+void dump_hyp_walk(vaddr_t addr)
+{
+    BUG_ON("unimplemented");
+}
+
+/* Release all __init and __initdata ranges to be reused */
+void free_init_memory(void)
+{
+    BUG_ON("unimplemented");
+}
+
 void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int flags)
 {
     BUG_ON("unimplemented");
diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c
new file mode 100644 (file)
index 0000000..f7fb58a
--- /dev/null
@@ -0,0 +1,84 @@
+
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/domain.h>
+#include <xen/errno.h>
+#include <xen/mm-frame.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+#include <asm/p2m.h>
+
+int p2m_set_entry(struct p2m_domain *p2m, gfn_t sgfn, unsigned long nr,
+                  mfn_t smfn, p2m_type_t t, p2m_access_t a)
+{
+    BUG_ON("unimplemented");
+    return -EINVAL;
+}
+
+mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, p2m_type_t *t,
+                    p2m_access_t *a, unsigned int *page_order, bool *valid)
+{
+    BUG_ON("unimplemented");
+    return INVALID_MFN;
+}
+
+void p2m_dump_info(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+int p2m_init(struct domain *d)
+{
+    BUG_ON("unimplemented");
+    return -EINVAL;
+}
+
+void p2m_save_state(struct vcpu *p)
+{
+    BUG_ON("unimplemented");
+}
+
+void p2m_restore_state(struct vcpu *n)
+{
+    BUG_ON("unimplemented");
+}
+
+void p2m_final_teardown(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+bool p2m_resolve_translation_fault(struct domain *d, gfn_t gfn)
+{
+    BUG_ON("unimplemented");
+    return false;
+}
+
+void p2m_flush_vm(struct vcpu *v) {}
+
+int relinquish_p2m_mapping(struct domain *d)
+{
+    return 0;
+}
+
+void p2m_domain_creation_finished(struct domain *d) {}
+
+int p2m_teardown(struct domain *d)
+{
+    return 0;
+}
+
+int p2m_teardown_allocation(struct domain *d)
+{
+    return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c
new file mode 100644 (file)
index 0000000..b4da770
--- /dev/null
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/types.h>
+#include <asm/setup.h>
+
+void __init setup_pagetables(void) {}
+
+void * __init early_fdt_map(paddr_t fdt_paddr)
+{
+    BUG_ON("unimplemented");
+    return NULL;
+}
+
+/*
+ * copy_from_paddr - copy data from a physical address
+ * @dst: destination virtual address
+ * @paddr: source physical address
+ * @len: length to copy
+ */
+void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
+{
+    BUG_ON("unimplemented");
+}
+
+void __init remove_early_mappings(void)
+{
+    BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/mpu/vmap.c b/xen/arch/arm/mpu/vmap.c
new file mode 100644 (file)
index 0000000..f977b79
--- /dev/null
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/mm-frame.h>
+#include <xen/types.h>
+#include <xen/vmap.h>
+
+void *vmap_contig(mfn_t mfn, unsigned int nr)
+{
+    BUG_ON("unimplemented");
+    return NULL;
+}
+
+void vunmap(const void *va)
+{
+    BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */