We should not need to index into SHMs based on absolute VA/PA. These functions are not used and this kind of usage should not be encouraged anyway. Remove these functions.
Unified · Split
| @@ -414,56 +414,6 @@ void tee_shm_free(struct tee_shm *shm) · 413 unmodified lines | ||
| 414 | 414 | } |
| 415 | 415 | EXPORT_SYMBOL_GPL(tee_shm_free); |
| 416 | 416 | |
| 417 | −/** | |
| 418 | − * tee_shm_va2pa() - Get physical address of a virtual address | |
| 419 | − * @shm: Shared memory handle | |
| 420 | − * @va: Virtual address to tranlsate | |
| 421 | − * @pa: Returned physical address | |
| 422 | − * @returns 0 on success and < 0 on failure | |
| 423 | − */ | |
| 424 | −int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa) | |
| 425 | −{ | |
| 426 | − if (!shm->kaddr) | |
| 427 | − return -EINVAL; | |
| 428 | − /* Check that we're in the range of the shm */ | |
| 429 | − if ((char *)va < (char *)shm->kaddr) | |
| 430 | − return -EINVAL; | |
| 431 | − if ((char *)va >= ((char *)shm->kaddr + shm->size)) | |
| 432 | − return -EINVAL; | |
| 433 | − | |
| 434 | − return tee_shm_get_pa( | |
| 435 | − shm, (unsigned long)va - (unsigned long)shm->kaddr, pa); | |
| 436 | −} | |
| 437 | −EXPORT_SYMBOL_GPL(tee_shm_va2pa); | |
| 438 | − | |
| 439 | −/** | |
| 440 | − * tee_shm_pa2va() - Get virtual address of a physical address | |
| 441 | − * @shm: Shared memory handle | |
| 442 | − * @pa: Physical address to tranlsate | |
| 443 | − * @va: Returned virtual address | |
| 444 | − * @returns 0 on success and < 0 on failure | |
| 445 | − */ | |
| 446 | −int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va) | |
| 447 | −{ | |
| 448 | − if (!shm->kaddr) | |
| 449 | − return -EINVAL; | |
| 450 | − /* Check that we're in the range of the shm */ | |
| 451 | − if (pa < shm->paddr) | |
| 452 | − return -EINVAL; | |
| 453 | − if (pa >= (shm->paddr + shm->size)) | |
| 454 | − return -EINVAL; | |
| 455 | − | |
| 456 | − if (va) { | |
| 457 | − void *v = tee_shm_get_va(shm, pa - shm->paddr); | |
| 458 | − | |
| 459 | − if (IS_ERR(v)) | |
| 460 | − return PTR_ERR(v); | |
| 461 | − *va = v; | |
| 462 | − } | |
| 463 | − return 0; | |
| 464 | −} | |
| 465 | −EXPORT_SYMBOL_GPL(tee_shm_pa2va); | |
| 466 | − | |
| 467 | 417 | /** |
| 468 | 418 | * tee_shm_get_va() - Get virtual address of a shared memory plus an offset |
| 469 | 419 | * @shm: Shared memory handle |
| @@ -298,24 +298,6 @@ void tee_shm_free(struct tee_shm *shm); · 297 unmodified lines | ||
| 298 | 298 | */ |
| 299 | 299 | void tee_shm_put(struct tee_shm *shm); |
| 300 | 300 | |
| 301 | −/** | |
| 302 | − * tee_shm_va2pa() - Get physical address of a virtual address | |
| 303 | − * @shm: Shared memory handle | |
| 304 | − * @va: Virtual address to tranlsate | |
| 305 | − * @pa: Returned physical address | |
| 306 | − * @returns 0 on success and < 0 on failure | |
| 307 | − */ | |
| 308 | −int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa); | |
| 309 | − | |
| 310 | −/** | |
| 311 | − * tee_shm_pa2va() - Get virtual address of a physical address | |
| 312 | − * @shm: Shared memory handle | |
| 313 | − * @pa: Physical address to tranlsate | |
| 314 | − * @va: Returned virtual address | |
| 315 | − * @returns 0 on success and < 0 on failure | |
| 316 | − */ | |
| 317 | −int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va); | |
| 318 | − | |
| 319 | 301 | /** |
| 320 | 302 | * tee_shm_get_va() - Get virtual address of a shared memory plus an offset |
| 321 | 303 | * @shm: Shared memory handle |