lkml.org 
[lkml]   [2023]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] riscv: Use asm-generic for {read,write}{bwlq} and their relaxed variant
On Mon, Nov 27, 2023 at 10:39:16AM +0000, Conor Dooley wrote:
> On Thu, Nov 23, 2023 at 10:20:03PM +0800, Jisheng Zhang wrote:
> > The asm-generic implementation is functionally identical to the riscv
> > version.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
>
> This fails to build for nommu:
> /tmp/tmp.ojumpiEgOt/arch/riscv/include/asm/timex.h:20:16: error: implicit declaration of function 'readq_relaxed' [-Werror=implicit-function-declaration]
> /tmp/tmp.ojumpiEgOt/include/asm-generic/io.h:342:23: error: conflicting types for 'readq_relaxed'; have 'u64(const volatile void *)' {aka 'long long unsigned int(const volatile void *)'}
>
> Cheers,
> Conor.

Hi,

Thanks for the report. I can reproduce the build error locally.
The problem is readl_relaxed usage in timex.h.

If include <asm/io.h> in timex.h, then we will meet issues which is
fixed by commit 0c3ac289.

If not include <asm/io.h>, then the readl_relaxed readq_relaxed
are not explictly declared as reported here.

I have two solutions:

solA: use __raw_readl and __raw_readq in timex, since I found other
architectures use the raw asm instructions for get_cycles()

solB: remove clint_time_val and export a function in timer-clint.c as below:
get_clint_cycles()
{
readl_relaxed(clint_time_val);
}

then
#define get_cycles get_clint_cycles

Both solutions can solve the issues. which one is better?

Thanks in advance

\
 
 \ /
  Last update: 2023-11-27 17:10    [W:0.101 / U:1.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site