Search code examples
armvxworkstrustzone

How to use an ARM Secure Monitor Call (SMC)


I am running an Operating System that uses a ARM Cortex processor on a FPGA. To be able to access this region of memory on this board, I need to be running a secure world. I was told I need to use a Secure Monitor call to enter a secure world. If I am not in a secure world, the Arm Trusted Firmware blocks my Operating System, and gives me a Signal 2 Interrupt.

How can I use a SMC? Is there an example somewhere of implementing this?

Thanks


Solution

  • I understood your question as 'How can I implement an ARM Secure Monitor Call (SMC) so that I may access a specific region of my system from a software not running at EL3' - If you want to know how to use an existing SMC call, you were already answered in Michael Dorgan's first comment.

    If not, you need to implement your own SMC call in the software running at EL3 that was executed at the time your system booted. In a typical Aarch64 system, the BL31 part of the Arm Trusted Firmware would be responsible for this, and ATF seems to be what your system is running.

    An example for an implementation would be the SMC handlers for the ZynqMP IPI mailbox doorbell service located here.

    Bottomline, you should:

    • retrieve the source code for the Arm Trusted Firmware your system is running,
    • implement your own set of SMC calls using, say, the IPI mailbox doorbell service example,
    • recompile Arm Trusted Firmware for your platform,
    • upgrade your system,
    • test.

    Since your platform is using ATF, it may be supported by this code. Otherwise, your silicon/board vendor should provide its source code for your platform.

    I hope this helps.