From patchwork Tue Apr 30 13:43:04 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: 13649024 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 E821EC4345F for ; Tue, 30 Apr 2024 13:45:16 +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=16yejhmpcqHPnlUMI13brGRrdd8aWUEqyZRFCzgDyGU=; b=rs0FT0URPkbxg1 1cESwdse/3WyuT//GqTA0R+g6SouWJJhsVTqCfDWEuZcKPvZtkaDIV1qNTr60UWT13PV8d4vdq0Rc nG+kvTG9I6o9dcbqf88o2l2XTnkFM42QHEGDh2qnrNsSUsblFl9cToFCm/hFgqaG3t/tlJdqdNmWI kwO+mlQKkJuOtLX4v7+ri5FL1DqSMNRdmrMzvk+KFy36tFT6R0g391xrPvz9KFGLWtcTpjX134cQD AwpGOkUbyuTm/o2h5ewheZOqD74sPqZyd/O7wUbkG17ICXZM7c2RNyCxdpFJOU57JKz3387QYABQ0 jWNWsGHJ4LYZwGLXKGkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1nn8-00000006aOl-1a3f; Tue, 30 Apr 2024 13:45:06 +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 1s1nn5-00000006aNL-2q1R for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2024 13:45:05 +0000 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VTLwP0lN6z6J7JY; Tue, 30 Apr 2024 21:42:13 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id CD759140A08; Tue, 30 Apr 2024 21:44:53 +0800 (CST) Received: from A2303104131.china.huawei.com (10.126.175.159) 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.35; Tue, 30 Apr 2024 14:44:43 +0100 From: Shameer Kolothum To: , CC: , , , , , , , , , , , , Subject: [PATCH v3 0/4] iommu/smmuv3: Add IOMMUFD dirty tracking support for SMMUv3 Date: Tue, 30 Apr 2024 14:43:04 +0100 Message-ID: <20240430134308.1604-1-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.126.175.159] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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-20240430_064503_866932_8365DC14 X-CRM114-Status: GOOD ( 10.01 ) 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 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. Please take a look and let me know your feedback. Thanks, Shameer --- 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. 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 (1): iommu/io-pgtable-arm: Add read_and_clear_dirty() support drivers/iommu/Kconfig | 1 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 129 ++++++++++++++++---- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 8 ++ drivers/iommu/io-pgtable-arm.c | 110 ++++++++++++++++- include/linux/io-pgtable.h | 4 + 5 files changed, 226 insertions(+), 26 deletions(-)