Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp74652iof; Sun, 5 Jun 2022 21:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQOOGZbKPw8P08WjcHp3JvhlVom8p43ngR4IGtjZVOcu7t2GInT0Wec3nHbDdnrtr47U4e X-Received: by 2002:a17:903:240e:b0:158:eab9:2662 with SMTP id e14-20020a170903240e00b00158eab92662mr22106940plo.87.1654490045841; Sun, 05 Jun 2022 21:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654490045; cv=none; d=google.com; s=arc-20160816; b=rUSxQr98wMNYWL221ISqDURQr0cv8ZsWNaBXDOezdFxi7UnA1wA42PCZnqAuSGe+6u V6rsg00VM+F0D/nGr+oa+n8mPBf8m4ulSZtbEH2YAuWkQ9pK/yE9UoGp01htb+oqOZZ1 pK46ZXnHzO+/XRTVXQ1UyvM2H5Hg8s/PH0Sno0Z3O19fU/GVrtrGP7wTMKtlr7310ehy HOh18YnunR+AhlT5bDKIru5KqZIfDcXLqsV9YGMRggfoVPvbJ8PEJ0E7aeL3FyDt2piE 0ZEumuSPM78HjtoKpfzc391oZZy86qHLMLSmFobBtZ5w31ufHkIGEl+MA37ASfit8vzX xQeQ== 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=QSwdtV/PVH07JigHSg97mnOtznNXZtjZyW/IYbxLV/0=; b=zGYjvESe2KwZ4qUwJq97A8qltAS02ZtPFqGnxoLSOrKBmeDwsue3tA7nmxesOzC40Y Bi13Z1hTr6chiQ+cQMRCGi9GRqNQYbTO+7G7Umhd54iR/JexHZ6Y40OXlUQRiHAFffjr F7AX7uwWLM+Agp/3efjwp7x5bdhE58lPIozskurAElG+JZqkoTVNy+b9nIyL8+BhNQ4/ wuRGHf84r7Qmj9F9KN1p6dFKqBYTVYKj5M8Zs/UpAgbxhmfIx4cE2APBo6rxFR4x+AlZ Dho8GP17m6PTtw8kDRHgnXqT2SXZ2h1SDJSho40F3Mh6cIJU60liL/gbgATUNAyVU4u2 hUog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BhnMcK50; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u10-20020a170902e80a00b00153b2d165d8si21143792plg.480.2022.06.05.21.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:34:05 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=BhnMcK50; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1468E5A095; Sun, 5 Jun 2022 20:59:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245651AbiFEMDU (ORCPT + 99 others); Sun, 5 Jun 2022 08:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232695AbiFEMDQ (ORCPT ); Sun, 5 Jun 2022 08:03:16 -0400 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7988830554 for ; Sun, 5 Jun 2022 05:03:14 -0700 (PDT) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-30fdbe7467cso84916477b3.1 for ; Sun, 05 Jun 2022 05:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QSwdtV/PVH07JigHSg97mnOtznNXZtjZyW/IYbxLV/0=; b=BhnMcK50biuVGP9bh6TQK14ZLbsMBFOTlgkmqqrYgBRV7bfy1aweI9b4VWfU8RRTc1 u7hqO1dYLSg3vBzhGcQfad7HkcUR/Y/foupxT3ePcHDQ683fkvykk7U7WU0b6QGRhfmh ORMEhYUVbKnh6B6sSQ9JIxHrC9mqX7VLPIOZ/qr3IvpnnHlNyO5Fofn1WdCGE+rMjR3/ wNKxynAgANtqvMeCpo+Cn4sG+YI8p+m+hUEv7pwLiINwUE3IFU3r3AgRJ78BFXAt/jnV OI/JgtlBHKMlgGhrntrC5Aml2hHoXCQlUsBE5vnaB6HY9Gns5U2iuy6vs/SlH4TVJ9XF zO2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QSwdtV/PVH07JigHSg97mnOtznNXZtjZyW/IYbxLV/0=; b=qaLzZ+NHyir88pvrtZ8V/ZOVtIr6AJR3vt89VIr/zjcKO7f1L3nhkTo637z/n3uQOc jnesiDBbaJFAQ7JPGWaT6wMs3XTJOOe+qK2SiNUvweWYw9qr0tkurx7EkmGLXSJBnaRY aoE7je03dERF3toYBPpX6kcSwHPqQEQgRbds4SbwHTJYgxxcCRuwAsDYFr30EOmL52FZ JakCMcI3tEt/VsFubjt8UpxqxcvqfmDjuuCmos2tHYnLpgxlkoY2RKjWR9vukNGrkclx XaudTpaOlTpfNLeLTUdfxexhPAcTY4TPAUQV3CinN9q/Qzhmwvq3/HxNBUAv8V/Rmq8g AQsA== X-Gm-Message-State: AOAM53368+zPzU9ATXkzNkIAxNRjlwJ22sZQ0fpmbsNMmssrDMBIOdra KWjSasAOqtU7pKRPEu6n2YaHyrurn83DmojSrIo= X-Received: by 2002:a0d:d689:0:b0:30c:21df:a2e7 with SMTP id y131-20020a0dd689000000b0030c21dfa2e7mr20498015ywd.421.1654430593704; Sun, 05 Jun 2022 05:03:13 -0700 (PDT) MIME-Version: 1.0 References: <35f95ba3-8a7b-7918-0f9d-e14274a5ffe9@arm.com> <87ee0gn5rq.wl-maz@kernel.org> <20220530084039.7rjjbm4gkplg5747@maple.lan> In-Reply-To: <20220530084039.7rjjbm4gkplg5747@maple.lan> From: richard clark Date: Sun, 5 Jun 2022 20:03:02 +0800 Message-ID: Subject: Re: Question about SPIs' interrupt trigger type restrictions To: Daniel Thompson Cc: Marc Zyngier , Robin Murphy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, s32@nxp.com, leoyang.li@nxp.com, catalin-dan.udma@nxp.com, bogdan.hamciuc@nxp.com, bogdan.folea@nxp.com, ciprianmarian.costea@nxp.com, radu-nicolae.pirea@nxp.com, ghennadi.procopciuc@nxp.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, May 30, 2022 at 4:40 PM Daniel Thompson wrote: > > On Thu, May 26, 2022 at 08:09:32PM +0800, richard clark wrote: > > CC'ing some nxp guys for the S32G274A SOC... > > > > On Thu, May 26, 2022 at 2:54 PM Marc Zyngier wrote: > > > richard clark wrote: > > > > On Thu, May 26, 2022 at 3:14 AM Robin Murphy wrote: > > > > > On 2022-05-25 11:01, richard clark wrote: > > > From the GIC500 r1p1 TRM, page 2-8: > > > > > > > > > SPIs are generated either by wire inputs or by writes to the AXI4 > > > slave programming interface. The GIC-500 can support up to 960 SPIs > > > corresponding to the external spi[991:32] signal. The number of SPIs > > > available depends on the implemented configuration. The permitted > > > values are 32-960, in steps of 32. The first SPI has an ID number of > > > 32. You can configure whether each SPI is triggered on a rising edge > > > or is active-HIGH level-sensitive. > > > > > > > > > So I have no idea what you are talking about, but you definitely have > > > the wrong end of the stick. Both the architecture and the > > > implementations are aligned with what the GIC drivers do. > > > > What I am talking about is - The SPI is triggered on a rising edge > > only, while the falling edge is not as the document says. But I've > > observed the falling edge does trigger the SPI interrupt on my > > platform (the SOC is NXP S32G274A, an external wakeup signal with high > > to low transition to wake up the SOC - 'Wakeup/Interrupt Rising-Edge > > Event Enable Register (WIREER)' and 'Wakeup/Interrupt Falling-Edge > > Event Enable Register (WIFEER)', WIFEER set 1 and WIREER set 0 > > works). > > > > I don't know why the GIC has such a behavior and what the subtle > > rationale is behind this, so just mark this as a record... > > Are you really describing the GIC behaviour here? It sounds like you are > describing the behaviour of the Wakeup Unit. Definitely it's behavior of GIC, not WKPU's > > The SPI that goes to the GIC is the *output* of the WKPU. However the > registers you mention above all control edge detection at the input to > the WKPU. If so, the kernel would need an WKPU irqchip driver in order > to manage the trigger mode registers above (and to clear them). > external wakeup signal has a transition from High to Low to the SOC, then output of WIREER (rising detect) or WIFEER(falling detect) to generate INTID to the GIC, you have to enable WIFEER to generate the IRQ signal to the GIC which is also an evidence that the external wakup is falling edge. With this clear *falling edge*, I have to write the below irq_request code as: request_irq(50, wkup12_interrupt, IRQ_TYPE_EDGE_RISING...) IMO, this is very weird because the wakeup signal is falling edge from the point of SOC/GIC side, but I have to name it as *IRQ_TYPE_EDGE_RISING*, but it works just to pass the sanity check(although I think which is not necessary as the fact shows) > > Daniel. > > > PS I can't find any sign of a WKPU driver in the mainline kernel and > AFAICT this would make wake up sources unusable. What kernel have > you been running your experiments on? 5.10.44- BSP code from NXP: https://source.codeaurora.org/external/autobsps32/linux