xref: /qemu/docs/system/i386/hyperv.rst (revision f1dd640896ee2b50cb34328f2568aad324702954)
19ad6634eSVitaly KuznetsovHyper-V Enlightenments
29ad6634eSVitaly Kuznetsov======================
39ad6634eSVitaly Kuznetsov
49ad6634eSVitaly Kuznetsov
59ad6634eSVitaly KuznetsovDescription
69ad6634eSVitaly Kuznetsov-----------
79ad6634eSVitaly Kuznetsov
89ad6634eSVitaly KuznetsovIn some cases when implementing a hardware interface in software is slow, KVM
99ad6634eSVitaly Kuznetsovimplements its own paravirtualized interfaces. This works well for Linux as
109ad6634eSVitaly Kuznetsovguest support for such features is added simultaneously with the feature itself.
119ad6634eSVitaly KuznetsovIt may, however, be hard-to-impossible to add support for these interfaces to
129ad6634eSVitaly Kuznetsovproprietary OSes, namely, Microsoft Windows.
139ad6634eSVitaly Kuznetsov
149ad6634eSVitaly KuznetsovKVM on x86 implements Hyper-V Enlightenments for Windows guests. These features
159ad6634eSVitaly Kuznetsovmake Windows and Hyper-V guests think they're running on top of a Hyper-V
169ad6634eSVitaly Kuznetsovcompatible hypervisor and use Hyper-V specific features.
179ad6634eSVitaly Kuznetsov
189ad6634eSVitaly Kuznetsov
199ad6634eSVitaly KuznetsovSetup
209ad6634eSVitaly Kuznetsov-----
219ad6634eSVitaly Kuznetsov
229ad6634eSVitaly KuznetsovNo Hyper-V enlightenments are enabled by default by either KVM or QEMU. In
239ad6634eSVitaly KuznetsovQEMU, individual enlightenments can be enabled through CPU flags, e.g:
249ad6634eSVitaly Kuznetsov
259ad6634eSVitaly Kuznetsov.. parsed-literal::
269ad6634eSVitaly Kuznetsov
279ad6634eSVitaly Kuznetsov  |qemu_system| --enable-kvm --cpu host,hv_relaxed,hv_vpindex,hv_time, ...
289ad6634eSVitaly Kuznetsov
299ad6634eSVitaly KuznetsovSometimes there are dependencies between enlightenments, QEMU is supposed to
309ad6634eSVitaly Kuznetsovcheck that the supplied configuration is sane.
319ad6634eSVitaly Kuznetsov
329ad6634eSVitaly KuznetsovWhen any set of the Hyper-V enlightenments is enabled, QEMU changes hypervisor
339ad6634eSVitaly Kuznetsovidentification (CPUID 0x40000000..0x4000000A) to Hyper-V. KVM identification
349ad6634eSVitaly Kuznetsovand features are kept in leaves 0x40000100..0x40000101.
359ad6634eSVitaly Kuznetsov
369ad6634eSVitaly Kuznetsov
379ad6634eSVitaly KuznetsovExisting enlightenments
389ad6634eSVitaly Kuznetsov-----------------------
399ad6634eSVitaly Kuznetsov
409ad6634eSVitaly Kuznetsov``hv-relaxed``
419ad6634eSVitaly Kuznetsov  This feature tells guest OS to disable watchdog timeouts as it is running on a
429ad6634eSVitaly Kuznetsov  hypervisor. It is known that some Windows versions will do this even when they
439ad6634eSVitaly Kuznetsov  see 'hypervisor' CPU flag.
449ad6634eSVitaly Kuznetsov
459ad6634eSVitaly Kuznetsov``hv-vapic``
469ad6634eSVitaly Kuznetsov  Provides so-called VP Assist page MSR to guest allowing it to work with APIC
479ad6634eSVitaly Kuznetsov  more efficiently. In particular, this enlightenment allows paravirtualized
489ad6634eSVitaly Kuznetsov  (exit-less) EOI processing.
499ad6634eSVitaly Kuznetsov
509ad6634eSVitaly Kuznetsov``hv-spinlocks`` = xxx
519ad6634eSVitaly Kuznetsov  Enables paravirtualized spinlocks. The parameter indicates how many times
529ad6634eSVitaly Kuznetsov  spinlock acquisition should be attempted before indicating the situation to the
539ad6634eSVitaly Kuznetsov  hypervisor. A special value 0xffffffff indicates "never notify".
549ad6634eSVitaly Kuznetsov
559ad6634eSVitaly Kuznetsov``hv-vpindex``
569ad6634eSVitaly Kuznetsov  Provides HV_X64_MSR_VP_INDEX (0x40000002) MSR to the guest which has Virtual
579ad6634eSVitaly Kuznetsov  processor index information. This enlightenment makes sense in conjunction with
589ad6634eSVitaly Kuznetsov  hv-synic, hv-stimer and other enlightenments which require the guest to know its
599ad6634eSVitaly Kuznetsov  Virtual Processor indices (e.g. when VP index needs to be passed in a
609ad6634eSVitaly Kuznetsov  hypercall).
619ad6634eSVitaly Kuznetsov
629ad6634eSVitaly Kuznetsov``hv-runtime``
639ad6634eSVitaly Kuznetsov  Provides HV_X64_MSR_VP_RUNTIME (0x40000010) MSR to the guest. The MSR keeps the
649ad6634eSVitaly Kuznetsov  virtual processor run time in 100ns units. This gives guest operating system an
659ad6634eSVitaly Kuznetsov  idea of how much time was 'stolen' from it (when the virtual CPU was preempted
669ad6634eSVitaly Kuznetsov  to perform some other work).
679ad6634eSVitaly Kuznetsov
689ad6634eSVitaly Kuznetsov``hv-crash``
699ad6634eSVitaly Kuznetsov  Provides HV_X64_MSR_CRASH_P0..HV_X64_MSR_CRASH_P5 (0x40000100..0x40000105) and
709ad6634eSVitaly Kuznetsov  HV_X64_MSR_CRASH_CTL (0x40000105) MSRs to the guest. These MSRs are written to
719ad6634eSVitaly Kuznetsov  by the guest when it crashes, HV_X64_MSR_CRASH_P0..HV_X64_MSR_CRASH_P5 MSRs
729ad6634eSVitaly Kuznetsov  contain additional crash information. This information is outputted in QEMU log
739ad6634eSVitaly Kuznetsov  and through QAPI.
749ad6634eSVitaly Kuznetsov  Note: unlike under genuine Hyper-V, write to HV_X64_MSR_CRASH_CTL causes guest
759ad6634eSVitaly Kuznetsov  to shutdown. This effectively blocks crash dump generation by Windows.
769ad6634eSVitaly Kuznetsov
779ad6634eSVitaly Kuznetsov``hv-time``
789ad6634eSVitaly Kuznetsov  Enables two Hyper-V-specific clocksources available to the guest: MSR-based
799ad6634eSVitaly Kuznetsov  Hyper-V clocksource (HV_X64_MSR_TIME_REF_COUNT, 0x40000020) and Reference TSC
809ad6634eSVitaly Kuznetsov  page (enabled via MSR HV_X64_MSR_REFERENCE_TSC, 0x40000021). Both clocksources
819ad6634eSVitaly Kuznetsov  are per-guest, Reference TSC page clocksource allows for exit-less time stamp
829ad6634eSVitaly Kuznetsov  readings. Using this enlightenment leads to significant speedup of all timestamp
839ad6634eSVitaly Kuznetsov  related operations.
849ad6634eSVitaly Kuznetsov
859ad6634eSVitaly Kuznetsov``hv-synic``
869ad6634eSVitaly Kuznetsov  Enables Hyper-V Synthetic interrupt controller - an extension of a local APIC.
879ad6634eSVitaly Kuznetsov  When enabled, this enlightenment provides additional communication facilities
889ad6634eSVitaly Kuznetsov  to the guest: SynIC messages and Events. This is a pre-requisite for
899ad6634eSVitaly Kuznetsov  implementing VMBus devices (not yet in QEMU). Additionally, this enlightenment
909ad6634eSVitaly Kuznetsov  is needed to enable Hyper-V synthetic timers. SynIC is controlled through MSRs
919ad6634eSVitaly Kuznetsov  HV_X64_MSR_SCONTROL..HV_X64_MSR_EOM (0x40000080..0x40000084) and
929ad6634eSVitaly Kuznetsov  HV_X64_MSR_SINT0..HV_X64_MSR_SINT15 (0x40000090..0x4000009F)
939ad6634eSVitaly Kuznetsov
949ad6634eSVitaly Kuznetsov  Requires: ``hv-vpindex``
959ad6634eSVitaly Kuznetsov
969ad6634eSVitaly Kuznetsov``hv-stimer``
979ad6634eSVitaly Kuznetsov  Enables Hyper-V synthetic timers. There are four synthetic timers per virtual
989ad6634eSVitaly Kuznetsov  CPU controlled through HV_X64_MSR_STIMER0_CONFIG..HV_X64_MSR_STIMER3_COUNT
999ad6634eSVitaly Kuznetsov  (0x400000B0..0x400000B7) MSRs. These timers can work either in single-shot or
1009ad6634eSVitaly Kuznetsov  periodic mode. It is known that certain Windows versions revert to using HPET
1019ad6634eSVitaly Kuznetsov  (or even RTC when HPET is unavailable) extensively when this enlightenment is
1029ad6634eSVitaly Kuznetsov  not provided; this can lead to significant CPU consumption, even when virtual
1039ad6634eSVitaly Kuznetsov  CPU is idle.
1049ad6634eSVitaly Kuznetsov
1059ad6634eSVitaly Kuznetsov  Requires: ``hv-vpindex``, ``hv-synic``, ``hv-time``
1069ad6634eSVitaly Kuznetsov
1079ad6634eSVitaly Kuznetsov``hv-tlbflush``
1089ad6634eSVitaly Kuznetsov  Enables paravirtualized TLB shoot-down mechanism. On x86 architecture, remote
1099ad6634eSVitaly Kuznetsov  TLB flush procedure requires sending IPIs and waiting for other CPUs to perform
1109ad6634eSVitaly Kuznetsov  local TLB flush. In virtualized environment some virtual CPUs may not even be
1119ad6634eSVitaly Kuznetsov  scheduled at the time of the call and may not require flushing (or, flushing
1129ad6634eSVitaly Kuznetsov  may be postponed until the virtual CPU is scheduled). hv-tlbflush enlightenment
1139ad6634eSVitaly Kuznetsov  implements TLB shoot-down through hypervisor enabling the optimization.
1149ad6634eSVitaly Kuznetsov
1159ad6634eSVitaly Kuznetsov  Requires: ``hv-vpindex``
1169ad6634eSVitaly Kuznetsov
1179ad6634eSVitaly Kuznetsov``hv-ipi``
1189ad6634eSVitaly Kuznetsov  Enables paravirtualized IPI send mechanism. HvCallSendSyntheticClusterIpi
1199ad6634eSVitaly Kuznetsov  hypercall may target more than 64 virtual CPUs simultaneously, doing the same
1209ad6634eSVitaly Kuznetsov  through APIC requires more than one access (and thus exit to the hypervisor).
1219ad6634eSVitaly Kuznetsov
1229ad6634eSVitaly Kuznetsov  Requires: ``hv-vpindex``
1239ad6634eSVitaly Kuznetsov
1249ad6634eSVitaly Kuznetsov``hv-vendor-id`` = xxx
1259ad6634eSVitaly Kuznetsov  This changes Hyper-V identification in CPUID 0x40000000.EBX-EDX from the default
1269ad6634eSVitaly Kuznetsov  "Microsoft Hv". The parameter should be no longer than 12 characters. According
1279ad6634eSVitaly Kuznetsov  to the specification, guests shouldn't use this information and it is unknown
1289ad6634eSVitaly Kuznetsov  if there is a Windows version which acts differently.
1299ad6634eSVitaly Kuznetsov  Note: hv-vendor-id is not an enlightenment and thus doesn't enable Hyper-V
1309ad6634eSVitaly Kuznetsov  identification when specified without some other enlightenment.
1319ad6634eSVitaly Kuznetsov
1329ad6634eSVitaly Kuznetsov``hv-reset``
1339ad6634eSVitaly Kuznetsov  Provides HV_X64_MSR_RESET (0x40000003) MSR to the guest allowing it to reset
1349ad6634eSVitaly Kuznetsov  itself by writing to it. Even when this MSR is enabled, it is not a recommended
1359ad6634eSVitaly Kuznetsov  way for Windows to perform system reboot and thus it may not be used.
1369ad6634eSVitaly Kuznetsov
1379ad6634eSVitaly Kuznetsov``hv-frequencies``
1389ad6634eSVitaly Kuznetsov  Provides HV_X64_MSR_TSC_FREQUENCY (0x40000022) and HV_X64_MSR_APIC_FREQUENCY
1399ad6634eSVitaly Kuznetsov  (0x40000023) allowing the guest to get its TSC/APIC frequencies without doing
1409ad6634eSVitaly Kuznetsov  measurements.
1419ad6634eSVitaly Kuznetsov
1429ad6634eSVitaly Kuznetsov``hv-reenlightenment``
1439ad6634eSVitaly Kuznetsov  The enlightenment is nested specific, it targets Hyper-V on KVM guests. When
1449ad6634eSVitaly Kuznetsov  enabled, it provides HV_X64_MSR_REENLIGHTENMENT_CONTROL (0x40000106),
1459ad6634eSVitaly Kuznetsov  HV_X64_MSR_TSC_EMULATION_CONTROL (0x40000107)and HV_X64_MSR_TSC_EMULATION_STATUS
1469ad6634eSVitaly Kuznetsov  (0x40000108) MSRs allowing the guest to get notified when TSC frequency changes
1479ad6634eSVitaly Kuznetsov  (only happens on migration) and keep using old frequency (through emulation in
1489ad6634eSVitaly Kuznetsov  the hypervisor) until it is ready to switch to the new one. This, in conjunction
1499ad6634eSVitaly Kuznetsov  with ``hv-frequencies``, allows Hyper-V on KVM to pass stable clocksource
1509ad6634eSVitaly Kuznetsov  (Reference TSC page) to its own guests.
1519ad6634eSVitaly Kuznetsov
1529ad6634eSVitaly Kuznetsov  Note, KVM doesn't fully support re-enlightenment notifications and doesn't
1539ad6634eSVitaly Kuznetsov  emulate TSC accesses after migration so 'tsc-frequency=' CPU option also has to
1549ad6634eSVitaly Kuznetsov  be specified to make migration succeed. The destination host has to either have
1559ad6634eSVitaly Kuznetsov  the same TSC frequency or support TSC scaling CPU feature.
1569ad6634eSVitaly Kuznetsov
1579ad6634eSVitaly Kuznetsov  Recommended: ``hv-frequencies``
1589ad6634eSVitaly Kuznetsov
1599ad6634eSVitaly Kuznetsov``hv-evmcs``
1609ad6634eSVitaly Kuznetsov  The enlightenment is nested specific, it targets Hyper-V on KVM guests. When
1619ad6634eSVitaly Kuznetsov  enabled, it provides Enlightened VMCS version 1 feature to the guest. The feature
1629ad6634eSVitaly Kuznetsov  implements paravirtualized protocol between L0 (KVM) and L1 (Hyper-V)
1639ad6634eSVitaly Kuznetsov  hypervisors making L2 exits to the hypervisor faster. The feature is Intel-only.
1649ad6634eSVitaly Kuznetsov
1659ad6634eSVitaly Kuznetsov  Note: some virtualization features (e.g. Posted Interrupts) are disabled when
1669ad6634eSVitaly Kuznetsov  hv-evmcs is enabled. It may make sense to measure your nested workload with and
1679ad6634eSVitaly Kuznetsov  without the feature to find out if enabling it is beneficial.
1689ad6634eSVitaly Kuznetsov
1699ad6634eSVitaly Kuznetsov  Requires: ``hv-vapic``
1709ad6634eSVitaly Kuznetsov
1719ad6634eSVitaly Kuznetsov``hv-stimer-direct``
1729ad6634eSVitaly Kuznetsov  Hyper-V specification allows synthetic timer operation in two modes: "classic",
1739ad6634eSVitaly Kuznetsov  when expiration event is delivered as SynIC message and "direct", when the event
1749ad6634eSVitaly Kuznetsov  is delivered via normal interrupt. It is known that nested Hyper-V can only
1759ad6634eSVitaly Kuznetsov  use synthetic timers in direct mode and thus ``hv-stimer-direct`` needs to be
1769ad6634eSVitaly Kuznetsov  enabled.
1779ad6634eSVitaly Kuznetsov
1789ad6634eSVitaly Kuznetsov  Requires: ``hv-vpindex``, ``hv-synic``, ``hv-time``, ``hv-stimer``
1799ad6634eSVitaly Kuznetsov
1809ad6634eSVitaly Kuznetsov``hv-avic`` (``hv-apicv``)
1819ad6634eSVitaly Kuznetsov  The enlightenment allows to use Hyper-V SynIC with hardware APICv/AVIC enabled.
1829ad6634eSVitaly Kuznetsov  Normally, Hyper-V SynIC disables these hardware feature and suggests the guest
1839ad6634eSVitaly Kuznetsov  to use paravirtualized AutoEOI feature.
1849ad6634eSVitaly Kuznetsov  Note: enabling this feature on old hardware (without APICv/AVIC support) may
1859ad6634eSVitaly Kuznetsov  have negative effect on guest's performance.
1869ad6634eSVitaly Kuznetsov
1879ad6634eSVitaly Kuznetsov``hv-no-nonarch-coresharing`` = on/off/auto
1889ad6634eSVitaly Kuznetsov  This enlightenment tells guest OS that virtual processors will never share a
1899ad6634eSVitaly Kuznetsov  physical core unless they are reported as sibling SMT threads. This information
1909ad6634eSVitaly Kuznetsov  is required by Windows and Hyper-V guests to properly mitigate SMT related CPU
1919ad6634eSVitaly Kuznetsov  vulnerabilities.
1929ad6634eSVitaly Kuznetsov
1939ad6634eSVitaly Kuznetsov  When the option is set to 'auto' QEMU will enable the feature only when KVM
1949ad6634eSVitaly Kuznetsov  reports that non-architectural coresharing is impossible, this means that
1959ad6634eSVitaly Kuznetsov  hyper-threading is not supported or completely disabled on the host. This
1969ad6634eSVitaly Kuznetsov  setting also prevents migration as SMT settings on the destination may differ.
1979ad6634eSVitaly Kuznetsov  When the option is set to 'on' QEMU will always enable the feature, regardless
1989ad6634eSVitaly Kuznetsov  of host setup. To keep guests secure, this can only be used in conjunction with
1999ad6634eSVitaly Kuznetsov  exposing correct vCPU topology and vCPU pinning.
2009ad6634eSVitaly Kuznetsov
2019ad6634eSVitaly Kuznetsov``hv-version-id-build``, ``hv-version-id-major``, ``hv-version-id-minor``, ``hv-version-id-spack``, ``hv-version-id-sbranch``, ``hv-version-id-snumber``
2029ad6634eSVitaly Kuznetsov  This changes Hyper-V version identification in CPUID 0x40000002.EAX-EDX from the
2039ad6634eSVitaly Kuznetsov  default (WS2016).
2049ad6634eSVitaly Kuznetsov
2059ad6634eSVitaly Kuznetsov  - ``hv-version-id-build`` sets 'Build Number' (32 bits)
2069ad6634eSVitaly Kuznetsov  - ``hv-version-id-major`` sets 'Major Version' (16 bits)
2079ad6634eSVitaly Kuznetsov  - ``hv-version-id-minor`` sets 'Minor Version' (16 bits)
2089ad6634eSVitaly Kuznetsov  - ``hv-version-id-spack`` sets 'Service Pack' (32 bits)
2099ad6634eSVitaly Kuznetsov  - ``hv-version-id-sbranch`` sets 'Service Branch' (8 bits)
2109ad6634eSVitaly Kuznetsov  - ``hv-version-id-snumber`` sets 'Service Number' (24 bits)
2119ad6634eSVitaly Kuznetsov
2129ad6634eSVitaly Kuznetsov  Note: hv-version-id-* are not enlightenments and thus don't enable Hyper-V
2139ad6634eSVitaly Kuznetsov  identification when specified without any other enlightenments.
2149ad6634eSVitaly Kuznetsov
2159ad6634eSVitaly Kuznetsov``hv-syndbg``
2169ad6634eSVitaly Kuznetsov  Enables Hyper-V synthetic debugger interface, this is a special interface used
2179ad6634eSVitaly Kuznetsov  by Windows Kernel debugger to send the packets through, rather than sending
2189ad6634eSVitaly Kuznetsov  them via serial/network .
2199ad6634eSVitaly Kuznetsov  When enabled, this enlightenment provides additional communication facilities
2209ad6634eSVitaly Kuznetsov  to the guest: SynDbg messages.
2219ad6634eSVitaly Kuznetsov  This new communication is used by Windows Kernel debugger rather than sending
2229ad6634eSVitaly Kuznetsov  packets via serial/network, adding significant performance boost over the other
2239ad6634eSVitaly Kuznetsov  comm channels.
2249ad6634eSVitaly Kuznetsov  This enlightenment requires a VMBus device (-device vmbus-bridge,irq=15).
2259ad6634eSVitaly Kuznetsov
2269ad6634eSVitaly Kuznetsov  Requires: ``hv-relaxed``, ``hv_time``, ``hv-vapic``, ``hv-vpindex``, ``hv-synic``, ``hv-runtime``, ``hv-stimer``
2279ad6634eSVitaly Kuznetsov
2289ad6634eSVitaly Kuznetsov``hv-emsr-bitmap``
2299ad6634eSVitaly Kuznetsov  The enlightenment is nested specific, it targets Hyper-V on KVM guests. When
2309ad6634eSVitaly Kuznetsov  enabled, it allows L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to
2319ad6634eSVitaly Kuznetsov  avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. While the protocol is
2329ad6634eSVitaly Kuznetsov  supported for both VMX (Intel) and SVM (AMD), the VMX implementation requires
2339ad6634eSVitaly Kuznetsov  Enlightened VMCS (``hv-evmcs``) feature to also be enabled.
2349ad6634eSVitaly Kuznetsov
2359ad6634eSVitaly Kuznetsov  Recommended: ``hv-evmcs`` (Intel)
2369ad6634eSVitaly Kuznetsov
2379ad6634eSVitaly Kuznetsov``hv-xmm-input``
2389ad6634eSVitaly Kuznetsov  Hyper-V specification allows to pass parameters for certain hypercalls using XMM
2399ad6634eSVitaly Kuznetsov  registers ("XMM Fast Hypercall Input"). When the feature is in use, it allows
2409ad6634eSVitaly Kuznetsov  for faster hypercalls processing as KVM can avoid reading guest's memory.
2419ad6634eSVitaly Kuznetsov
2429ad6634eSVitaly Kuznetsov``hv-tlbflush-ext``
2439ad6634eSVitaly Kuznetsov  Allow for extended GVA ranges to be passed to Hyper-V TLB flush hypercalls
2449ad6634eSVitaly Kuznetsov  (HvFlushVirtualAddressList/HvFlushVirtualAddressListEx).
2459ad6634eSVitaly Kuznetsov
2469ad6634eSVitaly Kuznetsov  Requires: ``hv-tlbflush``
2479ad6634eSVitaly Kuznetsov
2489ad6634eSVitaly Kuznetsov``hv-tlbflush-direct``
2499ad6634eSVitaly Kuznetsov  The enlightenment is nested specific, it targets Hyper-V on KVM guests. When
2509ad6634eSVitaly Kuznetsov  enabled, it allows L0 (KVM) to directly handle TLB flush hypercalls from L2
2519ad6634eSVitaly Kuznetsov  guest without the need to exit to L1 (Hyper-V) hypervisor. While the feature is
2529ad6634eSVitaly Kuznetsov  supported for both VMX (Intel) and SVM (AMD), the VMX implementation requires
2539ad6634eSVitaly Kuznetsov  Enlightened VMCS (``hv-evmcs``) feature to also be enabled.
2549ad6634eSVitaly Kuznetsov
2559ad6634eSVitaly Kuznetsov  Requires: ``hv-vapic``
2569ad6634eSVitaly Kuznetsov
2579ad6634eSVitaly Kuznetsov  Recommended: ``hv-evmcs`` (Intel)
2589ad6634eSVitaly Kuznetsov
2599ad6634eSVitaly KuznetsovSupplementary features
2609ad6634eSVitaly Kuznetsov----------------------
2619ad6634eSVitaly Kuznetsov
2629ad6634eSVitaly Kuznetsov``hv-passthrough``
2639ad6634eSVitaly Kuznetsov  In some cases (e.g. during development) it may make sense to use QEMU in
2649ad6634eSVitaly Kuznetsov  'pass-through' mode and give Windows guests all enlightenments currently
2657d7b9c76SVitaly Kuznetsov  supported by KVM.
2669ad6634eSVitaly Kuznetsov
2679ad6634eSVitaly Kuznetsov  Note: ``hv-passthrough`` flag only enables enlightenments which are known to QEMU
2689ad6634eSVitaly Kuznetsov  (have corresponding 'hv-' flag) and copies ``hv-spinlocks`` and ``hv-vendor-id``
2699ad6634eSVitaly Kuznetsov  values from KVM to QEMU. ``hv-passthrough`` overrides all other 'hv-' settings on
2707d7b9c76SVitaly Kuznetsov  the command line.
2717d7b9c76SVitaly Kuznetsov
2727d7b9c76SVitaly Kuznetsov  Note: ``hv-passthrough`` does not enable ``hv-syndbg`` which can prevent certain
2737d7b9c76SVitaly Kuznetsov  Windows guests from booting when used without proper configuration. If needed,
2747d7b9c76SVitaly Kuznetsov  ``hv-syndbg`` can be enabled additionally.
2757d7b9c76SVitaly Kuznetsov
2767d7b9c76SVitaly Kuznetsov  Note: ``hv-passthrough`` effectively prevents migration as the list of enabled
2777d7b9c76SVitaly Kuznetsov  enlightenments may differ between target and destination hosts.
2789ad6634eSVitaly Kuznetsov
2799ad6634eSVitaly Kuznetsov``hv-enforce-cpuid``
2809ad6634eSVitaly Kuznetsov  By default, KVM allows the guest to use all currently supported Hyper-V
2819ad6634eSVitaly Kuznetsov  enlightenments when Hyper-V CPUID interface was exposed, regardless of if
2829ad6634eSVitaly Kuznetsov  some features were not announced in guest visible CPUIDs. ``hv-enforce-cpuid``
2839ad6634eSVitaly Kuznetsov  feature alters this behavior and only allows the guest to use exposed Hyper-V
2849ad6634eSVitaly Kuznetsov  enlightenments.
2859ad6634eSVitaly Kuznetsov
286*45f51995SVitaly KuznetsovRecommendations
287*45f51995SVitaly Kuznetsov---------------
288*45f51995SVitaly Kuznetsov
289*45f51995SVitaly KuznetsovTo achieve the best performance of Windows and Hyper-V guests and unless there
290*45f51995SVitaly Kuznetsovare any specific requirements (e.g. migration to older QEMU/KVM versions,
291*45f51995SVitaly Kuznetsovemulating specific Hyper-V version, ...), it is recommended to enable all
292*45f51995SVitaly Kuznetsovcurrently implemented Hyper-V enlightenments with the following exceptions:
293*45f51995SVitaly Kuznetsov
294*45f51995SVitaly Kuznetsov- ``hv-syndbg``, ``hv-passthrough``, ``hv-enforce-cpuid`` should not be enabled
295*45f51995SVitaly Kuznetsov  in production configurations as these are debugging/development features.
296*45f51995SVitaly Kuznetsov- ``hv-reset`` can be avoided as modern Hyper-V versions don't expose it.
297*45f51995SVitaly Kuznetsov- ``hv-evmcs`` can (and should) be enabled on Intel CPUs only. While the feature
298*45f51995SVitaly Kuznetsov  is only used in nested configurations (Hyper-V, WSL2), enabling it for regular
299*45f51995SVitaly Kuznetsov  Windows guests should not have any negative effects.
300*45f51995SVitaly Kuznetsov- ``hv-no-nonarch-coresharing`` must only be enabled if vCPUs are properly pinned
301*45f51995SVitaly Kuznetsov  so no non-architectural core sharing is possible.
302*45f51995SVitaly Kuznetsov- ``hv-vendor-id``, ``hv-version-id-build``, ``hv-version-id-major``,
303*45f51995SVitaly Kuznetsov  ``hv-version-id-minor``, ``hv-version-id-spack``, ``hv-version-id-sbranch``,
304*45f51995SVitaly Kuznetsov  ``hv-version-id-snumber`` can be left unchanged, guests are not supposed to
305*45f51995SVitaly Kuznetsov  behave differently when different Hyper-V version is presented to them.
306*45f51995SVitaly Kuznetsov- ``hv-crash`` must only be enabled if the crash information is consumed via
307*45f51995SVitaly Kuznetsov  QAPI by higher levels of the virtualization stack. Enabling this feature
308*45f51995SVitaly Kuznetsov  effectively prevents Windows from creating dumps upon crashes.
309*45f51995SVitaly Kuznetsov- ``hv-reenlightenment`` can only be used on hardware which supports TSC
310*45f51995SVitaly Kuznetsov  scaling or when guest migration is not needed.
311*45f51995SVitaly Kuznetsov- ``hv-spinlocks`` should be set to e.g. 0xfff when host CPUs are overcommited
312*45f51995SVitaly Kuznetsov  (meaning there are other scheduled tasks or guests) and can be left unchanged
313*45f51995SVitaly Kuznetsov  from the default value (0xffffffff) otherwise.
314*45f51995SVitaly Kuznetsov- ``hv-avic``/``hv-apicv`` should not be enabled if the hardware does not
315*45f51995SVitaly Kuznetsov  support APIC virtualization (Intel APICv, AMD AVIC).
3169ad6634eSVitaly Kuznetsov
3179ad6634eSVitaly KuznetsovUseful links
3189ad6634eSVitaly Kuznetsov------------
3199ad6634eSVitaly KuznetsovHyper-V Top Level Functional specification and other information:
3209ad6634eSVitaly Kuznetsov
3219ad6634eSVitaly Kuznetsov- https://github.com/MicrosoftDocs/Virtualization-Documentation
3229ad6634eSVitaly Kuznetsov- https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/tlfs
3239ad6634eSVitaly Kuznetsov
324