Skip to content

Commit b1d434d

Browse files
ozbenhstewartsmith
authored andcommitted
xive: Fix mangling of interrupt server# in opal_get/set_xive()
The OPAL API uses mangled server numbers with the link in the bottom 2 bits like a real XICS does, we need to account for it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent faaf3f8 commit b1d434d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

hw/xive.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ static int64_t xive_source_get_xive(struct irq_source *is __unused,
14771477
uint32_t target_id;
14781478

14791479
if (xive_get_eq_info(isn, &target_id, prio)) {
1480-
*server = target_id;
1480+
*server = target_id << 2;
14811481
return OPAL_SUCCESS;
14821482
} else
14831483
return OPAL_PARAMETER;
@@ -1490,6 +1490,9 @@ static int64_t xive_source_set_xive(struct irq_source *is, uint32_t isn,
14901490
uint32_t idx = isn - s->esb_base;
14911491
void *mmio_base;
14921492

1493+
/* Unmangle server */
1494+
server >>= 2;
1495+
14931496
/* Let XIVE configure the EQ */
14941497
if (!xive_set_eq_info(isn, server, prio))
14951498
return OPAL_PARAMETER;
@@ -1704,15 +1707,10 @@ struct xive_cpu_state {
17041707
static void xive_ipi_init(struct xive *x, struct cpu_thread *cpu)
17051708
{
17061709
struct xive_cpu_state *xs = cpu->xstate;
1707-
uint32_t idx = GIRQ_TO_IDX(xs->ipi_irq);
1708-
uint8_t *mm = x->esb_mmio + idx * 0x20000;
17091710

17101711
assert(xs);
17111712

1712-
xive_source_set_xive(&x->ipis.is, xs->ipi_irq, cpu->pir, 0x7);
1713-
1714-
/* Clear P and Q */
1715-
in_8(mm + 0x10c00);
1713+
xive_source_set_xive(&x->ipis.is, xs->ipi_irq, cpu->pir << 2, 0x7);
17161714
}
17171715

17181716
static void xive_ipi_eoi(struct xive *x, uint32_t idx)

0 commit comments

Comments
 (0)