Page MenuHomeFreeBSD

bhyve: Don't log a warning when we fail to open /dev/pci
AbandonedPublic

Authored by markj on Jan 16 2026, 4:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 22, 6:51 PM
Unknown Object (File)
Sat, Feb 21, 2:19 PM
Unknown Object (File)
Fri, Feb 20, 2:45 PM
Unknown Object (File)
Fri, Feb 20, 10:22 AM
Unknown Object (File)
Thu, Feb 19, 3:06 PM
Unknown Object (File)
Sun, Feb 8, 2:20 PM
Unknown Object (File)
Fri, Jan 30, 8:10 PM
Unknown Object (File)
Jan 25 2026, 6:19 PM

Details

Reviewers
bnovkov
Group Reviewers
bhyve
Summary

When running as an unprivileged user, we can't open /dev/pci for writing.
This isn't critical for bhyve operation, but there are many places where we
try to open it, so to avoid logging some scary-looking warnings, just silence
it in this case.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69983
Build 66866: arc lint + arc unit

Event Timeline

I did an initial smoke test for this phab stack and it worked for me..got a couple questions though

usr.sbin/bhyve/pci_passthru.c
198–201

hmm..wonder if this will break the gpu passthru bits?

host_read_config() proxies through ioctl(PCIOCREAD)..and PCIOCREAD requires a writable descriptor...

it appears the the existing gpu passthru bits rely on pci_host_read_config()

curious if the gpu bits should leverage passthru_read_config() using the global pcifd descriptor instead?

for what its worth i haven't experimented with gpu passthru yet

usr.sbin/bhyve/pci_passthru.c
198–201

Thanks for testing... you're right, for some reason I had convinced myself that PCIOCREAD was in the list of ioctls that pci_ioctl() explicitly lists as not requiring FWRITE. I'll retest and update the revision.

Always open /dev/pci read-write.

markj retitled this revision from bhyve: Open /dev/pci read-only when possible to bhyve: Don't log a warning when we fail to open /dev/pci.Jan 19 2026, 2:21 PM
markj edited the summary of this revision. (Show Details)
markj marked an inline comment as done.

This isn't needed with D54851.