diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/x86.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3c4ca98ad27f..c4f35b545c1d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1712,6 +1712,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu, | |||
1712 | if (copy_from_user(cpuid_entries, entries, | 1712 | if (copy_from_user(cpuid_entries, entries, |
1713 | cpuid->nent * sizeof(struct kvm_cpuid_entry))) | 1713 | cpuid->nent * sizeof(struct kvm_cpuid_entry))) |
1714 | goto out_free; | 1714 | goto out_free; |
1715 | vcpu_load(vcpu); | ||
1715 | for (i = 0; i < cpuid->nent; i++) { | 1716 | for (i = 0; i < cpuid->nent; i++) { |
1716 | vcpu->arch.cpuid_entries[i].function = cpuid_entries[i].function; | 1717 | vcpu->arch.cpuid_entries[i].function = cpuid_entries[i].function; |
1717 | vcpu->arch.cpuid_entries[i].eax = cpuid_entries[i].eax; | 1718 | vcpu->arch.cpuid_entries[i].eax = cpuid_entries[i].eax; |
@@ -1729,6 +1730,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu, | |||
1729 | r = 0; | 1730 | r = 0; |
1730 | kvm_apic_set_version(vcpu); | 1731 | kvm_apic_set_version(vcpu); |
1731 | kvm_x86_ops->cpuid_update(vcpu); | 1732 | kvm_x86_ops->cpuid_update(vcpu); |
1733 | vcpu_put(vcpu); | ||
1732 | 1734 | ||
1733 | out_free: | 1735 | out_free: |
1734 | vfree(cpuid_entries); | 1736 | vfree(cpuid_entries); |
@@ -1749,9 +1751,11 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu, | |||
1749 | if (copy_from_user(&vcpu->arch.cpuid_entries, entries, | 1751 | if (copy_from_user(&vcpu->arch.cpuid_entries, entries, |
1750 | cpuid->nent * sizeof(struct kvm_cpuid_entry2))) | 1752 | cpuid->nent * sizeof(struct kvm_cpuid_entry2))) |
1751 | goto out; | 1753 | goto out; |
1754 | vcpu_load(vcpu); | ||
1752 | vcpu->arch.cpuid_nent = cpuid->nent; | 1755 | vcpu->arch.cpuid_nent = cpuid->nent; |
1753 | kvm_apic_set_version(vcpu); | 1756 | kvm_apic_set_version(vcpu); |
1754 | kvm_x86_ops->cpuid_update(vcpu); | 1757 | kvm_x86_ops->cpuid_update(vcpu); |
1758 | vcpu_put(vcpu); | ||
1755 | return 0; | 1759 | return 0; |
1756 | 1760 | ||
1757 | out: | 1761 | out: |