On 03/18/2017 10:05 AM, Jan Kiszka wrote: > On 2017-03-16 23:17, Ralf Ramsauer wrote: >> And use this chance to remove unneeded #ifdef ASSEMBLY guards. >> >> Signed-off-by: Ralf Ramsauer <[email protected]> >> --- >> inmates/lib/{arm64 => arm-common}/include/inmate.h | 17 +---- >> inmates/lib/arm/include/arch/inmate.h | 26 +++++++ >> inmates/lib/arm/include/inmate.h | 87 >> ---------------------- >> inmates/lib/arm64/include/arch/inmate.h | 25 +++++++ >> 4 files changed, 52 insertions(+), 103 deletions(-) >> rename inmates/lib/{arm64 => arm-common}/include/inmate.h (80%) >> create mode 100644 inmates/lib/arm/include/arch/inmate.h >> delete mode 100644 inmates/lib/arm/include/inmate.h >> create mode 100644 inmates/lib/arm64/include/arch/inmate.h >> >> diff --git a/inmates/lib/arm64/include/inmate.h >> b/inmates/lib/arm-common/include/inmate.h >> similarity index 80% >> rename from inmates/lib/arm64/include/inmate.h >> rename to inmates/lib/arm-common/include/inmate.h >> index 24e828a144..99ab37f0c6 100644 >> --- a/inmates/lib/arm64/include/inmate.h >> +++ b/inmates/lib/arm-common/include/inmate.h >> @@ -13,7 +13,6 @@ >> #ifndef _JAILHOUSE_INMATE_H >> #define _JAILHOUSE_INMATE_H >> >> -#ifndef __ASSEMBLY__ >> typedef signed char s8; >> typedef unsigned char u8; >> >> @@ -56,20 +55,6 @@ static inline void cpu_relax(void) >> asm volatile("" : : : "memory"); >> } >> >> -/* >> - * To ease the debugging, we can send a spurious hypercall, which should >> return >> - * -ENOSYS, but appear in the hypervisor stats for this cell. >> - */ >> -static inline void heartbeat(void) >> -{ >> - asm volatile ( >> - "mov x0, %0\n" >> - "hvc #0\n" >> - : : "r" (0xbea7) : "x0"); >> -} >> - >> -void __attribute__((used)) vector_irq(void); >> - >> typedef void (*irq_handler_t)(unsigned int); >> void gic_setup(irq_handler_t handler); >> void gic_enable_irq(unsigned int irq); >> @@ -79,7 +64,7 @@ u64 timer_get_ticks(void); >> u64 timer_ticks_to_ns(u64 ticks); >> void timer_start(u64 timeout); >> >> -#endif /* !__ASSEMBLY__ */ >> +#include <arch/inmate.h> >> >> #include "../inmate_common.h" >> >> diff --git a/inmates/lib/arm/include/arch/inmate.h >> b/inmates/lib/arm/include/arch/inmate.h >> new file mode 100644 >> index 0000000000..5c2ee1a670 >> --- /dev/null >> +++ b/inmates/lib/arm/include/arch/inmate.h >> @@ -0,0 +1,26 @@ >> +/* >> + * Jailhouse, a Linux-based partitioning hypervisor >> + * >> + * Copyright (c) ARM Limited, 2014 >> + * >> + * Authors: >> + * Jean-Philippe Brucker <[email protected]> >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2. See >> + * the COPYING file in the top-level directory. >> + */ >> + >> +/* >> + * To ease the debugging, we can send a spurious hypercall, which should >> return >> + * -ENOSYS, but appear in the hypervisor stats for this cell. >> + */ >> +static inline void heartbeat(void) >> +{ >> + asm volatile ( >> + ".arch_extension virt\n" >> + "mov r0, %0\n" >> + "hvc #0\n" >> + : : "r" (0xbea7) : "r0"); >> +} >> + >> +void __attribute__((interrupt("IRQ"))) __attribute__((used)) >> vector_irq(void); >> diff --git a/inmates/lib/arm/include/inmate.h >> b/inmates/lib/arm/include/inmate.h >> deleted file mode 100644 >> index bbf93131b4..0000000000 >> --- a/inmates/lib/arm/include/inmate.h >> +++ /dev/null >> @@ -1,87 +0,0 @@ >> -/* >> - * Jailhouse, a Linux-based partitioning hypervisor >> - * >> - * Copyright (c) ARM Limited, 2014 >> - * >> - * Authors: >> - * Jean-Philippe Brucker <[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_INMATE_H >> -#define _JAILHOUSE_INMATE_H >> - >> -#ifndef __ASSEMBLY__ >> -typedef signed char s8; >> -typedef unsigned char u8; >> - >> -typedef signed short s16; >> -typedef unsigned short u16; >> - >> -typedef signed int s32; >> -typedef unsigned int u32; >> - >> -typedef signed long long s64; >> -typedef unsigned long long u64; >> - >> -static inline u8 mmio_read8(void *address) >> -{ >> - return *(volatile u8 *)address; >> -} >> - >> -static inline void mmio_write8(void *address, u8 value) >> -{ >> - *(volatile u8 *)address = value; >> -} >> - >> -static inline void mmio_write16(void *address, u16 value) >> -{ >> - *(volatile u16 *)address = value; >> -} >> - >> -static inline u32 mmio_read32(void *address) >> -{ >> - return *(volatile u32 *)address; >> -} >> - >> -static inline void mmio_write32(void *address, u32 value) >> -{ >> - *(volatile u32 *)address = value; >> -} >> - >> -static inline void cpu_relax(void) >> -{ >> - asm volatile("" : : : "memory"); >> -} >> - >> -/* >> - * To ease the debugging, we can send a spurious hypercall, which should >> return >> - * -ENOSYS, but appear in the hypervisor stats for this cell. >> - */ >> -static inline void heartbeat(void) >> -{ >> - asm volatile ( >> - ".arch_extension virt\n" >> - "mov r0, %0\n" >> - "hvc #0\n" >> - : : "r" (0xbea7) : "r0"); >> -} >> - >> -void __attribute__((interrupt("IRQ"))) __attribute__((used)) >> vector_irq(void); >> - >> -typedef void (*irq_handler_t)(unsigned int); >> -void gic_setup(irq_handler_t handler); >> -void gic_enable_irq(unsigned int irq); >> - >> -unsigned long timer_get_frequency(void); >> -u64 timer_get_ticks(void); >> -u64 timer_ticks_to_ns(u64 ticks); >> -void timer_start(u64 timeout); >> - >> -#endif /* !__ASSEMBLY__ */ >> - >> -#include "../inmate_common.h" >> - >> -#endif /* !_JAILHOUSE_INMATE_H */ >> diff --git a/inmates/lib/arm64/include/arch/inmate.h >> b/inmates/lib/arm64/include/arch/inmate.h >> new file mode 100644 >> index 0000000000..cd9275ddf0 >> --- /dev/null >> +++ b/inmates/lib/arm64/include/arch/inmate.h >> @@ -0,0 +1,25 @@ >> +/* >> + * Jailhouse, a Linux-based partitioning hypervisor >> + * >> + * Copyright (c) ARM Limited, 2014 >> + * >> + * Authors: >> + * Jean-Philippe Brucker <[email protected]> >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2. See >> + * the COPYING file in the top-level directory. >> + */ >> + >> +/* >> + * To ease the debugging, we can send a spurious hypercall, which should >> return >> + * -ENOSYS, but appear in the hypervisor stats for this cell. >> + */ >> +static inline void heartbeat(void) >> +{ >> + asm volatile ( >> + "mov x0, %0\n" >> + "hvc #0\n" >> + : : "r" (0xbea7) : "x0"); >> +} >> + >> +void __attribute__((used)) vector_irq(void); >> > > Can be done separately, but we still have the open topic of tagging > vector_irq as interrupt on 64-bit. Yes, that's true, but we can not simply tag it. That's probably the reason why it's missing at the moment. > > At that chance, attributes should be combined: > __attribute__((interrupt("IRQ), used)). This doesn't work for GCC together with aarch64, they apparently don't support this parameter. We will have to push away the context manually.
Ralf > > Jan > -- 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.
