2022-01-29 00:54:36

by kernel test robot

[permalink] [raw]
Subject: [esmil:visionfive 36/74] pwm-sifive-ptc.c:undefined reference to `__udivdi3'

tree: https://github.com/esmil/linux visionfive
head: 31606e93b454de33cd75c74d622f35eee020dc5b
commit: d8f87b24049876b29ade8ed4e49f975d32eeec79 [36/74] drivers/pwm: Add SiFive PWM PTC driver
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220128/[email protected]/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/d8f87b24049876b29ade8ed4e49f975d32eeec79
git remote add esmil https://github.com/esmil/linux
git fetch --no-tags esmil visionfive
git checkout d8f87b24049876b29ade8ed4e49f975d32eeec79
# 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 <[email protected]>

All errors (new ones prefixed by >>):

m68k-linux-ld: drivers/pwm/pwm-sifive-ptc.o: in function `sifive_pwm_ptc_apply':
>> pwm-sifive-ptc.c:(.text+0x1c2): 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

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


2022-02-01 02:38:35

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [esmil:visionfive 36/74] pwm-sifive-ptc.c:undefined reference to `__udivdi3'

On Sat, Jan 29, 2022 at 2:15 AM kernel test robot <[email protected]> wrote:
> tree: https://github.com/esmil/linux visionfive
> head: 31606e93b454de33cd75c74d622f35eee020dc5b
> commit: d8f87b24049876b29ade8ed4e49f975d32eeec79 [36/74] drivers/pwm: Add SiFive PWM PTC driver
> config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220128/[email protected]/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/d8f87b24049876b29ade8ed4e49f975d32eeec79
> git remote add esmil https://github.com/esmil/linux
> git fetch --no-tags esmil visionfive
> git checkout d8f87b24049876b29ade8ed4e49f975d32eeec79
> # 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 <[email protected]>
>
> All errors (new ones prefixed by >>):
>
> m68k-linux-ld: drivers/pwm/pwm-sifive-ptc.o: in function `sifive_pwm_ptc_apply':
> >> pwm-sifive-ptc.c:(.text+0x1c2): 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

+ /* calculate period count */
+ period_data = state->period / pwm_clk_ns;

64-by-32 division (pwm_state.period is u64, pwm_clk_ns is uint32_t).
Please #include <linux/math64.h> and use div_u64():

period_data = div_u64(period, pwm_clk_ns);

+
+ if (!state->enabled)
+ /* if is unenable,just set duty_dat to 0 , means low
level always */
+ duty_data = 0;
+ else
+ /* calculate duty count*/
+ duty_data = state->duty_cycle / pwm_clk_ns;

Likewise.

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

2022-02-01 03:08:15

by Emil Renner Berthing

[permalink] [raw]
Subject: Re: [esmil:visionfive 36/74] pwm-sifive-ptc.c:undefined reference to `__udivdi3'

On Sat, 29 Jan 2022 at 17:15, Geert Uytterhoeven <[email protected]> wrote:
>
> On Sat, Jan 29, 2022 at 2:15 AM kernel test robot <[email protected]> wrote:
> > tree: https://github.com/esmil/linux visionfive
> > head: 31606e93b454de33cd75c74d622f35eee020dc5b
> > commit: d8f87b24049876b29ade8ed4e49f975d32eeec79 [36/74] drivers/pwm: Add SiFive PWM PTC driver
> > config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220128/[email protected]/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/d8f87b24049876b29ade8ed4e49f975d32eeec79
> > git remote add esmil https://github.com/esmil/linux
> > git fetch --no-tags esmil visionfive
> > git checkout d8f87b24049876b29ade8ed4e49f975d32eeec79
> > # 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 <[email protected]>
> >
> > All errors (new ones prefixed by >>):
> >
> > m68k-linux-ld: drivers/pwm/pwm-sifive-ptc.o: in function `sifive_pwm_ptc_apply':
> > >> pwm-sifive-ptc.c:(.text+0x1c2): 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
>
> + /* calculate period count */
> + period_data = state->period / pwm_clk_ns;
>
> 64-by-32 division (pwm_state.period is u64, pwm_clk_ns is uint32_t).
> Please #include <linux/math64.h> and use div_u64():
>
> period_data = div_u64(period, pwm_clk_ns);

Thanks, I'd only found the raw do_div. This is better.

> +
> + if (!state->enabled)
> + /* if is unenable,just set duty_dat to 0 , means low
> level always */
> + duty_data = 0;
> + else
> + /* calculate duty count*/
> + duty_data = state->duty_cycle / pwm_clk_ns;
>
> Likewise.
>
> 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