On 01/26/2010 09:25 PM, Zheng, Jiajia wrote:
Add command p2v to translate Guest physical address to Host virtual address.

For what purpose?

Signed-off-by: Max Asbock<masb...@linux.vnet.ibm.com>
                Jiajia Zheng<jiajia.zh...@intel.com>
---
diff --git a/monitor.c b/monitor.c
index b33b01f..83d9ac7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -668,6 +668,11 @@ static void do_info_uuid(Monitor *mon, QObject **ret_data)
      *ret_data = qobject_from_jsonf("{ 'UUID': %s }", uuid);
  }

+static void do_info_p2v(Monitor *mon)
+{
+    monitor_printf(mon, "p2v implemented\n");
+}

These should be implemented as QMP commands.

  /* get the current CPU defined by the user */
  static int mon_set_cpu(int cpu_index)
  {
@@ -2283,6 +2288,14 @@ static void do_inject_mce(Monitor *mon, const QDict 
*qdict)
              break;
          }
  }
+static void do_p2v(Monitor *mon, const QDict *qdict)
+{
+    target_long size = 4096;
+    target_long addr = qdict_get_int(qdict, "addr");
+
+    monitor_printf(mon, "Guest physical address %p is mapped at host virtual address 
%p\n", (void *)addr, cpu_physical_memory_map( (target_phys_addr_t)addr, 
(target_phys_addr_t *)&size, 0));

This isn't quite right. It assumes TARGET_PAGE_SIZE is 4k which is certainly not always true. It also assumes that cpu_physical_memory_map() something that has some meaning which isn't necessarily the case. It could be a pointer to a bounce buffer.

Could you give an end-to-end description of how you expect this mechanism to be used so we can work out a more appropriate set of interfaces. I assume this is MCE related.

Regards,

Anthony Liguori


Reply via email to