public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Liu Yu-B13201 <Yu.Liu@freescale.com>
Cc: kvm-ppc@vger.kernel.org, kvm <kvm@vger.kernel.org>
Subject: Re: Virtio_pci in kernel ignore endian of PCI I/O space?
Date: Tue, 02 Sep 2008 09:15:56 -0500	[thread overview]
Message-ID: <1220364956.26357.33.camel@localhost.localdomain> (raw)
In-Reply-To: <C6FABC699EA2354EB260110329F4B35508F638@zch01exm26.fsl.freescale.net>

On Tue, 2008-09-02 at 15:29 +0800, Liu Yu-B13201 wrote:
> Hollis,
> 
> I noticed fuction virtio_blk_update_config() (qemu/hw/virtio-blk.c) in
> qemu
> updated the virtio disk's capacity in little endian.
> But virtblk_probe() (drivers/block/virtio_blk.c) in kernel read the
> capacity from I/O space without convertion.

Sigh, I don't remember why this works any more.

There was discussion on this on kvm-ppc-devel in April (unfortunately it
was right at the month line, so the threading is broken, but see e.g.
http://marc.info/?l=kvm-ppc&m=120716463602156), and ultimately
cpu_to_le64() was added to qemu. However, a couple weeks later, the
swapping that the kernel was doing was removed (see
http://thread.gmane.org/gmane.linux.kernel.virtualization/5776/focus=5801).

However, the code is actually working today on 440 (and reporting a sane
number of blocks). Also, this patch
(http://article.gmane.org/gmane.linux.kernel.virtualization/6126/match=virtio%5fblk+fix+endianess+annotations) suggests that struct virtio_blk_config is no longer LE, so I'm thinking your problem must be in qemu. AFAICS the kernel is basically just doing memcpy in a few places.

> Since E500 is big endian, this bring the misunderstanding between qemu
> and guest.

What are you using for PCI emulation in qemu? I don't think it should
matter in this case, since the kernel is doing 1-byte reads in vp_get(),
but endianness gets very convoluted wherever qemu is involved. :(

-- 
Hollis Blanchard
IBM Linux Technology Center


       reply	other threads:[~2008-09-02 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <C6FABC699EA2354EB260110329F4B35508F638@zch01exm26.fsl.freescale.net>
2008-09-02 14:15 ` Hollis Blanchard [this message]
     [not found]   ` <1220364956.26357.33.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-09-04  5:27     ` Virtio_pci in kernel ignore endian of PCI I/O space? Liu Yu-B13201
     [not found]       ` <C6FABC699EA2354EB260110329F4B3550D42B8-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2008-09-05 15:30         ` Hollis Blanchard
     [not found]           ` <1220628650.31152.4.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-09-07 15:26             ` Liu Yu-B13201

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=1220364956.26357.33.camel@localhost.localdomain \
    --to=hollisb@us.ibm.com \
    --cc=Yu.Liu@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox