-
Notifications
You must be signed in to change notification settings - Fork 8.1k
ARMV7 MMU : support of the NORMAL and memory-ordered memory type #96575
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
base: main
Are you sure you want to change the base?
Conversation
FYI,
|
I plan to use it in a driver (code not yet updated to add the new attribute): |
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.
Isn't there already a facility for per-platform mmu flag bits somewhere? Plumbing arch-specific details all the way out to the generic API usually causes headaches. If not, a quick change to add a facility (e.g. reserve the top N bits for the arch, etc...) might be a cleaner way to do this.
Also, pedantry: these really aren't "cache" related, they're alignment and ordering rules. It's surely true that they only makes sense for uncacheable regions, but introducing symbols named things like "CACHE_NONE_STRONGLY_ORDERED" seems needlessly confusing.
Reanalyzing the arm64 architecture, I should create a |
@andyross |
Any advice, comments or reviews on this new version would be greatly appreciated. |
Add new flag to allow to select normal non-cacheable memory. This is needed for armV7 to be able to configure non cacheable memories with normal attribute instead of "device" attribute. Signed-off-by: Arnaud Pouliquen <[email protected]>
Allow to configure the MMU for non-cacheable normal memories. This mode is needed for instance by net samples to access to to non word-aligned memory. Signed-off-by: Arnaud Pouliquen <[email protected]>
|
This PR fixes an
Alignment fault
issue encountered when running the/sample/net/zperf
exampleon an STM32MP135F-DK board that embeds a Cortex-A7.
On this board, a memory region is defined and mapped in the MMU to store Ethernet descriptors and buffers. This memory must be non-cacheable because it is accessed by both the network library and the Ethernet peripheral DMA.
The issue occurs in
net_pkt_cursor_operate()
, wherepkt_cursor_advance()
returns 0xE,resulting in a memcpy to address 0xd800000e, which is not aligned on a 32-bit word boundary.
The root cause is that the MMU sets the memory type to device if
K_MEM_CACHE_NONE
is set.In this use case, I would need to register a normal, non-cacheable memory region since this region corresponds to RAM.
This pull request introduces the ability to select the memory type for MMU attributes.
Memory can then be registered using syntax like this: