From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiJWH-0000OQ-KG for qemu-devel@nongnu.org; Fri, 31 May 2013 03:13:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiJWG-0008GG-HW for qemu-devel@nongnu.org; Fri, 31 May 2013 03:13:01 -0400 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:35317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiJWG-0008G3-Ab for qemu-devel@nongnu.org; Fri, 31 May 2013 03:13:00 -0400 Received: by mail-ea0-f169.google.com with SMTP id m14so1239195eaj.0 for ; Fri, 31 May 2013 00:12:59 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51A84D6F.4020207@redhat.com> Date: Fri, 31 May 2013 09:12:47 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1369948629-2833-1-git-send-email-pbonzini@redhat.com> <1369948629-2833-11-git-send-email-pbonzini@redhat.com> <51A849A5.70802@ozlabs.ru> In-Reply-To: <51A849A5.70802@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-devel@nongnu.org Il 31/05/2013 08:56, Alexey Kardashevskiy ha scritto: > On 05/31/2013 07:16 AM, Paolo Bonzini wrote: >> So far, the size of all regions passed to listeners could fit in 64 bits, >> because artificial regions (containers and aliases) are eliminated by >> the memory core, leaving only device regions which have reasonable sizes >> >> An IOMMU however cannot be eliminated by the memory core, and may have >> an artificial size, hence we may need 65 bits to represent its size. >> >> Signed-off-by: Paolo Bonzini > > [...] > >> diff --git a/kvm-all.c b/kvm-all.c >> index 8222729..86c9af3 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -316,7 +316,7 @@ static void kvm_log_start(MemoryListener *listener, >> int r; >> >> r = kvm_dirty_pages_log_change(section->offset_within_address_space, >> - section->size, true); >> + int128_get64(section->size), true); >> if (r < 0) { >> abort(); >> } >> @@ -328,7 +328,7 @@ static void kvm_log_stop(MemoryListener *listener, >> int r; >> >> r = kvm_dirty_pages_log_change(section->offset_within_address_space, >> - section->size, false); >> + int128_get64(section->size), false); >> if (r < 0) { >> abort(); >> } >> @@ -366,7 +366,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, >> unsigned int i, j; >> unsigned long page_number, c; >> hwaddr addr, addr1; >> - unsigned int len = ((section->size / getpagesize()) + HOST_LONG_BITS - 1) / HOST_LONG_BITS; >> + unsigned int pages = int128_get64(section->size) / getpagesize(); >> + unsigned int len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS; >> unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE; >> >> /* >> @@ -409,7 +410,7 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section) >> KVMSlot *mem; >> int ret = 0; >> hwaddr start_addr = section->offset_within_address_space; >> - hwaddr end_addr = start_addr + section->size; >> + hwaddr end_addr = start_addr + int128_get64(section->size); >> >> d.dirty_bitmap = NULL; >> while (start_addr < end_addr) { >> @@ -619,7 +620,7 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add) >> MemoryRegion *mr = section->mr; >> bool log_dirty = memory_region_is_logging(mr); >> hwaddr start_addr = section->offset_within_address_space; >> - ram_addr_t size = section->size; >> + ram_addr_t size = int128_get64(section->size); >> void *ram = NULL; >> unsigned delta; >> > > Tried to replay part2 and part3 on qemu.org/master (I assume part1 is > already there), part2 played well, part3 failed. What did I do wrong? Thanks. Needs a rebase, it seems. I'll push to the iommu branch later today and repost this patch. Paolo