Skip to content

Commit e9e1691

Browse files
legoatermpe
authored andcommitted
powerpc/xive: Use the "ibm, chip-id" property only under PowerNV
The 'chip_id' field of the XIVE CPU structure is used to choose a target for a source located on the same chip. For that, the XIVE driver queries the chip identifier from the "ibm,chip-id" property and compares it to a 'src_chip' field identifying the chip of a source. This information is only available on the PowerNV platform, 'src_chip' being assigned to XIVE_INVALID_CHIP_ID under pSeries. The "ibm,chip-id" property is also not available on all platforms. It was first introduced on PowerNV and later, under QEMU for pSeries/KVM. However, the property is not part of PAPR and does not exist under pSeries/PowerVM. Assign 'chip_id' to XIVE_INVALID_CHIP_ID by default and let the PowerNV platform override the value with the "ibm,chip-id" property. Signed-off-by: Cédric Le Goater <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 38d0b1c commit e9e1691

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

arch/powerpc/sysdev/xive/common.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,17 +1413,14 @@ static int xive_prepare_cpu(unsigned int cpu)
14131413

14141414
xc = per_cpu(xive_cpu, cpu);
14151415
if (!xc) {
1416-
struct device_node *np;
1417-
14181416
xc = kzalloc_node(sizeof(struct xive_cpu),
14191417
GFP_KERNEL, cpu_to_node(cpu));
14201418
if (!xc)
14211419
return -ENOMEM;
1422-
np = of_get_cpu_node(cpu, NULL);
1423-
if (np)
1424-
xc->chip_id = of_get_ibm_chip_id(np);
1425-
of_node_put(np);
14261420
xc->hw_ipi = XIVE_BAD_IRQ;
1421+
xc->chip_id = XIVE_INVALID_CHIP_ID;
1422+
if (xive_ops->prepare_cpu)
1423+
xive_ops->prepare_cpu(cpu, xc);
14271424

14281425
per_cpu(xive_cpu, cpu) = xc;
14291426
}

arch/powerpc/sysdev/xive/native.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,11 @@ static void xive_native_update_pending(struct xive_cpu *xc)
380380
}
381381
}
382382

383+
static void xive_native_prepare_cpu(unsigned int cpu, struct xive_cpu *xc)
384+
{
385+
xc->chip_id = cpu_to_chip_id(cpu);
386+
}
387+
383388
static void xive_native_setup_cpu(unsigned int cpu, struct xive_cpu *xc)
384389
{
385390
s64 rc;
@@ -462,6 +467,7 @@ static const struct xive_ops xive_native_ops = {
462467
.match = xive_native_match,
463468
.shutdown = xive_native_shutdown,
464469
.update_pending = xive_native_update_pending,
470+
.prepare_cpu = xive_native_prepare_cpu,
465471
.setup_cpu = xive_native_setup_cpu,
466472
.teardown_cpu = xive_native_teardown_cpu,
467473
.sync_source = xive_native_sync_source,

arch/powerpc/sysdev/xive/xive-internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct xive_ops {
4444
u32 *sw_irq);
4545
int (*setup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio);
4646
void (*cleanup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio);
47+
void (*prepare_cpu)(unsigned int cpu, struct xive_cpu *xc);
4748
void (*setup_cpu)(unsigned int cpu, struct xive_cpu *xc);
4849
void (*teardown_cpu)(unsigned int cpu, struct xive_cpu *xc);
4950
bool (*match)(struct device_node *np);

0 commit comments

Comments
 (0)