0a122b
From f792ee6d096426909f440421758e908460c18f77 Mon Sep 17 00:00:00 2001
0a122b
From: Juan Quintela <quintela@redhat.com>
0a122b
Date: Tue, 14 Jan 2014 15:07:47 +0100
0a122b
Subject: [PATCH 36/40] kvm: refactor start address calculation
0a122b
0a122b
RH-Author: Juan Quintela <quintela@redhat.com>
0a122b
Message-id: <1389712071-23303-37-git-send-email-quintela@redhat.com>
0a122b
Patchwork-id: 56691
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 36/40] kvm: refactor start address calculation
0a122b
Bugzilla: 997559
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
0a122b
0a122b
Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
0a122b
(cherry picked from commit c9dd46fc0d64d9f314aa3c220d4aff9d01ab778e)
0a122b
Signed-off-by: Juan Quintela <quintela@trasno.org>
0a122b
---
0a122b
 kvm-all.c | 8 ++++----
0a122b
 1 file changed, 4 insertions(+), 4 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 kvm-all.c |    8 ++++----
0a122b
 1 files changed, 4 insertions(+), 4 deletions(-)
0a122b
0a122b
diff --git a/kvm-all.c b/kvm-all.c
0a122b
index 8e2bd34..d3aa869 100644
0a122b
--- a/kvm-all.c
0a122b
+++ b/kvm-all.c
0a122b
@@ -367,7 +367,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
0a122b
 {
0a122b
     unsigned int i, j;
0a122b
     unsigned long page_number, c;
0a122b
-    hwaddr addr, addr1;
0a122b
+    hwaddr addr;
0a122b
+    ram_addr_t start = section->offset_within_region + section->mr->ram_addr;
0a122b
     ram_addr_t ram_addr;
0a122b
     unsigned int len = ((section->size / getpagesize()) + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
0a122b
     unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
0a122b
@@ -383,9 +384,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
0a122b
                 j = ffsl(c) - 1;
0a122b
                 c &= ~(1ul << j);
0a122b
                 page_number = (i * HOST_LONG_BITS + j) * hpratio;
0a122b
-                addr1 = page_number * TARGET_PAGE_SIZE;
0a122b
-                addr = section->offset_within_region + addr1;
0a122b
-                ram_addr = section->mr->ram_addr + addr;
0a122b
+                addr = page_number * TARGET_PAGE_SIZE;
0a122b
+                ram_addr = start + addr;
0a122b
                 cpu_physical_memory_set_dirty_range(ram_addr,
0a122b
                                                     TARGET_PAGE_SIZE * hpratio);
0a122b
             } while (c != 0);
0a122b
-- 
0a122b
1.7.1
0a122b