summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJayaprakash Madisetty <quic_jmadiset@quicinc.com>2022-03-23 15:36:45 +0530
committerRaghavendra Ambadas <quic_c_rambad@quicinc.com>2022-07-13 10:33:57 +0530
commit687ad854c3569765973a57ccc230af86ec82da4e (patch)
tree73fac89b88fa7b5052495779da29fe5afb2a6419
parentce33c52e42d2bd6214c3daf06a7510d08be33c15 (diff)
downloaddisplay-drivers-687ad854c3569765973a57ccc230af86ec82da4e.tar.gz
disp: msm: use vzalloc for large allocations
Large allocations using kzalloc can lead to timeouts. This updates the allocation calls accordingly to use vzalloc to remove requirements on contiguous memory. Change-Id: Ica54483787509ed0e9283289fc9d523e8cde9238 Signed-off-by: Nilaan Gunabalachandran <quic_ngunabal@quicinc.com> Signed-off-by: Jayaprakash Madisetty <quic_jmadiset@quicinc.com>
-rw-r--r--msm/sde/sde_color_processing.c9
-rw-r--r--msm/sde/sde_connector.c5
-rw-r--r--msm/sde/sde_crtc.c6
-rw-r--r--msm/sde/sde_plane.c5
-rw-r--r--msm/sde_dbg.c37
-rw-r--r--msm/sde_dbg_evtlog.c9
6 files changed, 45 insertions, 26 deletions
diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c
index 799dfdd4..806076dd 100644
--- a/msm/sde/sde_color_processing.c
+++ b/msm/sde/sde_color_processing.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
@@ -3968,7 +3969,7 @@ void sde_cp_crtc_enable(struct drm_crtc *drm_crtc)
if (!num_mixers)
return;
mutex_lock(&crtc->crtc_cp_lock);
- info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
+ info = vzalloc(sizeof(struct sde_kms_info));
if (info) {
for (i = 0; i < ARRAY_SIZE(dspp_cap_update_func); i++)
dspp_cap_update_func[i](crtc, info);
@@ -3977,7 +3978,7 @@ void sde_cp_crtc_enable(struct drm_crtc *drm_crtc)
info->data, SDE_KMS_INFO_DATALEN(info),
CRTC_PROP_DSPP_INFO);
}
- kfree(info);
+ vfree(info);
mutex_unlock(&crtc->crtc_cp_lock);
}
@@ -3992,12 +3993,12 @@ void sde_cp_crtc_disable(struct drm_crtc *drm_crtc)
}
crtc = to_sde_crtc(drm_crtc);
mutex_lock(&crtc->crtc_cp_lock);
- info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
+ info = vzalloc(sizeof(struct sde_kms_info));
if (info)
msm_property_set_blob(&crtc->property_info,
&crtc->dspp_blob_info,
info->data, SDE_KMS_INFO_DATALEN(info),
CRTC_PROP_DSPP_INFO);
mutex_unlock(&crtc->crtc_cp_lock);
- kfree(info);
+ vfree(info);
}
diff --git a/msm/sde/sde_connector.c b/msm/sde/sde_connector.c
index c8bb88bc..35f67837 100644
--- a/msm/sde/sde_connector.c
+++ b/msm/sde/sde_connector.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -2367,7 +2368,7 @@ int sde_connector_set_blob_data(struct drm_connector *conn,
return -EINVAL;
}
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = vzalloc(sizeof(*info));
if (!info)
return -ENOMEM;
@@ -2425,7 +2426,7 @@ int sde_connector_set_blob_data(struct drm_connector *conn,
SDE_KMS_INFO_DATALEN(info),
prop_id);
exit:
- kfree(info);
+ vfree(info);
return rc;
}
diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c
index 86b38a69..602476ba 100644
--- a/msm/sde/sde_crtc.c
+++ b/msm/sde/sde_crtc.c
@@ -5066,7 +5066,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
return;
}
- info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
+ info = vzalloc(sizeof(struct sde_kms_info));
if (!info) {
SDE_ERROR("failed to allocate info memory\n");
return;
@@ -5313,12 +5313,12 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
catalog->ubwc_bw_calc_version);
sde_kms_info_add_keyint(info, "use_baselayer_for_stage",
- catalog->has_base_layer);
+ catalog->has_base_layer);
msm_property_set_blob(&sde_crtc->property_info, &sde_crtc->blob_info,
info->data, SDE_KMS_INFO_DATALEN(info), CRTC_PROP_INFO);
- kfree(info);
+ vfree(info);
}
static int _sde_crtc_get_output_fence(struct drm_crtc *crtc,
diff --git a/msm/sde/sde_plane.c b/msm/sde/sde_plane.c
index e991cbe7..0264cefe 100644
--- a/msm/sde/sde_plane.c
+++ b/msm/sde/sde_plane.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
@@ -3609,7 +3610,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
"prefill_time", 0x0, 0, ~0, 0,
PLANE_PROP_PREFILL_TIME);
- info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
+ info = vzalloc(sizeof(struct sde_kms_info));
if (!info) {
SDE_ERROR("failed to allocate info memory\n");
return;
@@ -3720,7 +3721,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
info->data, SDE_KMS_INFO_DATALEN(info),
PLANE_PROP_INFO);
- kfree(info);
+ vfree(info);
if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) {
snprintf(feature_name, sizeof(feature_name), "%s%d",
diff --git a/msm/sde_dbg.c b/msm/sde_dbg.c
index 2723d01c..04037d5c 100644
--- a/msm/sde_dbg.c
+++ b/msm/sde_dbg.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -198,6 +199,7 @@ struct sde_dbg_regbuf {
* struct sde_dbg_base - global sde debug base structure
* @evtlog: event log instance
* @reglog: reg log instance
+ * @reg_dump_base: base address of register dump region
* @reg_base_list: list of register dumping regions
* @dev: device pointer
* @mutex: mutex to serialize access to serialze dumps, debugfs access
@@ -221,6 +223,7 @@ static struct sde_dbg_base {
struct sde_dbg_evtlog *evtlog;
struct sde_dbg_reglog *reglog;
struct list_head reg_base_list;
+ void *reg_dump_base;
void *reg_dump_addr;
struct device *dev;
struct mutex mutex;
@@ -3251,7 +3254,6 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)
u32 *dump_addr = NULL;
u32 status = 0;
struct sde_debug_bus_entry *head;
- phys_addr_t phys = 0;
int list_size;
int i;
u32 offset;
@@ -3289,8 +3291,7 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)
if (in_mem) {
if (!(*dump_mem))
- *dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
- list_size, &phys, GFP_KERNEL);
+ *dump_mem = vzalloc(list_size);
if (*dump_mem) {
dump_addr = *dump_mem;
@@ -3400,7 +3401,6 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus)
u32 value, d0, d1;
unsigned long reg, reg1, reg2;
struct vbif_debug_bus_entry *head;
- phys_addr_t phys = 0;
int i, list_size = 0;
void __iomem *mem_base = NULL;
struct vbif_debug_bus_entry *dbg_bus;
@@ -3450,8 +3450,7 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus)
if (in_mem) {
if (!(*dump_mem))
- *dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
- list_size, &phys, GFP_KERNEL);
+ *dump_mem = vzalloc(list_size);
if (*dump_mem) {
dump_addr = *dump_mem;
@@ -3542,13 +3541,18 @@ static void _sde_dump_array(struct sde_dbg_reg_base *blk_arr[],
int i;
u32 reg_dump_size;
struct sde_dbg_base *dbg_base = &sde_dbg_base;
- phys_addr_t phys = 0;
mutex_lock(&sde_dbg_base.mutex);
reg_dump_size = _sde_dbg_get_reg_dump_size();
- dbg_base->reg_dump_addr = dma_alloc_coherent(sde_dbg_base.dev,
- reg_dump_size, &phys, GFP_KERNEL);
+ if (!dbg_base->reg_dump_base)
+ dbg_base->reg_dump_base = vzalloc(reg_dump_size);
+
+ dbg_base->reg_dump_addr = dbg_base->reg_dump_base;
+
+ if (!dbg_base->reg_dump_addr)
+ pr_err("Failed to allocate memory for reg_dump_addr size:%d\n",
+ reg_dump_size);
if (dump_all)
sde_evtlog_dump_all(sde_dbg_base.evtlog);
@@ -4051,7 +4055,7 @@ static ssize_t sde_recovery_regdump_read(struct file *file, char __user *ubuf,
mutex_lock(&sde_dbg_base.mutex);
if (!rbuf->dump_done && !rbuf->cur_blk) {
if (!rbuf->buf)
- rbuf->buf = kzalloc(DUMP_BUF_SIZE, GFP_KERNEL);
+ rbuf->buf = vzalloc(DUMP_BUF_SIZE);
if (!rbuf->buf) {
len = -ENOMEM;
goto err;
@@ -4781,13 +4785,23 @@ static void sde_dbg_reg_base_destroy(void)
list_del(&blk_base->reg_base_head);
kfree(blk_base);
}
+ vfree(dbg_base->reg_dump_base);
+}
+
+static void sde_dbg_buses_destroy(void)
+{
+ struct sde_dbg_base *dbg_base = &sde_dbg_base;
+
+ vfree(dbg_base->dbgbus_sde.cmn.dumped_content);
+ vfree(dbg_base->dbgbus_vbif_rt.cmn.dumped_content);
}
+
/**
* sde_dbg_destroy - destroy sde debug facilities
*/
void sde_dbg_destroy(void)
{
- kfree(sde_dbg_base.regbuf.buf);
+ vfree(sde_dbg_base.regbuf.buf);
memset(&sde_dbg_base.regbuf, 0, sizeof(sde_dbg_base.regbuf));
_sde_dbg_debugfs_destroy();
sde_dbg_base_evtlog = NULL;
@@ -4796,6 +4810,7 @@ void sde_dbg_destroy(void)
sde_reglog_destroy(sde_dbg_base.reglog);
sde_dbg_base.reglog = NULL;
sde_dbg_reg_base_destroy();
+ sde_dbg_buses_destroy();
mutex_destroy(&sde_dbg_base.mutex);
}
diff --git a/msm/sde_dbg_evtlog.c b/msm/sde_dbg_evtlog.c
index 5724d4cd..65f95704 100644
--- a/msm/sde_dbg_evtlog.c
+++ b/msm/sde_dbg_evtlog.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
@@ -219,7 +220,7 @@ struct sde_dbg_evtlog *sde_evtlog_init(void)
{
struct sde_dbg_evtlog *evtlog;
- evtlog = kzalloc(sizeof(*evtlog), GFP_KERNEL);
+ evtlog = vzalloc(sizeof(*evtlog));
if (!evtlog)
return ERR_PTR(-ENOMEM);
@@ -235,7 +236,7 @@ struct sde_dbg_reglog *sde_reglog_init(void)
{
struct sde_dbg_reglog *reglog;
- reglog = kzalloc(sizeof(*reglog), GFP_KERNEL);
+ reglog = vzalloc(sizeof(*reglog));
if (!reglog)
return ERR_PTR(-ENOMEM);
@@ -343,7 +344,7 @@ void sde_evtlog_destroy(struct sde_dbg_evtlog *evtlog)
list_del(&filter_node->list);
kfree(filter_node);
}
- kfree(evtlog);
+ vfree(evtlog);
}
void sde_reglog_destroy(struct sde_dbg_reglog *reglog)
@@ -351,5 +352,5 @@ void sde_reglog_destroy(struct sde_dbg_reglog *reglog)
if (!reglog)
return;
- kfree(reglog);
+ vfree(reglog);
}