From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UljN7-0000g9-4z for qemu-devel@nongnu.org; Sun, 09 Jun 2013 13:25:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UljN5-0007Ru-Nz for qemu-devel@nongnu.org; Sun, 09 Jun 2013 13:25:40 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41955 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UljN4-0007Rg-RI for qemu-devel@nongnu.org; Sun, 09 Jun 2013 13:25:39 -0400 Message-ID: <51B4BA8C.3070601@suse.de> Date: Sun, 09 Jun 2013 19:25:32 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1370794247-28267-1-git-send-email-afaerber@suse.de> <1370794247-28267-18-git-send-email-afaerber@suse.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-cpu v4 17/18] memory_mapping: Use hwaddr type for MemoryMapping virt_addr field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qiaonuohan@cn.fujitsu.com, qemu-devel@nongnu.org, lcapitulino@redhat.com Am 09.06.2013 19:17, schrieb Peter Maydell: > On 9 June 2013 17:10, Andreas F=C3=A4rber wrote: >> The memory mapping API uses hwaddr, so use it in the struct, too. >> This avoids a header dependency on target_ulong type. >=20 >> --- a/include/sysemu/memory_mapping.h >> +++ b/include/sysemu/memory_mapping.h >> @@ -20,7 +20,7 @@ >> /* The physical and virtual address in the memory mapping are contigu= ous. */ >> typedef struct MemoryMapping { >> hwaddr phys_addr; >> - target_ulong virt_addr; >> + hwaddr virt_addr; >> ram_addr_t length; >=20 > This seems kind of odd given that HACKING specifically > says that target_ulong is for virtual addresses and hwaddr > for physical addresses. And in fact all the places that call > memory_mapping_list_add_merge_sorted() actually pass a > target_ulong as the virt_addr parameter, so maybe what we > should be fixing is the function prototype? Maybe. The benefit with going with the overwhelming use of hwaddr is that memory_mapping.o can be compiled once for all targets, saving compilation time. The benefit of target_ulong would be saving a few bytes for 32-bit targets at runtime. > Incidentally that use of ram_addr_t for length looks > kind of suspicious to me; it should probably be a hwaddr. Looking at it strictly from a CPU and build perspective I'll happily leave further code cleanups to someone else. :) Somewhere there's also a misspelling of "memory" left to fix. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg