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 58A574F4029; Tue, 13 Oct 2026 11:47:19 +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=1791892040; cv=none; b=D1V+prZLvd7DT3Dfoq+7BwO+QKFtE3I5ON6URv4NYeaK9G+dxJh8NJK8QpbCw+eo0Kd1Gw1pqCLLXC/E/ZEG0wLQQSttiQhc5S1wjTxmjyqg5jeIseyWvFZ31EQNOrDEq2qneZuK4mI4h9ntm+btIJv2Nkdm/JWmajXfe2/3AX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791892040; c=relaxed/simple; bh=hJIY5eGeLLYCY2z5C3aQf7aLbHz7PZ9Ot5oGfCBogY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fBIjjJjVpysyDwnErSsEmggLC58FbG7k/3lQNOYPnG51xYqX4OQRanIAFnXnCkZABPw68u/uzBtGLUKtH3Hcn8Lh2nXT6MQEKi3dKCuQbqWgkfMT6woevUEZUfsCDkTcbNpsjNeZl+m3SmkzTP0hNqIL4PKCaobTyEbO+rdwqw0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AsEN77mT; 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="AsEN77mT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD9691F00893; Tue, 13 Oct 2026 11:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791892039; bh=mdXwzV2S0TaLpa9ZG1HeL10jc2hlIcUvpgFA+F/Wwao=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AsEN77mTOWNmTFETnSoSgsYkfGq+8+6E1rWh88yWCmIUWMkJjeTus3A9O5lwiCqE1 1pMNyC8R8XbEC21uL9T/ppzwwYoRpSG9y5BT7lyYVpMH4BrBJTI0B0EbIye+8K24p4 8Xtv+u3uckevuIrnghAsk+IsMTadKHS5eESfvd9I= 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 7.2 041/281] swiotlb: fix default_swiotlb_limit() for non-growable default pool Date: Tue, 13 Oct 2026 13:35:57 +0200 Message-ID: <20261013112856.050555666@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112855.045212108@linuxfoundation.org> References: <20261013112855.045212108@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 7.2-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 @@ -1680,10 +1680,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