diff options
author | Thierry Reding <treding@nvidia.com> | 2019-04-10 04:47:28 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2019-04-17 10:43:03 -0400 |
commit | 4cb5d9eca143f7fbf8cc457be19a91914f978a00 (patch) | |
tree | e89f60dfe3c393a27b65a07cd46a8f7e0e24758a | |
parent | c8e7755ec62b47482d2f1343d5db3a95f807a73f (diff) |
firmware: Move Trusted Foundations support
Move the Trusted Foundations support out of arch/arm/firmware and into
drivers/firmware where most other firmware support implementations are
located.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | arch/arm/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/firmware/Kconfig | 29 | ||||
-rw-r--r-- | arch/arm/firmware/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/cpuidle-tegra114.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/pm.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/reset.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra.c | 3 | ||||
-rw-r--r-- | drivers/firmware/Kconfig | 16 | ||||
-rw-r--r-- | drivers/firmware/Makefile | 1 | ||||
-rw-r--r-- | drivers/firmware/trusted_foundations.c (renamed from arch/arm/firmware/trusted_foundations.c) | 4 | ||||
-rw-r--r-- | include/linux/firmware/trusted_foundations.h (renamed from arch/arm/include/asm/trusted_foundations.h) | 4 |
13 files changed, 30 insertions, 44 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 054ead960f98..f006b3c69247 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -899,8 +899,6 @@ config PLAT_PXA | |||
899 | config PLAT_VERSATILE | 899 | config PLAT_VERSATILE |
900 | bool | 900 | bool |
901 | 901 | ||
902 | source "arch/arm/firmware/Kconfig" | ||
903 | |||
904 | source "arch/arm/mm/Kconfig" | 902 | source "arch/arm/mm/Kconfig" |
905 | 903 | ||
906 | config IWMMXT | 904 | config IWMMXT |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 807a7d06c2a0..05ecc004de86 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -290,7 +290,6 @@ core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ | |||
290 | core-y += arch/arm/probes/ | 290 | core-y += arch/arm/probes/ |
291 | core-y += arch/arm/net/ | 291 | core-y += arch/arm/net/ |
292 | core-y += arch/arm/crypto/ | 292 | core-y += arch/arm/crypto/ |
293 | core-y += arch/arm/firmware/ | ||
294 | core-y += $(machdirs) $(platdirs) | 293 | core-y += $(machdirs) $(platdirs) |
295 | 294 | ||
296 | drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ | 295 | drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ |
diff --git a/arch/arm/firmware/Kconfig b/arch/arm/firmware/Kconfig deleted file mode 100644 index ad396af68e47..000000000000 --- a/arch/arm/firmware/Kconfig +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | config ARCH_SUPPORTS_FIRMWARE | ||
2 | bool | ||
3 | |||
4 | config ARCH_SUPPORTS_TRUSTED_FOUNDATIONS | ||
5 | bool | ||
6 | select ARCH_SUPPORTS_FIRMWARE | ||
7 | |||
8 | menu "Firmware options" | ||
9 | depends on ARCH_SUPPORTS_FIRMWARE | ||
10 | |||
11 | config TRUSTED_FOUNDATIONS | ||
12 | bool "Trusted Foundations secure monitor support" | ||
13 | depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS | ||
14 | default y | ||
15 | help | ||
16 | Some devices (including most Tegra-based consumer devices on the | ||
17 | market) are booted with the Trusted Foundations secure monitor | ||
18 | active, requiring some core operations to be performed by the secure | ||
19 | monitor instead of the kernel. | ||
20 | |||
21 | This option allows the kernel to invoke the secure monitor whenever | ||
22 | required on devices using Trusted Foundations. See | ||
23 | arch/arm/include/asm/trusted_foundations.h or the | ||
24 | tlm,trusted-foundations device tree binding documentation for details | ||
25 | on how to use it. | ||
26 | |||
27 | Say n if you don't know what this is about. | ||
28 | |||
29 | endmenu | ||
diff --git a/arch/arm/firmware/Makefile b/arch/arm/firmware/Makefile deleted file mode 100644 index 6e41336b0bc4..000000000000 --- a/arch/arm/firmware/Makefile +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o | ||
2 | |||
3 | # tf_generic_smc() fails to build with -fsanitize-coverage=trace-pc | ||
4 | KCOV_INSTRUMENT := n | ||
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 7b3fd0995a16..63e89e75639b 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
@@ -3,7 +3,6 @@ menuconfig ARCH_TEGRA | |||
3 | bool "NVIDIA Tegra" | 3 | bool "NVIDIA Tegra" |
4 | depends on ARCH_MULTI_V7 | 4 | depends on ARCH_MULTI_V7 |
5 | select ARCH_HAS_RESET_CONTROLLER | 5 | select ARCH_HAS_RESET_CONTROLLER |
6 | select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS | ||
7 | select ARM_AMBA | 6 | select ARM_AMBA |
8 | select ARM_GIC | 7 | select ARM_GIC |
9 | select CLKSRC_MMIO | 8 | select CLKSRC_MMIO |
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c index 3b9af4766cdf..43c695d83f03 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra114.c +++ b/arch/arm/mach-tegra/cpuidle-tegra114.c | |||
@@ -21,10 +21,11 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | 23 | ||
24 | #include <linux/firmware/trusted_foundations.h> | ||
25 | |||
24 | #include <asm/cpuidle.h> | 26 | #include <asm/cpuidle.h> |
25 | #include <asm/smp_plat.h> | 27 | #include <asm/smp_plat.h> |
26 | #include <asm/suspend.h> | 28 | #include <asm/suspend.h> |
27 | #include <asm/trusted_foundations.h> | ||
28 | #include <asm/psci.h> | 29 | #include <asm/psci.h> |
29 | 30 | ||
30 | #include "cpuidle.h" | 31 | #include "cpuidle.h" |
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index abf5f88778f4..1b0ade06f204 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/suspend.h> | 28 | #include <linux/suspend.h> |
29 | 29 | ||
30 | #include <linux/firmware/trusted_foundations.h> | ||
31 | |||
30 | #include <soc/tegra/flowctrl.h> | 32 | #include <soc/tegra/flowctrl.h> |
31 | #include <soc/tegra/fuse.h> | 33 | #include <soc/tegra/fuse.h> |
32 | #include <soc/tegra/pm.h> | 34 | #include <soc/tegra/pm.h> |
@@ -39,7 +41,6 @@ | |||
39 | #include <asm/smp_plat.h> | 41 | #include <asm/smp_plat.h> |
40 | #include <asm/suspend.h> | 42 | #include <asm/suspend.h> |
41 | #include <asm/tlbflush.h> | 43 | #include <asm/tlbflush.h> |
42 | #include <asm/trusted_foundations.h> | ||
43 | 44 | ||
44 | #include "iomap.h" | 45 | #include "iomap.h" |
45 | #include "pm.h" | 46 | #include "pm.h" |
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c index b02ae7699842..35dc5d419b6f 100644 --- a/arch/arm/mach-tegra/reset.c +++ b/arch/arm/mach-tegra/reset.c | |||
@@ -19,12 +19,13 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | 21 | ||
22 | #include <linux/firmware/trusted_foundations.h> | ||
23 | |||
22 | #include <soc/tegra/fuse.h> | 24 | #include <soc/tegra/fuse.h> |
23 | 25 | ||
24 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
25 | #include <asm/firmware.h> | 27 | #include <asm/firmware.h> |
26 | #include <asm/hardware/cache-l2x0.h> | 28 | #include <asm/hardware/cache-l2x0.h> |
27 | #include <asm/trusted_foundations.h> | ||
28 | 29 | ||
29 | #include "iomap.h" | 30 | #include "iomap.h" |
30 | #include "irammap.h" | 31 | #include "irammap.h" |
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 1e89cfefbf68..3e88f67dd521 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/sys_soc.h> | 35 | #include <linux/sys_soc.h> |
36 | #include <linux/usb/tegra_usb_phy.h> | 36 | #include <linux/usb/tegra_usb_phy.h> |
37 | 37 | ||
38 | #include <linux/firmware/trusted_foundations.h> | ||
39 | |||
38 | #include <soc/tegra/fuse.h> | 40 | #include <soc/tegra/fuse.h> |
39 | #include <soc/tegra/pmc.h> | 41 | #include <soc/tegra/pmc.h> |
40 | 42 | ||
@@ -44,7 +46,6 @@ | |||
44 | #include <asm/mach/time.h> | 46 | #include <asm/mach/time.h> |
45 | #include <asm/mach-types.h> | 47 | #include <asm/mach-types.h> |
46 | #include <asm/setup.h> | 48 | #include <asm/setup.h> |
47 | #include <asm/trusted_foundations.h> | ||
48 | 49 | ||
49 | #include "board.h" | 50 | #include "board.h" |
50 | #include "common.h" | 51 | #include "common.h" |
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index cac16c4b0df3..f0646ac75868 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -267,6 +267,22 @@ config TI_SCI_PROTOCOL | |||
267 | This protocol library is used by client drivers to use the features | 267 | This protocol library is used by client drivers to use the features |
268 | provided by the system controller. | 268 | provided by the system controller. |
269 | 269 | ||
270 | config TRUSTED_FOUNDATIONS | ||
271 | bool "Trusted Foundations secure monitor support" | ||
272 | depends on ARM | ||
273 | help | ||
274 | Some devices (including most early Tegra-based consumer devices on | ||
275 | the market) are booted with the Trusted Foundations secure monitor | ||
276 | active, requiring some core operations to be performed by the secure | ||
277 | monitor instead of the kernel. | ||
278 | |||
279 | This option allows the kernel to invoke the secure monitor whenever | ||
280 | required on devices using Trusted Foundations. See the functions and | ||
281 | comments in linux/firmware/trusted_foundations.h or the device tree | ||
282 | bindings for "tlm,trusted-foundations" for details on how to use it. | ||
283 | |||
284 | Choose N if you don't know what this is about. | ||
285 | |||
270 | config HAVE_ARM_SMCCC | 286 | config HAVE_ARM_SMCCC |
271 | bool | 287 | bool |
272 | 288 | ||
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 80feb635120f..745f4907e69b 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_QCOM_SCM_64) += qcom_scm-64.o | |||
23 | obj-$(CONFIG_QCOM_SCM_32) += qcom_scm-32.o | 23 | obj-$(CONFIG_QCOM_SCM_32) += qcom_scm-32.o |
24 | CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch armv7-a\n.arch_extension sec,-DREQUIRES_SEC=1) -march=armv7-a | 24 | CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch armv7-a\n.arch_extension sec,-DREQUIRES_SEC=1) -march=armv7-a |
25 | obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o | 25 | obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o |
26 | obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o | ||
26 | 27 | ||
27 | obj-$(CONFIG_ARM_SCMI_PROTOCOL) += arm_scmi/ | 28 | obj-$(CONFIG_ARM_SCMI_PROTOCOL) += arm_scmi/ |
28 | obj-y += broadcom/ | 29 | obj-y += broadcom/ |
diff --git a/arch/arm/firmware/trusted_foundations.c b/drivers/firmware/trusted_foundations.c index bb2ee73d9e02..fd4999388ff1 100644 --- a/arch/arm/firmware/trusted_foundations.c +++ b/drivers/firmware/trusted_foundations.c | |||
@@ -17,10 +17,12 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | |||
21 | #include <linux/firmware/trusted_foundations.h> | ||
22 | |||
20 | #include <asm/firmware.h> | 23 | #include <asm/firmware.h> |
21 | #include <asm/hardware/cache-l2x0.h> | 24 | #include <asm/hardware/cache-l2x0.h> |
22 | #include <asm/outercache.h> | 25 | #include <asm/outercache.h> |
23 | #include <asm/trusted_foundations.h> | ||
24 | 26 | ||
25 | #define TF_CACHE_MAINT 0xfffff100 | 27 | #define TF_CACHE_MAINT 0xfffff100 |
26 | 28 | ||
diff --git a/arch/arm/include/asm/trusted_foundations.h b/include/linux/firmware/trusted_foundations.h index 54513c533811..4064e7c74715 100644 --- a/arch/arm/include/asm/trusted_foundations.h +++ b/include/linux/firmware/trusted_foundations.h | |||
@@ -23,8 +23,8 @@ | |||
23 | * PSCI standard. | 23 | * PSCI standard. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H | 26 | #ifndef __FIRMWARE_TRUSTED_FOUNDATIONS_H |
27 | #define __ASM_ARM_TRUSTED_FOUNDATIONS_H | 27 | #define __FIRMWARE_TRUSTED_FOUNDATIONS_H |
28 | 28 | ||
29 | #include <linux/printk.h> | 29 | #include <linux/printk.h> |
30 | #include <linux/bug.h> | 30 | #include <linux/bug.h> |