From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
To: Julien Grall <julien.grall@arm.com>, xen-devel@lists.xen.org
Cc: Marc Zyngier <marc.zyngier@arm.com>, sstabellini@kernel.org
Subject: Re: [PATCH 1/6] xen/arm: smccc-1.1: Make return values unsigned long
Date: Mon, 27 Aug 2018 17:03:22 +0300 [thread overview]
Message-ID: <0c4be1a6-fd6a-3e8f-95b4-966b153eb17f@epam.com> (raw)
In-Reply-To: <20180824165820.32620-2-julien.grall@arm.com>
Hi Julien, Marc
On 24.08.18 19:58, Julien Grall wrote:
> From: Marc Zyngier <marc.zyngier@arm.com>
>
> An unfortunate consequence of having a strong typing for the input
> values to the SMC call is that it also affects the type of the
> return values, limiting r0 to 32 bits and r{1,2,3} to whatever
> was passed as an input. >
> Let's turn everything into "unsigned long", which satisfies the
> requirements of both architectures, and allows for the full
> range of return values.
Maybe it better to use register_t then? By definition register_t has the
same size as a CPU register and SMC uses CPU registers to pass
parameters/return values.
> Reported-by: Stefano Stabellini <stefanos@xilinx.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
> xen/include/asm-arm/smccc.h | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/xen/include/asm-arm/smccc.h b/xen/include/asm-arm/smccc.h
> index 74c13f8419..a31d67a1de 100644
> --- a/xen/include/asm-arm/smccc.h
> +++ b/xen/include/asm-arm/smccc.h
> @@ -119,35 +119,35 @@ struct arm_smccc_res {
>
> #define __declare_arg_0(a0, res) \
> struct arm_smccc_res *___res = res; \
> - register uin32_t r0 asm("r0") = a0; \
> + register unsigned long r0 asm("r0") = (uint32_t)a0;\
Do you really want to silently drop upper 32 bits of the argument?
I know, that SMCCC states that function id is a 32-bit value,
but I don't think that it is a good place to enforce this
behavior.
I think it is better to allow user to shoot in his leg in this case.
> register unsigned long r1 asm("r1"); \
> register unsigned long r2 asm("r2"); \
> register unsigned long r3 asm("r3")
>
> #define __declare_arg_1(a0, a1, res) \
> struct arm_smccc_res *___res = res; \
> - register uint32_t r0 asm("r0") = a0; \
> - register typeof(a1) r1 asm("r1") = a1; \
> + register unsigned long r0 asm("r0") = (uint32_t)a0;\
> + register unsigned long r1 asm("r1") = a1; \
> register unsigned long r2 asm("r2"); \
> register unsigned long r3 asm("r3")
>
> #define __declare_arg_2(a0, a1, a2, res) \
> struct arm_smccc_res *___res = res; \
> - register u32 r0 asm("r0") = a0; \
> - register typeof(a1) r1 asm("r1") = a1; \
> - register typeof(a2) r2 asm("r2") = a2; \
> + register unsigned long r0 asm("r0") = (uint32_t)a0;\
> + register unsigned long r1 asm("r1") = a1; \
> + register unsigned long r2 asm("r2") = a2; \
> register unsigned long r3 asm("r3")
>
> #define __declare_arg_3(a0, a1, a2, a3, res) \
> struct arm_smccc_res *___res = res; \
> - register u32 r0 asm("r0") = a0; \
> - register typeof(a1) r1 asm("r1") = a1; \
> - register typeof(a2) r2 asm("r2") = a2; \
> - register typeof(a3) r3 asm("r3") = a3
> + register unsigned long r0 asm("r0") = (uint32_t)a0;\
> + register unsigned long r1 asm("r1") = a1; \
> + register unsigned long r2 asm("r2") = a2; \
> + register unsigned long r3 asm("r3") = a3
>
> #define __declare_arg_4(a0, a1, a2, a3, a4, res) \
> __declare_arg_3(a0, a1, a2, a3, res); \
> - register typeof(a4) r4 asm("r4") = a4
> + register unsigned long r4 asm("r4") = a4
>
> #define __declare_arg_5(a0, a1, a2, a3, a4, a5, res) \
> __declare_arg_4(a0, a1, a2, a3, a4, res); \
>
--
Volodymyr Babchuk
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-08-27 14:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-24 16:58 [PATCH 0/6] xen/arm: SMCCC fixup and improvement Julien Grall
2018-08-24 16:58 ` [PATCH 1/6] xen/arm: smccc-1.1: Make return values unsigned long Julien Grall
2018-08-27 14:03 ` Volodymyr Babchuk [this message]
2018-08-27 15:23 ` Julien Grall
2018-08-27 16:33 ` Volodymyr Babchuk
2018-08-24 16:58 ` [PATCH 2/6] xen/arm: smccc-1.1: Handle function result as parameters Julien Grall
2018-08-27 14:05 ` Volodymyr Babchuk
2018-08-24 16:58 ` [PATCH 3/6] xen/arm: add SMC wrapper that is compatible with SMCCC v1.0 Julien Grall
2018-08-24 16:58 ` [PATCH 4/6] xen/arm: cpufeature: Add helper to check constant caps Julien Grall
2018-08-30 17:43 ` Volodymyr Babchuk
2018-09-25 16:53 ` Julien Grall
2018-08-24 16:58 ` [PATCH 5/6] xen/arm: smccc: Add wrapper to automatically select the calling convention Julien Grall
2018-08-27 14:15 ` Volodymyr Babchuk
2018-08-27 15:29 ` Julien Grall
2018-08-27 16:50 ` Volodymyr Babchuk
2018-08-28 14:05 ` Julien Grall
2018-08-28 14:40 ` Volodymyr Babchuk
2018-08-28 14:43 ` Julien Grall
2018-08-28 15:10 ` Volodymyr Babchuk
2018-08-28 15:27 ` Julien Grall
2018-08-28 15:50 ` Volodymyr Babchuk
2018-08-28 15:57 ` Julien Grall
2018-08-30 17:45 ` Volodymyr Babchuk
2018-08-24 16:58 ` [PATCH 6/6] xen/arm: Replace call_smc with arm_smccc_smc Julien Grall
2018-08-27 13:53 ` Volodymyr Babchuk
2018-08-30 16:41 ` [PATCH 0/6] xen/arm: SMCCC fixup and improvement Volodymyr Babchuk
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=0c4be1a6-fd6a-3e8f-95b4-966b153eb17f@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=julien.grall@arm.com \
--cc=marc.zyngier@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xen.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).