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