Skip to contentSkip to conversation

powerpc/eeh: Fix missing PE bridge reconfiguration during VFIO EEH recovery

PATCH Applied Narayana Murty N 3 participants 3 messages May 8, 2025 – Jun 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/eeh: Fix missing PE bridge reconfiguration during VFIO EEH recovery

VFIO EEH recovery for PCI passthrough devices fails on PowerNV and pseries platforms due to missing host-side PE bridge reconfiguration. In the current implementation, eeh_pe_configure() only performs RTAS or OPAL-based bridge reconfiguration for native host devices, but skips it entirely for PEs managed through VFIO in guest passthrough scenarios.

This leads to incomplete EEH recovery when a PCI error affects a passthrough device assigned to a QEMU/KVM guest. Although VFIO triggers the EEH recovery flow through VFIO_EEH_PE_ENABLE ioctl, the platform-specific bridge reconfiguration step is silently bypassed. As a result, the PE's config space is not fully restored, causing subsequent config space access failures or EEH freeze-on-access errors inside the guest.

This patch fixes the issue by ensuring that eeh_pe_configure() always invokes the platform's configure_bridge() callback (e.g., pseries_eeh_phb_configure_bridge) even for VFIO-managed PEs. This ensures that RTAS or OPAL calls to reconfigure the PE bridge are correctly issued on the host side, restoring the PE's configuration space after an EEH event.

This fix is essential for reliable EEH recovery in QEMU/KVM guests using VFIO PCI passthrough on PowerNV and pseries systems.

Tested with:
- QEMU/KVM guest using VFIO passthrough (IBM Power9,(lpar)Power11 host)
- Injected EEH errors with pseries EEH errinjct tool on host, recovery verified on qemu guest.
- Verified successful config space access and CAP_EXP DevCtl restoration after recovery

Fixes 212d16cdca2d ("powerpc/eeh: EEH support for VFIO PCI device")
---
 arch/powerpc/kernel/eeh.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/eeh.c +2 -0
index 83fe99861eb1..ca7f7bb2b478 100644
@@ -1509,6 +1509,8 @@ int eeh_pe_configure(struct eeh_pe *pe)
 	/* Invalid PE ? */
 	if (!pe)
 		return -ENODEV;
+	else
+		ret = eeh_ops->configure_bridge(pe);
 
 	return ret;
 }

--
2.48.1

Reviewed-by on v1 1/1
#1 lore raw
Quoted 51 lines · Narayana Murty N

VFIO EEH recovery for PCI passthrough devices fails on PowerNV and pseries platforms due to missing host-side PE bridge reconfiguration. In the current implementation, eeh_pe_configure() only performs RTAS or OPAL-based bridge reconfiguration for native host devices, but skips it entirely for PEs managed through VFIO in guest passthrough scenarios.

This leads to incomplete EEH recovery when a PCI error affects a passthrough device assigned to a QEMU/KVM guest. Although VFIO triggers the EEH recovery flow through VFIO_EEH_PE_ENABLE ioctl, the platform-specific bridge reconfiguration step is silently bypassed. As a result, the PE's config space is not fully restored, causing subsequent config space access failures or EEH freeze-on-access errors inside the guest.

This patch fixes the issue by ensuring that eeh_pe_configure() always invokes the platform's configure_bridge() callback (e.g., pseries_eeh_phb_configure_bridge) even for VFIO-managed PEs. This ensures that RTAS or OPAL calls to reconfigure the PE bridge are correctly issued on the host side, restoring the PE's configuration space after an EEH event.

This fix is essential for reliable EEH recovery in QEMU/KVM guests using VFIO PCI passthrough on PowerNV and pseries systems.

Tested with:
- QEMU/KVM guest using VFIO passthrough (IBM Power9,(lpar)Power11 host)
- Injected EEH errors with pseries EEH errinjct tool on host, recovery verified on qemu guest.
- Verified successful config space access and CAP_EXP DevCtl restoration after recovery

Fixes 212d16cdca2d ("powerpc/eeh: EEH support for VFIO PCI device")
---
  arch/powerpc/kernel/eeh.c | 2 ++
  1 file changed, 2 insertions(+)
arch/powerpc/kernel/eeh.c +2 -1
index 83fe99861eb1..ca7f7bb2b478 100644
@@ -1509,6 +1509,8 @@ int eeh_pe_configure(struct eeh_pe *pe)
  	/* Invalid PE ? */
  	if (!pe)
  		return -ENODEV;
+	else
+		ret = eeh_ops->configure_bridge(pe);
 
  	return ret;
  }
--
Quoted 2 lines

2.48.1

Looks good to me.

maintainer Applied
#2 lore raw
In reply to Narayana Murty N
Quoted 6 lines · Narayana Murty N

VFIO EEH recovery for PCI passthrough devices fails on PowerNV and pseries platforms due to missing host-side PE bridge reconfiguration. In the current implementation, eeh_pe_configure() only performs RTAS or OPAL-based bridge reconfiguration for native host devices, but skips it entirely for PEs managed through VFIO in guest passthrough scenarios.

Quoted 8 lines

This leads to incomplete EEH recovery when a PCI error affects a passthrough device assigned to a QEMU/KVM guest. Although VFIO triggers the EEH recovery flow through VFIO_EEH_PE_ENABLE ioctl, the platform-specific bridge reconfiguration step is silently bypassed. As a result, the PE's config space is not fully restored, causing subsequent config space access failures or EEH freeze-on-access errors inside the guest.

[...]

Applied to powerpc/fixes.

[1/1] powerpc/eeh: Fix missing PE bridge reconfiguration during VFIO EEH recovery

      https://git.kernel.org/powerpc/c/33bc69cf6655cf60829a803a45275f11a74899e5

Thanks