diff options
-rw-r--r-- | drivers/char/diag/diag_dci.c | 41 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/sde/sde_plane.c | 76 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc.c | 8 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_common.c | 109 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_common.h | 3 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_internal.h | 8 | ||||
-rw-r--r-- | drivers/misc/qseecom.c | 189 | ||||
-rw-r--r-- | drivers/platform/msm/gsi/gsi.c | 17 | ||||
-rw-r--r-- | drivers/soc/qcom/icnss.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/xhci-plat.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdss_debug_xlog.c | 7 | ||||
-rw-r--r-- | sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c | 3 |
12 files changed, 156 insertions, 312 deletions
diff --git a/drivers/char/diag/diag_dci.c b/drivers/char/diag/diag_dci.c index 9a98b0124713..16ff781cde65 100644 --- a/drivers/char/diag/diag_dci.c +++ b/drivers/char/diag/diag_dci.c @@ -26,6 +26,7 @@ #include <linux/reboot.h> #include <asm/current.h> #include <soc/qcom/restart.h> +#include <linux/vmalloc.h> #ifdef CONFIG_DIAG_OVER_USB #include <linux/usb/usbdiag.h> #endif @@ -258,7 +259,7 @@ static int diag_dci_init_buffer(struct diag_dci_buffer_t *buffer, int type) switch (type) { case DCI_BUF_PRIMARY: buffer->capacity = IN_BUF_SIZE; - buffer->data = kzalloc(buffer->capacity, GFP_KERNEL); + buffer->data = vzalloc(buffer->capacity); if (!buffer->data) return -ENOMEM; break; @@ -268,7 +269,7 @@ static int diag_dci_init_buffer(struct diag_dci_buffer_t *buffer, int type) break; case DCI_BUF_CMD: buffer->capacity = DIAG_MAX_REQ_SIZE + DCI_BUF_SIZE; - buffer->data = kzalloc(buffer->capacity, GFP_KERNEL); + buffer->data = vzalloc(buffer->capacity); if (!buffer->data) return -ENOMEM; break; @@ -2719,7 +2720,7 @@ static int diag_dci_init_remote(void) create_dci_event_mask_tbl(temp->event_mask_composite); } - partial_pkt.data = kzalloc(MAX_DCI_PACKET_SZ, GFP_KERNEL); + partial_pkt.data = vzalloc(MAX_DCI_PACKET_SZ); if (!partial_pkt.data) { pr_err("diag: Unable to create partial pkt data\n"); return -ENOMEM; @@ -2775,7 +2776,7 @@ int diag_dci_init(void) goto err; if (driver->apps_dci_buf == NULL) { - driver->apps_dci_buf = kzalloc(DCI_BUF_SIZE, GFP_KERNEL); + driver->apps_dci_buf = vzalloc(DCI_BUF_SIZE); if (driver->apps_dci_buf == NULL) goto err; } @@ -2792,12 +2793,12 @@ int diag_dci_init(void) return DIAG_DCI_NO_ERROR; err: pr_err("diag: Could not initialize diag DCI buffers"); - kfree(driver->apps_dci_buf); + vfree(driver->apps_dci_buf); driver->apps_dci_buf = NULL; if (driver->diag_dci_wq) destroy_workqueue(driver->diag_dci_wq); - kfree(partial_pkt.data); + vfree(partial_pkt.data); partial_pkt.data = NULL; mutex_destroy(&driver->dci_mutex); mutex_destroy(&dci_log_mask_mutex); @@ -2817,9 +2818,9 @@ void diag_dci_channel_init(void) void diag_dci_exit(void) { - kfree(partial_pkt.data); + vfree(partial_pkt.data); partial_pkt.data = NULL; - kfree(driver->apps_dci_buf); + vfree(driver->apps_dci_buf); driver->apps_dci_buf = NULL; mutex_destroy(&driver->dci_mutex); mutex_destroy(&dci_log_mask_mutex); @@ -2959,7 +2960,7 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry) new_entry->in_service = 0; INIT_LIST_HEAD(&new_entry->list_write_buf); mutex_init(&new_entry->write_buf_mutex); - new_entry->dci_log_mask = kzalloc(DCI_LOG_MASK_SIZE, GFP_KERNEL); + new_entry->dci_log_mask = vzalloc(DCI_LOG_MASK_SIZE); if (!new_entry->dci_log_mask) { pr_err("diag: Unable to create log mask for client, %d", driver->dci_client_id); @@ -2967,7 +2968,7 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry) } create_dci_log_mask_tbl(new_entry->dci_log_mask, DCI_LOG_MASK_CLEAN); - new_entry->dci_event_mask = kzalloc(DCI_EVENT_MASK_SIZE, GFP_KERNEL); + new_entry->dci_event_mask = vzalloc(DCI_EVENT_MASK_SIZE); if (!new_entry->dci_event_mask) { pr_err("diag: Unable to create event mask for client, %d", driver->dci_client_id); @@ -2977,7 +2978,7 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry) new_entry->buffers = kzalloc(new_entry->num_buffers * sizeof(struct diag_dci_buf_peripheral_t), - GFP_KERNEL); + GFP_KERNEL); if (!new_entry->buffers) { pr_err("diag: Unable to allocate buffers for peripherals in %s\n", __func__); @@ -3001,7 +3002,7 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry) if (!proc_buf->buf_primary) goto fail_alloc; proc_buf->buf_cmd = kzalloc(sizeof(struct diag_dci_buffer_t), - GFP_KERNEL); + GFP_KERNEL); if (!proc_buf->buf_cmd) goto fail_alloc; err = diag_dci_init_buffer(proc_buf->buf_primary, @@ -3034,7 +3035,7 @@ fail_alloc: if (proc_buf) { mutex_destroy(&proc_buf->health_mutex); if (proc_buf->buf_primary) { - kfree(proc_buf->buf_primary->data); + vfree(proc_buf->buf_primary->data); proc_buf->buf_primary->data = NULL; mutex_destroy( &proc_buf->buf_primary->data_mutex); @@ -3042,7 +3043,7 @@ fail_alloc: kfree(proc_buf->buf_primary); proc_buf->buf_primary = NULL; if (proc_buf->buf_cmd) { - kfree(proc_buf->buf_cmd->data); + vfree(proc_buf->buf_cmd->data); proc_buf->buf_cmd->data = NULL; mutex_destroy( &proc_buf->buf_cmd->data_mutex); @@ -3051,9 +3052,9 @@ fail_alloc: proc_buf->buf_cmd = NULL; } } - kfree(new_entry->dci_event_mask); + vfree(new_entry->dci_event_mask); new_entry->dci_event_mask = NULL; - kfree(new_entry->dci_log_mask); + vfree(new_entry->dci_log_mask); new_entry->dci_log_mask = NULL; kfree(new_entry->buffers); new_entry->buffers = NULL; @@ -3088,7 +3089,7 @@ int diag_dci_deinit_client(struct diag_dci_client_tbl *entry) * Clear the client's log and event masks, update the cumulative * masks and send the masks to peripherals */ - kfree(entry->dci_log_mask); + vfree(entry->dci_log_mask); entry->dci_log_mask = NULL; diag_dci_invalidate_cumulative_log_mask(token); if (token == DCI_LOCAL_PROC) @@ -3097,7 +3098,7 @@ int diag_dci_deinit_client(struct diag_dci_client_tbl *entry) if (ret != DIAG_DCI_NO_ERROR) { return ret; } - kfree(entry->dci_event_mask); + vfree(entry->dci_event_mask); entry->dci_event_mask = NULL; diag_dci_invalidate_cumulative_event_mask(token); if (token == DCI_LOCAL_PROC) @@ -3161,12 +3162,12 @@ int diag_dci_deinit_client(struct diag_dci_client_tbl *entry) } mutex_lock(&proc_buf->buf_primary->data_mutex); - kfree(proc_buf->buf_primary->data); + vfree(proc_buf->buf_primary->data); proc_buf->buf_primary->data = NULL; mutex_unlock(&proc_buf->buf_primary->data_mutex); mutex_lock(&proc_buf->buf_cmd->data_mutex); - kfree(proc_buf->buf_cmd->data); + vfree(proc_buf->buf_cmd->data); proc_buf->buf_cmd->data = NULL; mutex_unlock(&proc_buf->buf_cmd->data_mutex); diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c index 43ff508975dd..acd5687f6d11 100644 --- a/drivers/gpu/drm/msm/sde/sde_plane.c +++ b/drivers/gpu/drm/msm/sde/sde_plane.c @@ -1359,51 +1359,55 @@ static int _sde_plane_mode_set(struct drm_plane *plane, src.y = DIV_ROUND_UP(src.y, 2); src.y &= ~0x1; } - } - list_for_each_entry(pp, &psde->phy_plane_head, phy_plane_list) - num_of_phy_planes++; + list_for_each_entry(pp, &psde->phy_plane_head, phy_plane_list) + num_of_phy_planes++; - /* - * Only need to use one physical plane if plane width is still within - * the limitation. - */ - is_across_mixer_boundary = (plane->state->crtc_x < crtc_split_width) && + /* + * Only need to use one physical plane if plane width + * is still within the limitation. + */ + is_across_mixer_boundary = + (plane->state->crtc_x < crtc_split_width) && (plane->state->crtc_x + plane->state->crtc_w > - crtc_split_width); - if (crtc_split_width >= (src.x + src.w) && !is_across_mixer_boundary) - num_of_phy_planes = 1; + crtc_split_width); + if (crtc_split_width >= (src.x + src.w) && + !is_across_mixer_boundary) + num_of_phy_planes = 1; - if (num_of_phy_planes > 1) { - /* Adjust width for multi-pipe */ - src.w /= num_of_phy_planes; - dst.w /= num_of_phy_planes; - } - - list_for_each_entry(pp, &psde->phy_plane_head, phy_plane_list) { - /* Adjust offset for multi-pipe */ if (num_of_phy_planes > 1) { - src.x += src.w * pp->index; - dst.x += dst.w * pp->index; + /* Adjust width for multi-pipe */ + src.w /= num_of_phy_planes; + dst.w /= num_of_phy_planes; } - pp->pipe_cfg.src_rect = src; - pp->pipe_cfg.dst_rect = dst; - - /* check for color fill */ - pp->color_fill = (uint32_t)sde_plane_get_property(pstate, - PLANE_PROP_COLOR_FILL); - if (pp->color_fill & SDE_PLANE_COLOR_FILL_FLAG) { - /* skip remaining processing on color fill */ - pstate->dirty = 0x0; - } else if (pp->pipe_hw->ops.setup_rects) { - _sde_plane_setup_scaler(pp, fmt, pstate); - pp->pipe_hw->ops.setup_rects(pp->pipe_hw, - &pp->pipe_cfg, &pp->pixel_ext, - pp->scaler3_cfg); + list_for_each_entry(pp, &psde->phy_plane_head, phy_plane_list) { + /* Adjust offset for multi-pipe */ + if (num_of_phy_planes > 1) { + src.x += src.w * pp->index; + dst.x += dst.w * pp->index; + } + pp->pipe_cfg.src_rect = src; + pp->pipe_cfg.dst_rect = dst; + + /* check for color fill */ + pp->color_fill = (uint32_t)sde_plane_get_property( + pstate, PLANE_PROP_COLOR_FILL); + if (pp->color_fill & SDE_PLANE_COLOR_FILL_FLAG) { + /* skip remaining processing on color fill */ + pstate->dirty = 0x0; + } else if (pp->pipe_hw->ops.setup_rects) { + _sde_plane_setup_scaler(pp, fmt, pstate); + + pp->pipe_hw->ops.setup_rects(pp->pipe_hw, + &pp->pipe_cfg, &pp->pixel_ext, + pp->scaler3_cfg); + } } + } - if (((pstate->dirty & SDE_PLANE_DIRTY_FORMAT) || + list_for_each_entry(pp, &psde->phy_plane_head, phy_plane_list) { + if (((pstate->dirty & SDE_PLANE_DIRTY_FORMAT) || (src_flags & SDE_SSPP_SECURE_OVERLAY_SESSION)) && pp->pipe_hw->ops.setup_format) { diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c index 20d5ba661a6b..c288568edfbd 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_vidc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1238,7 +1238,7 @@ static inline int vb2_bufq_init(struct msm_vidc_inst *inst, q->ops = msm_venc_get_vb2q_ops(); q->mem_ops = &msm_vidc_vb2_mem_ops; q->drv_priv = inst; - q->allow_zero_bytesused = !V4L2_TYPE_IS_OUTPUT(type); + q->allow_zero_bytesused = 1; return vb2_queue_init(q); } @@ -1356,7 +1356,6 @@ void *msm_vidc_open(int core_id, int session_type) INIT_MSM_VIDC_LIST(&inst->pending_getpropq); INIT_MSM_VIDC_LIST(&inst->outputbufs); INIT_MSM_VIDC_LIST(&inst->registeredbufs); - INIT_MSM_VIDC_LIST(&inst->eosbufs); kref_init(&inst->kref); @@ -1449,7 +1448,6 @@ fail_mem_client: DEINIT_MSM_VIDC_LIST(&inst->pending_getpropq); DEINIT_MSM_VIDC_LIST(&inst->outputbufs); DEINIT_MSM_VIDC_LIST(&inst->registeredbufs); - DEINIT_MSM_VIDC_LIST(&inst->eosbufs); kfree(inst); inst = NULL; @@ -1475,7 +1473,6 @@ static void cleanup_instance(struct msm_vidc_inst *inst) dprintk(VIDC_ERR, "Failed to release scratch buffers\n"); } - msm_comm_release_eos_buffers(inst); if (msm_comm_release_persist_buffers(inst)) { dprintk(VIDC_ERR, @@ -1519,7 +1516,6 @@ int msm_vidc_destroy(struct msm_vidc_inst *inst) DEINIT_MSM_VIDC_LIST(&inst->pending_getpropq); DEINIT_MSM_VIDC_LIST(&inst->outputbufs); DEINIT_MSM_VIDC_LIST(&inst->registeredbufs); - DEINIT_MSM_VIDC_LIST(&inst->eosbufs); v4l2_fh_del(&inst->event_handler); v4l2_fh_exit(&inst->event_handler); diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index 17c5066ae13f..3af6e53b21e7 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -1829,26 +1829,6 @@ static struct vb2_buffer *get_vb_from_device_addr(struct buf_queue *bufq, return vb; } -static bool is_eos_buffer(struct msm_vidc_inst *inst, u32 device_addr) -{ - struct eos_buf *temp, *next; - bool found = false; - - mutex_lock(&inst->eosbufs.lock); - list_for_each_entry_safe(temp, next, &inst->eosbufs.list, list) { - if (temp->smem->device_addr == device_addr) { - found = true; - list_del(&temp->list); - msm_comm_smem_free(inst, temp->smem); - kfree(temp); - break; - } - } - mutex_unlock(&inst->eosbufs.lock); - - return found; -} - static void handle_ebd(enum hal_command_response cmd, void *data) { struct msm_vidc_cb_data_done *response = data; @@ -1869,14 +1849,6 @@ static void handle_ebd(enum hal_command_response cmd, void *data) return; } - empty_buf_done = (struct vidc_hal_ebd *)&response->input_done; - /* If this is internal EOS buffer, handle it in driver */ - if (is_eos_buffer(inst, empty_buf_done->packet_buffer)) { - dprintk(VIDC_DBG, "Received EOS buffer %pK\n", - (void *)empty_buf_done->packet_buffer); - goto exit; - } - vb = get_vb_from_device_addr(&inst->bufq[OUTPUT_PORT], response->input_done.packet_buffer); if (vb) { @@ -1928,7 +1900,6 @@ static void handle_ebd(enum hal_command_response cmd, void *data) msm_vidc_debugfs_update(inst, MSM_VIDC_DEBUGFS_EVENT_EBD); } -exit: put_inst(inst); } @@ -3616,66 +3587,6 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd) "Failed to flush buffers: %d\n", rc); } break; - - case V4L2_DEC_CMD_STOP: - { - struct vidc_frame_data data = {0}; - struct hfi_device *hdev; - struct eos_buf *binfo; - u32 smem_flags = 0; - - get_inst(inst->core, inst); - if (inst->session_type != MSM_VIDC_DECODER) { - dprintk(VIDC_DBG, - "Non-Decoder session. DEC_STOP is not valid\n"); - rc = -EINVAL; - goto exit; - } - - binfo = kzalloc(sizeof(*binfo), GFP_KERNEL); - if (!binfo) { - dprintk(VIDC_ERR, "%s: Out of memory\n", __func__); - rc = -ENOMEM; - goto exit; - } - - if (inst->flags & VIDC_SECURE) - smem_flags |= SMEM_SECURE; - - binfo->smem = msm_comm_smem_alloc(inst, - SZ_4K, 1, smem_flags, - HAL_BUFFER_INPUT, 0); - if (!binfo->smem) { - dprintk(VIDC_ERR, - "Failed to allocate eos memory\n"); - goto exit; - } - - mutex_lock(&inst->eosbufs.lock); - list_add_tail(&binfo->list, &inst->eosbufs.list); - mutex_unlock(&inst->eosbufs.lock); - - data.alloc_len = binfo->smem->size; - data.device_addr = binfo->smem->device_addr; - data.clnt_data = data.device_addr; - data.buffer_type = HAL_BUFFER_INPUT; - data.filled_len = 0; - data.offset = 0; - data.flags = HAL_BUFFERFLAG_EOS; - data.timestamp = LLONG_MAX; - data.extradata_addr = data.device_addr; - data.extradata_size = 0; - dprintk(VIDC_DBG, "Queueing EOS buffer %pK\n", - (void *)data.device_addr); - hdev = inst->core->device; - - rc = call_hfi_op(hdev, session_etb, inst->session, - &data); -exit: - put_inst(inst); - break; - } - default: dprintk(VIDC_ERR, "Unknown Command %d\n", which_cmd); rc = -ENOTSUPP; @@ -4396,26 +4307,6 @@ exit: return rc; } -void msm_comm_release_eos_buffers(struct msm_vidc_inst *inst) -{ - struct eos_buf *buf, *next; - - if (!inst) { - dprintk(VIDC_ERR, - "Invalid instance pointer = %pK\n", inst); - return; - } - - mutex_lock(&inst->eosbufs.lock); - list_for_each_entry_safe(buf, next, &inst->eosbufs.list, list) { - list_del(&buf->list); - msm_comm_smem_free(inst, buf->smem); - kfree(buf); - } - INIT_LIST_HEAD(&inst->eosbufs.list); - mutex_unlock(&inst->eosbufs.lock); -} - int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst) { struct msm_smem *handle; diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.h b/drivers/media/platform/msm/vidc/msm_vidc_common.h index d6e8a84fb5bb..ef1898dd36c3 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.h +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -60,7 +60,6 @@ int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst, bool check_for_reuse); int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst); int msm_comm_release_output_buffers(struct msm_vidc_inst *inst); -void msm_comm_release_eos_buffers(struct msm_vidc_inst *inst); int msm_comm_force_cleanup(struct msm_vidc_inst *inst); int msm_comm_suspend(int core_id); enum hal_extradata_id msm_comm_get_hal_extradata_index( diff --git a/drivers/media/platform/msm/vidc/msm_vidc_internal.h b/drivers/media/platform/msm/vidc/msm_vidc_internal.h index 08ba0bfb566e..2a4033598bd2 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_internal.h +++ b/drivers/media/platform/msm/vidc/msm_vidc_internal.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -132,11 +132,6 @@ enum buffer_owner { MAX_OWNER }; -struct eos_buf { - struct list_head list; - struct msm_smem *smem; -}; - struct internal_buf { struct list_head list; enum hal_buffer buffer_type; @@ -275,7 +270,6 @@ struct msm_vidc_inst { struct msm_vidc_list persistbufs; struct msm_vidc_list pending_getpropq; struct msm_vidc_list outputbufs; - struct msm_vidc_list eosbufs; struct msm_vidc_list registeredbufs; struct buffer_requirements buff_req; void *mem_client; diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 98657d0a6822..ce47780e5936 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -1,6 +1,6 @@ /*Qualcomm Secure Execution Environment Communicator (QSEECOM) driver * - * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1845,7 +1845,7 @@ static int __qseecom_process_incomplete_cmd(struct qseecom_dev_handle *data, return ret; } -static int __qseecom_process_blocked_on_listener_legacy( +static int __qseecom_process_reentrancy_blocked_on_listener( struct qseecom_command_scm_resp *resp, struct qseecom_registered_app_list *ptr_app, struct qseecom_dev_handle *data) @@ -1854,8 +1854,11 @@ static int __qseecom_process_blocked_on_listener_legacy( int ret = 0; struct qseecom_continue_blocked_request_ireq ireq; struct qseecom_command_scm_resp continue_resp; - bool found_app = false; + unsigned int session_id; + sigset_t new_sigset; + sigset_t old_sigset; unsigned long flags; + bool found_app = false; if (!resp || !data) { pr_err("invalid resp or data pointer\n"); @@ -1886,137 +1889,81 @@ static int __qseecom_process_blocked_on_listener_legacy( } } - list_ptr = __qseecom_find_svc(resp->data); - if (!list_ptr) { - pr_err("Invalid listener ID\n"); - ret = -ENODATA; - goto exit; - } - pr_debug("lsntr %d in_use = %d\n", - resp->data, list_ptr->listener_in_use); - ptr_app->blocked_on_listener_id = resp->data; - - /* sleep until listener is available */ do { - qseecom.app_block_ref_cnt++; - ptr_app->app_blocked = true; - mutex_unlock(&app_access_lock); - if (wait_event_freezable( - list_ptr->listener_block_app_wq, - !list_ptr->listener_in_use)) { - pr_err("Interrupted: listener_id %d, app_id %d\n", - resp->data, ptr_app->app_id); - ret = -ERESTARTSYS; + session_id = resp->resp_type; + list_ptr = __qseecom_find_svc(resp->data); + if (!list_ptr) { + pr_err("Invalid listener ID %d\n", resp->data); + ret = -ENODATA; goto exit; } - mutex_lock(&app_access_lock); - ptr_app->app_blocked = false; - qseecom.app_block_ref_cnt--; - } while (list_ptr->listener_in_use); - - ptr_app->blocked_on_listener_id = 0; - /* notify the blocked app that listener is available */ - pr_warn("Lsntr %d is available, unblock app(%d) %s in TZ\n", - resp->data, data->client.app_id, - data->client.app_name); - ireq.qsee_cmd_id = QSEOS_CONTINUE_BLOCKED_REQ_COMMAND; - ireq.app_or_session_id = data->client.app_id; - ret = qseecom_scm_call(SCM_SVC_TZSCHEDULER, 1, - &ireq, sizeof(ireq), - &continue_resp, sizeof(continue_resp)); - if (ret) { - pr_err("scm_call for continue blocked req for app(%d) %s failed, ret %d\n", - data->client.app_id, - data->client.app_name, ret); - goto exit; - } - /* - * After TZ app is unblocked, then continue to next case - * for incomplete request processing - */ - resp->result = QSEOS_RESULT_INCOMPLETE; -exit: - return ret; -} + ptr_app->blocked_on_listener_id = resp->data; -static int __qseecom_process_blocked_on_listener_smcinvoke( - struct qseecom_command_scm_resp *resp, uint32_t app_id) -{ - struct qseecom_registered_listener_list *list_ptr; - int ret = 0; - struct qseecom_continue_blocked_request_ireq ireq; - struct qseecom_command_scm_resp continue_resp; - unsigned int session_id; + pr_warn("Lsntr %d in_use %d, block session(%d) app(%d)\n", + resp->data, list_ptr->listener_in_use, + session_id, data->client.app_id); - if (!resp) { - pr_err("invalid resp pointer\n"); - ret = -EINVAL; - goto exit; - } - session_id = resp->resp_type; - list_ptr = __qseecom_find_svc(resp->data); - if (!list_ptr) { - pr_err("Invalid listener ID\n"); - ret = -ENODATA; - goto exit; - } - pr_debug("lsntr %d in_use = %d\n", - resp->data, list_ptr->listener_in_use); - /* sleep until listener is available */ - do { - qseecom.app_block_ref_cnt++; - mutex_unlock(&app_access_lock); - if (wait_event_freezable( - list_ptr->listener_block_app_wq, - !list_ptr->listener_in_use)) { - pr_err("Interrupted: listener_id %d, session_id %d\n", - resp->data, session_id); - ret = -ERESTARTSYS; - goto exit; - } - mutex_lock(&app_access_lock); - qseecom.app_block_ref_cnt--; - } while (list_ptr->listener_in_use); + /* sleep until listener is available */ + sigfillset(&new_sigset); + sigprocmask(SIG_SETMASK, &new_sigset, &old_sigset); + + do { + qseecom.app_block_ref_cnt++; + ptr_app->app_blocked = true; + mutex_unlock(&app_access_lock); + wait_event_freezable( + list_ptr->listener_block_app_wq, + !list_ptr->listener_in_use); + mutex_lock(&app_access_lock); + ptr_app->app_blocked = false; + qseecom.app_block_ref_cnt--; + } while (list_ptr->listener_in_use); + + sigprocmask(SIG_SETMASK, &old_sigset, NULL); + + ptr_app->blocked_on_listener_id = 0; + pr_warn("Lsntr %d is available, unblock session(%d) app(%d)\n", + resp->data, session_id, data->client.app_id); + + /* notify TZ that listener is available */ + ireq.qsee_cmd_id = QSEOS_CONTINUE_BLOCKED_REQ_COMMAND; + + if (qseecom.smcinvoke_support) + ireq.app_or_session_id = session_id; + else + ireq.app_or_session_id = data->client.app_id; - /* notify TZ that listener is available */ - pr_warn("Lsntr %d is available, unblock session(%d) in TZ\n", - resp->data, session_id); - ireq.qsee_cmd_id = QSEOS_CONTINUE_BLOCKED_REQ_COMMAND; - ireq.app_or_session_id = session_id; - ret = qseecom_scm_call(SCM_SVC_TZSCHEDULER, 1, - &ireq, sizeof(ireq), - &continue_resp, sizeof(continue_resp)); - if (ret) { - /* retry with legacy cmd */ - qseecom.smcinvoke_support = false; - ireq.app_or_session_id = app_id; ret = qseecom_scm_call(SCM_SVC_TZSCHEDULER, 1, - &ireq, sizeof(ireq), - &continue_resp, sizeof(continue_resp)); - qseecom.smcinvoke_support = true; - if (ret) { - pr_err("cont block req for app %d or session %d fail\n", - app_id, session_id); - goto exit; + &ireq, sizeof(ireq), + &continue_resp, sizeof(continue_resp)); + if (ret && qseecom.smcinvoke_support) { + /* retry with legacy cmd */ + qseecom.smcinvoke_support = false; + ireq.app_or_session_id = data->client.app_id; + ret = qseecom_scm_call(SCM_SVC_TZSCHEDULER, 1, + &ireq, sizeof(ireq), + &continue_resp, sizeof(continue_resp)); + qseecom.smcinvoke_support = true; + if (ret) { + pr_err("unblock app %d or session %d fail\n", + data->client.app_id, session_id); + goto exit; + } } + resp->result = continue_resp.result; + resp->resp_type = continue_resp.resp_type; + resp->data = continue_resp.data; + pr_debug("unblock resp = %d\n", resp->result); + } while (resp->result == QSEOS_RESULT_BLOCKED_ON_LISTENER); + + if (resp->result != QSEOS_RESULT_INCOMPLETE) { + pr_err("Unexpected unblock resp %d\n", resp->result); + ret = -EINVAL; } - resp->result = QSEOS_RESULT_INCOMPLETE; exit: return ret; } -static int __qseecom_process_reentrancy_blocked_on_listener( - struct qseecom_command_scm_resp *resp, - struct qseecom_registered_app_list *ptr_app, - struct qseecom_dev_handle *data) -{ - if (!qseecom.smcinvoke_support) - return __qseecom_process_blocked_on_listener_legacy( - resp, ptr_app, data); - else - return __qseecom_process_blocked_on_listener_smcinvoke( - resp, data->client.app_id); -} static int __qseecom_reentrancy_process_incomplete_cmd( struct qseecom_dev_handle *data, struct qseecom_command_scm_resp *resp) diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index 2ae2438032b7..20351dd8a492 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1082,13 +1082,14 @@ int gsi_alloc_evt_ring(struct gsi_evt_ring_props *props, unsigned long dev_hdl, uint32_t val; struct gsi_evt_ctx *ctx; int res; - int ee = gsi_ctx->per.ee; + int ee; unsigned long flags; if (!gsi_ctx) { pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } + ee = gsi_ctx->per.ee; if (!props || !evt_ring_hdl || dev_hdl != (uintptr_t)gsi_ctx) { GSIERR("bad params props=%p dev_hdl=0x%lx evt_ring_hdl=%p\n", @@ -1605,7 +1606,7 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, struct gsi_chan_ctx *ctx; uint32_t val; int res; - int ee = gsi_ctx->per.ee; + int ee; enum gsi_ch_cmd_opcode op = GSI_CH_ALLOCATE; uint8_t erindex; void **user_data; @@ -1614,6 +1615,7 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } + ee = gsi_ctx->per.ee; if (!props || !chan_hdl || dev_hdl != (uintptr_t)gsi_ctx) { GSIERR("bad params props=%p dev_hdl=0x%lx chan_hdl=%p\n", @@ -2208,12 +2210,13 @@ int gsi_query_channel_info(unsigned long chan_hdl, unsigned long flags; uint64_t rp; uint64_t wp; - int ee = gsi_ctx->per.ee; + int ee; if (!gsi_ctx) { pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } + ee = gsi_ctx->per.ee; if (chan_hdl >= gsi_ctx->max_ch || !info) { GSIERR("bad params chan_hdl=%lu info=%p\n", chan_hdl, info); @@ -2278,12 +2281,13 @@ int gsi_is_channel_empty(unsigned long chan_hdl, bool *is_empty) unsigned long flags; uint64_t rp; uint64_t wp; - int ee = gsi_ctx->per.ee; + int ee; if (!gsi_ctx) { pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } + ee = gsi_ctx->per.ee; if (chan_hdl >= gsi_ctx->max_ch || !is_empty) { GSIERR("bad params chan_hdl=%lu is_empty=%p\n", @@ -2464,13 +2468,14 @@ int gsi_poll_channel(unsigned long chan_hdl, { struct gsi_chan_ctx *ctx; uint64_t rp; - int ee = gsi_ctx->per.ee; + int ee; unsigned long flags; if (!gsi_ctx) { pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } + ee = gsi_ctx->per.ee; if (chan_hdl >= gsi_ctx->max_ch || !notify) { GSIERR("bad params chan_hdl=%lu notify=%p\n", chan_hdl, notify); diff --git a/drivers/soc/qcom/icnss.c b/drivers/soc/qcom/icnss.c index 848328a1a4ea..4dfb533b724a 100644 --- a/drivers/soc/qcom/icnss.c +++ b/drivers/soc/qcom/icnss.c @@ -1181,8 +1181,9 @@ bool icnss_is_fw_down(void) { if (!penv) return false; - else - return test_bit(ICNSS_FW_DOWN, &penv->state); + + return test_bit(ICNSS_FW_DOWN, &penv->state) || + test_bit(ICNSS_PD_RESTART, &penv->state); } EXPORT_SYMBOL(icnss_is_fw_down); diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c9596f1a7d26..408c8eca2bbe 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -353,7 +353,7 @@ static int xhci_plat_resume(struct device *dev) dev_dbg(dev, "xhci-plat PM resume\n"); - return xhci_resume(xhci, false); + return (!hcd_to_bus(hcd)->skip_resume) ? xhci_resume(xhci, false) : 0; } #endif diff --git a/drivers/video/fbdev/msm/mdss_debug_xlog.c b/drivers/video/fbdev/msm/mdss_debug_xlog.c index aeefc81657b0..10d747962a91 100644 --- a/drivers/video/fbdev/msm/mdss_debug_xlog.c +++ b/drivers/video/fbdev/msm/mdss_debug_xlog.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -755,6 +755,11 @@ static ssize_t mdss_xlog_dump_read(struct file *file, char __user *buff, if (__mdss_xlog_dump_calc_range()) { len = mdss_xlog_dump_entry(xlog_buf, MDSS_XLOG_BUF_MAX); + if (len < 0 || len > count) { + pr_err("len is more than the size of user buffer\n"); + return 0; + } + if (copy_to_user(buff, xlog_buf, len)) return -EFAULT; *ppos += len; diff --git a/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c index 27daa3a3f061..26b40d2081f0 100644 --- a/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c @@ -4125,7 +4125,8 @@ static struct snd_soc_dai_driver msm_dai_q6_mi2s_dai[] = { SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, .rate_min = 8000, .rate_max = 192000, }, |