Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4975681rwb; Wed, 21 Sep 2022 01:04:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6y57M39ZDtntP+7IH+ObY2vAvLr/v55g7vz0iPEYs3AaZ27atR9WGlPwn9ZCosLXB0fz9l X-Received: by 2002:a17:90b:3101:b0:203:776b:6494 with SMTP id gc1-20020a17090b310100b00203776b6494mr8235936pjb.43.1663747457842; Wed, 21 Sep 2022 01:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663747457; cv=none; d=google.com; s=arc-20160816; b=ycl5KzfHjjCpxfCaysTRsA6AcFx8izz8H0dDvECfVSLLxyCI1Cpo1NnxD3gtdZdcgs 39bLWpxNm1JnzABTffpEKKIx3kTiWpBkLLd04j0btxw6X1HuLT/Pv5KXjcuhbVHmSlGj Nsy4Nvs4q30ad9eulwtj8jXxmrV5dWfIoJNm3YD5owYJkgZB/BLbqTI/+8C+1iTmcvuT 59tnfu6Are9lgmZ/IG+xI8h1gKoAihAyZV+pwFza1MruqCWMyREUS9HKKqsBAdYfaGHd 4jdjCtL9SxVPWPmcGd9u2YisnYv5s10Xf80oHZRsZJ7R6NYmm8sWrSBjc77lQhClr+DO W/mg== 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:mime-version; bh=OhopKPZK57xXKGubPvCv9frnIozANjFyjeXFzVUULTY=; b=aH/uLHTdSSzDneJg8hTL78+8XypWvJh8H3H4BM1rAyDcbSpwys1OH0cwmE0fwYAhzI hcjqx6VuiZfnoANJ4XVfoJkvjB5QaP8IxMfYsH+jQL5y1mZvJNAsl2UXn+gUtVfyaPDv jRtG2AqkzymcHo7aVlc8756v2Mcpokt4DHLX9Ns6u6vWllsHU5QZwAOAxwF2hXpIn/mN IxxwA2ubOGQv2a6HDgFK6AmCj45qyECCsovI2XPqjJTLZYUhBKzhdNYOpBgXjnPYLXXh xuvIZaJElrFnr+/0QmNeYBvijsf8IASkPfBf7xzWbnYExVf9qEftK0PpncFJIo/smtys T3/Q== 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 k13-20020a170902c40d00b00178276c2e35si2561740plk.38.2022.09.21.01.04.05; Wed, 21 Sep 2022 01:04:17 -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 S230149AbiIUHqv (ORCPT + 99 others); Wed, 21 Sep 2022 03:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbiIUHqs (ORCPT ); Wed, 21 Sep 2022 03:46:48 -0400 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C39EF77EB2; Wed, 21 Sep 2022 00:46:47 -0700 (PDT) Received: by mail-qt1-f175.google.com with SMTP id c11so3502740qtw.8; Wed, 21 Sep 2022 00:46:47 -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:mime-version:x-gm-message-state :from:to:cc:subject:date; bh=OhopKPZK57xXKGubPvCv9frnIozANjFyjeXFzVUULTY=; b=5Bl0Ov3ZE4I6E0b288w9kl81HA7PP+/Qmmzk7ZvIlRHkZNwIPVjPGyOI0eCEL4xIuO Ymozpe/dcnEiQMZuSeD+jJNGpuBPbLtjtkfwoFvBg1cjHPo3Xr/3Y2SQK3vDKalJGaGI obQrOLSV1z9F1RrqfXkEWN9yu5nX+ep65XT6BvR3VTq64gaF89ur6ixKVVwTLoOLUI/2 45mJyWZOEDJr2msm9A8n+pC6v2iw8rjWHO0KdEsHM61tW6gb+kvlbWHU2Pew5usQJ8rk zp0jwPhOQlWQiB4XYePkqMekZ/g22cEgo4MpZQVhYJOb3cBMIRlZ8mW5gsFCVTve3Xnw /QKg== X-Gm-Message-State: ACrzQf2gL/qUfOwLpgteco+d4AVJrxEs8vO4SZuJy+9Nj3fLOmgSMXqy Uex+BSsWmNbXFu3oyNLX+TyYttvDkYV4Eg== X-Received: by 2002:ac8:5d49:0:b0:35c:e066:b972 with SMTP id g9-20020ac85d49000000b0035ce066b972mr15221455qtx.303.1663746406583; Wed, 21 Sep 2022 00:46:46 -0700 (PDT) Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com. [209.85.128.172]) by smtp.gmail.com with ESMTPSA id v6-20020a05620a0f0600b006bc0980db76sm1485535qkl.126.2022.09.21.00.46.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Sep 2022 00:46:45 -0700 (PDT) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-3454b0b1b6dso54712427b3.4; Wed, 21 Sep 2022 00:46:45 -0700 (PDT) X-Received: by 2002:a81:8d3:0:b0:34d:1215:fb4b with SMTP id 202-20020a8108d3000000b0034d1215fb4bmr10409981ywi.383.1663746405180; Wed, 21 Sep 2022 00:46:45 -0700 (PDT) MIME-Version: 1.0 From: Geert Uytterhoeven Date: Wed, 21 Sep 2022 09:46:34 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Similar SoCs with different CPUs and interrupt bindings To: 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 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 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. 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