Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1 | From 1ecad11415cff1f4a1f098ddb224293fcc8df4a1 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: Fri, 14 Jan 2022 13:41:26 +0000 |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 4 | Subject: [PATCH 28/40] ANDROID: trusty: Remove FFA specific initilization |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 5 | |
| 6 | Remove FFA specific initialization and its arm_ffa.h file from Trusty |
| 7 | driver. These changes are done so that Trusty can use ARM FFA driver |
| 8 | and its related header files. |
| 9 | |
| 10 | Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com> |
| 11 | Change-Id: Iaad473659de94930cdf78cd7201f016d59cee8d7 |
| 12 | Upstream-Status: Pending [Not submitted to upstream yet] |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 13 | Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 14 | --- |
| 15 | drivers/trusty/trusty-mem.c | 37 --- |
| 16 | drivers/trusty/trusty.c | 286 +--------------- |
| 17 | include/linux/trusty/arm_ffa.h | 590 --------------------------------- |
| 18 | include/linux/trusty/trusty.h | 3 - |
| 19 | 4 files changed, 3 insertions(+), 913 deletions(-) |
| 20 | delete mode 100644 include/linux/trusty/arm_ffa.h |
| 21 | |
| 22 | diff --git a/drivers/trusty/trusty-mem.c b/drivers/trusty/trusty-mem.c |
| 23 | index 8a360298e501..7775ff76c38c 100644 |
| 24 | --- a/drivers/trusty/trusty-mem.c |
| 25 | +++ b/drivers/trusty/trusty-mem.c |
| 26 | @@ -5,7 +5,6 @@ |
| 27 | |
| 28 | #include <linux/types.h> |
| 29 | #include <linux/printk.h> |
| 30 | -#include <linux/trusty/arm_ffa.h> |
| 31 | #include <linux/trusty/trusty.h> |
| 32 | #include <linux/trusty/smcall.h> |
| 33 | |
| 34 | @@ -75,8 +74,6 @@ int trusty_encode_page_info(struct ns_mem_page_info *inf, |
| 35 | { |
| 36 | int mem_attr; |
| 37 | u64 pte; |
| 38 | - u8 ffa_mem_attr; |
| 39 | - u8 ffa_mem_perm = 0; |
| 40 | |
| 41 | if (!inf || !page) |
| 42 | return -EINVAL; |
| 43 | @@ -89,30 +86,6 @@ int trusty_encode_page_info(struct ns_mem_page_info *inf, |
| 44 | if (mem_attr < 0) |
| 45 | return mem_attr; |
| 46 | |
| 47 | - switch (mem_attr) { |
| 48 | - case MEM_ATTR_STRONGLY_ORDERED: |
| 49 | - ffa_mem_attr = FFA_MEM_ATTR_DEVICE_NGNRNE; |
| 50 | - break; |
| 51 | - |
| 52 | - case MEM_ATTR_DEVICE: |
| 53 | - ffa_mem_attr = FFA_MEM_ATTR_DEVICE_NGNRE; |
| 54 | - break; |
| 55 | - |
| 56 | - case MEM_ATTR_NORMAL_NON_CACHEABLE: |
| 57 | - ffa_mem_attr = FFA_MEM_ATTR_NORMAL_MEMORY_UNCACHED; |
| 58 | - break; |
| 59 | - |
| 60 | - case MEM_ATTR_NORMAL_WRITE_BACK_READ_ALLOCATE: |
| 61 | - case MEM_ATTR_NORMAL_WRITE_BACK_WRITE_ALLOCATE: |
| 62 | - ffa_mem_attr = FFA_MEM_ATTR_NORMAL_MEMORY_CACHED_WB; |
| 63 | - break; |
| 64 | - |
| 65 | - default: |
| 66 | - return -EINVAL; |
| 67 | - } |
| 68 | - |
| 69 | - inf->paddr = pte; |
| 70 | - |
| 71 | /* add other attributes */ |
| 72 | #if defined(CONFIG_ARM64) || defined(CONFIG_ARM_LPAE) |
| 73 | pte |= pgprot_val(pgprot); |
| 74 | @@ -123,16 +96,6 @@ int trusty_encode_page_info(struct ns_mem_page_info *inf, |
| 75 | pte |= ATTR_INNER_SHAREABLE; /* inner sharable */ |
| 76 | #endif |
| 77 | |
| 78 | - if (!(pte & ATTR_RDONLY)) |
| 79 | - ffa_mem_perm |= FFA_MEM_PERM_RW; |
| 80 | - else |
| 81 | - ffa_mem_perm |= FFA_MEM_PERM_RO; |
| 82 | - |
| 83 | - if ((pte & ATTR_INNER_SHAREABLE) == ATTR_INNER_SHAREABLE) |
| 84 | - ffa_mem_attr |= FFA_MEM_ATTR_INNER_SHAREABLE; |
| 85 | - |
| 86 | - inf->ffa_mem_attr = ffa_mem_attr; |
| 87 | - inf->ffa_mem_perm = ffa_mem_perm; |
| 88 | inf->compat_attr = (pte & 0x0000FFFFFFFFFFFFull) | |
| 89 | ((u64)mem_attr << 48); |
| 90 | return 0; |
| 91 | diff --git a/drivers/trusty/trusty.c b/drivers/trusty/trusty.c |
| 92 | index 265eab52aea0..2dec75398f69 100644 |
| 93 | --- a/drivers/trusty/trusty.c |
| 94 | +++ b/drivers/trusty/trusty.c |
| 95 | @@ -11,7 +11,6 @@ |
| 96 | #include <linux/slab.h> |
| 97 | #include <linux/stat.h> |
| 98 | #include <linux/string.h> |
| 99 | -#include <linux/trusty/arm_ffa.h> |
| 100 | #include <linux/trusty/smcall.h> |
| 101 | #include <linux/trusty/sm_err.h> |
| 102 | #include <linux/trusty/trusty.h> |
| 103 | @@ -42,11 +41,6 @@ struct trusty_state { |
| 104 | struct list_head nop_queue; |
| 105 | spinlock_t nop_lock; /* protects nop_queue */ |
| 106 | struct device_dma_parameters dma_parms; |
| 107 | - void *ffa_tx; |
| 108 | - void *ffa_rx; |
| 109 | - u16 ffa_local_id; |
| 110 | - u16 ffa_remote_id; |
| 111 | - struct mutex share_memory_msg_lock; /* protects share_memory_msg */ |
| 112 | }; |
| 113 | |
| 114 | static inline unsigned long smc(unsigned long r0, unsigned long r1, |
| 115 | @@ -246,19 +240,6 @@ int trusty_transfer_memory(struct device *dev, u64 *id, |
| 116 | struct ns_mem_page_info pg_inf; |
| 117 | struct scatterlist *sg; |
| 118 | size_t count; |
| 119 | - size_t i; |
| 120 | - size_t len; |
| 121 | - u64 ffa_handle = 0; |
| 122 | - size_t total_len; |
| 123 | - size_t endpoint_count = 1; |
| 124 | - struct ffa_mtd *mtd = s->ffa_tx; |
| 125 | - size_t comp_mrd_offset = offsetof(struct ffa_mtd, emad[endpoint_count]); |
| 126 | - struct ffa_comp_mrd *comp_mrd = s->ffa_tx + comp_mrd_offset; |
| 127 | - struct ffa_cons_mrd *cons_mrd = comp_mrd->address_range_array; |
| 128 | - size_t cons_mrd_offset = (void *)cons_mrd - s->ffa_tx; |
| 129 | - struct smc_ret8 smc_ret; |
| 130 | - u32 cookie_low; |
| 131 | - u32 cookie_high; |
| 132 | |
| 133 | if (WARN_ON(dev->driver != &trusty_driver.driver)) |
| 134 | return -EINVAL; |
| 135 | @@ -284,126 +265,11 @@ int trusty_transfer_memory(struct device *dev, u64 *id, |
| 136 | if (ret) { |
| 137 | dev_err(s->dev, "%s: trusty_encode_page_info failed\n", |
| 138 | __func__); |
| 139 | - goto err_encode_page_info; |
| 140 | - } |
| 141 | - |
| 142 | - if (s->api_version < TRUSTY_API_VERSION_MEM_OBJ) { |
| 143 | - *id = pg_inf.compat_attr; |
| 144 | - return 0; |
| 145 | - } |
| 146 | - |
| 147 | - len = 0; |
| 148 | - for_each_sg(sglist, sg, nents, i) |
| 149 | - len += sg_dma_len(sg); |
| 150 | - |
| 151 | - mutex_lock(&s->share_memory_msg_lock); |
| 152 | - |
| 153 | - mtd->sender_id = s->ffa_local_id; |
| 154 | - mtd->memory_region_attributes = pg_inf.ffa_mem_attr; |
| 155 | - mtd->reserved_3 = 0; |
| 156 | - mtd->flags = 0; |
| 157 | - mtd->handle = 0; |
| 158 | - mtd->tag = tag; |
| 159 | - mtd->reserved_24_27 = 0; |
| 160 | - mtd->emad_count = endpoint_count; |
| 161 | - for (i = 0; i < endpoint_count; i++) { |
| 162 | - struct ffa_emad *emad = &mtd->emad[i]; |
| 163 | - /* TODO: support stream ids */ |
| 164 | - emad->mapd.endpoint_id = s->ffa_remote_id; |
| 165 | - emad->mapd.memory_access_permissions = pg_inf.ffa_mem_perm; |
| 166 | - emad->mapd.flags = 0; |
| 167 | - emad->comp_mrd_offset = comp_mrd_offset; |
| 168 | - emad->reserved_8_15 = 0; |
| 169 | - } |
| 170 | - comp_mrd->total_page_count = len / PAGE_SIZE; |
| 171 | - comp_mrd->address_range_count = nents; |
| 172 | - comp_mrd->reserved_8_15 = 0; |
| 173 | - |
| 174 | - total_len = cons_mrd_offset + nents * sizeof(*cons_mrd); |
| 175 | - sg = sglist; |
| 176 | - while (count) { |
| 177 | - size_t lcount = |
| 178 | - min_t(size_t, count, (PAGE_SIZE - cons_mrd_offset) / |
| 179 | - sizeof(*cons_mrd)); |
| 180 | - size_t fragment_len = lcount * sizeof(*cons_mrd) + |
| 181 | - cons_mrd_offset; |
| 182 | - |
| 183 | - for (i = 0; i < lcount; i++) { |
| 184 | - cons_mrd[i].address = sg_dma_address(sg); |
| 185 | - cons_mrd[i].page_count = sg_dma_len(sg) / PAGE_SIZE; |
| 186 | - cons_mrd[i].reserved_12_15 = 0; |
| 187 | - sg = sg_next(sg); |
| 188 | - } |
| 189 | - count -= lcount; |
| 190 | - if (cons_mrd_offset) { |
| 191 | - u32 smc = lend ? SMC_FC_FFA_MEM_LEND : |
| 192 | - SMC_FC_FFA_MEM_SHARE; |
| 193 | - /* First fragment */ |
| 194 | - smc_ret = trusty_smc8(smc, total_len, |
| 195 | - fragment_len, 0, 0, 0, 0, 0); |
| 196 | - } else { |
| 197 | - smc_ret = trusty_smc8(SMC_FC_FFA_MEM_FRAG_TX, |
| 198 | - cookie_low, cookie_high, |
| 199 | - fragment_len, 0, 0, 0, 0); |
| 200 | - } |
| 201 | - if (smc_ret.r0 == SMC_FC_FFA_MEM_FRAG_RX) { |
| 202 | - cookie_low = smc_ret.r1; |
| 203 | - cookie_high = smc_ret.r2; |
| 204 | - dev_dbg(s->dev, "cookie %x %x", cookie_low, |
| 205 | - cookie_high); |
| 206 | - if (!count) { |
| 207 | - /* |
| 208 | - * We have sent all our descriptors. Expected |
| 209 | - * SMC_FC_FFA_SUCCESS, not a request to send |
| 210 | - * another fragment. |
| 211 | - */ |
| 212 | - dev_err(s->dev, "%s: fragment_len %zd/%zd, unexpected SMC_FC_FFA_MEM_FRAG_RX\n", |
| 213 | - __func__, fragment_len, total_len); |
| 214 | - ret = -EIO; |
| 215 | - break; |
| 216 | - } |
| 217 | - } else if (smc_ret.r0 == SMC_FC_FFA_SUCCESS) { |
| 218 | - ffa_handle = smc_ret.r2 | (u64)smc_ret.r3 << 32; |
| 219 | - dev_dbg(s->dev, "%s: fragment_len %zu/%zu, got handle 0x%llx\n", |
| 220 | - __func__, fragment_len, total_len, |
| 221 | - ffa_handle); |
| 222 | - if (count) { |
| 223 | - /* |
| 224 | - * We have not sent all our descriptors. |
| 225 | - * Expected SMC_FC_FFA_MEM_FRAG_RX not |
| 226 | - * SMC_FC_FFA_SUCCESS. |
| 227 | - */ |
| 228 | - dev_err(s->dev, "%s: fragment_len %zu/%zu, unexpected SMC_FC_FFA_SUCCESS, count %zu != 0\n", |
| 229 | - __func__, fragment_len, total_len, |
| 230 | - count); |
| 231 | - ret = -EIO; |
| 232 | - break; |
| 233 | - } |
| 234 | - } else { |
| 235 | - dev_err(s->dev, "%s: fragment_len %zu/%zu, SMC_FC_FFA_MEM_SHARE failed 0x%lx 0x%lx 0x%lx", |
| 236 | - __func__, fragment_len, total_len, |
| 237 | - smc_ret.r0, smc_ret.r1, smc_ret.r2); |
| 238 | - ret = -EIO; |
| 239 | - break; |
| 240 | - } |
| 241 | - |
| 242 | - cons_mrd = s->ffa_tx; |
| 243 | - cons_mrd_offset = 0; |
| 244 | - } |
| 245 | - |
| 246 | - mutex_unlock(&s->share_memory_msg_lock); |
| 247 | - |
| 248 | - if (!ret) { |
| 249 | - *id = ffa_handle; |
| 250 | - dev_dbg(s->dev, "%s: done\n", __func__); |
| 251 | - return 0; |
| 252 | + return ret; |
| 253 | } |
| 254 | |
| 255 | - dev_err(s->dev, "%s: failed %d", __func__, ret); |
| 256 | - |
| 257 | -err_encode_page_info: |
| 258 | - dma_unmap_sg(dev, sglist, nents, DMA_BIDIRECTIONAL); |
| 259 | - return ret; |
| 260 | + *id = pg_inf.compat_attr; |
| 261 | + return 0; |
| 262 | } |
| 263 | EXPORT_SYMBOL(trusty_transfer_memory); |
| 264 | |
| 265 | @@ -433,8 +299,6 @@ int trusty_reclaim_memory(struct device *dev, u64 id, |
| 266 | struct scatterlist *sglist, unsigned int nents) |
| 267 | { |
| 268 | struct trusty_state *s = platform_get_drvdata(to_platform_device(dev)); |
| 269 | - int ret = 0; |
| 270 | - struct smc_ret8 smc_ret; |
| 271 | |
| 272 | if (WARN_ON(dev->driver != &trusty_driver.driver)) |
| 273 | return -EINVAL; |
| 274 | @@ -454,28 +318,6 @@ int trusty_reclaim_memory(struct device *dev, u64 id, |
| 275 | return 0; |
| 276 | } |
| 277 | |
| 278 | - mutex_lock(&s->share_memory_msg_lock); |
| 279 | - |
| 280 | - smc_ret = trusty_smc8(SMC_FC_FFA_MEM_RECLAIM, (u32)id, id >> 32, 0, 0, |
| 281 | - 0, 0, 0); |
| 282 | - if (smc_ret.r0 != SMC_FC_FFA_SUCCESS) { |
| 283 | - dev_err(s->dev, "%s: SMC_FC_FFA_MEM_RECLAIM failed 0x%lx 0x%lx 0x%lx", |
| 284 | - __func__, smc_ret.r0, smc_ret.r1, smc_ret.r2); |
| 285 | - if (smc_ret.r0 == SMC_FC_FFA_ERROR && |
| 286 | - smc_ret.r2 == FFA_ERROR_DENIED) |
| 287 | - ret = -EBUSY; |
| 288 | - else |
| 289 | - ret = -EIO; |
| 290 | - } |
| 291 | - |
| 292 | - mutex_unlock(&s->share_memory_msg_lock); |
| 293 | - |
| 294 | - if (ret != 0) |
| 295 | - return ret; |
| 296 | - |
| 297 | - dma_unmap_sg(dev, sglist, nents, DMA_BIDIRECTIONAL); |
| 298 | - |
| 299 | - dev_dbg(s->dev, "%s: done\n", __func__); |
| 300 | return 0; |
| 301 | } |
| 302 | EXPORT_SYMBOL(trusty_reclaim_memory); |
| 303 | @@ -527,118 +369,6 @@ const char *trusty_version_str_get(struct device *dev) |
| 304 | } |
| 305 | EXPORT_SYMBOL(trusty_version_str_get); |
| 306 | |
| 307 | -static int trusty_init_msg_buf(struct trusty_state *s, struct device *dev) |
| 308 | -{ |
| 309 | - phys_addr_t tx_paddr; |
| 310 | - phys_addr_t rx_paddr; |
| 311 | - int ret; |
| 312 | - struct smc_ret8 smc_ret; |
| 313 | - |
| 314 | - if (s->api_version < TRUSTY_API_VERSION_MEM_OBJ) |
| 315 | - return 0; |
| 316 | - |
| 317 | - /* Get supported FF-A version and check if it is compatible */ |
| 318 | - smc_ret = trusty_smc8(SMC_FC_FFA_VERSION, FFA_CURRENT_VERSION, 0, 0, |
| 319 | - 0, 0, 0, 0); |
| 320 | - if (FFA_VERSION_TO_MAJOR(smc_ret.r0) != FFA_CURRENT_VERSION_MAJOR) { |
| 321 | - dev_err(s->dev, |
| 322 | - "%s: Unsupported FF-A version 0x%lx, expected 0x%x\n", |
| 323 | - __func__, smc_ret.r0, FFA_CURRENT_VERSION); |
| 324 | - ret = -EIO; |
| 325 | - goto err_version; |
| 326 | - } |
| 327 | - |
| 328 | - /* Check that SMC_FC_FFA_MEM_SHARE is implemented */ |
| 329 | - smc_ret = trusty_smc8(SMC_FC_FFA_FEATURES, SMC_FC_FFA_MEM_SHARE, 0, 0, |
| 330 | - 0, 0, 0, 0); |
| 331 | - if (smc_ret.r0 != SMC_FC_FFA_SUCCESS) { |
| 332 | - dev_err(s->dev, |
| 333 | - "%s: SMC_FC_FFA_FEATURES(SMC_FC_FFA_MEM_SHARE) failed 0x%lx 0x%lx 0x%lx\n", |
| 334 | - __func__, smc_ret.r0, smc_ret.r1, smc_ret.r2); |
| 335 | - ret = -EIO; |
| 336 | - goto err_features; |
| 337 | - } |
| 338 | - |
| 339 | - /* |
| 340 | - * Set FF-A endpoint IDs. |
| 341 | - * |
| 342 | - * Hardcode 0x8000 for the secure os. |
| 343 | - * TODO: Use FF-A call or device tree to configure this dynamically |
| 344 | - */ |
| 345 | - smc_ret = trusty_smc8(SMC_FC_FFA_ID_GET, 0, 0, 0, 0, 0, 0, 0); |
| 346 | - if (smc_ret.r0 != SMC_FC_FFA_SUCCESS) { |
| 347 | - dev_err(s->dev, |
| 348 | - "%s: SMC_FC_FFA_ID_GET failed 0x%lx 0x%lx 0x%lx\n", |
| 349 | - __func__, smc_ret.r0, smc_ret.r1, smc_ret.r2); |
| 350 | - ret = -EIO; |
| 351 | - goto err_id_get; |
| 352 | - } |
| 353 | - |
| 354 | - s->ffa_local_id = smc_ret.r2; |
| 355 | - s->ffa_remote_id = 0x8000; |
| 356 | - |
| 357 | - s->ffa_tx = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 358 | - if (!s->ffa_tx) { |
| 359 | - ret = -ENOMEM; |
| 360 | - goto err_alloc_tx; |
| 361 | - } |
| 362 | - tx_paddr = virt_to_phys(s->ffa_tx); |
| 363 | - if (WARN_ON(tx_paddr & (PAGE_SIZE - 1))) { |
| 364 | - ret = -EINVAL; |
| 365 | - goto err_unaligned_tx_buf; |
| 366 | - } |
| 367 | - |
| 368 | - s->ffa_rx = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 369 | - if (!s->ffa_rx) { |
| 370 | - ret = -ENOMEM; |
| 371 | - goto err_alloc_rx; |
| 372 | - } |
| 373 | - rx_paddr = virt_to_phys(s->ffa_rx); |
| 374 | - if (WARN_ON(rx_paddr & (PAGE_SIZE - 1))) { |
| 375 | - ret = -EINVAL; |
| 376 | - goto err_unaligned_rx_buf; |
| 377 | - } |
| 378 | - |
| 379 | - smc_ret = trusty_smc8(SMC_FCZ_FFA_RXTX_MAP, tx_paddr, rx_paddr, 1, 0, |
| 380 | - 0, 0, 0); |
| 381 | - if (smc_ret.r0 != SMC_FC_FFA_SUCCESS) { |
| 382 | - dev_err(s->dev, "%s: SMC_FCZ_FFA_RXTX_MAP failed 0x%lx 0x%lx 0x%lx\n", |
| 383 | - __func__, smc_ret.r0, smc_ret.r1, smc_ret.r2); |
| 384 | - ret = -EIO; |
| 385 | - goto err_rxtx_map; |
| 386 | - } |
| 387 | - |
| 388 | - return 0; |
| 389 | - |
| 390 | -err_rxtx_map: |
| 391 | -err_unaligned_rx_buf: |
| 392 | - kfree(s->ffa_rx); |
| 393 | - s->ffa_rx = NULL; |
| 394 | -err_alloc_rx: |
| 395 | -err_unaligned_tx_buf: |
| 396 | - kfree(s->ffa_tx); |
| 397 | - s->ffa_tx = NULL; |
| 398 | -err_alloc_tx: |
| 399 | -err_id_get: |
| 400 | -err_features: |
| 401 | -err_version: |
| 402 | - return ret; |
| 403 | -} |
| 404 | - |
| 405 | -static void trusty_free_msg_buf(struct trusty_state *s, struct device *dev) |
| 406 | -{ |
| 407 | - struct smc_ret8 smc_ret; |
| 408 | - |
| 409 | - smc_ret = trusty_smc8(SMC_FC_FFA_RXTX_UNMAP, 0, 0, 0, 0, 0, 0, 0); |
| 410 | - if (smc_ret.r0 != SMC_FC_FFA_SUCCESS) { |
| 411 | - dev_err(s->dev, "%s: SMC_FC_FFA_RXTX_UNMAP failed 0x%lx 0x%lx 0x%lx\n", |
| 412 | - __func__, smc_ret.r0, smc_ret.r1, smc_ret.r2); |
| 413 | - } else { |
| 414 | - kfree(s->ffa_rx); |
| 415 | - kfree(s->ffa_tx); |
| 416 | - } |
| 417 | -} |
| 418 | - |
| 419 | static void trusty_init_version(struct trusty_state *s, struct device *dev) |
| 420 | { |
| 421 | int ret; |
| 422 | @@ -842,7 +572,6 @@ static int trusty_probe(struct platform_device *pdev) |
| 423 | spin_lock_init(&s->nop_lock); |
| 424 | INIT_LIST_HEAD(&s->nop_queue); |
| 425 | mutex_init(&s->smc_lock); |
| 426 | - mutex_init(&s->share_memory_msg_lock); |
| 427 | ATOMIC_INIT_NOTIFIER_HEAD(&s->notifier); |
| 428 | init_completion(&s->cpu_idle_completion); |
| 429 | |
| 430 | @@ -862,10 +591,6 @@ static int trusty_probe(struct platform_device *pdev) |
| 431 | if (ret < 0) |
| 432 | goto err_api_version; |
| 433 | |
| 434 | - ret = trusty_init_msg_buf(s, &pdev->dev); |
| 435 | - if (ret < 0) |
| 436 | - goto err_init_msg_buf; |
| 437 | - |
| 438 | s->nop_wq = alloc_workqueue("trusty-nop-wq", WQ_CPU_INTENSIVE, 0); |
| 439 | if (!s->nop_wq) { |
| 440 | ret = -ENODEV; |
| 441 | @@ -910,13 +635,10 @@ static int trusty_probe(struct platform_device *pdev) |
| 442 | err_alloc_works: |
| 443 | destroy_workqueue(s->nop_wq); |
| 444 | err_create_nop_wq: |
| 445 | - trusty_free_msg_buf(s, &pdev->dev); |
| 446 | -err_init_msg_buf: |
| 447 | err_api_version: |
| 448 | s->dev->dma_parms = NULL; |
| 449 | kfree(s->version_str); |
| 450 | device_for_each_child(&pdev->dev, NULL, trusty_remove_child); |
| 451 | - mutex_destroy(&s->share_memory_msg_lock); |
| 452 | mutex_destroy(&s->smc_lock); |
| 453 | kfree(s); |
| 454 | err_allocate_state: |
| 455 | @@ -938,9 +660,7 @@ static int trusty_remove(struct platform_device *pdev) |
| 456 | free_percpu(s->nop_works); |
| 457 | destroy_workqueue(s->nop_wq); |
| 458 | |
| 459 | - mutex_destroy(&s->share_memory_msg_lock); |
| 460 | mutex_destroy(&s->smc_lock); |
| 461 | - trusty_free_msg_buf(s, &pdev->dev); |
| 462 | s->dev->dma_parms = NULL; |
| 463 | kfree(s->version_str); |
| 464 | kfree(s); |
| 465 | diff --git a/include/linux/trusty/arm_ffa.h b/include/linux/trusty/arm_ffa.h |
| 466 | deleted file mode 100644 |
| 467 | index ab7b2afb794c..000000000000 |
| 468 | --- a/include/linux/trusty/arm_ffa.h |
| 469 | +++ /dev/null |
| 470 | @@ -1,590 +0,0 @@ |
| 471 | -/* SPDX-License-Identifier: MIT */ |
| 472 | -/* |
| 473 | - * Copyright (C) 2020 Google, Inc. |
| 474 | - * |
| 475 | - * Trusty and TF-A also have a copy of this header. |
| 476 | - * Please keep the copies in sync. |
| 477 | - */ |
| 478 | -#ifndef __LINUX_TRUSTY_ARM_FFA_H |
| 479 | -#define __LINUX_TRUSTY_ARM_FFA_H |
| 480 | - |
| 481 | -/* |
| 482 | - * Subset of Arm PSA Firmware Framework for Arm v8-A 1.0 EAC 1_0 |
| 483 | - * (https://developer.arm.com/docs/den0077/a) needed for shared memory. |
| 484 | - */ |
| 485 | - |
| 486 | -#include "smcall.h" |
| 487 | - |
| 488 | -#ifndef STATIC_ASSERT |
| 489 | -#define STATIC_ASSERT(e) _Static_assert(e, #e) |
| 490 | -#endif |
| 491 | - |
| 492 | -#define FFA_CURRENT_VERSION_MAJOR (1U) |
| 493 | -#define FFA_CURRENT_VERSION_MINOR (0U) |
| 494 | - |
| 495 | -#define FFA_VERSION_TO_MAJOR(version) ((version) >> 16) |
| 496 | -#define FFA_VERSION_TO_MINOR(version) ((version) & (0xffff)) |
| 497 | -#define FFA_VERSION(major, minor) (((major) << 16) | (minor)) |
| 498 | -#define FFA_CURRENT_VERSION \ |
| 499 | - FFA_VERSION(FFA_CURRENT_VERSION_MAJOR, FFA_CURRENT_VERSION_MINOR) |
| 500 | - |
| 501 | -#define SMC_ENTITY_SHARED_MEMORY 4 |
| 502 | - |
| 503 | -#define SMC_FASTCALL_NR_SHARED_MEMORY(nr) \ |
| 504 | - SMC_FASTCALL_NR(SMC_ENTITY_SHARED_MEMORY, nr) |
| 505 | -#define SMC_FASTCALL64_NR_SHARED_MEMORY(nr) \ |
| 506 | - SMC_FASTCALL64_NR(SMC_ENTITY_SHARED_MEMORY, nr) |
| 507 | - |
| 508 | -/** |
| 509 | - * typedef ffa_endpoint_id16_t - Endpoint ID |
| 510 | - * |
| 511 | - * Current implementation only supports VMIDs. FFA spec also support stream |
| 512 | - * endpoint ids. |
| 513 | - */ |
| 514 | -typedef uint16_t ffa_endpoint_id16_t; |
| 515 | - |
| 516 | -/** |
| 517 | - * struct ffa_cons_mrd - Constituent memory region descriptor |
| 518 | - * @address: |
| 519 | - * Start address of contiguous memory region. Must be 4K page aligned. |
| 520 | - * @page_count: |
| 521 | - * Number of 4K pages in region. |
| 522 | - * @reserved_12_15: |
| 523 | - * Reserve bytes 12-15 to pad struct size to 16 bytes. |
| 524 | - */ |
| 525 | -struct ffa_cons_mrd { |
| 526 | - uint64_t address; |
| 527 | - uint32_t page_count; |
| 528 | - uint32_t reserved_12_15; |
| 529 | -}; |
| 530 | -STATIC_ASSERT(sizeof(struct ffa_cons_mrd) == 16); |
| 531 | - |
| 532 | -/** |
| 533 | - * struct ffa_comp_mrd - Composite memory region descriptor |
| 534 | - * @total_page_count: |
| 535 | - * Number of 4k pages in memory region. Must match sum of |
| 536 | - * @address_range_array[].page_count. |
| 537 | - * @address_range_count: |
| 538 | - * Number of entries in @address_range_array. |
| 539 | - * @reserved_8_15: |
| 540 | - * Reserve bytes 8-15 to pad struct size to 16 byte alignment and |
| 541 | - * make @address_range_array 16 byte aligned. |
| 542 | - * @address_range_array: |
| 543 | - * Array of &struct ffa_cons_mrd entries. |
| 544 | - */ |
| 545 | -struct ffa_comp_mrd { |
| 546 | - uint32_t total_page_count; |
| 547 | - uint32_t address_range_count; |
| 548 | - uint64_t reserved_8_15; |
| 549 | - struct ffa_cons_mrd address_range_array[]; |
| 550 | -}; |
| 551 | -STATIC_ASSERT(sizeof(struct ffa_comp_mrd) == 16); |
| 552 | - |
| 553 | -/** |
| 554 | - * typedef ffa_mem_attr8_t - Memory region attributes |
| 555 | - * |
| 556 | - * * @FFA_MEM_ATTR_DEVICE_NGNRNE: |
| 557 | - * Device-nGnRnE. |
| 558 | - * * @FFA_MEM_ATTR_DEVICE_NGNRE: |
| 559 | - * Device-nGnRE. |
| 560 | - * * @FFA_MEM_ATTR_DEVICE_NGRE: |
| 561 | - * Device-nGRE. |
| 562 | - * * @FFA_MEM_ATTR_DEVICE_GRE: |
| 563 | - * Device-GRE. |
| 564 | - * * @FFA_MEM_ATTR_NORMAL_MEMORY_UNCACHED |
| 565 | - * Normal memory. Non-cacheable. |
| 566 | - * * @FFA_MEM_ATTR_NORMAL_MEMORY_CACHED_WB |
| 567 | - * Normal memory. Write-back cached. |
| 568 | - * * @FFA_MEM_ATTR_NON_SHAREABLE |
| 569 | - * Non-shareable. Combine with FFA_MEM_ATTR_NORMAL_MEMORY_*. |
| 570 | - * * @FFA_MEM_ATTR_OUTER_SHAREABLE |
| 571 | - * Outer Shareable. Combine with FFA_MEM_ATTR_NORMAL_MEMORY_*. |
| 572 | - * * @FFA_MEM_ATTR_INNER_SHAREABLE |
| 573 | - * Inner Shareable. Combine with FFA_MEM_ATTR_NORMAL_MEMORY_*. |
| 574 | - */ |
| 575 | -typedef uint8_t ffa_mem_attr8_t; |
| 576 | -#define FFA_MEM_ATTR_DEVICE_NGNRNE ((1U << 4) | (0x0U << 2)) |
| 577 | -#define FFA_MEM_ATTR_DEVICE_NGNRE ((1U << 4) | (0x1U << 2)) |
| 578 | -#define FFA_MEM_ATTR_DEVICE_NGRE ((1U << 4) | (0x2U << 2)) |
| 579 | -#define FFA_MEM_ATTR_DEVICE_GRE ((1U << 4) | (0x3U << 2)) |
| 580 | -#define FFA_MEM_ATTR_NORMAL_MEMORY_UNCACHED ((2U << 4) | (0x1U << 2)) |
| 581 | -#define FFA_MEM_ATTR_NORMAL_MEMORY_CACHED_WB ((2U << 4) | (0x3U << 2)) |
| 582 | -#define FFA_MEM_ATTR_NON_SHAREABLE (0x0U << 0) |
| 583 | -#define FFA_MEM_ATTR_OUTER_SHAREABLE (0x2U << 0) |
| 584 | -#define FFA_MEM_ATTR_INNER_SHAREABLE (0x3U << 0) |
| 585 | - |
| 586 | -/** |
| 587 | - * typedef ffa_mem_perm8_t - Memory access permissions |
| 588 | - * |
| 589 | - * * @FFA_MEM_ATTR_RO |
| 590 | - * Request or specify read-only mapping. |
| 591 | - * * @FFA_MEM_ATTR_RW |
| 592 | - * Request or allow read-write mapping. |
| 593 | - * * @FFA_MEM_PERM_NX |
| 594 | - * Deny executable mapping. |
| 595 | - * * @FFA_MEM_PERM_X |
| 596 | - * Request executable mapping. |
| 597 | - */ |
| 598 | -typedef uint8_t ffa_mem_perm8_t; |
| 599 | -#define FFA_MEM_PERM_RO (1U << 0) |
| 600 | -#define FFA_MEM_PERM_RW (1U << 1) |
| 601 | -#define FFA_MEM_PERM_NX (1U << 2) |
| 602 | -#define FFA_MEM_PERM_X (1U << 3) |
| 603 | - |
| 604 | -/** |
| 605 | - * typedef ffa_mem_flag8_t - Endpoint memory flags |
| 606 | - * |
| 607 | - * * @FFA_MEM_FLAG_OTHER |
| 608 | - * Other borrower. Memory region must not be or was not retrieved on behalf |
| 609 | - * of this endpoint. |
| 610 | - */ |
| 611 | -typedef uint8_t ffa_mem_flag8_t; |
| 612 | -#define FFA_MEM_FLAG_OTHER (1U << 0) |
| 613 | - |
| 614 | -/** |
| 615 | - * typedef ffa_mtd_flag32_t - Memory transaction descriptor flags |
| 616 | - * |
| 617 | - * * @FFA_MTD_FLAG_ZERO_MEMORY |
| 618 | - * Zero memory after unmapping from sender (must be 0 for share). |
| 619 | - * * @FFA_MTD_FLAG_TIME_SLICING |
| 620 | - * Not supported by this implementation. |
| 621 | - * * @FFA_MTD_FLAG_ZERO_MEMORY_AFTER_RELINQUISH |
| 622 | - * Zero memory after unmapping from borrowers (must be 0 for share). |
| 623 | - * * @FFA_MTD_FLAG_TYPE_MASK |
| 624 | - * Bit-mask to extract memory management transaction type from flags. |
| 625 | - * * @FFA_MTD_FLAG_TYPE_SHARE_MEMORY |
| 626 | - * Share memory transaction flag. |
| 627 | - * Used by @SMC_FC_FFA_MEM_RETRIEVE_RESP to indicate that memory came from |
| 628 | - * @SMC_FC_FFA_MEM_SHARE and by @SMC_FC_FFA_MEM_RETRIEVE_REQ to specify that |
| 629 | - * it must have. |
| 630 | - * * @FFA_MTD_FLAG_ADDRESS_RANGE_ALIGNMENT_HINT_MASK |
| 631 | - * Not supported by this implementation. |
| 632 | - */ |
| 633 | -typedef uint32_t ffa_mtd_flag32_t; |
| 634 | -#define FFA_MTD_FLAG_ZERO_MEMORY (1U << 0) |
| 635 | -#define FFA_MTD_FLAG_TIME_SLICING (1U << 1) |
| 636 | -#define FFA_MTD_FLAG_ZERO_MEMORY_AFTER_RELINQUISH (1U << 2) |
| 637 | -#define FFA_MTD_FLAG_TYPE_MASK (3U << 3) |
| 638 | -#define FFA_MTD_FLAG_TYPE_SHARE_MEMORY (1U << 3) |
| 639 | -#define FFA_MTD_FLAG_ADDRESS_RANGE_ALIGNMENT_HINT_MASK (0x1FU << 5) |
| 640 | - |
| 641 | -/** |
| 642 | - * struct ffa_mapd - Memory access permissions descriptor |
| 643 | - * @endpoint_id: |
| 644 | - * Endpoint id that @memory_access_permissions and @flags apply to. |
| 645 | - * (&typedef ffa_endpoint_id16_t). |
| 646 | - * @memory_access_permissions: |
| 647 | - * FFA_MEM_PERM_* values or'ed together (&typedef ffa_mem_perm8_t). |
| 648 | - * @flags: |
| 649 | - * FFA_MEM_FLAG_* values or'ed together (&typedef ffa_mem_flag8_t). |
| 650 | - */ |
| 651 | -struct ffa_mapd { |
| 652 | - ffa_endpoint_id16_t endpoint_id; |
| 653 | - ffa_mem_perm8_t memory_access_permissions; |
| 654 | - ffa_mem_flag8_t flags; |
| 655 | -}; |
| 656 | -STATIC_ASSERT(sizeof(struct ffa_mapd) == 4); |
| 657 | - |
| 658 | -/** |
| 659 | - * struct ffa_emad - Endpoint memory access descriptor. |
| 660 | - * @mapd: &struct ffa_mapd. |
| 661 | - * @comp_mrd_offset: |
| 662 | - * Offset of &struct ffa_comp_mrd form start of &struct ffa_mtd. |
| 663 | - * @reserved_8_15: |
| 664 | - * Reserved bytes 8-15. Must be 0. |
| 665 | - */ |
| 666 | -struct ffa_emad { |
| 667 | - struct ffa_mapd mapd; |
| 668 | - uint32_t comp_mrd_offset; |
| 669 | - uint64_t reserved_8_15; |
| 670 | -}; |
| 671 | -STATIC_ASSERT(sizeof(struct ffa_emad) == 16); |
| 672 | - |
| 673 | -/** |
| 674 | - * struct ffa_mtd - Memory transaction descriptor. |
| 675 | - * @sender_id: |
| 676 | - * Sender endpoint id. |
| 677 | - * @memory_region_attributes: |
| 678 | - * FFA_MEM_ATTR_* values or'ed together (&typedef ffa_mem_attr8_t). |
| 679 | - * @reserved_3: |
| 680 | - * Reserved bytes 3. Must be 0. |
| 681 | - * @flags: |
| 682 | - * FFA_MTD_FLAG_* values or'ed together (&typedef ffa_mtd_flag32_t). |
| 683 | - * @handle: |
| 684 | - * Id of shared memory object. Most be 0 for MEM_SHARE. |
| 685 | - * @tag: Client allocated tag. Must match original value. |
| 686 | - * @reserved_24_27: |
| 687 | - * Reserved bytes 24-27. Must be 0. |
| 688 | - * @emad_count: |
| 689 | - * Number of entries in @emad. Must be 1 in current implementation. |
| 690 | - * FFA spec allows more entries. |
| 691 | - * @emad: |
| 692 | - * Endpoint memory access descriptor array (see @struct ffa_emad). |
| 693 | - */ |
| 694 | -struct ffa_mtd { |
| 695 | - ffa_endpoint_id16_t sender_id; |
| 696 | - ffa_mem_attr8_t memory_region_attributes; |
| 697 | - uint8_t reserved_3; |
| 698 | - ffa_mtd_flag32_t flags; |
| 699 | - uint64_t handle; |
| 700 | - uint64_t tag; |
| 701 | - uint32_t reserved_24_27; |
| 702 | - uint32_t emad_count; |
| 703 | - struct ffa_emad emad[]; |
| 704 | -}; |
| 705 | -STATIC_ASSERT(sizeof(struct ffa_mtd) == 32); |
| 706 | - |
| 707 | -/** |
| 708 | - * struct ffa_mem_relinquish_descriptor - Relinquish request descriptor. |
| 709 | - * @handle: |
| 710 | - * Id of shared memory object to relinquish. |
| 711 | - * @flags: |
| 712 | - * If bit 0 is set clear memory after unmapping from borrower. Must be 0 |
| 713 | - * for share. Bit[1]: Time slicing. Not supported, must be 0. All other |
| 714 | - * bits are reserved 0. |
| 715 | - * @endpoint_count: |
| 716 | - * Number of entries in @endpoint_array. |
| 717 | - * @endpoint_array: |
| 718 | - * Array of endpoint ids. |
| 719 | - */ |
| 720 | -struct ffa_mem_relinquish_descriptor { |
| 721 | - uint64_t handle; |
| 722 | - uint32_t flags; |
| 723 | - uint32_t endpoint_count; |
| 724 | - ffa_endpoint_id16_t endpoint_array[]; |
| 725 | -}; |
| 726 | -STATIC_ASSERT(sizeof(struct ffa_mem_relinquish_descriptor) == 16); |
| 727 | - |
| 728 | -/** |
| 729 | - * enum ffa_error - FF-A error code |
| 730 | - * @FFA_ERROR_NOT_SUPPORTED: |
| 731 | - * Operation contained possibly valid parameters not supported by the |
| 732 | - * current implementation. Does not match FF-A 1.0 EAC 1_0 definition. |
| 733 | - * @FFA_ERROR_INVALID_PARAMETERS: |
| 734 | - * Invalid parameters. Conditions function specific. |
| 735 | - * @FFA_ERROR_NO_MEMORY: |
| 736 | - * Not enough memory. |
| 737 | - * @FFA_ERROR_DENIED: |
| 738 | - * Operation not allowed. Conditions function specific. |
| 739 | - * |
| 740 | - * FF-A 1.0 EAC 1_0 defines other error codes as well but the current |
| 741 | - * implementation does not use them. |
| 742 | - */ |
| 743 | -enum ffa_error { |
| 744 | - FFA_ERROR_NOT_SUPPORTED = -1, |
| 745 | - FFA_ERROR_INVALID_PARAMETERS = -2, |
| 746 | - FFA_ERROR_NO_MEMORY = -3, |
| 747 | - FFA_ERROR_DENIED = -6, |
| 748 | -}; |
| 749 | - |
| 750 | -/** |
| 751 | - * SMC_FC32_FFA_MIN - First 32 bit SMC opcode reserved for FFA |
| 752 | - */ |
| 753 | -#define SMC_FC32_FFA_MIN SMC_FASTCALL_NR_SHARED_MEMORY(0x60) |
| 754 | - |
| 755 | -/** |
| 756 | - * SMC_FC32_FFA_MAX - Last 32 bit SMC opcode reserved for FFA |
| 757 | - */ |
| 758 | -#define SMC_FC32_FFA_MAX SMC_FASTCALL_NR_SHARED_MEMORY(0x7F) |
| 759 | - |
| 760 | -/** |
| 761 | - * SMC_FC64_FFA_MIN - First 64 bit SMC opcode reserved for FFA |
| 762 | - */ |
| 763 | -#define SMC_FC64_FFA_MIN SMC_FASTCALL64_NR_SHARED_MEMORY(0x60) |
| 764 | - |
| 765 | -/** |
| 766 | - * SMC_FC64_FFA_MAX - Last 64 bit SMC opcode reserved for FFA |
| 767 | - */ |
| 768 | -#define SMC_FC64_FFA_MAX SMC_FASTCALL64_NR_SHARED_MEMORY(0x7F) |
| 769 | - |
| 770 | -/** |
| 771 | - * SMC_FC_FFA_ERROR - SMC error return opcode |
| 772 | - * |
| 773 | - * Register arguments: |
| 774 | - * |
| 775 | - * * w1: VMID in [31:16], vCPU in [15:0] |
| 776 | - * * w2: Error code (&enum ffa_error) |
| 777 | - */ |
| 778 | -#define SMC_FC_FFA_ERROR SMC_FASTCALL_NR_SHARED_MEMORY(0x60) |
| 779 | - |
| 780 | -/** |
| 781 | - * SMC_FC_FFA_SUCCESS - 32 bit SMC success return opcode |
| 782 | - * |
| 783 | - * Register arguments: |
| 784 | - * |
| 785 | - * * w1: VMID in [31:16], vCPU in [15:0] |
| 786 | - * * w2-w7: Function specific |
| 787 | - */ |
| 788 | -#define SMC_FC_FFA_SUCCESS SMC_FASTCALL_NR_SHARED_MEMORY(0x61) |
| 789 | - |
| 790 | -/** |
| 791 | - * SMC_FC64_FFA_SUCCESS - 64 bit SMC success return opcode |
| 792 | - * |
| 793 | - * Register arguments: |
| 794 | - * |
| 795 | - * * w1: VMID in [31:16], vCPU in [15:0] |
| 796 | - * * w2/x2-w7/x7: Function specific |
| 797 | - */ |
| 798 | -#define SMC_FC64_FFA_SUCCESS SMC_FASTCALL64_NR_SHARED_MEMORY(0x61) |
| 799 | - |
| 800 | -/** |
| 801 | - * SMC_FC_FFA_VERSION - SMC opcode to return supported FF-A version |
| 802 | - * |
| 803 | - * Register arguments: |
| 804 | - * |
| 805 | - * * w1: Major version bit[30:16] and minor version in bit[15:0] supported |
| 806 | - * by caller. Bit[31] must be 0. |
| 807 | - * |
| 808 | - * Return: |
| 809 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 810 | - * * w2: Major version bit[30:16], minor version in bit[15:0], bit[31] must |
| 811 | - * be 0. |
| 812 | - * |
| 813 | - * or |
| 814 | - * |
| 815 | - * * w0: SMC_FC_FFA_ERROR |
| 816 | - * * w2: FFA_ERROR_NOT_SUPPORTED if major version passed in is less than the |
| 817 | - * minimum major version supported. |
| 818 | - */ |
| 819 | -#define SMC_FC_FFA_VERSION SMC_FASTCALL_NR_SHARED_MEMORY(0x63) |
| 820 | - |
| 821 | -/** |
| 822 | - * SMC_FC_FFA_FEATURES - SMC opcode to check optional feature support |
| 823 | - * |
| 824 | - * Register arguments: |
| 825 | - * |
| 826 | - * * w1: FF-A function ID |
| 827 | - * |
| 828 | - * Return: |
| 829 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 830 | - * * w2: Bit[0]: Supports custom buffers for memory transactions. |
| 831 | - * Bit[1:0]: For RXTX_MAP min buffer size and alignment boundary. |
| 832 | - * Other bits must be 0. |
| 833 | - * * w3: For FFA_MEM_RETRIEVE_REQ, bit[7-0]: Number of times receiver can |
| 834 | - * retrieve each memory region before relinquishing it specified as |
| 835 | - * ((1U << (value + 1)) - 1 (or value = bits in reference count - 1). |
| 836 | - * For all other bits and commands: must be 0. |
| 837 | - * or |
| 838 | - * |
| 839 | - * * w0: SMC_FC_FFA_ERROR |
| 840 | - * * w2: FFA_ERROR_NOT_SUPPORTED if function is not implemented, or |
| 841 | - * FFA_ERROR_INVALID_PARAMETERS if function id is not valid. |
| 842 | - */ |
| 843 | -#define SMC_FC_FFA_FEATURES SMC_FASTCALL_NR_SHARED_MEMORY(0x64) |
| 844 | - |
| 845 | -/** |
| 846 | - * SMC_FC_FFA_RXTX_MAP - 32 bit SMC opcode to map message buffers |
| 847 | - * |
| 848 | - * Register arguments: |
| 849 | - * |
| 850 | - * * w1: TX address |
| 851 | - * * w2: RX address |
| 852 | - * * w3: RX/TX page count in bit[5:0] |
| 853 | - * |
| 854 | - * Return: |
| 855 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 856 | - */ |
| 857 | -#define SMC_FC_FFA_RXTX_MAP SMC_FASTCALL_NR_SHARED_MEMORY(0x66) |
| 858 | - |
| 859 | -/** |
| 860 | - * SMC_FC64_FFA_RXTX_MAP - 64 bit SMC opcode to map message buffers |
| 861 | - * |
| 862 | - * Register arguments: |
| 863 | - * |
| 864 | - * * x1: TX address |
| 865 | - * * x2: RX address |
| 866 | - * * x3: RX/TX page count in bit[5:0] |
| 867 | - * |
| 868 | - * Return: |
| 869 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 870 | - */ |
| 871 | -#define SMC_FC64_FFA_RXTX_MAP SMC_FASTCALL64_NR_SHARED_MEMORY(0x66) |
| 872 | -#ifdef CONFIG_64BIT |
| 873 | -#define SMC_FCZ_FFA_RXTX_MAP SMC_FC64_FFA_RXTX_MAP |
| 874 | -#else |
| 875 | -#define SMC_FCZ_FFA_RXTX_MAP SMC_FC_FFA_RXTX_MAP |
| 876 | -#endif |
| 877 | - |
| 878 | -/** |
| 879 | - * SMC_FC_FFA_RXTX_UNMAP - SMC opcode to unmap message buffers |
| 880 | - * |
| 881 | - * Register arguments: |
| 882 | - * |
| 883 | - * * w1: ID in [31:16] |
| 884 | - * |
| 885 | - * Return: |
| 886 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 887 | - */ |
| 888 | -#define SMC_FC_FFA_RXTX_UNMAP SMC_FASTCALL_NR_SHARED_MEMORY(0x67) |
| 889 | - |
| 890 | -/** |
| 891 | - * SMC_FC_FFA_ID_GET - SMC opcode to get endpoint id of caller |
| 892 | - * |
| 893 | - * Return: |
| 894 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 895 | - * * w2: ID in bit[15:0], bit[31:16] must be 0. |
| 896 | - */ |
| 897 | -#define SMC_FC_FFA_ID_GET SMC_FASTCALL_NR_SHARED_MEMORY(0x69) |
| 898 | - |
| 899 | -/** |
| 900 | - * SMC_FC_FFA_MEM_DONATE - 32 bit SMC opcode to donate memory |
| 901 | - * |
| 902 | - * Not supported. |
| 903 | - */ |
| 904 | -#define SMC_FC_FFA_MEM_DONATE SMC_FASTCALL_NR_SHARED_MEMORY(0x71) |
| 905 | - |
| 906 | -/** |
| 907 | - * SMC_FC_FFA_MEM_LEND - 32 bit SMC opcode to lend memory |
| 908 | - * |
| 909 | - * Not currently supported. |
| 910 | - */ |
| 911 | -#define SMC_FC_FFA_MEM_LEND SMC_FASTCALL_NR_SHARED_MEMORY(0x72) |
| 912 | - |
| 913 | -/** |
| 914 | - * SMC_FC_FFA_MEM_SHARE - 32 bit SMC opcode to share memory |
| 915 | - * |
| 916 | - * Register arguments: |
| 917 | - * |
| 918 | - * * w1: Total length |
| 919 | - * * w2: Fragment length |
| 920 | - * * w3: Address |
| 921 | - * * w4: Page count |
| 922 | - * |
| 923 | - * Return: |
| 924 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 925 | - * * w2/w3: Handle |
| 926 | - * |
| 927 | - * or |
| 928 | - * |
| 929 | - * * w0: &SMC_FC_FFA_MEM_FRAG_RX |
| 930 | - * * w1-: See &SMC_FC_FFA_MEM_FRAG_RX |
| 931 | - * |
| 932 | - * or |
| 933 | - * |
| 934 | - * * w0: SMC_FC_FFA_ERROR |
| 935 | - * * w2: Error code (&enum ffa_error) |
| 936 | - */ |
| 937 | -#define SMC_FC_FFA_MEM_SHARE SMC_FASTCALL_NR_SHARED_MEMORY(0x73) |
| 938 | - |
| 939 | -/** |
| 940 | - * SMC_FC64_FFA_MEM_SHARE - 64 bit SMC opcode to share memory |
| 941 | - * |
| 942 | - * Register arguments: |
| 943 | - * |
| 944 | - * * w1: Total length |
| 945 | - * * w2: Fragment length |
| 946 | - * * x3: Address |
| 947 | - * * w4: Page count |
| 948 | - * |
| 949 | - * Return: |
| 950 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 951 | - * * w2/w3: Handle |
| 952 | - * |
| 953 | - * or |
| 954 | - * |
| 955 | - * * w0: &SMC_FC_FFA_MEM_FRAG_RX |
| 956 | - * * w1-: See &SMC_FC_FFA_MEM_FRAG_RX |
| 957 | - * |
| 958 | - * or |
| 959 | - * |
| 960 | - * * w0: SMC_FC_FFA_ERROR |
| 961 | - * * w2: Error code (&enum ffa_error) |
| 962 | - */ |
| 963 | -#define SMC_FC64_FFA_MEM_SHARE SMC_FASTCALL64_NR_SHARED_MEMORY(0x73) |
| 964 | - |
| 965 | -/** |
| 966 | - * SMC_FC_FFA_MEM_RETRIEVE_REQ - 32 bit SMC opcode to retrieve shared memory |
| 967 | - * |
| 968 | - * Register arguments: |
| 969 | - * |
| 970 | - * * w1: Total length |
| 971 | - * * w2: Fragment length |
| 972 | - * * w3: Address |
| 973 | - * * w4: Page count |
| 974 | - * |
| 975 | - * Return: |
| 976 | - * * w0: &SMC_FC_FFA_MEM_RETRIEVE_RESP |
| 977 | - * * w1/x1-w5/x5: See &SMC_FC_FFA_MEM_RETRIEVE_RESP |
| 978 | - */ |
| 979 | -#define SMC_FC_FFA_MEM_RETRIEVE_REQ SMC_FASTCALL_NR_SHARED_MEMORY(0x74) |
| 980 | - |
| 981 | -/** |
| 982 | - * SMC_FC64_FFA_MEM_RETRIEVE_REQ - 64 bit SMC opcode to retrieve shared memory |
| 983 | - * |
| 984 | - * Register arguments: |
| 985 | - * |
| 986 | - * * w1: Total length |
| 987 | - * * w2: Fragment length |
| 988 | - * * x3: Address |
| 989 | - * * w4: Page count |
| 990 | - * |
| 991 | - * Return: |
| 992 | - * * w0: &SMC_FC_FFA_MEM_RETRIEVE_RESP |
| 993 | - * * w1/x1-w5/x5: See &SMC_FC_FFA_MEM_RETRIEVE_RESP |
| 994 | - */ |
| 995 | -#define SMC_FC64_FFA_MEM_RETRIEVE_REQ SMC_FASTCALL64_NR_SHARED_MEMORY(0x74) |
| 996 | - |
| 997 | -/** |
| 998 | - * SMC_FC_FFA_MEM_RETRIEVE_RESP - Retrieve 32 bit SMC return opcode |
| 999 | - * |
| 1000 | - * Register arguments: |
| 1001 | - * |
| 1002 | - * * w1: Total length |
| 1003 | - * * w2: Fragment length |
| 1004 | - */ |
| 1005 | -#define SMC_FC_FFA_MEM_RETRIEVE_RESP SMC_FASTCALL_NR_SHARED_MEMORY(0x75) |
| 1006 | - |
| 1007 | -/** |
| 1008 | - * SMC_FC_FFA_MEM_RELINQUISH - SMC opcode to relinquish shared memory |
| 1009 | - * |
| 1010 | - * Input in &struct ffa_mem_relinquish_descriptor format in message buffer. |
| 1011 | - * |
| 1012 | - * Return: |
| 1013 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 1014 | - */ |
| 1015 | -#define SMC_FC_FFA_MEM_RELINQUISH SMC_FASTCALL_NR_SHARED_MEMORY(0x76) |
| 1016 | - |
| 1017 | -/** |
| 1018 | - * SMC_FC_FFA_MEM_RECLAIM - SMC opcode to reclaim shared memory |
| 1019 | - * |
| 1020 | - * Register arguments: |
| 1021 | - * |
| 1022 | - * * w1/w2: Handle |
| 1023 | - * * w3: Flags |
| 1024 | - * |
| 1025 | - * Return: |
| 1026 | - * * w0: &SMC_FC_FFA_SUCCESS |
| 1027 | - */ |
| 1028 | -#define SMC_FC_FFA_MEM_RECLAIM SMC_FASTCALL_NR_SHARED_MEMORY(0x77) |
| 1029 | - |
| 1030 | -/** |
| 1031 | - * SMC_FC_FFA_MEM_FRAG_RX - SMC opcode to request next fragment. |
| 1032 | - * |
| 1033 | - * Register arguments: |
| 1034 | - * |
| 1035 | - * * w1/w2: Cookie |
| 1036 | - * * w3: Fragment offset. |
| 1037 | - * * w4: Endpoint id ID in [31:16], if client is hypervisor. |
| 1038 | - * |
| 1039 | - * Return: |
| 1040 | - * * w0: &SMC_FC_FFA_MEM_FRAG_TX |
| 1041 | - * * w1/x1-w5/x5: See &SMC_FC_FFA_MEM_FRAG_TX |
| 1042 | - */ |
| 1043 | -#define SMC_FC_FFA_MEM_FRAG_RX SMC_FASTCALL_NR_SHARED_MEMORY(0x7A) |
| 1044 | - |
| 1045 | -/** |
| 1046 | - * SMC_FC_FFA_MEM_FRAG_TX - SMC opcode to transmit next fragment |
| 1047 | - * |
| 1048 | - * Register arguments: |
| 1049 | - * |
| 1050 | - * * w1/w2: Cookie |
| 1051 | - * * w3: Fragment length. |
| 1052 | - * * w4: Sender endpoint id ID in [31:16], if client is hypervisor. |
| 1053 | - * |
| 1054 | - * Return: |
| 1055 | - * * w0: &SMC_FC_FFA_MEM_FRAG_RX or &SMC_FC_FFA_SUCCESS. |
| 1056 | - * * w1/x1-w5/x5: See opcode in w0. |
| 1057 | - */ |
| 1058 | -#define SMC_FC_FFA_MEM_FRAG_TX SMC_FASTCALL_NR_SHARED_MEMORY(0x7B) |
| 1059 | - |
| 1060 | -#endif /* __LINUX_TRUSTY_ARM_FFA_H */ |
| 1061 | diff --git a/include/linux/trusty/trusty.h b/include/linux/trusty/trusty.h |
| 1062 | index efbb36999a8b..272d96c1c696 100644 |
| 1063 | --- a/include/linux/trusty/trusty.h |
| 1064 | +++ b/include/linux/trusty/trusty.h |
| 1065 | @@ -52,9 +52,6 @@ u32 trusty_get_api_version(struct device *dev); |
| 1066 | bool trusty_get_panic_status(struct device *dev); |
| 1067 | |
| 1068 | struct ns_mem_page_info { |
| 1069 | - u64 paddr; |
| 1070 | - u8 ffa_mem_attr; |
| 1071 | - u8 ffa_mem_perm; |
| 1072 | u64 compat_attr; |
| 1073 | }; |
| 1074 | |
| 1075 | -- |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1076 | 2.34.1 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1077 | |