Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1217559lqs; Fri, 14 Jun 2024 22:28:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVS74MCn174TZiyJ+6a0bgk840CUL7TtwPi12nOaSW8PXX6/vRl0jLj5j7tCxurebC2Bk6TjYLUsHTHL7JlQv4eFBneDSWGLcOu91gjOg== X-Google-Smtp-Source: AGHT+IHvngFTUx+I74WvlIBNm91A5Z/8Ci9LiN21pKjAxbCif4R9tJQgOtviRr5bPdffjE7/M94L X-Received: by 2002:a0c:f9c7:0:b0:6b0:8bee:50f0 with SMTP id 6a1803df08f44-6b2afdb7e88mr49796916d6.60.1718429287518; Fri, 14 Jun 2024 22:28:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718429287; cv=pass; d=google.com; s=arc-20160816; b=wQ3ZKVtf1ds9MkLs6Tmi0L/Pgcf2dr06QUFEZNnxxq8o3n8jldm4M30tW5ejewbClp jN7tPKYZx5EZSsDRGMX+4/7RUI4lbasfWSpx0ZVWrzT+UF9BKbpIfMAXHSFKngSRsJmz ArbAf2MnjvXOUy97tZxApvOvd+YkR7roqyuxWwD2oz8QcXoEGOlu6v+SYLP/MM30LJCB SlpfemH/KLwf0MPEEkJQ8Fl1o+kgg0hX87vH37DfCeaizx5lzXSUTmuAf/VmOolXEDSx MuMJPK+Tpu9azrejs4eqSppfK/ulP1sCL9G7foY5Wi8ElenDJrygczLR1Ie6rRQMa5qP 7Bdw== 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=hX4rXy+acmv+ohoMY8KkeM2ChnDNLgiOcjEcwsmP8c0=; fh=K4fHlOlEUUvWBgcubVxFSLDGEgNAeM+dVmsKQS8HDnE=; b=jvp2y/hozOBe182jYQgBezB+cFSuaq3qkixsZ5bc/uNO7q2ExVQ/5gedVhbT66iNIT nRVzbRMOZozWsmPvKRCQKI0o24vnkrO3gEcBk0k+fmak1szfWd6Icxw9UODXk3gUelha ad6M0YG/jxQrAozvFGYqv4fmRjKUuj6mnmlD85bSojenHmvs7DWviGWNW1FDOphmxQCi Rw/4pxCXWy8x7mq2rsRIYrPtqaPtnEaxUSOpkku2jUmrVVIEFc75XxB7mug9uDKR9pAT tFBlhiLAAPncGIRyYtmRLsmLKeqSRkskMUIoFmteDPjuF4ytPpY2g/x3EZGLW3jhHUXD eU1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=0Frr0zFM; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-215707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215707-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-441ef3bb049si56902911cf.135.2024.06.14.22.28.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 22:28:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215707-linux.lists.archive=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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=0Frr0zFM; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-215707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215707-linux.lists.archive=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 313911C213FE for ; Sat, 15 Jun 2024 05:28:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7581A16426; Sat, 15 Jun 2024 05:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="0Frr0zFM" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 BF2F410940 for ; Sat, 15 Jun 2024 05:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718429272; cv=none; b=KbDaANaiVZ+uG854FmowhZFXP+DHd4w/a49V2buUZ6nox6hJSFlrSh84GMZfyfIZhHLlF4drlb0/r+TA9PdOIg2EspuvQ+3T7jWNTVJ9BTJHXM+ELJNe211K11FZtuG4LSBO6TLAljguk17JasRKHU1PS2CzqSzBGlketrAonfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718429272; c=relaxed/simple; bh=2isofOljudAsXmMfXcDtDDozt8jWuC69atxQDyzhgmc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Bnl7xeQl5np2taxe+KQud9sdExcb2kLRBF6OS70B+9YdA43Cc8q5ihHS9LMFYgBa+p161fJ4+s1kXIpB+EN1mqedtho4LQQ4FhGGD2lVXKxoKxIyOK+0n0qHsU1Kb4E4X5Z028oaJYzpekBtwwO6EPuJlrpd3c9SzLGDNVsXFYk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=0Frr0zFM; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6f8ec7e054dso1930474b3a.2 for ; Fri, 14 Jun 2024 22:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718429270; x=1719034070; 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=hX4rXy+acmv+ohoMY8KkeM2ChnDNLgiOcjEcwsmP8c0=; b=0Frr0zFMIUfVdxs2cuyicM8Z+A8UCeqFyb5nVC69wLUW/Gg3p6sf9ZnaAwz4qpYi4/ RoAAnP32G9OJsjBqAxaROvE6ql50j+w4o1xDW7sawA6V6IxvZlhm/ZXjqnfIrQ/vNrs5 6BD93/LNSwd5o4rm2ovWp0/Qic5tmJ4iem92Qgs1Pq+TDMrPId0oAZvGodSf8EKVjtJT 2ufq8A6ffnKdYpXJNABnUtewVQgTAVCJL0Pp0hF0OeDU5AFZCRSVtI2rB+KMLiqICjQd IjqLK8iIGgJxepy+cpCFpsoTFSZXkpnP4MHv3UnbyeCoDDmr3kbaiM3DYRk6ivZv5uFo LSQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718429270; x=1719034070; 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=hX4rXy+acmv+ohoMY8KkeM2ChnDNLgiOcjEcwsmP8c0=; b=ioZnw1hhuJ1yKp3TiNTxo9wB9kO1Wqhe0dCinG612HIaiG0ivr74RuFbsjudh8R1sm fmwDbq+u2qkpTEdWdp2HKuNvFYgszRbUMR1ljHSE/3diMUL5bDPFMOOVialh206PSswY XWM04nSprr4jzmCtbtLqlVLQFqDI6qAKMyktJAn14XaFsOw/M2dj1bNcdScYzqTSOUSP kir1LTngMKUVIdWtDLhsS2/3CEQ6m4TceJNsD8pmxWoraktUFXx3/yO7XKNNhz/e6+c2 PEdVFeNgYvXsa+fCl5MT7AwyDN7gS5bX2jfuzU5Euy/4cPK+50/Jp3D2Og5TlVBvWwwj NULA== X-Forwarded-Encrypted: i=1; AJvYcCUvyBchbBpv4aDtyYj6AQxaaiQ//0DQWop7XLz42I4DaNgyAvLeGKuxaCChcGrPtPKho9LStyUaOp0WpDQJubEs8ZdR82FyrAFMzT01 X-Gm-Message-State: AOJu0YwOX64Wyg8ShPFeP/QvLqjiHlxRqSnX4F3IjLoKT7f8279REOeK euYa9yVaonlKfrtGEPN3naKJylYMDQ1uX2JxRPD4+HKFHi5fDMo+WEGCxAv01MU= X-Received: by 2002:a05:6a00:114e:b0:705:dd44:ae77 with SMTP id d2e1a72fcca58-705dd44b04emr4715791b3a.3.1718429269869; Fri, 14 Jun 2024 22:27:49 -0700 (PDT) Received: from tjeznach.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb6b99bsm4081578b3a.143.2024.06.14.22.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 22:27:48 -0700 (PDT) From: Tomasz Jeznach To: Joerg Roedel , Will Deacon , Robin Murphy , Paul Walmsley Cc: Palmer Dabbelt , Albert Ou , Anup Patel , Sunil V L , Nick Kossifidis , Sebastien Boeuf , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, iommu@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux@rivosinc.com, Tomasz Jeznach , Conor Dooley , Rob Herring Subject: [PATCH v8 1/7] dt-bindings: iommu: riscv: Add bindings for RISC-V IOMMU Date: Fri, 14 Jun 2024 22:27:31 -0700 Message-Id: <90f6ecaa9afc6fe4edf005f4d19175446f7afd11.1718388908.git.tjeznach@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add bindings for the RISC-V IOMMU device drivers. Co-developed-by: Anup Patel Signed-off-by: Anup Patel Reviewed-by: Conor Dooley Reviewed-by: Rob Herring (Arm) Signed-off-by: Tomasz Jeznach --- .../bindings/iommu/riscv,iommu.yaml | 147 ++++++++++++++++++ MAINTAINERS | 7 + 2 files changed, 154 insertions(+) create mode 100644 Documentation/devicetree/bindings/iommu/riscv,iommu.yaml diff --git a/Documentation/devicetree/bindings/iommu/riscv,iommu.yaml b/Documentation/devicetree/bindings/iommu/riscv,iommu.yaml new file mode 100644 index 000000000000..5d015eeb06d0 --- /dev/null +++ b/Documentation/devicetree/bindings/iommu/riscv,iommu.yaml @@ -0,0 +1,147 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iommu/riscv,iommu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RISC-V IOMMU Architecture Implementation + +maintainers: + - Tomasz Jeznach + +description: | + The RISC-V IOMMU provides memory address translation and isolation for + input and output devices, supporting per-device translation context, + shared process address spaces including the ATS and PRI components of + the PCIe specification, two stage address translation and MSI remapping. + It supports identical translation table format to the RISC-V address + translation tables with page level access and protection attributes. + Hardware uses in-memory command and fault reporting queues with wired + interrupt or MSI notifications. + + Visit https://github.com/riscv-non-isa/riscv-iommu for more details. + + For information on assigning RISC-V IOMMU to its peripheral devices, + see generic IOMMU bindings. + +properties: + # For PCIe IOMMU hardware compatible property should contain the vendor + # and device ID according to the PCI Bus Binding specification. + # Since PCI provides built-in identification methods, compatible is not + # actually required. For non-PCIe hardware implementations 'riscv,iommu' + # should be specified along with 'reg' property providing MMIO location. + compatible: + oneOf: + - items: + - enum: + - qemu,riscv-iommu + - const: riscv,iommu + - items: + - enum: + - pci1efd,edf1 + - const: riscv,pci-iommu + + reg: + maxItems: 1 + description: + For non-PCI devices this represents base address and size of for the + IOMMU memory mapped registers interface. + For PCI IOMMU hardware implementation this should represent an address + of the IOMMU, as defined in the PCI Bus Binding reference. + + '#iommu-cells': + const: 1 + description: + The single cell describes the requester id emitted by a master to the + IOMMU. + + interrupts: + minItems: 1 + maxItems: 4 + description: + Wired interrupt vectors available for RISC-V IOMMU to notify the + RISC-V HARTS. The cause to interrupt vector is software defined + using IVEC IOMMU register. + + msi-parent: true + + power-domains: + maxItems: 1 + +required: + - compatible + - reg + - '#iommu-cells' + +additionalProperties: false + +examples: + - |+ + /* Example 1 (IOMMU device with wired interrupts) */ + #include + + iommu1: iommu@1bccd000 { + compatible = "qemu,riscv-iommu", "riscv,iommu"; + reg = <0x1bccd000 0x1000>; + interrupt-parent = <&aplic_smode>; + interrupts = <32 IRQ_TYPE_LEVEL_HIGH>, + <33 IRQ_TYPE_LEVEL_HIGH>, + <34 IRQ_TYPE_LEVEL_HIGH>, + <35 IRQ_TYPE_LEVEL_HIGH>; + #iommu-cells = <1>; + }; + + /* Device with two IOMMU device IDs, 0 and 7 */ + master1 { + iommus = <&iommu1 0>, <&iommu1 7>; + }; + + - |+ + /* Example 2 (IOMMU device with shared wired interrupt) */ + #include + + iommu2: iommu@1bccd000 { + compatible = "qemu,riscv-iommu", "riscv,iommu"; + reg = <0x1bccd000 0x1000>; + interrupt-parent = <&aplic_smode>; + interrupts = <32 IRQ_TYPE_LEVEL_HIGH>; + #iommu-cells = <1>; + }; + + - |+ + /* Example 3 (IOMMU device with MSIs) */ + iommu3: iommu@1bcdd000 { + compatible = "qemu,riscv-iommu", "riscv,iommu"; + reg = <0x1bccd000 0x1000>; + msi-parent = <&imsics_smode>; + #iommu-cells = <1>; + }; + + - |+ + /* Example 4 (IOMMU PCIe device with MSIs) */ + bus { + #address-cells = <2>; + #size-cells = <2>; + + pcie@30000000 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + reg = <0x0 0x30000000 0x0 0x1000000>; + ranges = <0x02000000 0x0 0x41000000 0x0 0x41000000 0x0 0x0f000000>; + + /* + * The IOMMU manages all functions in this PCI domain except + * itself. Omit BDF 00:01.0. + */ + iommu-map = <0x0 &iommu0 0x0 0x8>, + <0x9 &iommu0 0x9 0xfff7>; + + /* The IOMMU programming interface uses slot 00:01.0 */ + iommu0: iommu@1,0 { + compatible = "pci1efd,edf1", "riscv,pci-iommu"; + reg = <0x800 0 0 0 0>; + #iommu-cells = <1>; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index aacccb376c28..0e0cd18d915b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19262,6 +19262,13 @@ F: arch/riscv/ N: riscv K: riscv +RISC-V IOMMU +M: Tomasz Jeznach +L: iommu@lists.linux.dev +L: linux-riscv@lists.infradead.org +S: Maintained +F: Documentation/devicetree/bindings/iommu/riscv,iommu.yaml + RISC-V MICROCHIP FPGA SUPPORT M: Conor Dooley M: Daire McNamara -- 2.34.1