From nobody Fri Mar 31 06:03:34 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 4PnqTz0Xlnz42y8D; Fri, 31 Mar 2023 06:03:35 +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 4PnqTy6sfxz45XN; Fri, 31 Mar 2023 06:03:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680242615; 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=+6i7Dq3g3MbHWuVNlr4kdda/tRO2lYq0ibpD7m6wsCs=; b=lKwiDOm9soHlGFRH7pqJv7dHCN7whmCw63yIu/TLBbUNlXdUvf9+xdSe3A7v+G6aHl1yn8 MGLlsHo65xVTQisRcB5Je9EKG6z3cePa9slt8OT0obg9WPLtpXE/Tr5IxAW8L1/4HdlkOS EyCBbXUuYylxJxHFgkl/F13mQlrBXTvTafvUBNrRZ0DLssMTVegFbW+Qj8OG9Af5FnvVLg wNEKMmyKa+PrLjT17pdti4OQvRoZKyJ9mnLOx9DqZ/kBdH+48dgHCvEIwlRE5XP5XCD9J/ 9VcOIjc7GSIe9u/FoKbeLQe2+NXla9vOSvSAJ0X2kq5UoR2NbGYm07mdoWtv/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680242615; 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=+6i7Dq3g3MbHWuVNlr4kdda/tRO2lYq0ibpD7m6wsCs=; b=BhoZ3myrkcWm8RZw5uPTgYPwPBRpwJxyau8DowlzaNPoFW26Un90Etf/aUyG9vlrazYOfO FXQZ1pn256PW43fKeuAqnwyKayInKHetHWF51kjhIgo/FaF541OYkYDkhGcF7BccA9jMnU 7xLWkTmqnvmhR+crhwWAUAGjDmhXIVtJNVTXFbp3adDHtFLaObOnOobSizgHzWZAe2l6iW B17RaRTUhhsKMsXURNZwfyBsM4ot0w1qT2AW1LyoTRlhIs3M/dXReUMexd/9ZUXfeunjcC nOpfrNkG6QIgGoUuYwa65R5CoPZVgF/VRDYVD6U6NZCGy6V7Wx04PDIMIne0ig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680242615; a=rsa-sha256; cv=none; b=rPF76JY+fVF5rc0enK+MJSNOTnvPBbPKC89t7Kix6Sh4y0AuC+Awg4x81PqMTYNlh9BTbI RfQCp/qW3bp1sBYsjyL5+AB4uPzzTHEJzN/fEP5mzj8F2RYAkCiUxh31T6Mudgliwa8Jmh Ti36g85cr1wchkZn0mSM22nC7yeoOaF++vgbuzePehhNBfGvlcy0A+z6iDY8n6FqlKzrpz 25skzvqwZ07iaM8QS+/voq7YP/envO+hOb8XKyrXtGOFqR00AAfOeES4Vm2jc43Zte42+t m9Aduqbs2yApYdrueuznWXdsqzMFvIyJcC31BTwxUnn177B3ut4nBNvFqSy4Pw== 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 4PnqTy5wGDzjGD; Fri, 31 Mar 2023 06:03:34 +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 32V63YYU011278; Fri, 31 Mar 2023 06:03:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32V63YCP011277; Fri, 31 Mar 2023 06:03:34 GMT (envelope-from git) Date: Fri, 31 Mar 2023 06:03:34 GMT Message-Id: <202303310603.32V63YCP011277@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: d3e03d235e31 - main - bhyve: scan PCI device functions to find host LPC 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: corvink X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3e03d235e3133f79ff9e3879fd4ed61ace38d73 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=d3e03d235e3133f79ff9e3879fd4ed61ace38d73 commit d3e03d235e3133f79ff9e3879fd4ed61ace38d73 Author: Corvin Köhne AuthorDate: 2023-03-29 07:45:11 +0000 Commit: Corvin Köhne CommitDate: 2023-03-31 06:00:06 +0000 bhyve: scan PCI device functions to find host LPC At least on some AMD devices the host LPC bridge could be located as seperate function of another PCI device. Fixes: f4ceaff56ddaacc151df07d2d205a2d7fcb736a8 MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D39310 --- usr.sbin/bhyve/pci_lpc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c index 3b42947369a2..02105ef01bdf 100644 --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -461,10 +461,22 @@ pci_lpc_get_sel(struct pcisel *const sel) memset(sel, 0, sizeof(*sel)); for (uint8_t slot = 0; slot <= PCI_SLOTMAX; ++slot) { + uint8_t max_func = 0; + sel->pc_dev = slot; - if ((read_config(sel, PCIR_CLASS, 1) == PCIC_BRIDGE) && - (read_config(sel, PCIR_SUBCLASS, 1) == PCIS_BRIDGE_ISA)) { - return (0); + sel->pc_func = 0; + + if (read_config(sel, PCIR_HDRTYPE, 1) & PCIM_MFDEV) + max_func = PCI_FUNCMAX; + + for (uint8_t func = 0; func <= max_func; ++func) { + sel->pc_func = func; + + if ((read_config(sel, PCIR_CLASS, 1) == PCIC_BRIDGE) && + (read_config(sel, PCIR_SUBCLASS, 1) == + PCIS_BRIDGE_ISA)) { + return (0); + } } }