public inbox for fio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
@ 2025-05-22 10:40 Runa Guo-oc
  2025-05-23  7:38 ` fiotestbot
  2025-05-23 15:46 ` Jens Axboe
  0 siblings, 2 replies; 10+ messages in thread
From: Runa Guo-oc @ 2025-05-22 10:40 UTC (permalink / raw)
  To: fio, axboe, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
---
 arch/arch-x86-common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cc..ac26126a 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -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();
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
@ 2025-05-22  4:37 Runa Guo-oc
  2025-05-22  6:49 ` fiotestbot
  2025-05-22  8:07 ` Sitsofe Wheeler
  0 siblings, 2 replies; 10+ messages in thread
From: Runa Guo-oc @ 2025-05-22  4:37 UTC (permalink / raw)
  To: fio, axboe, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
---
 arch/arch-x86-common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cc..bd329c32 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -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();
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features
@ 2025-05-21  2:04 Runa Guo-oc
  2025-05-21 13:20 ` Jens Axboe
  2025-05-21 17:49 ` fiotestbot
  0 siblings, 2 replies; 10+ messages in thread
From: Runa Guo-oc @ 2025-05-21  2:04 UTC (permalink / raw)
  To: fio, axboe, vincentfu
  Cc: cobechen, tonywwang, xanderchen, louisqi, runaguo, leoliu

Signed-off-by: Runa Guo-oc <RunaGuo-oc@zhaoxin.com>
---
 arch/arch-x86-common.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index f32835cc..fbbbd62e 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-05-23 15:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-22 10:40 [PATCH] Add Zhaoxin support to enable tsc_reliable and arch_random features Runa Guo-oc
2025-05-23  7:38 ` fiotestbot
2025-05-23 13:19   ` Vincent Fu
2025-05-23 15:46 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2025-05-22  4:37 Runa Guo-oc
2025-05-22  6:49 ` fiotestbot
2025-05-22  8:07 ` Sitsofe Wheeler
2025-05-21  2:04 Runa Guo-oc
2025-05-21 13:20 ` Jens Axboe
2025-05-21 17:49 ` fiotestbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox