From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCSKU-0006C2-2m for qemu-devel@nongnu.org; Thu, 22 Aug 2013 06:41:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCSKL-0001S6-7K for qemu-devel@nongnu.org; Thu, 22 Aug 2013 06:41:26 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:35194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCSKL-0001Rt-0j for qemu-devel@nongnu.org; Thu, 22 Aug 2013 06:41:17 -0400 Received: by mail-pd0-f175.google.com with SMTP id q10so1001517pdj.6 for ; Thu, 22 Aug 2013 03:41:15 -0700 (PDT) Message-ID: <5215EAC5.3050101@ozlabs.ru> Date: Thu, 22 Aug 2013 20:41:09 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1377159632-7446-1-git-send-email-aik@ozlabs.ru> <1377159632-7446-4-git-send-email-aik@ozlabs.ru> <5215D5D8.6070205@redhat.com> In-Reply-To: <5215D5D8.6070205@redhat.com> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/3] vfio: Fix 128 bit handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Alex Williamson , qemu-devel@nongnu.org On 08/22/2013 07:11 PM, Paolo Bonzini wrote: > Il 22/08/2013 10:20, Alexey Kardashevskiy ha scritto: >> iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); >> - end = (section->offset_within_address_space + int128_get64(section->size)) & >> - TARGET_PAGE_MASK; >> + llend = int128_make64(section->offset_within_address_space); >> + llend = int128_add(llend, section->size); >> + llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); >> >> - if (iova >= end) { >> + if (int128_ge(int128_make64(iova), llend)) { >> return; >> } >> >> + end = (section->offset_within_address_space + int128_get64(section->size)) & >> + TARGET_PAGE_MASK; >> + > > This can still fail for section->size = 2^64. Do your IOMMU patches > take care of it? Nope. That part works for IOMMU mapped to RAM which is smaller than 2^64 bytes and therefore I do not see why we would need 2^64 bits sizes there. Either way, I cannot test it quick (yes, I know, I should have some x86 VFIO setup by hand as everyone has a lot of x86, etc...) so I decided to leave to the moment when x86 folks hit the problem :) -- Alexey