[PATCH 2/4] um: virtio_uml: use smaller virtqueue sizes for VIRTIO_ID_SOUND
Benjamin Berg
benjamin at sipsolutions.net
Sun Nov 3 13:28:52 PST 2024
From: Benjamin Berg <benjamin.berg at 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 at 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
More information about the linux-um
mailing list