[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] WHPX Add signature CPUID
From: |
Alessandro Pilotti |
Subject: |
Re: [Qemu-devel] [PATCH] WHPX Add signature CPUID |
Date: |
Tue, 15 May 2018 23:55:24 +0000 |
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 <address@hidden> wrote:
>
>> On 15/05/2018 13:37, address@hidden wrote:
>> From: Lucian Petrut <address@hidden>
>>
>> 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 <address@hidden>
>> Signed-off-by: Justin Terry (VM) <address@hidden>
>> Signed-off-by: Lucian Petrut <address@hidden>
>
> 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);
>>
>