From: zhangshuai <zhangshuai13@huawei.com>
To: stefanha@redhat.com
Cc: qemu-devel@nongnu.org, wu.wubin@huawei.com,
eric.fangyi@huawei.com, subo7@huawei.com,
kathy.wangting@huawei.com, lina.lulina@huawei.com,
zhangshuai13@huawei.com
Subject: [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick()
Date: Fri, 26 Aug 2016 11:18:22 +0800 [thread overview]
Message-ID: <1472181502-6588-1-git-send-email-zhangshuai13@huawei.com> (raw)
From: Zhang Shuai <zhangshuai13@huawei.com>
The idx and ring[] of vring_avail is 16-bit, but the writel
is 32-bit, the second writel will cover the ring[free_head]
with 0. So use writew to replace writel to fix the bug.
Signed-off-by: zhangshuai <zhangshuai13@huawei.com>
---
tests/libqos/virtio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index d8c2970..801690f 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -264,9 +264,9 @@ void qvirtqueue_kick(const QVirtioBus *bus, QVirtioDevice *d, QVirtQueue *vq,
uint16_t avail_event;
/* vq->avail->ring[idx % vq->size] */
- writel(vq->avail + 4 + (2 * (idx % vq->size)), free_head);
+ writew(vq->avail + 4 + (2 * (idx % vq->size)), free_head);
/* vq->avail->idx */
- writel(vq->avail + 2, idx + 1);
+ writew(vq->avail + 2, idx + 1);
/* Must read after idx is updated */
flags = readw(vq->avail);
--
1.8.3.4
next reply other threads:[~2016-08-26 3:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 3:18 zhangshuai [this message]
2016-09-05 17:44 ` [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick() Stefan Hajnoczi
2016-09-05 18:08 ` Stefan Hajnoczi
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=1472181502-6588-1-git-send-email-zhangshuai13@huawei.com \
--to=zhangshuai13@huawei.com \
--cc=eric.fangyi@huawei.com \
--cc=kathy.wangting@huawei.com \
--cc=lina.lulina@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=subo7@huawei.com \
--cc=wu.wubin@huawei.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).