Skip to contentSkip to conversation

hw/virtio: Build virtio-mem.c once

PATCH In review Philippe Mathieu-Daudé 4 participants 15 messages May 2, 2025 – May 11, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v3 cover hw/virtio: Build virtio-mem.c once

Since v2:
- Use TargetInfo API (Pierrick)

Since v1:
- Use max extent size of all archs (David)

Based-on: <[email protected]>

Philippe Mathieu-Daudé (5):
qemu/target-info: Factor target_system_arch() out qemu/target-info: Add %target_arch field to TargetInfo hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime hw/virtio: Compile virtio-mem.c once

 include/qemu/target-info-impl.h |   4 +-
 include/qemu/target-info.h      |   9 +++
 hw/core/machine-qmp-cmds.c      |   6 +-
 hw/virtio/virtio-mem.c          | 101 +++++++++++++++++++-------------
 target-info-stub.c              |   1 +
 target-info.c                   |  15 +++++
 hw/virtio/meson.build           |   2 +-
 7 files changed, 90 insertions(+), 48 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH v3 1/5 qemu/target-info: Factor target_system_arch() out

---
 include/qemu/target-info.h |  9 +++++++++
 hw/core/machine-qmp-cmds.c |  6 ++----
 target-info.c              | 12 ++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)
include/qemu/target-info.h +9 -0
index 850a2958b9c..87b4b0e0cbb 100644
@@ -9,6 +9,8 @@
 #ifndef QEMU_TARGET_INFO_H
 #define QEMU_TARGET_INFO_H
 
+#include "qapi/qapi-types-machine.h"
+
 /**
  * target_name:
  *
@@ -16,6 +18,13 @@
  */
 const char *target_name(void);
 
+/**
+ * target_system_arch:
+ *
+ * Returns: QAPI SysEmuTarget enum (i.e. SYS_EMU_TARGET_I386).
+ */
+SysEmuTarget target_system_arch(void);
+
 /**
  * target_long_bits:
  *
hw/core/machine-qmp-cmds.c +2 -4
index d82043e1c68..8f491dba441 100644
@@ -37,8 +37,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
     MachineState *ms = MACHINE(qdev_get_machine());
     MachineClass *mc = MACHINE_GET_CLASS(ms);
     CpuInfoFastList *head = NULL, **tail = &head;
-    SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, target_name(),
-                                          -1, &error_abort);
+    SysEmuTarget target = target_system_arch();
     CPUState *cpu;
 
     CPU_FOREACH(cpu) {
@@ -139,8 +138,7 @@ QemuTargetInfo *qmp_query_target(Error **errp)
 {
     QemuTargetInfo *info = g_malloc0(sizeof(*info));
 
-    info->arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
-                                 &error_abort);
+    info->arch = target_system_arch();
 
     return info;
 }
target-info.c +12 -0
index 16fdca7aaaf..8232d488870 100644
@@ -9,6 +9,7 @@
 #include "qemu/osdep.h"
 #include "qemu/target-info.h"
 #include "qemu/target-info-impl.h"
+#include "qapi/error.h"
 
 const char *target_name(void)
 {
@@ -20,6 +21,17 @@ unsigned target_long_bits(void)
     return target_info()->long_bits;
 }
 
+SysEmuTarget target_system_arch(void)
+{
+    static SysEmuTarget system_arch = SYS_EMU_TARGET__MAX;
+
+    if (system_arch == SYS_EMU_TARGET__MAX) {
+        system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
+                                      &error_abort);
+    }
+    return system_arch;
+}
+
 const char *target_cpu_type(void)
 {
     return target_info()->cpu_type;
Signature · 1 line
2.47.1
#2 lore raw

Re: [PATCH v3 1/5] qemu/target-info: Factor target_system_arch() out

Quoted 71 lines · Philippe Mathieu-Daudé
---
  include/qemu/target-info.h |  9 +++++++++
  hw/core/machine-qmp-cmds.c |  6 ++----
  target-info.c              | 12 ++++++++++++
  3 files changed, 23 insertions(+), 4 deletions(-)
include/qemu/target-info.h +9 -0
index 850a2958b9c..87b4b0e0cbb 100644
@@ -9,6 +9,8 @@
  #ifndef QEMU_TARGET_INFO_H
  #define QEMU_TARGET_INFO_H
 
+#include "qapi/qapi-types-machine.h"
+
  /**
   * target_name:
   *
@@ -16,6 +18,13 @@
   */
  const char *target_name(void);
 
+/**
+ * target_system_arch:
+ *
+ * Returns: QAPI SysEmuTarget enum (i.e. SYS_EMU_TARGET_I386).
+ */
+SysEmuTarget target_system_arch(void);
+
  /**
   * target_long_bits:
   *
hw/core/machine-qmp-cmds.c +2 -4
index d82043e1c68..8f491dba441 100644
@@ -37,8 +37,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
      MachineState *ms = MACHINE(qdev_get_machine());
      MachineClass *mc = MACHINE_GET_CLASS(ms);
      CpuInfoFastList *head = NULL, **tail = &head;
-    SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, target_name(),
-                                          -1, &error_abort);
+    SysEmuTarget target = target_system_arch();
      CPUState *cpu;
 
      CPU_FOREACH(cpu) {
@@ -139,8 +138,7 @@ QemuTargetInfo *qmp_query_target(Error **errp)
  {
      QemuTargetInfo *info = g_malloc0(sizeof(*info));
 
-    info->arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
-                                 &error_abort);
+    info->arch = target_system_arch();
 
      return info;
  }
target-info.c +1 -0
index 16fdca7aaaf..8232d488870 100644
@@ -9,6 +9,7 @@
  #include "qemu/osdep.h"
  #include "qemu/target-info.h"
  #include "qemu/target-info-impl.h"
+#include "qapi/error.h"
 
  const char *target_name(void)
  {

target-info.c unsigned target_long_bits(void) · line 27

Quoted 7 lines
target-info.c +4 -0
@@ -20,6 +21,17 @@ unsigned target_long_bits(void)
      return target_info()->long_bits;
  }
 
+SysEmuTarget target_system_arch(void)
+{
+    static SysEmuTarget system_arch = SYS_EMU_TARGET__MAX;
+

It would be better to squash next commit, and modify target_info()->target_arch directly, instead of introducing this static variable.

Quoted 10 lines
target-info.c +7 -0
+    if (system_arch == SYS_EMU_TARGET__MAX) {
+        system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
+                                      &error_abort);
+    }
+    return system_arch;
+}
+
  const char *target_cpu_type(void)
  {
      return target_info()->cpu_type;
#3 lore raw

PATCH v3 2/5 qemu/target-info: Add %target_arch field to TargetInfo

In reply to Philippe Mathieu-Daudé
---
 include/qemu/target-info-impl.h | 4 +++-
 target-info-stub.c              | 1 +
 target-info.c                   | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)
include/qemu/target-info-impl.h +3 -1
index 1b51cbcfe1b..83d584d7dba 100644
@@ -9,11 +9,13 @@
 #ifndef QEMU_TARGET_INFO_IMPL_H
 #define QEMU_TARGET_INFO_IMPL_H
 
-#include "qemu/target-info.h"
+#include "qapi/qapi-types-common.h"
 
 typedef struct TargetInfo {
     /* runtime equivalent of TARGET_NAME definition */
     const char *target_name;
+    /* related to TARGET_ARCH definition */
+    SysEmuTarget target_arch;
     /* runtime equivalent of TARGET_LONG_BITS definition */
     unsigned long_bits;
     /* runtime equivalent of CPU_RESOLVING_TYPE definition */
target-info-stub.c +1 -0
index fecc0e71286..2e4407ff04b 100644
@@ -14,6 +14,7 @@
 
 static const TargetInfo target_info_stub = {
     .target_name = TARGET_NAME,
+    .target_arch = SYS_EMU_TARGET__MAX,
     .long_bits = TARGET_LONG_BITS,
     .cpu_type = CPU_RESOLVING_TYPE,
     .machine_typename = TYPE_MACHINE,
target-info.c +3 -0
index 8232d488870..5f6096606e4 100644
@@ -25,6 +25,9 @@ SysEmuTarget target_system_arch(void)
 {
     static SysEmuTarget system_arch = SYS_EMU_TARGET__MAX;
 
+    if (system_arch == SYS_EMU_TARGET__MAX) {
+        system_arch = target_info()->target_arch;
+    }
     if (system_arch == SYS_EMU_TARGET__MAX) {
         system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
                                       &error_abort);
Signature · 1 line
2.47.1
#4 lore raw

Re: [PATCH v3 2/5] qemu/target-info: Add %target_arch field to TargetInfo

Quoted 32 lines · Philippe Mathieu-Daudé
---
  include/qemu/target-info-impl.h | 4 +++-
  target-info-stub.c              | 1 +
  target-info.c                   | 3 +++
  3 files changed, 7 insertions(+), 1 deletion(-)
include/qemu/target-info-impl.h +3 -1
index 1b51cbcfe1b..83d584d7dba 100644
@@ -9,11 +9,13 @@
  #ifndef QEMU_TARGET_INFO_IMPL_H
  #define QEMU_TARGET_INFO_IMPL_H
 
-#include "qemu/target-info.h"
+#include "qapi/qapi-types-common.h"
 
  typedef struct TargetInfo {
      /* runtime equivalent of TARGET_NAME definition */
      const char *target_name;
+    /* related to TARGET_ARCH definition */
+    SysEmuTarget target_arch;
      /* runtime equivalent of TARGET_LONG_BITS definition */
      unsigned long_bits;
      /* runtime equivalent of CPU_RESOLVING_TYPE definition */
target-info-stub.c +0 -0
index fecc0e71286..2e4407ff04b 100644

target-info-stub.c line 17

Quoted 4 lines
target-info-stub.c +1 -0
@@ -14,6 +14,7 @@
 
  static const TargetInfo target_info_stub = {
      .target_name = TARGET_NAME,
+    .target_arch = SYS_EMU_TARGET__MAX,

Time to suggest again to implement an ifdef with all TARGET_*, so we can get rid of this "not set" value. It would solve all the issues with target_system_arch() function, without duplicating the enum SYS_EMU_TARGET itself.

The only compromise is this ifdef, that can be shrinked and eventually removed when we'll have implemented target_info for all configs.

Quoted 17 lines
target-info-stub.c +0 -0
      .long_bits = TARGET_LONG_BITS,
      .cpu_type = CPU_RESOLVING_TYPE,
      .machine_typename = TYPE_MACHINE,
target-info.c +3 -0
index 8232d488870..5f6096606e4 100644
@@ -25,6 +25,9 @@ SysEmuTarget target_system_arch(void)
  {
      static SysEmuTarget system_arch = SYS_EMU_TARGET__MAX;
 
+    if (system_arch == SYS_EMU_TARGET__MAX) {
+        system_arch = target_info()->target_arch;
+    }
      if (system_arch == SYS_EMU_TARGET__MAX) {
          system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
                                        &error_abort);
#5 lore raw

PATCH v3 3/5 hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime

In reply to Philippe Mathieu-Daudé

Use target_system_arch() to check at runtime which target architecture is being run.
Note, since TARGET_ARM is defined for TARGET_AARCH64, we check for both ARM & AARCH64 enum values.

---
 hw/virtio/virtio-mem.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
hw/virtio/virtio-mem.c +15 -8
index a3d1a676e71..02c47730ae8 100644
@@ -170,13 +170,20 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb)
  * necessary (as the section size can change). But it's more likely that the
  * section size will rather get smaller and not bigger over time.
  */
-#if defined(TARGET_X86_64) || defined(TARGET_I386) || defined(TARGET_S390X)
-#define VIRTIO_MEM_USABLE_EXTENT (2 * (128 * MiB))
-#elif defined(TARGET_ARM)
-#define VIRTIO_MEM_USABLE_EXTENT (2 * (512 * MiB))
-#else
-#error VIRTIO_MEM_USABLE_EXTENT not defined
-#endif
+static uint64_t virtio_mem_usable_extent_size(void)
+{
+    switch (target_system_arch()) {
+    case SYS_EMU_TARGET_I386:
+    case SYS_EMU_TARGET_X86_64:
+    case SYS_EMU_TARGET_S390X:
+        return 2 * 128 * MiB;
+    case SYS_EMU_TARGET_AARCH64:
+    case SYS_EMU_TARGET_ARM:
+        return 2 * 512 * MiB;
+    default:
+        g_assert_not_reached();
+    }
+}
 
 static bool virtio_mem_is_busy(void)
 {
@@ -721,7 +728,7 @@ static void virtio_mem_resize_usable_region(VirtIOMEM *vmem,
                                             bool can_shrink)
 {
     uint64_t newsize = MIN(memory_region_size(&vmem->memdev->mr),
-                           requested_size + VIRTIO_MEM_USABLE_EXTENT);
+                           requested_size + virtio_mem_usable_extent_size());
 
     /* The usable region size always has to be multiples of the block size. */
     newsize = QEMU_ALIGN_UP(newsize, vmem->block_size);
Signature · 1 line
2.47.1
Reviewed-by on v3 3/5
#6 lore raw

Re: [PATCH v3 3/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime

Quoted 9 lines · Philippe Mathieu-Daudé

Use target_system_arch() to check at runtime which target architecture is being run.
Note, since TARGET_ARM is defined for TARGET_AARCH64, we check for both ARM & AARCH64 enum values.

---
  hw/virtio/virtio-mem.c | 23 +++++++++++++++--------
  1 file changed, 15 insertions(+), 8 deletions(-)
Acked-by on v3 3/5
#7 lore raw

Re: [PATCH v3 3/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Use target_system_arch() to check at runtime which target architecture is being run.
Note, since TARGET_ARM is defined for TARGET_AARCH64, we check for both ARM & AARCH64 enum values.

---

Signature · 3 lines
Cheers,

David / dhildenb
#8 lore raw

PATCH v3 4/5 hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime

In reply to Philippe Mathieu-Daudé

Check legacy guests support at runtime: instead of evaluating the VIRTIO_MEM_HAS_LEGACY_GUESTS definition at compile time, call target_system_arch() to detect which target is being run at runtime. Register virtio_mem_legacy_guests_properties[] at runtime.

---
 hw/virtio/virtio-mem.c | 77 ++++++++++++++++++++++++------------------
 1 file changed, 44 insertions(+), 33 deletions(-)
hw/virtio/virtio-mem.c +44 -33
index 02c47730ae8..4234396f774 100644
@@ -15,6 +15,7 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/units.h"
+#include "qemu/target-info.h"
 #include "system/numa.h"
 #include "system/system.h"
 #include "system/reset.h"
@@ -33,13 +34,21 @@
 
 static const VMStateDescription vmstate_virtio_mem_device_early;
 
-/*
- * We only had legacy x86 guests that did not support
- * VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE. Other targets don't have legacy guests.
- */
-#if defined(TARGET_X86_64) || defined(TARGET_I386)
-#define VIRTIO_MEM_HAS_LEGACY_GUESTS
-#endif
+static bool virtio_mem_has_legacy_guests(void)
+{
+    /*
+     * We only had legacy x86 guests that did not support
+     * VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE. Other targets don't have
+     * legacy guests.
+     */
+    switch (target_system_arch()) {
+    case SYS_EMU_TARGET_I386:
+    case SYS_EMU_TARGET_X86_64:
+        return true;
+    default:
+        return false;
+    }
+}
 
 /*
  * Let's not allow blocks smaller than 1 MiB, for example, to keep the tracking
@@ -143,7 +152,6 @@ static uint64_t virtio_mem_default_block_size(RAMBlock *rb)
     return MAX(page_size, VIRTIO_MEM_MIN_BLOCK_SIZE);
 }
 
-#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS)
 static bool virtio_mem_has_shared_zeropage(RAMBlock *rb)
 {
     /*
@@ -154,7 +162,6 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb)
     return !qemu_ram_is_shared(rb) && qemu_ram_get_fd(rb) < 0 &&
            qemu_ram_pagesize(rb) == qemu_real_host_page_size();
 }
-#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */
 
 /*
  * Size the usable region bigger than the requested size if possible. Esp.
@@ -1004,28 +1011,28 @@ static void virtio_mem_device_realize(DeviceState *dev, Error **errp)
     rb = vmem->memdev->mr.ram_block;
     page_size = qemu_ram_pagesize(rb);
 
-#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS)
-    switch (vmem->unplugged_inaccessible) {
-    case ON_OFF_AUTO_AUTO:
-        if (virtio_mem_has_shared_zeropage(rb)) {
-            vmem->unplugged_inaccessible = ON_OFF_AUTO_OFF;
-        } else {
-            vmem->unplugged_inaccessible = ON_OFF_AUTO_ON;
+    if (virtio_mem_has_legacy_guests()) {
+        switch (vmem->unplugged_inaccessible) {
+        case ON_OFF_AUTO_AUTO:
+            if (virtio_mem_has_shared_zeropage(rb)) {
+                vmem->unplugged_inaccessible = ON_OFF_AUTO_OFF;
+            } else {
+                vmem->unplugged_inaccessible = ON_OFF_AUTO_ON;
+            }
+            break;
+        case ON_OFF_AUTO_OFF:
+            if (!virtio_mem_has_shared_zeropage(rb)) {
+                warn_report("'%s' property set to 'off' with a memdev that does"
+                            " not support the shared zeropage.",
+                            VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP);
+            }
+            break;
+        default:
+            break;
         }
-        break;
-    case ON_OFF_AUTO_OFF:
-        if (!virtio_mem_has_shared_zeropage(rb)) {
-            warn_report("'%s' property set to 'off' with a memdev that does"
-                        " not support the shared zeropage.",
-                        VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP);
-        }
-        break;
-    default:
-        break;
+    } else {
+        vmem->unplugged_inaccessible = ON_OFF_AUTO_ON;
     }
-#else /* VIRTIO_MEM_HAS_LEGACY_GUESTS */
-    vmem->unplugged_inaccessible = ON_OFF_AUTO_ON;
-#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */
 
     if (vmem->dynamic_memslots &&
         vmem->unplugged_inaccessible != ON_OFF_AUTO_ON) {
@@ -1718,16 +1725,17 @@ static const Property virtio_mem_properties[] = {
     DEFINE_PROP_BOOL(VIRTIO_MEM_PREALLOC_PROP, VirtIOMEM, prealloc, false),
     DEFINE_PROP_LINK(VIRTIO_MEM_MEMDEV_PROP, VirtIOMEM, memdev,
                      TYPE_MEMORY_BACKEND, HostMemoryBackend *),
-#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS)
-    DEFINE_PROP_ON_OFF_AUTO(VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP, VirtIOMEM,
-                            unplugged_inaccessible, ON_OFF_AUTO_ON),
-#endif
     DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM,
                      early_migration, true),
     DEFINE_PROP_BOOL(VIRTIO_MEM_DYNAMIC_MEMSLOTS_PROP, VirtIOMEM,
                      dynamic_memslots, false),
 };
 
+static const Property virtio_mem_legacy_guests_properties[] = {
+    DEFINE_PROP_ON_OFF_AUTO(VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP, VirtIOMEM,
+                            unplugged_inaccessible, ON_OFF_AUTO_ON),
+};
+
 static uint64_t virtio_mem_rdm_get_min_granularity(const RamDiscardManager *rdm,
                                                    const MemoryRegion *mr)
 {
@@ -1880,6 +1888,9 @@ static void virtio_mem_class_init(ObjectClass *klass, const void *data)
     RamDiscardManagerClass *rdmc = RAM_DISCARD_MANAGER_CLASS(klass);
 
     device_class_set_props(dc, virtio_mem_properties);
+    if (virtio_mem_has_legacy_guests()) {
+        device_class_set_props(dc, virtio_mem_legacy_guests_properties);
+    }
     dc->vmsd = &vmstate_virtio_mem;
 
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
Signature · 1 line
2.47.1
Reviewed-by on v3 4/5
#9 lore raw

Re: [PATCH v3 4/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime

Quoted 9 lines · Philippe Mathieu-Daudé

Check legacy guests support at runtime: instead of evaluating the VIRTIO_MEM_HAS_LEGACY_GUESTS definition at compile time, call target_system_arch() to detect which target is being run at runtime. Register virtio_mem_legacy_guests_properties[] at runtime.

---
  hw/virtio/virtio-mem.c | 77 ++++++++++++++++++++++++------------------
  1 file changed, 44 insertions(+), 33 deletions(-)
Acked-by on v3 4/5
#10 lore raw

Re: [PATCH v3 4/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Check legacy guests support at runtime: instead of evaluating the VIRTIO_MEM_HAS_LEGACY_GUESTS definition at compile time, call target_system_arch() to detect which target is being run at runtime. Register virtio_mem_legacy_guests_properties[] at runtime.

---

Signature · 3 lines
Cheers,

David / dhildenb
#11 lore raw

PATCH v3 5/5 hw/virtio: Compile virtio-mem.c once

In reply to Philippe Mathieu-Daudé

Remove unused "system/ram_addr.h" header. This file doesn't use any target specific definitions anymore, compile it once by moving it to system_virtio_ss[].

---
 hw/virtio/virtio-mem.c | 1 -
 hw/virtio/meson.build  | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
hw/virtio/virtio-mem.c +0 -1
index 4234396f774..f4882c6901b 100644
@@ -25,7 +25,6 @@
 #include "hw/virtio/virtio-mem.h"
 #include "qapi/error.h"
 #include "qapi/visitor.h"
-#include "system/ram_addr.h"
 #include "migration/misc.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
hw/virtio/meson.build +1 -1
index 164f6fd995a..525679954ee 100644
@@ -56,7 +56,7 @@ specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c
 specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c'))
 specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c'))
 specific_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('virtio-nsm.c', 'cbor-helpers.c'), libcbor])
-specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c'))
+system_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c'))
 specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost-user-scmi.c'))
 specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SCMI'], if_true: files('vhost-user-scmi-pci.c'))
 
Signature · 1 line
2.47.1
Reviewed-by on v3 5/5
#12 lore raw

Re: [PATCH v3 5/5] hw/virtio: Compile virtio-mem.c once

Quoted 10 lines · Philippe Mathieu-Daudé

Remove unused "system/ram_addr.h" header. This file doesn't use any target specific definitions anymore, compile it once by moving it to system_virtio_ss[].

---
  hw/virtio/virtio-mem.c | 1 -
  hw/virtio/meson.build  | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-) 
Acked-by on v3 5/5
#13 lore raw

Re: [PATCH v3 5/5] hw/virtio: Compile virtio-mem.c once

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Remove unused "system/ram_addr.h" header. This file doesn't use any target specific definitions anymore, compile it once by moving it to system_virtio_ss[].

---

Signature · 3 lines
Cheers,

David / dhildenb
Reviewed-by on the v3 series
#14 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Since v2:
- Use TargetInfo API (Pierrick)

Since v1:
- Use max extent size of all archs (David)

Based-on: <[email protected]>

virtio bits:

feel free to merge.

Quoted 18 lines

Philippe Mathieu-Daudé (5):
qemu/target-info: Factor target_system_arch() out qemu/target-info: Add %target_arch field to TargetInfo hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime hw/virtio: Compile virtio-mem.c once

 include/qemu/target-info-impl.h |   4 +-
 include/qemu/target-info.h      |   9 +++
 hw/core/machine-qmp-cmds.c      |   6 +-
 hw/virtio/virtio-mem.c          | 101 +++++++++++++++++++-------------
 target-info-stub.c              |   1 +
 target-info.c                   |  15 +++++
 hw/virtio/meson.build           |   2 +-
 7 files changed, 90 insertions(+), 48 deletions(-)
Signature · 1 line
2.47.1