Handle platforms that lack hwcap.h by falling back to ARMV8

This commit is contained in:
Martin Kroeker 2019-10-07 20:34:28 +02:00 committed by GitHub
parent 40eb3c22bf
commit b6af6a5a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -37,8 +37,10 @@
/*********************************************************************/ /*********************************************************************/
#include "common.h" #include "common.h"
#if (defined OS_LINUX || defined OS_ANDROID)
#include <asm/hwcap.h> #include <asm/hwcap.h>
#include <sys/auxv.h> #include <sys/auxv.h>
#endif
extern gotoblas_t gotoblas_ARMV8; extern gotoblas_t gotoblas_ARMV8;
extern gotoblas_t gotoblas_CORTEXA57; extern gotoblas_t gotoblas_CORTEXA57;
@ -105,13 +107,17 @@ static gotoblas_t *force_coretype(char *coretype) {
static gotoblas_t *get_coretype(void) { static gotoblas_t *get_coretype(void) {
int implementer, variant, part, arch, revision, midr_el1; int implementer, variant, part, arch, revision, midr_el1;
#if (defined OS_LINUX || defined OS_ANDROID)
if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) { if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
char coremsg[128]; char coremsg[128];
snprintf(coremsg, 128, "Kernel lacks cpuid feature support. Auto detection of core type failed !!!\n"); snprintf(coremsg, 128, "Kernel lacks cpuid feature support. Auto detection of core type failed !!!\n");
openblas_warning(1, coremsg); openblas_warning(1, coremsg);
return NULL; return NULL;
} }
#else
return NULL;
#endif
get_cpu_ftr(MIDR_EL1, midr_el1); get_cpu_ftr(MIDR_EL1, midr_el1);
/* /*