loongarch.h 831 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2023 WANG Xuerui <git@xen0n.name>
  4. *
  5. * raid6/loongarch.h
  6. *
  7. * Definitions common to LoongArch RAID-6 code only
  8. */
  9. #ifndef _LIB_RAID6_LOONGARCH_H
  10. #define _LIB_RAID6_LOONGARCH_H
  11. #ifdef __KERNEL__
  12. #include <asm/cpu-features.h>
  13. #include <asm/fpu.h>
  14. #else /* for user-space testing */
  15. #include <sys/auxv.h>
  16. /* have to supply these defines for glibc 2.37- and musl */
  17. #ifndef HWCAP_LOONGARCH_LSX
  18. #define HWCAP_LOONGARCH_LSX (1 << 4)
  19. #endif
  20. #ifndef HWCAP_LOONGARCH_LASX
  21. #define HWCAP_LOONGARCH_LASX (1 << 5)
  22. #endif
  23. #define kernel_fpu_begin()
  24. #define kernel_fpu_end()
  25. #define cpu_has_lsx (getauxval(AT_HWCAP) & HWCAP_LOONGARCH_LSX)
  26. #define cpu_has_lasx (getauxval(AT_HWCAP) & HWCAP_LOONGARCH_LASX)
  27. #endif /* __KERNEL__ */
  28. #endif /* _LIB_RAID6_LOONGARCH_H */