| @@ -425,45 +425,53 @@ check_os_arm_support(void) | | | @@ -425,45 +425,53 @@ check_os_arm_support(void) |
425 | } | | 425 | } |
426 | #endif /* PIPE_OS_LINUX */ | | 426 | #endif /* PIPE_OS_LINUX */ |
427 | } | | 427 | } |
428 | | | 428 | |
429 | #elif defined(PIPE_ARCH_AARCH64) | | 429 | #elif defined(PIPE_ARCH_AARCH64) |
430 | static void | | 430 | static void |
431 | check_os_arm_support(void) | | 431 | check_os_arm_support(void) |
432 | { | | 432 | { |
433 | util_cpu_caps.has_neon = true; | | 433 | util_cpu_caps.has_neon = true; |
434 | } | | 434 | } |
435 | #endif /* PIPE_ARCH_ARM || PIPE_ARCH_AARCH64 */ | | 435 | #endif /* PIPE_ARCH_ARM || PIPE_ARCH_AARCH64 */ |
436 | | | 436 | |
437 | #if defined(PIPE_ARCH_MIPS64) | | 437 | #if defined(PIPE_ARCH_MIPS64) |
| | | 438 | #ifdef __NetBSD__ |
| | | 439 | static void |
| | | 440 | check_os_arm_support(void) |
| | | 441 | { |
| | | 442 | util_cpu_caps.has_msa = false; /* XXX seems there is no way to detect MSA support from userland */ |
| | | 443 | } |
| | | 444 | #else |
438 | static void | | 445 | static void |
439 | check_os_mips64_support(void) | | 446 | check_os_mips64_support(void) |
440 | { | | 447 | { |
441 | Elf64_auxv_t aux; | | 448 | Elf64_auxv_t aux; |
442 | int fd; | | 449 | int fd; |
443 | | | 450 | |
444 | fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC); | | 451 | fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC); |
445 | if (fd >= 0) { | | 452 | if (fd >= 0) { |
446 | while (read(fd, &aux, sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) { | | 453 | while (read(fd, &aux, sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) { |
447 | if (aux.a_type == AT_HWCAP) { | | 454 | if (aux.a_type == AT_HWCAP) { |
448 | uint64_t hwcap = aux.a_un.a_val; | | 455 | uint64_t hwcap = aux.a_un.a_val; |
449 | | | 456 | |
450 | util_cpu_caps.has_msa = (hwcap >> 1) & 1; | | 457 | util_cpu_caps.has_msa = (hwcap >> 1) & 1; |
451 | break; | | 458 | break; |
452 | } | | 459 | } |
453 | } | | 460 | } |
454 | close (fd); | | 461 | close (fd); |
455 | } | | 462 | } |
456 | } | | 463 | } |
| | | 464 | #endif |
457 | #endif /* PIPE_ARCH_MIPS64 */ | | 465 | #endif /* PIPE_ARCH_MIPS64 */ |
458 | | | 466 | |
459 | | | 467 | |
460 | static void | | 468 | static void |
461 | get_cpu_topology(void) | | 469 | get_cpu_topology(void) |
462 | { | | 470 | { |
463 | /* Default. This is OK if L3 is not present or there is only one. */ | | 471 | /* Default. This is OK if L3 is not present or there is only one. */ |
464 | util_cpu_caps.num_L3_caches = 1; | | 472 | util_cpu_caps.num_L3_caches = 1; |
465 | | | 473 | |
466 | memset(util_cpu_caps.cpu_to_L3, 0xff, sizeof(util_cpu_caps.cpu_to_L3)); | | 474 | memset(util_cpu_caps.cpu_to_L3, 0xff, sizeof(util_cpu_caps.cpu_to_L3)); |
467 | | | 475 | |
468 | #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) | | 476 | #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) |
469 | /* AMD Zen */ | | 477 | /* AMD Zen */ |