From patchwork Mon Feb 26 04:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 206224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1859133dyb; Sun, 25 Feb 2024 20:10:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0MxPyPEepfXx9JI0jrfVYfCjHksRq31+/T9AIJBu2YCjpDTziqk5O6uXzrj4JQPmftTTwlzF0luGmDxt45WjtuuTDhg== X-Google-Smtp-Source: AGHT+IGCkIJrlk900cpgOM/T8lad+35Gq3Wy/oLKF/3Bvxvk11IBtWw1eS1pA+IjWu74+i3xge2Q X-Received: by 2002:a0c:ca8e:0:b0:68f:73d4:75fa with SMTP id a14-20020a0cca8e000000b0068f73d475famr6167850qvk.58.1708920608481; Sun, 25 Feb 2024 20:10:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708920608; cv=pass; d=google.com; s=arc-20160816; b=aSKF4yrMzCW4VkzmTgfMtg4QWUqPDISOIYj429yRJkfIfLgqS5Noyf/sK+rdvZZ6E5 aN7cxmcWNPiPfcuVMLjuxnT7a4Vtdshfa5gOwZ8710nzeLk+RwBs0Kt8Vky0XHweoGdK cb+ljZvQc4GdKJrwuoNRpbwQoyw7O27LziTjZxGdZxvVvNVg11JbZstJURp5tzSX3jdS hZWXFI5vyb+jbE202O5/aJbGBT+kD3faugOK1lKgeXcmOsFe2aVxzRG8QD9Zv7yOUHBB DcB0LoUUrPzUMaXL+EiilNoH2uoZjRwEKregLI0UHuzvKJzyeSDptVBlhzKI0hfnBP3C XKng== 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=e2jsLyFwepKDrwIr/uWJV0RdUuyknGyf55lcJyFTRiQ=; fh=XWXmzsPewoaqt2IsN8Z/4EzAIuIG9V4arj0tZolFja8=; b=A9iEvxCFgkEKH4/el+HNgPiDC+NCjD3ZSARv0CTmh0aRaKg14UKQ3nYiY0ia0NYJ5c +e02Nj/8YTkVWZBXf6pWVuOhHu8YxWRnPt8UxXl0GYAbDSw4JSVGLwIs7KTVaaQU9mZZ wc4bSYPqxLclQDkgMskxqBVHyDutPN3Wkct+2HmjQEE2Pu83UquxTPCWPYTkTS4vywz7 dtFUXzAWMiRO8RKx/Ng8A5nDN2AgwMx8PjLSoDuNlXj3rNdE0R+6+tDoZcdQ0sBdcXGU AqiC8bWshZfv76PoHOkuRkIA9/V+CsS2GGKJ0YQMVEV5Y+8urRQrX8JMhf0/Qt3RQ0oY wO2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=FIN4jGy0; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-80531-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80531-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id kd15-20020a056214400f00b00690069298dfsi1752107qvb.430.2024.02.25.20.10.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 20:10:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80531-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=FIN4jGy0; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-80531-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80531-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 4A0811C2157A for ; Mon, 26 Feb 2024 04:10:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5302C1BF50; Mon, 26 Feb 2024 04:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="FIN4jGy0" Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 27C581AAA5 for ; Mon, 26 Feb 2024 04:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708920554; cv=none; b=K2hkwsUIbRqIFFaU9S99d/XnBC4IJ4v/F/aTLAGL7YeTVMAMx9BCEqnwscAcfOvTGmVAdF1XUecu6u7MEUkTepfHWVnD+hBF+rfRaLwENSVeo7stORy9WQbJVwZnO+2bwgQc4BU4Gqz5klivXHyXvMq6gjgi0dWv/ZvAsNkhlhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708920554; c=relaxed/simple; bh=6ldkn/NLN5Vok7/3YlbAjD/lx6DIcA8TyTnQ2yT4OV4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X9Wa5oxC6KN0zQFQrAGNeicK9ZFFObZmUg6F5Os9SMErXPOd4giysnBqv/rwKVf4g3yvVaqUoHIfjzTKPEacMQ37VmqpgxvumljfQGOqBxdvHVhtKifhPsSA5fmBgqxVkBs1/k9Q8CIvV0heiig7k8svPzPgFZYsZkdDDgBqXOI= 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=FIN4jGy0; arc=none smtp.client-ip=209.85.214.179 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-pl1-f179.google.com with SMTP id d9443c01a7336-1dbd32cff0bso17730135ad.0 for ; Sun, 25 Feb 2024 20:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1708920552; x=1709525352; 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=e2jsLyFwepKDrwIr/uWJV0RdUuyknGyf55lcJyFTRiQ=; b=FIN4jGy0WhUSHOlyoEWYN/Y62yHv171dMKZ9AiPlRnbhkQs1QG8AaRzUQKAGWFVPj0 ddsQRuFSalVGNs8mfFCjl7F/uiPfYfGp36tQzAUvu5aVdpojk6LjZT4VgblxJRqU4wCB mUMAig5XVfi2pV0+2Zo5cXvqm5Ic+ae2tEZ9UBsCrI9VobDieAZ3N0IHDuP5u+FE056a tgFgC73PmcZjVThQXa8Wb8hTzdiY8tx7LmEwyKSe8LGWAksRTumCSsgffL3FaQ0pJ+8O haPFMihw68++5MD9COX57ILKEAqtJ+VDAxZt36X+nicmA2IY9A6xaEdMgizibkRN/rSX PIFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708920552; x=1709525352; 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=e2jsLyFwepKDrwIr/uWJV0RdUuyknGyf55lcJyFTRiQ=; b=H4ACVld71myGcVZELztG4l1YVRbVmRwEhHt+Q68YJOeOb7TdKZ8CrsXko8EusQ6RuN AM/DeptE4vVYJ1+9uNQnDBHBGLveTTmHQvPWEn36U3dpZGcAqijXvqVt4n/nrfOMkS3j fY/PjfljR+MgMwvQLjUbZi11m82ehsUp9e24DgWRaesWx7tdnMxGffuJgM8RXdKGH0oS T24Gbkv/nhDVTpsq40iwOblOCJFnFyuyWfPGqHRBnqXkLYtlzKJuTKBlGkhRxGl5rL1N 1TNrjT94dMOtLwDC22sKGySLASzTRNE6TSkqXu9PczdS3l7oNn4JQV+MwgJM8KRaGZ8w 7dQQ== X-Forwarded-Encrypted: i=1; AJvYcCUNB69wKUD0m5ChyiJKhyQrqsFFiDnzRY8qMClf0gcJuO8s8ggb8d6gVL+2bMDLDJ1Xlr0G4W2Tu7YWz+wpMVz3xOv47jQ+gS1cbgKj X-Gm-Message-State: AOJu0YyUFsgiPcd+2nJnUDF3hZtb3PnUjRFy86FhBzT5QCNLdItWNpoG YWuOWq0FE7jEFqP8jWKJBJDfZSPDzjHlNj2SLol1pDr99QI986PPU9y7UnlPFB0= X-Received: by 2002:a17:903:2409:b0:1dc:81b8:cc1e with SMTP id e9-20020a170903240900b001dc81b8cc1emr5101477plo.60.1708920552408; Sun, 25 Feb 2024 20:09:12 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 20:09:12 -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 v15 02/10] dt-bindings: interrupt-controller: Add RISC-V incoming MSI controller Date: Mon, 26 Feb 2024 09:37:38 +0530 Message-Id: <20240226040746.1396416-3-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: 1791933136094606557 X-GMAIL-MSGID: 1791933136094606557 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>; + }; +...