From: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
To: <bruce.richardson@intel.com>, <konstantin.v.ananyev@yandex.ru>
Cc: <dev@dpdk.org>, <david.marchand@redhat.com>,
<ferruh.yigit@amd.com>, <jerin.jacob@caviumnetworks.com>,
<stable@dpdk.org>
Subject: [PATCH v2] eal/x86: add AMD vendor check to choose TSC calibration
Date: Wed, 22 Nov 2023 23:27:30 -0800 [thread overview]
Message-ID: <20231123072730.22948-1-sivaprasad.tummala@amd.com> (raw)
In-Reply-To: <20231109052820.2129745-1-sivaprasad.tummala@amd.com>
AMD Epyc processors doesn't support get_tsc_freq_arch().
The patch allows graceful return to allow fallback to
alternate TSC calibration.
Fixes: 3dbc565e81a0 ("timer: honor arch-specific TSC frequency query")
Cc: jerin.jacob@caviumnetworks.com
Cc: stable@dpdk.org
Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
lib/eal/x86/rte_cycles.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/eal/x86/rte_cycles.c b/lib/eal/x86/rte_cycles.c
index 69ed59b4f0..f147a5231d 100644
--- a/lib/eal/x86/rte_cycles.c
+++ b/lib/eal/x86/rte_cycles.c
@@ -10,6 +10,10 @@
#include <cpuid.h>
#endif
+#define x86_vendor_amd(t1, t2, t3) \
+ ((t1 == 0x68747541) && /* htuA */ \
+ (t2 == 0x444d4163) && /* DMAc */ \
+ (t3 == 0x69746e65)) /* itne */
#include "eal_private.h"
@@ -110,6 +114,18 @@ get_tsc_freq_arch(void)
uint8_t mult, model;
int32_t ret;
+#ifdef RTE_TOOLCHAIN_MSVC
+ __cpuid(cpuinfo, 0);
+ a = cpuinfo[0];
+ b = cpuinfo[1];
+ c = cpuinfo[2];
+ d = cpuinfo[3];
+#else
+ __cpuid(0, a, b, c, d);
+#endif
+ if (x86_vendor_amd(b, c, d))
+ return 0;
+
/*
* Time Stamp Counter and Nominal Core Crystal Clock
* Information Leaf
--
2.34.1
next prev parent reply other threads:[~2023-11-23 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 5:28 [PATCH] eal/x86: add vendor ID checks for specific implementation Sivaprasad Tummala
2023-11-22 11:25 ` Ferruh Yigit
2023-11-22 17:45 ` Tummala, Sivaprasad
2023-11-23 7:27 ` Sivaprasad Tummala [this message]
2023-11-23 10:29 ` [PATCH v2] eal/x86: add AMD vendor check to choose TSC calibration Ferruh Yigit
2024-02-13 15:14 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231123072730.22948-1-sivaprasad.tummala@amd.com \
--to=sivaprasad.tummala@amd.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=jerin.jacob@caviumnetworks.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).