summaryrefslogtreecommitdiff
path: root/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0044-ANDROID-trusty-Make-trusty-transports-configurable.patch
blob: 3076eca749abcc19715df4fd56061d87700c5357 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
From 088162ab1852aa0f2034199e97a327b6240231db Mon Sep 17 00:00:00 2001
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Date: Wed, 16 Mar 2022 11:14:09 +0000
Subject: [PATCH 31/32] ANDROID: trusty: Make trusty transports configurable

With TRUSTY_SMC_TRANSPORT set to 'y', SMC based message passing and
memory sharing support will be compiled in to trusty core.

With TRUSTY_FFA_TRANSPORT set to 'y', FFA based message passing and
memory sharing support will be compiled in to trusty core. This
depends on ARM FF-A driver (ARM_FFA_TRANSPORT).

Enabling any of the transport sets config TRUSTY_HAVE_TRANSPORT to 'y'.
Not enabling any of the transport causes the build to break.

Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: Ib5bbf0d39202e6897700264d14371ae33101c1d1
Upstream-Status: Pending [Not submitted to upstream yet]
---
 drivers/trusty/Kconfig          | 30 ++++++++++++++++++++++++++++++
 drivers/trusty/Makefile         | 26 +++++++++++++++-----------
 drivers/trusty/trusty-private.h |  4 ++++
 drivers/trusty/trusty.c         |  7 +++++++
 4 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/drivers/trusty/Kconfig b/drivers/trusty/Kconfig
index fcde7f097acf..260022e4595b 100644
--- a/drivers/trusty/Kconfig
+++ b/drivers/trusty/Kconfig
@@ -21,6 +21,36 @@ config TRUSTY
 
 if TRUSTY
 
+config TRUSTY_HAVE_TRANSPORT
+	bool
+	help
+	  If any of the Trusty transport is enabled then it sets this config
+	  option. This variable is used to break the build when none of the
+	  Trusty transports are enabled.
+
+config TRUSTY_SMC_TRANSPORT
+	bool "Trusty transport based on SMC"
+	select TRUSTY_HAVE_TRANSPORT
+	default n
+	help
+	  Enable SMC based transport for Trusty. This transport is required for
+	  Trusty API version <= TRUSTY_API_VERSION_MEM_OBJ.
+
+	  If you want to use legacy SMC based transport for sending Trusty
+	  messages to secure world, answer Y.
+
+config TRUSTY_FFA_TRANSPORT
+	bool "Trusty transport based on FFA"
+	select TRUSTY_HAVE_TRANSPORT
+	depends on ARM_FFA_TRANSPORT
+	default y
+	help
+	  Enable ARM FF-A based transport for Trusty. This transport is required
+	  for Trusty API version >= TRUSTY_API_VERSION_MEM_OBJ.
+
+	  If you want to use ARM FF-A based transport for sending Trusty messages
+	  to secure world, answer Y.
+
 config TRUSTY_IRQ
 	tristate "Trusty IRQ support"
 	default y
diff --git a/drivers/trusty/Makefile b/drivers/trusty/Makefile
index 797d61bf68ef..104a4d0ed35c 100644
--- a/drivers/trusty/Makefile
+++ b/drivers/trusty/Makefile
@@ -3,14 +3,18 @@
 # Makefile for trusty components
 #
 
-obj-$(CONFIG_TRUSTY)		+= trusty-core.o
-trusty-core-objs		+= trusty.o trusty-mem.o
-trusty-core-objs		+= trusty-smc.o
-trusty-core-objs		+= trusty-ffa.o
-trusty-core-$(CONFIG_ARM)	+= trusty-smc-arm.o
-trusty-core-$(CONFIG_ARM64)	+= trusty-smc-arm64.o
-obj-$(CONFIG_TRUSTY_IRQ)	+= trusty-irq.o
-obj-$(CONFIG_TRUSTY_LOG)	+= trusty-log.o
-obj-$(CONFIG_TRUSTY_TEST)	+= trusty-test.o
-obj-$(CONFIG_TRUSTY_VIRTIO)	+= trusty-virtio.o
-obj-$(CONFIG_TRUSTY_VIRTIO_IPC)	+= trusty-ipc.o
+obj-$(CONFIG_TRUSTY)				+= trusty-core.o
+trusty-core-objs				+= trusty.o
+trusty-arm-smc-$(CONFIG_ARM)			+= trusty-smc-arm.o
+trusty-arm-smc64-$(CONFIG_ARM64)		+= trusty-smc-arm64.o
+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += trusty-smc.o
+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += trusty-mem.o
+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += $(trusty-arm-smc-y)
+trusty-transport-$(CONFIG_TRUSTY_SMC_TRANSPORT) += $(trusty-arm-smc64-y)
+trusty-transport-$(CONFIG_TRUSTY_FFA_TRANSPORT) += trusty-ffa.o
+trusty-core-objs				+= $(trusty-transport-y)
+obj-$(CONFIG_TRUSTY_IRQ)			+= trusty-irq.o
+obj-$(CONFIG_TRUSTY_LOG)			+= trusty-log.o
+obj-$(CONFIG_TRUSTY_TEST)			+= trusty-test.o
+obj-$(CONFIG_TRUSTY_VIRTIO)			+= trusty-virtio.o
+obj-$(CONFIG_TRUSTY_VIRTIO_IPC)			+= trusty-ipc.o
diff --git a/drivers/trusty/trusty-private.h b/drivers/trusty/trusty-private.h
index 2496f397e5d2..386ca9ae5af3 100644
--- a/drivers/trusty/trusty-private.h
+++ b/drivers/trusty/trusty-private.h
@@ -72,7 +72,11 @@ int trusty_init_api_version(struct trusty_state *s, struct device *dev,
 
 typedef const struct trusty_transport_desc *trusty_transports_t;
 
+#ifdef CONFIG_TRUSTY_SMC_TRANSPORT
 extern const struct trusty_transport_desc trusty_smc_transport;
+#endif
+#ifdef CONFIG_TRUSTY_FFA_TRANSPORT
 extern const struct trusty_transport_desc trusty_ffa_transport;
+#endif
 
 #endif /* _TRUSTY_PRIVATE_H */
diff --git a/drivers/trusty/trusty.c b/drivers/trusty/trusty.c
index 66273873f169..06698f3c67f9 100644
--- a/drivers/trusty/trusty.c
+++ b/drivers/trusty/trusty.c
@@ -684,8 +684,12 @@ static int trusty_remove(struct platform_device *pdev)
  *
  */
 static const trusty_transports_t trusty_transports[] = {
+#ifdef CONFIG_TRUSTY_SMC_TRANSPORT
 	&trusty_smc_transport,
+#endif
+#ifdef CONFIG_TRUSTY_FFA_TRANSPORT
 	&trusty_ffa_transport,
+#endif
 	NULL,
 };
 
@@ -708,6 +712,9 @@ static struct platform_driver trusty_driver = {
 
 static int __init trusty_driver_init(void)
 {
+	BUILD_BUG_ON_MSG(!IS_ENABLED(CONFIG_TRUSTY_HAVE_TRANSPORT),
+			 "Trusty transport not configured");
+
 	return platform_driver_register(&trusty_driver);
 }
 
-- 
2.30.2