-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
arm: stm32: Data cache (dcache) management update #44692
arm: stm32: Data cache (dcache) management update #44692
Conversation
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 don't think we should go with this solution as this is globally the same as #35165 which was already rejected
@erwango The #35165 has been already accepted and pulled - the And the current situation (as it is now in Zephyr repo's - With this patch we are going one small step forward - with having DCache enabled with DMA running with Some STM32 drivers do require defining the This patch allows developers to use DCache and also check if their |
Ok, this is not strictly exact, but in the end you're right. |
The problem here is that we already have many systems with DCache disabled when However, I don't mind to follow your guidelines if other developers (i.e. @de-nordic @Laczen @FRASTM @ABOSTM @nvlsianpu ) agree about this approach. |
Gentle PING on this patch set .... |
I'd go for deactivating it by default and add a note in the release note to inform users. |
@erwango Shouldn't, also, the option be dependent on Wouldn't we maybe go further add something like 'HAS_HW_DCACHE', that would be selected by platform and that would then show the Maybe we can, instead of
And it would be |
@de-nordic Is there any example of However, such approach could break some existing STM32H7 boards, as they run with DCACHE disabled when drivers with |
This is a good example of this non sense situation. This should be fixed. And on these ones, I don't think this should raise issues. |
Please correct my understanding if it is wrong:
Or am I missing something? |
Yes. Use
Yes, for STM32H7 based boards only.
Unfortunately, I don't see way to generate a smart warning, so I can think of only 2 ways to help out of tree users:
Fine with me. Maybe @de-nordic can comment.
We'll aslo need to get STM32F7 to also use DCACHE, but that's another story. |
@de-nordic Do you have any input or comments to the above plan? |
46fb34d
to
7baa667
Compare
This option is by default defined and explicitly enables the data cache on a target platform. Signed-off-by: Lukasz Majewski <[email protected]>
Up till now the usage of CONFIG_NOCACHE_MEMORY also explicitly disables data cache on the STM32H7 SoC. With this change the usage of CONFIG_NOCACHE_MEMORY has been decoupled from data cache enabling as new Kconfig option - namely CONFIG_DCACHE is now used to explicitly enable it. After this change it would be possible to use data cache on STM32H7 with DMA buffers, fragile to cache coherency issues, defined with '__nocache' attribute. Such approach would improve the overall STM32H7 performance until the moment when proper (i.e. in-DMA) buffer cache management is developed. Signed-off-by: Lukasz Majewski <[email protected]>
As now the CONFIG_NOCACHE_MEMORY is not responsible for controlling the data cache on STM32H7 SoC, the CONFIG_DCACHE=n must be set explicitly to preserve previous behavior as UART driver is not using no-cache buffers. Considering the above comment, the CONFIG_NOCACHE_MEMORY can be safely removed. Signed-off-by: Lukasz Majewski <[email protected]>
…DCACHE Add information entry to release-notes-3.1.rst regarding data cache management on the STM32H7 SoC. Signed-off-by: Lukasz Majewski <[email protected]>
It has been validated that the nucleo_h743zi board works correctly, with '__nocache' buffers and data caches enabled, so this patch enables support for the former. Signed-off-by: Lukasz Majewski <[email protected]>
1f26680
to
8a552fc
Compare
@nashif @carlescufi Can this patch set be pulled? |
This patch series fixes problem with enabling at the same time STM32H7's Data cache and CONFIG_NOCACHE_MEMORY option.
On the STM32 it shall be possible to use memory buffers with
__nocache
attribute with data cache being enabled.This is not the best possible solution - one could fix cache coherency issues on the DMA driver level, but allows avoiding
performance penalty when data cache is disabled.
This solution has been tested on
nucleo_h743zi
withlittlefs
sample program.west build -p always -b nucleo_h743zi ./zephyr/samples/subsys/fs/littlefs -DCONF_FILE=prj_blk.conf
This patch series comply with point '2.1' of #36471
Fixes: #45739