blob: 3076eca749abcc19715df4fd56061d87700c5357 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From 088162ab1852aa0f2034199e97a327b6240231db Mon Sep 17 00:00:00 2001
2From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
3Date: Wed, 16 Mar 2022 11:14:09 +0000
4Subject: [PATCH 31/32] ANDROID: trusty: Make trusty transports configurable
5
6With TRUSTY_SMC_TRANSPORT set to 'y', SMC based message passing and
7memory sharing support will be compiled in to trusty core.
8
9With TRUSTY_FFA_TRANSPORT set to 'y', FFA based message passing and
10memory sharing support will be compiled in to trusty core. This
11depends on ARM FF-A driver (ARM_FFA_TRANSPORT).
12
13Enabling any of the transport sets config TRUSTY_HAVE_TRANSPORT to 'y'.
14Not enabling any of the transport causes the build to break.
15
16Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
17Change-Id: Ib5bbf0d39202e6897700264d14371ae33101c1d1
18Upstream-Status: Pending [Not submitted to upstream yet]
19---
20 drivers/trusty/Kconfig | 30 ++++++++++++++++++++++++++++++
21 drivers/trusty/Makefile | 26 +++++++++++++++-----------
22 drivers/trusty/trusty-private.h | 4 ++++
23 drivers/trusty/trusty.c | 7 +++++++
24 4 files changed, 56 insertions(+), 11 deletions(-)
25
26diff --git a/drivers/trusty/Kconfig b/drivers/trusty/Kconfig
27index fcde7f097acf..260022e4595b 100644
28--- a/drivers/trusty/Kconfig
29+++ b/drivers/trusty/Kconfig
30@@ -21,6 +21,36 @@ config TRUSTY
31
32 if TRUSTY
33
34+config TRUSTY_HAVE_TRANSPORT
35+ bool
36+ help
37+ If any of the Trusty transport is enabled then it sets this config
38+ option. This variable is used to break the build when none of the
39+ Trusty transports are enabled.
40+
41+config TRUSTY_SMC_TRANSPORT
42+ bool "Trusty transport based on SMC"
43+ select TRUSTY_HAVE_TRANSPORT
44+ default n
45+ help
46+ Enable SMC based transport for Trusty. This transport is required for
47+ Trusty API version <= TRUSTY_API_VERSION_MEM_OBJ.
48+
49+ If you want to use legacy SMC based transport for sending Trusty
50+ messages to secure world, answer Y.
51+
52+config TRUSTY_FFA_TRANSPORT
53+ bool "Trusty transport based on FFA"
54+ select TRUSTY_HAVE_TRANSPORT
55+ depends on ARM_FFA_TRANSPORT
56+ default y
57+ help
58+ Enable ARM FF-A based transport for Trusty. This transport is required
59+ for Trusty API version >= TRUSTY_API_VERSION_MEM_OBJ.
60+
61+ If you want to use ARM FF-A based transport for sending Trusty messages
62+ to secure world, answer Y.
63+
64 config TRUSTY_IRQ
65 tristate "Trusty IRQ support"
66 default y
67diff --git a/drivers/trusty/Makefile b/drivers/trusty/Makefile
68index 797d61bf68ef..104a4d0ed35c 100644
69--- a/drivers/trusty/Makefile
70+++ b/drivers/trusty/Makefile
71@@ -3,14 +3,18 @@
72 # Makefile for trusty components
73 #
74
75-obj-$(CONFIG_TRUSTY) += trusty-core.o
76-trusty-core-objs += trusty.o trusty-mem.o
77-trusty-core-objs += trusty-smc.o
78-trusty-core-objs += trusty-ffa.o
79-trusty-core-$(CONFIG_ARM) += trusty-smc-arm.o
80-trusty-core-$(CONFIG_ARM64) += trusty-smc-arm64.o
81-obj-$(CONFIG_TRUSTY_IRQ) += trusty-irq.o
82-obj-$(CONFIG_TRUSTY_LOG) += trusty-log.o
83-obj-$(CONFIG_TRUSTY_TEST) += trusty-test.o
84-obj-$(CONFIG_TRUSTY_VIRTIO) += trusty-virtio.o
85-obj-$(CONFIG_TRUSTY_VIRTIO_IPC) += trusty-ipc.o
86+obj-$(CONFIG_TRUSTY) += trusty-core.o
87+trusty-core-objs += trusty.o
88+trusty-arm-smc-$(CONFIG_ARM) += trusty-smc-arm.o
89+trusty-arm-smc64-$(CONFIG_ARM64) += trusty-smc-arm64.o
90+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += trusty-smc.o
91+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += trusty-mem.o
92+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += $(trusty-arm-smc-y)
93+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += $(trusty-arm-smc64-y)
94+trusty-transport-$(CONFIG_TRUSTY_FFA_TRANSPORT) += trusty-ffa.o
95+trusty-core-objs += $(trusty-transport-y)
96+obj-$(CONFIG_TRUSTY_IRQ) += trusty-irq.o
97+obj-$(CONFIG_TRUSTY_LOG) += trusty-log.o
98+obj-$(CONFIG_TRUSTY_TEST) += trusty-test.o
99+obj-$(CONFIG_TRUSTY_VIRTIO) += trusty-virtio.o
100+obj-$(CONFIG_TRUSTY_VIRTIO_IPC) += trusty-ipc.o
101diff --git a/drivers/trusty/trusty-private.h b/drivers/trusty/trusty-private.h
102index 2496f397e5d2..386ca9ae5af3 100644
103--- a/drivers/trusty/trusty-private.h
104+++ b/drivers/trusty/trusty-private.h
105@@ -72,7 +72,11 @@ int trusty_init_api_version(struct trusty_state *s, struct device *dev,
106
107 typedef const struct trusty_transport_desc *trusty_transports_t;
108
109+#ifdef CONFIG_TRUSTY_SMC_TRANSPORT
110 extern const struct trusty_transport_desc trusty_smc_transport;
111+#endif
112+#ifdef CONFIG_TRUSTY_FFA_TRANSPORT
113 extern const struct trusty_transport_desc trusty_ffa_transport;
114+#endif
115
116 #endif /* _TRUSTY_PRIVATE_H */
117diff --git a/drivers/trusty/trusty.c b/drivers/trusty/trusty.c
118index 66273873f169..06698f3c67f9 100644
119--- a/drivers/trusty/trusty.c
120+++ b/drivers/trusty/trusty.c
121@@ -684,8 +684,12 @@ static int trusty_remove(struct platform_device *pdev)
122 *
123 */
124 static const trusty_transports_t trusty_transports[] = {
125+#ifdef CONFIG_TRUSTY_SMC_TRANSPORT
126 &trusty_smc_transport,
127+#endif
128+#ifdef CONFIG_TRUSTY_FFA_TRANSPORT
129 &trusty_ffa_transport,
130+#endif
131 NULL,
132 };
133
134@@ -708,6 +712,9 @@ static struct platform_driver trusty_driver = {
135
136 static int __init trusty_driver_init(void)
137 {
138+ BUILD_BUG_ON_MSG(!IS_ENABLED(CONFIG_TRUSTY_HAVE_TRANSPORT),
139+ "Trusty transport not configured");
140+
141 return platform_driver_register(&trusty_driver);
142 }
143
144--
1452.30.2
146