Skip to contentSkip to conversation

Machine queue, 2019-01-10

GIT PULL Applied Eduardo Habkost 3 participants 13 messages Jan 10, 2019 – Jan 11, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit 8ae951fbc1068308313b2c57a4fc3c68451641f4:

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190109' into staging (2019-01-09 16:08:31 +0000)

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 d769f0dfeeaa1554a38fedb16bb20a4b0ecf793c:

qom: Don't keep error value between object_property_parse() calls (2019-01-10 12:25:15 -0200)

----------------------------------------------------------------
Machine queue, 2019-01-10

* Simplify GlobalProperty array declarations (Eduardo Habkost)
* Deprecate cpu-add commands (Kashyap Chamarthy)
* range/memory-device cleanups (David Hildenbrand)
* Fix -device scsi-hd,help regression (Marc-André Lureau)
* Fix crash when -global generates multiple warnings (Eduardo Habkost)

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

Queue for Machine Core patches

David Hildenbrand (2):
range: add some more functions
memory-device: rewrite address assignment using ranges

Eduardo Habkost (4):
spapr: Eliminate SPAPR_PCI_2_7_MMIO_WIN_SIZE macro
machine: Eliminate unnecessary stringify() usage
machine: Use shorter format for GlobalProperty arrays
qom: Don't keep error value between object_property_parse() calls

Kashyap Chamarthy (3):
qemu-deprecated.texi: Rename the HMP section
Update that HMP 'cpu-add' is deprecated in 4.0
Mention that QMP 'cpu-add' will be deprecated

Marc-André Lureau (1):
qdev: fix -device scsi-hd,help regression

 include/hw/i386/pc.h        |  18 +-
 include/hw/pci-host/spapr.h |   1 -
 include/qemu/range.h        |  62 ++++
 hw/core/machine.c           | 338 ++++-------------
 hw/core/qdev.c              |   9 +-
 hw/i386/pc.c                | 720 +++++++-----------------------------
 hw/i386/pc_piix.c           | 192 ++--------
 hw/mem/memory-device.c      |  51 +--
 hw/ppc/spapr.c              |  72 +---
 hw/s390x/s390-virtio-ccw.c  |  75 +---
 hw/xen/xen-common.c         |  18 +-
 qom/object.c                |   2 +-
 qemu-deprecated.texi        |  10 +-
 13 files changed, 368 insertions(+), 1200 deletions(-)
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#1 lore raw

[Qemu-devel] [PULL 01/10] qemu-deprecated.texi: Rename the HMP section

From: Kashyap Chamarthy <[email protected]>

So that it is consistent with the naming of QMP's

Message-Id: <[email protected]>

---
 qemu-deprecated.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-deprecated.texi +1 -1
index c3735b698e..3f30f05a61 100644
@@ -106,7 +106,7 @@ The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command.
 The ``arch'' output member of the ``query-cpus-fast'' command is
 replaced by the ``target'' output member.
 
-@section System emulator human monitor commands
+@section Human Monitor Protocol (HMP) commands
 
 @subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (since 3.1)
 
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#2 lore raw

[Qemu-devel] [PULL 02/10] Update that HMP 'cpu-add' is deprecated in 4.0

In reply to Eduardo Habkost

From: Kashyap Chamarthy <[email protected]>

Message-Id: <[email protected]>

[ehabkost: revert back to 'cpu-add' spelling]
---
 qemu-deprecated.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-deprecated.texi +1 -1
index 3f30f05a61..f4a5cea62b 100644
@@ -113,7 +113,7 @@ replaced by the ``target'' output member.
 The @option{[hub_id name]} parameter tuple of the 'hostfwd_add' and
 'hostfwd_remove' HMP commands has been replaced by @option{netdev_id}.
 
-@subsection cpu-add (since 3.1)
+@subsection cpu-add (since 4.0)
 
 Use ``device_add'' for hotplugging vCPUs instead of ``cpu-add''.  See
 documentation of ``query-hotpluggable-cpus'' for additional details.
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#3 lore raw

[Qemu-devel] [PULL 03/10] Mention that QMP 'cpu-add' will be deprecated

In reply to Eduardo Habkost

From: Kashyap Chamarthy <[email protected]>

Message-Id: <[email protected]>

---
 qemu-deprecated.texi | 6 ++++++
 1 file changed, 6 insertions(+)
qemu-deprecated.texi +6 -0
index f4a5cea62b..81de5fc019 100644
@@ -106,6 +106,12 @@ The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command.
 The ``arch'' output member of the ``query-cpus-fast'' command is
 replaced by the ``target'' output member.
 
+@subsection cpu-add (since 4.0)
+
+Use ``device_add'' for hotplugging vCPUs instead of ``cpu-add''.  See
+documentation of ``query-hotpluggable-cpus'' for additional
+details.
+
 @section Human Monitor Protocol (HMP) commands
 
 @subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (since 3.1)
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#4 lore raw

[Qemu-devel] [PULL 04/10] range: add some more functions

In reply to Eduardo Habkost

From: David Hildenbrand <[email protected]>

Add some more functions that will be used in memory-device context.

range_init(): Init using lower bound and size, check for validity range_init_nofail(): Init using lower bound and size, validity asserted range_size(): Extract the size of a range range_overlaps_range(): Check for overlaps of two ranges range_contains_range(): Check if one range is contained in the other

Message-Id: <[email protected]>

---
 include/qemu/range.h | 62 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
include/qemu/range.h +62 -0
index 7e75f4e655..ba606c6bc0 100644
@@ -112,6 +112,68 @@ static inline uint64_t range_upb(Range *range)
     return range->upb;
 }
 
+/*
+ * Initialize @range to span the interval [@lob,@lob + @size - 1].
+ * @size may be 0. If the range would overflow, returns -ERANGE, otherwise
+ * 0.
+ */
+static inline int QEMU_WARN_UNUSED_RESULT range_init(Range *range, uint64_t lob,
+                                                     uint64_t size)
+{
+    if (lob + size < lob) {
+        return -ERANGE;
+    }
+    range->lob = lob;
+    range->upb = lob + size - 1;
+    range_invariant(range);
+    return 0;
+}
+
+/*
+ * Initialize @range to span the interval [@lob,@lob + @size - 1].
+ * @size may be 0. Range must not overflow.
+ */
+static inline void range_init_nofail(Range *range, uint64_t lob, uint64_t size)
+{
+    range->lob = lob;
+    range->upb = lob + size - 1;
+    range_invariant(range);
+}
+
+/*
+ * Get the size of @range.
+ */
+static inline uint64_t range_size(const Range *range)
+{
+    return range->upb - range->lob + 1;
+}
+
+/*
+ * Check if @range1 overlaps with @range2. If one of the ranges is empty,
+ * the result is always "false".
+ */
+static inline bool range_overlaps_range(const Range *range1,
+                                        const Range *range2)
+{
+    if (range_is_empty(range1) || range_is_empty(range2)) {
+        return false;
+    }
+    return !(range2->upb < range1->lob || range1->upb < range2->lob);
+}
+
+/*
+ * Check if @range1 contains @range2. If one of the ranges is empty,
+ * the result is always "false".
+ */
+static inline bool range_contains_range(const Range *range1,
+                                        const Range *range2)
+{
+    if (range_is_empty(range1) || range_is_empty(range2)) {
+        return false;
+    }
+    return range1->lob <= range2->lob && range1->upb >= range2->upb;
+}
+
 /*
  * Extend @range to the smallest interval that includes @extend_by, too.
  */
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#5 lore raw

[Qemu-devel] [PULL 05/10] memory-device: rewrite address assignment using ranges

In reply to Eduardo Habkost

From: David Hildenbrand <[email protected]>

Let's rewrite it properly using ranges. This fixes certain overflows that are right now possible. E.g.

qemu-system-x86_64 -m 4G,slots=20,maxmem=40G -M pc \
    -object memory-backend-file,id=mem1,share,mem-path=/dev/zero,size=2G
    -device pc-dimm,memdev=mem1,id=dimm1,addr=-0x40000000

Now properly errors out instead of succeeding. (Note that qapi parsing of huge uint64_t values is broken and fixes are on the way)

"can't add memory device [0xffffffffa0000000:0x80000000], usable range for memory devices [0x140000000:0xe00000000]"

Message-Id: <[email protected]>

---
 hw/mem/memory-device.c | 51 +++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 25 deletions(-)
hw/mem/memory-device.c +26 -25
index 8be63c8032..5f2c408036 100644
@@ -100,9 +100,8 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
                                             uint64_t align, uint64_t size,
                                             Error **errp)
 {
-    uint64_t address_space_start, address_space_end;
     GSList *list = NULL, *item;
-    uint64_t new_addr = 0;
+    Range as, new = range_empty;
 
     if (!ms->device_memory) {
         error_setg(errp, "memory devices (e.g. for memory hotplug) are not "
@@ -115,13 +114,11 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
                          "enabled, please specify the maxmem option");
         return 0;
     }
-    address_space_start = ms->device_memory->base;
-    address_space_end = address_space_start +
-                        memory_region_size(&ms->device_memory->mr);
-    g_assert(address_space_end >= address_space_start);
+    range_init_nofail(&as, ms->device_memory->base,
+                      memory_region_size(&ms->device_memory->mr));
 
-    /* address_space_start indicates the maximum alignment we expect */
-    if (!QEMU_IS_ALIGNED(address_space_start, align)) {
+    /* start of address space indicates the maximum alignment we expect */
+    if (!QEMU_IS_ALIGNED(range_lob(&as), align)) {
         error_setg(errp, "the alignment (0x%" PRIx64 ") is not supported",
                    align);
         return 0;
@@ -145,20 +142,18 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
     }
 
     if (hint) {
-        new_addr = *hint;
-        if (new_addr < address_space_start) {
+        if (range_init(&new, *hint, size) || !range_contains_range(&as, &new)) {
             error_setg(errp, "can't add memory device [0x%" PRIx64 ":0x%" PRIx64
-                       "] before 0x%" PRIx64, new_addr, size,
-                       address_space_start);
-            return 0;
-        } else if ((new_addr + size) > address_space_end) {
-            error_setg(errp, "can't add memory device [0x%" PRIx64 ":0x%" PRIx64
-                       "] beyond 0x%" PRIx64, new_addr, size,
-                       address_space_end);
+                       "], usable range for memory devices [0x%" PRIx64 ":0x%"
+                       PRIx64 "]", *hint, size, range_lob(&as),
+                       range_size(&as));
             return 0;
         }
     } else {
-        new_addr = address_space_start;
+        if (range_init(&new, range_lob(&as), size)) {
+            error_setg(errp, "can't add memory device, device too big");
+            return 0;
+        }
     }
 
     /* find address range that will fit new memory device */
@@ -166,30 +161,36 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
     for (item = list; item; item = g_slist_next(item)) {
         const MemoryDeviceState *md = item->data;
         const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(OBJECT(md));
-        uint64_t md_size, md_addr;
+        uint64_t next_addr;
+        Range tmp;
 
-        md_addr = mdc->get_addr(md);
-        md_size = memory_device_get_region_size(md, &error_abort);
+        range_init_nofail(&tmp, mdc->get_addr(md),
+                          memory_device_get_region_size(md, &error_abort));
 
-        if (ranges_overlap(md_addr, md_size, new_addr, size)) {
+        if (range_overlaps_range(&tmp, &new)) {
             if (hint) {
                 const DeviceState *d = DEVICE(md);
                 error_setg(errp, "address range conflicts with memory device"
                            " id='%s'", d->id ? d->id : "(unnamed)");
                 goto out;
             }
-            new_addr = QEMU_ALIGN_UP(md_addr + md_size, align);
+
+            next_addr = QEMU_ALIGN_UP(range_upb(&tmp) + 1, align);
+            if (!next_addr || range_init(&new, next_addr, range_size(&new))) {
+                range_make_empty(&new);
+                break;
+            }
         }
     }
 
-    if (new_addr + size > address_space_end) {
+    if (!range_contains_range(&as, &new)) {
         error_setg(errp, "could not find position in guest address space for "
                    "memory device - memory fragmented due to alignments");
         goto out;
     }
 out:
     g_slist_free(list);
-    return new_addr;
+    return range_lob(&new);
 }
 
 MemoryDeviceInfoList *qmp_memory_device_list(void)
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#6 lore raw

[Qemu-devel] [PULL 06/10] spapr: Eliminate SPAPR_PCI_2_7_MMIO_WIN_SIZE macro

In reply to Eduardo Habkost

The macro is only used in one place, where the purpose of the value is obvious. Eliminate the macro so we don't need to rely on stringify().

Message-Id: <[email protected]>

---
 include/hw/pci-host/spapr.h | 1 -
 hw/ppc/spapr.c              | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
include/hw/pci-host/spapr.h +0 -1
index 4eb3a2ce3e..a5a7bf4837 100644
@@ -101,7 +101,6 @@ struct sPAPRPHBState {
 #define SPAPR_MAX_PHBS ((SPAPR_PCI_LIMIT - SPAPR_PCI_BASE) / \
                         SPAPR_PCI_MEM64_WIN_SIZE - 1)
 
-#define SPAPR_PCI_2_7_MMIO_WIN_SIZE  0xf80000000
 #define SPAPR_PCI_IO_WIN_SIZE        0x10000
 
 #define SPAPR_PCI_MSI_WINDOW         0x40000000000ULL
hw/ppc/spapr.c +1 -1
index 83081defde..54a19d2db8 100644
@@ -4285,7 +4285,7 @@ static void spapr_machine_2_7_class_options(MachineClass *mc)
         {
             .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,
             .property = "mem_win_size",
-            .value    = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE),
+            .value    = "0xf80000000",
         },
         {
             .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#7 lore raw

[Qemu-devel] [PULL 07/10] machine: Eliminate unnecessary stringify() usage

In reply to Eduardo Habkost

stringify() is useful when we need to use macros in compat_props (like when we set virtio-baloon-pci.class=PCI_CLASS_MEMORY_RAM at pc_i440fx_1_0_machine_options()), but it is pointless when we are already providing a number literal.

Replace stringify() with string literals when appropriate.

Message-Id: <[email protected]>

---
 hw/core/machine.c |  8 ++--
 hw/i386/pc.c      | 94 +++++++++++++++++++++++------------------------
 hw/i386/pc_piix.c | 30 +++++++--------
 hw/ppc/spapr.c    |  2 +-
 4 files changed, 67 insertions(+), 67 deletions(-)
hw/core/machine.c +4 -4
index f8563efb86..4b4d6c23de 100644
@@ -135,11 +135,11 @@ GlobalProperty hw_compat_2_8[] = {
     {
         .driver   = "fw_cfg_mem",
         .property = "x-file-slots",
-        .value    = stringify(0x10),
+        .value    = "0x10",
     },{
         .driver   = "fw_cfg_io",
         .property = "x-file-slots",
-        .value    = stringify(0x10),
+        .value    = "0x10",
     },{
         .driver   = "pflash_cfi01",
         .property = "old-multiple-chip-handling",
@@ -337,11 +337,11 @@ GlobalProperty hw_compat_2_1[] = {
     },{
         .driver   = "usb-mouse",
         .property = "usb_version",
-        .value    = stringify(1),
+        .value    = "1",
     },{
         .driver   = "usb-kbd",
         .property = "usb_version",
-        .value    = stringify(1),
+        .value    = "1",
     },{
         .driver   = "virtio-pci",
         .property = "virtio-pci-bus-master-bug-migration",
hw/i386/pc.c +47 -47

271 lines not on this page · raw message

hw/i386/pc_piix.c +15 -15
index ed6984638e..fd20227af3 100644
@@ -697,7 +697,7 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m)
         {
             .driver   = "usb-tablet",
             .property = "usb_version",
-            .value    = stringify(1),
+            .value    = "1",
         },{
             .driver   = "virtio-net-pci",
             .property = "ctrl_mac_addr",
@@ -741,11 +741,11 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m)
         },{
             .driver   = "qxl",
             .property = "revision",
-            .value    = stringify(3),
+            .value    = "3",
         },{
             .driver   = "qxl-vga",
             .property = "revision",
-            .value    = stringify(3),
+            .value    = "3",
         },{
             .driver   = "VGA",
             .property = "mmio",
@@ -777,19 +777,19 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m)
         },{
             .driver   = "VGA",
             .property = "vgamem_mb",
-            .value    = stringify(8),
+            .value    = "8",
         },{
             .driver   = "vmware-svga",
             .property = "vgamem_mb",
-            .value    = stringify(8),
+            .value    = "8",
         },{
             .driver   = "qxl-vga",
             .property = "vgamem_mb",
-            .value    = stringify(8),
+            .value    = "8",
         },{
             .driver   = "qxl",
             .property = "vgamem_mb",
-            .value    = stringify(8),
+            .value    = "8",
         },{
             .driver   = "virtio-blk-pci",
             .property = "config-wce",
@@ -876,11 +876,11 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m)
         },{
             .driver   = "qxl",
             .property = "revision",
-            .value    = stringify(2),
+            .value    = "2",
         },{
             .driver   = "qxl-vga",
             .property = "revision",
-            .value    = stringify(2),
+            .value    = "2",
         },
     };
 
@@ -904,19 +904,19 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m)
         },{
             .driver   = "AC97",
             .property = "use_broken_id",
-            .value    = stringify(1),
+            .value    = "1",
         },{
             .driver   = "virtio-9p-pci",
             .property = "vectors",
-            .value    = stringify(0),
+            .value    = "0",
         },{
             .driver   = "VGA",
             .property = "rombar",
-            .value    = stringify(0),
+            .value    = "0",
         },{
             .driver   = "vmware-svga",
             .property = "rombar",
-            .value    = stringify(0),
+            .value    = "0",
         },
     };
 
@@ -936,11 +936,11 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m)
         {
             .driver   = "virtio-serial-pci",
             .property = "max_ports",
-            .value    = stringify(1),
+            .value    = "1",
         },{
             .driver   = "virtio-serial-pci",
             .property = "vectors",
-            .value    = stringify(0),
+            .value    = "0",
         },{
             .driver   = "usb-mouse",
             .property = "serial",
hw/ppc/spapr.c +1 -1
index 54a19d2db8..b6e42c7775 100644
@@ -4324,7 +4324,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)
         {
             .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,
             .property = "ddw",
-            .value    = stringify(off),
+            .value    = "off",
         },
     };
 
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#8 lore raw

[Qemu-devel] [PULL 10/10] qom: Don't keep error value between object_property_parse() calls

In reply to Eduardo Habkost

When handling errp==NULL at object_apply_global_props(), we are leaving the old error value in err after printing a warning. This makes QEMU crash if two global properties generate warnings:

  $ echo device_add rtl8139 | qemu-system-x86_64 -monitor stdio -global rtl8139.xxx=yyy -global rtl8139.xxx=zzz
  warning: can't apply global rtl8139.xxx=yyy: Property '.xxx' not found
  qemu-system-x86_64: util/error.c:57: error_setv: Assertion `*errp == NULL' failed.
  Aborted (core dumped)

Fix that by making err go out of scope immediately after the warn_report_err() call.

Fixes 50545b2cc029 "qdev-props: call object_apply_global_props()"

Message-Id: <[email protected]>

---
 qom/object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qom/object.c +1 -1
index aa6f3a2a71..4e5226ca12 100644
@@ -372,7 +372,6 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti)
 
 void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp)
 {
-    Error *err = NULL;
     int i;
 
     if (!props) {
@@ -381,6 +380,7 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp
 
     for (i = 0; i < props->len; i++) {
         GlobalProperty *p = g_ptr_array_index(props, i);
+        Error *err = NULL;
 
         if (object_dynamic_cast(obj, p->driver) == NULL) {
             continue;
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#9 lore raw

[Qemu-devel] [PULL 09/10] qdev: fix -device scsi-hd, help regression

In reply to Eduardo Habkost

From: Marc-André Lureau <[email protected]>

Since commit ea9ce8934, device_post_init() applies globals directly from machines and accelerator classes.

There are cases, such as -device scsi-hd,help, where the machine is setup but there in no accelerator.

Let's skip accelerator globals in this case.

Fixes SEGV:

 #0  0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857
 #1  0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978
 #2  0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973
 #3  0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989
 #4  0x0000555558e9e250 in object_post_init_with_type (ti=<optimized out>, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365
 #5  0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=<optimized out>) at /home/elmarco/src/qemu/build/../qom/object.c:425
 #6  0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588
 #7  0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519
 #8  0x00005555582c4027 in qdev_device_help (opts=<optimized out>) at /home/elmarco/src/qemu/qdev-monitor.c:283
 #9  0x0000555559378fa2 in qemu_opts_foreach (list=<optimized out>, func=func@entry=0x5555582cfca0 <device_help_func>, opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171

https://bugzilla.redhat.com/show_bug.cgi?id=1664364

Message-Id: <[email protected]>

---
 hw/core/qdev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
hw/core/qdev.c +6 -3
index 3769a2bccb..47bddacb4f 100644
@@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj)
     if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
         MachineState *m = MACHINE(qdev_get_machine());
         MachineClass *mc = MACHINE_GET_CLASS(m);
-        AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
 
-        if (ac->compat_props) {
-            object_apply_global_props(obj, ac->compat_props, &error_abort);
+        if (m->accelerator) {
+            AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
+
+            if (ac->compat_props) {
+                object_apply_global_props(obj, ac->compat_props, &error_abort);
+            }
         }
         object_apply_global_props(obj, mc->compat_props, &error_abort);
     }
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#10 lore raw

[Qemu-devel] [PULL 08/10] machine: Use shorter format for GlobalProperty arrays

In reply to Eduardo Habkost

Instead of verbose arrays with 4 lines for each entry, make each entry take only one line. This makes long arrays that couldn't fit in the screen become short and readable.

Message-Id: <[email protected]>

---
 include/hw/i386/pc.h       |  18 +-
 hw/core/machine.c          | 338 ++++-------------
 hw/i386/pc.c               | 720 +++++++------------------------------
 hw/i386/pc_piix.c          | 192 ++--------
 hw/ppc/spapr.c             |  72 +---
 hw/s390x/s390-virtio-ccw.c |  75 +---
 hw/xen/xen-common.c        |  18 +-
 7 files changed, 265 insertions(+), 1168 deletions(-)
include/hw/i386/pc.h +3 -15
index 84720bede9..0abbe45637 100644
@@ -354,21 +354,9 @@ extern const size_t pc_compat_1_4_len;
  * depending on QEMU versions up to QEMU 2.4.
  */
 #define PC_CPU_MODEL_IDS(v) \
-    {\
-        .driver   = "qemu32-" TYPE_X86_CPU,\
-        .property = "model-id",\
-        .value    = "QEMU Virtual CPU version " v,\
-    },\
-    {\
-        .driver   = "qemu64-" TYPE_X86_CPU,\
-        .property = "model-id",\
-        .value    = "QEMU Virtual CPU version " v,\
-    },\
-    {\
-        .driver   = "athlon-" TYPE_X86_CPU,\
-        .property = "model-id",\
-        .value    = "QEMU Virtual CPU version " v,\
-    },
+    { "qemu32-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
+    { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
+    { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
 
 #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
     static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
hw/core/machine.c +65 -273

392 lines not on this page · raw message

hw/i386/pc.c +131 -589

804 lines not on this page · raw message

hw/i386/pc_piix.c +37 -155

234 lines not on this page · raw message

hw/ppc/spapr.c +12 -60

120 lines not on this page · raw message

hw/s390x/s390-virtio-ccw.c +14 -61

105 lines not on this page · raw message

hw/xen/xen-common.c +3 -15
index d51148b6b3..18a9045556 100644
@@ -163,21 +163,9 @@ static void xen_accel_class_init(ObjectClass *oc, void *data)
 {
     AccelClass *ac = ACCEL_CLASS(oc);
     static GlobalProperty compat[] = {
-        {
-            .driver = "migration",
-            .property = "store-global-state",
-            .value = "off",
-        },
-        {
-            .driver = "migration",
-            .property = "send-configuration",
-            .value = "off",
-        },
-        {
-            .driver = "migration",
-            .property = "send-section-footer",
-            .value = "off",
-        }
+        { "migration", "store-global-state", "off" },
+        { "migration", "send-configuration", "off" },
+        { "migration", "send-section-footer", "off" },
     };
 
     ac->name = "Xen";
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#11 lore raw
In reply to Eduardo Habkost
Quoted 16 lines · Eduardo Habkost

The following changes since commit 8ae951fbc1068308313b2c57a4fc3c68451641f4:

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190109' into staging (2019-01-09 16:08:31 +0000)

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 d769f0dfeeaa1554a38fedb16bb20a4b0ecf793c:

qom: Don't keep error value between object_property_parse() calls (2019-01-10 12:25:15 -0200)

----------------------------------------------------------------
Machine queue, 2019-01-10

Quoted 8 lines

* Simplify GlobalProperty array declarations (Eduardo Habkost)
* Deprecate cpu-add commands (Kashyap Chamarthy)
* range/memory-device cleanups (David Hildenbrand)
* Fix -device scsi-hd,help regression (Marc-André Lureau)
* Fix crash when -global generates multiple warnings (Eduardo Habkost)

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

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM

#12 lore raw
In reply to Eduardo Habkost
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Message-id: [email protected]
Type: series
Subject: [Qemu-devel] [PULL 00/10] Machine queue, 2019-01-10

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram ./scripts/checkpatch.pl --mailback --color=always base.. === TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
62544fe qom: Don't keep error value between object_property_parse() calls a320168 qdev: fix -device scsi-hd, help regression
917e46b machine: Use shorter format for GlobalProperty arrays 4326497 machine: Eliminate unnecessary stringify() usage f4d8c3d spapr: Eliminate SPAPR_PCI_2_7_MMIO_WIN_SIZE macro 6ca72c7 memory-device: rewrite address assignment using ranges e6667d7 range: add some more functions
58bda71 Mention that QMP 'cpu-add' will be deprecated
cfce683 Update that HMP 'cpu-add' is deprecated in 4.0 fd46ac3 qemu-deprecated.texi: Rename the HMP section

=== OUTPUT BEGIN ===
Unknown option: color
Usage:

checkpatch.pl [OPTION]... [FILE]...
checkpatch.pl [OPTION]... [GIT-REV-LIST]

Version: 0.31

Options:

  -q, --quiet                quiet
  --no-tree                  run without a kernel tree
  --no-signoff               do not check for 'Signed-off-by' line
  --patch                    treat FILE as patchfile
  --branch                   treat args as GIT revision list
  --emacs                    emacs compile window format
  --terse                    one line per report
  -f, --file                 treat FILE as regular source file
  --strict                   fail if only warnings are found
  --root=PATH                PATH to the kernel tree root
  --no-summary               suppress the per-file summary
  --mailback                 only produce a report in case of warnings/errors
  --summary-file             include the filename in summary
  --debug KEY=[0|1]          turn on/off debugging of KEY, where KEY is one of

'values', 'possible', 'type', and 'attr' (default is all off)
--test-only=WORD report only warnings/errors containing WORD
literally
-h, --help, --version display this help and exit

When FILE is - read standard input.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]