From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkMGQ-000550-EW for qemu-devel@nongnu.org; Mon, 20 Apr 2015 20:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkMGM-00068D-Db for qemu-devel@nongnu.org; Mon, 20 Apr 2015 20:42:10 -0400 Date: Tue, 21 Apr 2015 10:24:48 +1000 From: David Gibson Message-ID: <20150421002448.GA31815@voom.redhat.com> References: <1429544096-1387-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline In-Reply-To: <1429544096-1387-1-git-send-email-thuth@redhat.com> Subject: Re: [Qemu-devel] [PATCH] hw/ppc/spapr_iommu: Fix the check for invalid upper bits in liobn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 20, 2015 at 05:34:56PM +0200, Thomas Huth wrote: > The check "liobn & 0xFFFFFFFF00000000ULL" in spapr_tce_find_by_liobn() > is completely useless since liobn is only declared as an uint32_t > parameter. Fix this by using target_ulong instead (this is what most > of the callers of this function are using, too). > And while we're at it, change the error message printing into a proper > qemu_log_mask(LOG_GUEST_ERROR, ...) call so that it is also possible > to enable this warning without recompiling the binary. >=20 > Signed-off-by: Thomas Huth > --- > hw/ppc/spapr_iommu.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c > index f3990fd..cd26a06 100644 > --- a/hw/ppc/spapr_iommu.c > +++ b/hw/ppc/spapr_iommu.c > @@ -41,18 +41,19 @@ enum sPAPRTCEAccess { > =20 > static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; > =20 > -static sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn) > +static sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn) > { > sPAPRTCETable *tcet; > =20 > if (liobn & 0xFFFFFFFF00000000ULL) { > - hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx= "\n", > + qemu_log_mask(LOG_GUEST_ERROR, > + "Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx= "\n", > liobn); I'd actually prefer to see this left for the time being. The dprintf stuff may be ugly, but it's used throughout this stuff, whereas the qemu logging is not. Plus I've found the qemu logging stuff (as opposed to the tracepoint stuff) to be a pain to actually use. So I'd prefer that you just fix the mask bug, and we look at a different patch to change the logging of the spapr stuff en masse. > return NULL; > } > =20 > QLIST_FOREACH(tcet, &spapr_tce_tables, list) { > - if (tcet->liobn =3D=3D liobn) { > + if (tcet->liobn =3D=3D (uint32_t)liobn) { > return tcet; > } > } --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --tKW2IUtsqtDRztdT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVNZjQAAoJEGw4ysog2bOS55YP/A/S6/FpxH86VkN4Y5cAVleJ vG6n52irun7OD7kLaUVVszdfDqGFpE7Hjj0dRpLyZXDtN2zk8TWZHkzV05l7/0XC xdRg4ANGoFcKMQT7t9U8Ak/Q6x4cjZGpwQOb8aQylgXHsNGnqT6hLWfJTC3La0L5 OV9fpLr/o9oEzDrahXiA/LUS45nuoOhoi+OVCPGfMwtvrIDzQlPP1kVm3jwezUBR sw2XJpdkdZMsKSJs1+K0C9i5HcUoi1TXqPFCMxkDL/Ag+H6Xoap1n9Q1eMoyY6NZ +lL8o5ms1nO2F1c9vGaxRBFJLG0dk/9V4PiXbbdyW/+IPIEdIYaLTLwwmTqK22iz KkYvPA6SHmIyzmZkiFsy1NtSCpi9PcRrMXmzZAfPGVu2n4v2lw7AevsRH4twNA5L LGhPLxJWwJOz7ALrgtLzXZBQC4e3DaedW9TTPanZ7Q+8lRP8UMM58OuPKdjy77Xd jJVIH0ju9FItzrhVoVxNZ22jSQFvBkVamnSvI0qkL4b7gPUyIlFjydedMyo5IdIy FhgvlN+CjNPXt+8LiyRCYBz/ZqZjXLEb+ynDW1ahEksLCrIFjOoyOT7FiVxgTHFx N6QsAagKqB2hj8yP5PgKuYhZKkx/xPXzHW7Gl1jtNHanmgwYLQO8YrzHkHjf6dIU ixf9CRcxa5RdcbY3DcwR =M/Cx -----END PGP SIGNATURE----- --tKW2IUtsqtDRztdT--