From 94ec7c686d5a45b308ff5a828159e8c3445018a2 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 20 Oct 2025 16:17:25 -0400 Subject: [PATCH] util: Don't advertise cache ops on x86 without SSE2 Fixes: 555881e57499 ("util/cache_ops: Add some cache flush helpers") Reviewed-by: Mel Henning (cherry picked from commit 3739d7a90c3d2406a3297a973c3de4c3dbe83050) Part-of: --- .pick_status.json | 2 +- src/util/cache_ops.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 6cf4f41891e..2ecf16d6938 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -154,7 +154,7 @@ "description": "util: Don't advertise cache ops on x86 without SSE2", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "555881e57499bc38f098dd5859edecdf6bdad2a2", "notes": null diff --git a/src/util/cache_ops.h b/src/util/cache_ops.h index 2f9dce03946..3ea796f46a7 100644 --- a/src/util/cache_ops.h +++ b/src/util/cache_ops.h @@ -28,6 +28,7 @@ #include #include "detect_arch.h" +#include "u_cpu_detect.h" #ifdef __cplusplus extern "C" { @@ -44,7 +45,13 @@ util_has_cache_ops(void) return false; #endif - return DETECT_ARCH_X86 || DETECT_ARCH_X86_64 || DETECT_ARCH_AARCH64; +#if DETECT_ARCH_X86 + return util_get_cpu_caps()->has_sse2; +#elif DETECT_ARCH_X86_64 || DETECT_ARCH_AARCH64 + return true; +#else + return false; +#endif } /** Returns the cache granularity