From: Jason Gunthorpe <jgg@ziepe.ca>
To: Marc Zyngier <maz@kernel.org>
Cc: "Steven Price" <steven.price@arm.com>,
"Christian König" <christian.koenig@amd.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Thomas Gleixner" <tglx@kernel.org>,
"T.J. Mercier" <tjmercier@google.com>,
"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
"Brian Starkey" <Brian.Starkey@arm.com>,
"John Stultz" <jstultz@google.com>,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
"Jiri Pirko" <jiri@resnulli.us>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>
Subject: Re: [PATCH 1/2] irqchip/gic-v3-its: Zero shared pages after conversion
Date: Thu, 20 Aug 2026 10:27:36 -0300 [thread overview]
Message-ID: <20260820132736.GC18100@ziepe.ca> (raw)
In-Reply-To: <87wltlnfay.wl-maz@kernel.org>
On Thu, Aug 20, 2026 at 01:32:05PM +0100, Marc Zyngier wrote:
> On Thu, 20 Aug 2026 11:50:24 +0100,
> Steven Price <steven.price@arm.com> wrote:
> >
> > its_alloc_pages_node() passes __GFP_ZERO to the page allocator before
> > calling set_memory_decrypted(). This assumes that converting a page from
> > private to shared preserves its contents.
> >
> > For Arm CCA with MEC (Memory Encryption Contexts) the key used to access
> > the page will change, and so by default the visible data will change.
> > The host could ensure that it zeros the page, but rather than relying on
> > the host's behaviour it's best if the guest simply zeros after the
> > decryption rather than before. Specifically in this case the ITS tables
> > are required to be zeroed.
>
> What are the guarantees that we want to enforce post decryption? My
> recollection is that the RME firmware cleans the caches to the PoPA,
> making the data immediately visible to the hypervisor. Obviously, this
> isn't the case anymore, since the zeroing comes after that, and I
> don't see any CMO enforcing this.
I thought any CMO stuff was principally about cleaning things as part
of the MEC change? Coherency after the memory is made shared should
follow the normal cachable memory model rules, just like in a non-CC
VM? We don't need further explicit CMOs for that.
Post decryption I would expect from all architectures:
1) Neither the guest or host take a fault/error when accessing the
memory. ie the host may immediately pass this memory to an
O_DIRECT system call and have its kernel read from it.
It must not crash the kernel.
2) So long as the memory is mapped cachable it should follow the
normal memory model visibility rules. ie it works the same as
VM CPU memory prior to CC
3) Rules for actual DMA are the same as prior to CC, the VM is
expected to issue its own flushes prior to DMA if the platform
requires it.
Given the requirements for #1, is there actually any case on any
platform where the host doesn't *have* to fill the memory? Is there a
platform with MEC that doesn't generate an error on reading with the
wrong MEC? Without MEC it surely has to be zero'd in the RMM world,
right?
I've argued before that set_memory_decrypted() should be defined to
return 0'd memory. I think there are real systems that *have* to zero
the memory as part of the state change and this API is now
forcing an extra zeroing.
> I'm concerned that this relies on undocumented behaviours that may
> hold today on some undisclosed combinations of HW and hypervisors, but
> that are not guaranteed at all. set_memory_decrypted() doesn't really
> say anything, and I have the feeling that we may want some hypervisor
> specific hook to perform the correct CMO magic. I don't think this is
> required right now, but I'm not excluding anything!
I would expect any required CMOs to be part of the arch's
implementation of set_memory_decrypted()?
Jason
next prev parent reply other threads:[~2026-08-20 13:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 10:50 [PATCH 0/2] Clear shared pages after private-to-shared conversion Steven Price
2026-08-20 10:50 ` [PATCH 1/2] irqchip/gic-v3-its: Zero shared pages after conversion Steven Price
2026-08-20 11:08 ` sashiko-bot
2026-08-20 12:32 ` Marc Zyngier
2026-08-20 12:55 ` Steven Price
2026-08-20 13:27 ` Jason Gunthorpe [this message]
2026-08-20 10:50 ` [PATCH 2/2] dma-buf: heaps: Zero system shared heap " Steven Price
2026-08-20 11:02 ` sashiko-bot
2026-08-20 12:20 ` [PATCH 0/2] Clear shared pages after private-to-shared conversion Jason Gunthorpe
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=20260820132736.GC18100@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=Brian.Starkey@arm.com \
--cc=benjamin.gaignard@collabora.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jiri@resnulli.us \
--cc=jstultz@google.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maz@kernel.org \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=tglx@kernel.org \
--cc=tjmercier@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.