qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/11] plugins: Restrict functions handling hwaddr to system-


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 01/11] plugins: Restrict functions handling hwaddr to system-mode
Date: Sun, 10 May 2020 12:44:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 5/9/20 3:09 PM, Philippe Mathieu-Daudé wrote:
Restrict qemu_plugin_hwaddr_is_io() and
qemu_plugin_hwaddr_device_offset() to system-mode.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
  include/qemu/qemu-plugin.h |  2 ++
  plugins/api.c              | 17 ++---------------
  2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 5502e112c8..06c271a107 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -326,6 +326,7 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info);
  struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
                                                    uint64_t vaddr);
+#ifndef CONFIG_USER_ONLY
  /*
   * The following additional queries can be run on the hwaddr structure
   * to return information about it. For non-IO accesses the device
@@ -333,6 +334,7 @@ struct qemu_plugin_hwaddr 
*qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
   */
  bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr);
  uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr 
*haddr);
+#endif /* CONFIG_USER_ONLY */
typedef void
  (*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index,
diff --git a/plugins/api.c b/plugins/api.c
index 53c8a73582..785ad2e45e 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -249,7 +249,8 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info)
   * Virtual Memory queries
   */
-#ifdef CONFIG_SOFTMMU
+#ifndef CONFIG_USER_ONLY
+
  static __thread struct qemu_plugin_hwaddr hwaddr_info;
struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
@@ -267,26 +268,14 @@ struct qemu_plugin_hwaddr 
*qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
return &hwaddr_info;
  }
-#else
-struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
-                                                  uint64_t vaddr)
-{
-    return NULL;
-}
-#endif
bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr)

Please disregard this patch, I misinterpreted the variable name with the hwaddr type.

  {
-#ifdef CONFIG_SOFTMMU
      return hwaddr->is_io;
-#else
-    return false;
-#endif
  }
uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr *haddr)
  {
-#ifdef CONFIG_SOFTMMU
      if (haddr) {
          if (!haddr->is_io) {
              ram_addr_t ram_addr = qemu_ram_addr_from_host((void *) 
haddr->v.ram.hostaddr);
@@ -299,7 +288,6 @@ uint64_t qemu_plugin_hwaddr_device_offset(const struct 
qemu_plugin_hwaddr *haddr
              return haddr->v.io.offset;
          }
      }
-#endif
      return 0;
  }
@@ -308,7 +296,6 @@ uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr *haddr
   * will be. This helps the plugin dimension per-vcpu arrays.
   */
-#ifndef CONFIG_USER_ONLY
  static MachineState * get_ms(void)
  {
      return MACHINE(qdev_get_machine());




reply via email to

[Prev in Thread] Current Thread [Next in Thread]