From nobody Thu Sep 10 05:48:12 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 4hgRY91XNTz6rQ7N for ; Thu, 10 Sep 2026 05:48:13 +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 4hgRY90YtCz4lmp for ; Thu, 10 Sep 2026 05:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789019293; 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=o2wYu9NY0ojygg6EKf+Cj1x3UymWQC5NZj6Yp+cLcXw=; b=Cl7cASU+5jpzwjk9Gg8wE3Xqrln67sHhPMVS1UaE5ccykeHL04rwMDjU2ME0QsIu7hgLrR FFOKf3HF5MfRs8L3ORhvwPgovMLg7z2EEFc1fKkhI0TmHDYsspbEjfoXCbtgnKuFVE9dVa I934UXMt6EICkHYUHYz/mqW0xvlhBT/HvWhwDqKYSPOqwhNn4WSrvOpb6nn8Thahwjvvy/ IvsoBuUUiH5FfHhEkahNBq9dliBAIBJjD/GdPZKhBNopvRGhYsdbSo8qNS+iFxC8JLbPKV o5uFUAsl+WbBzhODI09Ep2eLZupdPA83ENi32BhnYG/4PtiZKJmiO574pPLs2g== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789019293; b=pGABw9ynd3CDazrPVz5XB/IsOD8ZRmZ/Jg6M1i8dfDKB69Js2U7DSLU1ezXCXTIDZH0cUL PkJt5WMBGzFGk5yE7qyOTC72mbHFqG09LwoeufQwpy9DXiYMaGj9OU2+wFoH2wrjoavC7r SC0ESCKv26D3Q7rrawaKZ9hw6BkvD2Vi7NmR84JJj/Bl6oiZbhDq1Gt2Jl21mLUzjgZML8 5MrA6F4PdY58X107BEn3Qt/VlpoUjq8YrTqk2TTSIbxrwzplamWmzb51VlWiKvQJ+6S7Ep MJlqOnkivJSrY4+caIGBcqhN9TiMysVWWtZv24akG3epgJ1tUyGG00xYyl1vSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789019293; 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=o2wYu9NY0ojygg6EKf+Cj1x3UymWQC5NZj6Yp+cLcXw=; b=ImQI3305ufeG8/bKsJFi/guurrjwsaQ/oZG6yLvYM4jI+M45jjaqYvnhEg6TqmsIwF1Zkk ITvV0x6S/k2DtJmC659hb+VdUr6iqW30tFjsxGgHOMORzjGCl9rp+6ISgX2O8iWvfptU5v 3B2Sw97htYR97wSinSyFFX6I8UeGlF83mIVwV/YV6RdxMdVOgGyJGbKuY7xCQNYJ5lbOT3 PmAes+cq3i2TBqPknOg+4Ut1QH6oUdLqgy2pIEPKmpG0I86waJuLt3zYamoXIHRXblvilv 7MYfY5knio6P3CXmMCyre4wBXslcrp7LjRYNKG/1jZie9Vmn7cu1BslBj5Vo+g== 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 4hgRY86XTqz1SSp for ; Thu, 10 Sep 2026 05:48:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d103 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 10 Sep 2026 05:48:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 6c2e54998411 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 6c2e54998411fa5904d8e1cbb28918b663b9281e Auto-Submitted: auto-generated Date: Thu, 10 Sep 2026 05:48:12 +0000 Message-Id: <6aa2449c.3d103.3b4670c4@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=6c2e54998411fa5904d8e1cbb28918b663b9281e commit 6c2e54998411fa5904d8e1cbb28918b663b9281e Author: Kevin Bowling AuthorDate: 2026-08-27 06:23:42 +0000 Commit: Kevin Bowling CommitDate: 2026-09-10 04:05:17 +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 | 58 ++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index 1f04de54ac44..347a68e17e53 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,8 +50,6 @@ #include #include -#include - /* Hooks for the ACPI CA debugging infrastructure. */ #define _COMPONENT ACPI_BUS ACPI_MODULE_NAME("PCI") @@ -60,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; }; @@ -179,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); @@ -560,26 +560,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; - return (pci_get_dma_tag(bus, child)); + 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); + + /* + * 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