Received: from eggs.gnu.org ([2001:4830:134:3::10]:60163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTN5j-0007Hb-Jo for qemu-devel@nongnu.org; Thu, 14 Jun 2018 03:54:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTN5g-0005Y8-Hv for qemu-devel@nongnu.org; Thu, 14 Jun 2018 03:54:47 -0400 Date: Thu, 14 Jun 2018 09:54:41 +0200 (CEST) From: BALATON Zoltan In-Reply-To: <20180614012754.GB3042@umbus.fritz.box> Message-ID: References: <8c404c8c4ee1bfd2e4d079877d481094f797df8f.1528291908.git.balaton@eik.bme.hu> <6aa1bc4e-a4b0-d7be-b9eb-85dfe8c06781@amsat.org> <20180613041115.GS30690@umbus.fritz.box> <20180613100339.GK30690@umbus.fritz.box> <20180614012754.GB3042@umbus.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 5/8] hw/timer: Add basic M41T80 emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-ppc@nongnu.org, =?ISO-8859-15?Q?Philippe_Mathieu-Daud=E9?= , qemu-devel@nongnu.org On Thu, 14 Jun 2018, David Gibson wrote: > On Wed, Jun 13, 2018 at 04:13:57PM +0200, BALATON Zoltan wrote: >> I don't see the problem. The addr register selects the register to read or >> write. It is set by the first write when the device is accessed the first >> time (this is denoted by addr == -1 (or really any negative value). The >> device has 20 registers and trying to read any register outside addr between >> 0-19 will result in returning 0 and logging a warning about invalid register >> in m41t80_recv. What could fail here when guest sends garbage? It will set >> addr to invalid value and try to read non-exitent register and get an error >> just like for any other nonexistent value of addr (or start to read from >> register 0 if it manages to set a negative value). All writes of registers >> are ignored currently (except setting addr by the first write). What should >> be enforced here? > > Ah, I see your point. I mean strictly we should match the hardware > behaviour if you write garbage addresses here, but really I don't > think it matters much. Problem is like usual I have no idea what the real hardware does. I've only seen the datasheet, never seen real device and have no way to test. All the clients I've tested seem to be OK with the current emulation so unless someone has more info on how this should work I think we can live with this version and then fix it later if found to be needed. Regards, BALATON Zoltan