From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeQMl-0005Uw-Op for qemu-devel@nongnu.org; Fri, 11 Mar 2016 11:56:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeQMj-0003N8-2M for qemu-devel@nongnu.org; Fri, 11 Mar 2016 11:56:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeQMi-0003N1-QO for qemu-devel@nongnu.org; Fri, 11 Mar 2016 11:56:40 -0500 References: <1457695134-10712-1-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56E2F8C7.1060409@redhat.com> Date: Fri, 11 Mar 2016 09:56:39 -0700 MIME-Version: 1.0 In-Reply-To: <1457695134-10712-1-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="u1lUQa8aJBcu5fhGP2hDTUPaBnVfOKewu" Subject: Re: [Qemu-devel] [PATCH v2] hw: fix error reporting for missing option ROMs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Paolo Bonzini , "Michael S. Tsirkin" , Eduardo Habkost , Richard Henderson This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --u1lUQa8aJBcu5fhGP2hDTUPaBnVfOKewu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/11/2016 04:18 AM, Daniel P. Berrange wrote: > If QEMU fails to load any of the VGA ROMs, it prints a message > to stderr and then carries on as if everything was fine, despite > the VGA interface not being functional. This extends the the > various rom_add_*() methods in loader.h to accept a 'Error **errp' > parameter. The VGA device realizefn() impls can now pass in the > errp they already have and get errors reported as fatal problems. >=20 > Addition of 'Error **errp' to the load_*() methods in loader.h is > left as an exercise for future interested developers, since it will > require fixing up a great many callers to propagate errors correctly. >=20 > Signed-off-by: Daniel P. Berrange > --- >=20 > Changed in v2: >=20 > - Use error_fatal instead of NULL in places lacking an > Error **errp to propagate to > - Use error_setg_file_open instead of error_setg_errno > - Mention that load_*() methods are intentionally not converted >=20 > +++ b/hw/i386/pc_sysfw.c > @@ -178,6 +178,7 @@ static void old_pc_system_rom_init(MemoryRegion *ro= m_memory, bool isapc_ram_fw) > MemoryRegion *bios, *isa_bios; > int bios_size, isa_bios_size; > int ret; > + Error *err =3D NULL; > =20 > /* BIOS load */ > if (bios_name =3D=3D NULL) { > @@ -199,10 +200,10 @@ static void old_pc_system_rom_init(MemoryRegion *= rom_memory, bool isapc_ram_fw) > if (!isapc_ram_fw) { > memory_region_set_readonly(bios, true); > } > - ret =3D rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);= > + ret =3D rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1, = &err); > if (ret !=3D 0) { > bios_error: > - fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_na= me); > + error_report_err(err); You can get here through the 'goto bios_error' flow, at which point err is not set. You'll want to do an error_setg() just before that goto. With that fixed, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --u1lUQa8aJBcu5fhGP2hDTUPaBnVfOKewu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJW4vjHAAoJEKeha0olJ0Nq0jcIAKrqcCvcwOGfv7HwfEviWQz0 HNsKwhnLI/k77CXYIilBbIjaS3Z77t5gfwgzIGq82ZgQutFD5UWKhm7TAGsDJs+3 53+0uoO3ROurSKURJ3WqqsRbNpksjlwPuMqJ+R9kscd8O/6Ww9heMtODO8FM/srn XbBL0x7xB5MITMtmygssBy9u7RhkrwyNpS1RAUik9biaIvRY34zuxCgH7e8VI5C2 KFO54HsEG6zpfibJ2WIYbJmGxfBuufbeuCAKfyXz9zx6DhzGctuLopEaBYoyKUX4 7wMQIajicUsKR5Q84oXoqcvMkAXa/Z7YCQ7JUXAQkQRMO81CcvBz/+yIDJGZw4Q= =v7wZ -----END PGP SIGNATURE----- --u1lUQa8aJBcu5fhGP2hDTUPaBnVfOKewu--