public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@linux.intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	kvm@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm: x86: refine kvm_get_arch_capabilities()
Date: Tue, 21 May 2019 11:37:18 +0800	[thread overview]
Message-ID: <be5bb1d6-ca22-8480-1bf9-b60b617df8cf@linux.intel.com> (raw)
In-Reply-To: <20190419021624.186106-1-xiaoyao.li@linux.intel.com>

Ping.

On 4/19/2019 10:16 AM, Xiaoyao Li wrote:
> 1. Using X86_FEATURE_ARCH_CAPABILITIES to enumerate the existence of
> MSR_IA32_ARCH_CAPABILITIES to avoid using rdmsrl_safe().
> 
> 2. Since kvm_get_arch_capabilities() is only used in this file, making
> it static.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
> ---
>   arch/x86/include/asm/kvm_host.h | 1 -
>   arch/x86/kvm/x86.c              | 8 ++++----
>   2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index a9d03af34030..d4ae67870764 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1526,7 +1526,6 @@ int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low,
>   		    unsigned long ipi_bitmap_high, u32 min,
>   		    unsigned long icr, int op_64_bit);
>   
> -u64 kvm_get_arch_capabilities(void);
>   void kvm_define_shared_msr(unsigned index, u32 msr);
>   int kvm_set_shared_msr(unsigned index, u64 val, u64 mask);
>   
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index a0d1fc80ac5a..ba8e269a8cd2 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1205,11 +1205,12 @@ static u32 msr_based_features[] = {
>   
>   static unsigned int num_msr_based_features;
>   
> -u64 kvm_get_arch_capabilities(void)
> +static u64 kvm_get_arch_capabilities(void)
>   {
> -	u64 data;
> +	u64 data = 0;
>   
> -	rdmsrl_safe(MSR_IA32_ARCH_CAPABILITIES, &data);
> +	if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES))
> +		rdmsrl(MSR_IA32_ARCH_CAPABILITIES, data);
>   
>   	/*
>   	 * If we're doing cache flushes (either "always" or "cond")
> @@ -1225,7 +1226,6 @@ u64 kvm_get_arch_capabilities(void)
>   
>   	return data;
>   }
> -EXPORT_SYMBOL_GPL(kvm_get_arch_capabilities);
>   
>   static int kvm_get_msr_feature(struct kvm_msr_entry *msr)
>   {
> 

  reply	other threads:[~2019-05-21  3:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  2:16 [PATCH] kvm: x86: refine kvm_get_arch_capabilities() Xiaoyao Li
2019-05-21  3:37 ` Xiaoyao Li [this message]
2019-06-04 16:09 ` 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=be5bb1d6-ca22-8480-1bf9-b60b617df8cf@linux.intel.com \
    --to=xiaoyao.li@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox