Re: [PATCH v3 09/27] KVM: SEV: Explicitly initialize the per vCPU ASID on SEV VM migration

From: Jim Mattson

Date: Wed Oct 14 2026 - 19:36:29 EST


On Mon, Oct 12, 2026 at 4:36 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> Explicitly initialize svm->asid on the destination vCPUs as part of SEV
> VM migration, before calling sev_init_vmcb() to make sure the per-vCPU
> ASID is initialized before the VMCB. This is currently unnecessary as
> sev_init_vmcb() initializes the per-vCPU ASID anyway, but will be needed
> when the ASID initialization is moved to vCPU creation.
>
> Add a helper function for the ASID migration as more changes will be
> needed with incoming changes.
>
> Note that svm->asid is left as-is on the source vCPUs, even though the
> ASID now belongs to the destination VM. Clearing it would be a nice
> hardening measure, but it is not as simple as clearing src_svm->asid, as
> the source and destination VMs do not necessarily have the same number
> of vCPUs (e.g. for non SEV-ES), so NULL-handling would be needed in a
> couple of places. Leave it alone for now.
>
> Signed-off-by: Yosry Ahmed <yosry@xxxxxxxxxx>
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>