-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iommu/vt-d: Add trace events for device dma map/unmap
This adds trace support for the Intel IOMMU driver. It also declares some events which could be used to trace the events when an IOVA is being mapped or unmapped in a domain. Cc: Ashok Raj <ashok.raj@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
- Loading branch information
Lu Baolu
authored and
Joerg Roedel
committed
Sep 11, 2019
1 parent
c5a5dc4
commit 3b53034
Showing
4 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Intel IOMMU trace support | ||
* | ||
* Copyright (C) 2019 Intel Corporation | ||
* | ||
* Author: Lu Baolu <baolu.lu@linux.intel.com> | ||
*/ | ||
|
||
#include <linux/string.h> | ||
#include <linux/types.h> | ||
|
||
#define CREATE_TRACE_POINTS | ||
#include <trace/events/intel_iommu.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* Intel IOMMU trace support | ||
* | ||
* Copyright (C) 2019 Intel Corporation | ||
* | ||
* Author: Lu Baolu <baolu.lu@linux.intel.com> | ||
*/ | ||
#ifdef CONFIG_INTEL_IOMMU | ||
#undef TRACE_SYSTEM | ||
#define TRACE_SYSTEM intel_iommu | ||
|
||
#if !defined(_TRACE_INTEL_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ) | ||
#define _TRACE_INTEL_IOMMU_H | ||
|
||
#include <linux/tracepoint.h> | ||
#include <linux/intel-iommu.h> | ||
|
||
DECLARE_EVENT_CLASS(dma_map, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr, | ||
size_t size), | ||
|
||
TP_ARGS(dev, dev_addr, phys_addr, size), | ||
|
||
TP_STRUCT__entry( | ||
__string(dev_name, dev_name(dev)) | ||
__field(dma_addr_t, dev_addr) | ||
__field(phys_addr_t, phys_addr) | ||
__field(size_t, size) | ||
), | ||
|
||
TP_fast_assign( | ||
__assign_str(dev_name, dev_name(dev)); | ||
__entry->dev_addr = dev_addr; | ||
__entry->phys_addr = phys_addr; | ||
__entry->size = size; | ||
), | ||
|
||
TP_printk("dev=%s dev_addr=0x%llx phys_addr=0x%llx size=%zu", | ||
__get_str(dev_name), | ||
(unsigned long long)__entry->dev_addr, | ||
(unsigned long long)__entry->phys_addr, | ||
__entry->size) | ||
); | ||
|
||
DEFINE_EVENT(dma_map, map_single, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr, | ||
size_t size), | ||
TP_ARGS(dev, dev_addr, phys_addr, size) | ||
); | ||
|
||
DEFINE_EVENT(dma_map, map_sg, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr, | ||
size_t size), | ||
TP_ARGS(dev, dev_addr, phys_addr, size) | ||
); | ||
|
||
DEFINE_EVENT(dma_map, bounce_map_single, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr, | ||
size_t size), | ||
TP_ARGS(dev, dev_addr, phys_addr, size) | ||
); | ||
|
||
DECLARE_EVENT_CLASS(dma_unmap, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size), | ||
|
||
TP_ARGS(dev, dev_addr, size), | ||
|
||
TP_STRUCT__entry( | ||
__string(dev_name, dev_name(dev)) | ||
__field(dma_addr_t, dev_addr) | ||
__field(size_t, size) | ||
), | ||
|
||
TP_fast_assign( | ||
__assign_str(dev_name, dev_name(dev)); | ||
__entry->dev_addr = dev_addr; | ||
__entry->size = size; | ||
), | ||
|
||
TP_printk("dev=%s dev_addr=0x%llx size=%zu", | ||
__get_str(dev_name), | ||
(unsigned long long)__entry->dev_addr, | ||
__entry->size) | ||
); | ||
|
||
DEFINE_EVENT(dma_unmap, unmap_single, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size), | ||
TP_ARGS(dev, dev_addr, size) | ||
); | ||
|
||
DEFINE_EVENT(dma_unmap, unmap_sg, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size), | ||
TP_ARGS(dev, dev_addr, size) | ||
); | ||
|
||
DEFINE_EVENT(dma_unmap, bounce_unmap_single, | ||
TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size), | ||
TP_ARGS(dev, dev_addr, size) | ||
); | ||
|
||
#endif /* _TRACE_INTEL_IOMMU_H */ | ||
|
||
/* This part must be outside protection */ | ||
#include <trace/define_trace.h> | ||
#endif /* CONFIG_INTEL_IOMMU */ |