All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: kernel test robot <lkp@intel.com>
Cc: Farzad Farshchi <farzadfr@gmail.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Emil Renner Berthing <kernel@esmil.dk>
Subject: Re: [esmil:visionfive 55/61] nvdla_core_callbacks.c:undefined reference to `__udivdi3'
Date: Wed, 9 Mar 2022 09:06:27 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2203090905560.780932@ramsan.of.borg> (raw)
In-Reply-To: <202203090611.3NpTkqvn-lkp@intel.com>

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@intel.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@linux-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@intel.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-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@linux-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

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: kbuild-all@lists.01.org
Subject: Re: [esmil:visionfive 55/61] nvdla_core_callbacks.c:undefined reference to `__udivdi3'
Date: Wed, 09 Mar 2022 09:06:27 +0100	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2203090905560.780932@ramsan.of.borg> (raw)
In-Reply-To: <202203090611.3NpTkqvn-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3448 bytes --]

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(a)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@intel.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@linux-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@intel.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-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(a)linux-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

  reply	other threads:[~2022-03-09  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 22:59 [esmil:visionfive 55/61] nvdla_core_callbacks.c:undefined reference to `__udivdi3' kernel test robot
2022-03-09  8:06 ` Geert Uytterhoeven [this message]
2022-03-09  8:06   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2203090905560.780932@ramsan.of.borg \
    --to=geert@linux-m68k.org \
    --cc=farzadfr@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kernel@esmil.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.