From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjSMg-0000fK-1z for qemu-devel@nongnu.org; Mon, 03 Jun 2013 06:51:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjSMb-0004z8-Cj for qemu-devel@nongnu.org; Mon, 03 Jun 2013 06:51:49 -0400 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]:65314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjSMb-0004yl-2V for qemu-devel@nongnu.org; Mon, 03 Jun 2013 06:51:45 -0400 Received: by mail-wg0-f50.google.com with SMTP id k13so3033035wgh.17 for ; Mon, 03 Jun 2013 03:51:44 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51AC7533.2030906@redhat.com> Date: Mon, 03 Jun 2013 12:51:31 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1370187812-13191-1-git-send-email-pbonzini@redhat.com> <1370187812-13191-15-git-send-email-pbonzini@redhat.com> <51AC3A60.5060501@redhat.com> In-Reply-To: <51AC3A60.5060501@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 14/15] memory: return MemoryRegion from qemu_ram_addr_from_host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Liu Ping Fan , qemu-devel@nongnu.org, jan.kiszka@siemens.com Il 03/06/2013 08:40, Paolo Bonzini ha scritto: > Il 02/06/2013 18:04, Peter Maydell ha scritto: >> On 2 June 2013 16:43, Paolo Bonzini wrote: >>> -int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr); >>> +MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr); >>> ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr); >> >> This is weird, because now the _nofail and the standard >> versions of this function return different things. Ah, actually that's not a change. The function used to return 0/-1 and place the address in a by-reference argument. It's a somewhat weird decision made when the normal and _nofail version were split (commit e890261, Export qemu_ram_addr_from_host, 2010-10-11). Returning -1 to indicate failure would have been ok, since it's not a valid ram_addr_t. >> Why wouldn't a caller of the _nofail version potentially >> need the MemoryRegion* too? Because there are just a handful of calls, and all of them are in cputlb.c which is not very much MemoryRegion-aware. I'll just move it there and make it static. The right fix here would be to make all the MCE handling code not KVM-specific. Then it can be in exec.c and ram_addr_t can be private (eliminating a good deal of confusion between it and hwaddr). Paolo