qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH] sga: stop using sgabios rom for 2.11+
Date: Wed, 15 Nov 2017 11:29:28 +0100	[thread overview]
Message-ID: <20171115102928.7878-1-kraxel@redhat.com> (raw)

seabios 1.11 got builtin serial console support, so we don't need
sgabios any more.  "-machine graphics=off" should be used instead.
update sga.c accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/compat.h |  4 ++++
 hw/misc/sga.c       | 26 +++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/hw/compat.h b/include/hw/compat.h
index f96212c49c..1e3ad895db 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -14,6 +14,10 @@
         .driver   = "i82559a",\
         .property = "x-use-alt-device-id",\
         .value    = "false",\
+    },{\
+        .driver   = "sga",\
+        .property = "use-sgabios",\
+        .value    = "true",\
     },
 
 #define HW_COMPAT_2_9 \
diff --git a/hw/misc/sga.c b/hw/misc/sga.c
index 03b006d6f0..bcb4c98554 100644
--- a/hw/misc/sga.c
+++ b/hw/misc/sga.c
@@ -25,6 +25,7 @@
  *
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "hw/pci/pci.h"
 #include "hw/i386/pc.h"
 #include "hw/loader.h"
@@ -37,18 +38,41 @@
 
 typedef struct ISASGAState {
     ISADevice parent_obj;
+    bool use_sgabios;
 } ISASGAState;
 
 static void sga_realizefn(DeviceState *dev, Error **errp)
 {
-    rom_add_vga(SGABIOS_FILENAME);
+    MachineState *machine = MACHINE(qdev_get_machine());
+    ISASGAState *sga = SGA(dev);
+
+    if (sga->use_sgabios) {
+        rom_add_vga(SGABIOS_FILENAME);
+    } else if (machine->enable_graphics) {
+        warn_report("sgabios is deprecated for your machine type, "
+                    "please use -machine graphics=off instead of "
+                    "-device sga");
+        rom_add_vga(SGABIOS_FILENAME);
+    } else {
+        /*
+         * For this machine type we expect SeaBIOS to provide a
+         * serial console for -machine graphics=off.  No need to
+         * do anything here.
+         */
+    }
 }
 
+static Property sga_properties[] = {
+    DEFINE_PROP_BOOL("use-sgabios", ISASGAState, use_sgabios, false),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void sga_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
+    dc->props = sga_properties;
     dc->realize = sga_realizefn;
     dc->desc = "Serial Graphics Adapter";
 }
-- 
2.9.3

                 reply	other threads:[~2017-11-15 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115102928.7878-1-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).