clear-pkgs-linux-iot-lts2018/1135-media-intel-ipu4-VIRT-...

85 lines
2.5 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
Date: Fri, 5 Jul 2019 07:38:37 +0800
Subject: [PATCH] media: intel-ipu4: [VIRT] Remove hash table entry on resume
SOS crashed and warm-rebooted in ipu_vbk_hash_find during suspend/resume
Root caused to addition of new entry added to ipu backend hash table on
resume but the entry is not removed on suspend.
Tracked-On: OAM-83283
Tracked-On: PKT-2253
Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
---
.../pci/intel/virtio/intel-ipu4-virtio-be.c | 39 +++++++++++++------
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/drivers/media/pci/intel/virtio/intel-ipu4-virtio-be.c b/drivers/media/pci/intel/virtio/intel-ipu4-virtio-be.c
2020-10-27 02:14:06 +08:00
index a4b950a128d7..75e93e47fa83 100644
--- a/drivers/media/pci/intel/virtio/intel-ipu4-virtio-be.c
+++ b/drivers/media/pci/intel/virtio/intel-ipu4-virtio-be.c
@@ -77,17 +77,6 @@ static void ipu_vbk_hash_init(void)
ipu_vbk_hash_initialized = 1;
}
-static int ipu_vbk_hash_add(struct ipu4_virtio_be_priv *entry)
-{
- if (!ipu_vbk_hash_initialized) {
- pr_err("RNG hash table not initialized!\n");
- return -1;
- }
-
- hash_add(HASH_NAME, &entry->node, virtio_dev_client_id(&entry->dev));
- return 0;
-}
-
static struct ipu4_virtio_be_priv *ipu_vbk_hash_find(int client_id)
{
struct ipu4_virtio_be_priv *entry;
@@ -106,6 +95,24 @@ static struct ipu4_virtio_be_priv *ipu_vbk_hash_find(int client_id)
return NULL;
}
+static int ipu_vbk_hash_add(struct ipu4_virtio_be_priv *entry)
+{
+ struct ipu4_virtio_be_priv *priv;
+ int client_id;
+
+ if (!ipu_vbk_hash_initialized) {
+ pr_err("RNG hash table not initialized!\n");
+ return -1;
+ }
+
+ client_id = virtio_dev_client_id(&entry->dev);
+ priv = ipu_vbk_hash_find(client_id);
+ if (priv == NULL)
+ hash_add(HASH_NAME, &entry->node, client_id);
+
+ return 0;
+}
+
static int ipu_vbk_hash_del(int client_id)
{
struct ipu4_virtio_be_priv *entry;
@@ -388,6 +395,16 @@ static long ipu_vbk_ioctl(struct file *f, unsigned int ioctl,
pr_err("VBS_RESET_DEV: virtio_vqs_ioctl failed!\n");
return -EFAULT;
}
+ pr_debug("ipu_vbk_connection cnt is %d\n",
+ ipu_vbk_connection_cnt);
+
+ if (priv && ipu_vbk_connection_cnt--)
+ ipu_vbk_hash_del(virtio_dev_client_id(&priv->dev));
+ if (!ipu_vbk_connection_cnt) {
+ pr_debug("ipu4_virtio_be_priv remove all hash entries\n");
+ ipu_vbk_hash_del_all();
+ }
+
return r;
default:
/*mutex_lock(&n->dev.mutex);*/
--
https://clearlinux.org