[PATCH] ARM: SMCCC: make header usable for compile test
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Oct 14 05:50:47 PDT 2024
The only thing truly ARM-specific about the secure monitor
call calling convention is the use of ARM SMC instructions.
Let's stub those out, so the rest of the driver can be compile
tested on other architectures.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
include/linux/arm-smccc.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index f6942c6420d8..feaf934f1333 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -243,6 +243,7 @@ struct arm_smccc_quirk {
} state;
};
+#ifdef CONFIG_ARM
/**
* __arm_smccc_smc() - make SMC calls
* @a0-a7: arguments passed in registers 0 to 7
@@ -277,6 +278,22 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
unsigned long a5, unsigned long a6, unsigned long a7,
struct arm_smccc_res *res, struct arm_smccc_quirk *quirk);
+#else
+static inline void __arm_smccc_smc(unsigned long a0, unsigned long a1,
+ unsigned long a2, unsigned long a3, unsigned long a4,
+ unsigned long a5, unsigned long a6, unsigned long a7,
+ struct arm_smccc_res *res, struct arm_smccc_quirk *quirk)
+{
+}
+
+static inline void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
+ unsigned long a2, unsigned long a3, unsigned long a4,
+ unsigned long a5, unsigned long a6, unsigned long a7,
+ struct arm_smccc_res *res, struct arm_smccc_quirk *quirk)
+{
+}
+#endif
+
#define arm_smccc_smc(...) __arm_smccc_smc(__VA_ARGS__, NULL)
#define arm_smccc_smc_quirk(...) __arm_smccc_smc(__VA_ARGS__)
@@ -370,6 +387,7 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
: "memory"
#define __constraints(count) ___constraints(count)
+#ifdef CONFIG_ARM
/*
* We have an output list that is not necessarily used, and GCC feels
* entitled to optimise the whole sequence away. "volatile" is what
@@ -389,6 +407,10 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
*___res = (typeof(*___res)){r0, r1, r2, r3}; \
} while (0)
+#else
+#define __arm_smccc_1_1(...) (void)0
+#endif
+
/*
* arm_smccc_1_1_smc() - make an SMCCC v1.1 compliant SMC call
*
--
2.39.5
More information about the barebox
mailing list