-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
soc: stm32f7 remove cache memory with dma transfer #35165
Conversation
4b6ec25
to
c058dd1
Compare
rebase, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If commit "drivers: dma: stm32 dmamux has request 0 for mem-to-mem" is fixing a bug, this should be clearly identified.
tests/drivers/dma/chan_blen_transfer/boards/nucleo_f767zi.overlay
Outdated
Show resolved
Hide resolved
tests/drivers/dma/chan_blen_transfer/boards/nucleo_f767zi.overlay
Outdated
Show resolved
Hide resolved
e37a6f5
to
19ab5db
Compare
tested with ./scripts/twister --device-testing --device-serial /dev/ttyACM0 -p nucleo_f746zg -j 2 -T tests/drivers/dma/chan_blen_transfer/ |
Disabling the cache memory when DMA is activated, especially when running the tests/drivers/dma test cases on stm32f7 Signed-off-by: Francois Ramu <francois.ramu@st.com>
single commit for this fix so that it is not mix with other PRs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we need this fix for:
soc/arm/nxp_imx/rt/soc.c
soc/arm/atmel_sam/same70/soc.c
soc/arm/atmel_sam/samv71/soc.c
And if we should refactor that code into something come for M7's to do this in one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation is incorrect. From the description of NOCACHE_MEMORY
Kconfig option
Add a "nocache" read-write memory section that is configured to
not be cached. This memory section can be used to perform DMA
transfers when cache coherence issues are not optimal or can not
be solved using cache maintenance operations.
The option adds support for a new, dedicated linker section. Only data placed in this specific, limited RAM section via __nocache
pragma/macro are not cached. This PR disables completely instruction and data cache if CONFIG_NOCACHE_MEMORY=y
.
I fully agree with that. Now if that PR fixes the issue, it means that there is a cache issue somewhere, which can actually be fixed by using no cache memory for that particular region. Alternatively it should be possible to use cache invalidate / clean, but Zephyr still lacks a proper infrastructure to do that. Both DMA and cache are supposed to improve performance. They should not be exclusive. |
Do we think there is a an ordering issue here between MPU init and cache init and that commit changed the order and thus broke M7? |
I have the impression that it worked by chance before and that the cache clean and invalidation is not done the proper way. For instance enabling |
I think the problem is with the clean part of the operation. By reorganizing the code, the call to We should change that part to something like:
Now if we are sure that the D-cache is not enabled at this point, we can just call For the |
This patch is no more relevant since the #35258, isn't it |
Yes, I believe this PR can now be closed. |
When using the DMA on stm32f7, the cache memory is disabled using the CONFIG_NOCACHE_MEMORY
This must be the case when running dma memory-to-memory transfers test cases
tests/driver/dma/chan_blen_transfer
andtests/driver/dma/loop_transfer
on nucleo_f746zg (dma2 is already enabled in the dts of the board)
Signed-off-by: Francois Ramu francois.ramu@st.com
Fixes #35220