aboutsummaryrefslogtreecommitdiffstats
path: root/meta-egvirt
diff options
context:
space:
mode:
authorVasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>2022-05-10 19:43:29 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2022-06-08 14:23:35 +0000
commit8b11814ab8e860d333d5fc25607c23c9122a0b16 (patch)
treeb8a0bc7b3f5d55f6be10812268b25eec777d4888 /meta-egvirt
parent25ee9ef44af5b1d305422afa2129d713be174062 (diff)
egvirt: linux-yocto: Add virtio_bt driver.
virtio-bt is not part of OASIS standard yet (v1.2) but Linux kernel has driver for virtio transport for BT HCI. Submit driver to meta-agl-devel since patch [1] is WIP and has a known issue. [1]: 0002-Bluetooth-virtio_bt-fix-device-removal.patch Bug-AGL: SPEC-4363 Change-Id: Ib6851df24d430e991a4e9078345bef7e440fb6de Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Diffstat (limited to 'meta-egvirt')
-rw-r--r--meta-egvirt/recipes-kernel/linux/linux-yocto/0002-Bluetooth-virtio_bt-fix-device-removal.patch78
-rw-r--r--meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_bt.cfg7
-rw-r--r--meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend6
3 files changed, 91 insertions, 0 deletions
diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto/0002-Bluetooth-virtio_bt-fix-device-removal.patch b/meta-egvirt/recipes-kernel/linux/linux-yocto/0002-Bluetooth-virtio_bt-fix-device-removal.patch
new file mode 100644
index 00000000..8c33cab0
--- /dev/null
+++ b/meta-egvirt/recipes-kernel/linux/linux-yocto/0002-Bluetooth-virtio_bt-fix-device-removal.patch
@@ -0,0 +1,78 @@
+From 0eb8535f5991e658ef3a795b4124c04524ca8fc5 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 076e4942a3f0..0ce1778babe6 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);
+ vdev->config->reset(vdev);
++ virtbt_close_vdev(vbt);
+
+ hci_free_dev(hdev);
+ vbt->hdev = NULL;
+--
+2.35.1
+
diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_bt.cfg b/meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_bt.cfg
new file mode 100644
index 00000000..154a05d5
--- /dev/null
+++ b/meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_bt.cfg
@@ -0,0 +1,7 @@
+# Enable BT_VIRTIO ("Virtio Bluetooth driver") config located in menu
+#
+# -> Networking support (NET [=y]) │
+# -> Bluetooth subsystem support (BT [=m]) │
+# -> Bluetooth device drivers │
+#
+CONFIG_BT_VIRTIO=m
diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend
index 2dba2566..d646f535 100644
--- a/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend
+++ b/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend
@@ -5,3 +5,9 @@ SRC_URI += " \
file://0001-drivers-media-Add-config-option-for-virtio-video.patch \
file://virtio_video.cfg \
"
+
+# virtio BT
+SRC_URI += " \
+ file://virtio_bt.cfg \
+ file://0002-Bluetooth-virtio_bt-fix-device-removal.patch \
+"