LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 5/5] KVM: VMX: Use "illegal GPA" helper for PT/RTIT output base check
Date: Thu, 24 Sep 2020 12:42:50 -0700 [thread overview]
Message-ID: <20200924194250.19137-6-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20200924194250.19137-1-sean.j.christopherson@intel.com>
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>
---
arch/x86/kvm/vmx/vmx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 7987de212057..8f1eb5dca794 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -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)
--
2.28.0
next prev parent reply other threads:[~2020-09-24 19:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 19:42 [PATCH v3 0/5] KVM: VMX: Clean up RTIT MAXPHYADDR usage Sean Christopherson
2020-09-24 19:42 ` [PATCH v3 1/5] KVM: VMX: Use precomputed MAXPHYADDR for RTIT base MSR check Sean Christopherson
2020-09-24 19:42 ` [PATCH v3 2/5] KVM: x86: Unexport cpuid_query_maxphyaddr() Sean Christopherson
2020-09-24 19:42 ` [PATCH v3 3/5] KVM: VMX: Replace MSR_IA32_RTIT_OUTPUT_BASE_MASK with helper function Sean Christopherson
2020-09-24 19:42 ` [PATCH v3 4/5] KVM: x86: Move illegal GPA helper out of the MMU code Sean Christopherson
2020-09-24 19:42 ` Sean Christopherson [this message]
2020-09-25 19:50 ` [PATCH v3 0/5] KVM: VMX: Clean up RTIT MAXPHYADDR usage Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200924194250.19137-6-sean.j.christopherson@intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--subject='Re: [PATCH v3 5/5] KVM: VMX: Use "illegal GPA" helper for PT/RTIT output base check' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).