Confused by OS Lock in Juno board

Hi all,

I am using 64-bit android on Juno r1 board, and get confused by the OS Lock when playing with ETM. 

The armv8 manual tells that the OS lock is used to restrict the external debugger, and can be unlocked by writing 0 to OSLAR_EL1 register. Moreover, the OSLAR_EL1 register is supposed to be mapped to external debug register OSLAR_EL1, whose offset is 0x300 in the memory-mapped interface. In the ETM, we also have a pair of OS lock registers locates at offset 0x300/0x304. Since i am confused by these OS Locks, i did some experiments like the following:

Experiment 1:

a) Unlock the OS Lock by using "msr OSLAR_EL1, 0"

b) Read the OS Lock status by using "mrs X0, OSLSR_EL1"

c) Read the ETM OS Lock status by the memory-mapped interface

d) Unlock the ETM OS Lock by the memory-mapped interface and repeat c)

In b), we can find that the OS Lock is unlocked, however, the result in c) shows that the OS Lock in ETM is not unlocked. If we do d), then the OS Lock in ETM is unlocked. So, does that mean the OS Lock and ETM OS Lock are completely different locks?

Experiment 2:

a) Unlock the ETM OS Lock by the memory-mapped interface

b) Read the ETM OS Lock status by the memory-mapped interface

c) Make the GPU Mali access the ETM OS Lock status

In a) and b), we can find that the ETM OS Lock is unlocked as expected. In c), i made some tricks in the open source kernel-level mali driver and created an OpenCL buffer on the physic address of ETM. Then, I tried to access the ETM OS Lock. However, it surprised me that the ETM OS Lock status reading by Mali shows that the ETM OS Lock is locked. How could this be? Does that mean the OS Lock has multiple copies while reading from different devices?

Experiment 3:

a) Use Mali to unlock the ETM OS Lock

b) Use Mali to access the ETM OS Lock status

Surprise again. Even I use Mali to unlock the ETM OS Lock, the ETM OS Lock status still shows that the ETM OS Lock is locked. So, does that mean there are some restrictions on access to the ETM OS Lock?

Experiment 4:

a) Use Mali to unlock the ETM Software Lock (at offset 0xfb0)

b) Use Mali to read the ETM Software Lock status (at offset 0xfb4)

c) Use CPU to read the ETM Software Lock status

In this experiment, everything works as expected. In both step b) and c), the results show that the Software Lock is unlocked. I suppose that this means the Mali is at least capable of accessing the ETM registers, but why not the OS Lock?

Thanks in advance for any suggestions and discussions!

Best Regards,

Zhenyu

Parents Reply Children
No data
More questions in this forum