Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp770288lqb; Fri, 24 May 2024 12:35:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTTTkw1vt/y05T/ollOb1EYfWarzb0AVGRrPOP/IKhy1Wu2SAJyd0CdLsbgo8anCgnTi6/BU0d5T20qWhZcfhKbctHhLWdapsJe1Bgsg== X-Google-Smtp-Source: AGHT+IF7mtGXkMZ2axStjSMow+9kC2B6EQCrCIBOd9XTNT50ryjQe+Rv/p81paMEWgK5bNjVFM9h X-Received: by 2002:a50:cdd7:0:b0:578:3334:616b with SMTP id 4fb4d7f45d1cf-578517a9000mr2823725a12.0.1716579320001; Fri, 24 May 2024 12:35:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716579319; cv=pass; d=google.com; s=arc-20160816; b=pMlrxjhXy/TULyWohDlcm6vZebSiTAULUhnRAytkvIVSM7/ZCmCxxcrd1YJHjWqTFl vNmigXNqUObEMX6s5B8AWmp1pZfm0XF4t9f948FJn//q4d4pcgXj0aadPKHSIXyniyrA 3USRblscplId++lth6ktbczABK3njPVG+qRtmE9EjeDuSfsnbSCPAaA53MLiB0hu2pil AjhZ7q2lVv1q779FKS6nFenYuIc0Qk/pRdcTP8UFli9+vAz5AaLJI0/JHroJjZ9O//v3 3Y28g9IkoXqHiUKosUpmQSH5o5qJnnRE9868GWA3uSuuzBJVtptFvuLXeRKrv1SJSVAT Ua7A== 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=+6ZCRHhHgt+ykFdnp7Z2Pkv1IEgHCkkKr8xgjwZKIrg=; fh=AeoxAGsDhE1qWFi2FbSib2FcgcdQuAzDj9hWmGc3FsQ=; b=N6PalQ55dlwZbyyi8OYV2xPcUvc8tD1Vt5T0zaOrgJdbAKNI3ZrtdCOxgDKZM1VEFp 91roxR43PgISJ4l18nBZwfI9P5shby2aLQnoWrW3k1dxPd9sJexOZ34HmWacgTJFEStz libV3IdpjcgJV+9MFpOBk77IFbKT+tBn73ro3nrY/pcQY6gYR1cSLjHyWcajsmkD23mP LgiFEnsA3qlia5DfyY/KLCohEIE/Bxlzu4kvPjrLLKiDzlXU1/0hDVAHegHG6Uk0xBP3 nqBj3QKFYQBbciJKRbbhupBbxcZUELpXWrBhWDXdn8CQ0cyOPoAXxC/YVeG4X8iBY83U 3dBQ==; 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=fz068mMJ; 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-189049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189049-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57862ebf1absi428286a12.84.2024.05.24.12.35.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 12:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=fz068mMJ; 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-189049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189049-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 700771F23810 for ; Fri, 24 May 2024 19:35:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E7FF7442A; Fri, 24 May 2024 19:35:05 +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="fz068mMJ" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 9483C5CDF0 for ; Fri, 24 May 2024 19:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716579304; cv=none; b=SAo8QW4Mw299JoctLrxWdcoTv392xtgOgF1rOxSrg95+vOoFl8OVO23pUOIR8Q+RXsTLiF9f34ZechxDRrSLGy932RmBPigPUKbb3pjPk2ejVx9+gulFjoHbXCQl4T1o5tjYeEw4bjyk8dAOVCyETpKJAXCfextDlTugZhvNNFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716579304; c=relaxed/simple; bh=opuHax8roT2BI4Pe8lhdIpmMxaQdJCHbIPtuUoDKb6U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ML9rfhBDsDrbZzq7EvTM3Ox4ydXXCNHy/LqOQN8zY52YaboVgIguTAti3XUxvKD6sufYgiW9zYjBq8P63lfCvrThkqweBB5agDBDRxs0NkUeCVzRYoZ+2AA7JlNq93QIGLqY+/MFyyR76YeUvH8YwPwFdR4hu7qUHHlqvag908c= 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=fz068mMJ; arc=none smtp.client-ip=209.85.210.176 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-f176.google.com with SMTP id d2e1a72fcca58-6f693fb0ad4so4169658b3a.1 for ; Fri, 24 May 2024 12:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1716579302; x=1717184102; 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=+6ZCRHhHgt+ykFdnp7Z2Pkv1IEgHCkkKr8xgjwZKIrg=; b=fz068mMJdNy608UQU8QLUTRjl/5pePryubdFsXBaUsDMoHKM4ayO8fZosdOL3aZUfy caaSUzqLXsveQGqemrN9gkO/s39fPHewVvvcxU0LJ8jL8moS+asZA8bXyNJVQ5mIBTW1 JjuiibPIJB42ZvQj9yBNokPXcAjAHoumIvElboROxdMP6L2EePmbAHuEHn1RgAi7ZEZO hhmE65lOzbKXlsTrp7urr/9P2A28RdwgTLHeHbVNoTgTPLIHGAf727wGXBMC0deh1Ryb XmK1v4Hexm5WWT7yW9Kimtg3Ido7xaLGq24sfZHNudo91Rn/AejWu21+qA5Ck6GRFY3o s1Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716579302; x=1717184102; 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=+6ZCRHhHgt+ykFdnp7Z2Pkv1IEgHCkkKr8xgjwZKIrg=; b=JmnKYy7yae/0NwCZJuxdIASABYvbzuPu0MlwOL8quwfxOQEdFyIs55cAexR9dSDk64 iewJLR4ME42iDUwO3XKraJ3/9j7+ay992u0k5+h6ysQmulDGx6ytwwktb4g4HIP9C1Ji Zgzu9RIGPmUFlsMtW1ACVK9a0rVzRLiriBsWvMVtgEKmyd7nBvwM6g1q94MgAbB4DsGI z/iB9yybeyPj7frvkyoNWSuodLlmrSQMfohIljiwqeBDPxOnKJh6gpzR3JoKvlPZ7pY/ ALZx6bOTrTwa5EFKjXWLJK4rr9Tnc/ulbJAitlWg+W8y849JncXCtMe8M2BZN+uD57rN 2+6g== X-Forwarded-Encrypted: i=1; AJvYcCWqWdPi1b/YMlbojaFwZf1ppYBNHz4InXCaHkxJbAOawZ+UTZdu9VolP09LX9NavFrK7Rvy5AHOCVkwSS7EFLBu3sBMrm8wZueC4/rQ X-Gm-Message-State: AOJu0YwqZTDSeGmn0RcxSss1JrTc4+5kFIGtgxmucbD71ZXba9b8VXVM TXxA8fQh6UGamILY7kzhvMnU8gBilx1Y5w1i2cOQ6ISSBYUvUw3E5J+gOhlg0Bo= X-Received: by 2002:a05:6a00:3007:b0:6ed:cd4c:cc11 with SMTP id d2e1a72fcca58-6f8f3f9f43amr3418278b3a.25.1716579301636; Fri, 24 May 2024 12:35:01 -0700 (PDT) Received: from tjeznach.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fd4d878esm1441684b3a.190.2024.05.24.12.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 12:35:00 -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 v6 1/7] dt-bindings: iommu: riscv: Add bindings for RISC-V IOMMU Date: Fri, 24 May 2024 12:34:41 -0700 Message-Id: <6777b49a702723f64bd83f96c4275452b56b7a02.1716578450.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 27367ad339ea..1ce589eb9c15 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19265,6 +19265,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