powerpc/eeh: Fix invalid cached PE primary bus
authorGavin Shan <gwshan@linux.vnet.ibm.com>
Fri, 17 Jun 2016 03:05:11 +0000 (13:05 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2016 07:33:18 +0000 (09:33 +0200)
commit77bf04650069868e5ddaf2a0511c232395989191
tree5165fcbcc0daca5c54d74eb2fa3da764a5ba285e
parent1e80f40d42ea6e567346b9ae28d7f07a8b9dee0c
powerpc/eeh: Fix invalid cached PE primary bus

commit a3aa256b7258b3d19f8b44557cc64525a993b941 upstream.

The PE primary bus cannot be got from its child devices when having
full hotplug in error recovery. The PE primary bus is cached, which
is done in commit <05ba75f84864> ("powerpc/eeh: Fix stale cached primary
bus"). In eeh_reset_device(), the flag (EEH_PE_PRI_BUS) is cleared
before the PCI hot remove. eeh_pe_bus_get() then returns NULL as the
PE primary bus in pnv_eeh_reset() and it crashes the kernel eventually.

This fixes the issue by clearing the flag (EEH_PE_PRI_BUS) before the
PCI hot add. With it, the PowerNV EEH reset backend (pnv_eeh_reset())
can get valid PE primary bus through eeh_pe_bus_get().

Fixes: 67086e32b564 ("powerpc/eeh: powerpc/eeh: Support error recovery for VF PE")
Reported-by: Pridhiviraj Paidipeddi <ppaiddipe@in.ibm.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/eeh_driver.c