This series fixes two independent but related problems in the sPAPR
EEH PE reset path for VFIO pass-through devices.
Patch 1 fixes a regression in MSI-X interrupt delivery after EEH
recovery. The previous code called msix_reset() during PE pre-reset,
which wiped the MSI-X table shadow. On pSeries the shadow is
populated via ibm,change-msi -> spapr_msi_setmsg() -> msix_set_message()
and is not necessarily rebuilt before the guest re-enables MSI-X.
vfio_msix_enable() -> vfio_msix_vector_do_use() re-arms KVM irqfd
routes from the existing shadow, so wiping it breaks interrupt delivery.
The fix clears only MSI-X Enable using the cached config shadow and
dispatches through pci_host_config_write_common() so that
vfio_msix_disable() tears down vectors cleanly without touching the
shadow table.
Patch 2 closes a race between the synchronous PE reset ioctl and QEMU's
direct-mapped BAR mmap windows. While the hardware is held in PCI reset
the device BARs are inaccessible. Any guest MMIO fault that is serviced
through an active mmap during this window can produce an indeterminate
result. The fix disables all BAR mmaps before issuing the reset ioctl
and re-enables them after VFIO_EEH_PE_CONFIGURE succeeds. Any pending
INTx mmap re-enable timer is also cancelled to prevent the timer from
re-arming the mmap window before configure completes.
without patch:
<snip>
[ 21.549925][ T251] EEH: Beginning: 'resume'
[ 21.550086][ T251] PCI 0001:00:01.0#0001: EEH: Invoking tg3->resume()
[ 21.605321][ T251] PCI 0001:00:01.0#0001: EEH: tg3 driver reports: 'none'
[ 21.605462][ T251] EEH: Finished:'resume'
[ 21.605552][ T251] EEH: Recovery successful.
</snip>
<snip>
# ethtool enP1p0s1 |grep Link
Link detected: no
</snip>
with patch:
<snip>
[ 5696.920423][ T250] EEH: Beginning: 'resume'
[ 5696.920497][ T250] PCI 0001:00:01.0#0001: EEH: Invoking tg3->resume()
[ 5696.975922][ T250] PCI 0001:00:01.0#0001: EEH: tg3 driver reports: 'none'
[ 5696.976165][ T250] EEH: Finished:'resume'
[ 5696.976298][ T250] EEH: Recovery successful.
[ 5700.086095][ C28] tg3 0001:00:01.0 enP1p0s1: Link is up at 1000 Mbps, full duplex
[ 5700.086330][ C28] tg3 0001:00:01.0 enP1p0s1: Flow control is on for TX and on for RX
</snip>
<snip>
# ethtool enP1p0s1 |grep Link
Link detected: yes
</snip>
Narayana Murty N (2):
ppc/spapr: Preserve MSI-X shadow across EEH PE reset
ppc/spapr: Temporarily disable VFIO BAR mmap during EEH PE reset
hw/ppc/spapr_pci_vfio.c | 122 ++++++++++++++++++++++++++++++++--------
1 file changed, 100 insertions(+), 22 deletions(-)
--
2.54.0