Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197833
b: refs/heads/master
c: b69e8ca
h: refs/heads/master
i:
  197831: 9263fe7
v: v3
  • Loading branch information
Roedel, Joerg authored and Avi Kivity committed May 19, 2010
1 parent 304773a commit c51a77d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0d945bd9351199744c1e89d57a70615b6ee9f394
refs/heads/master: b69e8caef5b190af48c525f6d715e7b7728a77f6
31 changes: 12 additions & 19 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,37 +683,29 @@ static u32 emulated_msrs[] = {
MSR_IA32_MISC_ENABLE,
};

static void set_efer(struct kvm_vcpu *vcpu, u64 efer)
static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
{
if (efer & efer_reserved_bits) {
kvm_inject_gp(vcpu, 0);
return;
}
if (efer & efer_reserved_bits)
return 1;

if (is_paging(vcpu)
&& (vcpu->arch.efer & EFER_LME) != (efer & EFER_LME)) {
kvm_inject_gp(vcpu, 0);
return;
}
&& (vcpu->arch.efer & EFER_LME) != (efer & EFER_LME))
return 1;

if (efer & EFER_FFXSR) {
struct kvm_cpuid_entry2 *feat;

feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT))) {
kvm_inject_gp(vcpu, 0);
return;
}
if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT)))
return 1;
}

if (efer & EFER_SVME) {
struct kvm_cpuid_entry2 *feat;

feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
if (!feat || !(feat->ecx & bit(X86_FEATURE_SVM))) {
kvm_inject_gp(vcpu, 0);
return;
}
if (!feat || !(feat->ecx & bit(X86_FEATURE_SVM)))
return 1;
}

kvm_x86_ops->set_efer(vcpu, efer);
Expand All @@ -725,6 +717,8 @@ static void set_efer(struct kvm_vcpu *vcpu, u64 efer)

vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled;
kvm_mmu_reset_context(vcpu);

return 0;
}

void kvm_enable_efer_bits(u64 mask)
Expand Down Expand Up @@ -1153,8 +1147,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
{
switch (msr) {
case MSR_EFER:
set_efer(vcpu, data);
break;
return set_efer(vcpu, data);
case MSR_K7_HWCR:
data &= ~(u64)0x40; /* ignore flush filter disable */
data &= ~(u64)0x100; /* ignore ignne emulation enable */
Expand Down

0 comments on commit c51a77d

Please sign in to comment.