git: 3933ff56f9b6 - main - busdma: tidy bus_dma_run_filter() functions

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Wed, 06 Dec 2023 23:21:44 UTC
The branch main has been updated by mhorne:

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

commit 3933ff56f9b6ee844105916b9002b46ba9536ea5
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2023-12-06 23:09:27 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-12-06 23:11:39 +0000

    busdma: tidy bus_dma_run_filter() functions
    
    After removing filter functionality, the naming doesn't clearly
    represent what the function does, so try to address this. Include some
    code clarity and style improvements.
    
    Create a common version in subr_busdma_bounce.c, used by most
    implementations. powerpc still needs its own version of the function,
    due to its dmat->iommu == NULL check.
    
    No functional change intended.
    
    Reviewed by:    jhb
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D42896
---
 sys/arm/arm/busdma_machdep.c         | 11 ++---------
 sys/arm64/arm64/busdma_bounce.c      |  7 ++-----
 sys/arm64/arm64/busdma_machdep.c     | 18 ------------------
 sys/arm64/include/bus_dma_impl.h     |  1 -
 sys/kern/subr_busdma_bounce.c        | 16 ++++++++++++++++
 sys/powerpc/powerpc/busdma_machdep.c | 36 ++++++++++++++----------------------
 sys/riscv/include/bus_dma_impl.h     |  1 -
 sys/riscv/riscv/busdma_bounce.c      | 10 +++++-----
 sys/riscv/riscv/busdma_machdep.c     | 21 ---------------------
 sys/x86/include/busdma_impl.h        |  1 -
 sys/x86/x86/busdma_bounce.c          | 13 +++++++------
 sys/x86/x86/busdma_machdep.c         | 22 ----------------------
 12 files changed, 46 insertions(+), 111 deletions(-)

diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c
index dd31f7779b21..9f4c6e561bbc 100644
--- a/sys/arm/arm/busdma_machdep.c
+++ b/sys/arm/arm/busdma_machdep.c
@@ -169,6 +169,7 @@ MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata");
 
 #define	dmat_alignment(dmat)	((dmat)->alignment)
 #define	dmat_flags(dmat)	((dmat)->flags)
+#define	dmat_highaddr(dmat)	((dmat)->highaddr)
 #define	dmat_lowaddr(dmat)	((dmat)->lowaddr)
 #define	dmat_lockfunc(dmat)	((dmat)->lockfunc)
 #define	dmat_lockfuncarg(dmat)	((dmat)->lockfuncarg)
@@ -340,18 +341,10 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
 	if (cacheline_bounce(map, paddr, size))
 		return (1);
 
-	/*
-	 *  The tag already contains ancestors' alignment restrictions so this
-	 *  check doesn't need to be inside the loop.
-	 */
-	if (alignment_bounce(dmat, paddr))
-		return (1);
-
 	/*
 	 * Check the tag's exclusion zone.
 	 */
-	if (exclusion_bounce(dmat) &&
-	    paddr >= dmat->lowaddr && paddr <= dmat->highaddr)
+	if (exclusion_bounce(dmat) && addr_needs_bounce(dmat, paddr))
 		return (1);
 
 	return (0);
diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
index 3b5521a31b92..a117e1041658 100644
--- a/sys/arm64/arm64/busdma_bounce.c
+++ b/sys/arm64/arm64/busdma_bounce.c
@@ -107,7 +107,6 @@ struct bus_dmamap {
 	struct sync_list	slist[];
 };
 
-int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
 static bool _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, bus_dmamap_t map,
     vm_paddr_t buf, bus_size_t buflen, int *pagesneeded);
 static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
@@ -120,6 +119,7 @@ static MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata");
 #define	dmat_alignment(dmat)	((dmat)->common.alignment)
 #define	dmat_domain(dmat)	((dmat)->common.domain)
 #define	dmat_flags(dmat)	((dmat)->common.flags)
+#define	dmat_highaddr(dmat)	((dmat)->common.highaddr)
 #define	dmat_lowaddr(dmat)	((dmat)->common.lowaddr)
 #define	dmat_lockfunc(dmat)	((dmat)->common.lockfunc)
 #define	dmat_lockfuncarg(dmat)	((dmat)->common.lockfuncarg)
@@ -225,11 +225,8 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
 	if (cacheline_bounce(dmat, map, paddr, size))
 		return (true);
 
-	if (alignment_bounce(dmat, paddr))
-		return (true);
-
 	if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0 &&
-	    bus_dma_run_filter(&dmat->common, paddr))
+	    addr_needs_bounce(dmat, paddr))
 		return (true);
 
 	return (false);
diff --git a/sys/arm64/arm64/busdma_machdep.c b/sys/arm64/arm64/busdma_machdep.c
index c88b28aa3e22..08dfb67abeab 100644
--- a/sys/arm64/arm64/busdma_machdep.c
+++ b/sys/arm64/arm64/busdma_machdep.c
@@ -49,24 +49,6 @@
 #include <machine/bus.h>
 #include <arm64/include/bus_dma_impl.h>
 
-/*
- * Return true if a match is made.
- *
- * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'.
- *
- * If paddr is within the bounds of the dma tag then call the filter callback
- * to check for a match, if there is no filter callback then assume a match.
- */
-int
-bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr)
-{
-
-	if (paddr > tc->lowaddr && paddr <= tc->highaddr)
-		return (1);
-
-	return (0);
-}
-
 int
 common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
     bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr,
diff --git a/sys/arm64/include/bus_dma_impl.h b/sys/arm64/include/bus_dma_impl.h
index 55af1b477979..9e5741758ef5 100644
--- a/sys/arm64/include/bus_dma_impl.h
+++ b/sys/arm64/include/bus_dma_impl.h
@@ -77,7 +77,6 @@ struct bus_dma_impl {
 	    bus_dmasync_op_t op);
 };
 
-int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr);
 int common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
     bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr,
     bus_addr_t highaddr, bus_size_t maxsize, int nsegments,
diff --git a/sys/kern/subr_busdma_bounce.c b/sys/kern/subr_busdma_bounce.c
index 76f50b2abf38..77b1b358758f 100644
--- a/sys/kern/subr_busdma_bounce.c
+++ b/sys/kern/subr_busdma_bounce.c
@@ -155,6 +155,22 @@ busdma_sysctl_tree_top(struct bounce_zone *bz)
 	return (bz->sysctl_tree_top);
 }
 
+/*
+ * Returns true if the address falls within the tag's exclusion window, or
+ * fails to meet its alignment requirements.
+ */
+static bool
+addr_needs_bounce(bus_dma_tag_t dmat, bus_addr_t paddr)
+{
+
+	if (paddr > dmat_lowaddr(dmat) && paddr <= dmat_highaddr(dmat))
+		return (true);
+	if (!vm_addr_align_ok(paddr, dmat_alignment(dmat)))
+		return (true);
+
+	return (false);
+}
+
 static int
 alloc_bounce_zone(bus_dma_tag_t dmat)
 {
diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c
index a4c30ee9470c..aa1a29e1f1ce 100644
--- a/sys/powerpc/powerpc/busdma_machdep.c
+++ b/sys/powerpc/powerpc/busdma_machdep.c
@@ -99,10 +99,9 @@ struct bus_dmamap {
 
 static MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata");
 
-static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
-
 #define	dmat_alignment(dmat)	((dmat)->alignment)
 #define	dmat_flags(dmat)	((dmat)->flags)
+#define	dmat_highaddr(dmat)	((dmat)->highaddr)
 #define	dmat_lowaddr(dmat)	((dmat)->lowaddr)
 #define	dmat_lockfunc(dmat)	((dmat)->lockfunc)
 #define	dmat_lockfuncarg(dmat)	((dmat)->lockfuncarg)
@@ -110,27 +109,20 @@ static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
 #include "../../kern/subr_busdma_bounce.c"
 
 /*
- * Return true if a match is made.
- *
- * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'.
- *
- * If paddr is within the bounds of the dma tag then call the filter callback
- * to check for a match, if there is no filter callback then assume a match.
+ * Returns true if the address falls within the tag's exclusion window, or
+ * fails to meet its alignment requirements.
  */
-static __inline int
-run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
+static __inline bool
+must_bounce(bus_dma_tag_t dmat, bus_addr_t paddr)
 {
-	int retval;
-
-	retval = 0;
 
-	if (dmat->iommu == NULL &&
-	    paddr > dmat->lowaddr && paddr <= dmat->highaddr)
-		retval = 1;
+	if (dmat->iommu == NULL && paddr > dmat->lowaddr &&
+	    paddr <= dmat->highaddr)
+		return (true);
 	if (!vm_addr_align_ok(paddr, dmat->alignment))
-		retval = 1;
+		return (true);
 
-	return (retval);
+	return (false);
 }
 
 #define BUS_DMA_COULD_BOUNCE	BUS_DMA_BUS3
@@ -492,7 +484,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf,
 		curaddr = buf;
 		while (buflen != 0) {
 			sgsize = MIN(buflen, dmat->maxsegsz);
-			if (run_filter(dmat, curaddr) != 0) {
+			if (must_bounce(dmat, curaddr)) {
 				sgsize = MIN(sgsize,
 				    PAGE_SIZE - (curaddr & PAGE_MASK));
 				map->pagesneeded++;
@@ -532,7 +524,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
 				paddr = pmap_kextract(vaddr);
 			else
 				paddr = pmap_extract(pmap, vaddr);
-			if (run_filter(dmat, paddr) != 0) {
+			if (must_bounce(dmat, paddr)) {
 				sg_len = roundup2(sg_len, dmat->alignment);
 				map->pagesneeded++;
 			}
@@ -614,7 +606,7 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat,
 	while (buflen > 0) {
 		curaddr = buf;
 		sgsize = MIN(buflen, dmat->maxsegsz);
-		if (map->pagesneeded != 0 && run_filter(dmat, curaddr)) {
+		if (map->pagesneeded != 0 && must_bounce(dmat, curaddr)) {
 			sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
 			curaddr = add_bounce_page(dmat, map, 0, curaddr,
 			    sgsize);
@@ -694,7 +686,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat,
 		 */
 		max_sgsize = MIN(buflen, dmat->maxsegsz);
 		sgsize = PAGE_SIZE - (curaddr & PAGE_MASK);
-		if (map->pagesneeded != 0 && run_filter(dmat, curaddr)) {
+		if (map->pagesneeded != 0 && must_bounce(dmat, curaddr)) {
 			sgsize = roundup2(sgsize, dmat->alignment);
 			sgsize = MIN(sgsize, max_sgsize);
 			curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,
diff --git a/sys/riscv/include/bus_dma_impl.h b/sys/riscv/include/bus_dma_impl.h
index 550ba648615c..09fd29b74f8e 100644
--- a/sys/riscv/include/bus_dma_impl.h
+++ b/sys/riscv/include/bus_dma_impl.h
@@ -74,7 +74,6 @@ struct bus_dma_impl {
 	    bus_dmasync_op_t op);
 };
 
-int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr);
 int common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
     bus_size_t alignment,
     bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr,
diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c
index e9801a8a732e..c9fdb0e38e40 100644
--- a/sys/riscv/riscv/busdma_bounce.c
+++ b/sys/riscv/riscv/busdma_bounce.c
@@ -103,7 +103,6 @@ struct bus_dmamap {
 	struct sync_list	slist[];
 };
 
-int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
 static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
     pmap_t pmap, void *buf, bus_size_t buflen, int flags);
 static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
@@ -113,6 +112,7 @@ static MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata");
 
 #define	dmat_alignment(dmat)	((dmat)->common.alignment)
 #define	dmat_flags(dmat)	((dmat)->common.flags)
+#define	dmat_highaddr(dmat)	((dmat)->common.highaddr)
 #define	dmat_lowaddr(dmat)	((dmat)->common.lowaddr)
 #define	dmat_lockfunc(dmat)	((dmat)->common.lockfunc)
 #define	dmat_lockfuncarg(dmat)	((dmat)->common.lockfuncarg)
@@ -494,7 +494,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf,
 		curaddr = buf;
 		while (buflen != 0) {
 			sgsize = MIN(buflen, dmat->common.maxsegsz);
-			if (bus_dma_run_filter(&dmat->common, curaddr)) {
+			if (addr_needs_bounce(dmat, curaddr)) {
 				sgsize = MIN(sgsize,
 				    PAGE_SIZE - (curaddr & PAGE_MASK));
 				map->pagesneeded++;
@@ -535,7 +535,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
 				paddr = pmap_kextract(vaddr);
 			else
 				paddr = pmap_extract(pmap, vaddr);
-			if (bus_dma_run_filter(&dmat->common, paddr) != 0) {
+			if (addr_needs_bounce(dmat, paddr)) {
 				sg_len = roundup2(sg_len,
 				    dmat->common.alignment);
 				map->pagesneeded++;
@@ -621,7 +621,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
 		sgsize = MIN(buflen, dmat->common.maxsegsz);
 		if (((dmat->bounce_flags & BF_COULD_BOUNCE) != 0) &&
 		    map->pagesneeded != 0 &&
-		    bus_dma_run_filter(&dmat->common, curaddr)) {
+		    addr_needs_bounce(dmat, curaddr)) {
 			sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
 			curaddr = add_bounce_page(dmat, map, 0, curaddr,
 			    sgsize);
@@ -708,7 +708,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
 		sgsize = PAGE_SIZE - (curaddr & PAGE_MASK);
 		if (((dmat->bounce_flags & BF_COULD_BOUNCE) != 0) &&
 		    map->pagesneeded != 0 &&
-		    bus_dma_run_filter(&dmat->common, curaddr)) {
+		    addr_needs_bounce(dmat, curaddr)) {
 			sgsize = roundup2(sgsize, dmat->common.alignment);
 			sgsize = MIN(sgsize, max_sgsize);
 			curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,
diff --git a/sys/riscv/riscv/busdma_machdep.c b/sys/riscv/riscv/busdma_machdep.c
index 630938a394e1..4a736f874d16 100644
--- a/sys/riscv/riscv/busdma_machdep.c
+++ b/sys/riscv/riscv/busdma_machdep.c
@@ -48,27 +48,6 @@
 #include <machine/bus.h>
 #include <machine/bus_dma_impl.h>
 
-/*
- * Return true if a match is made.
- *
- * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'.
- *
- * If paddr is within the bounds of the dma tag then call the filter callback
- * to check for a match, if there is no filter callback then assume a match.
- */
-int
-bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr)
-{
-	int retval;
-
-	retval = 0;
-	if ((paddr > tc->lowaddr && paddr <= tc->highaddr) ||
-	    !vm_addr_align_ok(paddr, tc->alignment))
-		retval = 1;
-
-	return (retval);
-}
-
 int
 common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
     bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr,
diff --git a/sys/x86/include/busdma_impl.h b/sys/x86/include/busdma_impl.h
index 2e4c83b04d72..86c8bb9ca972 100644
--- a/sys/x86/include/busdma_impl.h
+++ b/sys/x86/include/busdma_impl.h
@@ -82,7 +82,6 @@ struct bus_dma_impl {
 #endif
 };
 
-int bus_dma_run_filter(struct bus_dma_tag_common *dmat, vm_paddr_t paddr);
 int common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
     bus_size_t alignment,
     bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr,
diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
index 992f455ceb96..10e9e0b36602 100644
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -110,6 +110,7 @@ static MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata");
 #define	dmat_alignment(dmat)	((dmat)->common.alignment)
 #define	dmat_domain(dmat)	((dmat)->common.domain)
 #define	dmat_flags(dmat)	((dmat)->common.flags)
+#define	dmat_highaddr(dmat)	((dmat)->common.highaddr)
 #define	dmat_lowaddr(dmat)	((dmat)->common.lowaddr)
 #define	dmat_lockfunc(dmat)	((dmat)->common.lockfunc)
 #define	dmat_lockfuncarg(dmat)	((dmat)->common.lockfuncarg)
@@ -490,7 +491,7 @@ _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t buflen,
 	curaddr = buf;
 	while (buflen != 0) {
 		sgsize = MIN(buflen, dmat->common.maxsegsz);
-		if (bus_dma_run_filter(&dmat->common, curaddr)) {
+		if (addr_needs_bounce(dmat, curaddr)) {
 			sgsize = MIN(sgsize,
 			    PAGE_SIZE - (curaddr & PAGE_MASK));
 			if (pagesneeded == NULL)
@@ -546,7 +547,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
 				paddr = pmap_kextract(vaddr);
 			else
 				paddr = pmap_extract(pmap, vaddr);
-			if (bus_dma_run_filter(&dmat->common, paddr) != 0) {
+			if (addr_needs_bounce(dmat, paddr)) {
 				sg_len = roundup2(sg_len,
 				    dmat->common.alignment);
 				map->pagesneeded++;
@@ -583,7 +584,7 @@ _bus_dmamap_count_ma(bus_dma_tag_t dmat, bus_dmamap_t map, struct vm_page **ma,
 			sg_len = PAGE_SIZE - ma_offs;
 			max_sgsize = MIN(buflen, dmat->common.maxsegsz);
 			sg_len = MIN(sg_len, max_sgsize);
-			if (bus_dma_run_filter(&dmat->common, paddr) != 0) {
+			if (addr_needs_bounce(dmat, paddr)) {
 				sg_len = roundup2(sg_len,
 				    dmat->common.alignment);
 				sg_len = MIN(sg_len, max_sgsize);
@@ -684,7 +685,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
 		sgsize = MIN(buflen, dmat->common.maxsegsz);
 		if ((dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0 &&
 		    map->pagesneeded != 0 &&
-		    bus_dma_run_filter(&dmat->common, curaddr)) {
+		    addr_needs_bounce(dmat, curaddr)) {
 			sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
 			curaddr = add_bounce_page(dmat, map, 0, curaddr, 0,
 			    sgsize);
@@ -752,7 +753,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
 		sgsize = PAGE_SIZE - (curaddr & PAGE_MASK);
 		if ((dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0 &&
 		    map->pagesneeded != 0 &&
-		    bus_dma_run_filter(&dmat->common, curaddr)) {
+		    addr_needs_bounce(dmat, curaddr)) {
 			sgsize = roundup2(sgsize, dmat->common.alignment);
 			sgsize = MIN(sgsize, max_sgsize);
 			curaddr = add_bounce_page(dmat, map, kvaddr, curaddr, 0,
@@ -819,7 +820,7 @@ bounce_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map,
 		sgsize = PAGE_SIZE - ma_offs;
 		if ((dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0 &&
 		    map->pagesneeded != 0 &&
-		    bus_dma_run_filter(&dmat->common, paddr)) {
+		    addr_needs_bounce(dmat, paddr)) {
 			sgsize = roundup2(sgsize, dmat->common.alignment);
 			sgsize = MIN(sgsize, max_sgsize);
 			KASSERT(vm_addr_align_ok(sgsize,
diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c
index 6fe49367f7d8..efba01ea5988 100644
--- a/sys/x86/x86/busdma_machdep.c
+++ b/sys/x86/x86/busdma_machdep.c
@@ -53,28 +53,6 @@
 #include <machine/bus.h>
 #include <x86/include/busdma_impl.h>
 
-/*
- * Return true if a match is made.
- *
- * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'.
- *
- * If paddr is within the bounds of the dma tag then call the filter callback
- * to check for a match, if there is no filter callback then assume a match.
- */
-int
-bus_dma_run_filter(struct bus_dma_tag_common *tc, vm_paddr_t paddr)
-{
-	int retval;
-
-	retval = 0;
-	if (paddr >= BUS_SPACE_MAXADDR ||
-	    (paddr > tc->lowaddr && paddr <= tc->highaddr) ||
-	    !vm_addr_align_ok(paddr, tc->alignment))
-		retval = 1;
-
-	return (retval);
-}
-
 int
 common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
     bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr,