drm/i915: Implement HDCP
Subsystems (4)
v6 cover drm/i915: Implement HDCP
This is The One. Differences between v6 and v5 include fixing a printk formatting issue that 0-day found, and changing the verbose licenses in the new files to SPDX tags.
I'll push this to a topic branch in the drm-misc tree and send a pull request to Dave for 4.17 after the 4.16 merge window is over.
Sincere thanks to Ram, Daniel, and others for their review. Now the fun part, testing and fixing bugs!
Sean
Sean Paul (9):
drm: Fix link-status kerneldoc line lengths drm/i915: Add more control to wait_for routines
drm: Add Content Protection property
drm: Add some HDCP related #defines drm/i915: Add HDCP framework + base implementation drm/i915: Make use of indexed write GMBUS feature drm/i915: Add function to output Aksv over GMBUS drm/i915: Implement HDCP for HDMI drm/i915: Implement HDCP for DisplayPort
drivers/gpu/drm/drm_atomic.c | 8 + drivers/gpu/drm/drm_connector.c | 87 ++++- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 85 ++++ drivers/gpu/drm/i915/intel_atomic.c | 2 + drivers/gpu/drm/i915/intel_ddi.c | 36 ++ drivers/gpu/drm/i915/intel_display.c | 4 + drivers/gpu/drm/i915/intel_dp.c | 244 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 104 ++++- drivers/gpu/drm/i915/intel_hdcp.c | 723 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_hdmi.c | 250 ++++++++++++ drivers/gpu/drm/i915/intel_i2c.c | 81 +++- drivers/gpu/drm/i915/intel_uncore.c | 23 +- drivers/gpu/drm/i915/intel_uncore.h | 14 +- include/drm/drm_connector.h | 16 + include/drm/drm_dp_helper.h | 17 + include/drm/drm_hdcp.h | 39 ++ include/uapi/drm/drm_mode.h | 4 + 19 files changed, 1696 insertions(+), 43 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_hdcp.c create mode 100644 include/drm/drm_hdcp.h
Signature · 1 line
2.16.0.rc0.223.g4a4ac83678-goog
PATCH v6 1/9 drm: Fix link-status kerneldoc line lengths
I'm adding some stuff below it and it's killing my editor's vibe.
Changes in v2:
- Added to the series
Changes in v3:
- None
Changes in v4:
- None
Changes in v5:
- None
Changes in v6:
- None
--- drivers/gpu/drm/drm_connector.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_connector.c +5 -4
@@ -817,10 +817,11 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,* should update this value using drm_mode_connector_set_tile_property(). * Userspace cannot change this property. * link-status: -* Connector link-status property to indicate the status of link. The default -* value of link-status is "GOOD". If something fails during or after modeset, -* the kernel driver may set this to "BAD" and issue a hotplug uevent. Drivers -* should update this value using drm_mode_connector_set_link_status_property(). +* Connector link-status property to indicate the status of link. The +* default value of link-status is "GOOD". If something fails during or +* after modeset, the kernel driver may set this to "BAD" and issue a +* hotplug uevent. Drivers should update this value using +* drm_mode_connector_set_link_status_property(). * non_desktop: * Indicates the output should be ignored for purposes of displaying a * standard desktop environment or console. This is most likely because
Signature · 1 line
2.16.0.rc0.223.g4a4ac83678-goog
PATCH v6 2/9 drm/i915: Add more control to wait_for routines
In reply to Sean PaulThis patch adds a little more control to a couple wait_for routines such that we can avoid open-coding read/wait/timeout patterns which:
- need the value of the register after the wait_for
- run arbitrary operation for the read portion
This patch also chooses the correct sleep function (based on timers-howto.txt) for the polling interval the caller specifies.
Changes in v2:
- Added to the series
Changes in v3:
- Rebased on drm-intel-next-queued and the new Wmin/max _wait_for
- Removed msleep option
Changes in v4:
- Removed ; for OP in _wait_for (Chris)
- Moved reg_value definition above ret (Chris)
Changes in v4:
- checkpatch whitespace fix
Changes in v5:
- None
Changes in v6:
- None
--- drivers/gpu/drm/i915/intel_drv.h | 17 ++++++++++------- drivers/gpu/drm/i915/intel_uncore.c | 23 ++++++++++++++++------- drivers/gpu/drm/i915/intel_uncore.h | 14 +++++++++++++- 3 files changed, 39 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +10 -7
@@ -41,20 +41,21 @@#include <drm/drm_atomic.h> /** -* _wait_for - magic (register) wait macro +* __wait_for - magic wait macro * -* Does the right thing for modeset paths when run under kdgb or similar atomic -* contexts. Note that it's important that we check the condition again after -* having timed out, since the timeout could be due to preemption or similar and -* we've never had a chance to check the condition before the timeout. +* Macro to help avoid open coding check/wait/timeout patterns. Note that it's +* important that we check the condition again after having timed out, since the +* timeout could be due to preemption or similar and we've never had a chance to +* check the condition before the timeout. */ -#define _wait_for (COND ,US , Wmin, Wmax) ({ \ +#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \int ret__; \might_sleep (); \for (;;) { \bool expired__ =time_after (jiffies, timeout__); \ +OP ; \if (COND ) { \ ret__ =0 ; \break ; \
@@ -70,7 +71,9 @@ ret__; \ }) -#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) +#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ + (Wmax)) +#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000)/* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */ #if defined(CONFIG_DRM_I915_DEBUG ) && defined(CONFIG_PREEMPT_COUNT )
drivers/gpu/drm/i915/intel_uncore.c +16 -7
@@ -1767,12 +1767,14 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, }/** -* intel_wait_for_register - wait until register matches expected state +* __intel_wait_for_register - wait until register matches expected state * @dev_priv: the i915 device * @reg: the register to read * @mask: mask to apply to register value * @value: expected value -* @timeout_ms: timeout in millisecond +* @fast_timeout_us: fast timeout in microsecond for atomic/tight wait +* @slow_timeout_ms: slow timeout in millisecond +* @out_value: optional placeholder to hold registry value * * This routine waits until the target register @reg contains the expected * @value after applying the @mask, i.e. it waits until ::
@@ -1783,14 +1785,17 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv,* * Returns 0 if the register matches the desired condition, or -ETIMEOUT. */ -int intel_wait_for_register (struct drm_i915_private *dev_priv, +int __intel_wait_for_register (struct drm_i915_private *dev_priv,i915_reg_t reg,u32 mask,u32 value, -unsigned int timeout_ms) +unsigned int fast_timeout_us, +unsigned int slow_timeout_ms, +u32 *out_value) {unsigned fw =intel_uncore_forcewake_for_reg (dev_priv, reg,FW_REG_READ ); +u32 reg_value;int ret;might_sleep ();
@@ -1800,14 +1805,18 @@ int intel_wait_for_register(struct drm_i915_private *dev_priv, ret =__intel_wait_for_register_fw (dev_priv, reg, mask, value, -2 ,0 ,NULL ); + fast_timeout_us,0 , ®_value);intel_uncore_forcewake_put__locked (dev_priv, fw);spin_unlock_irq (&dev_priv->uncore.lock);if (ret) - ret =wait_for ((I915_READ_NOTRACE (reg) & mask) == value, - timeout_ms); + ret =__wait_for (reg_value =I915_READ_NOTRACE (reg), + (reg_value & mask) == value, + slow_timeout_ms *1000 ,10 ,1000 ); + +if (out_value) + *out_value = reg_value;return ret; }
drivers/gpu/drm/i915/intel_uncore.h +13 -1
@@ -163,11 +163,23 @@ void intel_uncore_forcewake_put__locked(struct drm_i915_private *dev_priv,void intel_uncore_forcewake_user_get (struct drm_i915_private *dev_priv);void intel_uncore_forcewake_user_put (struct drm_i915_private *dev_priv); +int __intel_wait_for_register (struct drm_i915_private *dev_priv, +i915_reg_t reg, +u32 mask, +u32 value, +unsigned int fast_timeout_us, +unsigned int slow_timeout_ms, +u32 *out_value); +static inline int intel_wait_for_register (struct drm_i915_private *dev_priv,i915_reg_t reg,u32 mask,u32 value, -unsigned int timeout_ms); +unsigned int timeout_ms) +{ +return __intel_wait_for_register (dev_priv, reg, mask, value,2 , + timeout_ms,NULL ); +} int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, i915_reg_t reg, u32 mask,
Signature · 6 lines
2.16.0.rc0.223.g4a4ac83678-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 3/9 drm: Add Content Protection property
In reply to Sean PaulThis patch adds a new optional connector property to allow userspace to enable protection over the content it is displaying. This will typically be implemented by the driver using HDCP.
The property is a tri-state with the following values:
- OFF: Self explanatory, no content protection
- DESIRED: Userspace requests that the driver enable protection
- ENABLED: Once the driver has authenticated the link, it sets this value
The driver is responsible for downgrading ENABLED to DESIRED if the link becomes unprotected. The driver should also maintain the desiredness of protection across hotplug/dpms/suspend.
If this looks familiar, I posted [1] this 3 years ago. We have been using this in ChromeOS across exynos, mediatek, and rockchip over that time.
Changes in v2:
- Pimp kerneldoc for content_protection_property (Daniel)
- Drop sysfs attribute
Changes in v3:
- None
Changes in v4:
- Changed kerneldoc to recommend userspace polling (Daniel)
- Changed kerneldoc to briefly describe how to attach the property (Daniel) Changes in v5:
- checkpatch whitespace noise
- Change DRM_MODE_CONTENT_PROTECTION_OFF to DRM_MODE_CONTENT_PROTECTION_UNDESIRED Changes in v6:
- None
[1] https://lists.freedesktop.org/archives/dri-devel/2014-December/073336.html
--- drivers/gpu/drm/drm_atomic.c | 8 +++++ drivers/gpu/drm/drm_connector.c | 78 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 16 +++++++++ include/uapi/drm/drm_mode.h | 4 +++ 4 files changed, 106 insertions(+)
drivers/gpu/drm/drm_atomic.c +8 -0
@@ -1224,6 +1224,12 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, state->picture_aspect_ratio = val; }else if (property == connector->scaling_mode_property) { state->scaling_mode = val; + }else if (property == connector->content_protection_property) { +if (val ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { +DRM_DEBUG_KMS ("only drivers can set CP Enabled\n" ); +return -EINVAL ; + } + state->content_protection = val; }else if (connector->funcs->atomic_set_property) {return connector->funcs->atomic_set_property (connector, state, property, val);
@@ -1303,6 +1309,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->picture_aspect_ratio; }else if (property == connector->scaling_mode_property) { *val = state->scaling_mode; + }else if (property == connector->content_protection_property) { + *val = state->content_protection; }else if (connector->funcs->atomic_get_property) {return connector->funcs->atomic_get_property (connector, state, property, val);
drivers/gpu/drm/drm_connector.c +78 -0
96 lines not on this page · raw message
include/drm/drm_connector.h +16 -0
@@ -419,6 +419,12 @@ struct drm_connector_state {* upscaling, mostly used for built-in panels. */ unsigned int scaling_mode; + +/** +* @content_protection: Connector property to request content +* protection. This is most commonly used for HDCP. +*/ +unsigned int content_protection; };/**
@@ -766,6 +772,7 @@ struct drm_cmdline_mode {* @tile_h_size: horizontal size of this tile. * @tile_v_size: vertical size of this tile. * @scaling_mode_property: Optional atomic property to control the upscaling. +* @content_protection_property: Optional property to control content protection * * Each connector may be connected to one or more CRTCs, or may be clonable by * another connector if they can share a CRTC. Each connector also has a specific
@@ -856,6 +863,12 @@ struct drm_connector {struct drm_property *scaling_mode_property; +/** +* @content_protection_property: DRM ENUM property for content +* protection +*/ +struct drm_property *content_protection_property; +/** * @path_blob_ptr: *
@@ -1065,6 +1078,7 @@ const char *drm_get_dvi_i_subconnector_name(int val);const char *drm_get_dvi_i_select_name (int val);const char *drm_get_tv_subconnector_name (int val);const char *drm_get_tv_select_name (int val); +const char *drm_get_content_protection_name (int val);int drm_mode_create_dvi_i_properties (struct drm_device *dev); int drm_mode_create_tv_properties(struct drm_device *dev,
@@ -1073,6 +1087,8 @@ int drm_mode_create_tv_properties(struct drm_device *dev,int drm_mode_create_scaling_mode_property (struct drm_device *dev);int drm_connector_attach_scaling_mode_property (struct drm_connector *connector,u32 scaling_mode_mask); +int drm_connector_attach_content_protection_property ( +struct drm_connector *connector);int drm_mode_create_aspect_ratio_property (struct drm_device *dev);int drm_mode_create_suggested_offset_properties (struct drm_device *dev);
include/uapi/drm/drm_mode.h +4 -0
@@ -173,6 +173,10 @@ extern "C" { DRM_MODE_REFLECT_X | \ DRM_MODE_REFLECT_Y) +/* Content Protection Flags */ +#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0 +#define DRM_MODE_CONTENT_PROTECTION_DESIRED 1 +#define DRM_MODE_CONTENT_PROTECTION_ENABLED 2struct drm_mode_modeinfo {__u32 clock;
Signature · 6 lines
2.16.0.rc0.223.g4a4ac83678-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 4/9 drm: Add some HDCP related #defines
In reply to Sean PaulIn preparation for implementing HDCP in i915, add some HDCP related register offsets and defines. The dpcd register offsets will go in drm_dp_helper.h whereas the ddc offsets along with generic HDCP stuff will get stuffed in drm_hdcp.h, which is new.
Changes in v2:
- drm_hdcp.h gets MIT license (Daniel)
Changes in v3:
- None
Changes in v4:
- None
Changes in v5:
- None
Changes in v6:
- SPDX license
--- include/drm/drm_dp_helper.h | 17 +++++++++++++++++ include/drm/drm_hdcp.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 include/drm/drm_hdcp.h
include/drm/drm_dp_helper.h +17 -0
@@ -836,6 +836,23 @@#define DP_CEC_TX_MESSAGE_BUFFER 0x3020#define DP_CEC_MESSAGE_BUFFER_LENGTH 0x10 +#define DP_AUX_HDCP_BKSV 0x68000 +#define DP_AUX_HDCP_RI_PRIME 0x68005 +#define DP_AUX_HDCP_AKSV 0x68007 +#define DP_AUX_HDCP_AN 0x6800C +#define DP_AUX_HDCP_V_PRIME (h) (0x68014 + h * 4) +#define DP_AUX_HDCP_BCAPS 0x68028 +# define DP_BCAPS_REPEATER_PRESENT BIT(1) +# define DP_BCAPS_HDCP_CAPABLE BIT(0) +#define DP_AUX_HDCP_BSTATUS 0x68029 +# define DP_BSTATUS_REAUTH_REQ BIT(3) +# define DP_BSTATUS_LINK_FAILURE BIT(2) +# define DP_BSTATUS_R0_PRIME_READY BIT(1) +# define DP_BSTATUS_READY BIT(0) +#define DP_AUX_HDCP_BINFO 0x6802A +#define DP_AUX_HDCP_KSV_FIFO 0x6802C +#define DP_AUX_HDCP_AINFO 0x6803B +/* DP 1.2 Sideband message defines */ /* peer device type - DP 1.2a Table 2-92 */ #define DP_PEER_DEVICE_NONE 0x0
include/drm/drm_hdcp.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright (C) 2017 Google, Inc. +* +* Authors: +* Sean Paul <[email protected]> +*/ + +#ifndef _DRM_HDCP_H_INCLUDED_ +#define _DRM_HDCP_H_INCLUDED_ + +/* Period of hdcp checks (to ensure we're still authenticated) */ +#define DRM_HDCP_CHECK_PERIOD_MS (128 * 16) + +/* Shared lengths/masks between HDMI/DVI/DisplayPort */ +#define DRM_HDCP_AN_LEN 8 +#define DRM_HDCP_BSTATUS_LEN 2 +#define DRM_HDCP_KSV_LEN 5 +#define DRM_HDCP_RI_LEN 2 +#define DRM_HDCP_V_PRIME_PART_LEN 4 +#define DRM_HDCP_V_PRIME_NUM_PARTS 5 +#define DRM_HDCP_NUM_DOWNSTREAM (x) (x & 0x3f) + +/* Slave address for the HDCP registers in the receiver */ +#define DRM_HDCP_DDC_ADDR 0x3A + +/* HDCP register offsets for HDMI/DVI devices */ +#define DRM_HDCP_DDC_BKSV 0x00 +#define DRM_HDCP_DDC_RI_PRIME 0x08 +#define DRM_HDCP_DDC_AKSV 0x10 +#define DRM_HDCP_DDC_AN 0x18 +#define DRM_HDCP_DDC_V_PRIME (h) (0x20 + h * 4) +#define DRM_HDCP_DDC_BCAPS 0x40 +#define DRM_HDCP_DDC_BCAPS_REPEATER_PRESENT BIT(6) +#define DRM_HDCP_DDC_BCAPS_KSV_FIFO_READY BIT(5) +#define DRM_HDCP_DDC_BSTATUS 0x41 +#define DRM_HDCP_DDC_KSV_FIFO 0x43 + +#endif
Signature · 1 line
2.16.0.rc0.223.g4a4ac83678-goog
Re: [PATCH v6 4/9] drm: Add some HDCP related #defines
Sean,
Quoted 19 lines · Sean Paul
In preparation for implementing HDCP in i915, add some HDCP related register offsets and defines. The dpcd register offsets will go in
drm_dp_helper.hwhereas the ddc offsets along with generic HDCP stuff will get stuffed indrm_hdcp.h, which is new.Changes in v2:
-drm_hdcp.hgets MIT license (Daniel)
Changes in v3:
- None
Changes in v4:
- None
Changes in v5:
- None
Changes in v6:
- SPDX licenseCc Daniel Vetter <[email protected]>Reviewed-by Ramalingam C <[email protected]>Signed-off-by Sean Paul <[email protected]>
<snip>
include/drm/drm_hdcp.h line 7
Quoted 10 lines
include/drm/drm_hdcp.h new file +7
-0@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright (C) 2017 Google, Inc. +* +* Authors: +* Sean Paul <[email protected]> +*/
Thank you++ for using the SPDX tags!
Signature · 2 lines
Cordially Philippe Ombredanne
PATCH v6 5/9 drm/i915: Add HDCP framework + base implementation
In reply to Sean PaulThis patch adds the framework required to add HDCP support to intel connectors. It implements Aksv loading from fuse, and parts 1/2/3 of the HDCP authentication scheme.
Note that without shim implementations, this does not actually implement HDCP. That will come in subsequent patches.
Changes in v2:
- Don't open code wait_fors (Chris)
- drm_hdcp.c under MIT license (Daniel)
- Move intel_hdcp_disable() call above ddi_disable (Ram)
- Fix // comments (I wore a cone of shame for 12 hours to atone) (Daniel)
- Justify intel_hdcp_shim with comments (Daniel)
- Fixed async locking issues by adding hdcp_mutex (Daniel)
- Don't alter connector_state in enable/disable (Daniel) Changes in v3:
- Added hdcp_mutex/hdcp_value to make async reasonable
- Added hdcp_prop_work to separate link checking & property setting
- Added new helper for atomic_check state tracking (Daniel)
- Moved enable/disable into atomic_commit with matching helpers
- Moved intel_hdcp_check_link out of all locks when called from dp
- Bumped up ksv_fifo timeout (noticed failure on one of my dongles) Changes in v4:
- Remove SKL_ prefix from most register names (Daniel)
- Move enable/disable back to modeset path (Daniel)
- s/get_random_long/get_random_u32/ (Daniel)
- Remove mode_config.mutex lock in prop_work (Daniel)
- Add intel_hdcp_init to handle init of conn components (Daniel)
- Actually check return value of attach_property
- Check Bksv is valid before trying to authenticate (Ram) Changes in v5:
- checkpatch whitespace changes
- s/DRM_MODE_CONTENT_PROTECTION_OFF/DRM_MODE_CONTENT_PROTECTION_UNDESIRED/
- Fix ksv list wait timeout (actually wait 5s)
- Increase the R0 timeout to 300ms (Ram)
Changes in v6:
- SPDX license
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_reg.h | 83 ++++ drivers/gpu/drm/i915/intel_atomic.c | 2 + drivers/gpu/drm/i915/intel_ddi.c | 7 + drivers/gpu/drm/i915/intel_display.c | 4 + drivers/gpu/drm/i915/intel_drv.h | 85 ++++ drivers/gpu/drm/i915/intel_hdcp.c | 723 +++++++++++++++++++++++++++++++++++ 7 files changed, 905 insertions(+) create mode 100644 drivers/gpu/drm/i915/intel_hdcp.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -109,6 +109,7 @@ i915-y += intel_audio.o \ intel_fbc.o \ intel_fifo_underrun.o \ intel_frontbuffer.o \ + intel_hdcp.o \ intel_hotplug.o \ intel_modes.o \ intel_overlay.o \
drivers/gpu/drm/i915/i915_reg.h +83 -0
95 lines not on this page · raw message
drivers/gpu/drm/i915/intel_atomic.c +2 -0
@@ -110,6 +110,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,to_intel_digital_connector_state (old_state);struct drm_crtc_state *crtc_state; +intel_hdcp_atomic_check (conn, old_state, new_state); +if (!new_state->crtc)return 0 ;
drivers/gpu/drm/i915/intel_ddi.c +7 -0
@@ -2423,6 +2423,11 @@ static void intel_enable_ddi(struct intel_encoder *encoder,intel_enable_ddi_hdmi (encoder, crtc_state, conn_state); elseintel_enable_ddi_dp (encoder ,crtc_state ,conn_state ); + +/* Enable hdcp if it's desired */ +if (conn_state->content_protection == +DRM_MODE_CONTENT_PROTECTION_DESIRED ) +intel_hdcp_enable (to_intel_connector (conn_state->connector)); } static void intel_disable_ddi_dp(struct intel_encoder *encoder,
@@ -2457,6 +2462,8 @@ static void intel_disable_ddi(struct intel_encoder *encoder,const struct intel_crtc_state *old_crtc_state, const struct drm_connector_state *old_conn_state) { + intel_hdcp_disable(to_intel_connector(old_conn_state->connector)); +if (intel_crtc_has_type (old_crtc_state,INTEL_OUTPUT_HDMI ))intel_disable_ddi_hdmi (encoder, old_crtc_state, old_conn_state);else
drivers/gpu/drm/i915/intel_display.c +4 -0
@@ -15217,6 +15217,10 @@ static void intel_hpd_poll_fini(struct drm_device *dev)for_each_intel_connector_iter (connector, &conn_iter) {if (connector->modeset_retry_work.func)cancel_work_sync (&connector->modeset_retry_work); +if (connector->hdcp_shim) { +cancel_delayed_work_sync (&connector->hdcp_check_work); +cancel_work_sync (&connector->hdcp_prop_work); + } }drm_connector_list_iter_end (&conn_iter); }
drivers/gpu/drm/i915/intel_drv.h +85 -0
103 lines not on this page · raw message
drivers/gpu/drm/i915/intel_hdcp.c new file +723 -0
723 lines not on this page · raw message
Signature · 6 lines
2.16.0.rc0.223.g4a4ac83678-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 6/9 drm/i915: Make use of indexed write GMBUS feature
In reply to Sean PaulThis patch enables the indexed write feature of the GMBUS to concatenate 2 consecutive messages into one. The criteria for an indexed write is that both messages are writes, the first is length == 1, and the second is length > 0. The first message is sent out by the GMBUS as the slave command, and the second one is sent via the GMBUS FIFO as usual.
Changes in v3:
- Added to series
Changes in v4:
- Combine indexed reads and writes (Ville)
Changes in v5:
- checkpatch whitespace nits
Changes in v6:
- None
--- drivers/gpu/drm/i915/intel_i2c.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +20 -14
@@ -402,7 +402,8 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,static int gmbus_xfer_write_chunk (struct drm_i915_private *dev_priv, -unsigned short addr,u8 *buf,unsigned int len) +unsigned short addr,u8 *buf,unsigned int len, +u32 gmbus1_index) {unsigned int chunk_size = len;u32 val, loop;
@@ -415,7 +416,7 @@ gmbus_xfer_write_chunk(struct drm_i915_private *dev_priv,I915_WRITE_FW (GMBUS3 , val);I915_WRITE_FW (GMBUS1 , -GMBUS_CYCLE_WAIT | + gmbus1_index |GMBUS_CYCLE_WAIT | (chunk_size <<GMBUS_BYTE_COUNT_SHIFT ) | (addr <<GMBUS_SLAVE_ADDR_SHIFT ) |GMBUS_SLAVE_WRITE |GMBUS_SW_RDY );
@@ -438,7 +439,8 @@ gmbus_xfer_write_chunk(struct drm_i915_private *dev_priv, }static int -gmbus_xfer_write (struct drm_i915_private *dev_priv,struct i2c_msg *msg) +gmbus_xfer_write (struct drm_i915_private *dev_priv,struct i2c_msg *msg, +u32 gmbus1_index) {u8 *buf = msg->buf;unsigned int tx_size = msg->len;
@@ -448,7 +450,8 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg) do { len = min(tx_size, GMBUS_BYTE_COUNT_MAX); - ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len); + ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len, + gmbus1_index); if (ret) return ret;
@@ -460,21 +463,21 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg) }/* -* The gmbus controller can combine a 1 or 2 byte write with a read that -* immediately follows it by using an "INDEX" cycle. +* The gmbus controller can combine a 1 or 2 byte write with another read/write +* that immediately follows it by using an "INDEX" cycle. */ static bool -gmbus_is_index_read (struct i2c_msg *msgs,int i,int num) +gmbus_is_index_xfer (struct i2c_msg *msgs,int i,int num) {return (i +1 < num && msgs[i].addr == msgs[i +1 ].addr && !(msgs[i].flags &I2C_M_RD ) && (msgs[i].len ==1 || msgs[i].len ==2 ) && - (msgs[i +1 ].flags &I2C_M_RD )); + msgs[i +1 ].len >0 ); }static int -gmbus_xfer_index_read (struct drm_i915_private *dev_priv,struct i2c_msg *msgs) +gmbus_index_xfer (struct drm_i915_private *dev_priv,struct i2c_msg *msgs) {u32 gmbus1_index =0 ;u32 gmbus5 =0 ;
@@ -491,7 +494,10 @@ gmbus_xfer_index_read(struct drm_i915_private *dev_priv, struct i2c_msg *msgs)if (gmbus5)I915_WRITE_FW (GMBUS5 , gmbus5); - ret =gmbus_xfer_read (dev_priv, &msgs[1 ], gmbus1_index); +if (msgs[1 ].flags &I2C_M_RD ) + ret =gmbus_xfer_read (dev_priv, &msgs[1 ], gmbus1_index); +else + ret =gmbus_xfer_write (dev_priv, &msgs[1 ], gmbus1_index);/* Clear GMBUS5 after each index transfer */ if (gmbus5)
@@ -522,13 +528,13 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)for (; i < num; i += inc) { inc =1 ; -if (gmbus_is_index_read (msgs, i, num)) { - ret =gmbus_xfer_index_read (dev_priv, &msgs[i]); - inc =2 ;/* an index read is two msgs */ +if (gmbus_is_index_xfer (msgs, i, num)) { + ret =gmbus_index_xfer (dev_priv, &msgs[i]); + inc =2 ;/* an index transmission is two msgs */ }else if (msgs[i].flags &I2C_M_RD ) { ret =gmbus_xfer_read (dev_priv, &msgs[i],0 ); }else { - ret =gmbus_xfer_write (dev_priv, &msgs[i]); + ret =gmbus_xfer_write (dev_priv, &msgs[i],0 ); }if (!ret)
Signature · 6 lines
2.16.0.rc0.223.g4a4ac83678-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 7/9 drm/i915: Add function to output Aksv over GMBUS
In reply to Sean PaulOnce the Aksv is available in the PCH, we need to get it on the wire to the receiver via DDC. The hardware doesn't allow us to read the value directly, so we need to tell GMBUS to source the Aksv internally and send it to the right offset on the receiver.
The way we do this is to initiate an indexed write where the index is the Aksv register offset. We write dummy values to GMBUS3 as if we were sending the key, and the hardware slips in the "real" values when it goes out.
Changes in v2:
- None
Changes in v3:
- Uses new index write feature (Ville)
Changes in v4:
- None
Changes in v5:
- checkpatch whitespace fix
Changes in v6:
- None
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_i2c.c | 47 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -3644,6 +3644,7 @@ extern int intel_setup_gmbus(struct drm_i915_private *dev_priv);extern void intel_teardown_gmbus (struct drm_i915_private *dev_priv);extern bool intel_gmbus_is_valid_pin (struct drm_i915_private *dev_priv,unsigned int pin); +extern int intel_gmbus_output_aksv (struct i2c_adapter *adapter);extern struct i2c_adapter *intel_gmbus_get_adapter (struct drm_i915_private *dev_priv,unsigned int pin);
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -3043,6 +3043,7 @@ enum i915_power_well_id {# define GPIO_DATA_PULLUP_DISABLE (1 << 13)#define GMBUS0 _MMIO(dev_priv->gpio_mmio_base + 0x5100)/* clock/port select */ +#define GMBUS_AKSV_SELECT (1<<11)#define GMBUS_RATE_100KHZ (0<<8)#define GMBUS_RATE_50KHZ (1<<8)#define GMBUS_RATE_400KHZ (2<<8)/* reserved on Pineview */
drivers/gpu/drm/i915/intel_i2c.c +44 -3
77 lines not on this page · raw message
Signature · 1 line
2.16.0.rc0.223.g4a4ac83678-goog
PATCH v6 8/9 drm/i915: Implement HDCP for HDMI
In reply to Sean PaulThis patch adds HDCP support for HDMI connectors by implementing the intel_hdcp_shim.
Nothing too special, just a bunch of DDC reads/writes.
Changes in v2:
- Rebased on drm-intel-next
Changes in v3:
- Initialize new worker
Changes in v4:
- Remove SKL_ prefix from most register names (Daniel)
- Wrap sanity checks in WARN_ON (Daniel)
- Consolidate the enable/disable functions into one toggle fn
- Use intel_hdcp_init (Daniel)
Changes in v5:
- checkpatch whitespace nits
Changes in v6:
- None
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 29 +++++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_hdmi.c | 250 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 282 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -8463,6 +8463,7 @@ enum skl_power_gate {#define TRANS_DDI_EDP_INPUT_A_ONOFF (4<<12)#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12) +#define TRANS_DDI_HDCP_SIGNALLING (1<<9)#define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8)#define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)#define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
drivers/gpu/drm/i915/intel_ddi.c +29 -0
@@ -1615,6 +1615,35 @@ void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,I915_WRITE (reg, val); } +int intel_ddi_toggle_hdcp_signalling (struct intel_encoder *intel_encoder, +bool enable) +{ +struct drm_device *dev = intel_encoder->base.dev; +struct drm_i915_private *dev_priv =to_i915 (dev); +enum pipe pipe =0 ; +int ret =0 ; +uint32_t tmp; + +if (WARN_ON (!intel_display_power_get_if_enabled (dev_priv, + intel_encoder->power_domain))) +return -ENXIO ; + +if (WARN_ON (!intel_encoder->get_hw_state (intel_encoder, &pipe))) { + ret = -EIO ; + goto out; + } + + tmp =I915_READ (TRANS_DDI_FUNC_CTL (pipe)); +if (enable) + tmp |=TRANS_DDI_HDCP_SIGNALLING ; +else + tmp &= ~TRANS_DDI_HDCP_SIGNALLING ; +I915_WRITE (TRANS_DDI_FUNC_CTL (pipe), tmp); +out: +intel_display_power_put (dev_priv, intel_encoder->power_domain); +return ret; +} +bool intel_ddi_connector_get_hw_state (struct intel_connector *intel_connector) {struct drm_device *dev = intel_connector->base.dev;
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1377,6 +1377,8 @@ void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv,u32 bxt_signal_levels (struct intel_dp *intel_dp);uint32_t ddi_signal_levels (struct intel_dp *intel_dp);u8 intel_ddi_dp_voltage_max (struct intel_encoder *encoder); +int intel_ddi_toggle_hdcp_signalling (struct intel_encoder *intel_encoder, +bool enable);unsigned int intel_fb_align_height (const struct drm_framebuffer *fb,int plane,unsigned int height);
drivers/gpu/drm/i915/intel_hdmi.c +250 -0
268 lines not on this page · raw message
Signature · 6 lines
2.16.0.rc0.223.g4a4ac83678-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 9/9 drm/i915: Implement HDCP for DisplayPort
In reply to Sean PaulThis patch adds HDCP support for DisplayPort connectors by implementing the intel_hdcp_shim.
Most of this is straightforward read/write from/to DPCD registers. One thing worth pointing out is the Aksv output bit. It wasn't easily separable like it's HDMI counterpart, so it's crammed in with the rest of it.
Changes in v2:
- Moved intel_hdcp_check_link out of intel_dp_check_link and only call it on short pulse. Since intel_hdcp_check_link does its own locking, this ensures we don't deadlock when intel_dp_check_link is called holding connection_mutex.
- Rebased on drm-intel-next
Changes in v3:
- Initialize new worker
Changes in v4:
- Use intel_hdcp_init (Daniel)
- Check for reauth requests in check_link (Ram)
Changes in v5:
- None
Changes in v6:
- Fix build warnings when printing ssize_t
--- drivers/gpu/drm/i915/intel_dp.c | 244 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 237 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +237 -7
@@ -36,7 +36,9 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_dp_helper.h> #include <drm/drm_edid.h> +#include <drm/drm_hdcp.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include "i915_drv.h"
@@ -1025,10 +1027,29 @@ static uint32_t skl_get_aux_send_ctl(struct intel_dp *intel_dp,DP_AUX_CH_CTL_SYNC_PULSE_SKL (32 ); } +static uint32_t intel_dp_get_aux_send_ctl (struct intel_dp *intel_dp, +bool has_aux_irq, +int send_bytes, +uint32_t aux_clock_divider, +bool aksv_write) +{ +uint32_t val =0 ; + +if (aksv_write) { + send_bytes +=5 ; + val |=DP_AUX_CH_CTL_AUX_AKSV_SELECT ; + } + +return val | intel_dp->get_aux_send_ctl (intel_dp, + has_aux_irq, + send_bytes, + aux_clock_divider); +} +static int intel_dp_aux_ch (struct intel_dp *intel_dp,const uint8_t *send,int send_bytes, -uint8_t *recv,int recv_size) +uint8_t *recv,int recv_size,bool aksv_write) {struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); struct drm_i915_private *dev_priv =
@@ -1088,10 +1109,11 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, }while ((aux_clock_divider = intel_dp->get_aux_clock_divider (intel_dp, clock++))) { -u32 send_ctl = intel_dp->get_aux_send_ctl (intel_dp, - has_aux_irq, - send_bytes, - aux_clock_divider); +u32 send_ctl =intel_dp_get_aux_send_ctl (intel_dp, + has_aux_irq, + send_bytes, + aux_clock_divider, + aksv_write);/* Must try at least 3 times according to DP spec */ for (try =0 ; try <5 ; try++) {
@@ -1228,7 +1250,8 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)if (msg->buffer)memcpy (txbuf +HEADER_SIZE , msg->buffer, msg->size); - ret =intel_dp_aux_ch (intel_dp, txbuf, txsize, rxbuf, rxsize); + ret =intel_dp_aux_ch (intel_dp, txbuf, txsize, rxbuf, rxsize, + false);if (ret >0 ) { msg->reply = rxbuf[0 ] >>4 ;
@@ -1250,7 +1273,8 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)if (WARN_ON (rxsize >20 ))return -E2BIG ; - ret =intel_dp_aux_ch (intel_dp, txbuf, txsize, rxbuf, rxsize); + ret =intel_dp_aux_ch (intel_dp, txbuf, txsize, rxbuf, rxsize, + false);if (ret >0 ) { msg->reply = rxbuf[0 ] >>4 ;/*
@@ -4985,6 +5009,203 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)pps_unlock (intel_dp); } +static +int intel_dp_hdcp_write_an_aksv (struct intel_digital_port *intel_dig_port, +u8 *an) +{ +struct intel_dp *intel_dp =enc_to_intel_dp (&intel_dig_port->base.base); +uint8_t txbuf[4 ], rxbuf[2 ], reply =0 ; +ssize_t dpcd_ret; +int ret; + +/* Output An first, that's easy */ + dpcd_ret =drm_dp_dpcd_write (&intel_dig_port->dp.aux,DP_AUX_HDCP_AN , + an,DRM_HDCP_AN_LEN ); +if (dpcd_ret !=DRM_HDCP_AN_LEN ) { +DRM_ERROR ("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 in +* order to get it on the wire, we need to create the AUX header as if +* we were writing the data, and then tickle the hardware to output the +* data once the header is sent out. +*/ + txbuf[0 ] = (DP_AUX_NATIVE_WRITE <<4 ) | + ((DP_AUX_HDCP_AKSV >>16 ) &0xf ); + txbuf[1 ] = (DP_AUX_HDCP_AKSV >>8 ) &0xff ; + txbuf[2 ] =DP_AUX_HDCP_AKSV &0xff ; + txbuf[3 ] =DRM_HDCP_KSV_LEN -1 ; + + ret =intel_dp_aux_ch (intel_dp, txbuf,sizeof (txbuf), rxbuf, +sizeof (rxbuf), true); +if (ret <0 ) { +DRM_ERROR ("Write Aksv over DP/AUX failed (%d)\n" , ret); +return ret; + }else if (ret ==0 ) { +DRM_ERROR ("Aksv write over DP/AUX was empty\n" ); +return -EIO ; + } + + reply = (rxbuf[0 ] >>4 ) &DP_AUX_NATIVE_REPLY_MASK ; +return reply ==DP_AUX_NATIVE_REPLY_ACK ?0 : -EIO ; +} + +static int intel_dp_hdcp_read_bksv (struct intel_digital_port *intel_dig_port, +u8 *bksv) +{ +ssize_t ret; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux,DP_AUX_HDCP_BKSV , bksv, +DRM_HDCP_KSV_LEN ); +if (ret !=DRM_HDCP_KSV_LEN ) { +DRM_ERROR ("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) +{ +ssize_t ret; +/* +* For some reason the HDMI and DP HDCP specs call this register +* definition by different names. In the HDMI spec, it's called BSTATUS, +* but in DP it's called BINFO. +*/ + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux,DP_AUX_HDCP_BINFO , + bstatus,DRM_HDCP_BSTATUS_LEN ); +if (ret !=DRM_HDCP_BSTATUS_LEN ) { +DRM_ERROR ("Read bstatus from DP/AUX failed (%zd)\n" , ret); +return ret >=0 ? -EIO : ret; + } +return 0 ; +} + +static +int intel_dp_hdcp_repeater_present (struct intel_digital_port *intel_dig_port, +bool *repeater_present) +{ +ssize_t ret; +u8 bcaps; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux,DP_AUX_HDCP_BCAPS , + &bcaps,1 ); +if (ret !=1 ) { +DRM_ERROR ("Read bcaps from DP/AUX failed (%zd)\n" , ret); +return ret >=0 ? -EIO : ret; + } + *repeater_present = bcaps &DP_BCAPS_REPEATER_PRESENT ; +return 0 ; +} + +static +int intel_dp_hdcp_read_ri_prime (struct intel_digital_port *intel_dig_port, +u8 *ri_prime) +{ +ssize_t ret; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux,DP_AUX_HDCP_RI_PRIME , + ri_prime,DRM_HDCP_RI_LEN ); +if (ret !=DRM_HDCP_RI_LEN ) { +DRM_ERROR ("Read Ri' from DP/AUX failed (%zd)\n" , ret); +return ret >=0 ? -EIO : ret; + } +return 0 ; +} + +static +int intel_dp_hdcp_read_ksv_ready (struct intel_digital_port *intel_dig_port, +bool *ksv_ready) +{ +ssize_t ret; +u8 bstatus; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux,DP_AUX_HDCP_BSTATUS , + &bstatus,1 ); +if (ret !=1 ) { +DRM_ERROR ("Read bstatus from DP/AUX failed (%zd)\n" , ret); +return ret >=0 ? -EIO : ret; + } + *ksv_ready = bstatus &DP_BSTATUS_READY ; +return 0 ; +} + +static +int intel_dp_hdcp_read_ksv_fifo (struct intel_digital_port *intel_dig_port, +int num_downstream,u8 *ksv_fifo) +{ +ssize_t ret; +int i; + +/* KSV list is read via 15 byte window (3 entries @ 5 bytes each) */ +for (i =0 ; i < num_downstream; i +=3 ) { +size_t len =min (num_downstream - i,3 ) *DRM_HDCP_KSV_LEN ; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_AUX_HDCP_KSV_FIFO , + ksv_fifo + i *DRM_HDCP_KSV_LEN , + len); +if (ret != len) { +DRM_ERROR ("Read ksv[%d] from DP/AUX failed (%zd)\n" , i, + ret); +return ret >=0 ? -EIO : ret; + } + } +return 0 ; +} + +static +int intel_dp_hdcp_read_v_prime_part (struct intel_digital_port *intel_dig_port, +int i,u32 *part) +{ +ssize_t ret; + +if (i >=DRM_HDCP_V_PRIME_NUM_PARTS ) +return -EINVAL ; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_AUX_HDCP_V_PRIME (i), part, +DRM_HDCP_V_PRIME_PART_LEN ); +if (ret !=DRM_HDCP_V_PRIME_PART_LEN ) { +DRM_ERROR ("Read v'[%d] from DP/AUX failed (%zd)\n" , i, ret); +return ret >=0 ? -EIO : ret; + } +return 0 ; +} + +static +int intel_dp_hdcp_toggle_signalling (struct intel_digital_port *intel_dig_port, +bool enable) +{ +/* Not used for single stream DisplayPort setups */ +return 0 ; +} + +static +bool intel_dp_hdcp_check_link (struct intel_digital_port *intel_dig_port) +{ +ssize_t ret; +u8 bstatus; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux,DP_AUX_HDCP_BSTATUS , + &bstatus,1 ); +if (ret !=1 ) { +DRM_ERROR ("Read bstatus from DP/AUX failed (%zd)\n" , ret); +return ret >=0 ? -EIO : ret; + } +return !(bstatus & (DP_BSTATUS_LINK_FAILURE |DP_BSTATUS_REAUTH_REQ )); +} + +static const struct intel_hdcp_shim intel_dp_hdcp_shim = { + .write_an_aksv = intel_dp_hdcp_write_an_aksv, + .read_bksv = intel_dp_hdcp_read_bksv, + .read_bstatus = intel_dp_hdcp_read_bstatus, + .repeater_present = intel_dp_hdcp_repeater_present, + .read_ri_prime = intel_dp_hdcp_read_ri_prime, + .read_ksv_ready = intel_dp_hdcp_read_ksv_ready, + .read_ksv_fifo = intel_dp_hdcp_read_ksv_fifo, + .read_v_prime_part = intel_dp_hdcp_read_v_prime_part, + .toggle_signalling = intel_dp_hdcp_toggle_signalling, + .check_link = intel_dp_hdcp_check_link, +}; +static void intel_edp_panel_vdd_sanitize (struct intel_dp *intel_dp) {struct drm_i915_private *dev_priv =to_i915 (intel_dp_to_dev (intel_dp));
@@ -5150,6 +5371,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)drm_modeset_acquire_fini (&ctx);WARN (iret,"Acquiring modeset locks failed with %i\n" , iret); +/* Short pulse can signify loss of hdcp authentication */ +intel_hdcp_check_link (intel_dp->attached_connector); +if (!handled) { intel_dp->detect_done = false; goto put_power;
@@ -6128,6 +6352,12 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector); +if (INTEL_GEN (dev_priv) >=9 && !intel_dp_is_edp (intel_dp)) { +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +if (ret) +DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); + } +/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written * 0xd. Failure to do so will result in spurious interrupts being * generated on the port when a cable is not attached.
Signature · 1 line
2.16.0.rc0.223.g4a4ac83678-goog
Sean Paul
AppliedQuoted 7 lines · Sean Paul
This is The One. Differences between v6 and v5 include fixing a printk formatting issue that 0-day found, and changing the verbose licenses in the new files to SPDX tags.
I'll push this to a topic branch in the drm-misc tree and send a pull request to Dave for 4.17 after the 4.16 merge window is over.
Applied to https://cgit.freedesktop.org/drm-misc/log/?h=topic/hdcp
Sean
Quoted 39 lines
Sincere thanks to Ram, Daniel, and others for their review. Now the fun part, testing and fixing bugs!
Sean
Sean Paul (9):
drm: Fix link-status kerneldoc line lengths drm/i915: Add more control towait_forroutines
drm: Add Content Protection property
drm: Add some HDCP related #defines drm/i915: Add HDCP framework + base implementation drm/i915: Make use of indexed write GMBUS feature drm/i915: Add function to output Aksv over GMBUS drm/i915: Implement HDCP for HDMI drm/i915: Implement HDCP for DisplayPortdrivers/gpu/drm/drm_atomic.c | 8 + drivers/gpu/drm/drm_connector.c | 87 ++++- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 85 ++++ drivers/gpu/drm/i915/intel_atomic.c | 2 + drivers/gpu/drm/i915/intel_ddi.c | 36 ++ drivers/gpu/drm/i915/intel_display.c | 4 + drivers/gpu/drm/i915/intel_dp.c | 244 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 104 ++++- drivers/gpu/drm/i915/intel_hdcp.c | 723 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_hdmi.c | 250 ++++++++++++ drivers/gpu/drm/i915/intel_i2c.c | 81 +++- drivers/gpu/drm/i915/intel_uncore.c | 23 +- drivers/gpu/drm/i915/intel_uncore.h | 14 +- include/drm/drm_connector.h | 16 + include/drm/drm_dp_helper.h | 17 + include/drm/drm_hdcp.h | 39 ++ include/uapi/drm/drm_mode.h | 4 + 19 files changed, 1696 insertions(+), 43 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_hdcp.c create mode 100644 include/drm/drm_hdcp.h
Quoted 3 lines
--
2.16.0.rc0.223.g4a4ac83678-goog
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for drm/i915: Implement HDCP (rev6)
In reply to Sean Paul== Series Details ==
== Series Details ==
Series: drm/i915: Implement HDCP (rev6)
URL : https://patchwork.freedesktop.org/series/34671/
State : warning
== Summary ==
Series 34671v6 drm/i915: Implement HDCP
https://patchwork.freedesktop.org/api/1.0/series/34671/revisions/6/mbox/
Test debugfs_test:
Subgroup read_all_entries:
dmesg-warn -> PASS (fi-elk-e7500) fdo#103989
incomplete -> PASS (fi-snb-2520m) fdo#103713
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> DMESG-WARN (fi-skl-6700k2)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
dmesg-warn -> PASS (fi-kbl-r) fdo#104172 +1fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:418s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:372s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:481s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:279s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:483s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:486s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:466s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:458s fi-elk-e7500 total:224 pass:169 dwarn:9 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:275s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:509s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:391s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:400s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:409s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:457s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:410s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:465s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:503s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:453s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:503s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:572s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:427s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:508s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:527s fi-skl-6700k2 total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:491s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:483s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:539s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:395s Blacklisted hosts: fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:567s fi-cnl-y total:251 pass:225 dwarn:0 dfail:0 fail:0 skip:25 fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:468s
70afdd6e5dfe93544afc231645c09084ec508b01 drm-tip: 2018y-01m-08d-13h-41m-31s UTC integration manifest a6d242627ff2 drm/i915: Implement HDCP for DisplayPort6e5cbdbca798 drm/i915: Implement HDCP for HDMI172797009f8c drm/i915: Add function to output Aksv over GMBUS4278bd651204 drm/i915: Make use of indexed write GMBUS feature84361026665b drm/i915: Add HDCP framework + base implementationa9b541e1f776 drm: Add some HDCP related #definesa6280b6c314e drm: Add Content Protection property378347f68afb drm/i915: Add more control to wait_for routines2b4c0e2f65a1 drm: Fix link-status kerneldoc line lengths
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7626/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.BAT: warning for drm/i915: Implement HDCP (rev6)
Quoting Patchwork (2018-01-08 20:18:40)
Quoted 6 lines
== Series Details ==
Series: drm/i915: Implement HDCP (rev6)
URL : https://patchwork.freedesktop.org/series/34671/
State : warning
Quoted 8 lines
== Summary ==
Series 34671v6 drm/i915: Implement HDCP
https://patchwork.freedesktop.org/api/1.0/series/34671/revisions/6/mbox/Test
gem_exec_suspend:Subgroup basic-s3: pass -> DMESG-WARN (fi-skl-6700k2)
[ 189.719889] Setting dangerous option reset - tainting kernel [ 190.375819] Suspending console(s) (use no_console_suspend to debug) [ 190.406059] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 190.413956] sd 0:0:0:0: [sda] Stopping disk [ 190.442231] ------------[ cut here ]------------ [ 190.442259] Unclaimed write to register 0x66a00 [ 190.442295] WARNING: CPU: 2 PID: 152 at drivers/gpu/drm/i915/intel_uncore.c:986 __unclaimed_reg_debug+0x3b/0x50 [i915] [ 190.442296] Modules linked in: snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic i915 x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul snd_hda_intel ghash_clmulni_intel snd_hda_codec snd_hwdep snd_hda_core e1000e snd_pcm ptp pps_core mei_me prime_numbers mei [ 190.442322] CPU: 2 PID: 152 Comm: kworker/u16:5 Tainted: G U 4.15.0-rc7-CI-Patchwork_7626+ #1 [ 190.442323] Hardware name: System manufacturer System Product Name/Z170 PRO GAMING, BIOS 0802 09/02/2015 [ 190.442326] Workqueue: events_unbound async_run_entry_fn [ 190.442349] RIP: 0010:__unclaimed_reg_debug+0x3b/0x50 [i915] [ 190.442351] RSP: 0018:ffffc90000bd79c8 EFLAGS: 00010096 [ 190.442353] RAX: 0000000000000023 RBX: 0000000000000000 RCX: 0000000000000002 [ 190.442355] RDX: 0000000000000000 RSI: ffffffff82107929 RDI: ffffffff820b8e2e [ 190.442356] RBP: 0000000000066a00 R08: 0000000000000000 R09: 0000000000000001 [ 190.442357] R10: ffffc90000bd7960 R11: 0000000000000001 R12: 0000000000000000 [ 190.442358] R13: 0000000000000000 R14: 0000000000000202 R15: ffff88043aa8e678 [ 190.442360] FS: 0000000000000000(0000) GS:ffff880455c80000(0000) knlGS:0000000000000000 [ 190.442361] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 190.442363] CR2: 00007fb02cb1c000 CR3: 0000000005210002 CR4: 00000000003606e0 [ 190.442364] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 190.442365] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 190.442366] Call Trace: [ 190.442389] fwtable_write32+0x27f/0x290 [i915] [ 190.442414] _intel_hdcp_disable+0x6c/0x130 [i915] [ 190.442440] intel_hdcp_disable+0x35/0x60 [i915] [ 190.442463] intel_disable_ddi+0x17/0xf0 [i915] [ 190.442487] intel_encoders_disable.isra.60+0x7a/0x80 [i915] [ 190.442511] haswell_crtc_disable+0x43/0x130 [i915] [ 190.442535] intel_atomic_commit_tail+0x1bb/0xce0 [i915] [ 190.442562] intel_atomic_commit+0x25f/0x320 [i915] [ 190.442569] drm_atomic_helper_disable_all+0x167/0x1a0 [ 190.442573] drm_atomic_helper_suspend+0x3c/0xb0 [ 190.442600] intel_display_suspend+0xd/0x50 [i915] [ 190.442616] i915_drm_suspend+0x79/0x160 [i915] [ 190.442620] ? pci_pm_freeze+0xd0/0xd0 [ 190.442621] pci_pm_suspend+0x74/0x140 [ 190.442625] dpm_run_callback+0x5f/0x310 [ 190.442628] __device_suspend+0xf3/0x5a0 [ 190.442633] ? dpm_watchdog_set+0x60/0x60 [ 190.442639] async_suspend+0x15/0x90 [ 190.442642] async_run_entry_fn+0x2e/0x160 [ 190.442646] process_one_work+0x215/0x640 [ 190.442653] worker_thread+0x48/0x3a0 [ 190.442658] kthread+0xfb/0x130 [ 190.442660] ? process_one_work+0x640/0x640 [ 190.442662] ? _kthread_create_on_node+0x30/0x30 [ 190.442666] ret_from_fork+0x24/0x30 [ 190.442675] Code: 3c 01 75 30 84 db 75 2c 45 84 e4 48 c7 c0 85 55 2f a0 48 c7 c6 7b 55 2f a0 48 0f 44 f0 89 ea 48 c7 c7 8e 55 2f a0 e8 b5 6c e4 e0 <0f> ff 83 2d 4c bc 16 00 01 5b 5d 41 5c c3 0f 1f 80 00 00 00 00 [ 190.442744] ---[ end trace 23eb6466b213278b ]---
Incorrect ordering with powerdomains?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.BAT: warning for drm/i915: Implement HDCP (rev6)
Hi,
Quoted 97 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Chris Wilson
Sent: tiistai 9. tammikuuta 2018 11.35
To: [email protected]; Patchwork <[email protected]>; Sean Paul <[email protected]>
Cc: [email protected]
Subject: Re: [Intel-gfx] ✗ Fi.CI.BAT: warning for drm/i915: Implement HDCP (rev6)Quoting Patchwork (2018-01-08 20:18:40)
Quoted 6 lines
== Series Details ==
Series: drm/i915: Implement HDCP (rev6)
URL : https://patchwork.freedesktop.org/series/34671/
State : warningQuoted 8 lines
== Summary ==
Series 34671v6 drm/i915: Implement HDCP
https://patchwork.freedesktop.org/api/1.0/series/34671/revisions/6/mbox/Test
gem_exec_suspend:Subgroup basic-s3: pass -> DMESG-WARN (fi-skl-6700k2)[ 189.719889] Setting dangerous option reset - tainting kernel [ 190.375819] Suspending console(s) (use no_console_suspend to debug) [ 190.406059] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 190.413956] sd 0:0:0:0: [sda] Stopping disk [ 190.442231] ------------[ cut here ]------------ [ 190.442259] Unclaimed write to register 0x66a00 [ 190.442295] WARNING: CPU: 2 PID: 152 at drivers/gpu/drm/i915/intel_uncore.c:986 __unclaimed_reg_debug+0x3b/0x50 [i915] [ 190.442296] Modules linked in: snd_hda_codec_hdmi
snd_hda_codec_realteksnd_hda_codec_generici915x86_pkg_temp_thermalintel_powerclampcoretempcrct10dif_pclmulcrc32_pclmulsnd_hda_intelghash_clmulni_intelsnd_hda_codecsnd_hwdepsnd_hda_coree1000esnd_pcmptppps_coremei_meprime_numbersmei[ 190.442322] CPU: 2 PID: 152 Comm: kworker/u16:5 Tainted: G U 4.15.0-rc7-CI-Patchwork_7626+ #1 [ 190.442323] Hardware name: System manufacturer System Product Name/Z170 PRO GAMING, BIOS 0802 09/02/2015 [ 190.442326] Workqueue: events_unbound async_run_entry_fn [ 190.442349] RIP: 0010:__unclaimed_reg_debug+0x3b/0x50 [i915] [ 190.442351] RSP: 0018:ffffc90000bd79c8 EFLAGS: 00010096 [ 190.442353] RAX: 0000000000000023 RBX: 0000000000000000 RCX: 0000000000000002 [ 190.442355] RDX: 0000000000000000 RSI: ffffffff82107929 RDI: ffffffff820b8e2e [ 190.442356] RBP: 0000000000066a00 R08: 0000000000000000 R09: 0000000000000001 [ 190.442357] R10: ffffc90000bd7960 R11: 0000000000000001 R12: 0000000000000000 [ 190.442358] R13: 0000000000000000 R14: 0000000000000202 R15: ffff88043aa8e678 [ 190.442360] FS: 0000000000000000(0000) GS:ffff880455c80000(0000) knlGS:0000000000000000 [ 190.442361] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 190.442363] CR2: 00007fb02cb1c000 CR3: 0000000005210002 CR4: 00000000003606e0 [ 190.442364] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 190.442365] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 190.442366] Call Trace: [ 190.442389] fwtable_write32+0x27f/0x290 [i915] [ 190.442414] _intel_hdcp_disable+0x6c/0x130 [i915] [ 190.442440] intel_hdcp_disable+0x35/0x60 [i915] [ 190.442463] intel_disable_ddi+0x17/0xf0 [i915] [ 190.442487] intel_encoders_disable.isra.60+0x7a/0x80 [i915] [ 190.442511] haswell_crtc_disable+0x43/0x130 [i915] [ 190.442535] intel_atomic_commit_tail+0x1bb/0xce0 [i915] [ 190.442562] intel_atomic_commit+0x25f/0x320 [i915] [ 190.442569] drm_atomic_helper_disable_all+0x167/0x1a0 [ 190.442573] drm_atomic_helper_suspend+0x3c/0xb0 [ 190.442600] intel_display_suspend+0xd/0x50 [i915] [ 190.442616] i915_drm_suspend+0x79/0x160 [i915] [ 190.442620] ? pci_pm_freeze+0xd0/0xd0 [ 190.442621] pci_pm_suspend+0x74/0x140 [ 190.442625] dpm_run_callback+0x5f/0x310 [ 190.442628] __device_suspend+0xf3/0x5a0 [ 190.442633] ? dpm_watchdog_set+0x60/0x60 [ 190.442639] async_suspend+0x15/0x90 [ 190.442642] async_run_entry_fn+0x2e/0x160 [ 190.442646] process_one_work+0x215/0x640 [ 190.442653] worker_thread+0x48/0x3a0 [ 190.442658] kthread+0xfb/0x130 [ 190.442660] ? process_one_work+0x640/0x640 [ 190.442662] ? _kthread_create_on_node+0x30/0x30 [ 190.442666] ret_from_fork+0x24/0x30 [ 190.442675] Code: 3c 01 75 30 84 db 75 2c 45 84 e4 48 c7 c0 85 55 2f a0 48 c7 c6 7b 55 2f a0 48 0f 44 f0 89 ea 48 c7 c7 8e 55 2f a0 e8 b5 6c e4 e0 <0f> ff 83 2d 4c bc 16 00 01 5b 5d 41 5c c3 0f 1f 80 00 00 00 00 [ 190.442744] ---[ end trace 23eb6466b213278b ]---
Quoted 1 line
Incorrect ordering with powerdomains?
Also bug made: https://bugs.freedesktop.org/show_bug.cgi?id=104548
Quoted 1 line
-Chris
Jani Saarinen
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx