git: 900907f4399f - main - busdma: kill filter functionality internally
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Dec 2023 23:21:42 UTC
The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=900907f4399f40f1088ea5f353b54c868daf630e commit 900907f4399f40f1088ea5f353b54c868daf630e Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2023-12-06 23:08:13 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2023-12-06 23:11:39 +0000 busdma: kill filter functionality internally Address filter functions are unused, unsupported, and now rejected. Simplify some busdma code by removing filter functionality completely. Note that the chains of parent tags become useless, and will be cleaned up in the next commit. No functional change intended. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42894 --- sys/arm/arm/busdma_machdep.c | 26 ++++++++---------------- sys/arm64/arm64/busdma_bounce.c | 12 +++++------ sys/arm64/arm64/busdma_machdep.c | 37 ++++++++++++++-------------------- sys/arm64/include/bus_dma_impl.h | 12 ++++------- sys/dev/iommu/busdma_iommu.c | 11 +++++----- sys/powerpc/powerpc/busdma_machdep.c | 27 ++++++++----------------- sys/riscv/include/bus_dma_impl.h | 10 +++------ sys/riscv/riscv/busdma_bounce.c | 12 +++++------ sys/riscv/riscv/busdma_machdep.c | 37 ++++++++++++++-------------------- sys/sys/bus_dma.h | 7 ++----- sys/x86/include/busdma_impl.h | 10 +++------ sys/x86/x86/busdma_bounce.c | 15 +++++++------- sys/x86/x86/busdma_machdep.c | 39 +++++++++++++++--------------------- 13 files changed, 96 insertions(+), 159 deletions(-) diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 282a8ccea690..cf1fd0209734 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -82,8 +82,6 @@ struct bus_dma_tag { bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; bus_size_t maxsize; u_int nsegments; bus_size_t maxsegsz; @@ -337,8 +335,7 @@ might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, * exclusion zone of any tag in the ancestry chain. * * For exclusions, walk the chain of tags comparing paddr to the exclusion zone - * within each tag. If the tag has a filter function, use it to decide whether - * the DMA needs to bounce, otherwise any DMA within the zone bounces. + * within each tag. */ static int must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, @@ -363,9 +360,7 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, * within the low-highaddr range of the tag that filterfunc belongs to. */ while (dmat != NULL && exclusion_bounce(dmat)) { - if ((paddr >= dmat->lowaddr && paddr <= dmat->highaddr) && - (dmat->filter == NULL || - dmat->filter(dmat->filterarg, paddr) != 0)) + if (paddr >= dmat->lowaddr && paddr <= dmat->highaddr) return (1); dmat = dmat->parent; } @@ -416,8 +411,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); newtag->highaddr = trunc_page((vm_paddr_t)highaddr) + (PAGE_SIZE - 1); - newtag->filter = filter; - newtag->filterarg = filterarg; newtag->maxsize = maxsize; newtag->nsegments = nsegments; newtag->maxsegsz = maxsegsz; @@ -444,15 +437,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, else if (parent->boundary != 0) newtag->boundary = MIN(parent->boundary, newtag->boundary); - if (newtag->filter == NULL) { - /* - * Short circuit to looking at our parent directly - * since we have encapsulated all of its information - */ - newtag->filter = parent->filter; - newtag->filterarg = parent->filterarg; - newtag->parent = parent->parent; - } + + /* + * Short circuit to looking at our parent directly since we + * have encapsulated all of its information. + */ + newtag->parent = parent->parent; if (newtag->parent != NULL) atomic_add_int(&parent->ref_count, 1); } diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index 16de0286060b..7585d950fcbb 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -241,17 +241,16 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, static int bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) + bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, + bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat) { bus_dma_tag_t newtag; int error; *dmat = NULL; error = common_bus_dma_tag_create(parent != NULL ? &parent->common : - NULL, alignment, boundary, lowaddr, highaddr, filter, filterarg, - maxsize, nsegments, maxsegsz, flags, lockfunc, lockfuncarg, + NULL, alignment, boundary, lowaddr, highaddr, maxsize, nsegments, + maxsegsz, flags, lockfunc, lockfuncarg, sizeof (struct bus_dma_tag), (void **)&newtag); if (error != 0) return (error); @@ -265,8 +264,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, } if (parent != NULL) { - if ((newtag->common.filter != NULL || - (parent->bounce_flags & BF_COULD_BOUNCE) != 0)) + if ((parent->bounce_flags & BF_COULD_BOUNCE) != 0) newtag->bounce_flags |= BF_COULD_BOUNCE; /* Copy some flags from the parent */ diff --git a/sys/arm64/arm64/busdma_machdep.c b/sys/arm64/arm64/busdma_machdep.c index 0c1550267ae6..aa5359b4552a 100644 --- a/sys/arm64/arm64/busdma_machdep.c +++ b/sys/arm64/arm64/busdma_machdep.c @@ -62,12 +62,10 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr) { while (tc != NULL) { - if ((paddr > tc->lowaddr && paddr <= tc->highaddr) && - (tc->filter == NULL || - (*tc->filter)(tc->filterarg, paddr) != 0)) + if (paddr > tc->lowaddr && paddr <= tc->highaddr) return (1); - tc = tc->parent; + tc = tc->parent; } return (0); @@ -76,9 +74,9 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, 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_dma_filter_t *filter, void *filterarg, - bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, - bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat) + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, + bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + void *lockfuncarg, size_t sz, void **dmat) { void *newtag; struct bus_dma_tag_common *common; @@ -106,8 +104,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = boundary; common->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); common->highaddr = trunc_page((vm_paddr_t)highaddr) + (PAGE_SIZE - 1); - common->filter = filter; - common->filterarg = filterarg; common->maxsize = maxsize; common->nsegments = nsegments; common->maxsegsz = maxsegsz; @@ -133,15 +129,12 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = MIN(parent->boundary, common->boundary); } - if (common->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - common->filter = parent->filter; - common->filterarg = parent->filterarg; - common->parent = parent->parent; - } + + /* + * Short circuit looking at our parent directly since we have + * encapsulated all of its information. + */ + common->parent = parent->parent; common->domain = parent->domain; atomic_add_int(&parent->ref_count, 1); } @@ -170,13 +163,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, if (parent == NULL) { error = bus_dma_bounce_impl.tag_create(parent, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, dmat); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, + flags, lockfunc, lockfuncarg, dmat); } else { tc = (struct bus_dma_tag_common *)parent; error = tc->impl->tag_create(parent, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, dmat); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, + flags, lockfunc, lockfuncarg, dmat); } return (error); } diff --git a/sys/arm64/include/bus_dma_impl.h b/sys/arm64/include/bus_dma_impl.h index 11e74ede87bf..1abce30b5b4c 100644 --- a/sys/arm64/include/bus_dma_impl.h +++ b/sys/arm64/include/bus_dma_impl.h @@ -36,8 +36,6 @@ struct bus_dma_tag_common { bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; bus_size_t maxsize; u_int nsegments; bus_size_t maxsegsz; @@ -51,8 +49,7 @@ struct bus_dma_tag_common { struct bus_dma_impl { int (*tag_create)(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, - bus_addr_t highaddr, bus_dma_filter_t *filter, - void *filterarg, bus_size_t maxsize, int nsegments, + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); int (*tag_destroy)(bus_dma_tag_t dmat); @@ -84,10 +81,9 @@ struct bus_dma_impl { 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_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, + bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat); extern struct bus_dma_impl bus_dma_bounce_impl; diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index b872016a78bf..f041838eac39 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -356,9 +356,8 @@ static void iommu_bus_schedule_dmamap(struct iommu_unit *unit, static int iommu_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) + bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, + bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat) { struct bus_dma_tag_iommu *newtag, *oldtag; int error; @@ -366,9 +365,9 @@ iommu_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, *dmat = NULL; error = common_bus_dma_tag_create(parent != NULL ? &((struct bus_dma_tag_iommu *)parent)->common : NULL, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, - sizeof(struct bus_dma_tag_iommu), (void **)&newtag); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, flags, + lockfunc, lockfuncarg, sizeof(struct bus_dma_tag_iommu), + (void **)&newtag); if (error != 0) goto out; diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index c1717140181e..3065526427e2 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -68,8 +68,6 @@ struct bus_dma_tag { bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; bus_size_t maxsize; bus_size_t maxsegsz; u_int nsegments; @@ -129,14 +127,10 @@ run_filter(bus_dma_tag_t dmat, bus_addr_t paddr) retval = 0; do { - if (dmat->filter == NULL && dmat->iommu == NULL && + if (dmat->iommu == NULL && paddr > dmat->lowaddr && paddr <= dmat->highaddr) retval = 1; - if (dmat->filter == NULL && - !vm_addr_align_ok(paddr, dmat->alignment)) - retval = 1; - if (dmat->filter != NULL && - (*dmat->filter)(dmat->filterarg, paddr) != 0) + if (!vm_addr_align_ok(paddr, dmat->alignment)) retval = 1; dmat = dmat->parent; @@ -188,8 +182,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->boundary = boundary; newtag->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); newtag->highaddr = trunc_page((vm_paddr_t)highaddr) + (PAGE_SIZE - 1); - newtag->filter = filter; - newtag->filterarg = filterarg; newtag->maxsize = maxsize; newtag->nsegments = nsegments; newtag->maxsegsz = maxsegsz; @@ -213,15 +205,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, else if (parent->boundary != 0) newtag->boundary = MIN(parent->boundary, newtag->boundary); - if (newtag->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - newtag->filter = parent->filter; - newtag->filterarg = parent->filterarg; - newtag->parent = parent->parent; - } + + /* + * Short circuit looking at our parent directly since we have + * encapsulated all of its information. + */ + newtag->parent = parent->parent; if (newtag->parent != NULL) atomic_add_int(&parent->ref_count, 1); newtag->iommu = parent->iommu; diff --git a/sys/riscv/include/bus_dma_impl.h b/sys/riscv/include/bus_dma_impl.h index 6df8ef6a6a20..d6e1d4ed632e 100644 --- a/sys/riscv/include/bus_dma_impl.h +++ b/sys/riscv/include/bus_dma_impl.h @@ -36,8 +36,6 @@ struct bus_dma_tag_common { bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; bus_size_t maxsize; u_int nsegments; bus_size_t maxsegsz; @@ -50,8 +48,7 @@ struct bus_dma_tag_common { struct bus_dma_impl { int (*tag_create)(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, - bus_addr_t highaddr, bus_dma_filter_t *filter, - void *filterarg, bus_size_t maxsize, int nsegments, + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); int (*tag_destroy)(bus_dma_tag_t dmat); @@ -83,9 +80,8 @@ 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_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, size_t sz, void **dmat); + bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, + bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat); extern struct bus_dma_impl bus_dma_bounce_impl; diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c index 83ea92219e10..6ac9a9cd678a 100644 --- a/sys/riscv/riscv/busdma_bounce.c +++ b/sys/riscv/riscv/busdma_bounce.c @@ -125,17 +125,16 @@ static MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata"); static int bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) + bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, + bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat) { bus_dma_tag_t newtag; int error; *dmat = NULL; error = common_bus_dma_tag_create(parent != NULL ? &parent->common : - NULL, alignment, boundary, lowaddr, highaddr, filter, filterarg, - maxsize, nsegments, maxsegsz, flags, lockfunc, lockfuncarg, + NULL, alignment, boundary, lowaddr, highaddr, maxsize, nsegments, + maxsegsz, flags, lockfunc, lockfuncarg, sizeof (struct bus_dma_tag), (void **)&newtag); if (error != 0) return (error); @@ -148,8 +147,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->bounce_flags |= BF_COHERENT; if (parent != NULL) { - if ((newtag->common.filter != NULL || - (parent->bounce_flags & BF_COULD_BOUNCE) != 0)) + if ((parent->bounce_flags & BF_COULD_BOUNCE) != 0) newtag->bounce_flags |= BF_COULD_BOUNCE; /* Copy some flags from the parent */ diff --git a/sys/riscv/riscv/busdma_machdep.c b/sys/riscv/riscv/busdma_machdep.c index 712aad4cb5c4..e992803f3ff2 100644 --- a/sys/riscv/riscv/busdma_machdep.c +++ b/sys/riscv/riscv/busdma_machdep.c @@ -63,10 +63,8 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr) retval = 0; do { - if (((paddr > tc->lowaddr && paddr <= tc->highaddr) || - !vm_addr_align_ok(paddr, tc->alignment)) && - (tc->filter == NULL || - (*tc->filter)(tc->filterarg, paddr) != 0)) + if ((paddr > tc->lowaddr && paddr <= tc->highaddr) || + !vm_addr_align_ok(paddr, tc->alignment)) retval = 1; tc = tc->parent; @@ -77,9 +75,9 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, 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_dma_filter_t *filter, void *filterarg, - bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, - bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat) + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, + bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + void *lockfuncarg, size_t sz, void **dmat) { void *newtag; struct bus_dma_tag_common *common; @@ -107,8 +105,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = boundary; common->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); common->highaddr = trunc_page((vm_paddr_t)highaddr) + (PAGE_SIZE - 1); - common->filter = filter; - common->filterarg = filterarg; common->maxsize = maxsize; common->nsegments = nsegments; common->maxsegsz = maxsegsz; @@ -133,15 +129,12 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = MIN(parent->boundary, common->boundary); } - if (common->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - common->filter = parent->filter; - common->filterarg = parent->filterarg; - common->parent = parent->parent; - } + + /* + * Short circuit looking at our parent directly since we have + * encapsulated all of its information. + */ + common->parent = parent->parent; atomic_add_int(&parent->ref_count, 1); } *dmat = common; @@ -167,13 +160,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, if (parent == NULL) { error = bus_dma_bounce_impl.tag_create(parent, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, dmat); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, + flags, lockfunc, lockfuncarg, dmat); } else { tc = (struct bus_dma_tag_common *)parent; error = tc->impl->tag_create(parent, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, dmat); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, + flags, lockfunc, lockfuncarg, dmat); } return (error); } diff --git a/sys/sys/bus_dma.h b/sys/sys/bus_dma.h index 530816f0532c..c7c1419b2998 100644 --- a/sys/sys/bus_dma.h +++ b/sys/sys/bus_dma.h @@ -161,11 +161,8 @@ void _busdma_dflt_lock(void *arg, bus_dma_lock_op_t op); * boundary: Boundary that segments cannot cross. * lowaddr: Low restricted address that cannot appear in a mapping. * highaddr: High restricted address that cannot appear in a mapping. - * filtfunc: An optional function to further test if an address - * within the range of lowaddr and highaddr cannot appear - * in a mapping. - * filtfuncarg: An argument that will be passed to filtfunc in addition - * to the address to test. + * filtfunc: (deprecated, must be NULL) + * filtfuncarg: (deprecated, must be NULL) * maxsize: Maximum mapping size supported by this tag. * nsegments: Number of discontinuities allowed in maps. * maxsegsz: Maximum size of a segment in the map. diff --git a/sys/x86/include/busdma_impl.h b/sys/x86/include/busdma_impl.h index 4cc4b288c88a..4718c67dacc1 100644 --- a/sys/x86/include/busdma_impl.h +++ b/sys/x86/include/busdma_impl.h @@ -38,8 +38,6 @@ struct bus_dma_tag_common { bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; bus_size_t maxsize; u_int nsegments; bus_size_t maxsegsz; @@ -53,8 +51,7 @@ struct bus_dma_tag_common { struct bus_dma_impl { int (*tag_create)(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, - bus_addr_t highaddr, bus_dma_filter_t *filter, - void *filterarg, bus_size_t maxsize, int nsegments, + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); int (*tag_destroy)(bus_dma_tag_t dmat); @@ -91,9 +88,8 @@ 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, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, size_t sz, void **dmat); + bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, + bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat); extern struct bus_dma_impl bus_dma_bounce_impl; diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index ac8d2d639732..01e799a1133d 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -148,18 +148,17 @@ bounce_bus_dma_zone_setup(bus_dma_tag_t dmat) static int bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) + bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, + bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat) { bus_dma_tag_t newtag; int error; *dmat = NULL; error = common_bus_dma_tag_create(parent != NULL ? &parent->common : - NULL, alignment, boundary, lowaddr, highaddr, filter, filterarg, - maxsize, nsegments, maxsegsz, flags, lockfunc, lockfuncarg, - sizeof (struct bus_dma_tag), (void **)&newtag); + NULL, alignment, boundary, lowaddr, highaddr, maxsize, nsegments, + maxsegsz, flags, lockfunc, lockfuncarg, sizeof(struct bus_dma_tag), + (void **)&newtag); if (error != 0) return (error); @@ -175,8 +174,8 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->bounce_flags |= BUS_DMA_FORCE_MAP; #endif - if (parent != NULL && (newtag->common.filter != NULL || - (parent->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0)) + if (parent != NULL && + (parent->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0) newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE; if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) || diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c index 40afcee0651e..bb1b6a393fb0 100644 --- a/sys/x86/x86/busdma_machdep.c +++ b/sys/x86/x86/busdma_machdep.c @@ -68,14 +68,12 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, vm_paddr_t paddr) retval = 0; do { - if ((paddr >= BUS_SPACE_MAXADDR || + if (paddr >= BUS_SPACE_MAXADDR || (paddr > tc->lowaddr && paddr <= tc->highaddr) || - !vm_addr_align_ok(paddr, tc->alignment)) && - (tc->filter == NULL || - (*tc->filter)(tc->filterarg, paddr) != 0)) + !vm_addr_align_ok(paddr, tc->alignment)) retval = 1; - tc = tc->parent; + tc = tc->parent; } while (retval == 0 && tc != NULL); return (retval); } @@ -83,9 +81,9 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, 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, bus_dma_filter_t *filter, void *filterarg, - bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, - bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat) + bus_addr_t highaddr, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, + int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, + void **dmat) { void *newtag; struct bus_dma_tag_common *common; @@ -113,8 +111,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = boundary; common->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); common->highaddr = trunc_page((vm_paddr_t)highaddr) + (PAGE_SIZE - 1); - common->filter = filter; - common->filterarg = filterarg; common->maxsize = maxsize; common->nsegments = nsegments; common->maxsegsz = maxsegsz; @@ -139,15 +135,12 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = MIN(parent->boundary, common->boundary); } - if (common->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - common->filter = parent->filter; - common->filterarg = parent->filterarg; - common->parent = parent->parent; - } + + /* + * Short circuit looking at our parent directly since we have + * encapsulated all of its information. + */ + common->parent = parent->parent; common->domain = parent->domain; atomic_add_int(&parent->ref_count, 1); } @@ -190,13 +183,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, if (parent == NULL) { error = bus_dma_bounce_impl.tag_create(parent, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, dmat); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, + flags, lockfunc, lockfuncarg, dmat); } else { tc = (struct bus_dma_tag_common *)parent; error = tc->impl->tag_create(parent, alignment, - boundary, lowaddr, highaddr, filter, filterarg, maxsize, - nsegments, maxsegsz, flags, lockfunc, lockfuncarg, dmat); + boundary, lowaddr, highaddr, maxsize, nsegments, maxsegsz, + flags, lockfunc, lockfuncarg, dmat); } return (error); }