On 12-Jan-21 4:09 PM, Ananyev, Konstantin wrote:
diff --git a/lib/librte_eal/x86/rte_power_intrinsics.c b/lib/librte_eal/x86/rte_power_intrinsics.c new file mode 100644 index 0000000000..34c5fd9c3e --- /dev/null +++ b/lib/librte_eal/x86/rte_power_intrinsics.c @@ -0,0 +1,120 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2020 Intel Corporation + */ + +#include "rte_power_intrinsics.h" + +static inline uint64_t +__get_umwait_val(const volatile void *p, const uint8_t sz) +{ +switch (sz) { +case sizeof(uint8_t): +return *(const volatile uint8_t *)p; +case sizeof(uint16_t): +return *(const volatile uint16_t *)p; +case sizeof(uint32_t): +return *(const volatile uint32_t *)p; +case sizeof(uint64_t): +return *(const volatile uint64_t *)p; +default: +/* this is an intrinsic, so we can't have any error handling */ +RTE_ASSERT(0); +return 0;Nearly forgot - as now this function is not inline anymore, we can probably get rid of assert and return some error code instead?
Well, this would necessitate a change of API to include return values. Which i think is OK at this point, because it's a fully fledged API (rather than an intrinsic) at this point anyway.
+} +} +
-- Thanks, Anatoly

