]> git.proxmox.com Git - mirror_qemu.git/commit - target/i386/cpu.c
hyperv: only add SynIC in compatible configurations
authorRoman Kagan <rkagan@virtuozzo.com>
Fri, 21 Sep 2018 08:22:10 +0000 (11:22 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Oct 2018 11:44:14 +0000 (13:44 +0200)
commit9b4cf107b09d18ac30f46fd1c4de8585ccba030c
treeeaf76223e82c1cf57f08526ec6e23b77cd2f8c08
parent606c34bfd57a0ecda67b395bea022bb307a5384e
hyperv: only add SynIC in compatible configurations

Certain configurations do not allow SynIC to be used in QEMU.  In
particular,

- when hyperv_vpindex is off, SINT routes can't be used as they refer to
  the destination vCPU by vp_index

- older KVM (which doesn't expose KVM_CAP_HYPERV_SYNIC2) zeroes out
  SynIC message and event pages on every msr load, breaking migration

OTOH in-KVM users of SynIC -- SynIC timers -- do work in those
configurations, and we shouldn't stop the guest from using them.

To cover both scenarios, introduce an X86CPU property that makes CPU
init code to skip creation of the SynIC object (and thus disables any
SynIC use in QEMU) but keeps the KVM part of the SynIC working.
The property is clear by default but is set via compat logic for older
machine types.

As a result, when hv_synic and a modern machine type are specified, QEMU
will refuse to run unless vp_index is on and the kernel is recent
enough.  OTOH with an older machine type QEMU will run fine with
hv_synic=on against an older kernel and/or without vp_index enabled but
will disallow the in-QEMU uses of SynIC (in e.g. VMBus).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Message-Id: <20180921082217.29481-4-rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/hw/i386/pc.h
target/i386/cpu.c
target/i386/cpu.h
target/i386/kvm.c