royzah opened a new pull request, #20196: URL: https://github.com/apache/nuttx/pull/20196
## Summary The ELE addresses memory physically. Cache maintenance takes a virtual address. The two buffer calls each supply one of them and use it for both purposes, in opposite directions. | | cache maintenance | address given to the enclave | | --- | --- | --- | | `imx9_ele_get_random()` | a **physical** address | correct | | `imx9_ele_get_key()` | correct | a **virtual** address | [`up_flush_dcache()` and `up_invalidate_dcache()`](https://github.com/apache/nuttx/blob/master/arch/arm64/src/common/arm64_cache.c#L484) document their arguments as virtual. So [`imx9_ele_get_random()`](https://github.com/apache/nuttx/blob/master/arch/arm64/src/imx9/imx9_ele.c#L470) maintains whatever lines its physical values happen to name, and a caller can read back what its own dirty line still holds rather than what the ELE wrote, with nothing reported anywhere. Both are correct only while the virtual and physical addresses are equal. That holds for the configurations in tree today. It does not hold for a kernel build with address environments. ## Change Both take the virtual address, maintain the cache on it, and translate for the message. `imx9_ele_get_random()` also gains the cache line alignment check `imx9_ele_get_key()` already has, because invalidating a partial line discards whatever shares it. `imx9_ele_get_random()` changes prototype. Neither function has an in-tree caller, so nothing else moves. ## Depends on The arm64 `up_addrenv_va_to_pa()` in #20192, which is approved. ## Testing Compiles for `imx93-evk:nsh`. Not yet run on hardware, which is why this is a draft. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
