Page MenuHomeFreeBSD

bhyve: add BAR handler list for passthru devices
Needs ReviewPublic

Authored by corvink on May 24 2024, 11:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 3, 9:00 AM
Unknown Object (File)
Wed, Nov 13, 6:19 PM
Unknown Object (File)
Wed, Nov 13, 6:15 PM
Unknown Object (File)
Nov 11 2024, 8:25 PM
Unknown Object (File)
Oct 6 2024, 4:39 PM
Unknown Object (File)
Oct 5 2024, 12:28 AM
Unknown Object (File)
Oct 3 2024, 10:13 PM
Unknown Object (File)
Oct 3 2024, 2:55 PM
Subscribers

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.