Re: [PATCH 6/6] virtio: core support for config generation

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

 



"Michael S. Tsirkin" <mst@xxxxxxxxxx> writes:
> virtio 1.0 spec says:
>
> Drivers MUST NOT assume reads from fields greater than 32 bits wide are
> atomic, nor are reads from multiple fields: drivers SHOULD read device
> configuration space fields like so:
> 	u32 before, after;
> 	do {
> 		before = get_config_generation(device);
> 		// read config entry/entries.
> 		after = get_config_generation(device);
> 	} while (after != before);
>
> Do exactly this, for transports that support it.

>  static inline void virtio_cwrite8(struct virtio_device *vdev,
> @@ -352,6 +375,7 @@ static inline u64 virtio_cread64(struct virtio_device *vdev,
>  {
>  	u64 ret;
>  	vdev->config->get(vdev, offset, &ret, sizeof(ret));
> +	__virtio_cread_many(vdev, offset, &ret, 1, sizeof(ret));
>  	return virtio64_to_cpu(vdev, (__force __virtio64)ret);
>  }

The "vdev->config->get(vdev, offset, &ret, sizeof(ret));" should
be deleted.  Harmless if not, though.

Cheers,
Rusty.
_______________________________________________
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