On 19/09/2017 14:36, Roman Kagan wrote:
> On Tue, Sep 19, 2017 at 02:29:32PM +0200, Paolo Bonzini wrote:
>> From: Roman Kagan <rkagan@virtuozzo.com>
>>
>> All definitions related to Hyper-V emulation are now taken from the QEMU
>> own header, so the one imported from the kernel is no longer needed.
>>
>> Unfortunately it's included by kvm_para.h.
>>
>> So, until this is fixed in the kernel, teach the header harvesting
>> script to substitute kernel's hyperv.h with a dummy.
>>
>> Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
>> Message-Id: <20170713201522.13765-3-rkagan@virtuozzo.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> scripts/update-linux-headers.sh | 4 +++-
>> target/i386/hyperv-proto.h | 3 +++
>> target/i386/kvm.c | 17 +++++------------
>> 3 files changed, 11 insertions(+), 13 deletions(-)
>>
>> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
>> index 2f906c4..ad80fe3 100755
>> --- a/scripts/update-linux-headers.sh
>> +++ b/scripts/update-linux-headers.sh
>> @@ -104,7 +104,9 @@ for arch in $ARCHLIST; do
>> cp "$tmpdir/include/asm/unistd-common.h" "$output/linux-headers/asm-arm/"
>> fi
>> if [ $arch = x86 ]; then
>> - cp_portable "$tmpdir/include/asm/hyperv.h" "$output/include/standard-headers/asm-x86/"
>> + cat <<-EOF >"$output/include/standard-headers/asm-x86/hyperv.h"
>> + /* this is a temporary placeholder until kvm_para.h stops including it */
>> + EOF
>> cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/"
>> cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/"
>> cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/"
>> diff --git a/target/i386/hyperv-proto.h b/target/i386/hyperv-proto.h
>> index 1b3fa6e..cb4d7f2 100644
>> --- a/target/i386/hyperv-proto.h
>> +++ b/target/i386/hyperv-proto.h
>> @@ -34,6 +34,8 @@
>> #define HV_VP_INDEX_AVAILABLE (1u << 6)
>> #define HV_RESET_AVAILABLE (1u << 7)
>> #define HV_REFERENCE_TSC_AVAILABLE (1u << 9)
>> +#define HV_ACCESS_FREQUENCY_MSRS (1u << 11)
>> +
>>
>> /*
>> * HV_CPUID_FEATURES.EDX bits
>> @@ -44,6 +46,7 @@
>> #define HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE (1u << 3)
>> #define HV_HYPERCALL_PARAMS_XMM_AVAILABLE (1u << 4)
>> #define HV_GUEST_IDLE_STATE_AVAILABLE (1u << 5)
>> +#define HV_FREQUENCY_MSRS_AVAILABLE (1u << 8)
>> #define HV_GUEST_CRASH_MSR_AVAILABLE (1u << 10)
>>
>> /*
>> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
>> index 0498ab7..b1e32e9 100644
>> --- a/target/i386/kvm.c
>> +++ b/target/i386/kvm.c
>> @@ -639,21 +639,14 @@ static int hyperv_handle_properties(CPUState *cs)
>> env->features[FEAT_HYPERV_EAX] |= HV_APIC_ACCESS_AVAILABLE;
>> }
>> if (cpu->hyperv_time) {
>> -<<<<<<< HEAD
>> - env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;
>> - env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE;
>> - env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_REFERENCE_TSC_AVAILABLE;
>> -
>> - if (has_msr_hv_frequencies && tsc_is_stable_and_known(env)) {
>> - env->features[FEAT_HYPERV_EAX] |= HV_X64_ACCESS_FREQUENCY_MSRS;
>> - env->features[FEAT_HYPERV_EDX] |=
>> - HV_FEATURE_FREQUENCY_MSRS_AVAILABLE;
>> - }
>> -=======
>> env->features[FEAT_HYPERV_EAX] |= HV_HYPERCALL_AVAILABLE;
>> env->features[FEAT_HYPERV_EAX] |= HV_TIME_REF_COUNT_AVAILABLE;
>> env->features[FEAT_HYPERV_EAX] |= HV_REFERENCE_TSC_AVAILABLE;
>> ->>>>>>> hyperv: add header with protocol definitions
>> +
>> + if (has_msr_hv_frequencies && tsc_is_stable_and_known(env)) {
>> + env->features[FEAT_HYPERV_EAX] |= HV_ACCESS_FREQUENCY_MSRS;
>> + env->features[FEAT_HYPERV_EDX] |= HV_FREQUENCY_MSRS_AVAILABLE;
>> + }
>> }
>> if (cpu->hyperv_crash && has_msr_hv_crash) {
>> env->features[FEAT_HYPERV_EDX] |= HV_GUEST_CRASH_MSR_AVAILABLE;
>
> I guess the conflicts were not supposed to be here.
Yup, the conflict resolution is correct but it ended up in the wrong patch.
Paolo
> Nor the FREQUENCY_MSRS stuff which would better be merged in the
> previous patch.
>
> Roman.
>