Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5088346rwb; Wed, 21 Sep 2022 03:03:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UJYZaNZQprBOk0+XOH6Qo8ZMlJJGTT1psf5fz4sGCROG0q+IchB2wZoQZQk/3l19S4Ey9 X-Received: by 2002:a17:907:628a:b0:781:bbff:1d42 with SMTP id nd10-20020a170907628a00b00781bbff1d42mr5957688ejc.375.1663754617418; Wed, 21 Sep 2022 03:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663754617; cv=none; d=google.com; s=arc-20160816; b=x5SUFnwC4zBDd/+1ph9hRpvMRnZDBj6Cay3+YGE7QagUg2nOgVsNIm78yTcOjj4Iwx QxFEbX9BFpRs9LzptGC+OW1DucbCOgrFdxgQWTiqCwTgDrAj87ZhCiEXQd0HMyLfiy2l EYTLkzhIofC4dIIUqtu4mpqMGXJVvLkE/wkuI1NfVDunnwyTwKDLAX32r5xNcYZ4Chzw 1++REHCxDa79s1mDz6b9yDVY2dH/mLMp4hIQOsEQ2EZzeB6i+7U1NkUZgYU8Z4/n/Zsx 2YyGZNyeMyGV94aLWgkL90mrO0mHM/Az91nu5+3OK+pjV5qMYIL/pJaE0iGJMwI1hGAO 5GmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=YqTVq3Vb/+5tN0J6AUUjJF+DHQfvcKvJ4feIwDG2TuE=; b=FKxv9CrWt8LlWEO2O9Npo7FzLHfbZyJf0By1m9IxxlyT8xHEPCyICWrTsEGdi/ixze rbSPxRDrIdO1NEYwjDYqYsyPrqkTv2oaEUWkmV7PVGL6byZec0zPx73+IlcmRDx/XHMH NJC0Y/l/OLFzoUhiueo3ZwjwVtviy518vlZq03137Ota3/V3rNyADn7h1wKgaVrPevMe acDu0ftpMLgzgm1Em82H/ulDBCiXgP9X0+hfye9HQMcdvGGRFhSKhMtUf8WDo48oZSzM na7fFOTFbK7JWb6oJHdC8FK9Ur9EngM/pxHuIMQaJr6eUV86tvkl8ZOLEPcd3XcLITFR yMAA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du18-20020a17090772d200b007806c7c3fb3si2390038ejc.718.2022.09.21.03.03.10; Wed, 21 Sep 2022 03:03:37 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbiIUJVp (ORCPT + 99 others); Wed, 21 Sep 2022 05:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbiIUJVU (ORCPT ); Wed, 21 Sep 2022 05:21:20 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3368E90C73; Wed, 21 Sep 2022 02:20:16 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 22BC2139F; Wed, 21 Sep 2022 02:20:23 -0700 (PDT) Received: from [10.57.18.118] (unknown [10.57.18.118]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 661D83F73D; Wed, 21 Sep 2022 02:20:14 -0700 (PDT) Message-ID: <45d2e6c2-3b4b-5720-0431-002c74b1f9cc@arm.com> Date: Wed, 21 Sep 2022 10:20:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Similar SoCs with different CPUs and interrupt bindings Content-Language: en-GB To: Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski Cc: 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 References: From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE 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 2022-09-21 08:46, Geert Uytterhoeven wrote: > Hi Rob, Krzysztof, > > 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 :) Cheers, Robin. > Personally, I'm leaning towards the third solution, as it is the most > flexible, and allows us to extend to more than 2 interrupt controllers. > > Note that this is actually not a new issue. For years, ARM SoCs have > existed with multiple types of cores on the same die, using Cortex-A > cores for the application, and Cortex-R/SuperH/V850/... cores for > real-time and/or baseband operation. So far this wasn't an issue, as > only the Cortex-A cores ran Linux, and we ignored the other cores (and > the related interrupt controllers and hierarchy) in DT. > > What do you think? > Thanks for your comments! > > [1] https://lore.kernel.org/lkml/20220815050815.22340-7-samuel@sholland.org > > 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 > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel