From nobody Thu Feb 23 19:34:41 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 4PN3BV44YHz3sfBl; Thu, 23 Feb 2023 19:34:42 +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 4PN3BV1g86z45rM; Thu, 23 Feb 2023 19:34:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180882; 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=Brml1X7LjoZ3rjEni+HcHwJvKlruZcLzmhEvBeJDBfQ=; b=VJzd+0ZLLu66KVY0H9eGb5peinZdG7Z3XzbqoNSdmVvIaDB3TrhfPfJb3Yw8Fq1VyoczjO fQExE5BXPU5dh3UzkFEUppEi1sVHx52DtcIvTyJzEyr1oNH/YN2nW8Zf79MmxHzFgJovFX WMB/XcewwG4n9fH8Ta2HuZVKOIQ058MQtX5gKbMIVPMvSZOSPPB8nJTKi3n06X1FEvtBge UWGbo0AMUTVqVFJ73K4wnfJA7Rw3BWmy1l1k/sMpZgSO7ByYvTWPx4WnQMUFtyRMxOkDyB GL3TiNsW0ktvuP/rBJbadjL3oDWH6Kc9Q1XZihzAQD2+otpik+yg/wpLk/Dliw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180882; 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=Brml1X7LjoZ3rjEni+HcHwJvKlruZcLzmhEvBeJDBfQ=; b=XpPqKR3rkmQHQpHHI8zI4DUdNp6xl/aVqLGvwKvCu7Ca/gUcOiYnZQqZWKnJ0AYI3JaJQ/ LYlq3N/N33kc4olSFyJU29KNvRwlFJ+9tnAuP9J7s6Vgq2M3Y63PGLAde6UW82cYVjamW7 BrX2yC4TtKCqzEOAKTB9EigF3scoHw5pq+Ix4A9qCvLT88HNYjCr7fKYdVIznumFwJd2P0 jVC8QRYvyd41VKSCSKlC5UL1Kf22QA3VsAZU6PeWsW72QJ5BLdQvSdxHRWIPWqvV2f9IQ3 mGt6kkTseiBbAokNVHKIn7s8/aQZvaN6qEIZP0/tDEg/HfCk+gU124ENDUc0VA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180882; a=rsa-sha256; cv=none; b=wo8WaMgfsfoOKVJM55DS0UYWjWp7uJrvD5AfKAiMxNdAjZyIkjO2Yvow4HHG11SmZaMa2S LjyNtHnDExPTN8ll0xEIn8UZiYn0ybuY15/4O7SovU7eGgxg4jMpEpYnd8JpykMJbqI+xC GLZsC54CdIbMm3hByaaAlIIrrtXE5gKeslS6AxVI/iOFacwUlA+Y5t/8C4CopmVTnLd56j i1OfwDXRHn+3bq5itxul9sMa4SNdWiU+h6szUDK2doIuNCsAkgpkY2RT8XhYASMmOnP6PY QIl2P/twNk6nWkx0ACFiJ/FCyHS5TOqO4yk/JU+GMtnR01jjEAnKvmY3E43y6Q== 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 4PN3BV0V6ZzvTP; Thu, 23 Feb 2023 19:34:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYfOb020484; Thu, 23 Feb 2023 19:34:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYf4W020483; Thu, 23 Feb 2023 19:34:41 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:41 GMT Message-Id: <202302231934.31NJYf4W020483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 368a398b9c3e - releng/13.2 - LinuxKPI: return an address string in pci_name() 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 368a398b9c3e01359d9997aaa3ccff6415129f74 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=368a398b9c3e01359d9997aaa3ccff6415129f74 commit 368a398b9c3e01359d9997aaa3ccff6415129f74 Author: Val Packett AuthorDate: 2023-02-06 21:50:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:33:31 +0000 LinuxKPI: return an address string in pci_name() amdgpu's virtual display feature uses pci_name() to match a module parameter string, and the documentation shows an example of `0000:26:00.0` for the name. In our case the name was just `drmn`, which is not actually unique across devices. The other consumers are wireless drivers, which will benefit from this change. Generate the expected string for pci_name() to return. Related to: https://github.com/freebsd/drm-kmod/issues/134 Sponsored by: https://www.patreon.com/valpackett Reviewed by: bz, hselasky, manu (earlier) Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D34248 (cherry picked from commit 393b0ba25f1a54dcc3f94244933c665f1c471d1a) (cherry picked from commit 30960c51e646c51134fcb72e0adc881f36a41c38) --- sys/compat/linuxkpi/common/include/linux/pci.h | 4 ++-- sys/compat/linuxkpi/common/src/linux_pci.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 3d43595df047..e050cb5021cf 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -351,6 +351,7 @@ struct pci_dev { bool msix_enabled; uint8_t msi_cap; struct msi_desc **msi_desc; + char *path_name; }; /* XXX add kassert here on the mmio offset */ @@ -470,8 +471,7 @@ pci_resource_flags(struct pci_dev *pdev, int bar) static inline const char * pci_name(struct pci_dev *d) { - - return device_get_desc(d->dev.bsddev); + return d->path_name; } static inline void * diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index a66627612778..3dbcf5cfbce0 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -309,6 +309,9 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) pdev->subsystem_device = pci_get_subdevice(dev); pdev->class = pci_get_class(dev); pdev->revision = pci_get_revid(dev); + pdev->path_name = kasprintf(GFP_KERNEL, "%04d:%02d:%02d.%d", + pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), + pci_get_function(dev)); pdev->bus = malloc(sizeof(*pdev->bus), M_DEVBUF, M_WAITOK | M_ZERO); /* * This should be the upstream bridge; pci_upstream_bridge() @@ -352,6 +355,7 @@ lkpinew_pci_dev_release(struct device *dev) free(pdev->msi_desc[i], M_DEVBUF); free(pdev->msi_desc, M_DEVBUF); } + kfree(pdev->path_name); free(pdev, M_DEVBUF); }