]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
KVM: VMX: Use "illegal GPA" helper for PT/RTIT output base check
authorSean Christopherson <sean.j.christopherson@intel.com>
Thu, 24 Sep 2020 19:42:50 +0000 (12:42 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Sep 2020 11:57:27 +0000 (07:57 -0400)
Use kvm_vcpu_is_illegal_gpa() to check for a legal GPA when validating a
PT output base instead of open coding a clever, but difficult to read,
variant.  Code readability is far more important than shaving a few uops
in a slow path.

No functional change intended.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200924194250.19137-6-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c

index 4e372b4e102d7ecb1e81d6182bceaaa1990f2f29..2c1abe964b762637d5c661897ea8a1471c7c8d03 100644 (file)
@@ -1037,7 +1037,7 @@ static inline bool pt_can_write_msr(struct vcpu_vmx *vmx)
 static inline bool pt_output_base_valid(struct kvm_vcpu *vcpu, u64 base)
 {
        /* The base must be 128-byte aligned and a legal physical address. */
-       return !(base & (~((1UL << cpuid_maxphyaddr(vcpu)) - 1) | 0x7f));
+       return !kvm_vcpu_is_illegal_gpa(vcpu, base) && !(base & 0x7f);
 }
 
 static inline void pt_load_msr(struct pt_ctx *ctx, u32 addr_range)