All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [kvm-ppc-devel] [PATCH] kvm(ppc)-userspace: initialize
Date: Tue, 01 Apr 2008 14:46:18 +0000	[thread overview]
Message-ID: <47F24ABA.3020404@us.ibm.com> (raw)
In-Reply-To: <47F225D2.9020409@linux.vnet.ibm.com>

Hollis Blanchard wrote:
> On Tue, 2008-04-01 at 14:08 +0200, Christian Ehrhardt wrote:
>   
>> FYI some output using virtio-block (still buggy on kvmppc)
>>
>> Initialization when booting guest (VIO = virtio drvier in guest, U-VIO = virtio emulation in host kvm userspace)
>>
>> PCI: Enabling device 0000:00:01.0 (0000 -> 0001)
>> PCI: Enabling device 0000:00:02.0 (0000 -> 0001)
>> U-VIO virtio_blk_update_config - vdev 0x10d0b008
>> VIO virtblk_probe - vdev 0xc8925200
>> U-VIO virtio_blk_get_features - vdev 0x10d0b008
>> U-VIO virtio_blk_get_features - vdev 0x10d0b008
>> U-VIO virtio_blk_get_features - vdev 0x10d0b008
>> blk_queue_max_hw_segments: set to minimum 1
>>  vda:<3>VIO do_virtblk_request - request_queue 0xc8936000
>> VIO do_req - request_queue 0xc8936000 request 0xc8937320 virtio_blk 0xc880c000 (8secs@0x0 - <NULL> Maj -929934324)
>> U-VIO virtio_blk_handle_output - vdev 0x10d0b008 vq 0x10d0b20c
>> VIO blk_done - vq 0xc88bcc00
>> VIO do_virtblk_request - request_queue 0xc8936000
>>
>>
>>
>> We have no dynamic /dev so anyone who wants to test that will need to create /dev/vda for his needs.
>> This is easy to check using /proc/partitions.
>> Well I think that block size is broken here and using fdisk to check the partitions on that (unformatted) disk killed the guest kernel.
>> This needs more debugging, but to enable it for our platform is the first step - comments are welcome.
>>
>> bash-3.00# cat /proc/partitions
>> major minor  #blocks  name
>> [...]
>>  254     0 22517998136852480 vda		<- ?broken?
>>     
>
> My guess is this is run-of-the-mill endianness mismatch.
> 22517998136852480 = 0x00500000_00000000, which 64-bit byteswapped would
> be 0x5000, and that's probably a reasonable number of 512-byte blocks.
> Is your disk image 10MB?
>
> Why would we have a problem, since both guest and host are big-endian?
> Because virtio is a PCI device, and PCI MMIO are LE, so
> __virtio_config_val() in the guest is (correctly) using le64_to_cpu().
>
> Why didn't we have problems with virtio-net? Because virtio-net doesn't
> seem to have anything interesting in PCI config space. virtio-blk's
> config space contains the capacity and a few other pieces of
> information.
>
> The fix needs to be in qemu, and given the lack of qemu endianness
> infrastructure, I'm afraid it will be a hack. See
> http://svn.savannah.nongnu.org/viewvc/trunk/hw/e1000.c?root=qemu&r1@46&r2@45&pathrev@46 for reference. We all know that TARGET_WORDS_BIGENDIAN is totally wrong, but unfortunately it also seems to be the only (accidentally) working solution in qemu without major IO system rework. :(
>
>   

It's actually not so bad since the virtio config space is already read 
one byte at a time.  The following should help.

diff --git a/qemu/hw/virtio-blk.c b/qemu/hw/virtio-blk.c
index 0f55d2a..492bd7f 100644
--- a/qemu/hw/virtio-blk.c
+++ b/qemu/hw/virtio-blk.c
@@ -134,8 +134,8 @@ static void virtio_blk_update_config(VirtIODevice 
*vdev, uin
     int64_t capacity;
 
     bdrv_get_geometry(s->bs, &capacity);
-    blkcfg.capacity = capacity;
-    blkcfg.seg_max = 128 - 2;
+    blkcfg.capacity = cpu_to_le64(capacity);
+    blkcfg.seg_max = cpu_to_le32(128 - 2);
     memcpy(config, &blkcfg, sizeof(blkcfg));
 }
 



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

  parent reply	other threads:[~2008-04-01 14:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 12:01 [kvm-ppc-devel] [PATCH] kvm(ppc)-userspace: initialize virtio-block ehrhardt
2008-04-01 12:08 ` [kvm-ppc-devel] [PATCH] kvm(ppc)-userspace: initialize Christian Ehrhardt
2008-04-01 14:33   ` [kvm-ppc-devel] [PATCH] kvm(ppc)-userspace: Hollis Blanchard
2008-04-01 14:46   ` Anthony Liguori [this message]
2008-04-01 16:13     ` [kvm-ppc-devel] booting from virtio-blk Hollis Blanchard
2008-04-01 16:13       ` Hollis Blanchard
2008-04-01 17:05       ` [kvm-ppc-devel] " Anthony Liguori
2008-04-01 17:05         ` Anthony Liguori
2008-04-01 17:09       ` [kvm-ppc-devel] " Anthony Liguori
2008-04-01 17:09         ` Anthony Liguori
2008-04-01 20:36         ` [kvm-ppc-devel] " Benjamin Herrenschmidt
2008-04-01 20:36           ` Benjamin Herrenschmidt
2008-04-01 21:03           ` Anthony Liguori
2008-04-01 21:03             ` Anthony Liguori
2008-04-01 21:14             ` Benjamin Herrenschmidt
2008-04-01 21:14               ` Benjamin Herrenschmidt
2008-04-01 21:18             ` Hollis Blanchard
2008-04-01 21:18               ` Hollis Blanchard
2008-04-01 21:24               ` Benjamin Herrenschmidt
2008-04-01 21:24                 ` Benjamin Herrenschmidt
2008-04-02 14:52   ` [kvm-ppc-devel] [PATCH] kvm(ppc)-userspace: initialize Anthony Liguori

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=47F24ABA.3020404@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=kvm-ppc@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 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.