From patchwork Tue May 28 07:18:24 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: 13676218 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 99F76C25B78 for ; Tue, 28 May 2024 07:19:44 +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=pQKOWG20gkZymWwwGWAVtGysRu7iUQrQN6MHm5enFIY=; b=v2fRS9T1waMOuA DUqrz2lltUoriuI1rWnwpeCOloVAZ+9fe9lC9QMj4SQfCBM2WvGC3m/stObflVqZHJbuv+sNlEu24 DOPWMae9VRJZfInyYa6H4zirJahuclxj0qW098T0hn8SoednDSebACggHq2xvxkJD51Lov2LOWS2t np2dAS9Rp+kNtv3uCnlPyqqYPMZyh1liEMRYKOdwzk85iiMvbDuDEB6tgjT7XYK4BnZpcmS5QMeHq w/GXyWZxy5bpEqhNzFyM4K+l0g+T/bO8612VvNKgZ8c05PNkUPkYHxMEx8pZd6EfsqLA4+Bkbt+mg SRaPtUAnwle2YrUkGxxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBr7O-0000000HJ9U-2Tvq; Tue, 28 May 2024 07:19:34 +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 1sBr7J-0000000HJ6Q-2TuA for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2024 07:19:32 +0000 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VpP0n4tGxz6J6Fk; Tue, 28 May 2024 15:15:05 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 70274140A90; Tue, 28 May 2024 15:19:15 +0800 (CST) Received: from A2303104131.china.huawei.com (10.126.170.13) 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; Tue, 28 May 2024 08:19:05 +0100 From: Shameer Kolothum To: , CC: , , , , , , , , , , , , Subject: [PATCH v4 0/7] iommu/smmuv3: Add IOMMUFD dirty tracking support for SMMUv3 Date: Tue, 28 May 2024 08:18:24 +0100 Message-ID: <20240528071831.17560-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.170.13] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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-20240528_001929_955530_7C1E2F02 X-CRM114-Status: GOOD ( 10.10 ) 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, 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. 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. 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 Jason Gunthorpe (2): iommu/arm-smmu-v3: Convert to domain_alloc_sva() iommu/arm-smmu-v3: Factor out a common arm_smmu_domain_alloc() 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 (2): 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 + .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 21 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 192 ++++++++++++++---- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 16 +- drivers/iommu/io-pgtable-arm.c | 119 ++++++++++- drivers/iommu/iommufd/hw_pagetable.c | 3 + include/linux/io-pgtable.h | 4 + 7 files changed, 307 insertions(+), 49 deletions(-)