From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCSqC-0001at-KE for qemu-devel@nongnu.org; Thu, 22 Aug 2013 07:14:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCSq6-00054D-Jk for qemu-devel@nongnu.org; Thu, 22 Aug 2013 07:14:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCSq6-00053n-Ar for qemu-devel@nongnu.org; Thu, 22 Aug 2013 07:14:06 -0400 Message-ID: <5215F253.3050205@redhat.com> Date: Thu, 22 Aug 2013 13:13:23 +0200 From: Paolo Bonzini 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> <5215EAC5.3050101@ozlabs.ru> In-Reply-To: <5215EAC5.3050101@ozlabs.ru> 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: Alexey Kardashevskiy Cc: Alex Williamson , qemu-devel@nongnu.org Il 22/08/2013 12:41, Alexey Kardashevskiy ha scritto: > 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. Understood. So the IOMMU patches take care of it because this code is only used for non-IOMMU regions. Thanks, Paolo > 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 :) > >