drm/i915: Implement HDCP2.2
Subsystems (5)
v4 cover drm/i915: Implement HDCP2.2
The sequence for HDCP2.2 authentication and encryption is implemented in I915. Encoder specific implementations are moved into hdcp_shim.
Intel HWs supports HDCP2.2 through ME FW. Hence this series introduces a client driver for mei bus, so that for HDCP2.2 authentication, HDCP2.2 stack in I915 can avail the services from ME FW.
DRM_I915 selects INTEL_MEI_HDCP, which selects INTEL_MEI_ME and INTEL_MEI. If we are interested in disabling the MEI_HDCP and MEI Bus then we need an option to disable the HDCP2.2 in I915 (like DRM_I915_HDCP2.2!?). Till then they are binded.
Userspace interface remains unchanged as version agnostic. When userspace request for HDCP enable, Kernel will detect the HDCP source and sink's HDCP version(1.4/2.2)capability and enable the best capable version for that combination.
This series enables the HDCP2.2 for Type0 content streams.
Thanks a lot for Usyskin, Alexander and Uma shankar for the review of v3. Thanks Daniel vetter for guiding me to test and confirm that there is no locking issue with respect to notifier usage between I915 and MEI_HDCP.
Major Changes in v4:
- GMBus Changes to implement the burst read as generic [Jani, Ville and Daniel]
- Polling is added for extra Notifier notification when I915 and MEI_HDCP are modules.
- Comment and style issues and typos are fixed [Uma and Alexander]
- INTEL_MEI_HDCP, INTEL_MEI_ME and INTEL_MEI are selected by I915.
- Fixed the #if in include/linux/mei_hdcp.h for build issues.
GMBus changes are added here for completeness of the series. They are in review at https://patchwork.freedesktop.org/series/41632/ also.
Ramalingam C (40):
drm: hdcp2.2 authentication msg definitions
drm: HDMI and DP specific HDCP2.2 defines misc/mei/hdcp: Client driver for HDCP application misc/mei/hdcp: Notifier chain for mei cldev state change misc/mei/hdcp: Define ME FW interface for HDCP2.2 linux/mei: Header for mei_hdcp driver interface misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session misc/mei/hdcp: Verify Receiver Cert and prepare km misc/mei/hdcp: Verify H_prime
misc/mei/hdcp: Store the HDCP Pairing info misc/mei/hdcp: Initiate Locality check misc/mei/hdcp: Verify L_prime
misc/mei/hdcp: Prepare Session Key misc/mei/hdcp: Repeater topology verification and ack misc/mei/hdcp: Verify M_prime
misc/mei/hdcp: Enabling the HDCP authentication misc/mei/hdcp: Closing wired HDCP2.2 Tx Session drm/i915: wrapping all hdcp var into intel_hdcp drm/i915: Define HDCP2.2 related variables drm/i915: Define Intel HDCP2.2 registers drm/i915: Wrappers for mei HDCP2.2 services drm/i915: Implement HDCP2.2 receiver authentication drm/i915: Implement HDCP2.2 repeater authentication drm/i915: Enable and Disable HDCP2.2 port encryption drm/i915: Implement HDCP2.2 En/Dis-able drm/i915: Implement HDCP2.2 link integrity check drm/i915: Handle HDCP2.2 downstream topology change drm/i915: Pullout the bksv read and validation drm/i915: Initialize HDCP2.2 and its MEI interface drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable drm/i915: Enable superior HDCP ver that is capable drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure drm/i915: hdcp_check_link only on CP_IRQ drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ drm/i915/gmbus: Increase the Bytes per Rd/Wr Op drm/i915/gmbus: Enable burst read
drm/i915: Implement the HDCP2.2 support for DP drm/i915: Implement the HDCP2.2 support for HDMI drm/i915: Add HDCP2.2 support for DP connectors drm/i915: Add HDCP2.2 support for HDMI connectors
Tomas Winkler (1):
mei: bus: whitelist hdcp client
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/i915_reg.h | 34 ++ drivers/gpu/drm/i915/intel_display.c | 7 +- drivers/gpu/drm/i915/intel_dp.c | 370 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 88 ++- drivers/gpu/drm/i915/intel_hdcp.c | 1096 ++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_hdmi.c | 189 +++++- drivers/gpu/drm/i915/intel_i2c.c | 71 ++- drivers/misc/mei/Kconfig | 7 + drivers/misc/mei/Makefile | 2 + drivers/misc/mei/bus-fixup.c | 16 + drivers/misc/mei/hdcp/Makefile | 6 + drivers/misc/mei/hdcp/mei_hdcp.c | 817 +++++++++++++++++++++++++ drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++++++++++++ include/drm/drm_dp_helper.h | 51 ++ include/drm/drm_hdcp.h | 232 +++++++ include/linux/mei_hdcp.h | 232 +++++++ 18 files changed, 3546 insertions(+), 91 deletions(-) create mode 100644 drivers/misc/mei/hdcp/Makefile create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.c create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.h create mode 100644 include/linux/mei_hdcp.h
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 1/41 drm: hdcp2.2 authentication msg definitions
This patch defines the hdcp2.2 protocol messages for authentication.
v2:
bit_fields are removed. Instead bitmasking used. [Tomas and Jani] prefix HDCP_2_2_ is added to the macros. [Tomas]
v3:
No Changes.
v4:
Style and spellings are fixed [Uma]
--- include/drm/drm_hdcp.h | 179 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+)
include/drm/drm_hdcp.h +179 -0
@@ -38,4 +38,183 @@#define DRM_HDCP_DDC_BSTATUS 0x41#define DRM_HDCP_DDC_KSV_FIFO 0x43 +#define DRM_HDCP_1_4_SRM_ID 0x8 +#define DRM_HDCP_1_4_VRL_LENGTH_SIZE 3 +#define DRM_HDCP_1_4_DCP_SIG_SIZE 40 + +/* Protocol message definition for HDCP2.2 specification */ +#define HDCP_STREAM_TYPE0 0x00 +#define HDCP_STREAM_TYPE1 0x01 + +/* HDCP2.2 Msg IDs */ +#define HDCP_2_2_NULL_MSG 1 +#define HDCP_2_2_AKE_INIT 2 +#define HDCP_2_2_AKE_SEND_CERT 3 +#define HDCP_2_2_AKE_NO_STORED_KM 4 +#define HDCP_2_2_AKE_STORED_KM 5 +#define HDCP_2_2_AKE_SEND_HPRIME 7 +#define HDCP_2_2_AKE_SEND_PAIRING_INFO 8 +#define HDCP_2_2_LC_INIT 9 +#define HDCP_2_2_LC_SEND_LPRIME 10 +#define HDCP_2_2_SKE_SEND_EKS 11 +#define HDCP_2_2_REP_SEND_RECVID_LIST 12 +#define HDCP_2_2_REP_SEND_ACK 15 +#define HDCP_2_2_REP_STREAM_MANAGE 16 +#define HDCP_2_2_REP_STREAM_READY 17 +#define HDCP_2_2_ERRATA_DP_STREAM_TYPE 50 + +#define HDCP_2_2_RTX_LEN 8 +#define HDCP_2_2_RRX_LEN 8 + +#define HDCP_2_2_K_PUB_RX_MOD_N_LEN 128 +#define HDCP_2_2_K_PUB_RX_EXP_E_LEN 3 +#define HDCP_2_2_K_PUB_RX_LEN (HDCP_2_2_K_PUB_RX_MOD_N_LEN + \ + HDCP_2_2_K_PUB_RX_EXP_E_LEN) + +#define HDCP_2_2_DCP_LLC_SIG_LEN 384 + +#define HDCP_2_2_E_KPUB_KM_LEN 128 +#define HDCP_2_2_E_KH_KM_M_LEN (16 + 16) +#define HDCP_2_2_H_PRIME_LEN 32 +#define HDCP_2_2_E_KH_KM_LEN 16 +#define HDCP_2_2_RN_LEN 8 +#define HDCP_2_2_L_PRIME_LEN 32 +#define HDCP_2_2_E_DKEY_KS_LEN 16 +#define HDCP_2_2_RIV_LEN 8 +#define HDCP_2_2_SEQ_NUM_LEN 3 +#define HDCP_2_2_LPRIME_HALF_LEN (HDCP_2_2_L_PRIME_LEN / 2) +#define HDCP_2_2_RECEIVER_ID_LEN DRM_HDCP_KSV_LEN +#define HDCP_2_2_MAX_DEVICE_COUNT 31 +#define HDCP_2_2_RECEIVER_IDS_MAX_LEN (HDCP_2_2_RECEIVER_ID_LEN * \ + HDCP_2_2_MAX_DEVICE_COUNT) +#define HDCP_2_2_MPRIME_LEN 32 + +/* Following Macros take a byte at a time for bit(s) masking */ +/* +* TODO: This has to be changed for DP MST, as multiple stream on +* same port is possible. +* For HDCP2.2 on HDMI and DP SST this value is always 1. +*/ +#define HDCP_2_2_MAX_CONTENT_STREAMS_CNT 1 +#define HDCP_2_2_TXCAP_MASK_LEN 2 +#define HDCP_2_2_RXCAPS_LEN 3 +#define HDCP_2_2_RX_REPEATER (x) (x & BIT(0)) +#define HDCP_2_2_DP_HDCP_CAPABLE (x) (x & BIT(1)) +#define HDCP_2_2_RXINFO_LEN 2 + +/* HDCP1.x compliant device in downstream */ +#define HDCP_2_2_HDCP1_DEVICE_CONNECTED (x) (x & BIT(0)) + +/* HDCP2.0 Compliant repeater in downstream */ +#define HDCP_2_2_HDCP_2_0_REP_CONNECTED (x) (x & BIT(1)) +#define HDCP_2_2_MAX_CASCADE_EXCEEDED (x) (x & BIT(2)) +#define HDCP_2_2_MAX_DEVS_EXCEEDED (x) (x & BIT(3)) +#define HDCP_2_2_DEV_COUNT_LO (x) ((x & (0xF << 4)) >> 4) +#define HDCP_2_2_DEV_COUNT_HI (x) (x & BIT(0)) +#define HDCP_2_2_DEPTH (x) ((x & (0x7 << 1)) >> 1) + +struct hdcp2_cert_rx { +uint8_t receiver_id[HDCP_2_2_RECEIVER_ID_LEN ]; +uint8_t kpub_rx[HDCP_2_2_K_PUB_RX_LEN ]; +uint8_t reserved[2 ]; +uint8_t dcp_signature[HDCP_2_2_DCP_LLC_SIG_LEN ]; +} __packed; + +struct hdcp2_streamid_type { +uint8_t stream_id; +uint8_t stream_type; +} __packed; + +/* +* The TxCaps field specified in the HDCP HDMI, DP specs +* This field is big endian as specified in the errata. +*/ +struct hdcp2_tx_caps { +/* Transmitter must set this to 0x2 */ +uint8_t version; + +/* Reserved for HDCP and DP Spec. Read as Zero */ +uint8_t tx_cap_mask[HDCP_2_2_TXCAP_MASK_LEN ]; +} __packed; + +/* Main structures for HDCP2.2 protocol communication */ +struct hdcp2_ake_init { +uint8_t msg_id; +uint8_t r_tx[HDCP_2_2_RTX_LEN ]; +struct hdcp2_tx_caps tx_caps; +} __packed; + +struct hdcp2_ake_send_cert { +uint8_t msg_id; +struct hdcp2_cert_rx cert_rx; +uint8_t r_rx[HDCP_2_2_RRX_LEN ]; +uint8_t rx_caps[HDCP_2_2_RXCAPS_LEN ]; +} __packed; + +struct hdcp2_ake_no_stored_km { +uint8_t msg_id; +uint8_t e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN ]; +} __packed; + +struct hdcp2_ake_stored_km { +uint8_t msg_id; +uint8_t e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN ]; +} __packed; + +struct hdcp2_ake_send_hprime { +uint8_t msg_id; +uint8_t h_prime[HDCP_2_2_H_PRIME_LEN ]; +} __packed; + +struct hdcp2_ake_send_pairing_info { +uint8_t msg_id; +uint8_t e_kh_km[HDCP_2_2_E_KH_KM_LEN ]; +} __packed; + +struct hdcp2_lc_init { +uint8_t msg_id; +uint8_t r_n[HDCP_2_2_RN_LEN ]; +} __packed; + +struct hdcp2_lc_send_lprime { +uint8_t msg_id; +uint8_t l_prime[HDCP_2_2_L_PRIME_LEN ]; +} __packed; + +struct hdcp2_ske_send_eks { +uint8_t msg_id; +uint8_t e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN ]; +uint8_t riv[HDCP_2_2_RIV_LEN ]; +} __packed; + +struct hdcp2_rep_send_receiverid_list { +uint8_t msg_id; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +uint8_t seq_num_v[HDCP_2_2_SEQ_NUM_LEN ]; +uint8_t v_prime[HDCP_2_2_LPRIME_HALF_LEN ]; +uint8_t receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN ]; +} __packed; + +struct hdcp2_rep_send_ack { +uint8_t msg_id; +uint8_t v[HDCP_2_2_LPRIME_HALF_LEN ]; +} __packed; + +struct hdcp2_rep_stream_manage { +uint8_t msg_id; +uint8_t seq_num_m[HDCP_2_2_SEQ_NUM_LEN ]; +__be16 k; +struct hdcp2_streamid_type streams[HDCP_2_2_MAX_CONTENT_STREAMS_CNT ]; +} __packed; + +struct hdcp2_rep_stream_ready { +uint8_t msg_id; +uint8_t m_prime[HDCP_2_2_MPRIME_LEN ]; +} __packed; + +struct hdcp2_dp_errata_stream_type { +uint8_t msg_id; +uint8_t stream_type; +} __packed; +#endif
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 2/41 drm: HDMI and DP specific HDCP2.2 defines
In reply to Ramalingam CThis patch adds HDCP register definitions for HDMI and DP HDCP adaptations.
HDMI specific HDCP2.2 register definitions are added into drm_hdcp.h, where as HDCP2.2 register offsets in DPCD offsets are defined at drm_dp_helper.h.
v2:
bit_field definitions are replaced by macros. [Tomas and Jani]
v3:
No Changes.
v4:
Comments style and typos are fixed [Uma]
--- include/drm/drm_dp_helper.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_hdcp.h | 30 ++++++++++++++++++++++++++ 2 files changed, 81 insertions(+)
include/drm/drm_dp_helper.h +51 -0
@@ -898,6 +898,57 @@#define DP_AUX_HDCP_KSV_FIFO 0x6802C#define DP_AUX_HDCP_AINFO 0x6803B +/* DP HDCP2.2 parameter offsets in DPCD address space */ +#define DP_HDCP_2_2_REG_RTX_OFFSET 0x69000 +#define DP_HDCP_2_2_REG_TXCAPS_OFFSET 0x69008 +#define DP_HDCP_2_2_REG_CERT_RX_OFFSET 0x6900B +#define DP_HDCP_2_2_REG_RRX_OFFSET 0x69215 +#define DP_HDCP_2_2_REG_RX_CAPS_OFFSET 0x6921D +#define DP_HDCP_2_2_REG_EKPUB_KM_OFFSET 0x69220 +#define DP_HDCP_2_2_REG_EKH_KM_OFFSET 0x692A0 +#define DP_HDCP_2_2_REG_M_OFFSET 0x692B0 +#define DP_HDCP_2_2_REG_HPRIME_OFFSET 0x692C0 +#define DP_HDCP_2_2_REG_EKH_KM_RD_OFFSET 0x692E0 +#define DP_HDCP_2_2_REG_RN_OFFSET 0x692F0 +#define DP_HDCP_2_2_REG_LPRIME_OFFSET 0x692F8 +#define DP_HDCP_2_2_REG_EDKEY_KS_OFFSET 0x69318 +#define DP_HDCP_2_2_REG_RIV_OFFSET 0x69328 +#define DP_HDCP_2_2_REG_RXINFO_OFFSET 0x69330 +#define DP_HDCP_2_2_REG_SEQ_NUM_V_OFFSET 0x69332 +#define DP_HDCP_2_2_REG_VPRIME_OFFSET 0x69335 +#define DP_HDCP_2_2_REG_RECV_ID_LIST_OFFSET 0x69345 +#define DP_HDCP_2_2_REG_V_OFFSET 0x693E0 +#define DP_HDCP_2_2_REG_SEQ_NUM_M_OFFSET 0x693F0 +#define DP_HDCP_2_2_REG_K_OFFSET 0x693F3 +#define DP_HDCP_2_2_REG_STREAM_ID_TYPE_OFFSET 0x693F5 +#define DP_HDCP_2_2_REG_MPRIME_OFFSET 0x69473 +#define DP_HDCP_2_2_REG_RXSTATUS_OFFSET 0x69493 +#define DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET 0x69494 +#define DP_HDCP_2_2_REG_DBG_OFFSET 0x69518 + +/* DP HDCP message start offsets in DPCD address space */ +#define DP_HDCP_2_2_AKE_INIT_OFFSET DP_HDCP_2_2_REG_RTX_OFFSET +#define DP_HDCP_2_2_AKE_SEND_CERT_OFFSET DP_HDCP_2_2_REG_CERT_RX_OFFSET +#define DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET DP_HDCP_2_2_REG_EKPUB_KM_OFFSET +#define DP_HDCP_2_2_AKE_STORED_KM_OFFSET DP_HDCP_2_2_REG_EKH_KM_OFFSET +#define DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET DP_HDCP_2_2_REG_HPRIME_OFFSET +#define DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET \ + DP_HDCP_2_2_REG_EKH_KM_RD_OFFSET +#define DP_HDCP_2_2_LC_INIT_OFFSET DP_HDCP_2_2_REG_RN_OFFSET +#define DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET DP_HDCP_2_2_REG_LPRIME_OFFSET +#define DP_HDCP_2_2_SKE_SEND_EKS_OFFSET DP_HDCP_2_2_REG_EDKEY_KS_OFFSET +#define DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET DP_HDCP_2_2_REG_RXINFO_OFFSET +#define DP_HDCP_2_2_REP_SEND_ACK_OFFSET DP_HDCP_2_2_REG_V_OFFSET +#define DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET DP_HDCP_2_2_REG_SEQ_NUM_M_OFFSET +#define DP_HDCP_2_2_REP_STREAM_READY_OFFSET DP_HDCP_2_2_REG_MPRIME_OFFSET + +#define HDCP_2_2_DP_RXSTATUS_LEN 1 +#define HDCP_2_2_DP_RXSTATUS_READY (x) (x & BIT(0)) +#define HDCP_2_2_DP_RXSTATUS_H_PRIME (x) (x & BIT(1)) +#define HDCP_2_2_DP_RXSTATUS_PAIRING (x) (x & BIT(2)) +#define HDCP_2_2_DP_RXSTATUS_REAUTH_REQ (x) (x & BIT(3)) +#define HDCP_2_2_DP_RXSTATUS_LINK_FAILED (x) (x & BIT(4)) +/* 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 +30 -0
@@ -217,4 +217,34 @@ struct hdcp2_dp_errata_stream_type { uint8_t stream_type; } __packed; +/* HDCP2.2 TIMEOUTs in mSec */ +#define HDCP_2_2_CERT_TIMEOUT 100 +#define HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT 1000 +#define HDCP_2_2_HPRIME_PAIRED_TIMEOUT 200 +#define HDCP_2_2_PAIRING_TIMEOUT 200 +#define HDCP_2_2_HDMI_LPRIME_TIMEOUT 20 +#define HDCP_2_2_DP_LPRIME_TIMEOUT 7 +#define HDCP_2_2_RECVID_LIST_TIMEOUT 3000 +#define HDCP_2_2_STREAM_READY_TIMEOUT 100 + +/* HDMI HDCP2.2 Register Offsets */ +#define HDCP_2_2_HDMI_REG_VER_OFFSET 0x50 +#define HDCP_2_2_HDMI_REG_WR_MSG_OFFSET 0x60 +#define HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET 0x70 +#define HDCP_2_2_HDMI_REG_RD_MSG_OFFSET 0x80 +#define HDCP_2_2_HDMI_REG_DBG_OFFSET 0xC0 + +#define HDCP_2_2_HDMI_SUPPORT_MASK BIT(2) +#define HDCP_2_2_RXCAPS_VERSION_VAL 0x2 + +#define HDCP_2_2_RX_CAPS_VERSION_VAL 0x02 +#define HDCP_2_2_SEQ_NUM_MAX 0xFFFFFF +#define HDCP_2_2_DELAY_BEFORE_ENCRYPTION_EN 200 + +/* Below macros take a byte at a time and mask the bit(s) */ +#define HDCP_2_2_HDMI_RXSTATUS_LEN 2 +#define HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI (x) (x & 0x3) +#define HDCP_2_2_HDMI_RXSTATUS_READY (x) (x & BIT(2)) +#define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ (x) (x & BIT(3)) +#endif
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 3/41 mei: bus: whitelist hdcp client
In reply to Ramalingam CFrom: Tomas Winkler <[email protected]>
Whitelist HDCP client for in kernel drm use
v2:
Rebased.
v3:
No changes.
v4:
No changes.
--- drivers/misc/mei/bus-fixup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/misc/mei/bus-fixup.c +16 -0
@@ -41,6 +41,9 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;#define MEI_UUID_MKHIF_FIX UUID_LE(0x55213584, 0x9a29, 0x4916, \ 0xba, 0xdf, 0xf, 0xb7, 0xed, 0x68, 0x2a, 0xeb) +#define MEI_UUID_HDCP UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, \ + 0xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04) +#define MEI_UUID_ANY NULL_UUID_LE/**
@@ -72,6 +75,18 @@ static void blacklist(struct mei_cl_device *cldev) cldev->do_match =0 ; } +/** +* whitelist - forcefully whitelist client +* +* @cldev: me clients device +*/ +static void whitelist (struct mei_cl_device *cldev) +{ +dev_dbg (&cldev->dev,"running hook %s\n" , __func__); + + cldev->do_match =1 ; +} +#define OSTYPE_LINUX 2struct mei_os_ver {__le16 build;
@@ -399,6 +414,7 @@ static struct mei_fixup {MEI_FIXUP (MEI_UUID_NFC_HCI , mei_nfc),MEI_FIXUP (MEI_UUID_WD , mei_wd),MEI_FIXUP (MEI_UUID_MKHIF_FIX , mei_mkhi_fix), + MEI_FIXUP(MEI_UUID_HDCP, whitelist), };/**
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 4/41 misc/mei/hdcp: Client driver for HDCP application
In reply to Ramalingam CME FW is contributes a vital role in HDCP2.2 authentication. HDCP2.2 driver needs to communicate to ME FW for each step of the HDCP2.2 authentication.
ME FW prepare and HDCP2.2 authentication parameters and encrypt them as per spec. With such parameter Driver prepares HDCP2.2 auth messages and communicate with HDCP2.2 sink.
Similarly HDCP2. sink's response is shared with ME FW for decrypt and verification.
Once All the steps of HDCP2.2 authentications are complete on driver's request ME FW will configure the port as authenticated and supply the HDCP keys to the Gen HW for encryption.
Only after this stage HDCP2.2 driver can start the HDCP2.2 encryption for a port.
ME FW is interfaced to kernel through MEI Bus Driver. To obtain the HDCP2.2 services from the ME FW through MEI Bus driver MEI Client Driver is developed.
With this change MEI_HDCP drivers selected by I915 by default. In case if we want to exclude the mei_hdcp compilation, we need to introduce a new config called HDCP2.2. Using such CONFIG var we could control the compilation of the HDCP2.2 code in I915 and also the compilation of the MEI_HDCP.
v2:
hdcp files are moved to drivers/misc/mei/hdcp/ [Tomas]
v3:
Squashed the Kbuild support [Tomas]
UUID renamed and Module License is modified [Tomas] drv_data is set to null at remove [Tomas]
v4:
Module name is changed to "MEI HDCP"
I915 Selects the MEI_HDCP
--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/misc/mei/Kconfig | 7 ++++ drivers/misc/mei/Makefile | 2 ++ drivers/misc/mei/hdcp/Makefile | 6 ++++ drivers/misc/mei/hdcp/mei_hdcp.c | 74 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 drivers/misc/mei/hdcp/Makefile create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.c
drivers/gpu/drm/i915/Kconfig +1 -0
@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select INTEL_MEI_HDCP help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,
drivers/misc/mei/Kconfig +7 -0
@@ -43,3 +43,10 @@ config INTEL_MEI_TXE Supported SoCs: Intel Bay Trail + +config INTEL_MEI_HDCP + tristate "Intel HDCP2.2 services of ME Interface" + select INTEL_MEI_ME + depends on DRM_I915 + help + MEI Support for HDCP2.2 Services on Intel SoCs.
drivers/misc/mei/Makefile +2 -0
@@ -23,3 +23,5 @@ mei-txe-objs += hw-txe.o mei-$(CONFIG_EVENT_TRACING) += mei-trace.o CFLAGS_mei-trace.o = -I$(src) + +obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/
drivers/misc/mei/hdcp/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile - HDCP client driver for Intel MEI Bus Driver. +# Copyright (c) 2010-2014, Intel Corporation. +# +obj-$(CONFIG_INTEL_MEI_HDCP) += mei_hdcp.o
drivers/misc/mei/hdcp/mei_hdcp.c new file +74 -0
74 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 5/41 misc/mei/hdcp: Notifier chain for mei cldev state change
In reply to Ramalingam CNotifier Chain is defined to inform all its clients about the mei client device state change. Routine is defined for the clients to register and unregister for the notification on state change.
v2:
Rebased.
v3:
Notifier chain is adopted for cldev state update [Tomas]
v4:
Made static dummy functions as inline in mei_hdcp.h API for polling client device status
IS_ENABLED used in header, for config status for mei_hdcp.
--- drivers/misc/mei/hdcp/mei_hdcp.c | 46 ++++++++++++++++++++++++++++++++-- include/linux/mei_hdcp.h | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 include/linux/mei_hdcp.h
drivers/misc/mei/hdcp/mei_hdcp.c +44 -2
@@ -31,6 +31,42 @@#include <linux/slab.h> #include <linux/uuid.h> #include <linux/mei_cl_bus.h> +#include <linux/notifier.h> +#include <linux/mei_hdcp.h> + +static struct mei_cl_device *mei_cldev; +static BLOCKING_NOTIFIER_HEAD (mei_cldev_notifier_list); + +static void +mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) +{ +if (enabled) +blocking_notifier_call_chain (&mei_cldev_notifier_list, +MEI_CLDEV_ENABLED , cldev); +else +blocking_notifier_call_chain (&mei_cldev_notifier_list, +MEI_CLDEV_DISABLED ,NULL ); +} + +int mei_cldev_register_notify (struct notifier_block *nb) +{ +return blocking_notifier_chain_register (&mei_cldev_notifier_list, nb); +} +EXPORT_SYMBOL_GPL (mei_cldev_register_notify); + +int mei_cldev_unregister_notify (struct notifier_block *nb) +{ +return blocking_notifier_chain_unregister (&mei_cldev_notifier_list, nb); +} +EXPORT_SYMBOL_GPL (mei_cldev_unregister_notify); + +int mei_cldev_poll_notification (void ) +{ +if (mei_cldev) +mei_cldev_state_notify_clients (mei_cldev, true); +return 0 ; +} +EXPORT_SYMBOL_GPL (mei_cldev_poll_notification);static int mei_hdcp_probe (struct mei_cl_device *cldev,const struct mei_cl_device_id *id)
@@ -38,14 +74,20 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev,int ret; ret =mei_cldev_enable (cldev); -if (ret <0 ) +if (ret <0 ) {dev_err (&cldev->dev,"mei_cldev_enable Failed. %d\n" , ret); +return ret; + } -return ret; + mei_cldev = cldev; +mei_cldev_state_notify_clients (cldev, true); +return 0 ; }static int mei_hdcp_remove (struct mei_cl_device *cldev) { + mei_cldev =NULL ; +mei_cldev_state_notify_clients (cldev, false);mei_cldev_set_drvdata (cldev,NULL );return mei_cldev_disable (cldev); }
include/linux/mei_hdcp.h new file +53 -0
53 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 6/41 misc/mei/hdcp: Define ME FW interface for HDCP2.2
In reply to Ramalingam CDefines the HDCP specific ME FW interfaces such as Request CMDs, payload structure for CMDs and their response status codes.
This patch defines payload size(Excluding the Header)for each WIRED HDCP2.2 CMDs.
v2:
Rebased.
v3:
Extra comments are removed.
v4:
%s/\/\*\*/\/\*
--- drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 415 insertions(+) create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.h
drivers/misc/mei/hdcp/mei_hdcp.h new file +415 -0
@@ -0,0 +1,415 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* +* Copyright © 2017-2018 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +* Authors: +* Ramalingam C <[email protected]> +*/ + +#ifndef __MEI_HDCP_H__ +#define __MEI_HDCP_H__ + +#include <drm/drm_hdcp.h> + +/* +* me_hdcp_status: Enumeration of all HDCP Status Codes +*/ +enum me_hdcp_status { +ME_HDCP_STATUS_SUCCESS =0x0000 , + +/* WiDi Generic Status Codes */ +ME_HDCP_STATUS_INTERNAL_ERROR =0x1000 , +ME_HDCP_STATUS_UNKNOWN_ERROR =0x1001 , +ME_HDCP_STATUS_INCORRECT_API_VERSION =0x1002 , +ME_HDCP_STATUS_INVALID_FUNCTION =0x1003 , +ME_HDCP_STATUS_INVALID_BUFFER_LENGTH =0x1004 , +ME_HDCP_STATUS_INVALID_PARAMS =0x1005 , +ME_HDCP_STATUS_AUTHENTICATION_FAILED =0x1006 , + +/* WiDi Status Codes */ +ME_HDCP_INVALID_SESSION_STATE =0x6000 , +ME_HDCP_SRM_FRAGMENT_UNEXPECTED =0x6001 , +ME_HDCP_SRM_INVALID_LENGTH =0x6002 , +ME_HDCP_SRM_FRAGMENT_OFFSET_INVALID =0x6003 , +ME_HDCP_SRM_VERIFICATION_FAILED =0x6004 , +ME_HDCP_SRM_VERSION_TOO_OLD =0x6005 , +ME_HDCP_RX_CERT_VERIFICATION_FAILED =0x6006 , +ME_HDCP_RX_REVOKED =0x6007 , +ME_HDCP_H_VERIFICATION_FAILED =0x6008 , +ME_HDCP_REPEATER_CHECK_UNEXPECTED =0x6009 , +ME_HDCP_TOPOLOGY_MAX_EXCEEDED =0x600A , +ME_HDCP_V_VERIFICATION_FAILED =0x600B , +ME_HDCP_L_VERIFICATION_FAILED =0x600C , +ME_HDCP_STREAM_KEY_ALLOC_FAILED =0x600D , +ME_HDCP_BASE_KEY_RESET_FAILED =0x600E , +ME_HDCP_NONCE_GENERATION_FAILED =0x600F , +ME_HDCP_STATUS_INVALID_E_KEY_STATE =0x6010 , +ME_HDCP_STATUS_INVALID_CS_ICV =0x6011 , +ME_HDCP_STATUS_INVALID_KB_KEY_STATE =0x6012 , +ME_HDCP_STATUS_INVALID_PAVP_MODE_ICV =0x6013 , +ME_HDCP_STATUS_INVALID_PAVP_MODE =0x6014 , +ME_HDCP_STATUS_LC_MAX_ATTEMPTS =0x6015 , + +/* New status for HDCP 2.1 */ +ME_HDCP_STATUS_MISMATCH_IN_M =0x6016 , + +/* New status code for HDCP 2.2 Rx */ +ME_HDCP_STATUS_RX_PROV_NOT_ALLOWED =0x6017 , +ME_HDCP_STATUS_RX_PROV_WRONG_SUBJECT =0x6018 , +ME_HDCP_RX_NEEDS_PROVISIONING =0x6019 , +ME_HDCP_BKSV_ICV_AUTH_FAILED =0x6020 , +ME_HDCP_STATUS_INVALID_STREAM_ID =0x6021 , +ME_HDCP_STATUS_CHAIN_NOT_INITIALIZED =0x6022 , +ME_HDCP_FAIL_NOT_EXPECTED =0x6023 , +ME_HDCP_FAIL_HDCP_OFF =0x6024 , +ME_HDCP_FAIL_INVALID_PAVP_MEMORY_MODE =0x6025 , +ME_HDCP_FAIL_AES_ECB_FAILURE =0x6026 , +ME_HDCP_FEATURE_NOT_SUPPORTED =0x6027 , +ME_HDCP_DMA_READ_ERROR =0x6028 , +ME_HDCP_DMA_WRITE_ERROR =0x6029 , +ME_HDCP_FAIL_INVALID_PACKET_SIZE =0x6030 , +ME_HDCP_H264_PARSING_ERROR =0x6031 , +ME_HDCP_HDCP2_ERRATA_VIDEO_VIOLATION =0x6032 , +ME_HDCP_HDCP2_ERRATA_AUDIO_VIOLATION =0x6033 , +ME_HDCP_TX_ACTIVE_ERROR =0x6034 , +ME_HDCP_MODE_CHANGE_ERROR =0x6035 , +ME_HDCP_STREAM_TYPE_ERROR =0x6036 , +ME_HDCP_STREAM_MANAGE_NOT_POSSIBLE =0x6037 , + +ME_HDCP_STATUS_PORT_INVALID_COMMAND =0x6038 , +ME_HDCP_STATUS_UNSUPPORTED_PROTOCOL =0x6039 , +ME_HDCP_STATUS_INVALID_PORT_INDEX =0x603a , +ME_HDCP_STATUS_TX_AUTH_NEEDED =0x603b , +ME_HDCP_STATUS_NOT_INTEGRATED_PORT =0x603c , +ME_HDCP_STATUS_SESSION_MAX_REACHED =0x603d , + +/* hdcp capable bit is not set in rx_caps(error is unique to DP) */ +ME_HDCP_STATUS_NOT_HDCP_CAPABLE =0x6041 , + +ME_HDCP_STATUS_INVALID_STREAM_COUNT =0x6042 , +}; + +#define HDCP_API_VERSION 0x00010000 + +#define HDCP_M_LEN 16 +#define HDCP_KH_LEN 16 + +/* +* Payload Buffer size(Excluding Header) for each CMD and corresponding response +*/ +/* Wired_Tx_AKE */ +#define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN (4 + 1) +#define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_OUT (4 + 8 + 3) + +#define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN (4 + 522 + 8 + 3) +#define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MIN_OUT (4 + 1 + 3 + 16 + 16) +#define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MAX_OUT (4 + 1 + 3 + 128) + +#define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN (4 + 32) +#define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_OUT (4) + +#define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN (4 + 16) +#define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_OUT (4) + +#define WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN (4) +#define WIRED_CMD_BUF_LEN_CLOSE_SESSION_OUT (4) + +/* Wired_Tx_LC */ +#define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN (4) +#define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_OUT (4 + 8) + +#define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN (4 + 32) +#define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_OUT (4) + +/* Wired_Tx_SKE */ +#define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN (4) +#define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_OUT (4 + 16 + 8) + +/* Wired_Tx_SKE */ +#define WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN (4 + 1) +#define WIRED_CMD_BUF_LEN_ENABLE_AUTH_OUT (4) + +/* Wired_Tx_Repeater */ +#define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN (4 + 2 + 3 + 16 + 155) +#define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_OUT (4 + 1 + 16) + +#define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN (4 + 3 + \ + 32 + 2 + 2) + +#define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_OUT (4) + + +/* +* hdcp_command_id: Enumeration of all WIRED HDCP Command IDs +*/ +enum hdcp_command_id { + _WIDI_COMMAND_BASE =0x00030000 , +WIDI_INITIATE_HDCP2_SESSION = _WIDI_COMMAND_BASE, +HDCP_GET_SRM_STATUS , +HDCP_SEND_SRM_FRAGMENT , + +/* The wired HDCP Tx commands */ + _WIRED_COMMAND_BASE =0x00031000 , +WIRED_INITIATE_HDCP2_SESSION = _WIRED_COMMAND_BASE, +WIRED_VERIFY_RECEIVER_CERT , +WIRED_AKE_SEND_HPRIME , +WIRED_AKE_SEND_PAIRING_INFO , +WIRED_INIT_LOCALITY_CHECK , +WIRED_VALIDATE_LOCALITY , +WIRED_GET_SESSION_KEY , +WIRED_ENABLE_AUTH , +WIRED_VERIFY_REPEATER , +WIRED_REPEATER_AUTH_STREAM_REQ , +WIRED_CLOSE_SESSION , + + _WIRED_COMMANDS_COUNT, +}; + +union encrypted_buff { +uint8_t e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN ]; +uint8_t e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN ]; +struct { +uint8_t e_kh_km[HDCP_KH_LEN ]; +uint8_t m[HDCP_M_LEN ]; + } __packed; +}; + +/* +* HDCP HECI message header. All header values are little endian. +*/ +struct hdcp_cmd_header { +uint32_t api_version; +uint32_t command_id; +enum me_hdcp_status status; +/* Length of the HECI message (excluding the header) */ +uint32_t buffer_len; +} __packed; + +/* Empty command request or response. No data follows the header. */ +struct hdcp_cmd_no_data { +struct hdcp_cmd_header header; +} __packed; + +/* +* Uniquely identifies the hdcp port being addressed for a given command. +*/ +struct hdcp_port_id { +uint8_t integrated_port_type; +uint8_t physical_port; +uint16_t reserved; +} __packed; + + +/* +* Data structures for integrated wired HDCP2 Tx in +* support of the AKE protocol +*/ + +/* +* HECI struct for integrated wired HDCP Tx session initiation. +*/ +struct wired_cmd_initiate_hdcp2_session_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t protocol;/* for HDMI vs DP */ +} __packed; + +struct wired_cmd_initiate_hdcp2_session_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t r_tx[HDCP_2_2_RTX_LEN ]; +struct hdcp2_tx_caps tx_caps; +} __packed; + +/* +* HECI struct for ending an integrated wired HDCP Tx session. +*/ +struct wired_cmd_close_session_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +struct wired_cmd_close_session_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +/* +* HECI struct for integrated wired HDCP Tx Rx Cert verification. +*/ +struct wired_cmd_verify_receiver_cert_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +struct hdcp2_cert_rx cert_rx; +uint8_t r_rx[HDCP_2_2_RRX_LEN ]; +uint8_t rx_caps[HDCP_2_2_RXCAPS_LEN ]; +} __packed; + +struct wired_cmd_verify_receiver_cert_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t km_stored; +uint8_t reserved[3 ]; +union encrypted_buff ekm_buff; +} __packed; + +/* +* HECI struct for verification of Rx's Hprime in a HDCP Tx session +*/ +struct wired_cmd_ake_send_hprime_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t h_prime[HDCP_2_2_H_PRIME_LEN ]; +} __packed; + +struct wired_cmd_ake_send_hprime_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +/* +* HECI struct for sending in AKE pairing data generated by the Rx in an +* integrated wired HDCP Tx session. +*/ +struct wired_cmd_ake_send_pairing_info_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t e_kh_km[HDCP_2_2_E_KH_KM_LEN ]; +} __packed; + +struct wired_cmd_ake_send_pairing_info_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + + +/* +* Data structures for integrated wired HDCP2 Tx in support of the LC protocol +*/ + +/* +* HECI struct for initiating locality check with an +* integrated wired HDCP Tx session. +*/ +struct wired_cmd_init_locality_check_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +struct wired_cmd_init_locality_check_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t r_n[HDCP_2_2_RN_LEN ]; +} __packed; + +/* +* HECI struct for validating an Rx's LPrime value in an +* integrated wired HDCP Tx session. +*/ +struct wired_cmd_validate_locality_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t l_prime[HDCP_2_2_L_PRIME_LEN ]; +} __packed; + +struct wired_cmd_validate_locality_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +/* +* Data structures for integrated wired HDCP2 Tx in support of the SKE protocol +*/ + +/* +* HECI struct for creating session key +*/ +struct wired_cmd_get_session_key_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +struct wired_cmd_get_session_key_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN ]; +uint8_t r_iv[HDCP_2_2_RIV_LEN ]; +} __packed; + +/* +* HECI struct for the Tx enable authentication command +*/ +struct wired_cmd_enable_auth_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t stream_type; +} __packed; + +struct wired_cmd_enable_auth_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +/* +* Data structures for integrated wired HDCP2 Tx in support of +* the repeater protocols +*/ + +/* +* HECI struct for verifying the downstream repeater's HDCP topology in an +* integrated wired HDCP Tx session. +*/ +struct wired_cmd_verify_repeater_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +uint8_t seq_num_v[HDCP_2_2_SEQ_NUM_LEN ]; +uint8_t v_prime[HDCP_2_2_LPRIME_HALF_LEN ]; +uint8_t receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN ]; +} __packed; + +struct wired_cmd_verify_repeater_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t content_type_supported; +uint8_t v[HDCP_2_2_LPRIME_HALF_LEN ]; +} __packed; + +/* +* HECI struct in support of stream management in an +* integrated wired HDCP Tx session. +*/ +struct wired_cmd_repeater_auth_stream_req_in { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +uint8_t seq_num_m[HDCP_2_2_SEQ_NUM_LEN ]; +uint8_t m_prime[HDCP_2_2_MPRIME_LEN ]; +uint16_t k; +struct hdcp2_streamid_type streams[1 ]; +} __packed; + +struct wired_cmd_repeater_auth_stream_req_out { +struct hdcp_cmd_header header; +struct hdcp_port_id port; +} __packed; + +#endif /* __MEI_HDCP_H__ */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 7/41 linux/mei: Header for mei_hdcp driver interface
In reply to Ramalingam CData structures and Enum for the I915-MEI_HDCP interface are defined at <linux/mei_hdcp.h>
v2:
Rebased.
v3:
mei_cl_device is removed from mei_hdcp_data [Tomas]
v4:
Comment style and typo fixed [Uma]
--- include/linux/mei_hdcp.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
include/linux/mei_hdcp.h +70 -0
@@ -27,11 +27,81 @@#ifndef _LINUX_MEI_HDCP_H#define _LINUX_MEI_HDCP_H +#include <linux/mei_cl_bus.h> +enum mei_cldev_state {MEI_CLDEV_DISABLED ,MEI_CLDEV_ENABLED }; +/* +* Enumeration of the physical DDI available on the platform +*/ +enum hdcp_physical_port { +INVALID_PORT =0x00 ,/* Not a valid port */ + +DDI_RANGE_BEGIN =0x01 ,/* Beginning of the valid DDI port range */ +DDI_B =0x01 ,/* Port DDI B */ +DDI_C =0x02 ,/* Port DDI C */ +DDI_D =0x03 ,/* Port DDI D */ +DDI_E =0x04 ,/* Port DDI E */ +DDI_F =0x05 ,/* Port DDI F */ +DDI_A =0x07 ,/* Port DDI A */ +DDI_RANGE_END =DDI_A ,/* End of the valid DDI port range */ +}; + +/* The types of HDCP 2.2 ports supported */ +enum hdcp_integrated_port_type { +HDCP_INVALID_TYPE =0x00 , + +/* HDCP 2.x ports that are integrated into Intel HW */ +INTEGRATED =0x01 , + +/* HDCP2.2 discrete wired Tx port with LSPCON (HDMI 2.0) solution */ +LSPCON =0x02 , + +/* HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3) solution */ +CPDP =0x03 , +}; + +/* +* wired_protocol: Supported integrated wired HDCP protocol. +* Based on this value, Minor difference needed between wired specifications +* are handled. +*/ +enum hdcp_protocol { +HDCP_PROTOCOL_INVALID , +HDCP_PROTOCOL_HDMI , +HDCP_PROTOCOL_DP +}; + +/* +* mei_hdcp_data: Input data to the mei_hdcp APIs. +*/ +struct mei_hdcp_data { +enum hdcp_physical_port port; +enum hdcp_integrated_port_type port_type; +enum hdcp_protocol protocol; + +/* +* No of streams transmitted on a port. +* In case of HDMI & DP SST, single stream will be +* transmitted on a port. +*/ +uint16_t k; + +/* +* Count of RepeaterAuth_Stream_Manage msg propagated. +* Initialized to 0 on AKE_INIT. Incremented after every successful +* transmission of RepeaterAuth_Stream_Manage message. When it rolls +* over re-Auth has to be triggered. +*/ +uint32_t seq_num_m; + +/* k(No of Streams per port) x structure of wired_streamid_type */ +struct hdcp2_streamid_type *streams; +}; +#if IS_ENABLED (CONFIG_INTEL_MEI_HDCP )int mei_cldev_register_notify (struct notifier_block *nb);int mei_cldev_unregister_notify (struct notifier_block *nb);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 8/41 misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
In reply to Ramalingam CRequest ME FW to start the HDCP2.2 session for an intel port. Prepares payloads for command WIRED_INITIATE_HDCP2_SESSION and sends to ME FW.
On Success, ME FW will start a HDCP2.2 session for the port and provides the content for HDCP2.2 AKE_Init message.
v2:
Rebased.
v3:
cldev is add as a separate parameter [Tomas] Redundant comment and typecast are removed [Tomas]
v4:
%zd is used for size [Alexander]
%s/return -1/return -EIO [Alexander] Spellings in commit msg is fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 68 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 11 +++++++ 2 files changed, 79 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +68 -0
@@ -33,10 +33,78 @@#include <linux/mei_cl_bus.h> #include <linux/notifier.h> #include <linux/mei_hdcp.h> +#include <drm/drm_connector.h> + +#include "mei_hdcp.h" static struct mei_cl_device *mei_cldev;static BLOCKING_NOTIFIER_HEAD (mei_cldev_notifier_list); +/* +* mei_initiate_hdcp2_session: +* Function to start a Wired HDCP2.2 Tx Session with ME FW +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* ake_data : ptr to store AKE_Init +* +* Returns 0 on Success, <0 on Failure. +*/ +int mei_initiate_hdcp2_session (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_init *ake_data) +{ +struct wired_cmd_initiate_hdcp2_session_in session_init_in = { {0 } }; +struct wired_cmd_initiate_hdcp2_session_out + session_init_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !ake_data) +return -EINVAL ; + + dev = &cldev->dev; + + session_init_in.header.api_version =HDCP_API_VERSION ; + session_init_in.header.command_id =WIRED_INITIATE_HDCP2_SESSION ; + session_init_in.header.status =ME_HDCP_STATUS_SUCCESS ; + session_init_in.header.buffer_len = +WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN ; + + session_init_in.port.integrated_port_type = data->port_type; + session_init_in.port.physical_port = data->port; + session_init_in.protocol = (uint8_t )data->protocol; + + byte =mei_cldev_send (cldev, (u8 *)&session_init_in, +sizeof (session_init_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&session_init_out, +sizeof (session_init_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (session_init_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X Failed. Status: 0x%X\n" , +WIRED_INITIATE_HDCP2_SESSION , + session_init_out.header.status); +return -EIO ; + } + + ake_data->msg_id =HDCP_2_2_AKE_INIT ; + ake_data->tx_caps = session_init_out.tx_caps; +memcpy (ake_data->r_tx, session_init_out.r_tx, +sizeof (session_init_out.r_tx)); + +return 0 ; +} +EXPORT_SYMBOL (mei_initiate_hdcp2_session); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +11 -0
@@ -28,6 +28,7 @@#define _LINUX_MEI_HDCP_H#include <linux/mei_cl_bus.h> +#include <drm/drm_hdcp.h> enum mei_cldev_state {MEI_CLDEV_DISABLED ,
@@ -106,6 +107,9 @@ struct mei_hdcp_data {int mei_cldev_register_notify (struct notifier_block *nb);int mei_cldev_unregister_notify (struct notifier_block *nb);int mei_cldev_poll_notification (void ); +int mei_initiate_hdcp2_session (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_init *ake_data);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -119,5 +123,12 @@ static inline int mei_cldev_poll_notification(void) {return -ENODEV ; } +static inline +int mei_initiate_hdcp2_session (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_init *ake_data) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 9/41 misc/mei/hdcp: Verify Receiver Cert and prepare km
In reply to Ramalingam CRequests for verification for receiver certification and also the preparation for next AKE auth message with km.
On Success ME FW validate the HDCP2.2 receivers certificate and do the revocation check on the receiver ID. AKE_Stored_Km will be prepared if the receiver is already paired, else AKE_No_Stored_Km will be prepared.
Here AKE_Stored_Km and AKE_No_Stored_Km are HDCP2.2 protocol msgs.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd is used for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 83 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 17 ++++++++ 2 files changed, 100 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +83 -0
@@ -105,6 +105,89 @@ int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, }EXPORT_SYMBOL (mei_initiate_hdcp2_session); +/* +* mei_verify_receiver_cert_prepare_km: +* Function to verify the Receiver Certificate AKE_Send_Cert +* and prepare AKE_Stored_Km or AKE_No_Stored_Km +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* rx_cert : Pointer for AKE_Send_Cert +* km_stored : Pointer for pairing status flag +* ek_pub_km : Pointer for output msg +* msg_sz : Pointer for size of AKE_XXXXX_Km +* +* Returns 0 on Success, <0 on Failure +*/ +int +mei_verify_receiver_cert_prepare_km (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_send_cert *rx_cert, +bool *km_stored, +struct hdcp2_ake_no_stored_km *ek_pub_km, +size_t *msg_sz) +{ +struct wired_cmd_verify_receiver_cert_in verify_rxcert_in = { {0 } }; +struct wired_cmd_verify_receiver_cert_out verify_rxcert_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !rx_cert || !km_stored || !ek_pub_km || !msg_sz) +return -EINVAL ; + + dev = &cldev->dev; + + verify_rxcert_in.header.api_version =HDCP_API_VERSION ; + verify_rxcert_in.header.command_id =WIRED_VERIFY_RECEIVER_CERT ; + verify_rxcert_in.header.status =ME_HDCP_STATUS_SUCCESS ; + verify_rxcert_in.header.buffer_len = +WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN ; + + verify_rxcert_in.port.integrated_port_type = data->port_type; + verify_rxcert_in.port.physical_port = data->port; + +memcpy (&verify_rxcert_in.cert_rx, &rx_cert->cert_rx, +sizeof (rx_cert->cert_rx)); +memcpy (verify_rxcert_in.r_rx, &rx_cert->r_rx,sizeof (rx_cert->r_rx)); +memcpy (verify_rxcert_in.rx_caps, rx_cert->rx_caps,HDCP_2_2_RXCAPS_LEN ); + + byte =mei_cldev_send (cldev, (u8 *)&verify_rxcert_in, +sizeof (verify_rxcert_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed: %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&verify_rxcert_out, +sizeof (verify_rxcert_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed: %zd\n" , byte); +return byte; + } + +if (verify_rxcert_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X Failed. Status: 0x%X\n" , +WIRED_VERIFY_RECEIVER_CERT , + verify_rxcert_out.header.status); +return -EIO ; + } + + *km_stored = verify_rxcert_out.km_stored; +if (verify_rxcert_out.km_stored) { + ek_pub_km->msg_id =HDCP_2_2_AKE_STORED_KM ; + *msg_sz =sizeof (struct hdcp2_ake_stored_km ); + }else { + ek_pub_km->msg_id =HDCP_2_2_AKE_NO_STORED_KM ; + *msg_sz =sizeof (struct hdcp2_ake_no_stored_km ); + } + +memcpy (ek_pub_km->e_kpub_km, &verify_rxcert_out.ekm_buff, +sizeof (verify_rxcert_out.ekm_buff)); + +return 0 ; +} +EXPORT_SYMBOL (mei_verify_receiver_cert_prepare_km); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +17 -0
@@ -110,6 +110,13 @@ int mei_cldev_poll_notification(void);int mei_initiate_hdcp2_session (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_ake_init *ake_data); +int +mei_verify_receiver_cert_prepare_km (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_send_cert *rx_cert, +bool *km_stored, +struct hdcp2_ake_no_stored_km *ek_pub_km, +size_t *msg_sz);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -130,5 +137,15 @@ int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, {return -ENODEV ; } +static inline int +mei_verify_receiver_cert_prepare_km (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_send_cert *rx_cert, +bool *km_stored, +struct hdcp2_ake_no_stored_km *ek_pub_km, +size_t *msg_sz) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 10/41 misc/mei/hdcp: Verify H_prime
In reply to Ramalingam CRequests for the verification of AKE_Send_H_prime.
ME will calculate the H and comparing it with received H_Prime. The result will be returned as status.
Here AKE_Send_H_prime is a HDCP2.2 Authentication msg.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Styles and typos fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 59 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 8 ++++++ 2 files changed, 67 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +59 -0
@@ -188,6 +188,65 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, }EXPORT_SYMBOL (mei_verify_receiver_cert_prepare_km); +/* +* mei_verify_hprime: +* Function to verify AKE_Send_H_prime received, through ME FW. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* rx_hprime : Pointer for AKE_Send_H_prime +* hprime_sz : Input buffer size +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_verify_hprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_ake_send_hprime *rx_hprime) +{ +struct wired_cmd_ake_send_hprime_in send_hprime_in = { {0 } }; +struct wired_cmd_ake_send_hprime_out send_hprime_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !rx_hprime) +return -EINVAL ; + + dev = &cldev->dev; + + send_hprime_in.header.api_version =HDCP_API_VERSION ; + send_hprime_in.header.command_id =WIRED_AKE_SEND_HPRIME ; + send_hprime_in.header.status =ME_HDCP_STATUS_SUCCESS ; + send_hprime_in.header.buffer_len =WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN ; + + send_hprime_in.port.integrated_port_type = data->port_type; + send_hprime_in.port.physical_port = data->port; + +memcpy (send_hprime_in.h_prime, rx_hprime->h_prime, +sizeof (rx_hprime->h_prime)); + + byte =mei_cldev_send (cldev, (u8 *)&send_hprime_in, +sizeof (send_hprime_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&send_hprime_out, +sizeof (send_hprime_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (send_hprime_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X Failed. Status: 0x%X\n" , +WIRED_AKE_SEND_HPRIME , send_hprime_out.header.status); +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (mei_verify_hprime); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +8 -0
@@ -117,6 +117,8 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev,bool *km_stored, struct hdcp2_ake_no_stored_km *ek_pub_km, size_t *msg_sz); +int mei_verify_hprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_ake_send_hprime *rx_hprime);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -147,5 +149,11 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, {return -ENODEV ; } +static inline +int mei_verify_hprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_ake_send_hprime *rx_hprime) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 11/41 misc/mei/hdcp: Store the HDCP Pairing info
In reply to Ramalingam CProvides Pairing info to ME to store.
Pairing is a process to fast track the subsequent authentication with the same HDCP sink.
On Success, received HDCP pairing info is stored in non-volatile memory of ME.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 61 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 10 +++++++ 2 files changed, 71 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +61 -0
@@ -247,6 +247,67 @@ int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, }EXPORT_SYMBOL (mei_verify_hprime); +/* +* mei_store_pairing_info: +* Function to store pairing info received from panel +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* pairing_info : Pointer for AKE_Send_Pairing_Info +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_store_pairing_info (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_send_pairing_info *pairing_info) +{ +struct wired_cmd_ake_send_pairing_info_in pairing_info_in = { {0 } }; +struct wired_cmd_ake_send_pairing_info_out pairing_info_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !pairing_info) +return -EINVAL ; + + dev = &cldev->dev; + + pairing_info_in.header.api_version =HDCP_API_VERSION ; + pairing_info_in.header.command_id =WIRED_AKE_SEND_PAIRING_INFO ; + pairing_info_in.header.status =ME_HDCP_STATUS_SUCCESS ; + pairing_info_in.header.buffer_len = +WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN ; + + pairing_info_in.port.integrated_port_type = data->port_type; + pairing_info_in.port.physical_port = data->port; + +memcpy (pairing_info_in.e_kh_km, pairing_info->e_kh_km, +sizeof (pairing_info_in.e_kh_km)); + + byte =mei_cldev_send (cldev, (u8 *)&pairing_info_in, +sizeof (pairing_info_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&pairing_info_out, +sizeof (pairing_info_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (pairing_info_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X failed. Status: 0x%X\n" , +WIRED_AKE_SEND_PAIRING_INFO , + pairing_info_out.header.status); +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (mei_store_pairing_info); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +10 -0
@@ -119,6 +119,9 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, size_t *msg_sz);int mei_verify_hprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_ake_send_hprime *rx_hprime); +int mei_store_pairing_info (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_send_pairing_info *pairing_info);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -155,5 +158,12 @@ int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, {return -ENODEV ; } +static inline +int mei_store_pairing_info (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_ake_send_pairing_info *pairing_info) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 12/41 misc/mei/hdcp: Initiate Locality check
In reply to Ramalingam CRequests ME to start the second stage of HDCP2.2 authentication, called Locality Check.
On Success, ME FW will provide LC_Init message to send to hdcp sink.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd used for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 57 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 10 +++++++ 2 files changed, 67 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +57 -0
@@ -308,6 +308,63 @@ int mei_store_pairing_info(struct mei_cl_device *cldev, }EXPORT_SYMBOL (mei_store_pairing_info); +/* +* mei_initiate_locality_check: +* Function to prepare LC_Init. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* hdcp2_lc_init : Pointer for storing LC_Init +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_initiate_locality_check (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_lc_init *lc_init_data) +{ +struct wired_cmd_init_locality_check_in lc_init_in = { {0 } }; +struct wired_cmd_init_locality_check_out lc_init_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !lc_init_data) +return -EINVAL ; + + dev = &cldev->dev; + + lc_init_in.header.api_version =HDCP_API_VERSION ; + lc_init_in.header.command_id =WIRED_INIT_LOCALITY_CHECK ; + lc_init_in.header.status =ME_HDCP_STATUS_SUCCESS ; + lc_init_in.header.buffer_len =WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN ; + + lc_init_in.port.integrated_port_type = data->port_type; + lc_init_in.port.physical_port = data->port; + + byte =mei_cldev_send (cldev, (u8 *)&lc_init_in,sizeof (lc_init_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&lc_init_out,sizeof (lc_init_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (lc_init_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X Failed. status: 0x%X\n" , +WIRED_INIT_LOCALITY_CHECK , lc_init_out.header.status); +return -EIO ; + } + + lc_init_data->msg_id =HDCP_2_2_LC_INIT ; +memcpy (lc_init_data->r_n, lc_init_out.r_n,HDCP_2_2_RN_LEN ); + +return 0 ; +} +EXPORT_SYMBOL (mei_initiate_locality_check); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +10 -0
@@ -122,6 +122,9 @@ int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data,int mei_store_pairing_info (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_ake_send_pairing_info *pairing_info); +int mei_initiate_locality_check (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_lc_init *lc_init_data);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -165,5 +168,12 @@ int mei_store_pairing_info(struct mei_cl_device *cldev, {return -ENODEV ; } +static inline +int mei_initiate_locality_check (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_lc_init *lc_init_data) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 13/41 misc/mei/hdcp: Verify L_prime
In reply to Ramalingam CRequest to ME to verify the LPrime received from HDCP sink.
On Success, ME FW will verify the received Lprime by calculating and comparing with L.
This represents the completion of Locality Check.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 60 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 8 ++++++ 2 files changed, 68 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +60 -0
@@ -365,6 +365,66 @@ int mei_initiate_locality_check(struct mei_cl_device *cldev, }EXPORT_SYMBOL (mei_initiate_locality_check); +/* +* mei_verify_lprime: +* Function to verify lprime. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* rx_lprime : Pointer for LC_Send_L_prime +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_verify_lprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_lc_send_lprime *rx_lprime) +{ +struct wired_cmd_validate_locality_in verify_lprime_in = { {0 } }; +struct wired_cmd_validate_locality_out verify_lprime_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !rx_lprime) +return -EINVAL ; + + dev = &cldev->dev; + + verify_lprime_in.header.api_version =HDCP_API_VERSION ; + verify_lprime_in.header.command_id =WIRED_VALIDATE_LOCALITY ; + verify_lprime_in.header.status =ME_HDCP_STATUS_SUCCESS ; + verify_lprime_in.header.buffer_len = +WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN ; + + verify_lprime_in.port.integrated_port_type = data->port_type; + verify_lprime_in.port.physical_port = data->port; + +memcpy (verify_lprime_in.l_prime, rx_lprime->l_prime, +sizeof (rx_lprime->l_prime)); + + byte =mei_cldev_send (cldev, (u8 *)&verify_lprime_in, +sizeof (verify_lprime_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&verify_lprime_out, +sizeof (verify_lprime_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (verify_lprime_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X failed. status: 0x%X\n" , +WIRED_VALIDATE_LOCALITY , + verify_lprime_out.header.status); +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (mei_verify_lprime); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +8 -0
@@ -125,6 +125,8 @@ int mei_store_pairing_info(struct mei_cl_device *cldev,int mei_initiate_locality_check (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_lc_init *lc_init_data); +int mei_verify_lprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_lc_send_lprime *rx_lprime);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -175,5 +177,11 @@ int mei_initiate_locality_check(struct mei_cl_device *cldev, {return -ENODEV ; } +static inline +int mei_verify_lprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_lc_send_lprime *rx_lprime) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 14/41 misc/mei/hdcp: Prepare Session Key
In reply to Ramalingam CRequest to ME to prepare the encrypted session key.
On Success, ME provides Encrypted session key. Function populates the HDCP2.2 authentication msg SKE_Send_Eks.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 59 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 8 ++++++ 2 files changed, 67 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +59 -0
@@ -425,6 +425,65 @@ int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, }EXPORT_SYMBOL (mei_verify_lprime); +/* +* mei_get_session_key: +* Function to prepare SKE_Send_Eks. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* ske_data : Pointer for SKE_Send_Eks. +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_get_session_key (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_ske_send_eks *ske_data) +{ +struct wired_cmd_get_session_key_in get_skey_in = { {0 } }; +struct wired_cmd_get_session_key_out get_skey_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data || !ske_data) +return -EINVAL ; + + dev = &cldev->dev; + + get_skey_in.header.api_version =HDCP_API_VERSION ; + get_skey_in.header.command_id =WIRED_GET_SESSION_KEY ; + get_skey_in.header.status =ME_HDCP_STATUS_SUCCESS ; + get_skey_in.header.buffer_len =WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN ; + + get_skey_in.port.integrated_port_type = data->port_type; + get_skey_in.port.physical_port = data->port; + + byte =mei_cldev_send (cldev, (u8 *)&get_skey_in,sizeof (get_skey_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&get_skey_out,sizeof (get_skey_out)); + +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (get_skey_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X failed. status: 0x%X\n" , +WIRED_GET_SESSION_KEY , get_skey_out.header.status); +return -EIO ; + } + + ske_data->msg_id =HDCP_2_2_SKE_SEND_EKS ; +memcpy (ske_data->e_dkey_ks, get_skey_out.e_dkey_ks, +HDCP_2_2_E_DKEY_KS_LEN ); +memcpy (ske_data->riv, get_skey_out.r_iv,HDCP_2_2_RIV_LEN ); + +return 0 ; +} +EXPORT_SYMBOL (mei_get_session_key); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +8 -0
@@ -127,6 +127,8 @@ int mei_initiate_locality_check(struct mei_cl_device *cldev, struct hdcp2_lc_init *lc_init_data);int mei_verify_lprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_lc_send_lprime *rx_lprime); +int mei_get_session_key (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_ske_send_eks *ske_data);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -183,5 +185,11 @@ int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, {return -ENODEV ; } +static inline +int mei_get_session_key (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_ske_send_eks *ske_data) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 15/41 misc/mei/hdcp: Repeater topology verification and ack
In reply to Ramalingam CRequest ME to verify the downstream topology information received.
ME FW will validate the Repeaters receiver id list and downstream topology.
On Success ME FW will provide the Least Significant 128bits of VPrime, which forms the repeater ack.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style and typos fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 75 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 15 ++++++++ 2 files changed, 90 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +75 -0
@@ -484,6 +484,81 @@ int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, }EXPORT_SYMBOL (mei_get_session_key); +/* +* mei_repeater_check_flow_prepare_ack: +* Function to validate the Downstream topology and prepare rep_ack. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* rep_topology : Pointer for Receiver Id List to be validated. +* rep_send_ack : Pointer for repeater ack +* +* Returns 0 on Success, <0 on Failure +*/ +int +mei_repeater_check_flow_prepare_ack (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_rep_send_receiverid_list + *rep_topology, +struct hdcp2_rep_send_ack *rep_send_ack) +{ +struct wired_cmd_verify_repeater_in verify_repeater_in = { {0 } }; +struct wired_cmd_verify_repeater_out verify_repeater_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!rep_topology || !rep_send_ack || !data) +return -EINVAL ; + + dev = &cldev->dev; + + verify_repeater_in.header.api_version =HDCP_API_VERSION ; + verify_repeater_in.header.command_id =WIRED_VERIFY_REPEATER ; + verify_repeater_in.header.status =ME_HDCP_STATUS_SUCCESS ; + verify_repeater_in.header.buffer_len = +WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN ; + + verify_repeater_in.port.integrated_port_type = data->port_type; + verify_repeater_in.port.physical_port = data->port; + +memcpy (verify_repeater_in.rx_info, rep_topology->rx_info, +HDCP_2_2_RXINFO_LEN ); +memcpy (verify_repeater_in.seq_num_v, rep_topology->seq_num_v, +HDCP_2_2_SEQ_NUM_LEN ); +memcpy (verify_repeater_in.v_prime, rep_topology->v_prime, +HDCP_2_2_LPRIME_HALF_LEN ); +memcpy (verify_repeater_in.receiver_ids, rep_topology->receiver_ids, +HDCP_2_2_RECEIVER_IDS_MAX_LEN ); + + byte =mei_cldev_send (cldev, (u8 *)&verify_repeater_in, +sizeof (verify_repeater_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&verify_repeater_out, +sizeof (verify_repeater_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (verify_repeater_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X failed. status: 0x%X\n" , +WIRED_VERIFY_REPEATER , + verify_repeater_out.header.status); +return -EIO ; + } + +memcpy (rep_send_ack->v, verify_repeater_out.v, +HDCP_2_2_LPRIME_HALF_LEN ); + rep_send_ack->msg_id =HDCP_2_2_REP_SEND_ACK ; + +return 0 ; +} +EXPORT_SYMBOL (mei_repeater_check_flow_prepare_ack); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +15 -0
@@ -129,6 +129,12 @@ int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_lc_send_lprime *rx_lprime);int mei_get_session_key (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_ske_send_eks *ske_data); +int +mei_repeater_check_flow_prepare_ack (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_rep_send_receiverid_list + *rep_topology, +struct hdcp2_rep_send_ack *rep_send_ack);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -191,5 +197,14 @@ int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, {return -ENODEV ; } +static inline int +mei_repeater_check_flow_prepare_ack (struct mei_cl_device *cldev, +struct mei_hdcp_data *data, +struct hdcp2_rep_send_receiverid_list + *rep_topology, +struct hdcp2_rep_send_ack *rep_send_ack) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 16/41 misc/mei/hdcp: Verify M_prime
In reply to Ramalingam CRequest to ME to verify the M_Prime received from the HDCP sink.
ME FW will calculate the M and compare with M_prime received as part of RepeaterAuth_Stream_Ready, which is HDCP2.2 protocol msg.
On successful completion of this stage, downstream propagation of the stream management info is completed.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander] endianness conversion func is moved to drm_hdcp.h [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 68 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_hdcp.h | 15 +++++++++ include/linux/mei_hdcp.h | 8 +++++ 3 files changed, 91 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +68 -0
@@ -559,6 +559,74 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, }EXPORT_SYMBOL (mei_repeater_check_flow_prepare_ack); +/* +* mei_verify_mprime: +* Function to verify mprime. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* stream_ready : pointer for RepeaterAuth_Stream_Ready message. +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_verify_mprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_rep_stream_ready *stream_ready) +{ +struct wired_cmd_repeater_auth_stream_req_in + verify_mprime_in = { {0 } }; +struct wired_cmd_repeater_auth_stream_req_out + verify_mprime_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!stream_ready || !data) +return -EINVAL ; + + dev = &cldev->dev; + + verify_mprime_in.header.api_version =HDCP_API_VERSION ; + verify_mprime_in.header.command_id =WIRED_REPEATER_AUTH_STREAM_REQ ; + verify_mprime_in.header.status =ME_HDCP_STATUS_SUCCESS ; + verify_mprime_in.header.buffer_len = +WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN ; + + verify_mprime_in.port.integrated_port_type = data->port_type; + verify_mprime_in.port.physical_port = data->port; + +memcpy (verify_mprime_in.m_prime, stream_ready->m_prime, +HDCP_2_2_MPRIME_LEN ); +reverse_endianness ((u8 *)&verify_mprime_in.seq_num_m, +HDCP_2_2_SEQ_NUM_LEN , (u8 *)&data->seq_num_m); +memcpy (verify_mprime_in.streams, data->streams, + (data->k *sizeof (struct hdcp2_streamid_type ))); + + verify_mprime_in.k =__swab16 (data->k); + + byte =mei_cldev_send (cldev, (u8 *)&verify_mprime_in, +sizeof (verify_mprime_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&verify_mprime_out, +sizeof (verify_mprime_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (verify_mprime_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X failed. status: 0x%X\n" , +WIRED_REPEATER_AUTH_STREAM_REQ , + verify_mprime_out.header.status); +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (mei_verify_mprime); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/drm/drm_hdcp.h +15 -0
@@ -247,4 +247,19 @@ struct hdcp2_dp_errata_stream_type {#define HDCP_2_2_HDMI_RXSTATUS_READY (x) (x & BIT(2))#define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ (x) (x & BIT(3)) +/* +* Library functions for endianness are aligned for 16/32/64 bits. +* But hdcp sequence numbers are 24bits. So for their Byte swapping, +* a conversion function is developed. +*/ +static inline void reverse_endianness (u8 *dest,size_t sz,u8 *src) +{ +u32 index; + +if (!sz || sz >sizeof (u32)) +return ; +for (index =0 ; index < sz; index++) + dest[sz - index -1 ] = src[index]; +} +#endif
include/linux/mei_hdcp.h +8 -0
@@ -135,6 +135,8 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev,struct hdcp2_rep_send_receiverid_list *rep_topology, struct hdcp2_rep_send_ack *rep_send_ack); +int mei_verify_mprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_rep_stream_ready *stream_ready);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -206,5 +208,11 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, {return -ENODEV ; } +static inline +int mei_verify_mprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data, +struct hdcp2_rep_stream_ready *stream_ready) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 17/41 misc/mei/hdcp: Enabling the HDCP authentication
In reply to Ramalingam CRequest to ME to configure a port as authenticated.
On Success, ME FW will mark the port as authenticated and provides HDCP cipher with the encryption keys.
Enabling the Authentication can be requested once all stages of HDCP2.2 authentication is completed by interacting with ME FW.
Only after this stage, driver can enable the HDCP encryption for the port, through HW registers.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style and typos fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 55 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 7 +++++ 2 files changed, 62 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +55 -0
@@ -627,6 +627,61 @@ int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, }EXPORT_SYMBOL (mei_verify_mprime); +/* +* mei_enable_hdcp_authentication: +* Function to request ME FW to mark a port as authenticated. +* +* cldev : Pointer for mei client device +* data : Intel HW specific Data +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_enable_hdcp_authentication (struct mei_cl_device *cldev, +struct mei_hdcp_data *data) +{ +struct wired_cmd_enable_auth_in enable_auth_in = { {0 } }; +struct wired_cmd_enable_auth_out enable_auth_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data) +return -EINVAL ; + + dev = &cldev->dev; + + enable_auth_in.header.api_version =HDCP_API_VERSION ; + enable_auth_in.header.command_id =WIRED_ENABLE_AUTH ; + enable_auth_in.header.status =ME_HDCP_STATUS_SUCCESS ; + enable_auth_in.header.buffer_len =WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN ; + + enable_auth_in.port.integrated_port_type = data->port_type; + enable_auth_in.port.physical_port = data->port; + enable_auth_in.stream_type = data->streams[0 ].stream_type; + + byte =mei_cldev_send (cldev, (u8 *)&enable_auth_in, +sizeof (enable_auth_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&enable_auth_out, +sizeof (enable_auth_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (enable_auth_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"ME cmd 0x%08X failed. status: 0x%X\n" , +WIRED_ENABLE_AUTH , enable_auth_out.header.status); +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (mei_enable_hdcp_authentication); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +7 -0
@@ -137,6 +137,8 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, struct hdcp2_rep_send_ack *rep_send_ack);int mei_verify_mprime (struct mei_cl_device *cldev,struct mei_hdcp_data *data,struct hdcp2_rep_stream_ready *stream_ready); +int mei_enable_hdcp_authentication (struct mei_cl_device *cldev, +struct mei_hdcp_data *data);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -214,5 +216,10 @@ int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, {return -ENODEV ; } +static inline int mei_enable_hdcp_authentication (struct mei_cl_device *cldev, +struct mei_hdcp_data *data) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 18/41 misc/mei/hdcp: Closing wired HDCP2.2 Tx Session
In reply to Ramalingam CRequest the ME to terminate the HDCP2.2 session for a port.
On Success, ME FW will mark the intel port as Deauthenticated and terminate the wired HDCP2.2 Tx session started due to the cmd WIRED_INITIATE_HDCP2_SESSION.
v2:
Rebased.
v3:
cldev is passed as first parameter [Tomas]
Redundant comments and cast are removed [Tomas]
v4:
%zd for ssize_t [Alexander]
%s/return -1/return -EIO [Alexander]
Style and typos fixed [Uma]
--- drivers/misc/mei/hdcp/mei_hdcp.c | 56 ++++++++++++++++++++++++++++++++++++++++ include/linux/mei_hdcp.h | 7 +++++ 2 files changed, 63 insertions(+)
drivers/misc/mei/hdcp/mei_hdcp.c +56 -0
@@ -682,6 +682,62 @@ int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, }EXPORT_SYMBOL (mei_enable_hdcp_authentication); +/* +* mei_close_hdcp_session: +* Function to close the Wired HDCP Tx session of ME FW. +* This also disables the authenticated state of the port. +* +* data : Intel HW specific Data +* +* Returns 0 on Success, <0 on Failure +*/ +int mei_close_hdcp_session (struct mei_cl_device *cldev, +struct mei_hdcp_data *data) +{ +struct wired_cmd_close_session_in session_close_in = { {0 } }; +struct wired_cmd_close_session_out session_close_out = { {0 } }; +struct device *dev; +ssize_t byte; + +if (!data) +return -EINVAL ; + + dev = &cldev->dev; + + session_close_in.header.api_version =HDCP_API_VERSION ; + session_close_in.header.command_id =WIRED_CLOSE_SESSION ; + session_close_in.header.status =ME_HDCP_STATUS_SUCCESS ; + session_close_in.header.buffer_len = +WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN ; + + session_close_in.port.integrated_port_type = data->port_type; + session_close_in.port.physical_port = data->port; + + + byte =mei_cldev_send (cldev, (u8 *)&session_close_in, +sizeof (session_close_in)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_send failed. %zd\n" , byte); +return byte; + } + + byte =mei_cldev_recv (cldev, (u8 *)&session_close_out, +sizeof (session_close_out)); +if (byte <0 ) { +dev_dbg (dev,"mei_cldev_recv failed. %zd\n" , byte); +return byte; + } + +if (session_close_out.header.status !=ME_HDCP_STATUS_SUCCESS ) { +dev_dbg (dev,"Session Close Failed. status: 0x%X\n" , + session_close_out.header.status); +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (mei_close_hdcp_session); +static void mei_cldev_state_notify_clients (struct mei_cl_device *cldev,bool enabled) {
include/linux/mei_hdcp.h +7 -0
@@ -139,6 +139,8 @@ int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_rep_stream_ready *stream_ready);int mei_enable_hdcp_authentication (struct mei_cl_device *cldev,struct mei_hdcp_data *data); +int mei_close_hdcp_session (struct mei_cl_device *cldev, +struct mei_hdcp_data *data);#else static inline int mei_cldev_register_notify (struct notifier_block *nb) {
@@ -221,5 +223,10 @@ static inline int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, {return -ENODEV ; } +static inline int mei_close_hdcp_session (struct mei_cl_device *cldev, +struct mei_hdcp_data *data) +{ +return -ENODEV ; +}#endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 19/41 drm/i915: wrapping all hdcp var into intel_hdcp
In reply to Ramalingam CConsidering significant number of HDCP specific variables, it will be clean to have separate struct for HDCP.
New structure called intel_hdcp is added within intel_connector.
v2:
struct hdcp statically allocated. [Sean Paul]
enable and disable function parameters are retained.[Sean Paul]
v3:
No Changes.
v4:
Commit msg is rephrased [Uma]
--- drivers/gpu/drm/i915/intel_display.c | 7 +-- drivers/gpu/drm/i915/intel_drv.h | 14 ++++-- drivers/gpu/drm/i915/intel_hdcp.c | 94 ++++++++++++++++++++---------------- 3 files changed, 66 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -3
@@ -15499,9 +15499,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); +if (connector->hdcp.hdcp_shim) { +cancel_delayed_work_sync ( + &connector->hdcp.hdcp_check_work); +cancel_work_sync (&connector->hdcp.hdcp_prop_work); } }drm_connector_list_iter_end (&conn_iter);
drivers/gpu/drm/i915/intel_drv.h +9 -5
@@ -377,6 +377,14 @@ struct intel_hdcp_shim { bool *hdcp_capable); }; +struct intel_hdcp { +const struct intel_hdcp_shim *hdcp_shim; +struct mutex hdcp_mutex; +uint64_t hdcp_value;/* protected by hdcp_mutex */ +struct delayed_work hdcp_check_work; +struct work_struct hdcp_prop_work; +}; +struct intel_connector {struct drm_connector base;/*
@@ -409,11 +417,7 @@ struct intel_connector {/* Work struct to schedule a uevent on link train failure */ struct work_struct modeset_retry_work; -const struct intel_hdcp_shim *hdcp_shim; -struct mutex hdcp_mutex; -uint64_t hdcp_value;/* protected by hdcp_mutex */ -struct delayed_work hdcp_check_work; -struct work_struct hdcp_prop_work; +struct intel_hdcp hdcp; };struct intel_digital_connector_state {
drivers/gpu/drm/i915/intel_hdcp.c +53 -41
226 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 20/41 drm/i915: Define HDCP2.2 related variables
In reply to Ramalingam CFor upcoming implementation of HDCP2.2 in I915, important variable required for HDCP2.2 are defined.
HDCP_shim is extended to support encoder specific HDCP2.2 flows.
v2:
1.4 shim is extended to support hdcp2.2. [Sean Paul] platform's/panel's hdcp ver capability is removed. [Sean Paul] mei references in i915_private are moved to later patches. [Chris Wilson]
v3:
mei_cl_device ref is moved into intel_hdcp
v4:
Extra * in comment is removed [Uma]
--- drivers/gpu/drm/i915/intel_drv.h | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +61 -0
@@ -29,6 +29,7 @@#include <linux/i2c.h> #include <linux/hdmi.h> #include <linux/sched/clock.h> +#include <linux/mei_hdcp.h> #include <drm/i915_drm.h> #include "i915_drv.h" #include <drm/drm_crtc.h>
@@ -375,6 +376,32 @@ struct intel_hdcp_shim {/* Detects panel's hdcp capability. This is optional for HDMI. */ int (*hdcp_capable)(struct intel_digital_port *intel_dig_port,bool *hdcp_capable); + +/* Write HDCP2.2 messages */ +int (*write_2_2_msg)(struct intel_digital_port *intel_dig_port, +void *buf,size_t size); + +/* Read HDCP2.2 messages */ +int (*read_2_2_msg)(struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size); + +/* +* Implementation of DP HDCP2.2 Errata for the communication of stream +* type to Receivers. In DP HDCP2.2 Stream type is one of the input to +* the HDCP2.2 Chiper for En/De-Cryption. Not applicable for HDMI. +*/ +int (*config_stream_type)(struct intel_digital_port *intel_dig_port, +void *buf,size_t size); + +/* HDCP2.2 Link Integrity Check */ +int (*check_2_2_link)(struct intel_digital_port *intel_dig_port); + +/* Detects whether Panel is HDCP2.2 capable */ +int (*hdcp_2_2_capable)(struct intel_digital_port *intel_dig_port, +bool *capable); + +/* Detects the HDCP protocol(DP/HDMI) required on the port */ +enum hdcp_protocol (*hdcp_protocol)(void ); };struct intel_hdcp {
@@ -383,6 +410,40 @@ struct intel_hdcp {uint64_t hdcp_value;/* protected by hdcp_mutex */ struct delayed_work hdcp_check_work;struct work_struct hdcp_prop_work; + +/* HDCP2.2 related definitions */ +bool hdcp2_supported; + +/* +* Content Stream Type defined by content owner. TYPE0(0x0) content can +* flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1) +* content can flow only through a link protected by HDCP2.2. +*/ +u8 content_type; + +bool is_paired; +bool is_repeater; + +/* +* Count of ReceiverID_List received. Initialized to 0 at AKE_INIT. +* Incremented after processing the RepeaterAuth_Send_ReceiverID_List. +* When it rolls over re-auth has to be triggered. +*/ +uint32_t seq_num_v; + +/* +* Count of RepeaterAuth_Stream_Manage msg propagated. +* Initialized to 0 on AKE_INIT. Incremented after every successful +* transmission of RepeaterAuth_Stream_Manage message. When it rolls +* over re-Auth has to be triggered. +*/ +uint32_t seq_num_m; + +/* mei interface related information */ +struct mei_cl_device *cldev; +struct mei_hdcp_data mei_data; + +struct delayed_work hdcp2_check_work; };struct intel_connector {
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 21/41 drm/i915: Define Intel HDCP2.2 registers
In reply to Ramalingam CIntel HDCP2.2 registers are defined with addr offsets and bit details.
v2:
Replaced the arith calc with _PICK [Sean Paul]
v3:
No changes.
v4:
%s/HDCP2_CTR_DDI/HDCP2_CTL_DDI [Uma]
--- drivers/gpu/drm/i915/i915_reg.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +32 -0
@@ -8539,6 +8539,38 @@ enum skl_power_gate {#define HDCP_STATUS_CIPHER BIT(16)#define HDCP_STATUS_FRAME_CNT (x) ((x >> 8) & 0xff) +/* HDCP2.2 Registers */ +#define _PORTA_HDCP2_BASE 0x66800 +#define _PORTB_HDCP2_BASE 0x66500 +#define _PORTC_HDCP2_BASE 0x66600 +#define _PORTD_HDCP2_BASE 0x66700 +#define _PORTE_HDCP2_BASE 0x66A00 +#define _PORTF_HDCP2_BASE 0x66900 +#define _PORT_HDCP2_BASE (port, x) _MMIO(_PICK(port, \ + _PORTA_HDCP2_BASE, \ + _PORTB_HDCP2_BASE, \ + _PORTC_HDCP2_BASE, \ + _PORTD_HDCP2_BASE, \ + _PORTE_HDCP2_BASE, \ + _PORTF_HDCP2_BASE) + x) + +#define HDCP2_AUTH_DDI (port) _PORT_HDCP2_BASE(port, 0x98) +#define AUTH_LINK_AUTHENTICATED BIT(31) +#define AUTH_LINK_TYPE BIT(30) +#define AUTH_FORCE_CLR_INPUTCTR BIT(19) +#define AUTH_CLR_KEYS BIT(18) + +#define HDCP2_CTL_DDI (port) _PORT_HDCP2_BASE(port, 0xB0) +#define CTL_LINK_ENCRYPTION_REQ BIT(31) + +#define HDCP2_STATUS_DDI (port) _PORT_HDCP2_BASE(port, 0xB4) +#define STREAM_ENCRYPTION_STATUS_A BIT(31) +#define STREAM_ENCRYPTION_STATUS_B BIT(30) +#define STREAM_ENCRYPTION_STATUS_C BIT(29) +#define LINK_TYPE_STATUS BIT(22) +#define LINK_AUTH_STATUS BIT(21) +#define LINK_ENCRYPTION_STATUS BIT(20) +/* Per-pipe DDI Function Control */ #define _TRANS_DDI_FUNC_CTL_A 0x60400#define _TRANS_DDI_FUNC_CTL_B 0x61400
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 22/41 drm/i915: Wrappers for mei HDCP2.2 services
In reply to Ramalingam CAdds the wrapper for all mei hdcp2.2 service functions.
v2:
Rebased.
v3:
cldev is moved from mei_hdcp_data to hdcp.
v4:
%s/hdcp2_store_paring_info/hdcp2_store_pairing_info
--- drivers/gpu/drm/i915/intel_hdcp.c | 194 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+)
drivers/gpu/drm/i915/intel_hdcp.c +194 -0
@@ -10,10 +10,13 @@#include <drm/drm_hdcp.h> #include <linux/i2c.h> #include <linux/random.h> +#include <linux/mei_hdcp.h> #include "intel_drv.h" #include "i915_reg.h" +#define GET_MEI_DDI_INDEX (port) (((port) == PORT_A) ? DDI_A : \ + (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
@@ -896,3 +899,194 @@ int intel_hdcp_check_link(struct intel_connector *connector)mutex_unlock (&hdcp->hdcp_mutex);return ret; } + +static int +hdcp2_prepare_ake_init (struct intel_hdcp *hdcp,struct hdcp2_ake_init *ake_data) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +struct intel_connector *connector =container_of (hdcp, + struct intel_connector, + hdcp); + +if (!hdcp->cldev) +return -EINVAL ; + +if (data->port ==INVALID_PORT && connector->encoder) + data->port =GET_MEI_DDI_INDEX (connector->encoder->port); + +/* Clear ME FW instance for the port, just incase */ +mei_close_hdcp_session (hdcp->cldev, data); + +return mei_initiate_hdcp2_session (hdcp->cldev, data, ake_data); +} + +static int hdcp2_close_mei_session (struct intel_hdcp *hdcp) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; + +if (!hdcp->cldev || data->port ==INVALID_PORT ) +return -EINVAL ; + +return mei_close_hdcp_session (hdcp->cldev, data); +} + +static int +hdcp2_verify_rx_cert_prepare_km (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_cert *rx_cert, +bool *paired, +struct hdcp2_ake_no_stored_km *ek_pub_km, +size_t *msg_sz) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_receiver_cert_prepare_km (hdcp->cldev, data, rx_cert, + paired, ek_pub_km, msg_sz); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int hdcp2_verify_hprime (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_hprime *rx_hprime) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_hprime (hdcp->cldev, data, rx_hprime); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_store_pairing_info (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_pairing_info *pairing_info) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_store_pairing_info (hdcp->cldev, data, pairing_info); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_prepare_lc_init (struct intel_hdcp *hdcp,struct hdcp2_lc_init *lc_init) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_initiate_locality_check (hdcp->cldev, data, lc_init); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_lprime (struct intel_hdcp *hdcp, +struct hdcp2_lc_send_lprime *rx_lprime) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_lprime (hdcp->cldev, data, rx_lprime); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int hdcp2_prepare_skey (struct intel_hdcp *hdcp, +struct hdcp2_ske_send_eks *ske_data) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_get_session_key (hdcp->cldev, data, ske_data); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_rep_topology_prepare_ack ( +struct intel_hdcp *hdcp, +struct hdcp2_rep_send_receiverid_list *rep_topology, +struct hdcp2_rep_send_ack *rep_send_ack) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_repeater_check_flow_prepare_ack (hdcp->cldev, data, + rep_topology, rep_send_ack); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_mprime (struct intel_hdcp *hdcp, +struct hdcp2_rep_stream_ready *stream_ready) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_mprime (hdcp->cldev, data, stream_ready); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + + +static int hdcp2_authenticate_port (struct intel_hdcp *hdcp) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_enable_hdcp_authentication (hdcp->cldev, data); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static inline int hdcp2_deauthenticate_port (struct intel_hdcp *hdcp) +{ +return hdcp2_close_mei_session (hdcp); +}
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 22/41] drm/i915: Wrappers for mei HDCP2.2 services
Quoted 10 lines · Ramalingam C
Adds the wrapper for all mei hdcp2.2 service functions.
v2:
Rebased.
v3:
cldev is moved frommei_hdcp_datato hdcp.
v4:
%s/hdcp2_store_paring_info/hdcp2_store_pairing_infoSigned-off-by Ramalingam C <[email protected]>
This is a bit a style nit, but I'm not convinced of the value of these wrappers. They just do basic sanity checking (and with the component stuff, cldev should never be NULL before we get here), and those checks that are still needed could be done just once when we start a hdcp2 operation.
Personally I'd drop these all and directly call the mei_ functions in the later patches (plus put just 1 set of the sanity checks at the beginning of a hdcp flow). More direct code is generally easier to read later on. -Daniel
Quoted 220 lines
--- drivers/gpu/drm/i915/intel_hdcp.c | 194 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+)drivers/gpu/drm/i915/intel_hdcp.c +194
-0@@ -10,10 +10,13 @@#include <drm/drm_hdcp.h> #include <linux/i2c.h> #include <linux/random.h> +#include <linux/mei_hdcp.h> #include "intel_drv.h" #include "i915_reg.h" +#define GET_MEI_DDI_INDEX (port) (((port) == PORT_A) ? DDI_A : \ + (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,@@ -896,3 +899,194 @@ int intel_hdcp_check_link(struct intel_connector *connector)mutex_unlock (&hdcp->hdcp_mutex);return ret; } + +static int +hdcp2_prepare_ake_init (struct intel_hdcp *hdcp,struct hdcp2_ake_init *ake_data) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +struct intel_connector *connector =container_of (hdcp, + struct intel_connector, + hdcp); + +if (!hdcp->cldev) +return -EINVAL ; + +if (data->port ==INVALID_PORT && connector->encoder) + data->port =GET_MEI_DDI_INDEX (connector->encoder->port); + +/* Clear ME FW instance for the port, just incase */ +mei_close_hdcp_session (hdcp->cldev, data); + +return mei_initiate_hdcp2_session (hdcp->cldev, data, ake_data); +} + +static int hdcp2_close_mei_session (struct intel_hdcp *hdcp) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; + +if (!hdcp->cldev || data->port ==INVALID_PORT ) +return -EINVAL ; + +return mei_close_hdcp_session (hdcp->cldev, data); +} + +static int +hdcp2_verify_rx_cert_prepare_km (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_cert *rx_cert, +bool *paired, +struct hdcp2_ake_no_stored_km *ek_pub_km, +size_t *msg_sz) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_receiver_cert_prepare_km (hdcp->cldev, data, rx_cert, + paired, ek_pub_km, msg_sz); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int hdcp2_verify_hprime (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_hprime *rx_hprime) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_hprime (hdcp->cldev, data, rx_hprime); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_store_pairing_info (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_pairing_info *pairing_info) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_store_pairing_info (hdcp->cldev, data, pairing_info); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_prepare_lc_init (struct intel_hdcp *hdcp,struct hdcp2_lc_init *lc_init) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_initiate_locality_check (hdcp->cldev, data, lc_init); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_lprime (struct intel_hdcp *hdcp, +struct hdcp2_lc_send_lprime *rx_lprime) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_lprime (hdcp->cldev, data, rx_lprime); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int hdcp2_prepare_skey (struct intel_hdcp *hdcp, +struct hdcp2_ske_send_eks *ske_data) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_get_session_key (hdcp->cldev, data, ske_data); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_rep_topology_prepare_ack ( +struct intel_hdcp *hdcp, +struct hdcp2_rep_send_receiverid_list *rep_topology, +struct hdcp2_rep_send_ack *rep_send_ack) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_repeater_check_flow_prepare_ack (hdcp->cldev, data, + rep_topology, rep_send_ack); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_mprime (struct intel_hdcp *hdcp, +struct hdcp2_rep_stream_ready *stream_ready) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_mprime (hdcp->cldev, data, stream_ready); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + + +static int hdcp2_authenticate_port (struct intel_hdcp *hdcp) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_enable_hdcp_authentication (hdcp->cldev, data); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static inline int hdcp2_deauthenticate_port (struct intel_hdcp *hdcp) +{ +return hdcp2_close_mei_session (hdcp); +}Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 22/41] drm/i915: Wrappers for mei HDCP2.2 services
Quoted 17 lines · Daniel Vetter
Quoted 10 lines · Ramalingam C
Adds the wrapper for all mei hdcp2.2 service functions.
v2:
Rebased.
v3:
cldev is moved frommei_hdcp_datato hdcp.
v4:
%s/hdcp2_store_paring_info/hdcp2_store_pairing_infoSigned-off-by Ramalingam C <[email protected]>This is a bit a style nit, but I'm not convinced of the value of these wrappers. They just do basic sanity checking (and with the component stuff, cldev should never be NULL before we get here), and those checks that are still needed could be done just once when we start a hdcp2 operation.
Quoted 4 lines
Personally I'd drop these all and directly call the
mei_functions in the later patches (plus put just 1 set of the sanity checks at the beginning of a hdcp flow). More direct code is generally easier to read later on. -Daniel
Daniel,
lets say we allow dynamic component unbind on cldev removal, even then
we need to check whether component is binded/unbinded before making a call to the service functions. Or may be checking the function ptr will be sufficient!? Need to check though.
In that way small wrapper looks required my side. But yes, instead of all wrappers together, in v5 I am merging them into the consumers patches itself. Still if we feel wrappers are not required we could get away from it.
Thanks,
Ram
Quoted 213 lines
Quoted 213 lines
--- drivers/gpu/drm/i915/intel_hdcp.c | 194 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+)drivers/gpu/drm/i915/intel_hdcp.c +189
-0@@ -10,10 +10,13 @@#include <drm/drm_hdcp.h> #include <linux/i2c.h> #include <linux/random.h> +#include <linux/mei_hdcp.h> #include "intel_drv.h" #include "i915_reg.h" +#define GET_MEI_DDI_INDEX (port) (((port) == PORT_A) ? DDI_A : \ + (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,@@ -896,3 +899,194 @@ int intel_hdcp_check_link(struct intel_connector *connector)mutex_unlock (&hdcp->hdcp_mutex);return ret; } + +static int +hdcp2_prepare_ake_init (struct intel_hdcp *hdcp,struct hdcp2_ake_init *ake_data) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +struct intel_connector *connector =container_of (hdcp, + struct intel_connector, + hdcp); + +if (!hdcp->cldev) +return -EINVAL ; + +if (data->port ==INVALID_PORT && connector->encoder) + data->port =GET_MEI_DDI_INDEX (connector->encoder->port); + +/* Clear ME FW instance for the port, just incase */ +mei_close_hdcp_session (hdcp->cldev, data); + +return mei_initiate_hdcp2_session (hdcp->cldev, data, ake_data); +} + +static int hdcp2_close_mei_session (struct intel_hdcp *hdcp) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; + +if (!hdcp->cldev || data->port ==INVALID_PORT ) +return -EINVAL ; + +return mei_close_hdcp_session (hdcp->cldev, data); +} + +static int +hdcp2_verify_rx_cert_prepare_km (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_cert *rx_cert, +bool *paired, +struct hdcp2_ake_no_stored_km *ek_pub_km, +size_t *msg_sz) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_receiver_cert_prepare_km (hdcp->cldev, data, rx_cert, + paired, ek_pub_km, msg_sz); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int hdcp2_verify_hprime (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_hprime *rx_hprime) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_hprime (hdcp->cldev, data, rx_hprime); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_store_pairing_info (struct intel_hdcp *hdcp, +struct hdcp2_ake_send_pairing_info *pairing_info) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_store_pairing_info (hdcp->cldev, data, pairing_info); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_prepare_lc_init (struct intel_hdcp *hdcp,struct hdcp2_lc_init *lc_init) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_initiate_locality_check (hdcp->cldev, data, lc_init); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_lprime (struct intel_hdcp *hdcp, +struct hdcp2_lc_send_lprime *rx_lprime) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_lprime (hdcp->cldev, data, rx_lprime); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int hdcp2_prepare_skey (struct intel_hdcp *hdcp, +struct hdcp2_ske_send_eks *ske_data) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_get_session_key (hdcp->cldev, data, ske_data); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_rep_topology_prepare_ack ( +struct intel_hdcp *hdcp, +struct hdcp2_rep_send_receiverid_list *rep_topology, +struct hdcp2_rep_send_ack *rep_send_ack) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_repeater_check_flow_prepare_ack (hdcp->cldev, data, + rep_topology, rep_send_ack); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + +static int +hdcp2_verify_mprime (struct intel_hdcp *hdcp, +struct hdcp2_rep_stream_ready *stream_ready) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_verify_mprime (hdcp->cldev, data, stream_ready); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +} + + +static int hdcp2_authenticate_port (struct intel_hdcp *hdcp) +{ +struct mei_hdcp_data *data = &hdcp->mei_data; +int ret; + +if (!hdcp->cldev) +return -EINVAL ; + + ret =mei_enable_hdcp_authentication (hdcp->cldev, data); +if (ret <0 ) +mei_close_hdcp_session (hdcp->cldev, data); + +return ret; +}
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdcp.c +5
-0+ +static inline int hdcp2_deauthenticate_port (struct intel_hdcp *hdcp) +{ +return hdcp2_close_mei_session (hdcp); +}Signature · 1 line
2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 23/41 drm/i915: Implement HDCP2.2 receiver authentication
In reply to Ramalingam CImplements HDCP2.2 authentication for hdcp2.2 receivers, with following steps:
Authentication and Key exchange (AKE). Locality Check (LC).
Session Key Exchange(SKE).
DP Errata for stream type configuration for receivers.
At AKE, the HDCP Receiver’s public key certificate is verified by the HDCP Transmitter. A Master Key k m is exchanged.
At LC, the HDCP Transmitter enforces locality on the content by requiring that the Round Trip Time (RTT) between a pair of messages is not more than 20 ms.
At SKE, The HDCP Transmitter exchanges Session Key ks with the HDCP Receiver.
In DP HDCP2.2 encryption and decryption logics use the stream type as one of the parameter. So Before enabling the Encryption DP HDCP2.2 receiver needs to be communicated with stream type. This is added to spec as ERRATA.
This generic implementation is complete only with the hdcp2_shim defined.
v2:
Rebased.
v3:
No Changes.
v4:
%s/PARING/PAIRING
Coding style fixing [Uma]
--- drivers/gpu/drm/i915/intel_hdcp.c | 187 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+)
drivers/gpu/drm/i915/intel_hdcp.c +187 -0
@@ -18,6 +18,7 @@#define GET_MEI_DDI_INDEX (port) (((port) == PORT_A) ? DDI_A : \ (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5 +#define HDCP2_LC_RETRY_CNT 3static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)
@@ -1090,3 +1091,189 @@ static inline int hdcp2_deauthenticate_port(struct intel_hdcp *hdcp) {return hdcp2_close_mei_session (hdcp); } + +static int hdcp2_authentication_key_exchange (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +union { +struct hdcp2_ake_init ake_init; +struct hdcp2_ake_send_cert send_cert; +struct hdcp2_ake_no_stored_km no_stored_km; +struct hdcp2_ake_send_hprime send_hprime; +struct hdcp2_ake_send_pairing_info pairing_info; + } msgs; +const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; +size_t size; +int ret; + +/* Init for seq_num */ + hdcp->seq_num_v =0 ; + hdcp->seq_num_m =0 ; + + ret =hdcp2_prepare_ake_init (hdcp, &msgs.ake_init); +if (ret <0 ) +return ret; + + ret = shim->write_2_2_msg (intel_dig_port, &msgs.ake_init, +sizeof (msgs.ake_init)); +if (ret <0 ) +return ret; + + ret = shim->read_2_2_msg (intel_dig_port,HDCP_2_2_AKE_SEND_CERT , + &msgs.send_cert,sizeof (msgs.send_cert)); +if (ret <0 ) +return ret; + +if (msgs.send_cert.rx_caps[0 ] !=HDCP_2_2_RX_CAPS_VERSION_VAL ) +return -EINVAL ; + + hdcp->is_repeater =HDCP_2_2_RX_REPEATER (msgs.send_cert.rx_caps[2 ]); + +/* +* Here msgs.no_stored_km will hold msgs corresponding to the km +* stored also. +*/ + ret =hdcp2_verify_rx_cert_prepare_km (hdcp, &msgs.send_cert, + &hdcp->is_paired, + &msgs.no_stored_km, &size); +if (ret <0 ) +return ret; + + ret = shim->write_2_2_msg (intel_dig_port, &msgs.no_stored_km, size); +if (ret <0 ) +return ret; + + ret = shim->read_2_2_msg (intel_dig_port,HDCP_2_2_AKE_SEND_HPRIME , + &msgs.send_hprime,sizeof (msgs.send_hprime)); +if (ret <0 ) +return ret; + + ret =hdcp2_verify_hprime (hdcp, &msgs.send_hprime); +if (ret <0 ) +return ret; + +if (!hdcp->is_paired) { +/* Pairing is required */ + ret = shim->read_2_2_msg (intel_dig_port, +HDCP_2_2_AKE_SEND_PAIRING_INFO , + &msgs.pairing_info, +sizeof (msgs.pairing_info)); +if (ret <0 ) +return ret; + + ret =hdcp2_store_pairing_info (hdcp, &msgs.pairing_info); +if (ret <0 ) +return ret; + hdcp->is_paired = true; + } + +return 0 ; +} + +static int hdcp2_locality_check (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +union { +struct hdcp2_lc_init lc_init; +struct hdcp2_lc_send_lprime send_lprime; + } msgs; +const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; +int tries =HDCP2_LC_RETRY_CNT , ret, i; + +for (i =0 ; i < tries; i++) { + ret =hdcp2_prepare_lc_init (hdcp, &msgs.lc_init); +if (ret <0 ) +continue ; + + ret = shim->write_2_2_msg (intel_dig_port, &msgs.lc_init, +sizeof (msgs.lc_init)); +if (ret <0 ) +continue ; + + ret = shim->read_2_2_msg (intel_dig_port, +HDCP_2_2_LC_SEND_LPRIME , + &msgs.send_lprime, +sizeof (msgs.send_lprime)); +if (ret <0 ) +continue ; + + ret =hdcp2_verify_lprime (hdcp, &msgs.send_lprime); +if (!ret) +break ; + } + +return ret; +} + +static int hdcp2_session_key_exchange (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +struct hdcp2_ske_send_eks send_eks; +int ret; + + ret =hdcp2_prepare_skey (hdcp, &send_eks); +if (ret <0 ) +return ret; + + ret = hdcp->hdcp_shim->write_2_2_msg (intel_dig_port, &send_eks, +sizeof (send_eks)); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int hdcp2_authenticate_sink (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; +struct hdcp2_dp_errata_stream_type stream_type_msg; +int ret; + + ret =hdcp2_authentication_key_exchange (connector); +if (ret <0 ) { +DRM_DEBUG_KMS ("AKE Failed. Err : %d\n" , ret); +return ret; + } + + ret =hdcp2_locality_check (connector); +if (ret <0 ) { +DRM_DEBUG_KMS ("Locality Check failed. Err : %d\n" , ret); +return ret; + } + + ret =hdcp2_session_key_exchange (connector); +if (ret <0 ) { +DRM_DEBUG_KMS ("SKE Failed. Err : %d\n" , ret); +return ret; + } + +if (!hdcp->is_repeater && shim->config_stream_type) { + +/* +* Errata for DP: As Stream type is used for encryption, +* Receiver should be communicated with stream type for the +* decryption of the content. +* Repeater will be communicated with stream type as a +* part of it's auth later in time. +*/ + stream_type_msg.msg_id =HDCP_2_2_ERRATA_DP_STREAM_TYPE ; + stream_type_msg.stream_type = hdcp->content_type; + + ret = shim->config_stream_type (intel_dig_port, &stream_type_msg, +sizeof (stream_type_msg)); +if (ret <0 ) +return ret; + } + + hdcp->mei_data.streams[0 ].stream_type = hdcp->content_type; + ret =hdcp2_authenticate_port (hdcp); +if (ret <0 ) +return ret; + +return ret; +}
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 24/41 drm/i915: Implement HDCP2.2 repeater authentication
In reply to Ramalingam CImplements the HDCP2.2 repeaters authentication steps such as verifying the downstream topology and sending stream management information.
v2:
Rebased.
v3:
No Changes.
v4:
-EINVAL is returned for topology error and rollover scenario. Endianness conversion func from drm_hdcp.h is used [Uma]
--- drivers/gpu/drm/i915/intel_hdcp.c | 120 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+)
drivers/gpu/drm/i915/intel_hdcp.c +120 -0
@@ -1226,6 +1226,120 @@ static int hdcp2_session_key_exchange(struct intel_connector *connector)return 0 ; } +static +int hdcp2_propagate_stream_management_info (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +union { +struct hdcp2_rep_stream_manage stream_manage; +struct hdcp2_rep_stream_ready stream_ready; + } msgs; +const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; +int ret; + +/* Prepare RepeaterAuth_Stream_Manage msg */ + msgs.stream_manage.msg_id =HDCP_2_2_REP_STREAM_MANAGE ; +reverse_endianness (msgs.stream_manage.seq_num_m,HDCP_2_2_SEQ_NUM_LEN , + (u8 *)&hdcp->seq_num_m); + +/* K no of streams is fixed as 1. Stored as big-endian. */ + msgs.stream_manage.k =__swab16 (1 ); + +/* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */ + msgs.stream_manage.streams[0 ].stream_id =0 ; + msgs.stream_manage.streams[0 ].stream_type = hdcp->content_type; + +/* Send it to Repeater */ + ret = shim->write_2_2_msg (intel_dig_port, &msgs.stream_manage, +sizeof (msgs.stream_manage)); +if (ret <0 ) +return ret; + + ret = shim->read_2_2_msg (intel_dig_port,HDCP_2_2_REP_STREAM_READY , + &msgs.stream_ready,sizeof (msgs.stream_ready)); +if (ret <0 ) +return ret; + + hdcp->mei_data.seq_num_m = hdcp->seq_num_m; + hdcp->mei_data.streams[0 ].stream_type = hdcp->content_type; + + ret =hdcp2_verify_mprime (hdcp, &msgs.stream_ready); +if (ret <0 ) +return ret; + + hdcp->seq_num_m++; + +if (hdcp->seq_num_m >HDCP_2_2_SEQ_NUM_MAX ) { +DRM_DEBUG_KMS ("seq_num_m roll over.\n" ); +return -1 ; + } + +return 0 ; +} + +static +int hdcp2_authenticate_repeater_topology (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +union { +struct hdcp2_rep_send_receiverid_list recvid_list; +struct hdcp2_rep_send_ack rep_ack; + } msgs; +const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; +uint8_t *rx_info; +uint32_t seq_num_v; +int ret; + + ret = shim->read_2_2_msg (intel_dig_port,HDCP_2_2_REP_SEND_RECVID_LIST , + &msgs.recvid_list,sizeof (msgs.recvid_list)); +if (ret <0 ) +return ret; + + rx_info = msgs.recvid_list.rx_info; + +if (HDCP_2_2_MAX_CASCADE_EXCEEDED (rx_info[1 ]) || +HDCP_2_2_MAX_DEVS_EXCEEDED (rx_info[1 ])) { +DRM_DEBUG_KMS ("Topology Max Size Exceeded\n" ); +return -EINVAL ; + } + +/* Converting and Storing the seq_num_v to local variable as DWORD */ +reverse_endianness ((u8 *)&seq_num_v,HDCP_2_2_SEQ_NUM_LEN , + msgs.recvid_list.seq_num_v); + +if (seq_num_v < hdcp->seq_num_v) { +/* Roll over of the seq_num_v from repeater. Reauthenticate. */ +DRM_DEBUG_KMS ("Seq_num_v roll over.\n" ); +return -EINVAL ; + } + + ret =hdcp2_verify_rep_topology_prepare_ack (hdcp, &msgs.recvid_list, + &msgs.rep_ack); +if (ret <0 ) +return ret; + + hdcp->seq_num_v = seq_num_v; + ret = shim->write_2_2_msg (intel_dig_port, &msgs.rep_ack, +sizeof (msgs.rep_ack)); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int hdcp2_authenticate_repeater (struct intel_connector *connector) +{ +int ret; + + ret =hdcp2_authenticate_repeater_topology (connector); +if (ret <0 ) +return ret; + +return hdcp2_propagate_stream_management_info (connector); +} +static int hdcp2_authenticate_sink (struct intel_connector *connector) {struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector);
@@ -1268,6 +1382,12 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector) sizeof(stream_type_msg));if (ret <0 )return ret; + }else if (hdcp->is_repeater) { + ret =hdcp2_authenticate_repeater (connector); +if (ret <0 ) { +DRM_DEBUG_KMS ("Repeater Auth Failed. Err: %d\n" , ret); +return ret; + } } hdcp->mei_data.streams[0 ].stream_type = hdcp->content_type;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH v4 24/41] drm/i915: Implement HDCP2.2 repeater authentication
Thank you for the patch! Perhaps something to improve:
Hi Ramalingam,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.17-rc6 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ramalingam-C/drm-i915-Implement-HDCP2-2/20180523-031938 base: git://anongit.freedesktop.org/drm-intel for-linux-next reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
drivers/gpu/drm/i915/i915_drv.h:3663:16: sparse: expression using sizeof(void)
>> drivers/gpu/drm/i915/intel_hdcp.c:1247:30: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [assigned] [usertype] k @@ got e] k @@
drivers/gpu/drm/i915/intel_hdcp.c:1247:30: expected restricted __be16 [assigned] [usertype] k
drivers/gpu/drm/i915/intel_hdcp.c:1247:30: got int
drivers/gpu/drm/i915/intel_hdcp.c:1343:12: warning: 'hdcp2_authenticate_sink' defined but not used [-Wunused-function]
static int hdcp2_authenticate_sink(struct intel_connector *connector)
^~~~~~~~~~~~~~~~~~~~~~~
vim +1247 drivers/gpu/drm/i915/intel_hdcp.c
1228
1229 static
1230 int hdcp2_propagate_stream_management_info(struct intel_connector *connector)
1231 {
1232 struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
1233 struct intel_hdcp *hdcp = &connector->hdcp;
1234 union {
1235 struct hdcp2_rep_stream_manage stream_manage;
1236 struct hdcp2_rep_stream_ready stream_ready;
1237 } msgs;
1238 const struct intel_hdcp_shim *shim = hdcp->hdcp_shim;
1239 int ret;
1240
1241 /* Prepare RepeaterAuth_Stream_Manage msg */
1242 msgs.stream_manage.msg_id = HDCP_2_2_REP_STREAM_MANAGE;
1243 reverse_endianness(msgs.stream_manage.seq_num_m, HDCP_2_2_SEQ_NUM_LEN,
1244 (u8 *)&hdcp->seq_num_m);
1245
1246 /* K no of streams is fixed as 1. Stored as big-endian. */
> 1247 msgs.stream_manage.k = __swab16(1);
1248
1249 /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */
1250 msgs.stream_manage.streams[0].stream_id = 0;
1251 msgs.stream_manage.streams[0].stream_type = hdcp->content_type;
1252
1253 /* Send it to Repeater */
1254 ret = shim->write_2_2_msg(intel_dig_port, &msgs.stream_manage,
1255 sizeof(msgs.stream_manage));
1256 if (ret < 0)
1257 return ret;
1258
1259 ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_REP_STREAM_READY,
1260 &msgs.stream_ready, sizeof(msgs.stream_ready));
1261 if (ret < 0)
1262 return ret;
1263
1264 hdcp->mei_data.seq_num_m = hdcp->seq_num_m;
1265 hdcp->mei_data.streams[0].stream_type = hdcp->content_type;
1266
1267 ret = hdcp2_verify_mprime(hdcp, &msgs.stream_ready);
1268 if (ret < 0)
1269 return ret;
1270
1271 hdcp->seq_num_m++;
1272
1273 if (hdcp->seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
1274 DRM_DEBUG_KMS("seq_num_m roll over.\n");
1275 return -1;
1276 }
1277
1278 return 0;
1279 }
1280
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 25/41 drm/i915: Enable and Disable HDCP2.2 port encryption
In reply to Ramalingam CImplements the enable and disable functions for HDCP2.2 encryption of the PORT.
v2:
intel_wait_for_register is used instead of wait_for. [Chris Wilson]
v3:
No Changes.
v4:
Debug msg is added for timeout at Disable of Encryption [Uma] %s/HDCP2_CTL/HDCP2_CTL
--- drivers/gpu/drm/i915/intel_hdcp.c | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)
drivers/gpu/drm/i915/intel_hdcp.c +57 -0
@@ -19,6 +19,7 @@ (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5#define HDCP2_LC_RETRY_CNT 3 +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)
@@ -1397,3 +1398,59 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector)return ret; } + +static int hdcp2_enable_encryption (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret; + +if (I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS ) +return 0 ; + +if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling (intel_dig_port, true); + +if (I915_READ (HDCP2_STATUS_DDI (port)) &LINK_AUTH_STATUS ) { + +/* Link is Authenticated. Now set for Encryption */ +I915_WRITE (HDCP2_CTL_DDI (port), +I915_READ (HDCP2_CTL_DDI (port)) | +CTL_LINK_ENCRYPTION_REQ ); + } + + ret =intel_wait_for_register (dev_priv,HDCP2_STATUS_DDI (port), +LINK_ENCRYPTION_STATUS , +LINK_ENCRYPTION_STATUS , +TIME_FOR_ENCRYPT_STATUS_CHANGE ); + +return ret; +} + +static int hdcp2_disable_encryption (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret; + +if (!(I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS )) +return 0 ; + +I915_WRITE (HDCP2_CTL_DDI (port), +I915_READ (HDCP2_CTL_DDI (port)) & ~CTL_LINK_ENCRYPTION_REQ ); + + ret =intel_wait_for_register (dev_priv,HDCP2_STATUS_DDI (port), +LINK_ENCRYPTION_STATUS ,0x0 , +TIME_FOR_ENCRYPT_STATUS_CHANGE ); +if (ret == -ETIMEDOUT ) +DRM_DEBUG_KMS ("Disable Encryption Timedout" ); + +if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling (intel_dig_port, false); + +return ret; +}
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 25/41] drm/i915: Enable and Disable HDCP2.2 port encryption
Quoted 33 lines · Ramalingam C
Implements the enable and disable functions for HDCP2.2 encryption of the PORT.
v2:
intel_wait_for_registeris used instead ofwait_for. [Chris Wilson]
v3:
No Changes.
v4:
Debug msg is added for timeout at Disable of Encryption [Uma] %s/HDCP2_CTL/HDCP2_CTLSigned-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_hdcp.c | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)drivers/gpu/drm/i915/intel_hdcp.c +2
-0@@ -19,6 +19,7 @@ (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5#define HDCP2_LC_RETRY_CNT 3 +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -1397,3 +1398,59 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector)return ret; } +
drivers/gpu/drm/i915/intel_hdcp.c static int hdcp2_authenticate_sink(struct intel_connector *connector) · line 1411
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+static int hdcp2_enable_encryption (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret; + +if (I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS ) +return 0 ;
Relying on hw status for state decisions is in my experience bad - it papers over bugs in our state handling. We should know what the expected state of the hardware is.
If you want to write a bit more robust code, then keep these checks, but wrap them in a WARN_ON. That way we'll know if there's a regression in the code (e.g. unbalanced enable/disable) right away, instead of these checks silently papering over them.
drivers/gpu/drm/i915/intel_hdcp.c static int hdcp2_authenticate_sink(struct intel_connector *connector) · line 1416
Quoted 5 lines
drivers/gpu/drm/i915/intel_hdcp.c +5
-0+ +if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling (intel_dig_port, true); + +if (I915_READ (HDCP2_STATUS_DDI (port)) &LINK_AUTH_STATUS ) {
Same for this check here. In general control flow that depends upon register values which can change at runtime is very suspect from a design robustness point of view.
-Daniel
Quoted 43 lines
drivers/gpu/drm/i915/intel_hdcp.c +40
-0+ +/* Link is Authenticated. Now set for Encryption */ +I915_WRITE (HDCP2_CTL_DDI (port), +I915_READ (HDCP2_CTL_DDI (port)) | +CTL_LINK_ENCRYPTION_REQ ); + } + + ret =intel_wait_for_register (dev_priv,HDCP2_STATUS_DDI (port), +LINK_ENCRYPTION_STATUS , +LINK_ENCRYPTION_STATUS , +TIME_FOR_ENCRYPT_STATUS_CHANGE ); + +return ret; +} + +static int hdcp2_disable_encryption (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret; + +if (!(I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS )) +return 0 ; + +I915_WRITE (HDCP2_CTL_DDI (port), +I915_READ (HDCP2_CTL_DDI (port)) & ~CTL_LINK_ENCRYPTION_REQ ); + + ret =intel_wait_for_register (dev_priv,HDCP2_STATUS_DDI (port), +LINK_ENCRYPTION_STATUS ,0x0 , +TIME_FOR_ENCRYPT_STATUS_CHANGE ); +if (ret == -ETIMEDOUT ) +DRM_DEBUG_KMS ("Disable Encryption Timedout" ); + +if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling (intel_dig_port, false); + +return ret; +}Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 25/41] drm/i915: Enable and Disable HDCP2.2 port encryption
Quoted 53 lines · Daniel Vetter
Quoted 33 lines · Ramalingam C
Implements the enable and disable functions for HDCP2.2 encryption of the PORT.
v2:
intel_wait_for_registeris used instead ofwait_for. [Chris Wilson]
v3:
No Changes.
v4:
Debug msg is added for timeout at Disable of Encryption [Uma] %s/HDCP2_CTL/HDCP2_CTLSigned-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_hdcp.c | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)drivers/gpu/drm/i915/intel_hdcp.c +2
-0@@ -19,6 +19,7 @@ (enum hdcp_physical_port) (port))#define KEY_LOAD_TRIES 5#define HDCP2_LC_RETRY_CNT 3 +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -1397,3 +1398,59 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector)return ret; } +drivers/gpu/drm/i915/intel_hdcp.c static int hdcp2_authenticate_sink(struct intel_connector *connector) · line 1411
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+static int hdcp2_enable_encryption (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret; + +if (I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS ) +return 0 ;Relying on hw status for state decisions is in my experience bad - it papers over bugs in our state handling. We should know what the expected state of the hardware is.
If you want to write a bit more robust code, then keep these checks, but wrap them in a
WARN_ON. That way we'll know if there's a regression in the code (e.g. unbalanced enable/disable) right away, instead of these checks silently papering over them.
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdcp.c static int hdcp2_authenticate_sink(struct intel_connector *connector) · line 1416
Quoted 5 lines
drivers/gpu/drm/i915/intel_hdcp.c +5
-0+ +if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling (intel_dig_port, true); + +if (I915_READ (HDCP2_STATUS_DDI (port)) &LINK_AUTH_STATUS ) {Same for this check here. In general control flow that depends upon register values which can change at runtime is very suspect from a design robustness point of view.
Sure. I will move these HW status check into the WARN_ONs.
-Ram.
Quoted 37 lines
-Daniel
Quoted 35 lines
drivers/gpu/drm/i915/intel_hdcp.c +35
-0+ +/* Link is Authenticated. Now set for Encryption */ +I915_WRITE (HDCP2_CTL_DDI (port), +I915_READ (HDCP2_CTL_DDI (port)) | +CTL_LINK_ENCRYPTION_REQ ); + } + + ret =intel_wait_for_register (dev_priv,HDCP2_STATUS_DDI (port), +LINK_ENCRYPTION_STATUS , +LINK_ENCRYPTION_STATUS , +TIME_FOR_ENCRYPT_STATUS_CHANGE ); + +return ret; +} + +static int hdcp2_disable_encryption (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret; + +if (!(I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS )) +return 0 ; + +I915_WRITE (HDCP2_CTL_DDI (port), +I915_READ (HDCP2_CTL_DDI (port)) & ~CTL_LINK_ENCRYPTION_REQ ); + + ret =intel_wait_for_register (dev_priv,HDCP2_STATUS_DDI (port), +LINK_ENCRYPTION_STATUS ,0x0 , +TIME_FOR_ENCRYPT_STATUS_CHANGE ); +if (ret == -ETIMEDOUT ) +DRM_DEBUG_KMS ("Disable Encryption Timedout" ); +
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdcp.c +5
-0+if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling (intel_dig_port, false); + +return ret; +}Signature · 1 line
2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 26/41 drm/i915: Implement HDCP2.2 En/Dis-able
In reply to Ramalingam CImplements a sequence of enabling and disabling the HDCP2.2 (auth and encryption).
v2:
Rebased.
v3:
No Changes.
v4:
No Changes.
--- drivers/gpu/drm/i915/intel_hdcp.c | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
drivers/gpu/drm/i915/intel_hdcp.c +75 -0
@@ -21,6 +21,9 @@#define HDCP2_LC_RETRY_CNT 3#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32 +static int _intel_hdcp2_enable (struct intel_connector *connector); +static int _intel_hdcp2_disable (struct intel_connector *connector); +static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim) {
@@ -1454,3 +1457,75 @@ static int hdcp2_disable_encryption(struct intel_connector *connector)return ret; } + +static int hdcp2_authenticate_and_encrypt (struct intel_connector *connector) +{ +int ret, i, tries =3 ; + +for (i =0 ; i < tries; i++) { + ret =hdcp2_authenticate_sink (connector); +if (!ret) +break ; + +/* Clearing the mei hdcp session */ +hdcp2_deauthenticate_port (&connector->hdcp); +DRM_DEBUG_KMS ("HDCP2.2 Auth %d of %d Failed.(%d)\n" , + i +1 , tries, ret); + } + +if (i != tries) { + +/* +* Ensuring the required 200mSec min time interval between +* Session Key Exchange and encryption. +*/ +msleep (HDCP_2_2_DELAY_BEFORE_ENCRYPTION_EN ); + ret =hdcp2_enable_encryption (connector); +if (ret <0 ) { +DRM_DEBUG_KMS ("Encryption Enable Failed.(%d)\n" , ret); +hdcp2_deauthenticate_port (&connector->hdcp); + } + } + +return ret; +} + +static int _intel_hdcp2_disable (struct intel_connector *connector) +{ +int ret; + +DRM_DEBUG_KMS ("[%s:%d] HDCP2.2 is being Disabled\n" , + connector->base.name, connector->base.base.id); + + ret =hdcp2_disable_encryption (connector); + +hdcp2_deauthenticate_port (&connector->hdcp); + +return ret; +} + +static int _intel_hdcp2_enable (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +int ret; + +DRM_DEBUG_KMS ("[%s:%d] HDCP2.2 is being enabled. Type: %d\n" , + connector->base.name, connector->base.base.id, + hdcp->content_type); + + ret =hdcp2_authenticate_and_encrypt (connector); +if (ret) { +DRM_ERROR ("HDCP2 Type%d Enabling Failed. (%d)\n" , + hdcp->content_type, ret); +return ret; + } + +DRM_DEBUG_KMS ("[%s:%d] HDCP2.2 is enabled. Type %d\n" , + connector->base.name, connector->base.base.id, + hdcp->content_type); + + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ; +schedule_work (&hdcp->hdcp_prop_work); + +return 0 ; +}
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 27/41 drm/i915: Implement HDCP2.2 link integrity check
In reply to Ramalingam CImplements the link integrity check once in 500mSec.
Once encryption is enabled, an ongoing Link Integrity Check is performed by the HDCP Receiver to check that cipher synchronization is maintained between the HDCP Transmitter and the HDCP Receiver.
On the detection of synchronization lost, the HDCP Receiver must assert the corresponding bits of the RxStatus register. The Transmitter polls the RxStatus register and it may initiate re-authentication.
v2:
Rebased.
v3:
No Changes.
v4:
enum check_link_response is used check the link status [Uma]
--- drivers/gpu/drm/i915/intel_hdcp.c | 82 ++++++++++++++++++++++++++++++++++++++- include/drm/drm_hdcp.h | 8 ++++ 2 files changed, 89 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdcp.c +81 -1
@@ -23,6 +23,8 @@static int _intel_hdcp2_enable (struct intel_connector *connector);static int _intel_hdcp2_disable (struct intel_connector *connector); +static void intel_hdcp2_check_work (struct work_struct *work); +static int intel_hdcp2_check_link (struct intel_connector *connector);static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)
@@ -1526,6 +1528,84 @@ static int _intel_hdcp2_enable(struct intel_connector *connector) hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ;schedule_work (&hdcp->hdcp_prop_work); - +schedule_delayed_work (&hdcp->hdcp2_check_work, +DRM_HDCP2_CHECK_PERIOD_MS );return 0 ; } + +static int intel_hdcp2_check_link (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +enum port port = connector->encoder->port; +int ret =0 ; + +if (!hdcp->hdcp_shim) +return -ENOENT ; + +mutex_lock (&hdcp->hdcp_mutex); + +if (hdcp->hdcp_value ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) + goto out; + +if (!(I915_READ (HDCP2_STATUS_DDI (port)) &LINK_ENCRYPTION_STATUS )) { +DRM_ERROR ("HDCP check failed: link is not encrypted, %x\n" , +I915_READ (HDCP2_STATUS_DDI (port))); + ret = -ENXIO ; + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_DESIRED ; +schedule_work (&hdcp->hdcp_prop_work); + goto out; + } + + ret = hdcp->hdcp_shim->check_2_2_link (intel_dig_port); +if (ret ==DRM_HDCP_LINK_PROTECTED ) { +if (hdcp->hdcp_value !=DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ; +schedule_work (&hdcp->hdcp_prop_work); + } + goto out; + } + +DRM_INFO ("[%s:%d] HDCP2.2 link failed, retrying authentication\n" , + connector->base.name, connector->base.base.id); + + ret =_intel_hdcp2_disable (connector); +if (ret) { +DRM_ERROR ("[%s:%d] Failed to disable hdcp2.2 (%d)\n" , + connector->base.name, connector->base.base.id, ret); + + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_DESIRED ; +schedule_work (&hdcp->hdcp_prop_work); + goto out; + } + + ret =_intel_hdcp2_enable (connector); +if (ret) { +DRM_ERROR ("[%s:%d] Failed to enable hdcp2.2 (%d)\n" , + connector->base.name, connector->base.base.id, ret); + + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_DESIRED ; +schedule_work (&hdcp->hdcp_prop_work); + goto out; + } + +out: +mutex_unlock (&hdcp->hdcp_mutex); + +return ret; +} + +static void intel_hdcp2_check_work (struct work_struct *work) +{ +struct intel_hdcp *hdcp =container_of (to_delayed_work (work), + struct intel_hdcp, + hdcp2_check_work); +struct intel_connector *connector =container_of (hdcp, + struct intel_connector, + hdcp); + +if (!intel_hdcp2_check_link (connector)) +schedule_delayed_work (&hdcp->hdcp2_check_work, +DRM_HDCP2_CHECK_PERIOD_MS ); +}
include/drm/drm_hdcp.h +8 -0
@@ -11,6 +11,14 @@/* Period of hdcp checks (to ensure we're still authenticated) */ #define DRM_HDCP_CHECK_PERIOD_MS (128 * 16) +#define DRM_HDCP2_CHECK_PERIOD_MS 500 + +enum check_link_response { +DRM_HDCP_LINK_PROTECTED =0 , +DRM_HDCP_TOPOLOGY_CHANGE , +DRM_HDCP_LINK_INTEGRITY_FAILURE , +DRM_HDCP_REAUTH_REQUEST +};/* Shared lengths/masks between HDMI/DVI/DisplayPort */ #define DRM_HDCP_AN_LEN 8
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 28/41 drm/i915: Handle HDCP2.2 downstream topology change
In reply to Ramalingam CWhen repeater notifies a downstream topology change, this patch reauthenticate the repeater alone without disabling the hdcp encryption. If that fails then complete reauthentication is executed.
v2:
Rebased.
v3:
No Changes.
v4:
Typo in commit msg is fixed [Uma]
--- drivers/gpu/drm/i915/intel_hdcp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +17 -2
@@ -1567,8 +1567,23 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) goto out; } -DRM_INFO ("[%s:%d] HDCP2.2 link failed, retrying authentication\n" , - connector->base.name, connector->base.base.id); +if (ret ==DRM_HDCP_TOPOLOGY_CHANGE ) { +if (hdcp->hdcp_value ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) + goto out; + +DRM_DEBUG_KMS ("HDCP2.2 Downstream topology change\n" ); + ret =hdcp2_authenticate_repeater_topology (connector); +if (!ret) { + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ; +schedule_work (&hdcp->hdcp_prop_work); + goto out; + } +DRM_ERROR ("[%s:%d] Repeater topology auth failed.(%d)\n" , + connector->base.name, connector->base.base.id, ret); + }else { +DRM_ERROR ("[%s:%d] HDCP2.2 link failed, retrying auth\n" , + connector->base.name, connector->base.base.id); + } ret =_intel_hdcp2_disable (connector);if (ret) {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 29/41 drm/i915: Pullout the bksv read and validation
In reply to Ramalingam CFor reusability purpose, this patch implements the hdcp1.4 bksv's read and validation as a functions.
For detecting the HDMI panel's HDCP capability this fucntions will be used.
v2:
Rebased.
v3:
No Changes.
v4:
inline tag is removed with modified error msg.
--- drivers/gpu/drm/i915/intel_hdcp.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +25 -12
@@ -404,6 +404,28 @@ int intel_hdcp_validate_v_prime(struct intel_digital_port *intel_dig_port,return 0 ; } +static +int intel_hdcp_read_valid_bksv (struct intel_digital_port *intel_dig_port, +const struct intel_hdcp_shim *shim,u8 *bksv) +{ +int ret, i, tries =2 ; + +/* HDCP spec states that we must retry the bksv if it is invalid */ +for (i =0 ; i < tries; i++) { + ret = shim->read_bksv (intel_dig_port, bksv); +if (ret) +return ret; +if (intel_hdcp_is_ksv_valid (bksv)) +break ; + } +if (i == tries) { +DRM_ERROR ("Bksv is invalid\n" ); +return -ENODEV ; + } + +return 0 ; +} +/* Implements Part 2 of the HDCP authorization procedure */ static int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port,
@@ -537,18 +559,9 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,memset (&bksv,0 ,sizeof (bksv)); -/* HDCP spec states that we must retry the bksv if it is invalid */ -for (i =0 ; i < tries; i++) { - ret = shim->read_bksv (intel_dig_port, bksv.shim); -if (ret) -return ret; -if (intel_hdcp_is_ksv_valid (bksv.shim)) -break ; - } -if (i == tries) { -DRM_ERROR ("HDCP failed, Bksv is invalid\n" ); -return -ENODEV ; - } + ret =intel_hdcp_read_valid_bksv (intel_dig_port, shim, bksv.shim); +if (ret <0 ) +return ret;I915_WRITE (PORT_HDCP_BKSVLO (port), bksv.reg[0 ]);I915_WRITE (PORT_HDCP_BKSVHI (port), bksv.reg[1 ]);
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 30/41 drm/i915: Initialize HDCP2.2 and its MEI interface
In reply to Ramalingam CInitialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]
--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }
drivers/gpu/drm/i915/intel_drv.h +3 -2
@@ -442,7 +442,7 @@ struct intel_hdcp {/* mei interface related information */ struct mei_cl_device *cldev;struct mei_hdcp_data mei_data; - +struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; };
@@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);
drivers/gpu/drm/i915/intel_hdcp.c +116 -1
149 lines not on this page · raw message
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -2334,7 +2334,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 30/41] drm/i915: Initialize HDCP2.2 and its MEI interface
Quoted 128 lines · Ramalingam C
Initialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }drivers/gpu/drm/i915/intel_drv.h +3
-2@@ -442,7 +442,7 @@ struct intel_hdcp {/* mei interface related information */ struct mei_cl_device *cldev;struct mei_hdcp_data mei_data; - +struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; };@@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);drivers/gpu/drm/i915/intel_hdcp.c +29
-1@@ -11,6 +11,7 @@#include <linux/i2c.h> #include <linux/random.h> #include <linux/mei_hdcp.h> +#include <linux/notifier.h> #include "intel_drv.h" #include "i915_reg.h" @@ -25,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector);static int _intel_hdcp2_disable (struct intel_connector *connector);static void intel_hdcp2_check_work (struct work_struct *work);static int intel_hdcp2_check_link (struct intel_connector *connector); +static int intel_hdcp2_init (struct intel_connector *connector);static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -766,11 +768,15 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port) }int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim) +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported) {struct intel_hdcp *hdcp = &connector->hdcp;int ret; +if (!hdcp_shim) +return -EINVAL ; + ret =drm_connector_attach_content_protection_property ( &connector->base);if (ret)@@ -779,7 +785,12 @@ int intel_hdcp_init(struct intel_connector *connector, hdcp->hdcp_shim = hdcp_shim;mutex_init (&hdcp->hdcp_mutex);INIT_DELAYED_WORK (&hdcp->hdcp_check_work, intel_hdcp_check_work); +INIT_DELAYED_WORK (&hdcp->hdcp2_check_work, intel_hdcp2_check_work);INIT_WORK (&hdcp->hdcp_prop_work, intel_hdcp_prop_work); + +if (hdcp2_supported) +intel_hdcp2_init (connector); +return 0 ; }@@ -1637,3 +1648,107 @@ static void intel_hdcp2_check_work(struct work_struct *work)schedule_delayed_work (&hdcp->hdcp2_check_work,DRM_HDCP2_CHECK_PERIOD_MS ); } + +static int initialize_mei_hdcp_data (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +struct mei_hdcp_data *data = &hdcp->mei_data; +enum port port; + +if (connector->encoder) { + port = connector->encoder->port; + data->port =GET_MEI_DDI_INDEX (port); + } + + data->port_type =INTEGRATED ; + data->protocol = hdcp->hdcp_shim->hdcp_protocol (); + + data->k =1 ; +if (!data->streams)
drivers/gpu/drm/i915/intel_hdcp.c static void intel_hdcp2_check_work(struct work_struct *work) · line 1677
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+ data->streams =kcalloc (data->k, +sizeof (struct hdcp2_streamid_type ), +GFP_KERNEL ); +if (!data->streams) { +DRM_ERROR ("Out of Memory\n" ); +return -ENOMEM ; + } + + data->streams[0 ].stream_id =0 ; + data->streams[0 ].stream_type = hdcp->content_type;
Ok there's 0 locking here. If there's no locking then of course CONFIG_PROVE_LOCKING will not spot any issues.
It also means you're code is racy, e.g. if mei and i915 load at the same time, things could get corrupted in interesting ways. Same holds if you have ongoing hdcp2 operations going on in the intel_hdcp code, while the mei driver is being unloaded.
Note that you can unload the driver without having to unload the module, those 2 things aren't coupled.
Another reason for not using notifiers is that it's another reinvented wheel to make multi-driver stuff work. We already have the component framework for this, and we're already using the component framework for the snd-hda vs. i915 coordination.
So here's my recommendation for getting this sorted out:
- Use the component framework to coordinate the loading of i915 and the mei_hdcp driver.
- Bonus points for using device_link to tell the driver core about this, which optimizes the load sequence (unfortunately we haven't done that for snd-hda yet, instead have to work around ordering issues in the suspend/resume handlers a bit).
- Drop all the EXPORT_SYMBOL and hard links between the two drivers. Instead have a vtable, like we're using for the audio side.
- Make sure that any shared state is appropriately protected with a mutex. Sprinkle lots of assert_lock_held over the code base to make sure you didn't miss anything, and use CONFIG_PROVE_LOCKING to make sure there's no deadlocks and oversights.
- Extend the igt drv_module_reload testcase to make sure you're exercising the new EPROBE_DEFER point fully (should just need a kernel change to add that as a potential load failure path).
I think with that we have a solid solution here which is aligned with how we handle this in other cases.
Thanks, Daniel
Quoted 93 lines
drivers/gpu/drm/i915/intel_hdcp.c +77
-0+ +return 0 ; +} + +static void intel_hdcp2_exit (struct intel_connector *connector) +{ +intel_hdcp_disable (connector); +kfree (connector->hdcp.mei_data.streams); +} + +static int mei_cldev_notify (struct notifier_block *nb,unsigned long event, +void *cldev) +{ + struct intel_hdcp *hdcp = container_of(nb, struct intel_hdcp, + mei_cldev_nb); +struct intel_connector *intel_connector =container_of (hdcp, + struct intel_connector, + hdcp); + +DRM_DEBUG_KMS ("[%s:%d] MEI_HDCP Notification. Interface: %s\n" , + intel_connector->base.name, intel_connector->base.base.id, + cldev ?"UP" :"Down" ); + +if (event ==MEI_CLDEV_ENABLED ) { + hdcp->cldev = cldev; +initialize_mei_hdcp_data (intel_connector); + }else { + hdcp->cldev =NULL ; +intel_hdcp2_exit (intel_connector); + } + +return NOTIFY_OK ; +} + +static inline +bool is_hdcp2_supported (struct drm_i915_private *dev_priv) +{ +return (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv) || +IS_KABYLAKE (dev_priv)); +} + +static int intel_hdcp2_init (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +int ret; + +if (!is_hdcp2_supported (dev_priv)) +return -EINVAL ; + + hdcp->hdcp2_supported = true; + + hdcp->mei_cldev_nb.notifier_call = mei_cldev_notify; + ret =mei_cldev_register_notify (&hdcp->mei_cldev_nb); +if (ret) { +DRM_ERROR ("mei_cldev not available. %d\n" , ret); + goto exit; + } + + ret =initialize_mei_hdcp_data (connector); +if (ret) { +mei_cldev_unregister_notify (&hdcp->mei_cldev_nb); + goto exit; + } + +/* +* Incase notifier is triggered well before this point, request for +* notification of the mei client device state. +*/ +mei_cldev_poll_notification (); + +exit: +if (ret) + hdcp->hdcp2_supported = false; + +return ret; +}drivers/gpu/drm/i915/intel_hdmi.c +1
-1@@ -2334,7 +2334,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 30/41] drm/i915: Initialize HDCP2.2 and its MEI interface
Quoted 142 lines · Daniel Vetter
Quoted 128 lines · Ramalingam C
Initialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }drivers/gpu/drm/i915/intel_drv.h +3
-2@@ -442,7 +442,7 @@ struct intel_hdcp {/* mei interface related information */ struct mei_cl_device *cldev;struct mei_hdcp_data mei_data; - +struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; };@@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);drivers/gpu/drm/i915/intel_hdcp.c +29
-1@@ -11,6 +11,7 @@#include <linux/i2c.h> #include <linux/random.h> #include <linux/mei_hdcp.h> +#include <linux/notifier.h> #include "intel_drv.h" #include "i915_reg.h" @@ -25,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector);static int _intel_hdcp2_disable (struct intel_connector *connector);static void intel_hdcp2_check_work (struct work_struct *work);static int intel_hdcp2_check_link (struct intel_connector *connector); +static int intel_hdcp2_init (struct intel_connector *connector);static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -766,11 +768,15 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port) }int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim) +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported) {struct intel_hdcp *hdcp = &connector->hdcp;int ret; +if (!hdcp_shim) +return -EINVAL ; + ret =drm_connector_attach_content_protection_property ( &connector->base);if (ret)@@ -779,7 +785,12 @@ int intel_hdcp_init(struct intel_connector *connector, hdcp->hdcp_shim = hdcp_shim;mutex_init (&hdcp->hdcp_mutex);INIT_DELAYED_WORK (&hdcp->hdcp_check_work, intel_hdcp_check_work); +INIT_DELAYED_WORK (&hdcp->hdcp2_check_work, intel_hdcp2_check_work);INIT_WORK (&hdcp->hdcp_prop_work, intel_hdcp_prop_work); + +if (hdcp2_supported) +intel_hdcp2_init (connector); +return 0 ; }@@ -1637,3 +1648,107 @@ static void intel_hdcp2_check_work(struct work_struct *work)schedule_delayed_work (&hdcp->hdcp2_check_work,DRM_HDCP2_CHECK_PERIOD_MS ); } + +static int initialize_mei_hdcp_data (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +struct mei_hdcp_data *data = &hdcp->mei_data; +enum port port; + +if (connector->encoder) { + port = connector->encoder->port; + data->port =GET_MEI_DDI_INDEX (port); + } + + data->port_type =INTEGRATED ; + data->protocol = hdcp->hdcp_shim->hdcp_protocol (); + + data->k =1 ; +if (!data->streams)drivers/gpu/drm/i915/intel_hdcp.c static void intel_hdcp2_check_work(struct work_struct *work) · line 1677
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+ data->streams =kcalloc (data->k, +sizeof (struct hdcp2_streamid_type ), +GFP_KERNEL ); +if (!data->streams) { +DRM_ERROR ("Out of Memory\n" ); +return -ENOMEM ; + } + + data->streams[0 ].stream_id =0 ; + data->streams[0 ].stream_type = hdcp->content_type;Ok there's 0 locking here. If there's no locking then of course
CONFIG_PROVE_LOCKINGwill not spot any issues.
Quoted 4 lines
It also means you're code is racy, e.g. if mei and i915 load at the same time, things could get corrupted in interesting ways. Same holds if you have ongoing hdcp2 operations going on in the
intel_hdcpcode, while the mei driver is being unloaded.
Daniel,
Both of these cases are not possible as MEI symbols are used in I915,
So I915 can't be loaded before or in parallel to MEI drivers.
Similarly we can't unload the MEI before I915 or in parallel. So I guess we are out of above race mentioned
MEI related data in intel_connector->hdcp is per connector basis. And per connector data's are protected with mutex in authentication path.
In MEI HDCP driver's APIs too, there is no shared variable except mei_cldev that also not modified in those mei_hdcp APIs. So I am not seeing any race conditions as such. So there is no need for any explicit locking between I915 and MEI.
Quoted 2 lines
Note that you can unload the driver without having to unload the module, those 2 things aren't coupled.
Can you please help me to understand more on this?
If you are referring to mei device removal, notification will be sent to I915.
Even if a hdcp service is placed for a mei device, that is unbinded/disabled, mei bus will gracefully decline the request.
So I don't expect any possible issues. Help me if you otherwise.
Quoted 4 lines
Another reason for not using notifiers is that it's another reinvented wheel to make multi-driver stuff work. We already have the component framework for this, and we're already using the component framework for the snd-hda vs. i915 coordination.
If we need to we can do with component. Exploring what is needed here. At First glance I915 will be component master and mei will be component client.
Thanks and Regards,
Ram
Quoted 111 lines
So here's my recommendation for getting this sorted out:
- Use the component framework to coordinate the loading of i915 and the
mei_hdcpdriver.- Bonus points for using
device_linkto tell the driver core about this, which optimizes the load sequence (unfortunately we haven't done that for snd-hda yet, instead have to work around ordering issues in the suspend/resume handlers a bit).- Drop all the
EXPORT_SYMBOLand hard links between the two drivers. Instead have a vtable, like we're using for the audio side.- Make sure that any shared state is appropriately protected with a mutex. Sprinkle lots of
assert_lock_heldover the code base to make sure you didn't miss anything, and useCONFIG_PROVE_LOCKINGto make sure there's no deadlocks and oversights.- Extend the igt
drv_module_reloadtestcase to make sure you're exercising the newEPROBE_DEFERpoint fully (should just need a kernel change to add that as a potential load failure path).I think with that we have a solid solution here which is aligned with how we handle this in other cases.
Thanks, Daniel
Quoted 83 lines
drivers/gpu/drm/i915/intel_hdcp.c +77
-0+ +return 0 ; +} + +static void intel_hdcp2_exit (struct intel_connector *connector) +{ +intel_hdcp_disable (connector); +kfree (connector->hdcp.mei_data.streams); +} + +static int mei_cldev_notify (struct notifier_block *nb,unsigned long event, +void *cldev) +{ + struct intel_hdcp *hdcp = container_of(nb, struct intel_hdcp, + mei_cldev_nb); +struct intel_connector *intel_connector =container_of (hdcp, + struct intel_connector, + hdcp); + +DRM_DEBUG_KMS ("[%s:%d] MEI_HDCP Notification. Interface: %s\n" , + intel_connector->base.name, intel_connector->base.base.id, + cldev ?"UP" :"Down" ); + +if (event ==MEI_CLDEV_ENABLED ) { + hdcp->cldev = cldev; +initialize_mei_hdcp_data (intel_connector); + }else { + hdcp->cldev =NULL ; +intel_hdcp2_exit (intel_connector); + } + +return NOTIFY_OK ; +} + +static inline +bool is_hdcp2_supported (struct drm_i915_private *dev_priv) +{ +return (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv) || +IS_KABYLAKE (dev_priv)); +} + +static int intel_hdcp2_init (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +int ret; + +if (!is_hdcp2_supported (dev_priv)) +return -EINVAL ; + + hdcp->hdcp2_supported = true; + + hdcp->mei_cldev_nb.notifier_call = mei_cldev_notify; + ret =mei_cldev_register_notify (&hdcp->mei_cldev_nb); +if (ret) { +DRM_ERROR ("mei_cldev not available. %d\n" , ret); + goto exit; + } + + ret =initialize_mei_hdcp_data (connector); +if (ret) { +mei_cldev_unregister_notify (&hdcp->mei_cldev_nb); + goto exit; + } + +/* +* Incase notifier is triggered well before this point, request for +* notification of the mei client device state. +*/ +mei_cldev_poll_notification (); + +exit: +if (ret) + hdcp->hdcp2_supported = false; + +return ret; +}drivers/gpu/drm/i915/intel_hdmi.c +0
-0@@ -2334,7 +2334,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +1
-1if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }Signature · 1 line
2.7.4
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 30/41] drm/i915: Initialize HDCP2.2 and its MEI interface
Quoted 142 lines · Ramalingam C
Quoted 135 lines · Daniel Vetter
Quoted 121 lines · Ramalingam C
Initialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }drivers/gpu/drm/i915/intel_drv.h +3
-2@@ -442,7 +442,7 @@ struct intel_hdcp {/* mei interface related information */ struct mei_cl_device *cldev;struct mei_hdcp_data mei_data; - +struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; };@@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);drivers/gpu/drm/i915/intel_hdcp.c +29
-1@@ -11,6 +11,7 @@#include <linux/i2c.h> #include <linux/random.h> #include <linux/mei_hdcp.h> +#include <linux/notifier.h> #include "intel_drv.h" #include "i915_reg.h" @@ -25,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector);static int _intel_hdcp2_disable (struct intel_connector *connector);static void intel_hdcp2_check_work (struct work_struct *work);static int intel_hdcp2_check_link (struct intel_connector *connector); +static int intel_hdcp2_init (struct intel_connector *connector);static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -766,11 +768,15 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port) }int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim) +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported) {struct intel_hdcp *hdcp = &connector->hdcp;int ret; +if (!hdcp_shim) +return -EINVAL ; + ret =drm_connector_attach_content_protection_property ( &connector->base);if (ret)@@ -779,7 +785,12 @@ int intel_hdcp_init(struct intel_connector *connector, hdcp->hdcp_shim = hdcp_shim;mutex_init (&hdcp->hdcp_mutex);INIT_DELAYED_WORK (&hdcp->hdcp_check_work, intel_hdcp_check_work); +INIT_DELAYED_WORK (&hdcp->hdcp2_check_work, intel_hdcp2_check_work);INIT_WORK (&hdcp->hdcp_prop_work, intel_hdcp_prop_work); + +if (hdcp2_supported) +intel_hdcp2_init (connector); +return 0 ; }@@ -1637,3 +1648,107 @@ static void intel_hdcp2_check_work(struct work_struct *work)schedule_delayed_work (&hdcp->hdcp2_check_work,DRM_HDCP2_CHECK_PERIOD_MS ); } + +static int initialize_mei_hdcp_data (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +struct mei_hdcp_data *data = &hdcp->mei_data; +enum port port; + +if (connector->encoder) { + port = connector->encoder->port; + data->port =GET_MEI_DDI_INDEX (port); + } + + data->port_type =INTEGRATED ; + data->protocol = hdcp->hdcp_shim->hdcp_protocol (); + + data->k =1 ; +if (!data->streams)drivers/gpu/drm/i915/intel_hdcp.c static void intel_hdcp2_check_work(struct work_struct *work) · line 1677
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+ data->streams =kcalloc (data->k, +sizeof (struct hdcp2_streamid_type ), +GFP_KERNEL ); +if (!data->streams) { +DRM_ERROR ("Out of Memory\n" ); +return -ENOMEM ; + } + + data->streams[0 ].stream_id =0 ; + data->streams[0 ].stream_type = hdcp->content_type;Ok there's 0 locking here. If there's no locking then of course
CONFIG_PROVE_LOCKINGwill not spot any issues.Quoted 4 lines
It also means you're code is racy, e.g. if mei and i915 load at the same time, things could get corrupted in interesting ways. Same holds if you have ongoing hdcp2 operations going on in the
intel_hdcpcode, while the mei driver is being unloaded.
Quoted 6 lines
Daniel,
Both of these cases are not possible as MEI symbols are used in I915, So I915 can't be loaded before or in parallel to MEI drivers. Similarly we can't unload the MEI before I915 or in parallel. So I guess we are out of above race mentioned
That's not how it works unfortunately. You can unbind drivers while the module is still there. And symbol availability doesn't guarantee you that the driver itself has loaded already. Same holds for i915.
Yes symbol availability not matching up with driver state is one of the neatest pitfalls of the linux driver model. Symbol availability only mostly matches driver state, but it can be different.
Quoted 7 lines
MEI related data in
intel_connector->hdcpis per connector basis. And per connector data's are protected with mutex in authentication path.In MEI HDCP driver's APIs too, there is no shared variable except
mei_cldevthat also not modified in thosemei_hdcpAPIs.
So I am not seeing any race conditions as such. So there is no need for any explicit locking between I915 and MEI.
Your notifier callback needs some lock to protect against i915-side modeset calls, in case the mei disappears while we try to use them.
I think at least, I need to look at the overall picture from your git tree again.
Quoted 10 lines
Quoted 2 lines
Note that you can unload the driver without having to unload the module, those 2 things aren't coupled.
Can you please help me to understand more on this?
If you are referring to mei device removal, notification will be sent to I915.
Even if a hdcp service is placed for a mei device, that is unbinded/disabled, mei bus will gracefully decline the request.So I don't expect any possible issues. Help me if you otherwise.
Quoted 7 lines
Quoted 4 lines
Another reason for not using notifiers is that it's another reinvented wheel to make multi-driver stuff work. We already have the component framework for this, and we're already using the component framework for the snd-hda vs. i915 coordination.
If we need to we can do with component. Exploring what is needed here. At First glance I915 will be component master and mei will be component client.
I think you can hand-roll it with notifiers, just need to be careful that you don't hold locks too much. And that's kinda reinventing component framework in that case. Especially since you've used direct function calls, making mei a static dependency anyway.
-Daniel
Quoted 124 lines
Thanks and Regards,
RamQuoted 120 lines
So here's my recommendation for getting this sorted out:
- Use the component framework to coordinate the loading of i915 and the
mei_hdcpdriver.- Bonus points for using
device_linkto tell the driver core about this, which optimizes the load sequence (unfortunately we haven't done that for snd-hda yet, instead have to work around ordering issues in the suspend/resume handlers a bit).- Drop all the
EXPORT_SYMBOLand hard links between the two drivers. Instead have a vtable, like we're using for the audio side.- Make sure that any shared state is appropriately protected with a mutex. Sprinkle lots of
assert_lock_heldover the code base to make sure you didn't miss anything, and useCONFIG_PROVE_LOCKINGto make sure there's no deadlocks and oversights.- Extend the igt
drv_module_reloadtestcase to make sure you're exercising the newEPROBE_DEFERpoint fully (should just need a kernel change to add that as a potential load failure path).I think with that we have a solid solution here which is aligned with how we handle this in other cases.
Thanks, Daniel
Quoted 92 lines
drivers/gpu/drm/i915/intel_hdcp.c +77
-0+ +return 0 ; +} + +static void intel_hdcp2_exit (struct intel_connector *connector) +{ +intel_hdcp_disable (connector); +kfree (connector->hdcp.mei_data.streams); +} + +static int mei_cldev_notify (struct notifier_block *nb,unsigned long event, +void *cldev) +{ + struct intel_hdcp *hdcp = container_of(nb, struct intel_hdcp, + mei_cldev_nb); +struct intel_connector *intel_connector =container_of (hdcp, + struct intel_connector, + hdcp); + +DRM_DEBUG_KMS ("[%s:%d] MEI_HDCP Notification. Interface: %s\n" , + intel_connector->base.name, intel_connector->base.base.id, + cldev ?"UP" :"Down" ); + +if (event ==MEI_CLDEV_ENABLED ) { + hdcp->cldev = cldev; +initialize_mei_hdcp_data (intel_connector); + }else { + hdcp->cldev =NULL ; +intel_hdcp2_exit (intel_connector); + } + +return NOTIFY_OK ; +} + +static inline +bool is_hdcp2_supported (struct drm_i915_private *dev_priv) +{ +return (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv) || +IS_KABYLAKE (dev_priv)); +} + +static int intel_hdcp2_init (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +int ret; + +if (!is_hdcp2_supported (dev_priv)) +return -EINVAL ; + + hdcp->hdcp2_supported = true; + + hdcp->mei_cldev_nb.notifier_call = mei_cldev_notify; + ret =mei_cldev_register_notify (&hdcp->mei_cldev_nb); +if (ret) { +DRM_ERROR ("mei_cldev not available. %d\n" , ret); + goto exit; + } + + ret =initialize_mei_hdcp_data (connector); +if (ret) { +mei_cldev_unregister_notify (&hdcp->mei_cldev_nb); + goto exit; + } + +/* +* Incase notifier is triggered well before this point, request for +* notification of the mei client device state. +*/ +mei_cldev_poll_notification (); + +exit: +if (ret) + hdcp->hdcp2_supported = false; + +return ret; +}drivers/gpu/drm/i915/intel_hdmi.c +1
-1@@ -2334,7 +2334,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 30/41] drm/i915: Initialize HDCP2.2 and its MEI interface
Quoted 186 lines · Daniel Vetter
Quoted 142 lines · Ramalingam C
Quoted 135 lines · Daniel Vetter
Quoted 121 lines · Ramalingam C
Initialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }drivers/gpu/drm/i915/intel_drv.h +3
-2@@ -442,7 +442,7 @@ struct intel_hdcp {/* mei interface related information */ struct mei_cl_device *cldev;struct mei_hdcp_data mei_data; - +struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; };@@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);drivers/gpu/drm/i915/intel_hdcp.c +29
-1@@ -11,6 +11,7 @@#include <linux/i2c.h> #include <linux/random.h> #include <linux/mei_hdcp.h> +#include <linux/notifier.h> #include "intel_drv.h" #include "i915_reg.h" @@ -25,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector);static int _intel_hdcp2_disable (struct intel_connector *connector);static void intel_hdcp2_check_work (struct work_struct *work);static int intel_hdcp2_check_link (struct intel_connector *connector); +static int intel_hdcp2_init (struct intel_connector *connector);static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -766,11 +768,15 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port) }int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim) +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported) {struct intel_hdcp *hdcp = &connector->hdcp;int ret; +if (!hdcp_shim) +return -EINVAL ; + ret =drm_connector_attach_content_protection_property ( &connector->base);if (ret)@@ -779,7 +785,12 @@ int intel_hdcp_init(struct intel_connector *connector, hdcp->hdcp_shim = hdcp_shim;mutex_init (&hdcp->hdcp_mutex);INIT_DELAYED_WORK (&hdcp->hdcp_check_work, intel_hdcp_check_work); +INIT_DELAYED_WORK (&hdcp->hdcp2_check_work, intel_hdcp2_check_work);INIT_WORK (&hdcp->hdcp_prop_work, intel_hdcp_prop_work); + +if (hdcp2_supported) +intel_hdcp2_init (connector); +return 0 ; }@@ -1637,3 +1648,107 @@ static void intel_hdcp2_check_work(struct work_struct *work)schedule_delayed_work (&hdcp->hdcp2_check_work,DRM_HDCP2_CHECK_PERIOD_MS ); } + +static int initialize_mei_hdcp_data (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +struct mei_hdcp_data *data = &hdcp->mei_data; +enum port port; + +if (connector->encoder) { + port = connector->encoder->port; + data->port =GET_MEI_DDI_INDEX (port); + } + + data->port_type =INTEGRATED ; + data->protocol = hdcp->hdcp_shim->hdcp_protocol (); + + data->k =1 ; +if (!data->streams)drivers/gpu/drm/i915/intel_hdcp.c static void intel_hdcp2_check_work(struct work_struct *work) · line 1677
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+ data->streams =kcalloc (data->k, +sizeof (struct hdcp2_streamid_type ), +GFP_KERNEL ); +if (!data->streams) { +DRM_ERROR ("Out of Memory\n" ); +return -ENOMEM ; + } + + data->streams[0 ].stream_id =0 ; + data->streams[0 ].stream_type = hdcp->content_type;Ok there's 0 locking here. If there's no locking then of course
CONFIG_PROVE_LOCKINGwill not spot any issues.Quoted 4 lines
It also means you're code is racy, e.g. if mei and i915 load at the same time, things could get corrupted in interesting ways. Same holds if you have ongoing hdcp2 operations going on in the
intel_hdcpcode, while the mei driver is being unloaded.Quoted 6 lines
Daniel,
Both of these cases are not possible as MEI symbols are used in I915, So I915 can't be loaded before or in parallel to MEI drivers. Similarly we can't unload the MEI before I915 or in parallel. So I guess we are out of above race mentioned
That's not how it works unfortunately. You can unbind drivers while the module is still there. And symbol availability doesn't guarantee you that the driver itself has loaded already. Same holds for i915.
Yes symbol availability not matching up with driver state is one of the neatest pitfalls of the linux driver model. Symbol availability only mostly matches driver state, but it can be different.
Quoted 7 lines
MEI related data in
intel_connector->hdcpis per connector basis. And per connector data's are protected with mutex in authentication path.In MEI HDCP driver's APIs too, there is no shared variable except
mei_cldevthat also not modified in thosemei_hdcpAPIs.
So I am not seeing any race conditions as such. So there is no need for any explicit locking between I915 and MEI.Your notifier callback needs some lock to protect against i915-side modeset calls, in case the mei disappears while we try to use them.
I think at least, I need to look at the overall picture from your git tree again.
Quoted 14 lines
Quoted 2 lines
Note that you can unload the driver without having to unload the module, those 2 things aren't coupled.
Can you please help me to understand more on this?
If you are referring to mei device removal, notification will be sent to I915.
Even if a hdcp service is placed for a mei device, that is unbinded/disabled, mei bus will gracefully decline the request.So I don't expect any possible issues. Help me if you otherwise.
Quoted 4 lines
Another reason for not using notifiers is that it's another reinvented wheel to make multi-driver stuff work. We already have the component framework for this, and we're already using the component framework for the snd-hda vs. i915 coordination.
Quoted 8 lines
Quoted 3 lines
If we need to we can do with component. Exploring what is needed here. At First glance I915 will be component master and mei will be component client.
I think you can hand-roll it with notifiers, just need to be careful that you don't hold locks too much. And that's kinda reinventing component framework in that case. Especially since you've used direct function calls, making mei a static dependency anyway.
Ok I looked at the overall picture with the git tree and I think:
- You need locking, at least for hdcp->cldev, or some other ordering guarantees around accessing that pointer.
- Given that you have a link-time dependency (by using the exported functions from mei_hdcp directly) we already have a strong dependency, and using the component framework makes sense I think. That should give you the required ordering guarantees around hdpc->cldev.
Cheers, Daniel
Quoted 131 lines
-Daniel
Quoted 124 lines
Thanks and Regards,
RamQuoted 120 lines
So here's my recommendation for getting this sorted out:
- Use the component framework to coordinate the loading of i915 and the
mei_hdcpdriver.- Bonus points for using
device_linkto tell the driver core about this, which optimizes the load sequence (unfortunately we haven't done that for snd-hda yet, instead have to work around ordering issues in the suspend/resume handlers a bit).- Drop all the
EXPORT_SYMBOLand hard links between the two drivers. Instead have a vtable, like we're using for the audio side.- Make sure that any shared state is appropriately protected with a mutex. Sprinkle lots of
assert_lock_heldover the code base to make sure you didn't miss anything, and useCONFIG_PROVE_LOCKINGto make sure there's no deadlocks and oversights.- Extend the igt
drv_module_reloadtestcase to make sure you're exercising the newEPROBE_DEFERpoint fully (should just need a kernel change to add that as a potential load failure path).I think with that we have a solid solution here which is aligned with how we handle this in other cases.
Thanks, Daniel
Quoted 92 lines
drivers/gpu/drm/i915/intel_hdcp.c +77
-0+ +return 0 ; +} + +static void intel_hdcp2_exit (struct intel_connector *connector) +{ +intel_hdcp_disable (connector); +kfree (connector->hdcp.mei_data.streams); +} + +static int mei_cldev_notify (struct notifier_block *nb,unsigned long event, +void *cldev) +{ + struct intel_hdcp *hdcp = container_of(nb, struct intel_hdcp, + mei_cldev_nb); +struct intel_connector *intel_connector =container_of (hdcp, + struct intel_connector, + hdcp); + +DRM_DEBUG_KMS ("[%s:%d] MEI_HDCP Notification. Interface: %s\n" , + intel_connector->base.name, intel_connector->base.base.id, + cldev ?"UP" :"Down" ); + +if (event ==MEI_CLDEV_ENABLED ) { + hdcp->cldev = cldev; +initialize_mei_hdcp_data (intel_connector); + }else { + hdcp->cldev =NULL ; +intel_hdcp2_exit (intel_connector); + } + +return NOTIFY_OK ; +} + +static inline +bool is_hdcp2_supported (struct drm_i915_private *dev_priv) +{ +return (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv) || +IS_KABYLAKE (dev_priv)); +} + +static int intel_hdcp2_init (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +int ret; + +if (!is_hdcp2_supported (dev_priv)) +return -EINVAL ; + + hdcp->hdcp2_supported = true; + + hdcp->mei_cldev_nb.notifier_call = mei_cldev_notify; + ret =mei_cldev_register_notify (&hdcp->mei_cldev_nb); +if (ret) { +DRM_ERROR ("mei_cldev not available. %d\n" , ret); + goto exit; + } + + ret =initialize_mei_hdcp_data (connector); +if (ret) { +mei_cldev_unregister_notify (&hdcp->mei_cldev_nb); + goto exit; + } + +/* +* Incase notifier is triggered well before this point, request for +* notification of the mei client device state. +*/ +mei_cldev_poll_notification (); + +exit: +if (ret) + hdcp->hdcp2_supported = false; + +return ret; +}drivers/gpu/drm/i915/intel_hdmi.c +1
-1@@ -2334,7 +2334,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }Signature · 1 line
2.7.4Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 30/41] drm/i915: Initialize HDCP2.2 and its MEI interface
Quoted 191 lines · Daniel Vetter
Quoted 183 lines · Daniel Vetter
Quoted 141 lines · Ramalingam C
Quoted 135 lines · Daniel Vetter
Quoted 121 lines · Ramalingam C
Initialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }drivers/gpu/drm/i915/intel_drv.h +3
-2@@ -442,7 +442,7 @@ struct intel_hdcp {/* mei interface related information */ struct mei_cl_device *cldev;struct mei_hdcp_data mei_data; - +struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; };@@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);drivers/gpu/drm/i915/intel_hdcp.c +29
-1@@ -11,6 +11,7 @@#include <linux/i2c.h> #include <linux/random.h> #include <linux/mei_hdcp.h> +#include <linux/notifier.h> #include "intel_drv.h" #include "i915_reg.h" @@ -25,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector);static int _intel_hdcp2_disable (struct intel_connector *connector);static void intel_hdcp2_check_work (struct work_struct *work);static int intel_hdcp2_check_link (struct intel_connector *connector); +static int intel_hdcp2_init (struct intel_connector *connector);static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)@@ -766,11 +768,15 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port) }int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim) +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported) {struct intel_hdcp *hdcp = &connector->hdcp;int ret; +if (!hdcp_shim) +return -EINVAL ; + ret =drm_connector_attach_content_protection_property ( &connector->base);if (ret)@@ -779,7 +785,12 @@ int intel_hdcp_init(struct intel_connector *connector, hdcp->hdcp_shim = hdcp_shim;mutex_init (&hdcp->hdcp_mutex);INIT_DELAYED_WORK (&hdcp->hdcp_check_work, intel_hdcp_check_work); +INIT_DELAYED_WORK (&hdcp->hdcp2_check_work, intel_hdcp2_check_work);INIT_WORK (&hdcp->hdcp_prop_work, intel_hdcp_prop_work); + +if (hdcp2_supported) +intel_hdcp2_init (connector); +return 0 ; }@@ -1637,3 +1648,107 @@ static void intel_hdcp2_check_work(struct work_struct *work)schedule_delayed_work (&hdcp->hdcp2_check_work,DRM_HDCP2_CHECK_PERIOD_MS ); } + +static int initialize_mei_hdcp_data (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +struct mei_hdcp_data *data = &hdcp->mei_data; +enum port port; + +if (connector->encoder) { + port = connector->encoder->port; + data->port =GET_MEI_DDI_INDEX (port); + } + + data->port_type =INTEGRATED ; + data->protocol = hdcp->hdcp_shim->hdcp_protocol (); + + data->k =1 ; +if (!data->streams)drivers/gpu/drm/i915/intel_hdcp.c static void intel_hdcp2_check_work(struct work_struct *work) · line 1677
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+ data->streams =kcalloc (data->k, +sizeof (struct hdcp2_streamid_type ), +GFP_KERNEL ); +if (!data->streams) { +DRM_ERROR ("Out of Memory\n" ); +return -ENOMEM ; + } + + data->streams[0 ].stream_id =0 ; + data->streams[0 ].stream_type = hdcp->content_type;Ok there's 0 locking here. If there's no locking then of course
CONFIG_PROVE_LOCKINGwill not spot any issues.Quoted 4 lines
It also means you're code is racy, e.g. if mei and i915 load at the same time, things could get corrupted in interesting ways. Same holds if you have ongoing hdcp2 operations going on in the
intel_hdcpcode, while the mei driver is being unloaded.Quoted 6 lines
Daniel,
Both of these cases are not possible as MEI symbols are used in I915, So I915 can't be loaded before or in parallel to MEI drivers. Similarly we can't unload the MEI before I915 or in parallel. So I guess we are out of above race mentioned
That's not how it works unfortunately. You can unbind drivers while the module is still there. And symbol availability doesn't guarantee you that the driver itself has loaded already. Same holds for i915.
Yes symbol availability not matching up with driver state is one of the neatest pitfalls of the linux driver model. Symbol availability only mostly matches driver state, but it can be different.
Quoted 7 lines
MEI related data in
intel_connector->hdcpis per connector basis. And per connector data's are protected with mutex in authentication path.In MEI HDCP driver's APIs too, there is no shared variable except
mei_cldevthat also not modified in thosemei_hdcpAPIs.
So I am not seeing any race conditions as such. So there is no need for any explicit locking between I915 and MEI.Your notifier callback needs some lock to protect against i915-side modeset calls, in case the mei disappears while we try to use them.
I think at least, I need to look at the overall picture from your git tree again.
Quoted 14 lines
Quoted 2 lines
Note that you can unload the driver without having to unload the module, those 2 things aren't coupled.
Can you please help me to understand more on this?
If you are referring to mei device removal, notification will be sent to I915.
Even if a hdcp service is placed for a mei device, that is unbinded/disabled, mei bus will gracefully decline the request.So I don't expect any possible issues. Help me if you otherwise.
Quoted 4 lines
Another reason for not using notifiers is that it's another reinvented wheel to make multi-driver stuff work. We already have the component framework for this, and we're already using the component framework for the snd-hda vs. i915 coordination.
Quoted 7 lines
Quoted 3 lines
If we need to we can do with component. Exploring what is needed here. At First glance I915 will be component master and mei will be component client.
I think you can hand-roll it with notifiers, just need to be careful that you don't hold locks too much. And that's kinda reinventing component framework in that case. Especially since you've used direct function calls, making mei a static dependency anyway.
Quoted 8 lines
Ok I looked at the overall picture with the git tree and I think:
- You need locking, at least forhdcp->cldev, or some other ordering guarantees around accessing that pointer.- Given that you have a link-time dependency (by using the exported functions from
mei_hdcpdirectly) we already have a strong dependency, and using the component framework makes sense I think. That should give you the required ordering guarantees aroundhdpc->cldev.
Daniel,
Ok. I am implementing the components for interface between I915(master) and mei_hdcp(client).
And Meanwhile I would like to request you to review other changes too.
Thanks,
Ram
Quoted 130 lines
Cheers, Daniel
Quoted 127 lines
-Daniel
Quoted 121 lines
Thanks and Regards,
RamQuoted 119 lines
So here's my recommendation for getting this sorted out:
- Use the component framework to coordinate the loading of i915 and the
mei_hdcpdriver.- Bonus points for using
device_linkto tell the driver core about this, which optimizes the load sequence (unfortunately we haven't done that for snd-hda yet, instead have to work around ordering issues in the suspend/resume handlers a bit).- Drop all the
EXPORT_SYMBOLand hard links between the two drivers. Instead have a vtable, like we're using for the audio side.- Make sure that any shared state is appropriately protected with a mutex. Sprinkle lots of
assert_lock_heldover the code base to make sure you didn't miss anything, and useCONFIG_PROVE_LOCKINGto make sure there's no deadlocks and oversights.- Extend the igt
drv_module_reloadtestcase to make sure you're exercising the newEPROBE_DEFERpoint fully (should just need a kernel change to add that as a potential load failure path).I think with that we have a solid solution here which is aligned with how we handle this in other cases.
Thanks, Daniel
Quoted 92 lines
drivers/gpu/drm/i915/intel_hdcp.c +77
-0+ +return 0 ; +} + +static void intel_hdcp2_exit (struct intel_connector *connector) +{ +intel_hdcp_disable (connector); +kfree (connector->hdcp.mei_data.streams); +} + +static int mei_cldev_notify (struct notifier_block *nb,unsigned long event, +void *cldev) +{ + struct intel_hdcp *hdcp = container_of(nb, struct intel_hdcp, + mei_cldev_nb); +struct intel_connector *intel_connector =container_of (hdcp, + struct intel_connector, + hdcp); + +DRM_DEBUG_KMS ("[%s:%d] MEI_HDCP Notification. Interface: %s\n" , + intel_connector->base.name, intel_connector->base.base.id, + cldev ?"UP" :"Down" ); + +if (event ==MEI_CLDEV_ENABLED ) { + hdcp->cldev = cldev; +initialize_mei_hdcp_data (intel_connector); + }else { + hdcp->cldev =NULL ; +intel_hdcp2_exit (intel_connector); + } + +return NOTIFY_OK ; +} + +static inline +bool is_hdcp2_supported (struct drm_i915_private *dev_priv) +{ +return (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv) || +IS_KABYLAKE (dev_priv)); +} + +static int intel_hdcp2_init (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_hdcp *hdcp = &connector->hdcp; +int ret; + +if (!is_hdcp2_supported (dev_priv)) +return -EINVAL ; + + hdcp->hdcp2_supported = true; + + hdcp->mei_cldev_nb.notifier_call = mei_cldev_notify; + ret =mei_cldev_register_notify (&hdcp->mei_cldev_nb); +if (ret) { +DRM_ERROR ("mei_cldev not available. %d\n" , ret); + goto exit; + } + + ret =initialize_mei_hdcp_data (connector); +if (ret) { +mei_cldev_unregister_notify (&hdcp->mei_cldev_nb); + goto exit; + } + +/* +* Incase notifier is triggered well before this point, request for +* notification of the mei client device state. +*/ +mei_cldev_poll_notification (); + +exit: +if (ret) + hdcp->hdcp2_supported = false; + +return ret; +}drivers/gpu/drm/i915/intel_hdmi.c +1
-1@@ -2334,7 +2334,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }Signature · 1 line
2.7.4Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 31/41 drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable
In reply to Ramalingam CAs a preparation for making the intel_hdcp_enable as common function for both HDCP1.4 and HDCP2.2, HDCP1.4 check_link scheduling is moved into _intel_hdcp_enable() function.
v3:
No Changes.
v4:
Style fix.
--- drivers/gpu/drm/i915/intel_hdcp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +8 -4
@@ -707,7 +707,7 @@ static int _intel_hdcp_enable(struct intel_connector *connector) ret =intel_hdcp_auth (conn_to_dig_port (connector), hdcp->hdcp_shim);if (!ret) -return 0 ; +break ;DRM_DEBUG_KMS ("HDCP Auth failure (%d)\n" , ret);
@@ -715,7 +715,13 @@ static int _intel_hdcp_enable(struct intel_connector *connector)_intel_hdcp_disable (connector); } -DRM_ERROR ("HDCP authentication failed (%d tries/%d)\n" , tries, ret); +if (i != tries) +schedule_delayed_work (&hdcp->hdcp_check_work, +DRM_HDCP_CHECK_PERIOD_MS ); +else +DRM_ERROR ("HDCP authentication failed (%d tries/%d)\n" , + tries, ret); +return ret; }
@@ -810,8 +816,6 @@ int intel_hdcp_enable(struct intel_connector *connector) hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ;schedule_work (&hdcp->hdcp_prop_work); -schedule_delayed_work (&hdcp->hdcp_check_work, -DRM_HDCP_CHECK_PERIOD_MS ); out:mutex_unlock (&hdcp->hdcp_mutex);return ret;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 32/41 drm/i915: Enable superior HDCP ver that is capable
In reply to Ramalingam CConsidering that HDCP2.2 is more secure than HDCP1.4, When a setup supports HDCP2.2 and HDCP1.4, HDCP2.2 will be enabled.
v2:
Included few optimization suggestions [Chris Wilson] Commit message is updated as per the rebased version.
v3:
No changes.
v4:
Extra comment added and Style issue fixed [Uma]
--- drivers/gpu/drm/i915/intel_hdcp.c | 77 +++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +70 -7
@@ -27,6 +27,58 @@ static int _intel_hdcp2_disable(struct intel_connector *connector);static void intel_hdcp2_check_work (struct work_struct *work);static int intel_hdcp2_check_link (struct intel_connector *connector);static int intel_hdcp2_init (struct intel_connector *connector); +static +int intel_hdcp_read_valid_bksv (struct intel_digital_port *intel_dig_port, +const struct intel_hdcp_shim *shim,u8 *bksv); +static +struct intel_digital_port *conn_to_dig_port (struct intel_connector *connector); + +static bool panel_supports_hdcp (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +bool capable = false; +u8 bksv[5 ]; + +if (hdcp->hdcp_shim) { +if (hdcp->hdcp_shim->hdcp_capable) { + hdcp->hdcp_shim->hdcp_capable (intel_dig_port, &capable); + }else { +if (!intel_hdcp_read_valid_bksv (intel_dig_port, + hdcp->hdcp_shim, bksv)) + capable = true; + } + } + +return capable; +} + +static inline +bool panel_supports_hdcp2 (struct intel_connector *connector) +{ +struct intel_digital_port *intel_dig_port =conn_to_dig_port (connector); +struct intel_hdcp *hdcp = &connector->hdcp; +bool capable = false; + +/* Check the panel's hdcp2.2 compliance if platform supports it. */ +if (hdcp->hdcp2_supported) + hdcp->hdcp_shim->hdcp_2_2_capable (intel_dig_port, &capable); + +return capable; +} + +/* Is HDCP1.4 capable on Platform and Panel */ +static inline bool intel_hdcp_capable (struct intel_connector *connector) +{ +return (connector->hdcp.hdcp_shim &&panel_supports_hdcp (connector)); +} + +/* Is HDCP2.2 capable on Platform and Panel */ +static inline bool intel_hdcp2_capable (struct intel_connector *connector) +{ +return (connector->hdcp.hdcp2_supported && +panel_supports_hdcp2 (connector)); +}static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim)
@@ -803,20 +855,27 @@ int intel_hdcp_init(struct intel_connector *connector,int intel_hdcp_enable (struct intel_connector *connector) {struct intel_hdcp *hdcp = &connector->hdcp; -int ret; +int ret = -EINVAL ;if (!hdcp->hdcp_shim)return -ENOENT ;mutex_lock (&hdcp->hdcp_mutex); - ret =_intel_hdcp_enable (connector); -if (ret) - goto out; +/* +* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup +* is capable of HDCP2.2, it is preferred to use HDCP2.2. +*/ +if (intel_hdcp2_capable (connector)) + ret =_intel_hdcp2_enable (connector); +else if (intel_hdcp_capable (connector)) + ret =_intel_hdcp_enable (connector); + +if (!ret) { + hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ; +schedule_work (&hdcp->hdcp_prop_work); + } - hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_ENABLED ; -schedule_work (&hdcp->hdcp_prop_work); -out:mutex_unlock (&hdcp->hdcp_mutex);return ret; }
@@ -833,10 +892,14 @@ int intel_hdcp_disable(struct intel_connector *connector)if (hdcp->hdcp_value !=DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { hdcp->hdcp_value =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +if (hdcp->hdcp2_supported) +_intel_hdcp2_disable (connector); + ret =_intel_hdcp_disable (connector); }mutex_unlock (&hdcp->hdcp_mutex); +cancel_delayed_work_sync (&hdcp->hdcp2_check_work);cancel_delayed_work_sync (&hdcp->hdcp_check_work);return ret; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 33/41 drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure
In reply to Ramalingam CWhen HDCP2.2 enabling fails and HDCP1.4 is supported, HDCP1.4 is enabled.
v2:
Rebased.
v3:
No Changes.
v4:
Reviewed-by is collected.
--- drivers/gpu/drm/i915/intel_hdcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdcp.c +3 -1
@@ -868,7 +868,9 @@ int intel_hdcp_enable(struct intel_connector *connector)*/ if (intel_hdcp2_capable (connector)) ret =_intel_hdcp2_enable (connector); -else if (intel_hdcp_capable (connector)) + +/* When HDCP2.2 fails, HDCP1.4 will be attempted */ +if (ret &&intel_hdcp_capable (connector)) ret =_intel_hdcp_enable (connector);if (!ret) {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 34/41 drm/i915: hdcp_check_link only on CP_IRQ
In reply to Ramalingam CHDCP check link is invoked only on CP_IRQ detection, instead of all short pulses.
v3:
No Changes.
v4:
Added sean in cc and collected the reviewed-by received.
--- drivers/gpu/drm/i915/intel_dp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -5
@@ -4454,8 +4454,10 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST )intel_dp_handle_test_request (intel_dp); -if (sink_irq_vector & (DP_CP_IRQ |DP_SINK_SPECIFIC_IRQ )) -DRM_DEBUG_DRIVER ("CP or sink specific irq unhandled\n" ); +if (sink_irq_vector &DP_CP_IRQ ) +intel_hdcp_check_link (intel_dp->attached_connector); +if (sink_irq_vector &DP_SINK_SPECIFIC_IRQ ) +DRM_DEBUG_DRIVER ("Sink specific irq unhandled\n" ); }/* defer to the hotplug work for link retraining if needed */
@@ -5425,9 +5427,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) handled =intel_dp_short_pulse (intel_dp); -/* 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;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 35/41 drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ
In reply to Ramalingam COn DP HDCP1.4 and 2.2, when CP_IRQ is received, start the link integrity check for the HDCP version that is enabled.
v2:
Rebased. Function name is changed.
v3:
No Changes.
v4:
No Changes.
--- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_hdcp.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -4455,7 +4455,7 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST )intel_dp_handle_test_request (intel_dp);if (sink_irq_vector &DP_CP_IRQ ) -intel_hdcp_check_link (intel_dp->attached_connector); +intel_hdcp_handle_cp_irq (intel_dp->attached_connector);if (sink_irq_vector &DP_SINK_SPECIFIC_IRQ )DRM_DEBUG_DRIVER ("Sink specific irq unhandled\n" ); }
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -1944,8 +1944,8 @@ int intel_hdcp_init(struct intel_connector *connector, bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector); -int intel_hdcp_check_link (struct intel_connector *connector);bool is_hdcp_supported (struct drm_i915_private *dev_priv,enum port port); +void intel_hdcp_handle_cp_irq (struct intel_connector *connector);/* intel_psr.c */ #define CAN_PSR (dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
drivers/gpu/drm/i915/intel_hdcp.c +30 -1
@@ -32,6 +32,7 @@ int intel_hdcp_read_valid_bksv(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim, u8 *bksv);static struct intel_digital_port *conn_to_dig_port (struct intel_connector *connector); +static int intel_hdcp_check_link (struct intel_connector *connector);static bool panel_supports_hdcp (struct intel_connector *connector) {
@@ -80,6 +81,26 @@ static inline bool intel_hdcp2_capable(struct intel_connector *connector) panel_supports_hdcp2(connector)); } +static inline bool intel_hdcp_in_force (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +enum port port = connector->encoder->port; +u32 reg; + + reg =I915_READ (PORT_HDCP_STATUS (port)); +return reg & (HDCP_STATUS_AUTH |HDCP_STATUS_ENC ); +} + +static inline bool intel_hdcp2_in_force (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +enum port port = connector->encoder->port; +u32 reg; + + reg =I915_READ (HDCP2_STATUS_DDI (port)); +return reg & (LINK_ENCRYPTION_STATUS |LINK_AUTH_STATUS ); +} +static int intel_hdcp_poll_ksv_fifo (struct intel_digital_port *intel_dig_port,const struct intel_hdcp_shim *shim) {
@@ -940,7 +961,7 @@ void intel_hdcp_atomic_check(struct drm_connector *connector, }/* Implements Part 3 of the HDCP authorization procedure */ -int intel_hdcp_check_link (struct intel_connector *connector) +static int intel_hdcp_check_link (struct intel_connector *connector) {struct intel_hdcp *hdcp = &connector->hdcp;struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
@@ -1821,3 +1842,11 @@ static int intel_hdcp2_init(struct intel_connector *connector)return ret; } + +void intel_hdcp_handle_cp_irq (struct intel_connector *connector) +{ +if (intel_hdcp_in_force (connector)) +intel_hdcp_check_link (connector); +else if (intel_hdcp2_in_force (connector)) +intel_hdcp2_check_link (connector); +}
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 36/41 drm/i915/gmbus: Increase the Bytes per Rd/Wr Op
In reply to Ramalingam CGMBUS HW supports 511Bytes as Max Bytes per single RD/WR op. Instead of enabling the 511Bytes per RD/WR cycle on legacy platforms for no absolute ROIs, this change allows the max bytes per op upto 511Bytes from Gen9 onwards.
v2:
No Change.
v3:
Inline function for max_xfer_size and renaming of the macro.[Jani]
v4:
Extra brackets removed [ville]
Commit msg is modified.
v5:
Adding the Reviewed-By received.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_i2c.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -3025,6 +3025,7 @@ enum i915_power_well_id {#define GMBUS_CYCLE_STOP (4<<25)#define GMBUS_BYTE_COUNT_SHIFT 16#define GMBUS_BYTE_COUNT_MAX 256U +#define GEN9_GMBUS_BYTE_COUNT_MAX 511U#define GMBUS_SLAVE_INDEX_SHIFT 8#define GMBUS_SLAVE_ADDR_SHIFT 1#define GMBUS_SLAVE_READ (1<<0)
drivers/gpu/drm/i915/intel_i2c.c +9 -2
@@ -361,6 +361,13 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv)return ret; } +static inline +unsigned int gmbus_max_xfer_size (struct drm_i915_private *dev_priv) +{ +return INTEL_GEN (dev_priv) >=9 ?GEN9_GMBUS_BYTE_COUNT_MAX : +GMBUS_BYTE_COUNT_MAX ; +} + static int gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv, unsigned short addr, u8 *buf, unsigned int len,
@@ -400,7 +407,7 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,int ret; do { - len = min(rx_size, GMBUS_BYTE_COUNT_MAX); + len = min(rx_size, gmbus_max_xfer_size(dev_priv)); ret = gmbus_xfer_read_chunk(dev_priv, msg->addr, buf, len, gmbus1_index);
@@ -462,7 +469,7 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg,int ret; do { - len = min(tx_size, GMBUS_BYTE_COUNT_MAX); + len = min(tx_size, gmbus_max_xfer_size(dev_priv)); ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len, gmbus1_index);
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 37/41 drm/i915/gmbus: Enable burst read
In reply to Ramalingam CSupport for Burst read in HW is added for HDCP2.2 compliance requirement.
This patch enables the burst read for all the gmbus read of more than 511Bytes, on capable platforms.
v2:
Extra line is removed.
v3:
Macro is added for detecting the BURST_READ Support [Jani] Runtime detection of the need for burst_read [Jani] Calculation enhancement.
v4:
GMBUS0 reg val is passed from caller [ville] Removed a extra var [ville]
Extra brackets are removed [ville]
Implemented the handling of 512Bytes Burst Read.
v5:
Burst read max length is fixed at 767Bytes [Ville]
--- drivers/gpu/drm/i915/i915_drv.h | 3 ++ drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_i2c.c | 62 +++++++++++++++++++++++++++++++++------- 3 files changed, 56 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2552,6 +2552,9 @@ intel_info(const struct drm_i915_private *dev_priv)*/ #define HAS_AUX_IRQ (dev_priv) true#define HAS_GMBUS_IRQ (dev_priv) (INTEL_GEN(dev_priv) >= 4) +#define HAS_GMBUS_BURST_READ (dev_priv) (INTEL_GEN(dev_priv) >= 10 || \ + IS_GEMINILAKE(dev_priv) || \ + IS_KABYLAKE(dev_priv))/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte * rows, which changed the alignment requirements and fence programming.
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -2996,6 +2996,7 @@ enum i915_power_well_id {#define GMBUS_RATE_400KHZ (2<<8)/* reserved on Pineview */ #define GMBUS_RATE_1MHZ (3<<8)/* reserved on Pineview */ #define GMBUS_HOLD_EXT (1<<7)/* 300ns hold time, rsvd on Pineview */ +#define GMBUS_BYTE_CNT_OVERRIDE (1<<6)#define GMBUS_PIN_DISABLED 0#define GMBUS_PIN_SSC 1#define GMBUS_PIN_VGADDC 2
drivers/gpu/drm/i915/intel_i2c.c +52 -10
115 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 38/41 drm/i915: Implement the HDCP2.2 support for DP
In reply to Ramalingam CImplements the DP adaptation specific HDCP2.2 functions.
These functions perform the DPCD read and write for communicating the HDCP2.2 auth message back and forth.
Note: Chris Wilson suggested alternate method for waiting for CP_IRQ, than completions concept. WIP to understand and implement that, if needed. Just to unblock the review of other changes, v2 still continues with completions.
v2:
wait for cp_irq is merged with this patch. Rebased.
v3:
wait_queue is used for wait for cp_irq [Chris Wilson]
v4:
Style fixed.
%s/PARING/PAIRING
Few style fixes [Uma]
--- drivers/gpu/drm/i915/intel_dp.c | 358 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 7 + drivers/gpu/drm/i915/intel_hdcp.c | 5 + 3 files changed, 370 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +358 -0
@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/mei_hdcp.h> #include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h>
@@ -5057,6 +5058,28 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)pps_unlock (intel_dp); } +static int intel_dp_hdcp_wait_for_cp_irq (struct intel_hdcp *hdcp, +int timeout) +{ +long ret; + +/* Reinit */ +atomic_set (&hdcp->cp_irq_recved,0 ); + +#define C (atomic_read(&hdcp->cp_irq_recved) > 0) + ret =wait_event_interruptible_timeout (hdcp->cp_irq_queue,C , +msecs_to_jiffies (timeout)); + +if (ret >0 ) { +atomic_set (&hdcp->cp_irq_recved,0 ); +return 0 ; + }else if (!ret) { +return -ETIMEDOUT ; + } +return (int )ret; +} + +static int intel_dp_hdcp_write_an_aksv (struct intel_digital_port *intel_dig_port,u8 *an)
@@ -5275,6 +5298,335 @@ int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port,return 0 ; } +static +int intel_dpcd_offset_for_hdcp2_msgid (uint8_t byte,unsigned int *offset) +{ +switch (byte) { +case HDCP_2_2_AKE_INIT : + *offset =DP_HDCP_2_2_AKE_INIT_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_CERT : + *offset =DP_HDCP_2_2_AKE_SEND_CERT_OFFSET ; +break ; +case HDCP_2_2_AKE_NO_STORED_KM : + *offset =DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_STORED_KM : + *offset =DP_HDCP_2_2_AKE_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : + *offset =DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + *offset =DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET ; +break ; +case HDCP_2_2_LC_INIT : + *offset =DP_HDCP_2_2_LC_INIT_OFFSET ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + *offset =DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET ; +break ; +case HDCP_2_2_SKE_SEND_EKS : + *offset =DP_HDCP_2_2_SKE_SEND_EKS_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + *offset =DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_ACK : + *offset =DP_HDCP_2_2_REP_SEND_ACK_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_MANAGE : + *offset =DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_READY : + *offset =DP_HDCP_2_2_REP_STREAM_READY_OFFSET ; +break ; +case HDCP_2_2_ERRATA_DP_STREAM_TYPE : + *offset =DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET ; +break ; +default : +DRM_ERROR ("Unrecognized Msg ID\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static inline +int intel_dp_hdcp2_read_rx_status (struct intel_digital_port *intel_dig_port, +uint8_t *rx_status) +{ +ssize_t ret; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RXSTATUS_OFFSET , rx_status, +HDCP_2_2_DP_RXSTATUS_LEN ); +if (ret !=HDCP_2_2_DP_RXSTATUS_LEN ) { +DRM_ERROR ("Read bstatus from DP/AUX failed (%ld)\n" , ret); +return ret >=0 ? -EIO : ret; + } + +return 0 ; +} + +static +int intel_dp_hdcp2_timeout_for_msg (uint8_t msg_id,bool paired) +{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_DP_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static +int hdcp2_detect_msg_availability (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,bool *msg_ready) +{ +uint8_t rx_status; +int ret; + + *msg_ready = false; + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret <0 ) +return ret; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_HPRIME : +if (HDCP_2_2_DP_RXSTATUS_H_PRIME (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +if (HDCP_2_2_DP_RXSTATUS_PAIRING (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : +if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + *msg_ready = true; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } + +return 0 ; +} + + +static ssize_t +intel_dp_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id) +{ +struct intel_dp *dp = &intel_dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; +int ret, timeout; +bool msg_ready = false; + + timeout =intel_dp_hdcp2_timeout_for_msg (msg_id, hdcp->is_paired); +switch (msg_id) { + +/* +* There is no way to detect the CERT, LPRIME and STREAM_READY +* availability. So Wait for timeout and read the msg. +*/ +case HDCP_2_2_AKE_SEND_CERT : +case HDCP_2_2_LC_SEND_LPRIME : +case HDCP_2_2_REP_STREAM_READY : +mdelay (timeout); + ret =0 ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +case HDCP_2_2_REP_SEND_RECVID_LIST : +intel_dp_hdcp_wait_for_cp_irq (hdcp, timeout); + ret =hdcp2_detect_msg_availability (intel_dig_port, msg_id, + &msg_ready); +if (!msg_ready) + ret = -ETIMEDOUT ; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } +if (ret) +DRM_ERROR ("msg_id %d, ret %d, timeout(mSec): %d\n" , msg_id, ret, + timeout); + +return ret; +} + +static +int intel_dp_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; +uint8_t *byte = buf; +ssize_t ret, bytes_to_write, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (*byte, &offset) <0 ) +return -EINVAL ; + +/* No msg_id in DP HDCP2.2 msgs */ + bytes_to_write = size -1 ; + byte++; + +while (bytes_to_write) { + len = bytes_to_write >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_write; + + ret =drm_dp_dpcd_write (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) +return ret; + + bytes_to_write -= ret; + byte += ret; + offset += ret; + } + +return size; +} + +static +int intel_dp_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +unsigned int offset, dev_cnt; +uint8_t *byte = buf; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +ssize_t ret, bytes_to_recv, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (msg_id, &offset) <0 ) +return -EINVAL ; + + ret =intel_dp_hdcp2_wait_for_msg (intel_dig_port, msg_id); +if (ret <0 ) +return ret; + +/* Finding the ReceiverID List size */ +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RXINFO_OFFSET , + (void *)rx_info,HDCP_2_2_RXINFO_LEN ); +if (ret !=HDCP_2_2_RXINFO_LEN ) +return ret >=0 ? -EIO : ret; + + dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 | +HDCP_2_2_DEV_COUNT_LO (rx_info[1 ])); + +if (dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) + dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ; + + size =sizeof (struct hdcp2_rep_send_receiverid_list ) - +HDCP_2_2_RECEIVER_IDS_MAX_LEN + + (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); + } + + bytes_to_recv = size -1 ; + +/* To skip the msg_id, as msgs in DP adaptation has no msg_id */ + byte++; + +while (bytes_to_recv) { + len = bytes_to_recv >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) { +DRM_DEBUG_KMS ("msg_id %d, ret %d\n" , msg_id, (int )ret); +return ret; + } + + bytes_to_recv -= ret; + byte += ret; + offset += ret; + } + byte = buf; + *byte = msg_id; + +return size; +} + +static +int intel_dp_hdcp2_config_stream_type (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +return intel_dp_hdcp2_write_msg (intel_dig_port, buf, size); +} + +static +int intel_dp_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status; +int ret; + + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret) +return ret; + +if (HDCP_2_2_DP_RXSTATUS_REAUTH_REQ (rx_status)) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_DP_RXSTATUS_LINK_FAILED (rx_status)) + ret =DRM_HDCP_LINK_INTEGRITY_FAILURE ; +else if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_dp_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t rx_caps[3 ]; +int ret; + + *capable = false; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RX_CAPS_OFFSET , + rx_caps,HDCP_2_2_RXCAPS_LEN ); +if (ret !=HDCP_2_2_RXCAPS_LEN ) +return ret >=0 ? -EIO : ret; + +if (rx_caps[0 ] ==HDCP_2_2_RXCAPS_VERSION_VAL && +HDCP_2_2_DP_HDCP_CAPABLE (rx_caps[2 ])) + *capable = true; + +return 0 ; +} + +static +enum hdcp_protocol intel_dp_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_DP ; +} +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,
@@ -5287,6 +5639,12 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .toggle_signalling = intel_dp_hdcp_toggle_signalling, .check_link = intel_dp_hdcp_check_link, .hdcp_capable = intel_dp_hdcp_capable, + .write_2_2_msg = intel_dp_hdcp2_write_msg, + .read_2_2_msg = intel_dp_hdcp2_read_msg, + .config_stream_type = intel_dp_hdcp2_config_stream_type, + .check_2_2_link = intel_dp_hdcp2_check_link, + .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .hdcp_protocol = intel_dp_hdcp2_protocol, };static void intel_edp_panel_vdd_sanitize (struct intel_dp *intel_dp)
drivers/gpu/drm/i915/intel_drv.h +7 -0
@@ -444,6 +444,13 @@ struct intel_hdcp {struct mei_hdcp_data mei_data;struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; + +/* +* Work queue to signal the CP_IRQ. Used for the waiters to read the +* available information from HDCP DP sink. +*/ +wait_queue_head_t cp_irq_queue; +atomic_t cp_irq_recved; };struct intel_connector {
drivers/gpu/drm/i915/intel_hdcp.c +5 -0
@@ -870,6 +870,8 @@ int intel_hdcp_init(struct intel_connector *connector,if (hdcp2_supported)intel_hdcp2_init (connector); +init_waitqueue_head (&hdcp->cp_irq_queue); +atomic_set (&hdcp->cp_irq_recved,0 );return 0 ; }
@@ -1849,4 +1851,7 @@ void intel_hdcp_handle_cp_irq(struct intel_connector *connector)intel_hdcp_check_link (connector); else if (intel_hdcp2_in_force(connector)) intel_hdcp2_check_link(connector); + +atomic_set (&connector->hdcp.cp_irq_recved,1 ); +wake_up_all (&connector->hdcp.cp_irq_queue); }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [Intel-gfx] [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
Thank you for the patch! Yet something to improve:
Hi Ramalingam,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20180517]
[cannot apply to v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ramalingam-C/drm-i915-Implement-HDCP2-2/20180523-031938 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-x000-201820 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
In file included from include/drm/drm_mm.h:49:0,
from include/drm/drmP.h:73,
from drivers/gpu//drm/i915/intel_dp.c:36:
drivers/gpu//drm/i915/intel_dp.c: In function 'intel_dp_hdcp2_read_rx_status':
>> drivers/gpu//drm/i915/intel_dp.c:5396:13: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'ssize_t {aka int}' [-Werror=format=]
DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret);
^
include/drm/drm_print.h:239:10: note: in definition of macro 'DRM_ERROR'
drm_err(fmt, ##__VA_ARGS__)
^~~ Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:ffs
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
Cyclomatic Complexity 3 include/linux/log2.h:is_power_of_2
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 3 include/linux/err.h:IS_ERR_OR_NULL
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_set Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_set Cyclomatic Complexity 1 include/asm-generic/atomic-long.h:atomic_long_read Cyclomatic Complexity 1 include/linux/lockdep.h:lock_is_held
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order Cyclomatic Complexity 1 include/linux/mutex.h:__mutex_owner
Cyclomatic Complexity 1 include/linux/mutex.h:mutex_is_locked
Cyclomatic Complexity 1 include/linux/jiffies.h:_msecs_to_jiffies Cyclomatic Complexity 3 include/linux/jiffies.h:msecs_to_jiffies Cyclomatic Complexity 3 include/linux/ktime.h:ktime_compare
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_after
Cyclomatic Complexity 70 include/linux/ktime.h:ktime_divns
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_to_ms
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_ms_delta
Cyclomatic Complexity 1 include/linux/timekeeping.h:ktime_get_boottime Cyclomatic Complexity 2 include/linux/workqueue.h:to_delayed_work Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_delayed_work Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 3 include/linux/slab.h:kmalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/linux/ww_mutex.h:ww_mutex_is_locked Cyclomatic Complexity 1 include/drm/drm_modeset_lock.h:drm_modeset_is_locked Cyclomatic Complexity 1 include/drm/drm_modeset_helper_vtables.h:drm_connector_helper_add Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_max_lane_count Cyclomatic Complexity 3 include/drm/drm_dp_helper.h:drm_dp_enhanced_frame_cap Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_is_branch Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_dpcd_readb Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_dpcd_writeb Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_has_quirk Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_reg.h:i915_mmio_reg_offset Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_reg.h:i915_mmio_reg_equal Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_reg.h:i915_mmio_reg_valid Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_utils.h:onoff Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_uncore.h:intel_wait_for_register Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.h:to_i915 Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:intel_info Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:msecs_to_jiffies_timeout Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_drv.h:wait_remaining_ms_from_jiffies Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:vlv_pipe_to_channel Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_get_crtc_for_pipe Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:intel_attached_encoder Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_drv.h:enc_to_dig_port Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:enc_to_intel_dp Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:dp_to_dig_port Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:dp_to_lspcon Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_crtc_has_type Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_crtc_has_dp_encoder Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_wait_for_vblank Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:intel_wait_for_vblank_if_active Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_dp_unused_lane_mask Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_to_dev Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_attached_dp Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_dp.c:intel_dp_rate_limit_len Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_common_len_rate_limit Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_max_common_rate Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_max_common_lane_count Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_dp.c:cnl_max_source_rate Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_dp.c:intel_dp_rate_index Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_dp.c:intel_dp_unpack_aux Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:vlv_pipe_has_pp_on Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:vlv_pipe_has_vdd_on Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:vlv_pipe_any Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_dp.c:vlv_initial_pps_pipe Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_dp.c:g4x_get_aux_clock_divider Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_dp.c:ilk_get_aux_clock_divider Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_dp.c:hsw_get_aux_clock_divider Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:skl_get_aux_clock_divider Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_dp.c:g4x_get_aux_send_ctl Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_dp.c:skl_get_aux_send_ctl Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_aux_header Cyclomatic Complexity 9 drivers/gpu//drm/i915/intel_dp.c:intel_dp_set_clock Cyclomatic Complexity 11 drivers/gpu//drm/i915/intel_dp.c:intel_edp_compare_alt_mode Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:wait_backlight_on Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:edp_wait_backlight_off Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:edp_panel_vdd_schedule_off Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_dp.c:downstream_hpd_needs_d0 Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_dp.c:gen4_signal_levels Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_dp.c:intel_dp_can_mst Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_get_sink_irq Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_dp.c:intel_dp_autotest_phy_pattern
vim +5396 drivers/gpu//drm/i915/intel_dp.c
5385
5386 static inline
5387 int intel_dp_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,
5388 uint8_t *rx_status)
5389 {
5390 ssize_t ret;
5391
5392 ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux,
5393 DP_HDCP_2_2_REG_RXSTATUS_OFFSET, rx_status,
5394 HDCP_2_2_DP_RXSTATUS_LEN);
5395 if (ret != HDCP_2_2_DP_RXSTATUS_LEN) {
> 5396 DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret); 5397 return ret >= 0 ? -EIO : ret;
5398 }
5399
5400 return 0;
5401 }
5402
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [Intel-gfx] [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
In reply to Ramalingam CThank you for the patch! Perhaps something to improve:
Hi Ramalingam,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on next-20180517]
[cannot apply to v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ramalingam-C/drm-i915-Implement-HDCP2-2/20180523-031938 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-x012-201820 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/drm/drm_mm.h:49:0,
from include/drm/drmP.h:73,
from drivers/gpu/drm/i915/intel_dp.c:36:
drivers/gpu/drm/i915/intel_dp.c: In function 'intel_dp_hdcp2_read_rx_status':
>> drivers/gpu/drm/i915/intel_dp.c:5396:13: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'ssize_t {aka int}' [-Wformat=]
DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret);
^
include/drm/drm_print.h:239:10: note: in definition of macro 'DRM_ERROR'
drm_err(fmt, ##__VA_ARGS__)
^~~vim +5396 drivers/gpu/drm/i915/intel_dp.c
5385
5386 static inline
5387 int intel_dp_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,
5388 uint8_t *rx_status)
5389 {
5390 ssize_t ret;
5391
5392 ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux,
5393 DP_HDCP_2_2_REG_RXSTATUS_OFFSET, rx_status,
5394 HDCP_2_2_DP_RXSTATUS_LEN);
5395 if (ret != HDCP_2_2_DP_RXSTATUS_LEN) {
> 5396 DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret); 5397 return ret >= 0 ? -EIO : ret;
5398 }
5399
5400 return 0;
5401 }
5402
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
In reply to Ramalingam CQuoted 68 lines · Ramalingam C
Implements the DP adaptation specific HDCP2.2 functions.
These functions perform the DPCD read and write for communicating the HDCP2.2 auth message back and forth.
Note: Chris Wilson suggested alternate method for waiting for
CP_IRQ, than completions concept. WIP to understand and implement that, if needed. Just to unblock the review of other changes, v2 still continues with completions.v2:
wait forcp_irqis merged with this patch. Rebased.
v3:
wait_queueis used for wait forcp_irq[Chris Wilson]
v4:
Style fixed.
%s/PARING/PAIRING
Few style fixes [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 358 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 7 + drivers/gpu/drm/i915/intel_hdcp.c | 5 + 3 files changed, 370 insertions(+)drivers/gpu/drm/i915/intel_dp.c +23
-0@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/mei_hdcp.h> #include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> @@ -5057,6 +5058,28 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)pps_unlock (intel_dp); } +static int intel_dp_hdcp_wait_for_cp_irq (struct intel_hdcp *hdcp, +int timeout) +{ +long ret; + +/* Reinit */ +atomic_set (&hdcp->cp_irq_recved,0 ); + +#define C (atomic_read(&hdcp->cp_irq_recved) > 0) + ret =wait_event_interruptible_timeout (hdcp->cp_irq_queue,C , +msecs_to_jiffies (timeout)); + +if (ret >0 ) { +atomic_set (&hdcp->cp_irq_recved,0 ); +return 0 ; + }else if (!ret) { +return -ETIMEDOUT ; + } +return (int )ret; +} + +static int intel_dp_hdcp_write_an_aksv (struct intel_digital_port *intel_dig_port,u8 *an)
drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, · line 5302
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -5275,6 +5298,335 @@ int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port,return 0 ; } +static +int intel_dpcd_offset_for_hdcp2_msgid (uint8_t byte,unsigned int *offset)
Ugh, this is annoying that we have to map things around like that. But looking at the numbers the standards really don't seem to match at all.
Instead of open-coding this I suggested you use a table with a struct like:
const static struct hdcp_dp {
int hdcp_msg;
int dpcd_offset;
int timeout;
/* whatever else you might need */
} hdcp_2_dp_table[] = {
{ HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, ... },
...
};Then just search that table in the code instead of the huge switch table below.
Quoted 61 lines
drivers/gpu/drm/i915/intel_dp.c +61
-0+{ +switch (byte) { +case HDCP_2_2_AKE_INIT : + *offset =DP_HDCP_2_2_AKE_INIT_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_CERT : + *offset =DP_HDCP_2_2_AKE_SEND_CERT_OFFSET ; +break ; +case HDCP_2_2_AKE_NO_STORED_KM : + *offset =DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_STORED_KM : + *offset =DP_HDCP_2_2_AKE_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : + *offset =DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + *offset =DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET ; +break ; +case HDCP_2_2_LC_INIT : + *offset =DP_HDCP_2_2_LC_INIT_OFFSET ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + *offset =DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET ; +break ; +case HDCP_2_2_SKE_SEND_EKS : + *offset =DP_HDCP_2_2_SKE_SEND_EKS_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + *offset =DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_ACK : + *offset =DP_HDCP_2_2_REP_SEND_ACK_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_MANAGE : + *offset =DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_READY : + *offset =DP_HDCP_2_2_REP_STREAM_READY_OFFSET ; +break ; +case HDCP_2_2_ERRATA_DP_STREAM_TYPE : + *offset =DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET ; +break ; +default : +DRM_ERROR ("Unrecognized Msg ID\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static inline +int intel_dp_hdcp2_read_rx_status (struct intel_digital_port *intel_dig_port, +uint8_t *rx_status) +{ +ssize_t ret; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RXSTATUS_OFFSET , rx_status, +HDCP_2_2_DP_RXSTATUS_LEN );
drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, · line 5373
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+if (ret !=HDCP_2_2_DP_RXSTATUS_LEN ) { +DRM_ERROR ("Read bstatus from DP/AUX failed (%ld)\n" , ret); +return ret >=0 ? -EIO : ret; + } + +return 0 ; +} + +static +int intel_dp_hdcp2_timeout_for_msg (uint8_t msg_id,bool paired)
For the timeout and the availability check below, is that not the same for hdmi? Might be good to set the timeout/check values once, and perhaps pass that then down to the dp/hdmi implementation, instead of computing it here.
All these functions here look like a huge layering violation. Imo all this timeout stuff should be handled higher up, or at least more tightly grouped together.
Remapping from the HDCP_2_2 defines to the dpcd offsets is imo different than all the stuff below here.
-Daniel
Quoted 314 lines
drivers/gpu/drm/i915/intel_dp.c +262
-0+{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_DP_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static +int hdcp2_detect_msg_availability (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,bool *msg_ready) +{ +uint8_t rx_status; +int ret; + + *msg_ready = false; + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret <0 ) +return ret; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_HPRIME : +if (HDCP_2_2_DP_RXSTATUS_H_PRIME (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +if (HDCP_2_2_DP_RXSTATUS_PAIRING (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : +if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + *msg_ready = true; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } + +return 0 ; +} + + +static ssize_t +intel_dp_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id) +{ +struct intel_dp *dp = &intel_dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; +int ret, timeout; +bool msg_ready = false; + + timeout =intel_dp_hdcp2_timeout_for_msg (msg_id, hdcp->is_paired); +switch (msg_id) { + +/* +* There is no way to detect the CERT, LPRIME and STREAM_READY +* availability. So Wait for timeout and read the msg. +*/ +case HDCP_2_2_AKE_SEND_CERT : +case HDCP_2_2_LC_SEND_LPRIME : +case HDCP_2_2_REP_STREAM_READY : +mdelay (timeout); + ret =0 ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +case HDCP_2_2_REP_SEND_RECVID_LIST : +intel_dp_hdcp_wait_for_cp_irq (hdcp, timeout); + ret =hdcp2_detect_msg_availability (intel_dig_port, msg_id, + &msg_ready); +if (!msg_ready) + ret = -ETIMEDOUT ; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } +if (ret) +DRM_ERROR ("msg_id %d, ret %d, timeout(mSec): %d\n" , msg_id, ret, + timeout); + +return ret; +} + +static +int intel_dp_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; +uint8_t *byte = buf; +ssize_t ret, bytes_to_write, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (*byte, &offset) <0 ) +return -EINVAL ; + +/* No msg_id in DP HDCP2.2 msgs */ + bytes_to_write = size -1 ; + byte++; + +while (bytes_to_write) { + len = bytes_to_write >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_write; + + ret =drm_dp_dpcd_write (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) +return ret; + + bytes_to_write -= ret; + byte += ret; + offset += ret; + } + +return size; +} + +static +int intel_dp_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +unsigned int offset, dev_cnt; +uint8_t *byte = buf; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +ssize_t ret, bytes_to_recv, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (msg_id, &offset) <0 ) +return -EINVAL ; + + ret =intel_dp_hdcp2_wait_for_msg (intel_dig_port, msg_id); +if (ret <0 ) +return ret; + +/* Finding the ReceiverID List size */ +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RXINFO_OFFSET , + (void *)rx_info,HDCP_2_2_RXINFO_LEN ); +if (ret !=HDCP_2_2_RXINFO_LEN ) +return ret >=0 ? -EIO : ret; + + dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 | +HDCP_2_2_DEV_COUNT_LO (rx_info[1 ])); + +if (dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) + dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ; + + size =sizeof (struct hdcp2_rep_send_receiverid_list ) - +HDCP_2_2_RECEIVER_IDS_MAX_LEN + + (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); + } + + bytes_to_recv = size -1 ; + +/* To skip the msg_id, as msgs in DP adaptation has no msg_id */ + byte++; + +while (bytes_to_recv) { + len = bytes_to_recv >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) { +DRM_DEBUG_KMS ("msg_id %d, ret %d\n" , msg_id, (int )ret); +return ret; + } + + bytes_to_recv -= ret; + byte += ret; + offset += ret; + } + byte = buf; + *byte = msg_id; + +return size; +} + +static +int intel_dp_hdcp2_config_stream_type (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +return intel_dp_hdcp2_write_msg (intel_dig_port, buf, size); +} + +static +int intel_dp_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status; +int ret; + + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret) +return ret; + +if (HDCP_2_2_DP_RXSTATUS_REAUTH_REQ (rx_status)) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_DP_RXSTATUS_LINK_FAILED (rx_status)) + ret =DRM_HDCP_LINK_INTEGRITY_FAILURE ; +else if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_dp_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t rx_caps[3 ]; +int ret; + + *capable = false; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RX_CAPS_OFFSET , + rx_caps,HDCP_2_2_RXCAPS_LEN ); +if (ret !=HDCP_2_2_RXCAPS_LEN ) +return ret >=0 ? -EIO : ret; + +if (rx_caps[0 ] ==HDCP_2_2_RXCAPS_VERSION_VAL && +HDCP_2_2_DP_HDCP_CAPABLE (rx_caps[2 ])) + *capable = true; + +return 0 ; +} + +static +enum hdcp_protocol intel_dp_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_DP ; +} +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,@@ -5287,6 +5639,12 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .toggle_signalling = intel_dp_hdcp_toggle_signalling, .check_link = intel_dp_hdcp_check_link, .hdcp_capable = intel_dp_hdcp_capable, + .write_2_2_msg = intel_dp_hdcp2_write_msg, + .read_2_2_msg = intel_dp_hdcp2_read_msg, + .config_stream_type = intel_dp_hdcp2_config_stream_type, + .check_2_2_link = intel_dp_hdcp2_check_link, + .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .hdcp_protocol = intel_dp_hdcp2_protocol, };static void intel_edp_panel_vdd_sanitize (struct intel_dp *intel_dp)drivers/gpu/drm/i915/intel_drv.h +7
-0@@ -444,6 +444,13 @@ struct intel_hdcp {struct mei_hdcp_data mei_data;struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; + +/* +* Work queue to signal the CP_IRQ. Used for the waiters to read the +* available information from HDCP DP sink. +*/ +wait_queue_head_t cp_irq_queue; +atomic_t cp_irq_recved; };struct intel_connector {drivers/gpu/drm/i915/intel_hdcp.c +5
-0@@ -870,6 +870,8 @@ int intel_hdcp_init(struct intel_connector *connector,if (hdcp2_supported)intel_hdcp2_init (connector); +init_waitqueue_head (&hdcp->cp_irq_queue); +atomic_set (&hdcp->cp_irq_recved,0 );return 0 ; }@@ -1849,4 +1851,7 @@ void intel_hdcp_handle_cp_irq(struct intel_connector *connector)intel_hdcp_check_link (connector); else if (intel_hdcp2_in_force(connector)) intel_hdcp2_check_link(connector); + +atomic_set (&connector->hdcp.cp_irq_recved,1 ); +wake_up_all (&connector->hdcp.cp_irq_queue); }Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
Quoted 72 lines · Daniel Vetter
Quoted 71 lines · Ramalingam C
Implements the DP adaptation specific HDCP2.2 functions.
These functions perform the DPCD read and write for communicating the HDCP2.2 auth message back and forth.
Note: Chris Wilson suggested alternate method for waiting for
CP_IRQ, than completions concept. WIP to understand and implement that, if needed. Just to unblock the review of other changes, v2 still continues with completions.v2:
wait forcp_irqis merged with this patch. Rebased.
v3:
wait_queueis used for wait forcp_irq[Chris Wilson]
v4:
Style fixed.
%s/PARING/PAIRING
Few style fixes [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 358 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 7 + drivers/gpu/drm/i915/intel_hdcp.c | 5 + 3 files changed, 370 insertions(+)drivers/gpu/drm/i915/intel_dp.c +23
-0@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/mei_hdcp.h> #include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> @@ -5057,6 +5058,28 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)pps_unlock (intel_dp); } +static int intel_dp_hdcp_wait_for_cp_irq (struct intel_hdcp *hdcp, +int timeout) +{ +long ret; + +/* Reinit */ +atomic_set (&hdcp->cp_irq_recved,0 ); + +#define C (atomic_read(&hdcp->cp_irq_recved) > 0) + ret =wait_event_interruptible_timeout (hdcp->cp_irq_queue,C , +msecs_to_jiffies (timeout)); + +if (ret >0 ) { +atomic_set (&hdcp->cp_irq_recved,0 ); +return 0 ; + }else if (!ret) { +return -ETIMEDOUT ; + } +return (int )ret; +} + +static int intel_dp_hdcp_write_an_aksv (struct intel_digital_port *intel_dig_port,u8 *an)@@ -5275,6 +5298,335 @@ int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port,return 0 ; }
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, · line 5302
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2
-0+static +int intel_dpcd_offset_for_hdcp2_msgid (uint8_t byte,unsigned int *offset)Ugh, this is annoying that we have to map things around like that. But looking at the numbers the standards really don't seem to match at all.
Sorry i am not getting about not matching part.
You mean some offsets and timeouts are not matching with spec?
Quoted 14 lines
Instead of open-coding this I suggested you use a table with a struct like:
const static struct hdcp_dp { int hdcp_msg; int dpcd_offset; int timeout; /* whatever else you might need */ } hdcp_2_dp_table[] = { { HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, ... }, ... };
Quoted 2 lines
Then just search that table in the code instead of the huge switch table below.
Suggesting this for cpu optimization or for coding style?
Quoted 77 lines
Quoted 62 lines
drivers/gpu/drm/i915/intel_dp.c +61
-0+{ +switch (byte) { +case HDCP_2_2_AKE_INIT : + *offset =DP_HDCP_2_2_AKE_INIT_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_CERT : + *offset =DP_HDCP_2_2_AKE_SEND_CERT_OFFSET ; +break ; +case HDCP_2_2_AKE_NO_STORED_KM : + *offset =DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_STORED_KM : + *offset =DP_HDCP_2_2_AKE_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : + *offset =DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + *offset =DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET ; +break ; +case HDCP_2_2_LC_INIT : + *offset =DP_HDCP_2_2_LC_INIT_OFFSET ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + *offset =DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET ; +break ; +case HDCP_2_2_SKE_SEND_EKS : + *offset =DP_HDCP_2_2_SKE_SEND_EKS_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + *offset =DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_ACK : + *offset =DP_HDCP_2_2_REP_SEND_ACK_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_MANAGE : + *offset =DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_READY : + *offset =DP_HDCP_2_2_REP_STREAM_READY_OFFSET ; +break ; +case HDCP_2_2_ERRATA_DP_STREAM_TYPE : + *offset =DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET ; +break ; +default : +DRM_ERROR ("Unrecognized Msg ID\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static inline +int intel_dp_hdcp2_read_rx_status (struct intel_digital_port *intel_dig_port, +uint8_t *rx_status) +{ +ssize_t ret; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RXSTATUS_OFFSET , rx_status, +HDCP_2_2_DP_RXSTATUS_LEN );drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, · line 5373
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+if (ret !=HDCP_2_2_DP_RXSTATUS_LEN ) { +DRM_ERROR ("Read bstatus from DP/AUX failed (%ld)\n" , ret); +return ret >=0 ? -EIO : ret; + } + +return 0 ; +} + +static +int intel_dp_hdcp2_timeout_for_msg (uint8_t msg_id,bool paired)For the timeout and the availability check below, is that not the same for hdmi? Might be good to set the timeout/check values once, and perhaps pass that then down to the dp/hdmi implementation, instead of computing it here.
Quoted 3 lines
All these functions here look like a huge layering violation. Imo all this timeout stuff should be handled higher up, or at least more tightly grouped together.
Between HDMI and DP adaptation differences are there but very minimal. Message avialbility check is completely different between HDMI and DP. DP uses the cp_irq. And timeout also varies for a DP HDCP msg.
Since we are adapting the HDCP1.4 design where all encoder specific operations are pushed into hdcp_shim, I have implemented all HDMI and DP related operation to their respective shims.
So that we need not do more if(dp/hdmi) in common code intel_hdcp.c atleast.
The first design I had shared using the drm helper functions, dont have different flows for HDMI and DP. Where ever different treatment is required based on the adaptation, that was taken care then and there.
-Ram
Quoted 307 lines
Remapping from the
HDCP_2_2defines to the dpcd offsets is imo different than all the stuff below here.
-DanielQuoted 303 lines
drivers/gpu/drm/i915/intel_dp.c +262
-0+{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_DP_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static +int hdcp2_detect_msg_availability (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,bool *msg_ready) +{ +uint8_t rx_status; +int ret; + + *msg_ready = false; + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret <0 ) +return ret; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_HPRIME : +if (HDCP_2_2_DP_RXSTATUS_H_PRIME (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +if (HDCP_2_2_DP_RXSTATUS_PAIRING (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : +if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + *msg_ready = true; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } + +return 0 ; +} + + +static ssize_t +intel_dp_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id) +{ +struct intel_dp *dp = &intel_dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; +int ret, timeout; +bool msg_ready = false; + + timeout =intel_dp_hdcp2_timeout_for_msg (msg_id, hdcp->is_paired); +switch (msg_id) { + +/* +* There is no way to detect the CERT, LPRIME and STREAM_READY +* availability. So Wait for timeout and read the msg. +*/ +case HDCP_2_2_AKE_SEND_CERT : +case HDCP_2_2_LC_SEND_LPRIME : +case HDCP_2_2_REP_STREAM_READY : +mdelay (timeout); + ret =0 ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +case HDCP_2_2_REP_SEND_RECVID_LIST : +intel_dp_hdcp_wait_for_cp_irq (hdcp, timeout); + ret =hdcp2_detect_msg_availability (intel_dig_port, msg_id, + &msg_ready); +if (!msg_ready) + ret = -ETIMEDOUT ; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } +if (ret) +DRM_ERROR ("msg_id %d, ret %d, timeout(mSec): %d\n" , msg_id, ret, + timeout); + +return ret; +} + +static +int intel_dp_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; +uint8_t *byte = buf; +ssize_t ret, bytes_to_write, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (*byte, &offset) <0 ) +return -EINVAL ; + +/* No msg_id in DP HDCP2.2 msgs */ + bytes_to_write = size -1 ; + byte++; + +while (bytes_to_write) { + len = bytes_to_write >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_write; + + ret =drm_dp_dpcd_write (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) +return ret; + + bytes_to_write -= ret; + byte += ret; + offset += ret; + } + +return size; +} + +static +int intel_dp_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +unsigned int offset, dev_cnt; +uint8_t *byte = buf; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +ssize_t ret, bytes_to_recv, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (msg_id, &offset) <0 ) +return -EINVAL ; + + ret =intel_dp_hdcp2_wait_for_msg (intel_dig_port, msg_id); +if (ret <0 ) +return ret; + +/* Finding the ReceiverID List size */ +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RXINFO_OFFSET , + (void *)rx_info,HDCP_2_2_RXINFO_LEN ); +if (ret !=HDCP_2_2_RXINFO_LEN ) +return ret >=0 ? -EIO : ret; + + dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 | +HDCP_2_2_DEV_COUNT_LO (rx_info[1 ])); + +if (dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) + dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ; + + size =sizeof (struct hdcp2_rep_send_receiverid_list ) - +HDCP_2_2_RECEIVER_IDS_MAX_LEN + + (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); + } + + bytes_to_recv = size -1 ; + +/* To skip the msg_id, as msgs in DP adaptation has no msg_id */ + byte++; + +while (bytes_to_recv) { + len = bytes_to_recv >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) { +DRM_DEBUG_KMS ("msg_id %d, ret %d\n" , msg_id, (int )ret); +return ret; + } + + bytes_to_recv -= ret; + byte += ret; + offset += ret; + } + byte = buf; + *byte = msg_id; + +return size; +} + +static +int intel_dp_hdcp2_config_stream_type (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +return intel_dp_hdcp2_write_msg (intel_dig_port, buf, size); +} + +static +int intel_dp_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status; +int ret; + + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret) +return ret; + +if (HDCP_2_2_DP_RXSTATUS_REAUTH_REQ (rx_status)) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_DP_RXSTATUS_LINK_FAILED (rx_status)) + ret =DRM_HDCP_LINK_INTEGRITY_FAILURE ; +else if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_dp_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t rx_caps[3 ]; +int ret; + + *capable = false; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RX_CAPS_OFFSET , + rx_caps,HDCP_2_2_RXCAPS_LEN ); +if (ret !=HDCP_2_2_RXCAPS_LEN ) +return ret >=0 ? -EIO : ret; + +if (rx_caps[0 ] ==HDCP_2_2_RXCAPS_VERSION_VAL && +HDCP_2_2_DP_HDCP_CAPABLE (rx_caps[2 ])) + *capable = true; + +return 0 ; +} + +static +enum hdcp_protocol intel_dp_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_DP ; +} +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,@@ -5287,6 +5639,12 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .toggle_signalling = intel_dp_hdcp_toggle_signalling, .check_link = intel_dp_hdcp_check_link, .hdcp_capable = intel_dp_hdcp_capable, + .write_2_2_msg = intel_dp_hdcp2_write_msg, + .read_2_2_msg = intel_dp_hdcp2_read_msg, + .config_stream_type = intel_dp_hdcp2_config_stream_type, + .check_2_2_link = intel_dp_hdcp2_check_link, + .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .hdcp_protocol = intel_dp_hdcp2_protocol, };static void intel_edp_panel_vdd_sanitize (struct intel_dp *intel_dp)drivers/gpu/drm/i915/intel_drv.h +7
-0@@ -444,6 +444,13 @@ struct intel_hdcp {struct mei_hdcp_data mei_data;struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; + +/* +* Work queue to signal the CP_IRQ. Used for the waiters to read the +* available information from HDCP DP sink. +*/ +wait_queue_head_t cp_irq_queue; +atomic_t cp_irq_recved; };struct intel_connector {drivers/gpu/drm/i915/intel_hdcp.c +2
-0@@ -870,6 +870,8 @@ int intel_hdcp_init(struct intel_connector *connector,if (hdcp2_supported)intel_hdcp2_init (connector); +init_waitqueue_head (&hdcp->cp_irq_queue); +atomic_set (&hdcp->cp_irq_recved,0 );return 0 ; }
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_hdcp.c +3
-0@@ -1849,4 +1851,7 @@ void intel_hdcp_handle_cp_irq(struct intel_connector *connector)intel_hdcp_check_link (connector); else if (intel_hdcp2_in_force(connector)) intel_hdcp2_check_link(connector); + +atomic_set (&connector->hdcp.cp_irq_recved,1 ); +wake_up_all (&connector->hdcp.cp_irq_queue); }Signature · 1 line
2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
Quoted 88 lines · Ramalingam C
Quoted 76 lines · Daniel Vetter
Quoted 74 lines · Ramalingam C
Implements the DP adaptation specific HDCP2.2 functions.
These functions perform the DPCD read and write for communicating the HDCP2.2 auth message back and forth.
Note: Chris Wilson suggested alternate method for waiting for
CP_IRQ, than completions concept. WIP to understand and implement that, if needed. Just to unblock the review of other changes, v2 still continues with completions.v2:
wait forcp_irqis merged with this patch. Rebased.
v3:
wait_queueis used for wait forcp_irq[Chris Wilson]
v4:
Style fixed.
%s/PARING/PAIRING
Few style fixes [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 358 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 7 + drivers/gpu/drm/i915/intel_hdcp.c | 5 + 3 files changed, 370 insertions(+)drivers/gpu/drm/i915/intel_dp.c +22
-0@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/mei_hdcp.h> #include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> @@ -5057,6 +5058,28 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)pps_unlock (intel_dp); } +static int intel_dp_hdcp_wait_for_cp_irq(struct intel_hdcp *hdcp, +int timeout) +{ +long ret; + +/* Reinit */ +atomic_set (&hdcp->cp_irq_recved,0 ); + +#define C (atomic_read(&hdcp->cp_irq_recved) > 0) + ret =wait_event_interruptible_timeout (hdcp->cp_irq_queue,C , +msecs_to_jiffies (timeout)); + +if (ret >0 ) { +atomic_set (&hdcp->cp_irq_recved,0 ); +return 0 ; + }else if (!ret) { +return -ETIMEDOUT ; + } +return (int )ret; +} + +static int intel_dp_hdcp_write_an_aksv(struct intel_digital_port
*intel_dig_port,u8 *an)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -5275,6 +5298,335 @@ int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port,Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct · line 5303
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0return 0 ; } +static +int intel_dpcd_offset_for_hdcp2_msgid (uint8_t byte,unsigned int *offset)Ugh, this is annoying that we have to map things around like that. But looking at the numbers the standards really don't seem to match at all.
Quoted 2 lines
Sorry i am not getting about not matching part.
You mean some offsets and timeouts are not matching with spec?
match as in you can't just compute them using a base_offset + hdcp_msgid trick, you do have to use the lookup table. The numbers itself match the spec, it's just that the specs are all inconsistent with each another for no real good reason.
Quoted 15 lines
Quoted 15 lines
Instead of open-coding this I suggested you use a table with a struct like:
const static struct hdcp_dp { int hdcp_msg; int dpcd_offset; int timeout; /* whatever else you might need */ } hdcp_2_dp_table[] = { { HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, ... }, ... };
Quoted 4 lines
Quoted 2 lines
Then just search that table in the code instead of the huge switch table below.
Suggesting this for cpu optimization or for coding style?
Just coding style, having to check a table is easier than checking huge case statements. None of this code matters from a performance pov.
Quoted 98 lines
Quoted 83 lines
Quoted 69 lines
drivers/gpu/drm/i915/intel_dp.c +60
-0+{ +switch (byte) { +case HDCP_2_2_AKE_INIT : + *offset =DP_HDCP_2_2_AKE_INIT_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_CERT : + *offset =DP_HDCP_2_2_AKE_SEND_CERT_OFFSET ; +break ; +case HDCP_2_2_AKE_NO_STORED_KM : + *offset =DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_STORED_KM : + *offset =DP_HDCP_2_2_AKE_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : + *offset =DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + *offset =DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET ; +break ; +case HDCP_2_2_LC_INIT : + *offset =DP_HDCP_2_2_LC_INIT_OFFSET ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + *offset =DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET ; +break ; +case HDCP_2_2_SKE_SEND_EKS : + *offset =DP_HDCP_2_2_SKE_SEND_EKS_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + *offset =DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_ACK : + *offset =DP_HDCP_2_2_REP_SEND_ACK_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_MANAGE : + *offset =DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_READY : + *offset =DP_HDCP_2_2_REP_STREAM_READY_OFFSET ; +break ; +case HDCP_2_2_ERRATA_DP_STREAM_TYPE : + *offset =DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET ; +break ; +default : +DRM_ERROR ("Unrecognized Msg ID\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static inline +int intel_dp_hdcp2_read_rx_status (struct intel_digital_port *intel_dig_port, +uint8_t *rx_status) +{ +ssize_t ret; + + ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, + DP_HDCP_2_2_REG_RXSTATUS_OFFSET,
rx_status,drivers/gpu/drm/i915/intel_dp.c +3
-0+ HDCP_2_2_DP_RXSTATUS_LEN); +if (ret !=HDCP_2_2_DP_RXSTATUS_LEN ) { + DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n",ret);
drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, · line 5373
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+return ret >=0 ? -EIO : ret; + } + +return 0 ; +} + +static +int intel_dp_hdcp2_timeout_for_msg (uint8_t msg_id,bool paired)For the timeout and the availability check below, is that not the same for hdmi? Might be good to set the timeout/check values once, and perhaps pass that then down to the dp/hdmi implementation, instead of computing it here.
Quoted 3 lines
All these functions here look like a huge layering violation. Imo all this timeout stuff should be handled higher up, or at least more tightly grouped together.
Between HDMI and DP adaptation differences are there but very minimal. Message avialbility check is completely different between HDMI and DP. DP uses the
cp_irq.
And timeout also varies for a DP HDCP msg.Since we are adapting the HDCP1.4 design where all encoder specific operations are pushed into
hdcp_shim,
I have implemented all HDMI and DP related operation to their respective shims.
So that we need not do more if(dp/hdmi) in common codeintel_hdcp.catleast.
Quoted 4 lines
The first design I had shared using the drm helper functions, dont have different flows for HDMI and DP.
Where ever different treatment is required based on the adaptation, that was taken care then and there.
I'm not against having dp/hdmi specific functions, I'm against having to spread that specific stuff all around in different places. If you need msgid specific timeouts between DP and HDMI then maybe stuff them into the lookup table, but from a quick look it seemed like that's not the case.
And if the hdcp1.4 shim design is getting in the way, we need to fix that. The hdcp1.4 shim is indeed a bit looking like a midlayer, so it getting in the way is no surprise really.
-Daniel
Quoted 333 lines
-Ram
Quoted 328 lines
Remapping from the
HDCP_2_2defines to the dpcd offsets is imo different than all the stuff below here.
-DanielQuoted 324 lines
drivers/gpu/drm/i915/intel_dp.c +35
-0+{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_DP_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static +int hdcp2_detect_msg_availability(struct intel_digital_port
*intel_dig_port,drivers/gpu/drm/i915/intel_dp.c +42
-0+ uint8_t msg_id, bool *msg_ready) +{ + uint8_t rx_status; +int ret; + + *msg_ready = false; + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret <0 ) +return ret; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_HPRIME : +if (HDCP_2_2_DP_RXSTATUS_H_PRIME (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +if (HDCP_2_2_DP_RXSTATUS_PAIRING (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : +if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + *msg_ready = true; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } + +return 0 ; +} + + +static ssize_t +intel_dp_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id) +{ +struct intel_dp *dp = &intel_dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; +int ret, timeout; +bool msg_ready = false; + + timeout = intel_dp_hdcp2_timeout_for_msg(msg_id,
hdcp->is_paired);drivers/gpu/drm/i915/intel_dp.c +17
-0+switch (msg_id) { + +/* +* There is no way to detect the CERT, LPRIME and STREAM_READY +* availability. So Wait for timeout and read the msg. +*/ +case HDCP_2_2_AKE_SEND_CERT : +case HDCP_2_2_LC_SEND_LPRIME : +case HDCP_2_2_REP_STREAM_READY : +mdelay (timeout); + ret =0 ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +case HDCP_2_2_REP_SEND_RECVID_LIST : +intel_dp_hdcp_wait_for_cp_irq (hdcp, timeout); + ret = hdcp2_detect_msg_availability(intel_dig_port,
msg_id,drivers/gpu/drm/i915/intel_dp.c +10
-0+ &msg_ready); +if (!msg_ready) + ret = -ETIMEDOUT ; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } +if (ret) + DRM_ERROR("msg_id %d, ret %d, timeout(mSec): %d\n",
msg_id, ret,drivers/gpu/drm/i915/intel_dp.c +23
-0+ timeout); + +return ret; +} + +static +int intel_dp_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; +uint8_t *byte = buf; +ssize_t ret, bytes_to_write, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (*byte, &offset) <0 ) +return -EINVAL ; + +/* No msg_id in DP HDCP2.2 msgs */ + bytes_to_write = size -1 ; + byte++; + +while (bytes_to_write) { + len = bytes_to_write >DP_AUX_MAX_PAYLOAD_BYTES ? + DP_AUX_MAX_PAYLOAD_BYTES :
bytes_to_write;drivers/gpu/drm/i915/intel_dp.c +35
-0+ + ret =drm_dp_dpcd_write (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) +return ret; + + bytes_to_write -= ret; + byte += ret; + offset += ret; + } + +return size; +} + +static +int intel_dp_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +unsigned int offset, dev_cnt; +uint8_t *byte = buf; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +ssize_t ret, bytes_to_recv, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (msg_id, &offset) <0 ) +return -EINVAL ; + + ret =intel_dp_hdcp2_wait_for_msg (intel_dig_port, msg_id); +if (ret <0 ) +return ret; + +/* Finding the ReceiverID List size */ +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { + ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, + DP_HDCP_2_2_REG_RXINFO_OFFSET, + (void *)rx_info,
HDCP_2_2_RXINFO_LEN);drivers/gpu/drm/i915/intel_dp.c +27
-0+if (ret !=HDCP_2_2_RXINFO_LEN ) +return ret >=0 ? -EIO : ret; + + dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 | +HDCP_2_2_DEV_COUNT_LO (rx_info[1 ])); + +if (dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) + dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ; + + size =sizeof (struct hdcp2_rep_send_receiverid_list ) - +HDCP_2_2_RECEIVER_IDS_MAX_LEN + + (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); + } + + bytes_to_recv = size -1 ; + +/* To skip the msg_id, as msgs in DP adaptation has no msg_id */ + byte++; + +while (bytes_to_recv) { + len = bytes_to_recv >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) { + DRM_DEBUG_KMS("msg_id %d, ret %d\n", msg_id,(int)ret);
drivers/gpu/drm/i915/intel_dp.c +15
-0+return ret; + } + + bytes_to_recv -= ret; + byte += ret; + offset += ret; + } + byte = buf; + *byte = msg_id; + +return size; +} + +static +int intel_dp_hdcp2_config_stream_type(struct intel_digital_port
*intel_dig_port,drivers/gpu/drm/i915/intel_dp.c +58
-0+ void *buf, size_t size) +{ +return intel_dp_hdcp2_write_msg (intel_dig_port, buf, size); +} + +static +int intel_dp_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status; +int ret; + + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret) +return ret; + +if (HDCP_2_2_DP_RXSTATUS_REAUTH_REQ (rx_status)) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_DP_RXSTATUS_LINK_FAILED (rx_status)) + ret =DRM_HDCP_LINK_INTEGRITY_FAILURE ; +else if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_dp_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t rx_caps[3 ]; +int ret; + + *capable = false; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RX_CAPS_OFFSET , + rx_caps,HDCP_2_2_RXCAPS_LEN ); +if (ret !=HDCP_2_2_RXCAPS_LEN ) +return ret >=0 ? -EIO : ret; + +if (rx_caps[0 ] ==HDCP_2_2_RXCAPS_VERSION_VAL && +HDCP_2_2_DP_HDCP_CAPABLE (rx_caps[2 ])) + *capable = true; + +return 0 ; +} + +static +enum hdcp_protocol intel_dp_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_DP ; +} +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,@@ -5287,6 +5639,12 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .toggle_signalling = intel_dp_hdcp_toggle_signalling, .check_link = intel_dp_hdcp_check_link, .hdcp_capable = intel_dp_hdcp_capable, + .write_2_2_msg = intel_dp_hdcp2_write_msg, + .read_2_2_msg = intel_dp_hdcp2_read_msg, + .config_stream_type = intel_dp_hdcp2_config_stream_type, + .check_2_2_link = intel_dp_hdcp2_check_link, + .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .hdcp_protocol = intel_dp_hdcp2_protocol, };static void intel_edp_panel_vdd_sanitize (struct intel_dp *intel_dp)drivers/gpu/drm/i915/intel_drv.h +3
-0@@ -444,6 +444,13 @@ struct intel_hdcp {struct mei_hdcp_data mei_data;struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; + +/* +* Work queue to signal the CP_IRQ. Used for the waiters to read the
drivers/gpu/drm/i915/intel_drv.h +4
-0+* available information from HDCP DP sink. +*/ +wait_queue_head_t cp_irq_queue; +atomic_t cp_irq_recved; };struct intel_connector {drivers/gpu/drm/i915/intel_hdcp.c +1
-0@@ -870,6 +870,8 @@ int intel_hdcp_init(struct intel_connector *connector, if (hdcp2_supported)intel_hdcp2_init (connector); +init_waitqueue_head (&hdcp->cp_irq_queue); +atomic_set (&hdcp->cp_irq_recved,0 );return 0 ; } @@ -1849,4 +1851,7 @@ void intel_hdcp_handle_cp_irq(struct
intel_connector*connector)intel_hdcp_check_link(connector); else if (intel_hdcp2_in_force(connector)) intel_hdcp2_check_link(connector);drivers/gpu/drm/i915/intel_hdcp.c +3
-1+ +atomic_set (&connector->hdcp.cp_irq_recved,1 ); +wake_up_all (&connector->hdcp.cp_irq_queue); } --2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
Best Regards,
Ramalingam C
Quoted 124 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Wednesday, June 20, 2018 5:14 PM
To: C, Ramalingam <[email protected]>
Cc: intel-gfx <[email protected]>; dri-devel <dri- [email protected]>; Sean Paul <[email protected]>; Chris Wilson <[email protected]>; Nikula, Jani <[email protected]>; Winkler, Tomas <[email protected]>; Usyskin, Alexander <[email protected]>; Shankar, Uma <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DPQuoted 88 lines · Ramalingam C
Quoted 76 lines · Daniel Vetter
Quoted 74 lines · Ramalingam C
Implements the DP adaptation specific HDCP2.2 functions.
These functions perform the DPCD read and write for communicating the
HDCP2.2 auth message back and forth.Note: Chris Wilson suggested alternate method for waiting for
CP_IRQ, than completions concept. WIP to understand and implement that, if needed. Just to unblock the review of other changes, v2 still continues with completions.v2:
wait forcp_irqis merged with this patch. Rebased.
v3:
wait_queueis used for wait forcp_irq[Chris Wilson]
v4:
Style fixed.
%s/PARING/PAIRING
Few style fixes [Uma]Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 358 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 7 + drivers/gpu/drm/i915/intel_hdcp.c | 5 + 3 files changed, 370 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_dp.cindex528407d608c8..ee71a26ec23f100644drivers/gpu/drm/i915/intel_dp.c +1
-0@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/mei_hdcp.h> #include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> @@ -5057,6 +5058,28 @@ voidintel_dp_encoder_suspend(struct
intel_encoder*intel_encoder)pps_unlock(intel_dp);}
+static int intel_dp_hdcp_wait_for_cp_irq(structintel_hdcp*hdcp,drivers/gpu/drm/i915/intel_dp.c +10
-0+ int timeout) { +long ret; + +/* Reinit */ +atomic_set (&hdcp->cp_irq_recved,0 ); + +#define C (atomic_read(&hdcp->cp_irq_recved) > 0) + ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, +C, +
msecs_to_jiffies(timeout));drivers/gpu/drm/i915/intel_dp.c +11
-0+ +if (ret >0 ) { +atomic_set (&hdcp->cp_irq_recved,0 ); +return 0 ; + }else if (!ret) { +return -ETIMEDOUT ; + } +return (int )ret; +} + +static int intel_dp_hdcp_write_an_aksv(struct intel_digital_port
*intel_dig_port,u8 *an) @@ -5275,6 +5298,335 @@ intintel_dp_hdcp_capable(struct
intel_digital_port*intel_dig_port,Quoted 8 lines
Quoted 5 lines
return 0;}
+static
+intintel_dpcd_offset_for_hdcp2_msgid(uint8_t byte, unsigned int *offset)Ugh, this is annoying that we have to map things around like that. But looking at the numbers the standards really don't seem to match at all.
Quoted 2 lines
Sorry i am not getting about not matching part.
You mean some offsets and timeouts are not matching with spec?match as in you can't just compute them using a
base_offset+hdcp_msgidtrick, you do have to use the lookup table. The numbers itself match the spec, it's just that the specs are all inconsistent with each another for no real good reason.Quoted 14 lines
Quoted 14 lines
Instead of open-coding this I suggested you use a table with a struct like:
const static struct hdcp_dp { int hdcp_msg; int dpcd_offset; int timeout; /* whatever else you might need */ } hdcp_2_dp_table[] = { { HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, ... }, ... };
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Then just search that table in the code instead of the huge switch table below.
Suggesting this for cpu optimization or for coding style?
Just coding style, having to check a table is easier than checking huge case statements. None of this code matters from a performance pov.
Sure Daniel. I will use array of struct here.
Thanks
-Ram
Quoted 443 lines
Quoted 92 lines
Quoted 83 lines
Quoted 69 lines
drivers/gpu/drm/i915/intel_dp.c +54
-0+{ +switch (byte) { +case HDCP_2_2_AKE_INIT : + *offset =DP_HDCP_2_2_AKE_INIT_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_CERT : + *offset =DP_HDCP_2_2_AKE_SEND_CERT_OFFSET ; +break ; +case HDCP_2_2_AKE_NO_STORED_KM : + *offset =DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_STORED_KM : + *offset =DP_HDCP_2_2_AKE_STORED_KM_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : + *offset =DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + *offset =DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET ; +break ; +case HDCP_2_2_LC_INIT : + *offset =DP_HDCP_2_2_LC_INIT_OFFSET ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + *offset =DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET ; +break ; +case HDCP_2_2_SKE_SEND_EKS : + *offset =DP_HDCP_2_2_SKE_SEND_EKS_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + *offset =DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET ; +break ; +case HDCP_2_2_REP_SEND_ACK : + *offset =DP_HDCP_2_2_REP_SEND_ACK_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_MANAGE : + *offset =DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET ; +break ; +case HDCP_2_2_REP_STREAM_READY : + *offset =DP_HDCP_2_2_REP_STREAM_READY_OFFSET ; +break ; +case HDCP_2_2_ERRATA_DP_STREAM_TYPE : + *offset =DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET ; +break ; +default : +DRM_ERROR ("Unrecognized Msg ID\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static inline +int intel_dp_hdcp2_read_rx_status(struct intel_digital_port
*intel_dig_port,drivers/gpu/drm/i915/intel_dp.c +5
-0+ uint8_t *rx_status) { +ssize_t ret; + + ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, + DP_HDCP_2_2_REG_RXSTATUS_OFFSET,
rx_status,drivers/gpu/drm/i915/intel_dp.c +3
-0+ HDCP_2_2_DP_RXSTATUS_LEN); +if (ret !=HDCP_2_2_DP_RXSTATUS_LEN ) { + DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n",ret);
drivers/gpu/drm/i915/intel_dp.c int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, · line 5373
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+return ret >=0 ? -EIO : ret; + } + +return 0 ; +} + +static +int intel_dp_hdcp2_timeout_for_msg (uint8_t msg_id,bool paired)For the timeout and the availability check below, is that not the same for hdmi? Might be good to set the timeout/check values once, and perhaps pass that then down to the dp/hdmi implementation, instead of computing it here.
Quoted 3 lines
All these functions here look like a huge layering violation. Imo all this timeout stuff should be handled higher up, or at least more tightly grouped together.
Between HDMI and DP adaptation differences are there but very minimal. Message avialbility check is completely different between HDMI and DP. DP uses the
cp_irq.
And timeout also varies for a DP HDCP msg.Quoted 4 lines
Since we are adapting the HDCP1.4 design where all encoder specific operations are pushed into
hdcp_shim, I have implemented all HDMI and DP related operation to their respective shims.
So that we need not do more if(dp/hdmi) in common codeintel_hdcp.catleast.
Quoted 5 lines
The first design I had shared using the drm helper functions, dont have different flows for HDMI and DP.
Where ever different treatment is required based on the adaptation, that was taken care then and there.I'm not against having dp/hdmi specific functions, I'm against having to spread that specific stuff all around in different places. If you need msgid specific timeouts between DP and HDMI then maybe stuff them into the lookup table, but from a quick look it seemed like that's not the case.
And if the hdcp1.4 shim design is getting in the way, we need to fix that. The hdcp1.4 shim is indeed a bit looking like a midlayer, so it getting in the way is no surprise really.
-DanielQuoted 318 lines
-Ram
Quoted 314 lines
Remapping from the
HDCP_2_2defines to the dpcd offsets is imo different than all the stuff below here.
-DanielQuoted 310 lines
drivers/gpu/drm/i915/intel_dp.c +35
-0+{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_DP_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static +int hdcp2_detect_msg_availability(struct intel_digital_port
*intel_dig_port,drivers/gpu/drm/i915/intel_dp.c +40
-0+ uint8_t msg_id, bool *msg_ready) { + uint8_t rx_status; +int ret; + + *msg_ready = false; + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret <0 ) +return ret; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_HPRIME : +if (HDCP_2_2_DP_RXSTATUS_H_PRIME (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +if (HDCP_2_2_DP_RXSTATUS_PAIRING (rx_status)) + *msg_ready = true; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : +if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + *msg_ready = true; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } + +return 0 ; +} + + +static ssize_t +intel_dp_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id) { +struct intel_dp *dp = &intel_dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; +int ret, timeout; +bool msg_ready = false; + + timeout = intel_dp_hdcp2_timeout_for_msg(msg_id,
hdcp->is_paired);drivers/gpu/drm/i915/intel_dp.c +17
-0+switch (msg_id) { + +/* +* There is no way to detect the CERT, LPRIME and STREAM_READY +* availability. So Wait for timeout and read the msg. +*/ +case HDCP_2_2_AKE_SEND_CERT : +case HDCP_2_2_LC_SEND_LPRIME : +case HDCP_2_2_REP_STREAM_READY : +mdelay (timeout); + ret =0 ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +case HDCP_2_2_AKE_SEND_PAIRING_INFO : +case HDCP_2_2_REP_SEND_RECVID_LIST : +intel_dp_hdcp_wait_for_cp_irq (hdcp, timeout); + ret = hdcp2_detect_msg_availability(intel_dig_port,
msg_id,drivers/gpu/drm/i915/intel_dp.c +10
-0+ &msg_ready); +if (!msg_ready) + ret = -ETIMEDOUT ; +break ; +default : +DRM_DEBUG_KMS ("Unidentified msg_id: %d\n" , (int )msg_id); +return -EINVAL ; + } +if (ret) + DRM_ERROR("msg_id %d, ret %d, timeout(mSec): %d\n",
msg_id, ret,drivers/gpu/drm/i915/intel_dp.c +22
-0+ timeout); + +return ret; +} + +static +int intel_dp_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) { +unsigned int offset; +uint8_t *byte = buf; +ssize_t ret, bytes_to_write, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (*byte, &offset) <0 ) +return -EINVAL ; + +/* No msg_id in DP HDCP2.2 msgs */ + bytes_to_write = size -1 ; + byte++; + +while (bytes_to_write) { + len = bytes_to_write >DP_AUX_MAX_PAYLOAD_BYTES ? + DP_AUX_MAX_PAYLOAD_BYTES :
bytes_to_write;drivers/gpu/drm/i915/intel_dp.c +35
-0+ + ret =drm_dp_dpcd_write (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) +return ret; + + bytes_to_write -= ret; + byte += ret; + offset += ret; + } + +return size; +} + +static +int intel_dp_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +unsigned int offset, dev_cnt; +uint8_t *byte = buf; +uint8_t rx_info[HDCP_2_2_RXINFO_LEN ]; +ssize_t ret, bytes_to_recv, len; + +if (intel_dpcd_offset_for_hdcp2_msgid (msg_id, &offset) <0 ) +return -EINVAL ; + + ret =intel_dp_hdcp2_wait_for_msg (intel_dig_port, msg_id); +if (ret <0 ) +return ret; + +/* Finding the ReceiverID List size */ +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { + ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, + DP_HDCP_2_2_REG_RXINFO_OFFSET, + (void *)rx_info,
HDCP_2_2_RXINFO_LEN);drivers/gpu/drm/i915/intel_dp.c +27
-0+if (ret !=HDCP_2_2_RXINFO_LEN ) +return ret >=0 ? -EIO : ret; + + dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 | +HDCP_2_2_DEV_COUNT_LO (rx_info[1 ])); + +if (dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) + dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ; + + size =sizeof (struct hdcp2_rep_send_receiverid_list ) - +HDCP_2_2_RECEIVER_IDS_MAX_LEN + + (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); + } + + bytes_to_recv = size -1 ; + +/* To skip the msg_id, as msgs in DP adaptation has no msg_id */ + byte++; + +while (bytes_to_recv) { + len = bytes_to_recv >DP_AUX_MAX_PAYLOAD_BYTES ? +DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv; + + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, offset, + (void *)byte, len); +if (ret <0 ) { + DRM_DEBUG_KMS("msg_id %d, ret %d\n", msg_id,(int)ret);
drivers/gpu/drm/i915/intel_dp.c +15
-0+return ret; + } + + bytes_to_recv -= ret; + byte += ret; + offset += ret; + } + byte = buf; + *byte = msg_id; + +return size; +} + +static +int intel_dp_hdcp2_config_stream_type(struct intel_digital_port
*intel_dig_port,drivers/gpu/drm/i915/intel_dp.c +49
-0+ void *buf, size_t size) { +return intel_dp_hdcp2_write_msg (intel_dig_port, buf, size); +} + +static +int intel_dp_hdcp2_check_link (struct intel_digital_port +*intel_dig_port) { +uint8_t rx_status; +int ret; + + ret =intel_dp_hdcp2_read_rx_status (intel_dig_port, &rx_status); +if (ret) +return ret; + +if (HDCP_2_2_DP_RXSTATUS_REAUTH_REQ (rx_status)) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_DP_RXSTATUS_LINK_FAILED (rx_status)) + ret =DRM_HDCP_LINK_INTEGRITY_FAILURE ; +else if (HDCP_2_2_DP_RXSTATUS_READY (rx_status)) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_dp_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) { +uint8_t rx_caps[3 ]; +int ret; + + *capable = false; + ret =drm_dp_dpcd_read (&intel_dig_port->dp.aux, +DP_HDCP_2_2_REG_RX_CAPS_OFFSET , + rx_caps,HDCP_2_2_RXCAPS_LEN ); +if (ret !=HDCP_2_2_RXCAPS_LEN ) +return ret >=0 ? -EIO : ret; + +if (rx_caps[0 ] ==HDCP_2_2_RXCAPS_VERSION_VAL && +HDCP_2_2_DP_HDCP_CAPABLE (rx_caps[2 ])) + *capable = true; + +return 0 ; +} + +static +enum hdcp_protocol intel_dp_hdcp2_protocol (void ) { +return HDCP_PROTOCOL_DP ; +} +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, @@ -5287,6 +5639,12 @@static const struct
intel_hdcp_shimintel_dp_hdcp_shim= {
.toggle_signalling =intel_dp_hdcp_toggle_signalling, .check_link =intel_dp_hdcp_check_link, .hdcp_capable =intel_dp_hdcp_capable,drivers/gpu/drm/i915/intel_dp.c +6
-0+ .write_2_2_msg = intel_dp_hdcp2_write_msg, + .read_2_2_msg = intel_dp_hdcp2_read_msg, + .config_stream_type = intel_dp_hdcp2_config_stream_type, + .check_2_2_link = intel_dp_hdcp2_check_link, + .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .hdcp_protocol = intel_dp_hdcp2_protocol, }; static void intel_edp_panel_vdd_sanitize(struct intel_dp
*intel_dp) diff --gita/drivers/gpu/drm/i915/intel_drv.hb/drivers/gpu/drm/i915/intel_drv.h
indexdef8e3255742..0496ebec287b100644drivers/gpu/drm/i915/intel_drv.h +4
-0@@ -444,6 +444,13 @@ struct intel_hdcp {struct mei_hdcp_data mei_data;struct notifier_block mei_cldev_nb;struct delayed_work hdcp2_check_work; + +/* +* Work queue to signal the CP_IRQ. Used for the waiters to +read the
drivers/gpu/drm/i915/intel_drv.h +4
-0+* available information from HDCP DP sink. +*/ +wait_queue_head_t cp_irq_queue; +atomic_t cp_irq_recved; };struct intel_connector {drivers/gpu/drm/i915/intel_hdcp.c +1
-0@@ -870,6 +870,8 @@ int intel_hdcp_init(struct intel_connector *connector, if (hdcp2_supported)intel_hdcp2_init (connector); +init_waitqueue_head (&hdcp->cp_irq_queue); +atomic_set (&hdcp->cp_irq_recved,0 );return 0 ; } @@ -1849,4 +1851,7 @@ void intel_hdcp_handle_cp_irq(struct
intel_connector*connector)
intel_hdcp_check_link(connector);
else if (intel_hdcp2_in_force(connector))Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
intel_hdcp2_check_link(connector);drivers/gpu/drm/i915/intel_hdcp.c +3
-1+ +atomic_set (&connector->hdcp.cp_irq_recved,1 ); +wake_up_all (&connector->hdcp.cp_irq_queue); } --2.7.4
Quoted 4 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 39/41 drm/i915: Implement the HDCP2.2 support for HDMI
In reply to Ramalingam CImplements the HDMI adaptation specific HDCP2.2 operations.
Basically these are DDC read and write for authenticating through HDCP2.2 messages.
v2:
Rebased.
v3:
No Changes.
v4:
No more special handling of Gmbus burst read for AKE_SEND_CERT. Style fixed with few naming. [Uma]
%s/PARING/PAIRING
--- drivers/gpu/drm/i915/intel_hdmi.c | 186 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +186 -0
@@ -30,6 +30,7 @@#include <linux/slab.h> #include <linux/delay.h> #include <linux/hdmi.h> +#include <linux/mei_hdcp.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h>
@@ -1106,6 +1107,186 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)return true; } +static +int intel_hdmi_hdcp2_read_rx_status (struct intel_digital_port *intel_dig_port, +uint8_t *rx_status) +{ +return intel_hdmi_hdcp_read (intel_dig_port, +HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET , + rx_status, +HDCP_2_2_HDMI_RXSTATUS_LEN ); +} + +static inline +int intel_hdmi_hdcp2_timeout_for_msg (uint8_t msg_id,bool is_paired) +{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (is_paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_HDMI_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static inline +int hdcp2_detect_msg_availability (struct intel_digital_port *intel_digital_port, +uint8_t msg_id,bool *msg_ready, +ssize_t *msg_sz) +{ +uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN ]; +int ret; + + ret =intel_hdmi_hdcp2_read_rx_status (intel_digital_port, rx_status); +if (ret <0 ) { +DRM_DEBUG_KMS ("rx_status read failed. Err %d\n" , ret); +return ret; + } + + *msg_sz = ((HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI (rx_status[1 ]) <<8 ) | + rx_status[0 ]); + +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) + *msg_ready = (HDCP_2_2_HDMI_RXSTATUS_READY (rx_status[1 ]) && + *msg_sz); +else + *msg_ready = *msg_sz; + +return 0 ; +} + +static ssize_t +intel_hdmi_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,bool paired) +{ +bool msg_ready = false; +int timeout, ret; +ssize_t msg_sz; + + timeout =intel_hdmi_hdcp2_timeout_for_msg (msg_id, paired); +if (timeout <0 ) +return timeout; + + ret =__wait_for (ret =hdcp2_detect_msg_availability (intel_dig_port, + msg_id, &msg_ready, &msg_sz), + !ret && msg_ready && msg_sz, timeout *1000 , +1000 ,5 *1000 ); +if (ret) +DRM_ERROR ("msg_id: %d, ret: %d, timeout: %d\n" , + msg_id, ret, timeout); + +return ret ? ret : msg_sz; +} + +static +int intel_hdmi_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; + + offset =HDCP_2_2_HDMI_REG_WR_MSG_OFFSET ; +return intel_hdmi_hdcp_write (intel_dig_port, offset, buf, size); +} + +static +int intel_hdmi_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +struct intel_hdmi *hdmi = &intel_dig_port->hdmi; +struct intel_hdcp *hdcp = &hdmi->attached_connector->hdcp; +unsigned int offset; +ssize_t ret; + + ret =intel_hdmi_hdcp2_wait_for_msg (intel_dig_port, msg_id, + hdcp->is_paired); +if (ret <0 ) +return ret; + +/* +* Available msg size should be equal to or lesser than the +* available buffer. +*/ +if (ret > size) { +DRM_DEBUG_KMS ("msg_sz(%d) is more than exp size(%d)\n" , + (int )ret, (int )size); +return -1 ; + } + + offset =HDCP_2_2_HDMI_REG_RD_MSG_OFFSET ; + ret =intel_hdmi_hdcp_read (intel_dig_port, offset, buf, ret); +if (ret) +DRM_DEBUG_KMS ("Failed to read msg_id: %d(%zd)\n" , msg_id, ret); + +return ret; +} + +static +int intel_hdmi_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN ]; +int ret; + + ret =intel_hdmi_hdcp2_read_rx_status (intel_dig_port, rx_status); +if (ret) +return ret; + +/* +* Re-auth request and Link Integrity Failures are represented by +* same bit. i.e reauth_req. +*/ +if (HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ (rx_status[1 ])) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_HDMI_RXSTATUS_READY (rx_status[1 ])) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_hdmi_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t hdcp2_version; +int ret; + + *capable = false; + ret =intel_hdmi_hdcp_read (intel_dig_port,HDCP_2_2_HDMI_REG_VER_OFFSET , + &hdcp2_version,sizeof (hdcp2_version)); +if (!ret && hdcp2_version &HDCP_2_2_HDMI_SUPPORT_MASK ) + *capable = true; + +return ret; +} + +static +enum hdcp_protocol intel_hdmi_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_HDMI ; +} +static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { .write_an_aksv = intel_hdmi_hdcp_write_an_aksv, .read_bksv = intel_hdmi_hdcp_read_bksv,
@@ -1117,6 +1298,11 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { .read_v_prime_part = intel_hdmi_hdcp_read_v_prime_part, .toggle_signalling = intel_hdmi_hdcp_toggle_signalling, .check_link = intel_hdmi_hdcp_check_link, + .write_2_2_msg = intel_hdmi_hdcp2_write_msg, + .read_2_2_msg = intel_hdmi_hdcp2_read_msg, + .check_2_2_link = intel_hdmi_hdcp2_check_link, + .hdcp_2_2_capable = intel_hdmi_hdcp2_capable, + .hdcp_protocol = intel_hdmi_hdcp2_protocol, }; static void intel_hdmi_prepare(struct intel_encoder *encoder,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 39/41] drm/i915: Implement the HDCP2.2 support for HDMI
Quoted 37 lines · Ramalingam C
Implements the HDMI adaptation specific HDCP2.2 operations.
Basically these are DDC read and write for authenticating through HDCP2.2 messages.
v2:
Rebased.
v3:
No Changes.
v4:
No more special handling of Gmbus burst read forAKE_SEND_CERT. Style fixed with few naming. [Uma]
%s/PARING/PAIRINGSigned-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_hdmi.c | 186 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+)drivers/gpu/drm/i915/intel_hdmi.c +3
-0@@ -30,6 +30,7 @@#include <linux/slab.h> #include <linux/delay.h> #include <linux/hdmi.h> +#include <linux/mei_hdcp.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> @@ -1106,6 +1107,186 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)return true; } +static +int intel_hdmi_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,
drivers/gpu/drm/i915/intel_hdmi.c bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port) · line 1121
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10
-0+ uint8_t *rx_status) +{ +return intel_hdmi_hdcp_read (intel_dig_port, +HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET , + rx_status, +HDCP_2_2_HDMI_RXSTATUS_LEN ); +} + +static inline +int intel_hdmi_hdcp2_timeout_for_msg (uint8_t msg_id,bool is_paired)
So at a glance this is the same timeout stuff as for dp. I think this should be moved out of the low-level callbacks into commont code. Maybe wrap the low-level callbacks for read/write into small helper functions, which then also do the timeout handling?
And I think the timeouts and availability checks should be done in the hdcp flow directly, instead of far away from where the register read/write is issue. Just to keep the entire register i/o closely together. -Daniel
Quoted 186 lines
drivers/gpu/drm/i915/intel_hdmi.c +173
-0+{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (is_paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_HDMI_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static inline +int hdcp2_detect_msg_availability (struct intel_digital_port *intel_digital_port, +uint8_t msg_id,bool *msg_ready, +ssize_t *msg_sz) +{ +uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN ]; +int ret; + + ret =intel_hdmi_hdcp2_read_rx_status (intel_digital_port, rx_status); +if (ret <0 ) { +DRM_DEBUG_KMS ("rx_status read failed. Err %d\n" , ret); +return ret; + } + + *msg_sz = ((HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI (rx_status[1 ]) <<8 ) | + rx_status[0 ]); + +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) + *msg_ready = (HDCP_2_2_HDMI_RXSTATUS_READY (rx_status[1 ]) && + *msg_sz); +else + *msg_ready = *msg_sz; + +return 0 ; +} + +static ssize_t +intel_hdmi_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,bool paired) +{ +bool msg_ready = false; +int timeout, ret; +ssize_t msg_sz; + + timeout =intel_hdmi_hdcp2_timeout_for_msg (msg_id, paired); +if (timeout <0 ) +return timeout; + + ret =__wait_for (ret =hdcp2_detect_msg_availability (intel_dig_port, + msg_id, &msg_ready, &msg_sz), + !ret && msg_ready && msg_sz, timeout *1000 , +1000 ,5 *1000 ); +if (ret) +DRM_ERROR ("msg_id: %d, ret: %d, timeout: %d\n" , + msg_id, ret, timeout); + +return ret ? ret : msg_sz; +} + +static +int intel_hdmi_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; + + offset =HDCP_2_2_HDMI_REG_WR_MSG_OFFSET ; +return intel_hdmi_hdcp_write (intel_dig_port, offset, buf, size); +} + +static +int intel_hdmi_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +struct intel_hdmi *hdmi = &intel_dig_port->hdmi; +struct intel_hdcp *hdcp = &hdmi->attached_connector->hdcp; +unsigned int offset; +ssize_t ret; + + ret =intel_hdmi_hdcp2_wait_for_msg (intel_dig_port, msg_id, + hdcp->is_paired); +if (ret <0 ) +return ret; + +/* +* Available msg size should be equal to or lesser than the +* available buffer. +*/ +if (ret > size) { +DRM_DEBUG_KMS ("msg_sz(%d) is more than exp size(%d)\n" , + (int )ret, (int )size); +return -1 ; + } + + offset =HDCP_2_2_HDMI_REG_RD_MSG_OFFSET ; + ret =intel_hdmi_hdcp_read (intel_dig_port, offset, buf, ret); +if (ret) +DRM_DEBUG_KMS ("Failed to read msg_id: %d(%zd)\n" , msg_id, ret); + +return ret; +} + +static +int intel_hdmi_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN ]; +int ret; + + ret =intel_hdmi_hdcp2_read_rx_status (intel_dig_port, rx_status); +if (ret) +return ret; + +/* +* Re-auth request and Link Integrity Failures are represented by +* same bit. i.e reauth_req. +*/ +if (HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ (rx_status[1 ])) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_HDMI_RXSTATUS_READY (rx_status[1 ])) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_hdmi_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t hdcp2_version; +int ret; + + *capable = false; + ret =intel_hdmi_hdcp_read (intel_dig_port,HDCP_2_2_HDMI_REG_VER_OFFSET , + &hdcp2_version,sizeof (hdcp2_version)); +if (!ret && hdcp2_version &HDCP_2_2_HDMI_SUPPORT_MASK ) + *capable = true; + +return ret; +} + +static +enum hdcp_protocol intel_hdmi_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_HDMI ; +} +static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { .write_an_aksv = intel_hdmi_hdcp_write_an_aksv, .read_bksv = intel_hdmi_hdcp_read_bksv,@@ -1117,6 +1298,11 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { .read_v_prime_part = intel_hdmi_hdcp_read_v_prime_part, .toggle_signalling = intel_hdmi_hdcp_toggle_signalling, .check_link = intel_hdmi_hdcp_check_link, + .write_2_2_msg = intel_hdmi_hdcp2_write_msg, + .read_2_2_msg = intel_hdmi_hdcp2_read_msg, + .check_2_2_link = intel_hdmi_hdcp2_check_link, + .hdcp_2_2_capable = intel_hdmi_hdcp2_capable, + .hdcp_protocol = intel_hdmi_hdcp2_protocol, }; static void intel_hdmi_prepare(struct intel_encoder *encoder,Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 39/41] drm/i915: Implement the HDCP2.2 support for HDMI
Quoted 53 lines · Daniel Vetter
Quoted 37 lines · Ramalingam C
Implements the HDMI adaptation specific HDCP2.2 operations.
Basically these are DDC read and write for authenticating through HDCP2.2 messages.
v2:
Rebased.
v3:
No Changes.
v4:
No more special handling of Gmbus burst read forAKE_SEND_CERT. Style fixed with few naming. [Uma]
%s/PARING/PAIRINGSigned-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/intel_hdmi.c | 186 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+)drivers/gpu/drm/i915/intel_hdmi.c +3
-0@@ -30,6 +30,7 @@#include <linux/slab.h> #include <linux/delay.h> #include <linux/hdmi.h> +#include <linux/mei_hdcp.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> @@ -1106,6 +1107,186 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)return true; } +static +int intel_hdmi_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,drivers/gpu/drm/i915/intel_hdmi.c bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port) · line 1121
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10
-0+ uint8_t *rx_status) +{ +return intel_hdmi_hdcp_read (intel_dig_port, +HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET , + rx_status, +HDCP_2_2_HDMI_RXSTATUS_LEN ); +} + +static inline +int intel_hdmi_hdcp2_timeout_for_msg (uint8_t msg_id,bool is_paired)So at a glance this is the same timeout stuff as for dp. I think this should be moved out of the low-level callbacks into commont code. Maybe wrap the low-level callbacks for read/write into small helper functions, which then also do the timeout handling?
Quoted 3 lines
And I think the timeouts and availability checks should be done in the hdcp flow directly, instead of far away from where the register read/write is issue.
Since the msg availability detection is specific to the adaptation and timeout which also adaptation specific, is needed for msg availability detection. So I feel it will look simple to keep them together in hdcp shim .
As you mentioned in the DP hdcp shim review, we could use the array of struct holding timeout and offsets for a msg. This will help to avoid the one of two switch cases used for mapping the timeout and offsets with msg_id.
-Ram
Quoted 185 lines
Just to keep the entire register i/o closely together.
-DanielQuoted 182 lines
drivers/gpu/drm/i915/intel_hdmi.c +173
-0+{ +int timeout; + +switch (msg_id) { +case HDCP_2_2_AKE_SEND_CERT : + timeout =HDCP_2_2_CERT_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_HPRIME : +if (is_paired) + timeout =HDCP_2_2_HPRIME_PAIRED_TIMEOUT ; +else + timeout =HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT ; +break ; +case HDCP_2_2_AKE_SEND_PAIRING_INFO : + timeout =HDCP_2_2_PAIRING_TIMEOUT ; +break ; +case HDCP_2_2_LC_SEND_LPRIME : + timeout =HDCP_2_2_HDMI_LPRIME_TIMEOUT ; +break ; +case HDCP_2_2_REP_SEND_RECVID_LIST : + timeout =HDCP_2_2_RECVID_LIST_TIMEOUT ; +break ; +case HDCP_2_2_REP_STREAM_READY : + timeout =HDCP_2_2_STREAM_READY_TIMEOUT ; +break ; +default : + timeout = -EINVAL ; +DRM_ERROR ("Unsupported msg_id: %d\n" , (int )msg_id); + } + +return timeout; +} + +static inline +int hdcp2_detect_msg_availability (struct intel_digital_port *intel_digital_port, +uint8_t msg_id,bool *msg_ready, +ssize_t *msg_sz) +{ +uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN ]; +int ret; + + ret =intel_hdmi_hdcp2_read_rx_status (intel_digital_port, rx_status); +if (ret <0 ) { +DRM_DEBUG_KMS ("rx_status read failed. Err %d\n" , ret); +return ret; + } + + *msg_sz = ((HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI (rx_status[1 ]) <<8 ) | + rx_status[0 ]); + +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) + *msg_ready = (HDCP_2_2_HDMI_RXSTATUS_READY (rx_status[1 ]) && + *msg_sz); +else + *msg_ready = *msg_sz; + +return 0 ; +} + +static ssize_t +intel_hdmi_hdcp2_wait_for_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,bool paired) +{ +bool msg_ready = false; +int timeout, ret; +ssize_t msg_sz; + + timeout =intel_hdmi_hdcp2_timeout_for_msg (msg_id, paired); +if (timeout <0 ) +return timeout; + + ret =__wait_for (ret =hdcp2_detect_msg_availability (intel_dig_port, + msg_id, &msg_ready, &msg_sz), + !ret && msg_ready && msg_sz, timeout *1000 , +1000 ,5 *1000 ); +if (ret) +DRM_ERROR ("msg_id: %d, ret: %d, timeout: %d\n" , + msg_id, ret, timeout); + +return ret ? ret : msg_sz; +} + +static +int intel_hdmi_hdcp2_write_msg (struct intel_digital_port *intel_dig_port, +void *buf,size_t size) +{ +unsigned int offset; + + offset =HDCP_2_2_HDMI_REG_WR_MSG_OFFSET ; +return intel_hdmi_hdcp_write (intel_dig_port, offset, buf, size); +} + +static +int intel_hdmi_hdcp2_read_msg (struct intel_digital_port *intel_dig_port, +uint8_t msg_id,void *buf,size_t size) +{ +struct intel_hdmi *hdmi = &intel_dig_port->hdmi; +struct intel_hdcp *hdcp = &hdmi->attached_connector->hdcp; +unsigned int offset; +ssize_t ret; + + ret =intel_hdmi_hdcp2_wait_for_msg (intel_dig_port, msg_id, + hdcp->is_paired); +if (ret <0 ) +return ret; + +/* +* Available msg size should be equal to or lesser than the +* available buffer. +*/ +if (ret > size) { +DRM_DEBUG_KMS ("msg_sz(%d) is more than exp size(%d)\n" , + (int )ret, (int )size); +return -1 ; + } + + offset =HDCP_2_2_HDMI_REG_RD_MSG_OFFSET ; + ret =intel_hdmi_hdcp_read (intel_dig_port, offset, buf, ret); +if (ret) +DRM_DEBUG_KMS ("Failed to read msg_id: %d(%zd)\n" , msg_id, ret); + +return ret; +} + +static +int intel_hdmi_hdcp2_check_link (struct intel_digital_port *intel_dig_port) +{ +uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN ]; +int ret; + + ret =intel_hdmi_hdcp2_read_rx_status (intel_dig_port, rx_status); +if (ret) +return ret; + +/* +* Re-auth request and Link Integrity Failures are represented by +* same bit. i.e reauth_req. +*/ +if (HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ (rx_status[1 ])) + ret =DRM_HDCP_REAUTH_REQUEST ; +else if (HDCP_2_2_HDMI_RXSTATUS_READY (rx_status[1 ])) + ret =DRM_HDCP_TOPOLOGY_CHANGE ; + +return ret; +} + +static +int intel_hdmi_hdcp2_capable (struct intel_digital_port *intel_dig_port, +bool *capable) +{ +uint8_t hdcp2_version; +int ret; + + *capable = false; + ret =intel_hdmi_hdcp_read (intel_dig_port,HDCP_2_2_HDMI_REG_VER_OFFSET , + &hdcp2_version,sizeof (hdcp2_version)); +if (!ret && hdcp2_version &HDCP_2_2_HDMI_SUPPORT_MASK ) + *capable = true; + +return ret; +} + +static +enum hdcp_protocol intel_hdmi_hdcp2_protocol (void ) +{ +return HDCP_PROTOCOL_HDMI ; +} +static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { .write_an_aksv = intel_hdmi_hdcp_write_an_aksv, .read_bksv = intel_hdmi_hdcp_read_bksv,@@ -1117,6 +1298,11 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { .read_v_prime_part = intel_hdmi_hdcp_read_v_prime_part, .toggle_signalling = intel_hdmi_hdcp_toggle_signalling, .check_link = intel_hdmi_hdcp_check_link, + .write_2_2_msg = intel_hdmi_hdcp2_write_msg, + .read_2_2_msg = intel_hdmi_hdcp2_read_msg, + .check_2_2_link = intel_hdmi_hdcp2_check_link, + .hdcp_2_2_capable = intel_hdmi_hdcp2_capable, + .hdcp_protocol = intel_hdmi_hdcp2_protocol, };
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_hdmi.c +0
-0static void intel_hdmi_prepare(struct intel_encoder *encoder,Signature · 1 line
2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 40/41 drm/i915: Add HDCP2.2 support for DP connectors
In reply to Ramalingam COn DP connector init, intel_hdcp_init is passed with a flag for hdcp2.2 support based on the platform capability.
v2:
Rebased.
v3:
No Changes.
v4:
Collected the reviewed-by received.
--- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdcp.c | 1 - 3 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -6726,7 +6726,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) {int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, - false); +is_hdcp2_supported (dev_priv));if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1953,6 +1953,7 @@ int intel_hdcp_enable(struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);bool is_hdcp_supported (struct drm_i915_private *dev_priv,enum port port);void intel_hdcp_handle_cp_irq (struct intel_connector *connector); +bool is_hdcp2_supported (struct drm_i915_private *dev_priv);/* intel_psr.c */ #define CAN_PSR (dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
drivers/gpu/drm/i915/intel_hdcp.c +0 -1
@@ -1801,7 +1801,6 @@ static int mei_cldev_notify(struct notifier_block *nb, unsigned long event,return NOTIFY_OK ; } -static inline bool is_hdcp2_supported (struct drm_i915_private *dev_priv) { return (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) ||
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 41/41 drm/i915: Add HDCP2.2 support for HDMI connectors
In reply to Ramalingam COn HDMI connector init, intel_hdcp_init is passed with a flag for hdcp2.2 support based on the platform capability.
v2:
Rebased.
v3:
No Changes.
v4:
Collected the reviewed-by received.
--- drivers/gpu/drm/i915/intel_hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
@@ -2520,7 +2520,8 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim, false); + &intel_hdmi_hdcp_shim, +is_hdcp2_supported (dev_priv));if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for drm/i915: Implement HDCP2.2 (rev5)
In reply to Ramalingam C== Series Details ==
== Series Details ==
Series: drm/i915: Implement HDCP2.2 (rev5)
URL : https://patchwork.freedesktop.org/series/38254/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 5534d5c8130b drm: hdcp2.2 authentication msg definitions e1983dd17552 drm: HDMI and DP specific HDCP2.2 defines 05320e361157 mei: bus: whitelist hdcp client d3a9f111f8e8 misc/mei/hdcp: Client driver for HDCP application -:85: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #85: new file mode 100644
-:102: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #102: FILE: drivers/misc/mei/hdcp/mei_hdcp.c:1:
+/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
total: 0 errors, 2 warnings, 0 checks, 102 lines checked631cabacba79 misc/mei/hdcp: Notifier chain for mei cldev state change
-:92: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #92:
new file mode 100644
-:140: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #140: FILE: include/linux/mei_hdcp.h:44:
+}
+static inline int mei_cldev_unregister_notify(struct notifier_block *nb)
-:144: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #144: FILE: include/linux/mei_hdcp.h:48:
+}
+static inline int mei_cldev_poll_notification(void)
total: 0 errors, 1 warnings, 2 checks, 117 lines checked8a50ab312a70 misc/mei/hdcp: Define ME FW interface for HDCP2.2
-:22: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #22:
new file mode 100644
-:186: CHECK:LINE_SPACING: Please don't use multiple blank lines #186: FILE: drivers/misc/mei/hdcp/mei_hdcp.h:160:
+
+
-:247: CHECK:LINE_SPACING: Please don't use multiple blank lines #247: FILE: drivers/misc/mei/hdcp/mei_hdcp.h:221:
+
+
-:330: CHECK:LINE_SPACING: Please don't use multiple blank lines #330: FILE: drivers/misc/mei/hdcp/mei_hdcp.h:304:
+
+
total: 0 errors, 1 warnings, 3 checks, 415 lines checked84ee35a55af1 linux/mei: Header for mei_hdcp driver interface6bc980d8e356 misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
-:134: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #134: FILE: include/linux/mei_hdcp.h:126:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 106 lines checked84e76bf55686 misc/mei/hdcp: Verify Receiver Cert and prepare km
-:142: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #142: FILE: include/linux/mei_hdcp.h:140:
}
+static inline int
total: 0 errors, 0 warnings, 1 checks, 117 lines checkedaefe2ebece44 misc/mei/hdcp: Verify H_prime
-:112: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #112: FILE: include/linux/mei_hdcp.h:152:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 84 lines checkedfd14fdc946e5 misc/mei/hdcp: Store the HDCP Pairing info
-:116: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #116: FILE: include/linux/mei_hdcp.h:161:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 88 lines checkeda654af89f26c misc/mei/hdcp: Initiate Locality check
-:109: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #109: FILE: include/linux/mei_hdcp.h:171:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 84 lines checked8ae3bad8bfc6 misc/mei/hdcp: Verify L_prime
-:113: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #113: FILE: include/linux/mei_hdcp.h:180:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 85 lines checked4cc6b45df72b misc/mei/hdcp: Prepare Session Key
-:110: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #110: FILE: include/linux/mei_hdcp.h:188:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 84 lines checkeda907491eeaa8 misc/mei/hdcp: Repeater topology verification and ack
-:133: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #133: FILE: include/linux/mei_hdcp.h:200:
}
+static inline int
total: 0 errors, 0 warnings, 1 checks, 107 lines checked9b7ef72365f5 misc/mei/hdcp: Verify M_prime
-:146: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #146: FILE: include/linux/mei_hdcp.h:211:
}
+static inline
total: 0 errors, 0 warnings, 1 checks, 112 lines checked9533b0a2bf1d misc/mei/hdcp: Enabling the HDCP authentication
-:112: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #112: FILE: include/linux/mei_hdcp.h:219:
}
+static inline int mei_enable_hdcp_authentication(struct mei_cl_device *cldev,
total: 0 errors, 0 warnings, 1 checks, 79 lines checked 79bf525e25db misc/mei/hdcp: Closing wired HDCP2.2 Tx Session -:63: CHECK:LINE_SPACING: Please don't use multiple blank lines #63: FILE: drivers/misc/mei/hdcp/mei_hdcp.c:716:
+
+
-:108: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #108: FILE: include/linux/mei_hdcp.h:226:
}
+static inline int mei_close_hdcp_session(struct mei_cl_device *cldev,
total: 0 errors, 0 warnings, 2 checks, 80 lines checked 16767b459033 drm/i915: wrapping all hdcp var into intel_hdcp -:33: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #33: FILE: drivers/gpu/drm/i915/intel_display.c:15611:
+ cancel_delayed_work_sync(
-:49: CHECK:UNCOMMENTED_DEFINITION: struct mutex definition without comment #49: FILE: drivers/gpu/drm/i915/intel_drv.h:390:
+ struct mutex hdcp_mutex;
total: 0 errors, 0 warnings, 2 checks, 265 lines checked 272b58219adc drm/i915: Define HDCP2.2 related variablesfaf4862f02e4 drm/i915: Define Intel HDCP2.2 registers35fa75485b9b drm/i915: Wrappers for mei HDCP2.2 services
-:30: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'port' - possible side-effects? #30: FILE: drivers/gpu/drm/i915/intel_hdcp.c:18:
+#define GET_MEI_DDI_INDEX(port) (((port) == PORT_A) ? DDI_A : \
+ (enum hdcp_physical_port) (port))
-:31: CHECK:SPACING: No space is necessary after a cast #31: FILE: drivers/gpu/drm/i915/intel_hdcp.c:19:
+ (enum hdcp_physical_port) (port))
-:109: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #109: FILE: drivers/gpu/drm/i915/intel_hdcp.c:972:
+hdcp2_store_pairing_info(struct intel_hdcp *hdcp,
+ struct hdcp2_ake_send_pairing_info *pairing_info)
-:174: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #174: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1037:
+hdcp2_verify_rep_topology_prepare_ack(
-:210: CHECK:LINE_SPACING: Please don't use multiple blank lines #210: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1073:
+
+
total: 0 errors, 0 warnings, 5 checks, 207 lines checked f0b0871219e8 drm/i915: Implement HDCP2.2 receiver authentication -:222: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #222: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1256:
+ if (!hdcp->is_repeater && shim->config_stream_type) {
+
total: 0 errors, 0 warnings, 1 checks, 196 lines checked 8afdc49b4695 drm/i915: Implement HDCP2.2 repeater authentication 728c6b7de976 drm/i915: Enable and Disable HDCP2.2 port encryption -:51: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #51: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1417:
+ if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) {
+
total: 0 errors, 0 warnings, 1 checks, 66 lines checked 565743b417ff drm/i915: Implement HDCP2.2 En/Dis-able
-:53: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #53: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1477:
+ if (i != tries) {
+
-:95: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #95: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1519:
+ DRM_ERROR("HDCP2 Type%d Enabling Failed. (%d)\n",
+ hdcp->content_type, ret);
total: 0 errors, 0 warnings, 2 checks, 84 lines checked 0b9623ddcbbc drm/i915: Implement HDCP2.2 link integrity check -:66: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #66: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1554:
+ DRM_ERROR("HDCP check failed: link is not encrypted, %x\n",
+ I915_READ(HDCP2_STATUS_DDI(port)));
total: 0 errors, 0 warnings, 1 checks, 107 lines checked 58085107b399 drm/i915: Handle HDCP2.2 downstream topology change -:45: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #45: FILE: drivers/gpu/drm/i915/intel_hdcp.c:1585:
+ DRM_ERROR("[%s:%d] HDCP2.2 link failed, retrying auth\n",
+ connector->base.name, connector->base.base.id);
total: 0 errors, 0 warnings, 1 checks, 25 lines checked478618e93f82 drm/i915: Pullout the bksv read and validation 6d3de0b43294 drm/i915: Initialize HDCP2.2 and its MEI interface ff7d62cc51ab drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable 0e14bd551f01 drm/i915: Enable superior HDCP ver that is capable d678fb18b651 drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure 1939a08c60f2 drm/i915: hdcp_check_link only on CP_IRQ74177819d1de drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ 874606d1c890 drm/i915/gmbus: Increase the Bytes per Rd/Wr Op f478a8f0d9d2 drm/i915/gmbus: Enable burst read
-:36: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'dev_priv' - possible side-effects? #36: FILE: drivers/gpu/drm/i915/i915_drv.h:2573:
+#define HAS_GMBUS_BURST_READ(dev_priv) (INTEL_GEN(dev_priv) >= 10 || \
+ IS_GEMINILAKE(dev_priv) || \
+ IS_KABYLAKE(dev_priv))
-:50: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #50: FILE: drivers/gpu/drm/i915/i915_reg.h:2999:
+#define GMBUS_BYTE_CNT_OVERRIDE (1<<6)
^
-:70: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #70: FILE: drivers/gpu/drm/i915/intel_i2c.c:381:
+ if (burst_read) {
+
total: 0 errors, 0 warnings, 3 checks, 131 lines checked 453c79a01cbe drm/i915: Implement the HDCP2.2 support for DP -:64: CHECK:LINE_SPACING: Please don't use multiple blank lines #64: FILE: drivers/gpu/drm/i915/intel_dp.c:5091:
+
+
-:211: CHECK:LINE_SPACING: Please don't use multiple blank lines #211: FILE: drivers/gpu/drm/i915/intel_dp.c:5449:
+
+
-:223: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #223: FILE: drivers/gpu/drm/i915/intel_dp.c:5461:
+ switch (msg_id) {
+
total: 0 errors, 0 warnings, 3 checks, 410 lines checked e8112903ee68 drm/i915: Implement the HDCP2.2 support for HDMI -:122: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #122: FILE: drivers/gpu/drm/i915/intel_hdmi.c:1198:
+ ret = __wait_for(ret = hdcp2_detect_msg_availability(intel_dig_port,
+ msg_id, &msg_ready, &msg_sz),
total: 0 errors, 0 warnings, 1 checks, 204 lines checked 2515ed3c47a5 drm/i915: Add HDCP2.2 support for DP connectors 9b6826a1a7ce drm/i915: Add HDCP2.2 support for HDMI connectors
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.SPARSE: warning for drm/i915: Implement HDCP2.2 (rev5)
In reply to Ramalingam C== Series Details ==
== Series Details ==
Series: drm/i915: Implement HDCP2.2 (rev5)
URL : https://patchwork.freedesktop.org/series/38254/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Commit: drm: hdcp2.2 authentication msg definitions Okay!
Commit: drm: HDMI and DP specific HDCP2.2 defines
Okay!
Commit: mei: bus: whitelist hdcp client
Okay!
Commit: misc/mei/hdcp: Client driver for HDCP application Okay!
Commit: misc/mei/hdcp: Notifier chain for mei cldev state change Okay!
Commit: misc/mei/hdcp: Define ME FW interface for HDCP2.2 Okay!
Commit: linux/mei: Header for mei_hdcp driver interface Okay!
Commit: misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Okay!
Commit: misc/mei/hdcp: Verify Receiver Cert and prepare km Okay!
Commit: misc/mei/hdcp: Verify H_prime
Okay!
Commit: misc/mei/hdcp: Store the HDCP Pairing info Okay!
Commit: misc/mei/hdcp: Initiate Locality check
Okay!
Commit: misc/mei/hdcp: Verify L_prime
Okay!
Commit: misc/mei/hdcp: Prepare Session Key
Okay!
Commit: misc/mei/hdcp: Repeater topology verification and ack Okay!
Commit: misc/mei/hdcp: Verify M_prime
Okay!
Commit: misc/mei/hdcp: Enabling the HDCP authentication Okay!
Commit: misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Okay!
Commit: drm/i915: wrapping all hdcp var into intel_hdcp Okay!
Commit: drm/i915: Define HDCP2.2 related variables Okay!
Commit: drm/i915: Define Intel HDCP2.2 registers
Okay!
Commit: drm/i915: Wrappers for mei HDCP2.2 services
+ ^~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~~
+cc1: all warnings being treated as errors+drivers/gpu/drm/i915/intel_hdcp.c:1004:1: error: ‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1020:12: error: ‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1037:1: error: ‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1057:1: error: ‘hdcp2_verify_mprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1074:12: error: ‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:904:1: error: ‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:934:1: error: ‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:954:12: error: ‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:971:1: error: ‘hdcp2_store_pairing_info’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:988:1: error: ‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function]
+ hdcp2_prepare_ake_init(struct intel_hdcp *hdcp, struct hdcp2_ake_init *ake_data)
+ hdcp2_prepare_lc_init(struct intel_hdcp *hdcp, struct hdcp2_lc_init *lc_init)
+ hdcp2_store_pairing_info(struct intel_hdcp *hdcp,
+ hdcp2_verify_lprime(struct intel_hdcp *hdcp,
+ hdcp2_verify_mprime(struct intel_hdcp *hdcp,
+ hdcp2_verify_rep_topology_prepare_ack(
+ hdcp2_verify_rx_cert_prepare_km(struct intel_hdcp *hdcp,
+make[1]: *** [drivers/gpu/drm/i915] Error 2
+make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1
+make: *** [drivers/gpu/drm/] Error 2
+ static int hdcp2_authenticate_port(struct intel_hdcp *hdcp)
+ static int hdcp2_prepare_skey(struct intel_hdcp *hdcp,
+ static int hdcp2_verify_hprime(struct intel_hdcp *hdcp,
Commit: drm/i915: Implement HDCP2.2 receiver authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~-drivers/gpu/drm/i915/intel_hdcp.c:1005:1: error: ‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1021:12: error: ‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1075:12: error: ‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:905:1: error: ‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:935:1: error: ‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:955:12: error: ‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:972:1: error: ‘hdcp2_store_pairing_info’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:989:1: error: ‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function]
- hdcp2_prepare_ake_init(struct intel_hdcp *hdcp, struct hdcp2_ake_init *ake_data)
- hdcp2_prepare_lc_init(struct intel_hdcp *hdcp, struct hdcp2_lc_init *lc_init)
- hdcp2_store_pairing_info(struct intel_hdcp *hdcp,
- hdcp2_verify_lprime(struct intel_hdcp *hdcp,+drivers/gpu/drm/i915/intel_hdcp.c:1229:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
- hdcp2_verify_rx_cert_prepare_km(struct intel_hdcp *hdcp,
- static int hdcp2_authenticate_port(struct intel_hdcp *hdcp)
- static int hdcp2_prepare_skey(struct intel_hdcp *hdcp,
- static int hdcp2_verify_hprime(struct intel_hdcp *hdcp,
+ static int hdcp2_authenticate_sink(struct intel_connector *connector)
Commit: drm/i915: Implement HDCP2.2 repeater authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-drivers/gpu/drm/i915/intel_hdcp.c:1038:1: error: ‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1058:1: error: ‘hdcp2_verify_mprime’ defined but not used [-Werror=unused-function] -O:drivers/gpu/drm/i915/intel_hdcp.c:1229:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
- hdcp2_verify_mprime(struct intel_hdcp *hdcp,
- hdcp2_verify_rep_topology_prepare_ack(+drivers/gpu/drm/i915/intel_hdcp.c:1247:30: expected restricted __be16 [assigned] [usertype] k+drivers/gpu/drm/i915/intel_hdcp.c:1247:30: got int+drivers/gpu/drm/i915/intel_hdcp.c:1247:30: warning: incorrect type in assignment (different base types) +drivers/gpu/drm/i915/intel_hdcp.c:1343:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
Commit: drm/i915: Enable and Disable HDCP2.2 port encryption
+ ^~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~+drivers/gpu/drm/i915/intel_hdcp.c:1402:12: error: ‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1432:12: error: ‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function]
+ static int hdcp2_disable_encryption(struct intel_connector *connector)
+ static int hdcp2_enable_encryption(struct intel_connector *connector)
Commit: drm/i915: Implement HDCP2.2 En/Dis-able
- ^~~~~~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~
-drivers/gpu/drm/i915/intel_hdcp.c:1347:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1405:12: error: ‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1435:12: error: ‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1493:12: error: ‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1507:12: error: ‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function]
- static int hdcp2_authenticate_sink(struct intel_connector *connector)
- static int hdcp2_disable_encryption(struct intel_connector *connector)
- static int hdcp2_enable_encryption(struct intel_connector *connector)
+ static int _intel_hdcp2_disable(struct intel_connector *connector)
+ static int _intel_hdcp2_enable(struct intel_connector *connector)
Commit: drm/i915: Implement HDCP2.2 link integrity check
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~-drivers/gpu/drm/i915/intel_hdcp.c:1495:12: error: ‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1509:12: error: ‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1599:13: error: ‘intel_hdcp2_check_work’ defined but not used [-Werror=unused-function]
- static int _intel_hdcp2_disable(struct intel_connector *connector)
- static int _intel_hdcp2_enable(struct intel_connector *connector)
+ static void intel_hdcp2_check_work(struct work_struct *work)
Commit: drm/i915: Handle HDCP2.2 downstream topology change Okay!
Commit: drm/i915: Pullout the bksv read and validation Okay!
Commit: drm/i915: Initialize HDCP2.2 and its MEI interface
- ^~~~~~~~~~~~~~~~~~~~~~
-cc1: all warnings being treated as errors-drivers/gpu/drm/i915/intel_hdcp.c:1638:13: error: ‘intel_hdcp2_check_work’ defined but not used [-Werror=unused-function] -make[1]: *** [drivers/gpu/drm/i915] Error 2
-make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1
-make[2]: *** Waiting for unfinished jobs....
-make: *** [drivers/gpu/drm/] Error 2
- static void intel_hdcp2_check_work(struct work_struct *work)
Commit: drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable Okay!
Commit: drm/i915: Enable superior HDCP ver that is capable Okay!
Commit: drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure Okay!
Commit: drm/i915: hdcp_check_link only on CP_IRQ
Okay!
Commit: drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ Okay!
Commit: drm/i915/gmbus: Increase the Bytes per Rd/Wr Op -O:drivers/gpu/drm/i915/intel_i2c.c:403:23: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_i2c.c:465:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:472:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:472:23: warning: expression using sizeof(void)
Commit: drm/i915/gmbus: Enable burst read -O:drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:446:31: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:448:31: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:448:31: warning: expression using sizeof(void) -drivers/gpu/drm/i915/selftests/../i915_drv.h:3664:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/selftests/../i915_drv.h:3667:16: warning: expression using sizeof(void)
Commit: drm/i915: Implement the HDCP2.2 support for DP Okay!
Commit: drm/i915: Implement the HDCP2.2 support for HDMI Okay!
Commit: drm/i915: Add HDCP2.2 support for DP connectors Okay!
Commit: drm/i915: Add HDCP2.2 support for HDMI connectors Okay!
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.SPARSE: warning for drm/i915: Implement HDCP2.2 (rev5)
Quoted 84 lines · Patchwork
== Series Details ==
Series: drm/i915: Implement HDCP2.2 (rev5)
URL : https://patchwork.freedesktop.org/series/38254/
State : warning== Summary ==
$ dim sparse origin/drm-tip Commit: drm: hdcp2.2 authentication msg definitions Okay!Commit: drm: HDMI and DP specific HDCP2.2 defines
Okay!Commit: mei: bus: whitelist hdcp client
Okay!Commit: misc/mei/hdcp: Client driver for HDCP application Okay!
Commit: misc/mei/hdcp: Notifier chain for mei cldev state change Okay!
Commit: misc/mei/hdcp: Define ME FW interface for HDCP2.2 Okay!
Commit: linux/mei: Header for
mei_hdcpdriver interface Okay!Commit: misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Okay!
Commit: misc/mei/hdcp: Verify Receiver Cert and prepare km Okay!
Commit: misc/mei/hdcp: Verify
H_prime
Okay!Commit: misc/mei/hdcp: Store the HDCP Pairing info Okay!
Commit: misc/mei/hdcp: Initiate Locality check
Okay!Commit: misc/mei/hdcp: Verify
L_prime
Okay!Commit: misc/mei/hdcp: Prepare Session Key
Okay!Commit: misc/mei/hdcp: Repeater topology verification and ack Okay!
Commit: misc/mei/hdcp: Verify
M_prime
Okay!Commit: misc/mei/hdcp: Enabling the HDCP authentication Okay!
Commit: misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Okay!
Commit: drm/i915: wrapping all hdcp var into
intel_hdcpOkay!Commit: drm/i915: Define HDCP2.2 related variables Okay!
Commit: drm/i915: Define Intel HDCP2.2 registers
Okay!Commit: drm/i915: Wrappers for mei HDCP2.2 services
+ ^~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(quoted diff) +4
-0+ ^~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors
Review
Quoted 10 lines
(quoted diff) +10
-0+drivers/gpu/drm/i915/intel_hdcp.c:1004:1: error: ‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1020:12: error: ‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1037:1: error: ‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1057:1: error: ‘hdcp2_verify_mprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1074:12: error: ‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:904:1: error: ‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:934:1: error: ‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:954:12: error: ‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:971:1: error: ‘hdcp2_store_pairing_info’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:988:1: error: ‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function]
Jani and all,
To avoid these warning in bisecting, what is the preferred method in intel-gfx?
1. Reverse the order of patches, as consumer functions first with dummy service functions and then fill the dummy functions with proper definitions?
2. Or combine all of them in single lengthy patches? HDCP1.4 was done in that manner.
Please help with preferred approach.
Thanks,
Ram
Quoted 147 lines
+
hdcp2_prepare_ake_init(struct intel_hdcp *hdcp, struct hdcp2_ake_init *ake_data)
+hdcp2_prepare_lc_init(struct intel_hdcp *hdcp, struct hdcp2_lc_init *lc_init)
+ hdcp2_store_pairing_info(structintel_hdcp*hdcp,
+ hdcp2_verify_lprime(structintel_hdcp*hdcp,
+ hdcp2_verify_mprime(structintel_hdcp*hdcp,
+ hdcp2_verify_rep_topology_prepare_ack(
+ hdcp2_verify_rx_cert_prepare_km(structintel_hdcp*hdcp,(quoted diff) +6
-0+make[1]: *** [drivers/gpu/drm/i915] Error 2 +make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1 +make: *** [drivers/gpu/drm/] Error 2 + static int hdcp2_authenticate_port(struct intel_hdcp *hdcp) + static int hdcp2_prepare_skey(struct intel_hdcp *hdcp, + static int hdcp2_verify_hprime(struct intel_hdcp *hdcp,Commit: drm/i915: Implement HDCP2.2 receiver authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(quoted diff) +2
-18- ^~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/i915/intel_hdcp.c:1005:1: error: ‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1021:12: error: ‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1075:12: error: ‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:905:1: error: ‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:935:1: error: ‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:955:12: error: ‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:972:1: error: ‘hdcp2_store_pairing_info’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:989:1: error: ‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function] - hdcp2_prepare_ake_init(struct intel_hdcp *hdcp, struct hdcp2_ake_init *ake_data) - hdcp2_prepare_lc_init(struct intel_hdcp *hdcp, struct hdcp2_lc_init *lc_init) - hdcp2_store_pairing_info(struct intel_hdcp *hdcp, - hdcp2_verify_lprime(struct intel_hdcp *hdcp, +drivers/gpu/drm/i915/intel_hdcp.c:1229:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function] - hdcp2_verify_rx_cert_prepare_km(struct intel_hdcp *hdcp, - static int hdcp2_authenticate_port(struct intel_hdcp *hdcp) - static int hdcp2_prepare_skey(struct intel_hdcp *hdcp, - static int hdcp2_verify_hprime(struct intel_hdcp *hdcp, + static int hdcp2_authenticate_sink(struct intel_connector *connector)Commit: drm/i915: Implement HDCP2.2 repeater authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(quoted diff) +4
-5-drivers/gpu/drm/i915/intel_hdcp.c:1038:1: error: ‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1058:1: error: ‘hdcp2_verify_mprime’ defined but not used [-Werror=unused-function] -O:drivers/gpu/drm/i915/intel_hdcp.c:1229:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function] - hdcp2_verify_mprime(struct intel_hdcp *hdcp, - hdcp2_verify_rep_topology_prepare_ack( +drivers/gpu/drm/i915/intel_hdcp.c:1247:30: expected restricted __be16 [assigned] [usertype] k +drivers/gpu/drm/i915/intel_hdcp.c:1247:30: got int +drivers/gpu/drm/i915/intel_hdcp.c:1247:30: warning: incorrect type in assignment (different base types) +drivers/gpu/drm/i915/intel_hdcp.c:1343:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]Commit: drm/i915: Enable and Disable HDCP2.2 port encryption
(quoted diff) +6
-0+ ^~~~~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~~~ +drivers/gpu/drm/i915/intel_hdcp.c:1402:12: error: ‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1432:12: error: ‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function] + static int hdcp2_disable_encryption(struct intel_connector *connector) + static int hdcp2_enable_encryption(struct intel_connector *connector)Commit: drm/i915: Implement HDCP2.2 En/Dis-able
(quoted diff) +6
-9- ^~~~~~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/i915/intel_hdcp.c:1347:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1405:12: error: ‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1435:12: error: ‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1493:12: error: ‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1507:12: error: ‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function] - static int hdcp2_authenticate_sink(struct intel_connector *connector) - static int hdcp2_disable_encryption(struct intel_connector *connector) - static int hdcp2_enable_encryption(struct intel_connector *connector) + static int _intel_hdcp2_disable(struct intel_connector *connector) + static int _intel_hdcp2_enable(struct intel_connector *connector)Commit: drm/i915: Implement HDCP2.2 link integrity check
(quoted diff) +3
-6- ^~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/i915/intel_hdcp.c:1495:12: error: ‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function] -drivers/gpu/drm/i915/intel_hdcp.c:1509:12: error: ‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1599:13: error: ‘intel_hdcp2_check_work’ defined but not used [-Werror=unused-function] - static int _intel_hdcp2_disable(struct intel_connector *connector) - static int _intel_hdcp2_enable(struct intel_connector *connector) + static void intel_hdcp2_check_work(struct work_struct *work)Commit: drm/i915: Handle HDCP2.2 downstream topology change Okay!
Commit: drm/i915: Pullout the bksv read and validation Okay!
Commit: drm/i915: Initialize HDCP2.2 and its MEI interface
(quoted diff) +0
-8- ^~~~~~~~~~~~~~~~~~~~~~ -cc1: all warnings being treated as errors -drivers/gpu/drm/i915/intel_hdcp.c:1638:13: error: ‘intel_hdcp2_check_work’ defined but not used [-Werror=unused-function] -make[1]: *** [drivers/gpu/drm/i915] Error 2 -make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1 -make[2]: *** Waiting for unfinished jobs.... -make: *** [drivers/gpu/drm/] Error 2 - static void intel_hdcp2_check_work(struct work_struct *work)Commit: drm/i915: Schedule
hdcp_check_linkin_intel_hdcp_enableOkay!Commit: drm/i915: Enable superior HDCP ver that is capable Okay!
Commit: drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure Okay!
Commit: drm/i915:
hdcp_check_linkonly onCP_IRQ
Okay!Commit: drm/i915: Check HDCP 1.4 and 2.2 link on
CP_IRQOkay!Commit: drm/i915/gmbus: Increase the Bytes per Rd/Wr Op
(quoted diff) +4
-2-O:drivers/gpu/drm/i915/intel_i2c.c:403:23: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_i2c.c:465:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:472:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:472:23: warning: expression using sizeof(void)Commit: drm/i915/gmbus: Enable burst read
(quoted diff) +4
-3-O:drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:446:31: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:448:31: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:448:31: warning: expression using sizeof(void) -drivers/gpu/drm/i915/selftests/../i915_drv.h:3664:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/selftests/../i915_drv.h:3667:16: warning: expression using sizeof(void)Commit: drm/i915: Implement the HDCP2.2 support for DP Okay!
Commit: drm/i915: Implement the HDCP2.2 support for HDMI Okay!
Commit: drm/i915: Add HDCP2.2 support for DP connectors Okay!
Quoted 7 lines
Commit: drm/i915: Add HDCP2.2 support for HDMI connectors Okay!
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.SPARSE: warning for drm/i915: Implement HDCP2.2 (rev5)
Quoted 109 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Ramalingam C
Sent: Monday, May 21, 2018 8:34 PM
To: [email protected]; Patchwork <[email protected]>; lkp <[email protected]>; Jani Nikula <[email protected]>
Subject: Re: [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Implement HDCP2.2 (rev5)Quoted 82 lines · Patchwork
== Series Details ==
Series: drm/i915: Implement HDCP2.2 (rev5)
URL : https://patchwork.freedesktop.org/series/38254/
State : warning== Summary ==
$ dim sparse origin/drm-tip Commit: drm: hdcp2.2 authentication msg definitions Okay!Commit: drm: HDMI and DP specific HDCP2.2 defines Okay!
Commit: mei: bus: whitelist hdcp client Okay!
Commit: misc/mei/hdcp: Client driver for HDCP application Okay!
Commit: misc/mei/hdcp: Notifier chain for mei cldev state change Okay!
Commit: misc/mei/hdcp: Define ME FW interface for HDCP2.2 Okay!
Commit: linux/mei: Header for
mei_hdcpdriver interface Okay!Commit: misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Okay!
Commit: misc/mei/hdcp: Verify Receiver Cert and prepare km Okay!
Commit: misc/mei/hdcp: Verify
H_prime
Okay!Commit: misc/mei/hdcp: Store the HDCP Pairing info Okay!
Commit: misc/mei/hdcp: Initiate Locality check Okay!
Commit: misc/mei/hdcp: Verify
L_prime
Okay!Commit: misc/mei/hdcp: Prepare Session Key Okay!
Commit: misc/mei/hdcp: Repeater topology verification and ack Okay!
Commit: misc/mei/hdcp: Verify
M_prime
Okay!Commit: misc/mei/hdcp: Enabling the HDCP authentication Okay!
Commit: misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Okay!
Commit: drm/i915: wrapping all hdcp var into
intel_hdcpOkay!Commit: drm/i915: Define HDCP2.2 related variables Okay!
Commit: drm/i915: Define Intel HDCP2.2 registers Okay!
Commit: drm/i915: Wrappers for mei HDCP2.2 services
+ ^~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(quoted diff) +20
-0+ ^~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors +drivers/gpu/drm/i915/intel_hdcp.c:1004:1: error: +‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1020:12: error: +‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1037:1: error: +‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used +[-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1057:1: error: +‘hdcp2_verify_mprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1074:12: error: +‘hdcp2_authenticate_port’ defined but not used +[-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:904:1: error: +‘hdcp2_prepare_ake_init’ defined but not used +[-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:934:1: error:Review
Quoted 10 lines
(quoted diff) +10
-0+‘hdcp2_verify_rx_cert_prepare_km’ defined but not used +[-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:954:12: error: +‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:971:1: error: +‘hdcp2_store_pairing_info’ defined but not used +[-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:988:1: error: +‘hdcp2_prepare_lc_init’ defined but not used +[-Werror=unused-function]Jani and all,
Quoted 8 lines
To avoid these warning in bisecting, what is the preferred method in intel-gfx?
1. Reverse the order of patches, as consumer functions first with dummy service functions and then fill the dummy functions with proper definitions?
2. Or combine all of them in single lengthy patches? HDCP1.4 was done in that manner.Please help with preferred approach.
For me, smaller logical patches are easy to review and maintain. So in order to avoid such warnings, option 1 sounds better. Though it will lead to dummy functions which will get filled later as part of subsequent patches in the series.
Quoted 202 lines
Thanks,
RamQuoted 59 lines
+ hdcp2_prepare_ake_init(struct
intel_hdcp*hdcp, struct(quoted diff) +13
-0+hdcp2_ake_init *ake_data) hdcp2_prepare_lc_init(struct intel_hdcp +*hdcp, struct hdcp2_lc_init *lc_init) +hdcp2_store_pairing_info(struct intel_hdcp *hdcp, +hdcp2_verify_lprime(struct intel_hdcp *hdcp, +hdcp2_verify_mprime(struct intel_hdcp *hdcp, +hdcp2_verify_rep_topology_prepare_ack( + hdcp2_verify_rx_cert_prepare_km(struct intel_hdcp *hdcp, +make[1]: *** [drivers/gpu/drm/i915] Error 2 +make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1 +make: *** [drivers/gpu/drm/] Error 2 + static int hdcp2_authenticate_port(struct intel_hdcp *hdcp) static +int hdcp2_prepare_skey(struct intel_hdcp *hdcp, static int +hdcp2_verify_hprime(struct intel_hdcp *hdcp,Commit: drm/i915: Implement HDCP2.2 receiver authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(quoted diff) +0
-3- ^~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/i915/intel_hdcp.c:1005:1: error:‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:1021:12: error:
‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:1075:12: error:
‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:905:1: error:
‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:935:1: error:
‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:955:12: error:
‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:972:1: error:
‘hdcp2_store_pairing_info’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:989:1: error:
‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function]
-hdcp2_prepare_ake_init(struct intel_hdcp *hdcp, struct hdcp2_ake_init *ake_data)
-hdcp2_prepare_lc_init(struct intel_hdcp *hdcp, struct hdcp2_lc_init *lc_init)
- hdcp2_store_pairing_info(structintel_hdcp*hdcp,
- hdcp2_verify_lprime(structintel_hdcp*hdcp,+drivers/gpu/drm/i915/intel_hdcp.c:1229:12: error:
+‘hdcp2_authenticate_sink’ defined but not used +[-Werror=unused-function]
- hdcp2_verify_rx_cert_prepare_km(structintel_hdcp*hdcp,
- static inthdcp2_authenticate_port(struct intel_hdcp *hdcp)
- static int hdcp2_prepare_skey(structintel_hdcp*hdcp,
- static int hdcp2_verify_hprime(structintel_hdcp*hdcp,
+ static int hdcp2_authenticate_sink(structintel_connector
+ *connector)Quoted 14 lines
Commit: drm/i915: Implement HDCP2.2 repeater authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-drivers/gpu/drm/i915/intel_hdcp.c:1038:1: error:
‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:1058:1: error:
‘hdcp2_verify_mprime’ defined but not used [-Werror=unused-function] -O:drivers/gpu/drm/i915/intel_hdcp.c:1229:12: error:
‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
- hdcp2_verify_mprime(structintel_hdcp*hdcp,
- hdcp2_verify_rep_topology_prepare_ack(+drivers/gpu/drm/i915/intel_hdcp.c:1247:30: expected restricted__be16[assigned] [usertype] k
Quoted 126 lines
(quoted diff) +6
-0+drivers/gpu/drm/i915/intel_hdcp.c:1247:30: got int +drivers/gpu/drm/i915/intel_hdcp.c:1247:30: warning: incorrect type in +assignment (different base types) +drivers/gpu/drm/i915/intel_hdcp.c:1343:12: error: +‘hdcp2_authenticate_sink’ defined but not used +[-Werror=unused-function]Commit: drm/i915: Enable and Disable HDCP2.2 port encryption
(quoted diff) +10
-0+ ^~~~~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~~~ +drivers/gpu/drm/i915/intel_hdcp.c:1402:12: error: +‘hdcp2_enable_encryption’ defined but not used +[-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1432:12: error: +‘hdcp2_disable_encryption’ defined but not used +[-Werror=unused-function] static int hdcp2_disable_encryption(struct +intel_connector *connector) static int +hdcp2_enable_encryption(struct intel_connector *connector)Commit: drm/i915: Implement HDCP2.2 En/Dis-able
(quoted diff) +2
-4- ^~~~~~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/i915/intel_hdcp.c:1347:12: error:‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:1405:12: error:
‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function]-drivers/gpu/drm/i915/intel_hdcp.c:1435:12: error:
‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function](quoted diff) +4
-1+drivers/gpu/drm/i915/intel_hdcp.c:1493:12: error: +‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function] +drivers/gpu/drm/i915/intel_hdcp.c:1507:12: error: +‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function] - static int hdcp2_authenticate_sink(struct intel_connector*connector)
- static inthdcp2_disable_encryption(struct intel_connector *connector)
- static inthdcp2_enable_encryption(struct intel_connector *connector)
+ static int_intel_hdcp2_disable(struct intel_connector *connector)
+ static int_intel_hdcp2_enable(struct intel_connector *connector)Commit: drm/i915: Implement HDCP2.2 link integrity check
(quoted diff) +1
-3- ^~~~~~~~~~~~~~~~~~~ - ^~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/i915/intel_hdcp.c:1495:12: error:‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:1509:12: error:
‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function]+drivers/gpu/drm/i915/intel_hdcp.c:1599:13: error:
+‘intel_hdcp2_check_work’ defined but not used +[-Werror=unused-function]
- static int_intel_hdcp2_disable(struct intel_connector *connector)
- static int_intel_hdcp2_enable(struct intel_connector *connector)
+ static voidintel_hdcp2_check_work(struct work_struct *work)Commit: drm/i915: Handle HDCP2.2 downstream topology change Okay!
Commit: drm/i915: Pullout the bksv read and validation Okay!
Commit: drm/i915: Initialize HDCP2.2 and its MEI interface
(quoted diff) +0
-3- ^~~~~~~~~~~~~~~~~~~~~~ -cc1: all warnings being treated as errors -drivers/gpu/drm/i915/intel_hdcp.c:1638:13: error:‘intel_hdcp2_check_work’ defined but not used
[-Werror=unused-function](quoted diff) +0
-5-make[1]: *** [drivers/gpu/drm/i915] Error 2 -make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1 -make[2]: *** Waiting for unfinished jobs.... -make: *** [drivers/gpu/drm/] Error 2 - static void intel_hdcp2_check_work(struct work_struct *work)Commit: drm/i915: Schedule
hdcp_check_linkin_intel_hdcp_enableOkay!Commit: drm/i915: Enable superior HDCP ver that is capable Okay!
Commit: drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure Okay!
Commit: drm/i915:
hdcp_check_linkonly onCP_IRQOkay!Commit: drm/i915: Check HDCP 1.4 and 2.2 link on
CP_IRQOkay!Commit: drm/i915/gmbus: Increase the Bytes per Rd/Wr Op -O:drivers/gpu/drm/i915/intel_i2c.c:403:23: warning: expression using sizeof(void)
-O:drivers/gpu/drm/i915/intel_i2c.c:465:23: warning: expression using sizeof(void)(quoted diff) +8
-0+drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using +sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using +sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:472:23: warning: expression using +sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:472:23: warning: expression using +sizeof(void)Commit: drm/i915/gmbus: Enable burst read -O:drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void)
-O:drivers/gpu/drm/i915/intel_i2c.c:410:23: warning: expression using sizeof(void)(quoted diff) +6
-1+drivers/gpu/drm/i915/intel_i2c.c:446:31: warning: expression using +sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:448:31: warning: expression using +sizeof(void) +drivers/gpu/drm/i915/intel_i2c.c:448:31: warning: expression using +sizeof(void) -drivers/gpu/drm/i915/selftests/../i915_drv.h:3664:16: warning:expression using sizeof(void)
(quoted diff) +2
-0+drivers/gpu/drm/i915/selftests/../i915_drv.h:3667:16: warning: +expression using sizeof(void)Commit: drm/i915: Implement the HDCP2.2 support for DP Okay!
Commit: drm/i915: Implement the HDCP2.2 support for HDMI Okay!
Commit: drm/i915: Add HDCP2.2 support for DP connectors Okay!
Commit: drm/i915: Add HDCP2.2 support for HDMI connectors Okay!
Quoted 9 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Implement HDCP2.2 (rev5)
In reply to Ramalingam C== Series Details ==
== Series Details ==
Series: drm/i915: Implement HDCP2.2 (rev5)
URL : https://patchwork.freedesktop.org/series/38254/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4212 -> Patchwork_9067 =
== Summary - FAILURE ==
Serious unknown changes coming with Patchwork_9067 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_9067, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/38254/revisions/5/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9067:
=== IGT changes ===
==== Possible regressions ====
igt@drv_module_reload@basic-no-display:
fi-glk-j4005: PASS -> FAIL
fi-kbl-r: PASS -> FAIL
fi-kbl-7560u: PASS -> FAIL
{fi-kbl-guc}: PASS -> FAIL
fi-kbl-7500u: PASS -> FAIL
igt@drv_module_reload@basic-reload:
fi-kbl-r: PASS -> DMESG-FAIL
fi-kbl-7500u: PASS -> DMESG-FAIL
{fi-kbl-guc}: PASS -> DMESG-FAIL
fi-glk-j4005: PASS -> DMESG-FAIL
fi-kbl-7560u: PASS -> DMESG-FAIL
igt@drv_module_reload@basic-reload-inject:
fi-kbl-7560u: PASS -> INCOMPLETE
{fi-kbl-guc}: PASS -> INCOMPLETE
fi-kbl-r: PASS -> INCOMPLETE
fi-kbl-7500u: PASS -> INCOMPLETE
==== Warnings ====
igt@drv_module_reload@basic-no-display:
fi-cnl-psr: DMESG-WARN (fdo#105395) -> FAIL
fi-kbl-7567u: DMESG-WARN (fdo#105602) -> FAIL
igt@drv_module_reload@basic-reload:
fi-kbl-7567u: DMESG-WARN (fdo#105602) -> DMESG-FAIL
fi-cnl-psr: DMESG-WARN (fdo#105395) -> DMESG-FAIL
igt@drv_module_reload@basic-reload-inject:
fi-kbl-7567u: DMESG-WARN (fdo#105602) -> INCOMPLETE
igt@gem_exec_gttfill@basic:
fi-pnv-d510: PASS -> SKIP
igt@kms_busy@basic-flip-a:
fi-kbl-7567u: SKIP -> PASS +30== Known issues ==
Here are the changes found in Patchwork_9067 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_module_reload@basic-reload-inject:
fi-glk-j4005: PASS -> INCOMPLETE (fdo#103359, k.org#198133)
igt@kms_frontbuffer_tracking@basic:
fi-hsw-peppy: NOTRUN -> DMESG-FAIL (fdo#102614, fdo#106103)
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
fi-kbl-7567u: SKIP -> DMESG-FAIL (fdo#105079)
==== Possible fixes ====
igt@debugfs_test@read_all_entries:
fi-snb-2520m: INCOMPLETE (fdo#103713) -> PASS
igt@gem_exec_suspend@basic-s3:
fi-kbl-7567u: DMESG-WARN (fdo#105602) -> PASS +1
igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
fi-skl-guc: FAIL (fdo#103191, fdo#104724) -> PASS
==== Warnings ====
igt@drv_module_reload@basic-reload-inject:
fi-cnl-psr: DMESG-WARN (fdo#105395) -> INCOMPLETE (fdo#105086) {name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105079 https://bugs.freedesktop.org/show_bug.cgi?id=105079
fdo#105086 https://bugs.freedesktop.org/show_bug.cgi?id=105086
fdo#105395 https://bugs.freedesktop.org/show_bug.cgi?id=105395
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133
== Participating hosts (41 -> 38) ==
Additional (2): fi-byt-j1900 fi-hsw-peppy
Missing (5): fi-byt-squawks fi-ilk-m540 fi-cnl-y3 fi-bsw-cyan fi-skl-6700hq
== Build changes ==
* Linux: CI_DRM_4212 -> Patchwork_9067
CI_DRM_4212: da383fb02111a4871806a3a31c4a5996243829a5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4488: 9367223d264bfba5b3aafc01d9b2b554d7d22f62 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9067: 9b6826a1a7cefa00253e3fba5542ff670e78ba76 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4488: 6ab75f7eb5e1dccbb773e1739beeb2d7cbd6ad0d @ git://anongit.freedesktop.org/piglit
== Linux commits ==
9b6826a1a7ce drm/i915: Add HDCP2.2 support for HDMI connectors 2515ed3c47a5 drm/i915: Add HDCP2.2 support for DP connectors e8112903ee68 drm/i915: Implement the HDCP2.2 support for HDMI 453c79a01cbe drm/i915: Implement the HDCP2.2 support for DP f478a8f0d9d2 drm/i915/gmbus: Enable burst read 874606d1c890 drm/i915/gmbus: Increase the Bytes per Rd/Wr Op 74177819d1de drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ 1939a08c60f2 drm/i915: hdcp_check_link only on CP_IRQ d678fb18b651 drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure 0e14bd551f01 drm/i915: Enable superior HDCP ver that is capable ff7d62cc51ab drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable 6d3de0b43294 drm/i915: Initialize HDCP2.2 and its MEI interface 478618e93f82 drm/i915: Pullout the bksv read and validation 58085107b399 drm/i915: Handle HDCP2.2 downstream topology change 0b9623ddcbbc drm/i915: Implement HDCP2.2 link integrity check 565743b417ff drm/i915: Implement HDCP2.2 En/Dis-able 728c6b7de976 drm/i915: Enable and Disable HDCP2.2 port encryption 8afdc49b4695 drm/i915: Implement HDCP2.2 repeater authentication f0b0871219e8 drm/i915: Implement HDCP2.2 receiver authentication 35fa75485b9b drm/i915: Wrappers for mei HDCP2.2 services faf4862f02e4 drm/i915: Define Intel HDCP2.2 registers 272b58219adc drm/i915: Define HDCP2.2 related variables 16767b459033 drm/i915: wrapping all hdcp var into intel_hdcp 79bf525e25db misc/mei/hdcp: Closing wired HDCP2.2 Tx Session 9533b0a2bf1d misc/mei/hdcp: Enabling the HDCP authentication 9b7ef72365f5 misc/mei/hdcp: Verify M_primea907491eeaa8 misc/mei/hdcp: Repeater topology verification and ack 4cc6b45df72b misc/mei/hdcp: Prepare Session Key 8ae3bad8bfc6 misc/mei/hdcp: Verify L_primea654af89f26c misc/mei/hdcp: Initiate Locality check fd14fdc946e5 misc/mei/hdcp: Store the HDCP Pairing info aefe2ebece44 misc/mei/hdcp: Verify H_prime84e76bf55686 misc/mei/hdcp: Verify Receiver Cert and prepare km 6bc980d8e356 misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session 84ee35a55af1 linux/mei: Header for mei_hdcp driver interface 8a50ab312a70 misc/mei/hdcp: Define ME FW interface for HDCP2.2 631cabacba79 misc/mei/hdcp: Notifier chain for mei cldev state change d3a9f111f8e8 misc/mei/hdcp: Client driver for HDCP application 05320e361157 mei: bus: whitelist hdcp cliente1983dd17552 drm: HDMI and DP specific HDCP2.2 defines 5534d5c8130b drm: hdcp2.2 authentication msg definitions
== Kernel 32bit build ==
Warning: Kernel 32bit buildtest failed:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9067/build_32bit_failure.log
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9067/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 33 lines · Ramalingam C
The sequence for HDCP2.2 authentication and encryption is implemented in I915. Encoder specific implementations are moved into
hdcp_shim.Intel HWs supports HDCP2.2 through ME FW. Hence this series introduces a client driver for mei bus, so that for HDCP2.2 authentication, HDCP2.2 stack in I915 can avail the services from ME FW.
DRM_I915selectsINTEL_MEI_HDCP, which selectsINTEL_MEI_MEandINTEL_MEI. If we are interested in disabling theMEI_HDCPand MEI Bus then we need an option to disable the HDCP2.2 in I915 (like DRM_I915_HDCP2.2!?). Till then they are binded.Userspace interface remains unchanged as version agnostic. When userspace request for HDCP enable, Kernel will detect the HDCP source and sink's HDCP version(1.4/2.2)capability and enable the best capable version for that combination.
This series enables the HDCP2.2 for Type0 content streams.
Thanks a lot for Usyskin, Alexander and Uma shankar for the review of v3. Thanks Daniel vetter for guiding me to test and confirm that there is no locking issue with respect to notifier usage between I915 and
MEI_HDCP.Major Changes in v4:
- GMBus Changes to implement the burst read as generic [Jani, Ville and Daniel]
- Polling is added for extra Notifier notification when I915 andMEI_HDCPare modules.
- Comment and style issues and typos are fixed [Uma and Alexander]
-INTEL_MEI_HDCP,INTEL_MEI_MEandINTEL_MEIare selected by I915.
- Fixed the #if ininclude/linux/mei_hdcp.hfor build issues.
Quoted 2 lines
GMBus changes are added here for completeness of the series. They are in review at https://patchwork.freedesktop.org/series/41632/ also.
Please reply with a link to your github here (and include it in your next cover letter too). I can't ever find it when I need it :-/
Thanks, Daniel
Quoted 73 lines
Ramalingam C (40):
drm: hdcp2.2 authentication msg definitions
drm: HDMI and DP specific HDCP2.2 defines misc/mei/hdcp: Client driver for HDCP application misc/mei/hdcp: Notifier chain for mei cldev state change misc/mei/hdcp: Define ME FW interface for HDCP2.2 linux/mei: Header formei_hdcpdriver interface misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session misc/mei/hdcp: Verify Receiver Cert and prepare km misc/mei/hdcp: VerifyH_prime
misc/mei/hdcp: Store the HDCP Pairing info misc/mei/hdcp: Initiate Locality check misc/mei/hdcp: VerifyL_prime
misc/mei/hdcp: Prepare Session Key misc/mei/hdcp: Repeater topology verification and ack misc/mei/hdcp: VerifyM_prime
misc/mei/hdcp: Enabling the HDCP authentication misc/mei/hdcp: Closing wired HDCP2.2 Tx Session drm/i915: wrapping all hdcp var intointel_hdcpdrm/i915: Define HDCP2.2 related variables drm/i915: Define Intel HDCP2.2 registers drm/i915: Wrappers for mei HDCP2.2 services drm/i915: Implement HDCP2.2 receiver authentication drm/i915: Implement HDCP2.2 repeater authentication drm/i915: Enable and Disable HDCP2.2 port encryption drm/i915: Implement HDCP2.2 En/Dis-able drm/i915: Implement HDCP2.2 link integrity check drm/i915: Handle HDCP2.2 downstream topology change drm/i915: Pullout the bksv read and validation drm/i915: Initialize HDCP2.2 and its MEI interface drm/i915: Schedulehdcp_check_linkin_intel_hdcp_enabledrm/i915: Enable superior HDCP ver that is capable drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure drm/i915:hdcp_check_linkonly onCP_IRQdrm/i915: Check HDCP 1.4 and 2.2 link onCP_IRQdrm/i915/gmbus: Increase the Bytes per Rd/Wr Op drm/i915/gmbus: Enable burst read
drm/i915: Implement the HDCP2.2 support for DP drm/i915: Implement the HDCP2.2 support for HDMI drm/i915: Add HDCP2.2 support for DP connectors drm/i915: Add HDCP2.2 support for HDMI connectorsTomas Winkler (1):
mei: bus: whitelist hdcp clientdrivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/i915_reg.h | 34 ++ drivers/gpu/drm/i915/intel_display.c | 7 +- drivers/gpu/drm/i915/intel_dp.c | 370 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 88 ++- drivers/gpu/drm/i915/intel_hdcp.c | 1096 ++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_hdmi.c | 189 +++++- drivers/gpu/drm/i915/intel_i2c.c | 71 ++- drivers/misc/mei/Kconfig | 7 + drivers/misc/mei/Makefile | 2 + drivers/misc/mei/bus-fixup.c | 16 + drivers/misc/mei/hdcp/Makefile | 6 + drivers/misc/mei/hdcp/mei_hdcp.c | 817 +++++++++++++++++++++++++ drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++++++++++++ include/drm/drm_dp_helper.h | 51 ++ include/drm/drm_hdcp.h | 232 +++++++ include/linux/mei_hdcp.h | 232 +++++++ 18 files changed, 3546 insertions(+), 91 deletions(-) create mode 100644 drivers/misc/mei/hdcp/Makefile create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.c create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.h create mode 100644 include/linux/mei_hdcp.hSignature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 44 lines
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, May 29, 2018 12:27 PM
To: C, Ramalingam <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Winkler, Tomas <[email protected]>; Usyskin, Alexander <[email protected]>; Shankar, Uma <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH v4 00/41] drm/i915: Implement HDCP2.2Quoted 32 lines · Ramalingam C
The sequence for HDCP2.2 authentication and encryption is implemented in I915. Encoder specific implementations are moved into
hdcp_shim.Intel HWs supports HDCP2.2 through ME FW. Hence this series introduces a client driver for mei bus, so that for HDCP2.2 authentication, HDCP2.2 stack in I915 can avail the services from ME FW.
DRM_I915selectsINTEL_MEI_HDCP, which selectsINTEL_MEI_MEandINTEL_MEI. If we are interested in disabling theMEI_HDCPand MEI Bus then we need an option to disable the HDCP2.2 in I915 (like DRM_I915_HDCP2.2!?). Till then they are binded.Userspace interface remains unchanged as version agnostic. When userspace request for HDCP enable, Kernel will detect the HDCP source and sink's HDCP version(1.4/2.2)capability and enable the best capable version for that combination.
This series enables the HDCP2.2 for Type0 content streams.
Thanks a lot for Usyskin, Alexander and Uma shankar for the review of v3. Thanks Daniel vetter for guiding me to test and confirm that there is no locking issue with respect to notifier usage between I915 and
MEI_HDCP.Major Changes in v4:
- GMBus Changes to implement the burst read as generic [Jani, Ville and Daniel]
- Polling is added for extra Notifier notification when I915 andMEI_HDCPare modules.
- Comment and style issues and typos are fixed [Uma and Alexander]
-INTEL_MEI_HDCP,INTEL_MEI_MEandINTEL_MEIare selected by I915.
- Fixed the #if ininclude/linux/mei_hdcp.hfor build issues.
Quoted 5 lines
Quoted 2 lines
GMBus changes are added here for completeness of the series. They are in review at https://patchwork.freedesktop.org/series/41632/ also.
Please reply with a link to your github here (and include it in your next cover letter too). I can't ever find it when I need it :-/
You can find a github repo for HDCP2.2 v4 series at https://github.com/ramalingampc2008/drm-tip
Thanks,
Ram
Quoted 74 lines
Thanks, Daniel
Quoted 46 lines
Ramalingam C (40):
drm: hdcp2.2 authentication msg definitions
drm: HDMI and DP specific HDCP2.2 defines misc/mei/hdcp: Client driver for HDCP application misc/mei/hdcp: Notifier chain for mei cldev state change misc/mei/hdcp: Define ME FW interface for HDCP2.2 linux/mei: Header formei_hdcpdriver interface misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session misc/mei/hdcp: Verify Receiver Cert and prepare km misc/mei/hdcp: VerifyH_prime
misc/mei/hdcp: Store the HDCP Pairing info misc/mei/hdcp: Initiate Locality check misc/mei/hdcp: VerifyL_prime
misc/mei/hdcp: Prepare Session Key misc/mei/hdcp: Repeater topology verification and ack misc/mei/hdcp: VerifyM_prime
misc/mei/hdcp: Enabling the HDCP authentication misc/mei/hdcp: Closing wired HDCP2.2 Tx Session drm/i915: wrapping all hdcp var intointel_hdcpdrm/i915: Define HDCP2.2 related variables drm/i915: Define Intel HDCP2.2 registers drm/i915: Wrappers for mei HDCP2.2 services drm/i915: Implement HDCP2.2 receiver authentication drm/i915: Implement HDCP2.2 repeater authentication drm/i915: Enable and Disable HDCP2.2 port encryption drm/i915: Implement HDCP2.2 En/Dis-able drm/i915: Implement HDCP2.2 link integrity check drm/i915: Handle HDCP2.2 downstream topology change drm/i915: Pullout the bksv read and validation drm/i915: Initialize HDCP2.2 and its MEI interface drm/i915: Schedulehdcp_check_linkin_intel_hdcp_enabledrm/i915: Enable superior HDCP ver that is capable drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure drm/i915:hdcp_check_linkonly onCP_IRQdrm/i915: Check HDCP 1.4 and 2.2 link onCP_IRQdrm/i915/gmbus: Increase the Bytes per Rd/Wr Op drm/i915/gmbus: Enable burst read
drm/i915: Implement the HDCP2.2 support for DP drm/i915: Implement the HDCP2.2 support for HDMI drm/i915: Add HDCP2.2 support for DP connectors drm/i915: Add HDCP2.2 support for HDMI connectorsTomas Winkler (1):
mei: bus: whitelist hdcp clientQuoted 7 lines
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/i915_reg.h | 34 ++ drivers/gpu/drm/i915/intel_display.c | 7 +- drivers/gpu/drm/i915/intel_dp.c | 370 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 88 ++- drivers/gpu/drm/i915/intel_hdcp.c | 1096++++++++++++++++++++++++++++++++--
Quoted 17 lines
drivers/gpu/drm/i915/intel_hdmi.c | 189 +++++- drivers/gpu/drm/i915/intel_i2c.c | 71 ++- drivers/misc/mei/Kconfig | 7 + drivers/misc/mei/Makefile | 2 + drivers/misc/mei/bus-fixup.c | 16 + drivers/misc/mei/hdcp/Makefile | 6 + drivers/misc/mei/hdcp/mei_hdcp.c | 817 +++++++++++++++++++++++++ drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++++++++++++ include/drm/drm_dp_helper.h | 51 ++ include/drm/drm_hdcp.h | 232 +++++++ include/linux/mei_hdcp.h | 232 +++++++ 18 files changed, 3546 insertions(+), 91 deletions(-) create mode100644
drivers/misc/mei/hdcp/Makefilecreate mode 100644drivers/misc/mei/hdcp/mei_hdcp.ccreate mode 100644drivers/misc/mei/hdcp/mei_hdcp.hcreate mode 100644include/linux/mei_hdcp.h
Quoted 8 lines
Quoted 3 lines
--
2.7.4--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 44 lines · Ramalingam
Quoted 44 lines
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, May 29, 2018 12:27 PM
To: C, Ramalingam <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Winkler, Tomas <[email protected]>; Usyskin, Alexander <[email protected]>; Shankar, Uma <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH v4 00/41] drm/i915: Implement HDCP2.2Quoted 32 lines · Ramalingam C
The sequence for HDCP2.2 authentication and encryption is implemented in I915. Encoder specific implementations are moved into
hdcp_shim.Intel HWs supports HDCP2.2 through ME FW. Hence this series introduces a client driver for mei bus, so that for HDCP2.2 authentication, HDCP2.2 stack in I915 can avail the services from ME FW.
DRM_I915selectsINTEL_MEI_HDCP, which selectsINTEL_MEI_MEandINTEL_MEI. If we are interested in disabling theMEI_HDCPand MEI Bus then we need an option to disable the HDCP2.2 in I915 (like DRM_I915_HDCP2.2!?). Till then they are binded.Userspace interface remains unchanged as version agnostic. When userspace request for HDCP enable, Kernel will detect the HDCP source and sink's HDCP version(1.4/2.2)capability and enable the best capable version for that combination.
This series enables the HDCP2.2 for Type0 content streams.
Thanks a lot for Usyskin, Alexander and Uma shankar for the review of v3. Thanks Daniel vetter for guiding me to test and confirm that there is no locking issue with respect to notifier usage between I915 and
MEI_HDCP.Major Changes in v4:
- GMBus Changes to implement the burst read as generic [Jani, Ville and Daniel]
- Polling is added for extra Notifier notification when I915 andMEI_HDCPare modules.
- Comment and style issues and typos are fixed [Uma and Alexander]
-INTEL_MEI_HDCP,INTEL_MEI_MEandINTEL_MEIare selected by I915.
- Fixed the #if ininclude/linux/mei_hdcp.hfor build issues.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
GMBus changes are added here for completeness of the series. They are in review at https://patchwork.freedesktop.org/series/41632/ also.
Please reply with a link to your github here (and include it in your next cover letter too). I can't ever find it when I need it :-/
You can find a github repo for HDCP2.2 v4 series at https://github.com/ramalingampc2008/drm-tip
Even nicer if you directly supply what I need to feed to git fetch (like a git pull request over email):
https://github.com/ramalingampc2008/drm-tip.git hdcp2_2_v4
Then I can do a git fetch && git checkout FETCH_HEAD.
Thanks, Daniel
Quoted 86 lines
Thanks,
RamQuoted 82 lines
Thanks, Daniel
Quoted 46 lines
Ramalingam C (40):
drm: hdcp2.2 authentication msg definitions
drm: HDMI and DP specific HDCP2.2 defines misc/mei/hdcp: Client driver for HDCP application misc/mei/hdcp: Notifier chain for mei cldev state change misc/mei/hdcp: Define ME FW interface for HDCP2.2 linux/mei: Header formei_hdcpdriver interface misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session misc/mei/hdcp: Verify Receiver Cert and prepare km misc/mei/hdcp: VerifyH_prime
misc/mei/hdcp: Store the HDCP Pairing info misc/mei/hdcp: Initiate Locality check misc/mei/hdcp: VerifyL_prime
misc/mei/hdcp: Prepare Session Key misc/mei/hdcp: Repeater topology verification and ack misc/mei/hdcp: VerifyM_prime
misc/mei/hdcp: Enabling the HDCP authentication misc/mei/hdcp: Closing wired HDCP2.2 Tx Session drm/i915: wrapping all hdcp var intointel_hdcpdrm/i915: Define HDCP2.2 related variables drm/i915: Define Intel HDCP2.2 registers drm/i915: Wrappers for mei HDCP2.2 services drm/i915: Implement HDCP2.2 receiver authentication drm/i915: Implement HDCP2.2 repeater authentication drm/i915: Enable and Disable HDCP2.2 port encryption drm/i915: Implement HDCP2.2 En/Dis-able drm/i915: Implement HDCP2.2 link integrity check drm/i915: Handle HDCP2.2 downstream topology change drm/i915: Pullout the bksv read and validation drm/i915: Initialize HDCP2.2 and its MEI interface drm/i915: Schedulehdcp_check_linkin_intel_hdcp_enabledrm/i915: Enable superior HDCP ver that is capable drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure drm/i915:hdcp_check_linkonly onCP_IRQdrm/i915: Check HDCP 1.4 and 2.2 link onCP_IRQdrm/i915/gmbus: Increase the Bytes per Rd/Wr Op drm/i915/gmbus: Enable burst read
drm/i915: Implement the HDCP2.2 support for DP drm/i915: Implement the HDCP2.2 support for HDMI drm/i915: Add HDCP2.2 support for DP connectors drm/i915: Add HDCP2.2 support for HDMI connectorsTomas Winkler (1):
mei: bus: whitelist hdcp clientQuoted 7 lines
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/i915_reg.h | 34 ++ drivers/gpu/drm/i915/intel_display.c | 7 +- drivers/gpu/drm/i915/intel_dp.c | 370 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 88 ++- drivers/gpu/drm/i915/intel_hdcp.c | 1096++++++++++++++++++++++++++++++++--
Quoted 12 lines
drivers/gpu/drm/i915/intel_hdmi.c | 189 +++++- drivers/gpu/drm/i915/intel_i2c.c | 71 ++- drivers/misc/mei/Kconfig | 7 + drivers/misc/mei/Makefile | 2 + drivers/misc/mei/bus-fixup.c | 16 + drivers/misc/mei/hdcp/Makefile | 6 + drivers/misc/mei/hdcp/mei_hdcp.c | 817 +++++++++++++++++++++++++ drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++++++++++++ include/drm/drm_dp_helper.h | 51 ++ include/drm/drm_hdcp.h | 232 +++++++ include/linux/mei_hdcp.h | 232 +++++++ 18 files changed, 3546 insertions(+), 91 deletions(-) create modeQuoted 8 lines
100644
drivers/misc/mei/hdcp/Makefilecreate mode 100644drivers/misc/mei/hdcp/mei_hdcp.ccreate mode 100644drivers/misc/mei/hdcp/mei_hdcp.hcreate mode 100644include/linux/mei_hdcp.h--
2.7.4--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 73 lines
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, May 29, 2018 2:01 PM
To: C, Ramalingam <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; dri- [email protected]; [email protected]; chris@chris- wilson.co.uk; [email protected]; Winkler, Tomas <[email protected]>; Usyskin, Alexander <[email protected]>; Shankar, Uma <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH v4 00/41] drm/i915: Implement HDCP2.2Quoted 14 lines · Ramalingam
Quoted 14 lines
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, May 29, 2018 12:27 PM
To: C, Ramalingam <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Winkler, Tomas <[email protected]>; Usyskin, Alexander <[email protected]>; Shankar, Uma <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH v4 00/41] drm/i915: Implement HDCP2.2Quoted 3 lines
Quoted 3 lines · Ramalingam C
Quoted 2 lines
The sequence for HDCP2.2 authentication and encryption is implemented in I915. Encoder specific implementations are moved into
hdcp_shim.Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Intel HWs supports HDCP2.2 through ME FW. Hence this series introduces a client driver for mei bus, so that for HDCP2.2 authentication,
HDCP2.2 stack in I915 can avail the services from ME FW.
DRM_I915selectsINTEL_MEI_HDCP, which selectsINTEL_MEI_MEandINTEL_MEI. If we are interested in disabling theMEI_HDCPand MEI Bus then we need an option to disable the HDCP2.2 in I915 (like DRM_I915_HDCP2.2!?). Till then they are binded.Userspace interface remains unchanged as version agnostic. When userspace request for HDCP enable, Kernel will detect the HDCP source and sink's HDCP version(1.4/2.2)capability and enable the best capable version for that combination.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This series enables the HDCP2.2 for Type0 content streams.
Thanks a lot for Usyskin, Alexander and Uma shankar for the review of v3. Thanks Daniel vetter for guiding me to test and confirm that there is no locking issue with respect to notifier usage between I915 and
MEI_HDCP.Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Major Changes in v4:
- GMBus Changes to implement the burst read as generic [Jani, Ville and Daniel]
- Polling is added for extra Notifier notification when I915 andMEI_HDCPare modules.
- Comment and style issues and typos are fixed [Uma and Alexander]
-INTEL_MEI_HDCP,INTEL_MEI_MEandINTEL_MEIare selected by I915.
- Fixed the #if ininclude/linux/mei_hdcp.hfor build issues.Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
GMBus changes are added here for completeness of the series. They are in review at https://patchwork.freedesktop.org/series/41632/ also.
Please reply with a link to your github here (and include it in your next cover letter too). I can't ever find it when I need it :-/
You can find a github repo for HDCP2.2 v4 series at
https://github.com/ramalingampc2008/drm-tip
Quoted 6 lines
Even nicer if you directly supply what I need to feed to git fetch (like a git pull request over email):
https://github.com/ramalingampc2008/drm-tip.git
hdcp2_2_v4Then I can do a git fetch && git checkout
FETCH_HEAD.
Ok. Sure.
Thanks,
Ram.
Quoted 87 lines
Thanks, Daniel
Quoted 68 lines
Thanks,
RamQuoted 64 lines
Thanks, Daniel
Quoted 46 lines
Ramalingam C (40):
drm: hdcp2.2 authentication msg definitions
drm: HDMI and DP specific HDCP2.2 defines misc/mei/hdcp: Client driver for HDCP application misc/mei/hdcp: Notifier chain for mei cldev state change misc/mei/hdcp: Define ME FW interface for HDCP2.2 linux/mei: Header formei_hdcpdriver interface misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session misc/mei/hdcp: Verify Receiver Cert and prepare km misc/mei/hdcp: VerifyH_prime
misc/mei/hdcp: Store the HDCP Pairing info misc/mei/hdcp: Initiate Locality check misc/mei/hdcp: VerifyL_prime
misc/mei/hdcp: Prepare Session Key misc/mei/hdcp: Repeater topology verification and ack misc/mei/hdcp: VerifyM_prime
misc/mei/hdcp: Enabling the HDCP authentication misc/mei/hdcp: Closing wired HDCP2.2 Tx Session drm/i915: wrapping all hdcp var intointel_hdcpdrm/i915: Define HDCP2.2 related variables drm/i915: Define Intel HDCP2.2 registers drm/i915: Wrappers for mei HDCP2.2 services drm/i915: Implement HDCP2.2 receiver authentication drm/i915: Implement HDCP2.2 repeater authentication drm/i915: Enable and Disable HDCP2.2 port encryption drm/i915: Implement HDCP2.2 En/Dis-able drm/i915: Implement HDCP2.2 link integrity check drm/i915: Handle HDCP2.2 downstream topology change drm/i915: Pullout the bksv read and validation drm/i915: Initialize HDCP2.2 and its MEI interface drm/i915: Schedulehdcp_check_linkin_intel_hdcp_enabledrm/i915: Enable superior HDCP ver that is capable drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure drm/i915:hdcp_check_linkonly onCP_IRQdrm/i915: Check HDCP 1.4 and 2.2 link onCP_IRQdrm/i915/gmbus: Increase the Bytes per Rd/Wr Op drm/i915/gmbus: Enable burst read
drm/i915: Implement the HDCP2.2 support for DP drm/i915: Implement the HDCP2.2 support for HDMI drm/i915: Add HDCP2.2 support for DP connectors drm/i915: Add HDCP2.2 support for HDMI connectorsTomas Winkler (1):
mei: bus: whitelist hdcp clientQuoted 7 lines
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/i915_reg.h | 34 ++ drivers/gpu/drm/i915/intel_display.c | 7 +- drivers/gpu/drm/i915/intel_dp.c | 370 +++++++++++- drivers/gpu/drm/i915/intel_drv.h | 88 ++- drivers/gpu/drm/i915/intel_hdcp.c | 1096++++++++++++++++++++++++++++++++--
Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c | 189 +++++- drivers/gpu/drm/i915/intel_i2c.c | 71 ++- drivers/misc/mei/Kconfig | 7 + drivers/misc/mei/Makefile | 2 + drivers/misc/mei/bus-fixup.c | 16 + drivers/misc/mei/hdcp/Makefile | 6 + drivers/misc/mei/hdcp/mei_hdcp.c | 817+++++++++++++++++++++++++
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++++++++++++ include/drm/drm_dp_helper.h | 51 ++ include/drm/drm_hdcp.h | 232 +++++++ include/linux/mei_hdcp.h | 232 +++++++ 18 files changed, 3546 insertions(+), 91 deletions(-) createmode
100644drivers/misc/mei/hdcp/Makefilecreate mode 100644drivers/misc/mei/hdcp/mei_hdcp.ccreate mode 100644drivers/misc/mei/hdcp/mei_hdcp.hcreate mode 100644include/linux/mei_hdcp.h--
2.7.4
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
--
Daniel Vetter
Software Engineer, Intel Corporation http://blog.ffwll.ch--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel