diff options
author | Arbel Moshe <arbel.moshe@oracle.com> | 2018-03-12 13:12:53 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-03-16 22:02:01 +0100 |
commit | 2d7921c499afebac78b13ab9a3758261a97e07b7 (patch) | |
tree | 9fbeb2ebc8c352acdbaab0c13857de719467a76b /arch/x86/kvm/x86.c | |
parent | 9718420e9fd462ac6b7ea840f9e63eb6af7e1bda (diff) | |
download | linux-2d7921c499afebac78b13ab9a3758261a97e07b7.tar.bz2 |
KVM: x86: Add support for VMware backdoor Pseudo-PMCs
VMware exposes the following Pseudo PMCs:
0x10000: Physical host TSC
0x10001: Elapsed real time in ns
0x10002: Elapsed apparent time in ns
For more info refer to:
https://www.vmware.com/files/pdf/techpaper/Timekeeping-In-VirtualMachines.pdf
VMware allows access to these Pseduo-PMCs even when read via RDPMC
in Ring3 and CR4.PCE=0. Therefore, commit modifies x86 emulator
to allow access to these PMCs in this situation. In addition,
emulation of these PMCs were added to kvm_pmu_rdpmc().
Signed-off-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 291ad5375747..9e1496cb2345 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5932,23 +5932,30 @@ static bool kvm_vcpu_check_breakpoint(struct kvm_vcpu *vcpu, int *r) static bool is_vmware_backdoor_opcode(struct x86_emulate_ctxt *ctxt) { - if (ctxt->opcode_len != 1) - return false; - - switch (ctxt->b) { - case 0xe4: /* IN */ - case 0xe5: - case 0xec: - case 0xed: - case 0xe6: /* OUT */ - case 0xe7: - case 0xee: - case 0xef: - case 0x6c: /* INS */ - case 0x6d: - case 0x6e: /* OUTS */ - case 0x6f: - return true; + switch (ctxt->opcode_len) { + case 1: + switch (ctxt->b) { + case 0xe4: /* IN */ + case 0xe5: + case 0xec: + case 0xed: + case 0xe6: /* OUT */ + case 0xe7: + case 0xee: + case 0xef: + case 0x6c: /* INS */ + case 0x6d: + case 0x6e: /* OUTS */ + case 0x6f: + return true; + } + break; + case 2: + switch (ctxt->b) { + case 0x33: /* RDPMC */ + return true; + } + break; } return false; |