mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
drm/i915/hdcp: Use intel_display in hdcp_gsc
Use intel_display structure instead of drm_i915_private wherever possible in hdcp_gsc related files. --v2 -make intel_hdcp_gsc_hdcp2_init accept intel_display [Jani] Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240911090540.643155-3-suraj.kandpal@intel.com
This commit is contained in:
parent
e35bf8f6a0
commit
c8d4ef7139
|
|
@ -2307,7 +2307,7 @@ void intel_hdcp_component_init(struct drm_i915_private *i915)
|
|||
display->hdcp.comp_added = true;
|
||||
mutex_unlock(&display->hdcp.hdcp_mutex);
|
||||
if (intel_hdcp_gsc_cs_required(display))
|
||||
ret = intel_hdcp_gsc_init(i915);
|
||||
ret = intel_hdcp_gsc_init(display);
|
||||
else
|
||||
ret = component_add_typed(display->drm->dev, &i915_hdcp_ops,
|
||||
I915_COMPONENT_HDCP);
|
||||
|
|
@ -2570,7 +2570,7 @@ void intel_hdcp_component_fini(struct drm_i915_private *i915)
|
|||
mutex_unlock(&display->hdcp.hdcp_mutex);
|
||||
|
||||
if (intel_hdcp_gsc_cs_required(display))
|
||||
intel_hdcp_gsc_fini(i915);
|
||||
intel_hdcp_gsc_fini(display);
|
||||
else
|
||||
component_del(display->drm->dev, &i915_hdcp_ops);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,8 +107,9 @@ static const struct i915_hdcp_ops gsc_hdcp_ops = {
|
|||
.close_hdcp_session = intel_hdcp_gsc_close_session,
|
||||
};
|
||||
|
||||
static int intel_hdcp_gsc_hdcp2_init(struct drm_i915_private *i915)
|
||||
static int intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(display->drm);
|
||||
struct intel_hdcp_gsc_message *hdcp_message;
|
||||
int ret;
|
||||
|
||||
|
|
@ -121,19 +122,19 @@ static int intel_hdcp_gsc_hdcp2_init(struct drm_i915_private *i915)
|
|||
* NOTE: No need to lock the comp mutex here as it is already
|
||||
* going to be taken before this function called
|
||||
*/
|
||||
i915->display.hdcp.hdcp_message = hdcp_message;
|
||||
display->hdcp.hdcp_message = hdcp_message;
|
||||
ret = intel_hdcp_gsc_initialize_message(i915, hdcp_message);
|
||||
|
||||
if (ret)
|
||||
drm_err(&i915->drm, "Could not initialize hdcp_message\n");
|
||||
drm_err(display->drm, "Could not initialize hdcp_message\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void intel_hdcp_gsc_free_message(struct drm_i915_private *i915)
|
||||
static void intel_hdcp_gsc_free_message(struct intel_display *display)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message =
|
||||
i915->display.hdcp.hdcp_message;
|
||||
display->hdcp.hdcp_message;
|
||||
|
||||
hdcp_message->hdcp_cmd_in = NULL;
|
||||
hdcp_message->hdcp_cmd_out = NULL;
|
||||
|
|
@ -141,7 +142,7 @@ static void intel_hdcp_gsc_free_message(struct drm_i915_private *i915)
|
|||
kfree(hdcp_message);
|
||||
}
|
||||
|
||||
int intel_hdcp_gsc_init(struct drm_i915_private *i915)
|
||||
int intel_hdcp_gsc_init(struct intel_display *display)
|
||||
{
|
||||
struct i915_hdcp_arbiter *data;
|
||||
int ret;
|
||||
|
|
@ -150,20 +151,20 @@ int intel_hdcp_gsc_init(struct drm_i915_private *i915)
|
|||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_lock(&i915->display.hdcp.hdcp_mutex);
|
||||
i915->display.hdcp.arbiter = data;
|
||||
i915->display.hdcp.arbiter->hdcp_dev = i915->drm.dev;
|
||||
i915->display.hdcp.arbiter->ops = &gsc_hdcp_ops;
|
||||
ret = intel_hdcp_gsc_hdcp2_init(i915);
|
||||
mutex_unlock(&i915->display.hdcp.hdcp_mutex);
|
||||
mutex_lock(&display->hdcp.hdcp_mutex);
|
||||
display->hdcp.arbiter = data;
|
||||
display->hdcp.arbiter->hdcp_dev = display->drm->dev;
|
||||
display->hdcp.arbiter->ops = &gsc_hdcp_ops;
|
||||
ret = intel_hdcp_gsc_hdcp2_init(display);
|
||||
mutex_unlock(&display->hdcp.hdcp_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void intel_hdcp_gsc_fini(struct drm_i915_private *i915)
|
||||
void intel_hdcp_gsc_fini(struct intel_display *display)
|
||||
{
|
||||
intel_hdcp_gsc_free_message(i915);
|
||||
kfree(i915->display.hdcp.arbiter);
|
||||
intel_hdcp_gsc_free_message(display);
|
||||
kfree(display->hdcp.arbiter);
|
||||
}
|
||||
|
||||
static int intel_gsc_send_sync(struct drm_i915_private *i915,
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ bool intel_hdcp_gsc_cs_required(struct intel_display *display);
|
|||
ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
|
||||
size_t msg_in_len, u8 *msg_out,
|
||||
size_t msg_out_len);
|
||||
int intel_hdcp_gsc_init(struct drm_i915_private *i915);
|
||||
void intel_hdcp_gsc_fini(struct drm_i915_private *i915);
|
||||
int intel_hdcp_gsc_init(struct intel_display *display);
|
||||
void intel_hdcp_gsc_fini(struct intel_display *display);
|
||||
bool intel_hdcp_gsc_check_status(struct intel_display *display);
|
||||
|
||||
#endif /* __INTEL_HDCP_GCS_H__ */
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ intel_hdcp_gsc_initiate_session(struct device *dev, struct hdcp_port_data *data,
|
|||
(u8 *)&session_init_out,
|
||||
sizeof(session_init_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (session_init_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
|
||||
WIRED_INITIATE_HDCP2_SESSION,
|
||||
session_init_out.header.status);
|
||||
return -EIO;
|
||||
|
|
@ -108,12 +108,12 @@ intel_hdcp_gsc_verify_receiver_cert_prepare_km(struct device *dev,
|
|||
(u8 *)&verify_rxcert_out,
|
||||
sizeof(verify_rxcert_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed: %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed: %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (verify_rxcert_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
|
||||
WIRED_VERIFY_RECEIVER_CERT,
|
||||
verify_rxcert_out.header.status);
|
||||
return -EIO;
|
||||
|
|
@ -171,12 +171,12 @@ intel_hdcp_gsc_verify_hprime(struct device *dev, struct hdcp_port_data *data,
|
|||
(u8 *)&send_hprime_out,
|
||||
sizeof(send_hprime_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (send_hprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
|
||||
WIRED_AKE_SEND_HPRIME, send_hprime_out.header.status);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
@ -222,12 +222,12 @@ intel_hdcp_gsc_store_pairing_info(struct device *dev, struct hdcp_port_data *dat
|
|||
(u8 *)&pairing_info_out,
|
||||
sizeof(pairing_info_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (pairing_info_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. Status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X failed. Status: 0x%X\n",
|
||||
WIRED_AKE_SEND_PAIRING_INFO,
|
||||
pairing_info_out.header.status);
|
||||
return -EIO;
|
||||
|
|
@ -269,12 +269,12 @@ intel_hdcp_gsc_initiate_locality_check(struct device *dev,
|
|||
byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&lc_init_in, sizeof(lc_init_in),
|
||||
(u8 *)&lc_init_out, sizeof(lc_init_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (lc_init_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X Failed. status: 0x%X\n",
|
||||
WIRED_INIT_LOCALITY_CHECK, lc_init_out.header.status);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
@ -323,12 +323,12 @@ intel_hdcp_gsc_verify_lprime(struct device *dev, struct hdcp_port_data *data,
|
|||
(u8 *)&verify_lprime_out,
|
||||
sizeof(verify_lprime_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (verify_lprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
WIRED_VALIDATE_LOCALITY,
|
||||
verify_lprime_out.header.status);
|
||||
return -EIO;
|
||||
|
|
@ -369,12 +369,12 @@ int intel_hdcp_gsc_get_session_key(struct device *dev,
|
|||
byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&get_skey_in, sizeof(get_skey_in),
|
||||
(u8 *)&get_skey_out, sizeof(get_skey_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (get_skey_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
WIRED_GET_SESSION_KEY, get_skey_out.header.status);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
@ -435,12 +435,12 @@ intel_hdcp_gsc_repeater_check_flow_prepare_ack(struct device *dev,
|
|||
(u8 *)&verify_repeater_out,
|
||||
sizeof(verify_repeater_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (verify_repeater_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
WIRED_VERIFY_REPEATER,
|
||||
verify_repeater_out.header.status);
|
||||
return -EIO;
|
||||
|
|
@ -504,12 +504,12 @@ int intel_hdcp_gsc_verify_mprime(struct device *dev,
|
|||
sizeof(verify_mprime_out));
|
||||
kfree(verify_mprime_in);
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (verify_mprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
WIRED_REPEATER_AUTH_STREAM_REQ,
|
||||
verify_mprime_out.header.status);
|
||||
return -EIO;
|
||||
|
|
@ -552,12 +552,12 @@ int intel_hdcp_gsc_enable_authentication(struct device *dev,
|
|||
(u8 *)&enable_auth_out,
|
||||
sizeof(enable_auth_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (enable_auth_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
|
||||
WIRED_ENABLE_AUTH, enable_auth_out.header.status);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
@ -599,12 +599,12 @@ intel_hdcp_gsc_close_session(struct device *dev, struct hdcp_port_data *data)
|
|||
(u8 *)&session_close_out,
|
||||
sizeof(session_close_out));
|
||||
if (byte < 0) {
|
||||
drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
drm_dbg_kms(display->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
|
||||
return byte;
|
||||
}
|
||||
|
||||
if (session_close_out.header.status != FW_HDCP_STATUS_SUCCESS) {
|
||||
drm_dbg_kms(&i915->drm, "Session Close Failed. status: 0x%X\n",
|
||||
drm_dbg_kms(display->drm, "Session Close Failed. status: 0x%X\n",
|
||||
session_close_out.header.status);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,10 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
|
|||
}
|
||||
|
||||
/*This function helps allocate memory for the command that we will send to gsc cs */
|
||||
static int intel_hdcp_gsc_initialize_message(struct xe_device *xe,
|
||||
static int intel_hdcp_gsc_initialize_message(struct intel_display *display,
|
||||
struct intel_hdcp_gsc_message *hdcp_message)
|
||||
{
|
||||
struct xe_device *xe = to_xe_device(display->drm);
|
||||
struct xe_bo *bo = NULL;
|
||||
u64 cmd_in, cmd_out;
|
||||
int ret = 0;
|
||||
|
|
@ -81,7 +82,7 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe,
|
|||
XE_BO_FLAG_GGTT);
|
||||
|
||||
if (IS_ERR(bo)) {
|
||||
drm_err(&xe->drm, "Failed to allocate bo for HDCP streaming command!\n");
|
||||
drm_err(display->drm, "Failed to allocate bo for HDCP streaming command!\n");
|
||||
ret = PTR_ERR(bo);
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -97,7 +98,7 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int intel_hdcp_gsc_hdcp2_init(struct xe_device *xe)
|
||||
static int intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message;
|
||||
int ret;
|
||||
|
|
@ -111,14 +112,14 @@ static int intel_hdcp_gsc_hdcp2_init(struct xe_device *xe)
|
|||
* NOTE: No need to lock the comp mutex here as it is already
|
||||
* going to be taken before this function called
|
||||
*/
|
||||
ret = intel_hdcp_gsc_initialize_message(xe, hdcp_message);
|
||||
ret = intel_hdcp_gsc_initialize_message(display, hdcp_message);
|
||||
if (ret) {
|
||||
drm_err(&xe->drm, "Could not initialize hdcp_message\n");
|
||||
drm_err(display->drm, "Could not initialize hdcp_message\n");
|
||||
kfree(hdcp_message);
|
||||
return ret;
|
||||
}
|
||||
|
||||
xe->display.hdcp.hdcp_message = hdcp_message;
|
||||
display->hdcp.hdcp_message = hdcp_message;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +139,7 @@ static const struct i915_hdcp_ops gsc_hdcp_ops = {
|
|||
.close_hdcp_session = intel_hdcp_gsc_close_session,
|
||||
};
|
||||
|
||||
int intel_hdcp_gsc_init(struct xe_device *xe)
|
||||
int intel_hdcp_gsc_init(struct intel_display *display)
|
||||
{
|
||||
struct i915_hdcp_arbiter *data;
|
||||
int ret;
|
||||
|
|
@ -147,33 +148,33 @@ int intel_hdcp_gsc_init(struct xe_device *xe)
|
|||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_lock(&xe->display.hdcp.hdcp_mutex);
|
||||
xe->display.hdcp.arbiter = data;
|
||||
xe->display.hdcp.arbiter->hdcp_dev = xe->drm.dev;
|
||||
xe->display.hdcp.arbiter->ops = &gsc_hdcp_ops;
|
||||
ret = intel_hdcp_gsc_hdcp2_init(xe);
|
||||
mutex_lock(&display->hdcp.hdcp_mutex);
|
||||
display->hdcp.arbiter = data;
|
||||
display->hdcp.arbiter->hdcp_dev = display->drm->dev;
|
||||
display->hdcp.arbiter->ops = &gsc_hdcp_ops;
|
||||
ret = intel_hdcp_gsc_hdcp2_init(display);
|
||||
if (ret)
|
||||
kfree(data);
|
||||
|
||||
mutex_unlock(&xe->display.hdcp.hdcp_mutex);
|
||||
mutex_unlock(&display->hdcp.hdcp_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void intel_hdcp_gsc_fini(struct xe_device *xe)
|
||||
void intel_hdcp_gsc_fini(struct intel_display *display)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message =
|
||||
xe->display.hdcp.hdcp_message;
|
||||
struct i915_hdcp_arbiter *arb = xe->display.hdcp.arbiter;
|
||||
display->hdcp.hdcp_message;
|
||||
struct i915_hdcp_arbiter *arb = display->hdcp.arbiter;
|
||||
|
||||
if (hdcp_message) {
|
||||
xe_bo_unpin_map_no_vm(hdcp_message->hdcp_bo);
|
||||
kfree(hdcp_message);
|
||||
xe->display.hdcp.hdcp_message = NULL;
|
||||
display->hdcp.hdcp_message = NULL;
|
||||
}
|
||||
|
||||
kfree(arb);
|
||||
xe->display.hdcp.arbiter = NULL;
|
||||
display->hdcp.arbiter = NULL;
|
||||
}
|
||||
|
||||
static int xe_gsc_send_sync(struct xe_device *xe,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user