Page MenuHomeFreeBSD

bhyve: add BAR handler list for passthru devices
Needs ReviewPublic

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

Details

Reviewers
jhb
markj
Group Reviewers
bhyve
Summary

We have to emulate some specific register of a BAR for passthru devices. Our
current use case are Intels integrated graphic devices. They mirror some of
their PCI config space into the MMIO space. Unfortunately, the Windows driver
reads from MMIO instead of PCI config space. For that reason, we have to trap
and emulate those register. Instead of implementing a quirk for this special
device, we're implementing a generic approach by using a list of trapped
register. That's much cleaner and can be reused. E.g. Nvidia GPUs mirror their
PCI config space in MMIO too and we can reuse it to trap the MSI-X table in the
future.

Note that the handling of this new list requires a larger patch. For that
reason, we split it into multiple commits. This means that the list isn't used
yet. This commit adds the callback on BAR reads and writes. Some subsequent
commit will add the trap for BAR regions and an interface to easily add
protected regions.

Diff Detail

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

Event Timeline

usr.sbin/bhyve/pci_passthru.c
1151
1154

Do you need to check the return value?

1187
1190

Do you need to check the return value?

corvink added inline comments.
usr.sbin/bhyve/pci_passthru.c
1154

What should we do on error return? passthru_write is a void function.

1190

What should we do on error return? passthru_read returns the read value.