diff mbox series

[v2] ARM: mvebu: Warn about memory chunks too small for DDR training

Message ID 20240712081302.901842-2-u.kleine-koenig@baylibre.com (mailing list archive)
State New, archived
Headers show
Series [v2] ARM: mvebu: Warn about memory chunks too small for DDR training | expand

Commit Message

Uwe Kleine-König July 12, 2024, 8:13 a.m. UTC
For each memory region the first 10K are reserved for DDR training. Emit
a warning if the area happens to be smaller than these 10K. This should
not happen, but if it does this message simplifies diagnosing the
problem.

This fixes a W=1 compiler error:

	arch/arm/mach-mvebu/board-v7.c: In function ‘mvebu_scan_mem’:
	arch/arm/mach-mvebu/board-v7.c:84:27: error: variable ‘size’ set but not used [-Werror=unused-but-set-variable]
	   84 |                 u64 base, size;
	      |                           ^~~~

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

the (implicit) first iteration of this patch is available at
https://lore.kernel.org/linux-arm-kernel/20240708093145.1398949-2-u.kleine-koenig@baylibre.com/

In this v2 the size variable is evaluated to emit a warning instead of
being dropped, which was done in v1.

Best regards
Uwe

 arch/arm/mach-mvebu/board-v7.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrew Lunn July 13, 2024, 5:35 p.m. UTC | #1
On Fri, Jul 12, 2024 at 10:13:01AM +0200, Uwe Kleine-König wrote:
> For each memory region the first 10K are reserved for DDR training. Emit
> a warning if the area happens to be smaller than these 10K. This should
> not happen, but if it does this message simplifies diagnosing the
> problem.
> 
> This fixes a W=1 compiler error:
> 
> 	arch/arm/mach-mvebu/board-v7.c: In function ‘mvebu_scan_mem’:
> 	arch/arm/mach-mvebu/board-v7.c:84:27: error: variable ‘size’ set but not used [-Werror=unused-but-set-variable]
> 	   84 |                 u64 base, size;
> 	      |                           ^~~~
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Gregory CLEMENT Sept. 2, 2024, 12:35 p.m. UTC | #2
Hi Uwe,

> For each memory region the first 10K are reserved for DDR training. Emit
> a warning if the area happens to be smaller than these 10K. This should
> not happen, but if it does this message simplifies diagnosing the
> problem.
>
> This fixes a W=1 compiler error:
>
> 	arch/arm/mach-mvebu/board-v7.c: In function ‘mvebu_scan_mem’:
> 	arch/arm/mach-mvebu/board-v7.c:84:27: error: variable ‘size’ set but not used [-Werror=unused-but-set-variable]
> 	   84 |                 u64 base, size;
> 	      |                           ^~~~
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

Applied on mvebu/arm

Thanks,

Gregory
> ---
> Hello,
>
> the (implicit) first iteration of this patch is available at
> https://lore.kernel.org/linux-arm-kernel/20240708093145.1398949-2-u.kleine-koenig@baylibre.com/
>
> In this v2 the size variable is evaluated to emit a warning instead of
> being dropped, which was done in v1.
>
> Best regards
> Uwe
>
>  arch/arm/mach-mvebu/board-v7.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
> index fd5d0c8ff695..04ad651d13a0 100644
> --- a/arch/arm/mach-mvebu/board-v7.c
> +++ b/arch/arm/mach-mvebu/board-v7.c
> @@ -86,6 +86,9 @@ static int __init mvebu_scan_mem(unsigned long node, const char *uname,
>  		base = dt_mem_next_cell(dt_root_addr_cells, &reg);
>  		size = dt_mem_next_cell(dt_root_size_cells, &reg);
>  
> +		if (size < MVEBU_DDR_TRAINING_AREA_SZ)
> +			pr_warn("Too little memory to reserve for DDR training\n");
> +
>  		memblock_reserve(base, MVEBU_DDR_TRAINING_AREA_SZ);
>  	}
>  
> -- 
> 2.43.0
diff mbox series

Patch

diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index fd5d0c8ff695..04ad651d13a0 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -86,6 +86,9 @@  static int __init mvebu_scan_mem(unsigned long node, const char *uname,
 		base = dt_mem_next_cell(dt_root_addr_cells, &reg);
 		size = dt_mem_next_cell(dt_root_size_cells, &reg);
 
+		if (size < MVEBU_DDR_TRAINING_AREA_SZ)
+			pr_warn("Too little memory to reserve for DDR training\n");
+
 		memblock_reserve(base, MVEBU_DDR_TRAINING_AREA_SZ);
 	}