From patchwork Tue May 5 10:09:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 201098 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC65CC47247 for ; Tue, 5 May 2020 10:09:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88BAF206E6 for ; Tue, 5 May 2020 10:09:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="ZZGh5MnH"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="pubwQPmF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728360AbgEEKJm (ORCPT ); Tue, 5 May 2020 06:09:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:47497 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728233AbgEEKJl (ORCPT ); Tue, 5 May 2020 06:09:41 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 403235C00F0; Tue, 5 May 2020 06:09:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 05 May 2020 06:09:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm2; bh=sqWvtyC3J90S0Z1L+sUBcl2FyI lVrX1gjpJJsojN7CU=; b=ZZGh5MnHyAsBjrATihvWyiXuatnkx9Q902qebeCMWj bPagP6ViNmSSEpjVyDl4dqe9wCCuhJX77M4GrtfLVj3CSYSquSI/wu09DNq2l+6Y EW1NdnFMwv4L5XO1RNdl08/Ydrb+CLnWqb4vTwUP1oGK6Crn5a0DWrnBI5d7LwBi VQ2vce+MaqACpRlhufoX9adMXRdbP897DldFXk9K4cO/yH194TkTU+XR67RXiMi9 gh7dlsK66G7kkhM+zoraTEjvqJ0QCAohGuZhjlOFusQCGOgeabEvKszyDk3lshNc Vz3YOPw3gjEbNoAj4yxbHBUhyKZRv294A5cK4m/Fh/hA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=sqWvtyC3J90S0Z1L+ sUBcl2FyIlVrX1gjpJJsojN7CU=; b=pubwQPmFoNTcmqtrJbtlTb7F3nRAPi96D 7JPhrrJ2iRuXb0600Hu63p20VWjR9kVZDoZkwJYC26EqRfk4X7982gXZw0xqaT7N tTo+tnndUcEWwpZVvaZmSbP3IxdXlhC6YjzMf6I8NAnoRZuMHsQBuLbL9dEYWzcs /beCe4LYII50pyJfiGWqsNf3SQMq2zj2iG2pYiObKMJBKt5+2buiUckSajIPR69o P2NZWFdvDm6eG/Wep9rkDDZiT6flA2Gu50i4a0HnMrFFWUfrAgZ1dzG7jE+Onv+J rj4JwM/H0llDbFBTO6imhAdWFTwjW3hKAEgXjK6iKSZtWgLBWlnag== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrjeeigddvfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepofgrgihimhgvucft ihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtthgvrh hnpeejffehuddvvddvlefhgeelleffgfeijedvhefgieejtdeiueetjeetfeeukeejgeen ucfkphepledtrdekledrieekrdejieenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 5CB84328005D; Tue, 5 May 2020 06:09:38 -0400 (EDT) From: Maxime Ripard To: Joerg Roedel , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring , Frank Rowand Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, Maxime Ripard Subject: [PATCH v3 0/5] iommu: Add Allwinner H6 IOMMU driver Date: Tue, 5 May 2020 12:09:29 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi, Here's a series adding support for the IOMMU introduced in the Allwinner H6. The driver from Allwinner hints at more SoCs using it in the future (with more masters), so we can bet on that IOMMU becoming pretty much standard in new SoCs from Allwinner. One thing I wasn't really sure about was how to expose the statistics reported by the IOMMU PMU (TLB hit rates, latencies, and so on). The Allwinner driver exposes them through custom sysfs files, while they would be best represented through perf I guess? Anyway, I'm planning to support them later on. Let me know what you think, Maxime Changes from v2: - Rebased on 5.7 - Add dt bindings patch - Allow the identity domain to be allocated - Add an unlikely to the check on whether a PTE already exists in map - Remove locking and adjust the PT installation to use an atomic operation instead - Switch to iotlb_sync / flush_iotlb_all callback instead of flushing by ourselves. Changes from v1: - Add a patch to configure the IOMMU on the virtual DRM device - Rework the domain allocation / freeing - Remove the runtime_pm handling to power up the device and rely on refcounting - use map gfp argument for kmem cache allocation - Removed unused macros - Switched from BIT(0) to 1 for the page table entry valid flag to make it more obvious that it's over multiple bits. - Switch to module_initcall - Make accesses to the fwspec more consistant - Removed dev_info logs - Reworked invalidation / flushing - Allow for compilation with COMPILE_TEST Maxime Ripard (5): dt-bindings: iommu: Add Allwinner H6 IOMMU bindings dt-bindings: display: sun8i-mixer: Allow for an iommu property iommu: Add Allwinner H6 IOMMU driver arm64: dts: allwinner: h6: Add IOMMU drm/sun4i: mixer: Call of_dma_configure if there's an IOMMU Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml | 3 +- Documentation/devicetree/bindings/iommu/allwinner,sun50i-h6-iommu.yaml | 61 ++++- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 +- drivers/gpu/drm/sun4i/sun8i_mixer.c | 13 +- drivers/iommu/Kconfig | 9 +- drivers/iommu/Makefile | 1 +- drivers/iommu/sun50i-iommu.c | 1065 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 1162 insertions(+) create mode 100644 Documentation/devicetree/bindings/iommu/allwinner,sun50i-h6-iommu.yaml create mode 100644 drivers/iommu/sun50i-iommu.c base-commit: 8f3d9f354286745c751374f5f1fcafee6b3f3136