Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Apr 2023 06:41:52 GMT
From:      =?utf-8?Q?Corvin=20K=C3=B6hne?= <corvink@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0d29d750b9a7 - main - bhyve: do not exit if LPC finds no host selector
Message-ID:  <202304110641.33B6fqVg055003@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d29d750b9a7188c435d3701b2183f4df15ac98b

commit 0d29d750b9a7188c435d3701b2183f4df15ac98b
Author:     Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2023-03-29 08:07:10 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2023-04-11 06:39:21 +0000

    bhyve: do not exit if LPC finds no host selector
    
    The host selector is only required when the user likes to use the same
    LPC device IDs as the physical LPC device. This is an uncommon use case.
    For that reason, it makes no sense to exit when we don't find the host
    selector.
    
    Reviewed by:            markj
    MFC after:              1 week
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D39311
---
 usr.sbin/bhyve/pci_lpc.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c
index 02105ef01bdf..8213f32985ef 100644
--- a/usr.sbin/bhyve/pci_lpc.c
+++ b/usr.sbin/bhyve/pci_lpc.c
@@ -480,6 +480,8 @@ pci_lpc_get_sel(struct pcisel *const sel)
 		}
 	}
 
+	warnx("%s: Unable to find host selector of LPC bridge.", __func__);
+
 	return (-1);
 }
 
@@ -487,6 +489,7 @@ static int
 pci_lpc_init(struct pci_devinst *pi, nvlist_t *nvl)
 {
 	struct pcisel sel = { 0 };
+	struct pcisel *selp = NULL;
 	uint16_t device, subdevice, subvendor, vendor;
 	uint8_t revid;
 
@@ -511,15 +514,15 @@ pci_lpc_init(struct pci_devinst *pi, nvlist_t *nvl)
 	if (lpc_init(pi->pi_vmctx) != 0)
 		return (-1);
 
-	if (pci_lpc_get_sel(&sel) != 0)
-		return (-1);
+	if (pci_lpc_get_sel(&sel) == 0)
+		selp = &sel;
 
-	vendor = pci_config_read_reg(&sel, nvl, PCIR_VENDOR, 2, LPC_VENDOR);
-	device = pci_config_read_reg(&sel, nvl, PCIR_DEVICE, 2, LPC_DEV);
-	revid = pci_config_read_reg(&sel, nvl, PCIR_REVID, 1, LPC_REVID);
-	subvendor = pci_config_read_reg(&sel, nvl, PCIR_SUBVEND_0, 2,
+	vendor = pci_config_read_reg(selp, nvl, PCIR_VENDOR, 2, LPC_VENDOR);
+	device = pci_config_read_reg(selp, nvl, PCIR_DEVICE, 2, LPC_DEV);
+	revid = pci_config_read_reg(selp, nvl, PCIR_REVID, 1, LPC_REVID);
+	subvendor = pci_config_read_reg(selp, nvl, PCIR_SUBVEND_0, 2,
 	    LPC_SUBVEND_0);
-	subdevice = pci_config_read_reg(&sel, nvl, PCIR_SUBDEV_0, 2,
+	subdevice = pci_config_read_reg(selp, nvl, PCIR_SUBDEV_0, 2,
 	    LPC_SUBDEV_0);
 
 	/* initialize config space */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304110641.33B6fqVg055003>