From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxutX-0004F5-Vb for qemu-devel@nongnu.org; Mon, 29 Aug 2011 02:00:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxutW-0006T6-Kn for qemu-devel@nongnu.org; Mon, 29 Aug 2011 02:00:27 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:56841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxutW-0006T1-CU for qemu-devel@nongnu.org; Mon, 29 Aug 2011 02:00:26 -0400 Received: by fxbb27 with SMTP id b27so4597551fxb.4 for ; Sun, 28 Aug 2011 23:00:25 -0700 (PDT) Date: Mon, 29 Aug 2011 08:00:22 +0200 From: "Edgar E. Iglesias" Message-ID: <20110829060022.GB3166@zapo> References: <1314546216-26613-1-git-send-email-avi@redhat.com> <20110828203715.GB7244@zapo> <4E5B25D2.1080402@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E5B25D2.1080402@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 Mon, Aug 29, 2011 at 08:38:26AM +0300, Avi Kivity wrote: > 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 wasn't clear enough maybe, the code in question is running, but the set_readble is not having any effect AFAICT. The reads, that should come through via IO callbacks when switching mode are not getting through. Do you ever see pflash_read beeing called? Cheers