[PATCH/RFC] ARM: shmobile: rcar-gen2: Remove CMA reservation code

Wolfram Sang wsa+renesas at sang-engineering.com
Tue Jan 7 03:34:37 PST 2025


On Tue, Jan 07, 2025 at 12:26:55PM +0100, Geert Uytterhoeven wrote:
> If CONFIG_HIGHMEM=y, two reserved blocks are allocated on R-Car Gen2:
> 
>     cma: Reserved 256 MiB at 0x70000000 on node -1
>     cma: Reserved 64 MiB at 0x6c000000 on node -1
> 
> The first block is reserved by the family-specific rcar_gen2_reserve(),
> the second by the common arm_memblock_init() (shmobile_defconfig sets
> CONFIG_CMA_SIZE_MBYTES=64).  As both blocks are reserved (eventually)
> using dma_contiguous_reserve_area(), they both have the same name
> ("reserved").  Hence if CONFIG_CMA_SYSFS=y:
> 
>   sysfs: cannot create duplicate filename '/kernel/mm/cma/reserved'
>    ...
>    cma_sysfs_init from do_one_initcall+0x84/0x178
>    ...
>   kobject: kobject_add_internal failed for reserved with -EEXIST, don't try to register things with the same name in the same directory.
> 
> This causes cma_sysfs_init() to fail completely, and not to create
> /sys/kernel/mm/cma/ at all.
> 
> Fix this by dropping the R-Car Gen2-specific reservation.  Compared to
> when it was introduced, now there exist more flexible mechanisms to
> control the size of memory reserved for CMA.  Users can reserve more
> memory by increasing CONFIG_CMA_SIZE_MBYTES, passing the cma=<N> kernel
> command line parameter, or adding a reserved-memory/linux,cma node to
> DT.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>

Acked-by: Wolfram Sang <wsa+renesas at sang-engineering.com>

> Note that increasing CONFIG_CMA_SIZE_MBYTES in shmobile_defconfig is not
> a good idea, as it can also be used on other Renesas platforms that are
> more memory-constrained than R-Car Gen2.

Ack.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250107/e4604f4c/attachment.sig>


More information about the linux-arm-kernel mailing list