From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qxm6b-0001NT-Ep for qemu-devel@nongnu.org; Sun, 28 Aug 2011 16:37:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qxm6a-0001CP-8o for qemu-devel@nongnu.org; Sun, 28 Aug 2011 16:37:21 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:53871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qxm6a-0001CK-0O for qemu-devel@nongnu.org; Sun, 28 Aug 2011 16:37:20 -0400 Received: by fxbb27 with SMTP id b27so4356469fxb.4 for ; Sun, 28 Aug 2011 13:37:19 -0700 (PDT) Date: Sun, 28 Aug 2011 22:37:15 +0200 From: "Edgar E. Iglesias" Message-ID: <20110828203715.GB7244@zapo> References: <1314546216-26613-1-git-send-email-avi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1314546216-26613-1-git-send-email-avi@redhat.com> 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: Avi Kivity Cc: qemu-devel@nongnu.org, Richard Henderson 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.. Cheers