lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2203090905560.780932@ramsan.of.borg>
Date:   Wed, 9 Mar 2022 09:06:27 +0100 (CET)
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     kernel test robot <lkp@...el.com>
cc:     Farzad Farshchi <farzadfr@...il.com>, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Emil Renner Berthing <kernel@...il.dk>
Subject: Re: [esmil:visionfive 55/61] nvdla_core_callbacks.c:undefined
 reference to `__udivdi3'

On Wed, 9 Mar 2022, kernel test robot wrote:
> tree:   https://github.com/esmil/linux visionfive
> head:   b75fcbba0e03fd9655bc4c8854422d51474664d3
> commit: 6146bd9336a5f9d2bb66d6a394863600b61afeb5 [55/61] nvdla: add NVDLA driver
> config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220309/202203090611.3NpTkqvn-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>        chmod +x ~/bin/make.cross
>        # https://github.com/esmil/linux/commit/6146bd9336a5f9d2bb66d6a394863600b61afeb5
>        git remote add esmil https://github.com/esmil/linux
>        git fetch --no-tags esmil visionfive
>        git checkout 6146bd9336a5f9d2bb66d6a394863600b61afeb5
>        # save the config file to linux build tree
>        mkdir build_dir
>        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
>
> All errors (new ones prefixed by >>):
>
>   m68k-linux-ld: drivers/nvdla/nvdla_core_callbacks.o: in function `dla_get_time_us':
>>> nvdla_core_callbacks.c:(.text+0x396): undefined reference to `__udivdi3'
>   `.exit.text' referenced in section `.data' of sound/soc/codecs/tlv320adc3xxx.o: defined in discarded section `.exit.text' of sound/soc/codecs/tlv320adc3xxx.o

>From 1df1db244324a715b93af89586e4cce720ad2c94 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@...ux-m68k.org>
Date: Wed, 9 Mar 2022 09:03:03 +0100
Subject: [PATCH] nvdla: Use div_u64() in dla_get_time_us()

On 32-bit (e.g. m68k allyesconfig):

     m68k-linux-ld: drivers/nvdla/nvdla_core_callbacks.o: in function `dla_get_time_us':
     nvdla_core_callbacks.c:(.text+0x396): undefined reference to `__udivdi3'

dla_get_time_us() does a 64-by-32 division, hence div_u64() must be
used instead of a plain division.

Fixes: 6146bd9336a5f9d2 ("nvdla: add NVDLA driver")
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
Feel free to fold into the original.

  drivers/nvdla/nvdla_core_callbacks.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdla/nvdla_core_callbacks.c b/drivers/nvdla/nvdla_core_callbacks.c
index 6d461624adfbda33..e296562d259b7124 100644
--- a/drivers/nvdla/nvdla_core_callbacks.c
+++ b/drivers/nvdla/nvdla_core_callbacks.c
@@ -38,6 +38,7 @@
  #include <linux/interrupt.h>
  #include <linux/irq.h>
  #include <linux/irqdomain.h>
+#include <linux/math64.h>
  #include <linux/module.h>
  #include <linux/of.h>
  #include <linux/of_device.h>
@@ -121,7 +122,7 @@ void *dla_memcpy(void *dest, const void *src, uint64_t len)

  int64_t dla_get_time_us(void)
  {
-	return ktime_get_ns() / NSEC_PER_USEC;
+	return div_u64(ktime_get_ns(), NSEC_PER_USEC);
  }

  void dla_reg_write(void *driver_context, uint32_t addr, uint32_t reg)
-- 
2.25.1

Gr{oetje,eeting}s,

 						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ