[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f2c6106-9cc1-4196-8b20-83b297ae7195@kernel.org>
Date: Wed, 14 Jan 2026 11:30:13 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: "Pratik R. Sampat" <prsampat@....com>, linux-mm@...ck.org,
linux-coco@...ts.linux.dev, x86@...nel.org, linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, kas@...nel.org, ardb@...nel.org,
akpm@...ux-foundation.org, osalvador@...e.de, thomas.lendacky@....com,
michael.roth@....com
Subject: Re: [PATCH v2 1/2] mm/memory_hotplug: Add support to accept memory
during hot-add
On 1/12/26 21:22, Pratik R. Sampat wrote:
> Confidential computing guests require memory to be accepted before use.
> The unaccepted memory bitmap maintained by firmware does not track
> hotplugged memory ranges.
>
> Call arch_accept_memory() during the hot-add path to explicitly validate
> and transition the newly added memory to a private state, making it
> usable by the guest.
>
> Signed-off-by: Pratik R. Sampat <prsampat@....com>
> ---
> mm/memory_hotplug.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index a63ec679d861..8cfbf0541430 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -38,6 +38,7 @@
> #include <linux/node.h>
>
> #include <asm/tlbflush.h>
> +#include <asm/unaccepted_memory.h>
>
> #include "internal.h"
> #include "shuffle.h"
> @@ -1567,6 +1568,9 @@ int add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
> if (!strcmp(res->name, "System RAM"))
> firmware_map_add_hotplug(start, start + size, "System RAM");
>
> + if (IS_ENABLED(CONFIG_UNACCEPTED_MEMORY))
> + arch_accept_memory(start, start + size);
> +
> /* device_online() will take the lock when calling online_pages() */
> mem_hotplug_done();
>
As discussed, for things like virtio-mem or the HV-balloon this might be
the wrong thing to do, but I don't expect these mechanisms to be used in
CoCo environments just yet (and doing so would require enabling work for
them).
So I'm fine with this for now.
--
Cheers
David
Powered by blists - more mailing lists