Skip to content

Commit

Permalink
KVM: VMX: Zero the vpid module parameter if vpid is not supported
Browse files Browse the repository at this point in the history
This allows reading back how the hardware is configured.

Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Avi Kivity committed Jun 10, 2009
1 parent 4462d21 commit 919818a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
vmx_capability.ept, vmx_capability.vpid);
}

if (!cpu_has_vmx_vpid())
enable_vpid = 0;

min = 0;
#ifdef CONFIG_X86_64
min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
Expand Down Expand Up @@ -2082,7 +2085,7 @@ static void allocate_vpid(struct vcpu_vmx *vmx)
int vpid;

vmx->vpid = 0;
if (!enable_vpid || !cpu_has_vmx_vpid())
if (!enable_vpid)
return;
spin_lock(&vmx_vpid_lock);
vpid = find_first_zero_bit(vmx_vpid_bitmap, VMX_NR_VPIDS);
Expand Down

0 comments on commit 919818a

Please sign in to comment.