lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 10 Nov 2015 14:43:05 +0100
From:	Marek Szyprowski <m.szyprowski@...sung.com>
To:	Jason Liu <r64343@...escale.com>, devicetree@...r.kernel.org
Cc:	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	robh+dt@...nel.org, grant.likely@...aro.org
Subject: Re: [PATCH 1/1] drivers: of: of_reserved_mem: fixup the alignment with
 CMA setup

Hello,

On 2015-11-10 13:30, Jason Liu wrote:
> There is an alignment mismatch issue between the of_reserved_mem and
> the CMA setup requirement. The of_reserved_mem will try to get the
> alignment value from the DTS and pass it to __memblock_alloc_base to
> do the memory block base allocation, but the alignment value specified
> in the DTS may not satisfy the CAM setup requirement since CMA setup
> required the alignment as the following in the code:
>
> align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
>
> The sanity check in the function of rmem_cma_setup will fail if the
> alignment does not setup correctly and thus CMA will fail to setup.
>
> This patch is to fixup the alignment to meet the CMA setup required.
>
> Mailing-list-thread: https://lkml.org/lkml/2015/11/9/138
> Signed-off-by: Jason Liu <r64343@...escale.com>
> Cc: Marek Szyprowski <m.szyprowski@...sung.com>
> Cc: Grant Likely <grant.likely@...aro.org>
> Cc: Rob Herring <robh+dt@...nel.org>

Acked-by: Marek Szyprowski <m.szyprowski@...sung.com>

> ---
>   drivers/of/of_reserved_mem.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index 62f467b..9394311 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -124,6 +124,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
>   		align = dt_mem_next_cell(dt_root_addr_cells, &prop);
>   	}
>   
> +	/* Need adjust the alignment to satisfy the CMA requirement */
> +	if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))
> +		align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
> +
>   	prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
>   	if (prop) {
>   

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ