From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV4po-00052t-Iy for qemu-devel@nongnu.org; Mon, 28 Nov 2011 12:17:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RV4pn-0006U0-2r for qemu-devel@nongnu.org; Mon, 28 Nov 2011 12:17:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV4pm-0006Tu-PX for qemu-devel@nongnu.org; Mon, 28 Nov 2011 12:17:39 -0500 Message-ID: <4ED3C22E.1070607@redhat.com> Date: Mon, 28 Nov 2011 19:17:34 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1322492805-5530-1-git-send-email-afaerber@suse.de> In-Reply-To: <1322492805-5530-1-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] exec.c: Fix subpage memory access to RAM MemoryRegion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: Blue Swirl , qemu-devel@nongnu.org, Gleb Natapov On 11/28/2011 05:06 PM, Andreas F=C3=A4rber wrote: > Commit 95c318f5e1f88d7e5bcc6deac17330fd4806a2d3 (Fix segfault in mmio s= ubpage > handling code.) prevented a segfault by making all subpage registration= s > over an existing memory page perform an unassigned access. Symptoms wer= e > writes not taking effect and reads returning zero. > > Very small page sizes are not currently supported either, so subpage me= mory > areas cannot fully be avoided. > > Therefore revert the previous fix and defer recognition of IO_MEM_RAM t= o > subpage_{read,write}len() and translate any access there. > > Signed-off-by: Andreas F=C3=A4rber > Cc: Avi Kivity > Cc: Gleb Natapov > Cc: Blue Swirl > --- > exec.c | 33 +++++++++++++++++++++++++++++++-- > 1 files changed, 31 insertions(+), 2 deletions(-) > > diff --git a/exec.c b/exec.c > index 6b92198..fba5ba1 100644 > --- a/exec.c > +++ b/exec.c > @@ -3508,6 +3508,21 @@ static inline uint32_t subpage_readlen (subpage_= t *mmio, > =20 > addr +=3D mmio->region_offset[idx]; > idx =3D mmio->sub_io_index[idx]; > + if (unlikely(idx =3D=3D IO_MEM_RAM)) { IMO, io_mem_init() should have something like cpu_register_io_memory_fixed(IO_MEM_SUBPAGE_RAM, subpage_ram_read, subpage_ram_write, ...); so you don't need those ugly switches; you just convert IO_MEM_RAM to IO_MEM_SUBPAGE_RAM. Maybe even register IO_MEM_RAM itself. Note need to handle dirty logging carefully. --=20 error compiling committee.c: too many arguments to function