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
F102406253: D45339.diff
Mon, Nov 11, 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
Unknown Object (File)
Oct 3 2024, 12:31 PM
Unknown Object (File)
Oct 3 2024, 3:53 AM
Unknown Object (File)
Sep 24 2024, 9:03 AM
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 57895
Build 54783: 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.