brintos

brintos / linux-shallow public Read only

0
0
Text · 5.3 KiB · bda3e3e Raw
125 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3==============4KVM CPUID bits5==============6 7:Author: Glauber Costa <glommer@gmail.com>8 9A guest running on a kvm host, can check some of its features using10cpuid. This is not always guaranteed to work, since userspace can11mask-out some, or even all KVM-related cpuid features before launching12a guest.13 14KVM cpuid functions are:15 16function: KVM_CPUID_SIGNATURE (0x40000000)17 18returns::19 20   eax = 0x4000000121   ebx = 0x4b4d564b22   ecx = 0x564b4d5623   edx = 0x4d24 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 should29be 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, ecx37          eax = an OR'ed group of (1 << flag)38 39where ``flag`` is defined as below:40 41================================== =========== ================================42flag                               value       meaning43================================== =========== ================================44KVM_FEATURE_CLOCKSOURCE            0           kvmclock available at msrs45                                               0x11 and 0x1246 47KVM_FEATURE_NOP_IO_DELAY           1           not necessary to perform delays48                                               on PIO operations49 50KVM_FEATURE_MMU_OP                 2           deprecated51 52KVM_FEATURE_CLOCKSOURCE2           3           kvmclock available at msrs53                                               0x4b564d00 and 0x4b564d0154 55KVM_FEATURE_ASYNC_PF               4           async pf can be enabled by56                                               writing to msr 0x4b564d0257 58KVM_FEATURE_STEAL_TIME             5           steal time can be enabled by59                                               writing to msr 0x4b564d0360 61KVM_FEATURE_PV_EOI                 6           paravirtualized end of interrupt62                                               handler can be enabled by63                                               writing to msr 0x4b564d0464 65KVM_FEATURE_PV_UNHALT              7           guest checks this feature bit66                                               before enabling paravirtualized67                                               spinlock support68 69KVM_FEATURE_PV_TLB_FLUSH           9           guest checks this feature bit70                                               before enabling paravirtualized71                                               tlb flush72 73KVM_FEATURE_ASYNC_PF_VMEXIT        10          paravirtualized async PF VM EXIT74                                               can be enabled by setting bit 275                                               when writing to msr 0x4b564d0276 77KVM_FEATURE_PV_SEND_IPI            11          guest checks this feature bit78                                               before enabling paravirtualized79                                               send IPIs80 81KVM_FEATURE_POLL_CONTROL           12          host-side polling on HLT can82                                               be disabled by writing83                                               to msr 0x4b564d05.84 85KVM_FEATURE_PV_SCHED_YIELD         13          guest checks this feature bit86                                               before using paravirtualized87                                               sched yield.88 89KVM_FEATURE_ASYNC_PF_INT           14          guest checks this feature bit90                                               before using the second async91                                               pf control msr 0x4b564d06 and92                                               async pf acknowledgment msr93                                               0x4b564d07.94 95KVM_FEATURE_MSI_EXT_DEST_ID        15          guest checks this feature bit96                                               before using extended destination97                                               ID bits in MSI address bits 11-5.98 99KVM_FEATURE_HC_MAP_GPA_RANGE       16          guest checks this feature bit before100                                               using the map gpa range hypercall101                                               to notify the page state change102 103KVM_FEATURE_MIGRATION_CONTROL      17          guest checks this feature bit before104                                               using MSR_KVM_MIGRATION_CONTROL105 106KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24          host will warn if no guest-side107                                               per-cpu warps are expected in108                                               kvmclock109================================== =========== ================================110 111::112 113      edx = an OR'ed group of (1 << flag)114 115Where ``flag`` here is defined as below:116 117================== ============ =================================118flag               value        meaning119================== ============ =================================120KVM_HINTS_REALTIME 0            guest checks this feature bit to121                                determine that vCPUs are never122                                preempted for an unlimited time123                                allowing optimizations124================== ============ =================================125