git: df3bd7201efc - main - powerpc: add in some busdma domain setup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 May 2026 21:15:18 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=df3bd7201efc88b0518c9fe7997f3dbf656eccd5
commit df3bd7201efc88b0518c9fe7997f3dbf656eccd5
Author: Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-02-15 02:28:07 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-05-01 21:14:37 +0000
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
---
sys/powerpc/include/bus_dma_impl.h | 1 +
sys/powerpc/powerpc/busdma_bounce.c | 5 +++++
sys/powerpc/powerpc/busdma_machdep.c | 7 ++++++-
3 files changed, 12 insertions(+), 1 deletion(-)
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));
}