diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4 --- a/share/man/man4/pci.4 +++ b/share/man/man4/pci.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 4, 2022 +.Dd March 17, 2024 .Dt PCI 4 .Os .Sh NAME @@ -235,6 +235,8 @@ Driver name. .It pd_unit Driver unit number. +.It pd_numa_domain +Driver NUMA domain. .El .It offset The offset is passed in by the user to tell the kernel where it should diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -79,6 +79,7 @@ u_int8_t pc_revid; /* chip revision ID */ char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ u_int32_t pd_unit; /* device unit number */ + u_int16_t pd_numa_domain; /* device NUMA domain */ }; struct pci_match_conf32 { @@ -319,6 +320,7 @@ u_int8_t pc_revid; /* chip revision ID */ char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ u_long pd_unit; /* device unit number */ + u_int16_t pd_numa_domain; /* device NUMA domain */ }; struct pci_match_conf_old { @@ -354,6 +356,7 @@ uint8_t pc_revid; /* chip revision ID */ char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ uint32_t pd_unit; /* device unit number (u_long) */ + uint16_t pd_numa_domain; /* device NUMA domain */ }; struct pci_match_conf_old32 { @@ -796,6 +799,7 @@ strlcpy(pcup->pc32.pd_name, pcp->pd_name, sizeof(pcup->pc32.pd_name)); pcup->pc32.pd_unit = (uint32_t)pcp->pd_unit; + pcup->pc32.pd_numa_domain = pcp->pd_numa_domain; return; #endif @@ -817,6 +821,7 @@ strlcpy(pcup->pco32.pd_name, pcp->pd_name, sizeof(pcup->pco32.pd_name)); pcup->pco32.pd_unit = (uint32_t)pcp->pd_unit; + pcup->pco32.pd_numa_domain = pcp->pd_numa_domain; return; #endif /* COMPAT_FREEBSD32 */ @@ -836,6 +841,7 @@ strlcpy(pcup->pco.pd_name, pcp->pd_name, sizeof(pcup->pco.pd_name)); pcup->pco.pd_unit = pcp->pd_unit; + pcup->pco.pd_numa_domain = pcp->pd_numa_domain; return; #endif /* PRE7_COMPAT */ @@ -1024,7 +1030,7 @@ struct pci_map *pm; struct pci_bar_mmap *pbm; size_t confsz, iolen; - int error, ionum, i, num_patterns; + int domain, error, ionum, i, num_patterns; union pci_conf_union pcu; #ifdef PRE7_COMPAT struct pci_io iodata; @@ -1201,6 +1207,12 @@ dinfo->conf.pd_unit = 0; } + if (dinfo->cfg.dev != NULL && + bus_get_domain(dinfo->cfg.dev, &domain) == 0) + dinfo->conf.pd_numa_domain = (u_int16_t)domain; + else + dinfo->conf.pd_numa_domain = 0; + if (pattern_buf == NULL || pci_conf_match(cmd, pattern_buf, num_patterns, &dinfo->conf) == 0) { diff --git a/sys/sys/pciio.h b/sys/sys/pciio.h --- a/sys/sys/pciio.h +++ b/sys/sys/pciio.h @@ -77,6 +77,7 @@ u_int8_t pc_revid; /* chip revision ID */ char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ u_long pd_unit; /* device unit number */ + u_int16_t pd_numa_domain; /* device NUMA domain */ }; struct pci_match_conf {