xen: fix setting legacy PVH vcpu id
The recommended way to obtain the vcpu id is using the cpuid instruction with a specific leaf value. This leaf value must be obtained at runtime, and it's done when populating the hypercall page. Legacy PVH however will get the hypercall page populated by the hypervisor itself before booting, so the cpuid leaf was not actually set, thus preventing setting the vcpu id value from cpuid. Fix this by making sure the cpuid leaf has been probed before attempting to set the vcpu id. Approved by: re (gjb) Sponsored by: Citrix Systems R&D
This commit is contained in:
parent
4fcd5f3003
commit
4edbde911b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338629
@ -163,6 +163,12 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
|
||||
{
|
||||
uint32_t regs[4];
|
||||
|
||||
/* Legacy PVH will get here without the cpuid leaf being set. */
|
||||
if (cpuid_base == 0)
|
||||
cpuid_base = xen_hvm_cpuid_base();
|
||||
if (cpuid_base == 0)
|
||||
return (ENXIO);
|
||||
|
||||
if (xen_domain() && init_type == XEN_HVM_INIT_LATE) {
|
||||
/*
|
||||
* If the domain type is already set we can assume that the
|
||||
@ -173,10 +179,6 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cpuid_base = xen_hvm_cpuid_base();
|
||||
if (cpuid_base == 0)
|
||||
return (ENXIO);
|
||||
|
||||
if (init_type == XEN_HVM_INIT_LATE)
|
||||
hypervisor_version();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user