* [PATCH BUGFIX u-boot-marvell] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x
@ 2021-03-04 10:23 Marek Behún
2021-03-04 13:35 ` Stefan Roese
2021-03-12 8:52 ` Stefan Roese
0 siblings, 2 replies; 3+ messages in thread
From: Marek Behún @ 2021-03-04 10:23 UTC (permalink / raw)
To: u-boot
In arch/arm/mach-mvebu/dram.c we always include axp's xor.h for common
XOR definitions, regardless whether we compile for axp or a38x.
But the declaration of this function has a different signature in axp's
xor.h from the one used in a38x' implementation - one parameter is u64
instead of u32. This can result in wrong argument's being passed to that
function on a38x with no one the wiser.
I discovered this when building U-Boot for Turris Omnia with LTO. The
compiler complains about the different signatures being thrown into the
same linking process:
axp/xor.h:67:5: warning: type of ?mv_xor_mem_init? does not match
original declaration [-Wlto-type-mismatch]
67 | int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size,
| ^
a38x/xor.c:165:5: note: type mismatch in parameter 3
165 | int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long
| ^
a38x/xor.c:165:5: note: type ?long long unsigned int? should match
type ?u32?
Fix this by changing the type of the block_size argument in the axp's
implementation and header file to the one used in a38x (and upstream
mv-ddr-marvell).
Signed-off-by: Marek Beh?n <marek.behun@nic.cz>
---
drivers/ddr/marvell/axp/xor.c | 4 ++--
drivers/ddr/marvell/axp/xor.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/ddr/marvell/axp/xor.c b/drivers/ddr/marvell/axp/xor.c
index 17bfe6a7bf..76aea96682 100644
--- a/drivers/ddr/marvell/axp/xor.c
+++ b/drivers/ddr/marvell/axp/xor.c
@@ -152,8 +152,8 @@ static int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl)
return MV_OK;
}
-int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size, u32 init_val_high,
- u32 init_val_low)
+int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long block_size,
+ u32 init_val_high, u32 init_val_low)
{
u32 tmp;
diff --git a/drivers/ddr/marvell/axp/xor.h b/drivers/ddr/marvell/axp/xor.h
index 97d1056432..a7c6ae840c 100644
--- a/drivers/ddr/marvell/axp/xor.h
+++ b/drivers/ddr/marvell/axp/xor.h
@@ -64,7 +64,7 @@ int mv_xor_state_get(u32 chan);
void mv_sys_xor_init(MV_DRAM_INFO *dram_info);
void mv_sys_xor_finish(void);
int mv_xor_transfer(u32 chan, int xor_type, u32 xor_chain_ptr);
-int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size, u32 init_val_high,
- u32 init_val_low);
+int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long block_size,
+ u32 init_val_high, u32 init_val_low);
#endif /* __XOR_H */
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH BUGFIX u-boot-marvell] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x
2021-03-04 10:23 [PATCH BUGFIX u-boot-marvell] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x Marek Behún
@ 2021-03-04 13:35 ` Stefan Roese
2021-03-12 8:52 ` Stefan Roese
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2021-03-04 13:35 UTC (permalink / raw)
To: u-boot
On 04.03.21 11:23, Marek Beh?n wrote:
> In arch/arm/mach-mvebu/dram.c we always include axp's xor.h for common
> XOR definitions, regardless whether we compile for axp or a38x.
>
> But the declaration of this function has a different signature in axp's
> xor.h from the one used in a38x' implementation - one parameter is u64
> instead of u32. This can result in wrong argument's being passed to that
> function on a38x with no one the wiser.
>
> I discovered this when building U-Boot for Turris Omnia with LTO. The
> compiler complains about the different signatures being thrown into the
> same linking process:
>
> axp/xor.h:67:5: warning: type of ?mv_xor_mem_init? does not match
> original declaration [-Wlto-type-mismatch]
> 67 | int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size,
> | ^
> a38x/xor.c:165:5: note: type mismatch in parameter 3
> 165 | int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long
> | ^
> a38x/xor.c:165:5: note: type ?long long unsigned int? should match
> type ?u32?
>
> Fix this by changing the type of the block_size argument in the axp's
> implementation and header file to the one used in a38x (and upstream
> mv-ddr-marvell).
>
> Signed-off-by: Marek Beh?n <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Thanks,
Stefan
> ---
> drivers/ddr/marvell/axp/xor.c | 4 ++--
> drivers/ddr/marvell/axp/xor.h | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ddr/marvell/axp/xor.c b/drivers/ddr/marvell/axp/xor.c
> index 17bfe6a7bf..76aea96682 100644
> --- a/drivers/ddr/marvell/axp/xor.c
> +++ b/drivers/ddr/marvell/axp/xor.c
> @@ -152,8 +152,8 @@ static int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl)
> return MV_OK;
> }
>
> -int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size, u32 init_val_high,
> - u32 init_val_low)
> +int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long block_size,
> + u32 init_val_high, u32 init_val_low)
> {
> u32 tmp;
>
> diff --git a/drivers/ddr/marvell/axp/xor.h b/drivers/ddr/marvell/axp/xor.h
> index 97d1056432..a7c6ae840c 100644
> --- a/drivers/ddr/marvell/axp/xor.h
> +++ b/drivers/ddr/marvell/axp/xor.h
> @@ -64,7 +64,7 @@ int mv_xor_state_get(u32 chan);
> void mv_sys_xor_init(MV_DRAM_INFO *dram_info);
> void mv_sys_xor_finish(void);
> int mv_xor_transfer(u32 chan, int xor_type, u32 xor_chain_ptr);
> -int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size, u32 init_val_high,
> - u32 init_val_low);
> +int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long block_size,
> + u32 init_val_high, u32 init_val_low);
>
> #endif /* __XOR_H */
>
Viele Gr??e,
Stefan
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH BUGFIX u-boot-marvell] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x
2021-03-04 10:23 [PATCH BUGFIX u-boot-marvell] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x Marek Behún
2021-03-04 13:35 ` Stefan Roese
@ 2021-03-12 8:52 ` Stefan Roese
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2021-03-12 8:52 UTC (permalink / raw)
To: u-boot
On 04.03.21 11:23, Marek Beh?n wrote:
> In arch/arm/mach-mvebu/dram.c we always include axp's xor.h for common
> XOR definitions, regardless whether we compile for axp or a38x.
>
> But the declaration of this function has a different signature in axp's
> xor.h from the one used in a38x' implementation - one parameter is u64
> instead of u32. This can result in wrong argument's being passed to that
> function on a38x with no one the wiser.
>
> I discovered this when building U-Boot for Turris Omnia with LTO. The
> compiler complains about the different signatures being thrown into the
> same linking process:
>
> axp/xor.h:67:5: warning: type of ?mv_xor_mem_init? does not match
> original declaration [-Wlto-type-mismatch]
> 67 | int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size,
> | ^
> a38x/xor.c:165:5: note: type mismatch in parameter 3
> 165 | int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long
> | ^
> a38x/xor.c:165:5: note: type ?long long unsigned int? should match
> type ?u32?
>
> Fix this by changing the type of the block_size argument in the axp's
> implementation and header file to the one used in a38x (and upstream
> mv-ddr-marvell).
>
> Signed-off-by: Marek Beh?n <marek.behun@nic.cz>
Applied to u-boot-marvell/master
Thanks,
Stefan
> ---
> drivers/ddr/marvell/axp/xor.c | 4 ++--
> drivers/ddr/marvell/axp/xor.h | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ddr/marvell/axp/xor.c b/drivers/ddr/marvell/axp/xor.c
> index 17bfe6a7bf..76aea96682 100644
> --- a/drivers/ddr/marvell/axp/xor.c
> +++ b/drivers/ddr/marvell/axp/xor.c
> @@ -152,8 +152,8 @@ static int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl)
> return MV_OK;
> }
>
> -int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size, u32 init_val_high,
> - u32 init_val_low)
> +int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long block_size,
> + u32 init_val_high, u32 init_val_low)
> {
> u32 tmp;
>
> diff --git a/drivers/ddr/marvell/axp/xor.h b/drivers/ddr/marvell/axp/xor.h
> index 97d1056432..a7c6ae840c 100644
> --- a/drivers/ddr/marvell/axp/xor.h
> +++ b/drivers/ddr/marvell/axp/xor.h
> @@ -64,7 +64,7 @@ int mv_xor_state_get(u32 chan);
> void mv_sys_xor_init(MV_DRAM_INFO *dram_info);
> void mv_sys_xor_finish(void);
> int mv_xor_transfer(u32 chan, int xor_type, u32 xor_chain_ptr);
> -int mv_xor_mem_init(u32 chan, u32 start_ptr, u32 block_size, u32 init_val_high,
> - u32 init_val_low);
> +int mv_xor_mem_init(u32 chan, u32 start_ptr, unsigned long long block_size,
> + u32 init_val_high, u32 init_val_low);
>
> #endif /* __XOR_H */
>
Viele Gr??e,
Stefan
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-12 8:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 10:23 [PATCH BUGFIX u-boot-marvell] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x Marek Behún
2021-03-04 13:35 ` Stefan Roese
2021-03-12 8:52 ` Stefan Roese
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.