1933ab6d3SLu Baolu /* SPDX-License-Identifier: GPL-2.0 */ 2933ab6d3SLu Baolu /* 3933ab6d3SLu Baolu * Intel IOMMU trace support 4933ab6d3SLu Baolu * 5933ab6d3SLu Baolu * Copyright (C) 2019 Intel Corporation 6933ab6d3SLu Baolu * 7933ab6d3SLu Baolu * Author: Lu Baolu <baolu.lu@linux.intel.com> 8933ab6d3SLu Baolu */ 9933ab6d3SLu Baolu #undef TRACE_SYSTEM 10933ab6d3SLu Baolu #define TRACE_SYSTEM intel_iommu 11933ab6d3SLu Baolu 12933ab6d3SLu Baolu #if !defined(_TRACE_INTEL_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ) 13933ab6d3SLu Baolu #define _TRACE_INTEL_IOMMU_H 14933ab6d3SLu Baolu 15933ab6d3SLu Baolu #include <linux/tracepoint.h> 16*2585a279SLu Baolu 17*2585a279SLu Baolu #include "iommu.h" 18933ab6d3SLu Baolu 19933ab6d3SLu Baolu #define MSG_MAX 256 20933ab6d3SLu Baolu 21933ab6d3SLu Baolu TRACE_EVENT(qi_submit, 22933ab6d3SLu Baolu TP_PROTO(struct intel_iommu *iommu, u64 qw0, u64 qw1, u64 qw2, u64 qw3), 23933ab6d3SLu Baolu 24933ab6d3SLu Baolu TP_ARGS(iommu, qw0, qw1, qw2, qw3), 25933ab6d3SLu Baolu 26933ab6d3SLu Baolu TP_STRUCT__entry( 27933ab6d3SLu Baolu __field(u64, qw0) 28933ab6d3SLu Baolu __field(u64, qw1) 29933ab6d3SLu Baolu __field(u64, qw2) 30933ab6d3SLu Baolu __field(u64, qw3) 31933ab6d3SLu Baolu __string(iommu, iommu->name) 32933ab6d3SLu Baolu ), 33933ab6d3SLu Baolu 34933ab6d3SLu Baolu TP_fast_assign( 35933ab6d3SLu Baolu __assign_str(iommu, iommu->name); 36933ab6d3SLu Baolu __entry->qw0 = qw0; 37933ab6d3SLu Baolu __entry->qw1 = qw1; 38933ab6d3SLu Baolu __entry->qw2 = qw2; 39933ab6d3SLu Baolu __entry->qw3 = qw3; 40933ab6d3SLu Baolu ), 41933ab6d3SLu Baolu 42933ab6d3SLu Baolu TP_printk("%s %s: 0x%llx 0x%llx 0x%llx 0x%llx", 43933ab6d3SLu Baolu __print_symbolic(__entry->qw0 & 0xf, 44933ab6d3SLu Baolu { QI_CC_TYPE, "cc_inv" }, 45933ab6d3SLu Baolu { QI_IOTLB_TYPE, "iotlb_inv" }, 46933ab6d3SLu Baolu { QI_DIOTLB_TYPE, "dev_tlb_inv" }, 47933ab6d3SLu Baolu { QI_IEC_TYPE, "iec_inv" }, 48933ab6d3SLu Baolu { QI_IWD_TYPE, "inv_wait" }, 49933ab6d3SLu Baolu { QI_EIOTLB_TYPE, "p_iotlb_inv" }, 50933ab6d3SLu Baolu { QI_PC_TYPE, "pc_inv" }, 51933ab6d3SLu Baolu { QI_DEIOTLB_TYPE, "p_dev_tlb_inv" }, 52933ab6d3SLu Baolu { QI_PGRP_RESP_TYPE, "page_grp_resp" }), 53933ab6d3SLu Baolu __get_str(iommu), 54933ab6d3SLu Baolu __entry->qw0, __entry->qw1, __entry->qw2, __entry->qw3 55933ab6d3SLu Baolu ) 56933ab6d3SLu Baolu ); 57933ab6d3SLu Baolu 58933ab6d3SLu Baolu TRACE_EVENT(prq_report, 59933ab6d3SLu Baolu TP_PROTO(struct intel_iommu *iommu, struct device *dev, 60933ab6d3SLu Baolu u64 dw0, u64 dw1, u64 dw2, u64 dw3, 61933ab6d3SLu Baolu unsigned long seq), 62933ab6d3SLu Baolu 63933ab6d3SLu Baolu TP_ARGS(iommu, dev, dw0, dw1, dw2, dw3, seq), 64933ab6d3SLu Baolu 65933ab6d3SLu Baolu TP_STRUCT__entry( 66933ab6d3SLu Baolu __field(u64, dw0) 67933ab6d3SLu Baolu __field(u64, dw1) 68933ab6d3SLu Baolu __field(u64, dw2) 69933ab6d3SLu Baolu __field(u64, dw3) 70933ab6d3SLu Baolu __field(unsigned long, seq) 71933ab6d3SLu Baolu __string(iommu, iommu->name) 72933ab6d3SLu Baolu __string(dev, dev_name(dev)) 73933ab6d3SLu Baolu __dynamic_array(char, buff, MSG_MAX) 74933ab6d3SLu Baolu ), 75933ab6d3SLu Baolu 76933ab6d3SLu Baolu TP_fast_assign( 77933ab6d3SLu Baolu __entry->dw0 = dw0; 78933ab6d3SLu Baolu __entry->dw1 = dw1; 79933ab6d3SLu Baolu __entry->dw2 = dw2; 80933ab6d3SLu Baolu __entry->dw3 = dw3; 81933ab6d3SLu Baolu __entry->seq = seq; 82933ab6d3SLu Baolu __assign_str(iommu, iommu->name); 83933ab6d3SLu Baolu __assign_str(dev, dev_name(dev)); 84933ab6d3SLu Baolu ), 85933ab6d3SLu Baolu 86933ab6d3SLu Baolu TP_printk("%s/%s seq# %ld: %s", 87933ab6d3SLu Baolu __get_str(iommu), __get_str(dev), __entry->seq, 88933ab6d3SLu Baolu decode_prq_descriptor(__get_str(buff), MSG_MAX, __entry->dw0, 89933ab6d3SLu Baolu __entry->dw1, __entry->dw2, __entry->dw3) 90933ab6d3SLu Baolu ) 91933ab6d3SLu Baolu ); 92933ab6d3SLu Baolu #endif /* _TRACE_INTEL_IOMMU_H */ 93933ab6d3SLu Baolu 94933ab6d3SLu Baolu /* This part must be outside protection */ 95933ab6d3SLu Baolu #undef TRACE_INCLUDE_PATH 96933ab6d3SLu Baolu #undef TRACE_INCLUDE_FILE 97933ab6d3SLu Baolu #define TRACE_INCLUDE_PATH ../../drivers/iommu/intel/ 98933ab6d3SLu Baolu #define TRACE_INCLUDE_FILE trace 99933ab6d3SLu Baolu #include <trace/define_trace.h> 100