qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Cc: kraxel@redhat.com, qemu-stable <qemu-stable@nongnu.org>,
	QEMU Trivial <qemu-trivial@nongnu.org>
Subject: Re: [PATCH] qxl: don't assert() if device isn't yet initialized
Date: Thu, 17 Aug 2023 15:21:53 +0200	[thread overview]
Message-ID: <9e2a9dcf-c15a-8e64-aea9-a40c871cbc8c@redhat.com> (raw)
In-Reply-To: <20230814193331.375778-1-marcandre.lureau@redhat.com>

On 14/08/2023 21.33, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> If the PCI BAR isn't yet mapped or was unmapped, QXL_IO_SET_MODE will
> assert(). Instead, report a guest bug and keep going.
> 
> This can be reproduced with:
> 
> cat << EOF | ./qemu-system-x86_64 -vga qxl -m 2048 -nodefaults -qtest stdio
> outl 0xcf8 0x8000101c
> outl 0xcfc 0xc000
> outl 0xcf8 0x80001001
> outl 0xcfc 0x01000000
> outl 0xc006 0x00
> EOF
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1829
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   hw/display/qxl.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index f1c0eb7dfc..70b73820b2 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -1591,7 +1591,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
>       }
>   
>       d->guest_slots[0].slot = slot;
> -    assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
> +    if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) {
> +        qxl_set_guest_bug(d, "device isn't initialized yet");
> +        return;
> +    }
>   
>       d->guest_primary.surface = surface;
>       qxl_create_guest_primary(d, 0, QXL_SYNC);

Reviewed-by: Thomas Huth <thuth@redhat.com>



      reply	other threads:[~2023-08-17 13:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 19:33 [PATCH] qxl: don't assert() if device isn't yet initialized marcandre.lureau
2023-08-17 13:21 ` Thomas Huth [this message]

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=9e2a9dcf-c15a-8e64-aea9-a40c871cbc8c@redhat.com \
    --to=thuth@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu-trivial@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).