blob: 7a1b75fcf7d755c1995891d83bd8e2d551fc3e04 [file] [log] [blame]
Damjan Marion522e4862016-03-04 12:44:14 +01001/*
2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef included_clib_cpu_h
17#define included_clib_cpu_h
18
Damjan Marion0a78fa12019-01-19 23:45:36 +010019#include <sys/syscall.h>
Damjan Marion1c80e832016-05-11 23:07:18 +020020#include <vppinfra/format.h>
21
Damjan Mariona31698b2021-03-10 14:35:28 +010022#if defined(__x86_64__)
23#define foreach_march_variant \
Damjan Marion98f7f0a2023-04-17 09:38:11 +000024 _ (scalar, "Generic (SIMD disabled)") \
Damjan Mariona31698b2021-03-10 14:35:28 +010025 _ (hsw, "Intel Haswell") \
26 _ (trm, "Intel Tremont") \
27 _ (skx, "Intel Skylake (server) / Cascade Lake") \
Damjan Marion1ca68182023-03-15 11:08:53 +000028 _ (icl, "Intel Ice Lake") \
29 _ (adl, "Intel Alder Lake") \
Sivaprasad Tummala206592b2023-04-17 05:05:15 -070030 _ (spr, "Intel Sapphire Rapids") \
31 _ (znver3, "AMD Milan") \
32 _ (znver4, "AMD Genoa")
Damjan Mariona31698b2021-03-10 14:35:28 +010033#elif defined(__aarch64__)
34#define foreach_march_variant \
35 _ (octeontx2, "Marvell Octeon TX2") \
36 _ (thunderx2t99, "Marvell ThunderX2 T99") \
37 _ (qdf24xx, "Qualcomm CentriqTM 2400") \
38 _ (cortexa72, "ARM Cortex-A72") \
Damjan Marion7bf8f5e2023-09-12 15:08:58 +020039 _ (neoversen1, "ARM Neoverse N1") \
40 _ (neoversen2, "ARM Neoverse N2")
Damjan Marion1c80e832016-05-11 23:07:18 +020041#else
Damjan Mariona31698b2021-03-10 14:35:28 +010042#define foreach_march_variant
Damjan Marion1c80e832016-05-11 23:07:18 +020043#endif
44
Sivaprasad Tummala6a1a8322023-04-17 05:16:11 -070045#define amd_vendor(t1, t2, t3) \
46 ((t1 == 0x68747541) && /* htuA */ \
47 (t2 == 0x444d4163) && /* DMAc */ \
48 (t3 == 0x69746e65)) /* itne */
Damjan Mariona31698b2021-03-10 14:35:28 +010049typedef enum
50{
51 CLIB_MARCH_VARIANT_TYPE = 0,
52#define _(s, n) CLIB_MARCH_VARIANT_TYPE_##s,
53 foreach_march_variant
54#undef _
55 CLIB_MARCH_TYPE_N_VARIANTS
56} clib_march_variant_type_t;
Damjan Marion1c80e832016-05-11 23:07:18 +020057
Damjan Marion812b32d2018-05-28 21:26:47 +020058#ifdef CLIB_MARCH_VARIANT
Damjan Marion04f3db32017-11-10 21:55:45 +010059#define __CLIB_MULTIARCH_FN(a,b) a##_##b
60#define _CLIB_MULTIARCH_FN(a,b) __CLIB_MULTIARCH_FN(a,b)
Damjan Marion812b32d2018-05-28 21:26:47 +020061#define CLIB_MULTIARCH_FN(fn) _CLIB_MULTIARCH_FN(fn,CLIB_MARCH_VARIANT)
Damjan Marion04f3db32017-11-10 21:55:45 +010062#else
63#define CLIB_MULTIARCH_FN(fn) fn
64#endif
Damjan Marion1c80e832016-05-11 23:07:18 +020065
Damjan Marion812b32d2018-05-28 21:26:47 +020066#define CLIB_MARCH_SFX CLIB_MULTIARCH_FN
67
Damjan Marion910d3692019-01-21 11:48:34 +010068typedef struct _clib_march_fn_registration
69{
70 void *function;
71 int priority;
72 struct _clib_march_fn_registration *next;
73 char *name;
74} clib_march_fn_registration;
75
76static_always_inline void *
77clib_march_select_fn_ptr (clib_march_fn_registration * r)
78{
79 void *rv = 0;
80 int last_prio = -1;
81
82 while (r)
83 {
84 if (last_prio < r->priority)
85 {
86 last_prio = r->priority;
87 rv = r->function;
88 }
89 r = r->next;
90 }
91 return rv;
92}
93
Damjan Marion11e0d752021-05-05 20:06:39 +020094#define CLIB_MARCH_FN_POINTER(fn) \
95 (__typeof__ (fn) *) clib_march_select_fn_ptr (fn##_march_fn_registrations);
Damjan Marion910d3692019-01-21 11:48:34 +010096
Mohammed Hawarie7149262022-05-18 10:08:47 +020097#define CLIB_MARCH_FN_VOID_POINTER(fn) \
98 clib_march_select_fn_ptr (fn##_march_fn_registrations);
99
Damjan Marion910d3692019-01-21 11:48:34 +0100100#define _CLIB_MARCH_FN_REGISTRATION(fn) \
101static clib_march_fn_registration \
102CLIB_MARCH_SFX(fn##_march_fn_registration) = \
103{ \
104 .name = CLIB_MARCH_VARIANT_STR \
105}; \
106\
107static void __clib_constructor \
108fn##_march_register () \
109{ \
110 clib_march_fn_registration *r; \
111 r = & CLIB_MARCH_SFX (fn##_march_fn_registration); \
112 r->priority = CLIB_MARCH_FN_PRIORITY(); \
113 r->next = fn##_march_fn_registrations; \
114 r->function = CLIB_MARCH_SFX (fn); \
115 fn##_march_fn_registrations = r; \
116}
117
118#ifdef CLIB_MARCH_VARIANT
119#define CLIB_MARCH_FN_REGISTRATION(fn) \
120extern clib_march_fn_registration *fn##_march_fn_registrations; \
121_CLIB_MARCH_FN_REGISTRATION(fn)
122#else
123#define CLIB_MARCH_FN_REGISTRATION(fn) \
124clib_march_fn_registration *fn##_march_fn_registrations = 0; \
125_CLIB_MARCH_FN_REGISTRATION(fn)
126#endif
Radu Nicolaue1480a22021-01-14 10:25:02 +0000127#define foreach_x86_64_flags \
128 _ (sse3, 1, ecx, 0) \
129 _ (pclmulqdq, 1, ecx, 1) \
130 _ (ssse3, 1, ecx, 9) \
131 _ (sse41, 1, ecx, 19) \
132 _ (sse42, 1, ecx, 20) \
133 _ (avx, 1, ecx, 28) \
134 _ (rdrand, 1, ecx, 30) \
135 _ (avx2, 7, ebx, 5) \
Maros Ondrejicka568ef462022-11-10 14:11:40 +0100136 _ (bmi2, 7, ebx, 8) \
Radu Nicolaue1480a22021-01-14 10:25:02 +0000137 _ (rtm, 7, ebx, 11) \
138 _ (pqm, 7, ebx, 12) \
139 _ (pqe, 7, ebx, 15) \
140 _ (avx512f, 7, ebx, 16) \
141 _ (rdseed, 7, ebx, 18) \
142 _ (x86_aes, 1, ecx, 25) \
143 _ (sha, 7, ebx, 29) \
144 _ (vaes, 7, ecx, 9) \
145 _ (vpclmulqdq, 7, ecx, 10) \
146 _ (avx512_vnni, 7, ecx, 11) \
147 _ (avx512_bitalg, 7, ecx, 12) \
148 _ (avx512_vpopcntdq, 7, ecx, 14) \
149 _ (movdiri, 7, ecx, 27) \
150 _ (movdir64b, 7, ecx, 28) \
Damjan Marion15522282023-03-14 13:34:59 +0100151 _ (enqcmd, 7, ecx, 29) \
Ray Kinsella0d27e3e2021-10-15 12:48:31 +0100152 _ (avx512_fp16, 7, edx, 23) \
Sivaprasad Tummala206592b2023-04-17 05:05:15 -0700153 _ (invariant_tsc, 0x80000007, edx, 8) \
154 _ (monitorx, 0x80000001, ecx, 29)
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100155
156#define foreach_aarch64_flags \
157_ (fp, 0) \
158_ (asimd, 1) \
159_ (evtstrm, 2) \
160_ (aarch64_aes, 3) \
161_ (pmull, 4) \
162_ (sha1, 5) \
163_ (sha2, 6) \
164_ (crc32, 7) \
165_ (atomics, 8) \
166_ (fphp, 9) \
167_ (asimdhp, 10) \
168_ (cpuid, 11) \
169_ (asimdrdm, 12) \
170_ (jscvt, 13) \
171_ (fcma, 14) \
172_ (lrcpc, 15) \
173_ (dcpop, 16) \
174_ (sha3, 17) \
175_ (sm3, 18) \
176_ (sm4, 19) \
177_ (asimddp, 20) \
178_ (sha512, 21) \
179_ (sve, 22)
180
Dave Barach6c89a352022-12-26 14:01:36 -0500181u32 clib_get_current_cpu_id (void);
182u32 clib_get_current_numa_node (void);
Damjan Marion0a78fa12019-01-19 23:45:36 +0100183
Dave Barach6c89a352022-12-26 14:01:36 -0500184typedef int (*clib_cpu_supports_func_t) (void);
Zachary Leaf268d7be2022-05-12 02:26:00 -0500185
Christophe Fontaine33e81952016-12-19 14:41:52 +0100186#if defined(__x86_64__)
187#include "cpuid.h"
188
Damjan Marion1c80e832016-05-11 23:07:18 +0200189static inline int
Dave Barachc3799992016-08-15 11:12:27 -0400190clib_get_cpuid (const u32 lev, u32 * eax, u32 * ebx, u32 * ecx, u32 * edx)
Damjan Marion1c80e832016-05-11 23:07:18 +0200191{
192 if ((u32) __get_cpuid_max (0x80000000 & lev, 0) < lev)
193 return 0;
194 if (lev == 7)
Dave Barachc3799992016-08-15 11:12:27 -0400195 __cpuid_count (lev, 0, *eax, *ebx, *ecx, *edx);
Damjan Marion1c80e832016-05-11 23:07:18 +0200196 else
Dave Barachc3799992016-08-15 11:12:27 -0400197 __cpuid (lev, *eax, *ebx, *ecx, *edx);
Damjan Marion1c80e832016-05-11 23:07:18 +0200198 return 1;
199}
200
Damjan Marion1c80e832016-05-11 23:07:18 +0200201#define _(flag, func, reg, bit) \
202static inline int \
203clib_cpu_supports_ ## flag() \
204{ \
205 u32 __attribute__((unused)) eax, ebx = 0, ecx = 0, edx = 0; \
206 clib_get_cpuid (func, &eax, &ebx, &ecx, &edx); \
207 \
208 return ((reg & (1 << bit)) != 0); \
209}
Dave Barachc3799992016-08-15 11:12:27 -0400210foreach_x86_64_flags
Damjan Marion1c80e832016-05-11 23:07:18 +0200211#undef _
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100212#else /* __x86_64__ */
Christophe Fontaine33e81952016-12-19 14:41:52 +0100213
214#define _(flag, func, reg, bit) \
215static inline int clib_cpu_supports_ ## flag() { return 0; }
216foreach_x86_64_flags
217#undef _
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100218#endif /* __x86_64__ */
219#if defined(__aarch64__)
220#include <sys/auxv.h>
221#define _(flag, bit) \
222static inline int \
223clib_cpu_supports_ ## flag() \
224{ \
225 unsigned long hwcap = getauxval(AT_HWCAP); \
226 return (hwcap & (1 << bit)); \
227}
228 foreach_aarch64_flags
229#undef _
230#else /* ! __x86_64__ && !__aarch64__ */
231#define _(flag, bit) \
232static inline int clib_cpu_supports_ ## flag() { return 0; }
233 foreach_aarch64_flags
234#undef _
235#endif /* __x86_64__, __aarch64__ */
236/*
237 * aes is the only feature with the same name in both flag lists
238 * handle this by prefixing it with the arch name, and handling it
239 * with the custom function below
240 */
241 static inline int
242clib_cpu_supports_aes ()
243{
Zhiyong Yang7f4fd222019-04-19 03:04:41 -0400244#if defined(__x86_64__)
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100245 return clib_cpu_supports_x86_aes ();
246#elif defined (__aarch64__)
247 return clib_cpu_supports_aarch64_aes ();
248#else
249 return 0;
Christophe Fontaine33e81952016-12-19 14:41:52 +0100250#endif
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100251}
252
Damjan Marion812b32d2018-05-28 21:26:47 +0200253static inline int
Damjan Marion98f7f0a2023-04-17 09:38:11 +0000254clib_cpu_march_priority_scalar ()
255{
256 return 1;
257}
258
259static inline int
Damjan Marion15522282023-03-14 13:34:59 +0100260clib_cpu_march_priority_spr ()
261{
262 if (clib_cpu_supports_enqcmd ())
263 return 300;
264 return -1;
265}
266
267static inline int
Damjan Marion162330f2020-04-29 21:28:15 +0200268clib_cpu_march_priority_icl ()
Damjan Marion812b32d2018-05-28 21:26:47 +0200269{
Damjan Marion162330f2020-04-29 21:28:15 +0200270 if (clib_cpu_supports_avx512_bitalg ())
271 return 200;
Damjan Marion812b32d2018-05-28 21:26:47 +0200272 return -1;
273}
274
275static inline int
Damjan Marion15522282023-03-14 13:34:59 +0100276clib_cpu_march_priority_adl ()
277{
278 if (clib_cpu_supports_movdiri () && clib_cpu_supports_avx2 ())
279 return 150;
280 return -1;
281}
282
283static inline int
Damjan Marion162330f2020-04-29 21:28:15 +0200284clib_cpu_march_priority_skx ()
285{
286 if (clib_cpu_supports_avx512f ())
287 return 100;
288 return -1;
289}
290
291static inline int
Radu Nicolaue1480a22021-01-14 10:25:02 +0000292clib_cpu_march_priority_trm ()
293{
294 if (clib_cpu_supports_movdiri ())
Damjan Marion15522282023-03-14 13:34:59 +0100295 return 40;
Radu Nicolaue1480a22021-01-14 10:25:02 +0000296 return -1;
297}
298
299static inline int
Damjan Marion162330f2020-04-29 21:28:15 +0200300clib_cpu_march_priority_hsw ()
Damjan Marion812b32d2018-05-28 21:26:47 +0200301{
302 if (clib_cpu_supports_avx2 ())
Damjan Marion64593152019-03-12 19:59:22 +0100303 return 50;
Damjan Marion812b32d2018-05-28 21:26:47 +0200304 return -1;
305}
306
Sivaprasad Tummala206592b2023-04-17 05:05:15 -0700307static inline int
308clib_cpu_march_priority_znver4 ()
309{
310 if (clib_cpu_supports_avx512_bitalg () && clib_cpu_supports_monitorx ())
311 return 250;
312 return -1;
313}
314
315static inline int
316clib_cpu_march_priority_znver3 ()
317{
318 if (clib_cpu_supports_avx2 () && clib_cpu_supports_monitorx ())
319 return 70;
320 return -1;
321}
322
Ray Kinsella0024e532021-11-26 14:57:35 +0000323#define X86_CPU_ARCH_PERF_FUNC 0xA
324
325static inline int
326clib_get_pmu_counter_count (u8 *fixed, u8 *general)
327{
328#if defined(__x86_64__)
329 u32 __clib_unused eax = 0, ebx = 0, ecx = 0, edx = 0;
330 clib_get_cpuid (X86_CPU_ARCH_PERF_FUNC, &eax, &ebx, &ecx, &edx);
331
332 *general = (eax & 0xFF00) >> 8;
333 *fixed = (edx & 0xF);
334
335 return 1;
336#else
337 return 0;
338#endif
339}
340
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200341typedef struct
Lijian Zhang2e237212018-09-10 17:13:56 +0800342{
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200343 struct
344 {
345 u8 implementer;
346 u16 part_num;
347 } aarch64;
348} clib_cpu_info_t;
Lijian Zhang2e237212018-09-10 17:13:56 +0800349
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200350const clib_cpu_info_t *clib_get_cpu_info ();
Lijian Zhang2e237212018-09-10 17:13:56 +0800351
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200352/* ARM */
353#define AARCH64_CPU_IMPLEMENTER_ARM 0x41
354#define AARCH64_CPU_PART_CORTEXA72 0xd08
355#define AARCH64_CPU_PART_NEOVERSEN1 0xd0c
356#define AARCH64_CPU_PART_NEOVERSEN2 0xd49
Lijian Zhang2e237212018-09-10 17:13:56 +0800357
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200358/*cavium */
Nitin Saxenae2f52362020-08-25 19:58:37 +0530359#define AARCH64_CPU_IMPLEMENTER_CAVIUM 0x43
360#define AARCH64_CPU_PART_THUNDERX2 0x0af
361#define AARCH64_CPU_PART_OCTEONTX2T96 0x0b2
362#define AARCH64_CPU_PART_OCTEONTX2T98 0x0b1
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200363
364/* Qualcomm */
365#define AARCH64_CPU_IMPLEMENTER_QUALCOMM 0x51
Lijian Zhang2e237212018-09-10 17:13:56 +0800366#define AARCH64_CPU_PART_QDF24XX 0xc00
Lijian Zhang2e237212018-09-10 17:13:56 +0800367
368static inline int
Nitin Saxenae2f52362020-08-25 19:58:37 +0530369clib_cpu_march_priority_octeontx2 ()
370{
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200371 const clib_cpu_info_t *info = clib_get_cpu_info ();
372
373 if (!info || info->aarch64.implementer != AARCH64_CPU_IMPLEMENTER_CAVIUM)
374 return -1;
375
376 if (info->aarch64.part_num == AARCH64_CPU_PART_OCTEONTX2T96 ||
377 info->aarch64.part_num == AARCH64_CPU_PART_OCTEONTX2T98)
Nitin Saxenae2f52362020-08-25 19:58:37 +0530378 return 20;
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200379
Nitin Saxenae2f52362020-08-25 19:58:37 +0530380 return -1;
381}
382
383static inline int
Lijian Zhang2e237212018-09-10 17:13:56 +0800384clib_cpu_march_priority_thunderx2t99 ()
385{
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200386 const clib_cpu_info_t *info = clib_get_cpu_info ();
387
388 if (!info || info->aarch64.implementer != AARCH64_CPU_IMPLEMENTER_CAVIUM)
389 return -1;
390
391 if (info->aarch64.part_num == AARCH64_CPU_PART_THUNDERX2)
Lijian Zhang2e237212018-09-10 17:13:56 +0800392 return 20;
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200393
Lijian Zhang2e237212018-09-10 17:13:56 +0800394 return -1;
395}
396
397static inline int
398clib_cpu_march_priority_qdf24xx ()
399{
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200400 const clib_cpu_info_t *info = clib_get_cpu_info ();
401
402 if (!info || info->aarch64.implementer != AARCH64_CPU_IMPLEMENTER_QUALCOMM)
403 return -1;
404
405 if (info->aarch64.part_num == AARCH64_CPU_PART_QDF24XX)
Lijian Zhang2e237212018-09-10 17:13:56 +0800406 return 20;
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200407
Lijian Zhang2e237212018-09-10 17:13:56 +0800408 return -1;
409}
410
411static inline int
412clib_cpu_march_priority_cortexa72 ()
413{
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200414 const clib_cpu_info_t *info = clib_get_cpu_info ();
415
416 if (!info || info->aarch64.implementer != AARCH64_CPU_IMPLEMENTER_ARM)
417 return -1;
418
419 if (info->aarch64.part_num == AARCH64_CPU_PART_CORTEXA72)
Lijian Zhang2e237212018-09-10 17:13:56 +0800420 return 10;
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200421
Lijian Zhang2e237212018-09-10 17:13:56 +0800422 return -1;
423}
424
Lijian.Zhang690ce862020-02-18 19:58:19 +0800425static inline int
426clib_cpu_march_priority_neoversen1 ()
427{
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200428 const clib_cpu_info_t *info = clib_get_cpu_info ();
429
430 if (!info || info->aarch64.implementer != AARCH64_CPU_IMPLEMENTER_ARM)
431 return -1;
432
433 if (info->aarch64.part_num == AARCH64_CPU_PART_NEOVERSEN1)
Lijian.Zhang690ce862020-02-18 19:58:19 +0800434 return 10;
Damjan Marion7bf8f5e2023-09-12 15:08:58 +0200435
436 return -1;
437}
438
439static inline int
440clib_cpu_march_priority_neoversen2 ()
441{
442 const clib_cpu_info_t *info = clib_get_cpu_info ();
443
444 if (!info || info->aarch64.implementer != AARCH64_CPU_IMPLEMENTER_ARM)
445 return -1;
446
447 if (info->aarch64.part_num == AARCH64_CPU_PART_NEOVERSEN2)
448 return 10;
449
Lijian.Zhang690ce862020-02-18 19:58:19 +0800450 return -1;
451}
452
Damjan Marion812b32d2018-05-28 21:26:47 +0200453#ifdef CLIB_MARCH_VARIANT
454#define CLIB_MARCH_FN_PRIORITY() CLIB_MARCH_SFX(clib_cpu_march_priority)()
455#else
456#define CLIB_MARCH_FN_PRIORITY() 0
457#endif
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100458#endif /* included_clib_cpu_h */
459
Florin Coras983cc7d2018-09-18 23:11:55 -0700460#define CLIB_MARCH_FN_CONSTRUCTOR(fn) \
461static void __clib_constructor \
462CLIB_MARCH_SFX(fn ## _march_constructor) (void) \
463{ \
464 if (CLIB_MARCH_FN_PRIORITY() > fn ## _selected_priority) \
465 { \
466 fn ## _selected = & CLIB_MARCH_SFX (fn ## _ma); \
467 fn ## _selected_priority = CLIB_MARCH_FN_PRIORITY(); \
468 } \
469} \
470
471#ifndef CLIB_MARCH_VARIANT
Damjan Marion1bb67ab2021-04-30 11:11:08 +0200472#define CLIB_MARCH_FN(fn, rtype, _args...) \
473 static rtype CLIB_MARCH_SFX (fn##_ma) (_args); \
474 rtype (*fn##_selected) (_args) = &CLIB_MARCH_SFX (fn##_ma); \
475 int fn##_selected_priority = 0; \
476 static inline rtype CLIB_MARCH_SFX (fn##_ma) (_args)
Florin Coras983cc7d2018-09-18 23:11:55 -0700477#else
Damjan Marion1bb67ab2021-04-30 11:11:08 +0200478#define CLIB_MARCH_FN(fn, rtype, _args...) \
479 static rtype CLIB_MARCH_SFX (fn##_ma) (_args); \
480 extern rtype (*fn##_selected) (_args); \
481 extern int fn##_selected_priority; \
482 CLIB_MARCH_FN_CONSTRUCTOR (fn) \
483 static rtype CLIB_MARCH_SFX (fn##_ma) (_args)
Florin Coras983cc7d2018-09-18 23:11:55 -0700484#endif
485
486#define CLIB_MARCH_FN_SELECT(fn) (* fn ## _selected)
487
Gabriel Ganne73cb0062017-12-05 14:26:33 +0100488format_function_t format_cpu_uarch;
Damjan Marion522e4862016-03-04 12:44:14 +0100489format_function_t format_cpu_model_name;
Damjan Marion1c80e832016-05-11 23:07:18 +0200490format_function_t format_cpu_flags;
Damjan Marione3e35552021-05-06 17:34:49 +0200491format_function_t format_march_variant;
Damjan Marion522e4862016-03-04 12:44:14 +0100492
Dave Barachc3799992016-08-15 11:12:27 -0400493/*
494 * fd.io coding-style-patch-verification: ON
495 *
496 * Local Variables:
497 * eval: (c-set-style "gnu")
498 * End:
499 */