phb3: Continue CAPP setup even if PHB is already in CAPP mode
phb3: Continue CAPP setup even if PHB is already in CAPP mode

This fixes a critical bug in CAPI support.

CAPI requires that all faults are escalated into a fence, not a
freeze. This is done by setting bits in a number of MMIO
registers. phb3_set_capi_mode() calls phb3_init_capp_errors() to do
this. However, if the PHB is already in CAPP mode - for example in the
recovery case - phb3_set_capi_mode() will bail out early, and those
registers will not be set.

This is quite easy to verify. PCI config space access errors, for
example, normally cause a freeze. On a CAPI-mode PHB, they should
cause a fence. Say we have a CAPI card on PHB 0, and we inject a
PCI config space error:

echo 0x8000000000000000 > /sys/kernel/debug/powerpc/PCI0000/err_injct_inboundA;
lspci;

The first time we inject this, the PHB will fence and recover, but
won't reset the registers. Therefore, the second time we inject it,
we will incorrectly freeze, not fence.

Worse, the recovery for the resultant EEH freeze event interacts
poorly with the CAPP, triggering an EEH recovery of the PHB. The
combination of the two attempted recoveries will get the PHB into
an inoperable state.

It's quite likely that there other side effects of bailing out
early. For example, the timebase sync probably fails to recover.
Rather than auditing all the possibilities, I verified that
repeating the entire setup procedure still works when the PHB is
already in CAPP mode. It does work, so just do the entire setup
every time instead of bailing out early.

Signed-off-by: Daniel Axtens <cf1af486034ab0119a20f38a060e40da25f4cea3@axtens.net>
Acked-By: Michael Neuling <7b0ab45a730e48a69239010b5b8fe5fa4e8eaac6@neuling.org>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com>

apopple/skiboot,apopple/skiboot,legoater/skiboot,mikey/skiboot,legoater/skiboot,open-power/skiboot,stewart-ibm/skiboot,stewart-ibm/skiboot,stewart-ibm/skiboot,open-power/skiboot,open-power/skiboot,open-power/skiboot,shenki/skiboot,shenki/skiboot,shenki/skiboot,mikey/skiboot,qemu/skiboot,csmart/skiboot,mikey/skiboot,qemu/skiboot,qemu/skiboot,legoater/skiboot,legoater/skiboot,csmart/skiboot,shenki/skiboot,legoater/skiboot,csmart/skiboot,open-power/skiboot,qemu/skiboot,apopple/skiboot,qemu/skiboot,shenki/skiboot