Skip to content

Commit c435209

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/amd: Remove the confusing dummy iommu_flush_ops tlb ops
The iommu driver is supposed to provide these ops to its io_pgtable implementation so that it can hook the invalidations and do the right thing. They are called by wrapper functions like io_pgtable_tlb_add_page() etc, which the AMD code never calls. Instead it directly calls the AMD IOMMU invalidation functions by casting to the struct protection_domain. Remove it all. Reviewed-by: Vasant Hegde <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent a06dcb6 commit c435209

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

drivers/iommu/amd/io_pgtable.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,6 @@
2424
#include "amd_iommu.h"
2525
#include "../iommu-pages.h"
2626

27-
static void v1_tlb_flush_all(void *cookie)
28-
{
29-
}
30-
31-
static void v1_tlb_flush_walk(unsigned long iova, size_t size,
32-
size_t granule, void *cookie)
33-
{
34-
}
35-
36-
static void v1_tlb_add_page(struct iommu_iotlb_gather *gather,
37-
unsigned long iova, size_t granule,
38-
void *cookie)
39-
{
40-
}
41-
42-
static const struct iommu_flush_ops v1_flush_ops = {
43-
.tlb_flush_all = v1_tlb_flush_all,
44-
.tlb_flush_walk = v1_tlb_flush_walk,
45-
.tlb_add_page = v1_tlb_add_page,
46-
};
47-
4827
/*
4928
* Helper function to get the first pte of a large mapping
5029
*/
@@ -572,7 +551,6 @@ static struct io_pgtable *v1_alloc_pgtable(struct io_pgtable_cfg *cfg, void *coo
572551
cfg->pgsize_bitmap = AMD_IOMMU_PGSIZES;
573552
cfg->ias = IOMMU_IN_ADDR_BIT_SIZE;
574553
cfg->oas = IOMMU_OUT_ADDR_BIT_SIZE;
575-
cfg->tlb = &v1_flush_ops;
576554

577555
pgtable->pgtbl.ops.map_pages = iommu_v1_map_pages;
578556
pgtable->pgtbl.ops.unmap_pages = iommu_v1_unmap_pages;

drivers/iommu/amd/io_pgtable_v2.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -326,27 +326,6 @@ static phys_addr_t iommu_v2_iova_to_phys(struct io_pgtable_ops *ops, unsigned lo
326326
/*
327327
* ----------------------------------------------------
328328
*/
329-
static void v2_tlb_flush_all(void *cookie)
330-
{
331-
}
332-
333-
static void v2_tlb_flush_walk(unsigned long iova, size_t size,
334-
size_t granule, void *cookie)
335-
{
336-
}
337-
338-
static void v2_tlb_add_page(struct iommu_iotlb_gather *gather,
339-
unsigned long iova, size_t granule,
340-
void *cookie)
341-
{
342-
}
343-
344-
static const struct iommu_flush_ops v2_flush_ops = {
345-
.tlb_flush_all = v2_tlb_flush_all,
346-
.tlb_flush_walk = v2_tlb_flush_walk,
347-
.tlb_add_page = v2_tlb_add_page,
348-
};
349-
350329
static void v2_free_pgtable(struct io_pgtable *iop)
351330
{
352331
struct amd_io_pgtable *pgtable = container_of(iop, struct amd_io_pgtable, pgtbl);
@@ -378,7 +357,6 @@ static struct io_pgtable *v2_alloc_pgtable(struct io_pgtable_cfg *cfg, void *coo
378357
cfg->pgsize_bitmap = AMD_IOMMU_PGSIZES_V2;
379358
cfg->ias = ias;
380359
cfg->oas = IOMMU_OUT_ADDR_BIT_SIZE;
381-
cfg->tlb = &v2_flush_ops;
382360

383361
return &pgtable->pgtbl;
384362
}

0 commit comments

Comments
 (0)