From nobody Sun Mar 27 20:13:57 2022 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 A58981A5301B; Sun, 27 Mar 2022 20:13:58 +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 4KRRqV2wvkz4nv1; Sun, 27 Mar 2022 20:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412038; 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=XUDJg+vTtcfxHBADT+ou+M23Uc2hZosD0eQ9m19Sju0=; b=nl+XO+VsRdIY292Y0MvcDfrRFtF/nSYWQCmdN6evDS4P2TwHgklt0tMO0917PTcWBcX47U 6C3OgVoyLnyuGjGue461uOlcRBL62bGjjuH2tDdhMJUm8+AT7nhnRR6tkh3+6vYm6YZnz1 YQbNDkKmZSHhH7YtX5BgQTVjm/kj+pbg/Iw1H2QzIIpT9ifYKzUiHbYnHRqo8kLQITQiwh YMopwmzP2XQKKtHun0h2ASD7a2LCalFT4r960GwKFoLKRz3PJ83U0nIg2p+8/sObDySClf qvO1JbozfvjM0hoKn2Wf1dyodjjv1PkOnvcUseCIKERmsS9mgXxgFsNt5F0q2w== 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 C3B431BE49; Sun, 27 Mar 2022 20:13:57 +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 22RKDvMV037064; Sun, 27 Mar 2022 20:13:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22RKDvIZ037062; Sun, 27 Mar 2022 20:13:57 GMT (envelope-from git) Date: Sun, 27 Mar 2022 20:13:57 GMT Message-Id: <202203272013.22RKDvIZ037062@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: 3166cea63244 - stable/13 - LinuxKPI: allow a driver to override the default pci probe result 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: 3166cea632449ce6c6dad699a812b9813a9531ef Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412038; 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=XUDJg+vTtcfxHBADT+ou+M23Uc2hZosD0eQ9m19Sju0=; b=xisKWbWtFAV1YRMlpNZuv8qbX+New7WbVSFMuD6Iuavzn5H9w9CT8PuuAor+3wpu2kJzEa ztHHuA6tz03AdJTV4NCMNx9G4w2LhdS0X5XVD4HKq3b9LH3cNnVK1Ly4ahlDuICSAKfQfq nngUOgnI+Aq8Z+cuR5YTc1ms0y0CbckdMmWic62DAoVL3dYjZAiDWm7dJb5xsMHw0CUZYD Xo/pwMMoDcubGvU8NwXkG30T3OaiJ5ECRqgUNoAigDrQkz9AJyPL542MTR7NebVl2uRBH6 nPyAOnesUC2IJNk9/N6E+oe6/iBnrzRhA/I7I6xxRVaEiRvcfze312u3hQhBwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412038; a=rsa-sha256; cv=none; b=PT5ATLYKnZOCr+pxktmnm9s6lRc3MpBr5yVjSyr7GhCEH1vp3JqDal2cZFhWjnX+6KLL1S 8EwAOU4c1xhgLcGQp3uQ9nD7vdoAOyDSbrJXhPxwFdIeBloSgEKE0cZfphHOTXQN4GaYx1 mUGYPlBx/PFlMtpBO3d21/7uNh2TAfH0qw9XaSa6cOoANnCxohI+PwDw8lEdocoMl0LX6S OXjx7Us5Z3vUd80pa/uKBKLNc40696AONnzxaCrgNRX0nKSHqFBRQOSvKT3KofMhkXLeuV OYF4uxrcJdRSWA9j2ILBPZWo5dQbLSefNuI6AsikSd5aXPE6PQJZnd5Qe5QhWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3166cea632449ce6c6dad699a812b9813a9531ef commit 3166cea632449ce6c6dad699a812b9813a9531ef Author: Bjoern A. Zeeb AuthorDate: 2022-02-18 21:58:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 18:06:33 +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 Differential Revision: https://reviews.freebsd.org/D33915 (cherry picked from commit b91dd79ba32122e6adb28073c534224bc78a7b58) --- 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 f463f697b5f7..df18c98a6278 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -215,6 +215,7 @@ struct pci_driver { void (*bsd_iov_uninit)(device_t dev); int (*bsd_iov_add_vf)(device_t dev, uint16_t vfnum, const nvlist_t *vf_config); + int bsd_probe_return; }; struct pci_bus { diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 06feb5107ea5..ccb52732391e 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