Page MenuHomeFreeBSD

bhyve: do not exit if LPC finds no host selector
ClosedPublic

Authored by corvink on Mar 29 2023, 9:32 AM.
Tags
None
Referenced Files
F109421907: D39311.diff
Tue, Feb 4, 8:49 PM
Unknown Object (File)
Tue, Jan 28, 2:50 PM
Unknown Object (File)
Mon, Jan 27, 5:07 PM
Unknown Object (File)
Sun, Jan 26, 6:04 PM
Unknown Object (File)
Fri, Jan 24, 7:49 PM
Unknown Object (File)
Mon, Jan 20, 2:48 AM
Unknown Object (File)
Wed, Jan 15, 7:33 PM
Unknown Object (File)
Dec 20 2024, 12:37 PM

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

usr.sbin/bhyve/pci_lpc.c
457
458

Or else this shouldn't compile...?

485

The caller also emits a warning message in this case. It'd be better to have a single warning.

525

Isn't sel leaked now? What's the purpose of dynamically allocating the selector in the first place?

usr.sbin/bhyve/pci_lpc.c
525

That's true. Thanks.

I need an invalid sel value. sel is only required if the user specifies host as LPC ID. So, if no LPC is found, it's not an error but sel should be set to an invalid value. If you have a better solution, feel free to post it.

usr.sbin/bhyve/pci_lpc.c
525

Can't you just pass NULL instead of &sel if we fail to find a matching LPC? That is:

selp = &sel;
if (pci_lpc_get_sel(selp) != 0)
    selp = NULL;
vendor = pci_config_read_reg(selp, ...);
...
  • don't allocate LPC host selector dynamically
This revision is now accepted and ready to land.Apr 10 2023, 2:33 PM