From patchwork Wed Aug 28 11:13:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 270459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 721B72C009C for ; Wed, 28 Aug 2013 21:13:39 +1000 (EST) Received: from localhost ([::1]:33432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEdgv-0001UC-Jr for incoming@patchwork.ozlabs.org; Wed, 28 Aug 2013 07:13:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEdgX-0001QR-LE for qemu-devel@nongnu.org; Wed, 28 Aug 2013 07:13:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEdgR-0007wB-CF for qemu-devel@nongnu.org; Wed, 28 Aug 2013 07:13:13 -0400 Received: from hall.aurel32.net ([88.191.116.210]:34662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEdgR-0007v6-5t for qemu-devel@nongnu.org; Wed, 28 Aug 2013 07:13:07 -0400 Received: from aurel32 by hall.aurel32.net with local (Exim 4.80) (envelope-from ) id 1VEdgN-000614-Gj; Wed, 28 Aug 2013 13:13:03 +0200 Date: Wed, 28 Aug 2013 13:13:03 +0200 From: Aurelien Jarno To: Paolo Bonzini Message-ID: <20130828111303.GA11702@hall.aurel32.net> References: <1374501278-31549-1-git-send-email-pbonzini@redhat.com> <1374501278-31549-9-git-send-email-pbonzini@redhat.com> <20130828110301.GD5908@ohm.aurel32.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130828110301.GD5908@ohm.aurel32.net> X-Mailer: Mutt 1.5.21 (2010-09-15) User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.191.116.210 Cc: aliguori@us.ibm.com, aik@ozlabs.ru, jan.kiszka@siemens.com, qemu-devel@nongnu.org, agraf@suse.de, hpoussin@reactos.org Subject: Re: [Qemu-devel] [PATCH 08/28] mips_malta: do not use isa_mmio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. 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,