Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp326181imm; Thu, 6 Sep 2018 03:08:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYJ9uToGXbjzaHLA6Ki8/BDKUd6wIyvRwK/8E7zDr9mFeedslJ5QhA/A1/2j6D6Iuc0HI4B X-Received: by 2002:a17:902:8681:: with SMTP id g1-v6mr1873483plo.302.1536228511466; Thu, 06 Sep 2018 03:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536228511; cv=none; d=google.com; s=arc-20160816; b=nAz8xr52pwsDWLEX3YAoaRI5dBA/HvZt7kRIbvzsWn/Bi/oSEvGCFQmB/PhsV0vMrS zWwVoI1PT1e4M9dCLqFT46LbYw3TaILQNyqFn06+6bsNBBhVybp6GGl6SKqtBjHE5NPT s2VMhoh6FK6VWS97fqQrhoFz5D1Fe+x7N0/Ibpi+OCX8CW552XxtNjH6gI0FLdf4rUI6 KNL8p/42aUGMG0nWXwsVIobchMbHFmQnuIdmUceMBE9qkbfTSyKd7sRdOFLZu3rsHnwN Go9S6RrKsRDnNnFbqk5d1etrTqI1gwB4DkM4TUYXGP/ufmnZHQPlm/+kt4lNBU1dQLI3 XO+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=tgshcRLx1vH7kASvmQNkcvFr86xktIDrNPYWSdcQnOg=; b=wcnX+trvjL3CHCr9kHCR630xgtF3zMdooCCozQowgLx/ifFCojcW1BKjF4Q/y70VAi euSwVzGk0b/feRjIAMo2qxStp+bosAHSzw9F8VbJD4LTV2PO1rSBv/NCjA7Sx0ltpZ5m TeFu/DDBNfRz0jPSIRhNDPjRFqCaJmA1fCkO1Coxd7a5f0gxQQx/lGSfhyzcdCVlnJQY o3zk0q/D7tNmiPMSwGeehBxtJQ9A2NZiXlKlMHZLx8JZtL8i6HTImEN0D3qknpyR4NRI 5zGnitioZVSjlX7EZm0NK4ltB0i17L0iEbkw+ZU0oGuxlz6s3NjzErRh5FzVU2LvuxQR TNcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=k1lVNq1S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4-v6si4110235plo.192.2018.09.06.03.08.14; Thu, 06 Sep 2018 03:08:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=k1lVNq1S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727708AbeIFOTn (ORCPT + 99 others); Thu, 6 Sep 2018 10:19:43 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38253 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbeIFOTn (ORCPT ); Thu, 6 Sep 2018 10:19:43 -0400 Received: by mail-wm0-f67.google.com with SMTP id t25-v6so10499534wmi.3 for ; Thu, 06 Sep 2018 02:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=tgshcRLx1vH7kASvmQNkcvFr86xktIDrNPYWSdcQnOg=; b=k1lVNq1Sq6rtVmL0M4cdBYmqhH4Bjz/bw3Ma6JVgbhJIWwQYRoyWBL9bp1cdGaTWjc QG+Yh3CtqSB7KZ0pABYHBJV46dNhV3F0wOOUwBphDfx8BFQGbTKPUQs8xfpVwiMNvLfV 9Euq5Ky7hCQGz043FCIulATtR4RviieJorJL+sbT9vBH1oIAxoI3Vo3yiX4DfrCmJ4+E MZU67wcxxUBkcBgPIMNFuKqjoia1KGp7VGS+hgxGNcX95kJrL0kicpQKErOMV5GVbv07 u9PXu8EPLsAObsZV5JVFHkJlrzhdDcErm9Ol5uH7mfYNq/LM76JxKWpmLMutUrpwfpbJ suEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=tgshcRLx1vH7kASvmQNkcvFr86xktIDrNPYWSdcQnOg=; b=kkbrjVCr0xAtdDiKc9PrdgPX7V0Oj/IILQdu1vqMfM4CHYZJ8VbajHuFqQncnrIHap ioEuKs43UtGYU2MD+5asZVawD7aGniwZl5eJ+4srwzKMF/aNex2LuEjDzjhVYkxLJkVQ fWtCWqF66WDTX8tJL7PXHsmjGuO2RcO7pbT76oGqSdTCs+xnk8vMh7hd4itAZahwyGx0 Xuu6zxC3LB/a4WIXwmvMSsIJx4Zatmed2T4EaZmVuMXpq8o6Q+z9uSP+M9ZP/vNzz7hf 71Fjs14oBWt1GIGhqx06nrqTd2VHYs4Gc9Xajx2etOZeOMGVHNKw4XaYrHkwgM3E1MJT LZQw== X-Gm-Message-State: APzg51AkZLNC9QbdWhq7tR5Q9clWQ9NUCHrVxlczD5S+JRS9GK6npmxC xceuTRiG2ul2Vyo7lAo86Mk6eg== X-Received: by 2002:a1c:5dd4:: with SMTP id r203-v6mr1609766wmb.29.1536227103017; Thu, 06 Sep 2018 02:45:03 -0700 (PDT) Received: from localhost (smb-adpcdg1-01.hotspot.hub-one.net. [213.174.99.129]) by smtp.gmail.com with ESMTPSA id w17-v6sm2902418wmc.43.2018.09.06.02.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 02:45:02 -0700 (PDT) Date: Thu, 06 Sep 2018 02:45:02 -0700 (PDT) X-Google-Original-Date: Wed, 05 Sep 2018 17:58:24 PDT (-0700) Subject: Re: [PATCH] dt-bindings: riscv,cpu-intc: Cleanups from a missed review In-Reply-To: CC: atish.patra@wdc.com, linux-riscv@lists.infradead.org, mark.rutland@arm.com, devicetree@vger.kernel.org, aou@eecs.berkeley.edu, jason@lakedaemon.net, marc.zyngier@arm.com, linux-kernel@vger.kernel.org, Christoph Hellwig , merker@debian.org, tglx@linutronix.de From: Palmer Dabbelt To: robh@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Aug 2018 05:59:03 PDT (-0700), robh@kernel.org wrote: > On Mon, Aug 20, 2018 at 6:10 PM Atish Patra wrote: >> >> On 8/20/18 4:01 PM, Palmer Dabbelt wrote: >> > I managed to miss one of Rob's code reviews on the mailing list >> > . >> > The patch has already been merged, so I'm submitting a fixup. >> > >> > Sorry! >> > >> > Fixes: b67bc7cb4088 ("dt-bindings: interrupt-controller: RISC-V local interrupt controller") >> > Cc: Rob Herring >> > Cc: Christoph Hellwig >> > Cc: Karsten Merker >> > Signed-off-by: Palmer Dabbelt >> > --- >> > .../bindings/interrupt-controller/riscv,cpu-intc.txt | 14 +++++++++++--- >> > 1 file changed, 11 insertions(+), 3 deletions(-) >> > >> > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt >> > index b0a8af51c388..265b223cd978 100644 >> > --- a/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt >> > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt >> > @@ -11,7 +11,7 @@ The RISC-V supervisor ISA manual specifies three interrupt sources that are >> > attached to every HLIC: software interrupts, the timer interrupt, and external >> > interrupts. Software interrupts are used to send IPIs between cores. The >> > timer interrupt comes from an architecturally mandated real-time timer that is >> > -controller via Supervisor Binary Interface (SBI) calls and CSR reads. External >> > +controlled via Supervisor Binary Interface (SBI) calls and CSR reads. External >> > interrupts connect all other device interrupts to the HLIC, which are routed >> > via the platform-level interrupt controller (PLIC). >> > >> > @@ -25,7 +25,15 @@ in the system. >> > >> > Required properties: >> > - compatible : "riscv,cpu-intc" >> >> Since this is a fix up patch, we should update the compatible string >> with the sifive specific one as well. no? > > I think it is fine as is if my understanding is correct. Given this is > part of the RISC-V spec(s), then using 'riscv' here for riscv,cpu-intc > is fine. It was only the PLIC which didn't have any standard > definition that I had issue with. Plus, with the SoC specific string, > I'm not too worried about what the fallback is. I agree. > However, sifive,fu540-c000-cpu-intc does need to be documented. > Putting it in the example is not documenting it. Makes sense. I wrote up something quickly diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt index 265b223cd978..30c23fba9676 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt @@ -24,7 +24,14 @@ a PLIC interrupt property will typically list the HLICs for all present HARTs in the system. Required properties: -- compatible : "riscv,cpu-intc" +- compatible : should be one of + "sifive,fu540-c000-cpu-intc" + and must contain "riscv,cpu-intc". The intent here is that each + implementation of the standard RISC-V interrupt controller contains a unique + compatible string in addition to the standard string "riscv,cpu-intc". This + allows the specific implementation of the interrupt controller to be + differentiated from others in case of yet to be discovered + incompatibilities between the extant implementations. - #interrupt-cells : should be <1>. The interrupt sources are defined by the RISC-V supervisor ISA manual, with only the following three interrupts being defined for supervisor mode: but it's very much a first pass as I managed to confuse myself while writing the documentation. The central issue here is that the "riscv,cpu-intc" on the fu540-c000 is actually provided by our machine-mode firmware, so I'm not sure calling this "sifive,fu540-c000-cpu-intc" is actually the right thing to do here. It should really be called something like "ENTITY,bbl-cpu-intc-537ae11ae506" -- where that's a git hash of the BBL used, and I'm not sure what "ENTITY" should be (bbl is part of the RISC-V GitHub, but it's not part of any RISC-V spec). That naming scheme is a nightmare, though, so I don't want to suggest it :). There's then the additional wrinkle where, in the current BBL implementation, we just use the machine-mode hardware trap delegation mechanism to directly provide most of the relevant traps to Linux without actually invoking any software. As a result, that means any as-of-yet undiscovered bugs present in that particular hardware path will end up manifesting in Linux. The trouble then is that if we discover one of these bugs we'd want to fix it in the machine-mode monitor, so the actual behavior of the interrupt controller that Linux sees would end up depending on both the hardware implementation as well as the machine-mode monitor's implementation. The resulting naming scheme seems crazy. Maybe the right thing to do here is to just call this something like compatible = "sifive,fu540-c000-cpu-intc-0", "riscv,cpu-intc"; which would result in a patch that looks like diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt index 265b223cd978..36a6a06dcac4 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt @@ -24,7 +24,17 @@ a PLIC interrupt property will typically list the HLICs for all present HARTs in the system. Required properties: -- compatible : "riscv,cpu-intc" +- compatible : should be one of + "sifive,fu540-c000-cpu-intc-0" + and must contain "riscv,cpu-intc". The intent here is that each + implementation of the standard RISC-V interrupt controller contains a unique + compatible string in addition to the standard string "riscv,cpu-intc". This + allows the specific implementation of the interrupt controller to be + differentiated from others in case of yet to be discovered + incompatibilities between the extant implementations. In this case, we + indicate the exact interrupt controller implementation by providing + "fu540-c000" as the hardware implementation's identifier and "0" as the + software implementation's identifier. - #interrupt-cells : should be <1>. The interrupt sources are defined by the RISC-V supervisor ISA manual, with only the following three interrupts being defined for supervisor mode: @@ -46,7 +56,7 @@ An example device tree entry for a HLIC is show below. ... cpu1-intc: interrupt-controller { #interrupt-cells = <1>; - compatible = "sifive,fu540-c000-cpu-intc", "riscv,cpu-intc"; + compatible = "sifive,fu540-c000-cpu-intc-0", "riscv,cpu-intc"; interrupt-controller; }; }; With the idea being that at least we can figure out if we end up with a bug that can be worked around in software. > Rob Thanks for all the help!