Re: [PATCH v3 2/2] x86/sev: Add support to unaccept memory after hot-remove

From: Pratik R. Sampat

Date: Thu Jan 29 2026 - 12:37:24 EST




On 1/29/26 4:40 AM, Kiryl Shutsemau wrote:
> On Wed, Jan 28, 2026 at 01:15:06PM -0800, Dave Hansen wrote:
>> On 1/28/26 12:41, Pratik R. Sampat wrote:
>>> +static inline void arch_unaccept_memory(phys_addr_t start, phys_addr_t end)
>>> +{
>>> + if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) {
>>> + snp_unaccept_memory(start, end);
>>> + } else {
>>> + panic("Cannot unaccept memory: unknown platform\n");
>>> + }
>>> +}
>>
>> This panic() is pretty nasty.
>>
>> Can't we just disable memory hotplug up front if it's:
>>
>> !cc_platform_has(CC_ATTR_GUEST_SEV_SNP)
>>
>> ?
>
> I don't understand SEV-SNP situation, but I don't think we need to do
> anything on unplug for TDX. We should expect the unplugged memory to be
> removed from SEPT. If VMM doesn't do this, it is effectively DoS and we
> don't protect against DoS in CoCo.
>
> Converting the memory to shared will do no good for us.

In that case a fall through for TDX (with a comment explaining why) and
panic for rest may be the way to go?

>