Skip to contentSkip to conversation

machine + QOM queue, 2020-10-05

GIT PULL Eduardo Habkost 6 participants 36 messages Oct 5, 2020 – Oct 7, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit 36d9c2883e55c863b622b99f0ebb5143f0001401:

readthedocs: build with Python 3.6 (2020-10-05 16:30:45 +0100)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/machine-next-pull-request

for you to fetch changes up to fec5c4b6d3b7f3ffcfcbe1714e0405df6de2a222:

kernel-doc: Remove $decl_type='type name' hack (2020-10-05 12:48:11 -0400)

----------------------------------------------------------------
machine + QOM queue, 2020-10-05

* QOM documentation fixes and cleanups (Eduardo Habkost)
* user-mode: Prune build dependencies (Philippe Mathieu-Daudé)
* qom: Improve error message (Philippe Mathieu-Daudé)
* numa: hmat: require parent cache description before the next level one (Igor Mammedov)

----------------------------------------------------------------

Eduardo Habkost (11):
qom: Fix DECLARE_*CHECKER documentation docs/devel/qom: Fix indentation of bulleted list docs/devel/qom: Fix indentation of code blocks docs/devel/qom: Use *emphasis* for emphasis docs/devel/qom: Remove usage of <code> docs/devel/qom: Avoid long lines
kernel-doc: Handle function typedefs that return pointers
kernel-doc: Handle function typedefs without asterisks
qom: Explicitly tag doc comments for typedefs and structs
memory: Explicitly tag doc comments for structs
kernel-doc: Remove $decl_type='type name' hack

Igor Mammedov (1):
numa: hmat: require parent cache description before the next level one

Philippe Mathieu-Daudé (9):
hw/core/qdev-properties: Use qemu_strtol() in set_mac() handler hw/core/qdev-properties: Use qemu_strtoul() in set_pci_host_devaddr() hw/core/qdev-properties: Fix code style hw/core/qdev-properties: Export enum-related functions hw/core/qdev-properties: Export qdev_prop_enum hw/core/qdev-properties: Export some integer-related functions hw/core/qdev-properties: Extract system-mode specific properties hw/core/cpu: Add missing 'exec/cpu-common.h' include
qom: Improve error message displayed with missing object properties

 docs/devel/qom.rst               |  91 ++--
 hw/core/qdev-prop-internal.h     |  30 ++
 include/exec/memory.h            |   6 +-
 include/hw/qdev-properties.h     |   1 +
 include/qom/object.h             |  38 +-
 hw/core/cpu.c                    |   1 +
 hw/core/numa.c                   |   8 +-
 hw/core/qdev-properties-system.c | 687 ++++++++++++++++++++++++++++-
 hw/core/qdev-properties.c        | 735 ++-----------------------------
 qom/object.c                     |   3 +-
 scripts/kernel-doc               |  16 +-
 11 files changed, 831 insertions(+), 785 deletions(-)
 create mode 100644 hw/core/qdev-prop-internal.h
Signature · 1 line
2.26.2
#1 lore raw

[PULL 01/21] numa: hmat: require parent cache description before the next level one

From: Igor Mammedov <[email protected]>

Spec[1] defines 0 - 3 level memory side cache, however QEMU CLI allows to specify an intermediate cache level without specifying previous level. Such option(s) silently ignored when building HMAT table, which leads to incomplete cache information.
Make sure that previous level exists and error out if it hasn't been provided.

1) ACPI 6.2A 5.2.27.5 Memory Side Cache Information Structure

Message-Id: <[email protected]>

---
 hw/core/numa.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/core/numa.c +7 -1
index 7d5d4130016..6dc3d19d282 100644
@@ -424,7 +424,13 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node,
     }
 
     if ((node->level > 1) &&
-        ms->numa_state->hmat_cache[node->node_id][node->level - 1] &&
+        ms->numa_state->hmat_cache[node->node_id][node->level - 1] == NULL) {
+        error_setg(errp, "Cache level=%" PRIu8 " shall be defined first",
+                   node->level - 1);
+        return;
+    }
+
+    if ((node->level > 1) &&
         (node->size <=
             ms->numa_state->hmat_cache[node->node_id][node->level - 1]->size)) {
         error_setg(errp, "Invalid size=%" PRIu64 ", the size of level=%" PRIu8
Signature · 1 line
2.26.2
#2 lore raw

[PULL 02/21] hw/core/qdev-properties: Use qemu_strtol() in set_mac() handler

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

The MACAddr structure contains an array of uint8_t. Previously if a value was out of the [0..255] range, it was silently casted and no input validation was done.
Replace strtol() by qemu_strtol() -- so checkpatch.pl won't complain if we move this code later -- and return EINVAL if the input is invalid.

Message-Id: <[email protected]>

---
 hw/core/qdev-properties.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
hw/core/qdev-properties.c +9 -2
index 343c824da04..080ba319a1f 100644
@@ -1,4 +1,5 @@
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 #include "net/net.h"
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
@@ -524,7 +525,8 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
     Property *prop = opaque;
     MACAddr *mac = qdev_get_prop_ptr(dev, prop);
     int i, pos;
-    char *str, *p;
+    char *str;
+    const char *p;
 
     if (dev->realized) {
         qdev_prop_set_after_realize(dev, name, errp);
@@ -536,6 +538,8 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
     }
 
     for (i = 0, pos = 0; i < 6; i++, pos += 3) {
+        long val;
+
         if (!qemu_isxdigit(str[pos])) {
             goto inval;
         }
@@ -551,7 +555,10 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
                 goto inval;
             }
         }
-        mac->a[i] = strtol(str+pos, &p, 16);
+        if (qemu_strtol(str + pos, &p, 16, &val) < 0 || val > 0xff) {
+            goto inval;
+        }
+        mac->a[i] = val;
     }
     g_free(str);
     return;
Signature · 1 line
2.26.2
#3 lore raw

[PULL 09/21] hw/core/cpu: Add missing 'exec/cpu-common.h' include

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

cpu_common_reset() uses tcg_flush_softmmu_tlb() which is declared in "exec/cpu-common.h". Add the missing header to avoid when refactoring other headers:

hw/core/cpu.c: In function ‘cpu_common_reset’:
hw/core/cpu.c:273:9: error: implicit declaration of function ‘tcg_flush_softmmu_tlb’ [-Werror=implicit-function-declaration]

    273 |         tcg_flush_softmmu_tlb(cpu);
        |         ^~~~~~~~~~~~~~~~~~~~~

Message-Id: <[email protected]>

---
 hw/core/cpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/cpu.c +1 -0
index c55c09f734c..b06eb38ecca 100644
@@ -26,6 +26,7 @@
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "exec/log.h"
+#include "exec/cpu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/qemu-print.h"
 #include "sysemu/tcg.h"
Signature · 1 line
2.26.2
#4 lore raw

[PULL 03/21] hw/core/qdev-properties: Use qemu_strtoul() in set_pci_host_devaddr()

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

Replace strtoul() by qemu_strtoul() so checkpatch.pl won't complain if we move this code later.

Message-Id: <[email protected]>

---
 hw/core/qdev-properties.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
hw/core/qdev-properties.c +12 -13
index 080ba319a1f..a1190a5db9e 100644
@@ -951,7 +951,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
     Property *prop = opaque;
     PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
     char *str, *p;
-    char *e;
+    const char *e;
     unsigned long val;
     unsigned long dom = 0, bus = 0;
     unsigned int slot = 0, func = 0;
@@ -966,23 +966,23 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
     }
 
     p = str;
-    val = strtoul(p, &e, 16);
-    if (e == p || *e != ':') {
+    if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0xffff || e == p) {
+        goto inval;
+    }
+    if (*e != ':') {
         goto inval;
     }
     bus = val;
 
-    p = e + 1;
-    val = strtoul(p, &e, 16);
-    if (e == p) {
+    p = (char *)e + 1;
+    if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) {
         goto inval;
     }
     if (*e == ':') {
         dom = bus;
         bus = val;
-        p = e + 1;
-        val = strtoul(p, &e, 16);
-        if (e == p) {
+        p = (char *)e + 1;
+        if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) {
             goto inval;
         }
     }
@@ -991,14 +991,13 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
     if (*e != '.') {
         goto inval;
     }
-    p = e + 1;
-    val = strtoul(p, &e, 10);
-    if (e == p) {
+    p = (char *)e + 1;
+    if (qemu_strtoul(p, &e, 10, &val) < 0 || val > 7 || e == p) {
         goto inval;
     }
     func = val;
 
-    if (dom > 0xffff || bus > 0xff || slot > 0x1f || func > 7) {
+    if (bus > 0xff) {
         goto inval;
     }
 
Signature · 1 line
2.26.2
#5 lore raw

[PULL 04/21] hw/core/qdev-properties: Fix code style

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

We will soon move this code, fix its style to avoid checkpatch.pl to complain.

Message-Id: <[email protected]>

---
 hw/core/qdev-properties.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/core/qdev-properties.c +5 -5
index a1190a5db9e..071fd5864ae 100644
@@ -543,15 +543,15 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
         if (!qemu_isxdigit(str[pos])) {
             goto inval;
         }
-        if (!qemu_isxdigit(str[pos+1])) {
+        if (!qemu_isxdigit(str[pos + 1])) {
             goto inval;
         }
         if (i == 5) {
-            if (str[pos+2] != '\0') {
+            if (str[pos + 2] != '\0') {
                 goto inval;
             }
         } else {
-            if (str[pos+2] != ':' && str[pos+2] != '-') {
+            if (str[pos + 2] != ':' && str[pos + 2] != '-') {
                 goto inval;
             }
         }
@@ -898,8 +898,8 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,
     /* We rely on power-of-2 blocksizes for bitmasks */
     if ((value & (value - 1)) != 0) {
         error_setg(errp,
-                  "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2",
-                  dev->id ?: "", name, (int64_t)value);
+                  "Property %s.%s doesn't take value '%" PRId64 "', "
+                  "it's not a power of 2", dev->id ?: "", name, (int64_t)value);
         return;
     }
 
Signature · 1 line
2.26.2
#6 lore raw

[PULL 05/21] hw/core/qdev-properties: Export enum-related functions

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

We are going to split this file and reuse these static functions. Add the local "qdev-prop-internal.h" header declaring them.

Message-Id: <[email protected]>

---
 hw/core/qdev-prop-internal.h | 19 ++++++++++++
 hw/core/qdev-properties.c    | 58 +++++++++++++++++++-----------------
 2 files changed, 49 insertions(+), 28 deletions(-)
 create mode 100644 hw/core/qdev-prop-internal.h
hw/core/qdev-prop-internal.h new file +19 -0
new file mode 100644
index 00000000000..2a8c9a306a5
@@ -0,0 +1,19 @@
+/*
+ * qdev property parsing
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef HW_CORE_QDEV_PROP_INTERNAL_H
+#define HW_CORE_QDEV_PROP_INTERNAL_H
+
+void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
+                            void *opaque, Error **errp);
+void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
+                            void *opaque, Error **errp);
+
+void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
+                                          const Property *prop);
+
+#endif
hw/core/qdev-properties.c +30 -28

134 lines not on this page · raw message

Signature · 1 line
2.26.2
#7 lore raw

[PULL 08/21] hw/core/qdev-properties: Extract system-mode specific properties

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

Move properties specific to machines into a separate file.

Message-Id: <[email protected]>

---
 hw/core/qdev-properties-system.c | 687 ++++++++++++++++++++++++++++++-
 hw/core/qdev-properties.c        | 674 ------------------------------
 2 files changed, 679 insertions(+), 682 deletions(-)
hw/core/qdev-properties-system.c +679 -8
index b29daf4fb51..49bdd125814 100644
@@ -11,19 +11,25 @@
  */
 
 #include "qemu/osdep.h"
-#include "audio/audio.h"
-#include "net/net.h"
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
+#include "qapi/visitor.h"
+#include "qapi/qapi-types-block.h"
+#include "qapi/qapi-types-machine.h"
+#include "qapi/qapi-types-migration.h"
 #include "qapi/qmp/qerror.h"
+#include "qemu/ctype.h"
+#include "qemu/cutils.h"
+#include "qemu/units.h"
+#include "qemu/error-report.h"
+#include "qdev-prop-internal.h"
+
+#include "audio/audio.h"
+#include "chardev/char-fe.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
-#include "hw/block/block.h"
-#include "net/hub.h"
-#include "qapi/visitor.h"
-#include "chardev/char-fe.h"
-#include "sysemu/iothread.h"
-#include "sysemu/tpm_backend.h"
+#include "net/net.h"
+#include "hw/pci/pci.h"
 
 static bool check_prop_still_unset(DeviceState *dev, const char *name,
                                    const void *old_val, const char *new_val,
@@ -280,6 +286,96 @@ const PropertyInfo qdev_prop_chr = {
     .release = release_chr,
 };
 
+/* --- mac address --- */
+
+/*
+ * accepted syntax versions:
+ *   01:02:03:04:05:06
+ *   01-02-03-04-05-06
+ */
+static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
+                    Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    MACAddr *mac = qdev_get_prop_ptr(dev, prop);
+    char buffer[2 * 6 + 5 + 1];
+    char *p = buffer;
+
+    snprintf(buffer, sizeof(buffer), "%02x:%02x:%02x:%02x:%02x:%02x",
+             mac->a[0], mac->a[1], mac->a[2],
+             mac->a[3], mac->a[4], mac->a[5]);
+
+    visit_type_str(v, name, &p, errp);
+}
+
+static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
+                    Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    MACAddr *mac = qdev_get_prop_ptr(dev, prop);
+    int i, pos;
+    char *str;
+    const char *p;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    if (!visit_type_str(v, name, &str, errp)) {
+        return;
+    }
+
+    for (i = 0, pos = 0; i < 6; i++, pos += 3) {
+        long val;
+
+        if (!qemu_isxdigit(str[pos])) {
+            goto inval;
+        }
+        if (!qemu_isxdigit(str[pos + 1])) {
+            goto inval;
+        }
+        if (i == 5) {
+            if (str[pos + 2] != '\0') {
+                goto inval;
+            }
+        } else {
+            if (str[pos + 2] != ':' && str[pos + 2] != '-') {
+                goto inval;
+            }
+        }
+        if (qemu_strtol(str + pos, &p, 16, &val) < 0 || val > 0xff) {
+            goto inval;
+        }
+        mac->a[i] = val;
+    }
+    g_free(str);
+    return;
+
+inval:
+    error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
+    g_free(str);
+}
+
+const PropertyInfo qdev_prop_macaddr = {
+    .name  = "str",
+    .description = "Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56",
+    .get   = get_mac,
+    .set   = set_mac,
+};
+
+void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
+                           const uint8_t *value)
+{
+    char str[2 * 6 + 5 + 1];
+    snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x",
+             value[0], value[1], value[2], value[3], value[4], value[5]);
+
+    object_property_set_str(OBJECT(dev), name, str, &error_abort);
+}
+
 /* --- netdev device --- */
 static void get_netdev(Object *obj, Visitor *v, const char *name,
                        void *opaque, Error **errp)
@@ -465,3 +561,578 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
     }
     nd->instantiated = 1;
 }
+
+/* --- lost tick policy --- */
+
+QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));
+
+const PropertyInfo qdev_prop_losttickpolicy = {
+    .name  = "LostTickPolicy",
+    .enum_table  = &LostTickPolicy_lookup,
+    .get   = qdev_propinfo_get_enum,
+    .set   = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- blocksize --- */
+
+/* lower limit is sector size */
+#define MIN_BLOCK_SIZE          512
+#define MIN_BLOCK_SIZE_STR      "512 B"
+/*
+ * upper limit is arbitrary, 2 MiB looks sufficient for all sensible uses, and
+ * matches qcow2 cluster size limit
+ */
+#define MAX_BLOCK_SIZE          (2 * MiB)
+#define MAX_BLOCK_SIZE_STR      "2 MiB"
+
+static void set_blocksize(Object *obj, Visitor *v, const char *name,
+                          void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+    uint64_t value;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    if (!visit_type_size(v, name, &value, errp)) {
+        return;
+    }
+    /* value of 0 means "unset" */
+    if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) {
+        error_setg(errp,
+                   "Property %s.%s doesn't take value %" PRIu64
+                   " (minimum: " MIN_BLOCK_SIZE_STR
+                   ", maximum: " MAX_BLOCK_SIZE_STR ")",
+                   dev->id ? : "", name, value);
+        return;
+    }
+
+    /* We rely on power-of-2 blocksizes for bitmasks */
+    if ((value & (value - 1)) != 0) {
+        error_setg(errp,
+                  "Property %s.%s doesn't take value '%" PRId64 "', "
+                  "it's not a power of 2", dev->id ?: "", name, (int64_t)value);
+        return;
+    }
+
+    *ptr = value;
+}
+
+const PropertyInfo qdev_prop_blocksize = {
+    .name  = "size",
+    .description = "A power of two between " MIN_BLOCK_SIZE_STR
+                   " and " MAX_BLOCK_SIZE_STR,
+    .get   = qdev_propinfo_get_size32,
+    .set   = set_blocksize,
+    .set_default_value = qdev_propinfo_set_default_value_uint,
+};
+
+/* --- Block device error handling policy --- */
+
+QEMU_BUILD_BUG_ON(sizeof(BlockdevOnError) != sizeof(int));
+
+const PropertyInfo qdev_prop_blockdev_on_error = {
+    .name = "BlockdevOnError",
+    .description = "Error handling policy, "
+                   "report/ignore/enospc/stop/auto",
+    .enum_table = &BlockdevOnError_lookup,
+    .get = qdev_propinfo_get_enum,
+    .set = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- BIOS CHS translation */
+
+QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
+
+const PropertyInfo qdev_prop_bios_chs_trans = {
+    .name = "BiosAtaTranslation",
+    .description = "Logical CHS translation algorithm, "
+                   "auto/none/lba/large/rechs",
+    .enum_table = &BiosAtaTranslation_lookup,
+    .get = qdev_propinfo_get_enum,
+    .set = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- FDC default drive types */
+
+const PropertyInfo qdev_prop_fdc_drive_type = {
+    .name = "FdcDriveType",
+    .description = "FDC drive type, "
+                   "144/288/120/none/auto",
+    .enum_table = &FloppyDriveType_lookup,
+    .get = qdev_propinfo_get_enum,
+    .set = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- MultiFDCompression --- */
+
+const PropertyInfo qdev_prop_multifd_compression = {
+    .name = "MultiFDCompression",
+    .description = "multifd_compression values, "
+                   "none/zlib/zstd",
+    .enum_table = &MultiFDCompression_lookup,
+    .get = qdev_propinfo_get_enum,
+    .set = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- Reserved Region --- */
+
+/*
+ * Accepted syntax:
+ *   <low address>:<high address>:<type>
+ *   where low/high addresses are uint64_t in hexadecimal
+ *   and type is a non-negative decimal integer
+ */
+static void get_reserved_region(Object *obj, Visitor *v, const char *name,
+                                void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    ReservedRegion *rr = qdev_get_prop_ptr(dev, prop);
+    char buffer[64];
+    char *p = buffer;
+    int rc;
+
+    rc = snprintf(buffer, sizeof(buffer), "0x%"PRIx64":0x%"PRIx64":%u",
+                  rr->low, rr->high, rr->type);
+    assert(rc < sizeof(buffer));
+
+    visit_type_str(v, name, &p, errp);
+}
+
+static void set_reserved_region(Object *obj, Visitor *v, const char *name,
+                                void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    ReservedRegion *rr = qdev_get_prop_ptr(dev, prop);
+    Error *local_err = NULL;
+    const char *endptr;
+    char *str;
+    int ret;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    visit_type_str(v, name, &str, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        return;
+    }
+
+    ret = qemu_strtou64(str, &endptr, 16, &rr->low);
+    if (ret) {
+        error_setg(errp, "start address of '%s'"
+                   " must be a hexadecimal integer", name);
+        goto out;
+    }
+    if (*endptr != ':') {
+        goto separator_error;
+    }
+
+    ret = qemu_strtou64(endptr + 1, &endptr, 16, &rr->high);
+    if (ret) {
+        error_setg(errp, "end address of '%s'"
+                   " must be a hexadecimal integer", name);
+        goto out;
+    }
+    if (*endptr != ':') {
+        goto separator_error;
+    }
+
+    ret = qemu_strtoui(endptr + 1, &endptr, 10, &rr->type);
+    if (ret) {
+        error_setg(errp, "type of '%s'"
+                   " must be a non-negative decimal integer", name);
+    }
+    goto out;
+
+separator_error:
+    error_setg(errp, "reserved region fields must be separated with ':'");
+out:
+    g_free(str);
+    return;
+}
+
+const PropertyInfo qdev_prop_reserved_region = {
+    .name  = "reserved_region",
+    .description = "Reserved Region, example: 0xFEE00000:0xFEEFFFFF:0",
+    .get   = get_reserved_region,
+    .set   = set_reserved_region,
+};
+
+/* --- pci address --- */
+
+/*
+ * bus-local address, i.e. "$slot" or "$slot.$fn"
+ */
+static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
+                          void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    int32_t value, *ptr = qdev_get_prop_ptr(dev, prop);
+    unsigned int slot, fn, n;
+    char *str;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    if (!visit_type_str(v, name, &str, NULL)) {
+        if (!visit_type_int32(v, name, &value, errp)) {
+            return;
+        }
+        if (value < -1 || value > 255) {
+            error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+                       name ? name : "null", "pci_devfn");
+            return;
+        }
+        *ptr = value;
+        return;
+    }
+
+    if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
+        fn = 0;
+        if (sscanf(str, "%x%n", &slot, &n) != 1) {
+            goto invalid;
+        }
+    }
+    if (str[n] != '\0' || fn > 7 || slot > 31) {
+        goto invalid;
+    }
+    *ptr = slot << 3 | fn;
+    g_free(str);
+    return;
+
+invalid:
+    error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
+    g_free(str);
+}
+
+static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
+                           size_t len)
+{
+    int32_t *ptr = qdev_get_prop_ptr(dev, prop);
+
+    if (*ptr == -1) {
+        return snprintf(dest, len, "<unset>");
+    } else {
+        return snprintf(dest, len, "%02x.%x", *ptr >> 3, *ptr & 7);
+    }
+}
+
+const PropertyInfo qdev_prop_pci_devfn = {
+    .name  = "int32",
+    .description = "Slot and optional function number, example: 06.0 or 06",
+    .print = print_pci_devfn,
+    .get   = qdev_propinfo_get_int32,
+    .set   = set_pci_devfn,
+    .set_default_value = qdev_propinfo_set_default_value_int,
+};
+
+/* --- pci host address --- */
+
+static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
+                                 void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
+    char buffer[] = "ffff:ff:ff.f";
+    char *p = buffer;
+    int rc = 0;
+
+    /*
+     * Catch "invalid" device reference from vfio-pci and allow the
+     * default buffer representing the non-existent device to be used.
+     */
+    if (~addr->domain || ~addr->bus || ~addr->slot || ~addr->function) {
+        rc = snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%0d",
+                      addr->domain, addr->bus, addr->slot, addr->function);
+        assert(rc == sizeof(buffer) - 1);
+    }
+
+    visit_type_str(v, name, &p, errp);
+}
+
+/*
+ * Parse [<domain>:]<bus>:<slot>.<func>
+ *   if <domain> is not supplied, it's assumed to be 0.
+ */
+static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
+                                 void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
+    char *str, *p;
+    const char *e;
+    unsigned long val;
+    unsigned long dom = 0, bus = 0;
+    unsigned int slot = 0, func = 0;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    if (!visit_type_str(v, name, &str, errp)) {
+        return;
+    }
+
+    p = str;
+    if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0xffff || e == p) {
+        goto inval;
+    }
+    if (*e != ':') {
+        goto inval;
+    }
+    bus = val;
+
+    p = (char *)e + 1;
+    if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) {
+        goto inval;
+    }
+    if (*e == ':') {
+        dom = bus;
+        bus = val;
+        p = (char *)e + 1;
+        if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) {
+            goto inval;
+        }
+    }
+    slot = val;
+
+    if (*e != '.') {
+        goto inval;
+    }
+    p = (char *)e + 1;
+    if (qemu_strtoul(p, &e, 10, &val) < 0 || val > 7 || e == p) {
+        goto inval;
+    }
+    func = val;
+
+    if (bus > 0xff) {
+        goto inval;
+    }
+
+    if (*e) {
+        goto inval;
+    }
+
+    addr->domain = dom;
+    addr->bus = bus;
+    addr->slot = slot;
+    addr->function = func;
+
+    g_free(str);
+    return;
+
+inval:
+    error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
+    g_free(str);
+}
+
+const PropertyInfo qdev_prop_pci_host_devaddr = {
+    .name = "str",
+    .description = "Address (bus/device/function) of "
+                   "the host device, example: 04:10.0",
+    .get = get_pci_host_devaddr,
+    .set = set_pci_host_devaddr,
+};
+
+/* --- OffAutoPCIBAR off/auto/bar0/bar1/bar2/bar3/bar4/bar5 --- */
+
+const PropertyInfo qdev_prop_off_auto_pcibar = {
+    .name = "OffAutoPCIBAR",
+    .description = "off/auto/bar0/bar1/bar2/bar3/bar4/bar5",
+    .enum_table = &OffAutoPCIBAR_lookup,
+    .get = qdev_propinfo_get_enum,
+    .set = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- PCIELinkSpeed 2_5/5/8/16 -- */
+
+static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
+                                   void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop);
+    int speed;
+
+    switch (*p) {
+    case QEMU_PCI_EXP_LNK_2_5GT:
+        speed = PCIE_LINK_SPEED_2_5;
+        break;
+    case QEMU_PCI_EXP_LNK_5GT:
+        speed = PCIE_LINK_SPEED_5;
+        break;
+    case QEMU_PCI_EXP_LNK_8GT:
+        speed = PCIE_LINK_SPEED_8;
+        break;
+    case QEMU_PCI_EXP_LNK_16GT:
+        speed = PCIE_LINK_SPEED_16;
+        break;
+    default:
+        /* Unreachable */
+        abort();
+    }
+
+    visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp);
+}
+
+static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
+                                   void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop);
+    int speed;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table,
+                         errp)) {
+        return;
+    }
+
+    switch (speed) {
+    case PCIE_LINK_SPEED_2_5:
+        *p = QEMU_PCI_EXP_LNK_2_5GT;
+        break;
+    case PCIE_LINK_SPEED_5:
+        *p = QEMU_PCI_EXP_LNK_5GT;
+        break;
+    case PCIE_LINK_SPEED_8:
+        *p = QEMU_PCI_EXP_LNK_8GT;
+        break;
+    case PCIE_LINK_SPEED_16:
+        *p = QEMU_PCI_EXP_LNK_16GT;
+        break;
+    default:
+        /* Unreachable */
+        abort();
+    }
+}
+
+const PropertyInfo qdev_prop_pcie_link_speed = {
+    .name = "PCIELinkSpeed",
+    .description = "2_5/5/8/16",
+    .enum_table = &PCIELinkSpeed_lookup,
+    .get = get_prop_pcielinkspeed,
+    .set = set_prop_pcielinkspeed,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
+/* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */
+
+static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
+                                   void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop);
+    int width;
+
+    switch (*p) {
+    case QEMU_PCI_EXP_LNK_X1:
+        width = PCIE_LINK_WIDTH_1;
+        break;
+    case QEMU_PCI_EXP_LNK_X2:
+        width = PCIE_LINK_WIDTH_2;
+        break;
+    case QEMU_PCI_EXP_LNK_X4:
+        width = PCIE_LINK_WIDTH_4;
+        break;
+    case QEMU_PCI_EXP_LNK_X8:
+        width = PCIE_LINK_WIDTH_8;
+        break;
+    case QEMU_PCI_EXP_LNK_X12:
+        width = PCIE_LINK_WIDTH_12;
+        break;
+    case QEMU_PCI_EXP_LNK_X16:
+        width = PCIE_LINK_WIDTH_16;
+        break;
+    case QEMU_PCI_EXP_LNK_X32:
+        width = PCIE_LINK_WIDTH_32;
+        break;
+    default:
+        /* Unreachable */
+        abort();
+    }
+
+    visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp);
+}
+
+static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
+                                   void *opaque, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop);
+    int width;
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table,
+                         errp)) {
+        return;
+    }
+
+    switch (width) {
+    case PCIE_LINK_WIDTH_1:
+        *p = QEMU_PCI_EXP_LNK_X1;
+        break;
+    case PCIE_LINK_WIDTH_2:
+        *p = QEMU_PCI_EXP_LNK_X2;
+        break;
+    case PCIE_LINK_WIDTH_4:
+        *p = QEMU_PCI_EXP_LNK_X4;
+        break;
+    case PCIE_LINK_WIDTH_8:
+        *p = QEMU_PCI_EXP_LNK_X8;
+        break;
+    case PCIE_LINK_WIDTH_12:
+        *p = QEMU_PCI_EXP_LNK_X12;
+        break;
+    case PCIE_LINK_WIDTH_16:
+        *p = QEMU_PCI_EXP_LNK_X16;
+        break;
+    case PCIE_LINK_WIDTH_32:
+        *p = QEMU_PCI_EXP_LNK_X32;
+        break;
+    default:
+        /* Unreachable */
+        abort();
+    }
+}
+
+const PropertyInfo qdev_prop_pcie_link_width = {
+    .name = "PCIELinkWidth",
+    .description = "1/2/4/8/12/16/32",
+    .enum_table = &PCIELinkWidth_lookup,
+    .get = get_prop_pcielinkwidth,
+    .set = set_prop_pcielinkwidth,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
hw/core/qdev-properties.c +0 -674

712 lines not on this page · raw message

Signature · 1 line
2.26.2
#8 lore raw

[PULL 10/21] qom: Improve error message displayed with missing object properties

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

Instead of only displaying the property missing, also display the object name. This help developer to quickly figure out the mistake without opening a debugger.

Message-Id: <[email protected]>

---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +2 -1
index c335dce7e4a..10653552334 100644
@@ -1291,7 +1291,8 @@ ObjectProperty *object_property_find_err(Object *obj, const char *name,
 {
     ObjectProperty *prop = object_property_find(obj, name);
     if (!prop) {
-        error_setg(errp, "Property '.%s' not found", name);
+        error_setg(errp, "Property '%s.%s' not found",
+                   object_get_typename(obj), name);
     }
     return prop;
 }
Signature · 1 line
2.26.2
#9 lore raw

[PULL 18/21] kernel-doc: Handle function typedefs without asterisks

In reply to Eduardo Habkost

Example of typedef that was not parsed by kernel-doc:

  typedef void (ObjectUnparent)(Object *obj);

Message-Id: <[email protected]>

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
index 57a4a72970f..57b911ff174 100755
@@ -1318,7 +1318,7 @@ sub dump_typedef($$) {
     $x =~ s@/\*.*?\*/@@gos;	# strip comments.
 
     # Parse function prototypes
-    if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
+    if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
 	$x =~ /typedef\s+(\w+\s*\**)\s*(\w\S+)\s*\s*\((.*)\);/) {
 
 	# Function typedefs
Signature · 1 line
2.26.2
#10 lore raw

[PULL 06/21] hw/core/qdev-properties: Export qdev_prop_enum

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

Message-Id: <[email protected]>

---
 include/hw/qdev-properties.h | 1 +
 hw/core/qdev-properties.c    | 7 +++++++
 2 files changed, 8 insertions(+)
include/hw/qdev-properties.h +1 -0
index 528310bb22f..44374500659 100644
@@ -8,6 +8,7 @@
 extern const PropertyInfo qdev_prop_bit;
 extern const PropertyInfo qdev_prop_bit64;
 extern const PropertyInfo qdev_prop_bool;
+extern const PropertyInfo qdev_prop_enum;
 extern const PropertyInfo qdev_prop_uint8;
 extern const PropertyInfo qdev_prop_uint16;
 extern const PropertyInfo qdev_prop_uint32;
hw/core/qdev-properties.c +7 -0
index 76417d09365..31dfe441e2e 100644
@@ -86,6 +86,13 @@ void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
         qapi_enum_lookup(prop->info->enum_table, prop->defval.i));
 }
 
+const PropertyInfo qdev_prop_enum = {
+    .name  = "enum",
+    .get   = qdev_propinfo_get_enum,
+    .set   = qdev_propinfo_set_enum,
+    .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
 /* Bit */
 
 static uint32_t qdev_get_prop_mask(Property *prop)
Signature · 1 line
2.26.2
#11 lore raw

[PULL 12/21] docs/devel/qom: Fix indentation of bulleted list

In reply to Eduardo Habkost

The list was incorrectly parsed as a literal block due to indentation.

Message-Id: <[email protected]>

---
 docs/devel/qom.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
docs/devel/qom.rst +3 -3
index 0b943b2a1a8..c4857d95c8e 100644
@@ -8,9 +8,9 @@ The QEMU Object Model provides a framework for registering user creatable
 types and instantiating objects from those types.  QOM provides the following
 features:
 
- - System for dynamically registering types
- - Support for single-inheritance of types
- - Multiple inheritance of stateless interfaces
+- System for dynamically registering types
+- Support for single-inheritance of types
+- Multiple inheritance of stateless interfaces
 
 .. code-block:: c
    :caption: Creating a minimal type
Signature · 1 line
2.26.2
#12 lore raw

[PULL 13/21] docs/devel/qom: Fix indentation of code blocks

In reply to Eduardo Habkost

Some code blocks had one extra space, fix that.

Message-Id: <[email protected]>

---
 docs/devel/qom.rst | 76 +++++++++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 38 deletions(-)
docs/devel/qom.rst +38 -38
index c4857d95c8e..a47e1b9a239 100644
@@ -284,28 +284,28 @@ in the header file:
 .. code-block:: c
    :caption: Declaring a simple type
 
-    OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+   OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
 
 This is equivalent to the following:
 
 .. code-block:: c
    :caption: Expansion from declaring a simple type
 
-    typedef struct MyDevice MyDevice;
-    typedef struct MyDeviceClass MyDeviceClass;
+   typedef struct MyDevice MyDevice;
+   typedef struct MyDeviceClass MyDeviceClass;
 
-    G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)
+   G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)
 
-    #define MY_DEVICE_GET_CLASS(void *obj) \
-            OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
-    #define MY_DEVICE_CLASS(void *klass) \
-            OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
-    #define MY_DEVICE(void *obj)
-            OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
+   #define MY_DEVICE_GET_CLASS(void *obj) \
+           OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
+   #define MY_DEVICE_CLASS(void *klass) \
+           OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
+   #define MY_DEVICE(void *obj)
+           OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
 
-    struct MyDeviceClass {
-        DeviceClass parent_class;
-    };
+   struct MyDeviceClass {
+       DeviceClass parent_class;
+   };
 
 The 'struct MyDevice' needs to be declared separately.
 If the type requires virtual functions to be declared in the class
@@ -319,33 +319,33 @@ In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
 .. code-block:: c
    :caption: Defining a simple type
 
-    OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+   OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
 
 This is equivalent to the following:
 
 .. code-block:: c
    :caption: Expansion from defining a simple type
 
-    static void my_device_finalize(Object *obj);
-    static void my_device_class_init(ObjectClass *oc, void *data);
-    static void my_device_init(Object *obj);
-
-    static const TypeInfo my_device_info = {
-        .parent = TYPE_DEVICE,
-        .name = TYPE_MY_DEVICE,
-        .instance_size = sizeof(MyDevice),
-        .instance_init = my_device_init,
-        .instance_finalize = my_device_finalize,
-        .class_size = sizeof(MyDeviceClass),
-        .class_init = my_device_class_init,
-    };
-
-    static void
-    my_device_register_types(void)
-    {
-        type_register_static(&my_device_info);
-    }
-    type_init(my_device_register_types);
+   static void my_device_finalize(Object *obj);
+   static void my_device_class_init(ObjectClass *oc, void *data);
+   static void my_device_init(Object *obj);
+
+   static const TypeInfo my_device_info = {
+       .parent = TYPE_DEVICE,
+       .name = TYPE_MY_DEVICE,
+       .instance_size = sizeof(MyDevice),
+       .instance_init = my_device_init,
+       .instance_finalize = my_device_finalize,
+       .class_size = sizeof(MyDeviceClass),
+       .class_init = my_device_class_init,
+   };
+
+   static void
+   my_device_register_types(void)
+   {
+       type_register_static(&my_device_info);
+   }
+   type_init(my_device_register_types);
 
 This is sufficient to get the type registered with the type
 system, and the three standard methods now need to be implemented
@@ -358,9 +358,9 @@ This accepts an array of interface type names.
 .. code-block:: c
    :caption: Defining a simple type implementing interfaces
 
-    OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
-                                       MY_DEVICE, DEVICE,
-                                       { TYPE_USER_CREATABLE }, { NULL })
+   OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
+                                      MY_DEVICE, DEVICE,
+                                      { TYPE_USER_CREATABLE }, { NULL })
 
 If the type is not intended to be instantiated, then then
 the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
@@ -368,7 +368,7 @@ the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
 .. code-block:: c
    :caption: Defining a simple abstract type
 
-    OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+   OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
 
 
 
Signature · 1 line
2.26.2
#13 lore raw

[PULL 20/21] memory: Explicitly tag doc comments for structs

In reply to Eduardo Habkost

This will allow us to remove the QEMU-specific $decl_type='type name' hack from the kernel-doc script.

Message-Id: <[email protected]>

---
 include/exec/memory.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/exec/memory.h +3 -3
index dee09851622..622207bde12 100644
@@ -443,7 +443,7 @@ struct IOMMUMemoryRegion {
     QLIST_FOREACH((n), &(mr)->iommu_notify, node)
 
 /**
- * MemoryListener: callbacks structure for updates to the physical memory map
+ * struct MemoryListener: callbacks structure for updates to the physical memory map
  *
  * Allows a component to adjust to changes in the guest-visible memory map.
  * Use with memory_listener_register() and memory_listener_unregister().
@@ -681,7 +681,7 @@ struct MemoryListener {
 };
 
 /**
- * AddressSpace: describes a mapping of addresses to #MemoryRegion objects
+ * struct AddressSpace: describes a mapping of addresses to #MemoryRegion objects
  */
 struct AddressSpace {
     /* private: */
@@ -721,7 +721,7 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as)
 
 
 /**
- * MemoryRegionSection: describes a fragment of a #MemoryRegion
+ * struct MemoryRegionSection: describes a fragment of a #MemoryRegion
  *
  * @mr: the region, or %NULL if empty
  * @fv: the flat view of the address space the region is mapped in
Signature · 1 line
2.26.2
#14 lore raw

[PULL 07/21] hw/core/qdev-properties: Export some integer-related functions

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

We are going to split this file and reuse these static functions. Declare them in the local "qdev-prop-internal.h" header.

Message-Id: <[email protected]>

---
 hw/core/qdev-prop-internal.h | 11 +++++++++
 hw/core/qdev-properties.c    | 46 +++++++++++++++++++-----------------
 2 files changed, 35 insertions(+), 22 deletions(-)
hw/core/qdev-prop-internal.h +11 -0
index 2a8c9a306a5..9cf5cc1d519 100644
@@ -15,5 +15,16 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
 
 void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
                                           const Property *prop);
+void qdev_propinfo_set_default_value_int(ObjectProperty *op,
+                                         const Property *prop);
+void qdev_propinfo_set_default_value_uint(ObjectProperty *op,
+                                          const Property *prop);
+
+void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name,
+                              void *opaque, Error **errp);
+void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name,
+                             void *opaque, Error **errp);
+void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name,
+                              void *opaque, Error **errp);
 
 #endif
hw/core/qdev-properties.c +24 -22

134 lines not on this page · raw message

Signature · 1 line
2.26.2
#15 lore raw

[PULL 17/21] kernel-doc: Handle function typedefs that return pointers

In reply to Eduardo Habkost

One example that was not being parsed correctly by kernel-doc is:

typedef Object *(ObjectPropertyResolve)(Object *obj,

                                          void *opaque,
                                          const char *part);

Message-Id: <[email protected]>

---
 scripts/kernel-doc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kernel-doc +2 -2
index 40ad782e342..57a4a72970f 100755
@@ -1318,8 +1318,8 @@ sub dump_typedef($$) {
     $x =~ s@/\*.*?\*/@@gos;	# strip comments.
 
     # Parse function prototypes
-    if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
-	$x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) {
+    if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
+	$x =~ /typedef\s+(\w+\s*\**)\s*(\w\S+)\s*\s*\((.*)\);/) {
 
 	# Function typedefs
 	$return_type = $1;
Signature · 1 line
2.26.2
#16 lore raw

[PULL 14/21] docs/devel/qom: Use *emphasis* for emphasis

In reply to Eduardo Habkost

<emphasis> is not valid reST syntax.

Message-Id: <[email protected]>

---
 docs/devel/qom.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
docs/devel/qom.rst +3 -3
index a47e1b9a239..0c610e20d62 100644
@@ -174,17 +174,17 @@ dynamically cast it to an object that implements the interface.
 Methods
 =======
 
-A <emphasis>method</emphasis> is a function within the namespace scope of
+A *method* is a function within the namespace scope of
 a class. It usually operates on the object instance by passing it as a
 strongly-typed first argument.
 If it does not operate on an object instance, it is dubbed
-<emphasis>class method</emphasis>.
+*class method*.
 
 Methods cannot be overloaded. That is, the #ObjectClass and method name
 uniquely identity the function to be called; the signature does not vary
 except for trailing varargs.
 
-Methods are always <emphasis>virtual</emphasis>. Overriding a method in
+Methods are always *virtual*. Overriding a method in
 #TypeInfo.class_init of a subclass leads to any user of the class obtained
 via OBJECT_GET_CLASS() accessing the overridden function.
 The original function is not automatically invoked. It is the responsibility
Signature · 1 line
2.26.2
#17 lore raw

[PULL 19/21] qom: Explicitly tag doc comments for typedefs and structs

In reply to Eduardo Habkost

If we explicitly indicate we are documenting a typedef or a struct, we'll be able to remove the $decl_type='type name' hack from kernel-doc.

Message-Id: <[email protected]>

---
 include/qom/object.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
include/qom/object.h +11 -11
index e80092f349a..d378f13a116 100644
@@ -31,7 +31,7 @@ typedef struct InterfaceInfo InterfaceInfo;
 typedef struct ObjectProperty ObjectProperty;
 
 /**
- * ObjectPropertyAccessor:
+ * typedef ObjectPropertyAccessor:
  * @obj: the object that owns the property
  * @v: the visitor that contains the property data
  * @name: the name of the property
@@ -47,7 +47,7 @@ typedef void (ObjectPropertyAccessor)(Object *obj,
                                       Error **errp);
 
 /**
- * ObjectPropertyResolve:
+ * typedef ObjectPropertyResolve:
  * @obj: the object that owns the property
  * @opaque: the opaque registered with the property
  * @part: the name of the property
@@ -66,7 +66,7 @@ typedef Object *(ObjectPropertyResolve)(Object *obj,
                                         const char *part);
 
 /**
- * ObjectPropertyRelease:
+ * typedef ObjectPropertyRelease:
  * @obj: the object that owns the property
  * @name: the name of the property
  * @opaque: the opaque registered with the property
@@ -78,7 +78,7 @@ typedef void (ObjectPropertyRelease)(Object *obj,
                                      void *opaque);
 
 /**
- * ObjectPropertyInit:
+ * typedef ObjectPropertyInit:
  * @obj: the object that owns the property
  * @prop: the property to set
  *
@@ -101,7 +101,7 @@ struct ObjectProperty
 };
 
 /**
- * ObjectUnparent:
+ * typedef ObjectUnparent:
  * @obj: the object that is being removed from the composition tree
  *
  * Called when an object is being removed from the QOM composition tree.
@@ -110,7 +110,7 @@ struct ObjectProperty
 typedef void (ObjectUnparent)(Object *obj);
 
 /**
- * ObjectFree:
+ * typedef ObjectFree:
  * @obj: the object being freed
  *
  * Called when an object's last reference is removed.
@@ -120,7 +120,7 @@ typedef void (ObjectFree)(void *obj);
 #define OBJECT_CLASS_CAST_CACHE 4
 
 /**
- * ObjectClass:
+ * struct ObjectClass:
  *
  * The base for all classes.  The only thing that #ObjectClass contains is an
  * integer type handle.
@@ -140,7 +140,7 @@ struct ObjectClass
 };
 
 /**
- * Object:
+ * struct Object:
  *
  * The base for all objects.  The first member of this object is a pointer to
  * a #ObjectClass.  Since C guarantees that the first member of a structure
@@ -370,7 +370,7 @@ struct Object
                                 true, { NULL })
 
 /**
- * TypeInfo:
+ * struct TypeInfo:
  * @name: The name of the type.
  * @parent: The name of the parent type.
  * @instance_size: The size of the object (derivative of #Object).  If
@@ -496,7 +496,7 @@ struct TypeInfo
     OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name)
 
 /**
- * InterfaceInfo:
+ * struct InterfaceInfo:
  * @type: The name of the interface.
  *
  * The information associated with an interface.
@@ -506,7 +506,7 @@ struct InterfaceInfo {
 };
 
 /**
- * InterfaceClass:
+ * struct InterfaceClass:
  * @parent_class: the base class
  *
  * The class for all interfaces.  Subclasses of this class should only add
Signature · 1 line
2.26.2
#18 lore raw

[PULL 11/21] qom: Fix DECLARE_*CHECKER documentation

In reply to Eduardo Habkost

Correct copy/paste mistake in the DECLARE_INSTANCE_CHECKER and DECLARE_CLASS_CHECKERS documentation.

Message-Id: <[email protected]>

---
 include/qom/object.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qom/object.h +2 -2
index 27aaa67e63f..de121d8d8e8 100644
@@ -170,7 +170,7 @@ struct Object
  * Direct usage of this macro should be avoided, and the complete
  * OBJECT_DECLARE_TYPE macro is recommended instead.
  *
- * This macro will provide the three standard type cast functions for a
+ * This macro will provide the instance type cast functions for a
  * QOM type.
  */
 #define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
@@ -187,7 +187,7 @@ struct Object
  * Direct usage of this macro should be avoided, and the complete
  * OBJECT_DECLARE_TYPE macro is recommended instead.
  *
- * This macro will provide the three standard type cast functions for a
+ * This macro will provide the class type cast functions for a
  * QOM type.
  */
 #define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \
Signature · 1 line
2.26.2
#19 lore raw

[PULL 16/21] docs/devel/qom: Avoid long lines

In reply to Eduardo Habkost

Long code lines don't look good in the rendered documents, make them shorter.

Message-Id: <[email protected]>

---
 docs/devel/qom.rst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
docs/devel/qom.rst +6 -3
index 0c610e20d62..42d0dc4f4da 100644
@@ -284,7 +284,8 @@ in the header file:
 .. code-block:: c
    :caption: Declaring a simple type
 
-   OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+   OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device,
+                              MY_DEVICE, DEVICE)
 
 This is equivalent to the following:
 
@@ -360,7 +361,8 @@ This accepts an array of interface type names.
 
    OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
                                       MY_DEVICE, DEVICE,
-                                      { TYPE_USER_CREATABLE }, { NULL })
+                                      { TYPE_USER_CREATABLE },
+                                      { NULL })
 
 If the type is not intended to be instantiated, then then
 the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
@@ -368,7 +370,8 @@ the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
 .. code-block:: c
    :caption: Defining a simple abstract type
 
-   OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+   OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device,
+                               MY_DEVICE, DEVICE)
 
 
 
Signature · 1 line
2.26.2
#20 lore raw

[PULL 15/21] docs/devel/qom: Remove usage of <code>

In reply to Eduardo Habkost

<code> is not valid reST syntax.

Function @argument references don't need additional markup, so just remove <code></code>.

Constants were changed to use reST ``code`` syntax

Message-Id: <[email protected]>

---
 include/qom/object.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/qom/object.h +6 -6
index de121d8d8e8..e80092f349a 100644
@@ -1256,7 +1256,7 @@ char *object_property_get_str(Object *obj, const char *name,
  * Writes an object's canonical path to a property.
  *
  * If the link property was created with
- * <code>OBJ_PROP_LINK_STRONG</code> bit, the old target object is
+ * %OBJ_PROP_LINK_STRONG bit, the old target object is
  * unreferenced, and a reference is added to the new target object.
  *
  * Returns: %true on success, %false on failure.
@@ -1603,16 +1603,16 @@ void object_property_allow_set_link(const Object *obj, const char *name,
  *
  * Links form the graph in the object model.
  *
- * The <code>@check()</code> callback is invoked when
+ * The @check() callback is invoked when
  * object_property_set_link() is called and can raise an error to prevent the
- * link being set.  If <code>@check</code> is NULL, the property is read-only
+ * link being set.  If @check is NULL, the property is read-only
  * and cannot be set.
  *
  * Ownership of the pointer that @child points to is transferred to the
- * link property.  The reference count for <code>*@child</code> is
+ * link property.  The reference count for *@child is
  * managed by the property from after the function returns till the
  * property is deleted with object_property_del().  If the
- * <code>@flags</code> <code>OBJ_PROP_LINK_STRONG</code> bit is set,
+ * @flags %OBJ_PROP_LINK_STRONG bit is set,
  * the reference count is decremented when the property is deleted or
  * modified.
  *
@@ -1823,7 +1823,7 @@ ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,
  * Add an alias for a property on an object.  This function will add a property
  * of the same type as the forwarded property.
  *
- * The caller must ensure that <code>@target_obj</code> stays alive as long as
+ * The caller must ensure that @target_obj stays alive as long as
  * this property exists.  In the case of a child object or an alias on the same
  * object this will be the case.  For aliases to other objects the caller is
  * responsible for taking a reference.
Signature · 1 line
2.26.2
#21 lore raw

[PULL 21/21] kernel-doc: Remove $decl_type='type name' hack

In reply to Eduardo Habkost

The $decl_type='type name' hack makes it impossible to document macros with uppercase names (e.g. most of the macros in object.h).

Now that we have explicitly tagged the struct and typedef doc comments in memory.h and object.h, we don't need that hack anymore. This will make the documentation for the macros in object.h finally be rendered as expected.

Message-Id: <[email protected]>

---
 scripts/kernel-doc | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
scripts/kernel-doc +1 -11
index 57b911ff174..0ff62bb6a2d 100755
@@ -1064,14 +1064,6 @@ sub output_blockhead {
 sub dump_declaration($$) {
     no strict 'refs';
     my ($prototype, $file) = @_;
-    if ($decl_type eq 'type name') {
-       if ($prototype =~ /^(enum|struct|union)\s+/) {
-	   $decl_type = $1;
-	} else {
-	   return;
-       }
-    }
-
     my $func = "dump_" . $decl_type;
     &$func(@_);
 }
@@ -1928,9 +1920,7 @@ sub process_name($$) {
 	    ++$warnings;
 	}
 
-	if ($identifier =~ m/^[A-Z]/) {
-	    $decl_type = 'type name';
-	} elsif ($identifier =~ m/^struct\b/) {
+	if ($identifier =~ m/^struct\b/) {
 	    $decl_type = 'struct';
 	} elsif ($identifier =~ m/^union\b/) {
 	    $decl_type = 'union';
Signature · 1 line
2.26.2
#22 lore raw
In reply to Eduardo Habkost
Quoted 16 lines · Eduardo Habkost

The following changes since commit 36d9c2883e55c863b622b99f0ebb5143f0001401:

readthedocs: build with Python 3.6 (2020-10-05 16:30:45 +0100)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/machine-next-pull-request

for you to fetch changes up to fec5c4b6d3b7f3ffcfcbe1714e0405df6de2a222:

kernel-doc: Remove $decl_type='type name' hack (2020-10-05 12:48:11 -0400)

----------------------------------------------------------------
machine + QOM queue, 2020-10-05

Quoted 7 lines

* QOM documentation fixes and cleanups (Eduardo Habkost)
* user-mode: Prune build dependencies (Philippe Mathieu-Daudé)
* qom: Improve error message (Philippe Mathieu-Daudé)
* numa: hmat: require parent cache description before the next level one (Igor Mammedov)

----------------------------------------------------------------

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

thanks
-- PMM

#23 lore raw
Quoted 29 lines · Peter Maydell
Quoted 16 lines · Eduardo Habkost

The following changes since commit 36d9c2883e55c863b622b99f0ebb5143f0001401:

readthedocs: build with Python 3.6 (2020-10-05 16:30:45 +0100)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/machine-next-pull-request

for you to fetch changes up to fec5c4b6d3b7f3ffcfcbe1714e0405df6de2a222:

kernel-doc: Remove $decl_type='type name' hack (2020-10-05 12:48:11 -0400)

----------------------------------------------------------------
machine + QOM queue, 2020-10-05

Quoted 7 lines

* QOM documentation fixes and cleanups (Eduardo Habkost)
* user-mode: Prune build dependencies (Philippe Mathieu-Daudé)
* qom: Improve error message (Philippe Mathieu-Daudé)
* numa: hmat: require parent cache description before the next level one (Igor Mammedov)

----------------------------------------------------------------

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

Quoted 7 lines
                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

Signature · 1 line
Eduardo
#24 lore raw
Quoted 14 lines · Eduardo Habkost
Quoted 11 lines · Peter Maydell

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

Quoted 2 lines

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

Currently this is still my ad-hoc setup. I think there is some CI that tests OSX compiles, though I have no idea how individual maintainers set up to use it.

thanks
-- PMM

#25 lore raw
Quoted 15 lines · Peter Maydell
Quoted 14 lines · Eduardo Habkost
Quoted 11 lines · Peter Maydell

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

Quoted 6 lines
Quoted 2 lines

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

Currently this is still my ad-hoc setup. I think there is some CI that tests OSX compiles, though I have no idea how individual maintainers set up to use it.

Cirrus CI will cover macOS builds. You just need to register with Cirrus CI via your GitLab login, then pushing a branch to gitlab should trigger both GitLab CI and Cirrus CI, which covers a vast majority of combinations.

If you register with Travis and push to GitHub too, you'll get some non-x86 coverage too. Alternatively setup mirroring from GitLab to GitHub, so you don't have to separately push to GitHub, just use GitLab to trigger all three CI systems.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#26 lore raw
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Eduardo Habkost
Quoted 11 lines · Peter Maydell

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

                    node->level - 1);
                    ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                         (fmt), ## __VA_ARGS__)
                          ~~~      ^~~~~~~~~~~

1 error generated.

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

Quoted 8 lines
Quoted 3 lines

Currently this is still my ad-hoc setup. I think there is some CI that tests OSX compiles, though I have no idea how individual maintainers set up to use it.

Cirrus CI will cover macOS builds. You just need to register with Cirrus CI via your GitLab login, then pushing a branch to gitlab should trigger both GitLab CI and Cirrus CI, which covers a vast majority of combinations.

I think Cirrus-CI needs a github account? Is there a way to use Gitlab now instead? (just like Travis recently added Gitlab support?)

We should eventually set up the cirrus-run tool, so we can use gitlab, too, but I think you then still need at least a dummy github account to be able to use it, don't you?

Thomas

#27 lore raw

Il mar 6 ott 2020, 20:47 Thomas Huth <[email protected]> ha scritto:

Quoted 3 lines

I think Cirrus-CI needs a github account? Is there a way to use Gitlab now instead? (just like Travis recently added Gitlab support?)

It does only support GitHub. In theory you can set up an automatic push from Gitlab to GitHub but it doesn't work well if you force push to the Gitlab repository.

We should eventually set up the cirrus-run tool, so we can use gitlab, too,

Quoted 3 lines

but I think you then still need at least a dummy github account to be able to use it, don't you?

Yes, that's correct.

Paolo

Quoted 3 lines

Thomas

#28 lore raw
Quoted 9 lines · Paolo Bonzini

Il mar 6 ott 2020, 20:47 Thomas Huth <[email protected]> ha scritto:

Quoted 3 lines

I think Cirrus-CI needs a github account? Is there a way to use Gitlab now instead? (just like Travis recently added Gitlab support?)

It does only support GitHub. In theory you can set up an automatic push from Gitlab to GitHub but it doesn't work well if you force push to the Gitlab repository.

I've configured my GitLab qemu repo to run a "Push" mirror to GitHub and it propagates force pushes for branches too.

There is some rate limiting though. It won't mirror more frequently than every 5 minutes, and so in worst case you could be waiting upto just under 10 minutes for it to sync.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#29 lore raw
In reply to Thomas Huth
Quoted 24 lines · Thomas Huth
Quoted 23 lines · Daniel P. Berrangé
Quoted 21 lines · Peter Maydell
Quoted 14 lines · Eduardo Habkost
Quoted 11 lines · Peter Maydell

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

                    node->level - 1);
                    ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                         (fmt), ## __VA_ARGS__)
                          ~~~      ^~~~~~~~~~~

1 error generated.

Quoted 2 lines

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

Currently this is still my ad-hoc setup. I think there is some CI that tests OSX compiles, though I have no idea how individual maintainers set up to use it.

Quoted 7 lines
Quoted 4 lines

Cirrus CI will cover macOS builds. You just need to register with Cirrus CI via your GitLab login, then pushing a branch to gitlab should trigger both GitLab CI and Cirrus CI, which covers a vast majority of combinations.

I think Cirrus-CI needs a github account? Is there a way to use Gitlab now instead? (just like Travis recently added Gitlab support?)

Sorry, I was mixing up Travis and Cirrus.

Quoted 3 lines

We should eventually set up the cirrus-run tool, so we can use gitlab, too, but I think you then still need at least a dummy github account to be able to use it, don't you?

Yes, you still need a github account.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#30 lore raw
In reply to Eduardo Habkost
Quoted 38 lines · Eduardo Habkost
Quoted 29 lines · Peter Maydell
Quoted 16 lines · Eduardo Habkost

The following changes since commit 36d9c2883e55c863b622b99f0ebb5143f0001401:

readthedocs: build with Python 3.6 (2020-10-05 16:30:45 +0100)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/machine-next-pull-request

for you to fetch changes up to fec5c4b6d3b7f3ffcfcbe1714e0405df6de2a222:

kernel-doc: Remove $decl_type='type name' hack (2020-10-05 12:48:11 -0400)

----------------------------------------------------------------
machine + QOM queue, 2020-10-05

Quoted 7 lines

* QOM documentation fixes and cleanups (Eduardo Habkost)
* user-mode: Prune build dependencies (Philippe Mathieu-Daudé)
* qom: Improve error message (Philippe Mathieu-Daudé)
* numa: hmat: require parent cache description before the next level one (Igor Mammedov)

----------------------------------------------------------------

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

Quoted 7 lines
                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

Quoted 2 lines

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

Possibly Cirrus CI? You have to add it to your account
(https://cirrus-ci.org/guide/quick-start/) and then it triggers on any push to GitHub; there's nothing else you have to do.

Paolo

#31 lore raw
In reply to Eduardo Habkost
Quoted 38 lines · On Tue, 6 Oct 2020 10:36:37 -0400 Eduardo Habkost <[email protected]> wrote:
Quoted 29 lines · Peter Maydell
Quoted 16 lines · Eduardo Habkost

The following changes since commit 36d9c2883e55c863b622b99f0ebb5143f0001401:

readthedocs: build with Python 3.6 (2020-10-05 16:30:45 +0100)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/machine-next-pull-request

for you to fetch changes up to fec5c4b6d3b7f3ffcfcbe1714e0405df6de2a222:

kernel-doc: Remove $decl_type='type name' hack (2020-10-05 12:48:11 -0400)

----------------------------------------------------------------
machine + QOM queue, 2020-10-05

Quoted 7 lines

* QOM documentation fixes and cleanups (Eduardo Habkost)
* user-mode: Prune build dependencies (Philippe Mathieu-Daudé)
* qom: Improve error message (Philippe Mathieu-Daudé)
* numa: hmat: require parent cache description before the next level one (Igor Mammedov)

----------------------------------------------------------------

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

Quoted 7 lines
                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

Quoted 2 lines

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

I usually use travis-ci, but for this patch I didn't run it via CI for some reason. Just posted fixed v2.

(it looks like pushing to github doesn't trigger travis build anymore)

#32 lore raw
Quoted 41 lines · On Tue, 6 Oct 2020 17:04:18 +0200 Igor Mammedov <[email protected]> wrote:
Quoted 38 lines · On Tue, 6 Oct 2020 10:36:37 -0400 Eduardo Habkost <[email protected]> wrote:
Quoted 36 lines · Peter Maydell
Quoted 16 lines · Eduardo Habkost

The following changes since commit 36d9c2883e55c863b622b99f0ebb5143f0001401:

readthedocs: build with Python 3.6 (2020-10-05 16:30:45 +0100)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/machine-next-pull-request

for you to fetch changes up to fec5c4b6d3b7f3ffcfcbe1714e0405df6de2a222:

kernel-doc: Remove $decl_type='type name' hack (2020-10-05 12:48:11 -0400)

----------------------------------------------------------------
machine + QOM queue, 2020-10-05

Quoted 7 lines

* QOM documentation fixes and cleanups (Eduardo Habkost)
* user-mode: Prune build dependencies (Philippe Mathieu-Daudé)
* qom: Improve error message (Philippe Mathieu-Daudé)
* numa: hmat: require parent cache description before the next level one (Igor Mammedov)

----------------------------------------------------------------

Compile failure on OSX:

../../hw/core/numa.c:429:20: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]

                   node->level - 1);
                   ^~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/include/qapi/error.h:319:35: note:
expanded from macro 'error_setg'
                        (fmt), ## __VA_ARGS__)
                         ~~~      ^~~~~~~~~~~

1 error generated.

Quoted 6 lines
Quoted 2 lines

Is there a CI system where this is tested? I'd like to be able to detect this kind of failure before sending pull requests.

I usually use travis-ci, but for this patch I didn't run it via CI for some reason. Just posted fixed v2.

(it looks like pushing to github doesn't trigger travis build anymore)

Looks like travis-ci lost previous authorizations to my github repo, but giving a new one didn't help.

Something wrong with current QEMU master, travis-ci doesn't recognize QEMU repo a valid anymore.

#33 lore raw
Quoted 5 lines · Igor Mammedov

Looks like travis-ci lost previous authorizations to my github repo, but giving a new one didn't help.

Something wrong with current QEMU master, travis-ci doesn't recognize QEMU repo a valid anymore.

Interesting, I use Travis->Gitlab integration and even though builds are still triggered, they don't appear in the Gitlab CI page. So the configuration is okay, but something seems to be wrong on the Travis side.

Paolo

#34 lore raw
Quoted 10 lines · On Tue, 6 Oct 2020 17:42:28 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 5 lines · Igor Mammedov

Looks like travis-ci lost previous authorizations to my github repo, but giving a new one didn't help.

Something wrong with current QEMU master, travis-ci doesn't recognize QEMU repo a valid anymore.

Interesting, I use Travis->Gitlab integration and even though builds are still triggered, they don't appear in the Gitlab CI page. So the configuration is okay, but something seems to be wrong on the Travis side.

If one enables access to all repositories on account, then even if travis-ci doesn't show QEMU repo as accessible one, it seems that there is a new build in 'received' state, maybe it will start building eventually.

Quoted 3 lines

Paolo

#35 lore raw
Quoted 10 lines · Igor Mammedov
Quoted 7 lines · On Tue, 6 Oct 2020 17:42:28 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 5 lines · Igor Mammedov

Looks like travis-ci lost previous authorizations to my github repo, but giving a new one didn't help.

Something wrong with current QEMU master, travis-ci doesn't recognize QEMU repo a valid anymore.

Quoted 7 lines
Quoted 3 lines

Interesting, I use Travis->Gitlab integration and even though builds are still triggered, they don't appear in the Gitlab CI page. So the configuration is okay, but something seems to be wrong on the Travis side.

If one enables access to all repositories on account, then even if travis-ci doesn't show QEMU repo as accessible one, it seems that there is a new build in 'received' state, maybe it will start building eventually.

It works for me (via my github account):

https://travis-ci.com/github/huth/qemu/builds/188441775

... maybe it was just a temporary hickup?

Anyway, we do not test macOS on Travis anymore (see commit 22a231950c50d3), so this is likely not helpful for Eduardo's original problem... Cirrus-CI is the way to go if you need macOS test coverage.

Thomas