From 1228b93b410a299cc2a730fe4b065bcffeb162c2 Mon Sep 17 00:00:00 2001 From: Mitchell Horne Date: Wed, 6 Dec 2023 19:08:51 -0400 Subject: [PATCH] busdma: remove parent tag tracking Without filter functions, we do not need to keep track of tag ancestry. All inheritance of the parent tag's parameters occurs when creating the new child tag. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42895 --- sys/arm/arm/busdma_machdep.c | 60 ++++------------------------ sys/arm64/arm64/busdma_bounce.c | 33 +++------------ sys/arm64/arm64/busdma_machdep.c | 17 +------- sys/arm64/include/bus_dma_impl.h | 2 - sys/dev/iommu/busdma_iommu.c | 23 ++++------- sys/powerpc/powerpc/busdma_machdep.c | 50 ++++------------------- sys/riscv/include/bus_dma_impl.h | 2 - sys/riscv/riscv/busdma_bounce.c | 29 +++----------- sys/riscv/riscv/busdma_machdep.c | 19 ++------- sys/x86/include/busdma_impl.h | 2 - sys/x86/iommu/intel_ctx.c | 1 - sys/x86/x86/busdma_bounce.c | 29 +++----------- sys/x86/x86/busdma_machdep.c | 20 ++-------- 13 files changed, 47 insertions(+), 240 deletions(-) diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index cf1fd020973..dd31f7779b2 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -77,7 +77,6 @@ struct bounce_page; struct bounce_zone; struct bus_dma_tag { - bus_dma_tag_t parent; bus_size_t alignment; bus_addr_t boundary; bus_addr_t lowaddr; @@ -86,7 +85,6 @@ struct bus_dma_tag { u_int nsegments; bus_size_t maxsegsz; int flags; - int ref_count; int map_count; bus_dma_lock_t *lockfunc; void *lockfuncarg; @@ -332,10 +330,7 @@ might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, * * Bouncing can be triggered by DMA that doesn't begin and end on cacheline * boundaries, or doesn't begin on an alignment boundary, or falls within the - * 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. + * exclusion zone of the tag. */ static int must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, @@ -353,17 +348,11 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, return (1); /* - * Even though each tag has an exclusion zone that is a superset of its - * own and all its ancestors' exclusions, the exclusion zone of each tag - * up the chain must be checked within the loop, because the busdma - * rules say the filter function is called only when the address lies - * within the low-highaddr range of the tag that filterfunc belongs to. + * Check the tag's exclusion zone. */ - while (dmat != NULL && exclusion_bounce(dmat)) { - if (paddr >= dmat->lowaddr && paddr <= dmat->highaddr) - return (1); - dmat = dmat->parent; - } + if (exclusion_bounce(dmat) && + paddr >= dmat->lowaddr && paddr <= dmat->highaddr) + return (1); return (0); } @@ -405,7 +394,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, return (ENOMEM); } - newtag->parent = parent; newtag->alignment = alignment; newtag->boundary = boundary; newtag->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); @@ -415,7 +403,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->nsegments = nsegments; newtag->maxsegsz = maxsegsz; newtag->flags = flags; - newtag->ref_count = 1; /* Count ourself */ newtag->map_count = 0; if (lockfunc != NULL) { newtag->lockfunc = lockfunc; @@ -437,14 +424,6 @@ 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); - - /* - * 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); } if (exclusion_bounce_check(newtag->lowaddr, newtag->highaddr)) @@ -504,7 +483,6 @@ bus_dma_template_clone(bus_dma_template_t *t, bus_dma_tag_t dmat) if (t == NULL || dmat == NULL) return; - t->parent = dmat->parent; t->alignment = dmat->alignment; t->boundary = dmat->boundary; t->lowaddr = dmat->lowaddr; @@ -527,39 +505,17 @@ bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) int bus_dma_tag_destroy(bus_dma_tag_t dmat) { -#ifdef KTR - bus_dma_tag_t dmat_copy = dmat; -#endif - int error; - - error = 0; + int error = 0; if (dmat != NULL) { if (dmat->map_count != 0) { error = EBUSY; goto out; } - - while (dmat != NULL) { - bus_dma_tag_t parent; - - parent = dmat->parent; - atomic_subtract_int(&dmat->ref_count, 1); - if (dmat->ref_count == 0) { - atomic_subtract_32(&tags_total, 1); - free(dmat, M_BUSDMA); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } + free(dmat, M_BUSDMA); } out: - CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat, error); return (error); } diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index 7585d950fcb..3b5521a31b9 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -309,42 +309,19 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, static int bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat) { -#ifdef KTR - bus_dma_tag_t dmat_copy; -#endif - bus_dma_tag_t parent; - int error; - - error = 0; -#ifdef KTR - dmat_copy = dmat; -#endif - + int error = 0; if (dmat != NULL) { if (dmat->map_count != 0) { error = EBUSY; goto out; } - while (dmat != NULL) { - parent = (bus_dma_tag_t)dmat->common.parent; - atomic_subtract_int(&dmat->common.ref_count, 1); - if (dmat->common.ref_count == 0) { - if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } + if (dmat->segments != NULL) + free(dmat->segments, M_DEVBUF); + free(dmat, M_DEVBUF); } out: - CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat, error); return (error); } diff --git a/sys/arm64/arm64/busdma_machdep.c b/sys/arm64/arm64/busdma_machdep.c index aa5359b4552..c88b28aa3e2 100644 --- a/sys/arm64/arm64/busdma_machdep.c +++ b/sys/arm64/arm64/busdma_machdep.c @@ -61,12 +61,8 @@ int bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr) { - while (tc != NULL) { - if (paddr > tc->lowaddr && paddr <= tc->highaddr) - return (1); - - tc = tc->parent; - } + if (paddr > tc->lowaddr && paddr <= tc->highaddr) + return (1); return (0); } @@ -99,7 +95,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common = newtag; common->impl = &bus_dma_bounce_impl; - common->parent = parent; common->alignment = alignment; common->boundary = boundary; common->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); @@ -108,7 +103,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->nsegments = nsegments; common->maxsegsz = maxsegsz; common->flags = flags; - common->ref_count = 1; /* Count ourself */ if (lockfunc != NULL) { common->lockfunc = lockfunc; common->lockfuncarg = lockfuncarg; @@ -130,13 +124,7 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary); } - /* - * 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); } common->domain = vm_phys_domain_match(common->domain, 0ul, common->lowaddr); @@ -184,7 +172,6 @@ bus_dma_template_clone(bus_dma_template_t *t, bus_dma_tag_t dmat) common = (struct bus_dma_tag_common *)dmat; - t->parent = (bus_dma_tag_t)common->parent; t->alignment = common->alignment; t->boundary = common->boundary; t->lowaddr = common->lowaddr; diff --git a/sys/arm64/include/bus_dma_impl.h b/sys/arm64/include/bus_dma_impl.h index 1abce30b5b4..55af1b47797 100644 --- a/sys/arm64/include/bus_dma_impl.h +++ b/sys/arm64/include/bus_dma_impl.h @@ -31,7 +31,6 @@ struct bus_dma_tag_common { struct bus_dma_impl *impl; - struct bus_dma_tag_common *parent; bus_size_t alignment; bus_addr_t boundary; bus_addr_t lowaddr; @@ -42,7 +41,6 @@ struct bus_dma_tag_common { int flags; bus_dma_lock_t *lockfunc; void *lockfuncarg; - int ref_count; int domain; }; diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index f041838eac3..d870e2af398 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -394,33 +394,24 @@ iommu_bus_dma_tag_set_domain(bus_dma_tag_t dmat) static int iommu_bus_dma_tag_destroy(bus_dma_tag_t dmat1) { - struct bus_dma_tag_iommu *dmat, *parent; - struct bus_dma_tag_iommu *dmat_copy __unused; + struct bus_dma_tag_iommu *dmat; int error; error = 0; - dmat_copy = dmat = (struct bus_dma_tag_iommu *)dmat1; + dmat = (struct bus_dma_tag_iommu *)dmat1; if (dmat != NULL) { if (dmat->map_count != 0) { error = EBUSY; goto out; } - while (dmat != NULL) { - parent = (struct bus_dma_tag_iommu *)dmat->common.parent; - if (atomic_fetchadd_int(&dmat->common.ref_count, -1) == - 1) { - if (dmat == dmat->ctx->tag) - iommu_free_ctx(dmat->ctx); - free(dmat->segments, M_IOMMU_DMAMAP); - free(dmat, M_DEVBUF); - dmat = parent; - } else - dmat = NULL; - } + if (dmat == dmat->ctx->tag) + iommu_free_ctx(dmat->ctx); + free(dmat->segments, M_IOMMU_DMAMAP); + free(dmat, M_DEVBUF); } out: - CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat, error); return (error); } diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 3065526427e..a4c30ee9470 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -63,7 +63,6 @@ struct bounce_page; struct bounce_zone; struct bus_dma_tag { - bus_dma_tag_t parent; bus_size_t alignment; bus_addr_t boundary; bus_addr_t lowaddr; @@ -72,7 +71,6 @@ struct bus_dma_tag { bus_size_t maxsegsz; u_int nsegments; int flags; - int ref_count; int map_count; bus_dma_lock_t *lockfunc; void *lockfuncarg; @@ -126,15 +124,12 @@ run_filter(bus_dma_tag_t dmat, bus_addr_t paddr) retval = 0; - do { - if (dmat->iommu == NULL && - paddr > dmat->lowaddr && paddr <= dmat->highaddr) - retval = 1; - if (!vm_addr_align_ok(paddr, dmat->alignment)) - retval = 1; + if (dmat->iommu == NULL && + paddr > dmat->lowaddr && paddr <= dmat->highaddr) + retval = 1; + if (!vm_addr_align_ok(paddr, dmat->alignment)) + retval = 1; - dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); return (retval); } @@ -177,7 +172,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, return (ENOMEM); } - newtag->parent = parent; newtag->alignment = alignment; newtag->boundary = boundary; newtag->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); @@ -186,7 +180,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->nsegments = nsegments; newtag->maxsegsz = maxsegsz; newtag->flags = flags; - newtag->ref_count = 1; /* Count ourself */ newtag->map_count = 0; if (lockfunc != NULL) { newtag->lockfunc = lockfunc; @@ -206,13 +199,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->boundary = MIN(parent->boundary, newtag->boundary); - /* - * 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; newtag->iommu_cookie = parent->iommu_cookie; } @@ -265,7 +251,6 @@ bus_dma_template_clone(bus_dma_template_t *t, bus_dma_tag_t dmat) if (t == NULL || dmat == NULL) return; - t->parent = dmat->parent; t->alignment = dmat->alignment; t->boundary = dmat->boundary; t->lowaddr = dmat->lowaddr; @@ -288,11 +273,7 @@ bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) int bus_dma_tag_destroy(bus_dma_tag_t dmat) { - bus_dma_tag_t dmat_copy __unused; - int error; - - error = 0; - dmat_copy = dmat; + int error = 0; if (dmat != NULL) { if (dmat->map_count != 0) { @@ -300,25 +281,10 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) goto out; } - while (dmat != NULL) { - bus_dma_tag_t parent; - - parent = dmat->parent; - atomic_subtract_int(&dmat->ref_count, 1); - if (dmat->ref_count == 0) { - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } + free(dmat, M_DEVBUF); } out: - CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat, error); return (error); } diff --git a/sys/riscv/include/bus_dma_impl.h b/sys/riscv/include/bus_dma_impl.h index d6e1d4ed632..550ba648615 100644 --- a/sys/riscv/include/bus_dma_impl.h +++ b/sys/riscv/include/bus_dma_impl.h @@ -31,7 +31,6 @@ struct bus_dma_tag_common { struct bus_dma_impl *impl; - struct bus_dma_tag_common *parent; bus_size_t alignment; bus_addr_t boundary; bus_addr_t lowaddr; @@ -42,7 +41,6 @@ struct bus_dma_tag_common { int flags; bus_dma_lock_t *lockfunc; void *lockfuncarg; - int ref_count; }; struct bus_dma_impl { diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c index 6ac9a9cd678..e9801a8a732 100644 --- a/sys/riscv/riscv/busdma_bounce.c +++ b/sys/riscv/riscv/busdma_bounce.c @@ -196,38 +196,19 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, static int bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat) { -#ifdef KTR - bus_dma_tag_t dmat_copy = dmat; -#endif - bus_dma_tag_t parent; - int error; - - error = 0; + int error = 0; if (dmat != NULL) { if (dmat->map_count != 0) { error = EBUSY; goto out; } - while (dmat != NULL) { - parent = (bus_dma_tag_t)dmat->common.parent; - atomic_subtract_int(&dmat->common.ref_count, 1); - if (dmat->common.ref_count == 0) { - if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } + if (dmat->segments != NULL) + free(dmat->segments, M_DEVBUF); + free(dmat, M_DEVBUF); } out: - CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat, error); return (error); } diff --git a/sys/riscv/riscv/busdma_machdep.c b/sys/riscv/riscv/busdma_machdep.c index e992803f3ff..630938a394e 100644 --- a/sys/riscv/riscv/busdma_machdep.c +++ b/sys/riscv/riscv/busdma_machdep.c @@ -62,13 +62,10 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr) int retval; retval = 0; - do { - if ((paddr > tc->lowaddr && paddr <= tc->highaddr) || - !vm_addr_align_ok(paddr, tc->alignment)) - retval = 1; + if ((paddr > tc->lowaddr && paddr <= tc->highaddr) || + !vm_addr_align_ok(paddr, tc->alignment)) + retval = 1; - tc = tc->parent; - } while (retval == 0 && tc != NULL); return (retval); } @@ -100,7 +97,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common = newtag; common->impl = &bus_dma_bounce_impl; - common->parent = parent; common->alignment = alignment; common->boundary = boundary; common->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); @@ -109,7 +105,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->nsegments = nsegments; common->maxsegsz = maxsegsz; common->flags = flags; - common->ref_count = 1; /* Count ourself */ if (lockfunc != NULL) { common->lockfunc = lockfunc; common->lockfuncarg = lockfuncarg; @@ -129,13 +124,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary = MIN(parent->boundary, common->boundary); } - - /* - * 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; return (0); @@ -181,7 +169,6 @@ bus_dma_template_clone(bus_dma_template_t *t, bus_dma_tag_t dmat) common = (struct bus_dma_tag_common *)dmat; - t->parent = (bus_dma_tag_t)common->parent; t->alignment = common->alignment; t->boundary = common->boundary; t->lowaddr = common->lowaddr; diff --git a/sys/x86/include/busdma_impl.h b/sys/x86/include/busdma_impl.h index 4718c67dacc..2e4c83b04d7 100644 --- a/sys/x86/include/busdma_impl.h +++ b/sys/x86/include/busdma_impl.h @@ -33,7 +33,6 @@ struct bus_dma_tag_common { struct bus_dma_impl *impl; - struct bus_dma_tag_common *parent; bus_size_t alignment; bus_addr_t boundary; bus_addr_t lowaddr; @@ -44,7 +43,6 @@ struct bus_dma_tag_common { int flags; bus_dma_lock_t *lockfunc; void *lockfuncarg; - int ref_count; int domain; }; diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index 30771e061ec..76a53f6bbd1 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -128,7 +128,6 @@ device_tag_init(struct dmar_ctx *ctx, device_t dev) domain = CTX2DOM(ctx); maxaddr = MIN(domain->iodom.end, BUS_SPACE_MAXADDR); - ctx->context.tag->common.ref_count = 1; /* Prevent free */ ctx->context.tag->common.impl = &bus_dma_iommu_impl; ctx->context.tag->common.boundary = 0; ctx->context.tag->common.lowaddr = maxaddr; diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index 01e799a1133..992f455ceb9 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -227,38 +227,19 @@ bounce_bus_dma_tag_set_domain(bus_dma_tag_t dmat) static int bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat) { -#ifdef KTR - bus_dma_tag_t dmat_copy = dmat; -#endif - bus_dma_tag_t parent; - int error; - - error = 0; + int error = 0; if (dmat != NULL) { if (dmat->map_count != 0) { error = EBUSY; goto out; } - while (dmat != NULL) { - parent = (bus_dma_tag_t)dmat->common.parent; - atomic_subtract_int(&dmat->common.ref_count, 1); - if (dmat->common.ref_count == 0) { - if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } + if (dmat->segments != NULL) + free(dmat->segments, M_DEVBUF); + free(dmat, M_DEVBUF); } out: - CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat, error); return (error); } diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c index bb1b6a393fb..6fe49367f7d 100644 --- a/sys/x86/x86/busdma_machdep.c +++ b/sys/x86/x86/busdma_machdep.c @@ -67,14 +67,11 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, vm_paddr_t paddr) int retval; retval = 0; - do { - if (paddr >= BUS_SPACE_MAXADDR || - (paddr > tc->lowaddr && paddr <= tc->highaddr) || - !vm_addr_align_ok(paddr, tc->alignment)) - retval = 1; + if (paddr >= BUS_SPACE_MAXADDR || + (paddr > tc->lowaddr && paddr <= tc->highaddr) || + !vm_addr_align_ok(paddr, tc->alignment)) + retval = 1; - tc = tc->parent; - } while (retval == 0 && tc != NULL); return (retval); } @@ -106,7 +103,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common = newtag; common->impl = &bus_dma_bounce_impl; - common->parent = parent; common->alignment = alignment; common->boundary = boundary; common->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); @@ -115,7 +111,6 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->nsegments = nsegments; common->maxsegsz = maxsegsz; common->flags = flags; - common->ref_count = 1; /* Count ourself */ if (lockfunc != NULL) { common->lockfunc = lockfunc; common->lockfuncarg = lockfuncarg; @@ -136,13 +131,7 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent, common->boundary); } - /* - * 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); } common->domain = vm_phys_domain_match(common->domain, 0ul, common->lowaddr); @@ -204,7 +193,6 @@ bus_dma_template_clone(bus_dma_template_t *t, bus_dma_tag_t dmat) common = (struct bus_dma_tag_common *)dmat; - t->parent = (bus_dma_tag_t)common->parent; t->alignment = common->alignment; t->boundary = common->boundary; t->lowaddr = common->lowaddr;