hv: fix cpuid 0x2 mismatch when launch RTVM use atom core
When CPUID executes with EAX set to 02H, the processor returns information about cache and TLB information. This information is percpu related, and should be obtained directly from the physical cpu. BTW, this patch is backported from v2.7 branch. Tracked-On: #6931 Signed-off-by: Tw <wei.tan@intel.com> Reviewed-by: Fei Li <fei1.li@intel.com>
This commit is contained in:
parent
6458a3f474
commit
deb35a0de9
|
@ -490,6 +490,11 @@ static int32_t set_vcpuid_extended_function(struct acrn_vm *vm)
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline bool is_percpu_related(uint32_t leaf)
|
||||
{
|
||||
return ((leaf == 0x1U) || (leaf == 0xbU) || (leaf == 0xdU) || (leaf == 0x19U) || (leaf == 0x80000001U) || (leaf == 0x2U));
|
||||
}
|
||||
|
||||
int32_t set_vcpuid_entries(struct acrn_vm *vm)
|
||||
{
|
||||
int32_t result;
|
||||
|
@ -509,8 +514,7 @@ int32_t set_vcpuid_entries(struct acrn_vm *vm)
|
|||
vm->vcpuid_level = limit;
|
||||
|
||||
for (i = 1U; i <= limit; i++) {
|
||||
/* cpuid 1/0xb is percpu related */
|
||||
if ((i == 1U) || (i == 0xbU) || (i == 0xdU) || (i == 0x19U)) {
|
||||
if (is_percpu_related(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -604,11 +608,6 @@ int32_t set_vcpuid_entries(struct acrn_vm *vm)
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline bool is_percpu_related(uint32_t leaf)
|
||||
{
|
||||
return ((leaf == 0x1U) || (leaf == 0xbU) || (leaf == 0xdU) || (leaf == 0x19U) || (leaf == 0x80000001U));
|
||||
}
|
||||
|
||||
static void guest_cpuid_01h(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
{
|
||||
uint32_t apicid = vlapic_get_apicid(vcpu_vlapic(vcpu));
|
||||
|
@ -850,11 +849,11 @@ void guest_cpuid(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx, uint32_t
|
|||
|
||||
default:
|
||||
/*
|
||||
* In this switch statement, leaf shall either be 0x01U or 0x0bU
|
||||
* or 0x0dU or 0x80000001U. All the other cases have been handled properly
|
||||
* before this switch statement.
|
||||
* Gracefully return if prior case clauses have not been met.
|
||||
* In this switch statement, leaf 0x01/0x0b/0x0d/0x19/0x80000001
|
||||
* shall be handled specifically. All the other cases
|
||||
* just return physical value.
|
||||
*/
|
||||
cpuid_subleaf(leaf, *ecx, eax, ebx, ecx, edx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue