Commit 6df63b7
iommu: rockchip: Fix directory table address encoding
The physical address to the directory table is currently encoded using
the following bit layout for IOMMU v2.
31:12 - Address bit 31:0
11: 4 - Address bit 39:32
This is also the bit layout used by the vendor kernel.
However, testing has shown that addresses to the directory/page tables
and memory pages are all encoded using the same bit layout.
IOMMU v1:
31:12 - Address bit 31:0
IOMMU v2:
31:12 - Address bit 31:0
11: 8 - Address bit 35:32
7: 4 - Address bit 39:36
Change to use the mk_dtentries ops to encode the directory table address
correctly. The value written to DTE_ADDR may include the valid bit set,
a bit that is ignored and DTE_ADDR reg read it back as 0.
This also update the bit layout comment for the page address and the
number of nybbles that are read back for DTE_ADDR comment.
These changes render the dte_addr_phys and dma_addr_dte ops unused and
is removed.
Fixes: 227014b ("iommu: rockchip: Add internal ops to handle variants")
Fixes: c55356c ("iommu: rockchip: Add support for iommu v2")
Fixes: c987b65 ("iommu/rockchip: Fix physical address decoding")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20230617182540.3091374-2-jonas@kwiboo.se
Signed-off-by: Joerg Roedel <jroedel@suse.de>1 parent 06c2afb commit 6df63b7
1 file changed
Lines changed: 5 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
| |||
278 | 276 | | |
279 | 277 | | |
280 | 278 | | |
281 | | - | |
282 | | - | |
| 279 | + | |
| 280 | + | |
283 | 281 | | |
284 | 282 | | |
285 | 283 | | |
| |||
506 | 504 | | |
507 | 505 | | |
508 | 506 | | |
509 | | - | |
| 507 | + | |
510 | 508 | | |
511 | 509 | | |
512 | 510 | | |
| |||
531 | 529 | | |
532 | 530 | | |
533 | 531 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | 532 | | |
562 | 533 | | |
563 | 534 | | |
| |||
577 | 548 | | |
578 | 549 | | |
579 | 550 | | |
580 | | - | |
| 551 | + | |
581 | 552 | | |
582 | 553 | | |
583 | 554 | | |
| |||
967 | 938 | | |
968 | 939 | | |
969 | 940 | | |
970 | | - | |
| 941 | + | |
971 | 942 | | |
972 | 943 | | |
973 | 944 | | |
| |||
1405 | 1376 | | |
1406 | 1377 | | |
1407 | 1378 | | |
1408 | | - | |
1409 | | - | |
1410 | 1379 | | |
1411 | 1380 | | |
1412 | 1381 | | |
1413 | 1382 | | |
1414 | 1383 | | |
1415 | 1384 | | |
1416 | 1385 | | |
1417 | | - | |
1418 | | - | |
1419 | 1386 | | |
1420 | 1387 | | |
1421 | 1388 | | |
| |||
0 commit comments