Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp151650pxj; Mon, 17 May 2021 23:39:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn1tWW6e8pCWepBPRUBrLlSg5D5ov7iwX+joDWueORCcCCCFUipbmmEXg1MZOYY61G12yS X-Received: by 2002:a5d:9acd:: with SMTP id x13mr3005350ion.134.1621319986292; Mon, 17 May 2021 23:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319986; cv=none; d=google.com; s=arc-20160816; b=Cy21oxhGJCubUXYx6KW15egCNZA0WLc4s+sOLmKGiuP3jkiGqLpsxOI1/NLhEbVf0V CHgjahvqn08YeRs5MXNsRXhyfyZbFUbFljt6hyrL13v/VCz81oCaRZ1q42fd0jn61bZW 0kNez22cS1+/jLqeIoOUon/4AE6NEOxRhboCrAJSjejnW8nCkM2sWSTJSKeY21ePadaK 7meoNZ2/Wj4mUo7dDQJWfKO/53r0OD80liVa5AGoxDw0hGzBMqZpVFnNaL0t8NqqCv+L A0N1u5VHjFCarQJkpIjqkb5vY8BZFVyO+GxmopTPbfaYZishfacsVUHKZdbxTAfSmw8J ij1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7t3bWM54JK2FuU7XT5Q8k4nbO4jQvy5ryj/KCV3sezc=; b=03BXoGuvxvLreGybKa4hzllIRtPyF14DQL265ldniAHptnhkkdwEcJGC2xePNUUiXi kJr6uogd9aVkys8K0AzvCbDA42hP2GqKhdSNfs3A65DgrJ/kIiBU/LqDlmmNh3u7QX+A qoPwwqpy6bodjQtlFWYu9PHf3jx/OYi80IFtAEM3pqprbD+yQ7jL3TgEiBNFAvzXT2Gk l/iBWHZMjwlnTZcOvaftkpj8TZORam23xYH+uGmLsMmQQXBdm4xM4yWz7cT4DmisB31Q /w6gYogf3pMDTdOGLEPr9Veo6F7NqRurtJdjgfTnWHhFLQV5okF9rrXYky2t1KnwLJWW Hb1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=emHDMMho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si20024129iou.72.2021.05.17.23.39.33; Mon, 17 May 2021 23:39:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=emHDMMho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241340AbhEQOuo (ORCPT + 99 others); Mon, 17 May 2021 10:50:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240268AbhEQOmN (ORCPT ); Mon, 17 May 2021 10:42:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 365E861406; Mon, 17 May 2021 14:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261174; bh=qPdBMdV797gRwxtm8tuNP/fzrqlce7GNUg0G0fL2vFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=emHDMMhoztkbELXKWJEoP/Ef2RsthRBJU5wJmAIbBXU7pra8qkDM2QliwG5hqbmtz F63eYf3QwtCX86L4W0anKUpfTzWKnutfYNa53GNyoqqjzZHmF2GJRY/oDHhjVWegZr u/h1dEhHg8AODtmdFrRpsTzI331lb514W/qmLePE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.11 083/329] powerpc/xive: Use the "ibm, chip-id" property only under PowerNV Date: Mon, 17 May 2021 15:59:54 +0200 Message-Id: <20210517140304.930548677@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cédric Le Goater [ Upstream commit e9e16917bc388846163b8566a298a291d71e44c9 ] 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 Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210413130352.1183267-1-clg@kaod.org Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/xive/common.c | 9 +++------ arch/powerpc/sysdev/xive/native.c | 6 ++++++ arch/powerpc/sysdev/xive/xive-internal.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c index 5cacb632eb37..31b657c37735 100644 --- a/arch/powerpc/sysdev/xive/common.c +++ b/arch/powerpc/sysdev/xive/common.c @@ -1341,17 +1341,14 @@ 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->hw_ipi = XIVE_BAD_IRQ; + xc->chip_id = XIVE_INVALID_CHIP_ID; + if (xive_ops->prepare_cpu) + xive_ops->prepare_cpu(cpu, xc); per_cpu(xive_cpu, cpu) = xc; } diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c index 05a800a3104e..57e3f1540435 100644 --- a/arch/powerpc/sysdev/xive/native.c +++ b/arch/powerpc/sysdev/xive/native.c @@ -380,6 +380,11 @@ static void xive_native_update_pending(struct xive_cpu *xc) } } +static void xive_native_prepare_cpu(unsigned int cpu, struct xive_cpu *xc) +{ + xc->chip_id = cpu_to_chip_id(cpu); +} + static void xive_native_setup_cpu(unsigned int cpu, struct xive_cpu *xc) { s64 rc; @@ -462,6 +467,7 @@ static const struct xive_ops xive_native_ops = { .match = xive_native_match, .shutdown = xive_native_shutdown, .update_pending = xive_native_update_pending, + .prepare_cpu = xive_native_prepare_cpu, .setup_cpu = xive_native_setup_cpu, .teardown_cpu = xive_native_teardown_cpu, .sync_source = xive_native_sync_source, diff --git a/arch/powerpc/sysdev/xive/xive-internal.h b/arch/powerpc/sysdev/xive/xive-internal.h index 9cf57c722faa..6478be19b4d3 100644 --- a/arch/powerpc/sysdev/xive/xive-internal.h +++ b/arch/powerpc/sysdev/xive/xive-internal.h @@ -46,6 +46,7 @@ struct xive_ops { u32 *sw_irq); int (*setup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio); void (*cleanup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio); + void (*prepare_cpu)(unsigned int cpu, struct xive_cpu *xc); void (*setup_cpu)(unsigned int cpu, struct xive_cpu *xc); void (*teardown_cpu)(unsigned int cpu, struct xive_cpu *xc); bool (*match)(struct device_node *np); -- 2.30.2