]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: venus: Add new interface queues reinit
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Thu, 30 Jul 2020 11:46:32 +0000 (13:46 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 1 Sep 2020 12:13:29 +0000 (14:13 +0200)
Presently the recovery mechanism is using two hfi functions
to destroy and create interface queues. For the purpose of
recovery we don't need to free and allocate the memory used
for interface message queues, that's why we introduce new
function which just reinit the queues.  Also this will give
to the recovery procedure one less reason to fail (if for
some reason we couldn't allocate memory).

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/venus/core.c
drivers/media/platform/qcom/venus/hfi.c
drivers/media/platform/qcom/venus/hfi.h
drivers/media/platform/qcom/venus/hfi_venus.c
drivers/media/platform/qcom/venus/hfi_venus.h

index 6a5c18c36c9226533bf4d4de0aedc64f2ba5d11a..83131933e7c9f8ae558497b384269c815aba277e 100644 (file)
@@ -72,8 +72,7 @@ static void venus_sys_error_handler(struct work_struct *work)
        while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0]))
                usleep_range(1000, 1500);
 
-       hfi_destroy(core);
-       ret |= hfi_create(core, &venus_core_ops);
+       hfi_reinit(core);
 
        pm_runtime_get_sync(core->dev);
 
index a211eb93e0f924f6ec22a6eb6b86fdddaa8cd797..a59022adb14c72894aa039981be6ab783f7aa9db 100644 (file)
@@ -517,3 +517,8 @@ void hfi_destroy(struct venus_core *core)
 {
        venus_hfi_destroy(core);
 }
+
+void hfi_reinit(struct venus_core *core)
+{
+       venus_hfi_queues_reinit(core);
+}
index 62c31529148481791889f5a9497c8c7b7a03ab25..f25d412d6553f9b544ab0ee7998afb33aead6f2e 100644 (file)
@@ -145,6 +145,7 @@ struct hfi_ops {
 
 int hfi_create(struct venus_core *core, const struct hfi_core_ops *ops);
 void hfi_destroy(struct venus_core *core);
+void hfi_reinit(struct venus_core *core);
 
 int hfi_core_init(struct venus_core *core);
 int hfi_core_deinit(struct venus_core *core, bool blocking);
index 3392fd177d22cb3aeed36b70aac99166c546b2e0..90067cd8c89261baebd8db511c6b023e1d324323 100644 (file)
@@ -1603,3 +1603,54 @@ err_kfree:
        core->ops = NULL;
        return ret;
 }
+
+void venus_hfi_queues_reinit(struct venus_core *core)
+{
+       struct venus_hfi_device *hdev = to_hfi_priv(core);
+       struct hfi_queue_table_header *tbl_hdr;
+       struct iface_queue *queue;
+       struct hfi_sfr *sfr;
+       unsigned int i;
+
+       mutex_lock(&hdev->lock);
+
+       for (i = 0; i < IFACEQ_NUM; i++) {
+               queue = &hdev->queues[i];
+               queue->qhdr =
+                       IFACEQ_GET_QHDR_START_ADDR(hdev->ifaceq_table.kva, i);
+
+               venus_set_qhdr_defaults(queue->qhdr);
+
+               queue->qhdr->start_addr = queue->qmem.da;
+
+               if (i == IFACEQ_CMD_IDX)
+                       queue->qhdr->type |= HFI_HOST_TO_CTRL_CMD_Q;
+               else if (i == IFACEQ_MSG_IDX)
+                       queue->qhdr->type |= HFI_CTRL_TO_HOST_MSG_Q;
+               else if (i == IFACEQ_DBG_IDX)
+                       queue->qhdr->type |= HFI_CTRL_TO_HOST_DBG_Q;
+       }
+
+       tbl_hdr = hdev->ifaceq_table.kva;
+       tbl_hdr->version = 0;
+       tbl_hdr->size = IFACEQ_TABLE_SIZE;
+       tbl_hdr->qhdr0_offset = sizeof(struct hfi_queue_table_header);
+       tbl_hdr->qhdr_size = sizeof(struct hfi_queue_header);
+       tbl_hdr->num_q = IFACEQ_NUM;
+       tbl_hdr->num_active_q = IFACEQ_NUM;
+
+       /*
+        * Set receive request to zero on debug queue as there is no
+        * need of interrupt from video hardware for debug messages
+        */
+       queue = &hdev->queues[IFACEQ_DBG_IDX];
+       queue->qhdr->rx_req = 0;
+
+       sfr = hdev->sfr.kva;
+       sfr->buf_size = ALIGNED_SFR_SIZE;
+
+       /* ensure table and queue header structs are settled in memory */
+       wmb();
+
+       mutex_unlock(&hdev->lock);
+}
index 57154832090e98e338691d0a50229cd301cc341e..1b656ef2bf07248f5f5a37454d545d0e22abb05d 100644 (file)
@@ -10,5 +10,6 @@ struct venus_core;
 
 void venus_hfi_destroy(struct venus_core *core);
 int venus_hfi_create(struct venus_core *core);
+void venus_hfi_queues_reinit(struct venus_core *core);
 
 #endif