Skip to content

Commit

Permalink
Merge branch 'kvm-updates/2.6.30' of git://git.kernel.org/pub/scm/vir…
Browse files Browse the repository at this point in the history
…t/kvm/kvm

* 'kvm-updates/2.6.30' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: SVM: Remove port 80 passthrough
  KVM: Make EFER reads safe when EFER does not exist
  KVM: Fix NX support reporting
  KVM: SVM: Fix cross vendor migration issue with unusable bit
  • Loading branch information
Linus Torvalds committed May 13, 2009
2 parents 014049a + 99f85a2 commit f6cab83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ static __init int svm_hardware_setup(void)

iopm_va = page_address(iopm_pages);
memset(iopm_va, 0xff, PAGE_SIZE * (1 << IOPM_ALLOC_ORDER));
clear_bit(0x80, iopm_va); /* allow direct access to PC debug port */
iopm_base = page_to_pfn(iopm_pages) << PAGE_SHIFT;

if (boot_cpu_has(X86_FEATURE_NX))
Expand Down Expand Up @@ -796,6 +795,11 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1;
var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1;

/* AMD's VMCB does not have an explicit unusable field, so emulate it
* for cross vendor migration purposes by "not present"
*/
var->unusable = !var->present || (var->type == 0);

switch (seg) {
case VCPU_SREG_CS:
/*
Expand Down Expand Up @@ -827,8 +831,6 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
var->type |= 0x1;
break;
}

var->unusable = !var->present;
}

static int svm_get_cpl(struct kvm_vcpu *vcpu)
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,9 +1121,9 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)

static int is_efer_nx(void)
{
u64 efer;
unsigned long long efer = 0;

rdmsrl(MSR_EFER, efer);
rdmsrl_safe(MSR_EFER, &efer);
return efer & EFER_NX;
}

Expand Down Expand Up @@ -1259,7 +1259,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
bit(X86_FEATURE_CMOV) | bit(X86_FEATURE_PSE36) |
bit(X86_FEATURE_MMX) | bit(X86_FEATURE_FXSR) |
bit(X86_FEATURE_SYSCALL) |
(bit(X86_FEATURE_NX) && is_efer_nx()) |
(is_efer_nx() ? bit(X86_FEATURE_NX) : 0) |
#ifdef CONFIG_X86_64
bit(X86_FEATURE_LM) |
#endif
Expand Down

0 comments on commit f6cab83

Please sign in to comment.