On Wed, 21 Jan 2026, Eric Auger wrote:
Currently if a virt_machine_<n>_options() sets a TYPE_ARM_CPU
x-mig-hidden-regs or x-mig-safe-missing-regs array property, another
one cannot overwrite it or extend it. We end up with a core dump:

qemu-system-aarch64: can't apply global 
arm-cpu.x-mig-safe-missing-regs=0x603000000013c103, 0x603000000013c512, 
0x603000000013c513: array size property x-mig-safe-missing-regs may not be set 
more than once
Aborted (core dumped)

In practice we would like an easy way to register regs that belong
to either of those categories and allow aggregation of those.

We introduce arm_virt_compat_register_safe_missing_reg() and
arm_virt_compat_register_hidden_reg() which populate GLists of
int64_t. After all virt_machine_<n>_options have been called and
have registered their regs, the GList are converted into the
associated array property value and the GlobalProperties are set.

[...]
+static char *get_prop_value_from_reg_qlist(QList *l)
+{
+    size_t size = qlist_size(l);
+    GString *s = g_string_new("");
+    QListEntry *item;
+    int i = 0;
+    QNum *qi;
+
+    if (!size) {
+        return NULL;

Do we need to free s here (or allocate later) or is there some RAII magic
involed?

+    }
+    QLIST_FOREACH_ENTRY(l, item) {
+        qi = qobject_to(QNum, qlist_entry_obj(item));
+        int64_t regidx;
+
+        qnum_get_try_int(qi, &regidx);
+        if (i++ > 0) {
+            g_string_append(s, ", ");
+        }
+        g_string_append_printf(s, "%" G_GINT64_FORMAT, regidx);
+    }
+    return g_string_free(s, false);
+}

Reviewed-by: Sebastian Ott <[email protected]>


Reply via email to