From nobody Mon Feb 19 16:45:04 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TdpL864RCz5C9HG; Mon, 19 Feb 2024 16:45:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TdpL856zJz4bLP; Mon, 19 Feb 2024 16:45:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qJr4k4Ob5dboNAHBtoWwbG93sLGJgC4BlhU7cnP+ol0=; b=vXRrMPZqCPad7uiZhOp3yScRUocddEeTLKqah3C1rp48nZYsEHnNyPRYUqwJxBgJUbHoJH 0vsO0fe0C4hFiFF4Wz/oW5//DPr3EnB5PhqR84yfdm11cQrljXZKhvBcbLdOCCEz2bqf3i yAiAqMOXS8xYgx7/6ef20LDrHlNifbH68tb1klPm8LJvnWk64kVzDkcVAcntWfSrxgkfQx 7jHjcl9sCVgeLI+KOSqdVnh/5/gEYcjy6TeUS8KDQcHaJM8LsCXAKSfKq7YIlDVcvaNbkD 0vcuLsy/D4B8CsamuZqyjbTgdEaMzSrazAocL5xZ7VIODcE1U+WnAtPeImtWQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qJr4k4Ob5dboNAHBtoWwbG93sLGJgC4BlhU7cnP+ol0=; b=qdeGbLztRwIea/LcDmkODZ/8dCmsVr3dE5bbK+nkuSoJIxbszEZhVeBqohvrvStGPjz6gl t9fE1XnXGrxsBHz6pxYerjovMDRET4+niZ55OAwzYlqRBnp3E4KTV1Xag9JI9Bem85cmUb MzzcTE77U1zDjdPN2Z9wVf778tPvjkEQaMhqfVNOaxPEmLayyE92AkNUIaB3ebzCloBlfi IRQXECwHhAzeCg0Q+B9K6pfHsDoh0j/Zz4WYBKOd7OPxAx13TnSEGYIA+k6rbj92nMYQP8 HWI4pHbUF516X7OpHyt5XkNByabNwom45NViSbi1WzhcQDf+PGQrZYuJ7QMe/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708361104; a=rsa-sha256; cv=none; b=Ro6Ot5Lftf0jinTVgKLenIYe7qJ5MUNrGGeEDjghzIVNO2eflbph8qQduE06W8vVUBa/HE fMtCt55vLzKBZf2Tkc0Tp/J0BOIdFnY4uuz/986b2oJBwYSl9uHYzciC8dlambyqLTr/R/ jGr8O3z86eWVrb0N9iJHEMzlDZ9mYpFBupkseyYwoaNGMDoXX9Tiw4f7M8n2qfEWpifbby 85RJGVVQzsKo/yukxLI8H5pTtaBRZZ+3k+jOwPDk/EDZF1rmnFYe1C2ljBzO0lTiXSNkcq CCvrg99OA6fjFyjR3wwRVaFlTHLxM0518207sy7Ef+8NA7qZpdyu2yywoau21A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TdpL84DxJzjVY; Mon, 19 Feb 2024 16:45:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41JGj4Rj095156; Mon, 19 Feb 2024 16:45:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JGj4GQ095153; Mon, 19 Feb 2024 16:45:04 GMT (envelope-from git) Date: Mon, 19 Feb 2024 16:45:04 GMT Message-Id: <202402191645.41JGj4GQ095153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 729576a3d540 - stable/14 - pci: Set the domain in the pci_generic driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 729576a3d540d914136c7faaa134ea25ae9c6636 Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=729576a3d540d914136c7faaa134ea25ae9c6636 commit 729576a3d540d914136c7faaa134ea25ae9c6636 Author: Andrew Turner AuthorDate: 2023-10-13 10:08:21 +0000 Commit: Andrew Turner 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,