From patchwork Mon Feb 5 12:01:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gowans, James" X-Patchwork-Id: 13545357 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF3C0C48291 for ; Mon, 5 Feb 2024 12:04:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D2356B009D; Mon, 5 Feb 2024 07:04:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 782506B009E; Mon, 5 Feb 2024 07:04:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 623096B009F; Mon, 5 Feb 2024 07:04:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5162B6B009D for ; Mon, 5 Feb 2024 07:04:42 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1FC59140A93 for ; Mon, 5 Feb 2024 12:04:42 +0000 (UTC) X-FDA: 81757618404.25.FDCAEB4 Received: from smtp-fw-80009.amazon.com (smtp-fw-80009.amazon.com [99.78.197.220]) by imf12.hostedemail.com (Postfix) with ESMTP id 160BC4001D for ; Mon, 5 Feb 2024 12:04:39 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazon201209 header.b=jBgeXVbC; dmarc=pass (policy=quarantine) header.from=amazon.com; spf=pass (imf12.hostedemail.com: domain of "prvs=75897cb1d=jgowans@amazon.com" designates 99.78.197.220 as permitted sender) smtp.mailfrom="prvs=75897cb1d=jgowans@amazon.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707134680; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=J/26rYh9SEOln6y0M0icroO5+g+Mdt4aS3KBehgGFN8=; b=xg6I7xBVaICvgJcSWVLdvQGWWlBLUdgpv35ksIXa6KzRvEzvpypdb0XEd3EP7LOPw0jsQ0 Yfr5YgyHjcDDa6MBSzFmMDjh9sgfFH7v4e5az7J8sM1igQUPSGuT7ClK1WTf2Liuz7Q3PC D9w41eyQjPjGmEuoL0EMEvCNp68Vnow= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazon201209 header.b=jBgeXVbC; dmarc=pass (policy=quarantine) header.from=amazon.com; spf=pass (imf12.hostedemail.com: domain of "prvs=75897cb1d=jgowans@amazon.com" designates 99.78.197.220 as permitted sender) smtp.mailfrom="prvs=75897cb1d=jgowans@amazon.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707134680; a=rsa-sha256; cv=none; b=rTAtYEbANDprAYycXxObLbf448qC+j8Iq/ieVUrlr+A3tmnuN8CijzmFUkGF3JIUihn5FF LvrH4sB1XnoEOtpHmm86RKA5+Ntt7QisSNmAOTqnHuIvt7bt2PiDS89qS2XSnq5n0s4zae iZnB9w7pEeIGD2zbWpiCx/GahWrM5Sg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1707134680; x=1738670680; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J/26rYh9SEOln6y0M0icroO5+g+Mdt4aS3KBehgGFN8=; b=jBgeXVbC7MQ7ZeIq302ImADqVc71l2YNCmbm/gxsDbKY2jZ4RtRubVSp BMrt66UyyL0Rk72Q8hIhiQAcndzT2dObMXoEZ8dAKfdA7IERIGzWm/p2L P8lNTmaiQmpbvrKZomnyha00s5pOWg0qd2QccLfBLKpD+5MDvaNB6k6aE c=; X-IronPort-AV: E=Sophos;i="6.05,245,1701129600"; d="scan'208";a="63724561" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-80009.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 12:04:38 +0000 Received: from EX19MTAEUA002.ant.amazon.com [10.0.43.254:15018] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.28.192:2525] with esmtp (Farcaster) id 82f5a304-b865-4a4d-9902-a5be57c26a04; Mon, 5 Feb 2024 12:04:36 +0000 (UTC) X-Farcaster-Flow-ID: 82f5a304-b865-4a4d-9902-a5be57c26a04 Received: from EX19D014EUC004.ant.amazon.com (10.252.51.182) by EX19MTAEUA002.ant.amazon.com (10.252.50.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 5 Feb 2024 12:04:36 +0000 Received: from dev-dsk-jgowans-1a-a3faec1f.eu-west-1.amazon.com (172.19.112.191) by EX19D014EUC004.ant.amazon.com (10.252.51.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 5 Feb 2024 12:04:30 +0000 From: James Gowans To: CC: Eric Biederman , , "Joerg Roedel" , Will Deacon , , Alexander Viro , "Christian Brauner" , , Paolo Bonzini , Sean Christopherson , , Andrew Morton , , Alexander Graf , David Woodhouse , "Jan H . Schoenherr" , Usama Arif , Anthony Yznaga , Stanislav Kinsburskii , , , Subject: [RFC 11/18] dma-iommu: Always enable deferred attaches for liveupdate Date: Mon, 5 Feb 2024 12:01:56 +0000 Message-ID: <20240205120203.60312-12-jgowans@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240205120203.60312-1-jgowans@amazon.com> References: <20240205120203.60312-1-jgowans@amazon.com> MIME-Version: 1.0 X-Originating-IP: [172.19.112.191] X-ClientProxiedBy: EX19D041UWA001.ant.amazon.com (10.13.139.124) To EX19D014EUC004.ant.amazon.com (10.252.51.182) X-Rspamd-Queue-Id: 160BC4001D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: tzurcp6gcqazhc9pzq6kagcgcbwjhyrg X-HE-Tag: 1707134679-618287 X-HE-Meta: U2FsdGVkX19mqmgdCir2To7GWMC3EMNeSiLRXF2uB5iwRmBlcE0LUkTIjI8kGVNokHmFecDYrGNO5x2WZx965ArAijSe6+rc0jLqXWqf15+b9Jr481PtUkgn1ulw/Zg+5wvEJR6TFdKq0rr8MnYFC9xRpQCDVOwOrMnEvm191P8FxdT6QaA2CFOBduEz2ih8g383h0o6NzUv4aBhnGFx3/79e9GW3qNqseZfooD0iTvoX4hMEb1OgrO0W4Pmr92xyLLE55vvCXZgS2JXQsZCAB0yDPvy3d027UssHma5e/0y+YUWvGKl32wkNrqqKhz33bSTEdv/KVorjaAo+wz7B06893qe4tLFnMOWWvCRUPiKGDH8rc4Vus1ESs0cBe+7HQV3V2GG5udPjpQci22fdg0mKYfz0b/ZxRcDg1W9T7GDVJukOhFRavyonjy6Ah2P+Xl8YFpVGrU8qRZhjGLkW27OXauPl7tZVqnE9zMQSUxEWaG+qR5yGlcHSE/M9aphhlUSnC/51boY3mBfRYrKuSYYTk1lDZfD0qTPwdyoXyoYaAwrtt8sIKB4J5aLlTWnl7vfXevNW1pS6EXw0GLY3gy74QG8wO0WCTFrwg4hs2RcLQkb2+qlP+GfBl13g/UO7Dv/HLnbs6ZIjCKKlGtb4o+KxxQfHJ/VF/TE7VsXkgrtR3C5C5y60FDRMTF7EsBeCpKDZ9w5naYtf1wTkArsgv2CKdyCuUDzCMCXgHZiOO3oxIfa1ughwfl1x91Bvd2CAPhiIbvitQ35Jd9DpHNQE/TTLiLREc8KED3tHWCIGMf0GWlR/b3IBq9HxuiUVzUYT52BoJEY72ilsoXUIeSd+UwX524PuVkv5yT4JWh0y8WFdj5G0vrYioNptTqKBHXUIxOuQ5w10Sl09ehPwy+MhYPN8L1IXYeruckVQ0FwQfDbkU0PwjfkjkR+1uizFO6Omf002XO7dmfUyMCTPh2 ymAnYapk JXVp3cmxPx1+tW44f34a6J2RutCGWj8O5drOACF3tc6h7JAKP9kcFsTxLu/toC8i5NuZrwsyTFtc/mKT8B5cc4/uXZdN80bS5JoNCqcJDTU/+haoN1G7zMuT/xuM7zUuHEeQxZmJze3oKtvkpo4WMSEZbGHMvgvZcYmOB3neXk+dE9O9OCma1kEvqCY5cLOCYO79MSvvg35VxdSk0Lc4O7nfzkbyL6Z6KdheZLQNJBQRXsk2BIcU2lcnzbH/ed+o/oFPjeWw8xkeOV0Nmfw+FtZGg2Ea1EZvukZa6Rv9pgWZjHasU69hpf5hr5Fgu3mxTgaAYEE46XFvi+QY8lVJ2LXxUv8eosEbtbn4ydSIRGkQQC97okacMIz+Aps7GGvIcz3009LtdCdXF/5Pdj5lbjXOht6GsbLFSoXjT2U+FBFQwKkWxqRF3wb72tsZe67eMt4mqX3oIauyngw2fRP2KXJ56r2uCBvuicFg09uuoRcIGvRiPKdUz5wardd3tW65sSNg7pEHc2OKiZQoU5tPs61mHCppIPz0OaRBnaD+X0WiPP2I= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Seeing as translations are pre-enabled, all devices will be set for deferred attach. The deferred attached actually has to be done when doing DMA mapping for devices to work. There may be a better way to do this be, for example, consulting the context entry table and only deferring attach if there is a persisted context table entry for this device. --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index e5d087bd6da1..76f916848f48 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1750,7 +1750,7 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc, struct msi_msg *msg) static int iommu_dma_init(void) { - if (is_kdump_kernel()) + if (is_kdump_kernel() || liveupdate) static_branch_enable(&iommu_deferred_attach_enabled); return iova_cache_get();