]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kvm/x86.c
KVM: SVM: Fake MSR_K7 performance counters
[linux-2.6-omap-h63xx.git] / arch / x86 / kvm / x86.c
index 63a77caa59f11bf55a8655b857aa9c541e4168a6..59084a3981c0cc72dfa9471e4dda10a0175c7b43 100644 (file)
@@ -2020,6 +2020,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
 
 int emulate_clts(struct kvm_vcpu *vcpu)
 {
+       KVMTRACE_0D(CLTS, vcpu, handler);
        kvm_x86_ops->set_cr0(vcpu, vcpu->arch.cr0 & ~X86_CR0_TS);
        return X86EMUL_CONTINUE;
 }
@@ -2600,27 +2601,41 @@ void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw,
 
 unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr)
 {
+       unsigned long value;
+
        kvm_x86_ops->decache_cr4_guest_bits(vcpu);
        switch (cr) {
        case 0:
-               return vcpu->arch.cr0;
+               value = vcpu->arch.cr0;
+               break;
        case 2:
-               return vcpu->arch.cr2;
+               value = vcpu->arch.cr2;
+               break;
        case 3:
-               return vcpu->arch.cr3;
+               value = vcpu->arch.cr3;
+               break;
        case 4:
-               return vcpu->arch.cr4;
+               value = vcpu->arch.cr4;
+               break;
        case 8:
-               return kvm_get_cr8(vcpu);
+               value = kvm_get_cr8(vcpu);
+               break;
        default:
                vcpu_printf(vcpu, "%s: unexpected cr %u\n", __func__, cr);
                return 0;
        }
+       KVMTRACE_3D(CR_READ, vcpu, (u32)cr, (u32)value,
+                   (u32)((u64)value >> 32), handler);
+
+       return value;
 }
 
 void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val,
                     unsigned long *rflags)
 {
+       KVMTRACE_3D(CR_WRITE, vcpu, (u32)cr, (u32)val,
+                   (u32)((u64)val >> 32), handler);
+
        switch (cr) {
        case 0:
                kvm_set_cr0(vcpu, mk_cr_64(vcpu->arch.cr0, val));
@@ -3449,7 +3464,7 @@ static int load_state_from_tss16(struct kvm_vcpu *vcpu,
        return 0;
 }
 
-int kvm_task_switch_16(struct kvm_vcpu *vcpu, u16 tss_selector,
+static int kvm_task_switch_16(struct kvm_vcpu *vcpu, u16 tss_selector,
                       struct desc_struct *cseg_desc,
                       struct desc_struct *nseg_desc)
 {
@@ -3472,7 +3487,7 @@ out:
        return ret;
 }
 
-int kvm_task_switch_32(struct kvm_vcpu *vcpu, u16 tss_selector,
+static int kvm_task_switch_32(struct kvm_vcpu *vcpu, u16 tss_selector,
                       struct desc_struct *cseg_desc,
                       struct desc_struct *nseg_desc)
 {
@@ -4044,6 +4059,6 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
         * So need not to call smp_call_function_single() in that case.
         */
        if (vcpu->guest_mode && vcpu->cpu != cpu)
-               smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0, 0);
+               smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0);
        put_cpu();
 }