Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2760693pxx; Sun, 1 Nov 2020 09:02:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyih73BXa/A8TuQ5cQd+8FlB6izdIaSYEjrN1KuQD+VoYIedeWQ6fg1mhju+/Oslu1rwqnU X-Received: by 2002:a50:ab07:: with SMTP id s7mr12618801edc.287.1604250154541; Sun, 01 Nov 2020 09:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604250154; cv=none; d=google.com; s=arc-20160816; b=RbwJPGvFK3A29ziqAhifKl6fZzPpD2VRp6fzVHFsJvtd+Mpzjvs2bj6V2VsDdt+v9e K8y92J0kRhOqjxQ5rMi8UOlx4Ky9iNbQvnlMtR1Zuzhekbmp5r6zfpvgNYqU4mTosb9M geoR64x8MTxg57+cGFRZFAOpO44lyL9/J40/MOPV7pVR0iyZiO7fkVvDhLWpfLs8kEHQ oDN8eR7DQLGc8lHCNvVJvd19keT50i1cqhYYuc/gYtnkQSn+vHTCkVbL/bFUoN48XVTd RyM5SXSNKzwku/a1suPovswAGJxor+BwT3dlcVBdff0IggHd+7TN3zNPcizyrAiseTsQ 9R+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=aCnuJ3lVmHHG4SSasG7csbDqsih9xX8WfJDoPw/c1LM=; b=eAlRE0ZCeFFULsDzLxVO19n1qUmcgxU4lu5eujcXuvku5TnT40RLOzljnjK5azxriZ BgsTMnGANm1GVB5thIAetDjJiybhdtRgyIn84G6WRpdtd0KdgPEIJaiMoJylaHiLqzJB WjaDSNWHw4CnXEhhWUJO/1EAzS6YuO6MZdvhwz1eVwqH1uZxUaymZSCxkxn8WC0lucPU aSCRhl0kvXHG5WFSrNFP+wDQ6TRjcuhSBU57l/8C8m0KUxW+0fsl6ZkccqW+T8lT1uBX PDoF6YIs+eFvdPjJfgN40aD4PYkgvEmbOHKgr3rc3795M7iP1Al+x2QX3OB8de/PtE/n LAwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ykIuZj0s; dkim=neutral (no key) header.i=@linutronix.de header.b=BpkO4QJZ; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si8237002ejl.239.2020.11.01.09.02.11; Sun, 01 Nov 2020 09:02:34 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=ykIuZj0s; dkim=neutral (no key) header.i=@linutronix.de header.b=BpkO4QJZ; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727086AbgKARAN (ORCPT + 99 others); Sun, 1 Nov 2020 12:00:13 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:53834 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbgKARAM (ORCPT ); Sun, 1 Nov 2020 12:00:12 -0500 Date: Sun, 01 Nov 2020 17:00:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604250010; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCnuJ3lVmHHG4SSasG7csbDqsih9xX8WfJDoPw/c1LM=; b=ykIuZj0s4zoDLvY5BUcYHH6Eyos4NlR7+fWNuwKs1hLQOBjS3BXOxBfH+HjFATVfuKiVzp guKTmbVHksblERjPFzGqk6aFYWc4m9JWs82dTwZSGBvEK0+98j+U668oJMmZDhK8ZEf8PR pwWEfwcWsQP9tk4B/w+dKlqdb6+xwRx8w6Z32YwabMALPHyYA7Bb07WuR+jEQb+4JgpYLZ 9Lq477hN0mjewaIOwlJPa53vwHGZpyO5JhTA6ZJFNCtyPWwy/qyCLwoZ2aOJD9YVUCrn+O BAIiKhbhbcMeaT6EQoHMQAuOPAueTPA9fYQOxF+coIweBPmBfvyiHM9hw/0Sqw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604250010; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCnuJ3lVmHHG4SSasG7csbDqsih9xX8WfJDoPw/c1LM=; b=BpkO4QJZ4/j/YcOPOwrXBf/x7wH1VjQb+MzHbUQ/XzM4v8brwvhYmvYXr+vzbtURgqODKu zsHqXryZhQDJx/DA== From: "tip-bot2 for Greentime Hu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] irqchip/sifive-plic: Fix chip_data access within a hierarchy Cc: Greentime Hu , Marc Zyngier , Anup Patel , Atish Patra , x86 , LKML In-Reply-To: <20201029023738.127472-1-greentime.hu@sifive.com> References: <20201029023738.127472-1-greentime.hu@sifive.com> MIME-Version: 1.0 Message-ID: <160425000919.397.3903804075850306877.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/urgent branch of tip: Commit-ID: f9ac7bbd6e4540dcc6df621b9c9b6eb2e26ded1d Gitweb: https://git.kernel.org/tip/f9ac7bbd6e4540dcc6df621b9c9b6eb2e26ded1d Author: Greentime Hu AuthorDate: Thu, 29 Oct 2020 10:37:38 +08:00 Committer: Marc Zyngier CommitterDate: Sun, 01 Nov 2020 11:52:27 irqchip/sifive-plic: Fix chip_data access within a hierarchy The plic driver crashes in plic_irq_unmask() when the interrupt is within a hierarchy, as it picks the top-level chip_data instead of its local one. Using irq_data_get_irq_chip_data() instead of irq_get_chip_data() solves the issue for good. Fixes: f1ad1133b18f ("irqchip/sifive-plic: Add support for multiple PLICs") Signed-off-by: Greentime Hu [maz: rewrote commit message] Signed-off-by: Marc Zyngier Reviewed-by: Anup Patel Reviewed-by: Atish Patra Link: https://lore.kernel.org/r/20201029023738.127472-1-greentime.hu@sifive.com --- drivers/irqchip/irq-sifive-plic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index 4048657..6f432d2 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -99,7 +99,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask, struct irq_data *d, int enable) { int cpu; - struct plic_priv *priv = irq_get_chip_data(d->irq); + struct plic_priv *priv = irq_data_get_irq_chip_data(d); writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); for_each_cpu(cpu, mask) { @@ -115,7 +115,7 @@ static void plic_irq_unmask(struct irq_data *d) { struct cpumask amask; unsigned int cpu; - struct plic_priv *priv = irq_get_chip_data(d->irq); + struct plic_priv *priv = irq_data_get_irq_chip_data(d); cpumask_and(&amask, &priv->lmask, cpu_online_mask); cpu = cpumask_any_and(irq_data_get_affinity_mask(d), @@ -127,7 +127,7 @@ static void plic_irq_unmask(struct irq_data *d) static void plic_irq_mask(struct irq_data *d) { - struct plic_priv *priv = irq_get_chip_data(d->irq); + struct plic_priv *priv = irq_data_get_irq_chip_data(d); plic_irq_toggle(&priv->lmask, d, 0); } @@ -138,7 +138,7 @@ static int plic_set_affinity(struct irq_data *d, { unsigned int cpu; struct cpumask amask; - struct plic_priv *priv = irq_get_chip_data(d->irq); + struct plic_priv *priv = irq_data_get_irq_chip_data(d); cpumask_and(&amask, &priv->lmask, mask_val);