Add Zhaoxin support to enable tsc_reliable and arch_random features
PATCH 1/1 Add Zhaoxin support to enable tsc_reliable and arch_random features
Signed-off-by Runa Guo-oc <[email protected]>
--- arch/arch-x86-common.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
arch/arch-x86-common.h +29 -0
@@ -56,6 +56,33 @@ static inline void arch_init_amd(void) tsc_reliable = (edx & (1U <<8 )) !=0 ; } +static inline void arch_init_zhaoxin (void ) +{ +unsigned int eax, ebx, ecx =0 , edx; + +/* +* Check for TSC +*/ + eax =1 ; +do_cpuid (&eax, &ebx, &ecx, &edx); +if (!(edx & (1U <<4 ))) +return ; + +/* +* Check for constant rate and synced (across cores) TSC +*/ + eax =0x80000007 ; +do_cpuid (&eax, &ebx, &ecx, &edx); + tsc_reliable = (edx & (1U <<8 )) !=0 ; + +/* +* Check for FDRAND +*/ + eax =0x1 ; +do_cpuid (&eax, &ebx, &ecx, &edx); + arch_random = (ecx & (1U <<30 )) !=0 ; +} +static inline void arch_init (char *envp[]) {unsigned int level;
@@ -72,6 +99,8 @@ static inline void arch_init(char *envp[])arch_init_intel (); else if (!strcmp(str, "AuthenticAMD") || !strcmp(str, "HygonGenuine"))arch_init_amd (); + else if (!strcmp(str, " Shanghai ") || !strcmp(str, "CentaurHauls")) + arch_init_zhaoxin(); }#endif
Signature · 1 line
2.17.1
Quoted 1 line · Runa Guo-oc
Signed-off-by Runa Guo-oc <[email protected]>
This is literally the same as the intel one, why duplicate all of that? Just do:
arch/arch-x86-common.h +2 -1
@@ -68,7 +68,8 @@ static inline void arch_init(char *envp[]) (unsigned int *) &str[4]); str[12 ] ='\0' ; -if (!strcmp (str,"GenuineIntel" )) +if (!strcmp (str,"GenuineIntel" ) || !strcmp (str," Shanghai " ) || + !strcmp (str,"CentaurHauls" ))arch_init_intel ();else if (!strcmp (str,"AuthenticAMD" ) || !strcmp (str,"HygonGenuine" ))arch_init_amd ();
Signature · 1 line
Jens Axboe
The result of fio's continuous integration tests was: success
For more details see https://github.com/fiotestbot/fio/actions/runs/15164633006