From: Liang Chen <liangchen.linux@gmail.com>
To: kvm@vger.kernel.org
Cc: mst@redhat.com, linux-kernel@vger.kernel.org,
pbonzini@redhat.com, jay.vosburgh@canonical.com,
Liang Chen <liangchen.linux@gmail.com>,
Gavin Guo <gavin.guo@canonical.com>
Subject: [PATCH] virtio-pci: use possible fallback queue size
Date: Tue, 22 Mar 2016 14:51:08 +0800 [thread overview]
Message-ID: <1458629468-27184-1-git-send-email-liangchen.linux@gmail.com> (raw)
Virtio 1.0 spec allows driver to modify queue size to reduce momery
requeirments. So the driver should write back the queue size actually
allocated, instead of the original value read from the common config
for the queue.
Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Suggested-by: Jay Vosburgh <jay.vosburgh@canonical.com>
---
drivers/virtio/virtio_pci_common.h | 2 +-
drivers/virtio/virtio_pci_modern.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
index 2cc2522..32ee993 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -36,7 +36,7 @@ struct virtio_pci_vq_info {
struct virtqueue *vq;
/* the number of entries in the queue */
- int num;
+ u16 num;
/* the virtual address of the ring queue */
void *queue;
diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index 7760fc1..7f9ccac 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -293,7 +293,7 @@ static size_t vring_pci_size(u16 num)
return PAGE_ALIGN(vring_size(num, SMP_CACHE_BYTES));
}
-static void *alloc_virtqueue_pages(int *num)
+static void *alloc_virtqueue_pages(u16 *num)
{
void *pages;
@@ -360,7 +360,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
}
/* activate the queue */
- vp_iowrite16(num, &cfg->queue_size);
+ vp_iowrite16(info->num, &cfg->queue_size);
vp_iowrite64_twopart(virt_to_phys(info->queue),
&cfg->queue_desc_lo, &cfg->queue_desc_hi);
vp_iowrite64_twopart(virt_to_phys(virtqueue_get_avail(vq)),
--
1.9.1
reply other threads:[~2016-03-22 6:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1458629468-27184-1-git-send-email-liangchen.linux@gmail.com \
--to=liangchen.linux@gmail.com \
--cc=gavin.guo@canonical.com \
--cc=jay.vosburgh@canonical.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.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