Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2745170rwe; Sun, 28 Aug 2022 21:50:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR4mVQCwES55AaWSzreE8rFnaKtCOB7/pP7CYnqJZJmJukY5iUSr9rj73C87sqBRAIGNmb+Y X-Received: by 2002:aa7:d995:0:b0:447:ea61:d7d8 with SMTP id u21-20020aa7d995000000b00447ea61d7d8mr10272369eds.118.1661748649338; Sun, 28 Aug 2022 21:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661748649; cv=none; d=google.com; s=arc-20160816; b=urmTrE1mS83Q02evr2Qms+4UgLOp1rii437wjcEag4443eJ+67VzL/fkdmm664vxS1 jt3DytAi2iqr3C/OqiBo5Mz/IFo0MbeTj9OHWezmbORSxxhLJa1wfj2BL3EBAYuUgGqf 3QZOBG/kAL41NmhkzHFnn2PNVu4AzEFWH2Zm4he/h+HgTsBUMW2QmMmKzlsBIYwiRW9Y SFdbeu5v43p5Gp4UHUU+NejDbKBQbFH1/jC9EqdVGoTHG44p1A5sedJCUQBF09az44V0 /ikY52BriTFamphY8NCbadLeXu/YHxosjHff5x4dpvvo7h/Udx1Jh2At/Da1zhfbuUoO RS5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Futttwn9zMBHEcnJ92xnZayzubYJ8abufQNgWkI8XL8=; b=XMJhodJqNSFUj2emOns8DKYBtmSBKn0+mxqv6Ss8nUF5i1oLogmAagK7q4Ka0vyBr6 daLvdbDaByTBgPsSMA5JkoS7ixu1RrNJgiUM3WRMcJ6rGtzg2GuFUvJD073R/Ta0E4Xs bbEPBkxClWR7l5tOxSmkd1YIdPNJOCoEfH1ig0NJVxKuGr5xxOC49K9NmQcFZB7HnV+M EochmdztpOc1vc1q5XiVFWlDdzFYrzKUyDVe6K8Wl+vgBlHjYbGwbCBrp7DbSOkQ9sSB VsjOmy5Nivd02ILzsJV5aaXY/6o/89r44jhwTjnfySCwPVFzQYMNvHT3PMUFnueJx94d wcNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b="0c4/Gwh6"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jo1-20020a170906f6c100b0073ccfb22163si5476040ejb.497.2022.08.28.21.50.23; Sun, 28 Aug 2022 21:50:49 -0700 (PDT) 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=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b="0c4/Gwh6"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229450AbiH2Enr (ORCPT + 99 others); Mon, 29 Aug 2022 00:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiH2Enp (ORCPT ); Mon, 29 Aug 2022 00:43:45 -0400 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63EAD4055A for ; Sun, 28 Aug 2022 21:43:34 -0700 (PDT) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-3378303138bso167777717b3.9 for ; Sun, 28 Aug 2022 21:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Futttwn9zMBHEcnJ92xnZayzubYJ8abufQNgWkI8XL8=; b=0c4/Gwh6P+ewGDHjeN7CKC/e3WqV0xR4+oiUAJs9snTy4zYPfeQI6XGUGL2MEeLJDv P3IZPbBZadZX6zKl0c2HiwbJbQxYre9WIhTJhS3bhfvZh7YkcQHs3ETAs0JF7Qx/r03E 7kuA2QMO2jPAtHlMYixqXt4f6QTKEqWLxNqUTprrZmaZC+wzPc1ejC0/Y4+zmy+J8cev PYW58rpTSdHfdZCWR2QfNWvdm9AjjLYCPJghY8AI9GeXw6gjxtzfa6wO23UxIRCXt5fs ADQ8iPnK6RcH8MOhmc7TUEqV8MOzoZdIrKkO2umW9LnKdBr/Nr/UxO2qYz+R7TGDp885 KAXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Futttwn9zMBHEcnJ92xnZayzubYJ8abufQNgWkI8XL8=; b=IQ1b6bncFozzqPgm2Fblqi6S4KBeKzuGkpdS66vUStgFin4GXlUBhBuGf1onhEloa5 k0DOe2GA/yVFloIoawbTvucInHlINLFDVjai2JLSPPDQYXTRKdmgqWzYBIP4jHrz+xHB pOYeoWkpKNsfLyey7t+q/VmaxHbevqcrau4mUFbGKz4J/Irj1/O2EbAuy1bWk7uNqHAA ty67wgeFSPjSJcFSS7XBg0Hb8We864OTYTvoEEmbCM5LxsnZO+vISsm1kyHC26GpqehX Ni5jcPcTn8en1kwdRmwdzvizeQ/XwwfCVbHIu0nCcauvDqHB9i2lxiupSMeVeXFIVFzy BpwA== X-Gm-Message-State: ACgBeo1DY9iQZ4pcTodvjJdKLS4df4mL0ru1ggF7hdu81hj699l2qXec PIsDZoiejVPLzn9pV5Z9pOwOiQ4uWlJemvBbAyZcYg== X-Received: by 2002:a0d:cad1:0:b0:335:8273:e9fd with SMTP id m200-20020a0dcad1000000b003358273e9fdmr8758289ywd.154.1661748213475; Sun, 28 Aug 2022 21:43:33 -0700 (PDT) MIME-Version: 1.0 References: <20220820065446.389788-1-apatel@ventanamicro.com> <20220820065446.389788-5-apatel@ventanamicro.com> <8f4ae429-0f12-2096-c07b-fe43b3abb4fe@microchip.com> <69e58f4dc2b74415a32a97998e862479@kernel.org> In-Reply-To: <69e58f4dc2b74415a32a97998e862479@kernel.org> From: Anup Patel Date: Mon, 29 Aug 2022 10:13:21 +0530 Message-ID: Subject: Re: [PATCH v8 4/7] RISC-V: Treat IPIs as normal Linux IRQs To: Marc Zyngier Cc: Conor.Dooley@microchip.com, 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, 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 Sat, Aug 27, 2022 at 12:27 AM Marc Zyngier wrote: > > On 2022-08-26 19:48, Conor.Dooley@microchip.com wrote: > > On 20/08/2022 07:54, Anup Patel wrote: > >> EXTERNAL EMAIL: Do not click links or open attachments unless you know > >> the content is safe > >> > >> Currently, the RISC-V kernel provides arch specific hooks (i.e. > >> struct riscv_ipi_ops) to register IPI handling methods. The stats > >> gathering of IPIs is also arch specific in the RISC-V kernel. > >> > >> Other architectures (such as ARM, ARM64, and MIPS) have moved away > >> from custom arch specific IPI handling methods. Currently, these > >> architectures have Linux irqchip drivers providing a range of Linux > >> IRQ numbers to be used as IPIs and IPI triggering is done using > >> generic IPI APIs. This approach allows architectures to treat IPIs > >> as normal Linux IRQs and IPI stats gathering is done by the generic > >> Linux IRQ subsystem. > >> > >> We extend the RISC-V IPI handling as-per above approach so that arch > >> specific IPI handling methods (struct riscv_ipi_ops) can be removed > >> and the IPI handling is done through the Linux IRQ subsystem. > >> > >> Signed-off-by: Anup Patel > > > >> +void riscv_ipi_set_virq_range(int virq, int nr) > >> +{ > >> + int i, err; > >> > >> - if (ops & (1 << IPI_IRQ_WORK)) { > >> - stats[IPI_IRQ_WORK]++; > >> - irq_work_run(); > >> - } > >> + if (WARN_ON(ipi_virq_base)) > >> + return; > >> > >> -#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST > >> - if (ops & (1 << IPI_TIMER)) { > >> - stats[IPI_TIMER]++; > >> - tick_receive_broadcast(); > >> - } > >> -#endif > >> - BUG_ON((ops >> IPI_MAX) != 0); > >> + WARN_ON(nr < IPI_MAX); > >> + nr_ipi = min(nr, IPI_MAX); > >> + ipi_virq_base = virq; > >> + > >> + /* Request IPIs */ > >> + for (i = 0; i < nr_ipi; i++) { > >> + err = request_percpu_irq(ipi_virq_base + i, > >> handle_IPI, > >> + "IPI", &ipi_virq_base); > > > > FWIW, ?sparse? does not like this: > > arch/riscv/kernel/smp.c:163:50: warning: incorrect type in argument 4 > > (different address spaces) > > arch/riscv/kernel/smp.c:163:50: expected void [noderef] __percpu > > *percpu_dev_id > > arch/riscv/kernel/smp.c:163:50: got int * > > Huh, well spotted. This will totally give the wrong sort of > result, as this is used as a percpu variable from the irq > core code. > > The arm64 code passes instead a pointer to the CPU number, which > is not very useful, but at least not completely wrong. > > I'm sure the RISC-V code has some sort of semi-useful data to > stuff in there instead of this. Unlike arm64, we don't have any percpu data in arch/riscv/kernel/smp.c which can be passed here. For now, I will just add dummy percpu data to make sparse happy. I hope this is okay ? Regards, Anup > > M. > -- > Jazz is not dead. It just smells funny...