On Tue, Jun 06, 2017 at 12:15:30PM +0200, Peter Zijlstra wrote:Okay. I can send a v2 with the changes.
Maybe something like:if (!(eax & 0x1f))
for (cache_level = 0; cache_level < 3; cache_level++) {
cpuid_count(0x8000001d, cache_level, &eax, &ebx, &ecx, &edx);
if ((eax & 0x1f) == 0) /* EAX[0:4] gives cache type */
break;Yap, especially if there are CPUID functions with subleafs with holes in
prev_eax = eax;
}
That way we'll not run off into the woods if CPUID goes funny (never
trust a BIOS/virt monkey).
them.