From nobody Thu Mar 03 23:17:37 2022 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 230C219E4B54; Thu, 3 Mar 2022 23:17:38 +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 4K8n2V0SLTz4TSn; Thu, 3 Mar 2022 23:17:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646349458; 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=qLuxjIedybfG151kTphYX0DWL6SclcmE6GbhlpfbwCA=; b=Jewtlx6iWfPZXlXaR+/y1XzhYC4xF7+H7IzONNC8Gp562COZK4iVAv5L19J+kwMqqKmTiq LjngZ2xAuLrb0FDlSOtKnQAY3dwFJ/yo3QTHQpANiYlz1bAY80XkJ5rBDAqaMhLwa9VUeQ CvxdbJtVm5Nms42dWgq9iDB+aN9sQ9QHXI+7OrpsF0Ko7k/mt4HxYZAJ5RgubMARIcsBDZ hTwLy/c5pWJRABEmHpvpp7Y7VHLozss9Ox7mxLeuuMrjXUY0oO/20Je7PV04YMGL/NwdV9 u4EphAa4F6W9eg8mmN4cK6/P4bxX3PKo4LCiW1cSn0b+JsMThEKFy4H8zE0WRg== 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 E36B520E49; Thu, 3 Mar 2022 23:17:37 +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 223NHbvl015226; Thu, 3 Mar 2022 23:17:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 223NHbpw015225; Thu, 3 Mar 2022 23:17:37 GMT (envelope-from git) Date: Thu, 3 Mar 2022 23:17:37 GMT Message-Id: <202203032317.223NHbpw015225@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: b91dd79ba321 - main - LinuxKPI: allow a driver to override the default pci probe result 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: b91dd79ba32122e6adb28073c534224bc78a7b58 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646349458; 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=qLuxjIedybfG151kTphYX0DWL6SclcmE6GbhlpfbwCA=; b=fjk1A2o12nZOXTxKoUKLtzYzVoi8mcn/Gxg2D3NU3G/JjjCLltgEH92NYh6fkVjVyRnsGe Sty3hDEThlIENjkuItGAHy9/a5VOF5L+8LitsyWrwyZcTpqWDXDYgwQjsfDGli0vqO+OCb vknj6Yi4y5RYE4IK2ovGuocqSyWVNiWiusMjm59GRgJWc9zE3DVl1NcYCEDgRbkj/tckG6 c8k86T5mKD3cf9EXrJTEqlT323wqZapX8DBhXIuo2KcWfhXxXZUiGsY0PlubTQj03f8viA KiguB9bxMYWVxIjLgiXtncCt1QXIOlB9353CMpmBqgMuVnoSEU4KHG+XgNGewA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646349458; a=rsa-sha256; cv=none; b=BYiMqgcJk28JcoDtaqrkSq6jzVxraaRD4RJp+t3xySNJHlqGbwdsROWfpGEVS+92Ybv+Lo V1BK0SDNlLWijc/rPUUdXzvgqynp90SNKtCjrEEJ8eJhwS9II55xz5OBWa0wBoArhlprJ2 yC9cDdn56Bm0H70LOYvRpuOllxROLczoVtffmZkcYwTYgHnaBmNfIAZ5hqA17LYXbTHlrs fWyGIkvL0cE3PRNL9sBUnhrv1K43VLzBRmjIU3Lvazf73A3kucKMX3jE01YI6wXatiIgA/ 7qKGWAmQvwysYtS27hkeCzZ6izHuWs9GiisIBTxEfwGNLN9n8QkkasLQtCNI8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b91dd79ba32122e6adb28073c534224bc78a7b58 commit b91dd79ba32122e6adb28073c534224bc78a7b58 Author: Bjoern A. Zeeb AuthorDate: 2022-02-18 21:58:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-03 23:16:39 +0000 LinuxKPI: allow a driver to override the default pci probe result Add bsd_probe_return which a driver can set in their 'struct pci_driver' definition to set a driver-sepcific LinuxKPI pci return value. This is helpful in case of multiple drivers with overlapping IDs, such as iwlwifi(4) and iwm(4). Contrary to an earlier version we now assume 0 is not BUS_PROBE_SPECIFIC (which no driver should really return these days) but the bss initialized value (bsd_probe_return unset) and we will return BUS_PROBE_DEFAULT. Suggested by: jhb Reviewed by: jhb Reviewed by: hselasky, imp (earlier versions) Sponsored by: The FreeBSD Foundation MFC after: 3 days X-MFC: new struct members need to go to the end for stable/13 Differential Revision: https://reviews.freebsd.org/D33915 --- sys/compat/linuxkpi/common/include/linux/pci.h | 1 + sys/compat/linuxkpi/common/src/linux_pci.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index ff3fbba9102a..7dc969e677de 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -211,6 +211,7 @@ struct pci_driver { struct device_driver driver; const struct pci_error_handlers *err_handler; bool isdrm; + int bsd_probe_return; int (*bsd_iov_init)(device_t dev, uint16_t num_vfs, const nvlist_t *pf_config); void (*bsd_iov_uninit)(device_t dev); diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 0f8e7cc82631..5f0ec07d3841 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -361,7 +361,12 @@ linux_pci_probe(device_t dev) if (device_get_driver(dev) != &pdrv->bsddriver) return (ENXIO); device_set_desc(dev, pdrv->name); - return (BUS_PROBE_DEFAULT); + + /* Assume BSS initialized (should never return BUS_PROBE_SPECIFIC). */ + if (pdrv->bsd_probe_return == 0) + return (BUS_PROBE_DEFAULT); + else + return (pdrv->bsd_probe_return); } static int