Message ID | 20221111044207.1478350-7-apatel@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp540900wru; Thu, 10 Nov 2022 20:49:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6IiLWYdV1liU2b1KFzrQLd6U4ozicPKjHCAax45J+tvzfw6O0SfBifZ4q7PAWdlnVQ5A3S X-Received: by 2002:a17:906:4f85:b0:7ae:c1b2:d912 with SMTP id o5-20020a1709064f8500b007aec1b2d912mr493717eju.577.1668142167905; Thu, 10 Nov 2022 20:49:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668142167; cv=none; d=google.com; s=arc-20160816; b=CTXT7IpGIrr/2+r2gBejP1xGpjYUW+LbraclLgrlf9mYuOIhVSWmqei3BL3kgLEjrb S0pglr3ex0CL2IZ/YI7HKDz2UaE4zPR05JXYhRMLqKJugyKnC9g3rMwvrErYKevaKse7 5awC2FKcafx6/pTLheicQxmqj8kVDCsdrxYERgpDl+/9gaQGLOeiIN6ScxlmSaEqxyNs 6XdX7cNCg9lu2NAGo0UV77toEhTQerxyiSWU/rr9FPNHSTI4nlSclIL46dtGKOfwlRvS tpy7pE4LkVLdwNDLd8lTis04S/+oSmAz9RJil8eHbByFxYzxdZ3XcDzMRAe5HkZj+7VI Aiwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=88dbZKnLEUx7Ht3ijEWLgxbktVAqIkhhdLqR4LLY0Pg=; b=BGBpua6sGLMcUJ5G/Tu/A2/Png6pIGM791z6rwKriMOgWEM38GUw3ht/lr8Uwp3s5I HQv20JG7ulYoBlP3BGXANzl8QibeETjrYd228qQMI38Iaj1961n8i0AS11Kim2s+CSMG eCS4aTTXjoidig3T2INiFDYu5vldXSSOEkBatXx7esJTu0SDsZEKuK11P4h+yR+YrqeL hZYnpWDGcvXJ9Me2a/T5CB7TcxWN+Iqoqf5jx9W2VAYU+vDLUEbnDemm2v0NgM5uCxcG DZOEejo7rb1d26w5JdIJGaXsh0vAjHgKVidb1/msjE38KU3isenf3pb6uybhL3dUFWcp WekQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=bv6ABeD0; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a42-20020a509ead000000b0045cd50b7c65si1250338edf.266.2022.11.10.20.49.03; Thu, 10 Nov 2022 20:49:27 -0800 (PST) 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; dkim=pass header.i=@ventanamicro.com header.s=google header.b=bv6ABeD0; 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 S232913AbiKKEoo (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Thu, 10 Nov 2022 23:44:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232905AbiKKEnt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 10 Nov 2022 23:43:49 -0500 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665D06AEDD for <linux-kernel@vger.kernel.org>; Thu, 10 Nov 2022 20:43:19 -0800 (PST) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-13ba86b5ac0so4408313fac.1 for <linux-kernel@vger.kernel.org>; Thu, 10 Nov 2022 20:43:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=88dbZKnLEUx7Ht3ijEWLgxbktVAqIkhhdLqR4LLY0Pg=; b=bv6ABeD0FMYwosnkSOwSDcCdQ0TnBV/dnIsn2N7jCXZAmg2jAQy6p247q6+2vaHGZw vOGbJQZ+584D2/VmgsF1o+w17/Xybk9XUDhXqKyH71c9F8kK5bjjbG4wguGyWTFO774j 2s1RnnOwx7aGHKfuKC8002TnsCQao6J/S8GVHcd8d3MiSN1NcJ+6qKhpYaf3B4tU/Yfk bW80dr0z2Dume1ve0WXk1Kj+8DuahSjIcX7S/1wfLz/fl9UNRBZ2X1u/N3JvCEuMoCgm UweVvUYWIR5EKPyJId6E2EisaZhpDSOKXjRBN9tNaWQMNmxzhAXP4vTkHu73hEA5bzxk RAZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=88dbZKnLEUx7Ht3ijEWLgxbktVAqIkhhdLqR4LLY0Pg=; b=I/1X8mXWusPtKm/BQFrXwZXkhFBFkFMi1EPAtf7nZ+W8nS+8MhyQIalC6BD6Y9F94J AITFpEIShAFmBt8e79P5GSwtgd5/72g0DShliNgs542qwitH5VaGBP0Bhh43E1jIlPCl CRfkDEQDBDwNVhDhpNstkpDWxDs1SpjcZCHdAOJhiK5MWQsxai8lDOq5WAjttC25ESIv 0Z02nBRJO05RvZG+7vVDqzRCI1DsTuGQqWj2gSTNCbksJHIP7vBrdBripPNvynOBWvcx /8m8hPStNoW2wKRxdDElP14oRAsRQ0y4/cd9teIqEWatKDFA4wLQroLQdESywgDDtgfC 0k7g== X-Gm-Message-State: ANoB5pnIPU1dZ+x1hYB8PbHYszc4u7jOLO+m2emM0TSYXZepn3FNV9q+ y3i5h4Xx36Owja0OVIMzQiL7FQ== X-Received: by 2002:a05:6870:b01f:b0:13b:2f1f:8327 with SMTP id y31-20020a056870b01f00b0013b2f1f8327mr30099oae.15.1668141797235; Thu, 10 Nov 2022 20:43:17 -0800 (PST) Received: from anup-ubuntu64-vm.. ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id k14-20020a056870350e00b0013d9bd4ad2esm787353oah.12.2022.11.10.20.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 20:43:17 -0800 (PST) From: Anup Patel <apatel@ventanamicro.com> To: Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <maz@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: Atish Patra <atishp@atishpatra.org>, Alistair Francis <Alistair.Francis@wdc.com>, Anup Patel <anup@brainfault.org>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel <apatel@ventanamicro.com> Subject: [PATCH 6/9] dt-bindings: Add RISC-V advanced PLIC bindings Date: Fri, 11 Nov 2022 10:12:04 +0530 Message-Id: <20221111044207.1478350-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221111044207.1478350-1-apatel@ventanamicro.com> References: <20221111044207.1478350-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749173842011926488?= X-GMAIL-MSGID: =?utf-8?q?1749173842011926488?= |
Series |
Linux RISC-V AIA Support
|
|
Commit Message
Anup Patel
Nov. 11, 2022, 4:42 a.m. UTC
We add DT bindings document for RISC-V advanced platform level interrupt
controller (APLIC) defined by the RISC-V advanced interrupt architecture
(AIA) specification.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
.../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++
1 file changed, 136 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml
Comments
Hey Anup, Ditto the $subject nit here. On Fri, Nov 11, 2022 at 10:12:04AM +0530, Anup Patel wrote: > We add DT bindings document for RISC-V advanced platform level interrupt > controller (APLIC) defined by the RISC-V advanced interrupt architecture > (AIA) specification. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > .../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++ > 1 file changed, 136 insertions(+) > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > new file mode 100644 > index 000000000000..0aa48571f3bc > --- /dev/null > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > @@ -0,0 +1,136 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) Typo: Advanced > + > +maintainers: > + - Anup Patel <anup@brainfault.org> > + > +description: > + The RISC-V advanced interrupt architecture (AIA) defines advanced platform ^ Missing an article here? > + level interrupt controller (APLIC) for handling wired interrupts in a > + RISC-V platform. The RISC-V AIA specification can be found at > + https://github.com/riscv/riscv-aia. > + > + The RISC-V APLIC is implemented as hierarchical APLIC domains where all > + interrupt sources connect to the root domain which can further delegate > + interrupts to child domains. We have one device tree node for each APLIC While I am nitpicking, s/We have/There is/ ? > + domain. > + > +allOf: > + - $ref: /schemas/interrupt-controller.yaml# > + > +properties: > + compatible: > + items: > + - enum: > + - vendor,chip-aplic Same comment here about the validity of this placeholder. > + - const: riscv,aplic > + > + reg: > + maxItems: 1 > + > + interrupt-controller: true > + > + "#interrupt-cells": > + const: 2 > + > + interrupts-extended: > + minItems: 1 > + maxItems: 16384 > + description: > + The presence of this property implies that given APLIC domain directly ^ Missing indefinite article here (and in msi-parent)? > + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each > + node pointed to should be a riscv,cpu-intc node, which has a riscv node > + (i.e. RISC-V HART) as parent. > + > + msi-parent: > + description: > + The presence of this property implies that given APLIC domain forwards > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > + controller (IMSIC). This property should be considered only when the > + interrupts-extended property is absent. This mutual exclusion can be represented, can't it? IIRC it is some sort of oneOf thing, somewhat like below: oneOf: - required: - msi-parent - required: - interrupts-extended AFAIR from doing the i2c ocores binding, this will force the addition of one, but not both, to a node. Or is this not actually mutually exclusive & the msi-parent property is permitted but just left unused if interrupts-extended is present? > + riscv,num-sources: > + $ref: "/schemas/types.yaml#/definitions/uint32" > + minimum: 1 > + maximum: 1023 > + description: > + Specifies how many wired interrupts are supported by this APLIC domain. > + > + riscv,children: > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > + minItems: 1 > + maxItems: 1024 > + description: > + This property represents a list of child APLIC domains for the given > + APLIC domain. Each child APLIC domain is assigned child index in > + increasing order with the first child APLIC domain assigned child > + index 0. The APLIC domain child index is used by firmware to delegate > + interrupts from the given APLIC domain to a particular child APLIC > + domain. > + > + riscv,delegate: > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > + minItems: 1 > + maxItems: 1024 > + description: > + This property represents a interrupt delegation list where each entry > + is a triple consisting of child APLIC domain phandle, first interrupt > + number, and last interrupt number. The firmware will configure interrupt > + delegation registers based on interrupt delegation list. What is the inter dependence of the children and delegate? Is it valid to have a delegate property without children? Can the firmware delegate interrupts without the delegation list, based on the children property alone? Or is it effectively useless without a children property? In your examples, the second has msi-parent but neither of these custom properties. Do the children/delegate properties have a meaning in the msi-parent case? I think the binding should enforce whatever dependency exists there. Thanks, Conor. > + > +additionalProperties: false > + > +required: > + - compatible > + - reg > + - interrupt-controller > + - "#interrupt-cells" > + - riscv,num-sources > + > +examples: > + - | > + // Example 1 (APIC domain directly injecting interrupt to HARTs): > + > + aplic0: interrupt-controller@c000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + interrupts-extended = <&cpu1_intc 11>, > + <&cpu2_intc 11>, > + <&cpu3_intc 11>, > + <&cpu4_intc 11>; > + reg = <0xc000000 0x4080>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + riscv,children = <&aplic1>; > + riscv,delegate = <&aplic1 1 63>; > + }; > + > + aplic1: interrupt-controller@d000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + interrupts-extended = <&cpu1_intc 9>, > + <&cpu2_intc 9>, > + <&cpu3_intc 9>, > + <&cpu4_intc 9>; > + reg = <0xd000000 0x4080>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + }; > + > + - | > + // Example 2 (APIC domain forwarding interrupts as MSIs): > + > + interrupt-controller@d000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + msi-parent = <&imsics>; > + reg = <0xd000000 0x4000>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + }; > +... > -- > 2.34.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On 11/11/2022 05:42, Anup Patel wrote: > We add DT bindings document for RISC-V advanced platform level interrupt > controller (APLIC) defined by the RISC-V advanced interrupt architecture > (AIA) specification. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > .../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++ > 1 file changed, 136 insertions(+) > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > new file mode 100644 > index 000000000000..0aa48571f3bc > --- /dev/null > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > @@ -0,0 +1,136 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) > + > +maintainers: > + - Anup Patel <anup@brainfault.org> > + > +description: > + The RISC-V advanced interrupt architecture (AIA) defines advanced platform > + level interrupt controller (APLIC) for handling wired interrupts in a > + RISC-V platform. The RISC-V AIA specification can be found at > + https://github.com/riscv/riscv-aia. > + > + The RISC-V APLIC is implemented as hierarchical APLIC domains where all > + interrupt sources connect to the root domain which can further delegate > + interrupts to child domains. We have one device tree node for each APLIC > + domain. > + > +allOf: > + - $ref: /schemas/interrupt-controller.yaml# > + > +properties: > + compatible: > + items: > + - enum: > + - vendor,chip-aplic > + - const: riscv,aplic > + > + reg: > + maxItems: 1 > + > + interrupt-controller: true > + > + "#interrupt-cells": > + const: 2 > + > + interrupts-extended: > + minItems: 1 > + maxItems: 16384 > + description: > + The presence of this property implies that given APLIC domain directly > + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each > + node pointed to should be a riscv,cpu-intc node, which has a riscv node > + (i.e. RISC-V HART) as parent. > + > + msi-parent: > + description: > + The presence of this property implies that given APLIC domain forwards Drop "The presence of this property" and make it a proper sentence describing hardware. > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > + controller (IMSIC). This property should be considered only when the > + interrupts-extended property is absent. > + > + riscv,num-sources: > + $ref: "/schemas/types.yaml#/definitions/uint32" Drop quotes. > + minimum: 1 > + maximum: 1023 > + description: > + Specifies how many wired interrupts are supported by this APLIC domain. > + > + riscv,children: > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > + minItems: 1 > + maxItems: 1024 > + description: > + This property represents a list of child APLIC domains for the given > + APLIC domain. Each child APLIC domain is assigned child index in > + increasing order with the first child APLIC domain assigned child > + index 0. The APLIC domain child index is used by firmware to delegate > + interrupts from the given APLIC domain to a particular child APLIC > + domain. > + > + riscv,delegate: > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > + minItems: 1 > + maxItems: 1024 > + description: > + This property represents a interrupt delegation list where each entry Drop "This property represents". > + is a triple consisting of child APLIC domain phandle, first interrupt > + number, and last interrupt number. The firmware will configure interrupt > + delegation registers based on interrupt delegation list. > + > +additionalProperties: false Same comments as in previous patch, > + > +required: > + - compatible > + - reg > + - interrupt-controller > + - "#interrupt-cells" > + - riscv,num-sources > + > +examples: > + - | > + // Example 1 (APIC domain directly injecting interrupt to HARTs): > + > + aplic0: interrupt-controller@c000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + interrupts-extended = <&cpu1_intc 11>, > + <&cpu2_intc 11>, > + <&cpu3_intc 11>, > + <&cpu4_intc 11>; > + reg = <0xc000000 0x4080>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + riscv,children = <&aplic1>; > + riscv,delegate = <&aplic1 1 63>; > + }; > + > + aplic1: interrupt-controller@d000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + interrupts-extended = <&cpu1_intc 9>, > + <&cpu2_intc 9>, > + <&cpu3_intc 9>, > + <&cpu4_intc 9>; > + reg = <0xd000000 0x4080>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + }; > + > + - | > + // Example 2 (APIC domain forwarding interrupts as MSIs): > + > + interrupt-controller@d000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + msi-parent = <&imsics>; > + reg = <0xd000000 0x4000>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; It's almost the same as previous... don't add unnecessary examples (difference in one property usually does not mean you need new example). > + }; > +... Best regards, Krzysztof
On Mon, Nov 14, 2022 at 3:21 PM Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 11/11/2022 05:42, Anup Patel wrote: > > We add DT bindings document for RISC-V advanced platform level interrupt > > controller (APLIC) defined by the RISC-V advanced interrupt architecture > > (AIA) specification. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > .../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++ > > 1 file changed, 136 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > new file mode 100644 > > index 000000000000..0aa48571f3bc > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > @@ -0,0 +1,136 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) > > + > > +maintainers: > > + - Anup Patel <anup@brainfault.org> > > + > > +description: > > + The RISC-V advanced interrupt architecture (AIA) defines advanced platform > > + level interrupt controller (APLIC) for handling wired interrupts in a > > + RISC-V platform. The RISC-V AIA specification can be found at > > + https://github.com/riscv/riscv-aia. > > + > > + The RISC-V APLIC is implemented as hierarchical APLIC domains where all > > + interrupt sources connect to the root domain which can further delegate > > + interrupts to child domains. We have one device tree node for each APLIC > > + domain. > > + > > +allOf: > > + - $ref: /schemas/interrupt-controller.yaml# > > + > > +properties: > > + compatible: > > + items: > > + - enum: > > + - vendor,chip-aplic > > + - const: riscv,aplic > > + > > + reg: > > + maxItems: 1 > > + > > + interrupt-controller: true > > + > > + "#interrupt-cells": > > + const: 2 > > + > > + interrupts-extended: > > + minItems: 1 > > + maxItems: 16384 > > + description: > > + The presence of this property implies that given APLIC domain directly > > + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each > > + node pointed to should be a riscv,cpu-intc node, which has a riscv node > > + (i.e. RISC-V HART) as parent. > > + > > + msi-parent: > > + description: > > + The presence of this property implies that given APLIC domain forwards > > Drop "The presence of this property" and make it a proper sentence > describing hardware. Okay, I will update. > > > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > > + controller (IMSIC). This property should be considered only when the > > + interrupts-extended property is absent. > > + > > + riscv,num-sources: > > + $ref: "/schemas/types.yaml#/definitions/uint32" > > Drop quotes. Okay, I will update. > > > + minimum: 1 > > + maximum: 1023 > > + description: > > + Specifies how many wired interrupts are supported by this APLIC domain. > > + > > + riscv,children: > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > + minItems: 1 > > + maxItems: 1024 > > + description: > > + This property represents a list of child APLIC domains for the given > > + APLIC domain. Each child APLIC domain is assigned child index in > > + increasing order with the first child APLIC domain assigned child > > + index 0. The APLIC domain child index is used by firmware to delegate > > + interrupts from the given APLIC domain to a particular child APLIC > > + domain. > > + > > + riscv,delegate: > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > + minItems: 1 > > + maxItems: 1024 > > + description: > > + This property represents a interrupt delegation list where each entry > > Drop "This property represents". Okay, I will update. > > > + is a triple consisting of child APLIC domain phandle, first interrupt > > + number, and last interrupt number. The firmware will configure interrupt > > + delegation registers based on interrupt delegation list. > > + > > +additionalProperties: false > > Same comments as in previous patch, Okay, I will update. > > > + > > +required: > > + - compatible > > + - reg > > + - interrupt-controller > > + - "#interrupt-cells" > > + - riscv,num-sources > > + > > +examples: > > + - | > > + // Example 1 (APIC domain directly injecting interrupt to HARTs): > > + > > + aplic0: interrupt-controller@c000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + interrupts-extended = <&cpu1_intc 11>, > > + <&cpu2_intc 11>, > > + <&cpu3_intc 11>, > > + <&cpu4_intc 11>; > > + reg = <0xc000000 0x4080>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + riscv,children = <&aplic1>; > > + riscv,delegate = <&aplic1 1 63>; > > + }; > > + > > + aplic1: interrupt-controller@d000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + interrupts-extended = <&cpu1_intc 9>, > > + <&cpu2_intc 9>, > > + <&cpu3_intc 9>, > > + <&cpu4_intc 9>; > > + reg = <0xd000000 0x4080>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + }; > > + > > + - | > > + // Example 2 (APIC domain forwarding interrupts as MSIs): > > + > > + interrupt-controller@d000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + msi-parent = <&imsics>; > > + reg = <0xd000000 0x4000>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > It's almost the same as previous... don't add unnecessary examples > (difference in one property usually does not mean you need new example). The second example shows the DT node of an APLIC in MSI-mode. Most noteworthy part of this node is presence of "msi-parent" DT property instead of "interrupts-extended" DT property to describe an APLIC in MSI mode. > > > + }; > > +... > Best Regards, Anup
On Fri, Nov 11, 2022 at 10:12:04AM +0530, Anup Patel wrote: > We add DT bindings document for RISC-V advanced platform level interrupt > controller (APLIC) defined by the RISC-V advanced interrupt architecture > (AIA) specification. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > .../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++ > 1 file changed, 136 insertions(+) > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > new file mode 100644 > index 000000000000..0aa48571f3bc > --- /dev/null > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > @@ -0,0 +1,136 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) > + > +maintainers: > + - Anup Patel <anup@brainfault.org> > + > +description: > + The RISC-V advanced interrupt architecture (AIA) defines advanced platform > + level interrupt controller (APLIC) for handling wired interrupts in a > + RISC-V platform. The RISC-V AIA specification can be found at > + https://github.com/riscv/riscv-aia. > + > + The RISC-V APLIC is implemented as hierarchical APLIC domains where all > + interrupt sources connect to the root domain which can further delegate > + interrupts to child domains. We have one device tree node for each APLIC > + domain. > + > +allOf: > + - $ref: /schemas/interrupt-controller.yaml# > + > +properties: > + compatible: > + items: > + - enum: > + - vendor,chip-aplic > + - const: riscv,aplic > + > + reg: > + maxItems: 1 > + > + interrupt-controller: true > + > + "#interrupt-cells": > + const: 2 > + > + interrupts-extended: > + minItems: 1 > + maxItems: 16384 > + description: > + The presence of this property implies that given APLIC domain directly > + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each > + node pointed to should be a riscv,cpu-intc node, which has a riscv node > + (i.e. RISC-V HART) as parent. > + > + msi-parent: > + description: > + The presence of this property implies that given APLIC domain forwards > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > + controller (IMSIC). This property should be considered only when the > + interrupts-extended property is absent. > + > + riscv,num-sources: > + $ref: "/schemas/types.yaml#/definitions/uint32" > + minimum: 1 > + maximum: 1023 > + description: > + Specifies how many wired interrupts are supported by this APLIC domain. > + > + riscv,children: > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > + minItems: 1 > + maxItems: 1024 As each entry is a single phandle: items: maxItems: 1 > + description: > + This property represents a list of child APLIC domains for the given > + APLIC domain. Each child APLIC domain is assigned child index in > + increasing order with the first child APLIC domain assigned child > + index 0. The APLIC domain child index is used by firmware to delegate > + interrupts from the given APLIC domain to a particular child APLIC > + domain. > + > + riscv,delegate: > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > + minItems: 1 > + maxItems: 1024 items: items: - description: child APLIC domain phandle - description: ... - description: ... > + description: > + This property represents a interrupt delegation list where each entry > + is a triple consisting of child APLIC domain phandle, first interrupt > + number, and last interrupt number. The firmware will configure interrupt > + delegation registers based on interrupt delegation list. First and last are inclusive? Couldn't riscv,children and riscv,delegate be combined? How would they be different? If some children don't have any delegated interrupts, you could use -1 for the cells for example. An example showing the need would be nice. > + > +additionalProperties: false > + > +required: > + - compatible > + - reg > + - interrupt-controller > + - "#interrupt-cells" > + - riscv,num-sources > + > +examples: > + - | > + // Example 1 (APIC domain directly injecting interrupt to HARTs): Is than an x86 APIC or a typo? > + > + aplic0: interrupt-controller@c000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + interrupts-extended = <&cpu1_intc 11>, > + <&cpu2_intc 11>, > + <&cpu3_intc 11>, > + <&cpu4_intc 11>; > + reg = <0xc000000 0x4080>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + riscv,children = <&aplic1>; > + riscv,delegate = <&aplic1 1 63>; > + }; > + > + aplic1: interrupt-controller@d000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + interrupts-extended = <&cpu1_intc 9>, > + <&cpu2_intc 9>, > + <&cpu3_intc 9>, > + <&cpu4_intc 9>; > + reg = <0xd000000 0x4080>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + }; > + > + - | > + // Example 2 (APIC domain forwarding interrupts as MSIs): > + > + interrupt-controller@d000000 { > + compatible = "vendor,chip-aplic", "riscv,aplic"; > + msi-parent = <&imsics>; > + reg = <0xd000000 0x4000>; > + interrupt-controller; > + #interrupt-cells = <2>; > + riscv,num-sources = <63>; > + }; > +... > -- > 2.34.1 > >
On Sun, Nov 13, 2022 at 9:14 PM Conor Dooley <conor@kernel.org> wrote: > > Hey Anup, > > Ditto the $subject nit here. Adding "interrupt-controller:" to subject makes it longer than 80 characters. > > On Fri, Nov 11, 2022 at 10:12:04AM +0530, Anup Patel wrote: > > We add DT bindings document for RISC-V advanced platform level interrupt > > controller (APLIC) defined by the RISC-V advanced interrupt architecture > > (AIA) specification. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > .../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++ > > 1 file changed, 136 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > new file mode 100644 > > index 000000000000..0aa48571f3bc > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > @@ -0,0 +1,136 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) > > Typo: Advanced Okay, I will update. > > > + > > +maintainers: > > + - Anup Patel <anup@brainfault.org> > > + > > +description: > > + The RISC-V advanced interrupt architecture (AIA) defines advanced platform > ^ > Missing an article here? Okay, I will update. > > > + level interrupt controller (APLIC) for handling wired interrupts in a > > + RISC-V platform. The RISC-V AIA specification can be found at > > + https://github.com/riscv/riscv-aia. > > + > > + The RISC-V APLIC is implemented as hierarchical APLIC domains where all > > + interrupt sources connect to the root domain which can further delegate > > + interrupts to child domains. We have one device tree node for each APLIC > > While I am nitpicking, s/We have/There is/ ? Okay, I will update. > > > + domain. > > + > > +allOf: > > + - $ref: /schemas/interrupt-controller.yaml# > > + > > +properties: > > + compatible: > > + items: > > + - enum: > > + - vendor,chip-aplic > > Same comment here about the validity of this placeholder. Okay, I will add "riscv,qemu-aplic" as QEMU specific compatible string. > > > + - const: riscv,aplic > > + > > + reg: > > + maxItems: 1 > > + > > + interrupt-controller: true > > + > > + "#interrupt-cells": > > + const: 2 > > + > > + interrupts-extended: > > + minItems: 1 > > + maxItems: 16384 > > + description: > > + The presence of this property implies that given APLIC domain directly > ^ > Missing indefinite article here (and in msi-parent)? > > > + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each > > + node pointed to should be a riscv,cpu-intc node, which has a riscv node > > + (i.e. RISC-V HART) as parent. > > + > > + msi-parent: > > + description: > > + The presence of this property implies that given APLIC domain forwards > > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > > + controller (IMSIC). This property should be considered only when the > > + interrupts-extended property is absent. > > This mutual exclusion can be represented, can't it? > IIRC it is some sort of oneOf thing, somewhat like below: > oneOf: > - required: > - msi-parent > - required: > - interrupts-extended > > AFAIR from doing the i2c ocores binding, this will force the addition of > one, but not both, to a node. > > Or is this not actually mutually exclusive & the msi-parent property is > permitted but just left unused if interrupts-extended is present? If both are present then interrupts-extended is preferred. > > > + riscv,num-sources: > > + $ref: "/schemas/types.yaml#/definitions/uint32" > > + minimum: 1 > > + maximum: 1023 > > + description: > > + Specifies how many wired interrupts are supported by this APLIC domain. > > + > > + riscv,children: > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > + minItems: 1 > > + maxItems: 1024 > > + description: > > + This property represents a list of child APLIC domains for the given > > + APLIC domain. Each child APLIC domain is assigned child index in > > + increasing order with the first child APLIC domain assigned child > > + index 0. The APLIC domain child index is used by firmware to delegate > > + interrupts from the given APLIC domain to a particular child APLIC > > + domain. > > + > > + riscv,delegate: > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > + minItems: 1 > > + maxItems: 1024 > > + description: > > + This property represents a interrupt delegation list where each entry > > + is a triple consisting of child APLIC domain phandle, first interrupt > > + number, and last interrupt number. The firmware will configure interrupt > > + delegation registers based on interrupt delegation list. > > What is the inter dependence of the children and delegate? > Is it valid to have a delegate property without children? > Can the firmware delegate interrupts without the delegation list, based > on the children property alone? Or is it effectively useless without a > children property? Both properties convey different information. The "riscv,childen" describes the association of child indexes with child APLIC domains whereas the "riscv,delegate" describes the interrupt delegation to few of the child APLIC domains. > > In your examples, the second has msi-parent but neither of these custom > properties. Do the children/delegate properties have a meaning in the > msi-parent case? The "riscv,childern" and "riscv,delegate" are only useful when we have hierarchy of multiple APLIC domains. The second example only has one APLIC domain hence these custom properties are absent. > > I think the binding should enforce whatever dependency exists there. > Thanks, > Conor. > > > + > > +additionalProperties: false > > + > > +required: > > + - compatible > > + - reg > > + - interrupt-controller > > + - "#interrupt-cells" > > + - riscv,num-sources > > + > > +examples: > > + - | > > + // Example 1 (APIC domain directly injecting interrupt to HARTs): > > + > > + aplic0: interrupt-controller@c000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + interrupts-extended = <&cpu1_intc 11>, > > + <&cpu2_intc 11>, > > + <&cpu3_intc 11>, > > + <&cpu4_intc 11>; > > + reg = <0xc000000 0x4080>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + riscv,children = <&aplic1>; > > + riscv,delegate = <&aplic1 1 63>; > > + }; > > + > > + aplic1: interrupt-controller@d000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + interrupts-extended = <&cpu1_intc 9>, > > + <&cpu2_intc 9>, > > + <&cpu3_intc 9>, > > + <&cpu4_intc 9>; > > + reg = <0xd000000 0x4080>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + }; > > + > > + - | > > + // Example 2 (APIC domain forwarding interrupts as MSIs): > > + > > + interrupt-controller@d000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + msi-parent = <&imsics>; > > + reg = <0xd000000 0x4000>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + }; > > +... > > -- > > 2.34.1 > > > > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv Regards, Anup
On Thu, Nov 17, 2022 at 12:57 AM Rob Herring <robh@kernel.org> wrote: > > On Fri, Nov 11, 2022 at 10:12:04AM +0530, Anup Patel wrote: > > We add DT bindings document for RISC-V advanced platform level interrupt > > controller (APLIC) defined by the RISC-V advanced interrupt architecture > > (AIA) specification. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > .../interrupt-controller/riscv,aplic.yaml | 136 ++++++++++++++++++ > > 1 file changed, 136 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > new file mode 100644 > > index 000000000000..0aa48571f3bc > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml > > @@ -0,0 +1,136 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) > > + > > +maintainers: > > + - Anup Patel <anup@brainfault.org> > > + > > +description: > > + The RISC-V advanced interrupt architecture (AIA) defines advanced platform > > + level interrupt controller (APLIC) for handling wired interrupts in a > > + RISC-V platform. The RISC-V AIA specification can be found at > > + https://github.com/riscv/riscv-aia. > > + > > + The RISC-V APLIC is implemented as hierarchical APLIC domains where all > > + interrupt sources connect to the root domain which can further delegate > > + interrupts to child domains. We have one device tree node for each APLIC > > + domain. > > + > > +allOf: > > + - $ref: /schemas/interrupt-controller.yaml# > > + > > +properties: > > + compatible: > > + items: > > + - enum: > > + - vendor,chip-aplic > > + - const: riscv,aplic > > + > > + reg: > > + maxItems: 1 > > + > > + interrupt-controller: true > > + > > + "#interrupt-cells": > > + const: 2 > > + > > + interrupts-extended: > > + minItems: 1 > > + maxItems: 16384 > > + description: > > + The presence of this property implies that given APLIC domain directly > > + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each > > + node pointed to should be a riscv,cpu-intc node, which has a riscv node > > + (i.e. RISC-V HART) as parent. > > + > > + msi-parent: > > + description: > > + The presence of this property implies that given APLIC domain forwards > > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > > + controller (IMSIC). This property should be considered only when the > > + interrupts-extended property is absent. > > + > > + riscv,num-sources: > > + $ref: "/schemas/types.yaml#/definitions/uint32" > > + minimum: 1 > > + maximum: 1023 > > + description: > > + Specifies how many wired interrupts are supported by this APLIC domain. > > + > > + riscv,children: > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > + minItems: 1 > > + maxItems: 1024 > > As each entry is a single phandle: > > items: > maxItems: 1 Okay, I will update. > > > + description: > > + This property represents a list of child APLIC domains for the given > > + APLIC domain. Each child APLIC domain is assigned child index in > > + increasing order with the first child APLIC domain assigned child > > + index 0. The APLIC domain child index is used by firmware to delegate > > + interrupts from the given APLIC domain to a particular child APLIC > > + domain. > > + > > + riscv,delegate: > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > + minItems: 1 > > + maxItems: 1024 > > items: > items: > - description: child APLIC domain phandle > - description: ... > - description: ... Okay, I will update. > > > + description: > > + This property represents a interrupt delegation list where each entry > > + is a triple consisting of child APLIC domain phandle, first interrupt > > + number, and last interrupt number. The firmware will configure interrupt > > + delegation registers based on interrupt delegation list. > > First and last are inclusive? Yes, first and last are inclusive. I will clarify this in the description. > > Couldn't riscv,children and riscv,delegate be combined? How would they > be different? If some children don't have any delegated interrupts, you > could use -1 for the cells for example. The "riscv,children" describes the hierarchy of APLIC domains in HW whereas "riscv,delegate" describes the system choices of delegating interrupts from a parent APLIC domain to one of its children. I feel it's not natural to combine these two properties. > > An example showing the need would be nice. > > > + > > +additionalProperties: false > > + > > +required: > > + - compatible > > + - reg > > + - interrupt-controller > > + - "#interrupt-cells" > > + - riscv,num-sources > > + > > +examples: > > + - | > > + // Example 1 (APIC domain directly injecting interrupt to HARTs): > > Is than an x86 APIC or a typo? > > > + > > + aplic0: interrupt-controller@c000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + interrupts-extended = <&cpu1_intc 11>, > > + <&cpu2_intc 11>, > > + <&cpu3_intc 11>, > > + <&cpu4_intc 11>; > > + reg = <0xc000000 0x4080>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + riscv,children = <&aplic1>; > > + riscv,delegate = <&aplic1 1 63>; > > + }; > > + > > + aplic1: interrupt-controller@d000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + interrupts-extended = <&cpu1_intc 9>, > > + <&cpu2_intc 9>, > > + <&cpu3_intc 9>, > > + <&cpu4_intc 9>; > > + reg = <0xd000000 0x4080>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + }; > > + > > + - | > > + // Example 2 (APIC domain forwarding interrupts as MSIs): > > + > > + interrupt-controller@d000000 { > > + compatible = "vendor,chip-aplic", "riscv,aplic"; > > + msi-parent = <&imsics>; > > + reg = <0xd000000 0x4000>; > > + interrupt-controller; > > + #interrupt-cells = <2>; > > + riscv,num-sources = <63>; > > + }; > > +... > > -- > > 2.34.1 > > > > Regards, Anup
On Mon, Jan 02, 2023 at 10:20:48PM +0530, Anup Patel wrote: > On Sun, Nov 13, 2022 at 9:14 PM Conor Dooley <conor@kernel.org> wrote: > > > + domain. > > > + > > > +allOf: > > > + - $ref: /schemas/interrupt-controller.yaml# > > > + > > > +properties: > > > + compatible: > > > + items: > > > + - enum: > > > + - vendor,chip-aplic > > > > Same comment here about the validity of this placeholder. > > Okay, I will add "riscv,qemu-aplic" as QEMU specific compatible string. Ah neat. I think that's a fair compromise. > > > + - const: riscv,aplic > > > + msi-parent: > > > + description: > > > + The presence of this property implies that given APLIC domain forwards > > > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > > > + controller (IMSIC). This property should be considered only when the > > > + interrupts-extended property is absent. > > > > This mutual exclusion can be represented, can't it? > > IIRC it is some sort of oneOf thing, somewhat like below: > > oneOf: > > - required: > > - msi-parent > > - required: > > - interrupts-extended > > > > AFAIR from doing the i2c ocores binding, this will force the addition of > > one, but not both, to a node. > > > > Or is this not actually mutually exclusive & the msi-parent property is > > permitted but just left unused if interrupts-extended is present? > > If both are present then interrupts-extended is preferred. Perhaps I am making a fool of myself here, but why would someone include both of them at once, if only one is going to be used? It would appear that making them explicitly mutually exclusive would make the binding easier to understand. What am I missing? > > > + riscv,children: > > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > > + minItems: 1 > > > + maxItems: 1024 > > > + description: > > > + This property represents a list of child APLIC domains for the given > > > + APLIC domain. Each child APLIC domain is assigned child index in > > > + increasing order with the first child APLIC domain assigned child > > > + index 0. The APLIC domain child index is used by firmware to delegate > > > + interrupts from the given APLIC domain to a particular child APLIC > > > + domain. > > > + > > > + riscv,delegate: > > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > > + minItems: 1 > > > + maxItems: 1024 > > > + description: > > > + This property represents a interrupt delegation list where each entry > > > + is a triple consisting of child APLIC domain phandle, first interrupt > > > + number, and last interrupt number. The firmware will configure interrupt > > > + delegation registers based on interrupt delegation list. > > > > What is the inter dependence of the children and delegate? > > Is it valid to have a delegate property without children? > > Can the firmware delegate interrupts without the delegation list, based > > on the children property alone? Or is it effectively useless without a > > children property? > > Both properties convey different information. The "riscv,childen" describes > the association of child indexes with child APLIC domains whereas the > "riscv,delegate" describes the interrupt delegation to few of the child > APLIC domains. > > > > > > In your examples, the second has msi-parent but neither of these custom > > properties. Do the children/delegate properties have a meaning in the > > msi-parent case? > > The "riscv,childern" and "riscv,delegate" are only useful when we have > hierarchy of multiple APLIC domains. The second example only has > one APLIC domain hence these custom properties are absent. It'd be great if you could include an example that explains the difference as, IIRC, both Rob and I both were kinda confused as to how the properties differ. Thanks, Conor.
On Mon, Jan 2, 2023 at 11:48 PM Conor Dooley <conor@kernel.org> wrote: > > On Mon, Jan 02, 2023 at 10:20:48PM +0530, Anup Patel wrote: > > On Sun, Nov 13, 2022 at 9:14 PM Conor Dooley <conor@kernel.org> wrote: > > > > > + domain. > > > > + > > > > +allOf: > > > > + - $ref: /schemas/interrupt-controller.yaml# > > > > + > > > > +properties: > > > > + compatible: > > > > + items: > > > > + - enum: > > > > + - vendor,chip-aplic > > > > > > Same comment here about the validity of this placeholder. > > > > Okay, I will add "riscv,qemu-aplic" as QEMU specific compatible string. > > Ah neat. I think that's a fair compromise. > > > > > + - const: riscv,aplic > > > > > + msi-parent: > > > > + description: > > > > + The presence of this property implies that given APLIC domain forwards > > > > + wired interrupts as MSIs to a AIA incoming message signaled interrupt > > > > + controller (IMSIC). This property should be considered only when the > > > > + interrupts-extended property is absent. > > > > > > This mutual exclusion can be represented, can't it? > > > IIRC it is some sort of oneOf thing, somewhat like below: > > > oneOf: > > > - required: > > > - msi-parent > > > - required: > > > - interrupts-extended > > > > > > AFAIR from doing the i2c ocores binding, this will force the addition of > > > one, but not both, to a node. > > > > > > Or is this not actually mutually exclusive & the msi-parent property is > > > permitted but just left unused if interrupts-extended is present? > > > > If both are present then interrupts-extended is preferred. > > Perhaps I am making a fool of myself here, but why would someone include > both of them at once, if only one is going to be used? > It would appear that making them explicitly mutually exclusive would > make the binding easier to understand. > What am I missing? If both "interrupts-extended" and "msi-parent" are present then it means the APLIC domain supports both MSI mode and Direct mode in HW. In this case, the APLIC driver has to choose between MSI mode or Direct mode. > > > > > + riscv,children: > > > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > > > + minItems: 1 > > > > + maxItems: 1024 > > > > + description: > > > > + This property represents a list of child APLIC domains for the given > > > > + APLIC domain. Each child APLIC domain is assigned child index in > > > > + increasing order with the first child APLIC domain assigned child > > > > + index 0. The APLIC domain child index is used by firmware to delegate > > > > + interrupts from the given APLIC domain to a particular child APLIC > > > > + domain. > > > > + > > > > + riscv,delegate: > > > > + $ref: '/schemas/types.yaml#/definitions/phandle-array' > > > > + minItems: 1 > > > > + maxItems: 1024 > > > > + description: > > > > + This property represents a interrupt delegation list where each entry > > > > + is a triple consisting of child APLIC domain phandle, first interrupt > > > > + number, and last interrupt number. The firmware will configure interrupt > > > > + delegation registers based on interrupt delegation list. > > > > > > What is the inter dependence of the children and delegate? > > > Is it valid to have a delegate property without children? > > > Can the firmware delegate interrupts without the delegation list, based > > > on the children property alone? Or is it effectively useless without a > > > children property? > > > > Both properties convey different information. The "riscv,childen" describes > > the association of child indexes with child APLIC domains whereas the > > "riscv,delegate" describes the interrupt delegation to few of the child > > APLIC domains. > > > > > > > > > > In your examples, the second has msi-parent but neither of these custom > > > properties. Do the children/delegate properties have a meaning in the > > > msi-parent case? > > > > The "riscv,childern" and "riscv,delegate" are only useful when we have > > hierarchy of multiple APLIC domains. The second example only has > > one APLIC domain hence these custom properties are absent. > > It'd be great if you could include an example that explains the > difference as, IIRC, both Rob and I both were kinda confused as to how > the properties differ. Okay, I will try to improve the examples. Regards, Anup
On 02/01/2023 17:50, Anup Patel wrote: > On Sun, Nov 13, 2022 at 9:14 PM Conor Dooley <conor@kernel.org> wrote: >> >> Hey Anup, >> >> Ditto the $subject nit here. > > Adding "interrupt-controller:" to subject makes it longer than 80 characters. Because you added redundant double "bindings". Subject line is precious, so do not add useless words. Best regards, Krzysztof
On Tue, Jan 3, 2023 at 2:29 PM Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 02/01/2023 17:50, Anup Patel wrote: > > On Sun, Nov 13, 2022 at 9:14 PM Conor Dooley <conor@kernel.org> wrote: > >> > >> Hey Anup, > >> > >> Ditto the $subject nit here. > > > > Adding "interrupt-controller:" to subject makes it longer than 80 characters. > > Because you added redundant double "bindings". Subject line is precious, > so do not add useless words. Okay, I will update the patch subject based on your suggestion. Regards, Anup
diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml new file mode 100644 index 000000000000..0aa48571f3bc --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml @@ -0,0 +1,136 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RISC-V Advancded Platform Level Interrupt Controller (APLIC) + +maintainers: + - Anup Patel <anup@brainfault.org> + +description: + The RISC-V advanced interrupt architecture (AIA) defines advanced platform + level interrupt controller (APLIC) for handling wired interrupts in a + RISC-V platform. The RISC-V AIA specification can be found at + https://github.com/riscv/riscv-aia. + + The RISC-V APLIC is implemented as hierarchical APLIC domains where all + interrupt sources connect to the root domain which can further delegate + interrupts to child domains. We have one device tree node for each APLIC + domain. + +allOf: + - $ref: /schemas/interrupt-controller.yaml# + +properties: + compatible: + items: + - enum: + - vendor,chip-aplic + - const: riscv,aplic + + reg: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 + + interrupts-extended: + minItems: 1 + maxItems: 16384 + description: + The presence of this property implies that given APLIC domain directly + injects external interrupts to a set of RISC-V HARTS (or CPUs). Each + node pointed to should be a riscv,cpu-intc node, which has a riscv node + (i.e. RISC-V HART) as parent. + + msi-parent: + description: + The presence of this property implies that given APLIC domain forwards + wired interrupts as MSIs to a AIA incoming message signaled interrupt + controller (IMSIC). This property should be considered only when the + interrupts-extended property is absent. + + riscv,num-sources: + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 1 + maximum: 1023 + description: + Specifies how many wired interrupts are supported by this APLIC domain. + + riscv,children: + $ref: '/schemas/types.yaml#/definitions/phandle-array' + minItems: 1 + maxItems: 1024 + description: + This property represents a list of child APLIC domains for the given + APLIC domain. Each child APLIC domain is assigned child index in + increasing order with the first child APLIC domain assigned child + index 0. The APLIC domain child index is used by firmware to delegate + interrupts from the given APLIC domain to a particular child APLIC + domain. + + riscv,delegate: + $ref: '/schemas/types.yaml#/definitions/phandle-array' + minItems: 1 + maxItems: 1024 + description: + This property represents a interrupt delegation list where each entry + is a triple consisting of child APLIC domain phandle, first interrupt + number, and last interrupt number. The firmware will configure interrupt + delegation registers based on interrupt delegation list. + +additionalProperties: false + +required: + - compatible + - reg + - interrupt-controller + - "#interrupt-cells" + - riscv,num-sources + +examples: + - | + // Example 1 (APIC domain directly injecting interrupt to HARTs): + + aplic0: interrupt-controller@c000000 { + compatible = "vendor,chip-aplic", "riscv,aplic"; + interrupts-extended = <&cpu1_intc 11>, + <&cpu2_intc 11>, + <&cpu3_intc 11>, + <&cpu4_intc 11>; + reg = <0xc000000 0x4080>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + riscv,children = <&aplic1>; + riscv,delegate = <&aplic1 1 63>; + }; + + aplic1: interrupt-controller@d000000 { + compatible = "vendor,chip-aplic", "riscv,aplic"; + interrupts-extended = <&cpu1_intc 9>, + <&cpu2_intc 9>, + <&cpu3_intc 9>, + <&cpu4_intc 9>; + reg = <0xd000000 0x4080>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + }; + + - | + // Example 2 (APIC domain forwarding interrupts as MSIs): + + interrupt-controller@d000000 { + compatible = "vendor,chip-aplic", "riscv,aplic"; + msi-parent = <&imsics>; + reg = <0xd000000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + }; +...