Repository navigation
xiongmai-osdrv-xm530: set_allocator cma, the media share as a CMA area - #2711
Conversation
The XM530/XM550 kernel gets CONFIG_CMA, with no area unless cma= asks for one (4 KB of kernel). set_allocator cma [osmem] gives Linux all of DDR but the top 1 MB and reserves DDR - osmem as cma=, which open_mmz allocator=cma takes the media buffers from; Linux uses what they don't. The 1 MB stays a zone for xm530_rgn, which ioremap()s its block. set_allocator xm restores mem=<osmem>, the default. set_allocator cma refuses a kernel without CMA or an image without open_mmz and open_vi (the vendor VI ioremap()s its buffers), which would boot without video. load_xiongmai loads open_mmz allocator=cma on a mmz_allocator=cma boot, and now reads mem= wherever it is on the command line.
9883ae1 to
085403e
Compare
PR Summary by QodoAdd opt-in CMA media allocation for XM530/XM550
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
…; a CMA boot stops on an open_mmz failure set_allocator writes both variables with one fw_setenv -s, so a failed write leaves neither changed. On a mmz_allocator=cma boot the fixed zone is 1 MB, so load_xiongmai reports an open_mmz failure and stops instead of loading the media modules on it.
This lets an XM530/XM550 camera opt in to a CMA-backed MMZ, as
set_allocatordoes on Goke and HiSilicon. The default stays the fixedmem=zone.Builds on:
struct devicelayout and the zonelist offset).cma=, the default layout), coherent memory comes from the page allocator. Without it, everydma_alloc_coherent()fails, and the XM550 oopses in the Ethernet driver at every boot. This PR must not merge before При ночном режиме картинка сиреневая #160.open_mmz allocator=cma. The xiongmai-opensdk pin moves to it (bf18f77).Changes
xm530.generic.configgetsCONFIG_CMA=ywithCONFIG_CMA_SIZE_MBYTES=0, so no area is reserved unlesscma=asks for one. That costs about 4 KB of kernel.set_allocator cma [osmem]: writesmem=<DDR-1>M cma=<DDR-1-osmem>M mmz_allocator=cmaand keeps the rest of bootargs in order.xm530_rgn, whichioremap()s its block.open_mmz/open_vi, since either would boot without video.set_allocator xm [osmem]: writesmem=<osmem>M, the default layout.load_xiongmai: on ammz_allocator=cmaboot it loadsopen_mmz allocator=cma, and it now readsmem=from anywhere on the command line.Tested
xm530_lite image built from this branch (kernel with #160 applied), flashed with sysupgrade onto an XM550 + IMX335:
mem=80M):open_mmzwith the fixed zone andopen_vi, no oops, snapshot OK.set_allocator cma 96, then reboot:mem=127M cma=31M mmz_allocator=cma, with 32 MiB of CMA reserved. majestic's 22 MB in 13 blocks came from CMA,rgnfrom the 1 MB zone, with 86 MB of memory free. No oops, snapshot OK.set_allocator xm 80, then reboot: back tomem=80Mand the fixed zone, snapshot OK.