From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61EC1C5AC7C for ; Fri, 7 Aug 2026 11:58:43 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4hGjNK6pFdz3c3w; Fri, 07 Aug 2026 21:58:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.234.252.31 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1786103921; cv=none; b=Fz+Fw7VqDPiqJFeF0OTHO/Jvu4C2wVpKEJls+Xwkd3O/ssoskywP2vYIqFTfhXMTSat9d4epkX1vjR8g4pNpvK+HeZxgjXt2i40ygS/LSmwJoxx7sVFSUeEVbRQg81Vf/HpFzBr94OztpnafhWYo5JLw9LLDmS8M7wdqEsdF2EvUo+iDpkN9pzQdszUsVlUrNymALOTZEU3mhJUeloXaLNv6z0L3/J+v1b+Isr6mR0LUrBSlG1hpCmvx6TXZ3zWaCZtUxFcbHKshB/k1OLzr2rhice7WhVBiXRP6tYE8HJvhx6Ac61ooGJCtpWR3t39DTMl/Wc1Ka/ANH3XU338QyQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1786103921; c=relaxed/relaxed; bh=Xd3UFDIz5wYvevp0q0lFRxsbOOvF3TFwe4o0b4um2rs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OqAtgZ7AmvNLPyPvKKfjXRMC50FShEITgRY4BsG+hLX+d0wQfjPJgWqOT6K4UaV07RwJL9+7LrdSoFGheyNH5S+nRCAL2SPhjtDP6aITIVWTDd7FI9EUm1avV4LPUxwzydT0qBcTQkeCP87BjjjpN905DygEFjE0IBBi3skj78APfzgPqMstIuEQUaE6ZeT0oFX0PPZ6WJQP7YWUyTUVkt1BLYRBmCPuOf8o+HdyuvLtiQF6/BkH4LdxJQ3A8nFn39KA/UuFLpNQ55aA99X3VP+XJVlTVX5c5LrLgGVSzQj8I1xRs8gvae6Vj/e7SYvnTd+0lgxKHtzsp22phYxkLw== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Nb5CNrdE; dkim-atps=neutral; spf=pass (client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=will@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Nb5CNrdE; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=will@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4hGjNK0ZpJz3c3v for ; Fri, 07 Aug 2026 21:58:40 +1000 (AEST) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 9545243394; Fri, 7 Aug 2026 11:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2F7A1F00A3A; Fri, 7 Aug 2026 11:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786103918; bh=Xd3UFDIz5wYvevp0q0lFRxsbOOvF3TFwe4o0b4um2rs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Nb5CNrdE/4Z45mCov87EsHo7R+c/XppeMgdWkypZiJi0hG1F3qOgd2tMn8awJqvaS lbdSFBuX+8DZW+BUgsVb72bpNXzoeTOxLUMO7EfDoa8A1uqNuAgZxEIKcOk6xWqCjz inB/PGpqH/asRSsq2GTJ8yf/60nRgNhE7C1XyCY51qwFthllbwSfudh5hb9iKzACj7 QziTT7OLJ6iY0pmcLYRNlH75OV6VN8M2L9EGh7RPznyr9g/ejgHCUX6HO7rcff8qyK jVXAQEnK36ohiepgjg3IyQBDlNwN1AqiRdGYIzb5ul1D0/BFPUE3uuAab7MCjuibx8 FtaKWGZWWR0DA== Date: Fri, 7 Aug 2026 12:58:29 +0100 From: Will Deacon To: "Aneesh Kumar K.V (Arm)" Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, Robin Murphy , Marek Szyprowski , Marc Zyngier , Steven Price , Suzuki K Poulose , Catalin Marinas , Jiri Pirko , Jason Gunthorpe , Mostafa Saleh , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , x86@kernel.org Subject: Re: [PATCH] arm64: swiotlb: Keep the default size for protected guests Message-ID: References: <20260717180442.110954-18-aneesh.kumar@kernel.org> <20260807092612.2202005-1-aneesh.kumar@kernel.org> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260807092612.2202005-1-aneesh.kumar@kernel.org> On Fri, Aug 07, 2026 at 02:56:12PM +0530, Aneesh Kumar K.V (Arm) wrote: > Realm guests and protected KVM guests may require swiotlb for device DMA > even when all system RAM is addressable by the DMA zones. > > Do not reduce the SWIOTLB buffer to the kmalloc-bouncing size for these > guests, as the reduced number of slots can be exhausted during CCA guest > operation. > > Fixes: 30c5e45ee2c5 ("dma-direct: make dma_direct_map_phys() honor DMA_ATTR_CC_SHARED") > Signed-off-by: Aneesh Kumar K.V (Arm) > --- > arch/arm64/mm/init.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index e308a7cabd12..24caaf10e755 100644 > --- a/arch/arm64/mm/init.c > +++ b/arch/arm64/mm/init.c > @@ -339,7 +339,8 @@ void __init arch_mm_preinit(void) > { > unsigned int flags = SWIOTLB_VERBOSE; > > - if (max_pfn <= PFN_DOWN(arm64_dma_phys_limit)) { > + if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) && > + max_pfn <= PFN_DOWN(arm64_dma_phys_limit)) { Protected guests under pKVM rely on restricted DMA, so won't this just waste memory for them? Will