{"id":2221400,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221400/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/patch/3eed961d41d3a81460031dee9f1db066f1d2e111.1775739433.git.robin.murphy@arm.com/","project":{"id":21,"url":"http://patchwork.ozlabs.org/api/1.2/projects/21/?format=json","name":"Linux Tegra Development","link_name":"linux-tegra","list_id":"linux-tegra.vger.kernel.org","list_email":"linux-tegra@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<3eed961d41d3a81460031dee9f1db066f1d2e111.1775739433.git.robin.murphy@arm.com>","list_archive_url":null,"date":"2026-04-09T12:59:41","name":"[v2] iommu: Ensure .iotlb_sync is called correctly","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"50f1a429d10d4e556d71e0421d967ec2281086b0","submitter":{"id":65641,"url":"http://patchwork.ozlabs.org/api/1.2/people/65641/?format=json","name":"Robin Murphy","email":"robin.murphy@arm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-tegra/patch/3eed961d41d3a81460031dee9f1db066f1d2e111.1775739433.git.robin.murphy@arm.com/mbox/","series":[{"id":499286,"url":"http://patchwork.ozlabs.org/api/1.2/series/499286/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/list/?series=499286","date":"2026-04-09T12:59:41","name":"[v2] iommu: Ensure .iotlb_sync is called correctly","version":2,"mbox":"http://patchwork.ozlabs.org/series/499286/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221400/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221400/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-tegra+bounces-13644-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-tegra@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256\n header.s=foss header.b=Iwe9vtEW;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-tegra+bounces-13644-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com\n header.b=\"Iwe9vtEW\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=217.140.110.172","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=arm.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=arm.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fs0QV3cG6z1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 23:00:02 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 1F90A300275F\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  9 Apr 2026 12:59:54 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id AF2A518A6A8;\n\tThu,  9 Apr 2026 12:59:53 +0000 (UTC)","from foss.arm.com (foss.arm.com [217.140.110.172])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 10A723C7E13\n\tfor <linux-tegra@vger.kernel.org>; Thu,  9 Apr 2026 12:59:51 +0000 (UTC)","from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 666172F9D;\n\tThu,  9 Apr 2026 05:59:45 -0700 (PDT)","from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com\n [10.1.196.85])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EB5493F641;\n\tThu,  9 Apr 2026 05:59:49 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775739593; cv=none;\n b=Cb8ayUDJPFQTDpZ9UBZtPTN6Xrg2VTE0DFTXARNJ1vP6RWEXmnst/XYCAxST+RQ8yXw8pDqcHZN8FJavGpRLfDTYt+ALeW8CkO6o3OwXiTxH4sdoaixcmWo4UQRzs7oO6KPumKwGUEEq1CK9Qeyx9K4eSj5OwFP7eL1if5gcEEw=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775739593; c=relaxed/simple;\n\tbh=4mjSmwYwqDeDBCI+476/c2pzTgbI2J4XyUIYa4sKdpM=;\n\th=From:To:Cc:Subject:Date:Message-Id:MIME-Version;\n b=tUtS1dv8VnfEtIzN5lKjH4HbRmRg0PhUHJJz+iqTd52AZCMj3MlYvid9jHRyqQ1OpE+sazqYeI3diPSMiS7CRSeREB5wsu81yPnYGwT/VhR5lxBfA8Ji7z2U+V9nMpuwg0XdSiz+ID3TGs92bcmgwKct16rdWL4W4ROdMFaKoc8=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=arm.com;\n spf=pass smtp.mailfrom=arm.com;\n dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com\n header.b=Iwe9vtEW; arc=none smtp.client-ip=217.140.110.172","DKIM-Signature":"v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss;\n\tt=1775739591; bh=4mjSmwYwqDeDBCI+476/c2pzTgbI2J4XyUIYa4sKdpM=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Iwe9vtEW7HobOS2KwDIt3cBb2OtwY9vxZbC1qoQ4p7XN7Qj5Ao79kXlkge11T6gvS\n\t jEUxIyqe4PxpTe7cVzH1llCYf05pDE6FnPZ3OVeFH6nTu557m88YtRi2gWt/Zb7MxN\n\t iEiiT0t192qabsf/oUGP6K0ty0xTzVrBrcvHYqCs=","From":"Robin Murphy <robin.murphy@arm.com>","To":"will@kernel.org,\n\tjoro@8bytes.org","Cc":"iommu@lists.linux.dev,\n\tlinux-tegra@vger.kernel.org,\n\tJon Hunter <jonathanh@nvidia.com>,\n\tJason Gunthorpe <jgg@nvidia.com>,\n\tRussell King <rmk+kernel@armlinux.org.uk>","Subject":"[PATCH v2] iommu: Ensure .iotlb_sync is called correctly","Date":"Thu,  9 Apr 2026 13:59:41 +0100","Message-Id":"\n <3eed961d41d3a81460031dee9f1db066f1d2e111.1775739433.git.robin.murphy@arm.com>","X-Mailer":"git-send-email 2.39.2.101.g768bb238c484.dirty","Precedence":"bulk","X-Mailing-List":"linux-tegra@vger.kernel.org","List-Id":"<linux-tegra.vger.kernel.org>","List-Subscribe":"<mailto:linux-tegra+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-tegra+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"Many drivers have no reason to use the iotlb_gather mechanism, but do\nstill depend on .iotlb_sync being called to properly complete an unmap.\nMissing or incomplete TLB maintenance at this point can then wreak all\nkinds of havoc, particularly in strict DMA mode where IOVAs may be\nreused right away, if DMA traffic for a subsequent new mapping hits a\nstale TLB entry and goes to the wrong physical address.\n\nSince the core code is now relying on the gather to detect when there\nis legitimately something to sync, it should also take care of encoding\na successful unmap when the driver does not touch the gather itself.\n\nFixes: 90c5def10bea (\"iommu: Do not call drivers for empty gathers\")\nReported-by: Jon Hunter <jonathanh@nvidia.com>\nCloses: https://lore.kernel.org/r/8800a38b-8515-4bbe-af15-0dae81274bf7@nvidia.com\nReviewed-by: Jason Gunthorpe <jgg@nvidia.com>\nTested-by: Jon Hunter <jonathanh@nvidia.com>\nTested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>\nSigned-off-by: Robin Murphy <robin.murphy@arm.com>\n---\nv2: Add tags, clarify implications in commit message [rmk]\n\n drivers/iommu/iommu.c | 6 ++++++\n 1 file changed, 6 insertions(+)","diff":"diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c\nindex 50718ab810a4..ee83850c7060 100644\n--- a/drivers/iommu/iommu.c\n+++ b/drivers/iommu/iommu.c\n@@ -2717,6 +2717,12 @@ static size_t __iommu_unmap(struct iommu_domain *domain,\n \n \t\tpr_debug(\"unmapped: iova 0x%lx size 0x%zx\\n\",\n \t\t\t iova, unmapped_page);\n+\t\t/*\n+\t\t * If the driver itself isn't using the gather, make sure\n+\t\t * it looks non-empty so iotlb_sync will still be called.\n+\t\t */\n+\t\tif (iotlb_gather->start >= iotlb_gather->end)\n+\t\t\tiommu_iotlb_gather_add_range(iotlb_gather, iova, size);\n \n \t\tiova += unmapped_page;\n \t\tunmapped += unmapped_page;\n","prefixes":["v2"]}