eal: avoid invalid power intrinsics API usage
authorAnatoly Burakov <anatoly.burakov@intel.com>
Thu, 14 Jan 2021 14:46:04 +0000 (14:46 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 18 Jan 2021 22:58:24 +0000 (23:58 +0100)
commit68fbbb8369dbe0c38b4464886855d937ce21a443
treebb298f249981e125c2045a6a1b8f7eed12b8fb09
parent56833cbd3538b8edac3b3705f835cc56de41cfb0
eal: avoid invalid power intrinsics API usage

Currently, the API documentation mandates that if the user wants to use
the power management intrinsics, they need to call the
`rte_cpu_get_intrinsics_support` API and check support for specific
intrinsics.

However, if the user does not do that, it is possible to get illegal
instruction error because we're using raw instruction opcodes, which may
or may not be supported at runtime.

Now that we have everything in a C file, we can check for support at
startup and prevent the user from possibly encountering illegal
instruction errors.

We also add return values to the API's as well, because why not.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_eal/arm/rte_power_intrinsics.c
lib/librte_eal/include/generic/rte_power_intrinsics.h
lib/librte_eal/ppc/rte_power_intrinsics.c
lib/librte_eal/x86/rte_power_intrinsics.c