From patchwork Wed Jul 3 10:15:59 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: 13721733 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 DF437C2BD09 for ; Wed, 3 Jul 2024 10:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=aso7KMrWMJ24t4q9JeYeiR1dg5hXv3ngWbZh0xnmcz4=; b=igWkebNtgCcCKwylcXNtfyWnLe xQUg9RWpM7oEoLz8GwWfq/seAkHc+onxwodNxLVYfL4wNiHXSdfMfv9w0oXOmKpui20emD1BSlWB8 OMc1k3Sb5rDuIFSbn6TLejCKIO7VVSdvbpRy+YVArM6Hx95wZZ77NwJcWVwZXzCdgQkBcCSkbURuW hVFPoId6ORt691RUm5s+2zMrltEvE7nQfElbin6PR79J6hWlE3rBz1qFVrvPL/Q+cAQV9DuE9Q3ZB lm7BdsB6HzeaOLShYF30A/P2nHdanpgA001L6NKVZ5gPEcnPhvPY3tGlu4yuy6wNBzwOT/Y/3yIC3 +e4zIcoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOx4J-00000009iVx-19dU; Wed, 03 Jul 2024 10:18:31 +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 1sOx45-00000009iR2-1Isd for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 10:18:19 +0000 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WDbKF2dkkz6K99Z; Wed, 3 Jul 2024 18:16:17 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id E37A3140B2F; Wed, 3 Jul 2024 18:18:09 +0800 (CST) Received: from A2303104131.china.huawei.com (10.203.177.241) 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; Wed, 3 Jul 2024 11:18:00 +0100 From: Shameer Kolothum To: , , CC: , , , , , , , , , , , Subject: [PATCH v7 0/5] Add IOMMUFD dirty tracking support for SMMUv3 Date: Wed, 3 Jul 2024 11:15:59 +0100 Message-ID: <20240703101604.2576-1-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.203.177.241] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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-20240703_031817_653074_6E3F559A X-CRM114-Status: UNSURE ( 9.37 ) 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, v6 --> v7 -Rebased to kernel/git/will/linux.git for-joerg/smmu/updates branch -Dropped patch #1 as already addressed by Jason's series. -Picked up R-by tag by Nicolin for patch #2 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. v5 --> v6 -Minor updates based on Nicolin's feedback. -Picked up R-by tags by Jason, Nicolin and Kevin(Thanks!) v4 --> v5 -Dropped arm_smmu_sva_domain_alloc() related changes from this series as suggested by Jason. -Added R-by tags. 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 (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 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 160 +++++++++++++++++--- 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 | 3 + 6 files changed, 268 insertions(+), 26 deletions(-)