HomeFreeBSD

x86/cpu: improve hypervisor detection

Description

x86/cpu: improve hypervisor detection

Some hypervisors can expose multiple signatures, for example Xen will expose
both the Xen and the HyperV signatures if Viridian extensions are enabled for
the guest. Presence of multiple signatures is currently not handled by
FreeBSD, that will exit once a known signature is found in cpuid output.

Exposing the HyperV signature on hypervisors different than HyperV is not
uncommon, this is done so that such hypervisor can expose a (subset) of the
Viridian extensions to Windows guests for performance reasons. Likely for
compatibility purposes the HyperV signature is always exposed on the first
leaf, and the Xen signature is exposed in the secondary leaf.

Fix the specific case of HyperV by not exiting from the scan if the HyperV
signature is found, and prefer a second signature if one is found.

Note that long term we might wish to convert vm_guest into a bitmap, so that it
can signal detection of multiple hypervisor interfaces.

Fixes: b0165dc4539f ('x86/xen: fix HVM guest hypercall page setup')
PR: 276421
Sponsored by: Cloud Software Group
Reviewed by: markj kib
Differential revision: https://reviews.freebsd.org/D43508

Details

Provenance
roygerAuthored on Jan 19 2024, 9:15 AM
Reviewer
markj
Differential Revision
D43508: x86/cpu: improve hypervisor detection
Parents
rG399386f190f1: x86/xen: introduce non-hypercall based emergency print
Branches
Unknown
Tags
Unknown