Add the minimum stub functions expected by the rest of the code base
to enable building on AArch64. We will implement the missing AArch64
functionality from here or enable the implementations in arm-common.

Based on patch by Antonios Motakis.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 hypervisor/Makefile                         |  4 ++
 hypervisor/arch/arm64/Makefile              | 25 +++++++++
 hypervisor/arch/arm64/asm-defines.c         | 19 +++++++
 hypervisor/arch/arm64/caches.S              | 16 ++++++
 hypervisor/arch/arm64/control.c             | 81 +++++++++++++++++++++++++++++
 hypervisor/arch/arm64/entry.S               | 19 +++++++
 hypervisor/arch/arm64/include/asm/control.h |  1 +
 hypervisor/arch/arm64/include/asm/paging.h  | 24 +++++++++
 hypervisor/arch/arm64/include/asm/percpu.h  |  1 +
 hypervisor/arch/arm64/mmio.c                | 21 ++++++++
 hypervisor/arch/arm64/setup.c               | 41 +++++++++++++++
 inmates/demos/arm64/Makefile                |  0
 inmates/lib/arm64/Makefile                  |  0
 inmates/tools/arm64/Makefile                |  0
 14 files changed, 252 insertions(+)
 create mode 100644 hypervisor/arch/arm64/Makefile
 create mode 100644 hypervisor/arch/arm64/asm-defines.c
 create mode 100644 hypervisor/arch/arm64/caches.S
 create mode 100644 hypervisor/arch/arm64/control.c
 create mode 100644 hypervisor/arch/arm64/entry.S
 create mode 100644 hypervisor/arch/arm64/mmio.c
 create mode 100644 hypervisor/arch/arm64/setup.c
 create mode 100644 inmates/demos/arm64/Makefile
 create mode 100644 inmates/lib/arm64/Makefile
 create mode 100644 inmates/tools/arm64/Makefile

diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index 0532e4e..c037ed0 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -33,6 +33,10 @@ ifeq ($(SRCARCH),arm)
 KBUILD_CFLAGS += -marm
 endif
 
+ifeq ($(SRCARCH),arm64)
+LINUXINCLUDE += -I$(src)/arch/arm/include
+endif
+
 ifneq ($(wildcard $(obj)/include/jailhouse/config.h),)
 KBUILD_CFLAGS += -include $(obj)/include/jailhouse/config.h
 endif
diff --git a/hypervisor/arch/arm64/Makefile b/hypervisor/arch/arm64/Makefile
new file mode 100644
index 0000000..3de96b1
--- /dev/null
+++ b/hypervisor/arch/arm64/Makefile
@@ -0,0 +1,25 @@
+#
+# Jailhouse AArch64 support
+#
+# Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+#
+# Authors:
+#  Antonios Motakis <antonios.mota...@huawei.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.  See
+# the COPYING file in the top-level directory.
+#
+
+include $(CONFIG_MK)
+
+KBUILD_AFLAGS := $(subst -include asm/unified.h,,$(KBUILD_AFLAGS))
+
+COMMON := ../arm-common
+
+always := built-in.o
+
+obj-y := entry.o setup.o control.o mmio.o caches.o
+obj-y += $(COMMON)/dbg-write.o $(COMMON)/lib.o
+obj-y += $(COMMON)/mmu_cell.o $(COMMON)/paging.o
+
+obj-$(CONFIG_SERIAL_AMBA_PL011) += $(COMMON)/dbg-write-pl011.o
diff --git a/hypervisor/arch/arm64/asm-defines.c 
b/hypervisor/arch/arm64/asm-defines.c
new file mode 100644
index 0000000..c026a3c
--- /dev/null
+++ b/hypervisor/arch/arm64/asm-defines.c
@@ -0,0 +1,19 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <jailhouse/gen-defines.h>
+
+void common(void);
+
+void common(void)
+{
+}
diff --git a/hypervisor/arch/arm64/caches.S b/hypervisor/arch/arm64/caches.S
new file mode 100644
index 0000000..400b4e6
--- /dev/null
+++ b/hypervisor/arch/arm64/caches.S
@@ -0,0 +1,16 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2016 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+       .global arm_dcaches_flush
+arm_dcaches_flush:
+       b       .
diff --git a/hypervisor/arch/arm64/control.c b/hypervisor/arch/arm64/control.c
new file mode 100644
index 0000000..ca4124e
--- /dev/null
+++ b/hypervisor/arch/arm64/control.c
@@ -0,0 +1,81 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <jailhouse/control.h>
+#include <jailhouse/printk.h>
+
+int arch_cell_create(struct cell *cell)
+{
+       return trace_error(-EINVAL);
+}
+
+void arch_flush_cell_vcpu_caches(struct cell *cell)
+{
+       /* AARCH64_TODO */
+       trace_error(-EINVAL);
+}
+
+void arch_cell_destroy(struct cell *cell)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_cell_reset(struct cell *cell)
+{
+}
+
+void arch_config_commit(struct cell *cell_added_removed)
+{
+}
+
+void arch_shutdown(void)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_suspend_cpu(unsigned int cpu_id)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_resume_cpu(unsigned int cpu_id)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_reset_cpu(unsigned int cpu_id)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_park_cpu(unsigned int cpu_id)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void __attribute__((noreturn)) arch_panic_stop(void)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_panic_park(void)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
diff --git a/hypervisor/arch/arm64/entry.S b/hypervisor/arch/arm64/entry.S
new file mode 100644
index 0000000..a7c0f2c
--- /dev/null
+++ b/hypervisor/arch/arm64/entry.S
@@ -0,0 +1,19 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015-2016 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *  Dmitry Voytik <dmitry.voy...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+/* Entry point for Linux loader module on JAILHOUSE_ENABLE */
+       .text
+       .globl arch_entry
+arch_entry:
+       mov     x0, -22
+       ret
diff --git a/hypervisor/arch/arm64/include/asm/control.h 
b/hypervisor/arch/arm64/include/asm/control.h
index 7563529..93fdbbe 100644
--- a/hypervisor/arch/arm64/include/asm/control.h
+++ b/hypervisor/arch/arm64/include/asm/control.h
@@ -28,6 +28,7 @@ bool arch_handle_phys_irq(struct per_cpu *cpu_data, u32 irqn,
                          unsigned int count_event);
 void arch_reset_self(struct per_cpu *cpu_data);
 void arch_shutdown_self(struct per_cpu *cpu_data);
+unsigned int arm_cpu_by_mpidr(struct cell *cell, unsigned long mpidr);
 
 void __attribute__((noreturn)) vmreturn(struct registers *guest_regs);
 void __attribute__((noreturn)) arch_shutdown_mmu(struct per_cpu *cpu_data);
diff --git a/hypervisor/arch/arm64/include/asm/paging.h 
b/hypervisor/arch/arm64/include/asm/paging.h
index 546992e..2d17acd 100644
--- a/hypervisor/arch/arm64/include/asm/paging.h
+++ b/hypervisor/arch/arm64/include/asm/paging.h
@@ -167,8 +167,17 @@
 
 #ifndef __ASSEMBLY__
 
+struct cell;
+struct paging_structures;
+
 typedef u64 *pt_entry_t;
 
+enum dcache_flush {
+       DCACHE_CLEAN,
+       DCACHE_INVALIDATE,
+       DCACHE_CLEAN_AND_INVALIDATE,
+};
+
 extern unsigned int cpu_parange;
 
 /* return the bits supported for the physical address range for this
@@ -230,6 +239,21 @@ static inline unsigned int get_cpu_parange(void)
                                | VTCR_RES1)
 
 void arm_dcaches_flush(void *addr, long size, enum dcache_flush flush);
+void arm_cell_dcaches_flush(struct cell *cell, enum dcache_flush flush);
+
+int arm_paging_cell_init(struct cell *cell);
+void arm_paging_cell_destroy(struct cell *cell);
+
+void arm_paging_vcpu_init(struct paging_structures *pg_structs);
+
+static inline void arm_paging_vcpu_flush_tlbs(void)
+{
+       /*
+        * Invalidate all stage-1 and 2 TLB entries for the current VMID
+        * ERET will ensure completion of these ops
+        */
+       asm volatile("tlbi vmalls12e1is");
+}
 
 /* Only executed on hypervisor paging struct changes */
 static inline void arch_paging_flush_page_tlbs(unsigned long page_addr)
diff --git a/hypervisor/arch/arm64/include/asm/percpu.h 
b/hypervisor/arch/arm64/include/asm/percpu.h
index 62e3e16..42f6f69 100644
--- a/hypervisor/arch/arm64/include/asm/percpu.h
+++ b/hypervisor/arch/arm64/include/asm/percpu.h
@@ -28,6 +28,7 @@ struct per_cpu {
        bool failed;
 
        bool flush_vcpu_caches;
+       unsigned long mpidr;
 } __attribute__((aligned(PAGE_SIZE)));
 
 static inline struct per_cpu *this_cpu_data(void)
diff --git a/hypervisor/arch/arm64/mmio.c b/hypervisor/arch/arm64/mmio.c
new file mode 100644
index 0000000..56f71b2
--- /dev/null
+++ b/hypervisor/arch/arm64/mmio.c
@@ -0,0 +1,21 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <jailhouse/entry.h>
+#include <jailhouse/mmio.h>
+#include <jailhouse/printk.h>
+
+unsigned int arch_mmio_count_regions(struct cell *cell)
+{
+       /* not entirely a lie :) */
+       return 0;
+}
diff --git a/hypervisor/arch/arm64/setup.c b/hypervisor/arch/arm64/setup.c
new file mode 100644
index 0000000..ca83940
--- /dev/null
+++ b/hypervisor/arch/arm64/setup.c
@@ -0,0 +1,41 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <jailhouse/entry.h>
+#include <jailhouse/printk.h>
+
+int arch_init_early(void)
+{
+       return trace_error(-EINVAL);
+}
+
+int arch_cpu_init(struct per_cpu *cpu_data)
+{
+       return trace_error(-EINVAL);
+}
+
+int arch_init_late(void)
+{
+       return trace_error(-EINVAL);
+}
+
+void __attribute__((noreturn)) arch_cpu_activate_vmm(struct per_cpu *cpu_data)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
+
+void arch_cpu_restore(struct per_cpu *cpu_data, int return_code)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
diff --git a/inmates/demos/arm64/Makefile b/inmates/demos/arm64/Makefile
new file mode 100644
index 0000000..e69de29
diff --git a/inmates/lib/arm64/Makefile b/inmates/lib/arm64/Makefile
new file mode 100644
index 0000000..e69de29
diff --git a/inmates/tools/arm64/Makefile b/inmates/tools/arm64/Makefile
new file mode 100644
index 0000000..e69de29
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to