All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: sparx5: fix bitmask on 32-bit targets
@ 2021-08-02 15:21 ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-08-02 15:21 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Lars Povlsen, Steen Hegelund,
	UNGLinuxDriver, Bjarni Jonasson
  Cc: Arnd Bergmann, netdev, linux-arm-kernel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

I saw the build failure that was fixed in commit 6387f65e2acb ("net:
sparx5: fix compiletime_assert for GCC 4.9") and noticed another
issue that was introduced in the same patch: Using GENMASK() to
create a 64-bit mask does not work on 32-bit architectures.

This probably won't ever happen on this driver since it's specific
to a 64-bit SoC, but it's better to write it portably, so use
GENMASK_ULL() instead.

Fixes: f3cad2611a77 ("net: sparx5: add hostmode with phylink support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
index 1a240e6bddd0..cb68eaaac881 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
@@ -32,7 +32,7 @@ static void __ifh_encode_bitfield(void *ifh, u64 value, u32 pos, u32 width)
 	u32 byte = (35 - (pos / 8));
 	/* Calculate the Start bit position in the Start IFH byte */
 	u32 bit  = (pos % 8);
-	u64 encode = GENMASK(bit + width - 1, bit) & (value << bit);
+	u64 encode = GENMASK_ULL(bit + width - 1, bit) & (value << bit);
 
 	/* The b0-b7 goes into the start IFH byte */
 	if (encode & 0xFF)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] net: sparx5: fix bitmask on 32-bit targets
@ 2021-08-02 15:21 ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-08-02 15:21 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Lars Povlsen, Steen Hegelund,
	UNGLinuxDriver, Bjarni Jonasson
  Cc: Arnd Bergmann, netdev, linux-arm-kernel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

I saw the build failure that was fixed in commit 6387f65e2acb ("net:
sparx5: fix compiletime_assert for GCC 4.9") and noticed another
issue that was introduced in the same patch: Using GENMASK() to
create a 64-bit mask does not work on 32-bit architectures.

This probably won't ever happen on this driver since it's specific
to a 64-bit SoC, but it's better to write it portably, so use
GENMASK_ULL() instead.

Fixes: f3cad2611a77 ("net: sparx5: add hostmode with phylink support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
index 1a240e6bddd0..cb68eaaac881 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
@@ -32,7 +32,7 @@ static void __ifh_encode_bitfield(void *ifh, u64 value, u32 pos, u32 width)
 	u32 byte = (35 - (pos / 8));
 	/* Calculate the Start bit position in the Start IFH byte */
 	u32 bit  = (pos % 8);
-	u64 encode = GENMASK(bit + width - 1, bit) & (value << bit);
+	u64 encode = GENMASK_ULL(bit + width - 1, bit) & (value << bit);
 
 	/* The b0-b7 goes into the start IFH byte */
 	if (encode & 0xFF)
-- 
2.29.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: sparx5: fix bitmask on 32-bit targets
  2021-08-02 15:21 ` Arnd Bergmann
@ 2021-08-03 11:00   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-03 11:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: davem, kuba, lars.povlsen, Steen.Hegelund, UNGLinuxDriver,
	bjarni.jonasson, arnd, netdev, linux-arm-kernel, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon,  2 Aug 2021 17:21:53 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> I saw the build failure that was fixed in commit 6387f65e2acb ("net:
> sparx5: fix compiletime_assert for GCC 4.9") and noticed another
> issue that was introduced in the same patch: Using GENMASK() to
> create a 64-bit mask does not work on 32-bit architectures.
> 
> [...]

Here is the summary with links:
  - net: sparx5: fix bitmask on 32-bit targets
    https://git.kernel.org/netdev/net/c/f41e57af926a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: sparx5: fix bitmask on 32-bit targets
@ 2021-08-03 11:00   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-03 11:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: davem, kuba, lars.povlsen, Steen.Hegelund, UNGLinuxDriver,
	bjarni.jonasson, arnd, netdev, linux-arm-kernel, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon,  2 Aug 2021 17:21:53 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> I saw the build failure that was fixed in commit 6387f65e2acb ("net:
> sparx5: fix compiletime_assert for GCC 4.9") and noticed another
> issue that was introduced in the same patch: Using GENMASK() to
> create a 64-bit mask does not work on 32-bit architectures.
> 
> [...]

Here is the summary with links:
  - net: sparx5: fix bitmask on 32-bit targets
    https://git.kernel.org/netdev/net/c/f41e57af926a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-03 11:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 15:21 [PATCH] net: sparx5: fix bitmask on 32-bit targets Arnd Bergmann
2021-08-02 15:21 ` Arnd Bergmann
2021-08-03 11:00 ` patchwork-bot+netdevbpf
2021-08-03 11:00   ` patchwork-bot+netdevbpf

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.