From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 D43053769FB for ; Tue, 19 May 2026 14:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779201943; cv=none; b=jdHZbblow621itf4Jc7fLfvzE/A+/UvUsPwd+Q339R/Sz8c+OsnF1hHwPP0PrhxdqeSaRRHGt39tqCh9NzZMMvU+e9qRCk6siYs6Z3HdY+hfw9ydXVNKJ4R78MjPEt+IJhBHlw6xW7nm+Z0Ti96HF21vPX/o2cc88FNBnL/71IU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779201943; c=relaxed/simple; bh=cS793SwOviBnkbKXY6VDrZ6GHZeAkO5ji2zHNpUdkV4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bpBDiiguPt18K5IEODCsHJhnrYeZMa6kVi7yCEid/MLCTaNrv6u8/S+CcrY01T7jq5M5yuZhuA029yh4GGLKPMjXbNCJsNj98I403LId4i7MKNQVo8szBfAJDR8czUW7/z0wL66ZTUUo+fl/NiEq3SeC1WAfFON525/ma/lw/WI= 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=V75pkfVk; arc=none smtp.client-ip=209.85.128.54 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="V75pkfVk" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4891b4934ffso635e9.0 for ; Tue, 19 May 2026 07:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779201940; x=1779806740; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=h7Nz6XFDKFDcI1TVcowrB8v0PKJyf/qnRnOMl+2I2pU=; b=V75pkfVkdFU6VQB6IjQ1raYR6FJEzU8kxZwZTpL/YBmSoHihrEG6/nmZ0goWpyQw6i NW3WkWRfWedz6flI8Q+XDaowusOYXQABc+UI0ZrYhfLT/zWMU6Ode0GsOSN5i7C6uJN6 upQQmCpHH9hm/3iEJJWV1my+JoFJkoImRGYkwXkJhhAtQsOtDd6wccu55ijdLk2yH5VC 5sl+Ohp5lZn69DWPsWBE1d/g0JvmIXmuUrr7yvX6/6527nWmzFEbI6wzCCs7gDSH+ijf cl/aXsKqa1Y+EHsjrGyPmLIurtT9EGbDvl9vFB4jbsW5HeMJxFwVMqXO8yGBEHVWr/W/ P/4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779201940; x=1779806740; h=in-reply-to:content-transfer-encoding:content-disposition :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; bh=h7Nz6XFDKFDcI1TVcowrB8v0PKJyf/qnRnOMl+2I2pU=; b=eoUJgpOyTytcTa+KbhVB+C4xV1SvBdrgRhzDWYN5Arfdr8K4gRSdAqRny2xOyynRVZ tvTNo8FZ8t5594vGRyOAFK346QncruY3FNLK6Y5gvn3orzhAxkTl+Iz0924aUrN/aVMY hR1NYi1uUKj2sOa8LJKZFwWsZE/FmOFO6ndJXdKprhfwZgVzu3Udjy9CPtp2RsChULLX klte7nNAqKmy9LSDe8SU5cF1AdVufLTbeJCPg1vJOqS3geWWWJ5/nv6bVjBh+wpz6xk0 CtJSYpinyvoXCXd9oZjCTR9Yxoz4mSIaaQKPo2Cy8tl7VJBaouAc6rHT4lBevXJcOBNt 7mWw== X-Forwarded-Encrypted: i=1; AFNElJ8qbKu/w+Z4vEd3lLs7mGqoRv7w2XRF6utLieCLaW2ElZwMVs7A3x+tiwNwXacB3EW0+vTfc2Z4oLVUeLw=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg5HLnMsz7bATz4V7qVCfVxzamACGV8jZVNwdhVRTYjxrGRzJa TXHrK6shhS2/P8f3MynIbz+zxVphsDx8f9Iby5jJiQVzOHBwm7T3p0vndbKwFBIc/Q== X-Gm-Gg: Acq92OG4h7B87HugDk2pt+tx3TiIYMQLB+ObhV90UO8ZqIoYooD1m0eHqkdBk8it1e8 1HsuBQxjnBrghvJVp2RRuMDFbSr1F9YdmM+/ruwO2yj03AGDKl2VMoJ40IiG7nUYiTOAZ5fdEYw btlCDS8rYTSnxUyiOGvhSiNIS5xxttNR0BcbXJU2gXuvriEMlo/XkCIPobfItf4pwcJuYcmFK6l MTE8XyvurQuW824jUKoCP+VySSqfjBRDTSH/zIuX33u0GXGo919ogEaD43PT/AtHfszP68X6IPd bmYbsr+y7eFCVzf2ccTUODLX0H79NWQn0ja6K/fbX2hpBNUAVhoditsMMvwWComM388MU7nEpUA +CYfpqFMgzK8F7SGHHrb8nzmy5mvcJQ0L/aa56cYugskp05XWMBE8fY1VjICdXs2DRBUhnxltAD yBc53R7pFloMVS7NQZGM1kUgf2Reqsh3QupslMTBBJqcaDlWF0mQQJzekuu7XonKblUUs4ohjhY rA= X-Received: by 2002:a05:600d:6401:20b0:489:1f6a:4ac0 with SMTP id 5b1f17b1804b1-48ffa0627e7mr3099895e9.0.1779201939945; Tue, 19 May 2026 07:45:39 -0700 (PDT) Received: from google.com (136.41.155.104.bc.googleusercontent.com. [104.155.41.136]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45da0a178adsm48721081f8f.18.2026.05.19.07.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2026 07:45:39 -0700 (PDT) Date: Tue, 19 May 2026 14:45:35 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: "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 , Will Deacon , 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 (CS GROUP)" , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , x86@kernel.org Subject: Re: [PATCH v4 04/13] dma: swiotlb: track pool encryption state and honor DMA_ATTR_CC_SHARED Message-ID: References: <20260519132911.GA7702@ziepe.ca> <20260519143529.GD7702@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260519143529.GD7702@ziepe.ca> On Tue, May 19, 2026 at 11:35:29AM -0300, Jason Gunthorpe wrote: > On Tue, May 19, 2026 at 01:41:42PM +0000, Mostafa Saleh wrote: > > On Tue, May 19, 2026 at 10:29:11AM -0300, Jason Gunthorpe wrote: > > > On Tue, May 19, 2026 at 11:04:37AM +0000, Mostafa Saleh wrote: > > > > On Thu, May 14, 2026 at 08:13:25PM +0530, Aneesh Kumar K.V wrote: > > > > > >> > > > > > >> What I meant was that we need a generic way to identify a pKVM guest, so > > > > > >> that we can use it in the conditional above. > > > > > > > > > > > > I have this patch, with that I can boot with your series unmodified, > > > > > > but I will need to do more testing. > > > > > > > > > > > > > > > > Thanks, I can add this to the series once you complete the required testing. > > > > > > > > > > > > > I am still running more tests, but looking more into it. Setting > > > > force_dma_unencrypted() to true for pKVM guests is wrong, as the > > > > guest shouldn’t try to decrypt arbitrary memory as it can include > > > > sensitive information (for example in case of virtio sub-page > > > > allocation) and should strictly rely on the restricted-dma-pool > > > > for that. > > > > > > ?? > > > > > > Where does force_dma_unencrypted() cause arbitary memory passed into > > > the DMA API to be decrypted? That should never happen??? > > > > Sorry, maybe arbitrary is not the right expression again :) > > I mean that, with emulated devices that use the DMA-API under pKVM, > > they will map memory coming from other layers (VFS, net) through > > vitrio-block, virtio-net... These can be smaller than a page, and > > using force_dma_unencrypted() will share the whole page. > > force_dma_unencrypted() should only trigger swiotlb and that never > memcpy's more than necessary? > > Where does it do otherwise? That sounds like a bug? Agh, I got confused and thought that it can be triggered from dma_map() too. I need to figure out why that made pKVM guests boot with broken restricted-dma-pool then. However, it should not alway use SWIOTLB? It can trigger decryption for any memory returned from __dma_direct_alloc_pages() which can come from alloc_pages_node(). Thanks, Mostafa > > Jason