From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEdxy-0006vg-Cb for qemu-devel@nongnu.org; Wed, 28 Aug 2013 07:31:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEdxr-0005sQ-71 for qemu-devel@nongnu.org; Wed, 28 Aug 2013 07:31:14 -0400 Received: from mail-ea0-f181.google.com ([209.85.215.181]:41504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEdxr-0005sE-07 for qemu-devel@nongnu.org; Wed, 28 Aug 2013 07:31:07 -0400 Received: by mail-ea0-f181.google.com with SMTP id d10so2856721eaj.26 for ; Wed, 28 Aug 2013 04:30:49 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <521DDF66.3030906@redhat.com> Date: Wed, 28 Aug 2013 13:30:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1374501278-31549-1-git-send-email-pbonzini@redhat.com> <1374501278-31549-9-git-send-email-pbonzini@redhat.com> <20130828110301.GD5908@ohm.aurel32.net> <20130828111303.GA11702@hall.aurel32.net> In-Reply-To: <20130828111303.GA11702@hall.aurel32.net> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 08/28] mips_malta: do not use isa_mmio List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: aliguori@us.ibm.com, aik@ozlabs.ru, jan.kiszka@siemens.com, qemu-devel@nongnu.org, agraf@suse.de, hpoussin@reactos.org Il 28/08/2013 13:13, Aurelien Jarno ha scritto: > On Wed, Aug 28, 2013 at 01:03:01PM +0200, Aurelien Jarno wrote: >> On Mon, Jul 22, 2013 at 03:54:18PM +0200, Paolo Bonzini wrote: >>> This fixes endianness bugs in I/O port access. >> >> It looks like it actually did the reverse, ie introducing endianness >> bugs. With this patch, the pcnet-pci NIC (default NIC card) doesn't work >> any more on big endian Malta, while it still works on little endian >> Malta. >> >> Reverting this commit fixes the issue for the pcnet card, but it makes >> the IDE controller to fail, likely due to endianness issues. >> >> This is reproducible using the following kernel and the following line: >> >> http://ftp.debian.org/debian/dists/wheezy/main/installer-mips/current/images/malta/netboot/vmlinux-3.2.0-4-4kc-malta >> qemu-system-mips -kernel vmlinux-3.2.0-4-4kc-malta -nographic >> >> In that case the boot log is: >> >> | [ 0.464000] pcnet32: pcnet32.c:v1.35 21.Apr.2008 tsbogend@alpha.franken.de >> | [ 0.464000] PCI: Enabling device 0000:00:0b.0 (0000 -> 0003) >> | [ 0.468000] pcnet32: No access methods >> >> Without this patch, the boot log is: >> >> | [ 0.524000] pcnet32: pcnet32.c:v1.35 21.Apr.2008 tsbogend@alpha.franken.de >> | [ 0.524000] PCI: Enabling device 0000:00:0b.0 (0000 -> 0003) >> | [ 0.524000] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56 assigned IRQ 10 >> | [ 0.528000] pcnet32: eth0: registered as PCnet/PCI II 79C970A >> | [ 0.532000] pcnet32: 1 cards_found >> > > It seems to be due to the fact that the pcnet-pci device is declared as > NATIVE_ENDIAN. I don't really understand why. Changing it to > LITTLE_ENDIAN as in the following patch also fixes the problem, but I am > not sure it is correct. Yes, it is. See patch 15 for an example of doing the same thing. Paolo > diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c > index a893165..865f2f0 100644 > --- a/hw/net/pcnet-pci.c > +++ b/hw/net/pcnet-pci.c > @@ -134,7 +134,7 @@ static void pcnet_ioport_write(void *opaque, hwaddr addr, > static const MemoryRegionOps pcnet_io_ops = { > .read = pcnet_ioport_read, > .write = pcnet_ioport_write, > - .endianness = DEVICE_NATIVE_ENDIAN, > + .endianness = DEVICE_LITTLE_ENDIAN, > }; > > static void pcnet_mmio_writeb(void *opaque, hwaddr addr, uint32_t val) > @@ -256,7 +256,7 @@ static const MemoryRegionOps pcnet_mmio_ops = { > .read = { pcnet_mmio_readb, pcnet_mmio_readw, pcnet_mmio_readl }, > .write = { pcnet_mmio_writeb, pcnet_mmio_writew, pcnet_mmio_writel }, > }, > - .endianness = DEVICE_NATIVE_ENDIAN, > + .endianness = DEVICE_LITTLE_ENDIAN, > }; > > static void pci_physical_memory_write(void *dma_opaque, hwaddr addr, >