From ffecc8bd2269ae86f48ccd15357b2598bdf10afe Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 25 Mar 2023 11:41:49 -0700 Subject: [PATCH] ircd::info: Fix leaf for avx2/avx512f; additional tsc related. --- include/ircd/info.h | 2 +- ircd/info.cc | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/include/ircd/info.h b/include/ircd/info.h index 93e1e60fa..5c34a9568 100644 --- a/include/ircd/info.h +++ b/include/ircd/info.h @@ -124,7 +124,7 @@ namespace ircd::info::hardware::x86 extern const string_view vendor; extern const bool sse, sse2, sse3, ssse3, sse4a, sse4_1, sse4_2; extern const bool avx, avx2, avx512f; - extern const bool tsc, tsc_constant; + extern const bool tsc, tsc_constant, tsc_nonstop; } namespace ircd::info::hardware::arm diff --git a/ircd/info.cc b/ircd/info.cc index 06a7cb0d3..af8f0e2e6 100644 --- a/ircd/info.cc +++ b/ircd/info.cc @@ -175,7 +175,7 @@ ircd::info::dump_cpu_info_x86() const auto append{[&support] (const string_view &name, const bool &avail, const int &enable) { - strlcat(support, fmt::bsprintf<64> + strlcat(support, fmt::bsprintf<32> { " %s:%c%s", name, @@ -193,7 +193,14 @@ ircd::info::dump_cpu_info_x86() append("avx", hardware::x86::avx, simd::support::avx); append("avx2", hardware::x86::avx2, simd::support::avx2); append("avx512f", hardware::x86::avx512f, simd::support::avx512f); - append("constant_tsc", hardware::x86::tsc_constant, -1); + + strlcat(support, fmt::bsprintf<32> + { + "%s%s%s", + hardware::x86::tsc? " tsc": "", + hardware::x86::tsc_constant? ":constant": "", + hardware::x86::tsc_nonstop? ":nonstop": "", + }); log::info { @@ -415,25 +422,31 @@ ircd::info::hardware::x86::avx decltype(ircd::info::hardware::x86::avx2) ircd::info::hardware::x86::avx2 { - bool(features & (uint128_t(1) << (32 + 5))) + bool(extended_features & (uint128_t(1) << (32 + 5))) }; decltype(ircd::info::hardware::x86::avx512f) ircd::info::hardware::x86::avx512f { - bool(features & (uint128_t(1) << (32 + 16))) + bool(extended_features & (uint128_t(1) << (32 + 16))) }; decltype(ircd::info::hardware::x86::tsc) ircd::info::hardware::x86::tsc { - bool(features & (uint128_t(1) << 4)) + bool(features & (uint128_t(1) << (96 + 4))) }; decltype(ircd::info::hardware::x86::tsc_constant) ircd::info::hardware::x86::tsc_constant { - bool(_apmi & (uint128_t(1) << (8))) + bool(_apmi & (uint128_t(1) << (96 + 8))) +}; + +decltype(ircd::info::hardware::x86::tsc_nonstop) +ircd::info::hardware::x86::tsc_nonstop +{ + bool(_apmi & (uint128_t(1) << (96 + 24))) }; #ifdef __x86_64__