From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxuYL-0007c4-DE for qemu-devel@nongnu.org; Mon, 29 Aug 2011 01:38:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxuYK-0003PQ-Bb for qemu-devel@nongnu.org; Mon, 29 Aug 2011 01:38:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxuYJ-0003PE-VN for qemu-devel@nongnu.org; Mon, 29 Aug 2011 01:38:32 -0400 Message-ID: <4E5B25D2.1080402@redhat.com> Date: Mon, 29 Aug 2011 08:38:26 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1314546216-26613-1-git-send-email-avi@redhat.com> <20110828203715.GB7244@zapo> In-Reply-To: <20110828203715.GB7244@zapo> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] pflash_cfi01/pflash_cfi02: convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: qemu-devel@nongnu.org, Richard Henderson On 08/28/2011 11:37 PM, Edgar E. Iglesias wrote: > On Sun, Aug 28, 2011 at 06:43:36PM +0300, Avi Kivity wrote: > > cfi02 is annoying in that is ignores some address bits; we probably > > want explicit support in the memory API for that. > > > > In order to get the correct opaque into the MemoryRegion object, the > > allocation scheme is changed so that the flash emulation code allocates > > memory, instead of the caller. This clears a FIXME in the flash code. > > > > Signed-off-by: Avi Kivity > > --- > > > > > diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c > > index 90e1301..b597304 100644 > > --- a/hw/pflash_cfi01.c > > +++ b/hw/pflash_cfi01.c > > @@ -40,6 +40,7 @@ > > #include "flash.h" > > #include "block.h" > > #include "qemu-timer.h" > > +#include "exec-memory.h" > > > > #define PFLASH_BUG(fmt, ...) \ > > do { \ > > @@ -74,8 +75,7 @@ struct pflash_t { > > target_phys_addr_t counter; > > unsigned int writeblock_size; > > QEMUTimer *timer; > > - ram_addr_t off; > > - int fl_mem; > > + MemoryRegion mem; > > void *storage; > > }; > > > > @@ -89,8 +89,7 @@ static void pflash_timer (void *opaque) > > if (pfl->bypass) { > > pfl->wcycle = 2; > > } else { > > - cpu_register_physical_memory(pfl->base, pfl->total_len, > > - pfl->off | IO_MEM_ROMD | pfl->fl_mem); > > + memory_region_rom_device_set_readable(&pfl->mem, true); > > pfl->wcycle = 0; > > } > > pfl->cmd = 0; > > @@ -263,7 +262,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, > > > > if (!pfl->wcycle) { > > /* Set the device in I/O access mode */ > > - cpu_register_physical_memory(pfl->base, pfl->total_len, pfl->fl_mem); > > + memory_region_rom_device_set_readable(&pfl->mem, false); > > } > > I get the impression that this one is not biting. Reads are not reaching > the IO callbacks at times when they should.. > It does bite, as I saw with gdb. You can even see that from the qemu error - it complains about unimplemented command 0xf0, that comes from pflash_write() later on. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.