[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [[PATCH v3] 4/4] xen/arm: Replace call_smc with arm_smccc_smc
On 01/10/18 13:46, Julien Grall wrote: > call_smc is a subset of arm_smccc_smc. Rather than having 2 methods to > do SMCCC call, replace all call to the former by the later. > > Signed-off-by: Julien Grall <julien.grall@xxxxxxx> > > --- > > Changes in v3: > - Use PSCI_RET where needed > --- > xen/arch/arm/Makefile | 1 - > xen/arch/arm/platforms/exynos5.c | 3 ++- > xen/arch/arm/platforms/seattle.c | 4 ++-- > xen/arch/arm/psci.c | 37 +++++++++++++++++++++++++------------ > xen/arch/arm/smc.S | 21 --------------------- > xen/include/asm-arm/processor.h | 3 --- > 6 files changed, 29 insertions(+), 40 deletions(-) > delete mode 100644 xen/arch/arm/smc.S > > diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile > index b9b141dc84..37fa8268b3 100644 > --- a/xen/arch/arm/Makefile > +++ b/xen/arch/arm/Makefile > @@ -39,7 +39,6 @@ obj-y += processor.o > obj-y += psci.o > obj-y += setup.o > obj-y += shutdown.o > -obj-y += smc.o > obj-y += smp.o > obj-y += smpboot.o > obj-y += sysctl.o > diff --git a/xen/arch/arm/platforms/exynos5.c > b/xen/arch/arm/platforms/exynos5.c > index c15ecf80f5..e2c0b7b878 100644 > --- a/xen/arch/arm/platforms/exynos5.c > +++ b/xen/arch/arm/platforms/exynos5.c > @@ -26,6 +26,7 @@ > #include <asm/platforms/exynos5.h> > #include <asm/platform.h> > #include <asm/io.h> > +#include <asm/smccc.h> > > static bool secure_firmware; > > @@ -249,7 +250,7 @@ static int exynos5_cpu_up(int cpu) > iounmap(power); > > if ( secure_firmware ) > - call_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0); > + arm_smccc_smc(SMC_CMD_CPU1BOOT, cpu, NULL); > > return cpu_up_send_sgi(cpu); > } > diff --git a/xen/arch/arm/platforms/seattle.c > b/xen/arch/arm/platforms/seattle.c > index 893cc17972..64cc1868c2 100644 > --- a/xen/arch/arm/platforms/seattle.c > +++ b/xen/arch/arm/platforms/seattle.c > @@ -33,12 +33,12 @@ static const char * const seattle_dt_compat[] __initconst > = > */ > static void seattle_system_reset(void) > { > - call_smc(PSCI_0_2_FN32_SYSTEM_RESET, 0, 0, 0); > + arm_smccc_smc(PSCI_0_2_FN32_SYSTEM_RESET, NULL); > } > > static void seattle_system_off(void) > { > - call_smc(PSCI_0_2_FN32_SYSTEM_OFF, 0, 0, 0); > + arm_smccc_smc(PSCI_0_2_FN32_SYSTEM_OFF, NULL); > } > > PLATFORM_START(seattle, "SEATTLE") > diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c > index 941eec921b..4ae6504f3e 100644 > --- a/xen/arch/arm/psci.c > +++ b/xen/arch/arm/psci.c > @@ -42,42 +42,53 @@ uint32_t smccc_ver; > > static uint32_t psci_cpu_on_nr; > > +#define PSCI_RET(res) ((int32_t)(res).a0) > + > int call_psci_cpu_on(int cpu) > { > - return call_smc(psci_cpu_on_nr, cpu_logical_map(cpu), > __pa(init_secondary), 0); > + struct arm_smccc_res res; > + > + arm_smccc_smc(psci_cpu_on_nr, cpu_logical_map(cpu), __pa(init_secondary), > + &res); > + > + return PSCI_RET(res.a0); > } Sorry if I'm jumping into the middle of a conversation, but why force all callers to manually extract the return value when it is a fixed register? Wouldn't it be far easier to do this: #define arcm_smccc_smc(...) \ ({ \ struct arm_smccc_res res; \ \ if ( cpus_have_const_cap(ARM_SMCCC_1_1) ) \ res = arm_smccc_1_1_smc(__VA_ARGS__); \ else \ res = arm_smccc_1_0_smc(__VA_ARGS__); \ \ (int)res.a0; \ }) Which also allows the compiler to optimise out the structure if it isn't read, and also avoids the caller needing to pass a NULL pointer for "I don't want the result". ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |