diff options
author | Jens Wiklander <jens.wiklander@linaro.org> | 2016-01-04 09:46:47 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2016-01-04 11:24:45 -0500 |
commit | e679660dbb8347f275fe5d83a5dd59c1fb6c8e63 (patch) | |
tree | 33e9b13cb2d34d7dc992ad5fac298dd2b92f7ee3 | |
parent | 14457459f9ca2ff8521686168ea179edc3a56a44 (diff) |
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>
-rw-r--r-- | arch/arm/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/kernel/psci-call.S | 31 | ||||
-rw-r--r-- | arch/arm64/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/psci-call.S | 28 | ||||
-rw-r--r-- | drivers/firmware/psci.c | 23 |
6 files changed, 23 insertions, 64 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 54a8974222c9..f8e7e09a7ac6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1481,7 +1481,7 @@ config HOTPLUG_CPU | |||
1481 | 1481 | ||
1482 | config ARM_PSCI | 1482 | config ARM_PSCI |
1483 | bool "Support for the ARM Power State Coordination Interface (PSCI)" | 1483 | bool "Support for the ARM Power State Coordination Interface (PSCI)" |
1484 | depends on CPU_V7 | 1484 | depends on HAVE_ARM_SMCCC |
1485 | select ARM_PSCI_FW | 1485 | select ARM_PSCI_FW |
1486 | help | 1486 | help |
1487 | Say Y here if you want Linux to communicate with system firmware | 1487 | Say Y here if you want Linux to communicate with system firmware |
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 599c950468fc..82bdac0f2804 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -87,7 +87,6 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | |||
87 | 87 | ||
88 | obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o | 88 | obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o |
89 | ifeq ($(CONFIG_ARM_PSCI),y) | 89 | ifeq ($(CONFIG_ARM_PSCI),y) |
90 | obj-y += psci-call.o | ||
91 | obj-$(CONFIG_SMP) += psci_smp.o | 90 | obj-$(CONFIG_SMP) += psci_smp.o |
92 | endif | 91 | endif |
93 | 92 | ||
diff --git a/arch/arm/kernel/psci-call.S b/arch/arm/kernel/psci-call.S deleted file mode 100644 index a78e9e1e206d..000000000000 --- a/arch/arm/kernel/psci-call.S +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * Copyright (C) 2015 ARM Limited | ||
12 | * | ||
13 | * Author: Mark Rutland <mark.rutland@arm.com> | ||
14 | */ | ||
15 | |||
16 | #include <linux/linkage.h> | ||
17 | |||
18 | #include <asm/opcodes-sec.h> | ||
19 | #include <asm/opcodes-virt.h> | ||
20 | |||
21 | /* int __invoke_psci_fn_hvc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */ | ||
22 | ENTRY(__invoke_psci_fn_hvc) | ||
23 | __HVC(0) | ||
24 | bx lr | ||
25 | ENDPROC(__invoke_psci_fn_hvc) | ||
26 | |||
27 | /* int __invoke_psci_fn_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */ | ||
28 | ENTRY(__invoke_psci_fn_smc) | ||
29 | __SMC(0) | ||
30 | bx lr | ||
31 | ENDPROC(__invoke_psci_fn_smc) | ||
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 0170bea3d4ae..27bf1e5180a1 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile | |||
@@ -14,7 +14,7 @@ CFLAGS_REMOVE_return_address.o = -pg | |||
14 | arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ | 14 | arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ |
15 | entry-fpsimd.o process.o ptrace.o setup.o signal.o \ | 15 | entry-fpsimd.o process.o ptrace.o setup.o signal.o \ |
16 | sys.o stacktrace.o time.o traps.o io.o vdso.o \ | 16 | 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 \ |
18 | return_address.o cpuinfo.o cpu_errata.o \ | 18 | return_address.o cpuinfo.o cpu_errata.o \ |
19 | cpufeature.o alternative.o cacheinfo.o \ | 19 | cpufeature.o alternative.o cacheinfo.o \ |
20 | smp.o smp_spin_table.o topology.o smccc-call.o | 20 | smp.o smp_spin_table.o topology.o smccc-call.o |
diff --git a/arch/arm64/kernel/psci-call.S b/arch/arm64/kernel/psci-call.S deleted file mode 100644 index cf83e61cd3b5..000000000000 --- a/arch/arm64/kernel/psci-call.S +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * Copyright (C) 2015 ARM Limited | ||
12 | * | ||
13 | * Author: Will Deacon <will.deacon@arm.com> | ||
14 | */ | ||
15 | |||
16 | #include <linux/linkage.h> | ||
17 | |||
18 | /* int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ | ||
19 | ENTRY(__invoke_psci_fn_hvc) | ||
20 | hvc #0 | ||
21 | ret | ||
22 | ENDPROC(__invoke_psci_fn_hvc) | ||
23 | |||
24 | /* int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ | ||
25 | ENTRY(__invoke_psci_fn_smc) | ||
26 | smc #0 | ||
27 | ret | ||
28 | ENDPROC(__invoke_psci_fn_smc) | ||
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index d24f35d74b27..f25cd79c8a79 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #define pr_fmt(fmt) "psci: " fmt | 14 | #define pr_fmt(fmt) "psci: " fmt |
15 | 15 | ||
16 | #include <linux/arm-smccc.h> | ||
16 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
17 | #include <linux/linkage.h> | 18 | #include <linux/linkage.h> |
18 | #include <linux/of.h> | 19 | #include <linux/of.h> |
@@ -58,8 +59,6 @@ struct psci_operations psci_ops; | |||
58 | 59 | ||
59 | typedef unsigned long (psci_fn)(unsigned long, unsigned long, | 60 | typedef unsigned long (psci_fn)(unsigned long, unsigned long, |
60 | unsigned long, unsigned long); | 61 | unsigned long, unsigned long); |
61 | asmlinkage psci_fn __invoke_psci_fn_hvc; | ||
62 | asmlinkage psci_fn __invoke_psci_fn_smc; | ||
63 | static psci_fn *invoke_psci_fn; | 62 | static psci_fn *invoke_psci_fn; |
64 | 63 | ||
65 | enum psci_function { | 64 | enum psci_function { |
@@ -107,6 +106,26 @@ bool psci_power_state_is_valid(u32 state) | |||
107 | return !(state & ~valid_mask); | 106 | return !(state & ~valid_mask); |
108 | } | 107 | } |
109 | 108 | ||
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 | |||
110 | static int psci_to_linux_errno(int errno) | 129 | static int psci_to_linux_errno(int errno) |
111 | { | 130 | { |
112 | switch (errno) { | 131 | switch (errno) { |