Page MenuHomeFreeBSD

bhyve: Treat BAR registration failures as non-fatal
Needs ReviewPublic

Authored by markj on Thu, Oct 15, 5:03 PM.
Tags
None
Referenced Files
F176095241: D60748.id.diff
Fri, Oct 16, 1:50 AM
F176093730: D60748.diff
Fri, Oct 16, 1:31 AM
F176093571: D60748.diff
Fri, Oct 16, 1:29 AM
F176086441: D60748.diff
Thu, Oct 15, 11:57 PM
F176086425: D60748.id.diff
Thu, Oct 15, 11:57 PM
F176074244: D60748.id189978.diff
Thu, Oct 15, 9:12 PM
F176069524: D60748.diff
Thu, Oct 15, 8:09 PM
F176068244: D60748.id189978.diff
Thu, Oct 15, 7:54 PM

Details

Reviewers
jhb
bnovkov
Group Reviewers
bhyve
Summary

Some guest operating systems (at least 9front) will leave device I/O
space decoding enabled while probing BAR sizes. In this case, a
sufficiently large 32-bit BAR can overlap with the HPET MMIO region
fixed at 0xfed00000. This results in an assertion failure in
modify_bar_registration(), even though the collision is transient, i.e.,
the guest will promptly map the BAR elsewhere.

Tolerate such overlaps. Keep track of a BAR's registration state and
make sure that modify_bar_registration() doesn't try to unregister an
I/O space if registration failed.

This fixes a problem where a 32MB framebuffer ends up overlapping with
the HPET MMIO region, causing 9front guests to crash.

PR: 290098

Diff Detail

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

Event Timeline

markj requested review of this revision.Thu, Oct 15, 5:03 PM

We hit the same assertion in a similar scenario: SeaBIOS sizing the 256 MB BAR of a passed-through GPU with memory decoding left on. The BAR landed at 0xf0000000, over the LAPIC/IOAPIC/HPET, and register_mem() failed.

We handled it the same way in our tree: remember that the registration failed, skip the unregistration later and do not call pe_baraddr for that BAR, plus a log line so that it shows up in the log. It has been fine since.

Your approach looks right to us; the per-BAR flag is cleaner than our side table.