Re: [PATCH 04/22] virtio: use u32, not bitmap for struct virtio_device's features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 21 Mar 2013 18:59:25 +1030
Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:

> It seemed like a good idea, but it's actually a pain when we get more
> than 32 feature bits.  Just change it to a u32 for now.
> 
> Cc: Ohad Ben-Cohen <ohad@xxxxxxxxxx>
> Cc: Brian Swetland <swetland@xxxxxxxxxx>
> Cc: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
> Cc: Pawel Moll <pawel.moll@xxxxxxx>
> Cc: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> ---
>  drivers/char/virtio_console.c          |    2 +-
>  drivers/lguest/lguest_device.c         |    2 +-
>  drivers/remoteproc/remoteproc_virtio.c |    2 +-
>  drivers/s390/kvm/kvm_virtio.c          |    2 +-
>  drivers/virtio/virtio.c                |   10 +++++-----
>  drivers/virtio/virtio_mmio.c           |    8 ++------
>  drivers/virtio/virtio_pci.c            |    3 +--
>  drivers/virtio/virtio_ring.c           |    2 +-
>  include/linux/virtio.h                 |    3 +--
>  include/linux/virtio_config.h          |    2 +-
>  tools/virtio/linux/virtio.h            |   22 +---------------------
>  tools/virtio/linux/virtio_config.h     |    2 +-
>  tools/virtio/virtio_test.c             |    5 ++---
>  tools/virtio/vringh_test.c             |   16 ++++++++--------
>  14 files changed, 27 insertions(+), 54 deletions(-)

I didn't try this patch, but wouldn't virtio_ccw need something like
the change below as well?

--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -440,7 +440,6 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
 {
 	struct virtio_ccw_device *vcdev = to_vc_device(vdev);
 	struct virtio_feature_desc *features;
-	int i;
 	struct ccw1 *ccw;
 
 	ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
@@ -454,19 +453,15 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
 	/* Give virtio_ring a chance to accept features. */
 	vring_transport_features(vdev);
 
-	for (i = 0; i < sizeof(*vdev->features) / sizeof(features->features);
-	     i++) {
-		int highbits = i % 2 ? 32 : 0;
-		features->index = i;
-		features->features = cpu_to_le32(vdev->features[i / 2]
-						 >> highbits);
-		/* Write the feature bits to the host. */
-		ccw->cmd_code = CCW_CMD_WRITE_FEAT;
-		ccw->flags = 0;
-		ccw->count = sizeof(*features);
-		ccw->cda = (__u32)(unsigned long)features;
-		ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
-	}
+	features->index = 0;
+	features->features = cpu_to_le32(vdev->features);
+	/* Write the feature bits to the host. */
+	ccw->cmd_code = CCW_CMD_WRITE_FEAT;
+	ccw->flags = 0;
+	ccw->count = sizeof(*features);
+	ccw->cda = (__u32)(unsigned long)features;
+	ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
+
 out_free:
 	kfree(features);
 	kfree(ccw);

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux