git: fc2e4f15a904 - main - iommu_gas: Eliminate unnecessary wrappers

From: Alan Cox <alc_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 06:20:04 UTC
The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=fc2e4f15a9047bbf546cd675ed590b88e54362bd

commit fc2e4f15a9047bbf546cd675ed590b88e54362bd
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2022-06-14 19:01:36 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2022-06-17 06:06:52 +0000

    iommu_gas: Eliminate unnecessary wrappers
    
    Eliminate trivial wrappers for several iommu_gas functions that serve
    no functional purpose.
    
    Reviewed by:    br, dougm, kib
    MFC after:      3 weeks
    Differential Revision:  https://reviews.freebsd.org/D35487
---
 sys/dev/iommu/busdma_iommu.c |  8 ++++----
 sys/dev/iommu/iommu.h        |  8 --------
 sys/dev/iommu/iommu_gas.c    | 41 -----------------------------------------
 3 files changed, 4 insertions(+), 53 deletions(-)

diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c
index e06d96dad027..ae8c98922e41 100644
--- a/sys/dev/iommu/busdma_iommu.c
+++ b/sys/dev/iommu/busdma_iommu.c
@@ -594,7 +594,7 @@ iommu_bus_dmamap_load_something1(struct bus_dma_tag_iommu *tag,
 		if (seg + 1 < tag->common.nsegments)
 			gas_flags |= IOMMU_MF_CANSPLIT;
 
-		error = iommu_map(domain, &tag->common, buflen1,
+		error = iommu_gas_map(domain, &tag->common, buflen1,
 		    offset, e_flags, gas_flags, ma + idx, &entry);
 		if (error != 0)
 			break;
@@ -1046,7 +1046,7 @@ bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1,
 	map = (struct bus_dmamap_iommu *)map1;
 	waitok = (flags & BUS_DMA_NOWAIT) != 0;
 
-	entry = iommu_map_alloc_entry(domain, waitok ? 0 : IOMMU_PGF_WAITOK);
+	entry = iommu_gas_alloc_entry(domain, waitok ? 0 : IOMMU_PGF_WAITOK);
 	if (entry == NULL)
 		return (ENOMEM);
 	entry->start = start;
@@ -1054,14 +1054,14 @@ bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1,
 	ma = malloc(sizeof(vm_page_t) * atop(length), M_TEMP, waitok ?
 	    M_WAITOK : M_NOWAIT);
 	if (ma == NULL) {
-		iommu_map_free_entry(domain, entry);
+		iommu_gas_free_entry(domain, entry);
 		return (ENOMEM);
 	}
 	for (i = 0; i < atop(length); i++) {
 		ma[i] = vm_page_getfake(entry->start + PAGE_SIZE * i,
 		    VM_MEMATTR_DEFAULT);
 	}
-	error = iommu_map_region(domain, entry, IOMMU_MAP_ENTRY_READ |
+	error = iommu_gas_map_region(domain, entry, IOMMU_MAP_ENTRY_READ |
 	    ((flags & BUS_DMA_NOWRITE) ? 0 : IOMMU_MAP_ENTRY_WRITE),
 	    waitok ? IOMMU_MF_CANWAIT : 0, ma);
 	if (error == 0) {
diff --git a/sys/dev/iommu/iommu.h b/sys/dev/iommu/iommu.h
index ee1149e6ea8f..3800213a1d64 100644
--- a/sys/dev/iommu/iommu.h
+++ b/sys/dev/iommu/iommu.h
@@ -162,14 +162,6 @@ struct iommu_ctx *iommu_instantiate_ctx(struct iommu_unit *iommu,
 device_t iommu_get_requester(device_t dev, uint16_t *rid);
 int iommu_init_busdma(struct iommu_unit *unit);
 void iommu_fini_busdma(struct iommu_unit *unit);
-struct iommu_map_entry *iommu_map_alloc_entry(struct iommu_domain *iodom,
-    u_int flags);
-void iommu_map_free_entry(struct iommu_domain *, struct iommu_map_entry *);
-int iommu_map(struct iommu_domain *iodom,
-    const struct bus_dma_tag_common *common, iommu_gaddr_t size, int offset,
-    u_int eflags, u_int flags, vm_page_t *ma, struct iommu_map_entry **res);
-int iommu_map_region(struct iommu_domain *domain,
-    struct iommu_map_entry *entry, u_int eflags, u_int flags, vm_page_t *ma);
 
 void iommu_gas_init_domain(struct iommu_domain *domain);
 void iommu_gas_fini_domain(struct iommu_domain *domain);
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index 27954de9db39..a65bb23e87c5 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -799,36 +799,6 @@ iommu_gas_reserve_region_extend(struct iommu_domain *domain,
 	return (error);
 }
 
-struct iommu_map_entry *
-iommu_map_alloc_entry(struct iommu_domain *domain, u_int flags)
-{
-	struct iommu_map_entry *res;
-
-	res = iommu_gas_alloc_entry(domain, flags);
-
-	return (res);
-}
-
-void
-iommu_map_free_entry(struct iommu_domain *domain, struct iommu_map_entry *entry)
-{
-
-	iommu_gas_free_entry(domain, entry);
-}
-
-int
-iommu_map(struct iommu_domain *domain,
-    const struct bus_dma_tag_common *common, iommu_gaddr_t size, int offset,
-    u_int eflags, u_int flags, vm_page_t *ma, struct iommu_map_entry **res)
-{
-	int error;
-
-	error = iommu_gas_map(domain, common, size, offset, eflags, flags,
-	    ma, res);
-
-	return (error);
-}
-
 void
 iommu_unmap_msi(struct iommu_ctx *ctx)
 {
@@ -917,17 +887,6 @@ iommu_translate_msi(struct iommu_domain *domain, uint64_t *addr)
 	    __func__, (uintmax_t)*addr, (uintmax_t)domain->msi_entry->end));
 }
 
-int
-iommu_map_region(struct iommu_domain *domain, struct iommu_map_entry *entry,
-    u_int eflags, u_int flags, vm_page_t *ma)
-{
-	int error;
-
-	error = iommu_gas_map_region(domain, entry, eflags, flags, ma);
-
-	return (error);
-}
-
 SYSCTL_NODE(_hw, OID_AUTO, iommu, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "");
 
 #ifdef INVARIANTS