Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp855592ybl; Thu, 22 Aug 2019 06:03:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBPD/9bfewOjW3WD2YWQN3m5hnaeDHzW2hG8S/y4gWz6QgI7H2Iad6lfac/05mxMyj8R4Y X-Received: by 2002:a17:90a:b884:: with SMTP id o4mr5355187pjr.52.1566478993873; Thu, 22 Aug 2019 06:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566478993; cv=none; d=google.com; s=arc-20160816; b=nfoOyXpnSC3y6uN0mnVGcQqvE0StgSlF/Mh93QKhBPp3y9kH5Lf0FXeYmRGidGAh/u WHs2/XQsbSgMWQlSBn3qGzOyoArODbWmU33Q+VG3okwJ01wdRsSq0xowXlhDc8ZmuOMQ LPg1CgPSRwDIDmpZ71cp0L9i8UayDJ13+aLf5SD/aCIpaIMdtKkP/uaP25A+SQo05IPO JQUyrcY4ZTDUqQURxbct3/0djUQ851O4SLkOxStx3OxYSfHJ10ikPQopbt/9F0j0O4H6 D9jL0ZUVx/Vg9SFR5Pcr9NFeKmYyDWandWvDpWHucV1vIqlWaQFeNdxBRl0s3ivlxpnS FJVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pMEunZ+lo3j9bPBb7KxWSj/UHL9IfaKvPYXyaGF/9PI=; b=JjvXE6vqQjUzcGTbHwHtTwUlGo+CB1mFRKdcox1dOKwOmnUsuCJOspAOJ38/iBp5Xr Mw7O/nsfG00ReRJM1FuBrByZUpXlefuvW9SpX1VHw2ZTIsQoaJI5g5OMsISwqyfmpai6 B8B7FEHqFAwVAlJorPk3bIiTeHfPmZRBsxQ52sXTDAYVGBc7e4VH76sAljJFkkThkMvK EUGKydVL7nfhhgNznby8i0qZ/Tc8vqTWPmT22dlEvn3pnDdyU1M0N+n40JXELJaC+a7Q BXsHnjhY+WXOjWpWZaP84ujcKKYT/NWT6bOU1B+n/I+INGwX5H6Fx4lfccFB4BLEtBDh iqQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si17155078plr.103.2019.08.22.06.02.55; Thu, 22 Aug 2019 06:03:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731563AbfHVJeW (ORCPT + 99 others); Thu, 22 Aug 2019 05:34:22 -0400 Received: from shell.v3.sk ([90.176.6.54]:35905 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730857AbfHVJeU (ORCPT ); Thu, 22 Aug 2019 05:34:20 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id AAF37D756D; Thu, 22 Aug 2019 11:34:15 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id UpO5WvmHcAzR; Thu, 22 Aug 2019 11:33:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id E195CD7567; Thu, 22 Aug 2019 11:33:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7d6UZ33megEi; Thu, 22 Aug 2019 11:27:28 +0200 (CEST) Received: from belphegor.brq.redhat.com (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id DC5D6D755F; Thu, 22 Aug 2019 11:26:48 +0200 (CEST) From: Lubomir Rintel To: Olof Johansson Cc: Rob Herring , Mark Rutland , Thomas Gleixner , Jason Cooper , Marc Zyngier , Kishon Vijay Abraham I , Russell King , Michael Turquette , Stephen Boyd , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Andres Salomon , Lubomir Rintel Subject: [PATCH v2 08/20] irqchip/mmp: mask off interrupts from other cores Date: Thu, 22 Aug 2019 11:26:31 +0200 Message-Id: <20190822092643.593488-9-lkundrak@v3.sk> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190822092643.593488-1-lkundrak@v3.sk> References: <20190822092643.593488-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andres Salomon On mmp3, there's an extra set of ICU registers (ICU2) that handle interrupts on the extra cores. When masking off interrupts on MP1, these should be masked as well. We add a new interrupt controller via device tree to identify when we're looking at an mmp3 machine via compatible field of "marvell,mmp3-intc". [lkundrak@v3.sk: Changed "mrvl,mmp3-intc" compatible strings to "marvell,mmp3-intc". Tidied up the subject line a bit.] Signed-off-by: Andres Salomon Signed-off-by: Lubomir Rintel -- Changes since v1: - Moved mmp3-specific mmp_icu2_base initialization from mmp_init_bases() = to mmp3_of_init() so that we don't have to check for marvell,mmp3-intc compatibility twice. - Drop an superfluous call to irq_set_default_host() arch/arm/mach-mmp/regs-icu.h | 3 +++ drivers/irqchip/irq-mmp.c | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/arch/arm/mach-mmp/regs-icu.h b/arch/arm/mach-mmp/regs-icu.h index 0375d5a7fcb2b..410743d2b4020 100644 --- a/arch/arm/mach-mmp/regs-icu.h +++ b/arch/arm/mach-mmp/regs-icu.h @@ -11,6 +11,9 @@ #define ICU_VIRT_BASE (AXI_VIRT_BASE + 0x82000) #define ICU_REG(x) (ICU_VIRT_BASE + (x)) =20 +#define ICU2_VIRT_BASE (AXI_VIRT_BASE + 0x84000) +#define ICU2_REG(x) (ICU2_VIRT_BASE + (x)) + #define ICU_INT_CONF(n) ICU_REG((n) << 2) #define ICU_INT_CONF_MASK (0xf) =20 diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c index 126ffdbffdddf..25848d73f6792 100644 --- a/drivers/irqchip/irq-mmp.c +++ b/drivers/irqchip/irq-mmp.c @@ -44,6 +44,7 @@ struct icu_chip_data { unsigned int conf_enable; unsigned int conf_disable; unsigned int conf_mask; + unsigned int conf2_mask; unsigned int clr_mfp_irq_base; unsigned int clr_mfp_hwirq; struct irq_domain *domain; @@ -53,9 +54,11 @@ struct mmp_intc_conf { unsigned int conf_enable; unsigned int conf_disable; unsigned int conf_mask; + unsigned int conf2_mask; }; =20 static void __iomem *mmp_icu_base; +static void __iomem *mmp_icu2_base; static struct icu_chip_data icu_data[MAX_ICU_NR]; static int max_icu_nr; =20 @@ -98,6 +101,16 @@ static void icu_mask_irq(struct irq_data *d) r &=3D ~data->conf_mask; r |=3D data->conf_disable; writel_relaxed(r, mmp_icu_base + (hwirq << 2)); + + if (data->conf2_mask) { + /* + * ICU1 (above) only controls PJ4 MP1; if using SMP, + * we need to also mask the MP2 and MM cores via ICU2. + */ + r =3D readl_relaxed(mmp_icu2_base + (hwirq << 2)); + r &=3D ~data->conf2_mask; + writel_relaxed(r, mmp_icu2_base + (hwirq << 2)); + } } else { r =3D readl_relaxed(data->reg_mask) | (1 << hwirq); writel_relaxed(r, data->reg_mask); @@ -201,6 +214,14 @@ static const struct mmp_intc_conf mmp2_conf =3D { MMP2_ICU_INT_ROUTE_PJ4_FIQ, }; =20 +static struct mmp_intc_conf mmp3_conf =3D { + .conf_enable =3D 0x20, + .conf_disable =3D 0x0, + .conf_mask =3D MMP2_ICU_INT_ROUTE_PJ4_IRQ | + MMP2_ICU_INT_ROUTE_PJ4_FIQ, + .conf2_mask =3D 0xf0, +}; + static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) { int hwirq; @@ -428,6 +449,33 @@ static int __init mmp2_of_init(struct device_node *n= ode, } IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init); =20 +static int __init mmp3_of_init(struct device_node *node, + struct device_node *parent) +{ + int ret; + + mmp_icu2_base =3D of_iomap(node, 1); + if (!mmp_icu2_base) { + pr_err("Failed to get interrupt controller register #2\n"); + return -ENODEV; + } + + ret =3D mmp_init_bases(node); + if (ret < 0) { + iounmap(mmp_icu2_base); + return ret; + } + + icu_data[0].conf_enable =3D mmp3_conf.conf_enable; + icu_data[0].conf_disable =3D mmp3_conf.conf_disable; + icu_data[0].conf_mask =3D mmp3_conf.conf_mask; + icu_data[0].conf2_mask =3D mmp3_conf.conf2_mask; + set_handle_irq(mmp2_handle_irq); + max_icu_nr =3D 1; + return 0; +} +IRQCHIP_DECLARE(mmp3_intc, "marvell,mmp3-intc", mmp3_of_init); + static int __init mmp2_mux_of_init(struct device_node *node, struct device_node *parent) { --=20 2.21.0