From nobody Tue Sep 30 22:21:05 2025 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 4cbsw14txWz69SPS; Tue, 30 Sep 2025 22:21:05 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cbsw13hQTz42qV; Tue, 30 Sep 2025 22:21:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759270865; 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=g8IhKsguVqza+6jmLJ6mGXRX1EGH01J1c+bj/8AA3+M=; b=HKa7ZG1Rttj0Tmt2uJXbBWtx//wy7ORAHuYGM5aum4BMc60rshnI5Y5UzXMX4TwK4/hkTN 0WNrlxDxMErXuMiN3riwsPlSY/u76bDO3PPBYL0qtlgTVnzB7HMHHD3p642ENINUBUgEBz U+sHN7g3mC+KaqtUzUqI4oS1ARrEJCAK+kHVL9mIe0CDxGbOZm3k9RRjDEVBjdfWuQ7wPI YU6vkvgZBgd594Gt2Mfr3YxSlAxkz3AmRGvZikr/aJLFQ5duQL45qeq2RO3+cxV4sLSC/t Egkq3YFNA2GrnMV45HIpZzzJF4/e4c0Y8HMaFxhczcuPQdLr5jSx3i+zG/pYag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759270865; 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=g8IhKsguVqza+6jmLJ6mGXRX1EGH01J1c+bj/8AA3+M=; b=yqYmzy0uQcivy0zuBsokv8jWP9JVWGuhhUJnQP6sCO2g7TvLkAOk1QlQnOWjEr90Maf6k9 61jalQoxug/GL0phxN53Fz17+M3I3dV12FyoqzcuUnhMVa8yiol+nkm3y+eYgtyWP0J7mO YNkOfqaMfrLEbrol9ZSWzbAgKskY197/KwCKeV6sJM75VB1O7l1HpEQYBncnvCoGV6ygqF Cd+Bh5IyK2v2vfe3c/TOXrubSk3ckT2HHEbV5SulKOntq42xKxDGD+vl/bkV1ZW4dkllfe cI7w2ouf5LpEr0Ffma4pt4PpFsenr9TWxGhNsQYXEaeo3RRSrlELp7cLC4HOgQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759270865; a=rsa-sha256; cv=none; b=ja361O9iinxXMtOK0RJhcH1k5aWNK4S3oXG6Cs0Gw7BUh6+/2CyVPl4vap9rq06PElvAZU auin/DEBSKdvC4ZKoalxx0UMyEHyHrLostHytXR4LA5sFImpecILXEa/ZVACBp50uBayit s7jMQ4/KuQPbeuwavJOS4XDzlNiLvtY3cruDvaJgviSFweoEs9/8zyd64EFbrghs94b1K/ a7htL7YigV74chi0NdLk3pI9rgwzL8sE6suy+dH639hTqWzVVjtReyOiYoVX0Pqu0TbV7A dJTW36GPTAgIFGVLPCwxzPEEgyeWvwtR5TDP/AKFp3HyjdbkbAiBFJr3lfJkVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cbsw13FxGzvCf; Tue, 30 Sep 2025 22:21:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58UML5xf038474; Tue, 30 Sep 2025 22:21:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58UML5OD038471; Tue, 30 Sep 2025 22:21:05 GMT (envelope-from git) Date: Tue, 30 Sep 2025 22:21:05 GMT Message-Id: <202509302221.58UML5OD038471@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: 62c3b77d1d10 - stable/15 - LinuxKPI: pci: implementation of [lkpi_]pci_get_slot() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/15 X-Git-Reftype: branch X-Git-Commit: 62c3b77d1d1084dc46663eed52e288307b5c7e64 Auto-Submitted: auto-generated The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=62c3b77d1d1084dc46663eed52e288307b5c7e64 commit 62c3b77d1d1084dc46663eed52e288307b5c7e64 Author: Bjoern A. Zeeb AuthorDate: 2025-09-04 20:19:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-09-30 21:45:29 +0000 LinuxKPI: pci: implementation of [lkpi_]pci_get_slot() Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is needed for a wireless driver. Unfortunately the name [pci_get_slot()] collides with the native PCI function. Add a guard around it and disable the use when the native version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the latter gets fixed we can probably also fix work around it in the former; further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved). Sponsored by: The FreeBSD Foundation (initially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52065 (cherry picked from commit 4179e6b78297369f0cf0eae1076e01e5151c5cbe) --- sys/compat/linuxkpi/common/include/linux/pci.h | 6 ++++++ sys/compat/linuxkpi/common/src/linux_pci.c | 15 +++++++++++++++ sys/dev/bnxt/bnxt_en/if_bnxt.c | 1 + 3 files changed, 22 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index d891d0df3546..ffc2be600c22 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1332,6 +1332,12 @@ struct pci_dev *lkpi_pci_get_domain_bus_and_slot(int domain, #define pci_get_domain_bus_and_slot(domain, bus, devfn) \ lkpi_pci_get_domain_bus_and_slot(domain, bus, devfn) +struct pci_dev *lkpi_pci_get_slot(struct pci_bus *, unsigned int); +#ifndef WANT_NATIVE_PCI_GET_SLOT +#define pci_get_slot(_pbus, _devfn) \ + lkpi_pci_get_slot(_pbus, _devfn) +#endif + static inline int pci_domain_nr(struct pci_bus *pbus) { diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index d0f1d5e3f9c5..8507a59a8df3 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -67,6 +67,7 @@ #include #include #include +#define WANT_NATIVE_PCI_GET_SLOT #include #include @@ -485,6 +486,20 @@ lkpi_pci_get_domain_bus_and_slot(int domain, unsigned int bus, return (pdev); } +struct pci_dev * +lkpi_pci_get_slot(struct pci_bus *pbus, unsigned int devfn) +{ + device_t dev; + struct pci_dev *pdev; + + dev = pci_find_bsf(pbus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); + if (dev == NULL) + return (NULL); + + pdev = lkpinew_pci_dev(dev); + return (pdev); +} + static int linux_pci_probe(device_t dev) { diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index feac3ce54a29..471e26a4b252 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -48,6 +48,7 @@ #include #include +#define WANT_NATIVE_PCI_GET_SLOT #include #include #include