diff options
author | Avi Kivity <avi@redhat.com> | 2010-10-21 06:20:34 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:23:34 -0500 |
commit | 82ca2d108b493f7d916975805668bef2096f1147 (patch) | |
tree | fc0b2c3082b17167ab209a9ff2ca999da689ed99 /arch/x86/kvm/svm.c | |
parent | dacccfdd6bb386ec0714e1fec250c4b7d0aaccc9 (diff) |
KVM: SVM: Fold save_host_msrs() and load_host_msrs() into their callers
This abstraction only serves to obfuscate. Remove.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 8ea4a79bc4ef..cf47a2fc24e9 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -187,9 +187,6 @@ static int nested_svm_vmexit(struct vcpu_svm *svm); | |||
187 | static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr, | 187 | static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr, |
188 | bool has_error_code, u32 error_code); | 188 | bool has_error_code, u32 error_code); |
189 | 189 | ||
190 | static void save_host_msrs(struct kvm_vcpu *vcpu); | ||
191 | static void load_host_msrs(struct kvm_vcpu *vcpu); | ||
192 | |||
193 | static inline struct vcpu_svm *to_svm(struct kvm_vcpu *vcpu) | 190 | static inline struct vcpu_svm *to_svm(struct kvm_vcpu *vcpu) |
194 | { | 191 | { |
195 | return container_of(vcpu, struct vcpu_svm, vcpu); | 192 | return container_of(vcpu, struct vcpu_svm, vcpu); |
@@ -1002,7 +999,9 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
1002 | svm->asid_generation = 0; | 999 | svm->asid_generation = 0; |
1003 | } | 1000 | } |
1004 | 1001 | ||
1005 | save_host_msrs(vcpu); | 1002 | #ifdef CONFIG_X86_64 |
1003 | rdmsrl(MSR_GS_BASE, to_svm(vcpu)->host.gs_base); | ||
1004 | #endif | ||
1006 | savesegment(fs, svm->host.fs); | 1005 | savesegment(fs, svm->host.fs); |
1007 | savesegment(gs, svm->host.gs); | 1006 | savesegment(gs, svm->host.gs); |
1008 | svm->host.ldt = kvm_read_ldt(); | 1007 | svm->host.ldt = kvm_read_ldt(); |
@@ -1371,20 +1370,6 @@ static void svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) | |||
1371 | update_db_intercept(vcpu); | 1370 | update_db_intercept(vcpu); |
1372 | } | 1371 | } |
1373 | 1372 | ||
1374 | static void load_host_msrs(struct kvm_vcpu *vcpu) | ||
1375 | { | ||
1376 | #ifdef CONFIG_X86_64 | ||
1377 | wrmsrl(MSR_GS_BASE, to_svm(vcpu)->host.gs_base); | ||
1378 | #endif | ||
1379 | } | ||
1380 | |||
1381 | static void save_host_msrs(struct kvm_vcpu *vcpu) | ||
1382 | { | ||
1383 | #ifdef CONFIG_X86_64 | ||
1384 | rdmsrl(MSR_GS_BASE, to_svm(vcpu)->host.gs_base); | ||
1385 | #endif | ||
1386 | } | ||
1387 | |||
1388 | static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) | 1373 | static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) |
1389 | { | 1374 | { |
1390 | if (sd->next_asid > sd->max_asid) { | 1375 | if (sd->next_asid > sd->max_asid) { |
@@ -3426,8 +3411,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
3426 | #endif | 3411 | #endif |
3427 | ); | 3412 | ); |
3428 | 3413 | ||
3429 | load_host_msrs(vcpu); | 3414 | #ifdef CONFIG_X86_64 |
3430 | #ifndef CONFIG_X86_64 | 3415 | wrmsrl(MSR_GS_BASE, svm->host.gs_base); |
3416 | #else | ||
3431 | loadsegment(fs, svm->host.fs); | 3417 | loadsegment(fs, svm->host.fs); |
3432 | #endif | 3418 | #endif |
3433 | 3419 | ||