Skip to content

Commit eeec065

Browse files
committed
arch: x86_64: recommend Hyper-V paravirt TLB flush and cluster IPI
Adds three recommendation bits to CPUID 0x40000004.EAX so Windows / Hyper-V- aware guests use the corresponding paravirtualized hypercalls instead of falling back to architectural primitives. The hypercalls themselves are emulated unconditionally by KVM and surfaced via the corresponding KVM_CAP_HYPERV_* info caps; no userspace cap negotiation is needed because KVM advertises support to the guest at hypercall-issue time: KVM_CAP_HYPERV_TLBFLUSH advertises HvFlush{VirtualAddressSpace,Ex,List, ListEx} (per Documentation/virt/kvm/api.rst §8.18, "Architectures: x86" — info-only cap). KVM_CAP_HYPERV_SEND_IPI advertises HvCallSendSyntheticClusterIpi{,Ex} (api.rst §8.20, also info-only). Leaf 0x40000004.EAX (HV_CPUID_ENLIGHTMENT_INFO): bit 1 LocalTlbFlushRecommended bit 2 RemoteTlbFlushRecommended These recommend HvFlushVirtualAddressSpace / HvFlushVirtualAddress List in place of architectural INVPCID / INVLPG broadcasts. Remote TLB shoot-down via hypercall lets the host skip vCPUs that are not currently scheduled, instead of waiting for them to receive and ack the IPI. bit 10 ClusterIpiRecommended Recommends HvCallSendSyntheticClusterIpi over per-target APIC ICR writes. A single hypercall can target up to 64 vCPUs (or all of them via the Ex variant) versus one VM exit per APIC access on the architectural path. These bits depend on AccessVpIndex (0x40000003.EAX bit 6), which is now advertised after the partition-privileges fix. Sources: Microsoft Hypervisor Top-Level Functional Specification 7.4.5 qemu/qemu docs/system/i386/hyperv.rst (hv-tlbflush, hv-ipi) Linux Documentation/virt/kvm/api.rst §8.18, §8.20
1 parent 255a73c commit eeec065

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

arch/src/x86_64/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,10 @@ fn required_common_cpuid_updates(
872872
});
873873
cpuid.push(CpuIdEntry {
874874
function: 0x4000_0004,
875-
eax: 1 << 5, // Recommend relaxed timing
875+
eax: (1 << 1) // LocalTlbFlushRecommended
876+
| (1 << 2) // RemoteTlbFlushRecommended
877+
| (1 << 5) // RelaxedTimingRecommended
878+
| (1 << 10), // ClusterIpiRecommended (HvCallSendSyntheticClusterIpi)
876879
..Default::default()
877880
});
878881
for i in 0x4000_0005..=0x4000_000a {

0 commit comments

Comments
 (0)