linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: "Pratik R. Sampat" <prsampat@amd.com>,
	linux-mm@kvack.org, linux-coco@lists.linux.dev, x86@kernel.org,
	linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, kas@kernel.org, ardb@kernel.org,
	akpm@linux-foundation.org, osalvador@suse.de,
	thomas.lendacky@amd.com, michael.roth@amd.com
Subject: Re: [PATCH v2 1/2] mm/memory_hotplug: Add support to accept memory during hot-add
Date: Wed, 14 Jan 2026 11:30:13 +0100	[thread overview]
Message-ID: <4f2c6106-9cc1-4196-8b20-83b297ae7195@kernel.org> (raw)
In-Reply-To: <20260112202300.43546-2-prsampat@amd.com>

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@amd.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


  parent reply	other threads:[~2026-01-14 10:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 20:22 [PATCH v2 0/2] SEV-SNP Unaccepted Memory Hotplug Pratik R. Sampat
2026-01-12 20:22 ` [PATCH v2 1/2] mm/memory_hotplug: Add support to accept memory during hot-add Pratik R. Sampat
2026-01-12 21:04   ` Andrew Morton
2026-01-12 22:23     ` Pratik R. Sampat
2026-01-12 22:43       ` Andrew Morton
2026-01-13  5:52         ` Pratik R. Sampat
2026-01-13  3:52   ` kernel test robot
2026-01-13  8:56   ` kernel test robot
2026-01-14 10:30   ` David Hildenbrand (Red Hat) [this message]
2026-01-12 20:23 ` [PATCH v2 2/2] mm/memory_hotplug: Add support to unaccept memory after hot-remove Pratik R. Sampat
2026-01-13 10:28   ` Kiryl Shutsemau
2026-01-13 17:10     ` Pratik R. Sampat
2026-01-13 17:53       ` Kiryl Shutsemau
2026-01-13 18:22         ` Pratik R. Sampat
2026-01-14 10:47           ` Kiryl Shutsemau

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=4f2c6106-9cc1-4196-8b20-83b297ae7195@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kas@kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=osalvador@suse.de \
    --cc=prsampat@amd.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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