Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3842282rdg; Wed, 18 Oct 2023 07:36:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHl/cNg1p7ETh4gLEkctuxJ9+hZENPwBAnp/OMAc24knBMITuDyDgSDdP2uLjK3o0gLs3df X-Received: by 2002:a17:902:c40a:b0:1c3:ed30:ce0a with SMTP id k10-20020a170902c40a00b001c3ed30ce0amr6966632plk.19.1697639770294; Wed, 18 Oct 2023 07:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697639770; cv=none; d=google.com; s=arc-20160816; b=hghCdzVqs11MPkeG9K4DXXMvD29Y1/4EVjITI+uzpKOmca5ODopir5l+Jqd9qb3ZG3 asLn9TjQEnva6M/zF1SYMIIXz8MV2UNulaHyOvd3LTy6irdbSgt3OT1bMqQW45bZ2EVX P7ksASrz53MiA9KninHRTJiKaCFxeSlvnrpN3ci5Lr7d/x7QRHL45Ybr9bzOYF4UQq4I xS0lczY663kRHJIwafAXdkQwumTo7ytz3LlcdjI8Hjd5E1FD0p/dk5b14pZnT4u19Dm9 bx/Hzj3L1enRCc5wRlc3SRV02Ia21h4Zgn5jx22rfq9OtWboh+LqfTIMaH+bzYygOZze eQSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Z+Dln0z9M9W1+KYMWCUczs9eySIqJQ3jdJ2j7CGXCXc=; fh=0VN+LE45o2P1GwOH1b9e/2IgLPQeN8q16KCeWNAFjVk=; b=m/5Dor5oQXXx/FUFKsGd9ZiT1kwixdY5wuLqLEQ/lVmOcXm74diMqPQuEVC5RLg1id OiOgQZsPnClaVMih3y4XOXWY2scNqEG5ehBPcDW+YYOKovsWBZbcxHQe4VbRJAnV9f+r UkahikKcmfuH4VuMlCFRt5qLJdVwNb0qVMYCMxjUHVUZ64x+VoRSzZCvKlvfeBGPCXkm 6LmPZpep/mhW9GAyob16HzWVNlv4zQjSvmiqhcso/GTcxwidXuk17Mrxv2h1ehzNnPzK c4o7T5HBHFnE0Ktm2tYFSGa3Otb2BnyBTe4Es3YtqCBax2mMlSVkD8PoW8v4Za87hNaQ uncQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pnKaJobV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id m4-20020a170902db0400b001c7345bc01csi4584718plx.450.2023.10.18.07.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pnKaJobV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 494C4807933D; Wed, 18 Oct 2023 07:36:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345676AbjJROft (ORCPT + 99 others); Wed, 18 Oct 2023 10:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345558AbjJROfV (ORCPT ); Wed, 18 Oct 2023 10:35:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 017C5D72; Wed, 18 Oct 2023 07:33:46 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90C36C433CA; Wed, 18 Oct 2023 14:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697639626; bh=cLipz8J6oEmh+ml1rc21wOF53zzsI1dKLbu6UdJUPAE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pnKaJobVr1K8TrLoPMWwbp4EU6l54jpXaiZ3WiRMftDNOtS4Vc+7wQ2K1bm6VkpmV jo9kOetAQE1csLrFm64M8g0krD5DLQzJgSyY3RL6fgeni9HKZm0yVb3tcHXyz8f4cw zS7XlD8fUCBr0/K1hZvXc+X1mAa9EwYp86KIdWmJm51Ag5uINuVyU+tjRdzTh87qc4 aea12HuAHGtTF/UV4GfwhiSOncFEcyP3LaV/fJiJq4WFBot6H8KVWx0iorXTtDQCxG LEG2HuuyhrH1QIAN4xlbf/255CE9UwdD5BOtXcY8MZ8+vhXWqrQAr49MEO4+6VN0sk FuV250BtzoC4A== Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-9b96c3b4be4so1085641366b.1; Wed, 18 Oct 2023 07:33:46 -0700 (PDT) X-Gm-Message-State: AOJu0Yyd9UupN1qOjKcg1ZiktEc0ukEG8Qweb2dhyb211C7JKVq4izLK K2Sn6gLY7GCeQa5LfobX8Fy6aueUM1k4VFVevvA= X-Received: by 2002:a17:906:fd84:b0:9be:fc31:8cd4 with SMTP id xa4-20020a170906fd8400b009befc318cd4mr4906580ejb.18.1697639624987; Wed, 18 Oct 2023 07:33:44 -0700 (PDT) MIME-Version: 1.0 References: <20230821061315.3416836-1-zhoubinbin@loongson.cn> <6ba31912-6738-6156-d5f4-3c8d3a3ca7bc@linaro.org> <86wmxcejav.wl-maz@kernel.org> <86pm2ye2si.wl-maz@kernel.org> In-Reply-To: From: Huacai Chen Date: Wed, 18 Oct 2023 22:33:32 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] dt-bindings: interrupt-controller: loongson,liointc: Fix warnings about liointc-2.0 To: Jonas Gorski Cc: Binbin Zhou , Marc Zyngier , Jiaxun Yang , Krzysztof Kozlowski , Binbin Zhou , Huacai Chen , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , loongson-kernel@lists.loongnix.cn, devicetree@vger.kernel.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, diasyzhang@tencent.com, linux-kernel@vger.kernel.org, frowand.list@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:36:06 -0700 (PDT) Hi, Jonas, On Wed, Oct 18, 2023 at 5:38=E2=80=AFPM Jonas Gorski wrote: > > On Wed, 18 Oct 2023 at 08:58, Binbin Zhou wrote: > > > > On Tue, Oct 17, 2023 at 9:05=E2=80=AFPM Jonas Gorski wrote: > > > > > > On Mon, 16 Oct 2023 at 13:26, Binbin Zhou wr= ote: > > > > > > > > Hi all: > > > > > > > > Sorry, it's been a while since the last discussion. > > > > > > > > Previously, Krzysztof suggested using the standard "interrupt-map" > > > > attribute instead of the "loongson,parent_int_map" attribute, which= I > > > > tried to implement, but the downside of this approach seems to be > > > > obvious. > > > > > > > > First of all, let me explain again the interrupt routing of the > > > > loongson liointc. > > > > For example, the Loongson-2K1000 has 64 interrupt sources, each wit= h > > > > the following 8-bit interrupt routing registers (main regs attribut= e > > > > in dts): > > > > > > > > +----+-------------------------------------------------------------= ------+ > > > > | bit | description > > > > | > > > > +----+-------------------------------------------------------------= ------+ > > > > | 3:0 | Processor core to route = | > > > > | 7:4 | Routed processor core interrupt pins (INT0--INT3) | > > > > +-----+------------------------------------------------------------= ------+ > > > > > > > > The "loongson,parent_int_map" attribute is to describe the routed > > > > interrupt pins to cpuintc. > > > > > > > > However, the "interrupt-map" attribute is not supposed to be used f= or > > > > interrupt controller in the normal case. Though since commit > > > > 041284181226 ("of/irq: Allow matching of an interrupt-map local to = an > > > > interrupt controller"), the "interrupt-map" attribute can be used i= n > > > > interrupt controller nodes. Some interrupt controllers were found n= ot > > > > to work properly later, so in commit de4adddcbcc2 ("of/irq: Add a > > > > quirk for controllers with their own definition of interrupt-map"),= a > > > > quirk was added for these interrupt controllers. As we can see from > > > > the commit message, this is a bad solution in itself. > > > > > > > > Similarly, if we choose to use the "interrupt-map" attribute in the > > > > interrupt controller, we have to use this unfriendly solution (quir= k). > > > > Because we hope of_irq_parse_raw() stops at the liointc level rathe= r > > > > than goto its parent level. > > > > > > > > So, I don't think it's a good choice to use a bad solution as a rep= lacement. > > > > > > > > Do you have any other ideas? > > > > > > Assuming this is changeable at runtime, this sounds to me like this > > > mapping/routing could easily be exposed as irqchip cpu affinity. Then > > > userspace can apply all the performance optimizations it wants (and > > > can easily update them without fiddling with the kernel/dts). > > > > > > And then there would be no need to hardcode/describe it in the dts(i)= at all. > > > > Hi Jonas: > > > > Thanks for your reply. > > > > It is possible that my non-detailed explanation caused your misundersta= nding. > > Allow me to explain again about the interrupt routing register above, > > which we know is divided into two parts: > > > > +----+-----------------------------------------------------------------= --+ > > | bit | description | > > +----+-----------------------------------------------------------------= --+ > > | 3:0 | Processor core to route = | > > | 7:4 | Routed processor core interrupt pins (INT0--INT3) | > > +-----+----------------------------------------------------------------= --+ > > > > The first part "processor core" will be set to "boot_cpu_id" in the > > driver, which we assume is fixed and we don't need to care about it > > here. > > What we care about is the second part "mapping of device interrupts to > > processor interrupt pins", which is what we want to describe in > > dts(i). > > > > Let's take the Loongson-2K1000 as an example again, it has 64 > > interrupt sources as inputs and 4 processor core interrupt pins as > > outputs. > > The sketch is shown below: > > > > Device Interrupts Interrupt Pins > > +-------------+ > > 0---->| |--> INT0 > > ... | Mapping |--> INT1 > > ... | |--> INT2 > > 63--->| |--> INT3 > > +-------------+ > > > > Therefore, this mapping relationship cannot be changed at runtime and > > needs to be hardcoded/described in dts(i). > > But that's only a driver/description limitation, not an actual > physical limitation, right? In theory you could reroute them as much > as you want as long as you keep the kernel up-to-date about the > current routing (via whatever means). > > Anyway, I guess you want to use the routed interrupt pin to identify > different irq controller blocks. > > Can't the interrupt pin be inferred from the parent interrupt? If your > parent (hw) irq is two, route everything to INT0 etc? Or alternatively > use the name of the parent interrupt? Let me make things clear and ignore those irrelevant information. 1, Our liointc controller has 32 inputs from downstream interrupt sources and 4 outputs to the parent irqchip, the "routing" here means which input go to which output. 2, We use 'parent_int_map' to describe the boot-time routing in dts previously, but Krzysztof suggests us to use 'interrupt-map' instead. 3, When we rework our driver to use 'interrupt-map', we found that this property is not supposed to be used in a regular irqchip (it is usually used in a pcie port which is also act as an irqchip). 4, If we still want to use 'interrupt-map' to describe the routing in liointc, we should make of_irq_parse_raw() stop at the liointc level rather than go to its parent level, because the hwirq is provided by liointc, not its parent. To archive this goal, we should add liointc to the quirk list. 5, So, for our liointc driver we have two choices: 1) still use the 'parent_int_map' property; 2) use 'interrupt-map' property and add liointc to the quirk list. We prefer the first ourselves, but Krzysztof may give us a best solution. Huacai > > Best Regards, > Jonas