powerpc/xive: Fix bogus error code returned by OPAL
There's a bug in skiboot that causes the OPAL_XIVE_ALLOCATE_IRQ call to return the 32-bit value 0xffffffff when OPAL has run out of IRQs. Unfortunatelty, OPAL return values are signed 64-bit entities and errors are supposed to be negative. If that happens, the linux code confusingly treats 0xffffffff as a valid IRQ number and panics at some point. A fix was recently merged in skiboot: e97391ae2bb5 ("xive: fix return value of opal_xive_allocate_irq()") but we need a workaround anyway to support older skiboots already in the field. Internally convert 0xffffffff to OPAL_RESOURCE which is the usual error returned upon resource exhaustion. Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/156821713818.1985334.14123187368108582810.stgit@bahia.lan
This commit is contained in:

committed by
Michael Ellerman

parent
92c94dfb69
commit
6ccb4ac2bf
@@ -245,6 +245,17 @@ static bool xive_native_match(struct device_node *node)
|
||||
return of_device_is_compatible(node, "ibm,opal-xive-vc");
|
||||
}
|
||||
|
||||
static s64 opal_xive_allocate_irq(u32 chip_id)
|
||||
{
|
||||
s64 irq = opal_xive_allocate_irq_raw(chip_id);
|
||||
|
||||
/*
|
||||
* Old versions of skiboot can incorrectly return 0xffffffff to
|
||||
* indicate no space, fix it up here.
|
||||
*/
|
||||
return irq == 0xffffffff ? OPAL_RESOURCE : irq;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc)
|
||||
{
|
||||
|
Reference in New Issue
Block a user