aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/powerpc/include/asm/iommu.h
diff options
context:
space:
mode:
authorLeonardo Bras <leobras.c@gmail.com>2021-08-17 03:39:20 -0300
committerMichael Ellerman <mpe@ellerman.id.au>2021-08-27 00:56:54 +1000
commit3c33066a21903076722a2881556a92aa3cd7d359 (patch)
treeca10ab464fe8a67a04cee38d0ff098d7fafb4c4b /arch/powerpc/include/asm/iommu.h
parentpowerpc/pseries/iommu: Replace hard-coded page shift (diff)
downloadwireguard-linux-3c33066a21903076722a2881556a92aa3cd7d359.tar.xz
wireguard-linux-3c33066a21903076722a2881556a92aa3cd7d359.zip
powerpc/kernel/iommu: Add new iommu_table_in_use() helper
Having a function to check if the iommu table has any allocation helps deciding if a tbl can be reset for using a new DMA window. It should be enough to replace all instances of !bitmap_empty(tbl...). iommu_table_in_use() skips reserved memory, so we don't need to worry about releasing it before testing. This causes iommu_table_release_pages() to become unnecessary, given it is only used to remove reserved memory for testing. Also, only allow storing reserved memory values in tbl if they are valid in the table, so there is no need to check it in the new helper. Signed-off-by: Leonardo Bras <leobras.c@gmail.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210817063929.38701-3-leobras.c@gmail.com
Diffstat (limited to 'arch/powerpc/include/asm/iommu.h')
-rw-r--r--arch/powerpc/include/asm/iommu.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index deef7c94d7b6..bf3b84128525 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -154,6 +154,7 @@ extern int iommu_tce_table_put(struct iommu_table *tbl);
*/
extern struct iommu_table *iommu_init_table(struct iommu_table *tbl,
int nid, unsigned long res_start, unsigned long res_end);
+bool iommu_table_in_use(struct iommu_table *tbl);
#define IOMMU_TABLE_GROUP_MAX_TABLES 2