All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] WHPX Add signature CPUID
@ 2018-03-28 19:12 Alessandro Pilotti
  2018-03-28 19:12 ` [Qemu-devel] [PATCH 1/1] " Alessandro Pilotti
  0 siblings, 1 reply; 2+ messages in thread
From: Alessandro Pilotti @ 2018-03-28 19:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, juterry, Alessandro Pilotti

Add support for CPUID 0x40000000 in WHPX, requiring Justin Terry's patch
that adds support for CPUID 1.

Based-on: <20180326170658.606-1-juterry@microsoft.com>

Alessandro Pilotti (1):
  WHPX Add signature CPUID

 target/i386/whpx-all.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--
2.13.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH 1/1] WHPX Add signature CPUID
  2018-03-28 19:12 [Qemu-devel] [PATCH 0/1] WHPX Add signature CPUID Alessandro Pilotti
@ 2018-03-28 19:12 ` Alessandro Pilotti
  0 siblings, 0 replies; 2+ messages in thread
From: Alessandro Pilotti @ 2018-03-28 19:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, juterry, Alessandro Pilotti

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>
---
 target/i386/whpx-all.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c
index efa1441479..4085002428 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;
@@ -918,6 +920,7 @@ static int whpx_vcpu_run(CPUState *cpu)
             WHV_REGISTER_NAME reg_names[5];
             UINT32 reg_count = 5;
             UINT64 rip, rax, rcx, rdx, rbx;
+            UINT32 signature[3] = {0};
 
             rip = vcpu->exit_ctx.VpContext.Rip +
                   vcpu->exit_ctx.VpContext.InstructionLength;
@@ -932,6 +935,13 @@ static int whpx_vcpu_run(CPUState *cpu)
                     rdx = vcpu->exit_ctx.CpuidAccess.DefaultResultRdx;
                     rbx = vcpu->exit_ctx.CpuidAccess.DefaultResultRbx;
                     break;
+                case WHPX_CPUID_SIGNATURE:
+                    memcpy(signature, "WHPXWHPXWHPX", 12);
+                    rax = vcpu->exit_ctx.CpuidAccess.DefaultResultRax;
+                    rbx = signature[0];
+                    rcx = signature[1];
+                    rdx = signature[2];
+                    break;
                 default:
                     rax = vcpu->exit_ctx.CpuidAccess.DefaultResultRax;
                     rcx = vcpu->exit_ctx.CpuidAccess.DefaultResultRcx;
@@ -1338,7 +1348,7 @@ static int whpx_accel_init(MachineState *ms)
         goto error;
     }
 
-    UINT32 cpuidExitList[] = {1};
+    UINT32 cpuidExitList[] = {1, WHPX_CPUID_SIGNATURE};
     hr = WHvSetPartitionProperty(whpx->partition,
                                  WHvPartitionPropertyCodeCpuidExitList,
                                  cpuidExitList,
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-28 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 19:12 [Qemu-devel] [PATCH 0/1] WHPX Add signature CPUID Alessandro Pilotti
2018-03-28 19:12 ` [Qemu-devel] [PATCH 1/1] " Alessandro Pilotti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.