Page MenuHomeFreeBSD

bhyve: Treat the COMMAND register for PCI passthru devices as emulated
ClosedPublic

Authored by jhb on Jul 29 2024, 8:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 4, 9:47 PM
Unknown Object (File)
Mon, Sep 30, 10:40 AM
Unknown Object (File)
Mon, Sep 23, 7:40 PM
Unknown Object (File)
Mon, Sep 23, 7:13 AM
Unknown Object (File)
Sat, Sep 21, 6:55 PM
Unknown Object (File)
Thu, Sep 19, 5:37 PM
Unknown Object (File)
Wed, Sep 18, 1:00 PM
Unknown Object (File)
Mon, Sep 16, 11:47 AM

Details

Summary

Don't pass through writes of the command register through to the
physical device. These registers do not need to be in sync, and in
some cases (e.g. when the guest is sizing the BAR and temporarily
disables decoding), the states need to diverge.

PR: 205549
Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jul 29 2024, 8:44 PM

Shouldn't we set the command register to a known good value or do we expect that the host always sets a good value? If the host disables mem/io decoding for some reason, we're unable to read any values from the BARs MMIO space.

Shouldn't we set the command register to a known good value or do we expect that the host always sets a good value? If the host disables mem/io decoding for some reason, we're unable to read any values from the BARs MMIO space.

No, this is the responsibility of the host kernel and in particular the ppt(4) driver. For example, when the ppt(4) driver maps the physical BARs via bus_alloc_resource() with RF_ACTIVE, that enables the relevant decoding bits in the command register. Similarly, the host kernel takes clear of setting/clearing INTxDIS as needed when enabling/disabling MSI interrupts. I hadn't really realized this until yesterday, but ppt(4)'s actions as a device driver is what determines the correct values of the physical command register. For example, during guest boot while the guest is messing with the guest BARs to size the BAR, etc. the physical BAR remains unchanged and should remain enabled the entire time.

This revision is now accepted and ready to land.Jul 31 2024, 6:15 AM