2 * Ceph - scalable distributed file system
4 * Copyright (C) 2013,2014 Inktank Storage, Inc.
5 * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
7 * Author: Loic Dachary <loic@dachary.org>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
16 #include "arch/probe.h"
19 int ceph_arch_intel_pclmul = 0;
20 int ceph_arch_intel_sse42 = 0;
21 int ceph_arch_intel_sse41 = 0;
22 int ceph_arch_intel_ssse3 = 0;
23 int ceph_arch_intel_sse3 = 0;
24 int ceph_arch_intel_sse2 = 0;
25 int ceph_arch_intel_aesni = 0;
30 /* http://en.wikipedia.org/wiki/CPUID#EAX.3D1:_Processor_Info_and_Feature_Bits */
32 #define CPUID_PCLMUL (1 << 1)
33 #define CPUID_SSE42 (1 << 20)
34 #define CPUID_SSE41 (1 << 19)
35 #define CPUID_SSSE3 (1 << 9)
36 #define CPUID_SSE3 (1)
37 #define CPUID_SSE2 (1 << 26)
38 #define CPUID_AESNI (1 << 25)
40 int ceph_arch_intel_probe(void)
42 /* i know how to check this on x86_64... */
43 unsigned int eax, ebx, ecx = 0, edx = 0;
44 if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx)) {
47 if ((ecx & CPUID_PCLMUL) != 0) {
48 ceph_arch_intel_pclmul = 1;
50 if ((ecx & CPUID_SSE42) != 0) {
51 ceph_arch_intel_sse42 = 1;
53 if ((ecx & CPUID_SSE41) != 0) {
54 ceph_arch_intel_sse41 = 1;
56 if ((ecx & CPUID_SSSE3) != 0) {
57 ceph_arch_intel_ssse3 = 1;
59 if ((ecx & CPUID_SSE3) != 0) {
60 ceph_arch_intel_sse3 = 1;
62 if ((edx & CPUID_SSE2) != 0) {
63 ceph_arch_intel_sse2 = 1;
65 if ((ecx & CPUID_AESNI) != 0) {
66 ceph_arch_intel_aesni = 1;
74 int ceph_arch_intel_probe(void)