From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZKQb-00077m-96 for qemu-devel@nongnu.org; Sat, 10 Dec 2011 05:45:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZKQa-0003rb-4J for qemu-devel@nongnu.org; Sat, 10 Dec 2011 05:45:13 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:38688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZKQZ-0003rX-LK for qemu-devel@nongnu.org; Sat, 10 Dec 2011 05:45:12 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate03.web.de (Postfix) with ESMTP id 4FB9F1AB32E64 for ; Sat, 10 Dec 2011 11:45:09 +0100 (CET) Message-ID: <4EE3382D.80903@web.de> Date: Sat, 10 Dec 2011 11:45:01 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1323467645-24271-1-git-send-email-anthony.perard@citrix.com> <1323467645-24271-6-git-send-email-anthony.perard@citrix.com> In-Reply-To: <1323467645-24271-6-git-send-email-anthony.perard@citrix.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig08CBD72951CA10E90D48A03B" Subject: Re: [Qemu-devel] [PATCH V2 5/5] vga-cirrus: Workaround during restore when using Xen. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony PERARD Cc: Xen Devel , QEMU-devel , Stefano Stabellini This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig08CBD72951CA10E90D48A03B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-12-09 22:54, Anthony PERARD wrote: > During the initialisation of the machine at restore time, the access to= the > VRAM will fail because QEMU does not know yet the right guest address t= o map, > so the vram_ptr is NULL. >=20 > So this patch avoid using a NULL pointer during initialisation, and try= to get > another vram_ptr if the call failed the first time. >=20 > Signed-off-by: Anthony PERARD > --- > hw/cirrus_vga.c | 16 +++++++++++++--- > 1 files changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c > index c7e365b..2e049c9 100644 > --- a/hw/cirrus_vga.c > +++ b/hw/cirrus_vga.c > @@ -32,6 +32,7 @@ > #include "console.h" > #include "vga_int.h" > #include "loader.h" > +#include "sysemu.h" > =20 > /* > * TODO: > @@ -2696,6 +2697,13 @@ static int cirrus_post_load(void *opaque, int ve= rsion_id) > s->vga.gr[0x01] =3D s->cirrus_shadow_gr1 & 0x0f; > =20 > cirrus_update_memory_access(s); > + if (!s->vga.vram_ptr) { > + /* At this point vga.vram_ptr can be invalid on Xen because we= need to > + * know the position of the videoram in the guest physical add= ress space in > + * order to be able to map it. After cirrus_update_memory_acce= ss we do know > + * where the videoram is, so let's map it now. */ > + s->vga.vram_ptr =3D memory_region_get_ram_ptr(&s->vga.vram); > + } > /* force refresh */ > s->vga.graphic_mode =3D -1; > cirrus_update_bank_ptr(s, 0); > @@ -2784,9 +2792,11 @@ static void cirrus_reset(void *opaque) > } > s->vga.cr[0x27] =3D s->device_id; > =20 > - /* Win2K seems to assume that the pattern buffer is at 0xff > - initially ! */ > - memset(s->vga.vram_ptr, 0xff, s->real_vram_size); > + if (!runstate_check(RUN_STATE_PREMIGRATE)) { > + /* Win2K seems to assume that the pattern buffer is at 0xff > + initially ! */ > + memset(s->vga.vram_ptr, 0xff, s->real_vram_size); > + } > =20 > s->cirrus_hidden_dac_lockindex =3D 5; > s->cirrus_hidden_dac_data =3D 0; Is there really no way to fix this properly in the Xen layer? This looks highly fragile as specifically the second hunk appears unrelated to Xen. Also, is this the only device affected by the shortcoming? What about other VGA adapters e.g.? Jan --------------enig08CBD72951CA10E90D48A03B 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.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7jODIACgkQitSsb3rl5xS8+QCdFbSDn7kzL54Agbm65iS/X01a 500AnRozhuTqQ0RYY9tyJWlrQheC6p3K =YFZ1 -----END PGP SIGNATURE----- --------------enig08CBD72951CA10E90D48A03B-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH V2 5/5] vga-cirrus: Workaround during restore when using Xen. Date: Sat, 10 Dec 2011 11:45:01 +0100 Message-ID: <4EE3382D.80903@web.de> References: <1323467645-24271-1-git-send-email-anthony.perard@citrix.com> <1323467645-24271-6-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig08CBD72951CA10E90D48A03B" Return-path: In-Reply-To: <1323467645-24271-6-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Anthony PERARD Cc: Xen Devel , QEMU-devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig08CBD72951CA10E90D48A03B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-12-09 22:54, Anthony PERARD wrote: > During the initialisation of the machine at restore time, the access to= the > VRAM will fail because QEMU does not know yet the right guest address t= o map, > so the vram_ptr is NULL. >=20 > So this patch avoid using a NULL pointer during initialisation, and try= to get > another vram_ptr if the call failed the first time. >=20 > Signed-off-by: Anthony PERARD > --- > hw/cirrus_vga.c | 16 +++++++++++++--- > 1 files changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c > index c7e365b..2e049c9 100644 > --- a/hw/cirrus_vga.c > +++ b/hw/cirrus_vga.c > @@ -32,6 +32,7 @@ > #include "console.h" > #include "vga_int.h" > #include "loader.h" > +#include "sysemu.h" > =20 > /* > * TODO: > @@ -2696,6 +2697,13 @@ static int cirrus_post_load(void *opaque, int ve= rsion_id) > s->vga.gr[0x01] =3D s->cirrus_shadow_gr1 & 0x0f; > =20 > cirrus_update_memory_access(s); > + if (!s->vga.vram_ptr) { > + /* At this point vga.vram_ptr can be invalid on Xen because we= need to > + * know the position of the videoram in the guest physical add= ress space in > + * order to be able to map it. After cirrus_update_memory_acce= ss we do know > + * where the videoram is, so let's map it now. */ > + s->vga.vram_ptr =3D memory_region_get_ram_ptr(&s->vga.vram); > + } > /* force refresh */ > s->vga.graphic_mode =3D -1; > cirrus_update_bank_ptr(s, 0); > @@ -2784,9 +2792,11 @@ static void cirrus_reset(void *opaque) > } > s->vga.cr[0x27] =3D s->device_id; > =20 > - /* Win2K seems to assume that the pattern buffer is at 0xff > - initially ! */ > - memset(s->vga.vram_ptr, 0xff, s->real_vram_size); > + if (!runstate_check(RUN_STATE_PREMIGRATE)) { > + /* Win2K seems to assume that the pattern buffer is at 0xff > + initially ! */ > + memset(s->vga.vram_ptr, 0xff, s->real_vram_size); > + } > =20 > s->cirrus_hidden_dac_lockindex =3D 5; > s->cirrus_hidden_dac_data =3D 0; Is there really no way to fix this properly in the Xen layer? This looks highly fragile as specifically the second hunk appears unrelated to Xen. Also, is this the only device affected by the shortcoming? What about other VGA adapters e.g.? Jan --------------enig08CBD72951CA10E90D48A03B 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.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7jODIACgkQitSsb3rl5xS8+QCdFbSDn7kzL54Agbm65iS/X01a 500AnRozhuTqQ0RYY9tyJWlrQheC6p3K =YFZ1 -----END PGP SIGNATURE----- --------------enig08CBD72951CA10E90D48A03B--