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 7/7] 128bits: some HW components use 128bit arithmetic.
Date: Thu,  5 Nov 2015 17:18:59 +0100	[thread overview]
Message-ID: <1446740339-31366-8-git-send-email-pmorel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1446740339-31366-1-git-send-email-pmorel@linux.vnet.ibm.com>

Some HW components use 128bit arithmetic.
Let's adapt to unsigned 128 bit calculations.

Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
---
 hw/core/loader.c             |    2 +-
 hw/display/exynos4210_fimd.c |    4 ++--
 hw/display/framebuffer.c     |    2 +-
 hw/mem/pc-dimm.c             |    6 +++---
 hw/pci-host/ppce500.c        |    2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/core/loader.c b/hw/core/loader.c
index 216eeeb..97c7b54 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -953,7 +953,7 @@ int rom_check_and_register_reset(void)
         addr  = rom->addr;
         addr += rom->romsize;
         section = memory_region_find(get_system_memory(), rom->addr, 1);
-        rom->isrom = int128_nz(section.size) && memory_region_is_rom(section.mr);
+        rom->isrom = uint128_nz(section.size) && memory_region_is_rom(section.mr);
         memory_region_unref(section.mr);
     }
     qemu_register_reset(rom_reset, NULL);
diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
index 603ef50..dbedb45 100644
--- a/hw/display/exynos4210_fimd.c
+++ b/hw/display/exynos4210_fimd.c
@@ -1154,7 +1154,7 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)
     DPRINT_TRACE("Window %u framebuffer changed: address=0x%08x, len=0x%x\n",
             win, fb_start_addr, w->fb_len);
 
-    if (int128_get64(w->mem_section.size) != w->fb_len ||
+    if (uint128_to_64(w->mem_section.size) != w->fb_len ||
             !memory_region_is_ram(w->mem_section.mr)) {
         DPRINT_ERROR("Failed to find window %u framebuffer region\n", win);
         goto error_return;
@@ -1179,7 +1179,7 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)
 error_return:
     memory_region_unref(w->mem_section.mr);
     w->mem_section.mr = NULL;
-    w->mem_section.size = int128_zero();
+    w->mem_section.size = uint128_zero();
     w->host_fb_addr = NULL;
     w->fb_len = 0;
 }
diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c
index 7f075ce..19e3d39 100644
--- a/hw/display/framebuffer.c
+++ b/hw/display/framebuffer.c
@@ -41,7 +41,7 @@ void framebuffer_update_memory_section(
         return;
     }
 
-    if (int128_get64(mem_section->size) < src_len ||
+    if (uint128_to_64(mem_section->size) < src_len ||
             !memory_region_is_ram(mem_section->mr)) {
         memory_region_unref(mem_section->mr);
         mem_section->mr = NULL;
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index bb04862..0be2a18 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -260,11 +260,11 @@ static gint pc_dimm_addr_sort(gconstpointer a, gconstpointer b)
 {
     PCDIMMDevice *x = PC_DIMM(a);
     PCDIMMDevice *y = PC_DIMM(b);
-    Int128 diff = int128_sub(int128_make64(x->addr), int128_make64(y->addr));
+    UInt128 diff = uint128_sub(uint128_from_64(x->addr), uint128_from_64(y->addr));
 
-    if (int128_lt(diff, int128_zero())) {
+    if (uint128_lt(diff, uint128_zero())) {
         return -1;
-    } else if (int128_gt(diff, int128_zero())) {
+    } else if (uint128_gt(diff, uint128_zero())) {
         return 1;
     }
     return 0;
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index 613ba73..9002c51 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -428,7 +428,7 @@ static void e500_pcihost_bridge_realize(PCIDevice *d, Error **errp)
         PCI_HEADER_TYPE_BRIDGE;
 
     memory_region_init_alias(&b->bar0, OBJECT(ccsr), "e500-pci-bar0", &ccsr->ccsr_space,
-                             0, int128_get64(ccsr->ccsr_space.size));
+                             0, uint128_to_64(ccsr->ccsr_space.size));
     pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &b->bar0);
 }
 
-- 
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 ` [Qemu-devel] [PATCH 6/7] 128bit: adapt Virtio " Pierre Morel
2015-11-05 16:18 ` Pierre Morel [this message]
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-8-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).