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
F93237794: D39311.diff
Sun, Sep 8, 9:10 AM
Unknown Object (File)
Wed, Sep 4, 6:43 PM
Unknown Object (File)
Sat, Aug 31, 1:15 PM
Unknown Object (File)
Sat, Aug 17, 6:58 PM
Unknown Object (File)
Aug 9 2024, 8:18 AM
Unknown Object (File)
Aug 4 2024, 12:13 PM
Unknown Object (File)
Jul 11 2024, 6:20 PM
Unknown Object (File)
Jun 28 2024, 7:30 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 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