Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1889947lqm; Fri, 3 May 2024 09:13:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdPNsaR5RYmAWo8O3Y8oo4msfGJlQddc8ApxDhicxNRbp2odXtpnaHD8tOKb3lbnrnIf/Kg6y4Kh5ltVgxTZnGvWzkRmSfQoAkzt57og== X-Google-Smtp-Source: AGHT+IHB9DTTSJKeaShwlpD1Z5VDnrYJ4CMJijTXl/UI0/FeE+ABowYFqs4SiQ9UEyeVxUET3k8M X-Received: by 2002:a05:620a:56d1:b0:790:cd4c:87a3 with SMTP id wh17-20020a05620a56d100b00790cd4c87a3mr4946319qkn.34.1714752789319; Fri, 03 May 2024 09:13:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714752789; cv=pass; d=google.com; s=arc-20160816; b=DXQjZNxXGhJMgfk2CU1CpuBM5nqN7yQHY3XBjsMDEqB/tdcTKSvPlgdxjqWBESBO5q oUapF5Le0JLN0V3N8gT5vqBIXegsgwRgMCShGwL9nA5H0R1PRiLsuyU9X0euEcNhwkUl +C9SaGjiMu/RSfPx13UgyMZxexh7ABDqtWb6l8SBt2dCm7g+uYWhpu8itaq1OgtnvGcX FLsDxEMYml6ybpHUIADpKSCBdPZtsT6KpAOPLLHoAzn3Pc0mT2YzYZOrpjIxnQQijliS Q+0cJOc8k8kP4CE/vXImKBw55dkWqGkh+Exu1GRGQROknXFHCexqFm2CIWDudkoINdn4 Hidg== 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=2mgnoeguH7nHlN3yB90cDuTlgE+n/4swoPekxA8B/YA=; fh=6b8gIk01zLG7ICsRBDgLK4B08uA3hf/uLYxPmK4vfmc=; b=ho2q5liw+xA/0MTxVvEl93SFR5TjwtZPgBZWkFLdRYOpoB3EutXxXnX6VXtyTZi+9c SsqEas4yOs8J7rNIKD2nKye/+ICq6dfHiZvyfvGQKZmNF50pkracnWLkKLNivtzCDGft 6ldChafhprcb7Tw0FCzmHveZd5TSUlnSYHaiLbh/g3lLlHgZ4j2rKtTbc9wvUTKDgp5J sdZhAoh7tqDuD29MHgdQs4s1JOxnSvCFXamyz/ha1Z5VkPvT0+On/IPQ99VyNbQ51Gtf HVXrOOgOT1qDi9BCnNsCGo++Cr7RVCFvKg2ghrjNZYRiaPD5cirF0f+/0MJ/fr5DUlDS 6iOQ==; 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=ycif5K6g; 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-167879-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167879-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 bm11-20020a05620a198b00b007907aa969fdsi3943846qkb.737.2024.05.03.09.13.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 09:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167879-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=ycif5K6g; 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-167879-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167879-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 0478C1C20CC2 for ; Fri, 3 May 2024 16:13:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 308721553B3; Fri, 3 May 2024 16:12:54 +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="ycif5K6g" Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 A147915533E for ; Fri, 3 May 2024 16:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714752773; cv=none; b=ccOGszroZBmJG6vgL5jPJau+4TQClBrO6d+8VnXvHbLCeHtKLNe7/Cov+z/zVNzM8PiT0mjeCDXezcTlGIjnLIIfvFzXx+ROiWYISkpEX8JosFJVtAYJRXlgS6fIzDKo5mfcIxuqH9WK28r+u2Lu27GG089NGv5mHQwdYwBc2Q8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714752773; c=relaxed/simple; bh=4zbyAdrv6g4sWph/t2B7n4A5BRiiXHkJEWwlHWqvYOo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hQapZaFwT150saxWgs2ZnTd4/Z4JtgFzwT+EapeE84S02kdsK2QM+INrkhDoTlJ0YodU9GvZSEBBdsnMni/oZ43acdO80RcjSOdl0tpvYvhJEAMuWZqflZHA5HBucDdJNg1AjEVvA/4oEu+uNp46K2eNKuDVCO+B1CsFsOuAm9Q= 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=ycif5K6g; arc=none smtp.client-ip=209.85.214.182 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-pl1-f182.google.com with SMTP id d9443c01a7336-1e4c4fb6af3so21930905ad.0 for ; Fri, 03 May 2024 09:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714752771; x=1715357571; 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=2mgnoeguH7nHlN3yB90cDuTlgE+n/4swoPekxA8B/YA=; b=ycif5K6g6AA6az4NPjW8lvt2yV5WBiSFDTnVDZqlu8iZB7/I10ozotkKoV13FTiFzA IG8Ch6e+CYgAh5pR7Gcr/NE01F2SEEJDetYIOSmUgLRUkgoWdGckbUgkLPaMWPpXuk7a RE+dkKiONhmiDpwGkGSyj8+FZYVWTOo+AJXQp08WLzAj/LcEXFl/gZ4tQX2fxULRClqw 8USv1X9TDzxDxzoBs39IgiJe+/2NBRi07CxwGYciS/j63Hxqh2R+M7dcL+hWKL1bkJsI aoOSJFSv/tFsrx9QUWIY7HiNRoPLXitIvY986rQpQfRDXW5Apoet0kevuR6ylVJd5aQ8 xSBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714752771; x=1715357571; 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=2mgnoeguH7nHlN3yB90cDuTlgE+n/4swoPekxA8B/YA=; b=Tn0zuVqLin1iwj3SVS0Mj3fI13ZD4sDcy9Q4Q2oDSPSuNjf1YscBI8zMGscTCi3TX3 psxLM81DJBg/LTAVR1pyJd8vLfeh0ZZAE0WTIrmhIFu+PLbMFCqLvyo944kl+nIHNVjQ tQREq/7Uk+VHVnGzBPL6GkIebv/syl5wZcJ7X5QRqR6CCoRT8O4x5N3QcRGIiDzNoe0c LN2dtwERxIWm8i8hzImmprZLYHkie1kiXuS2hYbEA4T2wE2KwSoekrHd/o/sVmPL2g1B dN8VFCYIJddAsECZv4CcwooWda09nsDYthTAW5zKfy5qW2SXfezlNUl3S0sQG/pbY1b6 Lmdg== X-Forwarded-Encrypted: i=1; AJvYcCW0j3zzzldhSzPbH8UgVs6BgGEoRtJqhPUpBCYG7W177tn2PlTX/iU+ya9WC0GkTUY6+UXxNr1bxUSiaxUQmDotWcchNBlld60Gf3w/ X-Gm-Message-State: AOJu0YzldPaLRXHAblLT0l5fYz3HkGTrjyN9w4Y2VBmIErZTauDATpJV feMidKZrX1KIkGSJ3hfvyFVmCqC8He5fSKCQ2DPPVz6ZQ7fBnQUaIGbjdhCpE6Q= X-Received: by 2002:a17:902:f34a:b0:1e4:320b:4311 with SMTP id q10-20020a170902f34a00b001e4320b4311mr5693013ple.34.1714752770877; Fri, 03 May 2024 09:12:50 -0700 (PDT) Received: from tjeznach.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id x3-20020a170902ec8300b001e2086fddecsm3424746plg.139.2024.05.03.09.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 09:12:50 -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 Subject: [PATCH v4 1/7] dt-bindings: iommu: riscv: Add bindings for RISC-V IOMMU Date: Fri, 3 May 2024 09:12:34 -0700 Message-Id: <845127470ad85f9b4f690077968fe8c5d615c538.1714752293.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 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 f6dc90559341..7fcf7c27ef6b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18958,6 +18958,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