From: Benjamin Berg <benjamin@sipsolutions.net>
To: linux-um@lists.infradead.org
Cc: Benjamin Berg <benjamin.berg@intel.com>
Subject: [PATCH 2/4] um: virtio_uml: use smaller virtqueue sizes for VIRTIO_ID_SOUND
Date: Sun, 3 Nov 2024 22:28:52 +0100 [thread overview]
Message-ID: <20241103212854.1436046-3-benjamin@sipsolutions.net> (raw)
In-Reply-To: <20241103212854.1436046-1-benjamin@sipsolutions.net>
From: Benjamin Berg <benjamin.berg@intel.com>
It appears that the different vhost device implementations use different
sizes of the virtual queues. Add device specific limitations (for now,
only for sound), to ensure that we do not get disconnected unexpectedly.
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
---
arch/um/drivers/virtio_uml.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c
index c602892f329f..2e4b4eadd553 100644
--- a/arch/um/drivers/virtio_uml.c
+++ b/arch/um/drivers/virtio_uml.c
@@ -25,6 +25,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/virtio.h>
+#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
#include <linux/virtio_ring.h>
#include <linux/time-internal.h>
@@ -935,9 +936,19 @@ static struct virtqueue *vu_setup_vq(struct virtio_device *vdev,
struct platform_device *pdev = vu_dev->pdev;
struct virtio_uml_vq_info *info;
struct virtqueue *vq;
- int num = MAX_SUPPORTED_QUEUE_SIZE;
+ int num;
int rc;
+ /* Seems like we need to hard-code the queue size */
+ switch (vu_dev->vdev.id.device) {
+ case VIRTIO_ID_SOUND:
+ num = 64;
+ break;
+ default:
+ num = MAX_SUPPORTED_QUEUE_SIZE;
+ break;
+ }
+
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
rc = -ENOMEM;
--
2.47.0
next prev parent reply other threads:[~2024-11-03 21:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-03 21:28 [PATCH 0/4] Enable virtio-fs and virtio-snd in UML Benjamin Berg
2024-11-03 21:28 ` [PATCH 1/4] um: virtio_uml: send SET_MEM_TABLE message with the exact size Benjamin Berg
2024-11-03 21:28 ` Benjamin Berg [this message]
2024-11-07 17:01 ` [PATCH 2/4] um: virtio_uml: use smaller virtqueue sizes for VIRTIO_ID_SOUND Johannes Berg
2024-11-03 21:28 ` [PATCH 3/4] um: virtio_uml: fix call_fd IRQ allocation Benjamin Berg
2024-11-03 21:28 ` [PATCH 4/4] um: virtio_uml: query the number of vqs if supported Benjamin Berg
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=20241103212854.1436046-3-benjamin@sipsolutions.net \
--to=benjamin@sipsolutions.net \
--cc=benjamin.berg@intel.com \
--cc=linux-um@lists.infradead.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