From: Narayana Murty N <nnmlinux@linux.ibm.com>
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, sbhat@linux.ibm.com,
mahesh@linux.ibm.com, sourabhjain@linux.ibm.com,
adityag@linux.ibm.com, npiggin@gmail.com, harshpb@linux.ibm.com,
alex@shazbot.org, clg@redhat.com
Cc: amachhiw@linux.ibm.com, hbathini@linux.ibm.com,
shivangu@linux.ibm.com, anushree.mathur@linux.ibm.com
Subject: [PATCH v3 0/2] ppc/spapr: Fix MSI-X shadow and BAR mmap handling during EEH PE reset
Date: Mon, 23 Nov 2026 13:45:47 +0530 [thread overview]
Message-ID: <20261123081546.49210-4-nnmlinux@linux.ibm.com> (raw)
This series fixes two independent but related problems in the sPAPR EEH
PE reset path for VFIO pass-through devices.
Patch 1 fixes MSI-X interrupt delivery after EEH recovery. The existing
pre-reset path calls msix_reset(), which clears QEMU's MSI-X table shadow.
On pSeries, this shadow is populated through:
ibm,change-msi
-> spapr_msi_setmsg()
-> msix_set_message()
and is not necessarily rebuilt before the guest restores MSI-X after an
EEH reset.
Instead of resetting the MSI-X state, disable MSI-X by clearing only the
Enable bit using QEMU's cached PCI configuration value and dispatch the
write through pci_host_config_write_common(). This lets VFIO tear down
the active vectors and KVM irqfd routes through vfio_msix_disable() while
preserving the MSI-X shadow needed when the guest later re-enables MSI-X.
Patch 2 handles BAR mmap access while the PE is undergoing an EEH reset.
BAR mmap access is disabled before issuing the hot or fundamental PE
reset and restored only after VFIO_EEH_PE_CONFIGURE completes
successfully. During this interval BAR accesses fall back to the VFIO
region read/write path.
Following review feedback, the BAR mmap and INTx mmap timer handling are
now encapsulated in VFIO PCI helpers instead of accessing
VFIOPCIDevice internals directly from the pSeries code. The pre-reset
helper cancels a pending INTx mmap re-enable timer and disables the BAR
mmap path after interrupt teardown. The post-configure helper restores
the normal mmap/INTx timer policy after successful PE configuration.
Without the fixes, EEH recovery itself reports success for the
passed-through BCM5719/tg3 device, but the interface does not recover its
link:
<snip>
EEH: Beginning: 'resume'
PCI 0001:00:01.0#0001: EEH: Invoking tg3->resume()
PCI 0001:00:01.0#0001: EEH: tg3 driver reports: 'none'
EEH: Finished:'resume'
EEH: Recovery successful.
</snip>
<snip>
# ethtool enP1p0s1 | grep Link
Link detected: no
</snip>
With the series applied, EEH recovery completes and the link subsequently
comes back:
<snip>
EEH: Beginning: 'resume'
PCI 0001:00:01.0#0001: EEH: Invoking tg3->resume()
PCI 0001:00:01.0#0001: EEH: tg3 driver reports: 'none'
EEH: Finished:'resume'
EEH: Recovery successful.
tg3 0001:00:01.0 enP1p0s1: Link is up at 1000 Mbps, full duplex
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>
Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
---
Change log:
v2:
- Reworked the BAR mmap handling based on review feedback so that generic
VFIO provides only the mmap mechanism and the pSeries code retains the
EEH policy.
- Replaced the EEH-specific generic VFIO helpers
`vfio_pci_eeh_pre_reset()` and `vfio_pci_eeh_post_configure()` with a
neutral `vfio_pci_mmap_block()` helper.
- Added per-device `mmap_blocked` state in vfio-pci. Once BAR mmap is
blocked, later attempts to re-enable the mmap subregions, including
those from INTx timer or interrupt-mode transitions, are ignored.
- Changed the BAR mmap handling from temporary disable/restore to a
persistent block after an EEH PE reset. In particular, BAR mmap is no
longer restored after `VFIO_EEH_PE_CONFIGURE`.
- Removed the pSeries post-configure device/bus walkers that were added
in v2 solely to restore BAR mmap.
- Moved the generic mmap-block implementation into patch 1/2 and kept
the pSeries EEH use of that mechanism in patch 2/2.
- Block BAR mmap before changing MSI-X state during EEH reset
preparation, so subsequent VFIO interrupt-mode activity cannot restore
the direct mmap path.
- Retained the v2 MSI-X shadow preservation behavior: clear only
`PCI_MSIX_FLAGS_ENABLE` through the normal PCI config-write path and
do not call `msix_reset()`.
- Updated the BAR mmap recovery policy based on BCM5719 passthrough
testing: restoring direct BAR mmap after PE configure could result in
the device becoming inaccessible again during guest resume, while
keeping BAR accesses on the VFIO region read/write path allowed the
Guest-2 EEH recovery to complete and the device to remain functional.
v1:
- Move BAR mmap and INTx mmap timer handling into VFIO PCI helpers,
as suggested by Mahesh.
- Avoid direct access to VFIOPCIDevice BAR and INTx internals from
spapr_pci_vfio.c.
- Restore normal INTx mmap handling after successful PE configuration.
- Keep BAR mmap disabled when VFIO_EEH_PE_CONFIGURE fails.
- Keep the MSI-X shadow preservation behavior from patch 1 unchanged.
v1: https://lore.kernel.org/qemu-devel/20260902114758.85160-1-nnmlinux@linux.ibm.com
Narayana Murty N (2):
vfio/pci: Add persistent BAR mmap blocking helper
ppc/spapr: Preserve VFIO MSI-X shadow and block BAR mmap on EEH reset
hw/ppc/spapr_pci_vfio.c | 75 ++++++++++++++++++++++++++++-------------
hw/vfio/pci.c | 59 ++++++++++++++++++++++++++++++++
hw/vfio/pci.h | 7 ++++
3 files changed, 117 insertions(+), 24 deletions(-)
--
2.54.0
next reply other threads:[~2026-11-23 8:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 8:15 Narayana Murty N [this message]
2026-11-23 8:15 ` [PATCH v3 1/2] vfio/pci: Add persistent BAR mmap blocking helper Narayana Murty N
2026-11-23 8:15 ` [PATCH v3 2/2] ppc/spapr: Preserve VFIO MSI-X shadow and block BAR mmap on EEH reset Narayana Murty N
2026-12-01 17:57 ` [PATCH v3 0/2] ppc/spapr: Fix MSI-X shadow and BAR mmap handling during EEH PE reset Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123081546.49210-4-nnmlinux@linux.ibm.com \
--to=nnmlinux@linux.ibm.com \
--cc=adityag@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=amachhiw@linux.ibm.com \
--cc=anushree.mathur@linux.ibm.com \
--cc=clg@redhat.com \
--cc=harshpb@linux.ibm.com \
--cc=hbathini@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sbhat@linux.ibm.com \
--cc=shivangu@linux.ibm.com \
--cc=sourabhjain@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.