[PATCH v8 07/29] iommu: Use device fault trace event

Eric Auger
2019-05-26T16:11:02Z

From: Jacob Pan <jacob.jun.pan@linux.intel.com>

For performance and debugging purposes, these trace events help
analyzing device faults that interact with IOMMU subsystem.
E.g.
IOMMU:0000:00:0a.0 type=2 reason=0 addr=0x00000000007ff000 pasid=1
group=1 last=0 prot=1

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
[JPB: removed invalidate event, that will be added later]
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
---
drivers/iommu/iommu.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 64e87d56f471..166adb88b014 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1032,6 +1032,7 @@ int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt)
}

ret = fparam->handler(evt, fparam->data);
+ trace_dev_fault(dev, &evt->fault);
done_unlock:
mutex_unlock(&param->lock);
return ret;
@@ -1604,6 +1605,7 @@ int iommu_page_response(struct device *dev,
if (evt->fault.prm.pasid == msg->pasid &&
evt->fault.prm.grpid == msg->grpid) {
msg->iommu_data = evt->iommu_private;
+ trace_dev_page_response(dev, msg);
ret = domain->ops->page_response(dev, msg);
list_del(&evt->list);
kfree(evt);
--
2.20.1