Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7440a85 authored by George Shen's avatar George Shen
Browse files

msm: cvp: Don't access deleted session during SSR



It may cause undefined behavior if CVP driver continue access
deleted session attributes during SSR (SubSystem Restart). The
change is to fix the potential issues.

Change-Id: I3f245eb966b10f0748f7f7be069c271d011fd01e
Signed-off-by: default avatarGeorge Shen <sqiao@codeaurora.org>
parent ad302b00
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1387,6 +1387,8 @@ static void cvp_dump_csr(struct iris_hfi_device *dev)

	if (!dev)
		return;
	if (!dev->power_enabled)
		return;
	reg = __read_register(dev, CVP_WRAPPER_CPU_STATUS);
	dprintk(CVP_ERR, "CVP_WRAPPER_CPU_STATUS: %x\n", reg);
	reg = __read_register(dev, CVP_CPU_CS_SCIACMDARG0);
@@ -2060,6 +2062,7 @@ static int __interface_queues_init(struct iris_hfi_device *dev)
	}

	vsfr = (struct cvp_hfi_sfr_struct *) dev->sfr.align_virtual_addr;
	if (vsfr)
		vsfr->bufSize = ALIGNED_SFR_SIZE;

	rc = __interface_dsp_queues_init(dev);
@@ -4669,7 +4672,7 @@ static void __unload_fw(struct iris_hfi_device *device)
	device->resources.fw.cookie = NULL;
	__deinit_resources(device);

	dprintk(CVP_DBG, "Firmware unloaded successfully\n");
	dprintk(CVP_WARN, "Firmware unloaded\n");
}

static int iris_hfi_get_fw_info(void *dev, struct cvp_hal_fw_info *fw_info)
+11 −9
Original line number Diff line number Diff line
@@ -638,15 +638,17 @@ static void handle_sys_error(enum hal_command_response cmd, void *data)
	call_hfi_op(hdev, flush_debug_queue, hdev->hfi_device_data);
	list_for_each_entry(inst, &core->instances, list) {
		dprintk(CVP_WARN,
			"%s: sys error for inst %#x kref %x, cmd %x\n",
			"%s: sys error inst %#x kref %x, cmd %x state %x\n",
				__func__, inst, kref_read(&inst->kref),
				inst->cur_cmd_type);
				inst->cur_cmd_type, inst->state);
		if (inst->state != MSM_CVP_CORE_INVALID) {
			change_cvp_inst_state(inst, MSM_CVP_CORE_INVALID);

			spin_lock_irqsave(&inst->event_handler.lock, flags);
			inst->event_handler.event = CVP_SSR_EVENT;
		spin_unlock_irqrestore(&inst->event_handler.lock, flags);
			spin_unlock_irqrestore(
				&inst->event_handler.lock, flags);
			wake_up_all(&inst->event_handler.wq);
		}

		if (!core->trigger_ssr)
			msm_cvp_comm_print_inst_info(inst);
@@ -1477,7 +1479,7 @@ int msm_cvp_comm_kill_session(struct msm_cvp_inst *inst)
		}
	}

	if (inst->state == MSM_CVP_CORE_UNINIT) {
	if (inst->state >= MSM_CVP_CORE_UNINIT) {
		spin_lock_irqsave(&inst->event_handler.lock, flags);
		inst->event_handler.event = CVP_SSR_EVENT;
		spin_unlock_irqrestore(&inst->event_handler.lock, flags);