Files
rockchip-kernel/include/linux/log_mmiorw.h
Prasad Sodagudi e091aa59b9 ANDROID: tracing: Add register read and write tracing support
Add register read/write operations tracing support.
ftrace events helps to trace register read and write
location details of memory mapped IO registers.
These trace logs helps to debug un clocked access
of peripherals.

Bug: 169045115
Change-Id: I849bf75b84c24c8f3e9d2e8fba34a10ddcf4aaca
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2021-01-11 16:43:50 +00:00

55 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
*/
#ifndef __LOG_MMIORW_H__
#define __LOG_MMIORW_H__
#include <linux/types.h>
#include <linux/atomic.h>
#include <linux/tracepoint-defs.h>
/*
* TODO - io.h is included in NVHE files and these tracepoints are getting
* enabled for NVHE too. To avoid these tracepoints enabling in NHVE below
* condition is introduced.
* !(defined(__KVM_NVHE_HYPERVISOR__))
*/
#if IS_ENABLED(CONFIG_TRACE_MMIO_ACCESS) && !(defined(__KVM_NVHE_HYPERVISOR__))
DECLARE_TRACEPOINT(rwmmio_write);
DECLARE_TRACEPOINT(rwmmio_read);
DECLARE_TRACEPOINT(rwmmio_post_read);
void __log_write_mmio(u64 val, u8 width, volatile void __iomem *addr);
void __log_read_mmio(u8 width, const volatile void __iomem *addr);
void __log_post_read_mmio(u64 val, u8 width, const volatile void __iomem *addr);
#define log_write_mmio(val, width, addr) \
do { \
if (tracepoint_enabled(rwmmio_write)) \
__log_write_mmio(val, width, addr); \
} while (0)
#define log_read_mmio(width, addr) \
do { \
if (tracepoint_enabled(rwmmio_read)) \
__log_read_mmio(width, addr); \
} while (0)
#define log_post_read_mmio(val, width, addr) \
do { \
if (tracepoint_enabled(rwmmio_post_read)) \
__log_post_read_mmio(val, width, addr); \
} while (0)
#else
static inline void log_write_mmio(u64 val, u8 width, volatile void __iomem *addr)
{ }
static inline void log_read_mmio(u8 width, const volatile void __iomem *addr)
{ }
static inline void log_post_read_mmio(u64 val, u8 width, const volatile void __iomem *addr)
{ }
#endif /* CONFIG_TRACE_MMIO_ACCESS */
#endif /* __LOG_MMIORW_H__ */