egvirt: linux-yocto: Support linux-yocto-dev for VIRTIO. 82/27882/5
authorVasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Mon, 8 Aug 2022 09:29:22 +0000 (11:29 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Thu, 22 Sep 2022 11:21:19 +0000 (11:21 +0000)
Bug-AGL: SPEC-4453
Change-Id: Ib3641884bac404c7281df37e5ed4f4939e2830b4
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
meta-egvirt/recipes-kernel/linux/linux-yocto-5.18/0001-drivers-media-Add-config-option-for-virtio-video.patch [new file with mode: 0644]
meta-egvirt/recipes-kernel/linux/linux-yocto-5.18/0002-Bluetooth-virtio_bt-fix-device-removal.patch [new file with mode: 0644]
meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend [new file with mode: 0644]
meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_bt.cfg

diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto-5.18/0001-drivers-media-Add-config-option-for-virtio-video.patch b/meta-egvirt/recipes-kernel/linux/linux-yocto-5.18/0001-drivers-media-Add-config-option-for-virtio-video.patch
new file mode 100644 (file)
index 0000000..dbdb8b7
--- /dev/null
@@ -0,0 +1,33 @@
+From 162f03095b94fe1580653c96094e50ba827f4c0f Mon Sep 17 00:00:00 2001
+From: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
+Date: Thu, 3 Jun 2021 07:44:30 +0200
+Subject: [PATCH] drivers/media: Add config option for virtio video.
+
+virtio video driver is implemented as out of tree kernel module, but it
+depends on some of kernel functionality which can not be enabled
+explicitly via config (e.g. VIDEOBUF2_DMA_CONTIG).
+---
+ drivers/media/Kconfig | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
+index a6d073f2e036..a6146edb0ea3 100644
+--- a/drivers/media/Kconfig
++++ b/drivers/media/Kconfig
+@@ -235,6 +235,16 @@ endif
+ source "drivers/media/firewire/Kconfig"
++config VIDEO_VIRTIO
++      tristate "Virtio video driver"
++      depends on VIDEO_DEV
++      select MEDIA_CONTROLLER
++      select VIDEOBUF2_DMA_CONTIG
++      select VIDEOBUF2_DMA_SG
++      select V4L2_MEM2MEM_DEV
++      help
++        This is the virtual video driver for virtio. Say Y or M.
++
+ endmenu
+ #
diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto-5.18/0002-Bluetooth-virtio_bt-fix-device-removal.patch b/meta-egvirt/recipes-kernel/linux/linux-yocto-5.18/0002-Bluetooth-virtio_bt-fix-device-removal.patch
new file mode 100644 (file)
index 0000000..78aac51
--- /dev/null
@@ -0,0 +1,78 @@
+From b26cba86bfa2f29841279d7d3950cf1d4db0e6af Mon Sep 17 00:00:00 2001
+From: "Michael S. Tsirkin" <mst@redhat.com>
+Date: Thu, 25 Nov 2021 12:44:48 -0500
+Subject: [PATCH] Bluetooth: virtio_bt: fix device removal
+
+Device removal is clearly out of virtio spec: it attempts to remove
+unused buffers from a VQ before invoking device reset. To fix, make
+open/close NOPs and do all cleanup/setup in probe/remove.
+
+The cost here is a single skb wasted on an unused bt device - which
+seems modest.
+
+NB: with this fix in place driver still suffers from a race condition if
+an interrupt triggers while device is being reset. Work on a fix for
+that issue is in progress.
+
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Upstream-Status: Submitted [https://lore.kernel.org/all/20211125174200.133230-1-mst@redhat.com/]
+---
+ drivers/bluetooth/virtio_bt.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c
+index 67c21263f9e0..1dd734aef87b 100644
+--- a/drivers/bluetooth/virtio_bt.c
++++ b/drivers/bluetooth/virtio_bt.c
+@@ -50,8 +50,11 @@ static int virtbt_add_inbuf(struct virtio_bluetooth *vbt)
+ static int virtbt_open(struct hci_dev *hdev)
+ {
+-      struct virtio_bluetooth *vbt = hci_get_drvdata(hdev);
++      return 0;
++}
++static int virtbt_open_vdev(struct virtio_bluetooth *vbt)
++{
+       if (virtbt_add_inbuf(vbt) < 0)
+               return -EIO;
+@@ -61,7 +64,11 @@ static int virtbt_open(struct hci_dev *hdev)
+ static int virtbt_close(struct hci_dev *hdev)
+ {
+-      struct virtio_bluetooth *vbt = hci_get_drvdata(hdev);
++      return 0;
++}
++
++static int virtbt_close_vdev(struct virtio_bluetooth *vbt)
++{
+       int i;
+       cancel_work_sync(&vbt->rx);
+@@ -354,8 +361,14 @@ static int virtbt_probe(struct virtio_device *vdev)
+               goto failed;
+       }
++      virtio_device_ready(vdev);
++      if (virtbt_open_vdev(vbt))
++              goto open_failed;
++
+       return 0;
++open_failed:
++      hci_free_dev(hdev);
+ failed:
+       vdev->config->del_vqs(vdev);
+       return err;
+@@ -368,6 +381,7 @@ static void virtbt_remove(struct virtio_device *vdev)
+       hci_unregister_dev(hdev);
+       virtio_reset_device(vdev);
++      virtbt_close_vdev(vbt);
+       hci_free_dev(hdev);
+       vbt->hdev = NULL;
+-- 
+2.37.1
+
diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend b/meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend
new file mode 100644 (file)
index 0000000..750be25
--- /dev/null
@@ -0,0 +1,14 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/linux-yocto:"
+FILESEXTRAPATHS:prepend := "${THISDIR}/linux-yocto-5.18:"
+
+# virtio video
+SRC_URI:append = " \
+    file://0001-drivers-media-Add-config-option-for-virtio-video.patch \
+    file://virtio_video.cfg \
+"
+
+# virtio BT
+SRC_URI:append = " \
+    file://virtio_bt.cfg \
+    file://0002-Bluetooth-virtio_bt-fix-device-removal.patch \
+"
index 154a05d..530b0b2 100644 (file)
@@ -1,7 +1,7 @@
 # Enable BT_VIRTIO ("Virtio Bluetooth driver") config located in menu
 #
-#     -> Networking support (NET [=y])                                                                                                                                                                                                  │  
-#       -> Bluetooth subsystem support (BT [=m])                                                                                                                                                                                        │  
-#         -> Bluetooth device drivers                                                                                                                                                                                                   │  
+#     -> Networking support (NET [=y])
+#       -> Bluetooth subsystem support (BT [=m])
+#         -> Bluetooth device drivers
 #
 CONFIG_BT_VIRTIO=m