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)
Wed, Nov 27, 11:41 PM
Unknown Object (File)
Tue, Nov 19, 2:13 AM
Unknown Object (File)
Thu, Nov 14, 1:16 PM
Unknown Object (File)
Oct 16 2024, 12:59 PM
Unknown Object (File)
Oct 16 2024, 11:57 AM
Unknown Object (File)
Oct 16 2024, 11:56 AM
Unknown Object (File)
Oct 16 2024, 11:56 AM
Unknown Object (File)
Oct 2 2024, 6:38 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