From: Antonios Motakis <[email protected]>

Add the minimum stub functions expected by the rest of the codebase
to enable building on AArch64. We may implement the missing AArch64
functionality from here.

Signed-off-by: Antonios Motakis <[email protected]>
---
 hypervisor/Makefile                          |  4 ++
 hypervisor/arch/arm64/Makefile               | 22 ++++++++
 hypervisor/arch/arm64/asm-defines.c          | 19 +++++++
 hypervisor/arch/arm64/caches.S               | 16 ++++++
 hypervisor/arch/arm64/control.c              | 83 ++++++++++++++++++++++++++++
 hypervisor/arch/arm64/entry.S                | 19 +++++++
 hypervisor/arch/arm64/include/asm/control.h  |  1 +
 hypervisor/arch/arm64/include/asm/head.h     | 16 ++++++
 hypervisor/arch/arm64/include/asm/percpu.h   |  1 +
 hypervisor/arch/arm64/include/asm/platform.h | 18 ++++++
 hypervisor/arch/arm64/mmio.c                 | 27 +++++++++
 hypervisor/arch/arm64/setup.c                | 41 ++++++++++++++
 inmates/demos/arm64/Makefile                 |  0
 inmates/lib/arm64/Makefile                   |  0
 inmates/tools/arm64/Makefile                 |  0
 15 files changed, 267 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/include/asm/head.h
 create mode 100644 hypervisor/arch/arm64/include/asm/platform.h
 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..0911ff3
--- /dev/null
+++ b/hypervisor/arch/arm64/Makefile
@@ -0,0 +1,22 @@
+#
+# Jailhouse AArch64 support
+#
+# Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+#
+# Authors:
+#  Antonios Motakis <[email protected]>
+#
+# 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))
+
+always := built-in.o
+
+obj-y := entry.o setup.o control.o mmio.o caches.o
+obj-y += ../arm/mmu_cell.o ../arm/paging.o ../arm/dbg-write.o ../arm/lib.o
+
+obj-$(CONFIG_SERIAL_AMBA_PL011) += ../arm/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 <[email protected]>
+ *
+ * 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..4859032
--- /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 <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+       .global arch_paging_flush_cpu_caches
+arch_paging_flush_cpu_caches:
+       b       .
diff --git a/hypervisor/arch/arm64/control.c b/hypervisor/arch/arm64/control.c
new file mode 100644
index 0000000..a1c4774
--- /dev/null
+++ b/hypervisor/arch/arm64/control.c
@@ -0,0 +1,83 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <[email protected]>
+ *
+ * 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_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 arch_shutdown_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 <[email protected]>
+ *  Dmitry Voytik <[email protected]>
+ *
+ * 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 1957d55..98980ca 100644
--- a/hypervisor/arch/arm64/include/asm/control.h
+++ b/hypervisor/arch/arm64/include/asm/control.h
@@ -35,6 +35,7 @@ struct registers* arch_handle_exit(struct per_cpu *cpu_data,
 bool arch_handle_phys_irq(struct per_cpu *cpu_data, u32 irqn);
 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/head.h 
b/hypervisor/arch/arm64/include/asm/head.h
new file mode 100644
index 0000000..53dd26a
--- /dev/null
+++ b/hypervisor/arch/arm64/include/asm/head.h
@@ -0,0 +1,16 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef _JAILHOUSE_ASM_HEAD_H
+#define _JAILHOUSE_ASM_HEAD_H_
+
+#endif /* !_JAILHOUSE_ASM_HEAD_H */
diff --git a/hypervisor/arch/arm64/include/asm/percpu.h 
b/hypervisor/arch/arm64/include/asm/percpu.h
index c73d756..a4f3663 100644
--- a/hypervisor/arch/arm64/include/asm/percpu.h
+++ b/hypervisor/arch/arm64/include/asm/percpu.h
@@ -30,6 +30,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/include/asm/platform.h 
b/hypervisor/arch/arm64/include/asm/platform.h
new file mode 100644
index 0000000..afd7e72
--- /dev/null
+++ b/hypervisor/arch/arm64/include/asm/platform.h
@@ -0,0 +1,18 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef _JAILHOUSE_ASM_PLATFORM_H
+#define _JAILHOUSE_ASM_PLATFORM_H
+
+#include <jailhouse/config.h>
+
+#endif /* !_JAILHOUSE_ASM_PLATFORM_H */
diff --git a/hypervisor/arch/arm64/mmio.c b/hypervisor/arch/arm64/mmio.c
new file mode 100644
index 0000000..37745d7
--- /dev/null
+++ b/hypervisor/arch/arm64/mmio.c
@@ -0,0 +1,27 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <[email protected]>
+ *
+ * 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;
+}
+
+void arm_mmio_perform_access(unsigned long base, struct mmio_access *mmio)
+{
+       trace_error(-EINVAL);
+       while (1);
+}
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 <[email protected]>
+ *
+ * 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.8.0.rc3


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to