[SLOF] [PATCH v1 10/27] virtio: make virtio_vring_desc 1.0 aware

Alexey Kardashevskiy aik at ozlabs.ru
Thu Jan 14 18:18:31 AEDT 2016


On 01/13/2016 10:16 PM, Nikunj A Dadhania wrote:
> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> ---
>   lib/libvirtio/virtio.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/lib/libvirtio/virtio.c b/lib/libvirtio/virtio.c
> index aa4a45b..f95e86b 100644
> --- a/lib/libvirtio/virtio.c
> +++ b/lib/libvirtio/virtio.c
> @@ -235,14 +235,22 @@ struct vring_desc *virtio_get_vring_desc(struct virtio_device *dev, int queue)
>   {
>   	struct vring_desc *desc = 0;
>
> -	if (dev->type == VIRTIO_TYPE_PCI) {
> +	if (dev->type != VIRTIO_TYPE_PCI)
> +		return NULL;
> +	if (dev->is_modern) {
> +		void *q_sel = dev->common.addr + offset_of(struct virtio_dev_common, q_select);
> +		void *q_desc = dev->common.addr + offset_of(struct virtio_dev_common, q_desc);
> +
> +		ci_write_16(q_sel, cpu_to_le16(queue));
> +		eieio();


Here and in next patches I see this new eieio(), please merge similar 
changes to one patch and add a commit log about this "make xxx 1.0 aware" 
change.


> +		desc = (void *)(virtio_read64(q_desc));
> +	} else {
>   		ci_write_16(dev->base+VIRTIOHDR_QUEUE_SELECT,
>   			    cpu_to_le16(queue));
>   		eieio();
>   		desc = (void*)(4096L *
> -		   le32_to_cpu(ci_read_32(dev->base+VIRTIOHDR_QUEUE_ADDRESS)));
> +			       le32_to_cpu(ci_read_32(dev->base+VIRTIOHDR_QUEUE_ADDRESS)));

Unrelared change.


>   	}
> -

Here too.


>   	return desc;
>   }
>
>


-- 
Alexey


More information about the SLOF mailing list