git: 729576a3d540 - stable/14 - pci: Set the domain in the pci_generic driver
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Feb 2024 16:45:04 UTC
The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=729576a3d540d914136c7faaa134ea25ae9c6636 commit 729576a3d540d914136c7faaa134ea25ae9c6636 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2023-10-13 10:08:21 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-02-19 13:10:27 +0000 pci: Set the domain in the pci_generic driver Tell bus_dma(9) which NUMA domain the PCI driver is closest to so it can allocate memory from there when possible. Reviewed by: markj, jhb Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42186 (cherry picked from commit 7098f3c7569c21ecdfc990772e96a416f1a94eee) --- sys/dev/pci/pci_host_generic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index cef83069c371..90361a7258ed 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -83,7 +83,7 @@ pci_host_generic_core_attach(device_t dev) uint64_t phys_base; uint64_t pci_base; uint64_t size; - int error; + int domain, error; int rid, tuple; sc = device_get_softc(dev); @@ -104,6 +104,13 @@ pci_host_generic_core_attach(device_t dev) if (error != 0) return (error); + /* + * Attempt to set the domain. If it's missing, or we are unable to + * set it then memory allocations may be placed in the wrong domain. + */ + if (bus_get_domain(dev, &domain) == 0) + (void)bus_dma_tag_set_domain(sc->dmat, domain); + if ((sc->quirks & PCIE_CUSTOM_CONFIG_SPACE_QUIRK) == 0) { rid = 0; sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,