Skip to content

Commit 847e656

Browse files
aikmpe
authored andcommitted
powerpc/powernv: Reference iommu_table while it is linked to a group
The iommu_table pointer stored in iommu_table_group may get stale by accident, this adds referencing and removes a redundant comment about this. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 5eada8a commit 847e656

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

arch/powerpc/platforms/powernv/pci-ioda-tce.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ void pnv_pci_unlink_table_and_group(struct iommu_table *tbl,
368368
found = false;
369369
for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) {
370370
if (table_group->tables[i] == tbl) {
371+
iommu_tce_table_put(tbl);
371372
table_group->tables[i] = NULL;
372373
found = true;
373374
break;
@@ -393,7 +394,7 @@ long pnv_pci_link_table_and_group(int node, int num,
393394
tgl->table_group = table_group;
394395
list_add_rcu(&tgl->next, &tbl->it_group_list);
395396

396-
table_group->tables[num] = tbl;
397+
table_group->tables[num] = iommu_tce_table_get(tbl);
397398

398399
return 0;
399400
}

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,10 +2714,6 @@ static long pnv_pci_ioda2_npu_unset_window(
27142714

27152715
static void pnv_ioda2_npu_take_ownership(struct iommu_table_group *table_group)
27162716
{
2717-
/*
2718-
* Detach NPU first as pnv_ioda2_take_ownership() will destroy
2719-
* the iommu_table if 32bit DMA is enabled.
2720-
*/
27212717
pnv_npu_take_ownership(gpe_table_group_to_npe(table_group));
27222718
pnv_ioda2_take_ownership(table_group);
27232719
}

0 commit comments

Comments
 (0)