Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp234828ybl; Fri, 9 Aug 2019 05:20:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxA651f/jnmLL3DJrhhDcJsExlSLrdon6aDsQ/7aUoLvV0Td2ucGr+Zy3ykRA/XKzNBkOE X-Received: by 2002:a65:48c2:: with SMTP id o2mr17416461pgs.45.1565353258464; Fri, 09 Aug 2019 05:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565353258; cv=none; d=google.com; s=arc-20160816; b=rz515W8/6+EipPv9ft0HT2O9iPuUPvZKhKpb0yIETl6ollvx4fl4GOl+bDEkNTyJDw bn7SSCOBiwL/ZmPR7rW7HLFv/9yhKxnN76FYR2/jdtHXUBAnjqkSOK1W3I9elez6rpUe wT5vnlmbupR9Z+lTc+qRFgJOHL2qfkNMqYkPjH4CNCAW/XJCb+N8gp13TMDFdpbFy2ji AcKXkYy6xobVntdNeKz6I3cwVnIrG9D0Yq8m3pXcUwt4RTCyHMm7qerszbCJrkV+nr37 yMeUa6N3erDsvuvhqC3+JtB6oLWgZdSpv8H97mjKpT2U0/tuZ4NJ0YoKnuEBArI7A7bK Kw5w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=ZeR+MpZLwUQL+wB7okCCumY5wBhSVxEeu8ik9Lu9tXM=; b=OIX3hcnBASIHsGLsmhAQXVZJu8ryNvujDw0u6ARm593UiVt8pEYRcu4XgsLJ2ZrK1Z 2Nzg14mNgBcC/rGfamrbtFxpwiB5UfzXRll9m6LwrHsrqmApVGE8Xg9pHwaefsEHUBjm nJjrI4To8xQK9ZSqQGyI3WU3VB9jomgIadR0/b+CO03mnWsEUq20VQ8TiPubRzpSqbhw 5aSUmeKTgOnbUrCrGDSXemA8sjH926xZUra54M8dMZBKSmG2Yydzt8H1TtwmFpU1INrH ELEBBvmzpyeGrhVHkIdrzLMWoY7///LmeGM79NK4UZhHUK+sIcs0joFJ6+s+Vg1rvkSG Ec3w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e123si56749949pfa.252.2019.08.09.05.20.41; Fri, 09 Aug 2019 05:20:58 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406722AbfHIMS3 (ORCPT + 99 others); Fri, 9 Aug 2019 08:18:29 -0400 Received: from foss.arm.com ([217.140.110.172]:46688 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbfHIMS2 (ORCPT ); Fri, 9 Aug 2019 08:18:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B4E0B1596; Fri, 9 Aug 2019 05:18:27 -0700 (PDT) Received: from [10.1.197.61] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5C493F706; Fri, 9 Aug 2019 05:18:25 -0700 (PDT) Subject: Re: [PATCH 07/19] irqchip/mmp: mask off interrupts from other cores To: Lubomir Rintel , Olof Johansson Cc: Rob Herring , Mark Rutland , Thomas Gleixner , Jason Cooper , 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 References: <20190809093158.7969-1-lkundrak@v3.sk> <20190809093158.7969-8-lkundrak@v3.sk> From: Marc Zyngier Organization: Approximate Message-ID: <19a21c54-93ac-19dc-d679-8d376d44e68c@kernel.org> Date: Fri, 9 Aug 2019 13:18:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190809093158.7969-8-lkundrak@v3.sk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/2019 10:31, Lubomir Rintel wrote: > 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 > > --- > arch/arm/mach-mmp/regs-icu.h | 3 +++ > drivers/irqchip/irq-mmp.c | 51 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 54 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)) > > +#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) > > diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c > index cd8d2253f56d1..25497c75cc861 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; > }; > > 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; > > @@ -98,6 +101,16 @@ static void icu_mask_irq(struct irq_data *d) > r &= ~data->conf_mask; > r |= 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 = readl_relaxed(mmp_icu2_base + (hwirq << 2)); > + r &= ~data->conf2_mask; > + writel_relaxed(r, mmp_icu2_base + (hwirq << 2)); > + } > } else { > r = 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 = { > MMP2_ICU_INT_ROUTE_PJ4_FIQ, > }; > > +static struct mmp_intc_conf mmp3_conf = { > + .conf_enable = 0x20, > + .conf_disable = 0x0, > + .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | > + MMP2_ICU_INT_ROUTE_PJ4_FIQ, > + .conf2_mask = 0xf0, > +}; > + > static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) > { > int hwirq; > @@ -364,6 +385,14 @@ static int __init mmp_init_bases(struct device_node *node) > pr_err("Failed to get interrupt controller register\n"); > return -ENOMEM; > } > + if (of_device_is_compatible(node, "marvell,mmp3-intc")) { Instead of harcoding the compatible property once more, why don't you simply pass a flag from mmpx_of_init()? > + mmp_icu2_base = of_iomap(node, 1); > + if (!mmp_icu2_base) { > + pr_err("Failed to get interrupt controller register #2\n"); > + iounmap(mmp_icu_base); > + return -ENOMEM; > + } > + } > > icu_data[0].virq_base = 0; > icu_data[0].domain = irq_domain_add_linear(node, nr_irqs, > @@ -386,6 +415,8 @@ static int __init mmp_init_bases(struct device_node *node) > irq_dispose_mapping(icu_data[0].virq_base + i); > } > irq_domain_remove(icu_data[0].domain); > + if (of_device_is_compatible(node, "marvell,mmp3-intc")) > + iounmap(mmp_icu2_base); > iounmap(mmp_icu_base); > return -EINVAL; > } > @@ -428,6 +459,26 @@ static int __init mmp2_of_init(struct device_node *node, > } > IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init); > > +static int __init mmp3_of_init(struct device_node *node, > + struct device_node *parent) > +{ > + int ret; > + > + ret = mmp_init_bases(node); > + if (ret < 0) > + return ret; > + > + icu_data[0].conf_enable = mmp3_conf.conf_enable; > + icu_data[0].conf_disable = mmp3_conf.conf_disable; > + icu_data[0].conf_mask = mmp3_conf.conf_mask; > + icu_data[0].conf2_mask = mmp3_conf.conf2_mask; > + irq_set_default_host(icu_data[0].domain); Why do you need this? On a fully DT-ified platform, there should be no notion of a default domain. > + set_handle_irq(mmp2_handle_irq); > + max_icu_nr = 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) > { > Thanks, M. -- Jazz is not dead, it just smells funny...