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)
Sun, Apr 27, 8:26 AM
Unknown Object (File)
Wed, Apr 23, 5:39 PM
Unknown Object (File)
Wed, Apr 23, 8:56 AM
Unknown Object (File)
Sun, Apr 20, 2:36 AM
Unknown Object (File)
Sat, Apr 12, 1:24 AM
Unknown Object (File)
Mar 16 2025, 3:46 PM
Unknown Object (File)
Mar 11 2025, 7:44 PM
Unknown Object (File)
Mar 8 2025, 1:09 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 50641
Build 47532: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/pci_lpc.c
456
457

Or else this shouldn't compile...?

487

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

532

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

usr.sbin/bhyve/pci_lpc.c
532

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
532

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