Page MenuHomeFreeBSD

x86: Add zen identifier helper function
ClosedPublic

Authored by aokblast on Thu, Apr 9, 1:30 PM.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/x86/include/x86_var.h
135 ↗(On Diff #175179)

Will fix it before commit

sys/x86/x86/identcpu.c
2730

Can this be a table of {family, model_min, model_max} ?

Use structure instead of ifdef.

sys/x86/include/specialreg.h
307 ↗(On Diff #175219)

The constants are not from CPUID. Pleae use some different namespace for them. I think just CPU_AMD_ZENx is fine.

Also, specialreg.h is for the hardware registers definitions. Better to place them in some other place, might be machine/cpu.h.
Then it seems logical to move the function prototype there, as well.

sys/x86/x86/identcpu.c
2730

This requires the table to be sorted. At least, a comment is needed in the table herald.

Can we scan the whole table?

This was also a requirement for https://reviews.freebsd.org/D56332 and should be useless now. However, amdtemp driver now hardcode this zen detection logic in the amdtemp.c file, we can use ident_zen_cpu to refactor the amdtemp code.

sys/x86/include/specialreg.h
307 ↗(On Diff #175219)

machine/cpu.h has i386 and amd64 variant. Can we put in x86/cputypes.h?

sys/x86/include/specialreg.h
307 ↗(On Diff #175219)

Yes, and it looks even more appropriate than what I proposed.

Loop the whole array and put the macro to other file

sys/x86/include/x86_var.h
135 ↗(On Diff #175179)

I still suggest to move the prototype to cputypes.h, perhaps under #ifdef _KERNEL.

This revision is now accepted and ready to land.Fri, Apr 10, 12:50 PM
sys/x86/include/cputypes.h
54

Emm, It breaks again. I will fix it before merging.

This revision was automatically updated to reflect the committed changes.