From nobody Thu Sep 10 05:53:45 2026 X-Original-To: dev-commits-src-branches@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 4hgRgZ1Qrlz6rQv0 for ; Thu, 10 Sep 2026 05:53:46 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hgRgY3dZZz4nsb for ; Thu, 10 Sep 2026 05:53:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789019625; 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=SngDW5R0Vpkf5ucewznFYDMgg1KQh6J4J6N+HjNYYZs=; b=hdcRiEaiSWwngYxw0u/9okd6EYFx/LZs/+ab5NwvCkjyyKqy9TDtP9+jN2RFyl0qR+5vVS h8bmg+wiX2/CrAnLP2zzbdqEvXT1BCRgrPrNWJQJSFduITGUuha6FAdynbtb/dw0eWoRKr UmQ4agtOiPg9REZAN+7th5cwKPRhscmVUgHDQANax/eUp898wlAjvmzhmCf8XpP9oVZr/3 sjLPFQ4qg83fD1b6ajfRP0pl/c4MWPmDUbea3p2ho46fNM1y7akUtjEHxtBjmGL/qXeAab i/JmqH10G7T0peCEJXLimNRN0ZKQy+cg3vK2fgVavy//h2Ux0QsPUXqepUUHuQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789019625; b=Hldof2RrDlKi9ctVneTVfruLk8Q4NZFVgBm5QZipUpMEipaes3bISbAufG5Cvfo+rHLHlv U5+TDRhHju7bmxRE1kkkpk5em0XRN8CCLAB70QQ+duOS4s8g00KX5+VdYLzjQk/cLrbPas ivTCddbcwmBIG7O0LogwovaYDdT7SYQ/KMkdIk1VBd8SZ8VPRyMR73+O3z+8rZopulc8br ENSnKAmJtBwirK3gFYLoS/SGt9H1UL71sMmyJDDzBNykaVYIGmWTQVx9ksF2vputSpZGZV +RHn1pHFZqfGn7m4RDkQnIejbVyk3QBmRzTkoDkYP9MvqCav927Ui9g2YaoB6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789019625; 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=SngDW5R0Vpkf5ucewznFYDMgg1KQh6J4J6N+HjNYYZs=; b=IQf+uMujeaDbkuAfvxdOyI3qtcNfVben7YASUF2bpiThC0fSLJpNHlXvd4YpWoGeT2D3q0 +GNI+QdGpoxwItkvU7pk37q6yeL+Q4jMg1V49BKZvVMhZ/oWRO8WGPid4JUSN0VVXv8kU2 DizRyoez/l5DXwAK61H3EQptMCYX348CXNF0/pMjo6i52+h3+DJ7v3GVMcdcXfBArXa5d3 jKlrfVxiRO+bJCVbnR30q7EPotzULrzvMovpECLm/GH29vOpb1ZJz8FKvfwgZqXUz0XOFt UCrQAQqJ4k+BBdc4wpwnkljahDVZ5NxtkAtKM0bhutsszq2nQXNwGE6tugyHGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hgRgY2jsgzFKk for ; Thu, 10 Sep 2026 05:53:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3dc3e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 10 Sep 2026 05:53:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: f006f9ee93fe - stable/14 - acpi_pci: Honor device proximity for DMA tags List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f006f9ee93feb77e8fc4723d6c2e386b3956bb51 Auto-Submitted: auto-generated Date: Thu, 10 Sep 2026 05:53:45 +0000 Message-Id: <6aa245e9.3dc3e.1eded64a@gitrepo.freebsd.org> The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=f006f9ee93feb77e8fc4723d6c2e386b3956bb51 commit f006f9ee93feb77e8fc4723d6c2e386b3956bb51 Author: Kevin Bowling AuthorDate: 2026-08-27 06:23:42 +0000 Commit: Kevin Bowling CommitDate: 2026-09-10 05:53:16 +0000 acpi_pci: Honor device proximity for DMA tags A PCI function with its own _PXM still inherits a DMA tag carrying the upstream bridge's proximity domain. Resolving an SR-IOV VF's locality through its PF therefore does not affect the domain used for DMA allocations. Create and cache a private child tag when the function, or a VF's owning PF, has an explicit _PXM. Parent it to the existing PCI or IOMMU tag so its constraints remain intact, then apply the function's domain without mutating a shared tag. pci_get_dma_tag() already performs the IOMMU lookup, so remove the duplicated lookup in the ACPI subclass while here. Reviewed by: jhb Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59063 (cherry picked from commit f1f58bdf7b5fc58e6011c6ac2ae2ba129dc41991) --- sys/dev/acpica/acpi_pci.c | 61 ++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index 9a9e36848977..525128756e66 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -28,7 +28,6 @@ #include #include "opt_acpi.h" -#include "opt_iommu.h" #include #include @@ -51,11 +50,6 @@ #include #include -#include - -#include "pcib_if.h" -#include "pci_if.h" - /* Hooks for the ACPI CA debugging infrastructure. */ #define _COMPONENT ACPI_BUS ACPI_MODULE_NAME("PCI") @@ -63,6 +57,7 @@ ACPI_MODULE_NAME("PCI") struct acpi_pci_devinfo { struct pci_devinfo ap_dinfo; ACPI_HANDLE ap_handle; + bus_dma_tag_t ap_dma_tag; int ap_flags; int ap_domain; }; @@ -182,6 +177,8 @@ acpi_pci_child_deleted(device_t dev, device_t child) { struct acpi_pci_devinfo *dinfo = device_get_ivars(child); + if (dinfo->ap_dma_tag != NULL) + bus_dma_tag_destroy(dinfo->ap_dma_tag); if (acpi_get_device(dinfo->ap_handle) == child) AcpiDetachData(dinfo->ap_handle, acpi_fake_objhandler); pci_child_deleted(dev, child); @@ -562,26 +559,42 @@ acpi_pci_detach(device_t dev) return (pci_detach(dev)); } -#ifdef IOMMU -static bus_dma_tag_t -acpi_pci_get_dma_tag(device_t bus, device_t child) -{ - bus_dma_tag_t tag; - - if (device_get_parent(child) == bus) { - /* try iommu and return if it works */ - tag = iommu_get_dma_tag(bus, child); - } else - tag = NULL; - if (tag == NULL) - tag = pci_get_dma_tag(bus, child); - return (tag); -} -#else static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus, device_t child) { + struct acpi_pci_devinfo *dinfo; + bus_dma_tag_t parent, tag; + int domain, error; + + if (device_get_parent(child) != bus) + return (pci_get_dma_tag(bus, child)); + dinfo = device_get_ivars(child); + if (dinfo->ap_dma_tag != NULL) + return (dinfo->ap_dma_tag); - return (pci_get_dma_tag(bus, child)); + /* + * The parent tag already carries the upstream bridge's proximity + * domain. Only create a private tag when this function (or its PF, + * for a VF) supplies a more specific _PXM. In particular, do not + * change the shared PCI or IOMMU tag in place. + */ + domain = acpi_pci_get_locality_domain(child); + if (domain < 0) + return (pci_get_dma_tag(bus, child)); + + parent = pci_get_dma_tag(bus, child); + if (parent == NULL) + return (NULL); + error = bus_dma_tag_create(parent, 1, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE, + BUS_SPACE_UNRESTRICTED, BUS_SPACE_MAXSIZE, 0, NULL, NULL, &tag); + if (error != 0) + return (parent); + error = bus_dma_tag_set_domain(tag, domain); + if (error != 0) { + bus_dma_tag_destroy(tag); + return (parent); + } + dinfo->ap_dma_tag = tag; + return (tag); } -#endif