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
This commit is contained in:
Adrian Chadd
2026-02-14 18:28:07 -08:00
parent 330e4f6acb
commit df3bd7201e
3 changed files with 12 additions and 1 deletions
+1
View File
@@ -42,6 +42,7 @@ struct bus_dma_tag_common {
int flags;
bus_dma_lock_t *lockfunc;
void *lockfuncarg;
int domain;
};
struct bus_dma_impl {
+5
View File
@@ -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)
+6 -1
View File
@@ -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));
}