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>
Subject: [Qemu-devel] [PATCH v2 2/2] warn about two vga cards
Date: Mon,  2 Jul 2018 18:33:45 +0200	[thread overview]
Message-ID: <20180702163345.17892-2-kraxel@redhat.com> (raw)
In-Reply-To: <20180702163345.17892-1-kraxel@redhat.com>

Two vga cards will try to register for the same legacy (isa) ioports.
Due to this conflict only one of the two cards will work correctly in
vga mode.

Print a warning message in that case.  Also try registering the ports
only once, so the first vga added to the system will work properly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/vga.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index c82e6d240a..e811571624 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2273,6 +2273,7 @@ MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
 void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
               MemoryRegion *address_space_io, bool init_vga_ports)
 {
+    static bool vgaports_registered;
     MemoryRegion *vga_io_memory;
     const MemoryRegionPortio *vga_ports, *vbe_ports;
 
@@ -2289,9 +2290,14 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
                                         1);
     memory_region_set_coalescing(vga_io_memory);
     if (init_vga_ports) {
-        portio_list_init(&s->vga_port_list, obj, vga_ports, s, "vga");
-        portio_list_set_flush_coalesced(&s->vga_port_list);
-        portio_list_add(&s->vga_port_list, address_space_io, 0x3b0);
+        if (vgaports_registered) {
+            warn_report("multiple vga cards may not work as expected");
+        } else {
+            portio_list_init(&s->vga_port_list, obj, vga_ports, s, "vga");
+            portio_list_set_flush_coalesced(&s->vga_port_list);
+            portio_list_add(&s->vga_port_list, address_space_io, 0x3b0);
+            vgaports_registered = true;
+        }
     }
     if (vbe_ports) {
         portio_list_init(&s->vbe_port_list, obj, vbe_ports, s, "vbe");
-- 
2.9.3

  reply	other threads:[~2018-07-02 16:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02 16:33 [Qemu-devel] [PATCH v2 1/2] vga: disable global_vmstate for 3.0+ machine types Gerd Hoffmann
2018-07-02 16:33 ` Gerd Hoffmann [this message]
2018-07-02 16:43   ` [Qemu-devel] [PATCH v2 2/2] warn about two vga cards Gerd Hoffmann
2018-07-02 17:03     ` Philippe Mathieu-Daudé
2018-07-03  6:25       ` Gerd Hoffmann
2018-07-03 14:08         ` Philippe Mathieu-Daudé
2018-07-02 17:02   ` Philippe Mathieu-Daudé

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=20180702163345.17892-2-kraxel@redhat.com \
    --to=kraxel@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).