From nobody Fri Oct 23 15:33:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1791183974; cv=none; d=zohomail.com; s=zohoarc; b=lB4wxak9qm8G4WQUAOfD1zOW43L7X5LRXH2BaO4vktIq1eWYbWsGB5IEc/oftNzlu5Whuio153DieT0HhtfMcJxPuzeluJZ/PaKCeaRi+cCBn4tuZXXHx2+1UsHF3uDfY0dHKR5xMiNXbnw3x7qaEnX/heZGLtGlIk94G1dPZOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791183974; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LI1PY/lp2Uaq3ccGVqctwJ7GhEhUeqzl4hfjynZeaG8=; b=iTXtnIu9xuSrSYnebm6Zv654UXVdUPFfQxxNqKtUpRwL4OQKFRXU5bQjqk/S/e1xohjTbASbYNXhlQVUgX7oJQlwvt52TCDoAYaySKQFizr3z4Hm21BdpfwpfXCt0K6XGwYOKwVJuMT1kAvjlCe5wpjmV3fudnSUmj71A8V9CLM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1791183974157395.18010979143594; Mon, 5 Oct 2026 00:06:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1440588.1657994 (Exim 4.92) (envelope-from ) id 1xDclS-0002pl-HY; Mon, 05 Oct 2026 07:05:34 +0000 Received: by outflank-mailman (output) from mailman id 1440588.1657994; Mon, 05 Oct 2026 07:05:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xDclS-0002pe-Ee; Mon, 05 Oct 2026 07:05:34 +0000 Received: by outflank-mailman (input) for mailman id 1440588; Mon, 05 Oct 2026 07:05:32 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xDclQ-0002pY-6h for xen-devel@lists.xenproject.org; Mon, 05 Oct 2026 07:05:32 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xDclO-00BLBw-Ve for xen-devel@lists.xenproject.org; Mon, 05 Oct 2026 09:05:30 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ac34c30-bab6-0a2a0a5309dd-0a2a4501ab56-46 for ; Mon, 05 Oct 2026 09:05:30 +0200 Received: from [210.118.77.12] (helo=mailout2.w1.samsung.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ac34c39-5984-0a2a45010019-d2764d0cf7d6-3 for ; Mon, 05 Oct 2026 09:05:29 +0200 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20261005070529euoutp02459e45710f21251dc7cb1ff0e4225fd8~bkEshCAH_2592325923euoutp02N for ; Mon, 5 Oct 2026 07:05:29 +0000 (GMT) Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20261005070528eucas1p18d16ec6ecc4e879d0adc66538122132c~bkEsU7ZkM1887318873eucas1p1T; Mon, 5 Oct 2026 07:05:28 +0000 (GMT) Received: from AMDC4653.digital.local (unknown [106.120.51.32]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20261005070528eusmtip1b88e4c060af8fd0102f58eef95fae4dd~bkErlAe2r2672226722eusmtip1G; Mon, 5 Oct 2026 07:05:28 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mail20170921 header.d=samsung.com header.i="@samsung.com" header.h="From:To:Cc:Subject:Date:References" DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20261005070529euoutp02459e45710f21251dc7cb1ff0e4225fd8~bkEshCAH_2592325923euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1791183929; bh=LI1PY/lp2Uaq3ccGVqctwJ7GhEhUeqzl4hfjynZeaG8=; h=From:To:Cc:Subject:Date:References:From; b=IUkx1HNDA0Ce0WVEr0ao5DI7gy0CMBPsbPTzPoH85+3oggsJMvxhJOxmMxm36/r28 Js3UdcmTu5NNN2QVFUR7zJwIdhN9iflz37cpmw4aOb55MYN4sZJqCGFLJwdqHBP8bV dBD4t3FwZKIO32AV80IxRIAyj0Zx1bC2v7SJR89E= From: Marek Szyprowski To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: Marek Szyprowski , Robin Murphy , Christoph Hellwig , Petr Tesarik , Andreas Greve , James Dingwall Subject: [PATCH] swiotlb: fix default_swiotlb_limit() for non-growable default pool Date: Mon, 5 Oct 2026 09:05:17 +0200 Message-ID: <20261005070518.1590097-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20261005070528eucas1p18d16ec6ecc4e879d0adc66538122132c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20261005070528eucas1p18d16ec6ecc4e879d0adc66538122132c X-EPHeader: CA X-CMS-RootMailID: 20261005070528eucas1p18d16ec6ecc4e879d0adc66538122132c References: X-purgate-ID: tlsNG-d62444/1791183930-1FC69757-A942B5BE/0/0 X-purgate-type: clean X-purgate-size: 2041 X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1791183975107158500 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=3Dy. 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-7bfdf10d6= 2ac@a-greve.de/ Cc: stable@vger.kernel.org Assisted-by: Claude Opus 5.5 (1M context) Signed-off-by: Marek Szyprowski --- kernel/dma/swiotlb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index aa2f1c4588b9..5edea93ec635 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -1844,10 +1844,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; } =20 #ifdef CONFIG_DEBUG_FS --=20 2.43.0