* Re: Virtio_pci in kernel ignore endian of PCI I/O space? [not found] <C6FABC699EA2354EB260110329F4B35508F638@zch01exm26.fsl.freescale.net> @ 2008-09-02 14:15 ` Hollis Blanchard [not found] ` <1220364956.26357.33.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Hollis Blanchard @ 2008-09-02 14:15 UTC (permalink / raw) To: Liu Yu-B13201; +Cc: kvm-ppc, kvm 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <1220364956.26357.33.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>]
* RE: Virtio_pci in kernel ignore endian of PCI I/O space? [not found] ` <1220364956.26357.33.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> @ 2008-09-04 5:27 ` Liu Yu-B13201 [not found] ` <C6FABC699EA2354EB260110329F4B3550D42B8-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Liu Yu-B13201 @ 2008-09-04 5:27 UTC (permalink / raw) To: Hollis Blanchard; +Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm > -----Original Message----- > From: Hollis Blanchard [mailto:hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org] > Sent: Tuesday, September 02, 2008 10:16 PM > To: Liu Yu-B13201 > Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; kvm > Subject: Re: Virtio_pci in kernel ignore endian of PCI I/O space? > > 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/61 > 26/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. Thanks for your informations! > > > 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. :( > Did you see Anthony's reply? It's weird that 440 can still work fine. -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <C6FABC699EA2354EB260110329F4B3550D42B8-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>]
* RE: Virtio_pci in kernel ignore endian of PCI I/O space? [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> 0 siblings, 1 reply; 4+ messages in thread From: Hollis Blanchard @ 2008-09-05 15:30 UTC (permalink / raw) To: Liu Yu-B13201; +Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm On Thu, 2008-09-04 at 13:27 +0800, Liu Yu-B13201 wrote: > > > > > 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. :( > > > > Did you see Anthony's reply? > It's weird that 440 can still work fine. OK, I've found my problem. My host kernel is current, but my *guest* kernel is old (it was still byte-swapping). Also, the reason the S390 guys didn't see a problem is that they aren't yet using qemu, and their virtio userspace implementation doesn't swap. Yu, would you send a patch? -- Hollis Blanchard IBM Linux Technology Center -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <1220628650.31152.4.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>]
* RE: Virtio_pci in kernel ignore endian of PCI I/O space? [not found] ` <1220628650.31152.4.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> @ 2008-09-07 15:26 ` Liu Yu-B13201 0 siblings, 0 replies; 4+ messages in thread From: Liu Yu-B13201 @ 2008-09-07 15:26 UTC (permalink / raw) To: Hollis Blanchard; +Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm > -----Original Message----- > From: Hollis Blanchard [mailto:hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org] > Sent: Friday, September 05, 2008 11:31 PM > To: Liu Yu-B13201 > Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; kvm > Subject: RE: Virtio_pci in kernel ignore endian of PCI I/O space? > > On Thu, 2008-09-04 at 13:27 +0800, Liu Yu-B13201 wrote: > > > > > > > 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. :( > > > > > > > Did you see Anthony's reply? > > It's weird that 440 can still work fine. > > OK, I've found my problem. My host kernel is current, but my *guest* > kernel is old (it was still byte-swapping). > > Also, the reason the S390 guys didn't see a problem is that > they aren't > yet using qemu, and their virtio userspace implementation > doesn't swap. Thanks a lot! > > Yu, would you send a patch? > Certainly. As my code is on branch kvm-70rc1, I could only test it on branch kvm-70rc1 now. I don't know whether it is matter? -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-07 15:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <C6FABC699EA2354EB260110329F4B35508F638@zch01exm26.fsl.freescale.net>
2008-09-02 14:15 ` Virtio_pci in kernel ignore endian of PCI I/O space? Hollis Blanchard
[not found] ` <1220364956.26357.33.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-09-04 5:27 ` 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox