Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3010140pxj; Mon, 17 May 2021 15:29:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySVZm3xJF65NewFVColXnzwQx/EvK2gs+0PZZUKV8oiC8uKM0hUuRg0luzVsf686tnexE/ X-Received: by 2002:a17:906:c448:: with SMTP id ck8mr2254116ejb.497.1621290591400; Mon, 17 May 2021 15:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621290591; cv=none; d=google.com; s=arc-20160816; b=hfUktWpu+SEUHTPcnmWEDs7Ihh98c/LQLdQJydQeQ8kYP/O9fMfL3BFKKkzZT3F6Z1 4/Ls5BH0rvlxIcKE1oTFq6b5ZuDugv2YiQ1B4eBFl9/3+p6OCD9MCZsFlSCc0iecJKSS 4hl+RySqpTDfwQgQ90iaVn5TwNDrCmQG4yp4D8Z15I/yEbbgdnPxKIkOonPh1KtlkX5D voXCxknyxzpCIleRdlDi56doDvPHrZk7bXfx2yL1O3IweN0SiiG9qVo47Vc9bTcuR0pB x8W/gbfkFXQSnESGpkQbFBckpnaIbu9Uk/A/DsX2XW2y0WNpB7lnfMVEtLUOA7aePVK8 KVuA== 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=c1JH7nvYXgsnh3JVdO7evNYk0PLDOQDZ6wmkkv0ea+wSoUySqFgWBMMq0khjsymgxF WeTNHL+hs63oQpRlT6C4oWSP+6qTNuOm+5wSu2U3ZZJMIR8ZQeHqrH4GFgDf6oiv1ZfJ 7N9M6YkNZytPRneeSJcJ3cpZfAqeeNrtQNdF7tAlV+a5KGf9HYtyp3J2hsNg24PXJRVK 1lG3wXjV8EA5liFLCR0KpGFkM7j2q5yy+TtScmef20P7CfnGzx45/GnCIUYEnC9hGr8+ wfrDDTdM902336q4zE2cjwRxIhk0zNlIOLm52lfifXqpQZXlxaNxo6HAzrGSV2/LPKaB ednQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fqb+0Ihb; 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 bx4si12752828ejb.30.2021.05.17.15.29.28; Mon, 17 May 2021 15:29:51 -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=Fqb+0Ihb; 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 S236350AbhEQONi (ORCPT + 99 others); Mon, 17 May 2021 10:13:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:58460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238613AbhEQOLZ (ORCPT ); Mon, 17 May 2021 10:11:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA256613D6; Mon, 17 May 2021 14:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260467; bh=qPdBMdV797gRwxtm8tuNP/fzrqlce7GNUg0G0fL2vFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fqb+0IhbQVTF7BcywrD4MsL3Zrm4KxiHNaA34qR0zM10lHEeDOX6U7tdVcJlZLtZS dh40Gf5N4GmzxocErJ+nT0s7zMsD0tmEPZJqv3VoY6huyBSoh8iBbK+5HTn3HCCYW0 CWnNhnxxVH8dcxvVP9W+L4hsNbagBewv08mUg+pw= 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.12 093/363] powerpc/xive: Use the "ibm, chip-id" property only under PowerNV Date: Mon, 17 May 2021 15:59:19 +0200 Message-Id: <20210517140305.747795754@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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