qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Liuxiangdong <liuxiangdong5@huawei.com>,
	Parav Pandit <parav@mellanox.com>,
	Harpreet Singh Anand <hanand@xilinx.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Zhu Lingshan <lingshan.zhu@intel.com>,
	Gautam Dawar <gdawar@xilinx.com>, Eli Cohen <eli@mellanox.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Cindy Lu <lulu@redhat.com>, Jason Wang <jasowang@redhat.com>,
	Si-Wei Liu <si-wei.liu@oracle.com>
Subject: [PATCH 1/4] vhost: allocate event_idx fields on vring
Date: Thu, 20 Oct 2022 17:52:48 +0200	[thread overview]
Message-ID: <20221020155251.398735-2-eperezma@redhat.com> (raw)
In-Reply-To: <20221020155251.398735-1-eperezma@redhat.com>

There was not enough room to accomodate them.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/virtio/vhost-shadow-virtqueue.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
index 596d4434d2..a518f84772 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -570,16 +570,16 @@ void vhost_svq_get_vring_addr(const VhostShadowVirtqueue *svq,
 size_t vhost_svq_driver_area_size(const VhostShadowVirtqueue *svq)
 {
     size_t desc_size = sizeof(vring_desc_t) * svq->vring.num;
-    size_t avail_size = offsetof(vring_avail_t, ring) +
-                                             sizeof(uint16_t) * svq->vring.num;
+    size_t avail_size = offsetof(vring_avail_t, ring[svq->vring.num]) +
+                                                              sizeof(uint16_t);
 
     return ROUND_UP(desc_size + avail_size, qemu_real_host_page_size());
 }
 
 size_t vhost_svq_device_area_size(const VhostShadowVirtqueue *svq)
 {
-    size_t used_size = offsetof(vring_used_t, ring) +
-                                    sizeof(vring_used_elem_t) * svq->vring.num;
+    size_t used_size = offsetof(vring_used_t, ring[svq->vring.num]) +
+                                                              sizeof(uint16_t);
     return ROUND_UP(used_size, qemu_real_host_page_size());
 }
 
-- 
2.31.1



  reply	other threads:[~2022-10-20 16:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 15:52 [PATCH 0/4] Shadow VirtQueue event index support Eugenio Pérez
2022-10-20 15:52 ` Eugenio Pérez [this message]
2022-10-20 15:52 ` [PATCH 2/4] vhost: toggle device callbacks using used event idx Eugenio Pérez
2022-10-21  3:39   ` Jason Wang
2022-10-21  7:45     ` Eugenio Perez Martin
2022-10-21  8:15       ` Michael S. Tsirkin
2022-10-24  2:16         ` Jason Wang
2022-10-24 14:00           ` Eugenio Perez Martin
2022-10-24 14:05             ` Michael S. Tsirkin
2022-10-25  2:26               ` Jason Wang
2022-10-25  5:34                 ` Michael S. Tsirkin
2022-10-25  5:46                   ` Jason Wang
2022-10-25  5:57                     ` Michael S. Tsirkin
2022-10-25  7:06               ` Eugenio Perez Martin
2022-10-20 15:52 ` [PATCH 4/4] vhost: Accept event idx flag Eugenio Pérez
2022-10-26 20:58 ` [PATCH 0/4] Shadow VirtQueue event index support Michael S. Tsirkin
2022-10-28  2:44   ` Jason Wang
2022-10-28  6:49     ` Eugenio Perez Martin
2022-11-01  2:31       ` 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=20221020155251.398735-2-eperezma@redhat.com \
    --to=eperezma@redhat.com \
    --cc=eli@mellanox.com \
    --cc=gdawar@xilinx.com \
    --cc=hanand@xilinx.com \
    --cc=jasowang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=liuxiangdong5@huawei.com \
    --cc=lulu@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.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).