[PATCH v7 04/16] arm64: kvm: Move the do_el2_call macro to a header file
Marc Zyngier
marc.zyngier at arm.com
Tue Apr 19 08:02:47 PDT 2016
On 01/04/16 17:53, James Morse wrote:
> The hyp-stub could make use of the do_el2_call(), move it to a header file.
>
> Signed-off-by: James Morse <james.morse at arm.com>
> ---
> arch/arm64/include/asm/virt.h | 18 +++++++++++++++++-
> arch/arm64/kvm/hyp/hyp-entry.S | 17 +----------------
> 2 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
> index 9f22dd607958..b8fdddeca71b 100644
> --- a/arch/arm64/include/asm/virt.h
> +++ b/arch/arm64/include/asm/virt.h
> @@ -21,7 +21,23 @@
> #define BOOT_CPU_MODE_EL1 (0xe11)
> #define BOOT_CPU_MODE_EL2 (0xe12)
>
> -#ifndef __ASSEMBLY__
> +#ifdef __ASSEMBLY__
> +.macro do_el2_call
> + /*
> + * Shuffle the parameters before calling the function
> + * pointed to in x0. Assumes parameters in x[1,2,3].
> + */
> + sub sp, sp, #16
> + str lr, [sp]
> + mov lr, x0
> + mov x0, x1
> + mov x1, x2
> + mov x2, x3
> + blr lr
> + ldr lr, [sp]
> + add sp, sp, #16
> +.endm
> +#else
So while I'm not opposed to this macro being reused, the name is
slightly misleading out of the original context. This macro doesn't take
you to EL2, but implements a very peculiar calling convention that only
the HYP code is expecting.
Could we have a disclaimer saying something along the lines of "Don't
you dare using this macro!"?
Otherwise:
Acked-by: Marc Zyngier <marc.zyngier at arm.com>
M.
--
Jazz is not dead. It just smells funny...
More information about the linux-arm-kernel
mailing list