diff options
author | Avi Kivity <avi@qumranet.com> | 2006-12-29 19:49:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-30 13:56:44 -0500 |
commit | 3bab1f5dda3443043cc8fe68c5ae75530339f28f (patch) | |
tree | d1b675e8f5328094c1a3d651da5e7563ad692252 /drivers/kvm/svm.c | |
parent | 671d6564796e0c90398aab30f89b5e48fc5a3fbe (diff) |
[PATCH] KVM: Move common msr handling to arch independent code
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r-- | drivers/kvm/svm.c | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 6cd97c69ab3b..fa0428735717 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -1068,25 +1068,6 @@ static int emulate_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_ru | |||
1068 | static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) | 1068 | static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) |
1069 | { | 1069 | { |
1070 | switch (ecx) { | 1070 | switch (ecx) { |
1071 | case 0xc0010010: /* SYSCFG */ | ||
1072 | case 0xc0010015: /* HWCR */ | ||
1073 | case MSR_IA32_PLATFORM_ID: | ||
1074 | case MSR_IA32_P5_MC_ADDR: | ||
1075 | case MSR_IA32_P5_MC_TYPE: | ||
1076 | case MSR_IA32_MC0_CTL: | ||
1077 | case MSR_IA32_MCG_STATUS: | ||
1078 | case MSR_IA32_MCG_CAP: | ||
1079 | case MSR_IA32_MC0_MISC: | ||
1080 | case MSR_IA32_MC0_MISC+4: | ||
1081 | case MSR_IA32_MC0_MISC+8: | ||
1082 | case MSR_IA32_MC0_MISC+12: | ||
1083 | case MSR_IA32_MC0_MISC+16: | ||
1084 | case MSR_IA32_UCODE_REV: | ||
1085 | /* MTRR registers */ | ||
1086 | case 0xfe: | ||
1087 | case 0x200 ... 0x2ff: | ||
1088 | *data = 0; | ||
1089 | break; | ||
1090 | case MSR_IA32_TIME_STAMP_COUNTER: { | 1071 | case MSR_IA32_TIME_STAMP_COUNTER: { |
1091 | u64 tsc; | 1072 | u64 tsc; |
1092 | 1073 | ||
@@ -1094,12 +1075,6 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) | |||
1094 | *data = vcpu->svm->vmcb->control.tsc_offset + tsc; | 1075 | *data = vcpu->svm->vmcb->control.tsc_offset + tsc; |
1095 | break; | 1076 | break; |
1096 | } | 1077 | } |
1097 | case MSR_EFER: | ||
1098 | *data = vcpu->shadow_efer; | ||
1099 | break; | ||
1100 | case MSR_IA32_APICBASE: | ||
1101 | *data = vcpu->apic_base; | ||
1102 | break; | ||
1103 | case MSR_K6_STAR: | 1078 | case MSR_K6_STAR: |
1104 | *data = vcpu->svm->vmcb->save.star; | 1079 | *data = vcpu->svm->vmcb->save.star; |
1105 | break; | 1080 | break; |
@@ -1127,8 +1102,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) | |||
1127 | *data = vcpu->svm->vmcb->save.sysenter_esp; | 1102 | *data = vcpu->svm->vmcb->save.sysenter_esp; |
1128 | break; | 1103 | break; |
1129 | default: | 1104 | default: |
1130 | printk(KERN_ERR "kvm: unhandled rdmsr: 0x%x\n", ecx); | 1105 | return kvm_get_msr_common(vcpu, ecx, data); |
1131 | return 1; | ||
1132 | } | 1106 | } |
1133 | return 0; | 1107 | return 0; |
1134 | } | 1108 | } |
@@ -1152,15 +1126,6 @@ static int rdmsr_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1152 | static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) | 1126 | static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) |
1153 | { | 1127 | { |
1154 | switch (ecx) { | 1128 | switch (ecx) { |
1155 | #ifdef CONFIG_X86_64 | ||
1156 | case MSR_EFER: | ||
1157 | set_efer(vcpu, data); | ||
1158 | break; | ||
1159 | #endif | ||
1160 | case MSR_IA32_MC0_STATUS: | ||
1161 | printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n" | ||
1162 | , __FUNCTION__, data); | ||
1163 | break; | ||
1164 | case MSR_IA32_TIME_STAMP_COUNTER: { | 1129 | case MSR_IA32_TIME_STAMP_COUNTER: { |
1165 | u64 tsc; | 1130 | u64 tsc; |
1166 | 1131 | ||
@@ -1168,13 +1133,6 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) | |||
1168 | vcpu->svm->vmcb->control.tsc_offset = data - tsc; | 1133 | vcpu->svm->vmcb->control.tsc_offset = data - tsc; |
1169 | break; | 1134 | break; |
1170 | } | 1135 | } |
1171 | case MSR_IA32_UCODE_REV: | ||
1172 | case MSR_IA32_UCODE_WRITE: | ||
1173 | case 0x200 ... 0x2ff: /* MTRRs */ | ||
1174 | break; | ||
1175 | case MSR_IA32_APICBASE: | ||
1176 | vcpu->apic_base = data; | ||
1177 | break; | ||
1178 | case MSR_K6_STAR: | 1136 | case MSR_K6_STAR: |
1179 | vcpu->svm->vmcb->save.star = data; | 1137 | vcpu->svm->vmcb->save.star = data; |
1180 | break; | 1138 | break; |
@@ -1202,8 +1160,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) | |||
1202 | vcpu->svm->vmcb->save.sysenter_esp = data; | 1160 | vcpu->svm->vmcb->save.sysenter_esp = data; |
1203 | break; | 1161 | break; |
1204 | default: | 1162 | default: |
1205 | printk(KERN_ERR "kvm: unhandled wrmsr: %x\n", ecx); | 1163 | return kvm_set_msr_common(vcpu, ecx, data); |
1206 | return 1; | ||
1207 | } | 1164 | } |
1208 | return 0; | 1165 | return 0; |
1209 | } | 1166 | } |