1

My goal is to set a counter/timer in the secure world that cannot be disabled from the normal world. When the timer expires, it raises an interrupt that will be handled by the secure world. Is it possible?

UPDATE: I have found OP TEE os project and in particular the way they handle timers and secure world interrupts is pretty much what I need. I am looking inot better understanding this now:

https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/pta/interrupt_tests.c

Fardin Abdi
  • 1,284
  • 15
  • 20
  • what did the arm documentation say on the topic? and what did you try? and when you tried it what did your program do or not do? please post the code your expectations and what happened instead. – old_timer Sep 03 '17 at 23:33
  • Which device are you using? – MCG Sep 04 '17 at 19:51
  • It is possible on some trust zone devices. Some CPUs have trust zone, but timer hardware might be broken. The question 'is it possible' is more easy than 'how do i...'. Setting up secure/normal world is non-trivial. If you just want code in the secure world to periodically wake and the timer device has banked or world protection (or a bus controller has protection ability), then it should be possible. Note that running an OS in the normal world might require some support. So you may need to code `SMC` calls as the normal OS may not have permission; for example L2-cache manipulation. – artless noise Sep 07 '17 at 12:44
  • I am using raspberry pi3 and the OP TEE OS project is supporting this device. I was able to successfully install in on my device and test it. I am trying to figure out how to setup interrupts and timer though. – Fardin Abdi Mar 28 '18 at 18:57

1 Answers1

1

I think the secure timer and related registers CNTPS_*_EL1 are what you want.

S.Wan
  • 396
  • 3
  • 18