lkml.org 
[lkml]   [2021]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCHv4 2/2] arm64/io: Add a header for mmio access instrumentation
    On Mon, Nov 22, 2021 at 3:59 PM Sai Prakash Ranjan
    <quic_saipraka@quicinc.com> wrote:
    > >> And if we do move this instrumentation to asm-generic/io.h, how will
    > >> that be executed since
    > >> the arch specifc read{b,w,l,q} overrides this generic version?
    > > As I understand it, your version also requires architecture specific
    > > changes, so that would be the same: it only works for architectures
    > > that get the definition of readl()/readl_relaxed()/inl()/... from
    > > include/asm-generic/io.h and only override the __raw version. Arnd
    >
    > Sorry, I didn't get this part, so I am trying this on ARM64:
    >
    > arm64/include/asm/io.h has read{b,l,w,q} defined.
    > include/asm-generic/io.h has below:
    > #ifndef readl
    > #define readl readl
    > static inline u32 readl(const volatile void __iomem *addr)
    >
    > and we include asm-generic/io.h in arm64/include/asm/io.h at the end
    > after the definitions for arm64 mmio accesors.
    > So arch implementation here overrides generic ones as I see it, am I
    > missing something? I even confirmed this
    > with some trace_printk to generic and arch specific definitions of readl
    > and I see arch specific ones being called.

    Ah, you are right that the arm64 version currently has custom definitions
    of the high-level interfaces. These predate the introduction of the
    __io_{p,}{b,a}{r,w} macros and are currently only used on risc-v.

    I think in this case you should start by changing arm64 to use the
    generic readl() etc definitions, by removing the extra definitions and
    using

    #define __io_ar(v) __iormb(__v)
    #define __io_bw() dma_wmb()

    Arnd

    \
     
     \ /
      Last update: 2021-11-22 16:36    [W:3.371 / U:0.448 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site