-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x86: set ApicId in cpuid for each vcpu #5512
Conversation
I took a build of @jongwu's branch and it appears to address the issue. I am no longer hitting this with the same repro conditions described in the issue. Summary: |
let cpuid = core::arch::x86_64::__cpuid(1); | ||
cpu_ebx = cpuid.ebx | ||
} | ||
cpu_ebx &= 0xffffff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can simplify this a bit...
let mut cpu_ebx = { unsafe core::arch::x86_64::__cpuid(1) }.ebx;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks @rbradford
After this has landed, one can see then whether the Windows guest integration tests can be restored on CI. Also, for AMD, encoding the APIC ID into the topology is required, so this value set here could be probably reused at some other place. Thanks |
Program the APIC ID (CPUID leaf 0x1 EBX) with the CPU id. This resolves an issue where the EDKII firmware expects the APIC ID to vary per-CPU. Fixes: cloud-hypervisor#5475 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
When start clh from edk2 with vcpu number larger than 2, edk2 will crash at Ap initialization. The root cause is that when get ApicId from cpuid, it returns a wrong value that ApicId is the same for each Ap. Further more, stack selection depends on ApicId, that leads to all Aps share the same stack space.
Explicitly set ApicId in cpuid for each vcpu can solve this issue.
Fixes: #5475