From patchwork Wed Oct 13 21:30:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Juergen Lock X-Patchwork-Id: 67741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 43F85B70D9 for ; Thu, 14 Oct 2010 08:35:09 +1100 (EST) Received: from localhost ([127.0.0.1]:51193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P68yX-0003Z6-B2 for incoming@patchwork.ozlabs.org; Wed, 13 Oct 2010 17:35:05 -0400 Received: from [140.186.70.92] (port=53866 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P68wv-0003VZ-Fc for qemu-devel@nongnu.org; Wed, 13 Oct 2010 17:33:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P68vv-00086r-2e for qemu-devel@nongnu.org; Wed, 13 Oct 2010 17:32:25 -0400 Received: from gelbbaer.kn-bremen.de ([78.46.108.116]:48451 helo=smtp.kn-bremen.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P68vu-00086f-QJ for qemu-devel@nongnu.org; Wed, 13 Oct 2010 17:32:23 -0400 Received: by smtp.kn-bremen.de (Postfix, from userid 10) id CD11B1E007E2; Wed, 13 Oct 2010 23:32:20 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.4/8.14.3) with ESMTP id o9DLUIct065168; Wed, 13 Oct 2010 23:30:18 +0200 (CEST) (envelope-from qemu-l@triton8.kn-bremen.de) Received: (from qemu-l@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id o9DLUHu2065167; Wed, 13 Oct 2010 23:30:17 +0200 (CEST) (envelope-from qemu-l) From: Juergen Lock Date: Wed, 13 Oct 2010 23:30:17 +0200 To: Blue Swirl Subject: Re: [Qemu-devel] [PATCH] (master, stable-0.13) zaurus: workaround for io base address rounded down Message-ID: <20101013213017.GA64867@triton8.kn-bremen.de> References: <201010122134.o9CLYoxu005707@triton8.kn-bremen.de> <4CB4DA82.3080805@codemonkey.ws> <20101013032837.GA14923@triton8.kn-bremen.de> <20101013191250.GA59919@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: qemu-devel@nongnu.org X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Wed, Oct 13, 2010 at 07:45:19PM +0000, Blue Swirl wrote: > On Wed, Oct 13, 2010 at 7:12 PM, Juergen Lock wrote: > > The 2nd scoop's base address (0x08800040) now gets rounded down to > > start of page which causes its io read/write callbacks to be passed > > addresses 0x40 higher than the code expects:  (as witnessed by > > "Bad register offset" messages and failure to attach the internal > > CF disk aka microdrive at least.) > > > > [There may be more bugs of this kind hiding in other targets, this > >  was just the one I tested...] > > The devices are passed an offset to base address. Perhaps the real > problem is that scoop_init registers too much MMIO: 0x1000, when the > real range should be only 0x28. Also the registers are in 4 byte > intervals and any access to address between the registers also > triggers a warning. > Well I just tried registering only 0x28 bytes and still got the messages: > What were the messages exactly? Excerpt: [...] scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 scoop_readb: Bad register offset 0x4c scoop_readb: Bad register offset 0x48 scoop_readb: Bad register offset 0x4c scoop_readb: Bad register offset 0x48 scoop_readb: Bad register offset 0x4c scoop_readb: Bad register offset 0x48 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. (The above patch together with the addr &= 0x3f changes works tho.) Thanx, :) Juergen --- a/hw/zaurus.c +++ b/hw/zaurus.c @@ -237,7 +241,7 @@ ScoopInfo *scoop_init(PXA2xxState *cpu, s->in = qemu_allocate_irqs(scoop_gpio_set, s, 16); iomemtype = cpu_register_io_memory(scoop_readfn, scoop_writefn, s); - cpu_register_physical_memory(target_base, 0x1000, iomemtype); + cpu_register_physical_memory(target_base, 0x28, iomemtype); register_savevm(NULL, "scoop", instance, 1, scoop_save, scoop_load, s); return s;