[EXT] [PATCH 2/3] arm: a37xx: pci: Optimize a3700_fdt_fix_pcie_regions() when fixup offset is zero

Kostya Porotchkin kostap at marvell.com
Sun Jul 11 12:08:38 CEST 2021



> -----Original Message-----
> From: Pali Rohár <pali at kernel.org>
> Sent: Thursday, July 8, 2021 21:19
> To: Stefan Roese <sr at denx.de>; Kostya Porotchkin <kostap at marvell.com>
> Cc: Marek Behún <marek.behun at nic.cz>; u-boot at lists.denx.de
> Subject: [EXT] [PATCH 2/3] arm: a37xx: pci: Optimize
> a3700_fdt_fix_pcie_regions() when fixup offset is zero
> 
> External Email
> 
> ----------------------------------------------------------------------
> If fixup offset is zero then there is nothing to fix. All calculation in this case just
> increase addresses by value zero which results in identity.
> So in this case skip whole fixup re-calculation as it is not needed.
> 
> This is just an optimization for special case when fix_offset is zero which skips
> code path which does only identity operations (meaning nothing). No functional
> changes.
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>
> ---
>  arch/arm/mach-mvebu/armada3700/cpu.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-
> mvebu/armada3700/cpu.c
> index 4dd9de471b4e..64838b16c4d8 100644
> --- a/arch/arm/mach-mvebu/armada3700/cpu.c
> +++ b/arch/arm/mach-mvebu/armada3700/cpu.c
> @@ -339,6 +339,10 @@ int a3700_fdt_fix_pcie_regions(void *blob)
>  	/* Calculate fixup offset from first child address (in last cell) */
>  	fix_offset = base - fdt32_to_cpu(ranges[2]);
> 
> +	/* If fixup offset is zero then there is nothing to fix */
> +	if (!fix_offset)
> +		return 0;
> +
>  	/*
>  	 * Fix address (last cell) of each child address and each parent
>  	 * address
> --
> 2.20.1
Reviewed-by: Konstantin Porotchkin <kostap at marvell.com>



More information about the U-Boot mailing list