From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxbTn-0007GV-8R for qemu-devel@nongnu.org; Fri, 12 Jul 2013 07:25:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UxbTj-00035N-2d for qemu-devel@nongnu.org; Fri, 12 Jul 2013 07:25:38 -0400 References: <1373614639-15523-1-git-send-email-aik@ozlabs.ru> <51DFC569.4070507@ozlabs.ru> Mime-Version: 1.0 (1.0) In-Reply-To: <51DFC569.4070507@ozlabs.ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <1BA59720-3135-439F-9594-36A7EE170AAE@suse.de> From: Alexander Graf Date: Fri, 12 Jul 2013 13:25:27 +0200 Subject: Re: [Qemu-devel] BUG report Re: [PATCH] spapr-pci: change endianness for io ports space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: "qemu-devel@nongnu.org" , "qemu-ppc@nongnu.org" , Jan Kiszka , Paolo Bonzini , David Gibson Am 12.07.2013 um 10:59 schrieb Alexey Kardashevskiy : > Hi! > > Got a small lesson from Ben how to post stuff to the list and here are more > details :) > > Every PCI device which uses IO ports (at least vga, e1000, virtio-pci, > rtl8139) is broken in the master branch of QEMU for powerpc-kvm. The > problem is exactly with endianness. For example, setup_vq() from > drivers/virtio/virtio_pci.c (guest kernel) fails on: > > iowrite16(msix_vec, vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR); > > as QEMU receives msix_vec==0x100 instead of 0x1 in virtio_ioport_write(). > > The patch which broke it is b40acf99bef69fa8ab0f9092ff162fde945eec12 > "ioport: Switch dispatching to memory core layer". > > The patch below fixes this but I am not really sure it is correct. Is it? It is not. Please read my mail on the topic. Alex > Thanks. > > > On 07/12/2013 05:37 PM, Alexey Kardashevskiy wrote: >> sPAPR PHB emulates IO ports on PCI via a special memory region which >> routes all reads/writes further via cpu_in*/cpu_out* which are eventually >> processed by MemoryRegionOps implemented by devices. >> >> As devices normally take care of endianness themselves by setting >> correct MemoryRegionOps::endianness for their memory regions, it is >> better to set endianness in spapr_io_ops to NATIVE. >> >> Tested on sPAPR KVM with e1000, rtl8139, virtio-net. >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> >> I would really appreciate if someone told me what exactly changed >> in QEMU and broke spapr-pci. It used to work... Thanks! >> >> --- >> hw/ppc/spapr_pci.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c >> index ca588aa..dfe4d04 100644 >> --- a/hw/ppc/spapr_pci.c >> +++ b/hw/ppc/spapr_pci.c >> @@ -472,7 +472,7 @@ static void spapr_io_write(void *opaque, hwaddr addr, >> } >> >> static const MemoryRegionOps spapr_io_ops = { >> - .endianness = DEVICE_LITTLE_ENDIAN, >> + .endianness = DEVICE_NATIVE_ENDIAN, >> .read = spapr_io_read, >> .write = spapr_io_write >> }; > > > -- > Alexey