From owner-dev-commits-ports-all@freebsd.org Thu Sep 16 16:07:35 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B72267D241; Thu, 16 Sep 2021 16:07:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9MRq3mN8z4YNG; Thu, 16 Sep 2021 16:07:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60F1824914; Thu, 16 Sep 2021 16:07:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GG7Znm000705; Thu, 16 Sep 2021 16:07:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GG7Z1h000704; Thu, 16 Sep 2021 16:07:35 GMT (envelope-from git) Date: Thu, 16 Sep 2021 16:07:35 GMT Message-Id: <202109161607.18GG7Z1h000704@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Steven Kreuzer Subject: git: a5fa38ea2086 - main - devel/cpu_features: Update to v0.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: skreuzer X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5fa38ea20864378fd8c3f3f3b6adfde78cf1d76 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 16:07:35 -0000 The branch main has been updated by skreuzer: URL: https://cgit.FreeBSD.org/ports/commit/?id=a5fa38ea20864378fd8c3f3f3b6adfde78cf1d76 commit a5fa38ea20864378fd8c3f3f3b6adfde78cf1d76 Author: Steven Kreuzer AuthorDate: 2021-09-16 16:06:06 +0000 Commit: Steven Kreuzer CommitDate: 2021-09-16 16:07:17 +0000 devel/cpu_features: Update to v0.6.0 * Update port to v0.6.0 * Add patches from upstream to: * Support FreeBSD on x86 (11994370) * Detect Zen 3 CPUs (7ed0b0e5) --- devel/cpu_features/Makefile | 2 +- devel/cpu_features/distinfo | 6 +- .../files/patch-include_cpu__features__macros.h | 13 ++++ .../files/patch-include_cpuinfo__x86.h | 10 +++ devel/cpu_features/files/patch-src_cpuinfo__x86.c | 76 ++++++++++++++++++++++ devel/cpu_features/pkg-plist | 1 - 6 files changed, 103 insertions(+), 5 deletions(-) diff --git a/devel/cpu_features/Makefile b/devel/cpu_features/Makefile index 35a9d8666167..2c2ee5028668 100644 --- a/devel/cpu_features/Makefile +++ b/devel/cpu_features/Makefile @@ -1,5 +1,5 @@ PORTNAME= cpu_features -PORTVERSION= 0.5.0 +PORTVERSION= 0.6.0 DISTVERSIONPREFIX= v CATEGORIES= devel diff --git a/devel/cpu_features/distinfo b/devel/cpu_features/distinfo index cb917638c729..e40d46a8fd60 100644 --- a/devel/cpu_features/distinfo +++ b/devel/cpu_features/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1611873019 -SHA256 (google-cpu_features-v0.5.0_GH0.tar.gz) = b967811cecd68412e0dc65e4964756a6ae48755456fa2c2f42034f6271ac2c27 -SIZE (google-cpu_features-v0.5.0_GH0.tar.gz) = 61947 +TIMESTAMP = 1631796486 +SHA256 (google-cpu_features-v0.6.0_GH0.tar.gz) = 95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932 +SIZE (google-cpu_features-v0.6.0_GH0.tar.gz) = 63255 diff --git a/devel/cpu_features/files/patch-include_cpu__features__macros.h b/devel/cpu_features/files/patch-include_cpu__features__macros.h new file mode 100644 index 000000000000..afb5fb2ea3c7 --- /dev/null +++ b/devel/cpu_features/files/patch-include_cpu__features__macros.h @@ -0,0 +1,13 @@ +--- include/cpu_features_macros.h.orig 2021-09-16 15:06:15 UTC ++++ include/cpu_features_macros.h +@@ -83,6 +83,10 @@ + #define CPU_FEATURES_OS_DARWIN + #endif + ++#if (defined(__freebsd__) || defined(__FreeBSD__)) ++#define CPU_FEATURES_OS_FREEBSD ++#endif ++ + //////////////////////////////////////////////////////////////////////////////// + // Compilers + //////////////////////////////////////////////////////////////////////////////// diff --git a/devel/cpu_features/files/patch-include_cpuinfo__x86.h b/devel/cpu_features/files/patch-include_cpuinfo__x86.h new file mode 100644 index 000000000000..e59e56aecb31 --- /dev/null +++ b/devel/cpu_features/files/patch-include_cpuinfo__x86.h @@ -0,0 +1,10 @@ +--- include/cpuinfo_x86.h.orig 2021-09-16 15:51:24 UTC ++++ include/cpuinfo_x86.h +@@ -137,6 +137,7 @@ typedef enum { + AMD_BULLDOZER, // K15 + AMD_JAGUAR, // K16 + AMD_ZEN, // K17 ++ AMD_ZEN3, // K19 + } X86Microarchitecture; + + // Returns the underlying microarchitecture by looking at X86Info's vendor, diff --git a/devel/cpu_features/files/patch-src_cpuinfo__x86.c b/devel/cpu_features/files/patch-src_cpuinfo__x86.c new file mode 100644 index 000000000000..f88cee0a7325 --- /dev/null +++ b/devel/cpu_features/files/patch-src_cpuinfo__x86.c @@ -0,0 +1,76 @@ +--- src/cpuinfo_x86.c.orig 2020-10-15 09:09:51 UTC ++++ src/cpuinfo_x86.c +@@ -97,7 +97,8 @@ + // microarchitectures. + #if defined(CPU_FEATURES_OS_WINDOWS) + #include // IsProcessorFeaturePresent +-#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID) ++#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID) || \ ++ defined(CPU_FEATURES_OS_FREEBSD) + #include "internal/filesystem.h" // Needed to parse /proc/cpuinfo + #include "internal/stack_line_reader.h" // Needed to parse /proc/cpuinfo + #include "internal/string_view.h" // Needed to parse /proc/cpuinfo +@@ -1239,6 +1240,45 @@ static void DetectSseViaOs(X86Features* features) { + features->ssse3 = GetDarwinSysCtlByName("hw.optional.supplementalsse3"); + features->sse4_1 = GetDarwinSysCtlByName("hw.optional.sse4_1"); + features->sse4_2 = GetDarwinSysCtlByName("hw.optional.sse4_2"); ++#elif defined(CPU_FEATURES_OS_FREEBSD) ++ // Handling FreeBSD platform through parsing /var/run/dmesg.boot. ++ const int fd = CpuFeatures_OpenFile("/var/run/dmesg.boot"); ++ if (fd >= 0) { ++ StackLineReader reader; ++ StackLineReader_Initialize(&reader, fd); ++ for (;;) { ++ const LineResult result = StackLineReader_NextLine(&reader); ++ const StringView line = result.line; ++ const bool is_feature = ++ CpuFeatures_StringView_StartsWith(line, str(" Features=")); ++ const bool is_feature2 = ++ CpuFeatures_StringView_StartsWith(line, str(" Features2=")); ++ if (is_feature || is_feature2) { ++ // Lines of interests are of the following form: ++ // " Features=0x1783fbff" ++ // We replace '<', '>' and ',' with space so we can search by ++ // whitespace separated word. ++ // TODO: Fix CpuFeatures_StringView_HasWord to allow for different ++ // separators. ++ for (size_t i = 0; i < line.size; ++i) { ++ char* c = (char*)(&(line.ptr[i])); ++ if (*c == '<' || *c == '>' || *c == ',') *c = ' '; ++ } ++ if (is_feature) { ++ features->sse = CpuFeatures_StringView_HasWord(line, "SSE"); ++ features->sse2 = CpuFeatures_StringView_HasWord(line, "SSE2"); ++ } ++ if (is_feature2) { ++ features->sse3 = CpuFeatures_StringView_HasWord(line, "SSE3"); ++ features->ssse3 = CpuFeatures_StringView_HasWord(line, "SSSE3"); ++ features->sse4_1 = CpuFeatures_StringView_HasWord(line, "SSE4.1"); ++ features->sse4_2 = CpuFeatures_StringView_HasWord(line, "SSE4.2"); ++ } ++ } ++ if (result.eof) break; ++ } ++ CpuFeatures_CloseFile(fd); ++ } + #elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID) + // Handling Linux platform through /proc/cpuinfo. + const int fd = CpuFeatures_OpenFile("/proc/cpuinfo"); +@@ -1525,6 +1565,8 @@ X86Microarchitecture GetX86Microarchitecture(const X86 + return AMD_JAGUAR; + case 0x17: + return AMD_ZEN; ++ case 0x19: ++ return AMD_ZEN3; + default: + return X86_UNKNOWN; + } +@@ -1617,6 +1659,8 @@ const char* GetX86MicroarchitectureName(X86Microarchit + return "AMD_JAGUAR"; + case AMD_ZEN: + return "AMD_ZEN"; ++ case AMD_ZEN3: ++ return "AMD_ZEN3"; + } + return "unknown microarchitecture"; + } diff --git a/devel/cpu_features/pkg-plist b/devel/cpu_features/pkg-plist index 495a3c586cf7..e89c9e3391a6 100644 --- a/devel/cpu_features/pkg-plist +++ b/devel/cpu_features/pkg-plist @@ -12,5 +12,4 @@ include/internal/filesystem.h include/internal/hwcaps.h include/internal/stack_line_reader.h include/internal/string_view.h -include/internal/unix_features_aggregator.h lib/libcpu_features.so