From nobody Mon Feb 06 21:58:29 2023 X-Original-To: dev-commits-src-main@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 4P9gBF5gzlz3nTZg; Mon, 6 Feb 2023 21:58:29 +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 4P9gBF5Fvfz4CfC; Mon, 6 Feb 2023 21:58:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675720709; 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=wNbtiBsaO41Mgkx85eOEKtai3k1TwJhlz/zax/Eth2k=; b=nYQUL3u38va9ZSzESlDXbh4segEO+sa4taNu0gdEvTVR4Zg55qDgo4KqL4iHQJUqANtvGP 7SM6Vhv9YillqwE84z3cif8uUltx8gwtImAPnvIyxX3B4rL5oMujTvLcEGLxQ9SrYsxwJY X7SGIEwnuuyszInri19kug7hP32ASLxdD9x16/sakxXoj++qlzIpagWKaOZy5An4m+nA1c sI9GhYA2HBSFmNkCr+FpMBfoSZlK20l3xJyahbmVv5ZpUwwn6F6KFpIw6BWSqf5UTLgMEA M1XmWTRvGjKoa6zFWOFN0IycNXReiPLWF/Ck2iXaKi4YgVqUnuz8I8kU9DKMkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675720709; 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=wNbtiBsaO41Mgkx85eOEKtai3k1TwJhlz/zax/Eth2k=; b=RL+j4GL2YHDl2c8TqYOq3oBqIlKl0cOQ//1NTNvEpWUMVGBbh9YP0lnOCTziqKzKMOVC7v 6X1cMCU409L8JTcolrhaTEKfUdjg8GnXDWeh4Q7akxW/jpZn+ncrCasODJCSvxnHMcuHVb 745KT2wmIeTANcoRJnlRb28qHXas8LhiO5kcPO3OtpYi8JCwMk58e4OeWap/H+aCV0ggiW yC3s7wPTuqKCmYxfvnm8rn6SNBONmUSp31iz/q84/8p2GDTVdP2LoHgeXSCMcqgvJ0Fif4 de4FrqyM/9WIVjHKQfQFqjA1Br+MPePrGRz0tL0u6iu1lr8F9RwOaRTjtnJ6TQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675720709; a=rsa-sha256; cv=none; b=ydfwvUrPp4DxP80E8Dmu87fkHWUZg++F0Wee/39aQ8q+YTT6QhZALfS5WpzMN1aTcthzvS grf7gzIpnMNaev6V84DrFgFCASAU4o+OqX7whdndCVyW8m9QqbyTC5KtHj/gsAj23pRTAh 9ymUSBHLh+duxjPn2k27Mvj0vtpSAyKNr8fg/e+dDuSggPPrhKwS0apTebolRVKWqY8HYs 7Q/R+YANH0AGCLfkpFVWjnHBN55NuX2oLpsA6dYzQAfkTAcY+S8HUcMDjvNkLC//RqMEMm E8IkMqQCr7mHYxX3vFNp74fJJSuoDlhc92svHebi6G+Z3RkeuzKtax4yde1IfQ== 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 4P9gBF4JdFzrdy; Mon, 6 Feb 2023 21:58:29 +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 316LwTQj021797; Mon, 6 Feb 2023 21:58:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316LwTkY021796; Mon, 6 Feb 2023 21:58:29 GMT (envelope-from git) Date: Mon, 6 Feb 2023 21:58:29 GMT Message-Id: <202302062158.316LwTkY021796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 393b0ba25f1a - main - LinuxKPI: return an address string in pci_name() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 393b0ba25f1a54dcc3f94244933c665f1c471d1a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=393b0ba25f1a54dcc3f94244933c665f1c471d1a commit 393b0ba25f1a54dcc3f94244933c665f1c471d1a Author: Val Packett AuthorDate: 2023-02-06 21:50:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-06 21:56:39 +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 --- 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 596241525904..c9ebdf546696 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -334,6 +334,7 @@ struct pci_dev { phys_addr_t rom; size_t romlen; struct msi_desc **msi_desc; + char *path_name; TAILQ_HEAD(, pci_mmio_region) mmio; }; @@ -454,8 +455,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 9db95e1f337d..0d9b2827365f 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -307,6 +307,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() @@ -350,6 +353,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); }