From nobody Mon Oct 16 10:47:27 2023 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 4S8DMg4Ws2z4xDD3; Mon, 16 Oct 2023 10:47:27 +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 4S8DMg3rSqz3MHT; Mon, 16 Oct 2023 10:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697453247; 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=lZ1l897Ns3+xBWUzMMznfYAGwKlzUaktuDvPAA+WCOo=; b=f7ZvZG5flNU7ni2FOmhkXjxWnKs0vEjxw/kA0t8mWrMMKQLd5kTyByw8hG4GeHPI4YokBy XKXqnWRYMWXly7SVH9g8gRk4ee9r3KcoFhdn01rmx+pHZlfeh6vT7T8yRKeW8qQRTJD2aB osJ/FKCyty2+meBEJJLJLtlw+VyYhIdEO5DoyaaFA8DgQzV9RQWahBskY2X0uOYHnYonQi ePOpWTzBI5OZccz9iwe4o2JGHBnJ/58s+O6G1FRocaWjx5e+oCa8r50ACtQmmcB1cYpAUI D35yZVyMLfPaCniTcJUWPVRMDEfV/eS+IwwsdMRiCAw8Hf3bEdUTVLAsneO/bQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697453247; a=rsa-sha256; cv=none; b=hyxV0Rq51og4VG2pe6iFsNK58w+7TEvNL9PCaQLsIjoyJEs4cygOQtxVenxYR+BaHZROa6 L4EgXW5+GKnxkekwpniq+G7mrbKLguN84f/w9SOMfCaIjf5SjbvT13uLto+Npz7rQ6lXLL AnaMiBPY518Oh6XpKQ+rWZJiXnmPxFG6Jz1vkbjSFbXiq+JwCdMcoVA7eNKPwzymXxevFk /lzszS4X6qT96JVCE7GAcMX45NXs4BiQHReOqkKXJ3BNlfEdf7YQgkgnEqLSafb9Zgc1an JTn0DVJ6omCxo7XiVOrsT6u3BsHOf7pLOyIM2ECWx7cmeET20T526Ek4J7eXFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697453247; 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=lZ1l897Ns3+xBWUzMMznfYAGwKlzUaktuDvPAA+WCOo=; b=dHVJjSsymWmhLOP83KoGkjbz/DYkCjeVa2GXvMF/Qj9unSOkxFu2XMmk6NayQa95VMNZBh P/g32WDPXEdYyZbE/C0MfGCT6Q22z2IDvm0/tAahx0mzfW5k3MhSHNcAsnN65JTWLzLWDG kkzVrfk7Q6Z1ghwHIlobhEhXrpLXjreC0IqeMw5rHoBWaPWEAw6si4adqTqYLnUa5f+Tx6 HWY9ApjUiFNadrdVg10s4e11xFBf8J2SjjLEGWg7iEDmUIAHBulZeb/m2tCraV+pziElnb 6/mYxS5jCed3SWT5OSzKeMdqvX94eHw61MDzAX2XUrGIVb+HmJUnmutiOzbEtA== 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 4S8DMg2w7szcSL; Mon, 16 Oct 2023 10:47:27 +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 39GAlRus003695; Mon, 16 Oct 2023 10:47:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GAlR8c003692; Mon, 16 Oct 2023 10:47:27 GMT (envelope-from git) Date: Mon, 16 Oct 2023 10:47:27 GMT Message-Id: <202310161047.39GAlR8c003692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 7098f3c7569c - main - 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/main X-Git-Reftype: branch X-Git-Commit: 7098f3c7569c21ecdfc990772e96a416f1a94eee Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7098f3c7569c21ecdfc990772e96a416f1a94eee commit 7098f3c7569c21ecdfc990772e96a416f1a94eee Author: Andrew Turner AuthorDate: 2023-10-13 10:08:21 +0000 Commit: Andrew Turner CommitDate: 2023-10-16 09:36:39 +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 --- 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,