From patchwork Sat Jan 27 16:17:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 193049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2395:b0:106:343:edcb with SMTP id gw21csp566563dyb; Sat, 27 Jan 2024 08:23:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHK9tj+mHgprjh/Jg9+NiYh9pi4EaMGE+bwMP0rR+lIclNCQ/kHQBDZDdu2NW7XvJWYWd74 X-Received: by 2002:ac8:5e0b:0:b0:42a:7035:27e1 with SMTP id h11-20020ac85e0b000000b0042a703527e1mr2890033qtx.46.1706372608995; Sat, 27 Jan 2024 08:23:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706372608; cv=pass; d=google.com; s=arc-20160816; b=YPs4PK1/GbHBpedz3kQ0L0EicfOjPIyRTR3i5muz7b/VY37MMoOTgNNu9+mj/ESir/ jxbS1fAjwKCfA2DDs5v8y2xMjt0jlGeLElKnfJqNaatcWtiNZnSB4TZcgoQXAFikxtyl biTA75AR2qgIwYyW/0BuL9TdPYcEQRKuO+z5QLyfbf0f9EusNKiLi9KuNbl0lE1UrnEJ LZfZ/d1mW41+BjBgmH9E76w39OlZZBJPfUV4bAqq5pU/hIGKutv1ETuhW74LEFEskSA9 QW24kHP3wiNULadU/rHmD2czWvE4dX618XnDAwW/ps+bitgz9lY6RdjqI+vxWG0wZm4Z 6eJQ== 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=ZOjDepVi55uZJQ1rIBBnqb1diEnF/zfemFV4q9wl2F4=; fh=AgaHgobU2PC3sqMJfdE1fEBxHoD6ZUS5pj0IKz6/Y/E=; b=RTZnHsAz5uTkEPxSI0GuRuhu9vTtzdVcu17PkFBDXFs5jQmLMMHTVGon4kvmFL0COF 98ACg6+dwcNMOLtNfzJDBdg1wrINEwsAnZlmPlenu+DpORA+PvCirxf4uW25ka7wt/VO Ju+8993DI0Vep/F5uLPGXVjYm52tIIJtBP/GrgC3CmP2aAtVvUsluzXXFBpZYpO7xYxg G98wTau+53sBHYX+GbJQPB5GRKQdiVA5oqtyr4uJhb6tjOgX+xaH6EAPBDAphyfyf1xe JIP4bIErJ9g4cnXWlCsuttFVPtIPzDpY+ZqfBcpV2gG5Pch6u3Mg7uheNzdGJUPx3xsY vmqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=OOzjUdNy; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-41290-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41290-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d3-20020a05622a100300b0042a853105b1si3074386qte.600.2024.01.27.08.23.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 08:23:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41290-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=OOzjUdNy; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-41290-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41290-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B4DAD1C221D1 for ; Sat, 27 Jan 2024 16:23:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A7035C5E4; Sat, 27 Jan 2024 16:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="OOzjUdNy" Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 3714F2E40D for ; Sat, 27 Jan 2024 16:19:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706372391; cv=none; b=p5Cc0l2mfm57LjabnDMFH43Nx1w1IrTPdfELqo6KnM9guJRqd4XTCrUZJpT1CmrXaWmSvhyk/s4dg86bf6UXUvlAKLns1XEgOzpmZw+Rbn3wtA/mlE2E+KQFU8Ds9/1XQa2DVPpPuhnxukmzTOP+VbOp6ecgHYVchR5NAF9CpBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706372391; c=relaxed/simple; bh=Yv2jjkLSXu/2PGL/WRtssyxVBdk37r5e6qrU4c22G1w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NpaniPDAT3UFpPcbqfjiRLRe1PbcGFFIoFMSLU9ku19Nso1zYgdX7m51Xv9jmMPs7PJajD0Ig1DD82agSokMmALYmIc3PW222Hj4PqySEhVyXmM2VtYTMf93HAE1Zbg9y+CVBjQnnpyQXBpM4PCAl0MhutoOtM5ZXhL2ASU8G/s= 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=OOzjUdNy; arc=none smtp.client-ip=209.85.215.171 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-pg1-f171.google.com with SMTP id 41be03b00d2f7-5c229dabbb6so738735a12.0 for ; Sat, 27 Jan 2024 08:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1706372390; x=1706977190; 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=ZOjDepVi55uZJQ1rIBBnqb1diEnF/zfemFV4q9wl2F4=; b=OOzjUdNyRRbYiOn7r5uGK1nNkSJzW9JVYajMJ9IHN9zcKOBV01+PPoGgTu0aKV57ce EDylg5bxYJvGvakDNTYuM+QhHV7J5pteU+WG85xaBq530jlPtDCxJPApqkKCd1dSjzZc 2RnOXx3Jdr+Ws9q3CR2EVsbjoOwLVJ8oGgQMYAZz/Rwhp79jhmyKrC3f8a9zOeQtJaqc V7yDbBKIiNgepuuCg0qrwXRjeWcoQ88ieNjVigIxetycU303esJmSDnHDgXF7lllDITF r0sw7WKUr9A27gXQKb4pRHsUWqPok4TlniKuujDUqFjVgfXu5eMxm1FY+zRSr3TfEtLu aA+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706372390; x=1706977190; 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=ZOjDepVi55uZJQ1rIBBnqb1diEnF/zfemFV4q9wl2F4=; b=VLGXcOgDAXl61V/+Teu0ADE0484XTzexENyq85nJrfiH87tol22y+2jVptsLpK/2PK aXnTOG2GcnCdd6AEAn7Bx2A+D07v4GUG7dCLlethxBArX0hLRPF8aY1A7k7Ouu3/nnZf dEG/90MdqXLmCeQQrctKItqMuNdh4epyejk91xyw1sEiKLkaGcpYm2CO9zQeAzbcjMqA 9ln+9Bz5vrkQUWVyVJiE3UEjhkbZknA5kmvWoits9VfATg2Rl8LVbN+uJtPZqbg4GzFx PcDPXv1aV8gTAA9MxJV7IrSRlx9jxESz2LEJvm3SYeci5/mgir0PRFiQ2K251QEyhVwk 3gBg== X-Gm-Message-State: AOJu0Yy0Y46zUDQTBgT+WiN2Vo7sjLzykcwbF/z+0M7mNgWS5MJzb6rz qC1yUpHVCM8N5eVGKSjCMtHekyr8njK0+3jm6prx1cuJ3sjVFiBwKkZ8GZFG0lE= X-Received: by 2002:a17:903:2348:b0:1d8:a7e3:9dbc with SMTP id c8-20020a170903234800b001d8a7e39dbcmr1616931plh.94.1706372389620; Sat, 27 Jan 2024 08:19:49 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([171.76.86.17]) by smtp.gmail.com with ESMTPSA id d11-20020a17090ac24b00b00290f8c708d0sm5091620pjx.57.2024.01.27.08.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 08:19:48 -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 , Krzysztof Kozlowski Subject: [PATCH v12 16/25] dt-bindings: interrupt-controller: Add RISC-V incoming MSI controller Date: Sat, 27 Jan 2024 21:47:44 +0530 Message-Id: <20240127161753.114685-17-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240127161753.114685-1-apatel@ventanamicro.com> References: <20240127161753.114685-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: 1789261364348154456 X-GMAIL-MSGID: 1789261364348154456 We add DT bindings document for the RISC-V incoming MSI controller (IMSIC) defined by the RISC-V advanced interrupt architecture (AIA) specification. Signed-off-by: Anup Patel Reviewed-by: Conor Dooley Acked-by: Krzysztof Kozlowski --- .../interrupt-controller/riscv,imsics.yaml | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml diff --git a/Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml b/Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml new file mode 100644 index 000000000000..84976f17a4a1 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.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,imsics.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RISC-V Incoming MSI Controller (IMSIC) + +maintainers: + - Anup Patel + +description: | + The RISC-V advanced interrupt architecture (AIA) defines a per-CPU incoming + MSI controller (IMSIC) for handling MSIs in a RISC-V platform. The RISC-V + AIA specification can be found at https://github.com/riscv/riscv-aia. + + The IMSIC is a per-CPU (or per-HART) device with separate interrupt file + for each privilege level (machine or supervisor). The configuration of + a IMSIC interrupt file is done using AIA CSRs and it also has a 4KB MMIO + space to receive MSIs from devices. Each IMSIC interrupt file supports a + fixed number of interrupt identities (to distinguish MSIs from devices) + which is same for given privilege level across CPUs (or HARTs). + + The device tree of a RISC-V platform will have one IMSIC device tree node + for each privilege level (machine or supervisor) which collectively describe + IMSIC interrupt files at that privilege level across CPUs (or HARTs). + + The arrangement of IMSIC interrupt files in MMIO space of a RISC-V platform + follows a particular scheme defined by the RISC-V AIA specification. A IMSIC + group is a set of IMSIC interrupt files co-located in MMIO space and we can + have multiple IMSIC groups (i.e. clusters, sockets, chiplets, etc) in a + RISC-V platform. The MSI target address of a IMSIC interrupt file at given + privilege level (machine or supervisor) encodes group index, HART index, + and guest index (shown below). + + XLEN-1 > (HART Index MSB) 12 0 + | | | | + ------------------------------------------------------------- + |xxxxxx|Group Index|xxxxxxxxxxx|HART Index|Guest Index| 0 | + ------------------------------------------------------------- + +allOf: + - $ref: /schemas/interrupt-controller.yaml# + - $ref: /schemas/interrupt-controller/msi-controller.yaml# + +properties: + compatible: + items: + - enum: + - qemu,imsics + - const: riscv,imsics + + reg: + minItems: 1 + maxItems: 16384 + description: + Base address of each IMSIC group. + + interrupt-controller: true + + "#interrupt-cells": + const: 0 + + msi-controller: true + + "#msi-cells": + const: 0 + + interrupts-extended: + minItems: 1 + maxItems: 16384 + description: + This property represents the set of CPUs (or HARTs) for which given + device tree node describes the IMSIC interrupt files. Each node pointed + to should be a riscv,cpu-intc node, which has a CPU node (i.e. RISC-V + HART) as parent. + + riscv,num-ids: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 63 + maximum: 2047 + description: + Number of interrupt identities supported by IMSIC interrupt file. + + riscv,num-guest-ids: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 63 + maximum: 2047 + description: + Number of interrupt identities are supported by IMSIC guest interrupt + file. When not specified it is assumed to be same as specified by the + riscv,num-ids property. + + riscv,guest-index-bits: + minimum: 0 + maximum: 7 + default: 0 + description: + Number of guest index bits in the MSI target address. + + riscv,hart-index-bits: + minimum: 0 + maximum: 15 + description: + Number of HART index bits in the MSI target address. When not + specified it is calculated based on the interrupts-extended property. + + riscv,group-index-bits: + minimum: 0 + maximum: 7 + default: 0 + description: + Number of group index bits in the MSI target address. + + riscv,group-index-shift: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 55 + default: 24 + description: + The least significant bit position of the group index bits in the + MSI target address. + +required: + - compatible + - reg + - interrupt-controller + - msi-controller + - "#msi-cells" + - interrupts-extended + - riscv,num-ids + +unevaluatedProperties: false + +examples: + - | + // Example 1 (Machine-level IMSIC files with just one group): + + interrupt-controller@24000000 { + compatible = "qemu,imsics", "riscv,imsics"; + interrupts-extended = <&cpu1_intc 11>, + <&cpu2_intc 11>, + <&cpu3_intc 11>, + <&cpu4_intc 11>; + reg = <0x28000000 0x4000>; + interrupt-controller; + #interrupt-cells = <0>; + msi-controller; + #msi-cells = <0>; + riscv,num-ids = <127>; + }; + + - | + // Example 2 (Supervisor-level IMSIC files with two groups): + + interrupt-controller@28000000 { + compatible = "qemu,imsics", "riscv,imsics"; + interrupts-extended = <&cpu1_intc 9>, + <&cpu2_intc 9>, + <&cpu3_intc 9>, + <&cpu4_intc 9>; + reg = <0x28000000 0x2000>, /* Group0 IMSICs */ + <0x29000000 0x2000>; /* Group1 IMSICs */ + interrupt-controller; + #interrupt-cells = <0>; + msi-controller; + #msi-cells = <0>; + riscv,num-ids = <127>; + riscv,group-index-bits = <1>; + riscv,group-index-shift = <24>; + }; +...