Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2226947ybi; Sun, 9 Jun 2019 06:45:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXI1F7QoUN+Aff804dEiCL0vViZyxAYgKq0fjWTyCJKYQS834ZOMSWs14tKLn6sew5Ud1d X-Received: by 2002:a17:902:e40f:: with SMTP id ci15mr66619805plb.280.1560087918732; Sun, 09 Jun 2019 06:45:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560087918; cv=none; d=google.com; s=arc-20160816; b=Ab0iurF1S18Cf+tZ3oQFe7hHtf6cP5rD5UcgYY4TMZAwrK+49gEaoTBN6YDkv0Mpan uT6YGAG9jSXg7M12dzCIvbMYTVOHLp6M+0l9Osv2lHlXhXm1dAC87nxE0MzeS6ghYa4z Ey9RhlSPOnUBjbEmZsb1sywjBSj4WRk5FwWXss9lNIPN9DjhtIj8jPp89u9dIe00kwNt ejCfO29zJS1XT/PnJFegAG1MnsecurcmlYFZkugSSa4dOJt7k/k8IaWFVKGwY7dvoYxN YZywAOc8k7+2Jv0hmU/+Xz1iF9NHoZtZbKa89e3f89caVjmUtRZww3vb5N8avLsugX2E PpQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=LJJpaup8RlEnAxLPN2thWQ+Y9KQMJ+DKLxUIcuqGNgc=; b=v60DrLIUyOpfJZzXGPFaIDu3BWrwTxXRP6P5hi6s1nBYOkHJ5myr1uqXyY79ex6BgE 5sAzYR8QstLKYtfv6u5UXMAyKiWbzn0PBdM18nJZTuvB3XRfB5gr9/UBF2DxsuejhZhJ atvbs3eQeBmV+mxAwOgpbYJMxtwLREFXvMvHFVEE8RqLsS0mQSKleGVDOUy4wKbZSGTS ehtPnfq6Z/7u7KlMFKu7+Ugox1UlrLRHno+Y2++DwhLzMiNysPHoMYXsAYGUkWTftpVz mjjBzDLkrnqg1em8XqLSdTBC7Tux7W5nB5oS6a8ZAjxNT1n3oZ5e5bFPXy/ADgWnxvK5 FSdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si7015749pgr.55.2019.06.09.06.45.02; Sun, 09 Jun 2019 06:45:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729321AbfFINmf (ORCPT + 99 others); Sun, 9 Jun 2019 09:42:35 -0400 Received: from mga11.intel.com ([192.55.52.93]:32100 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728863AbfFINlS (ORCPT ); Sun, 9 Jun 2019 09:41:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jun 2019 06:41:17 -0700 X-ExtLoop1: 1 Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga003.jf.intel.com with ESMTP; 09 Jun 2019 06:41:17 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Eric Auger , Alex Williamson , Jean-Philippe Brucker Cc: "Yi Liu" , "Tian, Kevin" , Raj Ashok , "Christoph Hellwig" , "Lu Baolu" , Andriy Shevchenko , Jacob Pan Subject: [PATCH v4 06/22] trace/iommu: Add sva trace events Date: Sun, 9 Jun 2019 06:44:06 -0700 Message-Id: <1560087862-57608-7-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560087862-57608-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1560087862-57608-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jean-Philippe Brucker For development only, trace I/O page faults and responses. Signed-off-by: Jacob Pan [JPB: removed the invalidate trace event, that will be added later] Signed-off-by: Jean-Philippe Brucker --- include/trace/events/iommu.h | 87 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h index 72b4582..c8de147 100644 --- a/include/trace/events/iommu.h +++ b/include/trace/events/iommu.h @@ -12,6 +12,8 @@ #define _TRACE_IOMMU_H #include +#include +#include struct device; @@ -161,6 +163,91 @@ DEFINE_EVENT(iommu_error, io_page_fault, TP_ARGS(dev, iova, flags) ); + +TRACE_EVENT(dev_fault, + + TP_PROTO(struct device *dev, struct iommu_fault *evt), + + TP_ARGS(dev, evt), + + TP_STRUCT__entry( + __string(device, dev_name(dev)) + __field(int, type) + __field(int, reason) + __field(u64, addr) + __field(u64, fetch_addr) + __field(u32, pasid) + __field(u32, grpid) + __field(u32, flags) + __field(u32, prot) + ), + + TP_fast_assign( + __assign_str(device, dev_name(dev)); + __entry->type = evt->type; + if (evt->type == IOMMU_FAULT_DMA_UNRECOV) { + __entry->reason = evt->event.reason; + __entry->flags = evt->event.flags; + __entry->pasid = evt->event.pasid; + __entry->grpid = 0; + __entry->prot = evt->event.perm; + __entry->addr = evt->event.addr; + __entry->fetch_addr = evt->event.fetch_addr; + } else { + __entry->reason = 0; + __entry->flags = evt->prm.flags; + __entry->pasid = evt->prm.pasid; + __entry->grpid = evt->prm.grpid; + __entry->prot = evt->prm.perm; + __entry->addr = evt->prm.addr; + __entry->fetch_addr = 0; + } + ), + + TP_printk("IOMMU:%s type=%d reason=%d addr=0x%016llx fetch=0x%016llx pasid=%d group=%d flags=%x prot=%d", + __get_str(device), + __entry->type, + __entry->reason, + __entry->addr, + __entry->fetch_addr, + __entry->pasid, + __entry->grpid, + __entry->flags, + __entry->prot + ) +); + +TRACE_EVENT(dev_page_response, + + TP_PROTO(struct device *dev, struct page_response_msg *msg), + + TP_ARGS(dev, msg), + + TP_STRUCT__entry( + __string(device, dev_name(dev)) + __field(int, code) + __field(u64, addr) + __field(u32, pasid) + __field(u32, grpid) + ), + + TP_fast_assign( + __assign_str(device, dev_name(dev)); + __entry->code = msg->resp_code; + __entry->addr = msg->addr; + __entry->pasid = msg->pasid; + __entry->grpid = msg->grpid; + ), + + TP_printk("IOMMU:%s code=%d addr=0x%016llx pasid=%d group=%d", + __get_str(device), + __entry->code, + __entry->addr, + __entry->pasid, + __entry->grpid + ) +); + #endif /* _TRACE_IOMMU_H */ /* This part must be outside protection */ -- 2.7.4