18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci================= 48c2ecf20Sopenharmony_ciKVM-specific MSRs 58c2ecf20Sopenharmony_ci================= 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci:Author: Glauber Costa <glommer@redhat.com>, Red Hat Inc, 2010 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciKVM makes use of some custom MSRs to service some requests. 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciCustom MSRs have a range reserved for them, that goes from 128c2ecf20Sopenharmony_ci0x4b564d00 to 0x4b564dff. There are MSRs outside this area, 138c2ecf20Sopenharmony_cibut they are deprecated and their use is discouraged. 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciCustom MSR list 168c2ecf20Sopenharmony_ci--------------- 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciThe current supported Custom MSR list is: 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciMSR_KVM_WALL_CLOCK_NEW: 218c2ecf20Sopenharmony_ci 0x4b564d00 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cidata: 248c2ecf20Sopenharmony_ci 4-byte alignment physical address of a memory area which must be 258c2ecf20Sopenharmony_ci in guest RAM. This memory is expected to hold a copy of the following 268c2ecf20Sopenharmony_ci structure:: 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci struct pvclock_wall_clock { 298c2ecf20Sopenharmony_ci u32 version; 308c2ecf20Sopenharmony_ci u32 sec; 318c2ecf20Sopenharmony_ci u32 nsec; 328c2ecf20Sopenharmony_ci } __attribute__((__packed__)); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci whose data will be filled in by the hypervisor. The hypervisor is only 358c2ecf20Sopenharmony_ci guaranteed to update this data at the moment of MSR write. 368c2ecf20Sopenharmony_ci Users that want to reliably query this information more than once have 378c2ecf20Sopenharmony_ci to write more than once to this MSR. Fields have the following meanings: 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci version: 408c2ecf20Sopenharmony_ci guest has to check version before and after grabbing 418c2ecf20Sopenharmony_ci time information and check that they are both equal and even. 428c2ecf20Sopenharmony_ci An odd version indicates an in-progress update. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci sec: 458c2ecf20Sopenharmony_ci number of seconds for wallclock at time of boot. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci nsec: 488c2ecf20Sopenharmony_ci number of nanoseconds for wallclock at time of boot. 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci In order to get the current wallclock time, the system_time from 518c2ecf20Sopenharmony_ci MSR_KVM_SYSTEM_TIME_NEW needs to be added. 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci Note that although MSRs are per-CPU entities, the effect of this 548c2ecf20Sopenharmony_ci particular MSR is global. 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci Availability of this MSR must be checked via bit 3 in 0x4000001 cpuid 578c2ecf20Sopenharmony_ci leaf prior to usage. 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciMSR_KVM_SYSTEM_TIME_NEW: 608c2ecf20Sopenharmony_ci 0x4b564d01 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cidata: 638c2ecf20Sopenharmony_ci 4-byte aligned physical address of a memory area which must be in 648c2ecf20Sopenharmony_ci guest RAM, plus an enable bit in bit 0. This memory is expected to hold 658c2ecf20Sopenharmony_ci a copy of the following structure:: 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci struct pvclock_vcpu_time_info { 688c2ecf20Sopenharmony_ci u32 version; 698c2ecf20Sopenharmony_ci u32 pad0; 708c2ecf20Sopenharmony_ci u64 tsc_timestamp; 718c2ecf20Sopenharmony_ci u64 system_time; 728c2ecf20Sopenharmony_ci u32 tsc_to_system_mul; 738c2ecf20Sopenharmony_ci s8 tsc_shift; 748c2ecf20Sopenharmony_ci u8 flags; 758c2ecf20Sopenharmony_ci u8 pad[2]; 768c2ecf20Sopenharmony_ci } __attribute__((__packed__)); /* 32 bytes */ 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci whose data will be filled in by the hypervisor periodically. Only one 798c2ecf20Sopenharmony_ci write, or registration, is needed for each VCPU. The interval between 808c2ecf20Sopenharmony_ci updates of this structure is arbitrary and implementation-dependent. 818c2ecf20Sopenharmony_ci The hypervisor may update this structure at any time it sees fit until 828c2ecf20Sopenharmony_ci anything with bit0 == 0 is written to it. 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci Fields have the following meanings: 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci version: 878c2ecf20Sopenharmony_ci guest has to check version before and after grabbing 888c2ecf20Sopenharmony_ci time information and check that they are both equal and even. 898c2ecf20Sopenharmony_ci An odd version indicates an in-progress update. 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci tsc_timestamp: 928c2ecf20Sopenharmony_ci the tsc value at the current VCPU at the time 938c2ecf20Sopenharmony_ci of the update of this structure. Guests can subtract this value 948c2ecf20Sopenharmony_ci from current tsc to derive a notion of elapsed time since the 958c2ecf20Sopenharmony_ci structure update. 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci system_time: 988c2ecf20Sopenharmony_ci a host notion of monotonic time, including sleep 998c2ecf20Sopenharmony_ci time at the time this structure was last updated. Unit is 1008c2ecf20Sopenharmony_ci nanoseconds. 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci tsc_to_system_mul: 1038c2ecf20Sopenharmony_ci multiplier to be used when converting 1048c2ecf20Sopenharmony_ci tsc-related quantity to nanoseconds 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci tsc_shift: 1078c2ecf20Sopenharmony_ci shift to be used when converting tsc-related 1088c2ecf20Sopenharmony_ci quantity to nanoseconds. This shift will ensure that 1098c2ecf20Sopenharmony_ci multiplication with tsc_to_system_mul does not overflow. 1108c2ecf20Sopenharmony_ci A positive value denotes a left shift, a negative value 1118c2ecf20Sopenharmony_ci a right shift. 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci The conversion from tsc to nanoseconds involves an additional 1148c2ecf20Sopenharmony_ci right shift by 32 bits. With this information, guests can 1158c2ecf20Sopenharmony_ci derive per-CPU time by doing:: 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci time = (current_tsc - tsc_timestamp) 1188c2ecf20Sopenharmony_ci if (tsc_shift >= 0) 1198c2ecf20Sopenharmony_ci time <<= tsc_shift; 1208c2ecf20Sopenharmony_ci else 1218c2ecf20Sopenharmony_ci time >>= -tsc_shift; 1228c2ecf20Sopenharmony_ci time = (time * tsc_to_system_mul) >> 32 1238c2ecf20Sopenharmony_ci time = time + system_time 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci flags: 1268c2ecf20Sopenharmony_ci bits in this field indicate extended capabilities 1278c2ecf20Sopenharmony_ci coordinated between the guest and the hypervisor. Availability 1288c2ecf20Sopenharmony_ci of specific flags has to be checked in 0x40000001 cpuid leaf. 1298c2ecf20Sopenharmony_ci Current flags are: 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci +-----------+--------------+----------------------------------+ 1338c2ecf20Sopenharmony_ci | flag bit | cpuid bit | meaning | 1348c2ecf20Sopenharmony_ci +-----------+--------------+----------------------------------+ 1358c2ecf20Sopenharmony_ci | | | time measures taken across | 1368c2ecf20Sopenharmony_ci | 0 | 24 | multiple cpus are guaranteed to | 1378c2ecf20Sopenharmony_ci | | | be monotonic | 1388c2ecf20Sopenharmony_ci +-----------+--------------+----------------------------------+ 1398c2ecf20Sopenharmony_ci | | | guest vcpu has been paused by | 1408c2ecf20Sopenharmony_ci | 1 | N/A | the host | 1418c2ecf20Sopenharmony_ci | | | See 4.70 in api.txt | 1428c2ecf20Sopenharmony_ci +-----------+--------------+----------------------------------+ 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci Availability of this MSR must be checked via bit 3 in 0x4000001 cpuid 1458c2ecf20Sopenharmony_ci leaf prior to usage. 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ciMSR_KVM_WALL_CLOCK: 1498c2ecf20Sopenharmony_ci 0x11 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_cidata and functioning: 1528c2ecf20Sopenharmony_ci same as MSR_KVM_WALL_CLOCK_NEW. Use that instead. 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci This MSR falls outside the reserved KVM range and may be removed in the 1558c2ecf20Sopenharmony_ci future. Its usage is deprecated. 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci Availability of this MSR must be checked via bit 0 in 0x4000001 cpuid 1588c2ecf20Sopenharmony_ci leaf prior to usage. 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ciMSR_KVM_SYSTEM_TIME: 1618c2ecf20Sopenharmony_ci 0x12 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_cidata and functioning: 1648c2ecf20Sopenharmony_ci same as MSR_KVM_SYSTEM_TIME_NEW. Use that instead. 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci This MSR falls outside the reserved KVM range and may be removed in the 1678c2ecf20Sopenharmony_ci future. Its usage is deprecated. 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci Availability of this MSR must be checked via bit 0 in 0x4000001 cpuid 1708c2ecf20Sopenharmony_ci leaf prior to usage. 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci The suggested algorithm for detecting kvmclock presence is then:: 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci if (!kvm_para_available()) /* refer to cpuid.txt */ 1758c2ecf20Sopenharmony_ci return NON_PRESENT; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci flags = cpuid_eax(0x40000001); 1788c2ecf20Sopenharmony_ci if (flags & 3) { 1798c2ecf20Sopenharmony_ci msr_kvm_system_time = MSR_KVM_SYSTEM_TIME_NEW; 1808c2ecf20Sopenharmony_ci msr_kvm_wall_clock = MSR_KVM_WALL_CLOCK_NEW; 1818c2ecf20Sopenharmony_ci return PRESENT; 1828c2ecf20Sopenharmony_ci } else if (flags & 0) { 1838c2ecf20Sopenharmony_ci msr_kvm_system_time = MSR_KVM_SYSTEM_TIME; 1848c2ecf20Sopenharmony_ci msr_kvm_wall_clock = MSR_KVM_WALL_CLOCK; 1858c2ecf20Sopenharmony_ci return PRESENT; 1868c2ecf20Sopenharmony_ci } else 1878c2ecf20Sopenharmony_ci return NON_PRESENT; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ciMSR_KVM_ASYNC_PF_EN: 1908c2ecf20Sopenharmony_ci 0x4b564d02 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_cidata: 1938c2ecf20Sopenharmony_ci Asynchronous page fault (APF) control MSR. 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci Bits 63-6 hold 64-byte aligned physical address of a 64 byte memory area 1968c2ecf20Sopenharmony_ci which must be in guest RAM and must be zeroed. This memory is expected 1978c2ecf20Sopenharmony_ci to hold a copy of the following structure:: 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci struct kvm_vcpu_pv_apf_data { 2008c2ecf20Sopenharmony_ci /* Used for 'page not present' events delivered via #PF */ 2018c2ecf20Sopenharmony_ci __u32 flags; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci /* Used for 'page ready' events delivered via interrupt notification */ 2048c2ecf20Sopenharmony_ci __u32 token; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci __u8 pad[56]; 2078c2ecf20Sopenharmony_ci __u32 enabled; 2088c2ecf20Sopenharmony_ci }; 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci Bits 5-4 of the MSR are reserved and should be zero. Bit 0 is set to 1 2118c2ecf20Sopenharmony_ci when asynchronous page faults are enabled on the vcpu, 0 when disabled. 2128c2ecf20Sopenharmony_ci Bit 1 is 1 if asynchronous page faults can be injected when vcpu is in 2138c2ecf20Sopenharmony_ci cpl == 0. Bit 2 is 1 if asynchronous page faults are delivered to L1 as 2148c2ecf20Sopenharmony_ci #PF vmexits. Bit 2 can be set only if KVM_FEATURE_ASYNC_PF_VMEXIT is 2158c2ecf20Sopenharmony_ci present in CPUID. Bit 3 enables interrupt based delivery of 'page ready' 2168c2ecf20Sopenharmony_ci events. Bit 3 can only be set if KVM_FEATURE_ASYNC_PF_INT is present in 2178c2ecf20Sopenharmony_ci CPUID. 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci 'Page not present' events are currently always delivered as synthetic 2208c2ecf20Sopenharmony_ci #PF exception. During delivery of these events APF CR2 register contains 2218c2ecf20Sopenharmony_ci a token that will be used to notify the guest when missing page becomes 2228c2ecf20Sopenharmony_ci available. Also, to make it possible to distinguish between real #PF and 2238c2ecf20Sopenharmony_ci APF, first 4 bytes of 64 byte memory location ('flags') will be written 2248c2ecf20Sopenharmony_ci to by the hypervisor at the time of injection. Only first bit of 'flags' 2258c2ecf20Sopenharmony_ci is currently supported, when set, it indicates that the guest is dealing 2268c2ecf20Sopenharmony_ci with asynchronous 'page not present' event. If during a page fault APF 2278c2ecf20Sopenharmony_ci 'flags' is '0' it means that this is regular page fault. Guest is 2288c2ecf20Sopenharmony_ci supposed to clear 'flags' when it is done handling #PF exception so the 2298c2ecf20Sopenharmony_ci next event can be delivered. 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci Note, since APF 'page not present' events use the same exception vector 2328c2ecf20Sopenharmony_ci as regular page fault, guest must reset 'flags' to '0' before it does 2338c2ecf20Sopenharmony_ci something that can generate normal page fault. 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci Bytes 5-7 of 64 byte memory location ('token') will be written to by the 2368c2ecf20Sopenharmony_ci hypervisor at the time of APF 'page ready' event injection. The content 2378c2ecf20Sopenharmony_ci of these bytes is a token which was previously delivered as 'page not 2388c2ecf20Sopenharmony_ci present' event. The event indicates the page in now available. Guest is 2398c2ecf20Sopenharmony_ci supposed to write '0' to 'token' when it is done handling 'page ready' 2408c2ecf20Sopenharmony_ci event and to write 1' to MSR_KVM_ASYNC_PF_ACK after clearing the location; 2418c2ecf20Sopenharmony_ci writing to the MSR forces KVM to re-scan its queue and deliver the next 2428c2ecf20Sopenharmony_ci pending notification. 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci Note, MSR_KVM_ASYNC_PF_INT MSR specifying the interrupt vector for 'page 2458c2ecf20Sopenharmony_ci ready' APF delivery needs to be written to before enabling APF mechanism 2468c2ecf20Sopenharmony_ci in MSR_KVM_ASYNC_PF_EN or interrupt #0 can get injected. The MSR is 2478c2ecf20Sopenharmony_ci available if KVM_FEATURE_ASYNC_PF_INT is present in CPUID. 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci Note, previously, 'page ready' events were delivered via the same #PF 2508c2ecf20Sopenharmony_ci exception as 'page not present' events but this is now deprecated. If 2518c2ecf20Sopenharmony_ci bit 3 (interrupt based delivery) is not set APF events are not delivered. 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci If APF is disabled while there are outstanding APFs, they will 2548c2ecf20Sopenharmony_ci not be delivered. 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci Currently 'page ready' APF events will be always delivered on the 2578c2ecf20Sopenharmony_ci same vcpu as 'page not present' event was, but guest should not rely on 2588c2ecf20Sopenharmony_ci that. 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ciMSR_KVM_STEAL_TIME: 2618c2ecf20Sopenharmony_ci 0x4b564d03 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cidata: 2648c2ecf20Sopenharmony_ci 64-byte alignment physical address of a memory area which must be 2658c2ecf20Sopenharmony_ci in guest RAM, plus an enable bit in bit 0. This memory is expected to 2668c2ecf20Sopenharmony_ci hold a copy of the following structure:: 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci struct kvm_steal_time { 2698c2ecf20Sopenharmony_ci __u64 steal; 2708c2ecf20Sopenharmony_ci __u32 version; 2718c2ecf20Sopenharmony_ci __u32 flags; 2728c2ecf20Sopenharmony_ci __u8 preempted; 2738c2ecf20Sopenharmony_ci __u8 u8_pad[3]; 2748c2ecf20Sopenharmony_ci __u32 pad[11]; 2758c2ecf20Sopenharmony_ci } 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci whose data will be filled in by the hypervisor periodically. Only one 2788c2ecf20Sopenharmony_ci write, or registration, is needed for each VCPU. The interval between 2798c2ecf20Sopenharmony_ci updates of this structure is arbitrary and implementation-dependent. 2808c2ecf20Sopenharmony_ci The hypervisor may update this structure at any time it sees fit until 2818c2ecf20Sopenharmony_ci anything with bit0 == 0 is written to it. Guest is required to make sure 2828c2ecf20Sopenharmony_ci this structure is initialized to zero. 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci Fields have the following meanings: 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci version: 2878c2ecf20Sopenharmony_ci a sequence counter. In other words, guest has to check 2888c2ecf20Sopenharmony_ci this field before and after grabbing time information and make 2898c2ecf20Sopenharmony_ci sure they are both equal and even. An odd version indicates an 2908c2ecf20Sopenharmony_ci in-progress update. 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci flags: 2938c2ecf20Sopenharmony_ci At this point, always zero. May be used to indicate 2948c2ecf20Sopenharmony_ci changes in this structure in the future. 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci steal: 2978c2ecf20Sopenharmony_ci the amount of time in which this vCPU did not run, in 2988c2ecf20Sopenharmony_ci nanoseconds. Time during which the vcpu is idle, will not be 2998c2ecf20Sopenharmony_ci reported as steal time. 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci preempted: 3028c2ecf20Sopenharmony_ci indicate the vCPU who owns this struct is running or 3038c2ecf20Sopenharmony_ci not. Non-zero values mean the vCPU has been preempted. Zero 3048c2ecf20Sopenharmony_ci means the vCPU is not preempted. NOTE, it is always zero if the 3058c2ecf20Sopenharmony_ci the hypervisor doesn't support this field. 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ciMSR_KVM_EOI_EN: 3088c2ecf20Sopenharmony_ci 0x4b564d04 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_cidata: 3118c2ecf20Sopenharmony_ci Bit 0 is 1 when PV end of interrupt is enabled on the vcpu; 0 3128c2ecf20Sopenharmony_ci when disabled. Bit 1 is reserved and must be zero. When PV end of 3138c2ecf20Sopenharmony_ci interrupt is enabled (bit 0 set), bits 63-2 hold a 4-byte aligned 3148c2ecf20Sopenharmony_ci physical address of a 4 byte memory area which must be in guest RAM and 3158c2ecf20Sopenharmony_ci must be zeroed. 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci The first, least significant bit of 4 byte memory location will be 3188c2ecf20Sopenharmony_ci written to by the hypervisor, typically at the time of interrupt 3198c2ecf20Sopenharmony_ci injection. Value of 1 means that guest can skip writing EOI to the apic 3208c2ecf20Sopenharmony_ci (using MSR or MMIO write); instead, it is sufficient to signal 3218c2ecf20Sopenharmony_ci EOI by clearing the bit in guest memory - this location will 3228c2ecf20Sopenharmony_ci later be polled by the hypervisor. 3238c2ecf20Sopenharmony_ci Value of 0 means that the EOI write is required. 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci It is always safe for the guest to ignore the optimization and perform 3268c2ecf20Sopenharmony_ci the APIC EOI write anyway. 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci Hypervisor is guaranteed to only modify this least 3298c2ecf20Sopenharmony_ci significant bit while in the current VCPU context, this means that 3308c2ecf20Sopenharmony_ci guest does not need to use either lock prefix or memory ordering 3318c2ecf20Sopenharmony_ci primitives to synchronise with the hypervisor. 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci However, hypervisor can set and clear this memory bit at any time: 3348c2ecf20Sopenharmony_ci therefore to make sure hypervisor does not interrupt the 3358c2ecf20Sopenharmony_ci guest and clear the least significant bit in the memory area 3368c2ecf20Sopenharmony_ci in the window between guest testing it to detect 3378c2ecf20Sopenharmony_ci whether it can skip EOI apic write and between guest 3388c2ecf20Sopenharmony_ci clearing it to signal EOI to the hypervisor, 3398c2ecf20Sopenharmony_ci guest must both read the least significant bit in the memory area and 3408c2ecf20Sopenharmony_ci clear it using a single CPU instruction, such as test and clear, or 3418c2ecf20Sopenharmony_ci compare and exchange. 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ciMSR_KVM_POLL_CONTROL: 3448c2ecf20Sopenharmony_ci 0x4b564d05 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci Control host-side polling. 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cidata: 3498c2ecf20Sopenharmony_ci Bit 0 enables (1) or disables (0) host-side HLT polling logic. 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci KVM guests can request the host not to poll on HLT, for example if 3528c2ecf20Sopenharmony_ci they are performing polling themselves. 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ciMSR_KVM_ASYNC_PF_INT: 3558c2ecf20Sopenharmony_ci 0x4b564d06 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_cidata: 3588c2ecf20Sopenharmony_ci Second asynchronous page fault (APF) control MSR. 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci Bits 0-7: APIC vector for delivery of 'page ready' APF events. 3618c2ecf20Sopenharmony_ci Bits 8-63: Reserved 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci Interrupt vector for asynchnonous 'page ready' notifications delivery. 3648c2ecf20Sopenharmony_ci The vector has to be set up before asynchronous page fault mechanism 3658c2ecf20Sopenharmony_ci is enabled in MSR_KVM_ASYNC_PF_EN. The MSR is only available if 3668c2ecf20Sopenharmony_ci KVM_FEATURE_ASYNC_PF_INT is present in CPUID. 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ciMSR_KVM_ASYNC_PF_ACK: 3698c2ecf20Sopenharmony_ci 0x4b564d07 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_cidata: 3728c2ecf20Sopenharmony_ci Asynchronous page fault (APF) acknowledgment. 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci When the guest is done processing 'page ready' APF event and 'token' 3758c2ecf20Sopenharmony_ci field in 'struct kvm_vcpu_pv_apf_data' is cleared it is supposed to 3768c2ecf20Sopenharmony_ci write '1' to bit 0 of the MSR, this causes the host to re-scan its queue 3778c2ecf20Sopenharmony_ci and check if there are more notifications pending. The MSR is available 3788c2ecf20Sopenharmony_ci if KVM_FEATURE_ASYNC_PF_INT is present in CPUID. 379