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