Skip to content

Commit

Permalink
hypervisor: arm64: minimum stubs to allow building on AArch64
Browse files Browse the repository at this point in the history
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 <antonios.motakis@huawei.com>
  • Loading branch information
tvelocity committed Jan 25, 2016
1 parent e8161dc commit 8d2700d
Show file tree
Hide file tree
Showing 14 changed files with 262 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hypervisor/Makefile
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions hypervisor/arch/arm64/Makefile
@@ -0,0 +1,22 @@
#
# Jailhouse AArch64 support
#
# Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
#
# Authors:
# Antonios Motakis <antonios.motakis@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 := $(filter-out -include asm/unified.h,$(KBUILD_AFLAGS))

always := built-in.o

obj-y := entry.o setup.o control.o mmio.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
19 changes: 19 additions & 0 deletions hypervisor/arch/arm64/asm-defines.c
@@ -0,0 +1,19 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@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)
{
}
83 changes: 83 additions & 0 deletions hypervisor/arch/arm64/control.c
@@ -0,0 +1,83 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@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_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);
}
18 changes: 18 additions & 0 deletions hypervisor/arch/arm64/entry.S
@@ -0,0 +1,18 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@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
1 change: 1 addition & 0 deletions hypervisor/arch/arm64/include/asm/control.h
Expand Up @@ -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_mpid(struct cell *cell, unsigned long mpid);

void __attribute__((noreturn)) vmreturn(struct registers *guest_regs);
void __attribute__((noreturn)) arch_shutdown_mmu(struct per_cpu *cpu_data);
Expand Down
16 changes: 16 additions & 0 deletions hypervisor/arch/arm64/include/asm/head.h
@@ -0,0 +1,16 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@huawei.com>
*
* 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 */
13 changes: 13 additions & 0 deletions hypervisor/arch/arm64/include/asm/percpu.h
Expand Up @@ -21,6 +21,18 @@
#include <asm/cell.h>
#include <asm/spinlock.h>

union mpidr {
u64 val;
struct {
u8 aff0;
u8 aff1;
u8 aff2;
u8 pad1;
u8 aff3;
u8 pad2[3];
} f;
};

struct per_cpu {
/* common fields */
unsigned int cpu_id;
Expand All @@ -30,6 +42,7 @@ struct per_cpu {
bool failed;

bool flush_vcpu_caches;
union mpidr mpidr;
} __attribute__((aligned(PAGE_SIZE)));

static inline struct per_cpu *this_cpu_data(void)
Expand Down
18 changes: 18 additions & 0 deletions hypervisor/arch/arm64/include/asm/platform.h
@@ -0,0 +1,18 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@huawei.com>
*
* 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 */
27 changes: 27 additions & 0 deletions hypervisor/arch/arm64/mmio.c
@@ -0,0 +1,27 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@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;
}

void arm_mmio_perform_access(unsigned long base, struct mmio_access *mmio)
{
trace_error(-EINVAL);
while (1);
}
41 changes: 41 additions & 0 deletions hypervisor/arch/arm64/setup.c
@@ -0,0 +1,41 @@
/*
* Jailhouse AArch64 support
*
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
*
* Authors:
* Antonios Motakis <antonios.motakis@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);
}
Empty file added inmates/demos/arm64/Makefile
Empty file.
Empty file added inmates/lib/arm64/Makefile
Empty file.
Empty file added inmates/tools/arm64/Makefile
Empty file.

0 comments on commit 8d2700d

Please sign in to comment.