Skip to content

Commit 722feb6

Browse files
jenswi-linaroAlex Shi
authored andcommitted
ARM: 8481/2: drivers: psci: replace psci firmware calls
Switch to use a generic interface for issuing SMC/HVC based on ARM SMC Calling Convention. Removes now the now unused psci-call.S. Acked-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> (cherry picked from commit e679660dbb8347f275fe5d83a5dd59c1fb6c8e63) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 9012f6b commit 722feb6

6 files changed

Lines changed: 23 additions & 64 deletions

File tree

arch/arm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ config HOTPLUG_CPU
14821482

14831483
config ARM_PSCI
14841484
bool "Support for the ARM Power State Coordination Interface (PSCI)"
1485-
depends on CPU_V7
1485+
depends on HAVE_ARM_SMCCC
14861486
select ARM_PSCI_FW
14871487
help
14881488
Say Y here if you want Linux to communicate with system firmware

arch/arm/kernel/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
8787

8888
obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o
8989
ifeq ($(CONFIG_ARM_PSCI),y)
90-
obj-y += psci-call.o
9190
obj-$(CONFIG_SMP) += psci_smp.o
9291
endif
9392

arch/arm/kernel/psci-call.S

Lines changed: 0 additions & 31 deletions
This file was deleted.

arch/arm64/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ CFLAGS_REMOVE_return_address.o = -pg
1414
arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
1515
entry-fpsimd.o process.o ptrace.o setup.o signal.o \
1616
sys.o stacktrace.o time.o traps.o io.o vdso.o \
17-
hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \
17+
hyp-stub.o psci.o cpu_ops.o insn.o \
1818
return_address.o cpuinfo.o cpu_errata.o \
1919
cpufeature.o alternative.o cacheinfo.o \
2020
smp.o smp_spin_table.o topology.o smccc-call.o

arch/arm64/kernel/psci-call.S

Lines changed: 0 additions & 28 deletions
This file was deleted.

drivers/firmware/psci.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#define pr_fmt(fmt) "psci: " fmt
1515

16+
#include <linux/arm-smccc.h>
1617
#include <linux/errno.h>
1718
#include <linux/linkage.h>
1819
#include <linux/of.h>
@@ -58,8 +59,6 @@ struct psci_operations psci_ops;
5859

5960
typedef unsigned long (psci_fn)(unsigned long, unsigned long,
6061
unsigned long, unsigned long);
61-
asmlinkage psci_fn __invoke_psci_fn_hvc;
62-
asmlinkage psci_fn __invoke_psci_fn_smc;
6362
static psci_fn *invoke_psci_fn;
6463

6564
enum psci_function {
@@ -107,6 +106,26 @@ bool psci_power_state_is_valid(u32 state)
107106
return !(state & ~valid_mask);
108107
}
109108

109+
static unsigned long __invoke_psci_fn_hvc(unsigned long function_id,
110+
unsigned long arg0, unsigned long arg1,
111+
unsigned long arg2)
112+
{
113+
struct arm_smccc_res res;
114+
115+
arm_smccc_hvc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
116+
return res.a0;
117+
}
118+
119+
static unsigned long __invoke_psci_fn_smc(unsigned long function_id,
120+
unsigned long arg0, unsigned long arg1,
121+
unsigned long arg2)
122+
{
123+
struct arm_smccc_res res;
124+
125+
arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
126+
return res.a0;
127+
}
128+
110129
static int psci_to_linux_errno(int errno)
111130
{
112131
switch (errno) {

0 commit comments

Comments
 (0)