qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	peterx@redhat.com, Jason Wang <jasowang@redhat.com>
Subject: [Qemu-devel] [PATCH 5/8] intel_iommu: hmp: allow "-c" for "info iommu"
Date: Tue, 27 Jun 2017 17:03:36 +0800	[thread overview]
Message-ID: <1498554219-4942-6-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1498554219-4942-1-git-send-email-peterx@redhat.com>

New parameter "-c" for it to clear statistics. Other platforms can
selectively support this (though none yet).

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 hmp-commands-info.hx  | 4 ++--
 hw/i386/intel_iommu.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index a39243d..2add941 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -803,8 +803,8 @@ ETEXI
 
     {
         .name       = "iommu",
-        .args_type  = "",
-        .params     = "",
+        .args_type  = "clear_stats:-c",
+        .params     = "[-c]",
         .help       = "Display system IOMMU information",
         .cmd        = hmp_info_iommu,
     },
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 45d0919..72b39f0 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3008,6 +3008,7 @@ static void vtd_info_dump(X86IOMMUState *x86_iommu, Monitor *mon,
                           const QDict *qdict)
 {
     IntelIOMMUState *s = INTEL_IOMMU_DEVICE(x86_iommu);
+    bool clear_stats = qdict_get_try_bool(qdict, "clear_stats", false);
 
     DUMP("Version: %d\n", 1);
     DUMP("Cap: 0x%"PRIx64"\n", s->cap);
@@ -3047,6 +3048,10 @@ static void vtd_info_dump(X86IOMMUState *x86_iommu, Monitor *mon,
     DUMP("Misc: next_frr=%d, context_gen=%d, buggy_eim=%d\n",
          s->next_frcd_reg, s->context_cache_gen, s->buggy_eim);
     DUMP("      iotlb_size=%d\n", g_hash_table_size(s->iotlb));
+
+    if (clear_stats) {
+        vtd_reset_stats(s);
+    }
 }
 #undef DUMP
 
-- 
2.7.4

  parent reply	other threads:[~2017-06-27  9:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27  9:03 [Qemu-devel] [PATCH 0/8] VT-d: some enhancements on iotlb and tools Peter Xu
2017-06-27  9:03 ` [Qemu-devel] [PATCH 1/8] intel_iommu: fix VTD_PAGE_MASK Peter Xu
2017-06-27  9:03 ` [Qemu-devel] [PATCH 2/8] hmp: add info iommu Peter Xu
2017-06-27  9:03 ` [Qemu-devel] [PATCH 3/8] intel_iommu: support "info iommu" Peter Xu
2017-06-27  9:03 ` [Qemu-devel] [PATCH 4/8] intel_iommu: add iotlb/context cache statistics Peter Xu
2017-06-27  9:03 ` Peter Xu [this message]
2017-06-27  9:03 ` [Qemu-devel] [PATCH 6/8] intel_iommu: let iotlb size tunable Peter Xu
2017-06-27  9:03 ` [Qemu-devel] [PATCH 7/8] intel_iommu: use access_flags for iotlb Peter Xu
2017-06-27  9:03 ` [Qemu-devel] [PATCH 8/8] intel_iommu: implement mru list " Peter Xu
2017-06-27  9:22 ` [Qemu-devel] [PATCH 0/8] VT-d: some enhancements on iotlb and tools Peter Xu
2017-06-27 14:42 ` Michael S. Tsirkin
2017-06-28  7:03   ` Peter Xu
2017-06-27 16:30 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498554219-4942-6-git-send-email-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).