Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ppc64 support for ceph #16753

Merged
merged 1 commit into from
Aug 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmake/modules/SIMDExt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
endif()
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
set(HAVE_PPC64LE 1)
message(STATUS " we are ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64|(powerpc|ppc)64le")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
set(HAVE_PPC64LE 1)
message(STATUS " we are ppc64le")
else()
set(HAVE_PPC64 1)
message(STATUS " we are ppc64")
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
if(HAS_ALTIVEC)
message(STATUS " HAS_ALTIVEC yes")
Expand Down
9 changes: 6 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,12 @@ if(HAVE_INTEL)
endif(HAVE_GOOD_YASM_ELF64)
elseif(HAVE_POWER8)
list(APPEND libcommon_files
common/crc32c_ppc.c
common/crc32c_ppc_asm.S
common/crc32c_ppc_fast_zero_asm.S)
common/crc32c_ppc.c)
if(HAVE_PPC64LE)
list(APPEND libcommon_files
common/crc32c_ppc_asm.S
common/crc32c_ppc_fast_zero_asm.S)
endif(HAVE_PPC64LE)
endif(HAVE_INTEL)

if(LINUX)
Expand Down
8 changes: 4 additions & 4 deletions src/arch/ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ int ceph_arch_ppc_crc32 = 0;

#include <stdio.h>

#if __linux__ && __powerpc64__
#ifdef HAVE_PPC64LE
#include <sys/auxv.h>
#include <asm/cputable.h>
#endif /* __linux__ && __powerpc64__ */
#endif /* HAVE_PPC64LE */

#ifndef PPC_FEATURE2_VEC_CRYPTO
#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
Expand All @@ -31,9 +31,9 @@ int ceph_arch_ppc_probe(void)
{
ceph_arch_ppc_crc32 = 0;

#if __linux__ && __powerpc64__
#ifdef HAVE_PPC64LE
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO) ceph_arch_ppc_crc32 = 1;
#endif /* __linux__ && __powerpc64__ */
#endif /* HAVE_PPC64LE */

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/crc32c_ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define VMX_ALIGN 16
#define VMX_ALIGN_MASK (VMX_ALIGN-1)

#ifdef HAVE_PPC64LE
#ifdef REFLECT
static unsigned int crc32_align(unsigned int crc, unsigned char const *p,
unsigned long len)
Expand All @@ -38,7 +39,6 @@ static unsigned int crc32_align(unsigned int crc, unsigned char const *p,
}
#endif

#ifdef HAVE_POWER8
static inline unsigned long polynomial_multiply(unsigned int a, unsigned int b) {
vector unsigned int va = {a, 0, 0, 0};
vector unsigned int vb = {b, 0, 0, 0};
Expand Down Expand Up @@ -134,7 +134,7 @@ uint32_t ceph_crc32c_ppc(uint32_t crc, unsigned char const *data, unsigned len)
return crc;
}

#else /* HAVE_POWER8 */
#else /* HAVE_PPC64LE */

/* This symbol has to exist on non-ppc architectures (and on legacy
* ppc systems using power7 or below) in order to compile properly
Expand All @@ -145,4 +145,4 @@ uint32_t ceph_crc32c_ppc(uint32_t crc, unsigned char const *data, unsigned len)
return 0;
}

#endif /* HAVE_POWER8 */
#endif /* HAVE_PPC64LE */