Re: [PATCHv4 2/2] arm64/io: Add a header for mmio access instrumentation
From: Arnd Bergmann <arnd@arndb.de>
Date: 2021-11-22 15:35:21
Also in:
linux-arm-msm, lkml
On Mon, Nov 22, 2021 at 3:59 PM Sai Prakash Ranjan [off-list ref] wrote:
quoted
quoted
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. ArndSorry, 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel