diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 2bf1244b0ac8..2ab99334e660 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -25,6 +25,7 @@ config ARM select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K + select ARCH_HAVE_TRACE_MMIO_ACCESS if AMLOGIC_DEBUG_IOTRACE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_KEEP_MEMBLOCK select ARCH_MIGHT_HAVE_PC_PARPORT diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 79d246ac93ab..9df35303c0f7 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -115,7 +115,6 @@ static inline u32 __raw_readl(const volatile void __iomem *addr) : "Qo" (*(volatile u32 __force *)addr)); return val; } - /* * Architecture ioremap implementation. */ @@ -288,6 +287,8 @@ extern void _memset_io(volatile void __iomem *, int, size_t); * IO port primitives for more information. */ #ifndef readl +/* use the macro definitions in include/asm-generic/io.h */ +#if !IS_ENABLED(CONFIG_AMLOGIC_DEBUG_IOTRACE) #define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; }) #define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \ __raw_readw(c)); __r; }) @@ -313,6 +314,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t); #define writesb(p,d,l) __raw_writesb(p,d,l) #define writesw(p,d,l) __raw_writesw(p,d,l) #define writesl(p,d,l) __raw_writesl(p,d,l) +#endif #ifndef __ARMBE__ static inline void memset_io(volatile void __iomem *dst, unsigned c, @@ -338,7 +340,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from, mmiocpy((void __force *)to, from, count); } #define memcpy_toio(to,from,count) memcpy_toio(to,from,count) - #else #define memset_io(c,v,l) _memset_io(c,(v),(l)) #define memcpy_fromio(a,c,l) _memcpy_fromio((a),c,(l)) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 3995652daf81..8f6e6980b5c7 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -112,6 +112,9 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) #define __iowmb() dma_wmb() #define __iomb() dma_mb() +#if IS_BUILTIN(CONFIG_AMLOGIC_DEBUG_IOTRACE) || \ + ((IS_MODULE(CONFIG_AMLOGIC_DEBUG_IOTRACE)) && defined(MODULE)) +#else /* * Relaxed I/O memory access primitives. These follow the Device memory * ordering rules but do not guarantee any ordering relative to Normal memory @@ -141,6 +144,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) #define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) #define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); }) #define writeq(v,c) ({ __iowmb(); writeq_relaxed((v),(c)); }) +#endif /* * I/O port access primitives. diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index c154199269b1..6e64abad09a6 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -18,6 +18,13 @@ #include #include +/* get the macro ' _THIS_IP_' definition */ +#if IS_ENABLED(CONFIG_AMLOGIC_DEBUG_IOTRACE) +#ifdef CONFIG_ARM +#include +#endif +#endif + #ifndef __io_br #define __io_br() barrier() #endif