aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-03-20 12:44:51 -0400
committerAvi Kivity <avi@qumranet.com>2007-05-03 03:52:25 -0400
commitf6528b03f167785301908bf124db7be591e983ca (patch)
treeca52c2a5553d8f0c4bcd7b3a9587fcf00e374731 /drivers
parent8cb5b0333250beb382624f626851a31f601b4830 (diff)
KVM: Remove set_cr0_no_modeswitch() arch op
set_cr0_no_modeswitch() was a hack to avoid corrupting segment registers. As we now cache the protected mode values on entry to real mode, this isn't an issue anymore, and it interferes with reboot (which usually _is_ a modeswitch). Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm.h2
-rw-r--r--drivers/kvm/kvm_main.c2
-rw-r--r--drivers/kvm/svm.c1
-rw-r--r--drivers/kvm/vmx.c17
4 files changed, 1 insertions, 21 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index a4331da816d0..7361c45d70c9 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -383,8 +383,6 @@ struct kvm_arch_ops {
383 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l); 383 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
384 void (*decache_cr0_cr4_guest_bits)(struct kvm_vcpu *vcpu); 384 void (*decache_cr0_cr4_guest_bits)(struct kvm_vcpu *vcpu);
385 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0); 385 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
386 void (*set_cr0_no_modeswitch)(struct kvm_vcpu *vcpu,
387 unsigned long cr0);
388 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); 386 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
389 void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4); 387 void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
390 void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer); 388 void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 205998c141fb..b998bc68e9f2 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1936,7 +1936,7 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1936 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); 1936 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu);
1937 1937
1938 mmu_reset_needed |= vcpu->cr0 != sregs->cr0; 1938 mmu_reset_needed |= vcpu->cr0 != sregs->cr0;
1939 kvm_arch_ops->set_cr0_no_modeswitch(vcpu, sregs->cr0); 1939 kvm_arch_ops->set_cr0(vcpu, sregs->cr0);
1940 1940
1941 mmu_reset_needed |= vcpu->cr4 != sregs->cr4; 1941 mmu_reset_needed |= vcpu->cr4 != sregs->cr4;
1942 kvm_arch_ops->set_cr4(vcpu, sregs->cr4); 1942 kvm_arch_ops->set_cr4(vcpu, sregs->cr4);
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 64afc5cf890d..d3cc1157d23b 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1716,7 +1716,6 @@ static struct kvm_arch_ops svm_arch_ops = {
1716 .get_cs_db_l_bits = svm_get_cs_db_l_bits, 1716 .get_cs_db_l_bits = svm_get_cs_db_l_bits,
1717 .decache_cr0_cr4_guest_bits = svm_decache_cr0_cr4_guest_bits, 1717 .decache_cr0_cr4_guest_bits = svm_decache_cr0_cr4_guest_bits,
1718 .set_cr0 = svm_set_cr0, 1718 .set_cr0 = svm_set_cr0,
1719 .set_cr0_no_modeswitch = svm_set_cr0,
1720 .set_cr3 = svm_set_cr3, 1719 .set_cr3 = svm_set_cr3,
1721 .set_cr4 = svm_set_cr4, 1720 .set_cr4 = svm_set_cr4,
1722 .set_efer = svm_set_efer, 1721 .set_efer = svm_set_efer,
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index aa7e2ba6fb5a..027a9625ef90 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -788,22 +788,6 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
788 vcpu->cr0 = cr0; 788 vcpu->cr0 = cr0;
789} 789}
790 790
791/*
792 * Used when restoring the VM to avoid corrupting segment registers
793 */
794static void vmx_set_cr0_no_modeswitch(struct kvm_vcpu *vcpu, unsigned long cr0)
795{
796 if (!vcpu->rmode.active && !(cr0 & CR0_PE_MASK))
797 enter_rmode(vcpu);
798
799 vcpu->rmode.active = ((cr0 & CR0_PE_MASK) == 0);
800 update_exception_bitmap(vcpu);
801 vmcs_writel(CR0_READ_SHADOW, cr0);
802 vmcs_writel(GUEST_CR0,
803 (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON);
804 vcpu->cr0 = cr0;
805}
806
807static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 791static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
808{ 792{
809 vmcs_writel(GUEST_CR3, cr3); 793 vmcs_writel(GUEST_CR3, cr3);
@@ -2069,7 +2053,6 @@ static struct kvm_arch_ops vmx_arch_ops = {
2069 .get_cs_db_l_bits = vmx_get_cs_db_l_bits, 2053 .get_cs_db_l_bits = vmx_get_cs_db_l_bits,
2070 .decache_cr0_cr4_guest_bits = vmx_decache_cr0_cr4_guest_bits, 2054 .decache_cr0_cr4_guest_bits = vmx_decache_cr0_cr4_guest_bits,
2071 .set_cr0 = vmx_set_cr0, 2055 .set_cr0 = vmx_set_cr0,
2072 .set_cr0_no_modeswitch = vmx_set_cr0_no_modeswitch,
2073 .set_cr3 = vmx_set_cr3, 2056 .set_cr3 = vmx_set_cr3,
2074 .set_cr4 = vmx_set_cr4, 2057 .set_cr4 = vmx_set_cr4,
2075#ifdef CONFIG_X86_64 2058#ifdef CONFIG_X86_64