Re: [Qemu-devel] [PATCH] WHPX Add signature CPUID

2018-05-15 Thread Alessandro Pilotti
Hi Paolo,

The main reason for different signatures is to allow guest workloads to be 
aware of the differences between the two platforms (eg VirtIO vs VMBus).

Thanks,

Alessandro

> On 15 May 2018, at 16:44, Paolo Bonzini <pbonz...@redhat.com> wrote:
> 
>> On 15/05/2018 13:37, petrutlucia...@gmail.com wrote:
>> From: Lucian Petrut <lpet...@cloudbasesolutions.com>
>> 
>> Adds the CPUID trap for CPUID 0x4000, sending the WHPX signature
>> to the guest upon request. This is consistent with other QEMU
>> accelerators (KVM).
>> 
>> Signed-off-by: Alessandro Pilotti <apilo...@cloudbasesolutions.com>
>> Signed-off-by: Justin Terry (VM) <jute...@microsoft.com>
>> Signed-off-by: Lucian Petrut <lpet...@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 
>> #include 
>> 
>> +#define WHPX_CPUID_SIGNATURE 0x4000
>> +
>> 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);
>> 
> 



[Qemu-devel] [PATCH 0/1] WHPX Add signature CPUID

2018-03-28 Thread Alessandro Pilotti
Add support for CPUID 0x4000 in WHPX, requiring Justin Terry's patch
that adds support for CPUID 1.

Based-on: <20180326170658.606-1-jute...@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




[Qemu-devel] [PATCH 1/1] WHPX Add signature CPUID

2018-03-28 Thread Alessandro Pilotti
Adds the CPUID trap for CPUID 0x4000, sending the WHPX signature
to the guest upon request. This is consistent with other QEMU
accelerators (KVM).

Signed-off-by: Alessandro Pilotti <apilo...@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 
 #include 
 
+#define WHPX_CPUID_SIGNATURE 0x4000
+
 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




[Qemu-devel] [Bug 921208] Re: win7/x64 installer hangs on startup with 0x0000005d.

2014-10-13 Thread Alessandro Pilotti
Hi guys, is there any update on this issue?

Tx

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/921208

Title:
  win7/x64 installer hangs on startup with 0x005d.

Status in QEMU:
  Confirmed
Status in “qemu” package in Ubuntu:
  Triaged

Bug description:
  hi,

  during booting win7/x64 installer i'm observing a bsod with 0x005d
  ( msdn: unsupported_processor ).

  used command line: qemu-system-x86_64 -m 2048 -hda w7-system.img
  -cdrom win7_x64.iso -boot d

  adding '-machine accel=kvm' instead of default tcg accel helps to
  boot.

  
  installed software:

  qemu-1.0
  linux-3.2.1
  glibc-2.14.1
  gcc-4.6.2

  hw cpu:

  processor   : 0..7
  vendor_id   : GenuineIntel
  cpu family  : 6
  model   : 42
  model name  : Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
  stepping: 7
  microcode   : 0x14
  cpu MHz : 1995.739
  cache size  : 6144 KB
  physical id : 0
  siblings: 8
  core id : 3
  cpu cores   : 4
  apicid  : 7
  initial apicid  : 7
  fpu : yes
  fpu_exception   : yes
  cpuid level : 13
  wp  : yes
  flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx 
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology 
nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 
cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx 
lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
  bogomips: 3992.23
  clflush size: 64
  cache_alignment : 64
  address sizes   : 36 bits physical, 48 bits virtual

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/921208/+subscriptions