From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
haiyangz@microsoft.com, alex.williamson@redhat.com,
x86@kernel.org, "K. Y. Srinivasan" <kys@microsoft.com>
Subject: Re: [PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V
Date: Fri, 02 Oct 2015 13:26:32 +0200 [thread overview]
Message-ID: <874mi9o6jb.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <1443778007-27714-1-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Fri, 2 Oct 2015 11:26:47 +0200")
Paolo Bonzini <pbonzini@redhat.com> writes:
> The specification says that "Microsoft Hv" is actually a vendor ID field
> that is only used for reporting and diagnostic purposes. The actual
> field that you need to check is the interface ID that you get in eax
> when querying the HYPERV_CPUID_INTERFACE.
>
> Change ms_hyperv_platform to actually do what the specification suggests.
> This roughy matches what Windows looks for, though Windows actually
> ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
(and it seems K. Y. is missing on the CC: list, fixed).
> ---
> arch/x86/kernel/cpu/mshyperv.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 381c8b9b3a33..7910e7fd705b 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -116,18 +116,16 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs)
> static uint32_t __init ms_hyperv_platform(void)
> {
> u32 eax;
> - u32 hyp_signature[3];
>
> if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
> return 0;
>
> - cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
> - &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
> -
> - if (eax >= HYPERV_CPUID_MIN &&
> - eax <= HYPERV_CPUID_MAX &&
> - !memcmp("Microsoft Hv", hyp_signature, 12))
> - return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> + eax = cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS);
> + if (eax >= HYPERV_CPUID_MIN && eax <= HYPERV_CPUID_MAX) {
> + eax = cpuid_eax(HYPERV_CPUID_INTERFACE);
> + if (!memcmp(&eax, "Hv#1", sizeof(eax)))
> + return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> + }
>
> return 0;
> }
--
Vitaly
next prev parent reply other threads:[~2015-10-02 11:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 9:26 Paolo Bonzini
2015-10-02 11:26 ` Vitaly Kuznetsov [this message]
2015-10-02 14:37 ` KY Srinivasan
2015-10-02 20:07 ` Thomas Gleixner
2015-10-02 21:43 ` KY Srinivasan
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=874mi9o6jb.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--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
Powered by JetHome