Skip to content

Commit

Permalink
Merge tag 'LA.UM.7.2.r1-06500-sdm660.0' into caf-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
KarthikKarhem committed Mar 10, 2019
2 parents 3b77724 + 12d8239 commit 3a3b654
Show file tree
Hide file tree
Showing 11 changed files with 182 additions and 72 deletions.
14 changes: 12 additions & 2 deletions drivers/iommu/dma-mapping-fast.c
@@ -1,4 +1,4 @@
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017,2019, 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
Expand Down Expand Up @@ -513,12 +513,22 @@ static void *fast_smmu_alloc(struct device *dev, size_t size,
av8l_fast_iopte *ptep;
unsigned long flags;
struct sg_mapping_iter miter;
unsigned int count = ALIGN(size, SZ_4K) >> PAGE_SHIFT;
size_t count = ALIGN(size, SZ_4K) >> PAGE_SHIFT;
int prot = IOMMU_READ | IOMMU_WRITE; /* TODO: extract from attrs */
bool is_coherent = is_dma_coherent(dev, attrs);
pgprot_t remap_prot = __get_dma_pgprot(attrs, PAGE_KERNEL, is_coherent);
struct page **pages;

/*
* sg_alloc_table_from_pages accepts unsigned int value for count
* so check count doesn't exceed UINT_MAX.
*/

if (count > UINT_MAX) {
dev_err(dev, "count: %zx exceeds UNIT_MAX\n", count);
return NULL;
}

prot = __get_iommu_pgprot(attrs, prot, is_coherent);

*handle = DMA_ERROR_CODE;
Expand Down
10 changes: 5 additions & 5 deletions drivers/iommu/iommu-debug.c
Expand Up @@ -1403,7 +1403,7 @@ static ssize_t iommu_debug_virt_addr_read(struct file *file, char __user *ubuf,
else
snprintf(buf, 100, "0x%pK\n", virt_addr);

buflen = min(count, strlen(buf)+1);
buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
Expand Down Expand Up @@ -1527,7 +1527,7 @@ static ssize_t iommu_debug_pte_read(struct file *file, char __user *ubuf,
else
snprintf(buf, 100, "pte=%016llx\n", pte);

buflen = min(count, strlen(buf)+1);
buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
Expand Down Expand Up @@ -1596,7 +1596,7 @@ static ssize_t iommu_debug_atos_read(struct file *file, char __user *ubuf,
snprintf(buf, 100, "%pa\n", &phys);
}

buflen = min(count, strlen(buf)+1);
buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
Expand Down Expand Up @@ -1649,7 +1649,7 @@ static ssize_t iommu_debug_dma_atos_read(struct file *file, char __user *ubuf,
else
snprintf(buf, 100, "%pa\n", &phys);

buflen = min(count, strlen(buf)+1);
buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
Expand Down Expand Up @@ -1880,7 +1880,7 @@ static ssize_t iommu_debug_dma_map_read(struct file *file, char __user *ubuf,
iova = ddev->iova;
snprintf(buf, 100, "%pa\n", &iova);

buflen = min(count, strlen(buf)+1);
buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
Expand Down
65 changes: 46 additions & 19 deletions drivers/media/platform/msm/vidc/hfi_response_handler.c
@@ -1,4 +1,4 @@
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, 2019 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
Expand Down Expand Up @@ -316,9 +316,10 @@ static int hfi_process_session_error(u32 device_id,
}

static int hfi_process_event_notify(u32 device_id,
struct hfi_msg_event_notify_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_event_notify_packet *pkt = _pkt;
dprintk(VIDC_DBG, "Received: EVENT_NOTIFY\n");

if (pkt->size < sizeof(struct hfi_msg_event_notify_packet)) {
Expand Down Expand Up @@ -357,9 +358,10 @@ static int hfi_process_event_notify(u32 device_id,
}

static int hfi_process_sys_init_done(u32 device_id,
struct hfi_msg_sys_init_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_sys_init_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};
enum vidc_status status = VIDC_ERR_NONE;

Expand Down Expand Up @@ -396,9 +398,10 @@ static int hfi_process_sys_init_done(u32 device_id,
}

static int hfi_process_sys_rel_resource_done(u32 device_id,
struct hfi_msg_sys_release_resource_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_sys_release_resource_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};
enum vidc_status status = VIDC_ERR_NONE;
u32 pkt_size;
Expand Down Expand Up @@ -603,6 +606,11 @@ static int hfi_fill_codec_info(u8 *data_ptr,
vidc_get_hal_codec((1 << i) & codecs);
capability->domain =
vidc_get_hal_domain(HFI_VIDEO_DOMAIN_DECODER);
if (codec_count == VIDC_MAX_DECODE_SESSIONS) {
dprintk(VIDC_ERR,
"Max supported decoder sessions reached");
break;
}
}
}
codecs = sys_init_done->enc_codec_supported;
Expand All @@ -614,6 +622,11 @@ static int hfi_fill_codec_info(u8 *data_ptr,
vidc_get_hal_codec((1 << i) & codecs);
capability->domain =
vidc_get_hal_domain(HFI_VIDEO_DOMAIN_ENCODER);
if (codec_count == VIDC_MAX_SESSIONS) {
dprintk(VIDC_ERR,
"Max supported sessions reached");
break;
}
}
}
sys_init_done->codec_count = codec_count;
Expand Down Expand Up @@ -1211,9 +1224,10 @@ static void hfi_process_sess_get_prop_buf_req(
}

static int hfi_process_session_prop_info(u32 device_id,
struct hfi_msg_session_property_info_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_property_info_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};
struct hfi_profile_level profile_level = {0};
enum hal_h264_entropy entropy = {0};
Expand Down Expand Up @@ -1286,9 +1300,10 @@ static int hfi_process_session_prop_info(u32 device_id,
}

static int hfi_process_session_init_done(u32 device_id,
struct hfi_msg_sys_session_init_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_sys_session_init_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};
struct vidc_hal_session_init_done session_init_done = { {0} };

Expand Down Expand Up @@ -1320,9 +1335,10 @@ static int hfi_process_session_init_done(u32 device_id,
}

static int hfi_process_session_load_res_done(u32 device_id,
struct hfi_msg_session_load_resources_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_load_resources_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};
dprintk(VIDC_DBG, "RECEIVED: SESSION_LOAD_RESOURCES_DONE[%#x]\n",
pkt->session_id);
Expand All @@ -1349,9 +1365,10 @@ static int hfi_process_session_load_res_done(u32 device_id,
}

static int hfi_process_session_flush_done(u32 device_id,
struct hfi_msg_session_flush_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_flush_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

dprintk(VIDC_DBG, "RECEIVED: SESSION_FLUSH_DONE[%#x]\n",
Expand Down Expand Up @@ -1394,9 +1411,10 @@ static int hfi_process_session_flush_done(u32 device_id,
}

static int hfi_process_session_etb_done(u32 device_id,
struct hfi_msg_session_empty_buffer_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_empty_buffer_done_packet *pkt = _pkt;
struct msm_vidc_cb_data_done data_done = {0};
struct hfi_picture_type *hfi_picture_type = NULL;

Expand Down Expand Up @@ -1445,9 +1463,10 @@ static int hfi_process_session_etb_done(u32 device_id,
}

static int hfi_process_session_ftb_done(
u32 device_id, struct vidc_hal_msg_pkt_hdr *msg_hdr,
u32 device_id, void *_pkt,
struct msm_vidc_cb_info *info)
{
struct vidc_hal_msg_pkt_hdr *msg_hdr = _pkt;
struct msm_vidc_cb_data_done data_done = {0};
bool is_decoder = false, is_encoder = false;

Expand Down Expand Up @@ -1572,9 +1591,10 @@ static int hfi_process_session_ftb_done(
}

static int hfi_process_session_start_done(u32 device_id,
struct hfi_msg_session_start_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_start_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

dprintk(VIDC_DBG, "RECEIVED: SESSION_START_DONE[%#x]\n",
Expand All @@ -1600,9 +1620,10 @@ static int hfi_process_session_start_done(u32 device_id,
}

static int hfi_process_session_stop_done(u32 device_id,
struct hfi_msg_session_stop_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_stop_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

dprintk(VIDC_DBG, "RECEIVED: SESSION_STOP_DONE[%#x]\n",
Expand All @@ -1629,9 +1650,10 @@ static int hfi_process_session_stop_done(u32 device_id,
}

static int hfi_process_session_rel_res_done(u32 device_id,
struct hfi_msg_session_release_resources_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_release_resources_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

dprintk(VIDC_DBG, "RECEIVED: SESSION_RELEASE_RESOURCES_DONE[%#x]\n",
Expand All @@ -1658,9 +1680,10 @@ static int hfi_process_session_rel_res_done(u32 device_id,
}

static int hfi_process_session_rel_buf_done(u32 device_id,
struct hfi_msg_session_release_buffers_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_session_release_buffers_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

if (!pkt || pkt->size <
Expand Down Expand Up @@ -1693,9 +1716,10 @@ static int hfi_process_session_rel_buf_done(u32 device_id,
}

static int hfi_process_session_end_done(u32 device_id,
struct hfi_msg_sys_session_end_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_sys_session_end_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

dprintk(VIDC_DBG, "RECEIVED: SESSION_END_DONE[%#x]\n", pkt->session_id);
Expand All @@ -1720,9 +1744,10 @@ static int hfi_process_session_end_done(u32 device_id,
}

static int hfi_process_session_abort_done(u32 device_id,
struct hfi_msg_sys_session_abort_done_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_sys_session_abort_done_packet *pkt = _pkt;
struct msm_vidc_cb_cmd_done cmd_done = {0};

dprintk(VIDC_DBG, "RECEIVED: SESSION_ABORT_DONE[%#x]\n",
Expand Down Expand Up @@ -1827,9 +1852,10 @@ static void hfi_process_sys_get_prop_image_version(
}

static int hfi_process_sys_property_info(u32 device_id,
struct hfi_msg_sys_property_info_packet *pkt,
void *_pkt,
struct msm_vidc_cb_info *info)
{
struct hfi_msg_sys_property_info_packet *pkt = _pkt;
if (!pkt) {
dprintk(VIDC_ERR, "%s: invalid param\n", __func__);
return -EINVAL;
Expand Down Expand Up @@ -1861,7 +1887,7 @@ static int hfi_process_sys_property_info(u32 device_id,
}

static int hfi_process_ignore(u32 device_id,
struct vidc_hal_msg_pkt_hdr *msg_hdr,
void *_pkt,
struct msm_vidc_cb_info *info)
{
*info = (struct msm_vidc_cb_info) {
Expand Down Expand Up @@ -1945,5 +1971,6 @@ int hfi_process_msg_packet(u32 device_id, struct vidc_hal_msg_pkt_hdr *msg_hdr,
break;
}

return pkt_func ? pkt_func(device_id, msg_hdr, info) : -ENOTSUPP;
return pkt_func ?
pkt_func(device_id, (void *)msg_hdr, info) : -ENOTSUPP;
}
10 changes: 4 additions & 6 deletions drivers/media/platform/msm/vidc/msm_vidc_common.c
@@ -1,4 +1,4 @@
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, 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
Expand Down Expand Up @@ -1478,7 +1478,7 @@ void validate_output_buffers(struct msm_vidc_inst *inst)
}
mutex_lock(&inst->outputbufs.lock);
list_for_each_entry(binfo, &inst->outputbufs.list, list) {
if (binfo->buffer_ownership != DRIVER) {
if (binfo && binfo->buffer_ownership != DRIVER) {
dprintk(VIDC_DBG,
"This buffer is with FW %pa\n",
&binfo->handle->device_addr);
Expand Down Expand Up @@ -3175,8 +3175,7 @@ static int set_output_buffers(struct msm_vidc_inst *inst,
if (!handle) {
dprintk(VIDC_ERR,
"Failed to allocate output memory\n");
rc = -ENOMEM;
goto err_no_mem;
return -ENOMEM;
}
rc = msm_comm_smem_cache_operations(inst,
handle, SMEM_CACHE_CLEAN, -1);
Expand Down Expand Up @@ -3228,10 +3227,9 @@ static int set_output_buffers(struct msm_vidc_inst *inst,
}
return rc;
fail_set_buffers:
msm_comm_smem_free(inst, handle);
err_no_mem:
kfree(binfo);
fail_kzalloc:
msm_comm_smem_free(inst, handle);
return rc;
}

Expand Down

0 comments on commit 3a3b654

Please sign in to comment.