From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MU5tL-00014t-D6 for qemu-devel@nongnu.org; Thu, 23 Jul 2009 17:31:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MU5tG-00013D-DA for qemu-devel@nongnu.org; Thu, 23 Jul 2009 17:31:54 -0400 Received: from [199.232.76.173] (port=39371 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU5tG-000138-8h for qemu-devel@nongnu.org; Thu, 23 Jul 2009 17:31:50 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36280 helo=mx2.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MU5tF-0005YZ-On for qemu-devel@nongnu.org; Thu, 23 Jul 2009 17:31:50 -0400 Received: from relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 085D986391 for ; Thu, 23 Jul 2009 23:31:47 +0200 (CEST) From: Alexander Graf Date: Thu, 23 Jul 2009 23:31:43 +0200 Message-Id: <1248384704-47824-3-git-send-email-agraf@suse.de> In-Reply-To: <1248384704-47824-2-git-send-email-agraf@suse.de> References: <1248384704-47824-1-git-send-email-agraf@suse.de> <1248384704-47824-2-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 2/3] Assume PPC64 host on PPC32 KVM List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org When talking to the kernel about dirty maps, we need to find out which bits were actually set. This is done by set_bit and test_bit like functiontality which uses the "long" variable type. Now, with PPC32 userspace and PPC64 kernel space (which is pretty common), we can't interpret the bits properly anymore, because we think long is 32 bits wide. So for PPC dirty bitmap analysis, let's just assume we're always running on a PPC64 host. Currently there is no dirty bitmap implementation for PPC32 / PPCEMB anyways. Unbreaks dirty logging on PPC. Signed-off-by: Alexander Graf --- kvm-all.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 824bb4c..bfaa623 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -357,7 +357,13 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, for (phys_addr = mem->start_addr, addr = mem->phys_offset; phys_addr < mem->start_addr + mem->memory_size; phys_addr += TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) { +#ifdef HOST_PPC + /* Big endian keeps us from having different long sizes in user and + * kernel space, so assume we're always on ppc64. */ + uint64_t *bitmap = (uint64_t *)d.dirty_bitmap; +#else unsigned long *bitmap = (unsigned long *)d.dirty_bitmap; +#endif unsigned nr = (phys_addr - mem->start_addr) >> TARGET_PAGE_BITS; unsigned word = nr / (sizeof(*bitmap) * 8); unsigned bit = nr % (sizeof(*bitmap) * 8); -- 1.6.0.2