From patchwork Mon Feb 26 04:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 206245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1864455dyb; Sun, 25 Feb 2024 20:29:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYKYuaUklIaPHYIDYmEiqPgSOPvTwDgdbQfpy/+RNvsnB16fm8q6bVdh73TnbIBMlxF+g6vMBbSnEMxWMN9XzR4P0V3w== X-Google-Smtp-Source: AGHT+IGxJSR+j5LwSwhbwlH4xEApbWpuy+EPs51RDErDfkmUV1eQI3TXYgnIPOgNQehSMoDXv2BY X-Received: by 2002:a05:6870:353:b0:219:28af:f8a6 with SMTP id n19-20020a056870035300b0021928aff8a6mr5973261oaf.56.1708921763937; Sun, 25 Feb 2024 20:29:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708921763; cv=pass; d=google.com; s=arc-20160816; b=A/uzIndVVxsEgjEEWo1s7d6ISuo0ZvCOk9Qu/ZeH4xYaz7GStB63yIOapBYQt2tZkf D/sn7+AtiAnuGI1Z+pp/U79IqEd5Heyx4A483FhkCsp/D1rAfswkT7q3CgK6zzdjTNNP 7rxEozRQ0cqxfiU5Wgf5NNm/dpS5+zUoQxyXmqt+Ae1iMmOQ4hnEYNNRbqOJaEZa1oVq tJ2mfJgYbTQHBkGwTgcpbklo3Wq4mTLz4Ao9EzGCsbuDx1g/Ilw6Y3O3Htm3CVE0bHtB BKcAH5u56PqauI0qi4+ubqTnZO16uihgwDzdDUuQ5eprbjie3dLMn6XsskL7A6182HSI vPqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zlSSXeqmMrWeTCyKtywicMr25YT1KxbVoTbJX7XSN9g=; fh=jfL+ExhjDFbLDN7/oqEoeiUj/3gAetBN/LZC/APgJFw=; b=VV0dk01uv0eNpIWK9RKXMf4SqOg0eU3+8ytaMLBerCFb9oEVrRM86y2YSBO6btHZGH ji8wtOkdfQElhfjXl7pAct1ZiholKYL5jB2GupdG97EsswSdjvdsMiCcKhmMXiVFdVc8 l5J0yC/vndJ6523FZyXWwcHU1oCWcZwDRLM/PiT+Ifp3++vkh1e+B55rrjzzx8lt1j4l XpOzUBFrXhA6MRMySSrTLEEPZ7OKncyyTZV7QdhBP5gw82QY0tXvXpPWTFR/xgQgUavT zRD7R4fnzA4p7oJbYYKF5diSvKEUz4Y/NtcWLfYV+SanzxqgVfja3ZYslqfsyZVK8Az/ RFIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="MBLhrdp/"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-80535-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80535-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n22-20020a63e056000000b005dc6d15c299si3051816pgj.240.2024.02.25.20.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 20:29:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80535-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="MBLhrdp/"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-80535-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80535-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A85BBB25287 for ; Mon, 26 Feb 2024 04:11:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7EECF1CAA4; Mon, 26 Feb 2024 04:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="MBLhrdp/" Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A09A1C6BD for ; Mon, 26 Feb 2024 04:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708920575; cv=none; b=r6C3Ht9uAZAF0IWyuIpPKO51QjlmixtvJQuoLSb3HJhMqAadKKFg9yg57K/il4d/l7QmfMR2KDcmZBV8W/7445G72F8RcYP6cylIO9TzUawq7vg04w2pDMFFi5zZBL5iOjK9iDKivk3I4satCmFF6nZ1x2x2cSeKCmByzOStXEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708920575; c=relaxed/simple; bh=UEqf02ho8KoC5uUf94NdYj/8svBvRgvzCWxf0JoVQU0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nGiwnnR+NQxHiLes/ZRdbvElj9aJPkYAqTfnj3Tn5gSXxTjW8sPbxXxBvHUxq60z9bnLVwQoJ6tGcOemMn8Ye6Sefat7jxtANuTeiF/V2Ni8ea2lCleDOJNnXR8tpoSHqwlelPhMjSrjgXQWiX+MJvXmhuUz7MYdqQgx/Nvw34Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=MBLhrdp/; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e4ca46ab04so1372286b3a.3 for ; Sun, 25 Feb 2024 20:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1708920574; x=1709525374; darn=vger.kernel.org; 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=zlSSXeqmMrWeTCyKtywicMr25YT1KxbVoTbJX7XSN9g=; b=MBLhrdp/aVY+3BhuKBHrLNEXJ3yJ5b/ALf6v+3UtW7pvq0bGdVBFixsnvdDx52y92f B1AoMTZj82dPX3Od8CJXRb9eACjDmsnSUNt0CMzRU9X/nhDUZ/LpXPZYgsSzBQk94OGH ugFL+sgd6z+Ot4/iRuJfeinJuRTGN3v3kgIySbDnVjCqPI4nRJXUwugIApgh5IVBPcml OLV7iVZmEc6PbQdl/FPh36ke5jdXe1DmMuhhLpTrFnoW7BWmjQdeXT+G6vWL6wwZsGtF 1O8hNOy19jVHC5sPME74s2Dba/SlYf2EWzQ+Yr1i4TBYuvGCp/rh/MwLpBclkd2wU/oZ KJKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708920574; x=1709525374; 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=zlSSXeqmMrWeTCyKtywicMr25YT1KxbVoTbJX7XSN9g=; b=HkOb8xlAHfSIKPEUhXCU1sv5lZJsoUWlGsBWvfvNF5CHwl31dYYKId/AUae+MqNQiQ zAUcGBVEU54KGwvKLCMbfzlcwabc34Kdg846bhTHPgdZz/KYvjwMuMFMavCUG7T6yWz8 yE5ls3sG9v0UzKsyklaKGFbSXZByHYGGnt3mrYvNlF3qxi7Vr5mcpFGKI8rbjrzSj/LR PrQNSPP44rmmM36Tv2/XqiDfD2RAG6GMqR5+s8D/7KXGdtGXa/nNdQwSE3Vj75n1OjEQ D/MQpW/bXaFYf9kusCyis2vSZPtBaoR17mH4c/VOfDRWBdz34y06FFp/+I2NoIyJgYQt bh/A== X-Forwarded-Encrypted: i=1; AJvYcCWGthVHPdjLgNPyev5G39DhAmEOlXWBw3cH1u7ZCRqnxMv2/ewshp0hecgtZxI4LQCpYXBuBOW22CPKTQ2R9b1XjP999sAkG3ydlCDu X-Gm-Message-State: AOJu0YxAdgIeW1ekqXiIpwM7oA7xVFEkxOtDT8bu/QSq/by8ZVQTB1vR jA+Nrx8wdv/OKWI5D339IDTNoZoAjBgwRDNbh+5y/iHgRWFvD0tyLbh8ur2kqJY= X-Received: by 2002:a05:6a20:49a3:b0:19e:aaec:833a with SMTP id fs35-20020a056a2049a300b0019eaaec833amr5956232pzb.55.1708920573561; Sun, 25 Feb 2024 20:09:33 -0800 (PST) Received: from localhost.localdomain ([171.76.86.62]) by smtp.gmail.com with ESMTPSA id d11-20020a170902654b00b001dc6f7e794dsm3023258pln.16.2024.02.25.20.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 20:09:33 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley Cc: Marc Zyngier , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel , Conor Dooley Subject: [PATCH v15 06/10] dt-bindings: interrupt-controller: Add RISC-V advanced PLIC Date: Mon, 26 Feb 2024 09:37:42 +0530 Message-Id: <20240226040746.1396416-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226040746.1396416-1-apatel@ventanamicro.com> References: <20240226040746.1396416-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791934347818045925 X-GMAIL-MSGID: 1791934347818045925 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 Reviewed-by: Conor Dooley --- .../interrupt-controller/riscv,aplic.yaml | 172 ++++++++++++++++++ 1 file changed, 172 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..190a6499c932 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml @@ -0,0 +1,172 @@ +# 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 Advanced Platform Level Interrupt Controller (APLIC) + +maintainers: + - Anup Patel + +description: + The RISC-V advanced interrupt architecture (AIA) defines an 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 APLIC domain and a parent APLIC + domain can delegate interrupt sources to it's child APLIC domains. There + is one device tree node for each APLIC domain. + +allOf: + - $ref: /schemas/interrupt-controller.yaml# + +properties: + compatible: + items: + - enum: + - qemu,aplic + - const: riscv,aplic + + reg: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 + + interrupts-extended: + minItems: 1 + maxItems: 16384 + description: + 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 CPU node (i.e. RISC-V HART) as parent. + + msi-parent: + description: + Given APLIC domain forwards wired interrupts as MSIs to a AIA incoming + message signaled interrupt controller (IMSIC). If both "msi-parent" and + "interrupts-extended" properties 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,num-sources: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 1023 + description: + Specifies the number of wired interrupt sources supported by this + APLIC domain. + + riscv,children: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 1024 + items: + maxItems: 1 + description: + A list of child APLIC domains for the given APLIC domain. Each child + APLIC domain is assigned a 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,delegation: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 1024 + items: + items: + - description: child APLIC domain phandle + - description: first interrupt number of the parent APLIC domain (inclusive) + - description: last interrupt number of the parent APLIC domain (inclusive) + description: + A interrupt delegation list where each entry is a triple consisting + of child APLIC domain phandle, first interrupt number of the parent + APLIC domain, and last interrupt number of the parent APLIC domain. + Firmware must configure interrupt delegation registers based on + interrupt delegation list. + +dependencies: + riscv,delegation: [ "riscv,children" ] + +required: + - compatible + - reg + - interrupt-controller + - "#interrupt-cells" + - riscv,num-sources + +anyOf: + - required: + - interrupts-extended + - required: + - msi-parent + +unevaluatedProperties: false + +examples: + - | + // Example 1 (APLIC domains directly injecting interrupt to HARTs): + + interrupt-controller@c000000 { + compatible = "qemu,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>, <&aplic2>; + riscv,delegation = <&aplic1 1 63>; + }; + + aplic1: interrupt-controller@d000000 { + compatible = "qemu,aplic", "riscv,aplic"; + interrupts-extended = <&cpu1_intc 9>, + <&cpu2_intc 9>; + reg = <0xd000000 0x4080>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + }; + + aplic2: interrupt-controller@e000000 { + compatible = "qemu,aplic", "riscv,aplic"; + interrupts-extended = <&cpu3_intc 9>, + <&cpu4_intc 9>; + reg = <0xe000000 0x4080>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + }; + + - | + // Example 2 (APLIC domains forwarding interrupts as MSIs): + + interrupt-controller@c000000 { + compatible = "qemu,aplic", "riscv,aplic"; + msi-parent = <&imsic_mlevel>; + reg = <0xc000000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + riscv,children = <&aplic3>; + riscv,delegation = <&aplic3 1 63>; + }; + + aplic3: interrupt-controller@d000000 { + compatible = "qemu,aplic", "riscv,aplic"; + msi-parent = <&imsic_slevel>; + reg = <0xd000000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + riscv,num-sources = <63>; + }; +...