• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. SPDX-License-Identifier: GPL-2.0
2
3==============
4KVM CPUID bits
5==============
6
7:Author: Glauber Costa <glommer@gmail.com>
8
9A guest running on a kvm host, can check some of its features using
10cpuid. This is not always guaranteed to work, since userspace can
11mask-out some, or even all KVM-related cpuid features before launching
12a guest.
13
14KVM cpuid functions are:
15
16function: KVM_CPUID_SIGNATURE (0x40000000)
17
18returns::
19
20   eax = 0x40000001
21   ebx = 0x4b4d564b
22   ecx = 0x564b4d56
23   edx = 0x4d
24
25Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM".
26The value in eax corresponds to the maximum cpuid function present in this leaf,
27and will be updated if more functions are added in the future.
28Note also that old hosts set eax value to 0x0. This should
29be interpreted as if the value was 0x40000001.
30This function queries the presence of KVM cpuid leafs.
31
32function: define KVM_CPUID_FEATURES (0x40000001)
33
34returns::
35
36          ebx, ecx
37          eax = an OR'ed group of (1 << flag)
38
39where ``flag`` is defined as below:
40
41================================= =========== ================================
42flag                              value       meaning
43================================= =========== ================================
44KVM_FEATURE_CLOCKSOURCE           0           kvmclock available at msrs
45                                              0x11 and 0x12
46
47KVM_FEATURE_NOP_IO_DELAY          1           not necessary to perform delays
48                                              on PIO operations
49
50KVM_FEATURE_MMU_OP                2           deprecated
51
52KVM_FEATURE_CLOCKSOURCE2          3           kvmclock available at msrs
53
54                                              0x4b564d00 and 0x4b564d01
55KVM_FEATURE_ASYNC_PF              4           async pf can be enabled by
56                                              writing to msr 0x4b564d02
57
58KVM_FEATURE_STEAL_TIME            5           steal time can be enabled by
59                                              writing to msr 0x4b564d03
60
61KVM_FEATURE_PV_EOI                6           paravirtualized end of interrupt
62                                              handler can be enabled by
63                                              writing to msr 0x4b564d04
64
65KVM_FEATURE_PV_UNHAULT            7           guest checks this feature bit
66                                              before enabling paravirtualized
67                                              spinlock support
68
69KVM_FEATURE_PV_TLB_FLUSH          9           guest checks this feature bit
70                                              before enabling paravirtualized
71                                              tlb flush
72
73KVM_FEATURE_ASYNC_PF_VMEXIT       10          paravirtualized async PF VM EXIT
74                                              can be enabled by setting bit 2
75                                              when writing to msr 0x4b564d02
76
77KVM_FEATURE_PV_SEND_IPI           11          guest checks this feature bit
78                                              before enabling paravirtualized
79                                              sebd IPIs
80
81KVM_FEATURE_PV_POLL_CONTROL       12          host-side polling on HLT can
82                                              be disabled by writing
83                                              to msr 0x4b564d05.
84
85KVM_FEATURE_PV_SCHED_YIELD        13          guest checks this feature bit
86                                              before using paravirtualized
87                                              sched yield.
88
89KVM_FEATURE_CLOCSOURCE_STABLE_BIT 24          host will warn if no guest-side
90                                              per-cpu warps are expeced in
91                                              kvmclock
92================================= =========== ================================
93
94::
95
96      edx = an OR'ed group of (1 << flag)
97
98Where ``flag`` here is defined as below:
99
100================== ============ =================================
101flag               value        meaning
102================== ============ =================================
103KVM_HINTS_REALTIME 0            guest checks this feature bit to
104                                determine that vCPUs are never
105                                preempted for an unlimited time
106                                allowing optimizations
107================== ============ =================================
108