entry-fpsimd.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * FP/SIMD state saving and restoring
  4. *
  5. * Copyright (C) 2012 ARM Ltd.
  6. * Author: Catalin Marinas <catalin.marinas@arm.com>
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/assembler.h>
  10. #include <asm/fpsimdmacros.h>
  11. /*
  12. * Save the FP registers.
  13. *
  14. * x0 - pointer to struct fpsimd_state
  15. */
  16. SYM_FUNC_START(fpsimd_save_state)
  17. fpsimd_save x0, 8
  18. ret
  19. SYM_FUNC_END(fpsimd_save_state)
  20. /*
  21. * Load the FP registers.
  22. *
  23. * x0 - pointer to struct fpsimd_state
  24. */
  25. SYM_FUNC_START(fpsimd_load_state)
  26. fpsimd_restore x0, 8
  27. ret
  28. SYM_FUNC_END(fpsimd_load_state)
  29. #ifdef CONFIG_ARM64_SVE
  30. SYM_FUNC_START(sve_save_state)
  31. sve_save 0, x1, 2
  32. ret
  33. SYM_FUNC_END(sve_save_state)
  34. SYM_FUNC_START(sve_load_state)
  35. sve_load 0, x1, x2, 3, x4
  36. ret
  37. SYM_FUNC_END(sve_load_state)
  38. SYM_FUNC_START(sve_get_vl)
  39. _sve_rdvl 0, 1
  40. ret
  41. SYM_FUNC_END(sve_get_vl)
  42. /*
  43. * Load SVE state from FPSIMD state.
  44. *
  45. * x0 = pointer to struct fpsimd_state
  46. * x1 = VQ - 1
  47. *
  48. * Each SVE vector will be loaded with the first 128-bits taken from FPSIMD
  49. * and the rest zeroed. All the other SVE registers will be zeroed.
  50. */
  51. SYM_FUNC_START(sve_load_from_fpsimd_state)
  52. sve_load_vq x1, x2, x3
  53. fpsimd_restore x0, 8
  54. _for n, 0, 15, _sve_pfalse \n
  55. _sve_wrffr 0
  56. ret
  57. SYM_FUNC_END(sve_load_from_fpsimd_state)
  58. /* Zero all SVE registers but the first 128-bits of each vector */
  59. SYM_FUNC_START(sve_flush_live)
  60. sve_flush
  61. ret
  62. SYM_FUNC_END(sve_flush_live)
  63. #endif /* CONFIG_ARM64_SVE */