Skip to contentSkip to conversation

drm/rockchip: avoid 64-bit division

PATCH In review Arnd Bergmann 5 participants 8 messages Oct 18, 2024 – Nov 29, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/rockchip: avoid 64-bit division

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
 		 * comment in rk_hdptx_phy_power_on() from
 		 * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
 		 */
-		phy_set_bus_width(hdmi->phy, rate / 100);
+		phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
 	}
 }
 
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

Quoted 8 lines

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")

Can someone please pick this up? It is still broken in next-20241104...

https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2oNvJFRj8tkDieb6VfrMf4rh1Kn/build.log

Quoted 20 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
 		 * comment in rk_hdptx_phy_power_on() from
 		 * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
 		 */
-		phy_set_bus_width(hdmi->phy, rate / 100);
+		phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
 	}
 }
 
Signature · 1 line
2.39.5
#3 lore raw
Quoted 22 lines · Nathan Chancellor
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")

Can someone please pick this up? It is still broken in next-20241104...

https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2oNvJFRj8tkDieb6VfrMf4rh1Kn/build.log

Quoted 4 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder) · line 87

Quoted 12 lines
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
               * comment in rk_hdptx_phy_power_on() from
               * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
               */
-             phy_set_bus_width(hdmi->phy, rate / 100);
+             phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
      }
 }

[email protected] has just told me this build issue is now upstream:

    FAILED linus/m68k-allmodconfig/m68k-gcc8.1 Fri Nov 22, 05:34
    http://kisskb.ellerman.id.au/kisskb/buildresult/15277242/

    Commit:   Merge tag 'drm-next-2024-11-21' of
https://gitlab.freedesktop.org/drm/kernel
              28eb75e178d389d325f1666e422bc13bbbb9804c
    Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30

    ERROR: modpost: "__udivdi3"

[drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

Applying this patch fixes it, so

Do we really need +5 weeks to apply a fix for a reported build issue? Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#4 lore raw
Quoted 47 lines · Geert Uytterhoeven
Quoted 22 lines · Nathan Chancellor
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")

Can someone please pick this up? It is still broken in next-20241104...

https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2oNvJFRj8tkDieb6VfrMf4rh1Kn/build.log

Quoted 4 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder) · line 87

Quoted 12 lines
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
               * comment in rk_hdptx_phy_power_on() from
               * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
               */
-             phy_set_bus_width(hdmi->phy, rate / 100);
+             phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
      }
 }

[email protected] has just told me this build issue is now upstream:

    FAILED linus/m68k-allmodconfig/m68k-gcc8.1 Fri Nov 22, 05:34
    http://kisskb.ellerman.id.au/kisskb/buildresult/15277242/

    Commit:   Merge tag 'drm-next-2024-11-21' of
https://gitlab.freedesktop.org/drm/kernel
              28eb75e178d389d325f1666e422bc13bbbb9804c
    Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30

    ERROR: modpost: "__udivdi3"
Quoted 6 lines

[drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

Applying this patch fixes it, so

Do we really need +5 weeks to apply a fix for a reported build issue?

Do we really need that kind of comments?

It was applied already, I made sure it's part of the next PR we send to Linus. And it should be in linux-next tomorrow.

Maxime

#5 lore raw

Hi Maxime,

Quoted 50 lines · Maxime Ripard
Quoted 49 lines · Geert Uytterhoeven
Quoted 22 lines · Nathan Chancellor
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")

Can someone please pick this up? It is still broken in next-20241104...

https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2oNvJFRj8tkDieb6VfrMf4rh1Kn/build.log

Quoted 4 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder) · line 87

Quoted 12 lines
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
               * comment in rk_hdptx_phy_power_on() from
               * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
               */
-             phy_set_bus_width(hdmi->phy, rate / 100);
+             phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
      }
 }

[email protected] has just told me this build issue is now upstream:

    FAILED linus/m68k-allmodconfig/m68k-gcc8.1 Fri Nov 22, 05:34
    http://kisskb.ellerman.id.au/kisskb/buildresult/15277242/

    Commit:   Merge tag 'drm-next-2024-11-21' of
https://gitlab.freedesktop.org/drm/kernel
              28eb75e178d389d325f1666e422bc13bbbb9804c
    Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30

    ERROR: modpost: "__udivdi3"

[drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

Quoted 6 lines
Quoted 4 lines

Applying this patch fixes it, so

Do we really need +5 weeks to apply a fix for a reported build issue?

Do we really need that kind of comments?

Perhaps not...

Quoted 1 line

It was applied already,

Where was it applied?
How would I know that, when the fix is not in linux-next?

Quoted 2 lines

I made sure it's part of the next PR we send to
Linus. And it should be in linux-next tomorrow.

Thank you!

The issue is that the reported build issue was not fixed in linux-next, despite the fix having been available for 5 weeks, thus reducing (build) test coverage for all affected architectures, possibly hiding other issues.
In addition, a PR including the build issue was sent to Linus, so now the above applies to Linus' tree, too.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw
In reply to Maxime Ripard

Hi Maxime,

Quoted 53 lines · Maxime Ripard
Quoted 52 lines · Geert Uytterhoeven
Quoted 22 lines · Nathan Chancellor
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")

Can someone please pick this up? It is still broken in next-20241104...

https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2oNvJFRj8tkDieb6VfrMf4rh1Kn/build.log

Quoted 4 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder) · line 87

Quoted 12 lines
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
               * comment in rk_hdptx_phy_power_on() from
               * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
               */
-             phy_set_bus_width(hdmi->phy, rate / 100);
+             phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
      }
 }

[email protected] has just told me this build issue is now upstream:

    FAILED linus/m68k-allmodconfig/m68k-gcc8.1 Fri Nov 22, 05:34
    http://kisskb.ellerman.id.au/kisskb/buildresult/15277242/

    Commit:   Merge tag 'drm-next-2024-11-21' of
https://gitlab.freedesktop.org/drm/kernel
              28eb75e178d389d325f1666e422bc13bbbb9804c
    Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30

    ERROR: modpost: "__udivdi3"

[drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

Applying this patch fixes it, so

Quoted 6 lines
Quoted 1 line

Do we really need +5 weeks to apply a fix for a reported build issue?

Do we really need that kind of comments?

It was applied already, I made sure it's part of the next PR we send to Linus. And it should be in linux-next tomorrow.

Thank you, I can confirm it is now commit 818956c76517e127 ("drm/rockchip: avoid 64-bit division") in drm-misc/for-linux-next and next-20241125.

Interestingly, the commit description contains:

    (cherry picked from commit 4b64b4a81fcd51f570c046cf904aef19ec756d45)

which is not in any tree on git.kernel.org, but the github collective does know about it:
https://github.com/torvalds/linux/commit/4b64b4a81fcd51f570c046cf904aef19ec756d45

Probably you want to drop that line.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#7 lore raw
Quoted 67 lines · Geert Uytterhoeven

Hi Maxime,

Quoted 53 lines · Maxime Ripard
Quoted 52 lines · Geert Uytterhoeven
Quoted 22 lines · Nathan Chancellor
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Dividing a 64-bit integer prevents building this for 32-bit targets:

ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

As this function is not performance criticial, just Use the div_u64() helper.

Fixes 128a9bf8ace2 ("drm/rockchip: Add basic RK3588 HDMI output support")

Can someone please pick this up? It is still broken in next-20241104...

https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2oNvJFRj8tkDieb6VfrMf4rh1Kn/build.log

Quoted 4 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder) · line 87

Quoted 12 lines
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +1 -1
index 9c796ee4c303..c8b362cc2b95 100644
@@ -82,7 +82,7 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)
               * comment in rk_hdptx_phy_power_on() from
               * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
               */
-             phy_set_bus_width(hdmi->phy, rate / 100);
+             phy_set_bus_width(hdmi->phy, div_u64(rate, 100));
      }
 }

[email protected] has just told me this build issue is now upstream:

    FAILED linus/m68k-allmodconfig/m68k-gcc8.1 Fri Nov 22, 05:34
    http://kisskb.ellerman.id.au/kisskb/buildresult/15277242/

    Commit:   Merge tag 'drm-next-2024-11-21' of
https://gitlab.freedesktop.org/drm/kernel
              28eb75e178d389d325f1666e422bc13bbbb9804c
    Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30

    ERROR: modpost: "__udivdi3"

[drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

Applying this patch fixes it, so

Quoted 6 lines
Quoted 1 line

Do we really need +5 weeks to apply a fix for a reported build issue?

Do we really need that kind of comments?

It was applied already, I made sure it's part of the next PR we send to Linus. And it should be in linux-next tomorrow.

Thank you, I can confirm it is now commit 818956c76517e127 ("drm/rockchip: avoid 64-bit division") in drm-misc/for-linux-next and next-20241125.

Quoted 7 lines

Interestingly, the commit description contains:

    (cherry picked from commit 4b64b4a81fcd51f570c046cf904aef19ec756d45)

which is not in any tree on git.kernel.org, but the github collective does know about it:
https://github.com/torvalds/linux/commit/4b64b4a81fcd51f570c046cf904aef19ec756d45

The commit is in drm-misc-next, which will land in 6.14.

Quoted 1 line

Probably you want to drop that line.

We don't rebase anyway :/

Maxime