qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/7] 128bit: adapt VFIO for UInt128 arithmetic


From: Pierre Morel
Subject: [Qemu-devel] [PATCH 5/7] 128bit: adapt VFIO for UInt128 arithmetic
Date: Thu, 5 Nov 2015 17:18:57 +0100

VFIO is using 128bit arithmetic for memory areas.
Let's adapt to unsigned 128bit arithmetic.

Signed-off-by: Pierre Morel <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]