Now that the type handling is entirely uniform, it's easier to see that
__declare_arg_3() can use __declare_arg_2() and so on, just like the larger
__declare_arg_$()'s already do.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
---
xen/arch/arm/include/asm/smccc.h | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/smccc.h
index 5b30dd57b69d..347c4526d12a 100644
--- a/xen/arch/arm/include/asm/smccc.h
+++ b/xen/arch/arm/include/asm/smccc.h
@@ -114,26 +114,17 @@ struct arm_smccc_res {
#define __declare_arg_1(a0, a1, res) \
typeof(a1) __a1 = (a1); \
- struct arm_smccc_res *___res = (res); \
- register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
+ __declare_arg_0(a0, res); \
register typeof(a1) arg1 ASM_REG(1) = __a1
#define __declare_arg_2(a0, a1, a2, res) \
typeof(a1) __a1 = (a1); \
- typeof(a2) __a2 = (a2); \
- struct arm_smccc_res *___res = (res); \
- register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
- register typeof(a1) arg1 ASM_REG(1) = __a1; \
+ __declare_arg_1(a0, a1, res); \
register typeof(a2) arg2 ASM_REG(2) = __a2
#define __declare_arg_3(a0, a1, a2, a3, res) \
typeof(a1) __a1 = (a1); \
- typeof(a2) __a2 = (a2); \
- typeof(a3) __a3 = (a3); \
- struct arm_smccc_res *___res = (res); \
- register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
- register typeof(a1) arg1 ASM_REG(1) = __a1; \
- register typeof(a2) arg2 ASM_REG(2) = __a2; \
+ __declare_arg_2(a0, a1, a2, res); \
register typeof(a3) arg3 ASM_REG(3) = __a3
#define __declare_arg_4(a0, a1, a2, a3, a4, res) \
--
2.39.5
On 24/02/2026 13:45, Andrew Cooper wrote:
> Now that the type handling is entirely uniform, it's easier to see that
> __declare_arg_3() can use __declare_arg_2() and so on, just like the larger
> __declare_arg_$()'s already do.
>
> No functional change.
This patch won't build.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> ---
> xen/arch/arm/include/asm/smccc.h | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/smccc.h
> index 5b30dd57b69d..347c4526d12a 100644
> --- a/xen/arch/arm/include/asm/smccc.h
> +++ b/xen/arch/arm/include/asm/smccc.h
> @@ -114,26 +114,17 @@ struct arm_smccc_res {
>
> #define __declare_arg_1(a0, a1, res) \
> typeof(a1) __a1 = (a1); \
> - struct arm_smccc_res *___res = (res); \
> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
> + __declare_arg_0(a0, res); \
> register typeof(a1) arg1 ASM_REG(1) = __a1
>
> #define __declare_arg_2(a0, a1, a2, res) \
> typeof(a1) __a1 = (a1); \
You should remove this line and ...
> - typeof(a2) __a2 = (a2); \
keep this line.
> - struct arm_smccc_res *___res = (res); \
> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
> - register typeof(a1) arg1 ASM_REG(1) = __a1; \
> + __declare_arg_1(a0, a1, res); \
> register typeof(a2) arg2 ASM_REG(2) = __a2
>
> #define __declare_arg_3(a0, a1, a2, a3, res) \
> typeof(a1) __a1 = (a1); \
> - typeof(a2) __a2 = (a2); \
Same here.
> - typeof(a3) __a3 = (a3); \
> - struct arm_smccc_res *___res = (res); \
> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
> - register typeof(a1) arg1 ASM_REG(1) = __a1; \
> - register typeof(a2) arg2 ASM_REG(2) = __a2; \
> + __declare_arg_2(a0, a1, a2, res); \
> register typeof(a3) arg3 ASM_REG(3) = __a3
>
> #define __declare_arg_4(a0, a1, a2, a3, a4, res) \
In principal, with the remarks addressed:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
~Michal
On 24/02/2026 2:14 pm, Orzel, Michal wrote:
>
> On 24/02/2026 13:45, Andrew Cooper wrote:
>> Now that the type handling is entirely uniform, it's easier to see that
>> __declare_arg_3() can use __declare_arg_2() and so on, just like the larger
>> __declare_arg_$()'s already do.
>>
>> No functional change.
> This patch won't build.
>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Stefano Stabellini <sstabellini@kernel.org>
>> CC: Julien Grall <julien@xen.org>
>> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
>> CC: Bertrand Marquis <bertrand.marquis@arm.com>
>> CC: Michal Orzel <michal.orzel@amd.com>
>> ---
>> xen/arch/arm/include/asm/smccc.h | 15 +++------------
>> 1 file changed, 3 insertions(+), 12 deletions(-)
>>
>> diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/smccc.h
>> index 5b30dd57b69d..347c4526d12a 100644
>> --- a/xen/arch/arm/include/asm/smccc.h
>> +++ b/xen/arch/arm/include/asm/smccc.h
>> @@ -114,26 +114,17 @@ struct arm_smccc_res {
>>
>> #define __declare_arg_1(a0, a1, res) \
>> typeof(a1) __a1 = (a1); \
>> - struct arm_smccc_res *___res = (res); \
>> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
>> + __declare_arg_0(a0, res); \
>> register typeof(a1) arg1 ASM_REG(1) = __a1
>>
>> #define __declare_arg_2(a0, a1, a2, res) \
>> typeof(a1) __a1 = (a1); \
> You should remove this line and ...
>
>> - typeof(a2) __a2 = (a2); \
> keep this line.
>
>> - struct arm_smccc_res *___res = (res); \
>> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
>> - register typeof(a1) arg1 ASM_REG(1) = __a1; \
>> + __declare_arg_1(a0, a1, res); \
>> register typeof(a2) arg2 ASM_REG(2) = __a2
>>
>> #define __declare_arg_3(a0, a1, a2, a3, res) \
>> typeof(a1) __a1 = (a1); \
>> - typeof(a2) __a2 = (a2); \
> Same here.
Hmm - it built for me. I'd better figure out why I missed it first.
With the second patch, these disappear, which is why _that_ builds.
>
>> - typeof(a3) __a3 = (a3); \
>> - struct arm_smccc_res *___res = (res); \
>> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
>> - register typeof(a1) arg1 ASM_REG(1) = __a1; \
>> - register typeof(a2) arg2 ASM_REG(2) = __a2; \
>> + __declare_arg_2(a0, a1, a2, res); \
>> register typeof(a3) arg3 ASM_REG(3) = __a3
>>
>> #define __declare_arg_4(a0, a1, a2, a3, a4, res) \
> In principal, with the remarks addressed:
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
Thanks.
~Andrew
On 24/02/2026 2:17 pm, Andrew Cooper wrote:
> On 24/02/2026 2:14 pm, Orzel, Michal wrote:
>> On 24/02/2026 13:45, Andrew Cooper wrote:
>>> Now that the type handling is entirely uniform, it's easier to see that
>>> __declare_arg_3() can use __declare_arg_2() and so on, just like the larger
>>> __declare_arg_$()'s already do.
>>>
>>> No functional change.
>> This patch won't build.
>>
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>> ---
>>> CC: Stefano Stabellini <sstabellini@kernel.org>
>>> CC: Julien Grall <julien@xen.org>
>>> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
>>> CC: Bertrand Marquis <bertrand.marquis@arm.com>
>>> CC: Michal Orzel <michal.orzel@amd.com>
>>> ---
>>> xen/arch/arm/include/asm/smccc.h | 15 +++------------
>>> 1 file changed, 3 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/smccc.h
>>> index 5b30dd57b69d..347c4526d12a 100644
>>> --- a/xen/arch/arm/include/asm/smccc.h
>>> +++ b/xen/arch/arm/include/asm/smccc.h
>>> @@ -114,26 +114,17 @@ struct arm_smccc_res {
>>>
>>> #define __declare_arg_1(a0, a1, res) \
>>> typeof(a1) __a1 = (a1); \
>>> - struct arm_smccc_res *___res = (res); \
>>> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
>>> + __declare_arg_0(a0, res); \
>>> register typeof(a1) arg1 ASM_REG(1) = __a1
>>>
>>> #define __declare_arg_2(a0, a1, a2, res) \
>>> typeof(a1) __a1 = (a1); \
>> You should remove this line and ...
>>
>>> - typeof(a2) __a2 = (a2); \
>> keep this line.
>>
>>> - struct arm_smccc_res *___res = (res); \
>>> - register unsigned long arg0 ASM_REG(0) = (uint32_t)(a0);\
>>> - register typeof(a1) arg1 ASM_REG(1) = __a1; \
>>> + __declare_arg_1(a0, a1, res); \
>>> register typeof(a2) arg2 ASM_REG(2) = __a2
>>>
>>> #define __declare_arg_3(a0, a1, a2, a3, res) \
>>> typeof(a1) __a1 = (a1); \
>>> - typeof(a2) __a2 = (a2); \
>> Same here.
> Hmm - it built for me. I'd better figure out why I missed it first.
Ah - a last minute refactor, and I didn't build test on this commit
boundary.
Fixed. Thanks.
~Andrew
© 2016 - 2026 Red Hat, Inc.