Merge tag 'linux-kselftest-kunit-fixes-5.11-rc3' of git://git.kernel.org/pub/scm...
[linux/fpc-iii.git] / Documentation / virt / kvm / cpuid.rst
blobcf62162d4be207e5e9f8beaecf2f044cb7352d8a
1 .. SPDX-License-Identifier: GPL-2.0
3 ==============
4 KVM CPUID bits
5 ==============
7 :Author: Glauber Costa <glommer@gmail.com>
9 A guest running on a kvm host, can check some of its features using
10 cpuid. This is not always guaranteed to work, since userspace can
11 mask-out some, or even all KVM-related cpuid features before launching
12 a guest.
14 KVM cpuid functions are:
16 function: KVM_CPUID_SIGNATURE (0x40000000)
18 returns::
20    eax = 0x40000001
21    ebx = 0x4b4d564b
22    ecx = 0x564b4d56
23    edx = 0x4d
25 Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM".
26 The value in eax corresponds to the maximum cpuid function present in this leaf,
27 and will be updated if more functions are added in the future.
28 Note also that old hosts set eax value to 0x0. This should
29 be interpreted as if the value was 0x40000001.
30 This function queries the presence of KVM cpuid leafs.
32 function: define KVM_CPUID_FEATURES (0x40000001)
34 returns::
36           ebx, ecx
37           eax = an OR'ed group of (1 << flag)
39 where ``flag`` is defined as below:
41 ================================== =========== ================================
42 flag                               value       meaning
43 ================================== =========== ================================
44 KVM_FEATURE_CLOCKSOURCE            0           kvmclock available at msrs
45                                                0x11 and 0x12
47 KVM_FEATURE_NOP_IO_DELAY           1           not necessary to perform delays
48                                                on PIO operations
50 KVM_FEATURE_MMU_OP                 2           deprecated
52 KVM_FEATURE_CLOCKSOURCE2           3           kvmclock available at msrs
53                                                0x4b564d00 and 0x4b564d01
55 KVM_FEATURE_ASYNC_PF               4           async pf can be enabled by
56                                                writing to msr 0x4b564d02
58 KVM_FEATURE_STEAL_TIME             5           steal time can be enabled by
59                                                writing to msr 0x4b564d03
61 KVM_FEATURE_PV_EOI                 6           paravirtualized end of interrupt
62                                                handler can be enabled by
63                                                writing to msr 0x4b564d04
65 KVM_FEATURE_PV_UNHALT              7           guest checks this feature bit
66                                                before enabling paravirtualized
67                                                spinlock support
69 KVM_FEATURE_PV_TLB_FLUSH           9           guest checks this feature bit
70                                                before enabling paravirtualized
71                                                tlb flush
73 KVM_FEATURE_ASYNC_PF_VMEXIT        10          paravirtualized async PF VM EXIT
74                                                can be enabled by setting bit 2
75                                                when writing to msr 0x4b564d02
77 KVM_FEATURE_PV_SEND_IPI            11          guest checks this feature bit
78                                                before enabling paravirtualized
79                                                send IPIs
81 KVM_FEATURE_POLL_CONTROL           12          host-side polling on HLT can
82                                                be disabled by writing
83                                                to msr 0x4b564d05.
85 KVM_FEATURE_PV_SCHED_YIELD         13          guest checks this feature bit
86                                                before using paravirtualized
87                                                sched yield.
89 KVM_FEATURE_ASYNC_PF_INT           14          guest checks this feature bit
90                                                before using the second async
91                                                pf control msr 0x4b564d06 and
92                                                async pf acknowledgment msr
93                                                0x4b564d07.
95 KVM_FEATURE_MSI_EXT_DEST_ID        15          guest checks this feature bit
96                                                before using extended destination
97                                                ID bits in MSI address bits 11-5.
99 KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24          host will warn if no guest-side
100                                                per-cpu warps are expected in
101                                                kvmclock
102 ================================== =========== ================================
106       edx = an OR'ed group of (1 << flag)
108 Where ``flag`` here is defined as below:
110 ================== ============ =================================
111 flag               value        meaning
112 ================== ============ =================================
113 KVM_HINTS_REALTIME 0            guest checks this feature bit to
114                                 determine that vCPUs are never
115                                 preempted for an unlimited time
116                                 allowing optimizations
117 ================== ============ =================================