From: Jason Gunthorpe <jgg@ziepe.ca>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Kameron Carr <kameroncarr@linux.microsoft.com>,
akpm@linux-foundation.org, urezki@gmail.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, rppt@kernel.org,
mhklinux@outlook.com, linux-coco@lists.linux.dev,
Suzuki K Poulose <Suzuki.Poulose@arm.com>
Subject: Re: [RFC PATCH] mm/vmalloc: add vmalloc_decrypted() and vzalloc_decrypted()
Date: Tue, 16 Jun 2026 15:45:00 -0300 [thread overview]
Message-ID: <20260616184500.GD3577091@ziepe.ca> (raw)
In-Reply-To: <ajGTPelKLhgFqh7F@arm.com>
On Tue, Jun 16, 2026 at 07:17:33PM +0100, Catalin Marinas wrote:
> > The entry point is dma_alloc_noncontiguous() and you get a scatterlist
> > back.
>
> Yes but not scattered pages unless there's an iommu behind. Anyway,
> that's an implementation detail, something like
> dma_alloc_noncontiguous_vmap() could allocate scattered pages as a
> fallback.
Oh I never noticed it deliberately returns only a single dma entry. I
think that could be optionally weakened without alot of trouble
There is also dma_vmap_noncontiguous() already, so I think the main
framework is there, though it seems like it needs a a bit mmore features.
> Currently, something like netvsc_init_buf() just does a vzalloc() and
> passes it down to vmbus_establish_gpadl() which knows how to interpret
> the channel encryption status. I assume with the vzalloc_decrypted()
> API, that info needs to be interpreted at the netvsc_init_buf() level to
> know which allocation to call.
But it doesn't end at alloc does it? hyperv will still have to reach
into the vmap and convert it into an appropriate IPA to pass to the
hypervisor. That really needs to use the arch helpers the DMA API has
and those should not be called by any sort of driver environment like
hyperv.
> If we move towards a dma_alloc_noncontiguous_vmap() API we need vmbus to
> encode the encryption requirement in the hv_device::device somehow so
> that force_dma_unencrypted() knows what do return.
Yes, they would have to act like PCI and mark in-TEE and out of-TEE
struct devices properly so the DMA API knows what to do instead of
open coding a copy of all this logic in hyperv.
> We have the DMA_ATTR_CC_SHARED but that's not interpreted on the DMA
> alloc path,
It is to describe memory that was deliberately allocated as decrypted,
not to control allocation choices.
> so there's a bit more work needed on the DMA API I think (not sure
> whether Aneesh's series covers any of this).
I don't think it does directly. It largely sets the stage to properly
allow a struct device to opt out of force_dma_unencrypted() so we get
support a T=1 PCI device.
Jason
prev parent reply other threads:[~2026-06-16 18:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260521205834.1012925-1-kameroncarr@linux.microsoft.com>
2026-06-08 15:37 ` [RFC PATCH] mm/vmalloc: add vmalloc_decrypted() and vzalloc_decrypted() Catalin Marinas
2026-06-11 11:49 ` Jason Gunthorpe
2026-06-12 17:49 ` Catalin Marinas
2026-06-12 18:18 ` Jason Gunthorpe
2026-06-12 19:06 ` Michael Kelley
2026-06-15 12:09 ` Jason Gunthorpe
2026-06-16 18:17 ` Catalin Marinas
2026-06-16 18:45 ` Jason Gunthorpe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260616184500.GD3577091@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=Suzuki.Poulose@arm.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=hch@infradead.org \
--cc=kameroncarr@linux.microsoft.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhklinux@outlook.com \
--cc=rppt@kernel.org \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox