From 04d82e5c0fc2a51e6b8b29094f767ed511f2c471 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Tue, 4 Jun 2019 19:24:26 +0800 Subject: [PATCH] HV: return virtual lapic id in vcpuid 0b leaf Currently vlapic id of SOS VM is virtualized, it is indexed by vcpuid in physical APIC id sequence, but CPUID 0BH leaf still report physical APIC ID. In SDC/INDUSTRY scenario they are identical mapping so no issue occured. In hybrid mode this would be a problem because vAPIC ID might be different with pAPIC ID. We need to make the APIC ID which returned from CPUID consistent with the one returned from LAPIC register. Tracked-On: #3214 Signed-off-by: Victor Sun Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vcpuid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/arch/x86/guest/vcpuid.c b/hypervisor/arch/x86/guest/vcpuid.c index 1abcea936..8d0c7b99b 100644 --- a/hypervisor/arch/x86/guest/vcpuid.c +++ b/hypervisor/arch/x86/guest/vcpuid.c @@ -425,7 +425,6 @@ static void guest_cpuid_0bh(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx cpuid_subleaf(leaf, subleaf, eax, ebx, ecx, edx); } else { *ecx = subleaf & 0xFFU; - *edx = vlapic_get_apicid(vcpu_vlapic(vcpu)); /* No HT emulation for UOS */ switch (subleaf) { case 0U: @@ -449,6 +448,7 @@ static void guest_cpuid_0bh(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx break; } } + *edx = vlapic_get_apicid(vcpu_vlapic(vcpu)); } static void guest_cpuid_0dh(__unused struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)