mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
KVM: selftests: Set KVM's supported CPUID as vCPU's CPUID during recreate
On x86-64, set KVM's supported CPUID as the vCPU's CPUID when recreating a VM+vCPU to deduplicate code for state save/restore tests, and to provide symmetry of sorts with respect to vm_create_with_one_vcpu(). The extra KVM_SET_CPUID2 call is wasteful for Hyper-V, but ultimately is nothing more than an expensive nop, and overriding the vCPU's CPUID with the Hyper-V CPUID information is the only known scenario where a state save/restore test wouldn't need/want the default CPUID. Opportunistically use __weak for the default vm_compute_max_gfn(), it's provided by tools' compiler.h. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-2-seanjc@google.com
This commit is contained in:
@@ -388,11 +388,17 @@ void kvm_vm_restart(struct kvm_vm *vmp)
|
||||
}
|
||||
}
|
||||
|
||||
__weak struct kvm_vcpu *vm_arch_vcpu_recreate(struct kvm_vm *vm,
|
||||
uint32_t vcpu_id)
|
||||
{
|
||||
return __vm_vcpu_add(vm, vcpu_id);
|
||||
}
|
||||
|
||||
struct kvm_vcpu *vm_recreate_with_one_vcpu(struct kvm_vm *vm)
|
||||
{
|
||||
kvm_vm_restart(vm);
|
||||
|
||||
return __vm_vcpu_add(vm, 0);
|
||||
return vm_vcpu_recreate(vm, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1812,7 +1818,7 @@ void *addr_gva2hva(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
return addr_gpa2hva(vm, addr_gva2gpa(vm, gva));
|
||||
}
|
||||
|
||||
unsigned long __attribute__((weak)) vm_compute_max_gfn(struct kvm_vm *vm)
|
||||
unsigned long __weak vm_compute_max_gfn(struct kvm_vm *vm)
|
||||
{
|
||||
return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user