Skip to content

Commit af24a4e

Browse files
Jaswinder Singh Rajputavikivity
authored andcommitted
KVM: Replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
Use standard msr-index.h's MSR declaration. MSR_IA32_TSC is better than MSR_IA32_TIME_STAMP_COUNTER as it also solves 80 column issue. Signed-off-by: Jaswinder Singh Rajput <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent ae0bb3e commit af24a4e

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

arch/x86/include/asm/kvm_host.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,6 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)
752752
kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
753753
}
754754

755-
#define MSR_IA32_TIME_STAMP_COUNTER 0x010
756-
757755
#define TSS_IOPB_BASE_OFFSET 0x66
758756
#define TSS_BASE_SIZE 0x68
759757
#define TSS_IOPB_SIZE (65536 / 8)

arch/x86/kvm/svm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
19531953
struct vcpu_svm *svm = to_svm(vcpu);
19541954

19551955
switch (ecx) {
1956-
case MSR_IA32_TIME_STAMP_COUNTER: {
1956+
case MSR_IA32_TSC: {
19571957
u64 tsc;
19581958

19591959
rdtscll(tsc);
@@ -2043,7 +2043,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
20432043
struct vcpu_svm *svm = to_svm(vcpu);
20442044

20452045
switch (ecx) {
2046-
case MSR_IA32_TIME_STAMP_COUNTER: {
2046+
case MSR_IA32_TSC: {
20472047
u64 tsc;
20482048

20492049
rdtscll(tsc);

arch/x86/kvm/vmx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
941941
case MSR_EFER:
942942
return kvm_get_msr_common(vcpu, msr_index, pdata);
943943
#endif
944-
case MSR_IA32_TIME_STAMP_COUNTER:
944+
case MSR_IA32_TSC:
945945
data = guest_read_tsc();
946946
break;
947947
case MSR_IA32_SYSENTER_CS:
@@ -1001,7 +1001,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
10011001
case MSR_IA32_SYSENTER_ESP:
10021002
vmcs_writel(GUEST_SYSENTER_ESP, data);
10031003
break;
1004-
case MSR_IA32_TIME_STAMP_COUNTER:
1004+
case MSR_IA32_TSC:
10051005
rdtscll(host_tsc);
10061006
guest_write_tsc(data, host_tsc);
10071007
break;

arch/x86/kvm/x86.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static u32 msrs_to_save[] = {
466466
#ifdef CONFIG_X86_64
467467
MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
468468
#endif
469-
MSR_IA32_TIME_STAMP_COUNTER, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
469+
MSR_IA32_TSC, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
470470
MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
471471
};
472472

@@ -644,8 +644,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
644644

645645
/* Keep irq disabled to prevent changes to the clock */
646646
local_irq_save(flags);
647-
kvm_get_msr(v, MSR_IA32_TIME_STAMP_COUNTER,
648-
&vcpu->hv_clock.tsc_timestamp);
647+
kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
649648
ktime_get_ts(&ts);
650649
local_irq_restore(flags);
651650

0 commit comments

Comments
 (0)