Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2036698pxm; Fri, 4 Mar 2022 08:14:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEhh0EKb8gnxRGZDCw+9N6ynxUKrOAjv78Wa0RjTRLgkfW4ej4Phx8BuVz9DFdlUGwIqXm X-Received: by 2002:a17:902:bd95:b0:14f:40ab:270e with SMTP id q21-20020a170902bd9500b0014f40ab270emr41697034pls.101.1646410496129; Fri, 04 Mar 2022 08:14:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646410496; cv=none; d=google.com; s=arc-20160816; b=aI2JMFN5K0LroV8Z/IOki3F+DNEEuhcrYD2/FIe7t13tNo5LVbG6/I9ATDzlGB39vL CjJyeOrNCMj3AxWF3jCHzkZyaVwZYxcRpuiumtu2IoMh1KtMIrtaa+WAmj25UWrPZYUG E7phftvKQOz5yE8I+CdXrLig+umJfFnXHSeWMkj0uN48bd2vP3mEPHxPFr7sgO+YQSFg 7/qVc84p6EuopD6tXjW0zj0PeG6MtrhlJKvYksH+7yIcZDy6djh75+ORb8031wyRDc47 pwni5IlXYDkZDrKOZj4S/52tDSkh9koQtqxWshrDCA+oBa3t+msnC91NozcGegUoY2QV C7HQ== 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=jkOtjTuMs9UtVf30d5dRc+v5a4CRYP7QCTH1Xo/lr38=; b=QFLwwjK5OatJddeP5mZOpFOQHoh+rqsiq28RM7d93uZPcF+awZaIYPPdTYSk3+Bnkd j0byqZFNt0BX3YGZnf/nUJGmuK7Hd04aY8jgAk6LHJm/h1aiwLJZCKiUaYX4Jm1rd0c0 SrVYPXv9c/9jjUREoEhihGzfiX+G0btynSUyPuW8aq5dDc438hHE4Eze18uSV5ndmcE1 lVS43ONYVG2nHbyWJa7PQ7jUmIR+FUwnUIL2UaS6cjJqTKMzZuNaacerNk52wcU3LTMF DoNjrJ0ml8pcw7xyT6jTlxPptcOZGYorH08ngHp07nZVC1dHtAgyghjV3Ftty+3LllXu AmUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bk9VbTH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a62be11000000b004f6ae08af0esi2315757pff.105.2022.03.04.08.14.39; Fri, 04 Mar 2022 08:14:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bk9VbTH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbiCDIGB (ORCPT + 99 others); Fri, 4 Mar 2022 03:06:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233499AbiCDIFn (ORCPT ); Fri, 4 Mar 2022 03:05:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0288515B98A for ; Fri, 4 Mar 2022 00:04:56 -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 ams.source.kernel.org (Postfix) with ESMTPS id B75CDB827A1 for ; Fri, 4 Mar 2022 08:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F6E2C340F1; Fri, 4 Mar 2022 08:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646381093; bh=l69ZdbW1Spjoj7wr618Laos+FDuTVKY39Zk8tBMS2QY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bk9VbTH2K3/BZQBDbeVDta+ZSANz6J5FDeJmGA5qGCV7nT0vqRTZ2drLlkicJeO+9 3b/4KuLwManSyKKfpUUniBQyGXlD2eOsHndEmzzPHhM1d4FubO2N1kIj9B9cjYqp0q 9auHvc05jxVOCFnCxKlDBewYT5hRlPoo0lK59VOfwbyYBRQ4hBiRBNhTuBCC8rUU10 yM1K7yuBWE1ZK1onTyLQj0kWM1xJabE4wsFKzpsqruAeQsBKmFl4zzhBkZJCHsz2XJ r85t9GC7BhiAC+HsjMcqp6ZuZymLYshpqvmYArreUGfLFu9DmwZ7i+Frs0JGEj3Vl7 o+wsezaa6h+Hw== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] helo=billy-the-mountain.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 1nQ2vj-00C9OH-1u; Fri, 04 Mar 2022 08:04:51 +0000 Date: Fri, 04 Mar 2022 08:04:48 +0000 Message-ID: <87ee3ita73.wl-maz@kernel.org> From: Marc Zyngier To: Anup Patel Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Daniel Lezcano , Atish Patra , Alistair Francis , linux-riscv , "linux-kernel@vger.kernel.org List" Subject: Re: [PATCH v4 3/6] RISC-V: Treat IPIs as normal Linux IRQs In-Reply-To: References: <20220301042722.401113-1-apatel@ventanamicro.com> <20220301042722.401113-4-apatel@ventanamicro.com> <87czj53fjq.wl-maz@kernel.org> 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 (aarch64-unknown-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.104.136.29 X-SA-Exim-Rcpt-To: anup@brainfault.org, apatel@ventanamicro.com, palmer@dabbelt.com, paul.walmsley@sifive.com, tglx@linutronix.de, daniel.lezcano@linaro.org, atishp@atishpatra.org, Alistair.Francis@wdc.com, linux-riscv@lists.infradead.org, linux-kernel@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=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Tue, 01 Mar 2022 17:40:55 +0000, Anup Patel wrote: > > On Tue, Mar 1, 2022 at 8:07 PM Marc Zyngier wrote: > > > +struct ipi_mux { > > > + struct irq_domain *domain; > > > + int parent_virq; > > > + void (*clear_ipi)(void); > > > + void (*send_ipi)(const struct cpumask *mask); > > > +}; > > > > Why do you need this in the arch code? It really looks like something > > that is irqchip specific (single IPI signal on which actual IPIs are > > overlayed). It is also something that other irqchips are already > > implementing, so there is potential for consolidation. > > I agree we can share the IPI muxing among irqchip drivers. > > I was not sure where to place this IPI muxing so I made it > RISC-V specific initially. > > Can we place a simplified IPI muxing (with no RISC-V specific > stuff) under drivers/irqchip or kernel/irq ?? We already have IPI-specific code in kernel/irq, so it should probably live there. > > > +struct irq_domain *riscv_ipi_mux_create(bool use_soft_irq, > > > + void (*clear_ipi)(void), > > > + void (*send_ipi)(const struct cpumask *mask)) > > > +{ > > > > There really shouldn't be a need for such a registration interface > > anyway (the current idiom is to allocate IPIs in the root irqchip, and > > pass them to the arch code). > > > > Why can't you model it after the existing architectures? > > I ended up with a lot of duplicate code between SBI IPI driver and > SiFive CLINT driver so I factored out the IPI muxing as separate > sources. We also have RISC-V AIA drivers using the same IPI muxing. > > If we simplify the IPI muxing and move it out of arch/riscv then > changes in this patch are straight forward to review. It isn't only about making things easier to review. It is about having consistent interfaces across architecture and reducing the amount of glue between arch code and random drivers. If there is a lot of similar code between your various irqchips, then it can be made common between the irqchips. But the interface between arch code and those should not be arch-specific. M. -- Without deviation from the norm, progress is not possible.