From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>,
Jan Setje-Eilers <Jan.SetjeEilers@oracle.com>
Subject: [PATCH 3/6] xen/arm: Clean up 32bit arm_smccc_1_1_smc()
Date: Mon, 31 Aug 2026 13:19:42 +0100 [thread overview]
Message-ID: <20260831121944.2908139-4-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20260831121944.2908139-1-andrew.cooper3@citrix.com>
... before making a related copy of it.
* Drop __constraints() so the output parameters are visible in the same block
as they're defined. Use PASTE() rather than opencoding it.
* Adust the indentation of trailing \'s for consistency.
* Drop the newline at the end of the instruction.
* Indent the if condition correctly. ___res is always of type
arm_smccc_res (declared in __declare_arg_0()), so drop the typeof().
* Drop arm_smccc_1_0_smc() as it has no users.
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>
CC: Jan Setje-Eilers <Jan.SetjeEilers@oracle.com>
---
xen/arch/arm/include/asm/smccc.h | 45 ++++++++++++++++----------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/smccc.h
index 832157f43734..5fe54013ac83 100644
--- a/xen/arch/arm/include/asm/smccc.h
+++ b/xen/arch/arm/include/asm/smccc.h
@@ -56,6 +56,8 @@
#ifndef __ASSEMBLER__
+#include <xen/macros.h>
+
extern uint32_t smccc_ver;
/* Check if this is fast call. */
@@ -115,24 +117,24 @@ struct arm_smccc_res {
* This is manual register scheduling for the asm() statement, and any other
* logic to evaluate may clobber the already-scheduled registers.
*/
-#define __declare_arg_0(a0, res) \
- auto __a0 = (uint32_t)(a0); \
- struct arm_smccc_res *___res = (res); \
+#define __declare_arg_0(a0, res) \
+ auto __a0 = (uint32_t)(a0); \
+ struct arm_smccc_res *___res = (res); \
register unsigned long arg0 ASM_REG(0) = __a0
-#define __declare_arg_1(a0, a1, res) \
- auto __a1 = (a1); \
- __declare_arg_0(a0, res); \
+#define __declare_arg_1(a0, a1, res) \
+ auto __a1 = (a1); \
+ __declare_arg_0(a0, res); \
register auto arg1 ASM_REG(1) = __a1
-#define __declare_arg_2(a0, a1, a2, res) \
- auto __a2 = (a2); \
- __declare_arg_1(a0, a1, res); \
+#define __declare_arg_2(a0, a1, a2, res) \
+ auto __a2 = (a2); \
+ __declare_arg_1(a0, a1, res); \
register auto arg2 ASM_REG(2) = __a2
-#define __declare_arg_3(a0, a1, a2, a3, res) \
- auto __a3 = (a3); \
- __declare_arg_2(a0, a1, a2, res); \
+#define __declare_arg_3(a0, a1, a2, a3, res) \
+ auto __a3 = (a3); \
+ __declare_arg_2(a0, a1, a2, res); \
register auto arg3 ASM_REG(3) = __a3
#define __declare_arg_4(a0, a1, a2, a3, a4, res) \
@@ -158,12 +160,6 @@ struct arm_smccc_res {
#define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
#define __declare_args(count, ...) ___declare_args(count, __VA_ARGS__)
-#define ___constraints(count) \
- : "=r" (r0), "=r" (r1), "=r" (r2), "=r" (r3) \
- : __constraint_read_ ## count \
- : "memory"
-#define __constraints(count) ___constraints(count)
-
/*
* arm_smccc_1_1_smc() - make an SMCCC v1.1 compliant SMC call
*
@@ -189,10 +185,14 @@ struct arm_smccc_res {
register unsigned long r2 ASM_REG(2); \
register unsigned long r3 ASM_REG(3); \
__declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
- asm volatile("smc #0\n" \
- __constraints(__count_args(__VA_ARGS__))); \
+ asm volatile ( \
+ "smc #0" \
+ : "=r" (r0), "=r" (r1), "=r" (r2), "=r" (r3) \
+ : PASTE(__constraint_read_, \
+ __count_args(__VA_ARGS__)) \
+ : "memory" ); \
if ( ___res ) \
- *___res = (typeof(*___res)){r0, r1, r2, r3}; \
+ *___res = (struct arm_smccc_res){ r0, r1, r2, r3 }; \
} while ( 0 )
/*
@@ -200,7 +200,6 @@ struct arm_smccc_res {
* v1.1.
*/
#ifdef CONFIG_ARM_32
-#define arm_smccc_1_0_smc(...) arm_smccc_1_1_smc(__VA_ARGS__)
#define arm_smccc_smc(...) arm_smccc_1_1_smc(__VA_ARGS__)
/* Make an SMCCC v1.1 compliant SMC call with guest register state. */
@@ -217,7 +216,7 @@ static inline void arm_smccc_guest_smc(struct cpu_user_regs *regs)
regs->r3 = res.a3;
}
-#else
+#else /* CONFIG_ARM_64 */
void __arm_smccc_1_0_smc(register_t a0, register_t a1, register_t a2,
register_t a3, register_t a4, register_t a5,
--
2.39.5
next prev parent reply other threads:[~2026-08-31 12:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:19 [PATCH 0/5] xen/arm: Fixes and improvements to SMCCC Andrew Cooper
2026-08-31 12:19 ` [PATCH 1/6] xen/arm: Fix evaluation of parameters for SMCCC calls Andrew Cooper
2026-09-03 11:46 ` Bertrand Marquis
2026-08-31 12:19 ` [PATCH 2/6] xen/arm: Introduce arm_smccc_guest_smc() Andrew Cooper
2026-09-03 11:49 ` Bertrand Marquis
2026-08-31 12:19 ` Andrew Cooper [this message]
2026-09-03 11:52 ` [PATCH 3/6] xen/arm: Clean up 32bit arm_smccc_1_1_smc() Bertrand Marquis
2026-08-31 12:19 ` [PATCH 4/6] xen/arm: Rewrite arm_smccc_smc() for arm64 Andrew Cooper
2026-09-03 12:16 ` Bertrand Marquis
2026-09-04 10:50 ` Andrew Cooper
2026-08-31 12:19 ` [PATCH 5/6] xen/arm: Rewrite arm_smccc_*() to return by value Andrew Cooper
2026-09-03 12:21 ` Bertrand Marquis
2026-09-03 9:20 ` [PATCH 0/5] xen/arm: Fixes and improvements to SMCCC Bertrand Marquis
2026-09-03 9:35 ` Andrew Cooper
2026-09-03 10:26 ` Bertrand Marquis
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=20260831121944.2908139-4-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Jan.SetjeEilers@oracle.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 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.