Received: from eggs.gnu.org ([2001:4830:134:3::10]:52201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK3c0-0000xy-QY for qemu-devel@nongnu.org; Mon, 04 Jul 2016 09:08:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK3bw-0005Lf-Ij for qemu-devel@nongnu.org; Mon, 04 Jul 2016 09:08:31 -0400 Received: from 7.mo3.mail-out.ovh.net ([46.105.57.200]:47042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK3bw-0005LS-C5 for qemu-devel@nongnu.org; Mon, 04 Jul 2016 09:08:28 -0400 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 6F8E7FFB378 for ; Mon, 4 Jul 2016 15:08:27 +0200 (CEST) References: <1467634738-28642-1-git-send-email-clg@kaod.org> <1467634738-28642-2-git-send-email-clg@kaod.org> <8a6e0fd8-cd84-53c2-e230-a401ffac4212@kaod.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <0c7b846a-4c48-e894-ddcd-6fa39bb9f6c5@kaod.org> Date: Mon, 4 Jul 2016 15:08:16 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/7] tests: add a m25p80 test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Peter Crosthwaite , QEMU Developers , qemu-arm , Andrew Jeffery , =?UTF-8?Q?Marcin_Krzemi=c5=84ski?= On 07/04/2016 02:51 PM, Peter Maydell wrote: > On 4 July 2016 at 13:39, C=C3=A9dric Le Goater wrote: >> On 07/04/2016 02:24 PM, Peter Maydell wrote: >>> On 4 July 2016 at 13:18, C=C3=A9dric Le Goater wrote: >>>> This test uses the palmetto platform and the AST2400 SPI controller = to >>>> test the m25p80 flash module device model. The flash model is define= d >>>> by the platform (n25q256a) and it would be nice to find way to contr= ol >>>> it, using a property probably. >>> >>> >>>> +static inline void flash_writel(uint32_t data) >>>> +{ >>>> + data =3D cpu_to_be32(data); >>>> + memwrite(AST2400_FLASH_BASE, &data, 4); >>>> +} >>>> + >>>> +static inline uint32_t flash_readl(void) >>>> +{ >>>> + uint32_t data; >>>> + >>>> + memread(AST2400_FLASH_BASE, &data, 4); >>>> + return be32_to_cpu(data); >>>> +} >>> >>> These are weird. As per my question in the other thread, if you >>> were writing this as a piece of test code that ran natively >>> in the guest, how would you write it? >> >> Here is the uboot flash code : >> >> https://github.com/openbmc/u-boot/blob/v2016.05-aspeed-openbmc= /arch/arm/mach-aspeed/flash.c#L420 >> >> So these are doing byte per byte, but there is no reason not to do >> long. >=20 > If you want "write a long", that is what writel does, > and your test code should be able to use it in exactly > the same way native guest code would write a register > value with a str instruction. >=20 > It's very easy to work around endianness issues by > randomly changing things until the tests pass, but it's > much better to actually identify what you need to do > and where the code is diverging from that. I agree. Let's forget that patch until I have clarified how it should be done. Thanks, C.