From nobody Fri Feb 17 23:45:04 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 4PJT2861vxz3rxNJ; Fri, 17 Feb 2023 23: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 4PJT284yQNz3Hkw; Fri, 17 Feb 2023 23: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=1676677504; 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=2YRTxIkcWMNrVqzvoQ68NrgcflrcKAthi72U5NPWtWE=; b=cbsYwIcT9Bx3BGaHhjmoIukWFJrwlgQS94zWE552uUBPWR92lm3JP9/MU/aEpmscZ9tmAG vqryMm0RPm5tranJFQ5IEJXU0iClY/wwWfo34VpHzin3bdghID2samwbs65cv780BE6JkP DejbkcZV0CG0R8MdNbzj1qh/SULQBhaxFAQGSlThqaf1M/HPclrDIOP62KXVu9eIdtGe87 pM8doJFxFgg+Yj8NPdEnno7r7G8HsX4/48RxCKm12IQ3Tb6O4yujc/IfOn31XYF05XTQog HNVEKulZB4dp1gFX7VClvMbhPteAMF5RtuaVjkANX6yojb+nWLb7CUZ+SUzzvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676677504; 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=2YRTxIkcWMNrVqzvoQ68NrgcflrcKAthi72U5NPWtWE=; b=cD3p6insGeBsp5cxbhm5UISdxou4T+VmHtWwXGDkBwd9MUY8nqvH8XRHh/GW8xkqLfi3jt KZ3zq2K+TY/76VWm/KcG9HgsDIF4YX2t16d+XcOPkxAxjATHd+nhQw908qDK3Ro4RMTI42 hHdTdQBxrdELtyVQKkIP15sSwNcPnP9IUmIhVvsN/IWslJJoi5LoDU0Adq0j6VTXb3AdQ7 MgdYQzwnoKP+5eeg/Q1syA1O21R2N1i9szWHszpeDAZIOI+MFKNaE37XNVujl26hQdf+FC waaxreYtpS10DEV566UmsAzJixEBZpE9diSADeZ9xUvnhIgOrGE3VzRtDm11lQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676677504; a=rsa-sha256; cv=none; b=qt1CG9ubVscmIQRFTpvyOR9zihLABUiU5Mt+SuniFZHu4rhXfgYD/YXa/70sycAto891YC wdUznPDFkXSOLAsTfQdGvVEwXXkY6+MrtRDBIq5r6VotYiAhbc1dkq3JP69fMrZcvXnXmG aeya7BkllEWbbbDDsdkGFhV+jeLOFk0YoiqSX4iIpbNV47xpvWaor+7HKAJTYD0tg37xCI K2r5NmG6S6OwO5Fi/dyPVzRZov+KkfgTSXBPwlLYCSotaVe/NbqBy3kNJeeILk5k7IG0zZ pXafseqrnmpSSVluuQtzarMr6n/mEjbFB57bxuWAklslnjzzMZgLMLT3IkMXAw== 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 4PJT283nYnz123C; Fri, 17 Feb 2023 23:45:04 +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 31HNj4gn025391; Fri, 17 Feb 2023 23:45:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31HNj4e2025390; Fri, 17 Feb 2023 23:45:04 GMT (envelope-from git) Date: Fri, 17 Feb 2023 23:45:04 GMT Message-Id: <202302172345.31HNj4e2025390@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: 30960c51e646 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 30960c51e646c51134fcb72e0adc881f36a41c38 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=30960c51e646c51134fcb72e0adc881f36a41c38 commit 30960c51e646c51134fcb72e0adc881f36a41c38 Author: Val Packett AuthorDate: 2023-02-06 21:50:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-17 23:42:16 +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) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34248 (cherry picked from commit 393b0ba25f1a54dcc3f94244933c665f1c471d1a) --- 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 48bdabda9f21..f8071524c9e0 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -355,6 +355,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 */ @@ -475,8 +476,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 5f3a24210c03..88a6b749a043 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); }