hw/phb3: Fix potential race in EOI
hw/phb3: Fix potential race in EOI

When we EOI we need to clear the present (P) bit in the Interrupt
Vector Cache (IVC).  We must clear P ensuring that any additional
interrupts that come in aren't lost while also maintaining coherency
with the Interrupt Vector Table (IVT).

To do this, the hardware provides a conditional update bit in the
IVC. This bit ensures that generation counts between the IVT and the
IVC updates are synchronised.

Unfortunately we never set this the bit to conditionally update the P
bit in the IVC based on the generation count.  Also, we didn't set
what we wanted the new generation count to be if the update was
successful.

This patch fixes sets both of these.  It also reworks and documents
the code so that mortals may eventually be able to understand this
process.

Signed-off-by: Michael Neuling <7b0ab45a730e48a69239010b5b8fe5fa4e8eaac6@neuling.org>
Tested-by: Vaibhav Jain <e78384dfaa97bf0f3945c4da4075af8ac33ade0a@linux.vnet.ibm.com>
Tested-by: Andrew Donnellan <efc2d7c347a094a6ec1d918179e819039044c564@au1.ibm.com>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com>

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