RE: [PATCH v7 12/17] drm/i915: Factor out HDCP shim functions from dp for use by dp_mst
> -Original Message- > From: Sean Paul > Sent: Tuesday, June 23, 2020 9:29 PM > To: dri-devel@lists.freedesktop.org; intel-...@lists.freedesktop.org > Cc: Li, Juston ; C, Ramalingam > ; ville.syrj...@linux.intel.com; > jani.nik...@linux.intel.com; joonas.lahti...@linux.intel.com; Vivi, Rodrigo > ; daniel.vet...@ffwll.ch; Sean Paul > > Subject: [PATCH v7 12/17] drm/i915: Factor out HDCP shim functions from dp > for use by dp_mst > > From: Sean Paul > > These functions are all the same for dp and dp_mst, so move them into a > dedicated file for both sst and mst to use. > > Signed-off-by: Sean Paul Reviewed-by: Ramalingam C > Link: https://patchwork.freedesktop.org/patch/msgid/20191203173638.94919- > 11-s...@poorly.run #v1 > Link: > https://patchwork.freedesktop.org/patch/msgid/20191212190230.188505-12- > s...@poorly.run #v2 > Link: > https://patchwork.freedesktop.org/patch/msgid/20200117193103.156821-12- > s...@poorly.run #v3 > Link: > https://patchwork.freedesktop.org/patch/msgid/20200218220242.107265-12- > s...@poorly.run #v4 > Link: > https://patchwork.freedesktop.org/patch/msgid/20200305201236.152307-12- > s...@poorly.run #v5 > Link: https://patchwork.freedesktop.org/patch/msgid/20200429195502.39919- > 12-s...@poorly.run #v6 > > Changes in v2: > -None > Changes in v3: > -Created intel_dp_hdcp.c for the shared functions to live (Ville) Changes in > v4: > -Rebased on new drm logging change > Changes in v5: > -None > Changes in v6: > -None > Changes in v7: > -Rebased patch > --- > drivers/gpu/drm/i915/Makefile| 1 + > drivers/gpu/drm/i915/display/intel_dp.c | 606 +- > drivers/gpu/drm/i915/display/intel_dp.h | 3 + > drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 636 +++ > 4 files changed, 641 insertions(+), 605 deletions(-) create mode 100644 > drivers/gpu/drm/i915/display/intel_dp_hdcp.c > > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile > index 41a27fd5dbc7..cba4ddb95ab1 100644 > --- a/drivers/gpu/drm/i915/Makefile > +++ b/drivers/gpu/drm/i915/Makefile > @@ -233,6 +233,7 @@ i915-y += \ > display/intel_ddi.o \ > display/intel_dp.o \ > display/intel_dp_aux_backlight.o \ > + display/intel_dp_hdcp.o \ > display/intel_dp_link_training.o \ > display/intel_dp_mst.o \ > display/intel_dsi.o \ > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c > b/drivers/gpu/drm/i915/display/intel_dp.c > index d98e45a09c28..78ce5e41d559 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -38,7 +38,6 @@ > #include > #include > #include > -#include > #include > > #include "i915_debugfs.h" > @@ -6396,609 +6395,6 @@ void intel_dp_encoder_suspend(struct > intel_encoder *intel_encoder) > edp_panel_vdd_off_sync(intel_dp); > } > > -static void intel_dp_hdcp_wait_for_cp_irq(struct intel_hdcp *hdcp, int > timeout) > -{ > - long ret; > - > -#define C (hdcp->cp_irq_count_cached != atomic_read(>cp_irq_count)) > - ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, C, > -msecs_to_jiffies(timeout)); > - > - if (!ret) > - DRM_DEBUG_KMS("Timedout at waiting for CP_IRQ\n"); > -} > - > -static > -int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, > - u8 *an) > -{ > - struct drm_i915_private *i915 = to_i915(intel_dig_port- > >base.base.dev); > - u8 aksv[DRM_HDCP_KSV_LEN] = {}; > - ssize_t dpcd_ret; > - > - dpcd_ret = drm_dp_dpcd_write(_dig_port->dp.aux, > DP_AUX_HDCP_AN, > - an, DRM_HDCP_AN_LEN); > - if (dpcd_ret != DRM_HDCP_AN_LEN) { > - drm_dbg_kms(>drm, > - "Failed to write An over DP/AUX (%zd)\n", > - dpcd_ret); > - return dpcd_ret >= 0 ? -EIO : dpcd_ret; > - } > - > - /* > - * Since Aksv is Oh-So-Secret, we can't access it in software. So we > - * send an empty buffer of the correct length through the DP helpers. On > - * the other side, in the transfer hook, we'll generate a flag based on > - * the destination address which will tickle the hardware to output the > - * Aksv on our behalf after the header is sent. > - */ > - dpcd_ret = drm_dp_dpcd_write(_dig_port->dp.aux, > DP_AUX_HDCP_AKSV, > - aksv, DRM_HDCP_KSV_LEN); > - if (dpcd_ret != DRM_HDCP_KSV_
[PATCH v7 12/17] drm/i915: Factor out HDCP shim functions from dp for use by dp_mst
From: Sean Paul These functions are all the same for dp and dp_mst, so move them into a dedicated file for both sst and mst to use. Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20191203173638.94919-11-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20191212190230.188505-12-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20200117193103.156821-12-s...@poorly.run #v3 Link: https://patchwork.freedesktop.org/patch/msgid/20200218220242.107265-12-s...@poorly.run #v4 Link: https://patchwork.freedesktop.org/patch/msgid/20200305201236.152307-12-s...@poorly.run #v5 Link: https://patchwork.freedesktop.org/patch/msgid/20200429195502.39919-12-s...@poorly.run #v6 Changes in v2: -None Changes in v3: -Created intel_dp_hdcp.c for the shared functions to live (Ville) Changes in v4: -Rebased on new drm logging change Changes in v5: -None Changes in v6: -None Changes in v7: -Rebased patch --- drivers/gpu/drm/i915/Makefile| 1 + drivers/gpu/drm/i915/display/intel_dp.c | 606 +- drivers/gpu/drm/i915/display/intel_dp.h | 3 + drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 636 +++ 4 files changed, 641 insertions(+), 605 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dp_hdcp.c diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 41a27fd5dbc7..cba4ddb95ab1 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -233,6 +233,7 @@ i915-y += \ display/intel_ddi.o \ display/intel_dp.o \ display/intel_dp_aux_backlight.o \ + display/intel_dp_hdcp.o \ display/intel_dp_link_training.o \ display/intel_dp_mst.o \ display/intel_dsi.o \ diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d98e45a09c28..78ce5e41d559 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include "i915_debugfs.h" @@ -6396,609 +6395,6 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) edp_panel_vdd_off_sync(intel_dp); } -static void intel_dp_hdcp_wait_for_cp_irq(struct intel_hdcp *hdcp, int timeout) -{ - long ret; - -#define C (hdcp->cp_irq_count_cached != atomic_read(>cp_irq_count)) - ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, C, - msecs_to_jiffies(timeout)); - - if (!ret) - DRM_DEBUG_KMS("Timedout at waiting for CP_IRQ\n"); -} - -static -int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, - u8 *an) -{ - struct drm_i915_private *i915 = to_i915(intel_dig_port->base.base.dev); - u8 aksv[DRM_HDCP_KSV_LEN] = {}; - ssize_t dpcd_ret; - - dpcd_ret = drm_dp_dpcd_write(_dig_port->dp.aux, DP_AUX_HDCP_AN, -an, DRM_HDCP_AN_LEN); - if (dpcd_ret != DRM_HDCP_AN_LEN) { - drm_dbg_kms(>drm, - "Failed to write An over DP/AUX (%zd)\n", - dpcd_ret); - return dpcd_ret >= 0 ? -EIO : dpcd_ret; - } - - /* -* Since Aksv is Oh-So-Secret, we can't access it in software. So we -* send an empty buffer of the correct length through the DP helpers. On -* the other side, in the transfer hook, we'll generate a flag based on -* the destination address which will tickle the hardware to output the -* Aksv on our behalf after the header is sent. -*/ - dpcd_ret = drm_dp_dpcd_write(_dig_port->dp.aux, DP_AUX_HDCP_AKSV, -aksv, DRM_HDCP_KSV_LEN); - if (dpcd_ret != DRM_HDCP_KSV_LEN) { - drm_dbg_kms(>drm, - "Failed to write Aksv over DP/AUX (%zd)\n", - dpcd_ret); - return dpcd_ret >= 0 ? -EIO : dpcd_ret; - } - return 0; -} - -static int intel_dp_hdcp_read_bksv(struct intel_digital_port *intel_dig_port, - u8 *bksv) -{ - struct drm_i915_private *i915 = to_i915(intel_dig_port->base.base.dev); - ssize_t ret; - - ret = drm_dp_dpcd_read(_dig_port->dp.aux, DP_AUX_HDCP_BKSV, bksv, - DRM_HDCP_KSV_LEN); - if (ret != DRM_HDCP_KSV_LEN) { - drm_dbg_kms(>drm, - "Read Bksv from DP/AUX failed (%zd)\n", ret); - return ret >= 0 ? -EIO : ret; - } - return 0; -} - -static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port, - u8 *bstatus) -{ - struct drm_i915_private *i915 = to_i915(intel_dig_port->base.base.dev); - ssize_t ret; - -