mei: me: add io register tracing
To make debugging a bit easier we add me register access tracing <debugfs>/tracing/events/mei/mei_reg_{read,write} Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
381a58c709
Коммит
a0a927d06d
|
@ -21,3 +21,6 @@ mei-me-objs += hw-me.o
|
||||||
obj-$(CONFIG_INTEL_MEI_TXE) += mei-txe.o
|
obj-$(CONFIG_INTEL_MEI_TXE) += mei-txe.o
|
||||||
mei-txe-objs := pci-txe.o
|
mei-txe-objs := pci-txe.o
|
||||||
mei-txe-objs += hw-txe.o
|
mei-txe-objs += hw-txe.o
|
||||||
|
|
||||||
|
mei-$(CONFIG_EVENT_TRACING) += mei-trace.o
|
||||||
|
CFLAGS_mei-trace.o = -I$(src)
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "hw-me.h"
|
#include "hw-me.h"
|
||||||
#include "hw-me-regs.h"
|
#include "hw-me-regs.h"
|
||||||
|
|
||||||
|
#include "mei-trace.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mei_me_reg_read - Reads 32bit data from the mei device
|
* mei_me_reg_read - Reads 32bit data from the mei device
|
||||||
*
|
*
|
||||||
|
@ -86,7 +88,12 @@ static inline void mei_me_hcbww_write(struct mei_device *dev, u32 data)
|
||||||
*/
|
*/
|
||||||
static inline u32 mei_me_mecsr_read(const struct mei_device *dev)
|
static inline u32 mei_me_mecsr_read(const struct mei_device *dev)
|
||||||
{
|
{
|
||||||
return mei_me_reg_read(to_me_hw(dev), ME_CSR_HA);
|
u32 reg;
|
||||||
|
|
||||||
|
reg = mei_me_reg_read(to_me_hw(dev), ME_CSR_HA);
|
||||||
|
trace_mei_reg_read(dev->dev, "ME_CSR_HA", ME_CSR_HA, reg);
|
||||||
|
|
||||||
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +105,12 @@ static inline u32 mei_me_mecsr_read(const struct mei_device *dev)
|
||||||
*/
|
*/
|
||||||
static inline u32 mei_hcsr_read(const struct mei_device *dev)
|
static inline u32 mei_hcsr_read(const struct mei_device *dev)
|
||||||
{
|
{
|
||||||
return mei_me_reg_read(to_me_hw(dev), H_CSR);
|
u32 reg;
|
||||||
|
|
||||||
|
reg = mei_me_reg_read(to_me_hw(dev), H_CSR);
|
||||||
|
trace_mei_reg_read(dev->dev, "H_CSR", H_CSR, reg);
|
||||||
|
|
||||||
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,6 +121,7 @@ static inline u32 mei_hcsr_read(const struct mei_device *dev)
|
||||||
*/
|
*/
|
||||||
static inline void mei_hcsr_write(struct mei_device *dev, u32 reg)
|
static inline void mei_hcsr_write(struct mei_device *dev, u32 reg)
|
||||||
{
|
{
|
||||||
|
trace_mei_reg_write(dev->dev, "H_CSR", H_CSR, reg);
|
||||||
mei_me_reg_write(to_me_hw(dev), H_CSR, reg);
|
mei_me_reg_write(to_me_hw(dev), H_CSR, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,9 +568,14 @@ static int mei_me_read_slots(struct mei_device *dev, unsigned char *buffer,
|
||||||
static void mei_me_pg_enter(struct mei_device *dev)
|
static void mei_me_pg_enter(struct mei_device *dev)
|
||||||
{
|
{
|
||||||
struct mei_me_hw *hw = to_me_hw(dev);
|
struct mei_me_hw *hw = to_me_hw(dev);
|
||||||
u32 reg = mei_me_reg_read(hw, H_HPG_CSR);
|
u32 reg;
|
||||||
|
|
||||||
|
reg = mei_me_reg_read(hw, H_HPG_CSR);
|
||||||
|
trace_mei_reg_read(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg);
|
||||||
|
|
||||||
reg |= H_HPG_CSR_PGI;
|
reg |= H_HPG_CSR_PGI;
|
||||||
|
|
||||||
|
trace_mei_reg_write(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg);
|
||||||
mei_me_reg_write(hw, H_HPG_CSR, reg);
|
mei_me_reg_write(hw, H_HPG_CSR, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,11 +587,16 @@ static void mei_me_pg_enter(struct mei_device *dev)
|
||||||
static void mei_me_pg_exit(struct mei_device *dev)
|
static void mei_me_pg_exit(struct mei_device *dev)
|
||||||
{
|
{
|
||||||
struct mei_me_hw *hw = to_me_hw(dev);
|
struct mei_me_hw *hw = to_me_hw(dev);
|
||||||
u32 reg = mei_me_reg_read(hw, H_HPG_CSR);
|
u32 reg;
|
||||||
|
|
||||||
|
reg = mei_me_reg_read(hw, H_HPG_CSR);
|
||||||
|
trace_mei_reg_read(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg);
|
||||||
|
|
||||||
WARN(!(reg & H_HPG_CSR_PGI), "PGI is not set\n");
|
WARN(!(reg & H_HPG_CSR_PGI), "PGI is not set\n");
|
||||||
|
|
||||||
reg |= H_HPG_CSR_PGIHEXR;
|
reg |= H_HPG_CSR_PGIHEXR;
|
||||||
|
|
||||||
|
trace_mei_reg_write(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg);
|
||||||
mei_me_reg_write(hw, H_HPG_CSR, reg);
|
mei_me_reg_write(hw, H_HPG_CSR, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Intel Management Engine Interface (Intel MEI) Linux driver
|
||||||
|
* Copyright (c) 2015, Intel Corporation.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <linux/module.h>
|
||||||
|
|
||||||
|
/* sparse doesn't like tracepoint macros */
|
||||||
|
#ifndef __CHECKER__
|
||||||
|
#define CREATE_TRACE_POINTS
|
||||||
|
#include "mei-trace.h"
|
||||||
|
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL(mei_reg_read);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL(mei_reg_write);
|
||||||
|
#endif /* __CHECKER__ */
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Intel Management Engine Interface (Intel MEI) Linux driver
|
||||||
|
* Copyright (c) 2015, Intel Corporation.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(_MEI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
|
||||||
|
#define _MEI_TRACE_H_
|
||||||
|
|
||||||
|
#include <linux/stringify.h>
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/tracepoint.h>
|
||||||
|
|
||||||
|
#undef TRACE_SYSTEM
|
||||||
|
|
||||||
|
#define TRACE_SYSTEM mei
|
||||||
|
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
|
||||||
|
|
||||||
|
TRACE_EVENT(mei_reg_read,
|
||||||
|
TP_PROTO(const struct device *dev, const char *reg, u32 offs, u32 val),
|
||||||
|
TP_ARGS(dev, reg, offs, val),
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__string(dev, dev_name(dev))
|
||||||
|
__field(const char *, reg)
|
||||||
|
__field(u32, offs)
|
||||||
|
__field(u32, val)
|
||||||
|
),
|
||||||
|
TP_fast_assign(
|
||||||
|
__assign_str(dev, dev_name(dev))
|
||||||
|
__entry->reg = reg;
|
||||||
|
__entry->offs = offs;
|
||||||
|
__entry->val = val;
|
||||||
|
),
|
||||||
|
TP_printk("[%s] read %s:[%#x] = %#x",
|
||||||
|
__get_str(dev), __entry->reg, __entry->offs, __entry->val)
|
||||||
|
);
|
||||||
|
|
||||||
|
TRACE_EVENT(mei_reg_write,
|
||||||
|
TP_PROTO(const struct device *dev, const char *reg, u32 offs, u32 val),
|
||||||
|
TP_ARGS(dev, reg, offs, val),
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__string(dev, dev_name(dev))
|
||||||
|
__field(const char *, reg)
|
||||||
|
__field(u32, offs)
|
||||||
|
__field(u32, val)
|
||||||
|
),
|
||||||
|
TP_fast_assign(
|
||||||
|
__assign_str(dev, dev_name(dev))
|
||||||
|
__entry->reg = reg;
|
||||||
|
__entry->offs = offs;
|
||||||
|
__entry->val = val;
|
||||||
|
),
|
||||||
|
TP_printk("[%s] write %s[%#x] = %#x)",
|
||||||
|
__get_str(dev), __entry->reg, __entry->offs, __entry->val)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif /* _MEI_TRACE_H_ */
|
||||||
|
|
||||||
|
/* This part must be outside protection */
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#undef TRACE_INCLUDE_FILE
|
||||||
|
#define TRACE_INCLUDE_PATH .
|
||||||
|
#define TRACE_INCLUDE_FILE mei-trace
|
||||||
|
#include <trace/define_trace.h>
|
Загрузка…
Ссылка в новой задаче