From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Harry.Wentland@amd.com>, <Sunpeng.Li@amd.com>,
<Rodrigo.Siqueira@amd.com>, <Aurabindo.Pillai@amd.com>,
<roman.li@amd.com>, <wayne.lin@amd.com>,
<agustin.gutierrez@amd.com>, <chiahsuan.chung@amd.com>,
<hersenxs.wu@amd.com>, <jerry.zuo@amd.com>,
Sung Joon Kim <sungjoon.kim@amd.com>,
Wenjing Liu <wenjing.liu@amd.com>
Subject: [PATCH 39/43] drm/amd/display: Enable new interface design for alternate scrambling
Date: Tue, 12 Mar 2024 17:20:32 +0800 [thread overview]
Message-ID: <20240312092036.3283319-40-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20240312092036.3283319-1-Wayne.Lin@amd.com>
From: Sung Joon Kim <sungjoon.kim@amd.com>
[why & how]
To enable a new interface so alternate scrambling can be done via
security module.
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Sung Joon Kim <sungjoon.kim@amd.com>
---
drivers/gpu/drm/amd/display/dc/dc.h | 1 +
.../gpu/drm/amd/display/dc/link/link_dpms.c | 3 +
.../dc/link/protocols/link_dp_training.c | 16 +----
.../link/protocols/link_edp_panel_control.c | 64 +++++++++++++++++
.../link/protocols/link_edp_panel_control.h | 2 +
.../dc/resource/dcn351/dcn351_resource.c | 3 +
.../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 68 +++++++++++++++++++
7 files changed, 142 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index d280f55ebe50..673f36543f6c 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -436,6 +436,7 @@ struct dc_config {
unsigned int disable_ips_in_vpb;
bool usb4_bw_alloc_support;
bool allow_0_dtb_clk;
+ bool use_assr_psp_message;
};
enum visual_confirm {
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
index a72de44a5747..9c0e2b9cffc9 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
@@ -2285,6 +2285,7 @@ void link_set_dpms_off(struct pipe_ctx *pipe_ctx)
struct dc_stream_state *stream = pipe_ctx->stream;
struct dc_link *link = stream->sink->link;
struct vpg *vpg = pipe_ctx->stream_res.stream_enc->vpg;
+ enum dp_panel_mode panel_mode_dp = dp_get_panel_mode(link);
DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
@@ -2311,6 +2312,8 @@ void link_set_dpms_off(struct pipe_ctx *pipe_ctx)
dc->hwss.disable_audio_stream(pipe_ctx);
+ edp_set_panel_assr(link, pipe_ctx, &panel_mode_dp, false);
+
update_psp_stream_config(pipe_ctx, true);
dc->hwss.blank_stream(pipe_ctx);
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
index e538c67d3ed9..9de5380757e0 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
@@ -1587,21 +1587,7 @@ bool perform_link_training_with_retries(
msleep(delay_dp_power_up_in_ms);
}
- if (panel_mode == DP_PANEL_MODE_EDP) {
- struct cp_psp *cp_psp = &stream->ctx->cp_psp;
-
- if (cp_psp && cp_psp->funcs.enable_assr) {
- /* ASSR is bound to fail with unsigned PSP
- * verstage used during devlopment phase.
- * Report and continue with eDP panel mode to
- * perform eDP link training with right settings
- */
- bool result;
- result = cp_psp->funcs.enable_assr(cp_psp->handle, link);
- if (!result && link->panel_mode != DP_PANEL_MODE_EDP)
- panel_mode = DP_PANEL_MODE_DEFAULT;
- }
- }
+ edp_set_panel_assr(link, pipe_ctx, &panel_mode, true);
dp_set_panel_mode(link, panel_mode);
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
index 3baa2bdd6dd6..0682dbbad448 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
@@ -38,6 +38,7 @@
#include "dc/dc_dmub_srv.h"
#include "dce/dmub_replay.h"
#include "abm.h"
+#include "resource.h"
#define DC_LOGGER \
link->ctx->logger
#define DC_LOGGER_INIT(logger)
@@ -1145,3 +1146,66 @@ int edp_get_target_backlight_pwm(const struct dc_link *link)
return (int) abm->funcs->get_target_backlight(abm);
}
+
+static void edp_set_assr_enable(const struct dc *pDC, struct dc_link *link,
+ struct link_resource *link_res, bool enable)
+{
+ union dmub_rb_cmd cmd;
+ bool use_hpo_dp_link_enc = false;
+ uint8_t link_enc_index = 0;
+ uint8_t phy_type = 0;
+ uint8_t phy_id = 0;
+
+ if (!pDC->config.use_assr_psp_message)
+ return;
+
+ memset(&cmd, 0, sizeof(cmd));
+
+ link_enc_index = link->link_enc->transmitter - TRANSMITTER_UNIPHY_A;
+
+ if (link_res->hpo_dp_link_enc) {
+ link_enc_index = link_res->hpo_dp_link_enc->inst;
+ use_hpo_dp_link_enc = true;
+ }
+
+ if (enable)
+ phy_type = ((dp_get_panel_mode(link) == DP_PANEL_MODE_EDP) ? 1 : 0);
+
+ phy_id = resource_transmitter_to_phy_idx(pDC, link->link_enc->transmitter);
+
+ cmd.assr_enable.header.type = DMUB_CMD__PSP;
+ cmd.assr_enable.header.sub_type = DMUB_CMD__PSP_ASSR_ENABLE;
+ cmd.assr_enable.assr_data.enable = enable;
+ cmd.assr_enable.assr_data.phy_port_type = phy_type;
+ cmd.assr_enable.assr_data.phy_port_id = phy_id;
+ cmd.assr_enable.assr_data.link_enc_index = link_enc_index;
+ cmd.assr_enable.assr_data.hpo_mode = use_hpo_dp_link_enc;
+
+ dc_wake_and_execute_dmub_cmd(pDC->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
+}
+
+void edp_set_panel_assr(struct dc_link *link, struct pipe_ctx *pipe_ctx,
+ enum dp_panel_mode *panel_mode, bool enable)
+{
+ struct link_resource *link_res = &pipe_ctx->link_res;
+ struct cp_psp *cp_psp = &pipe_ctx->stream->ctx->cp_psp;
+
+ if (*panel_mode != DP_PANEL_MODE_EDP)
+ return;
+
+ if (link->dc->config.use_assr_psp_message) {
+ edp_set_assr_enable(link->dc, link, link_res, enable);
+ } else if (cp_psp && cp_psp->funcs.enable_assr && enable) {
+ /* ASSR is bound to fail with unsigned PSP
+ * verstage used during devlopment phase.
+ * Report and continue with eDP panel mode to
+ * perform eDP link training with right settings
+ */
+ bool result;
+
+ result = cp_psp->funcs.enable_assr(cp_psp->handle, link);
+
+ if (!result && link->panel_mode != DP_PANEL_MODE_EDP)
+ *panel_mode = DP_PANEL_MODE_DEFAULT;
+ }
+}
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
index a158c6234d42..eee8a4db6f85 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
@@ -76,4 +76,6 @@ bool edp_receiver_ready_T9(struct dc_link *link);
bool edp_receiver_ready_T7(struct dc_link *link);
bool edp_power_alpm_dpcd_enable(struct dc_link *link, bool enable);
void edp_set_panel_power(struct dc_link *link, bool powerOn);
+void edp_set_panel_assr(struct dc_link *link, struct pipe_ctx *pipe_ctx,
+ enum dp_panel_mode *panel_mode, bool enable);
#endif /* __DC_LINK_EDP_POWER_CONTROL_H__ */
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
index 5b486400dfdb..2dfd73d5f767 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
@@ -1864,6 +1864,9 @@ static bool dcn351_resource_construct(
/* Use pipe context based otg sync logic */
dc->config.use_pipe_ctx_sync_logic = true;
+ /* Use psp mailbox to enable assr */
+ dc->config.use_assr_psp_message = true;
+
/* read VBIOS LTTPR caps */
{
if (ctx->dc_bios->funcs->get_lttpr_caps) {
diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
index 818e5d87f0da..34cb25c6166a 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -1198,6 +1198,11 @@ enum dmub_cmd_type {
*/
DMUB_CMD__DPIA_HPD_INT_ENABLE = 86,
+ /**
+ * Command type used for all PSP commands.
+ */
+ DMUB_CMD__PSP = 88,
+
DMUB_CMD__VBIOS = 128,
};
@@ -4303,6 +4308,65 @@ struct dmub_rb_cmd_secure_display {
} roi_info;
};
+/**
+ * Command type of a DMUB_CMD__PSP command
+ */
+enum dmub_cmd_psp_type {
+ DMUB_CMD__PSP_ASSR_ENABLE = 0
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__PSP_ASSR_ENABLE command.
+ */
+struct dmub_cmd_assr_enable_data {
+ /**
+ * ASSR enable or disable.
+ */
+ uint8_t enable;
+ /**
+ * PHY port type.
+ * Indicates eDP / non-eDP port type
+ */
+ uint8_t phy_port_type;
+ /**
+ * PHY port ID.
+ */
+ uint8_t phy_port_id;
+ /**
+ * Link encoder index.
+ */
+ uint8_t link_enc_index;
+ /**
+ * HPO mode.
+ */
+ uint8_t hpo_mode;
+
+ /**
+ * Reserved field.
+ */
+ uint8_t reserved[7];
+};
+
+/**
+ * Definition of a DMUB_CMD__PSP_ASSR_ENABLE command.
+ */
+struct dmub_rb_cmd_assr_enable {
+ /**
+ * Command header.
+ */
+ struct dmub_cmd_header header;
+
+ /**
+ * Assr data.
+ */
+ struct dmub_cmd_assr_enable_data assr_data;
+
+ /**
+ * Reserved field.
+ */
+ uint32_t reserved[3];
+};
+
/**
* union dmub_rb_cmd - DMUB inbox command.
*/
@@ -4561,6 +4625,10 @@ union dmub_rb_cmd {
* Definition of a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command.
*/
struct dmub_rb_cmd_replay_set_pseudo_vtotal replay_set_pseudo_vtotal;
+ /**
+ * Definition of a DMUB_CMD__PSP_ASSR_ENABLE command.
+ */
+ struct dmub_rb_cmd_assr_enable assr_enable;
};
/**
--
2.37.3
next prev parent reply other threads:[~2024-03-12 9:25 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 9:19 [PATCH 00/43] DC Patches March 18, 2024 Wayne Lin
2024-03-12 9:19 ` [PATCH 01/43] drm/amd/display: Remove code duplication Wayne Lin
2024-03-12 9:19 ` [PATCH 02/43] drm/amd/display: Remove wrong signal from vrr calculation Wayne Lin
2024-03-12 9:19 ` [PATCH 03/43] drm/amd/display: Enable 2to1 ODM policy for DCN35 Wayne Lin
2024-03-12 10:20 ` Christian König
2024-03-13 6:35 ` Lin, Wayne
2024-03-12 9:19 ` [PATCH 04/43] drm/amd/display: Delete duplicated function prototypes Wayne Lin
2024-03-12 9:19 ` [PATCH 05/43] drm/amd/display: Correct indentations and spaces Wayne Lin
2024-03-12 9:19 ` [PATCH 06/43] drm/amd/display: Add the MALL size in the fallback function Wayne Lin
2024-03-12 9:20 ` [PATCH 07/43] drm/amd/display: Move define to the proper header Wayne Lin
2024-03-12 9:20 ` [PATCH 08/43] drm/amd/display: Enable fast update for DCN314 Wayne Lin
2024-03-12 9:20 ` [PATCH 09/43] drm/amd/display: Remove legacy code Wayne Lin
2024-03-12 9:20 ` [PATCH 10/43] drm/amd/display: correct hostvm flag Wayne Lin
2024-03-12 9:20 ` [PATCH 11/43] drm/amd/display: Comments adjustments Wayne Lin
2024-03-12 9:20 ` [PATCH 12/43] drm/amd/display: Add missing registers and offset Wayne Lin
2024-03-12 9:20 ` [PATCH 13/43] drm/amd/display: Fix noise issue on HDMI AV mute Wayne Lin
2024-03-12 9:20 ` [PATCH 14/43] drm/amd/display: skip forcing odm in minimal transition Wayne Lin
2024-03-12 9:20 ` [PATCH 15/43] drm/amd/display: revert Exit idle optimizations before HDCP execution Wayne Lin
2024-03-12 9:20 ` [PATCH 16/43] drm/amd/display: Add debug option for idle reg checks Wayne Lin
2024-03-12 9:20 ` [PATCH 17/43] drm/amd/display: Revert Add left edge pixel + ODM pipe split Wayne Lin
2024-03-12 9:20 ` [PATCH 18/43] drm/amd/display: To adjust dprefclk by down spread percentage Wayne Lin
2024-03-12 9:20 ` [PATCH 19/43] drm/amd/display: Enabling urgent latency adjustment for DCN35 Wayne Lin
2024-03-12 9:20 ` [PATCH 20/43] drm/amd/display: Revert "Set the power_down_on_boot function pointer to null" Wayne Lin
2024-03-12 9:20 ` [PATCH 21/43] drm/amd/display: add stream clock source to DP DTO params Wayne Lin
2024-03-12 9:20 ` [PATCH 22/43] drm/amd/display: Program pixclk according to dcn revision Wayne Lin
2024-03-12 9:20 ` [PATCH 23/43] drm/amd/display: clear mpc_tree in init_pipes Wayne Lin
2024-03-12 9:20 ` [PATCH 24/43] drm/amd/display: [FW Promotion] Release 0.0.208.0 Wayne Lin
2024-03-12 9:20 ` [PATCH 25/43] drm/amd/display: 3.2.276 Wayne Lin
2024-03-12 9:20 ` [PATCH 26/43] drm/amd/display: Workaround register access in idle race with cursor Wayne Lin
2024-03-12 9:20 ` [PATCH 27/43] drm/amd/display: Revert Remove pixle rate limit for subvp Wayne Lin
2024-03-12 9:20 ` [PATCH 28/43] drm/amd/display: fix debug key not working on dml2 Wayne Lin
2024-03-12 9:20 ` [PATCH 29/43] drm/amd/display: Power on VPG memory unconditionally if off Wayne Lin
2024-03-12 9:20 ` [PATCH 30/43] drm/amd/display: Added debug prints for zstate_support and StutterPeriod Wayne Lin
2024-03-12 9:20 ` [PATCH 31/43] drm/amd/display: change aux_init to apu version Wayne Lin
2024-03-12 9:20 ` [PATCH 32/43] drm/amd/display: Increase Z8 watermark times Wayne Lin
2024-03-12 9:20 ` [PATCH 33/43] drm/amd/display: Prevent crash on bring-up Wayne Lin
2024-03-13 14:40 ` Pillai, Aurabindo
2024-03-12 9:20 ` [PATCH 34/43] drm/amd/display: increase bb clock for DCN351 Wayne Lin
2024-03-12 9:20 ` [PATCH 35/43] drm/amd/display: Detect and disallow idle reallow during reentrancy Wayne Lin
2024-03-12 9:20 ` [PATCH 36/43] drm/amd/display: Add optional optimization for IPS handshake Wayne Lin
2024-03-12 9:20 ` [PATCH 37/43] drm/amd/display: Enable optimized handshake for DCN35 Wayne Lin
2024-03-12 9:20 ` [PATCH 38/43] drm/amd/display: Remove unnecessary hard coded DPM states Wayne Lin
2024-03-12 9:20 ` Wayne Lin [this message]
2024-03-12 9:20 ` [PATCH 40/43] drm/amd/display: Enable reallow for idle on DCN35 Wayne Lin
2024-03-12 9:20 ` [PATCH 41/43] drm/amd/display: fix a bug to dereference already freed old current state memory Wayne Lin
2024-03-12 9:20 ` [PATCH 42/43] drm/amd/display: Add TB_BORROWED_MAX definition Wayne Lin
2024-03-12 9:20 ` [PATCH 43/43] drm/amd/display: 3.2.277 Wayne Lin
2024-03-18 13:54 ` [PATCH 00/43] DC Patches March 18, 2024 Wheeler, Daniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240312092036.3283319-40-Wayne.Lin@amd.com \
--to=wayne.lin@amd.com \
--cc=Aurabindo.Pillai@amd.com \
--cc=Harry.Wentland@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Sunpeng.Li@amd.com \
--cc=agustin.gutierrez@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chiahsuan.chung@amd.com \
--cc=hersenxs.wu@amd.com \
--cc=jerry.zuo@amd.com \
--cc=roman.li@amd.com \
--cc=sungjoon.kim@amd.com \
--cc=wenjing.liu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox