From: Shannon Nelson via Virtualization <virtualization@lists.linux-foundation.org>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: virtualization@lists.linux-foundation.org, drivers@pensando.io,
mst@redhat.com
Subject: Re: [PATCH v2 2/3] vhost: support PACKED when setting-getting vring_base
Date: Mon, 15 May 2023 13:41:12 -0700 [thread overview]
Message-ID: <58f93ced-2f2b-dba1-b8a3-96bdb755d54e@amd.com> (raw)
In-Reply-To: <ogzrlfid7jwfzgk42zffegaq4xhdsrpi6vu22333ub4bkmvpc3@3pa2eyzub3jn>
On 5/9/23 1:46 AM, Stefano Garzarella wrote:
> On Mon, Apr 24, 2023 at 03:50:30PM -0700, Shannon Nelson via
> Virtualization wrote:
>> Use the right structs for PACKED or split vqs when setting and
>> getting the vring base.
>>
>> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
>> ---
>> drivers/vhost/vhost.c | 18 +++++++++++++-----
>> drivers/vhost/vhost.h | 8 ++++++--
>> 2 files changed, 19 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
>> index f11bdbe4c2c5..f64efda48f21 100644
>> --- a/drivers/vhost/vhost.c
>> +++ b/drivers/vhost/vhost.c
>> @@ -1633,17 +1633,25 @@ long vhost_vring_ioctl(struct vhost_dev *d,
>> unsigned int ioctl, void __user *arg
>> r = -EFAULT;
>> break;
>> }
>> - if (s.num > 0xffff) {
>> - r = -EINVAL;
>> - break;
>> + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) {
>> + vq->last_avail_idx = s.num & 0xffff;
>> + vq->last_used_idx = (s.num >> 16) & 0xffff;
>> + } else {
>> + if (s.num > 0xffff) {
>> + r = -EINVAL;
>> + break;
>> + }
>> + vq->last_avail_idx = s.num;
>> }
>> - vq->last_avail_idx = s.num;
>> /* Forget the cached index value. */
>> vq->avail_idx = vq->last_avail_idx;
>> break;
>> case VHOST_GET_VRING_BASE:
>> s.index = idx;
>> - s.num = vq->last_avail_idx;
>> + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
>> + s.num = (u32)vq->last_avail_idx |
>> ((u32)vq->last_used_idx << 16);
>> + else
>> + s.num = vq->last_avail_idx;
>
> The changes LGTM, but since we are changing the UAPI, should we
> update the documentation of VHOST_SET_VRING_BASE and
> VHOST_GET_VRING_BASE in include/uapi/linux/vhost.h?
Correct me if I'm wrong, but I don't think we're changing anything in
the UAPI here, just fixing code to work correctly with what is already
happening.
sln
>
> Thanks,
> Stefano
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-05-15 20:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 22:50 [PATCH v2 0/3] vhost_vdpa: better PACKED support Shannon Nelson via Virtualization
2023-04-24 22:50 ` [PATCH v2 1/3] vhost_vdpa: tell vqs about the negotiated Shannon Nelson via Virtualization
2023-04-24 22:50 ` [PATCH v2 2/3] vhost: support PACKED when setting-getting vring_base Shannon Nelson via Virtualization
2023-04-25 6:01 ` Jason Wang
2023-05-09 8:46 ` Stefano Garzarella
2023-05-15 20:41 ` Shannon Nelson via Virtualization [this message]
2023-05-16 7:49 ` Stefano Garzarella
2023-05-16 18:26 ` Shannon Nelson via Virtualization
2023-05-17 5:26 ` Jason Wang
2023-05-17 7:00 ` Stefano Garzarella
2023-05-18 5:23 ` Jason Wang
2023-05-18 7:34 ` Stefano Garzarella
2023-05-18 7:52 ` Jason Wang
2023-05-18 8:38 ` Michael S. Tsirkin
2023-05-18 8:59 ` Jason Wang
2023-05-18 9:42 ` Michael S. Tsirkin
2023-06-02 11:36 ` Michael S. Tsirkin
2023-06-05 8:17 ` Stefano Garzarella
2023-04-24 22:50 ` [PATCH v2 3/3] vhost_vdpa: " Shannon Nelson via Virtualization
2023-04-25 6:02 ` Jason Wang
2023-04-25 6:08 ` [PATCH v2 0/3] vhost_vdpa: better PACKED support Michael S. Tsirkin
2023-04-25 16:21 ` Shannon Nelson via Virtualization
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=58f93ced-2f2b-dba1-b8a3-96bdb755d54e@amd.com \
--to=virtualization@lists.linux-foundation.org \
--cc=drivers@pensando.io \
--cc=mst@redhat.com \
--cc=sgarzare@redhat.com \
--cc=shannon.nelson@amd.com \
/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).