From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@alien8.de>, LKML <linux-kernel@vger.kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>, kvm@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH] x86/kvm/svm: Simplify cpu_has_svm()
Date: Thu, 9 Jun 2016 17:19:56 +0200 [thread overview]
Message-ID: <8c6ff71a-9bd4-73bb-c820-b0c59fc0b02b@redhat.com> (raw)
In-Reply-To: <1462787586-24151-1-git-send-email-bp@alien8.de>
On 09/05/2016 11:53, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Use already cached CPUID information instead of querying CPUID again.
>
> No functionality change.
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: kvm@vger.kernel.org
> Cc: x86@kernel.org
> ---
> arch/x86/include/asm/svm.h | 1 -
> arch/x86/include/asm/virtext.h | 8 ++------
> 2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
> index 6136d99f537b..41888f51f936 100644
> --- a/arch/x86/include/asm/svm.h
> +++ b/arch/x86/include/asm/svm.h
> @@ -185,7 +185,6 @@ struct __attribute__ ((__packed__)) vmcb {
> struct vmcb_save_area save;
> };
>
> -#define SVM_CPUID_FEATURE_SHIFT 2
> #define SVM_CPUID_FUNC 0x8000000a
>
> #define SVM_VM_CR_SVM_DISABLE 4
> diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
> index cce9ee68e335..0116b2ee9e64 100644
> --- a/arch/x86/include/asm/virtext.h
> +++ b/arch/x86/include/asm/virtext.h
> @@ -83,23 +83,19 @@ static inline void cpu_emergency_vmxoff(void)
> */
> static inline int cpu_has_svm(const char **msg)
> {
> - uint32_t eax, ebx, ecx, edx;
> -
> if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
> if (msg)
> *msg = "not amd";
> return 0;
> }
>
> - cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
> - if (eax < SVM_CPUID_FUNC) {
> + if (boot_cpu_data.extended_cpuid_level < SVM_CPUID_FUNC) {
> if (msg)
> *msg = "can't execute cpuid_8000000a";
> return 0;
> }
>
> - cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
> - if (!(ecx & (1 << SVM_CPUID_FEATURE_SHIFT))) {
> + if (!boot_cpu_has(X86_FEATURE_SVM)) {
> if (msg)
> *msg = "svm not available";
> return 0;
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2016-06-09 15:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 9:53 Borislav Petkov
2016-06-09 15:19 ` Paolo Bonzini [this message]
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=8c6ff71a-9bd4-73bb-c820-b0c59fc0b02b@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®