HomeFreeBSD

bhyve: Use PCIOCGETCONF to find the host LPC bridge

Description

bhyve: Use PCIOCGETCONF to find the host LPC bridge

pci_host_read_config() requires write access to /dev/pci so cannot be
used with unprivileged bhyve. The lpc init code uses it to find the
host system's LPC bridge device and so was generating warnings with
bhyve running as a non-root user.

Refactor the implementation to use PCIOCGETCONF instead, which doesn't
require any special privileges. This isn't formally necessary, as we
only care about copying the host system's identifiers in order to
support Intel GPU passthrough (see commit f4ceaff56ddaa), but it's
straightforward and lets an unprivileged user run bhyve without seeing
warnings about failing to open /dev/pci with write permissions.

Reviewed by: corvink, rew
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D54851

(cherry picked from commit 1db1e4bdc64f29661592a47f2feb690d7cf37957)

Details

Provenance
markjAuthored on Jan 26 2026, 9:05 PM
Reviewer
corvink
Differential Revision
D54851: bhyve: Use PCIOCGETCONF to find the host LPC bridge
Parents
rGcf39d5888f41: vmrun.sh: add option for sharing directory via p9fs to bhyve
Branches
Unknown
Tags
Unknown