Skip to content

Commit 8e036c8

Browse files
legoatermpe
authored andcommitted
powerpc/xive: Use hw CPU ids when configuring the CPU queues
The CPU event notification queues on sPAPR should be configured using a hardware CPU identifier. The problem did not show up on the Power Hypervisor because pHyp supports 8 threads per core which keeps CPU number contiguous. This is not the case on all sPAPR virtual machines, some use SMT=1. Also improve error logging by adding the CPU number. Fixes: eac1e73 ("powerpc/xive: guest exploitation of the XIVE interrupt controller") Cc: [email protected] # v4.14+ Signed-off-by: Cédric Le Goater <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent c134f0d commit 8e036c8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

arch/powerpc/sysdev/xive/spapr.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ static int xive_spapr_configure_queue(u32 target, struct xive_q *q, u8 prio,
356356

357357
rc = plpar_int_get_queue_info(0, target, prio, &esn_page, &esn_size);
358358
if (rc) {
359-
pr_err("Error %lld getting queue info prio %d\n", rc, prio);
359+
pr_err("Error %lld getting queue info CPU %d prio %d\n", rc,
360+
target, prio);
360361
rc = -EIO;
361362
goto fail;
362363
}
@@ -370,7 +371,8 @@ static int xive_spapr_configure_queue(u32 target, struct xive_q *q, u8 prio,
370371
/* Configure and enable the queue in HW */
371372
rc = plpar_int_set_queue_config(flags, target, prio, qpage_phys, order);
372373
if (rc) {
373-
pr_err("Error %lld setting queue for prio %d\n", rc, prio);
374+
pr_err("Error %lld setting queue for CPU %d prio %d\n", rc,
375+
target, prio);
374376
rc = -EIO;
375377
} else {
376378
q->qpage = qpage;
@@ -389,8 +391,8 @@ static int xive_spapr_setup_queue(unsigned int cpu, struct xive_cpu *xc,
389391
if (IS_ERR(qpage))
390392
return PTR_ERR(qpage);
391393

392-
return xive_spapr_configure_queue(cpu, q, prio, qpage,
393-
xive_queue_shift);
394+
return xive_spapr_configure_queue(get_hard_smp_processor_id(cpu),
395+
q, prio, qpage, xive_queue_shift);
394396
}
395397

396398
static void xive_spapr_cleanup_queue(unsigned int cpu, struct xive_cpu *xc,
@@ -399,10 +401,12 @@ static void xive_spapr_cleanup_queue(unsigned int cpu, struct xive_cpu *xc,
399401
struct xive_q *q = &xc->queue[prio];
400402
unsigned int alloc_order;
401403
long rc;
404+
int hw_cpu = get_hard_smp_processor_id(cpu);
402405

403-
rc = plpar_int_set_queue_config(0, cpu, prio, 0, 0);
406+
rc = plpar_int_set_queue_config(0, hw_cpu, prio, 0, 0);
404407
if (rc)
405-
pr_err("Error %ld setting queue for prio %d\n", rc, prio);
408+
pr_err("Error %ld setting queue for CPU %d prio %d\n", rc,
409+
hw_cpu, prio);
406410

407411
alloc_order = xive_alloc_order(xive_queue_shift);
408412
free_pages((unsigned long)q->qpage, alloc_order);

0 commit comments

Comments
 (0)