From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 707E23CB91E; Sat, 17 Oct 2026 17:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792257240; cv=none; b=DX6vwnQN207B6gpqdZrX9+fo30c93x02lvmm86zqHhlvWH9vUz4Fa8bqwp8dXbV1qQKBCpT/piazmDMkTRJ4oZeryFhbNdCszqPK0feaYt52o3F5xT8T1+5QRtL/Zc+j36o0yK7iWDioZEsYpBhtiKn5fnC9TQS2T4oaJ2qjS4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792257240; c=relaxed/simple; bh=809l+5rK6Nzp8TyYTCGVrIEQIDUPKJzAZ0oFAUK3cR8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pecBkK40GlktCNw9o4eO4XT67nSBswdwVtT+lRBKsxhYamOPL4SoylKpX2o/LtJRW7IBswZNv1sVnzmTGeq4PmnHjRhjuinl7YxrZrN/ZMqNxg33mZCfqFj1/OqnJNPNFH2ArAzxo+8h/uyl6aRNQ5ABEpjNgtYr1RVLeaxurmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ewtG3j1/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ewtG3j1/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B603A1F000C4; Sat, 17 Oct 2026 17:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792257239; bh=S8D0x5R1URmfjn1q8OLteumWeVKZWvPJTXwYPGUdqlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ewtG3j1/fFIJsuBplJUkuOQqnlwYwhZX4LnRiGCrUh5nq0VG0mxPDbtKjWQB8ZfJr E0PxfGowTH3M3aj5WPiugcUTyAMDtRC48Qa7zd1fkXQOccVoKf/EiJgsCH2xHx7RNm zN+KkSWBAKUpBh1cTARQtgHvs1RKO8jIfznVWlmQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andreas Greve , James Dingwall , Marek Szyprowski , "Claude Opus 5.5 (1M context)" Subject: [PATCH 6.6 0479/1674] swiotlb: fix default_swiotlb_limit() for non-growable default pool Date: Sat, 17 Oct 2026 17:45:51 +0200 Message-ID: <20261017160443.409965171@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Szyprowski commit 911655ab1dfb9d526978a75df3b210132620d30a upstream. Commit ad96ce3252db ("swiotlb: determine potential physical address limit") changed default_swiotlb_limit() to return the maximum physical address that could ever be used by dynamically allocated pools, so that the value stays constant when CONFIG_SWIOTLB_DYNAMIC=y. However, io_tlb_default_mem.phys_limit is returned even when the default pool cannot grow, e.g. when swiotlb_init_remap() is called with a remap callback. This breaks Xen dom0 on x86: pci_xen_swiotlb_init() passes SWIOTLB_ANY and xen_swiotlb_fixup(), so phys_limit is set to the top of dom0 memory, although xen_swiotlb_fixup() makes the default pool below the 32-bit boundary. xen_swiotlb_dma_supported() then rejects 32-bit DMA masks, even though the bounce buffer is perfectly usable by such devices. Return phys_limit only if the default pool can actually grow, otherwise report the real end of the default pool, like in the !CONFIG_SWIOTLB_DYNAMIC case. Reported-by: Andreas Greve Reported-by: James Dingwall Fixes: ad96ce3252db ("swiotlb: determine potential physical address limit") Closes: https://lore.kernel.org/xen-devel/f74668db-52fd-4575-8372-7bfdf10d62ac@a-greve.de/ Cc: stable@vger.kernel.org Assisted-by: Claude Opus 5.5 (1M context) Tested-by: James Dingwall Link: https://lore.kernel.org/all/20261005070518.1590097-1-m.szyprowski@samsung.com/ Signed-off-by: Marek Szyprowski Signed-off-by: Greg Kroah-Hartman --- kernel/dma/swiotlb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -1594,10 +1594,10 @@ phys_addr_t default_swiotlb_base(void) phys_addr_t default_swiotlb_limit(void) { #ifdef CONFIG_SWIOTLB_DYNAMIC - return io_tlb_default_mem.phys_limit; -#else - return io_tlb_default_mem.defpool.end - 1; + if (io_tlb_default_mem.can_grow) + return io_tlb_default_mem.phys_limit; #endif + return io_tlb_default_mem.defpool.end - 1; } #ifdef CONFIG_DEBUG_FS