qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Jose R. Ziviani" <jziviani@suse.de>, qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: Re: [PATCH] vga: don't abort when adding a duplicate isa-vga device
Date: Sat, 14 Aug 2021 08:52:00 +0200	[thread overview]
Message-ID: <9dd25d6d-b9ba-0000-96a0-451fd1b28c56@redhat.com> (raw)
In-Reply-To: <20210813233619.32178-1-jziviani@suse.de>

On 14/08/2021 01.36, Jose R. Ziviani wrote:
> If users try to add an isa-vga device that was already registered,
> still in command line, qemu will crash:
> 
> $ qemu-system-mips64el -M pica61 -device isa-vga
> RAMBlock "vga.vram" already registered, abort!
> Aborted (core dumped)
> 
> That particular board registers such device automaticaly, so it's
> not obvious that a VGA device already exists. This patch changes
> this behavior by displaying a message and ignoring that device,
> starting qemu normally.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/44
> Signed-off-by: Jose R. Ziviani <jziviani@suse.de>
> ---
>   hw/display/vga-isa.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
> index 90851e730b..69db502dde 100644
> --- a/hw/display/vga-isa.c
> +++ b/hw/display/vga-isa.c
> @@ -61,6 +61,15 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
>       MemoryRegion *vga_io_memory;
>       const MemoryRegionPortio *vga_ports, *vbe_ports;
>   
> +    /*
> +     * some machines register VGA by default, so instead of aborting
> +     * it, show a message and ignore this device.
> +     */
> +    if (qemu_ram_block_by_name("vga.vram")) {
> +        error_report("vga.vram is already registered, ignoring this device");
> +        return;
> +    }

I think we should not ignore the error, but rather turn this into a proper 
error (instead of aborting).

So if you replace error_report(...) with error_setg(errp, ...), the patch 
should be fine.

  Thomas



  reply	other threads:[~2021-08-14  6:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 23:36 [PATCH] vga: don't abort when adding a duplicate isa-vga device Jose R. Ziviani
2021-08-14  6:52 ` Thomas Huth [this message]
2021-08-16  5:05   ` Gerd Hoffmann
2021-08-16 12:34     ` Jose Ricardo Ziviani
2021-08-24  5:12   ` Markus Armbruster

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=9dd25d6d-b9ba-0000-96a0-451fd1b28c56@redhat.com \
    --to=thuth@redhat.com \
    --cc=jziviani@suse.de \
    --cc=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).