From patchwork Thu Jun 2 19:23:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 12868087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1D3CC43334 for ; Thu, 2 Jun 2022 19:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3PBTlXqRZ/fK5ETk3fjdEVSLh+WPObiLgy4t0PBi/lU=; b=1S1jOg7ZjwBcCi /lr1yMcl8TFLFI+B6FvrZFAaUBmAQRnpz05xQhjQeKMdflmYuaay18OTD4zq7P4YeCnv3AJxleqJo UgrDEE6j/AnAuYMB983DZPw+iOGBBJ80WtczHAGnyx2advF3wPQDGvx+pcKH+cKPaSQsdO6/X9SjG ZT+2defYofCViy8GqJHWh/HbCQhNbY6F5uIX/KJvyKLQUA5IhfXi0mBe5Ei0mDkjPcP9w6mDd9IE1 54v20M3AS6VQb7/A50BZL9lWUEBkgp+1g0rKcABQ8yWnQgAXRMDD8BBT1ViKX7Bky5zSCrX+GvaP7 MZBsSc/Nbup3TUuajd6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwqRy-0044cP-5C; Thu, 02 Jun 2022 19:25:42 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwqQj-00443S-Ty for linux-arm-kernel@lists.infradead.org; Thu, 02 Jun 2022 19:24:27 +0000 Received: by mail-ej1-x62b.google.com with SMTP id s12so4610610ejx.3 for ; Thu, 02 Jun 2022 12:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JATYvLe48LS2H6IM0secvITvXQRFYJatDO7tIGdxKew=; b=VTT0OBaJLQkU0DXmYjkEMy4pAELAV+jBlguhxMn7A/UqRxOPNmS5CHgPtJ8qEHZ37t dJchUBQgCQYu0sVoQ3XZJeZMu/D3NfZmgNzNcTSM6d3mQgW/gfiuwtDFZ3C/zopEft70 53psImCdfXqfPzsfnsJ0x1WX2TilCTwWqqoFx42M3g540JOK5MIBPNJ4HDu3rtPd0NvR Q9zPUyeZA5Hv2CYInUh8MlFvL4nmj/eO1LHolt3AXfJI734JjCLw7bSnIYS5ZeZ4TIuR W3MaS7EEAi42acDU5NxK7pTxBgmMuOOT0q63i2Wpbh1F/ySWKn407asxBaQC4EJYFYUB ZPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JATYvLe48LS2H6IM0secvITvXQRFYJatDO7tIGdxKew=; b=ZjjSV1y2iopPmV7/31krj8RW6Zh/XE6HlXmgEpmp4IbSQWUIzdmw/hv2kR/7dpuJT1 gtrX+vZNMYD5ZSptAvtBVRIXU5jEk27CLoKnUpt7jtxfXgW8BhnpoPc1n5cs4xbiiZli f0Mn1qDVTtenSBATV5Ds9noFc/fQE1pHUUcU5QEwwzs6KWuLvdl9i8ai46s+m4z7eV7c TpUOZqNIP9Jse5FJP2s1vrMN3JMxluRIp6kh7AgXVyHBFtXpwGLUH8z5xBIsfwJiYErn lL3uIJYcWd7WWCFafKN9nGnOesmMfWZ+oSRGjFv62eQR4DI1lJFAFHvCsiueDLtNj1BR Zg3A== X-Gm-Message-State: AOAM533vHfFiYBpqpAaHi4j8MltgOJasLjOLTUrBykdc4ldeTiJjDcAh bVQ7iK4Qp4knwPQwnFQ7s9E= X-Google-Smtp-Source: ABdhPJwiCOLciOxN6TBYEcpArcIF1bwM/jhBDOJnBMmkSZAOupAwiR+Hr2XzW8lOBJHN2sRoLEmt4Q== X-Received: by 2002:a17:906:8146:b0:6ff:119c:881f with SMTP id z6-20020a170906814600b006ff119c881fmr5659395ejw.38.1654197862292; Thu, 02 Jun 2022 12:24:22 -0700 (PDT) Received: from otyshchenko.router ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id eg13-20020a056402288d00b0042dce73168csm2938301edb.13.2022.06.02.12.24.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2022 12:24:21 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org Cc: Oleksandr Tyshchenko , Rob Herring , Joerg Roedel , Will Deacon , Krzysztof Kozlowski , Julien Grall , Juergen Gross , Stefano Stabellini , "Michael S. Tsirkin" , Christoph Hellwig , Arnd Bergmann Subject: [PATCH V4 5/8] dt-bindings: Add xen,grant-dma IOMMU description for xen-grant DMA ops Date: Thu, 2 Jun 2022 22:23:50 +0300 Message-Id: <1654197833-25362-6-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1654197833-25362-1-git-send-email-olekstysh@gmail.com> References: <1654197833-25362-1-git-send-email-olekstysh@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220602_122426_057803_240DDAFD X-CRM114-Status: GOOD ( 24.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Oleksandr Tyshchenko The main purpose of this binding is to communicate Xen specific information using generic IOMMU device tree bindings (which is a good fit here) rather than introducing a custom property. Introduce Xen specific IOMMU for the virtualized device (e.g. virtio) to be used by Xen grant DMA-mapping layer in the subsequent commit. The reference to Xen specific IOMMU node using "iommus" property indicates that Xen grant mappings need to be enabled for the device, and it specifies the ID of the domain where the corresponding backend resides. The domid (domain ID) is used as an argument to the Xen grant mapping APIs. This is needed for the option to restrict memory access using Xen grant mappings to work which primary goal is to enable using virtio devices in Xen guests. Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Stefano Stabellini Reviewed-by: Rob Herring --- Changes RFC -> V1: - update commit subject/description and text in description - move to devicetree/bindings/arm/ Changes V1 -> V2: - update text in description - change the maintainer of the binding - fix validation issue - reference xen,dev-domid.yaml schema from virtio/mmio.yaml Change V2 -> V3: - Stefano already gave his Reviewed-by, I dropped it due to the changes (significant) - use generic IOMMU device tree bindings instead of custom property "xen,dev-domid" - change commit subject and description, was "dt-bindings: Add xen,dev-domid property description for xen-grant DMA ops" Changes V3 -> V4: - add Stefano's R-b - remove underscore in iommu node name - remove consumer example virtio@3000 - update text for two descriptions --- .../devicetree/bindings/iommu/xen,grant-dma.yaml | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml diff --git a/Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml b/Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml new file mode 100644 index 00000000..be1539d --- /dev/null +++ b/Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iommu/xen,grant-dma.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xen specific IOMMU for virtualized devices (e.g. virtio) + +maintainers: + - Stefano Stabellini + +description: + The Xen IOMMU represents the Xen grant table interface. Grant mappings + are to be used with devices connected to the Xen IOMMU using the "iommus" + property, which also specifies the ID of the backend domain. + The binding is required to restrict memory access using Xen grant mappings. + +properties: + compatible: + const: xen,grant-dma + + '#iommu-cells': + const: 1 + description: + The single cell is the domid (domain ID) of the domain where the backend + is running. + +required: + - compatible + - "#iommu-cells" + +additionalProperties: false + +examples: + - | + iommu { + compatible = "xen,grant-dma"; + #iommu-cells = <1>; + };