All of lore.kernel.org
 help / color / mirror / Atom feed
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 v2 0/2] ppc/spapr: Fix MSI-X shadow and BAR mmap handling during EEH PE reset
Date: Tue, 27 Oct 2026 21:32:56 +0530	[thread overview]
Message-ID: <20261027160258.48207-1-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:
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):
  ppc/spapr: Preserve VFIO MSI-X shadow across EEH reset
  ppc/spapr: Disable VFIO BAR mmap during EEH PE reset

 hw/ppc/spapr_pci_vfio.c | 102 ++++++++++++++++++++++++++++++++--------
 hw/vfio/pci.c           |  32 +++++++++++++
 hw/vfio/pci.h           |   2 +
 3 files changed, 116 insertions(+), 20 deletions(-)

-- 
2.54.0



             reply	other threads:[~2026-10-27 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 16:02 Narayana Murty N [this message]
2026-10-27 16:02 ` [PATCH v2 1/2] ppc/spapr: Preserve VFIO MSI-X shadow across EEH reset Narayana Murty N
2026-10-27 16:02 ` [PATCH v2 2/2] ppc/spapr: Disable VFIO BAR mmap during EEH PE reset Narayana Murty N
2026-10-27 16:08   ` Cédric Le Goater
2026-10-28  5:17     ` Narayana Murty N

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=20261027160258.48207-1-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.