All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] BUG report Re: [PATCH] spapr-pci: change endianness for io ports space
Date: Fri, 12 Jul 2013 18:59:21 +1000	[thread overview]
Message-ID: <51DFC569.4070507@ozlabs.ru> (raw)
In-Reply-To: <1373614639-15523-1-git-send-email-aik@ozlabs.ru>

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?
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 <aik@ozlabs.ru>
> ---
> 
> 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

  reply	other threads:[~2013-07-12  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12  7:37 [Qemu-devel] [PATCH] spapr-pci: change endianness for io ports space Alexey Kardashevskiy
2013-07-12  8:59 ` Alexey Kardashevskiy [this message]
2013-07-12 11:25   ` [Qemu-devel] BUG report " Alexander Graf
2013-07-13  8:03 ` [Qemu-devel] " David Gibson
2013-07-14 13:22   ` Alexey Kardashevskiy
2013-07-15 15:02     ` Anthony Liguori
2013-07-15 23:06       ` Alexey Kardashevskiy
2013-07-16  0:28         ` Anthony Liguori
2013-07-16  0:39           ` Alexey Kardashevskiy
2013-07-16  2:05             ` Anthony Liguori
2013-07-16  2:17               ` Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51DFC569.4070507@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=jan.kiszka@siemens.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.