From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08ZT-0002LT-N6 for qemu-devel@nongnu.org; Fri, 19 Jul 2013 07:10:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V08ZS-0004AX-1Y for qemu-devel@nongnu.org; Fri, 19 Jul 2013 07:09:59 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:63538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08ZR-0004AT-Nr for qemu-devel@nongnu.org; Fri, 19 Jul 2013 07:09:57 -0400 Received: by mail-pb0-f48.google.com with SMTP id ma3so4288668pbc.35 for ; Fri, 19 Jul 2013 04:09:56 -0700 (PDT) Message-ID: <51E91E7D.1000302@ozlabs.ru> Date: Fri, 19 Jul 2013 21:09:49 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <51C75FA6.6080903@reactos.org> <51C7E21A.9090005@web.de> <8A36D64D-0625-49E1-9E59-391DAEEBD1FC@suse.de> In-Reply-To: <8A36D64D-0625-49E1-9E59-391DAEEBD1FC@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka , Paolo Bonzini Cc: Liu Ping Fan , Alexander Graf , qemu-devel , =?UTF-8?B?SGVydsOpIFBvdXNzaW5lYXU=?= , "Aneesh Kumar K.V" , "anthony@codemonkey.ws" , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Hi! This patch also breaks virtio on powerpc. I thought it was fixed (reverted?) in the master branch from qemu.org but it is still there. What did I miss? The problem comes from "-drive file=virtimg/fc18guest,if=virtio". My full command line is: ./qemu-system-ppc64 -L "qemu-ppc64-bios/" \ -trace "events=qemu_trace_events" \ -nodefaults \ -chardev "stdio,id=char1,signal=off,mux=on" \ -device "spapr-vty,id=ser1,chardev=char1" \ -mon "chardev=char1,mode=readline,id=mon1" \ -drive file=virtimg/fc18guest,if=virtio \ -m "1024" \ -machine "pseries" \ -nographic \ -vga "none" \ -enable-kvm This is what happens: SLOF ********************************************************************** QEMU Starting Build Date = Apr 30 2013 14:04:00 FW Version = git-8cfdfc43f4c4c8c8 Press "s" to enter Open Firmware. Populating /vdevice methods Populating /vdevice/nvram@71000000 NVRAM: size=65536, fetch=200E, store=200F Populating /vdevice/vty@71000001 Populating /pci@800000020000000 Adapters on 0800000020000000 00 0000 (D) : 1af4 1001 virtio [ block ] No NVRAM common partition, re-initializing... claim failed! Using default console: /vdevice/vty@71000001 Welcome to Open Firmware Copyright (c) 2004, 2011 IBM Corporation All rights reserved. This program and the accompanying materials are made available under the terms of the BSD License available at http://www.opensource.org/licenses/bsd-license.php Trying to load: from: disk ... virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! virtioblk_read: Access beyond end of device! [many of those] On 07/11/2013 10:29 PM, Alexander Graf wrote: > > On 24.06.2013, at 08:07, Jan Kiszka wrote: > >> On 2013-06-23 22:50, Hervé Poussineau wrote: >>> Jan Kiszka a écrit : >>>> From: Jan Kiszka >>>> >>>> The current ioport dispatcher is a complex beast, mostly due to the >>>> need to deal with old portio interface users. But we can overcome it >>>> without converting all portio users by embedding the required base >>>> address of a MemoryRegionPortio access into that data structure. That >>>> removes the need to have the additional MemoryRegionIORange structure >>>> in the loop on every access. >>>> >>>> To handle old portio memory ops, we simply install dispatching handlers >>>> for portio memory regions when registering them with the memory core. >>>> This removes the need for the old_portio field. >>>> >>>> We can drop the additional aliasing of ioport regions and also the >>>> special address space listener. cpu_in and cpu_out now simply call >>>> address_space_read/write. And we can concentrate portio handling in a >>>> single source file. >>>> >>>> Signed-off-by: Jan Kiszka >>>> --- >>> >>> ... >>> >>>> + >>>> +static void portio_write(void *opaque, hwaddr addr, uint64_t data, >>>> + unsigned size) >>>> +{ >>>> + MemoryRegionPortioList *mrpio = opaque; >>>> + const MemoryRegionPortio *mrp = find_portio(mrpio, addr, size, >>>> true); >>>> + >>>> + if (mrp) { >>>> + mrp->write(mrpio->portio_opaque, mrp->base + addr, data); >>>> + } else if (size == 2) { >>>> + mrp = find_portio(mrpio, addr, 1, true); >>>> + assert(mrp); >>>> + mrp->write(mrpio->portio_opaque, mrp->base + addr, data & 0xff); >>>> + mrp->write(mrpio->portio_opaque, mrp->base + addr + 1, data >>>>>> 8); >>>> + } >>>> +} >>>> + >>>> +static const MemoryRegionOps portio_ops = { >>>> + .read = portio_read, >>>> + .write = portio_write, >>>> + .valid.unaligned = true, >>>> + .impl.unaligned = true, >>>> +}; >>>> + >>> >>> You need to mark these operations as DEVICE_LITTLE_ENDIAN. >>> In portio_write above, you clearly assume that data is in LE format. >> >> Anything behind PIO is little endian, of course. Will add this. > > This patch breaks VGA on PPC as it is in master today. > > > Alex > >> >>> >>> This fixes PPC PReP emulation, which would otherwise be broken with this >>> patchset. >> >> Thanks, >> Jan >> >> > > -- Alexey