Skip to content

Commit 2a7e640

Browse files
Kwiboojoergroedel
authored andcommitted
iommu: rockchip: Allocate tables from all available memory for IOMMU v2
IOMMU v2 found in newer Rockchip SoCs, e.g. RK356x and RK3588, support placing directory and page tables in up to 40-bit addressable physical memory. Remove the use of GFP_DMA32 flag for IOMMU v2 now that the physical address to the directory table is correctly written to DTE_ADDR. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 6df63b7 commit 2a7e640

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct rk_iommu_ops {
9999
u32 (*mk_dtentries)(dma_addr_t pt_dma);
100100
u32 (*mk_ptentries)(phys_addr_t page, int prot);
101101
u64 dma_bit_mask;
102+
gfp_t gfp_flags;
102103
};
103104

104105
struct rk_iommu {
@@ -727,7 +728,7 @@ static u32 *rk_dte_get_page_table(struct rk_iommu_domain *rk_domain,
727728
if (rk_dte_is_pt_valid(dte))
728729
goto done;
729730

730-
page_table = (u32 *)get_zeroed_page(GFP_ATOMIC | GFP_DMA32);
731+
page_table = (u32 *)get_zeroed_page(GFP_ATOMIC | rk_ops->gfp_flags);
731732
if (!page_table)
732733
return ERR_PTR(-ENOMEM);
733734

@@ -1076,7 +1077,7 @@ static struct iommu_domain *rk_iommu_domain_alloc(unsigned type)
10761077
* Each level1 (dt) and level2 (pt) table has 1024 4-byte entries.
10771078
* Allocate one 4 KiB page for each table.
10781079
*/
1079-
rk_domain->dt = (u32 *)get_zeroed_page(GFP_KERNEL | GFP_DMA32);
1080+
rk_domain->dt = (u32 *)get_zeroed_page(GFP_KERNEL | rk_ops->gfp_flags);
10801081
if (!rk_domain->dt)
10811082
goto err_free_domain;
10821083

@@ -1377,13 +1378,15 @@ static struct rk_iommu_ops iommu_data_ops_v1 = {
13771378
.mk_dtentries = &rk_mk_dte,
13781379
.mk_ptentries = &rk_mk_pte,
13791380
.dma_bit_mask = DMA_BIT_MASK(32),
1381+
.gfp_flags = GFP_DMA32,
13801382
};
13811383

13821384
static struct rk_iommu_ops iommu_data_ops_v2 = {
13831385
.pt_address = &rk_dte_pt_address_v2,
13841386
.mk_dtentries = &rk_mk_dte_v2,
13851387
.mk_ptentries = &rk_mk_pte_v2,
13861388
.dma_bit_mask = DMA_BIT_MASK(40),
1389+
.gfp_flags = 0,
13871390
};
13881391

13891392
static const struct of_device_id rk_iommu_dt_ids[] = {

0 commit comments

Comments
 (0)