[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
- [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calculations, Pierre Morel, 2015/11/05
- [Qemu-devel] [PATCH 4/7] 128bit: adapt sparc mmu_helper for UInt128, Pierre Morel, 2015/11/05
- [Qemu-devel] [PATCH 1/7] int128: use unsigned 128 bit arithmetic, Pierre Morel, 2015/11/05
- [Qemu-devel] [PATCH 2/7] memory: modify memory size for an unsigned 128bit int, Pierre Morel, 2015/11/05
- [Qemu-devel] [PATCH 6/7] 128bit: adapt Virtio for UInt128 arithmetic, Pierre Morel, 2015/11/05
- [Qemu-devel] [PATCH 7/7] 128bits: some HW components use 128bit arithmetic., Pierre Morel, 2015/11/05
- [Qemu-devel] [PATCH 5/7] 128bit: adapt VFIO for UInt128 arithmetic,
Pierre Morel <=
- [Qemu-devel] [PATCH 3/7] 128bit: adapt core files for unsigned 128bits, Pierre Morel, 2015/11/05
- Re: [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calculations, Paolo Bonzini, 2015/11/05