diff mbox

[2/8] hmp: add info iommu

Message ID 1498554219-4942-3-git-send-email-peterx@redhat.com
State New
Headers show

Commit Message

Peter Xu June 27, 2017, 9:03 a.m. UTC
Introducing a new HMP interface "info iommu" to dump IOMMU information.
This command will be only used for developers' debugging purpose, and no
possible use for users. So QMP interface will not be implemented.

This patch only implements the stub one.  We can provide arch-dependent
status dump in the future.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 hmp-commands-info.hx | 14 ++++++++++++++
 hmp.c                |  6 ++++++
 hmp.h                |  1 +
 include/hw/iommu.h   |  9 +++++++++
 stubs/Makefile.objs  |  1 +
 stubs/iommu.c        |  9 +++++++++
 6 files changed, 40 insertions(+)
 create mode 100644 include/hw/iommu.h
 create mode 100644 stubs/iommu.c
diff mbox

Patch

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index ae16901..a39243d 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -802,6 +802,20 @@  Dump all the ramblocks of the system.
 ETEXI
 
     {
+        .name       = "iommu",
+        .args_type  = "",
+        .params     = "",
+        .help       = "Display system IOMMU information",
+        .cmd        = hmp_info_iommu,
+    },
+
+STEXI
+@item info ramblock
+@findex ramblock
+Dump all the ramblocks of the system.
+ETEXI
+
+    {
         .name       = "hotpluggable-cpus",
         .args_type  = "",
         .params     = "",
diff --git a/hmp.c b/hmp.c
index 8c72c58..68994af 100644
--- a/hmp.c
+++ b/hmp.c
@@ -42,6 +42,7 @@ 
 #include "qemu/error-report.h"
 #include "exec/ramlist.h"
 #include "hw/intc/intc.h"
+#include "hw/iommu.h"
 #include "migration/snapshot.h"
 
 #ifdef CONFIG_SPICE
@@ -2817,3 +2818,8 @@  void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &err);
     qapi_free_GuidInfo(info);
 }
+
+void hmp_info_iommu(Monitor *mon, const QDict *qdict)
+{
+    arch_iommu_info(mon, qdict);
+}
diff --git a/hmp.h b/hmp.h
index d8b94ce..ed01c49 100644
--- a/hmp.h
+++ b/hmp.h
@@ -143,5 +143,6 @@  void hmp_info_dump(Monitor *mon, const QDict *qdict);
 void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
 void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
+void hmp_info_iommu(Monitor *mon, const QDict *qdict);
 
 #endif
diff --git a/include/hw/iommu.h b/include/hw/iommu.h
new file mode 100644
index 0000000..5201a8d
--- /dev/null
+++ b/include/hw/iommu.h
@@ -0,0 +1,9 @@ 
+#ifndef __HW_IOMMU_H__
+#define __HW_IOMMU_H__
+
+#include "qemu/typedefs.h"
+#include "qapi/qmp/qdict.h"
+
+void arch_iommu_info(Monitor *mon, const QDict *qdict);
+
+#endif
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index f5b47bf..dfd5569 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -39,3 +39,4 @@  stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += vmgenid.o
 stub-obj-y += xen-common.o
 stub-obj-y += xen-hvm.o
+stub-obj-y += iommu.o
diff --git a/stubs/iommu.c b/stubs/iommu.c
new file mode 100644
index 0000000..75b4f4c
--- /dev/null
+++ b/stubs/iommu.c
@@ -0,0 +1,9 @@ 
+#include "qemu/osdep.h"
+#include "monitor/monitor.h"
+#include "hw/iommu.h"
+
+void arch_iommu_info(Monitor *mon, const QDict *qdict)
+{
+    monitor_printf(mon, "This command is not supported "
+                   "on this platform.\n");
+}