1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
5 #ifndef _RTE_CPUFLAGS_H_
6 #define _RTE_CPUFLAGS_H_
10 * Architecture specific API to determine available CPU features at runtime.
13 #include "rte_common.h"
16 #include <rte_compat.h>
19 * Structure used to describe platform-specific intrinsics that may or may not
20 * be supported at runtime.
22 struct rte_cpu_intrinsics {
23 uint32_t power_monitor : 1;
24 /**< indicates support for rte_power_monitor function */
25 uint32_t power_pause : 1;
26 /**< indicates support for rte_power_pause function */
31 * @b EXPERIMENTAL: this API may change without prior notice
33 * Check CPU support for various intrinsics at runtime.
36 * Pointer to a structure to be filled.
40 rte_cpu_get_intrinsics_support(struct rte_cpu_intrinsics *intrinsics);
43 * Enumeration of all CPU features supported
49 * Get name of CPU flag
55 * NULL if flag ID is invalid
59 rte_cpu_get_flag_name(enum rte_cpu_flag_t feature);
62 * Function for checking a CPU flag availability
65 * CPU flag to query CPU for
67 * 1 if flag is available
68 * 0 if flag is not available
69 * -ENOENT if flag is invalid
73 rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
76 * This function checks that the currently used CPU supports the CPU features
77 * that were specified at compile time. It is called automatically within the
78 * EAL, so does not need to be used by applications. This version returns a
79 * result so that decisions may be made (for instance, graceful shutdowns).
82 rte_cpu_is_supported(void);
85 * This function attempts to retrieve a value from the auxiliary vector.
86 * If it is unsuccessful, the result will be 0, and errno will be set.
88 * @return A value from the auxiliary vector. When the value is 0, check
89 * errno to determine if an error occurred.
92 rte_cpu_getauxval(unsigned long type);
95 * This function retrieves a value from the auxiliary vector, and compares it
96 * as a string against the value retrieved.
98 * @return The result of calling strcmp() against the value retrieved from
99 * the auxiliary vector. When the value is 0 (meaning a match is found),
100 * check errno to determine if an error occurred.
103 rte_cpu_strcmp_auxval(unsigned long type, const char *str);
105 #endif /* _RTE_CPUFLAGS_H_ */