qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com,
	pmorel@linux.vnet.ibm.com, peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH 6/7] 128bit: adapt Virtio for UInt128 arithmetic
Date: Thu,  5 Nov 2015 17:18:58 +0100	[thread overview]
Message-ID: <1446740339-31366-7-git-send-email-pmorel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1446740339-31366-1-git-send-email-pmorel@linux.vnet.ibm.com>

Virtio uses 128 bit arithmetic for memory areas.
Let's adapt to UInt128 bit arithmetic.

Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
---
 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

  parent reply	other threads:[~2015-11-05 16:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 16:18 [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calculations Pierre Morel
2015-11-05 16:18 ` [Qemu-devel] [PATCH 1/7] int128: use unsigned 128 bit arithmetic Pierre Morel
2015-11-05 16:18 ` [Qemu-devel] [PATCH 2/7] memory: modify memory size for an unsigned 128bit int Pierre Morel
2015-11-05 16:18 ` [Qemu-devel] [PATCH 3/7] 128bit: adapt core files for unsigned 128bits Pierre Morel
2015-11-05 16:18 ` [Qemu-devel] [PATCH 4/7] 128bit: adapt sparc mmu_helper for UInt128 Pierre Morel
2015-11-05 16:18 ` [Qemu-devel] [PATCH 5/7] 128bit: adapt VFIO for UInt128 arithmetic Pierre Morel
2015-11-05 16:18 ` Pierre Morel [this message]
2015-11-05 16:18 ` [Qemu-devel] [PATCH 7/7] 128bits: some HW components use 128bit arithmetic Pierre Morel
2015-11-05 16:32 ` [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calculations Paolo Bonzini
2015-11-06  8:36   ` Pierre Morel
2015-11-06 16:33     ` Paolo Bonzini
     [not found]       ` <56408B28.8070408@linux.vnet.ibm.com>
2015-11-09 12:20         ` Paolo Bonzini
2015-11-10  9:08           ` Pierre Morel
2015-11-10 12:12             ` Pierre Morel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446740339-31366-7-git-send-email-pmorel@linux.vnet.ibm.com \
    --to=pmorel@linux.vnet.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).