Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5115385rwb; Wed, 21 Sep 2022 03:27:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ReVCegtVuU3jq/uo9WHHbhxpG4tq2SOgrrv/y1haZcWdte4fq5vz2Lm6ZQrN+DDJ7ODiV X-Received: by 2002:a17:907:2bf8:b0:770:837a:e3b8 with SMTP id gv56-20020a1709072bf800b00770837ae3b8mr19923080ejc.562.1663756058351; Wed, 21 Sep 2022 03:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663756058; cv=none; d=google.com; s=arc-20160816; b=W+ELxts9R81g9HfYBuKijTiRfxQgrTsyvgb9aqiCw/YGJ/IuqiOQzMPzaIixB8ARHV J4wIh2BErJGOpqAiwrOFjZGDvsGQvLr2s/alRxEhfGwlkB+c7g6TPh3U8wWZAlxsBNs4 km7Q0pLfxDhNmyTBZiJasmBvyj1TQQANPO7Klm0d2cFz57qklTFrjSp/AhIxgphwvTHk GnUvWTOkc7mu6oD9KiZDwmMpRPe7FbkEfmlxkbEx6rNxpW+2CNeWHV6kOz0npZ/OZLJK MX+78UoiV7MjWwdSIQjfPSVDU30kqWer8BSVoBl5WISB4LUMFGjREC9ra8RD1Knhb2jp dtEA== 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; bh=9A/p6ZkdEYO1vNEWi1IhugiWPSS0Lp7RP7GaNC2clvU=; b=Qnbyh0SfUWyKGznlJGCpGkcCWodyP5TMx1d9RxOaFm787I9rWCcunEyMwlsyThNi0N /k4DjRyzHXyDeWtLs4b3uJYwk6OJ0P3kX+rJJM9CFqiwSmHQSrEs2FnxfMplGUmz1UTe b2fHhEXXKOz05RdKDLIMnnwSYyzkdkg8R+w5x3mZwgENsgGNGuhFEXmCiAv2s0sClYN8 q5PnTItfKL1yGDGAsDUoGx0lo3ZaiZkixmLQi+gOA9yMyq4yFHka4fvYWJBWr/W95m/c NvHBUB+SP0H9RKYkPAY5BFXtPLZ/1x/UnGfSKu5SBLgrLYqMbBSnFh0hPw3bhGC5fEOj 0Bhw== ARC-Authentication-Results: i=1; mx.google.com; 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 m18-20020a509992000000b00445dfc9c0cdsi1915442edb.122.2022.09.21.03.27.12; Wed, 21 Sep 2022 03:27:38 -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; 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 S230256AbiIUKNj (ORCPT + 99 others); Wed, 21 Sep 2022 06:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231410AbiIUKNc (ORCPT ); Wed, 21 Sep 2022 06:13:32 -0400 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC357FF84; Wed, 21 Sep 2022 03:13:31 -0700 (PDT) Received: by mail-qv1-f46.google.com with SMTP id c6so4060210qvn.6; Wed, 21 Sep 2022 03:13:30 -0700 (PDT) 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:subject:date; bh=9A/p6ZkdEYO1vNEWi1IhugiWPSS0Lp7RP7GaNC2clvU=; b=K/x1XSIRZ5t+HB+JVsvkRjQDFnbL2VVu8BCx61zoQCo9Jr5r0FrejptJLoiR5WBfoq UAhGcsVqb0v+Jh5P/SB5/Rcwc9TjDT8D2OW81HdPtr+GkycB7/mLMb1vZ/u6PArztIr3 vJdaCObs36dHh2IBZU9kJauWalpQApOQn1x8YF6/obprEXf3BfUKw2EzgA6RWHJulHPn GPMcvTG6vOUBIW4pLC2s+twN/KwKCSogCpsbNR992AWAZ2/1IqhLC/VykOGtAcFI6dJe qX1cfl6KzToI79U8rkW08Eam59EuSHcqtOwzoFMs4PxFCK7ZA/S3tiPSAI4bVjf+E6G9 H1IQ== X-Gm-Message-State: ACrzQf2y+CDhv7T+Hn1nP6WMLFg2LIHl2jwj5ClDhravPZ3A41npkLk0 VDSyylRinp81q/ThJFGGzroLz9/ISgEmvEP7 X-Received: by 2002:a05:6214:5190:b0:4ad:41ed:80c7 with SMTP id kl16-20020a056214519000b004ad41ed80c7mr11741018qvb.53.1663755209954; Wed, 21 Sep 2022 03:13:29 -0700 (PDT) Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com. [209.85.219.182]) by smtp.gmail.com with ESMTPSA id fc11-20020a05622a488b00b003435bb7fe9csm1391920qtb.78.2022.09.21.03.13.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Sep 2022 03:13:29 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id a67so7350733ybb.3; Wed, 21 Sep 2022 03:13:28 -0700 (PDT) X-Received: by 2002:a25:3746:0:b0:6b1:4a12:b2d5 with SMTP id e67-20020a253746000000b006b14a12b2d5mr20690282yba.89.1663755208456; Wed, 21 Sep 2022 03:13:28 -0700 (PDT) MIME-Version: 1.0 References: <45d2e6c2-3b4b-5720-0431-002c74b1f9cc@arm.com> In-Reply-To: <45d2e6c2-3b4b-5720-0431-002c74b1f9cc@arm.com> From: Geert Uytterhoeven Date: Wed, 21 Sep 2022 12:13:17 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Similar SoCs with different CPUs and interrupt bindings To: Robin Murphy Cc: Rob Herring , Krzysztof Kozlowski , Andre Przywara , Conor Dooley , Samuel Holland , Biju Das , Chris Paterson , Atish Patra , "Lad, Prabhakar" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-riscv , Linux ARM , Linux-Renesas , Linux Kernel Mailing List , Arnd Bergmann , Olof Johansson Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 Hi Robin, On Wed, Sep 21, 2022 at 11:20 AM Robin Murphy wrote: > On 2022-09-21 08:46, Geert Uytterhoeven wrote: > > This is a topic that came up at the RISC-V BoF at Plumbers, and it was > > suggested to bring it up with you. > > > > The same SoC may be available with either RISC-V or other (e.g. ARM) CPU > > cores (an example of this are the Renesas RZ/Five and RZ/G2UL SoCs). > > To avoid duplication, we would like to have: > > - .dtsi includes .dtsi, > > - .dtsi includes .dtsi. > > > > Unfortunately RISC-V and ARM typically use different types of interrupt > > controllers, using different bindings (e.g. 2-cell vs. 3-cell), and > > possibly using different interrupt numbers. Hence the interrupt-parent > > and interrupts{-extended} properties should be different, too. > > > > Possible solutions[1]: > > 1. interrupt-map > > > > 2. Use a SOC_PERIPHERAL_IRQ() macro in interrupts properties in > > .dtsi, with > > - #define SOC_PERIPHERAL_IRQ(nr, na) nr // RISC-V > > - #define SOC_PERIPHERAL_IRQ(nr, na) GIC_SPI na // ARM > > Note that the cpp/dtc combo does not support arithmetic, so even > > the simple case where nr = 32 + na cannot be simplified. > > > > 3. Wrap inside RISCV() and ARM() macros, e.g.: > > > > RISCV(interrupts = <412 IRQ_TYPE_LEVEL_HIGH>;) > > ARM(interrupts = ;) > > > > Cfr. ARM() and THUMB() in arch/arm/include/asm/unified.h, as used > > to express the same operation using plain ARM or ARM Thumb > > instructions. > > 4. Put all the "interrupts" properties in the SoC-specific DTSI at the > same level as the interrupt controller to which they correspond. Works > out of the box with no horrible mystery macros, and is really no more or > less error-prone than any other approach. Yes, it means replicating a > bit of structure and/or having labels for everything (many of which may > be wanted anyway), but that's not necessarily a bad thing for > readability anyway. Hierarchical definitions are standard FDT practice > and should be well understood, so this is arguably the simplest and > least surprising approach :) Thanks for the suggestion! It does mean we have to update 3 .dtsi files when adding support for a new device. As long as all DT changes go through the same (soc) tree, we can easily manage the dependencies. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds