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
Unknown Object (File)
Thu, Mar 21, 8:16 PM
Unknown Object (File)
Feb 13 2024, 6:21 PM
Unknown Object (File)
Feb 3 2024, 3:30 AM
Unknown Object (File)
Dec 20 2023, 6:12 AM
Unknown Object (File)
Dec 13 2023, 4:50 PM
Unknown Object (File)
Dec 12 2023, 12:44 AM
Unknown Object (File)
Nov 23 2023, 10:46 AM
Unknown Object (File)
Nov 23 2023, 8:58 AM

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