Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3C6C43219 for ; Mon, 13 Dec 2021 14:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233094AbhLMOnZ (ORCPT ); Mon, 13 Dec 2021 09:43:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239666AbhLMOnY (ORCPT ); Mon, 13 Dec 2021 09:43:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE62BC061574; Mon, 13 Dec 2021 06:43:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EBA061120; Mon, 13 Dec 2021 14:43:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACC24C34603; Mon, 13 Dec 2021 14:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639406602; bh=QSCicIirP2m6ZjggqXj9l1P8p6DsUyvIyBwFqJR9+pE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oiFDlUBR9yqegPO65nbXDCCA9bmyfymtLA2/39dRkys5CYAnRtzp58NoPexqiloSr W9yGR3jsZdUA+OxY7gskwAv5AMhbfmjmKztI50wpvp0Ujp8zKiSgB8CE3AzeQZRTSW 1RZ0sREYyGOD0675HJJMq10OaCN8K1XndwNQabWCGE5noAA3G42rGzmkvpsnQKc6BV nDWNoiiUyfK7oVi3vdmx3T2xoDVcUgOYSeh9Sf2Q9xFJ2Win2nryf5WNIP+pIBBmya 44fROr/men/CMTvaXv9pAMyA0CNw0dYGVgknNpaV6za6fwmEBwP+MTuNtISAMLHYfR WWly4h4uE7UZw== Received: from cfbb000407.r.cam.camfibre.uk ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mwmXw-00Bpdp-Ho; Mon, 13 Dec 2021 14:43:20 +0000 Date: Mon, 13 Dec 2021 14:43:19 +0000 Message-ID: <87o85kk1ko.wl-maz@kernel.org> From: Marc Zyngier To: Hector Martin Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Will Deacon , Sven Peter , Alyssa Rosenzweig , Rob Herring , Thomas Gleixner , Dougall , kernel-team@android.com Subject: Re: [PATCH v2 3/8] irqchip/apple-aic: Add cpumasks for E and P cores In-Reply-To: <8bb14854-3377-4901-aaba-1a124c57cbec@marcan.st> References: <20211201134909.390490-1-maz@kernel.org> <20211201134909.390490-4-maz@kernel.org> <8bb14854-3377-4901-aaba-1a124c57cbec@marcan.st> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: marcan@marcan.st, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, will@kernel.org, sven@svenpeter.dev, alyssa@rosenzweig.io, robh+dt@kernel.org, tglx@linutronix.de, dougallj@gmail.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 12 Dec 2021 07:30:20 +0000, Hector Martin wrote: > > On 01/12/2021 22.49, Marc Zyngier wrote: > > In order to be able to tell the core IRQ code about the affinity > > of the PMU interrupt in later patches, compute the cpumasks of the > > P and E cores at boot time. > > > > This relies on the affinity scheme used by the vendor, which seems > > to work for the couple of SoCs that are out in the wild. > > > > Signed-off-by: Marc Zyngier > > --- > > drivers/irqchip/irq-apple-aic.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c > > index 3759dc36cc8f..30ca80ccda8b 100644 > > --- a/drivers/irqchip/irq-apple-aic.c > > +++ b/drivers/irqchip/irq-apple-aic.c > > @@ -177,6 +177,8 @@ struct aic_irq_chip { > > void __iomem *base; > > struct irq_domain *hw_domain; > > struct irq_domain *ipi_domain; > > + struct cpumask ecore_mask; > > + struct cpumask pcore_mask; > > int nr_hw; > > int ipi_hwirq; > > }; > > @@ -200,6 +202,11 @@ static void aic_ic_write(struct aic_irq_chip *ic, u32 reg, u32 val) > > writel_relaxed(val, ic->base + reg); > > } > > +static bool __is_pcore(u64 mpidr) > > +{ > > + return MPIDR_AFFINITY_LEVEL(mpidr, 2) == 1; > > +} > > + > > /* > > * IRQ irqchip > > */ > > @@ -833,6 +840,13 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p > > return -ENODEV; > > } > > + for_each_possible_cpu(i) { > > + if (__is_pcore(cpu_logical_map(i))) > > + cpumask_set_cpu(i, &irqc->pcore_mask); > > + else > > + cpumask_set_cpu(i, &irqc->ecore_mask); > > + } > > + > > set_handle_irq(aic_handle_irq); > > set_handle_fiq(aic_handle_fiq); > > > > I'm okay with this approach, but if we want to be more explicit about > the affinities, maybe something like apple,pmu-irq-index in the CPU > nodes? Then we can either start at a higher FIQ offset for these (in > case we need to add more FIQs in the future), or just make up a new > AIC_PMU top level interrupt type and start at 0. I'm actually worried that we'll need more of these "asymmetric FIQs" in the future, and that the PMU-specific hack won't scale. Do you know of any other per-CPU device that could differ between small and big cores? This would certainly help guiding my implementation between a device specific hack (the PMU irq index) or something more generic (interrupt specifier containing the affinity and following the AICv2 scheme). Thanks, M. -- Without deviation from the norm, progress is not possible.