secure_cntvoff.S 825 B

1234567891011121314151617181920212223242526272829303132
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2014 Renesas Electronics Corporation
  4. *
  5. * Initialization of CNTVOFF register from secure mode
  6. *
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/assembler.h>
  10. ENTRY(secure_cntvoff_init)
  11. .arch armv7-a
  12. /*
  13. * CNTVOFF has to be initialized either from non-secure Hypervisor
  14. * mode or secure Monitor mode with SCR.NS==1. If TrustZone is enabled
  15. * then it should be handled by the secure code. The CPU must implement
  16. * the virtualization extensions.
  17. */
  18. cps #MON_MODE
  19. mrc p15, 0, r1, c1, c1, 0 /* Get Secure Config */
  20. orr r0, r1, #1
  21. mcr p15, 0, r0, c1, c1, 0 /* Set Non Secure bit */
  22. isb
  23. mov r0, #0
  24. mcrr p15, 4, r0, r0, c14 /* CNTVOFF = 0 */
  25. isb
  26. mcr p15, 0, r1, c1, c1, 0 /* Set Secure bit */
  27. isb
  28. cps #SVC_MODE
  29. ret lr
  30. ENDPROC(secure_cntvoff_init)