Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp705972pxm; Fri, 25 Feb 2022 17:50:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyR4xAiY22V0dzZdq5KQ0eA1rc74Ga0ir2ga3C4OLbJU9OZzVgxb4h/Nr55I855lb6LUwfA X-Received: by 2002:a17:902:9a41:b0:149:a13f:af62 with SMTP id x1-20020a1709029a4100b00149a13faf62mr9864275plv.147.1645840200734; Fri, 25 Feb 2022 17:50:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645840200; cv=none; d=google.com; s=arc-20160816; b=PzGwadzlU4R7IgHX75MXUmR20q4pDsKts4jcBnFFQSEa/y3N0FzM79UpTsuFWYFeKS AAtmFEDaJGplIMEMTiIRckrKoqP2BTnLkGhbQTR7FZlbB/ElEto+UvMfX05qMqYaPcCx 1c2/fQmXjTgtsbTYw890NjIwjGXspc7qictW9e5IUfH1oXpIGtcZbBNfy2f3kzRXOebO Vw81m1VAIQ6bri53y25j1oD1cq35Z6VTVYQPJlhWG0kjAmRQIxSP3CHgLBXGsEyOgQG3 CUAxP3GUzglDapAcy4wgehIlmVrB5is85ZnZ7fh+dstuPKtGgGEF/zMgupI3+5HkDTo7 XWqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=fyq0deO5bWPMegefjUlMLkcZJhC20sREZnhpFS51GGQ=; b=shomA4EWe5IX1PzEPF/ZdQowh2ubt6PdN01Q6WW/EETFSZEr2KJ1k/t+tYvYQd6vEJ GT1TLiChK2RY6iEXK77D6XAIEwr0U89t5vddgyVDai0wPSxPgsOhFqsi2n8tzZM5zTeQ jAqhKUb0OqX6oA6hhogZBL4f8LhIYpd2iEV04/P/zm91fRmUygBUzzfM8Umd5FVCdYae z8DagTK1PhSXmyPbmPYMZDHzaOzw+w6NjfWq6nvjUDDL70iej/eKZNHXxvQ0hnBuBUsg ylh7mZ1Mg524dHqF1QRz15IwEvoH9NxcPcnTVhCaL4W696PaWzEEOly3Xqm/OPDa/Chs 2beQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XEkgTN4t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ay5-20020a1709028b8500b0014aa0b053easi3295853plb.94.2022.02.25.17.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:50:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XEkgTN4t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B577CBC8E; Fri, 25 Feb 2022 17:37:32 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241966AbiBYP2I (ORCPT + 99 others); Fri, 25 Feb 2022 10:28:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234823AbiBYP2F (ORCPT ); Fri, 25 Feb 2022 10:28:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BF033EB99; Fri, 25 Feb 2022 07:27:32 -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 4CF92611CB; Fri, 25 Feb 2022 15:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A49A7C340E7; Fri, 25 Feb 2022 15:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645802851; bh=GchGfchhQ7WZ/NePHJUvIbF37Uwesc1jKSg3sKSQ77g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XEkgTN4tjcJNe2GGfNsBi6FBRH2Z1Us6IOVNk7z6miXcHmfESrALYlgbWiklNnBJD bH2e6VIOIywHUU5CjFOPNl9z+CTJEhUFmCw34b4bcjW675XuioctQyc4SDbmlWvpy8 LvZOsyE0aVFW3+FcpE/XbVYngGsY51mZWbp/La3niPmtkgH+gsLgNCHapz2xCPINOg 6xmzLakgdjZNSlzKPIi/PKRnnYaDrdtz671xI2h6nGWFY67z70a59YCtwl6ly2Ps15 4xPl5BsBHT1satr/3RnMrcITuIl5MDztt8/xJmPq8yRuVYl1dsbQpH3kttyO3V1wPu Ob/IPmLF/j4Ew== Received: from sofa.misterjones.org ([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 1nNcVF-00AYqQ-6f; Fri, 25 Feb 2022 15:27:29 +0000 Date: Fri, 25 Feb 2022 15:27:28 +0000 Message-ID: <87lexz2cgv.wl-maz@kernel.org> From: Marc Zyngier To: Hector Martin Cc: Thomas Gleixner , Rob Herring , Sven Peter , Alyssa Rosenzweig , Mark Kettenis , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 7/7] irqchip/apple-aic: Add support for AICv2 In-Reply-To: <20220224130741.63924-8-marcan@marcan.st> References: <20220224130741.63924-1-marcan@marcan.st> <20220224130741.63924-8-marcan@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, tglx@linutronix.de, robh+dt@kernel.org, sven@svenpeter.dev, alyssa@rosenzweig.io, mark.kettenis@xs4all.nl, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Feb 2022 13:07:41 +0000, Hector Martin wrote: > > Introduce support for the new AICv2 hardware block in t6000/t6001 SoCs. > > It seems these blocks are missing the information required to compute > the event register offset in the capability registers, so we specify > that in the DT. > > Signed-off-by: Hector Martin > --- > drivers/irqchip/irq-apple-aic.c | 148 ++++++++++++++++++++++++++++---- > 1 file changed, 129 insertions(+), 19 deletions(-) > > diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c > index 93c622435ba2..602c8b274170 100644 > --- a/drivers/irqchip/irq-apple-aic.c > +++ b/drivers/irqchip/irq-apple-aic.c > @@ -103,6 +103,57 @@ > > #define AIC_MAX_IRQ 0x400 > > +/* > + * AIC v2 registers (MMIO) > + */ > + > +#define AIC2_VERSION 0x0000 > +#define AIC2_VERSION_VER GENMASK(7, 0) > + > +#define AIC2_INFO1 0x0004 > +#define AIC2_INFO1_NR_IRQ GENMASK(15, 0) > +#define AIC2_INFO1_LAST_DIE GENMASK(27, 24) > + > +#define AIC2_INFO2 0x0008 > + > +#define AIC2_INFO3 0x000c > +#define AIC2_INFO3_MAX_IRQ GENMASK(15, 0) > +#define AIC2_INFO3_MAX_DIE GENMASK(27, 24) > + > +#define AIC2_RESET 0x0010 > +#define AIC2_RESET_RESET BIT(0) > + > +#define AIC2_CONFIG 0x0014 > +#define AIC2_CONFIG_ENABLE BIT(0) > +#define AIC2_CONFIG_PREFER_PCPU BIT(28) > + > +#define AIC2_TIMEOUT 0x0028 > +#define AIC2_CLUSTER_PRIO 0x0030 > +#define AIC2_DELAY_GROUPS 0x0100 > + > +#define AIC2_IRQ_CFG 0x2000 > + > +/* > + * AIC2 registers are laid out like this, starting at AIC2_IRQ_CFG: > + * > + * Repeat for each die: > + * IRQ_CFG: u32 * MAX_IRQS > + * SW_SET: u32 * (MAX_IRQS / 32) > + * SW_CLR: u32 * (MAX_IRQS / 32) > + * MASK_SET: u32 * (MAX_IRQS / 32) > + * MASK_CLR: u32 * (MAX_IRQS / 32) > + * HW_STATE: u32 * (MAX_IRQS / 32) > + * > + * This is followed by a set of event registers, each 16K page aligned. > + * The first one is the AP event register we will use. Unfortunately, > + * the actual implemented die count is not specified anywhere in the > + * capability registers, so we have to explicitly specify the event > + * register offset in the device tree to remain forward-compatible. > + */ > + > +#define AIC2_IRQ_CFG_TARGET GENMASK(3, 0) > +#define AIC2_IRQ_CFG_DELAY_IDX GENMASK(7, 5) > + > #define MASK_REG(x) (4 * ((x) >> 5)) > #define MASK_BIT(x) BIT((x) & GENMASK(4, 0)) > > @@ -193,6 +244,7 @@ struct aic_info { > /* Register offsets */ > u32 event; > u32 target_cpu; > + u32 irq_cfg; > u32 sw_set; > u32 sw_clr; > u32 mask_set; > @@ -220,6 +272,14 @@ static const struct aic_info aic1_fipi_info = { > .fast_ipi = true, > }; > > +static const struct aic_info aic2_info = { > + .version = 2, > + > + .irq_cfg = AIC2_IRQ_CFG, > + > + .fast_ipi = true, > +}; > + > static const struct of_device_id aic_info_match[] = { > { > .compatible = "apple,t8103-aic", > @@ -229,6 +289,10 @@ static const struct of_device_id aic_info_match[] = { > .compatible = "apple,aic", > .data = &aic1_info, > }, > + { > + .compatible = "apple,aic2", > + .data = &aic2_info, > + }, > {} > }; > > @@ -373,6 +437,14 @@ static struct irq_chip aic_chip = { > .irq_set_type = aic_irq_set_type, > }; > > +static struct irq_chip aic2_chip = { > + .name = "AIC2", > + .irq_mask = aic_irq_mask, > + .irq_unmask = aic_irq_unmask, > + .irq_eoi = aic_irq_eoi, > + .irq_set_type = aic_irq_set_type, > +}; > + > /* > * FIQ irqchip > */ > @@ -529,10 +601,15 @@ static struct irq_chip fiq_chip = { > static int aic_irq_domain_map(struct irq_domain *id, unsigned int irq, > irq_hw_number_t hw) > { > + struct aic_irq_chip *ic = id->host_data; > u32 type = FIELD_GET(AIC_EVENT_TYPE, hw); > + struct irq_chip *chip = &aic_chip; > + > + if (ic->info.version == 2) > + chip = &aic2_chip; > > if (type == AIC_EVENT_TYPE_IRQ) { > - irq_domain_set_info(id, irq, hw, &aic_chip, id->host_data, > + irq_domain_set_info(id, irq, hw, chip, id->host_data, > handle_fasteoi_irq, NULL, NULL); > irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq))); > } else { > @@ -888,24 +965,26 @@ static int aic_init_cpu(unsigned int cpu) > /* Commit all of the above */ > isb(); > > - /* > - * Make sure the kernel's idea of logical CPU order is the same as AIC's > - * If we ever end up with a mismatch here, we will have to introduce > - * a mapping table similar to what other irqchip drivers do. > - */ > - WARN_ON(aic_ic_read(aic_irqc, AIC_WHOAMI) != smp_processor_id()); > + if (aic_irqc->info.version == 1) { > + /* > + * Make sure the kernel's idea of logical CPU order is the same as AIC's > + * If we ever end up with a mismatch here, we will have to introduce > + * a mapping table similar to what other irqchip drivers do. > + */ > + WARN_ON(aic_ic_read(aic_irqc, AIC_WHOAMI) != smp_processor_id()); Don't you have a similar issue with AICv2? Or is it that AICv2 doesn't have this register? Thanks, M. -- Without deviation from the norm, progress is not possible.