Commit 847e6563 authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Michael Ellerman

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: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 5eada8a3
...@@ -368,6 +368,7 @@ void pnv_pci_unlink_table_and_group(struct iommu_table *tbl, ...@@ -368,6 +368,7 @@ void pnv_pci_unlink_table_and_group(struct iommu_table *tbl,
found = false; found = false;
for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) { for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) {
if (table_group->tables[i] == tbl) { if (table_group->tables[i] == tbl) {
iommu_tce_table_put(tbl);
table_group->tables[i] = NULL; table_group->tables[i] = NULL;
found = true; found = true;
break; break;
...@@ -393,7 +394,7 @@ long pnv_pci_link_table_and_group(int node, int num, ...@@ -393,7 +394,7 @@ long pnv_pci_link_table_and_group(int node, int num,
tgl->table_group = table_group; tgl->table_group = table_group;
list_add_rcu(&tgl->next, &tbl->it_group_list); list_add_rcu(&tgl->next, &tbl->it_group_list);
table_group->tables[num] = tbl; table_group->tables[num] = iommu_tce_table_get(tbl);
return 0; return 0;
} }
...@@ -2714,10 +2714,6 @@ static long pnv_pci_ioda2_npu_unset_window( ...@@ -2714,10 +2714,6 @@ static long pnv_pci_ioda2_npu_unset_window(
static void pnv_ioda2_npu_take_ownership(struct iommu_table_group *table_group) static void pnv_ioda2_npu_take_ownership(struct iommu_table_group *table_group)
{ {
/*
* Detach NPU first as pnv_ioda2_take_ownership() will destroy
* the iommu_table if 32bit DMA is enabled.
*/
pnv_npu_take_ownership(gpe_table_group_to_npe(table_group)); pnv_npu_take_ownership(gpe_table_group_to_npe(table_group));
pnv_ioda2_take_ownership(table_group); pnv_ioda2_take_ownership(table_group);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment