From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [PATCH] Fix endianness for virtio-blk config space Date: Tue, 01 Apr 2008 11:14:59 -0500 Message-ID: <1207066499.6214.31.camel@basalt> References: <1207065896-22065-1-git-send-email-aliguori@us.ibm.com> Reply-To: Hollis Blanchard Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, Avi Kivity To: Anthony Liguori Return-path: In-Reply-To: <1207065896-22065-1-git-send-email-aliguori@us.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org On Tue, 2008-04-01 at 11:04 -0500, Anthony Liguori wrote: > The virtio config space is little endian. Make sure that in virtio-blk we > store the values in little endian format. > > Signed-off-by: Anthony Liguori > > 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, uint8_t *config) > 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)); > } Fixes virtio-blk for PowerPC KVM. Acked-by: Hollis Blanchard -- Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- 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