qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] vga: abort instead of shrinking memory
Date: Tue, 17 Feb 2015 11:51:35 +0100	[thread overview]
Message-ID: <1424170295.6014.37.camel@nilsson.home.kraxel.org> (raw)
In-Reply-To: <20150217104802.GC4562@potion.brq.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

  Hi,

> > Which command line triggers it?
> 
> The important subset is:
>   -vga qxl -global qxl-vga.vgamem_mb=512

Ah, so the problem is only one place enforces a upper limit, so we can
get an invalid configuration with large values.

Can you try the attached patch?

cheers,
  Gerd


[-- Attachment #2: 0001-spice-fix-qxl-mem-size-checking.patch --]
[-- Type: text/x-patch, Size: 1846 bytes --]

>From 7e5e3f9aa6ccd74ebbf454a0e5e4bddf87978f25 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 17 Feb 2015 11:50:49 +0100
Subject: [PATCH] spice: fix qxl mem size checking

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/qxl.c | 4 ++++
 hw/display/vga.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 61df477..c8ca645 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1880,6 +1880,9 @@ static void qxl_init_ramsize(PCIQXLDevice *qxl)
     if (qxl->vgamem_size_mb < 8) {
         qxl->vgamem_size_mb = 8;
     }
+    if (qxl->vgamem_size_mb > 512) {
+        qxl->vgamem_size_mb = 512;
+    }
     qxl->vgamem_size = qxl->vgamem_size_mb * 1024 * 1024;
 
     /* vga ram (bar 0, total) */
@@ -2040,6 +2043,7 @@ static int qxl_init_primary(PCIDevice *dev)
     vga->vbe_size = qxl->vgamem_size;
     vga->vram_size_mb = qxl->vga.vram_size >> 20;
     vga_common_init(vga, OBJECT(dev), true);
+    assert(qxl->vgamem_size < qxl->vga.vram_size);
     vga_init(vga, OBJECT(dev),
              pci_address_space(dev), pci_address_space_io(dev), false);
     portio_list_init(&qxl->vga_port_list, OBJECT(dev), qxl_vga_portio_list,
diff --git a/hw/display/vga.c b/hw/display/vga.c
index ffcfce3..52e86ce 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2122,10 +2122,10 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
         expand4to8[i] = v;
     }
 
-    /* valid range: 1 MB -> 256 MB */
+    /* valid range: 1 MB -> 1024 MB */
     s->vram_size = 1024 * 1024;
     while (s->vram_size < (s->vram_size_mb << 20) &&
-           s->vram_size < (256 << 20)) {
+           s->vram_size < (1024 << 20)) {
         s->vram_size <<= 1;
     }
     s->vram_size_mb = s->vram_size >> 20;
-- 
1.8.3.1


  reply	other threads:[~2015-02-17 10:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 21:23 [Qemu-devel] [PATCH 0/2] vga: assert to "solve" qxl bug Radim Krčmář
2015-02-16 21:23 ` [Qemu-devel] [PATCH 1/2] vga: abort instead of shrinking memory Radim Krčmář
2015-02-17  8:00   ` Gerd Hoffmann
2015-02-17 10:29     ` Radim Krčmář
2015-02-17 10:37       ` Gerd Hoffmann
2015-02-17 10:48         ` Radim Krčmář
2015-02-17 10:51           ` Gerd Hoffmann [this message]
2015-02-17 11:15             ` Radim Krčmář
2015-02-16 21:23 ` [Qemu-devel] [PATCH 2/2] qxl: surface0 and ram_header should fit into vram Radim Krčmář
2015-02-17  8:02   ` Gerd Hoffmann
2015-02-17 10:31     ` Radim Krčmář

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=1424170295.6014.37.camel@nilsson.home.kraxel.org \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkrcmar@redhat.com \
    /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).