From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuNG0-0002f5-AB for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuNFw-0001jJ-Ec for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:24 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:48986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuNFw-0001ix-5O for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:20 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Nov 2015 16:19:19 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 05F8A17D805F for ; Thu, 5 Nov 2015 16:19:19 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tA5GJ2rJ64880720 for ; Thu, 5 Nov 2015 16:19:02 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tA5GJ1Li021301 for ; Thu, 5 Nov 2015 09:19:02 -0700 From: Pierre Morel Date: Thu, 5 Nov 2015 17:18:57 +0100 Message-Id: <1446740339-31366-6-git-send-email-pmorel@linux.vnet.ibm.com> In-Reply-To: <1446740339-31366-1-git-send-email-pmorel@linux.vnet.ibm.com> References: <1446740339-31366-1-git-send-email-pmorel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 5/7] 128bit: adapt VFIO for UInt128 arithmetic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com, pmorel@linux.vnet.ibm.com, peter.maydell@linaro.org VFIO is using 128bit arithmetic for memory areas. Let's adapt to unsigned 128bit arithmetic. Signed-off-by: Pierre Morel --- hw/vfio/common.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 85ee9b0..f819cd5 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -318,7 +318,7 @@ static void vfio_listener_region_add(MemoryListener *listener, VFIOContainer *container = container_of(listener, VFIOContainer, iommu_data.type1.listener); hwaddr iova, end; - Int128 llend; + UInt128 llend; void *vaddr; int ret; @@ -326,7 +326,7 @@ static void vfio_listener_region_add(MemoryListener *listener, trace_vfio_listener_region_add_skip( section->offset_within_address_space, section->offset_within_address_space + - int128_get64(int128_sub(section->size, int128_one()))); + uint128_to_64(uint128_sub(section->size, uint128_one()))); return; } @@ -337,11 +337,11 @@ static void vfio_listener_region_add(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - llend = int128_make64(section->offset_within_address_space); - llend = int128_add(llend, section->size); - llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); + llend = uint128_from_64(section->offset_within_address_space); + llend = uint128_add(llend, section->size); + llend = uint128_and(llend, uint128_exts64(TARGET_PAGE_MASK)); - if (int128_ge(int128_make64(iova), llend)) { + if (uint128_ge(uint128_from_64(iova), llend)) { return; } @@ -351,7 +351,7 @@ static void vfio_listener_region_add(MemoryListener *listener, VFIOGuestIOMMU *giommu; trace_vfio_listener_region_add_iommu(iova, - int128_get64(int128_sub(llend, int128_one()))); + uint128_to_64(uint128_sub(llend, uint128_one()))); /* * FIXME: We should do some checking to see if the * capabilities of the host VFIO IOMMU are adequate to model @@ -388,7 +388,7 @@ static void vfio_listener_region_add(MemoryListener *listener, /* Here we assume that memory_region_is_ram(section->mr)==true */ - end = int128_get64(llend); + end = uint128_to_64(llend); vaddr = memory_region_get_ram_ptr(section->mr) + section->offset_within_region + (iova - section->offset_within_address_space); @@ -428,7 +428,7 @@ static void vfio_listener_region_del(MemoryListener *listener, trace_vfio_listener_region_del_skip( section->offset_within_address_space, section->offset_within_address_space + - int128_get64(int128_sub(section->size, int128_one()))); + uint128_to_64(uint128_sub(section->size, uint128_one()))); return; } @@ -460,7 +460,7 @@ static void vfio_listener_region_del(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - end = (section->offset_within_address_space + int128_get64(section->size)) & + end = (section->offset_within_address_space + uint128_to_64(section->size)) & TARGET_PAGE_MASK; if (iova >= end) { -- 1.7.1