How To Access SCTLR_EL1 of Non Secure World From EL3

I found this documentation: https://cs140e.sergio.bz/docs/ARMv8-Reference-Manual.pdf

On page D7-2464, it mentions that SCTLR_EL1 of the Non-Secure world can be accessed from EL3.

I am using ARMv8 FVP.

Can anyone provide guidance on how to access and update SCTLR_EL1 of the Non-Secure world (Linux)  from EL3?

Parents
  • Without knowing more, some guesses:

    • While in Linux, SCTLR_EL1 changes between your MRS and the SMC
      • If the MRS and SMC aren't close together, or they're wrapped in kernel calls, that's perhaps more likely - but I'm not a Linux expert.
    • Your OS is running in EL2, not EL1, with E2H set to 1.
      • In that case, accesses at EL2 to _EL1 registers will (in some cases) be re-directed to the equivalent _EL2 register.  The same re-direction does not happen at EL3.  So your MRS in the kernel (at EL2) and in firmware (at EL3) genuinely are to different registers.
    • Your OS is running in EL1 as a VM under a hypervisor
      • In that case, the SMC will likely initially go to the hypervisor, not firmware.  What the hypervisor then does I don't know, but it could lead to SCTLR_EL1 being updated.
    • Between arriving in EL3 and reading SCTLR_EL1 some other code is running, for example save/restore code, that overwrites SCTLR_EL1.  
Reply
  • Without knowing more, some guesses:

    • While in Linux, SCTLR_EL1 changes between your MRS and the SMC
      • If the MRS and SMC aren't close together, or they're wrapped in kernel calls, that's perhaps more likely - but I'm not a Linux expert.
    • Your OS is running in EL2, not EL1, with E2H set to 1.
      • In that case, accesses at EL2 to _EL1 registers will (in some cases) be re-directed to the equivalent _EL2 register.  The same re-direction does not happen at EL3.  So your MRS in the kernel (at EL2) and in firmware (at EL3) genuinely are to different registers.
    • Your OS is running in EL1 as a VM under a hypervisor
      • In that case, the SMC will likely initially go to the hypervisor, not firmware.  What the hypervisor then does I don't know, but it could lead to SCTLR_EL1 being updated.
    • Between arriving in EL3 and reading SCTLR_EL1 some other code is running, for example save/restore code, that overwrites SCTLR_EL1.  
Children
No data