qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20
@ 2016-05-20 20:28 Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 01/21] pc-dimm: correct comment of MemoryHotplugState Eduardo Habkost
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

The following changes since commit 65603e2fc18b48e6e55a3dd693669413141694ec:

  tci: do not include exec/exec-all.h (2016-05-20 15:07:46 +0100)

are available in the git repository at:

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

for you to fetch changes up to e8f2d2722eb84a809697e82c762d39c8c13f22f6:

  Use &error_fatal when initializing crypto on qemu-{img,io,nbd} (2016-05-20 14:28:55 -0300)

----------------------------------------------------------------
Machine Core queue, 2016-05-20

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

Cao jin (1):
  pc-dimm: correct comment of MemoryHotplugState

Eduardo Habkost (19):
  vl: Use exit(1) when requested VGA interface is unavailable
  vl: Table-based select_vgahw()
  vl: Replace *_vga_available() functions with class_names field
  vl: Add DT_COCOA DisplayType value
  vnc: Initialization stubs
  curses: curses_display_init() stub
  sdl: Initialization stubs
  cocoa: cocoa_display_init() stub
  gtk: Initialization stubs
  spice: Initialization stubs on qemu-spice.h
  milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create()
  vl: Replace DT_NOGRAPHIC with machine option
  vl: Make display_type a local variable
  vl: Move DisplayType typedef to vl.c
  vl: Make display_remote a local variable
  vl: Simplify global property registration
  vl: Use &error_fatal when parsing VNC options
  vl: Use &error_fatal when parsing monitor options
  Use &error_fatal when initializing crypto on qemu-{img,io,nbd}

Igor Mammedov (1):
  machine: add properties to compat_props incrementaly

 hw/arm/virt.c              |   4 -
 hw/core/machine.c          |  31 +++++
 hw/i386/pc_piix.c          |  13 --
 hw/lm32/milkymist-hw.h     |   4 -
 hw/lm32/milkymist.c        |   4 +-
 hw/nvram/fw_cfg.c          |   6 +-
 hw/ppc/spapr.c             |   4 -
 hw/s390x/s390-virtio-ccw.c |   1 -
 hw/sparc/sun4m.c           |   2 +-
 include/hw/boards.h        |  12 +-
 include/hw/i386/pc.h       |   9 --
 include/hw/mem/pc-dimm.h   |   4 +-
 include/sysemu/sysemu.h    |  12 +-
 include/ui/console.h       |  71 ++++++++++-
 include/ui/qemu-spice.h    |  13 ++
 qemu-img.c                 |   5 +-
 qemu-io.c                  |   5 +-
 qemu-nbd.c                 |   5 +-
 vl.c                       | 290 +++++++++++++++++++--------------------------
 19 files changed, 257 insertions(+), 238 deletions(-)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 01/21] pc-dimm: correct comment of MemoryHotplugState
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 02/21] vl: Use exit(1) when requested VGA interface is unavailable Eduardo Habkost
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel,
	Cao jin

From: Cao jin <caoj.fnst@cn.fujitsu.com>

correct comment and remove an unused macro. commit adcb4ee6
already correct its type

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/mem/pc-dimm.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
index 218dfb0..8cdc326 100644
--- a/include/hw/mem/pc-dimm.h
+++ b/include/hw/mem/pc-dimm.h
@@ -20,8 +20,6 @@
 #include "sysemu/hostmem.h"
 #include "hw/qdev.h"
 
-#define DEFAULT_PC_DIMMSIZE (1024*1024*1024)
-
 #define TYPE_PC_DIMM "pc-dimm"
 #define PC_DIMM(obj) \
     OBJECT_CHECK(PCDIMMDevice, (obj), TYPE_PC_DIMM)
@@ -72,7 +70,7 @@ typedef struct PCDIMMDeviceClass {
 
 /**
  * MemoryHotplugState:
- * @base: address in guest RAM address space where hotplug memory
+ * @base: address in guest physical address space where hotplug memory
  * address space begins.
  * @mr: hotplug memory address space container
  */
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 02/21] vl: Use exit(1) when requested VGA interface is unavailable
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 01/21] pc-dimm: correct comment of MemoryHotplugState Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 03/21] vl: Table-based select_vgahw() Eduardo Habkost
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Instead of using exit(0), use exit(1) when an unavailable VGA
interface is used in the command-line to indicate it's an error.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/vl.c b/vl.c
index a43a3ba..edfb5b9 100644
--- a/vl.c
+++ b/vl.c
@@ -2027,28 +2027,28 @@ static void select_vgahw (const char *p)
             vga_interface_type = VGA_STD;
         } else {
             error_report("standard VGA not available");
-            exit(0);
+            exit(1);
         }
     } else if (strstart(p, "cirrus", &opts)) {
         if (cirrus_vga_available()) {
             vga_interface_type = VGA_CIRRUS;
         } else {
             error_report("Cirrus VGA not available");
-            exit(0);
+            exit(1);
         }
     } else if (strstart(p, "vmware", &opts)) {
         if (vmware_vga_available()) {
             vga_interface_type = VGA_VMWARE;
         } else {
             error_report("VMWare SVGA not available");
-            exit(0);
+            exit(1);
         }
     } else if (strstart(p, "virtio", &opts)) {
         if (virtio_vga_available()) {
             vga_interface_type = VGA_VIRTIO;
         } else {
             error_report("Virtio VGA not available");
-            exit(0);
+            exit(1);
         }
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
@@ -2057,21 +2057,21 @@ static void select_vgahw (const char *p)
             vga_interface_type = VGA_QXL;
         } else {
             error_report("QXL VGA not available");
-            exit(0);
+            exit(1);
         }
     } else if (strstart(p, "tcx", &opts)) {
         if (tcx_vga_available()) {
             vga_interface_type = VGA_TCX;
         } else {
             error_report("TCX framebuffer not available");
-            exit(0);
+            exit(1);
         }
     } else if (strstart(p, "cg3", &opts)) {
         if (cg3_vga_available()) {
             vga_interface_type = VGA_CG3;
         } else {
             error_report("CG3 framebuffer not available");
-            exit(0);
+            exit(1);
         }
     } else if (!strstart(p, "none", &opts)) {
     invalid_vga:
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 03/21] vl: Table-based select_vgahw()
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 01/21] pc-dimm: correct comment of MemoryHotplugState Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 02/21] vl: Use exit(1) when requested VGA interface is unavailable Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 04/21] vl: Replace *_vga_available() functions with class_names field Eduardo Habkost
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Instead of implementing separate check functions for each vga
interface type, add a table enumerating the possible VGA
interfaces.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/sysemu.h |   1 +
 vl.c                    | 115 ++++++++++++++++++++++++++----------------------
 2 files changed, 64 insertions(+), 52 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 38fb3ca..2033f8c 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -146,6 +146,7 @@ extern int autostart;
 typedef enum {
     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
     VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
+    VGA_TYPE_MAX,
 } VGAInterfaceType;
 
 extern int vga_interface_type;
diff --git a/vl.c b/vl.c
index edfb5b9..ac5db24 100644
--- a/vl.c
+++ b/vl.c
@@ -2017,63 +2017,74 @@ static bool virtio_vga_available(void)
     return object_class_by_name("virtio-vga");
 }
 
-static void select_vgahw (const char *p)
+typedef struct VGAInterfaceInfo {
+    const char *opt_name;    /* option name */
+    const char *name;        /* human-readable name */
+    bool (*available)(void);
+} VGAInterfaceInfo;
+
+static VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX] = {
+    [VGA_NONE] = {
+        .opt_name = "none",
+    },
+    [VGA_STD] = {
+        .opt_name = "std",
+        .name = "standard VGA",
+        .available = vga_available,
+    },
+    [VGA_CIRRUS] = {
+        .opt_name = "cirrus",
+        .name = "Cirrus VGA",
+        .available = cirrus_vga_available,
+    },
+    [VGA_VMWARE] = {
+        .opt_name = "vmware",
+        .name = "VMWare SVGA",
+        .available = vmware_vga_available,
+    },
+    [VGA_VIRTIO] = {
+        .opt_name = "virtio",
+        .name = "Virtio VGA",
+        .available = virtio_vga_available,
+    },
+    [VGA_QXL] = {
+        .opt_name = "qxl",
+        .name = "QXL VGA",
+        .available = qxl_vga_available,
+    },
+    [VGA_TCX] = {
+        .opt_name = "tcx",
+        .name = "TCX framebuffer",
+        .available = tcx_vga_available,
+    },
+    [VGA_CG3] = {
+        .opt_name = "cg3",
+        .name = "CG3 framebuffer",
+        .available = cg3_vga_available,
+    },
+    [VGA_XENFB] = {
+        .opt_name = "xenfb",
+    },
+};
+
+static void select_vgahw(const char *p)
 {
     const char *opts;
+    int t;
 
     assert(vga_interface_type == VGA_NONE);
-    if (strstart(p, "std", &opts)) {
-        if (vga_available()) {
-            vga_interface_type = VGA_STD;
-        } else {
-            error_report("standard VGA not available");
-            exit(1);
-        }
-    } else if (strstart(p, "cirrus", &opts)) {
-        if (cirrus_vga_available()) {
-            vga_interface_type = VGA_CIRRUS;
-        } else {
-            error_report("Cirrus VGA not available");
-            exit(1);
-        }
-    } else if (strstart(p, "vmware", &opts)) {
-        if (vmware_vga_available()) {
-            vga_interface_type = VGA_VMWARE;
-        } else {
-            error_report("VMWare SVGA not available");
-            exit(1);
-        }
-    } else if (strstart(p, "virtio", &opts)) {
-        if (virtio_vga_available()) {
-            vga_interface_type = VGA_VIRTIO;
-        } else {
-            error_report("Virtio VGA not available");
-            exit(1);
-        }
-    } else if (strstart(p, "xenfb", &opts)) {
-        vga_interface_type = VGA_XENFB;
-    } else if (strstart(p, "qxl", &opts)) {
-        if (qxl_vga_available()) {
-            vga_interface_type = VGA_QXL;
-        } else {
-            error_report("QXL VGA not available");
-            exit(1);
-        }
-    } else if (strstart(p, "tcx", &opts)) {
-        if (tcx_vga_available()) {
-            vga_interface_type = VGA_TCX;
-        } else {
-            error_report("TCX framebuffer not available");
-            exit(1);
-        }
-    } else if (strstart(p, "cg3", &opts)) {
-        if (cg3_vga_available()) {
-            vga_interface_type = VGA_CG3;
-        } else {
-            error_report("CG3 framebuffer not available");
-            exit(1);
+    for (t = 0; t < VGA_TYPE_MAX; t++) {
+        VGAInterfaceInfo *ti = &vga_interfaces[t];
+        if (ti->opt_name && strstart(p, ti->opt_name, &opts)) {
+            if (ti->available && !ti->available()) {
+                error_report("%s not available", ti->name);
+                exit(1);
+            }
+            vga_interface_type = t;
+            break;
         }
-    } else if (!strstart(p, "none", &opts)) {
+    }
+    if (t == VGA_TYPE_MAX) {
     invalid_vga:
         error_report("unknown vga type: %s", p);
         exit(1);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 04/21] vl: Replace *_vga_available() functions with class_names field
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (2 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 03/21] vl: Table-based select_vgahw() Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 05/21] vl: Add DT_COCOA DisplayType value Eduardo Habkost
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Instead of requiring a separate function for each VGA interface,
just enumerate the corresponding class names on struct
VGAInterfaceInfo.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 70 +++++++++++++++++++++++---------------------------------------------
 1 file changed, 23 insertions(+), 47 deletions(-)

diff --git a/vl.c b/vl.c
index ac5db24..d309ff7 100644
--- a/vl.c
+++ b/vl.c
@@ -1981,46 +1981,12 @@ static const QEMUOption qemu_options[] = {
     { NULL },
 };
 
-static bool vga_available(void)
-{
-    return object_class_by_name("VGA") || object_class_by_name("isa-vga");
-}
-
-static bool cirrus_vga_available(void)
-{
-    return object_class_by_name("cirrus-vga")
-           || object_class_by_name("isa-cirrus-vga");
-}
-
-static bool vmware_vga_available(void)
-{
-    return object_class_by_name("vmware-svga");
-}
-
-static bool qxl_vga_available(void)
-{
-    return object_class_by_name("qxl-vga");
-}
-
-static bool tcx_vga_available(void)
-{
-    return object_class_by_name("SUNW,tcx");
-}
-
-static bool cg3_vga_available(void)
-{
-    return object_class_by_name("cgthree");
-}
-
-static bool virtio_vga_available(void)
-{
-    return object_class_by_name("virtio-vga");
-}
-
 typedef struct VGAInterfaceInfo {
     const char *opt_name;    /* option name */
     const char *name;        /* human-readable name */
-    bool (*available)(void);
+    /* Class names indicating that support is available.
+     * If no class is specified, the interface is always available */
+    const char *class_names[2];
 } VGAInterfaceInfo;
 
 static VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX] = {
@@ -2030,43 +1996,53 @@ static VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX] = {
     [VGA_STD] = {
         .opt_name = "std",
         .name = "standard VGA",
-        .available = vga_available,
+        .class_names = { "VGA", "isa-vga" },
     },
     [VGA_CIRRUS] = {
         .opt_name = "cirrus",
         .name = "Cirrus VGA",
-        .available = cirrus_vga_available,
+        .class_names = { "cirrus-vga", "isa-cirrus-vga" },
     },
     [VGA_VMWARE] = {
         .opt_name = "vmware",
         .name = "VMWare SVGA",
-        .available = vmware_vga_available,
+        .class_names = { "vmware-svga" },
     },
     [VGA_VIRTIO] = {
         .opt_name = "virtio",
         .name = "Virtio VGA",
-        .available = virtio_vga_available,
+        .class_names = { "virtio-vga" },
     },
     [VGA_QXL] = {
         .opt_name = "qxl",
         .name = "QXL VGA",
-        .available = qxl_vga_available,
+        .class_names = { "qxl-vga" },
     },
     [VGA_TCX] = {
         .opt_name = "tcx",
         .name = "TCX framebuffer",
-        .available = tcx_vga_available,
+        .class_names = { "SUNW,tcx" },
     },
     [VGA_CG3] = {
         .opt_name = "cg3",
         .name = "CG3 framebuffer",
-        .available = cg3_vga_available,
+        .class_names = { "cgthree" },
     },
     [VGA_XENFB] = {
         .opt_name = "xenfb",
     },
 };
 
+static bool vga_interface_available(VGAInterfaceType t)
+{
+    VGAInterfaceInfo *ti = &vga_interfaces[t];
+
+    assert(t < VGA_TYPE_MAX);
+    return !ti->class_names[0] ||
+           object_class_by_name(ti->class_names[0]) ||
+           object_class_by_name(ti->class_names[1]);
+}
+
 static void select_vgahw(const char *p)
 {
     const char *opts;
@@ -2076,7 +2052,7 @@ static void select_vgahw(const char *p)
     for (t = 0; t < VGA_TYPE_MAX; t++) {
         VGAInterfaceInfo *ti = &vga_interfaces[t];
         if (ti->opt_name && strstart(p, ti->opt_name, &opts)) {
-            if (ti->available && !ti->available()) {
+            if (!vga_interface_available(t)) {
                 error_report("%s not available", ti->name);
                 exit(1);
             }
@@ -4492,9 +4468,9 @@ int main(int argc, char **argv, char **envp)
     if (default_vga) {
         if (machine_class->default_display) {
             vga_model = machine_class->default_display;
-        } else if (cirrus_vga_available()) {
+        } else if (vga_interface_available(VGA_CIRRUS)) {
             vga_model = "cirrus";
-        } else if (vga_available()) {
+        } else if (vga_interface_available(VGA_STD)) {
             vga_model = "std";
         }
     }
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 05/21] vl: Add DT_COCOA DisplayType value
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (3 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 04/21] vl: Replace *_vga_available() functions with class_names field Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 06/21] vnc: Initialization stubs Eduardo Habkost
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel,
	Andreas Färber

Instead of reusing DT_SDL for Cocoa, use DT_COCOA to indicate
that a Cocoa display was requested.

configure already ensures CONFIG_COCOA and CONFIG_SDL are never
set at the same time. The only case where DT_SDL is used outside
a #ifdef CONFIG_SDL block is in the no_frame/alt_grab/ctrl_grab
check. That means the only user-visible change is that we will
start printing a warning if the SDL-specific options are used in
Cocoa mode. This is a bugfix, because no_frame/alt_grab/ctrl_grab
are not used by Cocoa code.

Cc: Andreas Färber <andreas.faerber@web.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/sysemu.h | 1 +
 vl.c                    | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 2033f8c..90766da 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -136,6 +136,7 @@ typedef enum DisplayType
     DT_DEFAULT,
     DT_CURSES,
     DT_SDL,
+    DT_COCOA,
     DT_GTK,
     DT_NOGRAPHIC,
     DT_NONE,
diff --git a/vl.c b/vl.c
index d309ff7..a064a46 100644
--- a/vl.c
+++ b/vl.c
@@ -4237,8 +4237,10 @@ int main(int argc, char **argv, char **envp)
     if (display_type == DT_DEFAULT && !display_remote) {
 #if defined(CONFIG_GTK)
         display_type = DT_GTK;
-#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
+#elif defined(CONFIG_SDL)
         display_type = DT_SDL;
+#elif defined(CONFIG_COCOA)
+        display_type = DT_COCOA;
 #elif defined(CONFIG_VNC)
         vnc_parse("localhost:0,to=99,id=default", &error_abort);
         show_vnc_port = 1;
@@ -4560,7 +4562,7 @@ int main(int argc, char **argv, char **envp)
         sdl_display_init(ds, full_screen, no_frame);
         break;
 #elif defined(CONFIG_COCOA)
-    case DT_SDL:
+    case DT_COCOA:
         cocoa_display_init(ds, full_screen);
         break;
 #endif
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 06/21] vnc: Initialization stubs
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (4 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 05/21] vl: Add DT_COCOA DisplayType value Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 07/21] curses: curses_display_init() stub Eduardo Habkost
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

This reduces the number of CONFIG_VNC #ifdefs in the vl.c code.

The only user-visible difference is that this will make QEMU
complain about syntax when using "-display vnc" ("VNC requires a
display argument vnc=<display>") even if CONFIG_VNC is disabled.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/ui/console.h | 20 +++++++++++++++++++-
 vl.c                 | 15 +--------------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index d5a88d9..6640348 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -6,6 +6,8 @@
 #include "qapi/qmp/qdict.h"
 #include "qemu/notify.h"
 #include "qapi-types.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
 
 #ifdef CONFIG_OPENGL
 # include <epoxy/gl.h>
@@ -430,10 +432,10 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
 void vnc_display_init(const char *id);
 void vnc_display_open(const char *id, Error **errp);
 void vnc_display_add_client(const char *id, int csock, bool skipauth);
-char *vnc_display_local_addr(const char *id);
 #ifdef CONFIG_VNC
 int vnc_display_password(const char *id, const char *password);
 int vnc_display_pw_expire(const char *id, time_t expires);
+char *vnc_display_local_addr(const char *id);
 QemuOpts *vnc_parse(const char *str, Error **errp);
 int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
 #else
@@ -445,6 +447,22 @@ static inline int vnc_display_pw_expire(const char *id, time_t expires)
 {
     return -ENODEV;
 };
+static inline QemuOpts *vnc_parse(const char *str, Error **errp)
+{
+    error_setg(errp, "VNC support is disabled");
+    return NULL;
+}
+static inline int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+    error_setg(errp, "VNC support is disabled");
+    return -1;
+}
+static inline char *vnc_display_local_addr(const char *id)
+{
+    /* This must never be called if CONFIG_VNC is disabled */
+    error_report("VNC support is disabled");
+    abort();
+}
 #endif
 
 /* curses.c */
diff --git a/vl.c b/vl.c
index a064a46..a66d04a 100644
--- a/vl.c
+++ b/vl.c
@@ -2148,7 +2148,6 @@ static DisplayType select_display(const char *p)
         exit(1);
 #endif
     } else if (strstart(p, "vnc", &opts)) {
-#ifdef CONFIG_VNC
         if (*opts == '=') {
             Error *err = NULL;
             if (vnc_parse(opts + 1, &err) == NULL) {
@@ -2159,10 +2158,6 @@ static DisplayType select_display(const char *p)
             error_report("VNC requires a display argument vnc=<display>");
             exit(1);
         }
-#else
-        error_report("VNC support is disabled");
-        exit(1);
-#endif
     } else if (strstart(p, "curses", &opts)) {
 #ifdef CONFIG_CURSES
         display = DT_CURSES;
@@ -2966,9 +2961,7 @@ int main(int argc, char **argv, char **envp)
     const char *qtest_log = NULL;
     const char *pid_file = NULL;
     const char *incoming = NULL;
-#ifdef CONFIG_VNC
     int show_vnc_port = 0;
-#endif
     bool defconfig = true;
     bool userconfig = true;
     const char *log_mask = NULL;
@@ -3715,17 +3708,12 @@ int main(int argc, char **argv, char **envp)
                 break;
             case QEMU_OPTION_vnc:
             {
-#ifdef CONFIG_VNC
                 Error *local_err = NULL;
 
                 if (vnc_parse(optarg, &local_err) == NULL) {
                     error_report_err(local_err);
                     exit(1);
                 }
-#else
-                error_report("VNC support is disabled");
-                exit(1);
-#endif
                 break;
             }
             case QEMU_OPTION_no_acpi:
@@ -4578,7 +4566,6 @@ int main(int argc, char **argv, char **envp)
     /* must be after terminal init, SDL library changes signal handlers */
     os_setup_signal_handling();
 
-#ifdef CONFIG_VNC
     /* init remote displays */
     qemu_opts_foreach(qemu_find_opts("vnc"),
                       vnc_init_func, NULL, NULL);
@@ -4587,7 +4574,7 @@ int main(int argc, char **argv, char **envp)
         printf("VNC server running on '%s'\n", ret);
         g_free(ret);
     }
-#endif
+
 #ifdef CONFIG_SPICE
     if (using_spice) {
         qemu_spice_display_init();
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 07/21] curses: curses_display_init() stub
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (5 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 06/21] vnc: Initialization stubs Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 08/21] sdl: Initialization stubs Eduardo Habkost
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

One less #ifdef in vl.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/ui/console.h | 9 +++++++++
 vl.c                 | 2 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 6640348..f5fa9cb 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -466,7 +466,16 @@ static inline char *vnc_display_local_addr(const char *id)
 #endif
 
 /* curses.c */
+#ifdef CONFIG_CURSES
 void curses_display_init(DisplayState *ds, int full_screen);
+#else
+static inline void curses_display_init(DisplayState *ds, int full_screen)
+{
+    /* This must never be called if CONFIG_CURSES is disabled */
+    error_report("curses support is disabled");
+    abort();
+}
+#endif
 
 /* input.c */
 int index_from_key(const char *key, size_t key_length);
diff --git a/vl.c b/vl.c
index a66d04a..c852d10 100644
--- a/vl.c
+++ b/vl.c
@@ -4540,11 +4540,9 @@ int main(int argc, char **argv, char **envp)
     case DT_NOGRAPHIC:
         (void)ds;	/* avoid warning if no display is configured */
         break;
-#if defined(CONFIG_CURSES)
     case DT_CURSES:
         curses_display_init(ds, full_screen);
         break;
-#endif
 #if defined(CONFIG_SDL)
     case DT_SDL:
         sdl_display_init(ds, full_screen, no_frame);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 08/21] sdl: Initialization stubs
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (6 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 07/21] curses: curses_display_init() stub Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 09/21] cocoa: cocoa_display_init() stub Eduardo Habkost
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

This reduces the number of CONFIG_SDL #ifdefs in vl.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/ui/console.h | 16 ++++++++++++++++
 vl.c                 |  6 ++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index f5fa9cb..f3e749d 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -422,8 +422,24 @@ void surface_gl_setup_viewport(ConsoleGLState *gls,
 #endif
 
 /* sdl.c */
+#ifdef CONFIG_SDL
 void sdl_display_early_init(int opengl);
 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
+#else
+static inline void sdl_display_early_init(int opengl)
+{
+    /* This must never be called if CONFIG_SDL is disabled */
+    error_report("SDL support is disabled");
+    abort();
+}
+static inline void sdl_display_init(DisplayState *ds, int full_screen,
+                                    int no_frame)
+{
+    /* This must never be called if CONFIG_SDL is disabled */
+    error_report("SDL support is disabled");
+    abort();
+}
+#endif
 
 /* cocoa.m */
 void cocoa_display_init(DisplayState *ds, int full_screen);
diff --git a/vl.c b/vl.c
index c852d10..d5df442 100644
--- a/vl.c
+++ b/vl.c
@@ -4251,11 +4251,10 @@ int main(int argc, char **argv, char **envp)
         early_gtk_display_init(request_opengl);
     }
 #endif
-#if defined(CONFIG_SDL)
     if (display_type == DT_SDL) {
         sdl_display_early_init(request_opengl);
     }
-#endif
+
     if (request_opengl == 1 && display_opengl == 0) {
 #if defined(CONFIG_OPENGL)
         error_report("OpenGL is not supported by the display");
@@ -4543,11 +4542,10 @@ int main(int argc, char **argv, char **envp)
     case DT_CURSES:
         curses_display_init(ds, full_screen);
         break;
-#if defined(CONFIG_SDL)
     case DT_SDL:
         sdl_display_init(ds, full_screen, no_frame);
         break;
-#elif defined(CONFIG_COCOA)
+#if defined(CONFIG_COCOA)
     case DT_COCOA:
         cocoa_display_init(ds, full_screen);
         break;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 09/21] cocoa: cocoa_display_init() stub
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (7 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 08/21] sdl: Initialization stubs Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 10/21] gtk: Initialization stubs Eduardo Habkost
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

One less #ifdef in vl.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/ui/console.h | 9 +++++++++
 vl.c                 | 2 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index f3e749d..7ac997f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -442,7 +442,16 @@ static inline void sdl_display_init(DisplayState *ds, int full_screen,
 #endif
 
 /* cocoa.m */
+#ifdef CONFIG_COCOA
 void cocoa_display_init(DisplayState *ds, int full_screen);
+#else
+static inline void cocoa_display_init(DisplayState *ds, int full_screen)
+{
+    /* This must never be called if CONFIG_COCOA is disabled */
+    error_report("Cocoa support is disabled");
+    abort();
+}
+#endif
 
 /* vnc.c */
 void vnc_display_init(const char *id);
diff --git a/vl.c b/vl.c
index d5df442..0648705 100644
--- a/vl.c
+++ b/vl.c
@@ -4545,11 +4545,9 @@ int main(int argc, char **argv, char **envp)
     case DT_SDL:
         sdl_display_init(ds, full_screen, no_frame);
         break;
-#if defined(CONFIG_COCOA)
     case DT_COCOA:
         cocoa_display_init(ds, full_screen);
         break;
-#endif
 #if defined(CONFIG_GTK)
     case DT_GTK:
         gtk_display_init(ds, full_screen, grab_on_hover);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 10/21] gtk: Initialization stubs
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (8 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 09/21] cocoa: cocoa_display_init() stub Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 11/21] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

This reduces the number of CONFIG_GTK #ifdefs in vl.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/ui/console.h | 17 +++++++++++++++++
 vl.c                 |  7 +------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 7ac997f..52a5f65 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -506,7 +506,24 @@ static inline void curses_display_init(DisplayState *ds, int full_screen)
 int index_from_key(const char *key, size_t key_length);
 
 /* gtk.c */
+#ifdef CONFIG_GTK
 void early_gtk_display_init(int opengl);
 void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);
+#else
+static inline void gtk_display_init(DisplayState *ds, bool full_screen,
+                                    bool grab_on_hover)
+{
+    /* This must never be called if CONFIG_GTK is disabled */
+    error_report("GTK support is disabled");
+    abort();
+}
+
+static inline void early_gtk_display_init(int opengl)
+{
+    /* This must never be called if CONFIG_GTK is disabled */
+    error_report("GTK support is disabled");
+    abort();
+}
+#endif
 
 #endif
diff --git a/vl.c b/vl.c
index 0648705..6e8d25e 100644
--- a/vl.c
+++ b/vl.c
@@ -148,9 +148,7 @@ int vga_interface_type = VGA_NONE;
 static int full_screen = 0;
 static int no_frame = 0;
 int no_quit = 0;
-#ifdef CONFIG_GTK
 static bool grab_on_hover;
-#endif
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
 CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
@@ -4246,11 +4244,10 @@ int main(int argc, char **argv, char **envp)
                      "ignoring option");
     }
 
-#if defined(CONFIG_GTK)
     if (display_type == DT_GTK) {
         early_gtk_display_init(request_opengl);
     }
-#endif
+
     if (display_type == DT_SDL) {
         sdl_display_early_init(request_opengl);
     }
@@ -4548,11 +4545,9 @@ int main(int argc, char **argv, char **envp)
     case DT_COCOA:
         cocoa_display_init(ds, full_screen);
         break;
-#if defined(CONFIG_GTK)
     case DT_GTK:
         gtk_display_init(ds, full_screen, grab_on_hover);
         break;
-#endif
     default:
         break;
     }
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 11/21] spice: Initialization stubs on qemu-spice.h
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (9 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 10/21] gtk: Initialization stubs Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 12/21] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create() Eduardo Habkost
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel,
	Gerd Hoffmann

This reduces the number of CONFIG_SPICE #ifdefs in vl.c.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/ui/qemu-spice.h | 13 +++++++++++++
 vl.c                    |  4 ----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
index aa24363..57ac91b 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -51,6 +51,8 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
 
 #else  /* CONFIG_SPICE */
 
+#include "qemu/error-report.h"
+
 #define using_spice 0
 #define spice_displays 0
 static inline int qemu_spice_set_passwd(const char *passwd,
@@ -75,6 +77,17 @@ static inline int qemu_spice_display_add_client(int csock, int skipauth,
     return -1;
 }
 
+static inline void qemu_spice_display_init(void)
+{
+    /* This must never be called if CONFIG_SPICE is disabled */
+    error_report("spice support is disabled");
+    abort();
+}
+
+static inline void qemu_spice_init(void)
+{
+}
+
 #endif /* CONFIG_SPICE */
 
 static inline bool qemu_using_spice(Error **errp)
diff --git a/vl.c b/vl.c
index 6e8d25e..8576556 100644
--- a/vl.c
+++ b/vl.c
@@ -4360,10 +4360,8 @@ int main(int argc, char **argv, char **envp)
 
     os_set_line_buffering();
 
-#ifdef CONFIG_SPICE
     /* spice needs the timers to be initialized by this point */
     qemu_spice_init();
-#endif
 
     cpu_ticks_init();
     if (icount_opts) {
@@ -4564,11 +4562,9 @@ int main(int argc, char **argv, char **envp)
         g_free(ret);
     }
 
-#ifdef CONFIG_SPICE
     if (using_spice) {
         qemu_spice_display_init();
     }
-#endif
 
     if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
         exit(1);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 12/21] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create()
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (10 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 11/21] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 13/21] vl: Replace DT_NOGRAPHIC with machine option Eduardo Habkost
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel,
	Michael Walle

DT_NOGRAPHIC handling will be moved to a MachineState field, and
it will be easier to change milkymist_init() to check that field.

Cc: Michael Walle <michael@walle.cc>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/lm32/milkymist-hw.h | 4 ----
 hw/lm32/milkymist.c    | 4 +++-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h
index c8dfb4d..f857d28 100644
--- a/hw/lm32/milkymist-hw.h
+++ b/hw/lm32/milkymist-hw.h
@@ -108,10 +108,6 @@ static inline DeviceState *milkymist_tmu2_create(hwaddr base,
     int nelements;
     int ver_major, ver_minor;
 
-    if (display_type == DT_NOGRAPHIC) {
-        return NULL;
-    }
-
     /* check that GLX will work */
     d = XOpenDisplay(NULL);
     if (d == NULL) {
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index 96e6f4d..694dac3 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -167,7 +167,9 @@ milkymist_init(MachineState *machine)
     milkymist_memcard_create(0x60004000);
     milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]);
     milkymist_pfpu_create(0x60006000, irq[8]);
-    milkymist_tmu2_create(0x60007000, irq[9]);
+    if (display_type != DT_NOGRAPHIC) {
+        milkymist_tmu2_create(0x60007000, irq[9]);
+    }
     milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]);
     milkymist_softusb_create(0x6000f000, irq[15],
             0x20000000, 0x1000, 0x20020000, 0x2000);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 13/21] vl: Replace DT_NOGRAPHIC with machine option
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (11 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 12/21] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create() Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 14/21] vl: Make display_type a local variable Eduardo Habkost
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel,
	Michael Walle, Blue Swirl, Mark Cave-Ayland

All DisplayType values are just UI options that don't affect any
hardware emulation code, except for DT_NOGRAPHIC. Replace
DT_NOGRAPHIC with DT_NONE plus a new "-machine graphics=on|off"
option, so hardware emulation code don't need to use the
display_type variable.

Cc: Michael Walle <michael@walle.cc>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/core/machine.c       | 21 +++++++++++++++++++++
 hw/lm32/milkymist.c     |  2 +-
 hw/nvram/fw_cfg.c       |  6 ++++--
 hw/sparc/sun4m.c        |  2 +-
 include/hw/boards.h     |  1 +
 include/sysemu/sysemu.h |  1 -
 vl.c                    | 13 +++++++------
 7 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 6dbbc85..0bb96ad 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -257,6 +257,20 @@ static void machine_set_usb(Object *obj, bool value, Error **errp)
     ms->usb_disabled = !value;
 }
 
+static bool machine_get_graphics(Object *obj, Error **errp)
+{
+    MachineState *ms = MACHINE(obj);
+
+    return ms->enable_graphics;
+}
+
+static void machine_set_graphics(Object *obj, bool value, Error **errp)
+{
+    MachineState *ms = MACHINE(obj);
+
+    ms->enable_graphics = value;
+}
+
 static bool machine_get_igd_gfx_passthru(Object *obj, Error **errp)
 {
     MachineState *ms = MACHINE(obj);
@@ -382,6 +396,7 @@ static void machine_initfn(Object *obj)
     ms->kvm_shadow_mem = -1;
     ms->dump_guest_core = true;
     ms->mem_merge = true;
+    ms->enable_graphics = true;
 
     object_property_add_str(obj, "accel",
                             machine_get_accel, machine_set_accel, NULL);
@@ -460,6 +475,12 @@ static void machine_initfn(Object *obj)
     object_property_set_description(obj, "usb",
                                     "Set on/off to enable/disable usb",
                                     NULL);
+    object_property_add_bool(obj, "graphics",
+                             machine_get_graphics,
+                             machine_set_graphics, NULL);
+    object_property_set_description(obj, "graphics",
+                                    "Set on/off to enable/disable graphics emulation",
+                                    NULL);
     object_property_add_bool(obj, "igd-passthru",
                              machine_get_igd_gfx_passthru,
                              machine_set_igd_gfx_passthru, NULL);
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index 694dac3..1abdf6e 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -167,7 +167,7 @@ milkymist_init(MachineState *machine)
     milkymist_memcard_create(0x60004000);
     milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]);
     milkymist_pfpu_create(0x60006000, irq[8]);
-    if (display_type != DT_NOGRAPHIC) {
+    if (machine->enable_graphics) {
         milkymist_tmu2_create(0x60007000, irq[9]);
     }
     milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]);
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 999f480..cdbdfb5 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/dma.h"
+#include "hw/boards.h"
 #include "hw/isa/isa.h"
 #include "hw/nvram/fw_cfg.h"
 #include "hw/sysbus.h"
@@ -868,16 +869,17 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
 static void fw_cfg_init1(DeviceState *dev)
 {
     FWCfgState *s = FW_CFG(dev);
+    MachineState *machine = MACHINE(qdev_get_machine());
 
     assert(!object_resolve_path(FW_CFG_PATH, NULL));
 
-    object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);
+    object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NULL);
 
     qdev_init_nofail(dev);
 
     fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
     fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
-    fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
+    fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphics);
     fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
     fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
     fw_cfg_bootsplash(s);
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 7bfc00a..478fda8 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -1000,7 +1000,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
     slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
 
     slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[14],
-                              display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1);
+                              !machine->enable_graphics, ESCC_CLOCK, 1);
     /* Slavio TTYA (base+4, Linux ttyS0) is the first QEMU serial device
        Slavio TTYB (base+0, Linux ttyS1) is the second QEMU serial device */
     escc_init(hwdef->serial_base, slavio_irq[15], slavio_irq[15],
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 8d4fe56..f968a25 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -154,6 +154,7 @@ struct MachineState {
     bool iommu;
     bool suppress_vmdesc;
     bool enforce_config_section;
+    bool enable_graphics;
 
     ram_addr_t ram_size;
     ram_addr_t maxram_size;
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 90766da..6076b80 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -138,7 +138,6 @@ typedef enum DisplayType
     DT_SDL,
     DT_COCOA,
     DT_GTK,
-    DT_NOGRAPHIC,
     DT_NONE,
 } DisplayType;
 
diff --git a/vl.c b/vl.c
index 8576556..35ed954 100644
--- a/vl.c
+++ b/vl.c
@@ -2962,6 +2962,7 @@ int main(int argc, char **argv, char **envp)
     int show_vnc_port = 0;
     bool defconfig = true;
     bool userconfig = true;
+    bool nographic = false;
     const char *log_mask = NULL;
     const char *log_file = NULL;
     char *trace_file = NULL;
@@ -3206,7 +3207,10 @@ int main(int argc, char **argv, char **envp)
                 display_type = select_display(optarg);
                 break;
             case QEMU_OPTION_nographic:
-                display_type = DT_NOGRAPHIC;
+                olist = qemu_find_opts("machine");
+                qemu_opts_parse_noisily(olist, "graphics=off", false);
+                nographic = true;
+                display_type = DT_NONE;
                 break;
             case QEMU_OPTION_curses:
 #ifdef CONFIG_CURSES
@@ -4167,7 +4171,7 @@ int main(int argc, char **argv, char **envp)
          * -nographic _and_ redirects all ports explicitly - this is valid
          * usage, -nographic is just a no-op in this case.
          */
-        if (display_type == DT_NOGRAPHIC
+        if (nographic
             && (default_parallel || default_serial
                 || default_monitor || default_virtcon)) {
             error_report("-nographic cannot be used with -daemonize");
@@ -4181,7 +4185,7 @@ int main(int argc, char **argv, char **envp)
 #endif
     }
 
-    if (display_type == DT_NOGRAPHIC) {
+    if (nographic) {
         if (default_parallel)
             add_device_config(DEV_PARALLEL, "null");
         if (default_serial && default_monitor) {
@@ -4531,9 +4535,6 @@ int main(int argc, char **argv, char **envp)
 
     /* init local displays */
     switch (display_type) {
-    case DT_NOGRAPHIC:
-        (void)ds;	/* avoid warning if no display is configured */
-        break;
     case DT_CURSES:
         curses_display_init(ds, full_screen);
         break;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 14/21] vl: Make display_type a local variable
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (12 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 13/21] vl: Replace DT_NOGRAPHIC with machine option Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 15/21] vl: Move DisplayType typedef to vl.c Eduardo Habkost
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Now display_type is only used inside main(), and don't need to be a
global variable.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/sysemu.h | 1 -
 vl.c                    | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 6076b80..7e9f93e 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -155,7 +155,6 @@ extern int vga_interface_type;
 extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
-extern DisplayType display_type;
 extern int display_opengl;
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
diff --git a/vl.c b/vl.c
index 35ed954..0d10ceb 100644
--- a/vl.c
+++ b/vl.c
@@ -129,7 +129,6 @@ static const char *data_dir[16];
 static int data_dir_idx;
 const char *bios_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
-DisplayType display_type = DT_DEFAULT;
 int request_opengl = -1;
 int display_opengl;
 static int display_remote;
@@ -2963,6 +2962,7 @@ int main(int argc, char **argv, char **envp)
     bool defconfig = true;
     bool userconfig = true;
     bool nographic = false;
+    DisplayType display_type = DT_DEFAULT;
     const char *log_mask = NULL;
     const char *log_file = NULL;
     char *trace_file = NULL;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 15/21] vl: Move DisplayType typedef to vl.c
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (13 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 14/21] vl: Make display_type a local variable Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 16/21] vl: Make display_remote a local variable Eduardo Habkost
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Now the type is only used inside vl.c and doesn't need to be in a
header file.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/sysemu.h | 10 ----------
 vl.c                    |  9 +++++++++
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 7e9f93e..618169c 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -131,16 +131,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
 
 int qemu_loadvm_state(QEMUFile *f);
 
-typedef enum DisplayType
-{
-    DT_DEFAULT,
-    DT_CURSES,
-    DT_SDL,
-    DT_COCOA,
-    DT_GTK,
-    DT_NONE,
-} DisplayType;
-
 extern int autostart;
 
 typedef enum {
diff --git a/vl.c b/vl.c
index 0d10ceb..aaf9134 100644
--- a/vl.c
+++ b/vl.c
@@ -2077,6 +2077,15 @@ static void select_vgahw(const char *p)
     }
 }
 
+typedef enum DisplayType {
+    DT_DEFAULT,
+    DT_CURSES,
+    DT_SDL,
+    DT_COCOA,
+    DT_GTK,
+    DT_NONE,
+} DisplayType;
+
 static DisplayType select_display(const char *p)
 {
     const char *opts;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 16/21] vl: Make display_remote a local variable
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (14 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 15/21] vl: Move DisplayType typedef to vl.c Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 17/21] vl: Simplify global property registration Eduardo Habkost
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

The variable is used only inside main(), so it can be local.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index aaf9134..a44e155 100644
--- a/vl.c
+++ b/vl.c
@@ -131,7 +131,6 @@ const char *bios_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 int request_opengl = -1;
 int display_opengl;
-static int display_remote;
 const char* keyboard_layout = NULL;
 ram_addr_t ram_size;
 const char *mem_path = NULL;
@@ -2972,6 +2971,7 @@ int main(int argc, char **argv, char **envp)
     bool userconfig = true;
     bool nographic = false;
     DisplayType display_type = DT_DEFAULT;
+    int display_remote = 0;
     const char *log_mask = NULL;
     const char *log_file = NULL;
     char *trace_file = NULL;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 17/21] vl: Simplify global property registration
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (15 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 16/21] vl: Make display_remote a local variable Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 18/21] machine: add properties to compat_props incrementaly Eduardo Habkost
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

There's no need to use qdev_prop_register_global_list() and an
array, if we are registering a single GlobalProperty struct. Use
qdev_prop_register_global() instead.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 39 +++++++++++++++------------------------
 1 file changed, 15 insertions(+), 24 deletions(-)

diff --git a/vl.c b/vl.c
index a44e155..8861862 100644
--- a/vl.c
+++ b/vl.c
@@ -888,16 +888,13 @@ static void configure_rtc(QemuOpts *opts)
     value = qemu_opt_get(opts, "driftfix");
     if (value) {
         if (!strcmp(value, "slew")) {
-            static GlobalProperty slew_lost_ticks[] = {
-                {
-                    .driver   = "mc146818rtc",
-                    .property = "lost_tick_policy",
-                    .value    = "slew",
-                },
-                { /* end of list */ }
+            static GlobalProperty slew_lost_ticks = {
+                .driver   = "mc146818rtc",
+                .property = "lost_tick_policy",
+                .value    = "slew",
             };
 
-            qdev_prop_register_global_list(slew_lost_ticks);
+            qdev_prop_register_global(&slew_lost_ticks);
         } else if (!strcmp(value, "none")) {
             /* discard is default */
         } else {
@@ -3626,16 +3623,13 @@ int main(int argc, char **argv, char **envp)
                 win2k_install_hack = 1;
                 break;
             case QEMU_OPTION_rtc_td_hack: {
-                static GlobalProperty slew_lost_ticks[] = {
-                    {
-                        .driver   = "mc146818rtc",
-                        .property = "lost_tick_policy",
-                        .value    = "slew",
-                    },
-                    { /* end of list */ }
+                static GlobalProperty slew_lost_ticks = {
+                    .driver   = "mc146818rtc",
+                    .property = "lost_tick_policy",
+                    .value    = "slew",
                 };
 
-                qdev_prop_register_global_list(slew_lost_ticks);
+                qdev_prop_register_global(&slew_lost_ticks);
                 break;
             }
             case QEMU_OPTION_acpitable:
@@ -3682,18 +3676,15 @@ int main(int argc, char **argv, char **envp)
                 break;
             }
             case QEMU_OPTION_no_kvm_pit_reinjection: {
-                static GlobalProperty kvm_pit_lost_tick_policy[] = {
-                    {
-                        .driver   = "kvm-pit",
-                        .property = "lost_tick_policy",
-                        .value    = "discard",
-                    },
-                    { /* end of list */ }
+                static GlobalProperty kvm_pit_lost_tick_policy = {
+                    .driver   = "kvm-pit",
+                    .property = "lost_tick_policy",
+                    .value    = "discard",
                 };
 
                 error_report("warning: deprecated, replaced by "
                              "-global kvm-pit.lost_tick_policy=discard");
-                qdev_prop_register_global_list(kvm_pit_lost_tick_policy);
+                qdev_prop_register_global(&kvm_pit_lost_tick_policy);
                 break;
             }
             case QEMU_OPTION_usb:
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 18/21] machine: add properties to compat_props incrementaly
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (16 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 17/21] vl: Simplify global property registration Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 19/21] vl: Use &error_fatal when parsing VNC options Eduardo Habkost
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel,
	Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Switch to adding compat properties incrementaly instead of
completly overwriting compat_props per machine type.
That removes data duplication which we have due to nested
[PC|SPAPR]_COMPAT_* macros.

It also allows to set default device properties from
default foo_machine_options() hook, which will be used
in following patch for putting VMGENID device as
a function if ISA bridge on pc/q35 machines.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
[ehabkost: Fixed CCW_COMPAT_* and PC_COMPAT_0_* defines]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/arm/virt.c              |  4 ----
 hw/core/machine.c          | 10 ++++++++++
 hw/i386/pc_piix.c          | 13 -------------
 hw/ppc/spapr.c             |  4 ----
 hw/s390x/s390-virtio-ccw.c |  1 -
 include/hw/boards.h        | 11 +++++++++--
 include/hw/i386/pc.h       |  9 ---------
 vl.c                       |  6 +++++-
 8 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index fe6b11d..e77ed88 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1418,13 +1418,9 @@ static void virt_2_6_instance_init(Object *obj)
 static void virt_2_6_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
-    static GlobalProperty compat_props[] = {
-        { /* end of list */ }
-    };
 
     mc->desc = "QEMU 2.6 ARM Virtual Machine";
     mc->alias = "virt";
-    mc->compat_props = compat_props;
 }
 
 static const TypeInfo machvirt_info = {
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 0bb96ad..ccdd5fa 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -571,6 +571,15 @@ bool machine_mem_merge(MachineState *machine)
     return machine->mem_merge;
 }
 
+static void machine_class_finalize(ObjectClass *klass, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(klass);
+
+    if (mc->compat_props) {
+        g_array_free(mc->compat_props, true);
+    }
+}
+
 static const TypeInfo machine_info = {
     .name = TYPE_MACHINE,
     .parent = TYPE_OBJECT,
@@ -578,6 +587,7 @@ static const TypeInfo machine_info = {
     .class_size = sizeof(MachineClass),
     .class_init    = machine_class_init,
     .class_base_init = machine_class_base_init,
+    .class_finalize = machine_class_finalize,
     .instance_size = sizeof(MachineState),
     .instance_init = machine_initfn,
     .instance_finalize = machine_finalize,
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7f50116..32918bb 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -582,7 +582,6 @@ DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
 
 
 #define PC_COMPAT_1_3 \
-        PC_COMPAT_1_4 \
         {\
             .driver   = "usb-tablet",\
             .property = "usb_version",\
@@ -614,7 +613,6 @@ DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
 
 
 #define PC_COMPAT_1_2 \
-        PC_COMPAT_1_3 \
         {\
             .driver   = "nec-usb-xhci",\
             .property = "msi",\
@@ -653,7 +651,6 @@ DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
 
 
 #define PC_COMPAT_1_1 \
-        PC_COMPAT_1_2 \
         {\
             .driver   = "virtio-scsi-pci",\
             .property = "hotplug",\
@@ -696,7 +693,6 @@ DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
 
 
 #define PC_COMPAT_1_0 \
-        PC_COMPAT_1_1 \
         {\
             .driver   = TYPE_ISA_FDC,\
             .property = "check_media_rate",\
@@ -726,14 +722,10 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
                       pc_i440fx_1_0_machine_options);
 
 
-#define PC_COMPAT_0_15 \
-        PC_COMPAT_1_0
-
 static void pc_i440fx_0_15_machine_options(MachineClass *m)
 {
     pc_i440fx_1_0_machine_options(m);
     m->hw_version = "0.15";
-    SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
 }
 
 DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
@@ -741,7 +733,6 @@ DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
 
 
 #define PC_COMPAT_0_14 \
-        PC_COMPAT_0_15 \
         {\
             .driver   = "virtio-blk-pci",\
             .property = "event_idx",\
@@ -780,7 +771,6 @@ DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
 
 
 #define PC_COMPAT_0_13 \
-        PC_COMPAT_0_14 \
         {\
             .driver   = TYPE_PCI_DEVICE,\
             .property = "command_serr_enable",\
@@ -817,7 +807,6 @@ DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,
 
 
 #define PC_COMPAT_0_12 \
-        PC_COMPAT_0_13 \
         {\
             .driver   = "virtio-serial-pci",\
             .property = "max_ports",\
@@ -852,7 +841,6 @@ DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
 
 
 #define PC_COMPAT_0_11 \
-        PC_COMPAT_0_12 \
         {\
             .driver   = "virtio-blk-pci",\
             .property = "vectors",\
@@ -883,7 +871,6 @@ DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
 
 
 #define PC_COMPAT_0_10 \
-    PC_COMPAT_0_11 \
     {\
         .driver   = "virtio-blk-pci",\
         .property = "class",\
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index de1de1d..add68ac 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2387,7 +2387,6 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false);
  * pseries-2.4
  */
 #define SPAPR_COMPAT_2_4 \
-        SPAPR_COMPAT_2_5 \
         HW_COMPAT_2_4
 
 static void spapr_machine_2_4_instance_options(MachineState *machine)
@@ -2410,7 +2409,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
  * pseries-2.3
  */
 #define SPAPR_COMPAT_2_3 \
-        SPAPR_COMPAT_2_4 \
         HW_COMPAT_2_3 \
         {\
             .driver   = "spapr-pci-host-bridge",\
@@ -2438,7 +2436,6 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
  */
 
 #define SPAPR_COMPAT_2_2 \
-        SPAPR_COMPAT_2_3 \
         HW_COMPAT_2_2 \
         {\
             .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,\
@@ -2463,7 +2460,6 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false);
  * pseries-2.1
  */
 #define SPAPR_COMPAT_2_1 \
-        SPAPR_COMPAT_2_2 \
         HW_COMPAT_2_1
 
 static void spapr_machine_2_1_instance_options(MachineState *machine)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 18bbbfb..95ff5e3 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -330,7 +330,6 @@ static const TypeInfo ccw_machine_info = {
         HW_COMPAT_2_5
 
 #define CCW_COMPAT_2_4 \
-        CCW_COMPAT_2_5 \
         HW_COMPAT_2_4 \
         {\
             .driver   = TYPE_S390_SKEYS,\
diff --git a/include/hw/boards.h b/include/hw/boards.h
index f968a25..d268bd0 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -114,7 +114,7 @@ struct MachineClass {
     const char *default_machine_opts;
     const char *default_boot_order;
     const char *default_display;
-    GlobalProperty *compat_props;
+    GArray *compat_props;
     const char *hw_version;
     ram_addr_t default_ram_size;
     bool option_rom_has_mr;
@@ -186,11 +186,18 @@ struct MachineState {
 
 #define SET_MACHINE_COMPAT(m, COMPAT) \
     do {                              \
+        int i;                        \
         static GlobalProperty props[] = {       \
             COMPAT                              \
             { /* end of list */ }               \
         };                                      \
-        (m)->compat_props = props;              \
+        if (!m->compat_props) { \
+            m->compat_props = g_array_new(false, false, sizeof(void *)); \
+        } \
+        for (i = 0; props[i].driver != NULL; i++) {    \
+            GlobalProperty *prop = &props[i];          \
+            g_array_append_val(m->compat_props, prop); \
+        }                                              \
     } while (0)
 
 #endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 96f0b66..367b6db 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -360,7 +360,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     HW_COMPAT_2_5
 
 #define PC_COMPAT_2_4 \
-    PC_COMPAT_2_5 \
     HW_COMPAT_2_4 \
     {\
         .driver   = "Haswell-" TYPE_X86_CPU,\
@@ -431,7 +430,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
 
 
 #define PC_COMPAT_2_3 \
-    PC_COMPAT_2_4 \
     HW_COMPAT_2_3 \
     {\
         .driver   = TYPE_X86_CPU,\
@@ -512,7 +510,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_2_2 \
-    PC_COMPAT_2_3 \
     HW_COMPAT_2_2 \
     {\
         .driver = "kvm64" "-" TYPE_X86_CPU,\
@@ -606,7 +603,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_2_1 \
-    PC_COMPAT_2_2 \
     HW_COMPAT_2_1 \
     {\
         .driver = "coreduo" "-" TYPE_X86_CPU,\
@@ -620,7 +616,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_2_0 \
-    PC_COMPAT_2_1 \
     {\
         .driver   = "virtio-scsi-pci",\
         .property = "any_layout",\
@@ -680,7 +675,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_1_7 \
-    PC_COMPAT_2_0 \
     {\
         .driver   = TYPE_USB_DEVICE,\
         .property = "msos-desc",\
@@ -698,7 +692,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_1_6 \
-    PC_COMPAT_1_7 \
     {\
         .driver   = "e1000",\
         .property = "mitigation",\
@@ -722,7 +715,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_1_5 \
-    PC_COMPAT_1_6 \
     {\
         .driver   = "Conroe-" TYPE_X86_CPU,\
         .property = "model",\
@@ -766,7 +758,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
     },
 
 #define PC_COMPAT_1_4 \
-    PC_COMPAT_1_5 \
     {\
         .driver   = "scsi-hd",\
         .property = "discard_granularity",\
diff --git a/vl.c b/vl.c
index 8861862..0228843 100644
--- a/vl.c
+++ b/vl.c
@@ -4473,7 +4473,11 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (machine_class->compat_props) {
-        qdev_prop_register_global_list(machine_class->compat_props);
+        GlobalProperty *p;
+        for (i = 0; i < machine_class->compat_props->len; i++) {
+            p = g_array_index(machine_class->compat_props, GlobalProperty *, i);
+            qdev_prop_register_global(p);
+        }
     }
     qemu_add_globals();
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 19/21] vl: Use &error_fatal when parsing VNC options
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (17 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 18/21] machine: add properties to compat_props incrementaly Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 20/21] vl: Use &error_fatal when parsing monitor options Eduardo Habkost
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/vl.c b/vl.c
index 0228843..bc22903 100644
--- a/vl.c
+++ b/vl.c
@@ -2151,11 +2151,7 @@ static DisplayType select_display(const char *p)
 #endif
     } else if (strstart(p, "vnc", &opts)) {
         if (*opts == '=') {
-            Error *err = NULL;
-            if (vnc_parse(opts + 1, &err) == NULL) {
-                error_report_err(err);
-                exit(1);
-            }
+            vnc_parse(opts + 1, &error_fatal);
         } else {
             error_report("VNC requires a display argument vnc=<display>");
             exit(1);
@@ -3709,15 +3705,8 @@ int main(int argc, char **argv, char **envp)
                 }
                 break;
             case QEMU_OPTION_vnc:
-            {
-                Error *local_err = NULL;
-
-                if (vnc_parse(optarg, &local_err) == NULL) {
-                    error_report_err(local_err);
-                    exit(1);
-                }
+                vnc_parse(optarg, &error_fatal);
                 break;
-            }
             case QEMU_OPTION_no_acpi:
                 acpi_enabled = 0;
                 break;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 20/21] vl: Use &error_fatal when parsing monitor options
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (18 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 19/21] vl: Use &error_fatal when parsing VNC options Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-20 20:28 ` [Qemu-devel] [PULL 21/21] Use &error_fatal when initializing crypto on qemu-{img, io, nbd} Eduardo Habkost
  2016-05-23 10:27 ` [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Peter Maydell
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/vl.c b/vl.c
index bc22903..b1562d8 100644
--- a/vl.c
+++ b/vl.c
@@ -2404,7 +2404,6 @@ static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
 static void monitor_parse(const char *optarg, const char *mode, bool pretty)
 {
     static int monitor_device_index = 0;
-    Error *local_err = NULL;
     QemuOpts *opts;
     const char *p;
     char label[32];
@@ -2425,11 +2424,7 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty)
         }
     }
 
-    opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &local_err);
-    if (!opts) {
-        error_report_err(local_err);
-        exit(1);
-    }
+    opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &error_fatal);
     qemu_opt_set(opts, "mode", mode, &error_abort);
     qemu_opt_set(opts, "chardev", label, &error_abort);
     qemu_opt_set_bool(opts, "pretty", pretty, &error_abort);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PULL 21/21] Use &error_fatal when initializing crypto on qemu-{img, io, nbd}
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (19 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 20/21] vl: Use &error_fatal when parsing monitor options Eduardo Habkost
@ 2016-05-20 20:28 ` Eduardo Habkost
  2016-05-23 10:27 ` [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Peter Maydell
  21 siblings, 0 replies; 23+ messages in thread
From: Eduardo Habkost @ 2016-05-20 20:28 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum, qemu-devel

In addition to making the code simpler, this will replace the
long error messages:
  cannot initialize crypto: Unable to initialize GNUTLS library: [...]
  cannot initialize crypto: Unable to initialize gcrypt
with shorter messages:
  Unable to initialize GNUTLS library: [...]
  Unable to initialize gcrypt

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu-img.c | 5 +----
 qemu-io.c  | 5 +----
 qemu-nbd.c | 5 +----
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 4792366..7ed8ef2 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3492,10 +3492,7 @@ int main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
-    if (qcrypto_init(&local_error) < 0) {
-        error_reportf_err(local_error, "cannot initialize crypto: ");
-        exit(1);
-    }
+    qcrypto_init(&error_fatal);
 
     module_call_init(MODULE_INIT_QOM);
     bdrv_init();
diff --git a/qemu-io.c b/qemu-io.c
index 5ef3ef7..d977a6e 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -466,10 +466,7 @@ int main(int argc, char **argv)
     progname = basename(argv[0]);
     qemu_init_exec_dir(argv[0]);
 
-    if (qcrypto_init(&local_error) < 0) {
-        error_reportf_err(local_error, "cannot initialize crypto: ");
-        exit(1);
-    }
+    qcrypto_init(&error_fatal);
 
     module_call_init(MODULE_INIT_QOM);
     qemu_add_opts(&qemu_object_opts);
diff --git a/qemu-nbd.c b/qemu-nbd.c
index d59b187..6554f0a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -527,10 +527,7 @@ int main(int argc, char **argv)
     sa_sigterm.sa_handler = termsig_handler;
     sigaction(SIGTERM, &sa_sigterm, NULL);
 
-    if (qcrypto_init(&local_err) < 0) {
-        error_reportf_err(local_err, "cannot initialize crypto: ");
-        exit(1);
-    }
+    qcrypto_init(&error_fatal);
 
     module_call_init(MODULE_INIT_QOM);
     qemu_add_opts(&qemu_object_opts);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20
  2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
                   ` (20 preceding siblings ...)
  2016-05-20 20:28 ` [Qemu-devel] [PULL 21/21] Use &error_fatal when initializing crypto on qemu-{img, io, nbd} Eduardo Habkost
@ 2016-05-23 10:27 ` Peter Maydell
  21 siblings, 0 replies; 23+ messages in thread
From: Peter Maydell @ 2016-05-23 10:27 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Michael S. Tsirkin, Marcel Apfelbaum,
	QEMU Developers

On 20 May 2016 at 21:28, Eduardo Habkost <ehabkost@redhat.com> wrote:
> The following changes since commit 65603e2fc18b48e6e55a3dd693669413141694ec:
>
>   tci: do not include exec/exec-all.h (2016-05-20 15:07:46 +0100)
>
> are available in the git repository at:
>
>   git://github.com/ehabkost/qemu.git tags/machine-pull-request
>
> for you to fetch changes up to e8f2d2722eb84a809697e82c762d39c8c13f22f6:
>
>   Use &error_fatal when initializing crypto on qemu-{img,io,nbd} (2016-05-20 14:28:55 -0300)
>
> ----------------------------------------------------------------
> Machine Core queue, 2016-05-20
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-05-23 10:27 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-20 20:28 [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 01/21] pc-dimm: correct comment of MemoryHotplugState Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 02/21] vl: Use exit(1) when requested VGA interface is unavailable Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 03/21] vl: Table-based select_vgahw() Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 04/21] vl: Replace *_vga_available() functions with class_names field Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 05/21] vl: Add DT_COCOA DisplayType value Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 06/21] vnc: Initialization stubs Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 07/21] curses: curses_display_init() stub Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 08/21] sdl: Initialization stubs Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 09/21] cocoa: cocoa_display_init() stub Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 10/21] gtk: Initialization stubs Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 11/21] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 12/21] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create() Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 13/21] vl: Replace DT_NOGRAPHIC with machine option Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 14/21] vl: Make display_type a local variable Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 15/21] vl: Move DisplayType typedef to vl.c Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 16/21] vl: Make display_remote a local variable Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 17/21] vl: Simplify global property registration Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 18/21] machine: add properties to compat_props incrementaly Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 19/21] vl: Use &error_fatal when parsing VNC options Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 20/21] vl: Use &error_fatal when parsing monitor options Eduardo Habkost
2016-05-20 20:28 ` [Qemu-devel] [PULL 21/21] Use &error_fatal when initializing crypto on qemu-{img, io, nbd} Eduardo Habkost
2016-05-23 10:27 ` [Qemu-devel] [PULL 00/21] Machine Core queue, 2016-05-20 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).