Re: drivers/clocksource/timer-riscv.c:28:16: error: implicit declaration of function 'get_cycles64'

From: Palmer Dabbelt
Date: Tue Nov 24 2020 - 16:14:25 EST


On Tue, 24 Nov 2020 13:13:07 PST (-0800), rdunlap@xxxxxxxxxxxxx wrote:
On 11/21/20 6:26 AM, kernel test robot wrote:
Hi Palmer,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 27bba9c532a8d21050b94224ffd310ad0058c353
commit: d5be89a8d118a8e8d09cd74a921a808f17fbdd09 RISC-V: Resurrect the MMIO timer implementation for M-mode systems
date: 9 weeks ago
config: riscv-randconfig-r034-20201121 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bec968cbb367dd03439c89c1d4ef968ef662d7c0)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d5be89a8d118a8e8d09cd74a921a808f17fbdd09
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d5be89a8d118a8e8d09cd74a921a808f17fbdd09
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

CONFIG_RISCV_M_MODE=y

and that prevents get_cycles64() in
arch/riscv/include/asm/timex.h from being visible.

I suppose that was intended?

No, I have a fix for it that I'm about to send out. There's also a bit more necessary.



drivers/clocksource/timer-riscv.c:28:16: error: implicit declaration of function 'get_cycles64' [-Werror,-Wimplicit-function-declaration]
sbi_set_timer(get_cycles64() + delta);
^
drivers/clocksource/timer-riscv.c:28:16: note: did you mean 'get_cycles'?
arch/riscv/include/asm/timex.h:18:24: note: 'get_cycles' declared here
static inline cycles_t get_cycles(void)
^
drivers/clocksource/timer-riscv.c:47:9: error: implicit declaration of function 'get_cycles64' [-Werror,-Wimplicit-function-declaration]
return get_cycles64();
^
drivers/clocksource/timer-riscv.c:52:9: error: implicit declaration of function 'get_cycles64' [-Werror,-Wimplicit-function-declaration]
return get_cycles64();
^
7 warnings and 3 errors generated.

vim +/get_cycles64 +28 drivers/clocksource/timer-riscv.c