summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilson Sung <wilsonsung@google.com>2022-10-26 17:39:29 +0800
committerWilson Sung <wilsonsung@google.com>2022-10-26 17:39:29 +0800
commitab6b39a365070d4df68e91997ad17dc93f18dfc1 (patch)
treeaf2b22ac918ebde0b97babf97514e08d7c17d43d
parent71f924dada382392139719de510ec237eff8867f (diff)
parent492bde87ae7e9241c82f1b861871360450bff849 (diff)
downloaddisplay-drivers-ab6b39a365070d4df68e91997ad17dc93f18dfc1.tar.gz
Merge branch 'LA.UM.9.12.C10.11.00.00.840.415' via branch 'qcom-msm-4.19-7250' into android-msm-pixel-4.19
Change-Id: I315d4bbef742f859ef7b1e7aa9fc7e4ae3a598e0
-rw-r--r--msm/dp/dp_aux.c8
-rw-r--r--msm/dp/dp_debug.c2
-rw-r--r--msm/dp/dp_display.c149
-rw-r--r--msm/dp/dp_display.h3
-rw-r--r--msm/dp/dp_parser.c11
-rw-r--r--msm/dp/dp_parser.h5
-rw-r--r--msm/dsi/dsi_panel.c3
-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
13 files changed, 184 insertions, 68 deletions
diff --git a/msm/dp/dp_aux.c b/msm/dp/dp_aux.c
index b9ae7386..4a1f54ee 100644
--- a/msm/dp/dp_aux.c
+++ b/msm/dp/dp_aux.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*/
@@ -771,11 +772,16 @@ static int dp_aux_configure_aux_switch(struct dp_aux *dp_aux,
aux = container_of(dp_aux, struct dp_aux_private, dp_aux);
if (!aux->aux_switch_node) {
- DP_DEBUG("undefined fsa4480 handle\n");
+ DP_DEBUG("undefined aux switch handle\n");
rc = -EINVAL;
goto end;
}
+ if (strcmp(aux->aux_switch_node->name, "fsa4480")) {
+ DP_DEBUG("Not an fsa4480 aux switch\n");
+ goto end;
+ }
+
if (enable) {
switch (orientation) {
case ORIENTATION_CC1:
diff --git a/msm/dp/dp_debug.c b/msm/dp/dp_debug.c
index 6303c1cf..0bccc7bf 100644
--- a/msm/dp/dp_debug.c
+++ b/msm/dp/dp_debug.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
@@ -2284,6 +2285,7 @@ struct dp_debug *dp_debug_get(struct dp_debug_in *in)
dp_debug->dp_mst_connector_list.con_id = -1;
dp_debug->dp_mst_connector_list.conn = NULL;
dp_debug->dp_mst_connector_list.debug_en = false;
+ mutex_init(&dp_debug->dp_mst_connector_list.lock);
dp_debug->max_pclk_khz = debug->parser->max_pclk_khz;
diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c
index 623b3022..26554a45 100644
--- a/msm/dp/dp_display.c
+++ b/msm/dp/dp_display.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
@@ -721,6 +722,11 @@ static void dp_display_send_hpd_event(struct dp_display_private *dp)
kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE,
envp);
+ if (dev->mode_config.funcs->output_poll_changed)
+ dev->mode_config.funcs->output_poll_changed(dev);
+
+ drm_client_dev_hotplug(dev);
+
if (connector->status == connector_status_connected) {
dp_display_state_add(DP_STATE_CONNECT_NOTIFIED);
dp_display_state_remove(DP_STATE_DISCONNECT_NOTIFIED);
@@ -976,6 +982,8 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)
dp->dp_display.max_pclk_khz = min(dp->parser->max_pclk_khz,
dp->debug->max_pclk_khz);
+ dp->dp_display.max_hdisplay = dp->parser->max_hdisplay;
+ dp->dp_display.max_vdisplay = dp->parser->max_vdisplay;
/*
* If dp video session is not restored from a previous session teardown
@@ -2316,43 +2324,22 @@ end:
return 0;
}
-static enum drm_mode_status dp_display_validate_mode(
+static int dp_display_validate_resources(
struct dp_display *dp_display,
void *panel, struct drm_display_mode *mode,
const struct msm_resource_caps_info *avail_res)
{
struct dp_display_private *dp;
- u32 mode_rate_khz = 0, supported_rate_khz = 0, mode_bpp = 0;
struct dp_panel *dp_panel;
struct dp_debug *debug;
- enum drm_mode_status mode_status = MODE_BAD;
- bool in_list = false;
- struct dp_mst_connector *mst_connector;
- int hdis, vdis, vref, ar, _hdis, _vdis, _vref, _ar, rate;
struct dp_display_mode dp_mode;
+ u32 mode_rate_khz, supported_rate_khz, mode_bpp, num_lm;
+ int rc, tmds_max_clock, rate;
bool dsc_en;
- u32 num_lm = 0;
- int rc = 0, tmds_max_clock = 0;
-
- if (!dp_display || !mode || !panel ||
- !avail_res || !avail_res->max_mixer_width) {
- DP_ERR("invalid params\n");
- return mode_status;
- }
dp = container_of(dp_display, struct dp_display_private, dp_display);
-
- mutex_lock(&dp->session_lock);
-
dp_panel = panel;
- if (!dp_panel->connector) {
- DP_ERR("invalid connector\n");
- goto end;
- }
-
debug = dp->debug;
- if (!debug)
- goto end;
dp_display->convert_to_dp_mode(dp_display, panel, mode, &dp_mode);
@@ -2366,36 +2353,65 @@ static enum drm_mode_status dp_display_validate_mode(
tmds_max_clock = dp_panel->connector->display_info.max_tmds_clock;
if (mode_rate_khz > supported_rate_khz) {
- DP_MST_DEBUG("pclk:%d, supported_rate:%d\n",
+ DP_DEBUG("pclk:%d, supported_rate:%d\n",
mode->clock, supported_rate_khz);
- goto end;
+ return -EINVAL;
}
if (mode->clock > dp_display->max_pclk_khz) {
- DP_MST_DEBUG("clk:%d, max:%d\n", mode->clock,
+ DP_DEBUG("clk:%d, max:%d\n", mode->clock,
dp_display->max_pclk_khz);
- goto end;
+ return -EINVAL;
+ }
+
+ if ((dp_display->max_hdisplay > 0) && (dp_display->max_vdisplay > 0) &&
+ ((mode->hdisplay > dp_display->max_hdisplay) ||
+ (mode->vdisplay > dp_display->max_vdisplay))) {
+ DP_DEBUG("hdisplay:%d, max-hdisplay:%d",
+ mode->hdisplay, dp_display->max_hdisplay);
+ DP_DEBUG("vdisplay:%d, max-vdisplay:%d\n",
+ mode->vdisplay, dp_display->max_vdisplay);
+ return -EINVAL;
}
if (tmds_max_clock > 0 && mode->clock > tmds_max_clock) {
- DP_MST_DEBUG("clk:%d, max tmds:%d\n", mode->clock,
+ DP_DEBUG("clk:%d, max tmds:%d\n", mode->clock,
tmds_max_clock);
- goto end;
+ return -EINVAL;
}
rc = msm_get_mixer_count(dp->priv, mode, avail_res, &num_lm);
if (rc) {
DP_ERR("error getting mixer count. rc:%d\n", rc);
- goto end;
+ return -EINVAL;
}
if (num_lm > avail_res->num_lm ||
(num_lm == 2 && !avail_res->num_3dmux)) {
- DP_MST_DEBUG("num_lm:%d, req lm:%d 3dmux:%d\n", num_lm,
+ DP_DEBUG("num_lm:%d, req lm:%d 3dmux:%d\n", num_lm,
avail_res->num_lm, avail_res->num_3dmux);
- goto end;
+ return -EINVAL;
}
+ return 0;
+}
+
+static int dp_display_check_overrides(
+ struct dp_display *dp_display,
+ void *panel, struct drm_display_mode *mode,
+ const struct msm_resource_caps_info *avail_res)
+{
+ struct dp_mst_connector *mst_connector;
+ struct dp_display_private *dp;
+ struct dp_panel *dp_panel;
+ struct dp_debug *debug;
+ bool in_list = false;
+ int hdis, vdis, vref, ar, _hdis, _vdis, _vref, _ar;
+
+ dp = container_of(dp_display, struct dp_display_private, dp_display);
+ dp_panel = panel;
+ debug = dp->debug;
+
/*
* If the connector exists in the mst connector list and if debug is
* enabled for that connector, use the mst connector settings from the
@@ -2404,6 +2420,7 @@ static enum drm_mode_status dp_display_validate_mode(
mutex_lock(&debug->dp_mst_connector_list.lock);
if (list_empty(&debug->dp_mst_connector_list.list)) {
+ DP_MST_DEBUG("MST connect list is empty\n");
mutex_unlock(&debug->dp_mst_connector_list.lock);
goto verify_default;
}
@@ -2414,10 +2431,9 @@ static enum drm_mode_status dp_display_validate_mode(
in_list = true;
if (!mst_connector->debug_en) {
- mode_status = MODE_OK;
mutex_unlock(
&debug->dp_mst_connector_list.lock);
- goto end;
+ return 0;
}
hdis = mst_connector->hdisplay;
@@ -2432,28 +2448,76 @@ static enum drm_mode_status dp_display_validate_mode(
if (hdis == _hdis && vdis == _vdis && vref == _vref &&
ar == _ar) {
- mode_status = MODE_OK;
mutex_unlock(
&debug->dp_mst_connector_list.lock);
- goto end;
+ return 0;
}
-
break;
}
}
mutex_unlock(&debug->dp_mst_connector_list.lock);
-
if (in_list)
- goto end;
+ return -EINVAL;
verify_default:
if (debug->debug_en && (mode->hdisplay != debug->hdisplay ||
mode->vdisplay != debug->vdisplay ||
mode->vrefresh != debug->vrefresh ||
mode->picture_aspect_ratio != debug->aspect_ratio))
+ return -EINVAL;
+
+ return 0;
+}
+
+static enum drm_mode_status dp_display_validate_mode(
+ struct dp_display *dp_display,
+ void *panel, struct drm_display_mode *mode,
+ const struct msm_resource_caps_info *avail_res)
+{
+ struct dp_display_private *dp;
+
+ struct dp_panel *dp_panel;
+ struct dp_debug *debug;
+ enum drm_mode_status mode_status = MODE_BAD;
+
+ if (!dp_display || !mode || !panel ||
+ !avail_res || !avail_res->max_mixer_width) {
+ DP_ERR("invalid params\n");
+ return mode_status;
+ }
+
+ dp = container_of(dp_display, struct dp_display_private, dp_display);
+
+ mutex_lock(&dp->session_lock);
+
+ dp_panel = panel;
+ if (!dp_panel->connector) {
+ DP_ERR("invalid connector\n");
+ goto end;
+ }
+
+ debug = dp->debug;
+ if (!debug) {
+ DP_ERR("invalid debug node\n");
+ goto end;
+ }
+
+ if (dp_display_validate_resources(dp_display, panel, mode, avail_res)) {
+ DP_DEBUG("DP bad mode %dx%d@%d\n",
+ mode->hdisplay, mode->vdisplay, mode->clock);
+ goto end;
+ }
+
+ if (dp_display_check_overrides(dp_display, panel,
+ mode, avail_res)) {
+ DP_MST_DEBUG("DP overrides ignore mode %dx%d@%d\n",
+ mode->hdisplay, mode->vdisplay, mode->clock);
goto end;
+ }
+ DP_DEBUG("DP ok mode %dx%d@%d\n",
+ mode->hdisplay, mode->vdisplay, mode->clock);
mode_status = MODE_OK;
end:
mutex_unlock(&dp->session_lock);
@@ -2656,6 +2720,11 @@ static int dp_display_init_aux_switch(struct dp_display_private *dp)
goto end;
}
+ if (strcmp(dp->aux_switch_node->name, "fsa4480")) {
+ DP_DEBUG("Not an fsa4480 aux switch\n");
+ goto end;
+ }
+
nb.notifier_call = dp_display_fsa4480_callback;
nb.priority = 0;
diff --git a/msm/dp/dp_display.h b/msm/dp/dp_display.h
index 3f4b8d9b..0172889c 100644
--- a/msm/dp/dp_display.h
+++ b/msm/dp/dp_display.h
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
@@ -70,6 +71,8 @@ struct dp_display {
bool is_sst_connected;
bool is_mst_supported;
u32 max_pclk_khz;
+ u32 max_hdisplay;
+ u32 max_vdisplay;
u32 no_mst_encoder;
void *dp_mst_prv_info;
bool is_primary;
diff --git a/msm/dp/dp_parser.c b/msm/dp/dp_parser.c
index 4c37aa2c..e33f7814 100644
--- a/msm/dp/dp_parser.c
+++ b/msm/dp/dp_parser.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
@@ -170,6 +171,16 @@ static int dp_parser_misc(struct dp_parser *parser)
if (!parser->display_type)
parser->display_type = "unknown";
+ rc = of_property_read_u32(of_node,
+ "qcom,max-hdisplay", &parser->max_hdisplay);
+ if (rc)
+ parser->max_hdisplay = 0;
+
+ rc = of_property_read_u32(of_node,
+ "qcom,max-vdisplay", &parser->max_vdisplay);
+ if (rc)
+ parser->max_vdisplay = 0;
+
return 0;
}
diff --git a/msm/dp/dp_parser.h b/msm/dp/dp_parser.h
index 5d937ca2..61cbe383 100644
--- a/msm/dp/dp_parser.h
+++ b/msm/dp/dp_parser.h
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
@@ -186,6 +187,8 @@ static inline char *dp_phy_aux_config_type_to_string(u32 cfg_type)
* @l_pnswap: P/N swap status on each lane
* @max_pclk_khz: maximum pixel clock supported for the platform
* @max_lclk_khz: maximum link clock supported for the platform
+ * @max_hdisplay: maximum supported horizontal display by the platform for dp
+ * @max_vdisplay: maximum supported vertical display by the platform for dp
* @hw_cfg: DP HW specific settings
* @has_mst: MST feature enable status
* @has_mst_sideband: MST sideband feature enable status
@@ -217,6 +220,8 @@ struct dp_parser {
struct dp_aux_cfg aux_cfg[AUX_CFG_LEN];
u32 max_pclk_khz;
u32 max_lclk_khz;
+ u32 max_hdisplay;
+ u32 max_vdisplay;
struct dp_hw_cfg hw_cfg;
bool has_mst;
bool has_mst_sideband;
diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c
index 817914c7..e1f231f1 100644
--- a/msm/dsi/dsi_panel.c
+++ b/msm/dsi/dsi_panel.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/delay.h>
@@ -49,7 +50,7 @@ static u32 dsi_dsc_rc_buf_thresh[] = {0x0e, 0x1c, 0x2a, 0x38, 0x46, 0x54,
* Rate control - Min QP values for each ratio type in dsi_dsc_ratio_type
*/
static char dsi_dsc_rc_range_min_qp_1_1[][15] = {
- {0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5, 5, 5, 7, 12},
+ {0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5, 5, 5, 7, 13},
{0, 4, 5, 5, 7, 7, 7, 7, 7, 7, 9, 9, 9, 11, 17},
{0, 4, 9, 9, 11, 11, 11, 11, 11, 11, 13, 13, 13, 15, 21},
{0, 4, 5, 6, 7, 7, 7, 7, 7, 7, 9, 9, 9, 11, 15},
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);
}