[PATCH] arm(64)/kvm: improve the documentation about HVC calls

Pingfan Liu kernelfans at gmail.com
Wed Aug 12 10:14:17 EDT 2020


This issue is detected by Morse
(https://lore.kernel.org/linux-arm-kernel/9b0da257-785b-90ba-de3c-b9ee9ccdeeba@arm.com/)
during the discussion for my patch.

I am not quite sure about the arm, but based on the note at the head
of arm/kernel/head.S, things should go that way. If any mistake,
please correct me.

Thanks,
Pingfan

On Wed, Aug 12, 2020 at 10:05 PM Pingfan Liu <kernelfans at gmail.com> wrote:
>
> Both arm and arm64 kernel entry point have the following prerequisite:
>   MMU = off, D-cache = off, I-cache = dont care.
>
> HVC_SOFT_RESTART call should meet this prerequisite before jumping to the
> new kernel.
>
> Furthermore, on arm64, el2_setup doesn't set I+C bits and keeps EL2 MMU
> off, and KVM resets them when its unload. These are achieved by
> HVC_RESET_VECTORS call.
>
> Improve the document.
>
> Signed-off-by: Pingfan Liu <kernelfans at gmail.com>
> Cc: James Morse <james.morse at arm.com>
> Cc: Russell King <linux at armlinux.org.uk>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Julien Thierry <julien.thierry.kdev at gmail.com>
> Cc: Suzuki K Poulose <suzuki.poulose at arm.com>
> Cc: linux-doc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> To: kvmarm at lists.cs.columbia.edu
> ---
>  Documentation/virt/kvm/arm/hyp-abi.rst | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/virt/kvm/arm/hyp-abi.rst b/Documentation/virt/kvm/arm/hyp-abi.rst
> index d9eba93..a95bc30 100644
> --- a/Documentation/virt/kvm/arm/hyp-abi.rst
> +++ b/Documentation/virt/kvm/arm/hyp-abi.rst
> @@ -40,9 +40,9 @@ these functions (see arch/arm{,64}/include/asm/virt.h):
>
>  * ::
>
> -    r0/x0 = HVC_RESET_VECTORS
> +    x0 = HVC_RESET_VECTORS (arm64 only)
>
> -  Turn HYP/EL2 MMU off, and reset HVBAR/VBAR_EL2 to the initials
> +  Disable HYP/EL2 MMU and D-cache, and reset HVBAR/VBAR_EL2 to the initials
>    stubs' exception vector value. This effectively disables an existing
>    hypervisor.
>
> @@ -54,7 +54,7 @@ these functions (see arch/arm{,64}/include/asm/virt.h):
>      x3 = x1's value when entering the next payload (arm64)
>      x4 = x2's value when entering the next payload (arm64)
>
> -  Mask all exceptions, disable the MMU, move the arguments into place
> +  Mask all exceptions, disable the MMU and D-cache, move the arguments into place
>    (arm64 only), and jump to the restart address while at HYP/EL2. This
>    hypercall is not expected to return to its caller.
>
> --
> 2.7.5
>



More information about the linux-arm-kernel mailing list