On Wednesday, August 4, 2021 8:00 PM, Ashish Kalra wrote:
> +/*
> + * Currently this exit is only used by SEV guests for
> + * MSR_KVM_MIGRATION_CONTROL to indicate if the guest
> + * is ready for migration.
> + */
> +static int kvm_handle_x86_msr(X86CPU *cpu, struct kvm_run *run) {
> +    static uint64_t msr_kvm_migration_control;
> +
> +    if (run->msr.index != MSR_KVM_MIGRATION_CONTROL) {
> +        run->msr.error = -EINVAL;
> +        return -1;
> +    }
> +
> +    switch (run->exit_reason) {
> +    case KVM_EXIT_X86_RDMSR:
> +        run->msr.error = 0;
> +        run->msr.data = msr_kvm_migration_control;
> +        break;
> +    case KVM_EXIT_X86_WRMSR:
> +        msr_kvm_migration_control = run->msr.data;
> +        if (run->msr.data == KVM_MIGRATION_READY) {
> +            sev_del_migrate_blocker();

It seems this is enabled/disabled by the guest, which means that the guest can 
always refuse to be migrated?

Best,
Wei

Reply via email to