qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 1/3] WHPX Add signature CPUID
@ 2018-05-15 17:35 petrutlucian94
  2018-05-15 17:35 ` [Qemu-devel] [PATCH v2 2/3] WHPX: dynamically load WHP libraries petrutlucian94
  2018-05-15 17:35 ` [Qemu-devel] [PATCH v2 3/3] WHPX: fix some compiler warnings petrutlucian94
  0 siblings, 2 replies; 5+ messages in thread
From: petrutlucian94 @ 2018-05-15 17:35 UTC (permalink / raw)
  Cc: Lucian Petrut, Alessandro Pilotti, Justin Terry, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, open list:All patches CC here

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>
---
 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..64ef79a 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;
@@ -1349,6 +1351,27 @@ static int whpx_accel_init(MachineState *ms)
         goto error;
     }
 
+    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;
+    }
+
     hr = WHvSetupPartition(whpx->partition);
     if (FAILED(hr)) {
         error_report("WHPX: Failed to setup partition, hr=%08lx", hr);
-- 
2.7.4

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

end of thread, other threads:[~2018-05-16 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-15 17:35 [Qemu-devel] [PATCH v2 1/3] WHPX Add signature CPUID petrutlucian94
2018-05-15 17:35 ` [Qemu-devel] [PATCH v2 2/3] WHPX: dynamically load WHP libraries petrutlucian94
2018-05-16 10:13   ` Paolo Bonzini
2018-05-15 17:35 ` [Qemu-devel] [PATCH v2 3/3] WHPX: fix some compiler warnings petrutlucian94
2018-05-16 10:13   ` Paolo Bonzini

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).