trans_pgd-asm.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, Microsoft Corporation.
  4. * Pasha Tatashin <[email protected]>
  5. */
  6. #include <linux/linkage.h>
  7. #include <asm/assembler.h>
  8. #include <asm/kvm_asm.h>
  9. .macro invalid_vector label
  10. SYM_CODE_START_LOCAL(\label)
  11. .align 7
  12. b \label
  13. SYM_CODE_END(\label)
  14. .endm
  15. .macro el1_sync_vector
  16. SYM_CODE_START_LOCAL(el1_sync)
  17. .align 7
  18. cmp x0, #HVC_SET_VECTORS /* Called from hibernate */
  19. b.ne 1f
  20. msr vbar_el2, x1
  21. mov x0, xzr
  22. eret
  23. 1: cmp x0, #HVC_SOFT_RESTART /* Called from kexec */
  24. b.ne 2f
  25. mov x0, x2
  26. mov x2, x4
  27. mov x4, x1
  28. mov x1, x3
  29. br x4
  30. 2: /* Unexpected argument, set an error */
  31. mov_q x0, HVC_STUB_ERR
  32. eret
  33. SYM_CODE_END(el1_sync)
  34. .endm
  35. SYM_CODE_START(trans_pgd_stub_vectors)
  36. invalid_vector hyp_stub_el2t_sync_invalid // Synchronous EL2t
  37. invalid_vector hyp_stub_el2t_irq_invalid // IRQ EL2t
  38. invalid_vector hyp_stub_el2t_fiq_invalid // FIQ EL2t
  39. invalid_vector hyp_stub_el2t_error_invalid // Error EL2t
  40. invalid_vector hyp_stub_el2h_sync_invalid // Synchronous EL2h
  41. invalid_vector hyp_stub_el2h_irq_invalid // IRQ EL2h
  42. invalid_vector hyp_stub_el2h_fiq_invalid // FIQ EL2h
  43. invalid_vector hyp_stub_el2h_error_invalid // Error EL2h
  44. el1_sync_vector // Synchronous 64-bit EL1
  45. invalid_vector hyp_stub_el1_irq_invalid // IRQ 64-bit EL1
  46. invalid_vector hyp_stub_el1_fiq_invalid // FIQ 64-bit EL1
  47. invalid_vector hyp_stub_el1_error_invalid // Error 64-bit EL1
  48. invalid_vector hyp_stub_32b_el1_sync_invalid // Synchronous 32-bit EL1
  49. invalid_vector hyp_stub_32b_el1_irq_invalid // IRQ 32-bit EL1
  50. invalid_vector hyp_stub_32b_el1_fiq_invalid // FIQ 32-bit EL1
  51. invalid_vector hyp_stub_32b_el1_error_invalid // Error 32-bit EL1
  52. .align 11
  53. SYM_INNER_LABEL(__trans_pgd_stub_vectors_end, SYM_L_LOCAL)
  54. SYM_CODE_END(trans_pgd_stub_vectors)
  55. # Check the trans_pgd_stub_vectors didn't overflow
  56. .org . - (__trans_pgd_stub_vectors_end - trans_pgd_stub_vectors) + SZ_2K