Received: from eggs.gnu.org ([2001:4830:134:3::10]:34930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuNFn-0002MJ-7C for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuNFj-0001aK-5h for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:11 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:38311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuNFi-0001Yw-Tt for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:07 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Nov 2015 16:19:06 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 27805219005E for ; Thu, 5 Nov 2015 16:18:59 +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 tA5GJ3ZW64880722 for ; Thu, 5 Nov 2015 16:19:03 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 tA5GJ1nb021314 for ; Thu, 5 Nov 2015 09:19:02 -0700 From: Pierre Morel Date: Thu, 5 Nov 2015 17:18:58 +0100 Message-Id: <1446740339-31366-7-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 6/7] 128bit: adapt Virtio 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 Virtio uses 128 bit arithmetic for memory areas. Let's adapt to UInt128 bit arithmetic. Signed-off-by: Pierre Morel --- hw/virtio/dataplane/vring.c | 2 +- hw/virtio/vhost.c | 4 ++-- hw/virtio/virtio-balloon.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 68f1994..2551a42 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -31,7 +31,7 @@ static void *vring_map(MemoryRegion **mr, hwaddr phys, hwaddr len, { MemoryRegionSection section = memory_region_find(get_system_memory(), phys, len); - if (!section.mr || int128_get64(section.size) < len) { + if (!section.mr || uint128_to_64(section.size) < len) { goto out; } if (is_write && section.readonly) { diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index a08c36b..143ea6f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -84,7 +84,7 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, return 0; } start_addr = section->offset_within_address_space; - end_addr = range_get_last(start_addr, int128_get64(section->size)); + end_addr = range_get_last(start_addr, uint128_to_64(section->size)); start_addr = MAX(first, start_addr); end_addr = MIN(last, end_addr); @@ -417,7 +417,7 @@ static void vhost_set_memory(MemoryListener *listener, struct vhost_dev *dev = container_of(listener, struct vhost_dev, memory_listener); hwaddr start_addr = section->offset_within_address_space; - ram_addr_t size = int128_get64(section->size); + ram_addr_t size = uint128_to_64(section->size); bool log_dirty = memory_region_get_dirty_log_mask(section->mr) & ~(1 << DIRTY_MEMORY_MIGRATION); int s = offsetof(struct vhost_memory, regions) + diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index c419b17..d0db511 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -220,7 +220,7 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq) /* FIXME: remove get_system_memory(), but how? */ section = memory_region_find(get_system_memory(), pa, 1); - if (!int128_nz(section.size) || !memory_region_is_ram(section.mr)) + if (!uint128_nz(section.size) || !memory_region_is_ram(section.mr)) continue; trace_virtio_balloon_handle_output(memory_region_name(section.mr), -- 1.7.1