From: Mark Rutland <mark.rutland@arm.com>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org,
dave.martin@arm.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 1/2] ARM: hyp-stub: improve ABI
Date: Wed, 14 Dec 2016 11:49:54 +0000 [thread overview]
Message-ID: <20161214114954.GF17982@leverpostej> (raw)
In-Reply-To: <E1cH74w-0003ke-Qp@rmk-PC.armlinux.org.uk>
On Wed, Dec 14, 2016 at 10:46:30AM +0000, Russell King wrote:
> Improve the hyp-stub ABI to allow it to do more than just get/set the
> vectors. We follow the example in ARM64, where r0 is used as an opcode
> with the other registers as an argument.
>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This looks good to me, though I'd suggest s/ABI/calling convention/, as
this isn't strictly speaking an ABI. So FWIW:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
> ---
> arch/arm/kernel/hyp-stub.S | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
> index 15d073ae5da2..f3e9ba5fb642 100644
> --- a/arch/arm/kernel/hyp-stub.S
> +++ b/arch/arm/kernel/hyp-stub.S
> @@ -22,6 +22,9 @@
> #include <asm/assembler.h>
> #include <asm/virt.h>
>
> +#define HVC_GET_VECTORS 0
> +#define HVC_SET_VECTORS 1
> +
> #ifndef ZIMAGE
> /*
> * For the kernel proper, we need to find out the CPU boot mode long after
> @@ -202,9 +205,19 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE
> ENDPROC(__hyp_stub_install_secondary)
>
> __hyp_stub_do_trap:
> - cmp r0, #-1
> - mrceq p15, 4, r0, c12, c0, 0 @ get HVBAR
> - mcrne p15, 4, r0, c12, c0, 0 @ set HVBAR
> + teq r0, #HVC_GET_VECTORS
> + bne 1f
> + mrc p15, 4, r0, c12, c0, 0 @ get HVBAR
> + b __hyp_stub_exit
> +
> +1: teq r0, #HVC_SET_VECTORS
> + bne 1f
> + mcr p15, 4, r1, c12, c0, 0 @ set HVBAR
> + b __hyp_stub_exit
> +
> +1: mov r0, #-1
> +
> +__hyp_stub_exit:
> __ERET
> ENDPROC(__hyp_stub_do_trap)
>
> @@ -231,10 +244,14 @@ ENDPROC(__hyp_stub_do_trap)
> * initialisation entry point.
> */
> ENTRY(__hyp_get_vectors)
> - mov r0, #-1
> + mov r0, #HVC_GET_VECTORS
> + __HVC(0)
> + ret lr
> ENDPROC(__hyp_get_vectors)
> - @ fall through
> +
> ENTRY(__hyp_set_vectors)
> + mov r1, r0
> + mov r0, #HVC_SET_VECTORS
> __HVC(0)
> ret lr
> ENDPROC(__hyp_set_vectors)
> --
> 2.7.4
>
WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: hyp-stub: improve ABI
Date: Wed, 14 Dec 2016 11:49:54 +0000 [thread overview]
Message-ID: <20161214114954.GF17982@leverpostej> (raw)
In-Reply-To: <E1cH74w-0003ke-Qp@rmk-PC.armlinux.org.uk>
On Wed, Dec 14, 2016 at 10:46:30AM +0000, Russell King wrote:
> Improve the hyp-stub ABI to allow it to do more than just get/set the
> vectors. We follow the example in ARM64, where r0 is used as an opcode
> with the other registers as an argument.
>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This looks good to me, though I'd suggest s/ABI/calling convention/, as
this isn't strictly speaking an ABI. So FWIW:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
> ---
> arch/arm/kernel/hyp-stub.S | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
> index 15d073ae5da2..f3e9ba5fb642 100644
> --- a/arch/arm/kernel/hyp-stub.S
> +++ b/arch/arm/kernel/hyp-stub.S
> @@ -22,6 +22,9 @@
> #include <asm/assembler.h>
> #include <asm/virt.h>
>
> +#define HVC_GET_VECTORS 0
> +#define HVC_SET_VECTORS 1
> +
> #ifndef ZIMAGE
> /*
> * For the kernel proper, we need to find out the CPU boot mode long after
> @@ -202,9 +205,19 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE
> ENDPROC(__hyp_stub_install_secondary)
>
> __hyp_stub_do_trap:
> - cmp r0, #-1
> - mrceq p15, 4, r0, c12, c0, 0 @ get HVBAR
> - mcrne p15, 4, r0, c12, c0, 0 @ set HVBAR
> + teq r0, #HVC_GET_VECTORS
> + bne 1f
> + mrc p15, 4, r0, c12, c0, 0 @ get HVBAR
> + b __hyp_stub_exit
> +
> +1: teq r0, #HVC_SET_VECTORS
> + bne 1f
> + mcr p15, 4, r1, c12, c0, 0 @ set HVBAR
> + b __hyp_stub_exit
> +
> +1: mov r0, #-1
> +
> +__hyp_stub_exit:
> __ERET
> ENDPROC(__hyp_stub_do_trap)
>
> @@ -231,10 +244,14 @@ ENDPROC(__hyp_stub_do_trap)
> * initialisation entry point.
> */
> ENTRY(__hyp_get_vectors)
> - mov r0, #-1
> + mov r0, #HVC_GET_VECTORS
> + __HVC(0)
> + ret lr
> ENDPROC(__hyp_get_vectors)
> - @ fall through
> +
> ENTRY(__hyp_set_vectors)
> + mov r1, r0
> + mov r0, #HVC_SET_VECTORS
> __HVC(0)
> ret lr
> ENDPROC(__hyp_set_vectors)
> --
> 2.7.4
>
next prev parent reply other threads:[~2016-12-14 11:49 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-09 19:49 [PATCH] ARM: soft-reboot into same mode that we entered the kernel Russell King
2016-12-13 10:54 ` Mark Rutland
2016-12-13 10:54 ` Mark Rutland
2016-12-13 11:11 ` Russell King - ARM Linux
2016-12-13 11:11 ` Russell King - ARM Linux
2016-12-13 11:30 ` Mark Rutland
2016-12-13 11:30 ` Mark Rutland
2016-12-14 10:46 ` [PATCH 1/2] ARM: hyp-stub: improve ABI Russell King
2016-12-14 10:46 ` Russell King
2016-12-14 11:49 ` Mark Rutland [this message]
2016-12-14 11:49 ` Mark Rutland
2016-12-15 11:18 ` Marc Zyngier
2016-12-15 11:18 ` Marc Zyngier
2016-12-15 11:35 ` Russell King - ARM Linux
2016-12-15 11:35 ` Russell King - ARM Linux
2016-12-15 11:46 ` Marc Zyngier
2016-12-15 11:46 ` Marc Zyngier
2016-12-15 15:15 ` Russell King - ARM Linux
2016-12-15 15:15 ` Russell King - ARM Linux
2016-12-15 15:37 ` Marc Zyngier
2016-12-15 15:37 ` Marc Zyngier
2016-12-15 18:57 ` Russell King - ARM Linux
2016-12-15 18:57 ` Russell King - ARM Linux
2016-12-17 12:07 ` Catalin Marinas
2016-12-17 12:07 ` Catalin Marinas
2017-01-02 12:12 ` Russell King - ARM Linux
2017-01-02 12:12 ` Russell King - ARM Linux
2017-01-03 9:51 ` Christoffer Dall
2017-01-03 9:51 ` Christoffer Dall
2017-01-09 12:26 ` Russell King - ARM Linux
2017-01-09 12:26 ` Russell King - ARM Linux
2017-01-09 13:26 ` Christoffer Dall
2017-01-09 13:26 ` Christoffer Dall
2017-01-09 14:05 ` Russell King - ARM Linux
2017-01-09 14:05 ` Russell King - ARM Linux
2017-01-09 14:10 ` Russell King - ARM Linux
2017-01-09 14:10 ` Russell King - ARM Linux
2017-01-09 14:42 ` Russell King - ARM Linux
2017-01-09 14:42 ` Russell King - ARM Linux
2017-01-09 14:57 ` Christoffer Dall
2017-01-09 14:57 ` Christoffer Dall
2017-01-09 15:01 ` Christoffer Dall
2017-01-09 15:01 ` Christoffer Dall
2017-01-09 15:43 ` Russell King - ARM Linux
2017-01-09 15:43 ` Russell King - ARM Linux
2017-01-09 12:54 ` Russell King - ARM Linux
2017-01-09 12:54 ` Russell King - ARM Linux
2017-01-09 13:14 ` Marc Zyngier
2017-01-09 13:14 ` Marc Zyngier
2017-01-09 13:20 ` Russell King - ARM Linux
2017-01-09 13:20 ` Russell King - ARM Linux
2017-01-09 13:31 ` Marc Zyngier
2017-01-09 13:31 ` Marc Zyngier
2017-01-09 14:28 ` Catalin Marinas
2017-01-09 14:28 ` Catalin Marinas
2016-12-14 10:46 ` [PATCH 2/2] ARM: soft-reboot into same mode that we entered the kernel Russell King
2016-12-14 10:46 ` Russell King
2016-12-14 11:56 ` Mark Rutland
2016-12-14 11:56 ` Mark Rutland
2016-12-14 12:05 ` Russell King - ARM Linux
2016-12-14 12:05 ` Russell King - ARM Linux
2016-12-14 12:17 ` Mark Rutland
2016-12-14 12:17 ` Mark Rutland
2016-12-14 12:29 ` Russell King - ARM Linux
2016-12-14 12:29 ` Russell King - ARM Linux
2016-12-14 12:40 ` Mark Rutland
2016-12-14 12:40 ` Mark Rutland
2016-12-14 12:46 ` Russell King - ARM Linux
2016-12-14 12:46 ` Russell King - ARM Linux
2016-12-14 13:42 ` Marc Zyngier
2016-12-14 13:42 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161214114954.GF17982@leverpostej \
--to=mark.rutland@arm.com \
--cc=dave.martin@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.