From patchwork Tue Jan 3 01:08:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 38217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4380707wrt; Mon, 2 Jan 2023 17:10:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXv0bgzLgt3NRwdN1qAZSr6Hy+ee0LWagmHA6xZivxhjkG9enWMOgKhywQdmXNCOSB5uuJMN X-Received: by 2002:a17:907:cbc7:b0:846:ccf3:d901 with SMTP id vk7-20020a170907cbc700b00846ccf3d901mr43431865ejc.52.1672708223907; Mon, 02 Jan 2023 17:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672708223; cv=none; d=google.com; s=arc-20160816; b=UgsF/X+MuxQ6xyggqR43OIkbUXR0pTzVZkU4cmWm4kJb9FEoSQYSwSSZHWDa4zhDMB T2IksuHFr29lxoSxDIfhelQ4GYMbj/XnKyRRlTOgLQZ7IT/XESakFIdDxoHxKX7ZXg7u yYwagCveZtS5v19YNhwiUoPQ20QbSGQy7WZaWLeMV7HCusGUW7eNOT3aHc3f+i1ypynG p1GyQgTDPKiJ6eJnPJ26RWO3pq/s13w0woop5EiOCD0Roh+p/PLwMP+/2y2mAxEk4Oj/ nQsQM8ddweotY3vU0EzneL5giybUhj8kVHinFs30rvN2M+MqX4Z9xnOB/oX53cDHSJ+2 gy9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=rSdD9Eyr/xiErPEA9MSXkTaUL862gDKe06QmYAccHDA=; b=dpCjbPzkwiOeBso2n4YE8gQOT3uS4P0DgNwN2oDVg2//ehINoFZo+oUXPKH0VTWHRg ok/d31lKjqIAVvZOIcDbHKV9jHTpg8/dyv5Z2xvaXRbKbJD6oHVjsxP3GgfjKXUQ6gGw IGMVwSOaaa8zbTZzE12ITXTclYzA+gLSJZ4Cc3dN2dSkntTHpRWKXLauKfbXb2bx0nRD Z1XLo5W/OzNTlp9gp/v8yW/Xn9K/pkISwwZC+3L8y80p7Ts3dnd4f8r3PCaxifbzrTNV rdivg2NqtO+frzxG9gemRQAnVkHfVdFP7BfMBgZzzT+QXspN8YZfBZMvPubkvBOGrHEq Xi6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=bJ5mBVoE; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Whxu3WgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho37-20020a1709070ea500b007ebc267e9fasi28119163ejc.83.2023.01.02.17.10.00; Mon, 02 Jan 2023 17:10:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=bJ5mBVoE; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Whxu3WgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236524AbjACBJ2 (ORCPT + 99 others); Mon, 2 Jan 2023 20:09:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232023AbjACBJM (ORCPT ); Mon, 2 Jan 2023 20:09:12 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D929C6583; Mon, 2 Jan 2023 17:09:10 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 6B3AA320091E; Mon, 2 Jan 2023 20:09:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 02 Jan 2023 20:09:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708149; x=1672794549; bh=rS dD9Eyr/xiErPEA9MSXkTaUL862gDKe06QmYAccHDA=; b=bJ5mBVoE1Z3WMZTo+G W4RivL6losj1Yk3heM1b+vtHt1v7g7+gzFV9eBDACr4xqZFZ2sJAqvRYyCd16V0y bjqiJ2HwzctfOPdWeo+o5GpmSV9vEdN/z1OgHlrd/fzgFWDHO5mTOm1nbhG1bh+h RwQhbu1+MxHnuHBwWBVbyshF2EWzsNAHZdcaOSKsCiE+MteKZBS8Lts45RlqsFS7 MXPyx8b8wivKv5g351huCEjoQARmd+V4LBFHuBBRWdQKwRW4emwpyWBwsuSkqOz/ mhf4V8BGEM8h1ytspibokGxUVlaTtYZwKmvEfwIV0a/0921RXFe8ggPVNjgm00+w 5Tsw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708149; x=1672794549; bh=rSdD9Eyr/xiEr PEA9MSXkTaUL862gDKe06QmYAccHDA=; b=Whxu3WgLF0P77rD14HLeM43ijeHqC pjfUh17lGRnn5tjzOiWgRmun8SMHWmt9cARqW8svO2yJ6O1ZHkG0R07zyTxWjHVq tB6ZXwWSBMdpP+MErqZy+qQmOZ4AK39vAm5xjFvI3p8HnjL4TlXnX0oNKagHpuQO i9agxF7aOC134tzqDMrd6eb6fHuDL01r2t7j/Sxlmz7PMGiqHGq1AnKA6tLz1NiC +fhAqO7qZahSUqTm02M+x5j2gVRPjGKV5sdxEiuoua4ar8yLM5TFnha50w9TEvIz DsQk1ZBEFYH9AbhY85yYujm0dx3FwzAIBK+QBGvBQCyOTj9u5ywMOUAaQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:08 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland Subject: [PATCH v2 1/6] dt-bindings: iommu: sun50i: Add compatible for Allwinner D1 Date: Mon, 2 Jan 2023 19:08:58 -0600 Message-Id: <20230103010903.11181-2-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753961698566447116?= X-GMAIL-MSGID: =?utf-8?q?1753961698566447116?= D1 contains an IOMMU similar to the one in the H6 SoC, but the D1 variant has no external reset signal. Signed-off-by: Samuel Holland Reviewed-by: Rob Herring --- Changes in v2: - Disallow the 'resets' property for the D1 variant .../iommu/allwinner,sun50i-h6-iommu.yaml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/iommu/allwinner,sun50i-h6-iommu.yaml b/Documentation/devicetree/bindings/iommu/allwinner,sun50i-h6-iommu.yaml index e20016f12017..5aeea10cf899 100644 --- a/Documentation/devicetree/bindings/iommu/allwinner,sun50i-h6-iommu.yaml +++ b/Documentation/devicetree/bindings/iommu/allwinner,sun50i-h6-iommu.yaml @@ -17,7 +17,9 @@ properties: The content of the cell is the master ID. compatible: - const: allwinner,sun50i-h6-iommu + enum: + - allwinner,sun20i-d1-iommu + - allwinner,sun50i-h6-iommu reg: maxItems: 1 @@ -37,7 +39,21 @@ required: - reg - interrupts - clocks - - resets + +if: + properties: + compatible: + contains: + enum: + - allwinner,sun50i-h6-iommu + +then: + required: + - resets + +else: + properties: + resets: false additionalProperties: false From patchwork Tue Jan 3 01:08:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 38218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4380953wrt; Mon, 2 Jan 2023 17:11:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXunkJPBcXy2jJUiTo35LNCUCWmjXW2mUW7w07mlu+La6DOE0shxJTuncaS4FB5C6KU3zTrw X-Received: by 2002:a05:6a21:339b:b0:ad:c97f:1c1b with SMTP id yy27-20020a056a21339b00b000adc97f1c1bmr66697028pzb.0.1672708271585; Mon, 02 Jan 2023 17:11:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672708271; cv=none; d=google.com; s=arc-20160816; b=eMt/R4qJKYvm7OTo04I4lbomv8b7VEnBli54dke8+i2PIu4MY1pLlfipXRzvggbdrw oZED8SbzB8G9U4TUCPEpNUvVtFWok/UEKNuHwlHPi2R6QUQBNSv9nAB8YLxTou2oBQPQ GKHR7zrS+WLmHrn4bwUCppUazLS/cpE5mFqIs+X+EbRwtlLfirt5STJNIisAkrfpnQE3 DKGbXg5GrtsbH0kIzw80Jn9GS6Ccxxz3tp69F5X4XtX1aKnRApH9Qp3nymjTpL6p3572 pdzxLlTJCoOwdQJ26i0znFX15G/eeRkUkRnmqRhBMT8eiVmFplfukE82Q7a0OEX9doAj 68jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=4M/YXCFP6z1qeIXax4Ipe9C0Q4INtZD2QYn6boleEmw=; b=R42RqRYhuZztYQEdRct5qo1PnCA4sSXClH36zuJcFi+N+lUwUeJaliwkYeA9VGzSDI XKhV2JZr2ZhM9Pp4nU5E5ABkx0hiIv/9I+xQAfq1+kmMMUkD7gyiwgJbjI6LY+8rrpv7 DvobP3V+BOPaFr73UHBQp5JCOhniuCKl22cxeIsOYR3AwvQzkmRFxhIw+d3/RzE7A1I1 c9Psge6ayFDeCvoTRaAdM+QQTOooRrsGa5jjJU7KmP6Q4eo7D16JUchG02OCoJ73QXH6 4gCohOdf0epsbcLPHB2XG//9VqrzzXj4++NJY6v9Qsr/j4Umwtpfj3Pvfc5TykIoFRkZ M5vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=VcD1lLVK; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=MfvkZe35; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a6541cd000000b004a3492595dcsi3436060pgq.248.2023.01.02.17.10.56; Mon, 02 Jan 2023 17:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=VcD1lLVK; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=MfvkZe35; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236616AbjACBJv (ORCPT + 99 others); Mon, 2 Jan 2023 20:09:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236411AbjACBJS (ORCPT ); Mon, 2 Jan 2023 20:09:18 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E2799FD9; Mon, 2 Jan 2023 17:09:13 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 2FC683200921; Mon, 2 Jan 2023 20:09:12 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 02 Jan 2023 20:09:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708151; x=1672794551; bh=4M /YXCFP6z1qeIXax4Ipe9C0Q4INtZD2QYn6boleEmw=; b=VcD1lLVKCld/+P9wLE KW3ZOldbUX1wubsUnP3aJLxPD5Blj+qfvTRWaQEYASDSdo3Uw80g7ipNC/nDFena 3UCt7UHojnDPRb07tRCIbQmyCTqrC92R2rCHbXS5dUJjnEOszohdEq0QVX97xpJq wRajs6Pqd7x3tkttbkxV+v2rba81C0Z9XoNMiB46u+W3+4V1ggrAemKqan9wNZ7j y8le58BlPT8MPm5uwo8Gd6al8YKh2c8r0IETEV/RTSdkyLQpmYkujON8CLFuTAg4 x2LpULr2AQbZ3gBSojOAa1ECwHuMrTQdaZrx3sfDxLcjHYcBS7wmZHIk1ezp7TJF GuRQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708151; x=1672794551; bh=4M/YXCFP6z1qe IXax4Ipe9C0Q4INtZD2QYn6boleEmw=; b=MfvkZe35is+AYz1KZfpm56KzHfUF3 l2I/MQNEVuq+SVKg8uw/d15uLW2acIvx55iCE2rfs61u7a0AQNGjP/FSrRVbf+Sc fxcgacJCwJ3PYN+vLgXBUHQuW/SuwQeUUV5V0B1xfS4ExHSZfEqkzIXIhPpyptWC Dex+xkeB9L0cdh+3VoNJnemAjjic39s++1EgB1Ug5gpEEzwaufFPKmC/Cn9DGQ9Q HrpR6skSs0S4bJiPCz2CsjuT3UIIqCXlfYmT3SIuDzUhKv3dE2mf28gjutCIj3N0 ZLMrV22aRi7Csi8emYMMat8XtNUFhzNRSUK4NvV+9f7rEf0aO6gyS6x5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:10 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland Subject: [PATCH v2 2/6] iommu/sun50i: Track masters attached to the domain Date: Mon, 2 Jan 2023 19:08:59 -0600 Message-Id: <20230103010903.11181-3-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753961748573751320?= X-GMAIL-MSGID: =?utf-8?q?1753961748573751320?= The refcount logic here is broken. The refcount is initialized to 1 with no devices attached, so it will be decremented back to 1 when the last device is detached. However, refcount_dec_and_test() returns true only when the refcount gets decremented to zero, so the domain will never be cleaned up, and the hardware will never be disabled. Replace the refcount with a mask of masters attached to the domain. The domain can be cleaned up when the last master detaches. This mask is also necessary to correctly set the bypass register. Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver") Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec --- Changes in v2: - New patch for v2 drivers/iommu/sun50i-iommu.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index 5b585eace3d4..3757d5a18318 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -114,8 +114,8 @@ struct sun50i_iommu { struct sun50i_iommu_domain { struct iommu_domain domain; - /* Number of devices attached to the domain */ - refcount_t refcnt; + /* Mask of masters attached to this domain */ + atomic_t masters; /* L1 Page Table */ u32 *dt; @@ -684,8 +684,6 @@ static struct iommu_domain *sun50i_iommu_domain_alloc(unsigned type) if (!sun50i_domain->dt) goto err_free_domain; - refcount_set(&sun50i_domain->refcnt, 1); - sun50i_domain->domain.geometry.aperture_start = 0; sun50i_domain->domain.geometry.aperture_end = DMA_BIT_MASK(32); sun50i_domain->domain.geometry.force_aperture = true; @@ -760,23 +758,27 @@ static void sun50i_iommu_detach_domain(struct sun50i_iommu *iommu, static void sun50i_iommu_detach_device(struct iommu_domain *domain, struct device *dev) { + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); struct sun50i_iommu *iommu = dev_iommu_priv_get(dev); + int masters = 0; dev_dbg(dev, "Detaching from IOMMU domain\n"); - if (iommu->domain != domain) - return; + for (unsigned int i = 0; i < fwspec->num_ids; i++) + masters |= BIT(fwspec->ids[i]); - if (refcount_dec_and_test(&sun50i_domain->refcnt)) + if (atomic_fetch_andnot(masters, &sun50i_domain->masters) == masters) sun50i_iommu_detach_domain(iommu, sun50i_domain); } static int sun50i_iommu_attach_device(struct iommu_domain *domain, struct device *dev) { + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); struct sun50i_iommu *iommu; + int masters = 0; iommu = sun50i_iommu_from_dev(dev); if (!iommu) @@ -784,15 +786,11 @@ static int sun50i_iommu_attach_device(struct iommu_domain *domain, dev_dbg(dev, "Attaching to IOMMU domain\n"); - refcount_inc(&sun50i_domain->refcnt); - - if (iommu->domain == domain) - return 0; - - if (iommu->domain) - sun50i_iommu_detach_device(iommu->domain, dev); + for (unsigned int i = 0; i < fwspec->num_ids; i++) + masters |= BIT(fwspec->ids[i]); - sun50i_iommu_attach_domain(iommu, sun50i_domain); + if (atomic_fetch_or(masters, &sun50i_domain->masters) == 0) + sun50i_iommu_attach_domain(iommu, sun50i_domain); return 0; } From patchwork Tue Jan 3 01:09:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 38224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4381410wrt; Mon, 2 Jan 2023 17:12:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXu389i5T5caQ5mPlvc3BP87wwyvqnd+3aMzFCvzYcuTxPANUan5MM+g/FUqVeuVug2Av6RK X-Received: by 2002:a05:6a20:b297:b0:9d:efbf:7880 with SMTP id ei23-20020a056a20b29700b0009defbf7880mr45030609pzb.53.1672708356618; Mon, 02 Jan 2023 17:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672708356; cv=none; d=google.com; s=arc-20160816; b=agtBQ/XFbZWZX6K6buNLIOBhYS2o/EVx1chk2w3MxVgIq12va9YUYBMJPmIKApbeSz ZCVkYtRlYfkGLnmaja1vIG45lXqFIcploNpxeubpGZskLyjGc4FzLjW/bw6/gsp+Rz1a 1Tu6kVrY9bQIW8mqkp3fVdHFtaNtDPnL8BwgjAE5eRocpFgHy8gwJ54gU5iK3fHRxD+r Mq3M2xA8YPCt67O0vmOxjYaotys0sAdMSHv/M+2npn2mYNcPj2FMZ4zmg4o6aZFBlJfY 4PokqOgUjhp1DGqL/6ZlN+2ztpgBb6rVoBpVeTO5Qpdut4Wh48wdl/990pfUOjm6MTtv Xj3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=l33byjN96tAFT91WzVSv7uBqAlUyhhwrwVPAOp/DxlI=; b=rGaQ7dXgsyOl1iXuit0f3Qya+q5PzPxfboghYgrqFbe+BeUA1ycPa3w8E0+9vSdQv7 Zj06HMTgmdwbQwmO97YWKh0sywbuumG/YLT+Ejf+28wt7SlHXTm8VGnZbM4hXULzW3kc bnkgg9A4p87TrC3EoK+r4c57TspfBCZu0YCpYXJn0bnWC/+RW62wJstLejiWjRgKMJak yuvUpewb3MU0vgSuIVCDlrYBRj6eyuwyu0/RpoDMhfgHDj3Pdb6saSCvqcHJJJzzOBNv RKkAh3+fe5cCbkPNLtk1iiEEeZQCSr+kymmBvc37vPo28zh8bFEbD9uYVvi2+bmD5+VR mDcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=cUBLPZjz; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=o4pb0s46; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a637903000000b00476e63cfd0fsi31228631pgc.466.2023.01.02.17.12.23; Mon, 02 Jan 2023 17:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=cUBLPZjz; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=o4pb0s46; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236634AbjACBJ6 (ORCPT + 99 others); Mon, 2 Jan 2023 20:09:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236475AbjACBJU (ORCPT ); Mon, 2 Jan 2023 20:09:20 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E7FAE72; Mon, 2 Jan 2023 17:09:16 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 07CFF3200919; Mon, 2 Jan 2023 20:09:14 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 02 Jan 2023 20:09:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708154; x=1672794554; bh=l3 3byjN96tAFT91WzVSv7uBqAlUyhhwrwVPAOp/DxlI=; b=cUBLPZjztaJPEF/tEF eXnYxSk3QYC4X9Z7BNWWtKNjLeMXIICX3Z0F8srYK52u98ILXKIAd8ey6+qiX+2/ CCjS38MZ8Oe+mD2bKi4MAGhwnVkT3B9toQo1K9iJowu5tTZG2k97iHSKAnbB5/Jr ke2GtIwXCgCdTv3mcZAC5/B0XRLjz3OJvSCueGp7HtFYI5nJzW1M+rEgNePKjwt+ 1JpAKKyNSlpHCfgUifkjt+vrUsCE8D9ExCMld5D4SiccVrOLbsjmmIlCmYP/1n/a oJkSowd45RKHw7EOYQcZgaLe7UgxoBTS6CEczexSaGjrIbnpgcpS3XgRVgeskRTc ZPFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708154; x=1672794554; bh=l33byjN96tAFT 91WzVSv7uBqAlUyhhwrwVPAOp/DxlI=; b=o4pb0s46K9RCUY30Fk6zVEKZDK0lT JnqzFQvbGCV95Q4cwbpolMY8oC7geSKBCkCT/zx1IY5on+go50zWThlMBK6iUhha mo850IGtZegHv5RvI74j/eHf38uCTQRfnU3wJy6Bcl/BTiLoZBmzmGnLFFdm1zTn Ogx4W7OaNakzafipaZcj0y2ttLazg6HwIFGJioYA75B3ywDWBepeEQWH6PqAXjyJ 2SDLMjvaa6rw7jliJ3nJsUraewPELG4b6UnNIKLYaeKIC4pXj4jNpSsiEOqdi8mM 73ZnvyMUw7evkNB+jW1rsWE3mlVf7C8suf7LVlBRcHw6jvdfF2zuJG7bw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:13 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland Subject: [PATCH v2 3/6] iommu/sun50i: Keep the bypass register up to date Date: Mon, 2 Jan 2023 19:09:00 -0600 Message-Id: <20230103010903.11181-4-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753961837254807566?= X-GMAIL-MSGID: =?utf-8?q?1753961837254807566?= Currently, the IOMMU driver leaves the bypass register at its default value. The H6 variant of the hardware disables bypass by default. So once the first device is attached to the IOMMU, translation is enabled for all masters, even those not attached to an IOMMU group/domain. On the other hand, the D1 hardware variant enables bypass by default, so keeping the default value prevents the IOMMU from functioning entirely. Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver") Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec --- Changes in v2: - Set bypass based on attached devices instead of using a fixed value drivers/iommu/sun50i-iommu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index 3757d5a18318..a3a462933c62 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -441,6 +441,9 @@ static int sun50i_iommu_enable(struct sun50i_iommu *iommu) spin_lock_irqsave(&iommu->iommu_lock, flags); + iommu_write(iommu, IOMMU_BYPASS_REG, + ~atomic_read(&sun50i_domain->masters)); + iommu_write(iommu, IOMMU_TTB_REG, sun50i_domain->dt_dma); iommu_write(iommu, IOMMU_TLB_PREFETCH_REG, IOMMU_TLB_PREFETCH_MASTER_ENABLE(0) | @@ -755,6 +758,17 @@ static void sun50i_iommu_detach_domain(struct sun50i_iommu *iommu, iommu->domain = NULL; } +static void sun50i_iommu_update_masters(struct sun50i_iommu *iommu, + struct sun50i_iommu_domain *sun50i_domain) +{ + unsigned long flags; + + spin_lock_irqsave(&iommu->iommu_lock, flags); + iommu_write(iommu, IOMMU_BYPASS_REG, + ~atomic_read(&sun50i_domain->masters)); + spin_unlock_irqrestore(&iommu->iommu_lock, flags); +} + static void sun50i_iommu_detach_device(struct iommu_domain *domain, struct device *dev) { @@ -770,6 +784,8 @@ static void sun50i_iommu_detach_device(struct iommu_domain *domain, if (atomic_fetch_andnot(masters, &sun50i_domain->masters) == masters) sun50i_iommu_detach_domain(iommu, sun50i_domain); + else + sun50i_iommu_update_masters(iommu, sun50i_domain); } static int sun50i_iommu_attach_device(struct iommu_domain *domain, @@ -791,6 +807,8 @@ static int sun50i_iommu_attach_device(struct iommu_domain *domain, if (atomic_fetch_or(masters, &sun50i_domain->masters) == 0) sun50i_iommu_attach_domain(iommu, sun50i_domain); + else + sun50i_iommu_update_masters(iommu, sun50i_domain); return 0; } From patchwork Tue Jan 3 01:09:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 38227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4381556wrt; Mon, 2 Jan 2023 17:13:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXua6Ap300X6I2vUu2UI1CEqddNBC1KBaEI7aPiG2ihi6ZuDvsCn4ipoRvvi9zuGltjLPQRn X-Received: by 2002:a05:6a21:2d07:b0:b2:48e8:e3a9 with SMTP id tw7-20020a056a212d0700b000b248e8e3a9mr60771278pzb.12.1672708385254; Mon, 02 Jan 2023 17:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672708385; cv=none; d=google.com; s=arc-20160816; b=WA8/aey1c0Fjm1H7J1p8ozPZ2isnLUudLaof7TZY2o/tcDTvUzP4kSuAaeiFkbxDRM vgFb1FCaEa1By4sU18EKOBIPPp3Y2Nn1ROFGEKi/6jdLk6Lmpik+zYoiYPyBZ18qw7QV EsZdzS5P0M2HZJL+LaJJPKiG4dKgJF4+42Lu+ygMGGigEIjj0kOg1m+GO2sJdvxPBsH9 r7mby0IggFpaVSxawNjUp8imBnuM5rCgve/kuYFRUQswJ5tgtrnKKOpnl3p7sE9MP63c Tl3WfCmRQCo9G4b/NRmsrFjqWFWnSRjjmMKT4SxM9B5u2sjxeVGQJj4SvFhQKRl1JWNc C5nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=ezFU4xIsWU9r0j3R9gbsjOutPYOzIkuUPEsZkjIMNUQ=; b=hPnI0D8SUroRCuwIbi0fooWbP1tadATuRyDaBwCUabKnqZ+Da0MmaFOr307MT2pWsG EuvQcLOWa5zBmh/H6pRHNf7PiKDWvBPLLXlAHEDAvY9hbWqjKfPSBuadlPKZjzNmN3Sw MQ7l5MS3UGpFKQcRYgDMhT7mXMgg4lZJedkKCssOR/h/q3fY4pBvl00QcKnOK3fTyLHw Q0E51T/fZ8NriY3UQxAyFR6P6eGqyIzDLJXrZb5pWrssOhUHVHGgx1I2IuFmI8ABgNU6 5cKlFIku5AhERkSqiiBXpgGGRsE0tGkC/1o4twadO7XnABr9MIh2V8aVC7DbOhFfRemG TTCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=ysFzFO7q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=qPmEr0jQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k124-20020a628482000000b00557e99763d3si30740169pfd.93.2023.01.02.17.12.53; Mon, 02 Jan 2023 17:13:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=ysFzFO7q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=qPmEr0jQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236578AbjACBKN (ORCPT + 99 others); Mon, 2 Jan 2023 20:10:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236509AbjACBJY (ORCPT ); Mon, 2 Jan 2023 20:09:24 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43D6B1CC; Mon, 2 Jan 2023 17:09:19 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 1CA5C320091D; Mon, 2 Jan 2023 20:09:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 02 Jan 2023 20:09:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708157; x=1672794557; bh=ez FU4xIsWU9r0j3R9gbsjOutPYOzIkuUPEsZkjIMNUQ=; b=ysFzFO7qoXLTgCeEil UPJ4g+pwrpPLNpTU2ODGVgjy7OznuxvvlHC2pDgGk6nWdoeTAS+6hgH3lQB5QGap W4pcK/KgSq1KVf/8koUZ10R5AtusMvSk0ErGUaFWaS6oCsa1fvnZ68JnLPp0hDJl Yb2USiCorZ7DXkZK+oYu87NZIq1GUGQs0XMhE8cGs7NI1NxRwT/iFqRQe6sz3eni 3gy8EGYQhke+DZvVhng/vqtIvRwG5zaIjJ0c2T6iKts2eux9ZI5sHbGKKF3b1AjX wwYSF5297IK2fe2FhMz+ZCoEkycIjwRBuvUKJ6oundSXoNMBnBqGE4ik3a60mK2U yM2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708157; x=1672794557; bh=ezFU4xIsWU9r0 j3R9gbsjOutPYOzIkuUPEsZkjIMNUQ=; b=qPmEr0jQTznHxX4YH91JJ/Tt1OXoA +SBQ8+YRAeNQHjCf/iICYQ9yJIqN7Fh3W4qHXb43C6whCUjmqapXK2mEFghZpdi6 nvi2nXQCn9eNaLM4aN+qg9uil81boFSCHo1ZjrDA4IJL4vhhS8odo7aR6w+DkgPC U1Cyk18Uy8P46JmFLyIjSbOjbx20dXNvoSdFJ2WqxgdgWyG00m9sxVGR3cTQ3NY3 V8118KLv9X02O2fO15vK8v+2Ex9Bw15pT41JtsPNxd+MF4QoSfMnN7rRD+CWgXeq gwmvVHc1KV+CeX9YPW3uROZO2YRshdNQFEkS30/4SauqWnj1NyjE5xsRw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:16 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland , Philipp Zabel Subject: [PATCH v2 4/6] iommu/sun50i: Support variants without an external reset Date: Mon, 2 Jan 2023 19:09:01 -0600 Message-Id: <20230103010903.11181-5-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753961867431663193?= X-GMAIL-MSGID: =?utf-8?q?1753961867431663193?= The IOMMU in the Allwinner D1 SoC does not have an external reset line. Only attempt to get the reset on hardware variants which should have one according to the binding. And switch from the deprecated function to the explicit "exclusive" variant. Reviewed-by: Jernej Skrabec Reviewed-by: Philipp Zabel Signed-off-by: Samuel Holland --- (no changes since v1) drivers/iommu/sun50i-iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index a3a462933c62..d19f6ce25f76 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -95,6 +95,10 @@ #define SPAGE_SIZE 4096 +struct sun50i_iommu_variant { + bool has_reset; +}; + struct sun50i_iommu { struct iommu_device iommu; @@ -995,9 +999,14 @@ static irqreturn_t sun50i_iommu_irq(int irq, void *dev_id) static int sun50i_iommu_probe(struct platform_device *pdev) { + const struct sun50i_iommu_variant *variant; struct sun50i_iommu *iommu; int ret, irq; + variant = of_device_get_match_data(&pdev->dev); + if (!variant) + return -EINVAL; + iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL); if (!iommu) return -ENOMEM; @@ -1037,7 +1046,8 @@ static int sun50i_iommu_probe(struct platform_device *pdev) goto err_free_group; } - iommu->reset = devm_reset_control_get(&pdev->dev, NULL); + if (variant->has_reset) + iommu->reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(iommu->reset)) { dev_err(&pdev->dev, "Couldn't get our reset line.\n"); ret = PTR_ERR(iommu->reset); @@ -1075,8 +1085,12 @@ static int sun50i_iommu_probe(struct platform_device *pdev) return ret; } +static const struct sun50i_iommu_variant sun50i_h6_iommu = { + .has_reset = true, +}; + static const struct of_device_id sun50i_iommu_dt[] = { - { .compatible = "allwinner,sun50i-h6-iommu", }, + { .compatible = "allwinner,sun50i-h6-iommu", .data = &sun50i_h6_iommu }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, sun50i_iommu_dt); From patchwork Tue Jan 3 01:09:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 38219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4381093wrt; Mon, 2 Jan 2023 17:11:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXtqW7Eyo8n7UWTbjXP9KET/GT7mORKXT+OpXbGr5cAtZTHVRIZK4p1ctQLcYCjgWbs8H061 X-Received: by 2002:a17:906:9688:b0:7c1:1c7:3bad with SMTP id w8-20020a170906968800b007c101c73badmr34858323ejx.36.1672708304133; Mon, 02 Jan 2023 17:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672708304; cv=none; d=google.com; s=arc-20160816; b=RiNU0X8BX0fT4WyMLAAhkaKfxjEUID1E3B2hB1cfqK9NRnQy8DPCkInO/x1b3Xw5+p MlhKcKeUinKJ95w12PO0/FMfMLUnGQZtBH783EIzfxY48LxIl3i4iMk9D715yKeMvpZp QYypoFFfRKiMzIAxjW/vd6bEDEnQaw/1qqOMg3NVgkL9f05IVqL7CfFpQjH26aq5SSRy pAVyPvLFlaBcoVo81RnaM1ZAz6vMRBBLy8IhVxyk5DvG42umKiLk2p5l5yO375ZgnSWO IGquihSRJRZ9iMq2yW0L7k2kccUxyVhcU4sBjvX2wZ4RQUwYq3ktG8G2HqF+7f3z3MnM B/ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=kHE08T4gTPodlZPGVapmZ0HQSfgCMhmZCAbX+vErrtM=; b=0UoOANXMH7n09///0+dfePgj3AuDVWV0vgP1V2bcXN/Qt24RTOL7uJy6qYvDHPS+Ea gMlJADaMFQgd+UAJLQsTUk0WCSd2OEcTvlI2RiSJwqz7qaawNMf4zcljwjzHl5V81D5W BU6TCKj97ZnLI1IiOJHUh4ylm5Smv+kSPqValkJjR36pC01m8FR27g7ChaS+k2zr/W+o HMxrLMu7PogB7sFnIl0cQYULtztuby8/iLjwAb6hC8xUEk/iy6sPDq8ody6qo2rBHIt3 kWbiOIWWGAj67dukcL8N4c65s7Q2IK2gZ1VTXn6MnzGmPpmgrTUt2kWvx5mUeRgiTGgI gBrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=UyYQ7Ilw; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=EdxZN0ap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm22-20020a170907949600b007c1600359d9si28158165ejc.451.2023.01.02.17.11.20; Mon, 02 Jan 2023 17:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=UyYQ7Ilw; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=EdxZN0ap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236697AbjACBKR (ORCPT + 99 others); Mon, 2 Jan 2023 20:10:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236510AbjACBJY (ORCPT ); Mon, 2 Jan 2023 20:09:24 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D4009596; Mon, 2 Jan 2023 17:09:22 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id CC9773200919; Mon, 2 Jan 2023 20:09:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 02 Jan 2023 20:09:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708160; x=1672794560; bh=kH E08T4gTPodlZPGVapmZ0HQSfgCMhmZCAbX+vErrtM=; b=UyYQ7IlwpwAkOuo1HN QDKkchKl0wnktPq2cNwHZDz/BhriE4CQUKnW4f9locHk+hPipNeJieJhsnxP57be ZmQgMnnGleRgrVMPSkYDeLqrSdwV99GA3KD0A9ASuCnXHEkE/Hnds9WqfZv+d4hz cq/lCK28mpL8wesFvohvkC7I1F9rw77Ttt0pxN2yz154eZjAC77+V88d5Vx8wcJX kVtmIXQO6wx9DKmGn15Yg/WHkv+2SeImCsrq5lJV+iruBh6AasrFRCM2vLsq6QHZ PGvC/3W/7ZsxfZQ3q+LrKMBH0KIx5+69LSTRPOzB2MUPwbI1ujNAxuW3vAPUjXaH YA4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708160; x=1672794560; bh=kHE08T4gTPodl ZPGVapmZ0HQSfgCMhmZCAbX+vErrtM=; b=EdxZN0apqAanSNtdkixjNQzRPslC8 IveKKh2SOhsJmhEnCcah95XZf55+fEphZb101Yf09BDfRB0Noqssfgcwl0tmDcHW /LO2op7yyEoHIlRWs8b9wdc5ceSH1qCkZzs9eyF5DEO51lBJPn0y371QVkQYeeQN eiMY91EpgtcWLUX9sz2aqzNQ7AokNAHlEmudb+M+KQbxFSchLsuQU7IdSCjGRM6z ATx5o4ccxIJocWWP4MQGusuzbKwoB8zkmReHw03AyYoVd1qtbKCV28jVmS9R1RFt g9GQ0y/BhlUffGtWYKlEhSg+8fCAsRLQDT666sm/wnoTRIgCU2iRwGLGQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:19 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland Subject: [PATCH v2 5/6] iommu/sun50i: Add support for the D1 variant Date: Mon, 2 Jan 2023 19:09:02 -0600 Message-Id: <20230103010903.11181-6-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753961782634390906?= X-GMAIL-MSGID: =?utf-8?q?1753961782634390906?= D1 contains an IOMMU similar to the one in the H6 SoC, but the D1 variant has no external reset signal. It also has some register definition changes, but none that affect the current driver. Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland --- (no changes since v1) drivers/iommu/sun50i-iommu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index d19f6ce25f76..8652559a2ca3 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -1085,11 +1085,15 @@ static int sun50i_iommu_probe(struct platform_device *pdev) return ret; } +static const struct sun50i_iommu_variant sun20i_d1_iommu = { +}; + static const struct sun50i_iommu_variant sun50i_h6_iommu = { .has_reset = true, }; static const struct of_device_id sun50i_iommu_dt[] = { + { .compatible = "allwinner,sun20i-d1-iommu", .data = &sun20i_d1_iommu }, { .compatible = "allwinner,sun50i-h6-iommu", .data = &sun50i_h6_iommu }, { /* sentinel */ }, }; From patchwork Tue Jan 3 01:09:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 38220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4381110wrt; Mon, 2 Jan 2023 17:11:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXsC3WC1zRPyB2RKJQo+CqSrUN099Sa32jgt/Ycg8BkF0IQ1LUcd/KvvJK3+6CcUb1EFxOLb X-Received: by 2002:a05:6402:1770:b0:461:8be6:1ac5 with SMTP id da16-20020a056402177000b004618be61ac5mr33392413edb.3.1672708307323; Mon, 02 Jan 2023 17:11:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672708307; cv=none; d=google.com; s=arc-20160816; b=DoAIdtLJqUh4oU+59VAy0zG1N2X/01YqvjAGsInWao37J+frx4LzCoMfZ4vdWOPIHM 5hkpTXOOA17aXowoHoljbCFlOYJvX+o/ZDVJs9T+gz8rkiSl3xuVUiqz8k/FGypLlVPB /adJtd7b6zh6sYTXwwhHF/bp8kR0hfpo7Bym8Ofh2sS3XldDUhsYLcvV08x9VgSTDNq2 vCbPoo7Pjolc5aBJjelc7ViY1UavDwggOY4FLddyq9Zm/gq2eRA/ckssZoJEWLCRm+KY qZ0CZwt89LaVh1n8waQPxklLrazraWCGILWmgRjiWvcWnnusgWStnmMCQm+O2LWG40mn VOlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=kZsTHUFAGL+nV4DJ8yYJfUo1prfIfeItgnkARi0XucI=; b=YCs0nTtRYcXRU5k4z2EtpfZpVbp/zw+52gePc4mNr78Onf4gF6vK+fZ1X6gD1ZuLuj 7KvQJ4oxmiLtZkk1OzfRfNe7znHnzLTpNE7JwNCauDFwEea+T4LknZFGJqb6d2dxiRH2 txNzAaR+4hRx/Y9a72o1uF5lkB5yx2amALx0zkMRxkvo8ZaOaZRHcGLdCAEkJQFr6OsX wXSAS+EGt3p5q2oufHz83dSWt8EIzE8aoimWpqG/m0ZU1sCKg+LHyw7r5hzxON30UHMw b2+Qzhkzbmj5+4anDxqrlK3UsbTVcG/71+JKGZ+hBTh98YY9e9O34bA9BGDstU2YnPsz QA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=I7sS11A2; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=eX3XuWrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y99-20020a50bb6c000000b0046b1ffb7211si26347409ede.423.2023.01.02.17.11.23; Mon, 02 Jan 2023 17:11:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=I7sS11A2; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=eX3XuWrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236657AbjACBKU (ORCPT + 99 others); Mon, 2 Jan 2023 20:10:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236497AbjACBJ1 (ORCPT ); Mon, 2 Jan 2023 20:09:27 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3575B6462; Mon, 2 Jan 2023 17:09:25 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 7CE103200900; Mon, 2 Jan 2023 20:09:23 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 02 Jan 2023 20:09:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708163; x=1672794563; bh=kZ sTHUFAGL+nV4DJ8yYJfUo1prfIfeItgnkARi0XucI=; b=I7sS11A2fNj9GnEtLL di2WxTbt2fNqMvmw2JjUkrMMjEGSpUzNj0K6KEkITQSRDIkVAuPjbAPS+s22k7aS tfsAgV+9rhwz0OsKtDzaywoFQ5TzYWohtV7IcdmmfJ9PBxrpvEfzw2dj6Y0RjFQ0 xKrmbQXuOfVFjpqqddgqlSYwYv48DCLF3OhNx9Cqrh5HIE0Fu/auiua9PE/6y3ij NjLCren3eo0hKw48PTujzcAXpGXQTe6pCInodtiy9FRNN4bE6LE/fMHgbziM9i8d 6AGjT2p29+wbfJoj8BJupdBGZM/XTeq82N9bNT1VH0iEqrJqlich4l1ZcpQl8O5w sn4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708163; x=1672794563; bh=kZsTHUFAGL+nV 4DJ8yYJfUo1prfIfeItgnkARi0XucI=; b=eX3XuWrX8cm2ftUAKF2gxfelvft5x +bjA9gM3kX1V3S39zQtE/PSsqVvhgCHtNInNIuAupyq8jd9GND0d6sxcO9oRLsOd GdhKOW9EkeaQFXtKCwYD/eDqIKQpds2sk9gqSH9cjeU5OT4xyyLjM/gYZQtHjCKv yF3RlSodYhmfUzGHzVPp1eMl753ra/d/PzadFj3FoI8BwDQb9WEz6yvxhDOoI3AT fT6cvdtMMTy9IioN9e1FDX33JWlKHwEn8OmARDTeKDprdkQTwLcmnr98k16P7Ucm Y0r/8BUpfPugtHovwcL1DwCsYtF21e58T31Gyj7TRdFjrPvsPSZIIgbTw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:22 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland Subject: [PATCH v2 6/6] riscv: dts: allwinner: d1: Add the IOMMU node Date: Mon, 2 Jan 2023 19:09:03 -0600 Message-Id: <20230103010903.11181-7-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753961785769097638?= X-GMAIL-MSGID: =?utf-8?q?1753961785769097638?= D1 contains an IOMMU for its video-related hardware. Add the node, and hook it up to the masters which are already described in the devicetree. Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec --- Changes in v2: - New patch for v2 arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi index dff363a3c934..ade50f1e01a4 100644 --- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi +++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi @@ -138,6 +138,14 @@ ccu: clock-controller@2001000 { #reset-cells = <1>; }; + iommu: iommu@2010000 { + compatible = "allwinner,sun20i-d1-iommu"; + reg = <0x2010000 0x10000>; + interrupts = ; + clocks = <&ccu CLK_BUS_IOMMU>; + #iommu-cells = <1>; + }; + dmic: dmic@2031000 { compatible = "allwinner,sun20i-d1-dmic", "allwinner,sun50i-h6-dmic"; @@ -574,6 +582,7 @@ mixer0: mixer@5100000 { <&display_clocks CLK_MIXER0>; clock-names = "bus", "mod"; resets = <&display_clocks RST_MIXER0>; + iommus = <&iommu 2>; ports { #address-cells = <1>; @@ -596,6 +605,7 @@ mixer1: mixer@5200000 { <&display_clocks CLK_MIXER1>; clock-names = "bus", "mod"; resets = <&display_clocks RST_MIXER1>; + iommus = <&iommu 2>; ports { #address-cells = <1>;