diff options
| author | Adrian Chadd <adrian@FreeBSD.org> | 2026-02-15 02:28:07 +0000 |
|---|---|---|
| committer | Adrian Chadd <adrian@FreeBSD.org> | 2026-05-01 21:14:37 +0000 |
| commit | df3bd7201efc88b0518c9fe7997f3dbf656eccd5 (patch) | |
| tree | d369fa06cd5a4b6b966a0bcf5dfe44b976dc030a | |
| parent | 330e4f6acbdc360c0dc466f4d54bc63e663d307a (diff) | |
powerpc: add in some busdma domain setup
* Implement the basic tag domain set routine
* Set the domain to the parent domain if provided
This is just plumbing for eventual work to re-allocate things into
the currently configured domain.
Differential Revision: https://reviews.freebsd.org/D55315
| -rw-r--r-- | sys/powerpc/include/bus_dma_impl.h | 1 | ||||
| -rw-r--r-- | sys/powerpc/powerpc/busdma_bounce.c | 5 | ||||
| -rw-r--r-- | sys/powerpc/powerpc/busdma_machdep.c | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/sys/powerpc/include/bus_dma_impl.h b/sys/powerpc/include/bus_dma_impl.h index e24bd6dd8806..80d775f2cf9e 100644 --- a/sys/powerpc/include/bus_dma_impl.h +++ b/sys/powerpc/include/bus_dma_impl.h @@ -42,6 +42,7 @@ struct bus_dma_tag_common { int flags; bus_dma_lock_t *lockfunc; void *lockfuncarg; + int domain; }; struct bus_dma_impl { diff --git a/sys/powerpc/powerpc/busdma_bounce.c b/sys/powerpc/powerpc/busdma_bounce.c index cdc25a5d8fb7..790903712da7 100644 --- a/sys/powerpc/powerpc/busdma_bounce.c +++ b/sys/powerpc/powerpc/busdma_bounce.c @@ -34,6 +34,7 @@ #include <sys/systm.h> #include <sys/malloc.h> #include <sys/bus.h> +#include <sys/domainset.h> #include <sys/interrupt.h> #include <sys/kernel.h> #include <sys/ktr.h> @@ -49,6 +50,7 @@ #include <vm/vm_kern.h> #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <vm/vm_phys.h> #include <machine/atomic.h> #include <machine/bus.h> @@ -80,6 +82,7 @@ static MALLOC_DEFINE(M_BUSDMA, "busdma", "busdma metadata"); /* XXX TODO: bounce flags? */ #define dmat_bounce_flags(dmat) (0) #define dmat_boundary(dmat) ((dmat)->common.boundary) +#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) @@ -219,6 +222,8 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->iommu = parent->iommu; newtag->iommu_cookie = parent->iommu_cookie; + newtag->common.domain = vm_phys_domain_match(newtag->common.domain, 0ul, + newtag->common.lowaddr); } if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) && newtag->iommu == NULL) diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 8e73e303cb11..aba11e64145c 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -49,6 +49,7 @@ #include <vm/vm_kern.h> #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <vm/vm_phys.h> #include <machine/atomic.h> #include <machine/bus.h> @@ -129,6 +130,10 @@ bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) struct bus_dma_tag_common *tc; tc = (struct bus_dma_tag_common *)dmat; - + domain = vm_phys_domain_match(domain, 0ul, tc->lowaddr); + /* Only call the callback if it changes. */ + if (domain == tc->domain) + return (0); + tc->domain = domain; return (tc->impl->tag_set_domain(dmat, domain)); } |
