OP-TEE / optee_os

Trusted side of the TEE
Other
1.51k stars 1.03k forks source link

How to read hardware registers from TA #6903

Open arunlalkm-intel opened 1 week ago

arunlalkm-intel commented 1 week ago

My use case is that I want to read chip ID in TA.

Just like in Linux we read using /dev/mem is there a way to read hardware registers from TA?

ivila commented 1 week ago

I think it depends on the chip provider, for example, if you are using rockchip, you can check the rockchip_cpuinfo_probe method, it use dts to find the register, and read the information from efuse, you can follow the logic and do the same thing in TEE.

jenswi-linaro commented 1 week ago

The short answer is, no. But if you need it anyway you must do it via pseudo TA. Have you considered PTA_SYSTEM_DERIVE_TA_UNIQUE_KEY from the system PTA?

arunlalkm-intel commented 5 days ago

Thanks for suggestions. I am using PTA_SYSTEM_DERIVE_TA_UNIQUE_KEY but that gives me only HUK based key.

jenswi-linaro commented 4 days ago

A pseudo-TA for chip ID is your only option then. If the chip ID is sensitive you'll need to add some filtering so only the expected TAs are allowed to get hold of it.

arunlalkm-intel commented 1 day ago

I am unfamiliar with pseudo-TA. It will be helpful if you can give bit more details or point me to an example.

jenswi-linaro commented 1 day ago

https://optee.readthedocs.io/en/latest/architecture/trusted_applications.html#pseudo-trusted-applications