Commit 1c753d0
firmware: qcom: tzmem: fix virtual-to-physical address conversion
We currently only correctly convert the virtual address passed by the
caller to qcom_tzmem_to_phys() if it corresponds to the base address of
the chunk. If the user wants to convert some pointer at an offset
relative to that base address, we'll return 0. Let's change the
implementation of qcom_tzmem_to_phys(): iterate over the chunks and try
to call gen_pool_virt_to_phys() just-in-time instead of trying to call
it only once when creating the chunk.
Fixes: 84f5a7b ("firmware: qcom: add a dedicated TrustZone buffer allocator")
Reported-by: Johan Hovold <[email protected]>
Closes: https://lore.kernel.org/lkml/[email protected]/
Acked-by: Andrew Halaney <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>1 parent 9960085 commit 1c753d0
1 file changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
388 | | - | |
389 | 387 | | |
390 | 388 | | |
391 | 389 | | |
| |||
431 | 429 | | |
432 | 430 | | |
433 | 431 | | |
434 | | - | |
435 | | - | |
| 432 | + | |
| 433 | + | |
436 | 434 | | |
437 | | - | |
438 | | - | |
| 435 | + | |
| 436 | + | |
439 | 437 | | |
440 | | - | |
| 438 | + | |
| 439 | + | |
441 | 440 | | |
442 | 441 | | |
443 | 442 | | |
444 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
445 | 447 | | |
446 | 448 | | |
447 | 449 | | |
448 | | - | |
449 | | - | |
450 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
451 | 453 | | |
452 | | - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
453 | 463 | | |
454 | 464 | | |
455 | 465 | | |
| |||
0 commit comments