qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: petrutlucian94@gmail.com
Cc: Lucian Petrut <lpetrut@cloudbasesolutions.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>,
	Alessandro Pilotti <apilotti@cloudbasesolutions.com>,
	Justin Terry <juterry@microsoft.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] WHPX Add signature CPUID
Date: Tue, 15 May 2018 16:43:38 +0200	[thread overview]
Message-ID: <b1f9836f-96ee-d782-1882-51c97e21d252@redhat.com> (raw)
In-Reply-To: <1526384258-3581-1-git-send-email-lpetrut@cloudbasesolutions.com>

On 15/05/2018 13:37, petrutlucian94@gmail.com wrote:
> From: Lucian Petrut <lpetrut@cloudbasesolutions.com>
> 
> Adds the CPUID trap for CPUID 0x40000000, sending the WHPX signature
> to the guest upon request. This is consistent with other QEMU
> accelerators (KVM).
> 
> Signed-off-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
> Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
> Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>

Is it worth defining a different signature?  Can WHPX implement part of
the Hyper-V spec, and if so would it be better to return the Hv
signature ("Hv#1") instead?

Thanks,

Paolo

> ---
> As opposed to the previous patch, this one will set the result of
> this specific CPUID leaf when initializing the accelerator so that
> we avoid a vcpu exit.
> 
>  target/i386/whpx-all.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c
> index 5843517..c8310de 100644
> --- a/target/i386/whpx-all.c
> +++ b/target/i386/whpx-all.c
> @@ -29,6 +29,8 @@
>  #include <WinHvPlatform.h>
>  #include <WinHvEmulation.h>
>  
> +#define WHPX_CPUID_SIGNATURE 0x40000000
> +
>  struct whpx_state {
>      uint64_t mem_quota;
>      WHV_PARTITION_HANDLE partition;
> @@ -1342,6 +1344,27 @@ static int whpx_accel_init(MachineState *ms)
>                                   cpuidExitList,
>                                   RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32));
>  
> +    UINT32 signature[3] = {0};
> +    memcpy(signature, "WHPXWHPXWHPX", 12);
> +
> +    WHV_X64_CPUID_RESULT cpuidResultList[1] = {0};
> +    cpuidResultList[0].Function = WHPX_CPUID_SIGNATURE;
> +    cpuidResultList[0].Eax = 0;
> +    cpuidResultList[0].Ebx = signature[0];
> +    cpuidResultList[0].Ecx = signature[1];
> +    cpuidResultList[0].Edx = signature[2];
> +    hr = WHvSetPartitionProperty(whpx->partition,
> +                                 WHvPartitionPropertyCodeCpuidResultList,
> +                                 cpuidResultList,
> +                                 RTL_NUMBER_OF(cpuidResultList) *
> +                                    sizeof(WHV_X64_CPUID_RESULT));
> +    if (FAILED(hr)) {
> +        error_report("WHPX: Failed to set partition CpuidResultList hr=%08lx",
> +                     hr);
> +        ret = -EINVAL;
> +        goto error;
> +    }
> +
>      if (FAILED(hr)) {
>          error_report("WHPX: Failed to set partition CpuidExitList hr=%08lx",
>                       hr);
> 

  parent reply	other threads:[~2018-05-15 14:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 11:37 [Qemu-devel] [PATCH] WHPX Add signature CPUID petrutlucian94
2018-05-15 14:01 ` Justin Terry (VM)
2018-05-15 14:43 ` Paolo Bonzini [this message]
2018-05-15 23:55   ` Alessandro Pilotti
2018-05-16  7:34     ` Paolo Bonzini
2018-05-16 14:18       ` Justin Terry (VM)
2018-06-27 12:53         ` 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=b1f9836f-96ee-d782-1882-51c97e21d252@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=apilotti@cloudbasesolutions.com \
    --cc=ehabkost@redhat.com \
    --cc=juterry@microsoft.com \
    --cc=lpetrut@cloudbasesolutions.com \
    --cc=petrutlucian94@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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;
as well as URLs for NNTP newsgroup(s).