From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LvTgb-00059Y-5Q for qemu-devel@nongnu.org; Sun, 19 Apr 2009 05:51:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LvTgV-00055z-Sk for qemu-devel@nongnu.org; Sun, 19 Apr 2009 05:51:40 -0400 Received: from [199.232.76.173] (port=36203 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvTgV-00055q-Kq for qemu-devel@nongnu.org; Sun, 19 Apr 2009 05:51:35 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:50151) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LvTgV-0006L7-04 for qemu-devel@nongnu.org; Sun, 19 Apr 2009 05:51:35 -0400 Message-ID: <49EAF41F.5040805@web.de> Date: Sun, 19 Apr 2009 11:51:27 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig853F8A8DE8FE99568F099A1F" Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH] kvm: Conditionally apply workaround for KVM slot handling bug Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig853F8A8DE8FE99568F099A1F Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Only apply the workaround for broken slot joining in KVM when the capability was not found that signals the corresponding fix existence. Signed-off-by: Jan Kiszka --- kvm-all.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 32cd636..9e9b462 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -57,6 +57,7 @@ struct KVMState int fd; int vmfd; int coalesced_mmio; + int broken_set_mem_region; #ifdef KVM_CAP_SET_GUEST_DEBUG struct kvm_sw_breakpoint_head kvm_sw_breakpoints; #endif @@ -398,6 +399,14 @@ int kvm_init(int smp_cpus) s->coalesced_mmio =3D ret; #endif =20 + s->broken_set_mem_region =3D 1; +#ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS + ret =3D kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_JOIN_MEMORY_REGION= S_WORKS); + if (ret > 0) { + s->broken_set_mem_region =3D 0; + } +#endif + ret =3D kvm_arch_init(s, smp_cpus); if (ret < 0) goto err; @@ -623,7 +632,8 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr, * address as the first existing one. If not or if some overlapp= ing * slot comes around later, we will fail (not seen in practice s= o far) * - and actually require a recent KVM version. */ - if (old.start_addr =3D=3D start_addr && old.memory_size < size &= & + if (s->broken_set_mem_region && + old.start_addr =3D=3D start_addr && old.memory_size < size &= & flags < IO_MEM_UNASSIGNED) { mem =3D kvm_alloc_slot(s); mem->memory_size =3D old.memory_size; --------------enig853F8A8DE8FE99568F099A1F 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.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAknq9CMACgkQniDOoMHTA+kqywCdEsrvtrZsJ/my1kTQzB+R+rmD EBkAn1xyolDZhG0oDTEAAPRqSN/liDHG =j8Rw -----END PGP SIGNATURE----- --------------enig853F8A8DE8FE99568F099A1F--