The 'chip_id' field of the XIVE CPU structure is used to choose a target for a source located on the same chip when possible. The XIVE driver queries the chip id value from the "ibm,chip-id" DT property but this property is not available on all platforms. It was first introduced on the PowerNV platform and later, under QEMU for pseries. However, the property does not exist under PowerVM since it is not specified in PAPR.
cpu_to_node() is a better alternative. On the PowerNV platform, the node id is computed from the "ibm,associativity" property of the CPU. Its value is built in the OPAL firmware from the physical chip id and is equivalent to "ibm,chip-id". On pSeries, the hcall H_HOME_NODE_ASSOCIATIVITY returns the node id. Also to be noted that under QEMU/KVM "ibm,chip-id" is badly calculated with unusual SMT configuration. This leads to a bogus chip id value being returned by of_get_ibm_chip_id(). Cc: David Gibson <da...@gibson.dropbear.id.au> Signed-off-by: Cédric Le Goater <c...@kaod.org> --- Changes in v3: - improved commit log for the misuse of "ibm,chip-id" arch/powerpc/sysdev/xive/common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c index 7e08be5e5e4a..776871274b69 100644 --- a/arch/powerpc/sysdev/xive/common.c +++ b/arch/powerpc/sysdev/xive/common.c @@ -1336,16 +1336,11 @@ static int xive_prepare_cpu(unsigned int cpu) xc = per_cpu(xive_cpu, cpu); if (!xc) { - struct device_node *np; - xc = kzalloc_node(sizeof(struct xive_cpu), GFP_KERNEL, cpu_to_node(cpu)); if (!xc) return -ENOMEM; - np = of_get_cpu_node(cpu, NULL); - if (np) - xc->chip_id = of_get_ibm_chip_id(np); - of_node_put(np); + xc->chip_id = cpu_to_node(cpu); xc->hw_ipi = XIVE_BAD_IRQ; per_cpu(xive_cpu, cpu) = xc; -- 2.26.3