]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
arm: implement some base functions
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Wed, 11 Jun 2014 17:03:13 +0000 (18:03 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 19 Dec 2014 08:57:47 +0000 (09:57 +0100)
memcpy and phys_processor_id implementations are required before going
any further. This patch introduces a very trivial version of those
functions.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/arm/Makefile
hypervisor/arch/arm/include/asm/processor.h
hypervisor/arch/arm/include/asm/sysregs.h
hypervisor/arch/arm/lib.c [new file with mode: 0644]
hypervisor/arch/arm/setup.c

index 6ceb0610f79a7c7f70a65775647a17d4a001b349..425f2215674ee00949ad7f9c045eaa6137d3c122 100644 (file)
@@ -14,4 +14,4 @@ KBUILD_AFLAGS := $(filter-out -include asm/unified.h,$(KBUILD_AFLAGS))
 
 always := built-in.o
 
-obj-y := entry.o setup.o
+obj-y := entry.o setup.o lib.o
index 4c5c54fa5e3e882bd3bc80528293fce9b28b5b4d..1e378da501911fb4dd5cb9af9c2a497c726a08a7 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef _JAILHOUSE_ASM_PROCESSOR_H
 #define _JAILHOUSE_ASM_PROCESSOR_H
 
+#define MPIDR_CPUID_MASK       0x00ffffff
+
 #ifndef __ASSEMBLY__
 
 struct registers {
index 8be5ce1e9f74029d1673b50226704d490507c90e..b5dddcfb418a780a0bee6d905af30f9ac951c2b7 100644 (file)
  * - arm_read_sysreg(SYSREG_NAME, reg)
  */
 
+/*
+ * 32bit sysregs definitions
+ * (Use the AArch64 names to ease the compatibility work)
+ */
+#define MPIDR_EL1      SYSREG_32(0, c0, c0, 5)
 
 #define SYSREG_32(...) 32, __VA_ARGS__
 #define SYSREG_64(...) 64, __VA_ARGS__
diff --git a/hypervisor/arch/arm/lib.c b/hypervisor/arch/arm/lib.c
new file mode 100644 (file)
index 0000000..c96d18b
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) ARM Limited, 2014
+ *
+ * Authors:
+ *  Jean-Philippe Brucker <jean-philippe.brucker@arm.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/processor.h>
+#include <jailhouse/string.h>
+#include <jailhouse/types.h>
+#include <asm/sysregs.h>
+
+int phys_processor_id(void)
+{
+       u32 mpidr;
+
+       arm_read_sysreg(MPIDR_EL1, mpidr);
+       return mpidr & MPIDR_CPUID_MASK;
+}
+
+void *memcpy(void *dest, const void *src, unsigned long n)
+{
+       unsigned long i;
+       const char *csrc = src;
+       char *cdest = dest;
+
+       for (i = 0; i < n; i++)
+               cdest[i] = csrc[i];
+
+       return dest;
+}
index de49990ad75925364821d89ec5460761f013f2dd..e5e4eddb8acd67a3b7df2b1d3d4053b2ae7a3a69 100644 (file)
@@ -43,7 +43,6 @@ void arch_cpu_restore(struct per_cpu *cpu_data)
 #include <jailhouse/string.h>
 #include <jailhouse/paging.h>
 void arch_dbg_write_init(void) {}
-int phys_processor_id(void) { return 0; }
 void arch_suspend_cpu(unsigned int cpu_id) {}
 void arch_resume_cpu(unsigned int cpu_id) {}
 void arch_reset_cpu(unsigned int cpu_id) {}
@@ -60,7 +59,6 @@ int arch_unmap_memory_region(struct cell *cell,
 void arch_flush_cell_vcpu_caches(struct cell *cell) {}
 void arch_cell_destroy(struct cell *new_cell) {}
 void arch_config_commit(struct cell *cell_added_removed) {}
-void *memcpy(void *dest, const void *src, unsigned long n) { return NULL; }
 void arch_dbg_write(const char *msg) {}
 void arch_shutdown(void) {}
 unsigned long arch_paging_gphys2phys(struct per_cpu *cpu_data,