From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZdfC-0003lu-A7 for qemu-devel@nongnu.org; Wed, 12 Mar 2008 22:59:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZdfA-0003hf-JB for qemu-devel@nongnu.org; Wed, 12 Mar 2008 22:59:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZdfA-0003hW-EZ for qemu-devel@nongnu.org; Wed, 12 Mar 2008 22:59:24 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JZdfA-0004uX-6R for qemu-devel@nongnu.org; Wed, 12 Mar 2008 22:59:24 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m2D2xIku000602 for ; Wed, 12 Mar 2008 22:59:18 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m2D2xIhF164498 for ; Wed, 12 Mar 2008 22:59:18 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m2D2xIT6019693 for ; Wed, 12 Mar 2008 22:59:18 -0400 Subject: Re: [Qemu-devel] Re: [PATCH] e1000: fix endianness issues From: Hollis Blanchard In-Reply-To: <20080312220755.GA12033@volta.aurel32.net> References: <1204910632.2876.12.camel@basalt> <20080308135946.GA7387@hall.aurel32.net> <1204996128.5742.21.camel@basalt> <20080311224925.GA8753@volta.aurel32.net> <1205329920.16914.20.camel@diesel> <20080312143855.GA10824@hall.aurel32.net> <20080312220755.GA12033@volta.aurel32.net> Content-Type: text/plain Date: Wed, 12 Mar 2008 21:59:16 -0500 Message-Id: <1205377156.9736.41.camel@basalt> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: Hollis Blanchard , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: kvm-ppc-devel , qemu-devel@nongnu.org On Wed, 2008-03-12 at 23:07 +0100, Aurelien Jarno wrote: > > We finally found the problem with rtl8139 emulation. The byteswapping > depending on the target was not done for all registers. The 8139too > driver was able to cope with that, but not the 8139cp. In his patch > Hollis addressed the issue by byteswapping accesses to all registers, > but depending the host endianness (cpu_to_ and _to_cpu functions) > instead of the target endianness. This was working correctly in his > case, as he tested it on both big endian target and hosts. > > Byte swapping does not depend on host endianness nor target endianness > but on the path from the CPU to the device, which is currently and > *wrongly* implemented in Qemu as a byteswap on big endian targets. > This > has to be fixed by providing a layer modeling the endianness. It has > to > maintain a bus network/tree, so it can invert the endianness of all > the > devices behind a PCI host controller or a PCI bridge. It also has to > be > dynamic, as some chipsets (e.g. gt64xxx) have a configurable bit that > can be changed at runtime to control the endianness. > > Before it is implemented correctly, please find attached two patches > to > fix the rtl8139 and e1000 emulations on big endian hosts and big > endian > targets, using the current and *wrong* Qemu implementation with regard > to endianness. Hopefully that works as all the systems we support > happen > to do the same thing. Thanks for pursuing this Aurelien. Although patches that replace cpu_to_* with TARGET_WORDS_BIGENDIAN usage make me cringe, these patches do indeed seem to fix BE/BE host/target behavior right now. -- Hollis Blanchard IBM Linux Technology Center