diff mbox

qxl: don't assert on guest create_guest_primary

Message ID 1334746806-28733-1-git-send-email-alevy@redhat.com
State New
Headers show

Commit Message

Alon Levy April 18, 2012, 11 a.m. UTC
initiate the implicit destroy ourselves.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Gerd Hoffmann April 24, 2012, 10:17 a.m. UTC | #1
On 04/18/12 13:00, Alon Levy wrote:
> initiate the implicit destroy ourselves.

What is the use case?

Allowing guests to do that without giving them a way to figure whenever
it will work or not doesn't look that useful to me.

cheers,
  Gerd
Alon Levy April 24, 2012, 12:39 p.m. UTC | #2
On Tue, Apr 24, 2012 at 12:17:15PM +0200, Gerd Hoffmann wrote:
> On 04/18/12 13:00, Alon Levy wrote:
> > initiate the implicit destroy ourselves.
> 
> What is the use case?

Don't let guest crash the machine with bad driver. i.e. during testing I
did this inadvertently.

> 
> Allowing guests to do that without giving them a way to figure whenever
> it will work or not doesn't look that useful to me.

OK - so maybe just have this as a guest_bug instead of an assert?

> 
> cheers,
>   Gerd
>
Gerd Hoffmann April 24, 2012, 1:55 p.m. UTC | #3
>> Allowing guests to do that without giving them a way to figure whenever
>> it will work or not doesn't look that useful to me.
> 
> OK - so maybe just have this as a guest_bug instead of an assert?

Yes, please.

thanks,
  Gerd
diff mbox

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index 6776a7f..1ab3348 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1163,7 +1163,15 @@  static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,
     QXLDevSurfaceCreate surface;
     QXLSurfaceCreate *sc = &qxl->guest_primary.surface;
 
-    assert(qxl->mode != QXL_MODE_NATIVE);
+    if (qxl->mode == QXL_MODE_NATIVE) {
+        /*
+         * allow a create without a destroy. This could be used
+         * later for an atomic "change primary" but right now just
+         * destroy the primary for the guest. Note that this uses
+         * the ability to have multiple concurrent async commands.
+         */
+        qxl_destroy_primary(qxl, async);
+    }
     qxl_exit_vga_mode(qxl);
 
     surface.format     = le32_to_cpu(sc->format);