From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVmBp-0005xv-Ul for qemu-devel@nongnu.org; Wed, 30 Nov 2011 10:35:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVmBn-0006Fr-Pm for qemu-devel@nongnu.org; Wed, 30 Nov 2011 10:35:17 -0500 Received: from cantor2.suse.de ([195.135.220.15]:58476 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVmBn-0006FA-HK for qemu-devel@nongnu.org; Wed, 30 Nov 2011 10:35:15 -0500 Message-ID: <4ED64D02.5090205@suse.de> Date: Wed, 30 Nov 2011 16:34:26 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1322492805-5530-1-git-send-email-afaerber@suse.de> <4ED3C22E.1070607@redhat.com> <4ED40DB6.3020701@suse.de> <4ED4AB4A.2010209@redhat.com> In-Reply-To: <4ED4AB4A.2010209@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 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: Avi Kivity Cc: qemu-devel Developers Am 29.11.2011 10:52, schrieb Avi Kivity: > On 11/29/2011 12:39 AM, Andreas F=E4rber wrote: >> Am 28.11.2011 18:17, schrieb Avi Kivity: >>> On 11/28/2011 05:06 PM, Andreas F=E4rber wrote: >>>> 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 (subpa= ge_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 nee= d >>> to handle dirty logging carefully. >> >> That didn't work because cpu_register_io_memory_fixed() is called from >> subpage_init(), which is called once for the whole page only, and the >> actual subpages are set up with multiple calls to subpage_register() >> instead. >=20 > I don't mean replacing the subpage handle with a call to c_r_io_m_f(); > just make the handle that is placed supage_t::sub_io_index have real io > callbacks. >=20 > In io_mem_init(), call cpu_register_io_memory_fixed() with a new > mem_read[] callback array an the existing notdirty_mem_write[] array.=20 > In subpage_register(), if we get an IO_MEM_RAM, convert it to > IO_MEM_SUBPAGE_RAM (and copy the 'memory' to region_offset). Sorry, I simply misunderstood your suggestion (memory newbie): Since we *continue* to go through subpage_{read,write}len(), we don't need a specific opaque value any longer so can do this from generic code. v2 sent out. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg