From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18F3947607C for ; Fri, 7 Aug 2026 15:34:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786116900; cv=none; b=leO+v8QlsdMwnWnkt8q8Vexo9pYSYpsPTfjqe1UvlJlWPvmsunFSgkDgMARhHjzxsoVeRQZX5qUum5fleioNd6NHUek1pj2GMWmZRmHKXkCCWamTZ4joIUeR5p7E+qQ+2901ffxuqNGZYMvtO60bZEnh/mUaQQ+3BnECB71kaZ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786116900; c=relaxed/simple; bh=7a7AysVuynNFe1lOeN952FQuu+x6NVHG3FmBrbLqGgw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JFa4ySmSQnBK94xvmsaoD+rshfZ4sdqiegujqKZI93xM3rs3TXRlD3ZTcD/kpdHJQvgIufVN38B++yeZcIkrPLqYg2OxyzYDX0lNN5HoNV+pTwuXt9u1xUUWROmNsx+9VUWrqm7JvX8l5f/2D5Hm77vQKf7KgOUenlqH0zTtxhI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CO+3mFLz; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CO+3mFLz" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-69fec8b4638so13959a12.0 for ; Fri, 07 Aug 2026 08:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786116897; x=1786721697; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Az5wp+kAsSbtOjG5rv8pQmucG2yE4e6DGCCgwM57rEM=; b=CO+3mFLz+OnsuSbka+OZwIUiYQ6ZIdTII924AdUdsNDVEHfbCyZgORYb1GLjx1Cmxr LfTHeFk8hjRmB6GtjJVz0uIFrhTviZsJsveFzdtkvebPmw4Ykqflkuc3b5p5XG9UA1jh AJ6b23Itqui55e3w9vJ7CiWR2aBVjxccUYHA/J9NqXZb4FmSjwJMGw7R7lXDrCImG4uJ wFJ/IOMJpJgGZKCPbs4ctguZspPnZX5yzMKXUd0hKFmrL8CiB0/Fyg+8mofC7mVEvCzA KXsl4agTfDeV8xscICo9F/aGDOr/cbOXw7xLJ6hcdPOcrfeWVkbo1LHBbm9tPOkPVg3u /RRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786116897; x=1786721697; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Az5wp+kAsSbtOjG5rv8pQmucG2yE4e6DGCCgwM57rEM=; b=JEqWWIGW5h2c5poc1N9ZRRRmyC2YKZY+6IzcBIygvNcmmVYW+7On8uMcbCrDKhNbek QptILfs5xeMMRAsAVB6rPg6k5ax30my6qG/h2f1YzK3pOxXaOnVOAF4y99IMBo6E+42o /dqi8m802KjIT2GuD6Xq3o3EezwOqevqHDltO/BPeoZwLFIR3R9Sj1JrCG0h/nWb67EF 8kDEDKmX5TsOdpHAjSH8VY4zlJ9Z741z4zVV59jdIY/AbsXfdnuywWFaZCwTtK/envbJ Hph/LEK4diwWLw/zFwW80+M3SH0ZFgjIJbWuGCRVbnwf/Lt45aZQLqPr8oeKEtROIs8I DcoQ== X-Forwarded-Encrypted: i=1; AHgh+Rp6IFZRH+9sICA8vPS0eCWZp3ttShSBAUfMn64W8qPgOhm4gyzgBlNMEtKdI/Ln64qtdIgt26FCzxfJlZM=@vger.kernel.org X-Gm-Message-State: AOJu0YymnwaoVWGldFBzh5+N2tSn+RUDJJT9bk1cnSayg0jV7qFxc21a u/OhFHM/2uBtJvyzIeWIr5VvsGBDLh/R1Ds8eGZbInvv5//Smqgthj0dsanC3I3upA== X-Gm-Gg: AR+sD12pbxZfxUPYegg4PU/bWGGeS0AZJf+ksQ8YPBGbYfDM73cK6k2Rhf6ndyYloEX goejFCaO30Abr+Q/8su0hq01izIEObJJ64cacWGy/2O7X2rjH7fymDdSPbh9eflrXNwV079O0Q4 gtUwGxBFyvUnYyUBUCv8Iq6wUfVuPNRRRfADIjSIKnecVV1yKMCagK6yNer869tzX5KaK4RJWka LwyB+cLXy/M8jTcc742vrTNqj/q2MWPIVieqEU5q70Ao2XXhsOx32RVl44cWkYElKi5O1N+5Bq6 6NSBkNW3hZKxGZ78zmspMFLoPTS/zjna8fG/UpT+3ozHR9g18T9Ev0Y+VW/UO1R25TXgwuE6XxC X+t2iehVTOHyRTl9FnvAZUY/MU0+YAt94VRU2ZcFzY2HbhRWhddQyJprKVKBEcBZKblOD920eK/ nUK/4t678Kd7TVz2T6FI26OqglJiws4jO7aT3VZH3MAs3bCPF5BH7JrFJGv0VWiRJW/RZA5/77W jmdj3aN4k4x76eGGYk08VY6H2NFuQ== X-Received: by 2002:a05:6402:65a:b0:6a1:f088:9486 with SMTP id 4fb4d7f45d1cf-6a1f088972amr16113a12.4.1786116896722; Fri, 07 Aug 2026 08:34:56 -0700 (PDT) Received: from google.com (250.192.189.35.bc.googleusercontent.com. [35.189.192.250]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a1e7d48f8dsm708475a12.17.2026.08.07.08.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 08:34:55 -0700 (PDT) Date: Fri, 7 Aug 2026 15:34:47 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: Will Deacon , "Aneesh Kumar K.V" , 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 , 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> <20260807135810.GA200537@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260807135810.GA200537@ziepe.ca> On Fri, Aug 07, 2026 at 10:58:10AM -0300, Jason Gunthorpe wrote: > On Fri, Aug 07, 2026 at 02:18:31PM +0100, Will Deacon wrote: > > > > I was under the impression that there is a possibility of using swiotlb > > > instead of restricted-dma-pool with pKVM. > > > > Yes, that patch enables swiotlb as a possibility for protected guests > > but with your patch we avoid shrinking the swiotlb buffer even when > > restricted dma pools are being used and that's a waste of memory. > > I also thought we switched pkvm to use CC-like swiotlb as part of the > alignment in this rework? Mostafa ? Yes, now protected VMs can use the SWIOTLB for bouncing. However for Android (and kvmtool), use restricted DMA. so SWIOTLB is not used. However, I do not think we should over engineer this in the code, swiotlb can be set from the cmdline and now through Kconfig also. Thanks, Mostafa > > > > If that is not the case, then we could change: > > > > > > !cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) && > > > > > > to > > > > > > !is_realm_world() && > > > > Perhaps, or you could just pass the swiotlb= option if the defaults don't > > work for you. Can you give more details about the slots exhaustion you're > > seeing under CCA? > > We see badness with swiotlb too, it basically doesn't work out of the > box if you have to use it 100% for real devices. It easily runs out > of memory. > > Auto tuning to higher levels makes sense to me, but I'd rather the > core code handled adjusting its size to the estimated need, not arch > code. > > Jason