cpu-reset.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * CPU reset routines
  4. *
  5. * Copyright (C) 2001 Deep Blue Solutions Ltd.
  6. * Copyright (C) 2012 ARM Ltd.
  7. * Copyright (C) 2015 Huawei Futurewei Technologies.
  8. */
  9. #include <linux/linkage.h>
  10. #include <asm/assembler.h>
  11. #include <asm/sysreg.h>
  12. #include <asm/virt.h>
  13. .text
  14. .pushsection .idmap.text, "awx"
  15. /*
  16. * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for
  17. * cpu_soft_restart.
  18. *
  19. * @el2_switch: Flag to indicate a switch to EL2 is needed.
  20. * @entry: Location to jump to for soft reset.
  21. * arg0: First argument passed to @entry. (relocation list)
  22. * arg1: Second argument passed to @entry.(physical kernel entry)
  23. * arg2: Third argument passed to @entry. (physical dtb address)
  24. *
  25. * Put the CPU into the same state as it would be if it had been reset, and
  26. * branch to what would be the reset vector. It must be executed with the
  27. * flat identity mapping.
  28. */
  29. SYM_CODE_START(__cpu_soft_restart)
  30. mov_q x12, INIT_SCTLR_EL1_MMU_OFF
  31. pre_disable_mmu_workaround
  32. /*
  33. * either disable EL1&0 translation regime or disable EL2&0 translation
  34. * regime if HCR_EL2.E2H == 1
  35. */
  36. msr sctlr_el1, x12
  37. isb
  38. cbz x0, 1f // el2_switch?
  39. mov x0, #HVC_SOFT_RESTART
  40. hvc #0 // no return
  41. 1: mov x8, x1 // entry
  42. mov x0, x2 // arg0
  43. mov x1, x3 // arg1
  44. mov x2, x4 // arg2
  45. br x8
  46. SYM_CODE_END(__cpu_soft_restart)
  47. .popsection