0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 ==============
0004 KVM CPUID bits
0005 ==============
0006
0007 :Author: Glauber Costa <glommer@gmail.com>
0008
0009 A guest running on a kvm host, can check some of its features using
0010 cpuid. This is not always guaranteed to work, since userspace can
0011 mask-out some, or even all KVM-related cpuid features before launching
0012 a guest.
0013
0014 KVM cpuid functions are:
0015
0016 function: KVM_CPUID_SIGNATURE (0x40000000)
0017
0018 returns::
0019
0020 eax = 0x40000001
0021 ebx = 0x4b4d564b
0022 ecx = 0x564b4d56
0023 edx = 0x4d
0024
0025 Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM".
0026 The value in eax corresponds to the maximum cpuid function present in this leaf,
0027 and will be updated if more functions are added in the future.
0028 Note also that old hosts set eax value to 0x0. This should
0029 be interpreted as if the value was 0x40000001.
0030 This function queries the presence of KVM cpuid leafs.
0031
0032 function: define KVM_CPUID_FEATURES (0x40000001)
0033
0034 returns::
0035
0036 ebx, ecx
0037 eax = an OR'ed group of (1 << flag)
0038
0039 where ``flag`` is defined as below:
0040
0041 ================================== =========== ================================
0042 flag value meaning
0043 ================================== =========== ================================
0044 KVM_FEATURE_CLOCKSOURCE 0 kvmclock available at msrs
0045 0x11 and 0x12
0046
0047 KVM_FEATURE_NOP_IO_DELAY 1 not necessary to perform delays
0048 on PIO operations
0049
0050 KVM_FEATURE_MMU_OP 2 deprecated
0051
0052 KVM_FEATURE_CLOCKSOURCE2 3 kvmclock available at msrs
0053 0x4b564d00 and 0x4b564d01
0054
0055 KVM_FEATURE_ASYNC_PF 4 async pf can be enabled by
0056 writing to msr 0x4b564d02
0057
0058 KVM_FEATURE_STEAL_TIME 5 steal time can be enabled by
0059 writing to msr 0x4b564d03
0060
0061 KVM_FEATURE_PV_EOI 6 paravirtualized end of interrupt
0062 handler can be enabled by
0063 writing to msr 0x4b564d04
0064
0065 KVM_FEATURE_PV_UNHALT 7 guest checks this feature bit
0066 before enabling paravirtualized
0067 spinlock support
0068
0069 KVM_FEATURE_PV_TLB_FLUSH 9 guest checks this feature bit
0070 before enabling paravirtualized
0071 tlb flush
0072
0073 KVM_FEATURE_ASYNC_PF_VMEXIT 10 paravirtualized async PF VM EXIT
0074 can be enabled by setting bit 2
0075 when writing to msr 0x4b564d02
0076
0077 KVM_FEATURE_PV_SEND_IPI 11 guest checks this feature bit
0078 before enabling paravirtualized
0079 send IPIs
0080
0081 KVM_FEATURE_POLL_CONTROL 12 host-side polling on HLT can
0082 be disabled by writing
0083 to msr 0x4b564d05.
0084
0085 KVM_FEATURE_PV_SCHED_YIELD 13 guest checks this feature bit
0086 before using paravirtualized
0087 sched yield.
0088
0089 KVM_FEATURE_ASYNC_PF_INT 14 guest checks this feature bit
0090 before using the second async
0091 pf control msr 0x4b564d06 and
0092 async pf acknowledgment msr
0093 0x4b564d07.
0094
0095 KVM_FEATURE_MSI_EXT_DEST_ID 15 guest checks this feature bit
0096 before using extended destination
0097 ID bits in MSI address bits 11-5.
0098
0099 KVM_FEATURE_HC_MAP_GPA_RANGE 16 guest checks this feature bit before
0100 using the map gpa range hypercall
0101 to notify the page state change
0102
0103 KVM_FEATURE_MIGRATION_CONTROL 17 guest checks this feature bit before
0104 using MSR_KVM_MIGRATION_CONTROL
0105
0106 KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 host will warn if no guest-side
0107 per-cpu warps are expected in
0108 kvmclock
0109 ================================== =========== ================================
0110
0111 ::
0112
0113 edx = an OR'ed group of (1 << flag)
0114
0115 Where ``flag`` here is defined as below:
0116
0117 ================== ============ =================================
0118 flag value meaning
0119 ================== ============ =================================
0120 KVM_HINTS_REALTIME 0 guest checks this feature bit to
0121 determine that vCPUs are never
0122 preempted for an unlimited time
0123 allowing optimizations
0124 ================== ============ =================================