On 2018-04-03 17:50, Ralf Ramsauer wrote:
> Since 9675814c6fe3e6 ("arm/arm64: Reject hypercalls with wrong immediate
> code"), Jailhouse rejects all HVCs with immediate codes other than
> 0x4a48.
>
> This breaks the assumption that the heartbeat() pseudo HVC makes on all
> ARM platforms.
>
> We must provide 0x4a48 as immediate code, but use an invalid function
> argument in order to return to our cell. 0xdeadbeef sounds reasonable.
>
> Let's use this cance to consolidate arm and arm64 code and use our
> common jailhouse_call interface.
>
> Fixes: 9675814c6fe3e6 ("arm/arm64: Reject hypercalls with wrong immediate
> code")
> Signed-off-by: Ralf Ramsauer <[email protected]>
> ---
> inmates/lib/arm-common/include/inmate.h | 11 +++++++++++
> inmates/lib/arm/include/arch/inmate.h | 15 ---------------
> inmates/lib/arm64/include/arch/inmate.h | 14 --------------
> 3 files changed, 11 insertions(+), 29 deletions(-)
>
> diff --git a/inmates/lib/arm-common/include/inmate.h
> b/inmates/lib/arm-common/include/inmate.h
> index 581469af..921fde96 100644
> --- a/inmates/lib/arm-common/include/inmate.h
> +++ b/inmates/lib/arm-common/include/inmate.h
> @@ -101,4 +101,15 @@ void timer_start(u64 timeout);
>
> #include "../inmate_common.h"
>
> +/*
> + * 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)
> +{
> +#ifndef CONFIG_BARE_METAL
> + jailhouse_call(0xdeadbeef);
> +#endif
> +}
> +
> #endif /* !_JAILHOUSE_INMATE_H */
> diff --git a/inmates/lib/arm/include/arch/inmate.h
> b/inmates/lib/arm/include/arch/inmate.h
> index 5d65edf2..9a0353a3 100644
> --- a/inmates/lib/arm/include/arch/inmate.h
> +++ b/inmates/lib/arm/include/arch/inmate.h
> @@ -36,19 +36,4 @@
> * THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> -/*
> - * 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)
> -{
> -#ifndef CONFIG_BARE_METAL
> - asm volatile (
> - ".arch_extension virt\n"
> - "mov r0, %0\n"
> - "hvc #0\n"
> - : : "r" (0xbea7) : "r0");
> -#endif
> -}
> -
> void __attribute__((interrupt("IRQ"), used)) vector_irq(void);
> diff --git a/inmates/lib/arm64/include/arch/inmate.h
> b/inmates/lib/arm64/include/arch/inmate.h
> index c1421b6b..8ea3dd5e 100644
> --- a/inmates/lib/arm64/include/arch/inmate.h
> +++ b/inmates/lib/arm64/include/arch/inmate.h
> @@ -36,18 +36,4 @@
> * THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> -/*
> - * 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)
> -{
> -#ifndef CONFIG_BARE_METAL
> - asm volatile (
> - "mov x0, %0\n"
> - "hvc #0\n"
> - : : "r" (0xbea7) : "x0");
> -#endif
> -}
> -
> void __attribute__((used)) vector_irq(void);
>
Applied to next, thanks.
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.