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



Reply via email to