]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Don't simulate PBA access if the PBA is in a separate BAR.
authorjhb <jhb@FreeBSD.org>
Wed, 5 Jun 2019 19:29:02 +0000 (19:29 +0000)
committerjhb <jhb@FreeBSD.org>
Wed, 5 Jun 2019 19:29:02 +0000 (19:29 +0000)
commit004c60515d837fda91de91a81284d42fb2561cc3
treed2581a6b6778130d6834f237031165c0e4b9b908
parent5bb1647d5bab68261ce33027e24fe81c6ec6e297
Don't simulate PBA access if the PBA is in a separate BAR.

bhyve has to virtualize the MSI-X table to trap reads and writes to
that table and map those to virtual interrupts that it maps real host
interrupts on to.  For the pending-bit-array (PBA), bhyve passes
accesses from the guest directly to the hardware.

bhyve's virtualization of the MSI-X table is done by intercepting all
reads and writes to the BAR holding the MSI-X table.  However, if the
PBA is stored in the same BAR as the MSI-X table, accesses to the PBA
portion of this BAR have to be forwarded to the real BAR.

However, in the case that the PBA was stored in a separate BAR and
it's offset in that separate BAR overlapped with the portion of the
MSI-X table BAR that the table used, the handlers for the table BAR
would incorrectly think that some accesses were PBA reads and writes.
This caused a crash in bhyve when it indirected a NULL pointer.  Fix
this case by never trying to handle PBA access if the PBA lives in a
separate BAR.

Reported by: gallatin
Tested by: gallatin
Reviewed by: markj, Patrick Mooney
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20523
usr.sbin/bhyve/pci_passthru.c