Repository navigation
xm530: CONFIG_CMA without an area, coherent memory from the page allocator - #160
Merged
Merged
Conversation
…cator With CONFIG_CMA, 3.10's ARM dma-mapping takes every non-atomic coherent allocation, and the atomic pool, from CMA without checking that there is an area. A kernel booted without cma= (CONFIG_CMA_SIZE_MBYTES=0) has none, so every dma_alloc_coherent() failed: on an XM550 booted mem=80M, pl330 could not create its channels and the Ethernet driver oopsed on a NULL descriptor ring as udhcpc started, at every boot. Take CMA only when the device has an area, and the page allocator otherwise, as later kernels do. The area is reserved at boot, so an allocation and its free take the same path. Tested on the XM550: booted mem=80M it comes up with pl330 and Ethernet, and majestic runs on the fixed zone; booted mem=127M cma=31M the area is reserved and open_mmz allocator=cma serves majestic from it.
PR Summary by QodoFall back to page allocation when no CMA area exists
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up to #157, found while testing a full firmware image with CONFIG_CMA on.
With CONFIG_CMA, 3.10's ARM
dma-mapping.ctakes the atomic pool and every non-atomicdma_alloc_coherent()from CMA without checking that an area exists. With nocma=andCONFIG_CMA_SIZE_MBYTES=0, which is firmware's default layout, there is none, so every coherent allocation fails. On an XM550 bootedmem=80M, pl330 couldn't create its channels, and the Ethernet driver oopsed on a NULL descriptor ring when udhcpc started, at every boot.This takes CMA only when the device has an area (
dev_get_cma_area()) and falls back to the page allocator otherwise, as later kernels do. The area is reserved at boot, so an allocation and its free always take the same path. Without CONFIG_CMA,dev_has_cma()isfalseand the code is unchanged.Tested on the XM550, flashed:
mem=80M, nocma=: pl330 and Ethernet come up, with no oops, and majestic runs on the fixed zone (open_mmzdefault).mem=127M cma=31M: 32 MiB is reserved, andopen_mmz allocator=cmaserves majestic from it (22 MB).Firmware doesn't enable CONFIG_CMA yet. OpenIPC/firmware#2711 will, after this.