From patchwork Thu Jun 6 13:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 13688507 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 E4123C27C54 for ; Thu, 6 Jun 2024 13:34:10 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=ZV5BO8rQhdahaIGfTciHPRKcWfJusqimi4W4qgNY7tg=; b=4FDeg2EdRGhEyu whbD0zMIcdi0SrwmxARRXq14qhrzezrkaNJ0w1jmp8ZWgCnJCeJMB2N3az7KTMDL3ObFMJzErePv1 dW7NaR8A61b4xxrsNWF0YnftJ8yOceUrDcRDb3YK5phPkLkNZ/Hh+gdDB6ZsSGy1fIb+xkOWRIpzI SHnlCG38J4zRKBfV3zZlKSWHpnOmb5UYras+bVhOzxCP0/q0/r0TPM5MEgAu8nurYd6I24H9ozh3n nC5vqwL/vmZUp0KpTLaaqFxpPwvPtQ4kzKXpIA42amrmQCYWQk1ZOe16wl0ilKz/50GqgYnasmUXY lZFnwe/9L/NCoWUNS2eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFDFf-00000009uBN-2diD; Thu, 06 Jun 2024 13:33:59 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFDFb-00000009u9R-2eXg for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2024 13:33:58 +0000 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Vw4t84Tr5z67WPF; Thu, 6 Jun 2024 21:29:04 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id EC00D1408F9; Thu, 6 Jun 2024 21:33:43 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 6 Jun 2024 14:33:35 +0100 From: Shameer Kolothum To: , CC: , , , , , , , , , , , , Subject: [PATCH v5 0/6] Add IOMMUFD dirty tracking support for SMMUv3 Date: Thu, 6 Jun 2024 14:32:56 +0100 Message-ID: <20240606133302.17540-1-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_063355_997287_CFA6E213 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, v4 --> v5 -Dropped arm_smmu_sva_domain_alloc() related changes from this series as suggested by Jason. -Added R-by tags. Please take a look and let me know your feedback. Thanks, Shameer Reviewed-by: Kevin Tian --- This is revisiting the earlier attempts [1, 2] to use SMMUv3 HTTU feature for dirty page tracking. The Intel/AMD support is already mainline. Basic sanity tests are done using an emulation setup and on a test hardware setup. Block page split/merge(BBML) is not part of this series. I am planning to send it separately. v3 --> v4 -Re-based on top of 6.10-rc1 -Added patches (1, 2 & 3) on top of v3 to make this series independent  of Jason's SMMUv3 refactor series. -Addressed comments received on v3 and added tags. v2 --> v3  -Rebased on top of the latest of Jason's refactor series git[3].  -Addressed comments from Ryan and Jason(patch 2 & 3, Thanks!)  -Added R-by tags  to 1 & 4. v1 --> v2: https://lore.kernel.org/linux-iommu/20231128094940.1344-1-shameerali.kolothum.thodi@huawei.com/ Addressed review comments from Jason and Joao(Thanks)    -Moved dirty_ops setting to domain finalise(patch #3)    -Only enable DBM for stage 1 if domain_alloc_user() requests it.    -Changed IO page table walker(patch #2) and tested with 4KB/16KB/64KB     with l1/l2/l3 traversal.(The earlier one had a bug where it fails to     walk L3 level).    -Rearranged patches a bit to improve bi-sectability.    -Rebased on top of Jason's v5 of SMMUv3 new API series git. 1. https://lore.kernel.org/lkml/20210413085457.25400-1-zhukeqian1@huawei.com/ 2. https://lore.kernel.org/linux-iommu/20230518204650.14541-1-joao.m.martins@oracle.com/ 3. https://github.com/jgunthorpe/linux/commits/smmuv3_newapi Jean-Philippe Brucker (1): iommu/arm-smmu-v3: Add feature detection for HTTU Joao Martins (1): iommu/arm-smmu-v3: Add support for dirty tracking in domain alloc Kunkun Jiang (1): iommu/arm-smmu-v3: Enable HTTU for stage1 with io-pgtable mapping Shameer Kolothum (3): iommu/arm-smmu-v3: Factor out a common domain alloc iommu/arm-smmu-v3: Add support for domain_alloc_user fn iommu/io-pgtable-arm: Add read_and_clear_dirty() support drivers/iommu/Kconfig | 1 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 190 ++++++++++++++++---- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 8 + drivers/iommu/io-pgtable-arm.c | 119 +++++++++++- drivers/iommu/iommufd/hw_pagetable.c | 3 + include/linux/io-pgtable.h | 4 + 6 files changed, 290 insertions(+), 35 deletions(-)