Page MenuHomeFreeBSD

bhyve: support VBTs which lay outside of the OpRegion
Needs ReviewPublic

Authored by corvink on Fri, May 24, 11:34 AM.

Details

Reviewers
jhb
markj
Group Reviewers
bhyve
Summary

Previously, all of our devices had an OpRegion with a VBT which lays inside the
OpRegion. Unfortunately, the OpRegion has a fixed size and VBTs get more and
more features/settings. A VBT can be larger than the allocated space of 6 KB
inside the OpRegion. For larger VBTs, Intel added two field to the OpRegion to
report the VBT address and the VBT size. Make bhyve aware of those fields and
put the VBT into the guest memory too.

Unfortunately, Intel forgot to consider virtualization when defining OpRegion
v2.0. OpRegion v2.0 uses an absolute address for pointing to the VBT. This
address is useless in a guest environment. It's possible to patch that.
However, it requires some more work and we can't test it because we have no
test device with this combination. Therefore, we don't want to do that yet
until we have a use case. Fortunately, Intel noticed the issue and from v2.1
onwards, the VBT address is a relative address.

Diff Detail

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

Event Timeline

usr.sbin/bhyve/amd64/pci_gvt-d.c
199

This mapping doesn't get removed in error paths. Is that intentional?

312
316
331
  • fix style issues
  • unmap vbt->hva in error path
corvink added inline comments.
usr.sbin/bhyve/amd64/pci_gvt-d.c
199

Forgot it. Thanks!