Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp461494lqm; Wed, 1 May 2024 06:16:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+ERvfw/S16mM8JikHO20MM4Bh5EoSe3IWS7dvz+cYIqLECGftQwk0JiWFROkZX7bWViV+oquV5ayeG0sZgwWuY81yRZ3DSj9BtuWuTA== X-Google-Smtp-Source: AGHT+IHcYxylCfqneZOQ/ahL37BzyPLNwpxF3zxOrNMpw9itepaE9+Fqxzx2XdAw9D/d4Htd3+ye X-Received: by 2002:a9d:7d0e:0:b0:6ef:9dcd:56ad with SMTP id v14-20020a9d7d0e000000b006ef9dcd56admr1733442otn.38.1714569369098; Wed, 01 May 2024 06:16:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714569369; cv=pass; d=google.com; s=arc-20160816; b=fhcYp5UDJ+VQQqWhLu31bbMaAf/K+MrcZJY7YtW2JbYRrlstZlmkYKZxMuQZVqBn9A ZJDSPg67IEFKgYiDl0nPTEmlji/DK/MW8oC2Ck5guQIx3BvhOM1ZP6YDitU1M45llEnw KLl54tg+1cMddEf66hGYT9v2HeRofZ+ZqIh8tS6nfJyt1gN5UVJku1jOxdg5khrYajbN ZbubrKL58JV8+jKiBvT1Q1ssAhtWcwy9EQV3E24N7Gqzf2B1G3IOdA7O8D2d6SFlHD3J x3otMyN3HtD4+QtThGyuTVhvBTY8LDw3uz25xT8IDmyRYynCgpfNI8NmQUI3iWr4oeG2 KYZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AiVp4aIh7VmFFO5vgaT4x3hD4NDgnMrxrr7DzziBECA=; fh=QoibKLEXIEpBTozPPb1rUm1yOH8lEO4NM4wINRwoqkM=; b=kYMPcw3UtFqjh/YURqCmdiNaznNuxWW7FRzX/K9AfySjsuLKGr6rFkfqCb6NBkWU8+ 08UdxvzypjPvHjRuNtRxpOnmkb3GOMYEGV0RMwp9TmDYh7jg/nknbNL+Zq/OWlx91tQ0 741K3+JRhTZQ6zed0XaKwcuRQjiq+DxxS4eSP78V+Tr8JQRV5RaY1wLraI0CbmfNuAub vqw21jo371Qs/WzApmLhP3ksAeJUQaErZnnfhebvkzgHCYM82be+8nwMrHKlOyiGLid3 tUJ283g9Zw5KrJaWQ/s5uzgUhYQUoXZfGzNai0Z2sZNTpkJR/5f5tUDNXRI9EZPcD+kn NhCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pm4Q5Ph3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165307-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eb11-20020a05620a480b00b00790eff03565si8314192qkb.513.2024.05.01.06.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 06:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165307-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=Pm4Q5Ph3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165307-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 9326D1C21357 for ; Wed, 1 May 2024 13:16:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B3E512DDBD; Wed, 1 May 2024 13:15:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Pm4Q5Ph3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F84912DD8E; Wed, 1 May 2024 13:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714569358; cv=none; b=MpHkeDcEejLK5FMFij9UUKx7rw/t7HDj2a6KdZrT50LG4jck3RfJy79+rIzSoDkcAHmCZOCiiv2ocUbwj0++4ABL6jjCPY9jYFGbaL4p5m1rJf7R0slHhyMCoiC9SUauM7Xj8zSodcIfaXHzUv7qVIrtGVr/N+J4n4QcK7YfO38= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714569358; c=relaxed/simple; bh=SMu5/M35r01oC6tcgA4Z1ZBtXBnVinplRgHwFdbOwr0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SMnPFyVmaufPGAVbZvBorXwR0PgHDwwKIk9+L5iAyeQJUk1WbbrzUEXkC0LmWi3GSfP8XKK4oTjSi5IAUEJqc5qxNfeWrPI214d67hQxRL5lyLvy2A+cDQU4ofqrEtdZbIhStuZnNoJj2jQmnpzb4fOhU2L+ixnFfqo74aKQnBA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Pm4Q5Ph3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB29CC113CC; Wed, 1 May 2024 13:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714569358; bh=SMu5/M35r01oC6tcgA4Z1ZBtXBnVinplRgHwFdbOwr0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Pm4Q5Ph39GLGiVEE/QaDTi0gKuPAeN1O01XoJX9DrPoh2dcDynVlEYEFGEEAky2IJ +8IyRM5ala3q6kWdwMTZMZIxtkRDAHMA8p7etduck+xjB94Gxpl/vd6SPNWWAzjy7y +IVTDaPtcTR6A6cQlo7qghD5ImdJQIRcMfHH5exIXa49WToCQ0DRaoWpjke7rgmckT 8F+tL1/aXnzlKttsx7LTYw6N5lzfFHGSmof+YEpD0hkn3pCS7etdkF3VBMXb8lOOdM lkmXKNZ9nuwa4qvP3uLt0MRt19ovJ4ZA5MYS5ca8rWDSap3x3ie62ODZgoWLbVDJEx IAwqlVdKFC+1Q== Date: Wed, 1 May 2024 08:15:56 -0500 From: Rob Herring To: Tomasz Jeznach Cc: Joerg Roedel , Will Deacon , Robin Murphy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Sunil V L , Nick Kossifidis , Sebastien Boeuf , 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 Subject: Re: [PATCH v3 1/7] dt-bindings: iommu: riscv: Add bindings for RISC-V IOMMU Message-ID: <20240501131556.GA2931109-robh@kernel.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Apr 30, 2024 at 01:01:51PM -0700, Tomasz Jeznach wrote: > Add bindings for the RISC-V IOMMU device drivers. > > Co-developed-by: Anup Patel > Signed-off-by: Anup Patel > Signed-off-by: Tomasz Jeznach > --- > .../bindings/iommu/riscv,iommu.yaml | 150 ++++++++++++++++++ > MAINTAINERS | 7 + > 2 files changed, 157 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..16817525e157 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iommu/riscv,iommu.yaml > @@ -0,0 +1,150 @@ > +# 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,iommu 'qemu,iommu' is too broad. Could be other QEMU implementations of an IOMMU. So '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. The reg > + property is a five-cell address encoded as (phys.hi phys.mid phys.lo > + size.hi size.lo), where phys.hi should contain the device's BDF as > + 0b00000000 bbbbbbbb dddddfff 00000000. The other cells should be zero. No need to describe what the PCI address looks like. > + > + '#iommu-cells': > + const: 1 > + description: > + Has to be one. The single cell describes the requester id emitted Drop 'Has to be one'. You already said that with the schema. > + 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,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,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,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>; Bracket each entry. > + > + /* 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 >