Hi Peng, On Wed, 2020-03-25 at 12:30 +0000, Peng Fan wrote: > > > > I see a few potential options: > > > > > > > > a) Ensure the CMA is contained within a single zone. > > > > > > This will break legacy dts with new version kernel. > > > > > > > How large is it in your case? > > > > > > It is 1GB > > > > > > > Is it allocated by the kernel dynamically or a fixed start set by > > > > the boot loader? > > > > > > We use alloc-ranges and size in kernel dts. > > > > > > But there is only 2GB DRAM in the board. > > > > So I guess without changing the dts, option (a) doesn't really work. > > > > > > b) Change the CMA allocator to allow spanning multiple zones (last time > > > > I looked it wasn't trivial since it relied on some per-zone lock). I like this as a solution, ultimately why should CMA be linked to a specific zone. Also, crossing the ZONE_DMA/ZONE_DMA32 boundary shouldn't be an issue since we already default to ZONE_DMA32 as the default area for CMA. That said, easier said than done. > > > > c) Make ZONE_DMA dynamic on arm64 and only enable it if RPi4. > > > > > > Option c seems a bit easier to me :) > > > > > > I will try to explore both, but if you have time to help, that would > > > be appreciated. > > > > I don't have time but option (c) was already discussed and there are patches > > from Nicolas on the list: > > > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ke > > rnel.org%2Flinux-arm-kernel%2F20190820145821.27214-5-nsaenzjulienne% > > 40suse.de%2F&data=02%7C01%7Cpeng.fan%40nxp.com%7C6403ddf37 > > 89b452ae5ee08d7d0a5a659%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 > > %7C0%7C637207282191026738&sdata=t2cZ9HTCcRuaL9RO4kD%2BzN > > 2n4VqM%2F66zYNZIOComCVs%3D&reserved=0 > > > > The above series was checking whether the platform is RPi4 and limiting the > > ZONE_DMA size to 1GB (otherwise 4GB with ZONE_DMA32 empty). We > > ended up with a static 1GB for ZONE_DMA but we missed the fact that it may > > break existing platforms. > > Thanks for the information. I'll check the patchset and work out something > proper to fix the issue I met. Just an FYI, I'm follwing the conversation, and will try to look into as soon as I get some free time. In the meantime if you want me to test/review anything on the Raspberry Pi, I'll be happy to. Regards, Nicolas