virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <elic@nvidia.com>
Cc: kvm@vger.kernel.org, mst@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, eli@mellanox.com
Subject: Re: [PATCH 1/4] vdpa: support packed virtqueue for set/get_vq_state()
Date: Wed, 2 Jun 2021 10:11:36 +0800	[thread overview]
Message-ID: <da410b5f-8603-8aa5-d2c7-89bf06a40de3@redhat.com> (raw)
In-Reply-To: <20210601104711.GD215954@mtl-vdi-166.wap.labs.mlnx>


在 2021/6/1 下午6:47, Eli Cohen 写道:
> On Tue, Jun 01, 2021 at 04:45:00PM +0800, Jason Wang wrote:
>> This patch extends the vdpa_vq_state to support packed virtqueue
>> state which is basically the device/driver ring wrap counters and the
>> avail and used index. This will be used for the virito-vdpa support
>> for the packed virtqueue and the future vhost/vhost-vdpa support for
>> the packed virtqueue.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
> You changed interface but did not modify mlx5. Does this compile on your
> system?


Yes but I'm using a minimal config without mlx5 enabled :(

V2 is posted.

Thanks


>
>> ---
>>   drivers/vdpa/ifcvf/ifcvf_main.c  |  4 ++--
>>   drivers/vdpa/vdpa_sim/vdpa_sim.c |  4 ++--
>>   drivers/vhost/vdpa.c             |  4 ++--
>>   include/linux/vdpa.h             | 25 +++++++++++++++++++++++--
>>   4 files changed, 29 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
>> index ab0ab5cf0f6e..5d3891b1ca28 100644
>> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
>> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
>> @@ -264,7 +264,7 @@ static int ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid,
>>   {
>>   	struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
>>   
>> -	state->avail_index = ifcvf_get_vq_state(vf, qid);
>> +	state->split.avail_index = ifcvf_get_vq_state(vf, qid);
>>   	return 0;
>>   }
>>   
>> @@ -273,7 +273,7 @@ static int ifcvf_vdpa_set_vq_state(struct vdpa_device *vdpa_dev, u16 qid,
>>   {
>>   	struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
>>   
>> -	return ifcvf_set_vq_state(vf, qid, state->avail_index);
>> +	return ifcvf_set_vq_state(vf, qid, state->split.avail_index);
>>   }
>>   
>>   static void ifcvf_vdpa_set_vq_cb(struct vdpa_device *vdpa_dev, u16 qid,
>> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>> index 98f793bc9376..14e024de5cbf 100644
>> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
>> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>> @@ -374,7 +374,7 @@ static int vdpasim_set_vq_state(struct vdpa_device *vdpa, u16 idx,
>>   	struct vringh *vrh = &vq->vring;
>>   
>>   	spin_lock(&vdpasim->lock);
>> -	vrh->last_avail_idx = state->avail_index;
>> +	vrh->last_avail_idx = state->split.avail_index;
>>   	spin_unlock(&vdpasim->lock);
>>   
>>   	return 0;
>> @@ -387,7 +387,7 @@ static int vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx,
>>   	struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
>>   	struct vringh *vrh = &vq->vring;
>>   
>> -	state->avail_index = vrh->last_avail_idx;
>> +	state->split.avail_index = vrh->last_avail_idx;
>>   	return 0;
>>   }
>>   
>> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
>> index fb41db3da611..210ab35a7ebf 100644
>> --- a/drivers/vhost/vdpa.c
>> +++ b/drivers/vhost/vdpa.c
>> @@ -383,7 +383,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
>>   		if (r)
>>   			return r;
>>   
>> -		vq->last_avail_idx = vq_state.avail_index;
>> +		vq->last_avail_idx = vq_state.split.avail_index;
>>   		break;
>>   	}
>>   
>> @@ -401,7 +401,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
>>   		break;
>>   
>>   	case VHOST_SET_VRING_BASE:
>> -		vq_state.avail_index = vq->last_avail_idx;
>> +		vq_state.split.avail_index = vq->last_avail_idx;
>>   		if (ops->set_vq_state(vdpa, idx, &vq_state))
>>   			r = -EINVAL;
>>   		break;
>> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
>> index f311d227aa1b..3357ac98878d 100644
>> --- a/include/linux/vdpa.h
>> +++ b/include/linux/vdpa.h
>> @@ -28,13 +28,34 @@ struct vdpa_notification_area {
>>   };
>>   
>>   /**
>> - * struct vdpa_vq_state - vDPA vq_state definition
>> + * struct vdpa_vq_state_split - vDPA split virtqueue state
>>    * @avail_index: available index
>>    */
>> -struct vdpa_vq_state {
>> +struct vdpa_vq_state_split {
>>   	u16	avail_index;
>>   };
>>   
>> +/**
>> + * struct vdpa_vq_state_packed - vDPA packed virtqueue state
>> + * @last_avail_counter: last driver ring wrap counter observed by device
>> + * @last_avail_idx: device available index
>> + * @last_used_counter: device ring wrap counter
>> + * @last_used_idx: used index
>> + */
>> +struct vdpa_vq_state_packed {
>> +        u16	last_avail_counter:1;
>> +        u16	last_avail_idx:15;
>> +        u16	last_used_counter:1;
>> +        u16	last_used_idx:15;
>> +};
>> +
>> +struct vdpa_vq_state {
>> +     union {
>> +          struct vdpa_vq_state_split split;
>> +          struct vdpa_vq_state_packed packed;
>> +     };
>> +};
>> +
>>   struct vdpa_mgmt_dev;
>>   
>>   /**
>> -- 
>> 2.25.1
>>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-06-02  2:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01  8:44 [PATCH 0/4] Packed virtqueue state support for vDPA Jason Wang
2021-06-01  8:45 ` [PATCH 1/4] vdpa: support packed virtqueue for set/get_vq_state() Jason Wang
2021-06-01 21:07   ` kernel test robot
     [not found]   ` <20210601104711.GD215954@mtl-vdi-166.wap.labs.mlnx>
2021-06-02  2:11     ` Jason Wang [this message]
2021-06-01  8:45 ` [PATCH 2/4] virtio-pci library: introduce vp_modern_get_driver_features() Jason Wang
2021-06-01  8:45 ` [PATCH 3/4] vp_vdpa: allow set vq state to initial state after reset Jason Wang
2021-06-01  8:45 ` [PATCH 4/4] virtio/vdpa: clear the virtqueue state during probe Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da410b5f-8603-8aa5-d2c7-89bf06a40de3@redhat.com \
    --to=jasowang@redhat.com \
    --cc=eli@mellanox.com \
    --cc=elic@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).