This module was in use by AVX512-specific functionality that is all removed now.
Signed-off-by: Ilya Maximets <[email protected]> --- lib/automake.mk | 2 -- lib/cpu.c | 71 ------------------------------------------------- lib/cpu.h | 35 ------------------------ 3 files changed, 108 deletions(-) delete mode 100644 lib/cpu.c delete mode 100644 lib/cpu.h diff --git a/lib/automake.mk b/lib/automake.mk index b6120c0e3..9b0f6fe0a 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -59,8 +59,6 @@ lib_libopenvswitch_la_SOURCES = \ lib/cooperative-multitasking-private.h \ lib/coverage.c \ lib/coverage.h \ - lib/cpu.c \ - lib/cpu.h \ lib/crc32c.c \ lib/crc32c.h \ lib/csum.c \ diff --git a/lib/cpu.c b/lib/cpu.c deleted file mode 100644 index fbbea4005..000000000 --- a/lib/cpu.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2021, Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <config.h> - -#include "cpu.h" -#include "openvswitch/compiler.h" - -#ifdef __x86_64__ -#include <cpuid.h> -#include <inttypes.h> - -#include "openvswitch/util.h" - -enum x86_reg { - EAX, - EBX, - ECX, - EDX, -}; -#define X86_LEAF_MASK 0x80000000 -#define X86_EXT_FEATURES_LEAF 0x00000007 -static bool x86_has_isa(uint32_t leaf, enum x86_reg reg, uint32_t bit) -{ - uint32_t regs[4]; - - if (__get_cpuid_max(leaf & X86_LEAF_MASK, NULL) < leaf) { - return false; - } - - __cpuid_count(leaf, 0, regs[EAX], regs[EBX], regs[ECX], regs[EDX]); - return (regs[reg] & ((uint32_t) 1 << bit)) != 0; -} - -static bool x86_isa[OVS_CPU_ISA_X86_LAST - OVS_CPU_ISA_X86_FIRST + 1]; -#define X86_ISA(leaf, reg, bit, name) \ -OVS_CONSTRUCTOR(cpu_isa_ ## name) { \ - x86_isa[name - OVS_CPU_ISA_X86_FIRST] = x86_has_isa(leaf, reg, bit); \ -} -X86_ISA(X86_EXT_FEATURES_LEAF, EBX, 8, OVS_CPU_ISA_X86_BMI2) -X86_ISA(X86_EXT_FEATURES_LEAF, EBX, 16, OVS_CPU_ISA_X86_AVX512F) -X86_ISA(X86_EXT_FEATURES_LEAF, EBX, 30, OVS_CPU_ISA_X86_AVX512BW) -X86_ISA(X86_EXT_FEATURES_LEAF, ECX, 1, OVS_CPU_ISA_X86_AVX512VBMI) -X86_ISA(X86_EXT_FEATURES_LEAF, ECX, 14, OVS_CPU_ISA_X86_VPOPCNTDQ) -X86_ISA(X86_EXT_FEATURES_LEAF, EBX, 31, OVS_CPU_ISA_X86_AVX512VL) -#endif - -bool -cpu_has_isa(enum ovs_cpu_isa isa OVS_UNUSED) -{ -#ifdef __x86_64__ - if (isa >= OVS_CPU_ISA_X86_FIRST && - isa <= OVS_CPU_ISA_X86_LAST) { - return x86_isa[isa - OVS_CPU_ISA_X86_FIRST]; - } -#endif - return false; -} diff --git a/lib/cpu.h b/lib/cpu.h deleted file mode 100644 index 3215229bc..000000000 --- a/lib/cpu.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021, Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef CPU_H -#define CPU_H 1 - -#include <stdbool.h> - -enum ovs_cpu_isa { - OVS_CPU_ISA_X86_FIRST, - OVS_CPU_ISA_X86_BMI2 = OVS_CPU_ISA_X86_FIRST, - OVS_CPU_ISA_X86_AVX512F, - OVS_CPU_ISA_X86_AVX512BW, - OVS_CPU_ISA_X86_AVX512VBMI, - OVS_CPU_ISA_X86_AVX512VL, - OVS_CPU_ISA_X86_VPOPCNTDQ, - OVS_CPU_ISA_X86_LAST = OVS_CPU_ISA_X86_VPOPCNTDQ, -}; - -bool cpu_has_isa(enum ovs_cpu_isa); - -#endif /* CPU_H */ -- 2.53.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
