Skip to content

Commit

Permalink
eal/x86: add vendor ID checks for specific implementation
Browse files Browse the repository at this point in the history
Current get_tsc_freq_arch() implementation is specific for
Intel processors.

Added vendor checks to gracefully return on AMD EPYC processors.

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
sivapt12 authored and ovsrobot committed Nov 9, 2023
1 parent de0ec3c commit 7780879
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/eal/x86/rte_cycles.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7780879

Please sign in to comment.