All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/43] drm/i915: Implement HDCP2.2
@ 2018-02-14 14:13 Ramalingam C
  2018-02-14 14:13 ` [PATCH 01/43] drm: hdcp2.2 authentication msg definitions Ramalingam C
                   ` (45 more replies)
  0 siblings, 46 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Based on HDCP1.4 framework introduced by Sean Paul, this series
implements the HDCP2.2 in I915.

The sequence for HDCP2.2 authentication and encryption is implemented
in I915. Encoder specific implementations are moved into hdcp2_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.

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.

Yes its bit lengthy series. Please tolerate. Thanks

Known TO-DOs:
	- Improving the commit messages.
	- Improving the documentation.
	- Not so happy about i/f between I915 and MEI_HDCP drivers :(

Ramalingam C (41):
  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: Add KBuild for mei hdcp driver
  misc/mei/hdcp: Verify mei client device status
  misc/mei/hdcp: Get & Put for mei cl_device
  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 verifcation 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: Async execution of hdcp authentication
  drm/i915: wrapping all hdcp var into intel_hdcp
  drm/i915: wait for cp_irq
  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: Enable HDCP version that is best capable
  drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure
  drm/i915: Initialize HDCP2.2 and its MEI interface
  drm/i915: Implement gmbus 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
  drm/i915: Invoke check link on CP_IRQ of DP

Tomas Winkler (2):
  mei: bus: whitelist hdcp client
  mei: me: add gemini lake devices ids

 drivers/gpu/drm/i915/i915_drv.h      |    7 +
 drivers/gpu/drm/i915/i915_reg.h      |  123 ++++
 drivers/gpu/drm/i915/intel_display.c |    8 +-
 drivers/gpu/drm/i915/intel_dp.c      |  367 ++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  116 +++-
 drivers/gpu/drm/i915/intel_hdcp.c    | 1151 +++++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_hdmi.c    |  209 +++++-
 drivers/gpu/drm/i915/intel_i2c.c     |  124 +++-
 drivers/misc/mei/Kconfig             |    6 +
 drivers/misc/mei/Makefile            |    2 +
 drivers/misc/mei/bus-fixup.c         |   16 +
 drivers/misc/mei/hw-me-regs.h        |    2 +
 drivers/misc/mei/mei_hdcp.c          |  935 +++++++++++++++++++++++++++
 drivers/misc/mei/mei_hdcp.h          |  566 +++++++++++++++++
 drivers/misc/mei/pci-me.c            |    2 +
 include/drm/drm_dp_helper.h          |   59 ++
 include/drm/drm_hdcp.h               |  271 ++++++++
 include/linux/mei_hdcp.h             |  215 +++++++
 18 files changed, 4066 insertions(+), 113 deletions(-)
 create mode 100644 drivers/misc/mei/mei_hdcp.c
 create mode 100644 drivers/misc/mei/mei_hdcp.h
 create mode 100644 include/linux/mei_hdcp.h

-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/43] drm: hdcp2.2 authentication msg definitions
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 15:15   ` Winkler, Tomas
  2018-02-14 14:13 ` [PATCH 02/43] drm: HDMI and DP specific HDCP2.2 defines Ramalingam C
                   ` (44 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

This patch defines the hdcp2.2 protocol messages for the
HDCP2.2 authentication.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 include/drm/drm_hdcp.h | 226 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 226 insertions(+)

diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index 562fa7df2637..9661c700cebb 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -38,4 +38,230 @@
 #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
+
+struct cp_srm_header {
+	struct {
+		uint8_t reserved_hi:4;
+		uint8_t srm_id:4;
+		uint8_t reserved_lo;
+	} spec_indicator;
+	uint16_t srm_version;
+	uint8_t srm_gen_no;
+} __packed;
+
+/**
+ * Protocol message definition for HDCP2.2 specification
+ */
+
+#define HDCP_STREAM_TYPE0			0x00
+#define HDCP_STREAM_TYPE1			0x01
+
+/* HDCP2.2 Msg IDs */
+#define NULL_MSG				1
+#define AKE_INIT				2
+#define AKE_SEND_CERT				3
+#define AKE_NO_STORED_KM			4
+#define AKE_STORED_KM				5
+#define AKE_SEND_HPRIME				7
+#define AKE_SEND_PARING_INFO			8
+#define LC_INIT					9
+#define LC_SEND_LPRIME				10
+#define SKE_SEND_EKS				11
+#define REP_SEND_RECVID_LIST			12
+#define REP_SEND_ACK				15
+#define REP_STREAM_MANAGE			16
+#define REP_STREAM_READY			17
+#define ERRATA_DP_STREAM_TYPE			50
+
+#define HDCP_RTX_LEN				8
+#define HDCP_RRX_LEN				8
+#define RECEIVER_ID_SIZE			5
+
+#define K_PUB_RX_MOD_N_SIZE			128
+#define K_PUB_RX_EXP_E_SIZE			3
+#define K_PUB_RX_SIZE				(K_PUB_RX_MOD_N_SIZE + \
+						 K_PUB_RX_EXP_E_SIZE)
+
+#define DCP_LLC_SIGNATURE_SIZE			384
+
+#define HDCP_E_KPUB_KM_LEN			128
+#define HDCP_E_KH_KM_M_LEN			(16 + 16)
+#define HDCP_H_PRIME_LEN			32
+#define HDCP_E_KH_KM_LEN			16
+#define HDCP_RN_LEN				8
+#define HDCP_L_PRIME_LEN			32
+#define HDCP_E_DKEY_KS_LEN			16
+#define HDCP_RIV_LEN				8
+#define HDCP_SEQ_NUM_LEN			3
+#define HDCP_LPRIME_HALF_SIZE			(HDCP_L_PRIME_LEN / 2)
+#define HDCP_RECEIVER_ID_LEN			5
+#define HDCP_MAX_DEVICE_COUNT			31
+#define HDCP_RECEIVER_IDS_MAX_LEN		(HDCP_RECEIVER_ID_LEN * \
+						 HDCP_MAX_DEVICE_COUNT)
+
+/**
+ * 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 MAX_CONTENT_STREAMS_CNT			1
+
+#define HDCP_MPRIME_LEN				32
+
+struct hdcp2_cert_rx {
+	uint8_t	receiver_id[RECEIVER_ID_SIZE];
+	uint8_t	kpub_rx[K_PUB_RX_SIZE];
+	uint8_t	reserved1			:4;
+
+	/* As per HDMI & DP HDCP Spec, must be 0x0 or 0x1 */
+	uint8_t	protocol_descriptor		:4;
+
+	/* As per HDMI & DP HDCP Spec, must be 0x0000 */
+	uint8_t	reserved2;
+	uint8_t	dcp_signature[DCP_LLC_SIGNATURE_SIZE];
+} __packed;
+
+/**
+ * The RxCaps field specified in the HDCP HDMI, DP specs
+ * This field is big endian as specified in the errata.
+ */
+union hdcp2_rx_caps {
+	struct	{
+		uint8_t version;
+		uint8_t receiver_capability_mask_hi;
+		uint8_t repeater:1;
+
+		/* Rsvd in HDMI. Applicable in DP alone */
+		uint8_t hdcp_capable:1;
+		uint8_t receiver_capability_mask_low:6;
+	} fields;
+	uint8_t rx_caps_value[3];
+} __packed;
+
+/**
+ * RxInfo fields Contains various topology information for the
+ * repeater authentication flows
+ */
+union hdcp2_rx_info {
+	struct {
+		uint8_t device_count_hi:1;
+		uint8_t depth:3;
+		uint8_t rsvd:4;
+
+		/* Bit-0: downstream HDCP 1.x device exist */
+		uint8_t hdcp1_device_downstream:1;
+
+		/* Bit-1: downstream HDCP 2.0, 2.1 device exist */
+		uint8_t hdcp2_legacy_device_downstream:1;
+
+		/* Bit-2: downstream Topology limit errors */
+		uint8_t max_cascade_exceeded:1;
+		uint8_t max_devs_exceeded:1;
+		uint8_t device_count_lo:4;
+
+	} fields;
+	uint16_t rx_info_value;
+} __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 {
+	uint8_t			version;
+
+	/* Reserved for HDCP and DP Spec. Read as Zero */
+	uint16_t		transmitter_capability_mask;
+} __packed;
+
+/*
+ * Main structures for HDCP2.2 protocol communication
+ */
+struct hdcp2_ake_init {
+	uint8_t			msg_id;
+	uint8_t			r_tx[HDCP_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_RRX_LEN];
+	union hdcp2_rx_caps	rx_caps;
+} __packed;
+
+struct hdcp2_ake_no_stored_km {
+	uint8_t			msg_id;
+	uint8_t			e_kpub_km[HDCP_E_KPUB_KM_LEN];
+} __packed;
+
+struct hdcp2_ake_stored_km {
+	uint8_t			msg_id;
+	uint8_t			e_kh_km_m[HDCP_E_KH_KM_M_LEN];
+} __packed;
+
+struct hdcp2_ake_send_hprime {
+	uint8_t			msg_id;
+	uint8_t			h_prime[HDCP_H_PRIME_LEN];
+} __packed;
+
+struct hdcp2_ake_send_pairing_info {
+	uint8_t			msg_id;
+	uint8_t			e_kh_km[HDCP_E_KH_KM_LEN];
+} __packed;
+
+struct hdcp2_lc_init {
+	uint8_t			msg_id;
+	uint8_t			r_n[HDCP_RN_LEN];
+} __packed;
+
+struct hdcp2_lc_send_lprime {
+	uint8_t			msg_id;
+	uint8_t			l_prime[HDCP_L_PRIME_LEN];
+} __packed;
+
+struct hdcp2_ske_send_eks {
+	uint8_t			msg_id;
+	uint8_t			e_dkey_ks[HDCP_E_DKEY_KS_LEN];
+	uint8_t			riv[HDCP_RIV_LEN];
+} __packed;
+
+struct hdcp2_rep_send_receiverid_list {
+	uint8_t			msg_id;
+	union hdcp2_rx_info	rx_info;
+	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];
+	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];
+	uint8_t			receiver_ids[HDCP_RECEIVER_IDS_MAX_LEN];
+} __packed;
+
+struct hdcp2_rep_send_ack {
+	uint8_t			msg_id;
+	uint8_t			v[HDCP_LPRIME_HALF_SIZE];
+} __packed;
+
+struct hdcp2_rep_stream_manage {
+	uint8_t			msg_id;
+	uint8_t			seq_num_m[HDCP_SEQ_NUM_LEN];
+	uint16_t		k;
+	struct hdcp2_streamid_type streams[MAX_CONTENT_STREAMS_CNT];
+} __packed;
+
+struct hdcp2_rep_stream_ready {
+	uint8_t			msg_id;
+	uint8_t			m_prime[HDCP_MPRIME_LEN];
+} __packed;
+
+struct hdcp2_dp_errata_stream_type {
+	uint8_t		msg_id;
+	uint8_t		stream_type;
+} __packed;
+
 #endif
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 02/43] drm: HDMI and DP specific HDCP2.2 defines
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
  2018-02-14 14:13 ` [PATCH 01/43] drm: hdcp2.2 authentication msg definitions Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 03/43] mei: bus: whitelist hdcp client Ramalingam C
                   ` (43 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

In preparation for implementing HDCP2.2 in I915, this patch adds
HDCP register definitions for HDMI and DP HDCP adaptations.

HDMI specific HDCP2.2 register definitions are added into drm_hdcp.h,
where are HDCP2.2 register offsets in DPCD offsets are defined at
drm_dp_helper.h.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 include/drm/drm_dp_helper.h | 59 +++++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_hdcp.h      | 37 ++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c239e6e24a10..28a4dfbc2613 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -857,6 +857,65 @@
 #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_PARING_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
+
+union hdcp2_dp_rx_status {
+	struct {
+		uint8_t ready:1;
+		uint8_t hprime_available:1;
+		uint8_t paring_available:1;
+		uint8_t reauth_req:1;
+		uint8_t Link_integrity_failure:1;
+		uint8_t rsvd:3;
+	} fields;
+	uint8_t val;
+} __packed;
+
 /* DP 1.2 Sideband message defines */
 /* peer device type - DP 1.2a Table 2-92 */
 #define DP_PEER_DEVICE_NONE		0x0
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index 9661c700cebb..c5f36b1a004b 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -264,4 +264,41 @@ 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 HDMI_HDCP_2_2_REG_VER_OFFSET		0x50
+#define HDMI_HDCP_2_2_REG_WR_MSG_OFFSET		0x60
+#define HDMI_HDCP_2_2_REG_RXSTATUS_OFFSET	0x70
+#define HDMI_HDCP_2_2_REG_RD_MSG_OFFSET		0x80
+#define HDMI_HDCP_2_2_REG_DBG_OFFSET		0xC0
+
+#define HDMI_HDCP_2_2_SUPPORT_MASK		(1<<2)
+#define HDCP_RXCAPS_VERSION_HDCP_2_2_VAL	0x2
+
+#define DRM_HDCP_MAX_AUX_LEN			16
+
+#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
+
+union hdcp2_hdmi_rx_status {
+	struct {
+		uint8_t msg_sz_hi:2;
+		uint8_t ready:1;
+		uint8_t reauth_req:1;
+		uint8_t reserved:4;
+		uint8_t msg_sz_lo;
+	} fields;
+	uint16_t val;
+} __packed;
+
 #endif
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 03/43] mei: bus: whitelist hdcp client
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
  2018-02-14 14:13 ` [PATCH 01/43] drm: hdcp2.2 authentication msg definitions Ramalingam C
  2018-02-14 14:13 ` [PATCH 02/43] drm: HDMI and DP specific HDCP2.2 defines Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 04/43] mei: me: add gemini lake devices ids Ramalingam C
                   ` (42 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

From: Tomas Winkler <tomas.winkler@intel.com>

Whitelist HDCP client for in kernel drm use

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/bus-fixup.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index 0208c4b027c5..3df2a69fddfb 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -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    2
 struct 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),
 };
 
 /**
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 04/43] mei: me: add gemini lake devices ids
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (2 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 03/43] mei: bus: whitelist hdcp client Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:45   ` Winkler, Tomas
  2018-02-14 14:13 ` [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application Ramalingam C
                   ` (41 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

From: Tomas Winkler <tomas.winkler@intel.com>

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/hw-me-regs.h | 2 ++
 drivers/misc/mei/pci-me.c     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
index 0ccccbaf530d..5a36ca403a24 100644
--- a/drivers/misc/mei/hw-me-regs.h
+++ b/drivers/misc/mei/hw-me-regs.h
@@ -132,6 +132,8 @@
 #define MEI_DEV_ID_KBP        0xA2BA  /* Kaby Point */
 #define MEI_DEV_ID_KBP_2      0xA2BB  /* Kaby Point 2 */
 
+#define MEI_DEV_ID_GLK        0x319A  /* Gemini Lake */
+
 /*
  * MEI HW Section
  */
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 4a0ccda4d04b..fe44ac2a9b2d 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -98,6 +98,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
 	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)},
 	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, MEI_ME_PCH8_CFG)},
 
+	{MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)},
+
 	/* required last entry */
 	{0, }
 };
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (3 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 04/43] mei: me: add gemini lake devices ids Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:54   ` Winkler, Tomas
  2018-02-14 14:13 ` [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver Ramalingam C
                   ` (40 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

ME 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 80 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/mei/mei_hdcp.h | 32 ++++++++++++++++++
 2 files changed, 112 insertions(+)
 create mode 100644 drivers/misc/mei/mei_hdcp.c
 create mode 100644 drivers/misc/mei/mei_hdcp.h

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
new file mode 100644
index 000000000000..aa211763e520
--- /dev/null
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Mei_hdcp.c: client driver for mei bus driver
+ *
+ * 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 <ramalingam.c@intel.com>
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/uuid.h>
+
+#include "mei_hdcp.h"
+
+struct mei_hdcp mei_hdcp;
+
+static int mei_hdcp_probe(struct mei_cl_device *cldev,
+			  const struct mei_cl_device_id *id)
+{
+	int ret;
+
+	mei_hdcp.cldev = cldev;
+	mei_cldev_set_drvdata(cldev, &mei_hdcp);
+
+	ret = mei_cldev_enable(cldev);
+	if (ret < 0)
+		dev_err(&cldev->dev, "mei_cldev_enable Failed. %d\n", ret);
+
+	return ret;
+}
+
+static int mei_hdcp_remove(struct mei_cl_device *cldev)
+{
+	mei_cldev_disable(cldev);
+	return 0;
+}
+
+#define WIDI_HECI_CLIENT_GUID	UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
+					0x52, 0xD1, 0xC5, 0x4B, \
+					0x62, 0x7F, 0x04)
+#define MEI_HDCP2_2_UUID	WIDI_HECI_CLIENT_GUID
+
+static struct mei_cl_device_id mei_hdcp_tbl[] = {
+	{ .uuid = MEI_HDCP2_2_UUID, .version = MEI_CL_VERSION_ANY },
+	{ }
+};
+MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
+
+static struct mei_cl_driver mei_hdcp_driver = {
+	.id_table	= mei_hdcp_tbl,
+	.name		= KBUILD_MODNAME,
+	.probe		= mei_hdcp_probe,
+	.remove		= mei_hdcp_remove,
+};
+
+module_mei_cl_driver(mei_hdcp_driver);
+
+MODULE_AUTHOR("Intel Corporation");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("HDCP");
diff --git a/drivers/misc/mei/mei_hdcp.h b/drivers/misc/mei/mei_hdcp.h
new file mode 100644
index 000000000000..c06c0d767c4f
--- /dev/null
+++ b/drivers/misc/mei/mei_hdcp.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __MEI_HDCP_H__
+#define __MEI_HDCP_H__
+
+#include <linux/mei_cl_bus.h>
+
+struct mei_hdcp {
+	struct mei_cl_device *cldev;
+};
+
+#endif /* __MEI_HDCP_H__ */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (4 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:54   ` Winkler, Tomas
  2018-02-14 14:13 ` [PATCH 07/43] misc/mei/hdcp: Verify mei client device status Ramalingam C
                   ` (39 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/Kconfig  | 6 ++++++
 drivers/misc/mei/Makefile | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig
index c49e1d2269af..90977132d1e2 100644
--- a/drivers/misc/mei/Kconfig
+++ b/drivers/misc/mei/Kconfig
@@ -43,3 +43,9 @@ config INTEL_MEI_TXE
 
 	  Supported SoCs:
 	  Intel Bay Trail
+
+config INTEL_MEI_HDCP
+	tristate "Intel HDCP2.2 services of ME Interface"
+	depends on INTEL_MEI && DRM_I915
+	help
+	  MEI Support for HDCP2.2 Services on Intel SoCs.
diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile
index cd6825afa8e1..ee19754c1aec 100644
--- a/drivers/misc/mei/Makefile
+++ b/drivers/misc/mei/Makefile
@@ -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) += mei_hdcp.o
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 07/43] misc/mei/hdcp: Verify mei client device status
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (5 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 08/43] misc/mei/hdcp: Get & Put for mei cl_device Ramalingam C
                   ` (38 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Checks whether mei client device for hdcp2.2 is enabled?

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index aa211763e520..25df7034cfb4 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -34,6 +34,18 @@
 
 struct mei_hdcp mei_hdcp;
 
+/**
+ * mei_cldev_active_and_enabled:
+ *	Return: true if me client for HDCP is initialized and connected
+ */
+static inline bool mei_cldev_active_and_enabled(struct mei_cl_device *cldev)
+{
+	if (!cldev)
+		return false;
+
+	return mei_cldev_enabled(cldev);
+}
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 08/43] misc/mei/hdcp: Get & Put for mei cl_device
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (6 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 07/43] misc/mei/hdcp: Verify mei client device status Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 09/43] misc/mei/hdcp: Define ME FW interface for HDCP2.2 Ramalingam C
                   ` (37 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Interfaces to obtain and release the cl_device reference is developed.
Using these interfaces intel hdcp driver will get the reference to the
mei client devices, so that hdcp2.2 service calls can be routed to
that client device.

During registration, call back function will be registered with
mei_hdcp driver so that when the client device is removed intel
hdcp driver can be informed.

At a time only one reference is allowed in this interfaces.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 55 ++++++++++++++++++++++++++++++++++++++++++++-
 drivers/misc/mei/mei_hdcp.h |  9 ++++++++
 include/linux/mei_hdcp.h    | 47 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/mei_hdcp.h

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 25df7034cfb4..63f77800a6f7 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -55,18 +55,71 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev,
 	mei_cldev_set_drvdata(cldev, &mei_hdcp);
 
 	ret = mei_cldev_enable(cldev);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(&cldev->dev, "mei_cldev_enable Failed. %d\n", ret);
+		goto err;
+	}
+
+	if (mei_hdcp.notify_on_cldev_change)
+		mei_hdcp.notify_on_cldev_change(mei_hdcp.client, cldev);
+
+	return 0;
+err:
+	if (mei_hdcp.notify_on_cldev_change)
+		mei_hdcp.notify_on_cldev_change(mei_hdcp.client, NULL);
 
 	return ret;
 }
 
 static int mei_hdcp_remove(struct mei_cl_device *cldev)
 {
+	struct mei_hdcp *mei_hdcp = mei_cldev_get_drvdata(cldev);
+
+	if (mei_hdcp->notify_on_cldev_change)
+		mei_hdcp->notify_on_cldev_change(mei_hdcp->client, NULL);
+
 	mei_cldev_disable(cldev);
+
 	return 0;
 }
 
+int mei_hdcp_cldev_get_reference(void *client_data,
+				 struct mei_cl_device **cldev,
+				 void (*notify_change)(void *client,
+						       struct mei_cl_device
+						       *cldev))
+{
+	if (!notify_change || !client_data)
+		return -EINVAL;
+
+	if (mei_hdcp.ref_cnt)
+		return -EBUSY;
+
+	if (!mei_cldev_active_and_enabled(mei_hdcp.cldev)) {
+		if (!notify_change)
+			return -EAGAIN;
+	} else {
+		*cldev = mei_hdcp.cldev;
+	}
+
+	mei_hdcp.ref_cnt++;
+	mei_hdcp.client = client_data;
+	mei_hdcp.notify_on_cldev_change = notify_change;
+
+	return 0;
+}
+EXPORT_SYMBOL(mei_hdcp_cldev_get_reference);
+
+void mei_hdcp_cldev_put_reference(struct mei_cl_device *cldev)
+{
+	if (cldev == mei_hdcp.cldev) {
+		mei_hdcp.ref_cnt--;
+		mei_hdcp.client = NULL;
+		mei_hdcp.notify_on_cldev_change = NULL;
+	}
+}
+EXPORT_SYMBOL(mei_hdcp_cldev_put_reference);
+
 #define WIDI_HECI_CLIENT_GUID	UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
 					0x52, 0xD1, 0xC5, 0x4B, \
 					0x62, 0x7F, 0x04)
diff --git a/drivers/misc/mei/mei_hdcp.h b/drivers/misc/mei/mei_hdcp.h
index c06c0d767c4f..7d792b5ad703 100644
--- a/drivers/misc/mei/mei_hdcp.h
+++ b/drivers/misc/mei/mei_hdcp.h
@@ -27,6 +27,15 @@
 
 struct mei_hdcp {
 	struct mei_cl_device *cldev;
+
+	/* Reference to the HDCP2.2 service consumer */
+	void *client;
+
+	/* Callback function for the consumer on cl_device state change */
+	void (*notify_on_cldev_change)(void *client,
+				      struct mei_cl_device *cldev);
+
+	int ref_cnt;
 };
 
 #endif /* __MEI_HDCP_H__ */
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
new file mode 100644
index 000000000000..774b26da0c26
--- /dev/null
+++ b/include/linux/mei_hdcp.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _LINUX_MEI_HDCP_H
+#define _LINUX_MEI_HDCP_H
+
+#ifdef CONFIG_INTEL_MEI_HDCP
+int mei_hdcp_cldev_get_reference(void *client_data,
+				 struct mei_cl_device **cldev,
+				 void (*notify_change)(void *client,
+						       struct mei_cl_device
+						       *cldev));
+void mei_hdcp_cldev_put_reference(struct mei_cl_device *cldev);
+#else
+static inline
+int mei_hdcp_cldev_get_reference(void *client_data,
+				 struct mei_cl_device **cldev,
+				 void (*notify_change)(void *client,
+						       struct mei_cl_device
+						       *cldev))
+{
+	return -ENODEV;
+}
+static inline
+void mei_hdcp_cldev_put_reference(struct mei_cl_device *cldev)
+{}
+#endif /* defined (CONFIG_INTEL_MEI_HDCP) */
+#endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 09/43] misc/mei/hdcp: Define ME FW interface for HDCP2.2
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (7 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 08/43] misc/mei/hdcp: Get & Put for mei cl_device Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 10/43] linux/mei: Header for mei_hdcp driver interface Ramalingam C
                   ` (36 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Defines 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.h | 525 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 525 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.h b/drivers/misc/mei/mei_hdcp.h
index 7d792b5ad703..2bf720e20476 100644
--- a/drivers/misc/mei/mei_hdcp.h
+++ b/drivers/misc/mei/mei_hdcp.h
@@ -24,6 +24,8 @@
 #define __MEI_HDCP_H__
 
 #include <linux/mei_cl_bus.h>
+#include <linux/mei_hdcp.h>
+#include <drm/drm_hdcp.h>
 
 struct mei_hdcp {
 	struct mei_cl_device *cldev;
@@ -38,4 +40,527 @@ struct mei_hdcp {
 	int ref_cnt;
 };
 
+/**
+ * @enum me_status: Enumeration of all HDCP Status Codes
+ */
+enum me_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)
+
+
+/**
+ * @enum 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_E_KPUB_KM_LEN];
+	uint8_t		e_kh_km_m[HDCP_E_KH_KM_M_LEN];
+	struct {
+		uint8_t e_kh_km[HDCP_KH_LEN];
+		uint8_t m[HDCP_M_LEN];
+	} __packed;
+};
+
+/**
+ * @brief HDCP HECI message header.
+ * @note All header values are little endian.
+ */
+struct hdcp_cmd_header {
+	uint32_t	api_version;
+	uint32_t	command_id;
+	enum me_status	status;
+	/* Length of the HECI message (excluding the header) */
+	uint32_t	buffer_len;
+} __packed;
+
+/* @brief Empty command request or response. No data follows the header. */
+struct hdcp_cmd_no_data {
+	struct hdcp_cmd_header header;
+} __packed;
+
+/*
+ * @brief 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 Integrated wired HDCP Tx session initiation command
+ *
+ * The command below is in support of Initiating an integrated
+ * wired HDCP Tx session.
+ *	command ID: WIRED_INITIATE_HDCP2_SESSION
+ *
+ * Corresponds to the AKE_Init from the HDCP DP, HDMI specs.
+ *
+ * return:
+ *	HDCP_STATUS_SUCCESS - Command completed correctly.
+ *	HDCP_INVALID_SESSION_STATE - This command can not be called
+ *					during an active session.
+ *	A call to WIRED_CMD_CLOSE_SESSION_IN must be made to destroy
+ *	an old HDCP Tx session.
+ */
+
+/**
+ * HECI Input 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_RTX_LEN];
+	struct hdcp2_tx_caps	tx_caps;
+} __packed;
+
+/**
+ * HECI Integrated wired HDCP Tx, close session command
+ *
+ * The command below is in support of ending an integrated
+ * wired HDCP Tx session.
+ *	command ID: WIRED_CLOSE_SESSION
+ *
+ * return:
+ *	HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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 Integrated wired HDCP Tx verify receiver certificates command
+ *
+ * The command below is in support of verifying a Rx in an
+ * integrated wired HDCP Tx session.
+ *	command ID: WIRED_VERIFY_RECEIVER_CERT
+ *
+ * Corresponds to the AKE_Send_Cert from the HDCP DP, HDMI specs.
+ * return:
+ *	HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * HECI Input struct for integrated wired HDCP Tx Rx 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_RRX_LEN];
+	union hdcp2_rx_caps		rx_caps;
+} __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 Integrated wired HDCP Tx, verify Rx's Hprime command
+ *
+ * The command below is in support of verifying an Hprime value
+ * generated by the Rx in an integrated wired HDCP Tx session.
+ *	command ID: WIRED_AKE_SEND_HPRIME
+ *
+ * Corresponds to the AKE_Send_H_prime message from the HDCP DP, HDMI specs.
+ *
+ * return:
+ *	HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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_H_PRIME_LEN];
+} __packed;
+
+struct wired_cmd_ake_send_hprime_out {
+	struct hdcp_cmd_header	header;
+	struct hdcp_port_id	port;
+} __packed;
+
+/**
+ * HECI Integrated wired HDCP Tx, send AKE pairing data command
+ *
+ * The command below is in support of sending in AKE pairing data generated
+ * by the Rx in an integrated wired HDCP Tx session.
+ *	command ID: WIRED_AKE_SEND_PAIRING_INFO
+ *
+ * Corresponds to the AKE_Send_H_prime message from the HDCP DP, HDMI specs.
+ *
+ * return:
+ *	HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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_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 Integrated wired HDCP Tx, initiate locality check
+ *
+ * The command below is in support of initiating locality check with an
+ * integrated wired HDCP Tx session.
+ *	command ID: WIRED_INIT_LOCALITY_CHECK
+ *
+ * Corresponds to the LC_Init message from the HDCP DP, HDMI specs.
+ *
+ * return: HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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_RN_LEN];
+} __packed;
+
+/**
+ * HECI Integrated wired HDCP Tx, validate locality check
+ *
+ * The command below is in support of validating an Rx's LPrime value
+ * in an integrated wired HDCP Tx session.
+ *	command ID: WIRED_VALIDATE_LOCALITY
+ *
+ * Corresponds to the LC_Send_L_prime message from the HDCP DP, HDMI specs.
+ *
+ * return: HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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_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 Integrated wired HDCP Tx, create session key command
+ *
+ * The command below is in support generating the session key
+ * in an integrated wired HDCP Tx session.
+ *	command ID: WIRED_GET_SESSION_KEY
+ *
+ * Corresponds to the SKE_Send_Eks message from the HDCP DP, HDMI specs.
+ *
+ * return: HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * HECI struct for create session key command
+ */
+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_E_DKEY_KS_LEN];
+	uint8_t		r_iv[HDCP_RIV_LEN];
+} __packed;
+
+/**
+ * HECI Integrated wired HDCP Tx, enable authentication command
+ *
+ * The command below is in support of assigning type 0, type 1
+ * values to a non-repeater downstream Tx port and marking Authentication
+ * complete
+ *	command ID: WIRED_ENABLE_AUTH
+ *
+ * return: HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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 Integrated wired HDCP Tx, verify downstream topology command
+ *
+ * The command below is in support verifying the downstream repeater's
+ * HDCP topology in an integrated wired HDCP Tx session.
+ *	command ID: WIRED_VERIFY_REPEATER
+ *
+ * Corresponds to the RepeaterAuth_Send_ReceiverId_List message
+ * from the HDCP DP, HDMI specs.
+ *
+ * return: HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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;
+	union hdcp2_rx_info		rx_info;
+	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];
+	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];
+	uint8_t			receiver_ids[HDCP_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_LPRIME_HALF_SIZE];
+} __packed;
+
+/**
+ * HECI Integrated wired HDCP Tx, stream management command
+ *
+ * The command below is in support of stream management in an
+ * integrated wired HDCP Tx session.
+ *	command ID: WIRED_REPEATER_AUTH_STREAM_REQ
+ *
+ * Corresponds to the RepeaterAuth_Stream_Ready message from
+ * the HDCP DP, HDMI specs.
+ *
+ * return: HDCP_STATUS_SUCCESS - Command completed correctly.
+ */
+
+/**
+ * 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_SEQ_NUM_LEN];
+	uint8_t			m_prime[HDCP_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__ */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 10/43] linux/mei: Header for mei_hdcp driver interface
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (8 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 09/43] misc/mei/hdcp: Define ME FW interface for HDCP2.2 Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 11/43] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Ramalingam C
                   ` (35 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Data structures and Enum for the I915-MEI_HDCP interface are defined
at <linux/mei_hdcp.h>

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 include/linux/mei_hdcp.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 774b26da0c26..9a869d1cbd5d 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -23,6 +23,77 @@
 #ifndef _LINUX_MEI_HDCP_H
 #define _LINUX_MEI_HDCP_H
 
+#include <linux/mei_cl_bus.h>
+
+/*
+ * Enumeration of the physical DDI available on the platform
+ */
+enum 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 differenceneeded 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 {
+	struct mei_cl_device *cldev;
+	enum 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;
+};
+
 #ifdef CONFIG_INTEL_MEI_HDCP
 int mei_hdcp_cldev_get_reference(void *client_data,
 				 struct mei_cl_device **cldev,
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 11/43] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (9 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 10/43] linux/mei: Header for mei_hdcp driver interface Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 12/43] misc/mei/hdcp: Verify Receiver Cert and prepare km Ramalingam C
                   ` (34 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request ME FW to start the HDCP2.2 session for a intel port.
Prepares payloads for command WIRED_INITIATE_HDCP2_SESSION and sent
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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 73 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    | 11 +++++++
 2 files changed, 84 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 63f77800a6f7..0b09f069f6d6 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/uuid.h>
+#include <drm/drm_connector.h>
 
 #include "mei_hdcp.h"
 
@@ -46,6 +47,78 @@ static inline bool mei_cldev_active_and_enabled(struct mei_cl_device *cldev)
 	return mei_cldev_enabled(cldev);
 }
 
+/**
+ * mei_initiate_hdcp2_session:
+ *	Function to start a Wired HDCP2.2 Tx Session with ME FW
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !ake_data)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->cldev->dev;
+
+	/* Fill header details */
+	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;
+
+	/* Fill in the In Data */
+	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;
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&session_init_in,
+			      sizeof(session_init_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&session_init_out,
+			      sizeof(session_init_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)session_init_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
+			WIRED_INITIATE_HDCP2_SESSION, status);
+		return -1;
+	}
+
+	ake_data->msg_id = 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 int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 9a869d1cbd5d..c333528b9c1e 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -24,6 +24,7 @@
 #define _LINUX_MEI_HDCP_H
 
 #include <linux/mei_cl_bus.h>
+#include <drm/drm_hdcp.h>
 
 /*
  * Enumeration of the physical DDI available on the platform
@@ -101,6 +102,9 @@ int mei_hdcp_cldev_get_reference(void *client_data,
 						       struct mei_cl_device
 						       *cldev));
 void mei_hdcp_cldev_put_reference(struct mei_cl_device *cldev);
+
+int mei_initiate_hdcp2_session(struct mei_hdcp_data *data,
+			       struct hdcp2_ake_init *ake_data);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -114,5 +118,12 @@ int mei_hdcp_cldev_get_reference(void *client_data,
 static inline
 void mei_hdcp_cldev_put_reference(struct mei_cl_device *cldev)
 {}
+
+static inline
+int mei_initiate_hdcp2_session(struct mei_hdcp_data *data,
+			       struct hdcp2_ake_init *ake_data)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 12/43] misc/mei/hdcp: Verify Receiver Cert and prepare km
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (10 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 11/43] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 13/43] misc/mei/hdcp: Verify H_prime Ramalingam C
                   ` (33 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Requests 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 89 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    | 15 ++++++++
 2 files changed, 104 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 0b09f069f6d6..536c27701fe8 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -119,6 +119,95 @@ int mei_initiate_hdcp2_session(struct mei_hdcp_data *data,
 }
 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
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !rx_cert || !km_stored || !ek_pub_km || !msg_sz)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->cldev->dev;
+
+	/* Fill header details */
+	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;
+
+	/* Fill the data */
+	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));
+	verify_rxcert_in.rx_caps = rx_cert->rx_caps;
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&verify_rxcert_in,
+			      sizeof(verify_rxcert_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed: %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&verify_rxcert_out,
+			      sizeof(verify_rxcert_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed: %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)verify_rxcert_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
+			WIRED_VERIFY_RECEIVER_CERT, status);
+		return -1;
+	}
+
+	*km_stored = verify_rxcert_out.km_stored;
+	if (verify_rxcert_out.km_stored) {
+		ek_pub_km->msg_id = AKE_STORED_KM;
+		*msg_sz = sizeof(struct hdcp2_ake_stored_km);
+	} else {
+		ek_pub_km->msg_id = 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 int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index c333528b9c1e..510a5c1ff1ff 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -105,6 +105,12 @@ void mei_hdcp_cldev_put_reference(struct mei_cl_device *cldev);
 
 int mei_initiate_hdcp2_session(struct mei_hdcp_data *data,
 			       struct hdcp2_ake_init *ake_data);
+int
+mei_verify_receiver_cert_prepare_km(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_hdcp_cldev_get_reference(void *client_data,
@@ -125,5 +131,14 @@ int mei_initiate_hdcp2_session(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline int
+mei_verify_receiver_cert_prepare_km(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 /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 13/43] misc/mei/hdcp: Verify H_prime
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (11 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 12/43] misc/mei/hdcp: Verify Receiver Cert and prepare km Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 14/43] misc/mei/hdcp: Store the HDCP Pairing info Ramalingam C
                   ` (32 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Requests for the verifcation of AKE_Send_H_prime.

ME will calculation the H and comparing it with received H_Prime.
Here AKE_Send_H_prime is a HDCP2.2 Authentication msg.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 65 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  8 ++++++
 2 files changed, 73 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 536c27701fe8..7977038e0642 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -208,6 +208,71 @@ mei_verify_receiver_cert_prepare_km(struct mei_hdcp_data *data,
 }
 EXPORT_SYMBOL(mei_verify_receiver_cert_prepare_km);
 
+/**
+ * mei_verify_hprime:
+ *	Function to verify AKE_Send_H_prime received
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !rx_hprime)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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));
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&send_hprime_in,
+			      sizeof(send_hprime_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&send_hprime_out,
+			      sizeof(send_hprime_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)send_hprime_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
+			WIRED_AKE_SEND_HPRIME, status);
+		return -1;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(mei_verify_hprime);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 510a5c1ff1ff..3590e3421134 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -111,6 +111,8 @@ mei_verify_receiver_cert_prepare_km(struct mei_hdcp_data *data,
 				    bool *km_stored,
 				    struct hdcp2_ake_no_stored_km *ek_pub_km,
 				    size_t *msg_sz);
+int mei_verify_hprime(struct mei_hdcp_data *data,
+		      struct hdcp2_ake_send_hprime *rx_hprime);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -140,5 +142,11 @@ mei_verify_receiver_cert_prepare_km(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline
+int mei_verify_hprime(struct mei_hdcp_data *data,
+		      struct hdcp2_ake_send_hprime *rx_hprime)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 14/43] misc/mei/hdcp: Store the HDCP Pairing info
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (12 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 13/43] misc/mei/hdcp: Verify H_prime Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 15/43] misc/mei/hdcp: Initiate Locality check Ramalingam C
                   ` (31 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Provides 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 66 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  8 ++++++
 2 files changed, 74 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 7977038e0642..d243db70a7de 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -273,6 +273,72 @@ int mei_verify_hprime(struct mei_hdcp_data *data,
 }
 EXPORT_SYMBOL(mei_verify_hprime);
 
+/**
+ * mei_store_pairing_info:
+ *	Function to store pairing info received from panel
+ *
+ * @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_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 } };
+	enum me_status status = ME_HDCP_STATUS_UNKNOWN_ERROR;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !pairing_info)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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));
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&pairing_info_in,
+			      sizeof(pairing_info_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&pairing_info_out,
+			      sizeof(pairing_info_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)pairing_info_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X failed. Status: 0x%X\n",
+			WIRED_AKE_SEND_PAIRING_INFO, status);
+		return -1;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(mei_store_pairing_info);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 3590e3421134..449ac3af4d53 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -113,6 +113,8 @@ mei_verify_receiver_cert_prepare_km(struct mei_hdcp_data *data,
 				    size_t *msg_sz);
 int mei_verify_hprime(struct mei_hdcp_data *data,
 		      struct hdcp2_ake_send_hprime *rx_hprime);
+int mei_store_pairing_info(struct mei_hdcp_data *data,
+			   struct hdcp2_ake_send_pairing_info *pairing_info);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -148,5 +150,11 @@ int mei_verify_hprime(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline
+int mei_store_pairing_info(struct mei_hdcp_data *data,
+			   struct hdcp2_ake_send_pairing_info *pairing_info)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 15/43] misc/mei/hdcp: Initiate Locality check
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (13 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 14/43] misc/mei/hdcp: Store the HDCP Pairing info Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 16/43] misc/mei/hdcp: Verify L_prime Ramalingam C
                   ` (30 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Requests 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 64 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  8 ++++++
 2 files changed, 72 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index d243db70a7de..5f0c56a1e51b 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -339,6 +339,70 @@ int mei_store_pairing_info(struct mei_hdcp_data *data,
 }
 EXPORT_SYMBOL(mei_store_pairing_info);
 
+/**
+ * mei_initiate_locality_check:
+ *	Function to prepare LC_Init.
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !lc_init_data)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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;
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&lc_init_in,
+			      sizeof(lc_init_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&lc_init_out,
+			      sizeof(lc_init_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)lc_init_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X Failed. status: 0x%X\n",
+			WIRED_INIT_LOCALITY_CHECK, status);
+		return -1;
+	}
+
+	lc_init_data->msg_id = LC_INIT;
+	memcpy(lc_init_data->r_n, lc_init_out.r_n, HDCP_RN_LEN);
+	return 0;
+}
+EXPORT_SYMBOL(mei_initiate_locality_check);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 449ac3af4d53..fd8a26dddacb 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -115,6 +115,8 @@ int mei_verify_hprime(struct mei_hdcp_data *data,
 		      struct hdcp2_ake_send_hprime *rx_hprime);
 int mei_store_pairing_info(struct mei_hdcp_data *data,
 			   struct hdcp2_ake_send_pairing_info *pairing_info);
+int mei_initiate_locality_check(struct mei_hdcp_data *data,
+				struct hdcp2_lc_init *lc_init_data);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -156,5 +158,11 @@ int mei_store_pairing_info(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline
+int mei_initiate_locality_check(struct mei_hdcp_data *data,
+				struct hdcp2_lc_init *lc_init_data)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 16/43] misc/mei/hdcp: Verify L_prime
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (14 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 15/43] misc/mei/hdcp: Initiate Locality check Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 17/43] misc/mei/hdcp: Prepare Session Key Ramalingam C
                   ` (29 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 65 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  8 ++++++
 2 files changed, 73 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 5f0c56a1e51b..828dcce56b49 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -403,6 +403,71 @@ int mei_initiate_locality_check(struct mei_hdcp_data *data,
 }
 EXPORT_SYMBOL(mei_initiate_locality_check);
 
+/**
+ * mei_verify_lprime:
+ *	Function to verify lprime.
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !rx_lprime)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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));
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&verify_lprime_in,
+			      sizeof(verify_lprime_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&verify_lprime_out,
+			      sizeof(verify_lprime_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)verify_lprime_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+			WIRED_VALIDATE_LOCALITY, status);
+		return -1;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(mei_verify_lprime);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index fd8a26dddacb..d8c2b440cd81 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -117,6 +117,8 @@ int mei_store_pairing_info(struct mei_hdcp_data *data,
 			   struct hdcp2_ake_send_pairing_info *pairing_info);
 int mei_initiate_locality_check(struct mei_hdcp_data *data,
 				struct hdcp2_lc_init *lc_init_data);
+int mei_verify_lprime(struct mei_hdcp_data *data,
+		      struct hdcp2_lc_send_lprime *rx_lprime);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -164,5 +166,11 @@ int mei_initiate_locality_check(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline
+int mei_verify_lprime(struct mei_hdcp_data *data,
+		      struct hdcp2_lc_send_lprime *rx_lprime)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 17/43] misc/mei/hdcp: Prepare Session Key
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (15 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 16/43] misc/mei/hdcp: Verify L_prime Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 18/43] misc/mei/hdcp: Repeater topology verifcation and ack Ramalingam C
                   ` (28 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request to ME to prepare the encrypted session key.

On Success, ME provides Encrypted session key. Functions populates
the HDCP2.2 authentication msg SKE_Send_Eks.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 68 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  8 ++++++
 2 files changed, 76 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 828dcce56b49..d4d009ebaf98 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -468,6 +468,74 @@ int mei_verify_lprime(struct mei_hdcp_data *data,
 }
 EXPORT_SYMBOL(mei_verify_lprime);
 
+/**
+ * mei_get_session_key:
+ *	Function to prepare SKE_Send_Eks.
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data || !ske_data)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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;
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&get_skey_in,
+			      sizeof(get_skey_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&get_skey_out,
+			      sizeof(get_skey_out));
+
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)get_skey_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+			WIRED_GET_SESSION_KEY, status);
+		return -1;
+	}
+
+	ske_data->msg_id = SKE_SEND_EKS;
+	memcpy(ske_data->e_dkey_ks, get_skey_out.e_dkey_ks,
+	       sizeof(get_skey_out.e_dkey_ks));
+	memcpy(ske_data->riv, get_skey_out.r_iv,
+	       sizeof(get_skey_out.r_iv));
+	return 0;
+}
+EXPORT_SYMBOL(mei_get_session_key);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index d8c2b440cd81..193f23ba8fbc 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -119,6 +119,8 @@ int mei_initiate_locality_check(struct mei_hdcp_data *data,
 				struct hdcp2_lc_init *lc_init_data);
 int mei_verify_lprime(struct mei_hdcp_data *data,
 		      struct hdcp2_lc_send_lprime *rx_lprime);
+int mei_get_session_key(struct mei_hdcp_data *data,
+			struct hdcp2_ske_send_eks *ske_data);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -172,5 +174,11 @@ int mei_verify_lprime(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline
+int mei_get_session_key(struct mei_hdcp_data *data,
+			struct hdcp2_ske_send_eks *ske_data)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 18/43] misc/mei/hdcp: Repeater topology verifcation and ack
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (16 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 17/43] misc/mei/hdcp: Prepare Session Key Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 19/43] misc/mei/hdcp: Verify M_prime Ramalingam C
                   ` (27 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request ot ME to verify the downatream 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 90 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    | 13 +++++++
 2 files changed, 103 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index d4d009ebaf98..c91a96bc45e9 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -536,6 +536,96 @@ int mei_get_session_key(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.
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!rep_topology || !rep_send_ack || !data)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->cldev->dev;
+
+	/* Topology check */
+	if (rep_topology->rx_info.fields.max_cascade_exceeded ||
+	    rep_topology->rx_info.fields.max_devs_exceeded) {
+		dev_err(dev, "Topology MAX Exceeded\n");
+		return -1;
+	}
+
+	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;
+
+	verify_repeater_in.rx_info = rep_topology->rx_info;
+	memcpy(verify_repeater_in.seq_num_v, rep_topology->seq_num_v,
+	       sizeof(rep_topology->seq_num_v));
+	memcpy(verify_repeater_in.v_prime, rep_topology->v_prime,
+	       sizeof(rep_topology->v_prime));
+	memcpy(verify_repeater_in.receiver_ids, rep_topology->receiver_ids,
+	       sizeof(rep_topology->receiver_ids));
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&verify_repeater_in,
+			      sizeof(verify_repeater_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&verify_repeater_out,
+			      sizeof(verify_repeater_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)verify_repeater_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+			WIRED_VERIFY_REPEATER, status);
+		return -1;
+	}
+
+	/*
+	 * Need to send the last byte of the V prime back to
+	 * the Repeater
+	 */
+	memcpy(rep_send_ack->v, verify_repeater_out.v,
+	       sizeof(verify_repeater_out.v));
+	rep_send_ack->msg_id = REP_SEND_ACK;
+	return 0;
+}
+EXPORT_SYMBOL(mei_repeater_check_flow_prepare_ack);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 193f23ba8fbc..c8f6fc90f475 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -121,6 +121,11 @@ int mei_verify_lprime(struct mei_hdcp_data *data,
 		      struct hdcp2_lc_send_lprime *rx_lprime);
 int mei_get_session_key(struct mei_hdcp_data *data,
 			struct hdcp2_ske_send_eks *ske_data);
+int
+mei_repeater_check_flow_prepare_ack(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_hdcp_cldev_get_reference(void *client_data,
@@ -180,5 +185,13 @@ int mei_get_session_key(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline int
+mei_repeater_check_flow_prepare_ack(struct mei_hdcp_data *data,
+				    struct hdcp2_rep_send_receiverid_list
+							*rep_topology,
+				    struct hdcp2_rep_send_ack *rep_send_ack)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 19/43] misc/mei/hdcp: Verify M_prime
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (17 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 18/43] misc/mei/hdcp: Repeater topology verifcation and ack Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 20/43] misc/mei/hdcp: Enabling the HDCP authentication Ramalingam C
                   ` (26 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 86 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  8 +++++
 2 files changed, 94 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index c91a96bc45e9..d950361206e2 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -626,6 +626,92 @@ mei_repeater_check_flow_prepare_ack(struct mei_hdcp_data *data,
 }
 EXPORT_SYMBOL(mei_repeater_check_flow_prepare_ack);
 
+static inline void reverse_endianness(u8 *dest, size_t dst_sz, u8 *src)
+{
+	u32 index;
+
+	if (dest != NULL && dst_sz != 0) {
+		for (index = 0; index < dst_sz && index < sizeof(u32);
+		     index++) {
+			dest[dst_sz - index - 1] = src[index];
+		}
+	}
+}
+
+/**
+ * mei_verify_mprime:
+ *	Function to verify mprime.
+ *
+ * @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_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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!stream_ready || !data)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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;
+
+	verify_mprime_in.k = data->k;
+	memcpy(verify_mprime_in.m_prime, stream_ready->m_prime,
+	       sizeof(stream_ready->m_prime));
+	reverse_endianness((u8 *)&verify_mprime_in.seq_num_m, HDCP_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);
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&verify_mprime_in,
+			      sizeof(verify_mprime_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&verify_mprime_out,
+			      sizeof(verify_mprime_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)verify_mprime_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+			WIRED_REPEATER_AUTH_STREAM_REQ, status);
+		return -1;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(mei_verify_mprime);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index c8f6fc90f475..560fc62b2b41 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -126,6 +126,8 @@ mei_repeater_check_flow_prepare_ack(struct mei_hdcp_data *data,
 				    struct hdcp2_rep_send_receiverid_list
 							*rep_topology,
 				    struct hdcp2_rep_send_ack *rep_send_ack);
+int mei_verify_mprime(struct mei_hdcp_data *data,
+		      struct hdcp2_rep_stream_ready *stream_ready);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -193,5 +195,11 @@ mei_repeater_check_flow_prepare_ack(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline
+int mei_verify_mprime(struct mei_hdcp_data *data,
+		      struct hdcp2_rep_stream_ready *stream_ready)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 20/43] misc/mei/hdcp: Enabling the HDCP authentication
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (18 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 19/43] misc/mei/hdcp: Verify M_prime Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 21/43] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Ramalingam C
                   ` (25 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request to ME to configure a port as authenticated.

On Success, ME FW will mark th eport as authenticated and provides
HDCP chiper of the port with the encryption keys.

Enabling the Authentication can be requested once the all
stages of HDCP2.2 authentication is completed by interating with
ME FW.

Only after this stage, driver can enable the HDCP encryption for
the port, through HW registers.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 61 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  5 ++++
 2 files changed, 66 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index d950361206e2..030c1604eb57 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -712,6 +712,67 @@ int mei_verify_mprime(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.
+ *
+ * @data		: Intel HW specific Data
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+int mei_enable_hdcp_authentication(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 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data)
+		return -EINVAL;
+
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->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;
+
+	/* Fill in the In Data */
+	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;
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&enable_auth_in,
+			      sizeof(enable_auth_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&enable_auth_out,
+			      sizeof(enable_auth_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)enable_auth_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+			WIRED_ENABLE_AUTH, status);
+		return -1;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(mei_enable_hdcp_authentication);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index 560fc62b2b41..cb8bf3b0f022 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -128,6 +128,7 @@ mei_repeater_check_flow_prepare_ack(struct mei_hdcp_data *data,
 				    struct hdcp2_rep_send_ack *rep_send_ack);
 int mei_verify_mprime(struct mei_hdcp_data *data,
 		      struct hdcp2_rep_stream_ready *stream_ready);
+int mei_enable_hdcp_authentication(struct mei_hdcp_data *data);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -201,5 +202,9 @@ int mei_verify_mprime(struct mei_hdcp_data *data,
 {
 	return -ENODEV;
 }
+static inline int mei_enable_hdcp_authentication(struct mei_hdcp_data *data)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 21/43] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (19 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 20/43] misc/mei/hdcp: Enabling the HDCP authentication Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 22/43] drm/i915: Async execution of hdcp authentication Ramalingam C
                   ` (24 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Request 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/misc/mei/mei_hdcp.c | 63 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mei_hdcp.h    |  5 ++++
 2 files changed, 68 insertions(+)

diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c
index 030c1604eb57..b4012bd259b8 100644
--- a/drivers/misc/mei/mei_hdcp.c
+++ b/drivers/misc/mei/mei_hdcp.c
@@ -773,6 +773,69 @@ int mei_enable_hdcp_authentication(struct mei_hdcp_data *data)
 }
 EXPORT_SYMBOL(mei_enable_hdcp_authentication);
 
+/**
+ * me_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_hdcp_data *data)
+{
+	struct wired_cmd_close_session_in session_close_in = { { 0 } };
+	struct wired_cmd_close_session_out session_close_out = { { 0 } };
+	enum me_status status;
+	struct device *dev;
+	ssize_t byte;
+
+	if (!data)
+		return -EINVAL;
+
+	/* check for the mei_device enabled or not */
+	if (!mei_cldev_active_and_enabled(data->cldev))
+		return -ENODEV;
+
+	dev = &data->cldev->dev;
+
+	/* Fill header details */
+	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;
+
+	/* Fill in the In Data */
+	session_close_in.port.integrated_port_type = data->port_type;
+	session_close_in.port.physical_port = data->port;
+
+
+	/* Request to ME */
+	byte = mei_cldev_send(data->cldev, (u8 *)&session_close_in,
+			      sizeof(session_close_in));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_send failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	/* Response from ME */
+	byte = mei_cldev_recv(data->cldev, (u8 *)&session_close_out,
+			      sizeof(session_close_out));
+	if (byte < 0) {
+		dev_err(dev, "mei_cldev_recv failed. %d\n", (int)byte);
+		return byte;
+	}
+
+	status = (enum me_status)session_close_out.header.status;
+	if (status != ME_HDCP_STATUS_SUCCESS) {
+		dev_err(dev, "Session Close Failed. status: 0x%X\n", status);
+		return -1;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(mei_close_hdcp_session);
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
 			  const struct mei_cl_device_id *id)
 {
diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h
index cb8bf3b0f022..031251a1424a 100644
--- a/include/linux/mei_hdcp.h
+++ b/include/linux/mei_hdcp.h
@@ -129,6 +129,7 @@ mei_repeater_check_flow_prepare_ack(struct mei_hdcp_data *data,
 int mei_verify_mprime(struct mei_hdcp_data *data,
 		      struct hdcp2_rep_stream_ready *stream_ready);
 int mei_enable_hdcp_authentication(struct mei_hdcp_data *data);
+int mei_close_hdcp_session(struct mei_hdcp_data *data);
 #else
 static inline
 int mei_hdcp_cldev_get_reference(void *client_data,
@@ -206,5 +207,9 @@ static inline int mei_enable_hdcp_authentication(struct mei_hdcp_data *data)
 {
 	return -ENODEV;
 }
+static inline int mei_close_hdcp_session(struct mei_hdcp_data *data)
+{
+	return -ENODEV;
+}
 #endif /* defined (CONFIG_INTEL_MEI_HDCP) */
 #endif /* defined (_LINUX_MEI_HDCP_H) */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 22/43] drm/i915: Async execution of hdcp authentication
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (20 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 21/43] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-22 14:39   ` Sean Paul
  2018-02-14 14:13 ` [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp Ramalingam C
                   ` (23 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Each HDCP authentication, could take upto 5.1Sec, based on the
downstream HDCP topology.

Hence to avoid this much delay in the atomic_commit path, this patch
schedules the HDCP authentication into a asynchronous work.

This keeps the UI active, by enabling the flips in parallel to
HDCP auth.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |  1 +
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_hdcp.c    | 36 ++++++++++++++++++++++--------------
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 30e38cbeface..048d60b5143b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15317,6 +15317,7 @@ static void intel_hpd_poll_fini(struct drm_device *dev)
 		if (connector->hdcp_shim) {
 			cancel_delayed_work_sync(&connector->hdcp_check_work);
 			cancel_work_sync(&connector->hdcp_prop_work);
+			cancel_work_sync(&connector->hdcp_enable_work);
 		}
 	}
 	drm_connector_list_iter_end(&conn_iter);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 898064e8bea7..7b9e5f70826f 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -412,6 +412,7 @@ struct intel_connector {
 	uint64_t hdcp_value; /* protected by hdcp_mutex */
 	struct delayed_work hdcp_check_work;
 	struct work_struct hdcp_prop_work;
+	struct work_struct hdcp_enable_work;
 };
 
 struct intel_digital_connector_state {
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 14ca5d3057a7..e03bd376d92c 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -600,8 +600,14 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 	for (i = 0; i < tries; i++) {
 		ret = intel_hdcp_auth(conn_to_dig_port(connector),
 				      connector->hdcp_shim);
-		if (!ret)
+		if (!ret) {
+			connector->hdcp_value =
+					DRM_MODE_CONTENT_PROTECTION_ENABLED;
+			schedule_work(&connector->hdcp_prop_work);
+			schedule_delayed_work(&connector->hdcp_check_work,
+					      DRM_HDCP_CHECK_PERIOD_MS);
 			return 0;
+		}
 
 		DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret);
 
@@ -613,6 +619,17 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 	return ret;
 }
 
+static void intel_hdcp_enable_work(struct work_struct *work)
+{
+	struct intel_connector *connector = container_of(work,
+							 struct intel_connector,
+							 hdcp_enable_work);
+
+	mutex_lock(&connector->hdcp_mutex);
+	_intel_hdcp_enable(connector);
+	mutex_unlock(&connector->hdcp_mutex);
+}
+
 static void intel_hdcp_check_work(struct work_struct *work)
 {
 	struct intel_connector *connector = container_of(to_delayed_work(work),
@@ -669,29 +686,20 @@ int intel_hdcp_init(struct intel_connector *connector,
 	mutex_init(&connector->hdcp_mutex);
 	INIT_DELAYED_WORK(&connector->hdcp_check_work, intel_hdcp_check_work);
 	INIT_WORK(&connector->hdcp_prop_work, intel_hdcp_prop_work);
+	INIT_WORK(&connector->hdcp_enable_work, intel_hdcp_enable_work);
 	return 0;
 }
 
 int intel_hdcp_enable(struct intel_connector *connector)
 {
-	int ret;
-
 	if (!connector->hdcp_shim)
 		return -ENOENT;
 
 	mutex_lock(&connector->hdcp_mutex);
-
-	ret = _intel_hdcp_enable(connector);
-	if (ret)
-		goto out;
-
-	connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
-	schedule_work(&connector->hdcp_prop_work);
-	schedule_delayed_work(&connector->hdcp_check_work,
-			      DRM_HDCP_CHECK_PERIOD_MS);
-out:
+	schedule_work(&connector->hdcp_enable_work);
 	mutex_unlock(&connector->hdcp_mutex);
-	return ret;
+
+	return 0;
 }
 
 int intel_hdcp_disable(struct intel_connector *connector)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (21 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 22/43] drm/i915: Async execution of hdcp authentication Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-22 14:47   ` Sean Paul
  2018-02-14 14:13 ` [PATCH 24/43] drm/i915: wait for cp_irq Ramalingam C
                   ` (22 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Considering the upcoming significant no HDCP2.2 variables, it will
be clean to have separate struct fo HDCP.

New structure called intel_hdcp is introduced.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |   9 ++-
 drivers/gpu/drm/i915/intel_dp.c      |   4 +-
 drivers/gpu/drm/i915/intel_drv.h     |  20 +++--
 drivers/gpu/drm/i915/intel_hdcp.c    | 141 ++++++++++++++++++++---------------
 4 files changed, 100 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 048d60b5143b..22097349529b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15314,10 +15314,11 @@ 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);
-			cancel_work_sync(&connector->hdcp_enable_work);
+		if (connector->hdcp && connector->hdcp->hdcp_shim) {
+			cancel_delayed_work_sync(
+					&connector->hdcp->hdcp_check_work);
+			cancel_work_sync(&connector->hdcp->hdcp_prop_work);
+			cancel_work_sync(&connector->hdcp->hdcp_enable_work);
 		}
 	}
 	drm_connector_list_iter_end(&conn_iter);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f20b25f98e5a..80476689754f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5445,7 +5445,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 		WARN(iret, "Acquiring modeset locks failed with %i\n", iret);
 
 		/* Short pulse can signify loss of hdcp authentication */
-		intel_hdcp_check_link(intel_dp->attached_connector);
+		if (intel_dp->attached_connector->hdcp)
+			intel_hdcp_check_link(
+					intel_dp->attached_connector->hdcp);
 
 		if (!handled) {
 			intel_dp->detect_done = false;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 7b9e5f70826f..5b170ff7ec14 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -375,6 +375,17 @@ struct intel_hdcp_shim {
 			    bool *hdcp_capable);
 };
 
+struct intel_hdcp {
+	struct intel_connector *connector;
+
+	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 work_struct hdcp_enable_work;
+};
+
 struct intel_connector {
 	struct drm_connector base;
 	/*
@@ -407,12 +418,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 work_struct hdcp_enable_work;
+	struct intel_hdcp *hdcp;
 };
 
 struct intel_digital_connector_state {
@@ -1853,7 +1859,7 @@ int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 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);
+int intel_hdcp_check_link(struct intel_hdcp *hdcp);
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
 
 /* intel_psr.c */
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index e03bd376d92c..9147fb17a9fc 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -545,8 +545,9 @@ struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector)
 	return enc_to_dig_port(&intel_attached_encoder(&connector->base)->base);
 }
 
-static int _intel_hdcp_disable(struct intel_connector *connector)
+static int _intel_hdcp_disable(struct intel_hdcp *hdcp)
 {
+	struct intel_connector *connector = hdcp->connector;
 	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
 	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
 	enum port port = intel_dig_port->base.port;
@@ -562,7 +563,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
 		return -ETIMEDOUT;
 	}
 
-	ret = connector->hdcp_shim->toggle_signalling(intel_dig_port, false);
+	ret = hdcp->hdcp_shim->toggle_signalling(intel_dig_port, false);
 	if (ret) {
 		DRM_ERROR("Failed to disable HDCP signalling\n");
 		return ret;
@@ -572,8 +573,9 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
 	return 0;
 }
 
-static int _intel_hdcp_enable(struct intel_connector *connector)
+static int _intel_hdcp_enable(struct intel_hdcp *hdcp)
 {
+	struct intel_connector *connector = hdcp->connector;
 	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
 	int i, ret, tries = 3;
 
@@ -599,12 +601,12 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 	/* Incase of authentication failures, HDCP spec expects reauth. */
 	for (i = 0; i < tries; i++) {
 		ret = intel_hdcp_auth(conn_to_dig_port(connector),
-				      connector->hdcp_shim);
+				      hdcp->hdcp_shim);
 		if (!ret) {
-			connector->hdcp_value =
+			hdcp->hdcp_value =
 					DRM_MODE_CONTENT_PROTECTION_ENABLED;
-			schedule_work(&connector->hdcp_prop_work);
-			schedule_delayed_work(&connector->hdcp_check_work,
+			schedule_work(&hdcp->hdcp_prop_work);
+			schedule_delayed_work(&hdcp->hdcp_check_work,
 					      DRM_HDCP_CHECK_PERIOD_MS);
 			return 0;
 		}
@@ -612,7 +614,7 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 		DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret);
 
 		/* Ensuring HDCP encryption and signalling are stopped. */
-		_intel_hdcp_disable(connector);
+		_intel_hdcp_disable(hdcp);
 	}
 
 	DRM_ERROR("HDCP authentication failed (%d tries/%d)\n", tries, ret);
@@ -621,47 +623,45 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 
 static void intel_hdcp_enable_work(struct work_struct *work)
 {
-	struct intel_connector *connector = container_of(work,
-							 struct intel_connector,
-							 hdcp_enable_work);
+	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
+					       hdcp_enable_work);
 
-	mutex_lock(&connector->hdcp_mutex);
-	_intel_hdcp_enable(connector);
-	mutex_unlock(&connector->hdcp_mutex);
+	mutex_lock(&hdcp->hdcp_mutex);
+	_intel_hdcp_enable(hdcp);
+	mutex_unlock(&hdcp->hdcp_mutex);
 }
 
 static void intel_hdcp_check_work(struct work_struct *work)
 {
-	struct intel_connector *connector = container_of(to_delayed_work(work),
-							 struct intel_connector,
-							 hdcp_check_work);
-	if (!intel_hdcp_check_link(connector))
-		schedule_delayed_work(&connector->hdcp_check_work,
+	struct intel_hdcp *hdcp = container_of(to_delayed_work(work),
+					       struct intel_hdcp,
+					       hdcp_check_work);
+	if (!intel_hdcp_check_link(hdcp))
+		schedule_delayed_work(&hdcp->hdcp_check_work,
 				      DRM_HDCP_CHECK_PERIOD_MS);
 }
 
 static void intel_hdcp_prop_work(struct work_struct *work)
 {
-	struct intel_connector *connector = container_of(work,
-							 struct intel_connector,
-							 hdcp_prop_work);
-	struct drm_device *dev = connector->base.dev;
+	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
+					       hdcp_prop_work);
+	struct drm_device *dev = hdcp->connector->base.dev;
 	struct drm_connector_state *state;
 
 	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
-	mutex_lock(&connector->hdcp_mutex);
+	mutex_lock(&hdcp->hdcp_mutex);
 
 	/*
 	 * This worker is only used to flip between ENABLED/DESIRED. Either of
 	 * those to UNDESIRED is handled by core. If hdcp_value == UNDESIRED,
 	 * we're running just after hdcp has been disabled, so just exit
 	 */
-	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
-		state = connector->base.state;
-		state->content_protection = connector->hdcp_value;
+	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
+		state = hdcp->connector->base.state;
+		state->content_protection = hdcp->hdcp_value;
 	}
 
-	mutex_unlock(&connector->hdcp_mutex);
+	mutex_unlock(&hdcp->hdcp_mutex);
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 }
 
@@ -676,48 +676,64 @@ int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim)
 {
 	int ret;
+	struct intel_hdcp *hdcp;
+
+	hdcp = kzalloc(sizeof(struct intel_hdcp), GFP_KERNEL);
+	if (!hdcp) {
+		ret = -ENOMEM;
+		goto err;
+	}
 
 	ret = drm_connector_attach_content_protection_property(
 			&connector->base);
 	if (ret)
-		return ret;
+		goto err;
+
+	hdcp->hdcp_shim = hdcp_shim;
+	mutex_init(&hdcp->hdcp_mutex);
+	INIT_DELAYED_WORK(&hdcp->hdcp_check_work, intel_hdcp_check_work);
+	INIT_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
+	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
 
-	connector->hdcp_shim = hdcp_shim;
-	mutex_init(&connector->hdcp_mutex);
-	INIT_DELAYED_WORK(&connector->hdcp_check_work, intel_hdcp_check_work);
-	INIT_WORK(&connector->hdcp_prop_work, intel_hdcp_prop_work);
-	INIT_WORK(&connector->hdcp_enable_work, intel_hdcp_enable_work);
+	connector->hdcp = hdcp;
 	return 0;
+
+err:
+	kfree(hdcp);
+	return ret;
 }
 
 int intel_hdcp_enable(struct intel_connector *connector)
 {
-	if (!connector->hdcp_shim)
+	struct intel_hdcp *hdcp = connector->hdcp;
+
+	if (!hdcp || !hdcp->hdcp_shim)
 		return -ENOENT;
 
-	mutex_lock(&connector->hdcp_mutex);
-	schedule_work(&connector->hdcp_enable_work);
-	mutex_unlock(&connector->hdcp_mutex);
+	mutex_lock(&hdcp->hdcp_mutex);
+	schedule_work(&hdcp->hdcp_enable_work);
+	mutex_unlock(&hdcp->hdcp_mutex);
 
 	return 0;
 }
 
 int intel_hdcp_disable(struct intel_connector *connector)
 {
+	struct intel_hdcp *hdcp = connector->hdcp;
 	int ret = 0;
 
-	if (!connector->hdcp_shim)
+	if (!hdcp || !hdcp->hdcp_shim)
 		return -ENOENT;
 
-	mutex_lock(&connector->hdcp_mutex);
+	mutex_lock(&hdcp->hdcp_mutex);
 
-	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
-		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
-		ret = _intel_hdcp_disable(connector);
+	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
+		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
+		ret = _intel_hdcp_disable(hdcp);
 	}
 
-	mutex_unlock(&connector->hdcp_mutex);
-	cancel_delayed_work_sync(&connector->hdcp_check_work);
+	mutex_unlock(&hdcp->hdcp_mutex);
+	cancel_delayed_work_sync(&hdcp->hdcp_check_work);
 	return ret;
 }
 
@@ -755,19 +771,20 @@ 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)
+int intel_hdcp_check_link(struct intel_hdcp *hdcp)
 {
+	struct intel_connector *connector = hdcp->connector;
 	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
 	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
 	enum port port = intel_dig_port->base.port;
 	int ret = 0;
 
-	if (!connector->hdcp_shim)
+	if (!hdcp->hdcp_shim)
 		return -ENOENT;
 
-	mutex_lock(&connector->hdcp_mutex);
+	mutex_lock(&hdcp->hdcp_mutex);
 
-	if (connector->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+	if (hdcp->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
 		goto out;
 
 	if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) {
@@ -775,17 +792,17 @@ int intel_hdcp_check_link(struct intel_connector *connector)
 			  connector->base.name, connector->base.base.id,
 			  I915_READ(PORT_HDCP_STATUS(port)));
 		ret = -ENXIO;
-		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
-		schedule_work(&connector->hdcp_prop_work);
+		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+		schedule_work(&hdcp->hdcp_prop_work);
 		goto out;
 	}
 
-	if (connector->hdcp_shim->check_link(intel_dig_port)) {
-		if (connector->hdcp_value !=
+	if (hdcp->hdcp_shim->check_link(intel_dig_port)) {
+		if (hdcp->hdcp_value !=
 		    DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
-			connector->hdcp_value =
+			hdcp->hdcp_value =
 				DRM_MODE_CONTENT_PROTECTION_ENABLED;
-			schedule_work(&connector->hdcp_prop_work);
+			schedule_work(&hdcp->hdcp_prop_work);
 		}
 		goto out;
 	}
@@ -793,23 +810,23 @@ int intel_hdcp_check_link(struct intel_connector *connector)
 	DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n",
 		      connector->base.name, connector->base.base.id);
 
-	ret = _intel_hdcp_disable(connector);
+	ret = _intel_hdcp_disable(hdcp);
 	if (ret) {
 		DRM_ERROR("Failed to disable hdcp (%d)\n", ret);
-		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
-		schedule_work(&connector->hdcp_prop_work);
+		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+		schedule_work(&hdcp->hdcp_prop_work);
 		goto out;
 	}
 
-	ret = _intel_hdcp_enable(connector);
+	ret = _intel_hdcp_enable(hdcp);
 	if (ret) {
 		DRM_ERROR("Failed to enable hdcp (%d)\n", ret);
-		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
-		schedule_work(&connector->hdcp_prop_work);
+		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+		schedule_work(&hdcp->hdcp_prop_work);
 		goto out;
 	}
 
 out:
-	mutex_unlock(&connector->hdcp_mutex);
+	mutex_unlock(&hdcp->hdcp_mutex);
 	return ret;
 }
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 24/43] drm/i915: wait for cp_irq
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (22 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-22 15:46   ` Sean Paul
  2018-02-14 14:13 ` [PATCH 25/43] drm/i915: Define HDCP2.2 related variables Ramalingam C
                   ` (21 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

DP HDCP asserts the CP_IRQ to indicate the msg availability and
auth state change at the panel.

Implements a completion structure to communicate the cp_irq
assertion and provides a function to wait for cp_irq with a timeout.

This can be used for implementation of both HDCP1.4 and HDCP2.2

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c   | 28 ++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++
 drivers/gpu/drm/i915/intel_hdcp.c |  1 +
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 80476689754f..8847f1a36504 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4402,6 +4402,7 @@ static bool
 intel_dp_short_pulse(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
+	struct intel_connector *connector = intel_dp->attached_connector;
 	u8 sink_irq_vector = 0;
 	u8 old_sink_count = intel_dp->sink_count;
 	bool ret;
@@ -4436,8 +4437,13 @@ 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) {
+			if (connector->hdcp)
+				complete(&connector->hdcp->cp_irq_recved);
+		}
+
+		if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
+			DRM_DEBUG_DRIVER("Sink specific irq unhandled\n");
 	}
 
 	intel_dp_check_link_status(intel_dp);
@@ -5049,6 +5055,24 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
 	pps_unlock(intel_dp);
 }
 
+static int wait_for_cp_irq(struct completion *cp_irq_recved, int timeout)
+{
+	long ret;
+
+	if (completion_done(cp_irq_recved))
+		reinit_completion(cp_irq_recved);
+
+	ret = wait_for_completion_interruptible_timeout(cp_irq_recved,
+							msecs_to_jiffies(
+							timeout));
+	reinit_completion(cp_irq_recved);
+	if (ret < 0)
+		return (int)ret;
+	else if (!ret)
+		return -ETIMEDOUT;
+	return 0;
+}
+
 static
 int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port,
 				u8 *an)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5b170ff7ec14..1c0d324c1044 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -384,6 +384,9 @@ struct intel_hdcp {
 	struct delayed_work hdcp_check_work;
 	struct work_struct hdcp_prop_work;
 	struct work_struct hdcp_enable_work;
+
+	/* To indicate the assertion of CP_IRQ */
+	struct completion cp_irq_recved;
 };
 
 struct intel_connector {
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 9147fb17a9fc..31e1af5b43ec 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -695,6 +695,7 @@ int intel_hdcp_init(struct intel_connector *connector,
 	INIT_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
 	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
 
+	init_completion(&hdcp->cp_irq_recved);
 	connector->hdcp = hdcp;
 	return 0;
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 25/43] drm/i915: Define HDCP2.2 related variables
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (23 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 24/43] drm/i915: wait for cp_irq Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:36   ` Chris Wilson
  2018-02-22 14:59   ` Sean Paul
  2018-02-14 14:13 ` [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers Ramalingam C
                   ` (20 subsequent siblings)
  45 siblings, 2 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

For upcoming implementation of HDCP2.2 in I915, all variable required
for HDCP2.2 are defined.

This includes a translation layer called hdcp2_shim for encoder
specific HDCP2.2 spec deviations.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  |  5 +++
 drivers/gpu/drm/i915/intel_drv.h | 91 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3f8d824dc313..09d31db90a38 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -44,6 +44,7 @@
 #include <linux/pm_qos.h>
 #include <linux/reservation.h>
 #include <linux/shmem_fs.h>
+#include <linux/mei_hdcp.h>
 
 #include <drm/drmP.h>
 #include <drm/intel-gtt.h>
@@ -2365,6 +2366,10 @@ struct drm_i915_private {
 
 	struct i915_pmu pmu;
 
+	/* Mei interface handle */
+	struct mei_cl_device *mei_cldev;
+	int mei_ref_cnt;
+
 	/*
 	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
 	 * will be rejected. Instead look for a better place.
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 1c0d324c1044..9c05049c25d5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -301,6 +301,62 @@ struct intel_panel {
 	} backlight;
 };
 
+struct intel_hdcp;
+
+#define HDCP_CAPABILITY				BIT(0)
+#define HDCP2_CAPABILITY			BIT(1)
+
+/*
+ * This structure serves as a translation layer between the generic HDCP2.2 code
+ * and the bus-specific code. What that means is that HDCP over HDMI differs
+ * from HDCP over DP, so to account for these differences, we need to
+ * communicate with the receiver through this shim.
+ *
+ * For completeness, the 2 buses differ in the following ways:
+ *	- DP AUX vs. DDC
+ *		HDCP registers on the receiver are set via DP AUX for DP, and
+ *		they are set via DDC for HDMI.
+ *	- Receiver register offsets
+ *		The offsets of the registers are different for DP vs. HDMI
+ *	- Receiver register masks/offsets
+ *		Few register bit definitions are different between DP and HDMI.
+ *	- HDCP signalling
+ *		Needed for HDMI but not for DP.
+ *	- Configure stream type onto receiver
+ *		Needed only for DP but not for HDMI.
+ */
+struct intel_hdcp2_shim {
+
+	/* Write HDCP2.2 messages */
+	int (*write_msg)(struct intel_digital_port *intel_dig_port, void *buf,
+			 size_t size);
+
+	/* Read HDCP2.2 messages */
+	int (*read_msg)(struct intel_digital_port *intel_dig_port,
+			uint8_t msg_id, void *buf, size_t size);
+
+	/*
+	 * Implementation of DP Errata for the communication of stream type to
+	 * Receivers. Not applicable for HDMI.
+	 */
+	int (*config_stream_type)(struct intel_digital_port *intel_dig_port,
+				  void *buf, size_t size);
+
+	/* Enables HDCP signalling on the port. Not applicable for DP. */
+	int (*toggle_signalling)(struct intel_digital_port *intel_dig_port,
+				 bool enable);
+
+	/* Link Integrity Check */
+	int (*check_link)(struct intel_digital_port *intel_dig_port);
+
+	/* Detects whether Panel is HDCP2.2 capable */
+	int (*hdcp_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);
+};
+
 /*
  * This structure serves as a translation layer between the generic HDCP code
  * and the bus-specific code. What that means is that HDCP over HDMI differs
@@ -378,6 +434,10 @@ struct intel_hdcp_shim {
 struct intel_hdcp {
 	struct intel_connector *connector;
 
+	/* Flags to represent the HDCP capability of the platform and panel */
+	u32 plat_cap;
+	u32 panel_cap;
+
 	const struct intel_hdcp_shim *hdcp_shim;
 	struct mutex hdcp_mutex;
 	uint64_t hdcp_value; /* protected by hdcp_mutex */
@@ -387,6 +447,37 @@ struct intel_hdcp {
 
 	/* To indicate the assertion of CP_IRQ */
 	struct completion cp_irq_recved;
+
+	/* HDCP2.2 related definitions */
+
+	/* Content Stream Type defined by content owner */
+	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;
+
+	/* Translation layer for encoder specific functions */
+	const struct intel_hdcp2_shim *hdcp2_shim;
+
+	/* mei interface related information */
+	struct mei_hdcp_data *mei_hdcp_data;
+
+	struct delayed_work hdcp2_check_work;
 };
 
 struct intel_connector {
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (24 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 25/43] drm/i915: Define HDCP2.2 related variables Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-22 15:43   ` Sean Paul
  2018-02-14 14:13 ` [PATCH 27/43] drm/i915: Wrappers for mei HDCP2.2 services Ramalingam C
                   ` (19 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Intel HDCP2.2 registers are defined with addr offsets and bit details.

Macros are defined for referencing the register offsets based on the
port index.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h | 120 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 120 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f6afa5e5e7c1..6a57b12d8dab 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2268,6 +2268,126 @@ enum i915_power_well_id {
 				   _PORT_TX_DW14_LN0_C) +		\
 	      _BXT_LANE_OFFSET(lane))
 
+/*
+ *HDCP Registers
+ **/
+
+/*
+ * HW register offsets are incresing in the order of B, C, D, A, F, E.
+ * But enum value increses in the order of A, B, C, D, E, F.
+ * So port numbers are adjusted for offset calculations.
+ */
+#define HDCP_PORT_INDEX_ADJUST(p)	(((p) == PORT_A ? PORT_E : \
+						(p) == PORT_E ? (0x6) : \
+						(p)) - 1)
+#define _MMIO_HDCP_PORT(p, a, b)	_MMIO_PORT(HDCP_PORT_INDEX_ADJUST(p), \
+						a, b)
+
+
+/* RO Registers for I915. Programmable from FW(ME) only */
+#define HDCP2_AUTH_DDI_A		0x66898
+#define HDCP2_AUTH_DDI_B		0x66598
+#define HDCP2_AUTH_DDI_C		0x66698
+#define HDCP2_AUTH_DDI_D		0x66798
+#define HDCP2_AUTH_DDI_E		0x66A98
+#define HDCP2_AUTH_DDI_F		0x66998
+#define   AUTH_LINK_AUTHENTICATED	(1 << 31)
+#define   AUTH_LINK_TYPE		(1 << 30)
+#define   AUTH_FORCE_CLR_INPUTCTR	(1 << 19)
+#define   AUTH_CLR_KEYS			(1 << 18)
+
+#define HDCP2_AUTH_DDI(port)		_MMIO_HDCP_PORT(port, \
+							HDCP2_AUTH_DDI_B, \
+							HDCP2_AUTH_DDI_C)
+
+
+/* Multi stream DP registers */
+/* RO Registers for I915. Programmable from FW(ME) only */
+#define HDCP2_AUTH_STREAM_A		0x66F00
+#define HDCP2_AUTH_STREAM_B		0x66F04
+#define HDCP2_AUTH_STREAM_C		0x66F08
+#define HDCP2_AUTH_STREAM_D		0x66F0C
+#define   AUTH_STREAM_TYPE		(1 << 31)
+
+#define HDCP2_AUTH_STREAM(stream)	_MMIO_PORT(stream, \
+						   HDCP2_AUTH_STREAM_A, \
+						   HDCP2_AUTH_STREAM_B)
+
+/* RW Registers for I915 */
+#define HDCP2_CTL_DDI_A			0x668B0
+#define HDCP2_CTL_DDI_B			0x665B0
+#define HDCP2_CTL_DDI_C			0x666B0
+#define HDCP2_CTL_DDI_D			0x667B0
+#define HDCP2_CTL_DDI_E			0x66AB0
+#define HDCP2_CTL_DDI_F			0x669B0
+#define   CTL_LINK_ENCRYPTION_REQ	(1 << 31)
+#define   CTL_VBID_TYPE_SELECT_SHIFT	29
+#define   CTL_VBID_TYPE_SELECT_MASK	(3 << CTL_VBID_TYPE_SELECT_SHIFT)
+
+#define HDCP2_CTR_DDI(port)		_MMIO_HDCP_PORT(port, HDCP2_CTL_DDI_B, \
+							HDCP2_CTL_DDI_C)
+
+/* RO only. For Debug purpose */
+#define HDCP2_INPUTCTR_DDI_A		0x668B8
+#define HDCP2_INPUTCTR_DDI_B		0x665B8
+#define HDCP2_INPUTCTR_DDI_C		0x666B8
+#define HDCP2_INPUTCTR_DDI_D		0x667B8
+#define HDCP2_INPUTCTR_DDI_E		0x66AB8
+#define HDCP2_INPUTCTR_DDI_F		0x669B8
+
+#define HDCP2_INPUTCTR_LO_DDI(port)	_MMIO_HDCP_PORT(port, \
+							HDCP2_INPUTCTL_DDI_B, \
+							HDCP2_INPUTCTL_DDI_C)
+
+#define HDCP2_INPUTCTR_HI_DDI(port)	_MMIO_HDCP_PORT(port, \
+						(HDCP2_INPUTCTL_DDI_B + 4), \
+						(HDCP2_INPUTCTL_DDI_C + 4))
+
+/* RO Registers for I915. Programmable from FW(ME) only */
+#define HDCP2_RIV_DDI_A			0x66890
+#define HDCP2_RIV_DDI_B			0x66590
+#define HDCP2_RIV_DDI_C			0x66690
+#define HDCP2_RIV_DDI_D			0x66790
+#define HDCP2_RIV_DDI_E			0x66A90
+#define HDCP2_RIV_DDI_F			0x66990
+
+#define HDCP2_RIV_LO_DDI(port)		_MMIO_HDCP_PORT(port, HDCP2_RIV_DDI_B, \
+							HDCP2_RIV_DDI_C)
+
+#define HDCP2_RIV_HI_DDI(port)		_MMIO_HDCP_PORT(port, \
+							(HDCP2_RIV_DDI_B + 4), \
+							(HDCP2_RIV_DDI_C + 4))
+
+/* RO only. For Debug purpose */
+#define HDCP2_STATUS_DDI_A		0x668B4
+#define HDCP2_STATUS_DDI_B		0x665B4
+#define HDCP2_STATUS_DDI_C		0x666B4
+#define HDCP2_STATUS_DDI_D		0x667B4
+#define HDCP2_STATUS_DDI_E		0x66AB4
+#define HDCP2_STATUS_DDI_F		0x669B4
+#define   STREAM_ENCRYPTION_STATUS_A	(1 << 31)
+#define   STREAM_ENCRYPTION_STATUS_B	(1 << 30)
+#define   STREAM_ENCRYPTION_STATUS_C	(1 << 29)
+#define   LINK_TYPE_STATUS		(1 << 22)
+#define   LINK_AUTH_STATUS		(1 << 21)
+#define   LINK_ENCRYPTION_STATUS	(1 << 20)
+
+#define HDCP2_STATUS_DDI(port)		_MMIO_HDCP_PORT(port, \
+							HDCP2_STATUS_DDI_B, \
+							HDCP2_STATUS_DDI_C)
+
+/* RO only. For Debug purpose */
+#define HDCP2_STREAM_STATUS_A		0x668C0
+#define HDCP2_STREAM_STATUS_B		0x665C0
+#define HDCP2_STREAM_STATUS_C		0x666C0
+#define HDCP2_STREAM_STATUS_D		0x667C0
+#define   STREAM_ENCRYPTION_STATUS	(1 << 31)
+#define   STREAM_TYPE_STATUS		(1 << 30)
+
+#define HDCP2_STREAM_STATUS(stream)	_MMIO_HDCP_PORT(stream, \
+							HDCP2_STREAM_STATUS_B, \
+							HDCP2_STREAM_STATUS_C)
+
 /* UAIMI scratch pad register 1 */
 #define UAIMI_SPR1			_MMIO(0x4F074)
 /* SKL VccIO mask */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 27/43] drm/i915: Wrappers for mei HDCP2.2 services
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (25 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 28/43] drm/i915: Implement HDCP2.2 receiver authentication Ramalingam C
                   ` (18 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Adds the wrapper for all mei hdcp2.2 service functions.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 189 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 31e1af5b43ec..8ac824f0ed35 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -10,10 +10,14 @@
 #include <drm/drm_hdcp.h>
 #include <linux/i2c.h>
 #include <linux/random.h>
+#include <uapi/linux/swab.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 physical_port) (port))
 #define KEY_LOAD_TRIES	5
 
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
@@ -831,3 +835,188 @@ int intel_hdcp_check_link(struct intel_hdcp *hdcp)
 	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_hdcp_data;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	if (data->port == INVALID_PORT && hdcp->connector->encoder)
+		data->port = GET_MEI_DDI_INDEX(hdcp->connector->encoder->port);
+
+	return mei_initiate_hdcp2_session(data, ake_data);
+}
+
+static int hdcp2_close_mei_session(struct intel_hdcp *hdcp)
+{
+	struct mei_hdcp_data *data = hdcp->mei_hdcp_data;
+
+	if (!data->cldev || data->port == INVALID_PORT)
+		return -EINVAL;
+
+	return mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_verify_receiver_cert_prepare_km(data, rx_cert, paired,
+						  ek_pub_km, msg_sz);
+	if (ret < 0)
+		mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_verify_hprime(data, rx_hprime);
+	if (ret < 0)
+		mei_close_hdcp_session(data);
+
+	return ret;
+}
+
+static int
+hdcp2_store_paring_info(struct intel_hdcp *hdcp,
+			struct hdcp2_ake_send_pairing_info *pairing_info)
+{
+	struct mei_hdcp_data *data = hdcp->mei_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_store_pairing_info(data, pairing_info);
+	if (ret < 0)
+		mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_initiate_locality_check(data, lc_init);
+	if (ret < 0)
+		mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_verify_lprime(data, rx_lprime);
+	if (ret < 0)
+		mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_get_session_key(data, ske_data);
+	if (ret < 0)
+		mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_repeater_check_flow_prepare_ack(data, rep_topology,
+						  rep_send_ack);
+	if (ret < 0)
+		mei_close_hdcp_session(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_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_verify_mprime(data, stream_ready);
+	if (ret < 0)
+		mei_close_hdcp_session(data);
+
+	return ret;
+}
+
+
+static int hdcp2_authenticate_port(struct intel_hdcp *hdcp)
+{
+	struct mei_hdcp_data *data = hdcp->mei_hdcp_data;
+	int ret;
+
+	if (!data->cldev)
+		return -EINVAL;
+
+	ret = mei_enable_hdcp_authentication(data);
+	if (ret < 0)
+		mei_close_hdcp_session(data);
+
+	return ret;
+}
+
+static inline int hdcp2_deauthenticate_port(struct intel_hdcp *hdcp)
+{
+	return hdcp2_close_mei_session(hdcp);
+}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 28/43] drm/i915: Implement HDCP2.2 receiver authentication
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (26 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 27/43] drm/i915: Wrappers for mei HDCP2.2 services Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 29/43] drm/i915: Implement HDCP2.2 repeater authentication Ramalingam C
                   ` (17 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements HDCP2.2 authentication for hdcp2.2 receivers, with
following steps:
	Authentication and Key enchange (AKE).
	Locality Check (LC).
	Session Key Exchange(SKE).
	DP Errata for stream type confuguration 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 183 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 183 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 8ac824f0ed35..64276f180e45 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -19,6 +19,7 @@
 #define GET_MEI_DDI_INDEX(port)		(((port) == PORT_A) ? DDI_A : \
 					 (enum physical_port) (port))
 #define KEY_LOAD_TRIES	5
+#define HDCP2_LC_RETRY_CNT		3
 
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
 				    const struct intel_hdcp_shim *shim)
@@ -1020,3 +1021,185 @@ static inline int hdcp2_deauthenticate_port(struct intel_hdcp *hdcp)
 {
 	return hdcp2_close_mei_session(hdcp);
 }
+
+static int hdcp2_authentication_key_exchange(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	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_hdcp2_shim *shim = hdcp->hdcp2_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_msg(intel_dig_port, &msgs.ake_init,
+			      sizeof(msgs.ake_init));
+	if (ret < 0)
+		return ret;
+
+	ret = shim->read_msg(intel_dig_port, AKE_SEND_CERT, &msgs.send_cert,
+			     sizeof(msgs.send_cert));
+	if (ret < 0)
+		return ret;
+
+	if (msgs.send_cert.rx_caps.fields.version !=
+	    HDCP_2_2_RX_CAPS_VERSION_VAL)
+		return -EINVAL;
+
+	hdcp->is_repeater = msgs.send_cert.rx_caps.fields.repeater;
+
+	/*
+	 * 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_msg(intel_dig_port, &msgs.no_stored_km, size);
+	if (ret < 0)
+		return ret;
+
+	ret = shim->read_msg(intel_dig_port, 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_msg(intel_dig_port, AKE_SEND_PARING_INFO,
+				     &msgs.pairing_info,
+				     sizeof(msgs.pairing_info));
+		if (ret < 0)
+			return ret;
+
+		ret = hdcp2_store_paring_info(hdcp, &msgs.pairing_info);
+		if (ret < 0)
+			return ret;
+		hdcp->is_paired = true;
+	}
+	return 0;
+}
+
+static int hdcp2_locality_check(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	union {
+		struct hdcp2_lc_init lc_init;
+		struct hdcp2_lc_send_lprime send_lprime;
+	} msgs;
+	const struct intel_hdcp2_shim *shim = hdcp->hdcp2_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_msg(intel_dig_port, &msgs.lc_init,
+				      sizeof(msgs.lc_init));
+		if (ret < 0)
+			continue;
+
+		ret = shim->read_msg(intel_dig_port, 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_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	struct hdcp2_ske_send_eks send_eks;
+	int ret;
+
+	ret = hdcp2_prepare_skey(hdcp, &send_eks);
+	if (ret < 0)
+		return ret;
+
+	ret = hdcp->hdcp2_shim->write_msg(intel_dig_port, &send_eks,
+					  sizeof(send_eks));
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	struct hdcp2_dp_errata_stream_type stream_type_msg;
+	const struct intel_hdcp2_shim *shim = hdcp->hdcp2_shim;
+	int ret;
+
+	ret = hdcp2_authentication_key_exchange(hdcp);
+	if (ret < 0) {
+		DRM_DEBUG_KMS("AKE Failed. Err : %d\n", ret);
+		return ret;
+	}
+
+	ret = hdcp2_locality_check(hdcp);
+	if (ret < 0) {
+		DRM_DEBUG_KMS("Locality Check failed. Err : %d\n", ret);
+		return ret;
+	}
+
+	ret = hdcp2_session_key_exchange(hdcp);
+	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 in later in time
+		 */
+		stream_type_msg.msg_id = 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_hdcp_data->streams[0].stream_type = hdcp->content_type;
+	ret = hdcp2_authenticate_port(hdcp);
+	if (ret < 0)
+		return ret;
+
+	return ret;
+}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 29/43] drm/i915: Implement HDCP2.2 repeater authentication
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (27 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 28/43] drm/i915: Implement HDCP2.2 receiver authentication Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption Ramalingam C
                   ` (16 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements the HDCP2.2 repeaters authentication steps such as verifying
the downstream topology and sending stream management information.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 133 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 64276f180e45..0cd637dd3f6b 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -1153,6 +1153,133 @@ static int hdcp2_session_key_exchange(struct intel_hdcp *hdcp)
 	return 0;
 }
 
+/*
+ * Lib endianness functions are aligned for 16/32/64 bits. Since here sequence
+ * num is 24bits developed a small conversion function.
+ */
+static inline void reverse_endianness(u8 *dest, size_t dst_sz, u8 *src)
+{
+	u32 index;
+
+	if (dest != NULL && dst_sz != 0) {
+		for (index = 0; index < dst_sz && index < sizeof(u32);
+		     index++) {
+			dest[dst_sz - index - 1] = src[index];
+		}
+	}
+}
+
+static int hdcp2_propagate_stream_management_info(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	union {
+		struct hdcp2_rep_stream_manage stream_manage;
+		struct hdcp2_rep_stream_ready stream_ready;
+	} msgs;
+	const struct intel_hdcp2_shim *shim = hdcp->hdcp2_shim;
+	int ret;
+
+	/* Prepare RepeaterAuth_Stream_Manage msg */
+	msgs.stream_manage.msg_id = REP_STREAM_MANAGE;
+	reverse_endianness(msgs.stream_manage.seq_num_m, HDCP_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_msg(intel_dig_port, &msgs.stream_manage,
+			      sizeof(msgs.stream_manage));
+	if (ret < 0)
+		return ret;
+
+	ret = shim->read_msg(intel_dig_port, REP_STREAM_READY,
+			     &msgs.stream_ready, sizeof(msgs.stream_ready));
+	if (ret < 0)
+		return ret;
+
+	hdcp->mei_hdcp_data->seq_num_m = hdcp->seq_num_m;
+	hdcp->mei_hdcp_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_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	union {
+		struct hdcp2_rep_send_receiverid_list recvid_list;
+		struct hdcp2_rep_send_ack rep_ack;
+	} msgs;
+	const struct intel_hdcp2_shim *shim = hdcp->hdcp2_shim;
+	union hdcp2_rx_info *rx_info;
+	uint32_t seq_num_v;
+	int ret;
+
+	ret = shim->read_msg(intel_dig_port, REP_SEND_RECVID_LIST,
+			     &msgs.recvid_list, sizeof(msgs.recvid_list));
+	if (ret < 0)
+		return ret;
+
+	rx_info = &msgs.recvid_list.rx_info;
+
+	if (rx_info->fields.max_cascade_exceeded ||
+	    rx_info->fields.max_devs_exceeded) {
+		DRM_DEBUG_KMS("Topology Max Size Exceeded\n");
+		return -1;
+	}
+
+	/* Converting and Storing the seq_num_v to local variable as DWORD */
+	reverse_endianness((u8 *)&seq_num_v, HDCP_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 -1;
+	}
+
+	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_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_hdcp *hdcp)
+{
+	int ret;
+
+	ret = hdcp2_authenticate_repeater_topology(hdcp);
+	if (ret < 0)
+		return ret;
+
+	return hdcp2_propagate_stream_management_info(hdcp);
+}
+
 static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
 {
 	struct intel_digital_port *intel_dig_port =
@@ -1194,6 +1321,12 @@ static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
 					       sizeof(stream_type_msg));
 		if (ret < 0)
 			return ret;
+	} else if (hdcp->is_repeater) {
+		ret = hdcp2_authenticate_repeater(hdcp);
+		if (ret < 0) {
+			DRM_DEBUG_KMS("Repeater Auth Failed. Err: %d\n", ret);
+			return ret;
+		}
 	}
 
 	hdcp->mei_hdcp_data->streams[0].stream_type = hdcp->content_type;
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (28 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 29/43] drm/i915: Implement HDCP2.2 repeater authentication Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:38   ` Chris Wilson
  2018-02-14 14:13 ` [PATCH 31/43] drm/i915: Implement HDCP2.2 En/Dis-able Ramalingam C
                   ` (15 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements the enable and disable functions for HDCP2.2 encryption
of the PORT.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 50 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 0cd637dd3f6b..6a0506cdefd5 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -20,6 +20,7 @@
 					 (enum physical_port) (port))
 #define KEY_LOAD_TRIES	5
 #define HDCP2_LC_RETRY_CNT		3
+#define TIME_FOR_ENCRYPT_STATUS_CHANGE	32
 
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
 				    const struct intel_hdcp_shim *shim)
@@ -1336,3 +1337,52 @@ static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
 
 	return ret;
 }
+
+static int hdcp2_enable_encryption(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
+	enum port port = hdcp->connector->encoder->port;
+	int ret;
+
+	if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS)
+		return 0;
+
+	if (hdcp->hdcp2_shim->toggle_signalling)
+		hdcp->hdcp2_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_CTR_DDI(port),
+			   I915_READ(HDCP2_CTR_DDI(port)) |
+			   CTL_LINK_ENCRYPTION_REQ);
+	}
+
+	ret = wait_for(I915_READ(HDCP2_STATUS_DDI(port)) &
+		       LINK_ENCRYPTION_STATUS, TIME_FOR_ENCRYPT_STATUS_CHANGE);
+	return ret;
+}
+
+static int hdcp2_disable_encryption(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
+	enum port port = hdcp->connector->encoder->port;
+	int ret;
+
+	if (!(I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS))
+		return 0;
+
+	I915_WRITE(HDCP2_CTR_DDI(port),
+		   I915_READ(HDCP2_CTR_DDI(port)) & ~CTL_LINK_ENCRYPTION_REQ);
+	ret = wait_for(!(I915_READ(HDCP2_STATUS_DDI(port)) &
+		       LINK_ENCRYPTION_STATUS), TIME_FOR_ENCRYPT_STATUS_CHANGE);
+
+	if (hdcp->hdcp2_shim->toggle_signalling)
+		hdcp->hdcp2_shim->toggle_signalling(intel_dig_port, false);
+
+	return ret;
+}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 31/43] drm/i915: Implement HDCP2.2 En/Dis-able
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (29 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 32/43] drm/i915: Implement HDCP2.2 link integrity check Ramalingam C
                   ` (14 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements a sequence of enabling and disabling the HDCP2.2
(auth and encryption).

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 70 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 6a0506cdefd5..8bf30513713a 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -22,6 +22,9 @@
 #define HDCP2_LC_RETRY_CNT		3
 #define TIME_FOR_ENCRYPT_STATUS_CHANGE	32
 
+static int _intel_hdcp2_enable(struct intel_hdcp *hdcp);
+static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
+
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
 				    const struct intel_hdcp_shim *shim)
 {
@@ -1386,3 +1389,70 @@ static int hdcp2_disable_encryption(struct intel_hdcp *hdcp)
 
 	return ret;
 }
+
+static int hdcp2_authenticate_and_encrypt(struct intel_hdcp *hdcp)
+{
+	int ret, i, tries = 3;
+
+	for (i = 0; i < tries; i++) {
+		ret = hdcp2_authenticate_sink(hdcp);
+		if (!ret)
+			break;
+
+		/* Clearing the mei hdcp session */
+		hdcp2_deauthenticate_port(hdcp);
+		DRM_DEBUG_KMS("HDCP2.2 Reauth %d of %d\n", i + 1, tries);
+	}
+
+	if (!ret) {
+
+		/*
+		 * 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(hdcp);
+		if (ret < 0)
+			DRM_DEBUG_KMS("Encryption Enable Failed. %d\n", ret);
+	}
+
+	return ret;
+}
+
+static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
+{
+	int ret;
+
+	DRM_ERROR("[%s:%d] HDCP2.2 is being Disabled\n",
+		  hdcp->connector->base.name, hdcp->connector->base.base.id);
+
+	ret = hdcp2_disable_encryption(hdcp);
+
+	hdcp2_deauthenticate_port(hdcp);
+
+	return ret;
+}
+
+static int _intel_hdcp2_enable(struct intel_hdcp *hdcp)
+{
+	struct intel_connector *connector = hdcp->connector;
+	int ret;
+
+	DRM_INFO("[%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(hdcp);
+	if (ret) {
+		DRM_ERROR("HDCP2 Enabling Failed. (%d)\n", ret);
+		return ret;
+	}
+
+	DRM_INFO("[%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;
+}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 32/43] drm/i915: Implement HDCP2.2 link integrity check
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (30 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 31/43] drm/i915: Implement HDCP2.2 En/Dis-able Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 33/43] drm/i915: Handle HDCP2.2 downstream topology change Ramalingam C
                   ` (13 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 80 ++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_hdcp.h            |  8 ++++
 2 files changed, 87 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 8bf30513713a..076a0b0d2ae9 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -24,6 +24,8 @@
 
 static int _intel_hdcp2_enable(struct intel_hdcp *hdcp);
 static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
+static void intel_hdcp2_check_work(struct work_struct *work);
+static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
 
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
 				    const struct intel_hdcp_shim *shim)
@@ -1453,6 +1455,82 @@ static int _intel_hdcp2_enable(struct intel_hdcp *hdcp)
 
 	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 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);
+
+	if (!intel_hdcp2_check_link(hdcp))
+		schedule_delayed_work(&hdcp->hdcp2_check_work,
+				      DRM_HDCP2_CHECK_PERIOD_MS);
+}
+
+static int intel_hdcp2_check_link(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
+	enum port port = hdcp->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->hdcp2_shim->check_link(intel_dig_port);
+	if (!ret) {
+		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",
+		 hdcp->connector->base.name, hdcp->connector->base.base.id);
+
+	ret = _intel_hdcp2_disable(hdcp);
+	if (ret) {
+		DRM_ERROR("[%s:%d] Failed to disable hdcp2.2 (%d)\n",
+			  hdcp->connector->base.name,
+			  hdcp->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(hdcp);
+	if (ret) {
+		DRM_ERROR("[%s:%d] Failed to enable hdcp2.2 (%d)\n",
+			  hdcp->connector->base.name,
+			  hdcp->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;
+}
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index c5f36b1a004b..8c1fca59ea35 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -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
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 33/43] drm/i915: Handle HDCP2.2 downstream topology change
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (31 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 32/43] drm/i915: Implement HDCP2.2 link integrity check Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 34/43] drm/i915: Pullout the bksv read and validation Ramalingam C
                   ` (12 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

When repeater notifies a downstream topology change, this patch
reauthenticate the repeater alone with out disabling the hdcp
encryption. If that fails then complete reauthentication is executed.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 076a0b0d2ae9..f5e606cc667f 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -1505,9 +1505,23 @@ static int intel_hdcp2_check_link(struct intel_hdcp *hdcp)
 		goto out;
 	}
 
+	if (ret == DRM_HDCP_TOPOLOGY_CHANGE) {
+		if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
+			DRM_DEBUG_KMS("HDCP2.2 Downstream topology change\n");
+			ret = hdcp2_authenticate_repeater_topology(hdcp);
+			if (ret < 0)
+				goto hdcp2_reauth;
+
+			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",
 		 hdcp->connector->base.name, hdcp->connector->base.base.id);
 
+hdcp2_reauth:
 	ret = _intel_hdcp2_disable(hdcp);
 	if (ret) {
 		DRM_ERROR("[%s:%d] Failed to disable hdcp2.2 (%d)\n",
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 34/43] drm/i915: Pullout the bksv read and validation
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (32 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 33/43] drm/i915: Handle HDCP2.2 downstream topology change Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 35/43] drm/i915: Enable HDCP version that is best capable Ramalingam C
                   ` (11 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

For 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.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index f5e606cc667f..69ae47eaff49 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -153,6 +153,27 @@ bool intel_hdcp_is_ksv_valid(u8 *ksv)
 	return true;
 }
 
+static inline
+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("HDCP failed, 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,
@@ -412,7 +433,7 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,
 	struct drm_i915_private *dev_priv;
 	enum port port;
 	unsigned long r0_prime_gen_start;
-	int ret, i, tries = 2;
+	int ret, i;
 	union {
 		u32 reg[2];
 		u8 shim[DRM_HDCP_AN_LEN];
@@ -470,18 +491,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]);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 35/43] drm/i915: Enable HDCP version that is best capable
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (33 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 34/43] drm/i915: Pullout the bksv read and validation Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:42   ` Chris Wilson
  2018-02-14 14:13 ` [PATCH 36/43] drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure Ramalingam C
                   ` (10 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

hdcp_enable_work is extended to choose the better hdcp version based
on the system and panel capability.

And intel_hdcp_disable will find the version that is inforce, if any.
And corresponding version specific disable function alone called.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 112 ++++++++++++++++++++++++++++++++++----
 1 file changed, 100 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 69ae47eaff49..2fe73f7eb6dd 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -27,6 +27,43 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
 static void intel_hdcp2_check_work(struct work_struct *work);
 static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
 
+static inline bool intel_hdcp1_supported(struct intel_hdcp *hdcp)
+{
+	return (hdcp->plat_cap & HDCP_CAPABILITY &&
+		hdcp->panel_cap & HDCP_CAPABILITY);
+}
+
+static inline bool intel_hdcp2_supported(struct intel_hdcp *hdcp)
+{
+	return (hdcp->plat_cap & HDCP2_CAPABILITY &&
+		hdcp->panel_cap & HDCP2_CAPABILITY);
+}
+
+static inline bool intel_hdcp_in_force(struct intel_hdcp *hdcp)
+{
+	struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
+	enum port port = hdcp->connector->encoder->port;
+	u32 reg;
+
+	reg = I915_READ(PORT_HDCP_STATUS(port));
+	if (reg & HDCP_STATUS_AUTH || reg & HDCP_STATUS_ENC)
+		return true;
+	return false;
+
+}
+
+static inline bool intel_hdcp2_in_force(struct intel_hdcp *hdcp)
+{
+	struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
+	enum port port = hdcp->connector->encoder->port;
+	u32 reg;
+
+	reg = I915_READ(HDCP2_STATUS_DDI(port));
+	if (reg & LINK_ENCRYPTION_STATUS || reg & LINK_AUTH_STATUS)
+		return true;
+	return false;
+}
+
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
 				    const struct intel_hdcp_shim *shim)
 {
@@ -650,7 +687,11 @@ static void intel_hdcp_enable_work(struct work_struct *work)
 					       hdcp_enable_work);
 
 	mutex_lock(&hdcp->hdcp_mutex);
-	_intel_hdcp_enable(hdcp);
+	if (intel_hdcp2_supported(hdcp))
+		_intel_hdcp2_enable(hdcp);
+	else if (intel_hdcp1_supported(hdcp))
+		_intel_hdcp_enable(hdcp);
+
 	mutex_unlock(&hdcp->hdcp_mutex);
 }
 
@@ -727,13 +768,48 @@ int intel_hdcp_init(struct intel_connector *connector,
 	return ret;
 }
 
+static void intel_hdcp_probe_panel_cap(struct intel_hdcp *hdcp)
+{
+	struct intel_digital_port *intel_dig_port =
+					conn_to_dig_port(hdcp->connector);
+	bool capable = false;
+	u8 bksv[5];
+
+	hdcp->panel_cap = 0;
+
+	if (hdcp->plat_cap & HDCP_CAPABILITY) {
+		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;
+		}
+		if (capable)
+			hdcp->panel_cap |= HDCP_CAPABILITY;
+	}
+
+	if (hdcp->plat_cap & HDCP2_CAPABILITY) {
+		hdcp->hdcp2_shim->hdcp_capable(intel_dig_port, &capable);
+		if (capable)
+			hdcp->panel_cap |= HDCP2_CAPABILITY;
+	}
+	DRM_DEBUG_KMS("plat_cap: 0x%X, panel_cap: 0x%X\n",
+		      hdcp->plat_cap, hdcp->panel_cap);
+}
+
 int intel_hdcp_enable(struct intel_connector *connector)
 {
 	struct intel_hdcp *hdcp = connector->hdcp;
 
-	if (!hdcp || !hdcp->hdcp_shim)
+	if (!hdcp)
 		return -ENOENT;
 
+	intel_hdcp_probe_panel_cap(hdcp);
+
+	if (!intel_hdcp1_supported(hdcp) && !intel_hdcp2_supported(hdcp))
+		return -EINVAL;
+
 	mutex_lock(&hdcp->hdcp_mutex);
 	schedule_work(&hdcp->hdcp_enable_work);
 	mutex_unlock(&hdcp->hdcp_mutex);
@@ -744,21 +820,33 @@ int intel_hdcp_enable(struct intel_connector *connector)
 int intel_hdcp_disable(struct intel_connector *connector)
 {
 	struct intel_hdcp *hdcp = connector->hdcp;
-	int ret = 0;
 
-	if (!hdcp || !hdcp->hdcp_shim)
+	if (!hdcp)
 		return -ENOENT;
 
-	mutex_lock(&hdcp->hdcp_mutex);
+	if (hdcp->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+		return 0;
 
-	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
-		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
-		ret = _intel_hdcp_disable(hdcp);
-	}
+	/*
+	 * Setting it out of mutex, so that other on going process like check
+	 * link and auth can check for this state change and terminate themself.
+	 */
+	hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
+	cancel_work_sync(&hdcp->hdcp_enable_work);
 
-	mutex_unlock(&hdcp->hdcp_mutex);
 	cancel_delayed_work_sync(&hdcp->hdcp_check_work);
-	return ret;
+	cancel_delayed_work_sync(&hdcp->hdcp2_check_work);
+
+	mutex_lock(&hdcp->hdcp_mutex);
+	if (hdcp->plat_cap & HDCP_CAPABILITY)
+		if (intel_hdcp_in_force(hdcp))
+			_intel_hdcp_disable(hdcp);
+	if (hdcp->plat_cap & HDCP2_CAPABILITY)
+		if (intel_hdcp2_in_force(hdcp))
+			_intel_hdcp2_disable(hdcp);
+	mutex_unlock(&hdcp->hdcp_mutex);
+
+	return 0;
 }
 
 void intel_hdcp_atomic_check(struct drm_connector *connector,
@@ -1437,7 +1525,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
 {
 	int ret;
 
-	DRM_ERROR("[%s:%d] HDCP2.2 is being Disabled\n",
+	DRM_INFO("[%s:%d] HDCP2.2 is being Disabled\n",
 		  hdcp->connector->base.name, hdcp->connector->base.base.id);
 
 	ret = hdcp2_disable_encryption(hdcp);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 36/43] drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (34 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 35/43] drm/i915: Enable HDCP version that is best capable Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface Ramalingam C
                   ` (9 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

When HDCP2.2 enabling fails and HDCP1.4 is supported, HDCP1.4 is
enabled.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 2fe73f7eb6dd..9d01d1ff8c73 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -685,11 +685,13 @@ static void intel_hdcp_enable_work(struct work_struct *work)
 {
 	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
 					       hdcp_enable_work);
+	int ret = -EINVAL;
 
 	mutex_lock(&hdcp->hdcp_mutex);
 	if (intel_hdcp2_supported(hdcp))
-		_intel_hdcp2_enable(hdcp);
-	else if (intel_hdcp1_supported(hdcp))
+		ret = _intel_hdcp2_enable(hdcp);
+
+	if (ret && intel_hdcp1_supported(hdcp))
 		_intel_hdcp_enable(hdcp);
 
 	mutex_unlock(&hdcp->hdcp_mutex);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (35 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 36/43] drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:45   ` Chris Wilson
  2018-02-14 14:13 ` [PATCH 38/43] drm/i915: Implement gmbus burst read Ramalingam C
                   ` (8 subsequent siblings)
  45 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements the init and exit for hdcp2.2 support. This includes the
mei interface initialization also.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c   |   3 +-
 drivers/gpu/drm/i915/intel_drv.h  |   3 +-
 drivers/gpu/drm/i915/intel_hdcp.c | 145 +++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_hdmi.c |   2 +-
 4 files changed, 147 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 8847f1a36504..6f6b4c8e3a42 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -6463,7 +6463,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,
+					  NULL);
 		if (ret)
 			DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
 	}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9c05049c25d5..842a22502763 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1950,7 +1950,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,
+		    const struct intel_hdcp2_shim *hdcp2_shim);
 int intel_hdcp_enable(struct intel_connector *connector);
 int intel_hdcp_disable(struct intel_connector *connector);
 int intel_hdcp_check_link(struct intel_hdcp *hdcp);
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 9d01d1ff8c73..bb56e4e595d8 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -26,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_hdcp *hdcp);
 static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
 static void intel_hdcp2_check_work(struct work_struct *work);
 static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
+static void intel_hdcp2_exit(struct intel_connector *connector);
 
 static inline bool intel_hdcp1_supported(struct intel_hdcp *hdcp)
 {
@@ -738,11 +739,136 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
 		!IS_CHERRYVIEW(dev_priv) && port < PORT_E);
 }
 
-int intel_hdcp_init(struct intel_connector *connector,
-		    const struct intel_hdcp_shim *hdcp_shim)
+static inline int initialize_mei_hdcp_data(struct intel_hdcp *hdcp)
+{
+	struct intel_connector *connector = hdcp->connector;
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+	struct mei_hdcp_data *data = hdcp->mei_hdcp_data;
+	enum port port;
+
+	data->cldev = dev_priv->mei_cldev;
+
+	if (connector->encoder) {
+		port = connector->encoder->port;
+		data->port = GET_MEI_DDI_INDEX(port);
+	}
+
+	data->port_type = INTEGRATED;
+	data->protocol = hdcp->hdcp2_shim->hdcp_protocol();
+
+	data->k = 1;
+	if (!data->streams)
+		data->streams = kcalloc(data->k,
+					sizeof(struct hdcp2_streamid_type),
+					GFP_KERNEL);
+	if (!data->streams)
+		return -ENOMEM;
+
+	data->streams[0].stream_id = 0;
+	data->streams[0].stream_type = hdcp->content_type;
+
+	return 0;
+}
+
+void intel_mei_cldev_reference_notify(void *client,
+				      struct mei_cl_device *cldev)
+{
+	struct drm_i915_private *dev_priv = client;
+	struct drm_device *dev = &dev_priv->drm;
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+
+	DRM_INFO("MEI_HDCP Notification. Interface: %s\n",
+		  cldev ? "UP" : "Down");
+	dev_priv->mei_cldev = cldev;
+
+	drm_connector_list_iter_begin(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		intel_connector = to_intel_connector(connector);
+		if (!intel_connector->hdcp ||
+		    !(intel_connector->hdcp->plat_cap & HDCP2_CAPABILITY))
+			continue;
+		if (cldev)
+			initialize_mei_hdcp_data(intel_connector->hdcp);
+		else
+			intel_hdcp2_exit(intel_connector);
+	}
+	drm_connector_list_iter_end(&conn_iter);
+}
+
+static int intel_hdcp2_init(struct intel_hdcp *hdcp,
+			    const struct intel_hdcp2_shim *shim)
 {
+	struct intel_connector *connector = hdcp->connector;
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	int ret;
+
+	if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv) &&
+	    !IS_KABYLAKE(dev_priv))
+		return -EINVAL;
+
+	if (!dev_priv->mei_cldev && !dev_priv->mei_ref_cnt) {
+		ret = mei_hdcp_cldev_get_reference((void *)dev_priv,
+					&dev_priv->mei_cldev,
+					intel_mei_cldev_reference_notify);
+		if (ret < 0)
+			return ret;
+	}
+
+	dev_priv->mei_ref_cnt++;
+
+	hdcp->hdcp2_shim = shim;
+	hdcp->mei_hdcp_data = kzalloc(sizeof(struct mei_hdcp_data), GFP_KERNEL);
+	if (!hdcp->mei_hdcp_data) {
+		ret = -ENOMEM;
+		goto err_exit;
+	}
+
+	ret = initialize_mei_hdcp_data(hdcp);
+	if (ret)
+		goto err2_exit;
+
+	INIT_DELAYED_WORK(&hdcp->hdcp2_check_work, intel_hdcp2_check_work);
+	hdcp->plat_cap |= HDCP2_CAPABILITY;
+	return 0;
+
+err2_exit:
+	kfree(hdcp->mei_hdcp_data);
+err_exit:
+	if (!(--dev_priv->mei_ref_cnt)) {
+		mei_hdcp_cldev_put_reference(dev_priv->mei_cldev);
+		dev_priv->mei_cldev = NULL;
+	}
+	return ret;
+}
+
+static void intel_hdcp2_exit(struct intel_connector *connector)
+{
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+	struct intel_hdcp *hdcp = connector->hdcp;
+
+	intel_hdcp_disable(connector);
+
+	if (dev_priv->mei_cldev && !(--dev_priv->mei_ref_cnt)) {
+		mei_hdcp_cldev_put_reference(dev_priv->mei_cldev);
+		dev_priv->mei_cldev = NULL;
+	}
+
+	kfree(hdcp->mei_hdcp_data->streams);
+	kfree(hdcp->mei_hdcp_data);
+	hdcp->plat_cap &= ~HDCP2_CAPABILITY;
+}
+
+int intel_hdcp_init(struct intel_connector *connector,
+		    const struct intel_hdcp_shim *hdcp_shim,
+		    const struct intel_hdcp2_shim *hdcp2_shim)
+{
 	struct intel_hdcp *hdcp;
+	int ret;
+
+	if (!hdcp_shim && !hdcp2_shim)
+		return -EINVAL;
 
 	hdcp = kzalloc(sizeof(struct intel_hdcp), GFP_KERNEL);
 	if (!hdcp) {
@@ -750,6 +876,20 @@ int intel_hdcp_init(struct intel_connector *connector,
 		goto err;
 	}
 
+	hdcp->connector = connector;
+	if (hdcp_shim) {
+
+		/* Initialize HDCP1.4 */
+		INIT_DELAYED_WORK(&hdcp->hdcp_check_work,
+				  intel_hdcp_check_work);
+		hdcp->hdcp_shim = hdcp_shim;
+
+		hdcp->plat_cap |= HDCP_CAPABILITY;
+	}
+
+	if (hdcp2_shim)
+		intel_hdcp2_init(hdcp, hdcp2_shim);
+
 	ret = drm_connector_attach_content_protection_property(
 			&connector->base);
 	if (ret)
@@ -757,7 +897,6 @@ 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_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
 	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index f5d7bfb43006..23986c02dd41 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2342,7 +2342,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, NULL);
 		if (ret)
 			DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
 	}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 38/43] drm/i915: Implement gmbus burst read
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (36 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 39/43] drm/i915: Implement the HDCP2.2 support for DP Ramalingam C
                   ` (7 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements a interface for single burst read of data that is larger
than 512 Bytes through gmbus.

HDCP2.2 spec expects HDCP2.2 transmitter to read 522Bytes of HDCP
receiver certificates in single burst read. On gmbus, to read more
than 511Bytes, HW provides a workaround for burst read.

This patch passes the burst read request through gmbus read functions.
And implements the sequence of enabling and disabling the burst read.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  |   2 +
 drivers/gpu/drm/i915/i915_reg.h  |   3 +
 drivers/gpu/drm/i915/intel_i2c.c | 124 +++++++++++++++++++++++++++++++++------
 3 files changed, 112 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 09d31db90a38..9ec34a2d1cec 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3670,6 +3670,8 @@ extern void intel_teardown_gmbus(struct drm_i915_private *dev_priv);
 extern bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv,
 				     unsigned int pin);
 extern int intel_gmbus_output_aksv(struct i2c_adapter *adapter);
+extern int intel_gmbus_burst_read(struct i2c_adapter *adapter,
+				  unsigned int offset, void *buf, size_t size);
 
 extern struct i2c_adapter *
 intel_gmbus_get_adapter(struct drm_i915_private *dev_priv, unsigned int pin);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 6a57b12d8dab..f93c27fe779d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3227,6 +3227,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
@@ -3254,8 +3255,10 @@ enum i915_power_well_id {
 #define   GMBUS_CYCLE_WAIT	(1<<25)
 #define   GMBUS_CYCLE_INDEX	(2<<25)
 #define   GMBUS_CYCLE_STOP	(4<<25)
+#define   GMBUS_CYCLE_MASK	(7<<25)
 #define   GMBUS_BYTE_COUNT_SHIFT 16
 #define   GMBUS_BYTE_COUNT_MAX   256U
+#define   GMBUS_BYTE_COUNT_HW_MAX 511U
 #define   GMBUS_SLAVE_INDEX_SHIFT 8
 #define   GMBUS_SLAVE_ADDR_SHIFT 1
 #define   GMBUS_SLAVE_READ	(1<<0)
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index e6875509bcd9..5593322485fa 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -364,21 +364,30 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv)
 static int
 gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv,
 		      unsigned short addr, u8 *buf, unsigned int len,
-		      u32 gmbus1_index)
+		      u32 gmbus1_index, bool burst_read)
 {
+	unsigned int size = len;
+	int ret;
+
+	if (burst_read) {
+		/* Seq to enable Burst Read */
+		I915_WRITE_FW(GMBUS0, (I915_READ_FW(GMBUS0) |
+			      GMBUS_BYTE_CNT_OVERRIDE));
+		size = GMBUS_BYTE_COUNT_HW_MAX;
+	}
+
 	I915_WRITE_FW(GMBUS1,
 		      gmbus1_index |
 		      GMBUS_CYCLE_WAIT |
-		      (len << GMBUS_BYTE_COUNT_SHIFT) |
+		      (size << GMBUS_BYTE_COUNT_SHIFT) |
 		      (addr << GMBUS_SLAVE_ADDR_SHIFT) |
 		      GMBUS_SLAVE_READ | GMBUS_SW_RDY);
 	while (len) {
-		int ret;
 		u32 val, loop = 0;
 
 		ret = gmbus_wait(dev_priv, GMBUS_HW_RDY, GMBUS_HW_RDY_EN);
 		if (ret)
-			return ret;
+			goto exit;
 
 		val = I915_READ_FW(GMBUS3);
 		do {
@@ -387,12 +396,29 @@ gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv,
 		} while (--len && ++loop < 4);
 	}
 
-	return 0;
+exit:
+	if (burst_read) {
+
+		/* Seq to disable the Burst Read */
+		I915_WRITE_FW(GMBUS0,
+			(I915_READ_FW(GMBUS0) & ~GMBUS_BYTE_CNT_OVERRIDE));
+		I915_WRITE_FW(GMBUS1, (I915_READ_FW(GMBUS1) &
+					~GMBUS_CYCLE_MASK) | GMBUS_CYCLE_STOP);
+
+		/*
+		 * On Burst read disable, GMBUS need more time to settle
+		 * down to Idle State.
+		 */
+		ret = intel_wait_for_register_fw(dev_priv, GMBUS2,
+					GMBUS_ACTIVE, 0, 50);
+	}
+
+	return ret;
 }
 
 static int
 gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
-		u32 gmbus1_index)
+		u32 gmbus1_index, bool burst_read)
 {
 	u8 *buf = msg->buf;
 	unsigned int rx_size = msg->len;
@@ -400,10 +426,13 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
 	int ret;
 
 	do {
-		len = min(rx_size, GMBUS_BYTE_COUNT_MAX);
+		if (burst_read)
+			len = rx_size;
+		else
+			len = min(rx_size, GMBUS_BYTE_COUNT_MAX);
 
-		ret = gmbus_xfer_read_chunk(dev_priv, msg->addr,
-					    buf, len, gmbus1_index);
+		ret = gmbus_xfer_read_chunk(dev_priv, msg->addr, buf, len,
+					    gmbus1_index, burst_read);
 		if (ret)
 			return ret;
 
@@ -491,7 +520,8 @@ gmbus_is_index_xfer(struct i2c_msg *msgs, int i, int num)
 }
 
 static int
-gmbus_index_xfer(struct drm_i915_private *dev_priv, struct i2c_msg *msgs)
+gmbus_index_xfer(struct drm_i915_private *dev_priv, struct i2c_msg *msgs,
+		 bool burst_read)
 {
 	u32 gmbus1_index = 0;
 	u32 gmbus5 = 0;
@@ -509,7 +539,8 @@ gmbus_index_xfer(struct drm_i915_private *dev_priv, struct i2c_msg *msgs)
 		I915_WRITE_FW(GMBUS5, gmbus5);
 
 	if (msgs[1].flags & I2C_M_RD)
-		ret = gmbus_xfer_read(dev_priv, &msgs[1], gmbus1_index);
+		ret = gmbus_xfer_read(dev_priv, &msgs[1],
+				      gmbus1_index, burst_read);
 	else
 		ret = gmbus_xfer_write(dev_priv, &msgs[1], gmbus1_index);
 
@@ -522,7 +553,7 @@ gmbus_index_xfer(struct drm_i915_private *dev_priv, struct i2c_msg *msgs)
 
 static int
 do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num,
-	      u32 gmbus0_source)
+	      u32 gmbus0_source, bool burst_read)
 {
 	struct intel_gmbus *bus = container_of(adapter,
 					       struct intel_gmbus,
@@ -544,15 +575,20 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num,
 	for (; i < num; i += inc) {
 		inc = 1;
 		if (gmbus_is_index_xfer(msgs, i, num)) {
-			ret = gmbus_index_xfer(dev_priv, &msgs[i]);
+			ret = gmbus_index_xfer(dev_priv, &msgs[i], burst_read);
 			inc = 2; /* an index transmission is two msgs */
 		} else if (msgs[i].flags & I2C_M_RD) {
-			ret = gmbus_xfer_read(dev_priv, &msgs[i], 0);
+			ret = gmbus_xfer_read(dev_priv, &msgs[i],
+					      0, burst_read);
 		} else {
 			ret = gmbus_xfer_write(dev_priv, &msgs[i], 0);
 		}
 
-		if (!ret)
+		/*
+		 * Burst read Sequence ends with STOP. So Dont expect
+		 * HW wait phase.
+		 */
+		if (!ret && !burst_read)
 			ret = gmbus_wait(dev_priv,
 					 GMBUS_HW_WAIT_PHASE, GMBUS_HW_WAIT_EN);
 		if (ret == -ETIMEDOUT)
@@ -664,7 +700,7 @@ gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
 		if (ret < 0)
 			bus->force_bit &= ~GMBUS_FORCE_BIT_RETRY;
 	} else {
-		ret = do_gmbus_xfer(adapter, msgs, num, 0);
+		ret = do_gmbus_xfer(adapter, msgs, num, 0, false);
 		if (ret == -EAGAIN)
 			bus->force_bit |= GMBUS_FORCE_BIT_RETRY;
 	}
@@ -705,7 +741,8 @@ int intel_gmbus_output_aksv(struct i2c_adapter *adapter)
 	 * pass the i2c command, and tell GMBUS to use the HW-provided value
 	 * instead of sourcing GMBUS3 for the data.
 	 */
-	ret = do_gmbus_xfer(adapter, msgs, ARRAY_SIZE(msgs), GMBUS_AKSV_SELECT);
+	ret = do_gmbus_xfer(adapter, msgs, ARRAY_SIZE(msgs),
+			    GMBUS_AKSV_SELECT, false);
 
 	mutex_unlock(&dev_priv->gmbus_mutex);
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
@@ -713,6 +750,59 @@ int intel_gmbus_output_aksv(struct i2c_adapter *adapter)
 	return ret;
 }
 
+static inline
+bool intel_gmbus_burst_read_supported(struct drm_i915_private *dev_priv)
+{
+	if (INTEL_GEN(dev_priv) > 10 || IS_GEMINILAKE(dev_priv) ||
+	    IS_KABYLAKE(dev_priv))
+		return true;
+	return false;
+}
+
+int intel_gmbus_burst_read(struct i2c_adapter *adapter, unsigned int offset,
+			   void *buf, size_t size)
+{
+	struct intel_gmbus *bus = container_of(adapter, struct intel_gmbus,
+					       adapter);
+	struct drm_i915_private *dev_priv = bus->dev_priv;
+	int ret;
+	u8 start = offset & 0xff;
+	struct i2c_msg msgs[] = {
+		{
+			.addr = DRM_HDCP_DDC_ADDR,
+			.flags = 0,
+			.len = 1,
+			.buf = &start,
+		},
+		{
+			.addr = DRM_HDCP_DDC_ADDR,
+			.flags = I2C_M_RD,
+			.len = size,
+			.buf = buf,
+		}
+	};
+
+	if (!intel_gmbus_burst_read_supported(dev_priv))
+		return -EINVAL;
+
+	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+	mutex_lock(&dev_priv->gmbus_mutex);
+
+	/*
+	 * In order to read the complete length(More than GMBus Limit) of data,
+	 * in burst mode, implement the Workaround supported in HW.
+	 */
+	ret = do_gmbus_xfer(adapter, msgs, ARRAY_SIZE(msgs), 0, true);
+
+	mutex_unlock(&dev_priv->gmbus_mutex);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+
+	if (ret == ARRAY_SIZE(msgs))
+		return 0;
+
+	return ret >= 0 ? -EIO : ret;
+}
+
 static u32 gmbus_func(struct i2c_adapter *adapter)
 {
 	return i2c_bit_algo.functionality(adapter) &
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 39/43] drm/i915: Implement the HDCP2.2 support for DP
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (37 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 38/43] drm/i915: Implement gmbus burst read Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 40/43] drm/i915: Implement the HDCP2.2 support for HDMI Ramalingam C
                   ` (6 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements the DP adaptation specific HDCP2.2 functions
intel_hdcp2_shim.

These functions perform the DPCD read and write for communicating the
HDCP2.2 auth message back and forth.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 331 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 331 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 6f6b4c8e3a42..241777398359 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5303,6 +5303,337 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
 	.hdcp_capable = intel_dp_hdcp_capable,
 };
 
+static inline
+int intel_dpcd_offset_for_hdcp2_msgid(uint8_t byte, unsigned int *offset)
+{
+	switch (byte) {
+	case AKE_INIT:
+		*offset = DP_HDCP_2_2_AKE_INIT_OFFSET;
+		break;
+	case AKE_SEND_CERT:
+		*offset = DP_HDCP_2_2_AKE_SEND_CERT_OFFSET;
+		break;
+	case AKE_NO_STORED_KM:
+		*offset = DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET;
+		break;
+	case AKE_STORED_KM:
+		*offset = DP_HDCP_2_2_AKE_STORED_KM_OFFSET;
+		break;
+	case AKE_SEND_HPRIME:
+		*offset = DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET;
+		break;
+	case AKE_SEND_PARING_INFO:
+		*offset = DP_HDCP_2_2_AKE_SEND_PARING_INFO_OFFSET;
+		break;
+	case LC_INIT:
+		*offset = DP_HDCP_2_2_LC_INIT_OFFSET;
+		break;
+	case LC_SEND_LPRIME:
+		*offset = DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET;
+		break;
+	case SKE_SEND_EKS:
+		*offset = DP_HDCP_2_2_SKE_SEND_EKS_OFFSET;
+		break;
+	case REP_SEND_RECVID_LIST:
+		*offset = DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET;
+		break;
+	case REP_SEND_ACK:
+		*offset = DP_HDCP_2_2_REP_SEND_ACK_OFFSET;
+		break;
+	case REP_STREAM_MANAGE:
+		*offset = DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET;
+		break;
+	case REP_STREAM_READY:
+		*offset = DP_HDCP_2_2_REP_STREAM_READY_OFFSET;
+		break;
+	case 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,
+				union hdcp2_dp_rx_status *rx_status)
+{
+	ssize_t ret;
+
+	ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux,
+			       DP_HDCP_2_2_REG_RXSTATUS_OFFSET, rx_status,
+			       sizeof(union hdcp2_dp_rx_status));
+	if (ret != sizeof(union hdcp2_dp_rx_status)) {
+		DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret);
+		return ret >= 0 ? -EIO : ret;
+	}
+
+	return 0;
+}
+
+static inline
+int intel_dp_hdcp2_timeout_for_msg(uint8_t msg_id, bool paired)
+{
+	int timeout = -EINVAL;
+
+	switch (msg_id) {
+	case AKE_SEND_CERT:
+		timeout = HDCP_2_2_CERT_TIMEOUT;
+		break;
+	case AKE_SEND_HPRIME:
+		if (paired)
+			timeout = HDCP_2_2_HPRIME_PAIRED_TIMEOUT;
+		else
+			timeout = HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT;
+		break;
+	case AKE_SEND_PARING_INFO:
+		timeout = HDCP_2_2_PAIRING_TIMEOUT;
+		break;
+	case LC_SEND_LPRIME:
+		timeout = HDCP_2_2_DP_LPRIME_TIMEOUT;
+		break;
+	case REP_SEND_RECVID_LIST:
+		timeout = HDCP_2_2_RECVID_LIST_TIMEOUT;
+		break;
+	case REP_STREAM_READY:
+		timeout = HDCP_2_2_STREAM_READY_TIMEOUT;
+		break;
+	default:
+		DRM_ERROR("Unsupported msg_id: %d\n", (int)msg_id);
+	}
+	return timeout;
+}
+
+static inline
+int hdcp2_detect_msg_availability(struct intel_digital_port *intel_dig_port,
+				  uint8_t msg_id, bool *msg_ready)
+{
+	union hdcp2_dp_rx_status 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 AKE_SEND_HPRIME:
+		if (rx_status.fields.hprime_available)
+			*msg_ready = true;
+		break;
+	case AKE_SEND_PARING_INFO:
+		if (rx_status.fields.paring_available)
+			*msg_ready = true;
+		break;
+	case REP_SEND_RECVID_LIST:
+		if (rx_status.fields.ready)
+			*msg_ready = true;
+		break;
+	default:
+		DRM_DEBUG_KMS("Unidentified msg_id: %d\n", (int)msg_id);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+
+static inline 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 AKE_SEND_CERT:
+	case LC_SEND_LPRIME:
+	case REP_STREAM_READY:
+		mdelay(timeout);
+		ret = 0;
+		break;
+	case AKE_SEND_HPRIME:
+	case AKE_SEND_PARING_INFO:
+	case REP_SEND_RECVID_LIST:
+		wait_for_cp_irq(&hdcp->cp_irq_recved, 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 > DRM_HDCP_MAX_AUX_LEN ?
+				DRM_HDCP_MAX_AUX_LEN : 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;
+	union hdcp2_rx_info rx_info;
+	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 == REP_SEND_RECVID_LIST) {
+		ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux,
+				DP_HDCP_2_2_REG_RXINFO_OFFSET, (void *)&rx_info,
+				sizeof(union hdcp2_rx_info));
+		if (ret != sizeof(union hdcp2_rx_info))
+			return ret >= 0 ? -EIO : ret;
+
+		dev_cnt = (rx_info.fields.device_count_hi << 4 |
+				rx_info.fields.device_count_lo);
+
+		if (dev_cnt > HDCP_MAX_DEVICE_COUNT)
+			dev_cnt = HDCP_MAX_DEVICE_COUNT;
+
+		size = sizeof(struct hdcp2_rep_send_receiverid_list) -
+				HDCP_RECEIVER_IDS_MAX_LEN +
+				(dev_cnt * HDCP_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 > DRM_HDCP_MAX_AUX_LEN ?
+				DRM_HDCP_MAX_AUX_LEN : 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)
+{
+	union hdcp2_dp_rx_status rx_status;
+	int ret;
+
+	ret = intel_dp_hdcp2_read_rx_status(intel_dig_port, &rx_status);
+	if (ret)
+		return ret;
+
+	if (rx_status.fields.reauth_req)
+		ret = DRM_HDCP_REAUTH_REQUEST;
+	else if (rx_status.fields.Link_integrity_failure)
+		ret = DRM_HDCP_LINK_INTEGRITY_FAILURE;
+	else if (rx_status.fields.ready)
+		ret = DRM_HDCP_TOPOLOGY_CHANGE;
+
+	return ret;
+}
+
+static
+int intel_dp_hdcp2_capable(struct intel_digital_port *intel_dig_port,
+			   bool *capable)
+{
+	union hdcp2_rx_caps rx_caps;
+	int ret;
+
+	*capable = false;
+	ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux,
+			       DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
+			       &rx_caps, sizeof(rx_caps));
+	if (ret != sizeof(rx_caps))
+		return ret >= 0 ? -EIO : ret;
+
+	if (rx_caps.fields.version == HDCP_RXCAPS_VERSION_HDCP_2_2_VAL)
+		*capable = true;
+
+	return 0;
+}
+
+static
+enum hdcp_protocol intel_dp_hdcp2_protocol(void)
+{
+	return HDCP_PROTOCOL_DP;
+}
+
+static const struct intel_hdcp2_shim intel_dp_hdcp2_shim = {
+	.write_msg		= intel_dp_hdcp2_write_msg,
+	.read_msg		= intel_dp_hdcp2_read_msg,
+	.config_stream_type	= intel_dp_hdcp2_config_stream_type,
+	.check_link		= intel_dp_hdcp2_check_link,
+	.hdcp_capable		= intel_dp_hdcp2_capable,
+	.hdcp_protocol		= intel_dp_hdcp2_protocol,
+};
+
 static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 40/43] drm/i915: Implement the HDCP2.2 support for HDMI
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (38 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 39/43] drm/i915: Implement the HDCP2.2 support for DP Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 41/43] drm/i915: Add HDCP2.2 support for DP connectors Ramalingam C
                   ` (5 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Implements the HDMI adapatation specific HDCP2.2 operations
intel_hdcp2_shim.

Basically these are DDC read and write for authenticating through
HDCP2.2 messages.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 206 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 206 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 23986c02dd41..ac5a69f5aeaa 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1119,6 +1119,212 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = {
 	.check_link = intel_hdmi_hdcp_check_link,
 };
 
+static
+int intel_hdmi_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,
+				  union hdcp2_hdmi_rx_status *rx_status)
+{
+	return intel_hdmi_hdcp_read(intel_dig_port,
+				    HDMI_HDCP_2_2_REG_RXSTATUS_OFFSET,
+				    rx_status,
+				    sizeof(union hdcp2_hdmi_rx_status));
+}
+
+static inline
+int intel_hdmi_hdcp2_timeout_for_msg(uint8_t msg_id, bool is_paired)
+{
+	int timeout = -EINVAL;
+
+	switch (msg_id) {
+	case AKE_SEND_CERT:
+		timeout = HDCP_2_2_CERT_TIMEOUT;
+		break;
+	case AKE_SEND_HPRIME:
+		if (is_paired)
+			timeout = HDCP_2_2_HPRIME_PAIRED_TIMEOUT;
+		else
+			timeout = HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT;
+		break;
+	case AKE_SEND_PARING_INFO:
+		timeout = HDCP_2_2_PAIRING_TIMEOUT;
+		break;
+	case LC_SEND_LPRIME:
+		timeout = HDCP_2_2_HDMI_LPRIME_TIMEOUT;
+		break;
+	case REP_SEND_RECVID_LIST:
+		timeout = HDCP_2_2_RECVID_LIST_TIMEOUT;
+		break;
+	case REP_STREAM_READY:
+		timeout = HDCP_2_2_STREAM_READY_TIMEOUT;
+		break;
+	default:
+		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)
+{
+	union hdcp2_hdmi_rx_status rx_status;
+	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;
+	}
+
+	/* Big endian to Little endian */
+	rx_status.val = __swab16(rx_status.val);
+	*msg_sz =  rx_status.fields.msg_sz_hi << 8 | rx_status.fields.msg_sz_lo;
+
+	if (msg_id == REP_SEND_RECVID_LIST)
+		*msg_ready = (rx_status.fields.ready && msg_sz);
+	else
+		*msg_ready = *msg_sz;
+
+	return 0;
+}
+
+/**
+ * intel_hdmi_hdcp2_wait_for_msg: Detects the hdmi hdcp2.2 msg availability
+ * @hdcp:	hdcp structure
+ * @msg_id:	Message ID for which we are waiting
+ *
+ * Detects the HDMI HDCP2.2 Message availability
+ *
+ * Returns -ETIMEOUT in case of timeout, Message Size on success
+ */
+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 = HDMI_HDCP_2_2_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;
+	struct drm_i915_private *dev_priv;
+	struct i2c_adapter *adapter;
+	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 = HDMI_HDCP_2_2_REG_RD_MSG_OFFSET;
+
+	if (msg_id == AKE_SEND_CERT) {
+		dev_priv = intel_dig_port->base.base.dev->dev_private;
+		adapter = intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
+
+		ret = intel_gmbus_burst_read(adapter, offset, buf, ret);
+	} else {
+		ret = intel_hdmi_hdcp_read(intel_dig_port, offset, buf, ret);
+	}
+
+	if (ret)
+		DRM_DEBUG_KMS("msg_id: %d, ret: %d\n", msg_id, (int)ret);
+	return ret;
+}
+
+static
+int intel_hdmi_hdcp2_check_link(struct intel_digital_port *intel_dig_port)
+{
+	union hdcp2_hdmi_rx_status rx_status;
+	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 (rx_status.fields.reauth_req)
+		ret = DRM_HDCP_REAUTH_REQUEST;
+	else if (rx_status.fields.ready)
+		ret = DRM_HDCP_TOPOLOGY_CHANGE;
+
+	return ret;
+}
+
+static
+int intel_hdmi_hdcp2_capable(struct intel_digital_port *intel_dig_port,
+			     bool *capable)
+{
+	uint8_t hdcp2version;
+	int ret;
+
+	*capable = false;
+	ret = intel_hdmi_hdcp_read(intel_dig_port, HDMI_HDCP_2_2_REG_VER_OFFSET,
+				   &hdcp2version, sizeof(hdcp2version));
+	if (!ret)
+		if (hdcp2version & HDMI_HDCP_2_2_SUPPORT_MASK)
+			*capable = true;
+
+	return ret;
+}
+
+static
+enum hdcp_protocol intel_hdmi_hdcp2_protocol(void)
+{
+	return HDCP_PROTOCOL_HDMI;
+}
+
+static const struct intel_hdcp2_shim intel_hdmi_hdcp2_shim = {
+	.write_msg		= intel_hdmi_hdcp2_write_msg,
+	.read_msg		= intel_hdmi_hdcp2_read_msg,
+	.toggle_signalling	= intel_hdmi_hdcp_toggle_signalling,
+	.check_link		= intel_hdmi_hdcp2_check_link,
+	.hdcp_capable		= intel_hdmi_hdcp2_capable,
+	.hdcp_protocol		= intel_hdmi_hdcp2_protocol,
+};
+
 static void intel_hdmi_prepare(struct intel_encoder *encoder,
 			       const struct intel_crtc_state *crtc_state)
 {
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 41/43] drm/i915: Add HDCP2.2 support for DP connectors
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (39 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 40/43] drm/i915: Implement the HDCP2.2 support for HDMI Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 42/43] drm/i915: Add HDCP2.2 support for HDMI connectors Ramalingam C
                   ` (4 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Initializes the DP HDCP2.2 shim with HDCP stack. With this HDCP2.2
will be initialized for intel DP connectors.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 241777398359..ec929b1ff0ae 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -6795,7 +6795,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,
-					  NULL);
+					  &intel_dp_hdcp2_shim);
 		if (ret)
 			DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
 	}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 42/43] drm/i915: Add HDCP2.2 support for HDMI connectors
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (40 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 41/43] drm/i915: Add HDCP2.2 support for DP connectors Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 14:13 ` [PATCH 43/43] drm/i915: Invoke check link on CP_IRQ of DP Ramalingam C
                   ` (3 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

Initializes the HDMI HDCP2.2 shim with HDCP stack. With this HDCP2.2
will be initialized for intel HDMI connectors.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index ac5a69f5aeaa..487006c3f406 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2548,7 +2548,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, NULL);
+					  &intel_hdmi_hdcp_shim,
+					  &intel_hdmi_hdcp2_shim);
 		if (ret)
 			DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
 	}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 43/43] drm/i915: Invoke check link on CP_IRQ of DP
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (41 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 42/43] drm/i915: Add HDCP2.2 support for HDMI connectors Ramalingam C
@ 2018-02-14 14:13 ` Ramalingam C
  2018-02-14 15:07 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Implement HDCP2.2 Patchwork
                   ` (2 subsequent siblings)
  45 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:13 UTC (permalink / raw)
  To: seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter; +Cc: tomas.winkler

On DP HDCP1.4 and 2.2, when CP_IRQ is received, start the link
integrity check for the HDCP version that is enabled.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c   |  9 +++------
 drivers/gpu/drm/i915/intel_drv.h  |  2 +-
 drivers/gpu/drm/i915/intel_hdcp.c | 11 ++++++++++-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index ec929b1ff0ae..46e1a0cce2d5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4438,8 +4438,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) {
-			if (connector->hdcp)
+			if (connector->hdcp) {
+				intel_hdcp_cp_irq_received(connector);
 				complete(&connector->hdcp->cp_irq_recved);
+			}
 		}
 
 		if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
@@ -5799,11 +5801,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 		drm_modeset_acquire_fini(&ctx);
 		WARN(iret, "Acquiring modeset locks failed with %i\n", iret);
 
-		/* Short pulse can signify loss of hdcp authentication */
-		if (intel_dp->attached_connector->hdcp)
-			intel_hdcp_check_link(
-					intel_dp->attached_connector->hdcp);
-
 		if (!handled) {
 			intel_dp->detect_done = false;
 			goto put_power;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 842a22502763..4b5fd92c115e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1954,8 +1954,8 @@ int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp2_shim *hdcp2_shim);
 int intel_hdcp_enable(struct intel_connector *connector);
 int intel_hdcp_disable(struct intel_connector *connector);
-int intel_hdcp_check_link(struct intel_hdcp *hdcp);
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
+void intel_hdcp_cp_irq_received(struct intel_connector *connector);
 
 /* intel_psr.c */
 #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index bb56e4e595d8..ab482082c5e4 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -27,6 +27,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
 static void intel_hdcp2_check_work(struct work_struct *work);
 static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
 static void intel_hdcp2_exit(struct intel_connector *connector);
+static int intel_hdcp_check_link(struct intel_hdcp *hdcp);
 
 static inline bool intel_hdcp1_supported(struct intel_hdcp *hdcp)
 {
@@ -1024,7 +1025,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_hdcp *hdcp)
+static int intel_hdcp_check_link(struct intel_hdcp *hdcp)
 {
 	struct intel_connector *connector = hdcp->connector;
 	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
@@ -1789,3 +1790,11 @@ static int intel_hdcp2_check_link(struct intel_hdcp *hdcp)
 	mutex_unlock(&hdcp->hdcp_mutex);
 	return ret;
 }
+
+void intel_hdcp_cp_irq_received(struct intel_connector *connector)
+{
+	if (intel_hdcp_in_force(connector->hdcp))
+		intel_hdcp_check_link(connector->hdcp);
+	else if (intel_hdcp2_in_force(connector->hdcp))
+		intel_hdcp2_check_link(connector->hdcp);
+}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* Re: [PATCH 25/43] drm/i915: Define HDCP2.2 related variables
  2018-02-14 14:13 ` [PATCH 25/43] drm/i915: Define HDCP2.2 related variables Ramalingam C
@ 2018-02-14 14:36   ` Chris Wilson
  2018-02-14 14:56     ` Ramalingam C
  2018-02-22 14:59   ` Sean Paul
  1 sibling, 1 reply; 79+ messages in thread
From: Chris Wilson @ 2018-02-14 14:36 UTC (permalink / raw)
  To: Ramalingam C, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler

Quoting Ramalingam C (2018-02-14 14:13:40)
> For upcoming implementation of HDCP2.2 in I915, all variable required
> for HDCP2.2 are defined.
> 
> This includes a translation layer called hdcp2_shim for encoder
> specific HDCP2.2 spec deviations.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h  |  5 +++
>  drivers/gpu/drm/i915/intel_drv.h | 91 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 96 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3f8d824dc313..09d31db90a38 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -44,6 +44,7 @@
>  #include <linux/pm_qos.h>
>  #include <linux/reservation.h>
>  #include <linux/shmem_fs.h>
> +#include <linux/mei_hdcp.h>

Why? You only want a forward decl for struct mei_cl_device.

>  #include <drm/drmP.h>
>  #include <drm/intel-gtt.h>
> @@ -2365,6 +2366,10 @@ struct drm_i915_private {
>  
>         struct i915_pmu pmu;
>  
> +       /* Mei interface handle */
> +       struct mei_cl_device *mei_cldev;
> +       int mei_ref_cnt;

This isn't used in this patch, which makes it very hard to verify. At
first glance, I don't buy that mei_ref_cnt is properly protected.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption
  2018-02-14 14:13 ` [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption Ramalingam C
@ 2018-02-14 14:38   ` Chris Wilson
  2018-02-14 14:52     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Chris Wilson @ 2018-02-14 14:38 UTC (permalink / raw)
  To: Ramalingam C, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler

Quoting Ramalingam C (2018-02-14 14:13:45)
> Implements the enable and disable functions for HDCP2.2 encryption
> of the PORT.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 50 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 0cd637dd3f6b..6a0506cdefd5 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -20,6 +20,7 @@
>                                          (enum physical_port) (port))
>  #define KEY_LOAD_TRIES 5
>  #define HDCP2_LC_RETRY_CNT             3
> +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32
>  
>  static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
>                                     const struct intel_hdcp_shim *shim)
> @@ -1336,3 +1337,52 @@ static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
>  
>         return ret;
>  }
> +
> +static int hdcp2_enable_encryption(struct intel_hdcp *hdcp)
> +{
> +       struct intel_digital_port *intel_dig_port =
> +                                       conn_to_dig_port(hdcp->connector);
> +       struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
> +       enum port port = hdcp->connector->encoder->port;
> +       int ret;
> +
> +       if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS)
> +               return 0;
> +
> +       if (hdcp->hdcp2_shim->toggle_signalling)
> +               hdcp->hdcp2_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_CTR_DDI(port),
> +                          I915_READ(HDCP2_CTR_DDI(port)) |
> +                          CTL_LINK_ENCRYPTION_REQ);
> +       }
> +
> +       ret = wait_for(I915_READ(HDCP2_STATUS_DDI(port)) &
> +                      LINK_ENCRYPTION_STATUS, TIME_FOR_ENCRYPT_STATUS_CHANGE);

Both of these wait_for are intel_wait_for_register. As a rule of thumb
avoid new (and definitely not repeated) use of wait_for().
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 35/43] drm/i915: Enable HDCP version that is best capable
  2018-02-14 14:13 ` [PATCH 35/43] drm/i915: Enable HDCP version that is best capable Ramalingam C
@ 2018-02-14 14:42   ` Chris Wilson
  2018-02-14 14:51     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Chris Wilson @ 2018-02-14 14:42 UTC (permalink / raw)
  To: Ramalingam C, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler

Quoting Ramalingam C (2018-02-14 14:13:50)
> hdcp_enable_work is extended to choose the better hdcp version based
> on the system and panel capability.
> 
> And intel_hdcp_disable will find the version that is inforce, if any.
> And corresponding version specific disable function alone called.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 112 ++++++++++++++++++++++++++++++++++----
>  1 file changed, 100 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 69ae47eaff49..2fe73f7eb6dd 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -27,6 +27,43 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
>  static void intel_hdcp2_check_work(struct work_struct *work);
>  static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
>  
> +static inline bool intel_hdcp1_supported(struct intel_hdcp *hdcp)
> +{
> +       return (hdcp->plat_cap & HDCP_CAPABILITY &&
> +               hdcp->panel_cap & HDCP_CAPABILITY);
> +}
> +
> +static inline bool intel_hdcp2_supported(struct intel_hdcp *hdcp)
> +{
> +       return (hdcp->plat_cap & HDCP2_CAPABILITY &&
> +               hdcp->panel_cap & HDCP2_CAPABILITY);
> +}
> +
> +static inline bool intel_hdcp_in_force(struct intel_hdcp *hdcp)
> +{
> +       struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
> +       enum port port = hdcp->connector->encoder->port;
> +       u32 reg;
> +
> +       reg = I915_READ(PORT_HDCP_STATUS(port));
> +       if (reg & HDCP_STATUS_AUTH || reg & HDCP_STATUS_ENC)
> +               return true;
> +       return false;

return reg & (HDCP_STATUS_AUTH | HDCP_STATUS_ENC);

> +
> +}
> +
> +static inline bool intel_hdcp2_in_force(struct intel_hdcp *hdcp)
> +{
> +       struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
> +       enum port port = hdcp->connector->encoder->port;
> +       u32 reg;
> +
> +       reg = I915_READ(HDCP2_STATUS_DDI(port));
> +       if (reg & LINK_ENCRYPTION_STATUS || reg & LINK_AUTH_STATUS)
> +               return true;
> +       return false;

return reg & (LINK_ENCRYPTION_STATUS | LINK_AUTH_STATUS);

> @@ -1437,7 +1525,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
>  {
>         int ret;
>  
> -       DRM_ERROR("[%s:%d] HDCP2.2 is being Disabled\n",
> +       DRM_INFO("[%s:%d] HDCP2.2 is being Disabled\n",
>                   hdcp->connector->base.name, hdcp->connector->base.base.id);

Will there be a third patch making this DEBUG_KMS?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 04/43] mei: me: add gemini lake devices ids
  2018-02-14 14:13 ` [PATCH 04/43] mei: me: add gemini lake devices ids Ramalingam C
@ 2018-02-14 14:45   ` Winkler, Tomas
  2018-02-22  5:22     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Winkler, Tomas @ 2018-02-14 14:45 UTC (permalink / raw)
  To: C, Ramalingam, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter

This one is already upstream 
Thanks
Tomas


> 
> From: Tomas Winkler <tomas.winkler@intel.com>
> 
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/misc/mei/hw-me-regs.h | 2 ++
>  drivers/misc/mei/pci-me.c     | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
> index 0ccccbaf530d..5a36ca403a24 100644
> --- a/drivers/misc/mei/hw-me-regs.h
> +++ b/drivers/misc/mei/hw-me-regs.h
> @@ -132,6 +132,8 @@
>  #define MEI_DEV_ID_KBP        0xA2BA  /* Kaby Point */
>  #define MEI_DEV_ID_KBP_2      0xA2BB  /* Kaby Point 2 */
> 
> +#define MEI_DEV_ID_GLK        0x319A  /* Gemini Lake */
> +
>  /*
>   * MEI HW Section
>   */
> diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index
> 4a0ccda4d04b..fe44ac2a9b2d 100644
> --- a/drivers/misc/mei/pci-me.c
> +++ b/drivers/misc/mei/pci-me.c
> @@ -98,6 +98,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
>  	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)},
>  	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, MEI_ME_PCH8_CFG)},
> 
> +	{MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)},
> +
>  	/* required last entry */
>  	{0, }
>  };
> --
> 2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface
  2018-02-14 14:13 ` [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface Ramalingam C
@ 2018-02-14 14:45   ` Chris Wilson
  2018-02-14 14:45     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Chris Wilson @ 2018-02-14 14:45 UTC (permalink / raw)
  To: Ramalingam C, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler

Quoting Ramalingam C (2018-02-14 14:13:52)
> Implements the init and exit for hdcp2.2 support. This includes the
> mei interface initialization also.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
> +static int intel_hdcp2_init(struct intel_hdcp *hdcp,
> +                           const struct intel_hdcp2_shim *shim)
>  {
> +       struct intel_connector *connector = hdcp->connector;
> +       struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>         int ret;
> +
> +       if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv) &&
> +           !IS_KABYLAKE(dev_priv))
> +               return -EINVAL;
> +
> +       if (!dev_priv->mei_cldev && !dev_priv->mei_ref_cnt) {
> +               ret = mei_hdcp_cldev_get_reference((void *)dev_priv,
> +                                       &dev_priv->mei_cldev,
> +                                       intel_mei_cldev_reference_notify);
> +               if (ret < 0)
> +                       return ret;
> +       }
> +
> +       dev_priv->mei_ref_cnt++;

So this is more or less unprotected? As there need not be any
serialisation between the construction of two connectors.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface
  2018-02-14 14:45   ` Chris Wilson
@ 2018-02-14 14:45     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:45 UTC (permalink / raw)
  To: Chris Wilson, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler



On Wednesday 14 February 2018 08:15 PM, Chris Wilson wrote:
> Quoting Ramalingam C (2018-02-14 14:13:52)
>> Implements the init and exit for hdcp2.2 support. This includes the
>> mei interface initialization also.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>> +static int intel_hdcp2_init(struct intel_hdcp *hdcp,
>> +                           const struct intel_hdcp2_shim *shim)
>>   {
>> +       struct intel_connector *connector = hdcp->connector;
>> +       struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>>          int ret;
>> +
>> +       if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv) &&
>> +           !IS_KABYLAKE(dev_priv))
>> +               return -EINVAL;
>> +
>> +       if (!dev_priv->mei_cldev && !dev_priv->mei_ref_cnt) {
>> +               ret = mei_hdcp_cldev_get_reference((void *)dev_priv,
>> +                                       &dev_priv->mei_cldev,
>> +                                       intel_mei_cldev_reference_notify);
>> +               if (ret < 0)
>> +                       return ret;
>> +       }
>> +
>> +       dev_priv->mei_ref_cnt++;
> So this is more or less unprotected? As there need not be any
> serialisation between the construction of two connectors.
> -Chris
yes. sorry for missing it. I will address it. Might need a lock in 
I915_priv.

-Ram

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 35/43] drm/i915: Enable HDCP version that is best capable
  2018-02-14 14:42   ` Chris Wilson
@ 2018-02-14 14:51     ` Ramalingam C
  2018-02-14 15:00       ` Chris Wilson
  0 siblings, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:51 UTC (permalink / raw)
  To: Chris Wilson, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler



On Wednesday 14 February 2018 08:12 PM, Chris Wilson wrote:
> Quoting Ramalingam C (2018-02-14 14:13:50)
>> hdcp_enable_work is extended to choose the better hdcp version based
>> on the system and panel capability.
>>
>> And intel_hdcp_disable will find the version that is inforce, if any.
>> And corresponding version specific disable function alone called.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_hdcp.c | 112 ++++++++++++++++++++++++++++++++++----
>>   1 file changed, 100 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index 69ae47eaff49..2fe73f7eb6dd 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -27,6 +27,43 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
>>   static void intel_hdcp2_check_work(struct work_struct *work);
>>   static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
>>   
>> +static inline bool intel_hdcp1_supported(struct intel_hdcp *hdcp)
>> +{
>> +       return (hdcp->plat_cap & HDCP_CAPABILITY &&
>> +               hdcp->panel_cap & HDCP_CAPABILITY);
>> +}
>> +
>> +static inline bool intel_hdcp2_supported(struct intel_hdcp *hdcp)
>> +{
>> +       return (hdcp->plat_cap & HDCP2_CAPABILITY &&
>> +               hdcp->panel_cap & HDCP2_CAPABILITY);
>> +}
>> +
>> +static inline bool intel_hdcp_in_force(struct intel_hdcp *hdcp)
>> +{
>> +       struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
>> +       enum port port = hdcp->connector->encoder->port;
>> +       u32 reg;
>> +
>> +       reg = I915_READ(PORT_HDCP_STATUS(port));
>> +       if (reg & HDCP_STATUS_AUTH || reg & HDCP_STATUS_ENC)
>> +               return true;
>> +       return false;
> return reg & (HDCP_STATUS_AUTH | HDCP_STATUS_ENC);
>
>> +
>> +}
>> +
>> +static inline bool intel_hdcp2_in_force(struct intel_hdcp *hdcp)
>> +{
>> +       struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
>> +       enum port port = hdcp->connector->encoder->port;
>> +       u32 reg;
>> +
>> +       reg = I915_READ(HDCP2_STATUS_DDI(port));
>> +       if (reg & LINK_ENCRYPTION_STATUS || reg & LINK_AUTH_STATUS)
>> +               return true;
>> +       return false;
> return reg & (LINK_ENCRYPTION_STATUS | LINK_AUTH_STATUS);
>
>> @@ -1437,7 +1525,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
>>   {
>>          int ret;
>>   
>> -       DRM_ERROR("[%s:%d] HDCP2.2 is being Disabled\n",
>> +       DRM_INFO("[%s:%d] HDCP2.2 is being Disabled\n",
>>                    hdcp->connector->base.name, hdcp->connector->base.base.id);
> Will there be a third patch making this DEBUG_KMS?
> -Chris
Thanks Chris!

Will address these comments. No, I feel its could to have DRM_INFO for 
state transition logs.
In practical HDCP logs will not be that frequent. If needed I will 
change them into DEBUG in upcoming versions :)

--Ram

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption
  2018-02-14 14:38   ` Chris Wilson
@ 2018-02-14 14:52     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:52 UTC (permalink / raw)
  To: Chris Wilson, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler



On Wednesday 14 February 2018 08:08 PM, Chris Wilson wrote:
> Quoting Ramalingam C (2018-02-14 14:13:45)
>> Implements the enable and disable functions for HDCP2.2 encryption
>> of the PORT.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_hdcp.c | 50 +++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 50 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index 0cd637dd3f6b..6a0506cdefd5 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -20,6 +20,7 @@
>>                                           (enum physical_port) (port))
>>   #define KEY_LOAD_TRIES 5
>>   #define HDCP2_LC_RETRY_CNT             3
>> +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32
>>   
>>   static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
>>                                      const struct intel_hdcp_shim *shim)
>> @@ -1336,3 +1337,52 @@ static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
>>   
>>          return ret;
>>   }
>> +
>> +static int hdcp2_enable_encryption(struct intel_hdcp *hdcp)
>> +{
>> +       struct intel_digital_port *intel_dig_port =
>> +                                       conn_to_dig_port(hdcp->connector);
>> +       struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
>> +       enum port port = hdcp->connector->encoder->port;
>> +       int ret;
>> +
>> +       if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS)
>> +               return 0;
>> +
>> +       if (hdcp->hdcp2_shim->toggle_signalling)
>> +               hdcp->hdcp2_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_CTR_DDI(port),
>> +                          I915_READ(HDCP2_CTR_DDI(port)) |
>> +                          CTL_LINK_ENCRYPTION_REQ);
>> +       }
>> +
>> +       ret = wait_for(I915_READ(HDCP2_STATUS_DDI(port)) &
>> +                      LINK_ENCRYPTION_STATUS, TIME_FOR_ENCRYPT_STATUS_CHANGE);
> Both of these wait_for are intel_wait_for_register. As a rule of thumb
> avoid new (and definitely not repeated) use of wait_for().
> -Chris
I will change them into intel_wait_for_register.

Thanks
--Ram

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application
  2018-02-14 14:13 ` [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application Ramalingam C
@ 2018-02-14 14:54   ` Winkler, Tomas
  2018-02-14 14:57     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Winkler, Tomas @ 2018-02-14 14:54 UTC (permalink / raw)
  To: C, Ramalingam, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter


> 
> ME 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.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/misc/mei/mei_hdcp.c | 80
> +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/misc/mei/mei_hdcp.h | 32 ++++++++++++++++++
>  2 files changed, 112 insertions(+)
>  create mode 100644 drivers/misc/mei/mei_hdcp.c  create mode 100644
> drivers/misc/mei/mei_hdcp.h
> 
> diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c new
> file mode 100644 index 000000000000..aa211763e520
> --- /dev/null
> +++ b/drivers/misc/mei/mei_hdcp.c

This should go under 'drivers/misc/mei/hdcp/' we don't want more code directly under mei 


> @@ -0,0 +1,80 @@
> +/*
> + * Copyright © 2017 Intel Corporation
> + *
> + * Mei_hdcp.c: client driver for mei bus driver
> + *
> + * 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 <ramalingam.c@intel.com>
> + */
> +
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/uuid.h>
> +
> +#include "mei_hdcp.h"
> +
> +struct mei_hdcp mei_hdcp;
> +
> +static int mei_hdcp_probe(struct mei_cl_device *cldev,
> +			  const struct mei_cl_device_id *id) {
> +	int ret;
> +
> +	mei_hdcp.cldev = cldev;
> +	mei_cldev_set_drvdata(cldev, &mei_hdcp);
> +
> +	ret = mei_cldev_enable(cldev);
> +	if (ret < 0)
> +		dev_err(&cldev->dev, "mei_cldev_enable Failed. %d\n", ret);
> +
> +	return ret;
> +}
> +
> +static int mei_hdcp_remove(struct mei_cl_device *cldev) {
> +	mei_cldev_disable(cldev);
> +	return 0;
> +}
> +
> +#define WIDI_HECI_CLIENT_GUID	UUID_LE(0xB638AB7E, 0x94E2,
> 0x4EA2, 0xA5, \
> +					0x52, 0xD1, 0xC5, 0x4B, \
> +					0x62, 0x7F, 0x04)
> +#define MEI_HDCP2_2_UUID	WIDI_HECI_CLIENT_GUID
> +
> +static struct mei_cl_device_id mei_hdcp_tbl[] = {
> +	{ .uuid = MEI_HDCP2_2_UUID, .version = MEI_CL_VERSION_ANY },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
> +
> +static struct mei_cl_driver mei_hdcp_driver = {
> +	.id_table	= mei_hdcp_tbl,
> +	.name		= KBUILD_MODNAME,
> +	.probe		= mei_hdcp_probe,
> +	.remove		= mei_hdcp_remove,
> +};
> +
> +module_mei_cl_driver(mei_hdcp_driver);
> +
> +MODULE_AUTHOR("Intel Corporation");
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("HDCP");
> diff --git a/drivers/misc/mei/mei_hdcp.h b/drivers/misc/mei/mei_hdcp.h
> new file mode 100644 index 000000000000..c06c0d767c4f
> --- /dev/null
> +++ b/drivers/misc/mei/mei_hdcp.h
> @@ -0,0 +1,32 @@
> +/*
> + * Copyright (c) 2017 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.
> + */
> +#ifndef __MEI_HDCP_H__
> +#define __MEI_HDCP_H__
> +
> +#include <linux/mei_cl_bus.h>
> +
> +struct mei_hdcp {
> +	struct mei_cl_device *cldev;
> +};
> +
> +#endif /* __MEI_HDCP_H__ */
> --
> 2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver
  2018-02-14 14:13 ` [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver Ramalingam C
@ 2018-02-14 14:54   ` Winkler, Tomas
  2018-02-14 14:58     ` Ramalingam C
  2018-02-28 15:43     ` Ramalingam C
  0 siblings, 2 replies; 79+ messages in thread
From: Winkler, Tomas @ 2018-02-14 14:54 UTC (permalink / raw)
  To: C, Ramalingam, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter

> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/misc/mei/Kconfig  | 6 ++++++
>  drivers/misc/mei/Makefile | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig index
> c49e1d2269af..90977132d1e2 100644
> --- a/drivers/misc/mei/Kconfig
> +++ b/drivers/misc/mei/Kconfig
> @@ -43,3 +43,9 @@ config INTEL_MEI_TXE
> 
>  	  Supported SoCs:
>  	  Intel Bay Trail
> +
> +config INTEL_MEI_HDCP
> +	tristate "Intel HDCP2.2 services of ME Interface"
> +	depends on INTEL_MEI && DRM_I915
> +	help
> +	  MEI Support for HDCP2.2 Services on Intel SoCs.
> diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile index
> cd6825afa8e1..ee19754c1aec 100644
> --- a/drivers/misc/mei/Makefile
> +++ b/drivers/misc/mei/Makefile
> @@ -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) += mei_hdcp.o

Should go to the separate directory. 
Thanks
Tomas

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 25/43] drm/i915: Define HDCP2.2 related variables
  2018-02-14 14:36   ` Chris Wilson
@ 2018-02-14 14:56     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:56 UTC (permalink / raw)
  To: Chris Wilson, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler



On Wednesday 14 February 2018 08:06 PM, Chris Wilson wrote:
> Quoting Ramalingam C (2018-02-14 14:13:40)
>> For upcoming implementation of HDCP2.2 in I915, all variable required
>> for HDCP2.2 are defined.
>>
>> This includes a translation layer called hdcp2_shim for encoder
>> specific HDCP2.2 spec deviations.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_drv.h  |  5 +++
>>   drivers/gpu/drm/i915/intel_drv.h | 91 ++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 96 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index 3f8d824dc313..09d31db90a38 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -44,6 +44,7 @@
>>   #include <linux/pm_qos.h>
>>   #include <linux/reservation.h>
>>   #include <linux/shmem_fs.h>
>> +#include <linux/mei_hdcp.h>
> Why? You only want a forward decl for struct mei_cl_device.
>
>>   #include <drm/drmP.h>
>>   #include <drm/intel-gtt.h>
>> @@ -2365,6 +2366,10 @@ struct drm_i915_private {
>>   
>>          struct i915_pmu pmu;
>>   
>> +       /* Mei interface handle */
>> +       struct mei_cl_device *mei_cldev;
>> +       int mei_ref_cnt;
> This isn't used in this patch, which makes it very hard to verify. At
> first glance, I don't buy that mei_ref_cnt is properly protected.
> -Chris
We need to protect the count. Thanks for finding the miss. will fix it.
thanks
--Ram

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application
  2018-02-14 14:54   ` Winkler, Tomas
@ 2018-02-14 14:57     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:57 UTC (permalink / raw)
  To: Winkler, Tomas, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter



On Wednesday 14 February 2018 08:24 PM, Winkler, Tomas wrote:
>> ME 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.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
>> ---
>>   drivers/misc/mei/mei_hdcp.c | 80
>> +++++++++++++++++++++++++++++++++++++++++++++
>>   drivers/misc/mei/mei_hdcp.h | 32 ++++++++++++++++++
>>   2 files changed, 112 insertions(+)
>>   create mode 100644 drivers/misc/mei/mei_hdcp.c  create mode 100644
>> drivers/misc/mei/mei_hdcp.h
>>
>> diff --git a/drivers/misc/mei/mei_hdcp.c b/drivers/misc/mei/mei_hdcp.c new
>> file mode 100644 index 000000000000..aa211763e520
>> --- /dev/null
>> +++ b/drivers/misc/mei/mei_hdcp.c
> This should go under 'drivers/misc/mei/hdcp/' we don't want more code directly under mei
Thanks for the review Tomas.
Sure I will move it.

--Ram
>
>
>> @@ -0,0 +1,80 @@
>> +/*
>> + * Copyright © 2017 Intel Corporation
>> + *
>> + * Mei_hdcp.c: client driver for mei bus driver
>> + *
>> + * 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 <ramalingam.c@intel.com>
>> + */
>> +
>> +#include <linux/module.h>
>> +#include <linux/slab.h>
>> +#include <linux/uuid.h>
>> +
>> +#include "mei_hdcp.h"
>> +
>> +struct mei_hdcp mei_hdcp;
>> +
>> +static int mei_hdcp_probe(struct mei_cl_device *cldev,
>> +			  const struct mei_cl_device_id *id) {
>> +	int ret;
>> +
>> +	mei_hdcp.cldev = cldev;
>> +	mei_cldev_set_drvdata(cldev, &mei_hdcp);
>> +
>> +	ret = mei_cldev_enable(cldev);
>> +	if (ret < 0)
>> +		dev_err(&cldev->dev, "mei_cldev_enable Failed. %d\n", ret);
>> +
>> +	return ret;
>> +}
>> +
>> +static int mei_hdcp_remove(struct mei_cl_device *cldev) {
>> +	mei_cldev_disable(cldev);
>> +	return 0;
>> +}
>> +
>> +#define WIDI_HECI_CLIENT_GUID	UUID_LE(0xB638AB7E, 0x94E2,
>> 0x4EA2, 0xA5, \
>> +					0x52, 0xD1, 0xC5, 0x4B, \
>> +					0x62, 0x7F, 0x04)
>> +#define MEI_HDCP2_2_UUID	WIDI_HECI_CLIENT_GUID
>> +
>> +static struct mei_cl_device_id mei_hdcp_tbl[] = {
>> +	{ .uuid = MEI_HDCP2_2_UUID, .version = MEI_CL_VERSION_ANY },
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
>> +
>> +static struct mei_cl_driver mei_hdcp_driver = {
>> +	.id_table	= mei_hdcp_tbl,
>> +	.name		= KBUILD_MODNAME,
>> +	.probe		= mei_hdcp_probe,
>> +	.remove		= mei_hdcp_remove,
>> +};
>> +
>> +module_mei_cl_driver(mei_hdcp_driver);
>> +
>> +MODULE_AUTHOR("Intel Corporation");
>> +MODULE_LICENSE("GPL");
>> +MODULE_DESCRIPTION("HDCP");
>> diff --git a/drivers/misc/mei/mei_hdcp.h b/drivers/misc/mei/mei_hdcp.h
>> new file mode 100644 index 000000000000..c06c0d767c4f
>> --- /dev/null
>> +++ b/drivers/misc/mei/mei_hdcp.h
>> @@ -0,0 +1,32 @@
>> +/*
>> + * Copyright (c) 2017 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.
>> + */
>> +#ifndef __MEI_HDCP_H__
>> +#define __MEI_HDCP_H__
>> +
>> +#include <linux/mei_cl_bus.h>
>> +
>> +struct mei_hdcp {
>> +	struct mei_cl_device *cldev;
>> +};
>> +
>> +#endif /* __MEI_HDCP_H__ */
>> --
>> 2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver
  2018-02-14 14:54   ` Winkler, Tomas
@ 2018-02-14 14:58     ` Ramalingam C
  2018-02-28 15:43     ` Ramalingam C
  1 sibling, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 14:58 UTC (permalink / raw)
  To: Winkler, Tomas, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter



On Wednesday 14 February 2018 08:24 PM, Winkler, Tomas wrote:
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/misc/mei/Kconfig  | 6 ++++++
>>   drivers/misc/mei/Makefile | 2 ++
>>   2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig index
>> c49e1d2269af..90977132d1e2 100644
>> --- a/drivers/misc/mei/Kconfig
>> +++ b/drivers/misc/mei/Kconfig
>> @@ -43,3 +43,9 @@ config INTEL_MEI_TXE
>>
>>   	  Supported SoCs:
>>   	  Intel Bay Trail
>> +
>> +config INTEL_MEI_HDCP
>> +	tristate "Intel HDCP2.2 services of ME Interface"
>> +	depends on INTEL_MEI && DRM_I915
>> +	help
>> +	  MEI Support for HDCP2.2 Services on Intel SoCs.
>> diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile index
>> cd6825afa8e1..ee19754c1aec 100644
>> --- a/drivers/misc/mei/Makefile
>> +++ b/drivers/misc/mei/Makefile
>> @@ -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) += mei_hdcp.o
> Should go to the separate directory.
Sure will move it.
Thanks
--Ram
> Thanks
> Tomas
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 35/43] drm/i915: Enable HDCP version that is best capable
  2018-02-14 15:00       ` Chris Wilson
@ 2018-02-14 15:00         ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-14 15:00 UTC (permalink / raw)
  To: Chris Wilson, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler



On Wednesday 14 February 2018 08:30 PM, Chris Wilson wrote:
> Quoting Ramalingam C (2018-02-14 14:51:10)
>>
>> On Wednesday 14 February 2018 08:12 PM, Chris Wilson wrote:
>>> Quoting Ramalingam C (2018-02-14 14:13:50)
>>>> @@ -1437,7 +1525,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
>>>>    {
>>>>           int ret;
>>>>    
>>>> -       DRM_ERROR("[%s:%d] HDCP2.2 is being Disabled\n",
>>>> +       DRM_INFO("[%s:%d] HDCP2.2 is being Disabled\n",
>>>>                     hdcp->connector->base.name, hdcp->connector->base.base.id);
>>> Will there be a third patch making this DEBUG_KMS?
>>> -Chris
>> Thanks Chris!
>>
>> Will address these comments. No, I feel its could to have DRM_INFO for
>> state transition logs.
>> In practical HDCP logs will not be that frequent. If needed I will
>> change them into DEBUG in upcoming versions :)
> Treat everything above DEBUG as communicating with the user. For the
> user, this information is already available via the connector property.
> -Chris
In that case, I will convert them into DEBUG logs
Thanks,
--Ram

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 35/43] drm/i915: Enable HDCP version that is best capable
  2018-02-14 14:51     ` Ramalingam C
@ 2018-02-14 15:00       ` Chris Wilson
  2018-02-14 15:00         ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Chris Wilson @ 2018-02-14 15:00 UTC (permalink / raw)
  To: Ramalingam C, seanpaul, intel-gfx, rodrigo.vivi, daniel.vetter
  Cc: tomas.winkler

Quoting Ramalingam C (2018-02-14 14:51:10)
> 
> 
> On Wednesday 14 February 2018 08:12 PM, Chris Wilson wrote:
> > Quoting Ramalingam C (2018-02-14 14:13:50)
> >> @@ -1437,7 +1525,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
> >>   {
> >>          int ret;
> >>   
> >> -       DRM_ERROR("[%s:%d] HDCP2.2 is being Disabled\n",
> >> +       DRM_INFO("[%s:%d] HDCP2.2 is being Disabled\n",
> >>                    hdcp->connector->base.name, hdcp->connector->base.base.id);
> > Will there be a third patch making this DEBUG_KMS?
> > -Chris
> Thanks Chris!
> 
> Will address these comments. No, I feel its could to have DRM_INFO for 
> state transition logs.
> In practical HDCP logs will not be that frequent. If needed I will 
> change them into DEBUG in upcoming versions :)

Treat everything above DEBUG as communicating with the user. For the
user, this information is already available via the connector property.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Implement HDCP2.2
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (42 preceding siblings ...)
  2018-02-14 14:13 ` [PATCH 43/43] drm/i915: Invoke check link on CP_IRQ of DP Ramalingam C
@ 2018-02-14 15:07 ` Patchwork
  2018-02-14 15:13 ` ✗ Fi.CI.SPARSE: " Patchwork
  2018-02-14 15:20 ` ✗ Fi.CI.BAT: failure " Patchwork
  45 siblings, 0 replies; 79+ messages in thread
From: Patchwork @ 2018-02-14 15:07 UTC (permalink / raw)
  To: Ramalingam C; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Implement HDCP2.2
URL   : https://patchwork.freedesktop.org/series/38254/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
f736f4ccc6d7 drm: hdcp2.2 authentication msg definitions
-:27: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#27: FILE: include/drm/drm_hdcp.h:49:
+		uint8_t reserved_lo;

-:29: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#29: FILE: include/drm/drm_hdcp.h:51:
+	uint16_t srm_version;

-:30: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#30: FILE: include/drm/drm_hdcp.h:52:
+	uint8_t srm_gen_no;

-:93: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#93: FILE: include/drm/drm_hdcp.h:115:
+	uint8_t	receiver_id[RECEIVER_ID_SIZE];

-:94: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#94: FILE: include/drm/drm_hdcp.h:116:
+	uint8_t	kpub_rx[K_PUB_RX_SIZE];

-:101: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#101: FILE: include/drm/drm_hdcp.h:123:
+	uint8_t	reserved2;

-:102: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#102: FILE: include/drm/drm_hdcp.h:124:
+	uint8_t	dcp_signature[DCP_LLC_SIGNATURE_SIZE];

-:111: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#111: FILE: include/drm/drm_hdcp.h:133:
+		uint8_t version;

-:112: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#112: FILE: include/drm/drm_hdcp.h:134:
+		uint8_t receiver_capability_mask_hi;

-:119: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#119: FILE: include/drm/drm_hdcp.h:141:
+	uint8_t rx_caps_value[3];

-:144: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#144: FILE: include/drm/drm_hdcp.h:166:
+	uint16_t rx_info_value;

-:148: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#148: FILE: include/drm/drm_hdcp.h:170:
+	uint8_t stream_id;

-:149: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#149: FILE: include/drm/drm_hdcp.h:171:
+	uint8_t stream_type;

-:157: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#157: FILE: include/drm/drm_hdcp.h:179:
+	uint8_t			version;

-:160: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#160: FILE: include/drm/drm_hdcp.h:182:
+	uint16_t		transmitter_capability_mask;

-:167: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#167: FILE: include/drm/drm_hdcp.h:189:
+	uint8_t			msg_id;

-:168: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#168: FILE: include/drm/drm_hdcp.h:190:
+	uint8_t			r_tx[HDCP_RTX_LEN];

-:173: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#173: FILE: include/drm/drm_hdcp.h:195:
+	uint8_t			msg_id;

-:175: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#175: FILE: include/drm/drm_hdcp.h:197:
+	uint8_t			r_rx[HDCP_RRX_LEN];

-:180: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#180: FILE: include/drm/drm_hdcp.h:202:
+	uint8_t			msg_id;

-:181: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#181: FILE: include/drm/drm_hdcp.h:203:
+	uint8_t			e_kpub_km[HDCP_E_KPUB_KM_LEN];

-:185: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#185: FILE: include/drm/drm_hdcp.h:207:
+	uint8_t			msg_id;

-:186: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#186: FILE: include/drm/drm_hdcp.h:208:
+	uint8_t			e_kh_km_m[HDCP_E_KH_KM_M_LEN];

-:190: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#190: FILE: include/drm/drm_hdcp.h:212:
+	uint8_t			msg_id;

-:191: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#191: FILE: include/drm/drm_hdcp.h:213:
+	uint8_t			h_prime[HDCP_H_PRIME_LEN];

-:195: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#195: FILE: include/drm/drm_hdcp.h:217:
+	uint8_t			msg_id;

-:196: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#196: FILE: include/drm/drm_hdcp.h:218:
+	uint8_t			e_kh_km[HDCP_E_KH_KM_LEN];

-:200: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#200: FILE: include/drm/drm_hdcp.h:222:
+	uint8_t			msg_id;

-:201: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#201: FILE: include/drm/drm_hdcp.h:223:
+	uint8_t			r_n[HDCP_RN_LEN];

-:205: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#205: FILE: include/drm/drm_hdcp.h:227:
+	uint8_t			msg_id;

-:206: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#206: FILE: include/drm/drm_hdcp.h:228:
+	uint8_t			l_prime[HDCP_L_PRIME_LEN];

-:210: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#210: FILE: include/drm/drm_hdcp.h:232:
+	uint8_t			msg_id;

-:211: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#211: FILE: include/drm/drm_hdcp.h:233:
+	uint8_t			e_dkey_ks[HDCP_E_DKEY_KS_LEN];

-:212: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#212: FILE: include/drm/drm_hdcp.h:234:
+	uint8_t			riv[HDCP_RIV_LEN];

-:216: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#216: FILE: include/drm/drm_hdcp.h:238:
+	uint8_t			msg_id;

-:218: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#218: FILE: include/drm/drm_hdcp.h:240:
+	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];

-:219: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#219: FILE: include/drm/drm_hdcp.h:241:
+	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];

-:220: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#220: FILE: include/drm/drm_hdcp.h:242:
+	uint8_t			receiver_ids[HDCP_RECEIVER_IDS_MAX_LEN];

-:224: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#224: FILE: include/drm/drm_hdcp.h:246:
+	uint8_t			msg_id;

-:225: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#225: FILE: include/drm/drm_hdcp.h:247:
+	uint8_t			v[HDCP_LPRIME_HALF_SIZE];

-:229: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#229: FILE: include/drm/drm_hdcp.h:251:
+	uint8_t			msg_id;

-:230: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#230: FILE: include/drm/drm_hdcp.h:252:
+	uint8_t			seq_num_m[HDCP_SEQ_NUM_LEN];

-:231: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#231: FILE: include/drm/drm_hdcp.h:253:
+	uint16_t		k;

-:236: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#236: FILE: include/drm/drm_hdcp.h:258:
+	uint8_t			msg_id;

-:237: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#237: FILE: include/drm/drm_hdcp.h:259:
+	uint8_t			m_prime[HDCP_MPRIME_LEN];

-:241: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#241: FILE: include/drm/drm_hdcp.h:263:
+	uint8_t		msg_id;

-:242: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#242: FILE: include/drm/drm_hdcp.h:264:
+	uint8_t		stream_type;

total: 0 errors, 0 warnings, 47 checks, 230 lines checked
3b68aa846b62 drm: HDMI and DP specific HDCP2.2 defines
-:76: CHECK: Avoid CamelCase: <Link_integrity_failure>
#76: FILE: include/drm/drm_dp_helper.h:913:
+		uint8_t Link_integrity_failure:1;

-:79: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#79: FILE: include/drm/drm_dp_helper.h:916:
+	uint8_t val;

-:110: CHECK: spaces preferred around that '<<' (ctx:VxV)
#110: FILE: include/drm/drm_hdcp.h:284:
+#define HDMI_HDCP_2_2_SUPPORT_MASK		(1<<2)
                                   		  ^

-:110: CHECK: Prefer using the BIT macro
#110: FILE: include/drm/drm_hdcp.h:284:
+#define HDMI_HDCP_2_2_SUPPORT_MASK		(1<<2)

-:125: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#125: FILE: include/drm/drm_hdcp.h:299:
+		uint8_t msg_sz_lo;

-:127: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#127: FILE: include/drm/drm_hdcp.h:301:
+	uint16_t val;

total: 0 errors, 0 warnings, 6 checks, 106 lines checked
a5578ed4a012 mei: bus: whitelist hdcp client
d357ae57a883 mei: me: add gemini lake devices ids
720b23af0b72 misc/mei/hdcp: Client driver for HDCP application
-:32: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#32: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 112 lines checked
40a7bcdc33f5 misc/mei/hdcp: Add KBuild for mei hdcp driver
53619c62c9a4 misc/mei/hdcp: Verify mei client device status
83915af0e87e misc/mei/hdcp: Get & Put for mei cl_device
-:110: CHECK: Alignment should match open parenthesis
#110: FILE: drivers/misc/mei/mei_hdcp.h:36:
+	void (*notify_on_cldev_change)(void *client,
+				      struct mei_cl_device *cldev);

-:117: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#117: 
new file mode 100644

-:164: CHECK: Please use a blank line after function/struct/union/enum declarations
#164: FILE: include/linux/mei_hdcp.h:43:
+}
+static inline

total: 0 errors, 1 warnings, 2 checks, 134 lines checked
ef20982b92c8 misc/mei/hdcp: Define ME FW interface for HDCP2.2
-:158: CHECK: Please don't use multiple blank lines
#158: FILE: drivers/misc/mei/mei_hdcp.h:170:
+
+

-:186: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#186: FILE: drivers/misc/mei/mei_hdcp.h:198:
+	uint8_t		e_kpub_km[HDCP_E_KPUB_KM_LEN];

-:187: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#187: FILE: drivers/misc/mei/mei_hdcp.h:199:
+	uint8_t		e_kh_km_m[HDCP_E_KH_KM_M_LEN];

-:189: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#189: FILE: drivers/misc/mei/mei_hdcp.h:201:
+		uint8_t e_kh_km[HDCP_KH_LEN];

-:190: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#190: FILE: drivers/misc/mei/mei_hdcp.h:202:
+		uint8_t m[HDCP_M_LEN];

-:199: CHECK: Prefer kernel type 'u32' over 'uint32_t'
#199: FILE: drivers/misc/mei/mei_hdcp.h:211:
+	uint32_t	api_version;

-:200: CHECK: Prefer kernel type 'u32' over 'uint32_t'
#200: FILE: drivers/misc/mei/mei_hdcp.h:212:
+	uint32_t	command_id;

-:203: CHECK: Prefer kernel type 'u32' over 'uint32_t'
#203: FILE: drivers/misc/mei/mei_hdcp.h:215:
+	uint32_t	buffer_len;

-:216: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#216: FILE: drivers/misc/mei/mei_hdcp.h:228:
+	uint8_t		integrated_port_type;

-:217: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#217: FILE: drivers/misc/mei/mei_hdcp.h:229:
+	uint8_t		physical_port;

-:218: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#218: FILE: drivers/misc/mei/mei_hdcp.h:230:
+	uint16_t	reserved;

-:221: CHECK: Please don't use multiple blank lines
#221: FILE: drivers/misc/mei/mei_hdcp.h:233:
+
+

-:250: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#250: FILE: drivers/misc/mei/mei_hdcp.h:262:
+	uint8_t			protocol; /* for HDMI vs DP */

-:256: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#256: FILE: drivers/misc/mei/mei_hdcp.h:268:
+	uint8_t			r_tx[HDCP_RTX_LEN];

-:303: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#303: FILE: drivers/misc/mei/mei_hdcp.h:315:
+	uint8_t			r_rx[HDCP_RRX_LEN];

-:310: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#310: FILE: drivers/misc/mei/mei_hdcp.h:322:
+	uint8_t			km_stored;

-:311: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#311: FILE: drivers/misc/mei/mei_hdcp.h:323:
+	uint8_t			reserved[3];

-:334: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#334: FILE: drivers/misc/mei/mei_hdcp.h:346:
+	uint8_t			h_prime[HDCP_H_PRIME_LEN];

-:362: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#362: FILE: drivers/misc/mei/mei_hdcp.h:374:
+	uint8_t			e_kh_km[HDCP_E_KH_KM_LEN];

-:370: CHECK: Please don't use multiple blank lines
#370: FILE: drivers/misc/mei/mei_hdcp.h:382:
+
+

-:399: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#399: FILE: drivers/misc/mei/mei_hdcp.h:411:
+	uint8_t			r_n[HDCP_RN_LEN];

-:421: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#421: FILE: drivers/misc/mei/mei_hdcp.h:433:
+	uint8_t			l_prime[HDCP_L_PRIME_LEN];

-:456: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#456: FILE: drivers/misc/mei/mei_hdcp.h:468:
+	uint8_t		e_dkey_ks[HDCP_E_DKEY_KS_LEN];

-:457: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#457: FILE: drivers/misc/mei/mei_hdcp.h:469:
+	uint8_t		r_iv[HDCP_RIV_LEN];

-:477: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#477: FILE: drivers/misc/mei/mei_hdcp.h:489:
+	uint8_t		stream_type;

-:511: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#511: FILE: drivers/misc/mei/mei_hdcp.h:523:
+	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];

-:512: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#512: FILE: drivers/misc/mei/mei_hdcp.h:524:
+	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];

-:513: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#513: FILE: drivers/misc/mei/mei_hdcp.h:525:
+	uint8_t			receiver_ids[HDCP_RECEIVER_IDS_MAX_LEN];

-:519: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#519: FILE: drivers/misc/mei/mei_hdcp.h:531:
+	uint8_t			content_type_supported;

-:520: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#520: FILE: drivers/misc/mei/mei_hdcp.h:532:
+	uint8_t			v[HDCP_LPRIME_HALF_SIZE];

-:543: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#543: FILE: drivers/misc/mei/mei_hdcp.h:555:
+	uint8_t			seq_num_m[HDCP_SEQ_NUM_LEN];

-:544: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#544: FILE: drivers/misc/mei/mei_hdcp.h:556:
+	uint8_t			m_prime[HDCP_MPRIME_LEN];

-:545: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#545: FILE: drivers/misc/mei/mei_hdcp.h:557:
+	uint16_t		k;

total: 0 errors, 0 warnings, 33 checks, 535 lines checked
721f27c37de4 linux/mei: Header for mei_hdcp driver interface
-:76: CHECK: Prefer kernel type 'u16' over 'uint16_t'
#76: FILE: include/linux/mei_hdcp.h:83:
+	uint16_t k;

-:84: CHECK: Prefer kernel type 'u32' over 'uint32_t'
#84: FILE: include/linux/mei_hdcp.h:91:
+	uint32_t seq_num_m;

total: 0 errors, 0 warnings, 2 checks, 77 lines checked
e4285cab5df4 misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
dcf38a21f754 misc/mei/hdcp: Verify Receiver Cert and prepare km
-:138: CHECK: Please use a blank line after function/struct/union/enum declarations
#138: FILE: include/linux/mei_hdcp.h:134:
 }
+static inline int

total: 0 errors, 0 warnings, 1 checks, 121 lines checked
baa2ef6c2ae8 misc/mei/hdcp: Verify H_prime
-:106: CHECK: Please use a blank line after function/struct/union/enum declarations
#106: FILE: include/linux/mei_hdcp.h:145:
 }
+static inline

total: 0 errors, 0 warnings, 1 checks, 90 lines checked
95ee2b2ff838 misc/mei/hdcp: Store the HDCP Pairing info
-:110: CHECK: Please use a blank line after function/struct/union/enum declarations
#110: FILE: include/linux/mei_hdcp.h:153:
 }
+static inline

total: 0 errors, 0 warnings, 1 checks, 91 lines checked
8ec87cbd6a8e misc/mei/hdcp: Initiate Locality check
-:105: CHECK: Please use a blank line after function/struct/union/enum declarations
#105: FILE: include/linux/mei_hdcp.h:161:
 }
+static inline

total: 0 errors, 0 warnings, 1 checks, 89 lines checked
5be0d5e5532e misc/mei/hdcp: Verify L_prime
-:108: CHECK: Please use a blank line after function/struct/union/enum declarations
#108: FILE: include/linux/mei_hdcp.h:169:
 }
+static inline

total: 0 errors, 0 warnings, 1 checks, 90 lines checked
c8237dc86040 misc/mei/hdcp: Prepare Session Key
-:109: CHECK: Please use a blank line after function/struct/union/enum declarations
#109: FILE: include/linux/mei_hdcp.h:177:
 }
+static inline

total: 0 errors, 0 warnings, 1 checks, 93 lines checked
241758068d42 misc/mei/hdcp: Repeater topology verifcation and ack
-:137: CHECK: Please use a blank line after function/struct/union/enum declarations
#137: FILE: include/linux/mei_hdcp.h:188:
 }
+static inline int

total: 0 errors, 0 warnings, 1 checks, 120 lines checked
5d658c67aff6 misc/mei/hdcp: Verify M_prime
-:28: CHECK: Comparison to NULL could be written "dest"
#28: FILE: drivers/misc/mei/mei_hdcp.c:633:
+	if (dest != NULL && dst_sz != 0) {

-:78: CHECK: Alignment should match open parenthesis
#78: FILE: drivers/misc/mei/mei_hdcp.c:683:
+	reverse_endianness((u8 *)&verify_mprime_in.seq_num_m, HDCP_SEQ_NUM_LEN,
+			    (u8 *)&data->seq_num_m);

-:130: CHECK: Please use a blank line after function/struct/union/enum declarations
#130: FILE: include/linux/mei_hdcp.h:198:
 }
+static inline

total: 0 errors, 0 warnings, 3 checks, 111 lines checked
71bdfa1c451c misc/mei/hdcp: Enabling the HDCP authentication
-:108: CHECK: Please use a blank line after function/struct/union/enum declarations
#108: FILE: include/linux/mei_hdcp.h:205:
 }
+static inline int mei_enable_hdcp_authentication(struct mei_hdcp_data *data)

total: 0 errors, 0 warnings, 1 checks, 83 lines checked
14071a5ac502 misc/mei/hdcp: Closing wired HDCP2.2 Tx Session
-:59: CHECK: Please don't use multiple blank lines
#59: FILE: drivers/misc/mei/mei_hdcp.c:813:
+
+

-:104: CHECK: Please use a blank line after function/struct/union/enum declarations
#104: FILE: include/linux/mei_hdcp.h:210:
 }
+static inline int mei_close_hdcp_session(struct mei_hdcp_data *data)

total: 0 errors, 0 warnings, 2 checks, 85 lines checked
5b37fb6fbbd5 drm/i915: Async execution of hdcp authentication
545ca59b5352 drm/i915: wrapping all hdcp var into intel_hdcp
-:26: CHECK: Lines should not end with a '('
#26: FILE: drivers/gpu/drm/i915/intel_display.c:15318:
+			cancel_delayed_work_sync(

-:43: CHECK: Lines should not end with a '('
#43: FILE: drivers/gpu/drm/i915/intel_dp.c:5449:
+			intel_hdcp_check_link(

-:60: CHECK: struct mutex definition without comment
#60: FILE: drivers/gpu/drm/i915/intel_drv.h:382:
+	struct mutex hdcp_mutex;

-:61: CHECK: Prefer kernel type 'u64' over 'uint64_t'
#61: FILE: drivers/gpu/drm/i915/intel_drv.h:383:
+	uint64_t hdcp_value; /* protected by hdcp_mutex */

-:226: CHECK: Prefer kzalloc(sizeof(*hdcp)...) over kzalloc(sizeof(struct intel_hdcp)...)
#226: FILE: drivers/gpu/drm/i915/intel_hdcp.c:681:
+	hdcp = kzalloc(sizeof(struct intel_hdcp), GFP_KERNEL);

total: 0 errors, 0 warnings, 5 checks, 338 lines checked
50ed77735dca drm/i915: wait for cp_irq
-:56: CHECK: Lines should not end with a '('
#56: FILE: drivers/gpu/drm/i915/intel_dp.c:5066:
+							msecs_to_jiffies(

total: 0 errors, 0 warnings, 1 checks, 62 lines checked
cc0288bf486c drm/i915: Define HDCP2.2 related variables
-:70: CHECK: Blank lines aren't necessary after an open brace '{'
#70: FILE: drivers/gpu/drm/i915/intel_drv.h:329:
+struct intel_hdcp2_shim {
+

-:77: CHECK: Prefer kernel type 'u8' over 'uint8_t'
#77: FILE: drivers/gpu/drm/i915/intel_drv.h:336:
+			uint8_t msg_id, void *buf, size_t size);

-:133: CHECK: Prefer kernel type 'u32' over 'uint32_t'
#133: FILE: drivers/gpu/drm/i915/intel_drv.h:464:
+	uint32_t seq_num_v;

-:141: CHECK: Prefer kernel type 'u32' over 'uint32_t'
#141: FILE: drivers/gpu/drm/i915/intel_drv.h:472:
+	uint32_t seq_num_m;

total: 0 errors, 0 warnings, 4 checks, 126 lines checked
84cb7e6697af drm/i915: Define Intel HDCP2.2 registers
-:30: CHECK: Macro argument reuse 'p' - possible side-effects?
#30: FILE: drivers/gpu/drm/i915/i915_reg.h:2280:
+#define HDCP_PORT_INDEX_ADJUST(p)	(((p) == PORT_A ? PORT_E : \
+						(p) == PORT_E ? (0x6) : \
+						(p)) - 1)

-:36: CHECK: Please don't use multiple blank lines
#36: FILE: drivers/gpu/drm/i915/i915_reg.h:2286:
+
+

-:44: CHECK: Prefer using the BIT macro
#44: FILE: drivers/gpu/drm/i915/i915_reg.h:2294:
+#define   AUTH_LINK_AUTHENTICATED	(1 << 31)

-:45: CHECK: Prefer using the BIT macro
#45: FILE: drivers/gpu/drm/i915/i915_reg.h:2295:
+#define   AUTH_LINK_TYPE		(1 << 30)

-:46: CHECK: Prefer using the BIT macro
#46: FILE: drivers/gpu/drm/i915/i915_reg.h:2296:
+#define   AUTH_FORCE_CLR_INPUTCTR	(1 << 19)

-:47: CHECK: Prefer using the BIT macro
#47: FILE: drivers/gpu/drm/i915/i915_reg.h:2297:
+#define   AUTH_CLR_KEYS			(1 << 18)

-:53: CHECK: Please don't use multiple blank lines
#53: FILE: drivers/gpu/drm/i915/i915_reg.h:2303:
+
+

-:60: CHECK: Prefer using the BIT macro
#60: FILE: drivers/gpu/drm/i915/i915_reg.h:2310:
+#define   AUTH_STREAM_TYPE		(1 << 31)

-:73: CHECK: Prefer using the BIT macro
#73: FILE: drivers/gpu/drm/i915/i915_reg.h:2323:
+#define   CTL_LINK_ENCRYPTION_REQ	(1 << 31)

-:118: CHECK: Prefer using the BIT macro
#118: FILE: drivers/gpu/drm/i915/i915_reg.h:2368:
+#define   STREAM_ENCRYPTION_STATUS_A	(1 << 31)

-:119: CHECK: Prefer using the BIT macro
#119: FILE: drivers/gpu/drm/i915/i915_reg.h:2369:
+#define   STREAM_ENCRYPTION_STATUS_B	(1 << 30)

-:120: CHECK: Prefer using the BIT macro
#120: FILE: drivers/gpu/drm/i915/i915_reg.h:2370:
+#define   STREAM_ENCRYPTION_STATUS_C	(1 << 29)

-:121: CHECK: Prefer using the BIT macro
#121: FILE: drivers/gpu/drm/i915/i915_reg.h:2371:
+#define   LINK_TYPE_STATUS		(1 << 22)

-:122: CHECK: Prefer using the BIT macro
#122: FILE: drivers/gpu/drm/i915/i915_reg.h:2372:
+#define   LINK_AUTH_STATUS		(1 << 21)

-:123: CHECK: Prefer using the BIT macro
#123: FILE: drivers/gpu/drm/i915/i915_reg.h:2373:
+#define   LINK_ENCRYPTION_STATUS	(1 << 20)

-:134: CHECK: Prefer using the BIT macro
#134: FILE: drivers/gpu/drm/i915/i915_reg.h:2384:
+#define   STREAM_ENCRYPTION_STATUS	(1 << 31)

-:135: CHECK: Prefer using the BIT macro
#135: FILE: drivers/gpu/drm/i915/i915_reg.h:2385:
+#define   STREAM_TYPE_STATUS		(1 << 30)

total: 0 errors, 0 warnings, 17 checks, 126 lines checked
13fc3345b736 dr

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* ✗ Fi.CI.SPARSE: warning for drm/i915: Implement HDCP2.2
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (43 preceding siblings ...)
  2018-02-14 15:07 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Implement HDCP2.2 Patchwork
@ 2018-02-14 15:13 ` Patchwork
  2018-02-14 15:20 ` ✗ Fi.CI.BAT: failure " Patchwork
  45 siblings, 0 replies; 79+ messages in thread
From: Patchwork @ 2018-02-14 15:13 UTC (permalink / raw)
  To: Ramalingam C; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Implement HDCP2.2
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: mei: me: add gemini lake devices ids
Okay!

Commit: misc/mei/hdcp: Client driver for HDCP application
Okay!

Commit: misc/mei/hdcp: Add KBuild for mei hdcp driver
+Error in reading or end of file.

Commit: misc/mei/hdcp: Verify mei client device status
Okay!

Commit: misc/mei/hdcp: Get & Put for mei cl_device
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 verifcation 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: Async execution of hdcp authentication
Okay!

Commit: drm/i915: wrapping all hdcp var into intel_hdcp
Okay!

Commit: drm/i915: wait for cp_irq
+            ^~~~~~~~~~~~~~~
+cc1: all warnings being treated as errors
+drivers/gpu/drm/i915/intel_dp.c:5058:12: error: ‘wait_for_cp_irq’ defined but not used [-Werror=unused-function]
+make[1]: *** [drivers/gpu/drm/i915] Error 2
+make[2]: *** [drivers/gpu/drm/i915/intel_dp.o] Error 1
+make[2]: *** Waiting for unfinished jobs....
+make: *** [drivers/gpu/drm/] Error 2
+ static int wait_for_cp_irq(struct completion *cp_irq_recved, int timeout)

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:12: error: ‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:840:1: error: ‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:864:1: error: ‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:884:12: error: ‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:901:1: error: ‘hdcp2_store_paring_info’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:918:1: error: ‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:934:1: error: ‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:950:12: error: ‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:967:1: error: ‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:987:1: error: ‘hdcp2_verify_mprime’ 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_paring_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[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1
+make[2]: *** Waiting for unfinished jobs....
+ 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:12: error: ‘hdcp2_authenticate_port’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:841:1: error: ‘hdcp2_prepare_ake_init’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:865:1: error: ‘hdcp2_verify_rx_cert_prepare_km’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:885:12: error: ‘hdcp2_verify_hprime’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:902:1: error: ‘hdcp2_store_paring_info’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:919:1: error: ‘hdcp2_prepare_lc_init’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:935:1: error: ‘hdcp2_verify_lprime’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:951:12: error: ‘hdcp2_prepare_skey’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:1156:12: error: ‘hdcp2_authenticate_sink’ 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_paring_info(struct intel_hdcp *hdcp,
- hdcp2_verify_lprime(struct intel_hdcp *hdcp,
- 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_hdcp *hdcp)

Commit: drm/i915: Implement HDCP2.2 repeater authentication
- ^~~~~~~~~~~~~~~~~~~
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-O:drivers/gpu/drm/i915/intel_hdcp.c:1156:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:968:1: error: ‘hdcp2_verify_rep_topology_prepare_ack’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:988:1: error: ‘hdcp2_verify_mprime’ 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:1283: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:1341:12: error: ‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:1368:12: error: ‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function]
+ static int hdcp2_disable_encryption(struct intel_hdcp *hdcp)
+ static int hdcp2_enable_encryption(struct intel_hdcp *hdcp)

Commit: drm/i915: Implement HDCP2.2 En/Dis-able
-            ^~~~~~~~~~~~~~~~~~~~~~~
-            ^~~~~~~~~~~~~~~~~~~~~~~
-            ^~~~~~~~~~~~~~~~~~~~~~~~
+            ^~~~~~~~~~~~~~~~~~~
+            ^~~~~~~~~~~~~~~~~~~~
-drivers/gpu/drm/i915/intel_hdcp.c:1287:12: error: ‘hdcp2_authenticate_sink’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:1344:12: error: ‘hdcp2_enable_encryption’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:1371:12: error: ‘hdcp2_disable_encryption’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:1422:12: error: ‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:1436:12: error: ‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function]
- static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
- static int hdcp2_disable_encryption(struct intel_hdcp *hdcp)
- static int hdcp2_enable_encryption(struct intel_hdcp *hdcp)
+ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
+ static int _intel_hdcp2_enable(struct intel_hdcp *hdcp)

Commit: drm/i915: Implement HDCP2.2 link integrity check
-            ^~~~~~~~~~~~~~~~~~~
-            ^~~~~~~~~~~~~~~~~~~~
+             ^~~~~~~~~~~~~~~~~~~~~~
-drivers/gpu/drm/i915/intel_hdcp.c:1424:12: error: ‘_intel_hdcp2_disable’ defined but not used [-Werror=unused-function]
-drivers/gpu/drm/i915/intel_hdcp.c:1438:12: error: ‘_intel_hdcp2_enable’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:1463:13: error: ‘intel_hdcp2_check_work’ defined but not used [-Werror=unused-function]
- static int _intel_hdcp2_disable(struct intel_hdcp *hdcp)
- static int _intel_hdcp2_enable(struct intel_hdcp *hdcp)
+ static void intel_hdcp2_check_work(struct work_struct *work)

Commit: drm/i915: Handle HDCP2.2 downstream topology change
-drivers/gpu/drm/i915/gvt/mmio.c:256:23: warning: memcpy with byte count of 279040
-drivers/gpu/drm/i915/gvt/mmio.c:257:23: warning: memcpy with byte count of 279040

Commit: drm/i915: Pullout the bksv read and validation
Okay!

Commit: drm/i915: Enable HDCP version that is best capable
Okay!

Commit: drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure
Okay!

Commit: drm/i915: Initialize HDCP2.2 and its MEI interface
-             ^~~~~~~~~~~~~~~~~~~~~~
-cc1: all warnings being treated as errors
+drivers/gpu/drm/i915/gvt/mmio.c:256:23: warning: memcpy with byte count of 279040
+drivers/gpu/drm/i915/gvt/mmio.c:257:23: warning: memcpy with byte count of 279040
-drivers/gpu/drm/i915/intel_hdcp.c:1704:13: error: ‘intel_hdcp2_check_work’ defined but not used [-Werror=unused-function]
+drivers/gpu/drm/i915/intel_hdcp.c:773:6: warning: symbol 'intel_mei_cldev_reference_notify' was not declared. Should it be static?
-make[2]: *** [drivers/gpu/drm/i915/intel_hdcp.o] Error 1
-make[2]: *** wait: No child processes.  Stop.
- static void intel_hdcp2_check_work(struct work_struct *work)

Commit: drm/i915: Implement gmbus burst read
Okay!

Commit: drm/i915: Implement the HDCP2.2 support for DP
-            ^~~~~~~~~~~~~~~
-cc1: all warnings being treated as errors
-drivers/gpu/drm/i915/intel_dp.c:5058:12: error: ‘wait_for_cp_irq’ defined but not used [-Werror=unused-function]
-make[1]: *** [drivers/gpu/drm/i915] Error 2
-make[2]: *** [drivers/gpu/drm/i915/intel_dp.o] Error 1
-make: *** [drivers/gpu/drm/] Error 2
- static int wait_for_cp_irq(struct completion *cp_irq_recved, int timeout)
+

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!

Commit: drm/i915: Invoke check link on CP_IRQ of DP
Okay!


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 01/43] drm: hdcp2.2 authentication msg definitions
  2018-02-14 14:13 ` [PATCH 01/43] drm: hdcp2.2 authentication msg definitions Ramalingam C
@ 2018-02-14 15:15   ` Winkler, Tomas
  2018-02-14 19:40     ` Jani Nikula
  2018-02-22  5:29     ` Ramalingam C
  0 siblings, 2 replies; 79+ messages in thread
From: Winkler, Tomas @ 2018-02-14 15:15 UTC (permalink / raw)
  To: C, Ramalingam, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter


> 
> This patch defines the hdcp2.2 protocol messages for the
> HDCP2.2 authentication.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  include/drm/drm_hdcp.h | 226
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 226 insertions(+)
> 
> diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index
> 562fa7df2637..9661c700cebb 100644
> --- a/include/drm/drm_hdcp.h
> +++ b/include/drm/drm_hdcp.h
> @@ -38,4 +38,230 @@
>  #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
> +
> +struct cp_srm_header {
> +	struct {
> +		uint8_t reserved_hi:4;
> +		uint8_t srm_id:4;
> +		uint8_t reserved_lo;
> +	} spec_indicator;
Do you really want to work with bit fields?  I mean in all the all structures.
> +	uint16_t srm_version;
Shouldn't be it __le16? 
> +	uint8_t srm_gen_no;
> +} __packed;

> +
> +/**
> + * Protocol message definition for HDCP2.2 specification  */
> +
> +#define HDCP_STREAM_TYPE0			0x00
> +#define HDCP_STREAM_TYPE1			0x01
> +
> +/* HDCP2.2 Msg IDs */
> +#define NULL_MSG				1


We need some HDCP2_ prefix this is in kernel global space and 
some of the constants have very generic name that can collide.

> +#define AKE_INIT				2
> +#define AKE_SEND_CERT				3



> +#define AKE_NO_STORED_KM			4
> +#define AKE_STORED_KM				5
> +#define AKE_SEND_HPRIME				7
> +#define AKE_SEND_PARING_INFO			8
> +#define LC_INIT					9
> +#define LC_SEND_LPRIME				10
> +#define SKE_SEND_EKS				11
> +#define REP_SEND_RECVID_LIST			12
> +#define REP_SEND_ACK				15
> +#define REP_STREAM_MANAGE			16
> +#define REP_STREAM_READY			17
> +#define ERRATA_DP_STREAM_TYPE			50
> +
> +#define HDCP_RTX_LEN				8
> +#define HDCP_RRX_LEN				8
> +#define RECEIVER_ID_SIZE			5
> +
> +#define K_PUB_RX_MOD_N_SIZE			128
> +#define K_PUB_RX_EXP_E_SIZE			3
> +#define K_PUB_RX_SIZE
> 	(K_PUB_RX_MOD_N_SIZE + \
> +						 K_PUB_RX_EXP_E_SIZE)
> +
> +#define DCP_LLC_SIGNATURE_SIZE			384
> +
> +#define HDCP_E_KPUB_KM_LEN			128
> +#define HDCP_E_KH_KM_M_LEN			(16 + 16)
> +#define HDCP_H_PRIME_LEN			32
> +#define HDCP_E_KH_KM_LEN			16
> +#define HDCP_RN_LEN				8
> +#define HDCP_L_PRIME_LEN			32
> +#define HDCP_E_DKEY_KS_LEN			16
> +#define HDCP_RIV_LEN				8
> +#define HDCP_SEQ_NUM_LEN			3
> +#define HDCP_LPRIME_HALF_SIZE			(HDCP_L_PRIME_LEN
> / 2)
> +#define HDCP_RECEIVER_ID_LEN			5
> +#define HDCP_MAX_DEVICE_COUNT			31
> +#define HDCP_RECEIVER_IDS_MAX_LEN
> 	(HDCP_RECEIVER_ID_LEN * \
> +						 HDCP_MAX_DEVICE_COUNT)
> +
> +/**
> + * 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 MAX_CONTENT_STREAMS_CNT			1
> +
> +#define HDCP_MPRIME_LEN				32
> +
> +struct hdcp2_cert_rx {
> +	uint8_t	receiver_id[RECEIVER_ID_SIZE];
> +	uint8_t	kpub_rx[K_PUB_RX_SIZE];
> +	uint8_t	reserved1			:4;
> +
> +	/* As per HDMI & DP HDCP Spec, must be 0x0 or 0x1 */
> +	uint8_t	protocol_descriptor		:4;
> +
> +	/* As per HDMI & DP HDCP Spec, must be 0x0000 */
> +	uint8_t	reserved2;
> +	uint8_t	dcp_signature[DCP_LLC_SIGNATURE_SIZE];
> +} __packed;
> +
> +/**
> + * The RxCaps field specified in the HDCP HDMI, DP specs
> + * This field is big endian as specified in the errata.
> + */
> +union hdcp2_rx_caps {
> +	struct	{
> +		uint8_t version;
> +		uint8_t receiver_capability_mask_hi;
> +		uint8_t repeater:1;
> +
> +		/* Rsvd in HDMI. Applicable in DP alone */
> +		uint8_t hdcp_capable:1;
> +		uint8_t receiver_capability_mask_low:6;
> +	} fields;
> +	uint8_t rx_caps_value[3];
> +} __packed;
> +
> +/**
> + * RxInfo fields Contains various topology information for the
> + * repeater authentication flows
> + */
> +union hdcp2_rx_info {
> +	struct {
> +		uint8_t device_count_hi:1;
> +		uint8_t depth:3;
> +		uint8_t rsvd:4;
> +
> +		/* Bit-0: downstream HDCP 1.x device exist */
> +		uint8_t hdcp1_device_downstream:1;
> +
> +		/* Bit-1: downstream HDCP 2.0, 2.1 device exist */
> +		uint8_t hdcp2_legacy_device_downstream:1;
> +
> +		/* Bit-2: downstream Topology limit errors */
> +		uint8_t max_cascade_exceeded:1;
> +		uint8_t max_devs_exceeded:1;
> +		uint8_t device_count_lo:4;
> +
> +	} fields;
> +	uint16_t rx_info_value;
Should be probably __le16 and better to use bitmask then bit fields. 

> +} __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 {
> +	uint8_t			version;
> +
> +	/* Reserved for HDCP and DP Spec. Read as Zero */
> +	uint16_t		transmitter_capability_mask;
> +} __packed;
> +
> +/*
> + * Main structures for HDCP2.2 protocol communication  */ struct
> +hdcp2_ake_init {
> +	uint8_t			msg_id;
> +	uint8_t			r_tx[HDCP_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_RRX_LEN];
> +	union hdcp2_rx_caps	rx_caps;
> +} __packed;
> +
> +struct hdcp2_ake_no_stored_km {
> +	uint8_t			msg_id;
> +	uint8_t			e_kpub_km[HDCP_E_KPUB_KM_LEN];
> +} __packed;
> +
> +struct hdcp2_ake_stored_km {
> +	uint8_t			msg_id;
> +	uint8_t			e_kh_km_m[HDCP_E_KH_KM_M_LEN];
> +} __packed;
> +
> +struct hdcp2_ake_send_hprime {
> +	uint8_t			msg_id;
> +	uint8_t			h_prime[HDCP_H_PRIME_LEN];
> +} __packed;
> +
> +struct hdcp2_ake_send_pairing_info {
> +	uint8_t			msg_id;
> +	uint8_t			e_kh_km[HDCP_E_KH_KM_LEN];
> +} __packed;
> +
> +struct hdcp2_lc_init {
> +	uint8_t			msg_id;
> +	uint8_t			r_n[HDCP_RN_LEN];
> +} __packed;
> +
> +struct hdcp2_lc_send_lprime {
> +	uint8_t			msg_id;
> +	uint8_t			l_prime[HDCP_L_PRIME_LEN];
> +} __packed;
> +
> +struct hdcp2_ske_send_eks {
> +	uint8_t			msg_id;
> +	uint8_t			e_dkey_ks[HDCP_E_DKEY_KS_LEN];
> +	uint8_t			riv[HDCP_RIV_LEN];
> +} __packed;
> +
> +struct hdcp2_rep_send_receiverid_list {
> +	uint8_t			msg_id;
> +	union hdcp2_rx_info	rx_info;
> +	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];
> +	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];
> +	uint8_t			receiver_ids[HDCP_RECEIVER_IDS_MAX_LEN];
> +} __packed;
> +
> +struct hdcp2_rep_send_ack {
> +	uint8_t			msg_id;
> +	uint8_t			v[HDCP_LPRIME_HALF_SIZE];
> +} __packed;
> +
> +struct hdcp2_rep_stream_manage {
> +	uint8_t			msg_id;
> +	uint8_t			seq_num_m[HDCP_SEQ_NUM_LEN];
> +	uint16_t		k;
> +	struct hdcp2_streamid_type
> streams[MAX_CONTENT_STREAMS_CNT]; }
> +__packed;
> +
> +struct hdcp2_rep_stream_ready {
> +	uint8_t			msg_id;
> +	uint8_t			m_prime[HDCP_MPRIME_LEN];
> +} __packed;
> +
> +struct hdcp2_dp_errata_stream_type {
> +	uint8_t		msg_id;
> +	uint8_t		stream_type;
> +} __packed;
> +
>  #endif
> --
> 2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Implement HDCP2.2
  2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
                   ` (44 preceding siblings ...)
  2018-02-14 15:13 ` ✗ Fi.CI.SPARSE: " Patchwork
@ 2018-02-14 15:20 ` Patchwork
  45 siblings, 0 replies; 79+ messages in thread
From: Patchwork @ 2018-02-14 15:20 UTC (permalink / raw)
  To: Ramalingam C; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Implement HDCP2.2
URL   : https://patchwork.freedesktop.org/series/38254/
State : failure

== Summary ==

Series 38254v1 drm/i915: Implement HDCP2.2
https://patchwork.freedesktop.org/api/1.0/series/38254/revisions/1/mbox/

Warning: Kernel 32bit buildtest failed
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8020/build_32bit.log

Test prime_vgem:
        Subgroup basic-fence-flip:
                pass       -> FAIL       (fi-ivb-3770)

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:421s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:426s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:374s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:481s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:286s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:483s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:468s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:460s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:569s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:575s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:416s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:283s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:508s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:408s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-ivb-3770      total:288  pass:254  dwarn:0   dfail:0   fail:1   skip:33  time:414s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:466s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:496s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:498s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:591s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:425s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:502s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:526s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:475s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:415s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:433s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:531s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:396s
Blacklisted hosts:
fi-glk-dsi       total:117  pass:104  dwarn:0   dfail:0   fail:0   skip:12 
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:455s

8ee739e0bcde50bd5ce8d40d57a1a146e167756d drm-tip: 2018y-02m-14d-13h-29m-07s UTC integration manifest
5861779e9c77 drm/i915: Invoke check link on CP_IRQ of DP
58bfa8db9fc1 drm/i915: Add HDCP2.2 support for HDMI connectors
b6591b246d17 drm/i915: Add HDCP2.2 support for DP connectors
5881b526e56b drm/i915: Implement the HDCP2.2 support for HDMI
c96813667cb3 drm/i915: Implement the HDCP2.2 support for DP
1a0379398cba drm/i915: Implement gmbus burst read
971feef04aa9 drm/i915: Initialize HDCP2.2 and its MEI interface
4d312fa8cd5d drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure
2bd224c8c6fb drm/i915: Enable HDCP version that is best capable
0b3cd631abdb drm/i915: Pullout the bksv read and validation
62725e6f987e drm/i915: Handle HDCP2.2 downstream topology change
d836b690d159 drm/i915: Implement HDCP2.2 link integrity check
c88ffb1709ab drm/i915: Implement HDCP2.2 En/Dis-able
437465874f5c drm/i915: Enable and Disable HDCP2.2 port encryption
d1815daf31b6 drm/i915: Implement HDCP2.2 repeater authentication
58537bfc577f drm/i915: Implement HDCP2.2 receiver authentication
13fc3345b736 drm/i915: Wrappers for mei HDCP2.2 services
84cb7e6697af drm/i915: Define Intel HDCP2.2 registers
cc0288bf486c drm/i915: Define HDCP2.2 related variables
50ed77735dca drm/i915: wait for cp_irq
545ca59b5352 drm/i915: wrapping all hdcp var into intel_hdcp
5b37fb6fbbd5 drm/i915: Async execution of hdcp authentication
14071a5ac502 misc/mei/hdcp: Closing wired HDCP2.2 Tx Session
71bdfa1c451c misc/mei/hdcp: Enabling the HDCP authentication
5d658c67aff6 misc/mei/hdcp: Verify M_prime
241758068d42 misc/mei/hdcp: Repeater topology verifcation and ack
c8237dc86040 misc/mei/hdcp: Prepare Session Key
5be0d5e5532e misc/mei/hdcp: Verify L_prime
8ec87cbd6a8e misc/mei/hdcp: Initiate Locality check
95ee2b2ff838 misc/mei/hdcp: Store the HDCP Pairing info
baa2ef6c2ae8 misc/mei/hdcp: Verify H_prime
dcf38a21f754 misc/mei/hdcp: Verify Receiver Cert and prepare km
e4285cab5df4 misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
721f27c37de4 linux/mei: Header for mei_hdcp driver interface
ef20982b92c8 misc/mei/hdcp: Define ME FW interface for HDCP2.2
83915af0e87e misc/mei/hdcp: Get & Put for mei cl_device
53619c62c9a4 misc/mei/hdcp: Verify mei client device status
40a7bcdc33f5 misc/mei/hdcp: Add KBuild for mei hdcp driver
720b23af0b72 misc/mei/hdcp: Client driver for HDCP application
d357ae57a883 mei: me: add gemini lake devices ids
a5578ed4a012 mei: bus: whitelist hdcp client
3b68aa846b62 drm: HDMI and DP specific HDCP2.2 defines
f736f4ccc6d7 drm: hdcp2.2 authentication msg definitions

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8020/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 01/43] drm: hdcp2.2 authentication msg definitions
  2018-02-14 15:15   ` Winkler, Tomas
@ 2018-02-14 19:40     ` Jani Nikula
  2018-02-22  5:24       ` Ramalingam C
  2018-02-22  5:29     ` Ramalingam C
  1 sibling, 1 reply; 79+ messages in thread
From: Jani Nikula @ 2018-02-14 19:40 UTC (permalink / raw)
  To: Winkler, Tomas, C, Ramalingam, seanpaul, intel-gfx, Vivi,
	Rodrigo, daniel.vetter

On Wed, 14 Feb 2018, "Winkler, Tomas" <tomas.winkler@intel.com> wrote:
>> 
>> This patch defines the hdcp2.2 protocol messages for the
>> HDCP2.2 authentication.
>> 
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>  include/drm/drm_hdcp.h | 226
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 226 insertions(+)
>> 
>> diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index
>> 562fa7df2637..9661c700cebb 100644
>> --- a/include/drm/drm_hdcp.h
>> +++ b/include/drm/drm_hdcp.h
>> @@ -38,4 +38,230 @@
>>  #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
>> +
>> +struct cp_srm_header {
>> +	struct {
>> +		uint8_t reserved_hi:4;
>> +		uint8_t srm_id:4;
>> +		uint8_t reserved_lo;
>> +	} spec_indicator;
> Do you really want to work with bit fields?  I mean in all the all structures.

We *can't* use bitfields in drm core for (un)marshalling. They depend on
endianness. (Thanks to folks on #dri-devel for confirming.) We use them
at places in i915 where we can be pretty sure about running on
little-endian machines, but that doesn't hold here.

Packed structs are fine otherwise though, just not bitfields.

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 04/43] mei: me: add gemini lake devices ids
  2018-02-14 14:45   ` Winkler, Tomas
@ 2018-02-22  5:22     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-22  5:22 UTC (permalink / raw)
  To: Winkler, Tomas, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter


On Wednesday 14 February 2018 08:15 PM, Winkler, Tomas wrote:
> This one is already upstream
Thanks for pointing that out. I will drop this patch.

--Ram

> Thanks
> Tomas
>
>
>> From: Tomas Winkler <tomas.winkler@intel.com>
>>
>> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
>> ---
>>   drivers/misc/mei/hw-me-regs.h | 2 ++
>>   drivers/misc/mei/pci-me.c     | 2 ++
>>   2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
>> index 0ccccbaf530d..5a36ca403a24 100644
>> --- a/drivers/misc/mei/hw-me-regs.h
>> +++ b/drivers/misc/mei/hw-me-regs.h
>> @@ -132,6 +132,8 @@
>>   #define MEI_DEV_ID_KBP        0xA2BA  /* Kaby Point */
>>   #define MEI_DEV_ID_KBP_2      0xA2BB  /* Kaby Point 2 */
>>
>> +#define MEI_DEV_ID_GLK        0x319A  /* Gemini Lake */
>> +
>>   /*
>>    * MEI HW Section
>>    */
>> diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index
>> 4a0ccda4d04b..fe44ac2a9b2d 100644
>> --- a/drivers/misc/mei/pci-me.c
>> +++ b/drivers/misc/mei/pci-me.c
>> @@ -98,6 +98,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
>>   	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)},
>>   	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, MEI_ME_PCH8_CFG)},
>>
>> +	{MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)},
>> +
>>   	/* required last entry */
>>   	{0, }
>>   };
>> --
>> 2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 01/43] drm: hdcp2.2 authentication msg definitions
  2018-02-14 19:40     ` Jani Nikula
@ 2018-02-22  5:24       ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-22  5:24 UTC (permalink / raw)
  To: Jani Nikula, Winkler, Tomas, seanpaul, intel-gfx, Vivi, Rodrigo,
	daniel.vetter



On Thursday 15 February 2018 01:10 AM, Jani Nikula wrote:
> On Wed, 14 Feb 2018, "Winkler, Tomas" <tomas.winkler@intel.com> wrote:
>>> This patch defines the hdcp2.2 protocol messages for the
>>> HDCP2.2 authentication.
>>>
>>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>>> ---
>>>   include/drm/drm_hdcp.h | 226
>>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>>   1 file changed, 226 insertions(+)
>>>
>>> diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index
>>> 562fa7df2637..9661c700cebb 100644
>>> --- a/include/drm/drm_hdcp.h
>>> +++ b/include/drm/drm_hdcp.h
>>> @@ -38,4 +38,230 @@
>>>   #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
>>> +
>>> +struct cp_srm_header {
>>> +	struct {
>>> +		uint8_t reserved_hi:4;
>>> +		uint8_t srm_id:4;
>>> +		uint8_t reserved_lo;
>>> +	} spec_indicator;
>> Do you really want to work with bit fields?  I mean in all the all structures.
> We *can't* use bitfields in drm core for (un)marshalling. They depend on
> endianness. (Thanks to folks on #dri-devel for confirming.) We use them
> at places in i915 where we can be pretty sure about running on
> little-endian machines, but that doesn't hold here.
>
> Packed structs are fine otherwise though, just not bitfields.
Thanks Jani. I will rework on that.

--Ram
>
> BR,
> Jani.
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 01/43] drm: hdcp2.2 authentication msg definitions
  2018-02-14 15:15   ` Winkler, Tomas
  2018-02-14 19:40     ` Jani Nikula
@ 2018-02-22  5:29     ` Ramalingam C
  1 sibling, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-22  5:29 UTC (permalink / raw)
  To: Winkler, Tomas, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter



On Wednesday 14 February 2018 08:45 PM, Winkler, Tomas wrote:
>> This patch defines the hdcp2.2 protocol messages for the
>> HDCP2.2 authentication.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   include/drm/drm_hdcp.h | 226
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 226 insertions(+)
>>
>> diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index
>> 562fa7df2637..9661c700cebb 100644
>> --- a/include/drm/drm_hdcp.h
>> +++ b/include/drm/drm_hdcp.h
>> @@ -38,4 +38,230 @@
>>   #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
>> +
>> +struct cp_srm_header {
>> +	struct {
>> +		uint8_t reserved_hi:4;
>> +		uint8_t srm_id:4;
>> +		uint8_t reserved_lo;
>> +	} spec_indicator;
> Do you really want to work with bit fields?  I mean in all the all structures.
I will rework on replacing all bitfields.
>> +	uint16_t srm_version;
> Shouldn't be it __le16?
And all multi-byte variables needs to be revisited for endianness.
>> +	uint8_t srm_gen_no;
>> +} __packed;
>> +
>> +/**
>> + * Protocol message definition for HDCP2.2 specification  */
>> +
>> +#define HDCP_STREAM_TYPE0			0x00
>> +#define HDCP_STREAM_TYPE1			0x01
>> +
>> +/* HDCP2.2 Msg IDs */
>> +#define NULL_MSG				1
>
> We need some HDCP2_ prefix this is in kernel global space and
> some of the constants have very generic name that can collide.
Sure I will add the prefix, to avoid possible conflicts. Thanks.
--Ram
>
>> +#define AKE_INIT				2
>> +#define AKE_SEND_CERT				3
>
>
>> +#define AKE_NO_STORED_KM			4
>> +#define AKE_STORED_KM				5
>> +#define AKE_SEND_HPRIME				7
>> +#define AKE_SEND_PARING_INFO			8
>> +#define LC_INIT					9
>> +#define LC_SEND_LPRIME				10
>> +#define SKE_SEND_EKS				11
>> +#define REP_SEND_RECVID_LIST			12
>> +#define REP_SEND_ACK				15
>> +#define REP_STREAM_MANAGE			16
>> +#define REP_STREAM_READY			17
>> +#define ERRATA_DP_STREAM_TYPE			50
>> +
>> +#define HDCP_RTX_LEN				8
>> +#define HDCP_RRX_LEN				8
>> +#define RECEIVER_ID_SIZE			5
>> +
>> +#define K_PUB_RX_MOD_N_SIZE			128
>> +#define K_PUB_RX_EXP_E_SIZE			3
>> +#define K_PUB_RX_SIZE
>> 	(K_PUB_RX_MOD_N_SIZE + \
>> +						 K_PUB_RX_EXP_E_SIZE)
>> +
>> +#define DCP_LLC_SIGNATURE_SIZE			384
>> +
>> +#define HDCP_E_KPUB_KM_LEN			128
>> +#define HDCP_E_KH_KM_M_LEN			(16 + 16)
>> +#define HDCP_H_PRIME_LEN			32
>> +#define HDCP_E_KH_KM_LEN			16
>> +#define HDCP_RN_LEN				8
>> +#define HDCP_L_PRIME_LEN			32
>> +#define HDCP_E_DKEY_KS_LEN			16
>> +#define HDCP_RIV_LEN				8
>> +#define HDCP_SEQ_NUM_LEN			3
>> +#define HDCP_LPRIME_HALF_SIZE			(HDCP_L_PRIME_LEN
>> / 2)
>> +#define HDCP_RECEIVER_ID_LEN			5
>> +#define HDCP_MAX_DEVICE_COUNT			31
>> +#define HDCP_RECEIVER_IDS_MAX_LEN
>> 	(HDCP_RECEIVER_ID_LEN * \
>> +						 HDCP_MAX_DEVICE_COUNT)
>> +
>> +/**
>> + * 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 MAX_CONTENT_STREAMS_CNT			1
>> +
>> +#define HDCP_MPRIME_LEN				32
>> +
>> +struct hdcp2_cert_rx {
>> +	uint8_t	receiver_id[RECEIVER_ID_SIZE];
>> +	uint8_t	kpub_rx[K_PUB_RX_SIZE];
>> +	uint8_t	reserved1			:4;
>> +
>> +	/* As per HDMI & DP HDCP Spec, must be 0x0 or 0x1 */
>> +	uint8_t	protocol_descriptor		:4;
>> +
>> +	/* As per HDMI & DP HDCP Spec, must be 0x0000 */
>> +	uint8_t	reserved2;
>> +	uint8_t	dcp_signature[DCP_LLC_SIGNATURE_SIZE];
>> +} __packed;
>> +
>> +/**
>> + * The RxCaps field specified in the HDCP HDMI, DP specs
>> + * This field is big endian as specified in the errata.
>> + */
>> +union hdcp2_rx_caps {
>> +	struct	{
>> +		uint8_t version;
>> +		uint8_t receiver_capability_mask_hi;
>> +		uint8_t repeater:1;
>> +
>> +		/* Rsvd in HDMI. Applicable in DP alone */
>> +		uint8_t hdcp_capable:1;
>> +		uint8_t receiver_capability_mask_low:6;
>> +	} fields;
>> +	uint8_t rx_caps_value[3];
>> +} __packed;
>> +
>> +/**
>> + * RxInfo fields Contains various topology information for the
>> + * repeater authentication flows
>> + */
>> +union hdcp2_rx_info {
>> +	struct {
>> +		uint8_t device_count_hi:1;
>> +		uint8_t depth:3;
>> +		uint8_t rsvd:4;
>> +
>> +		/* Bit-0: downstream HDCP 1.x device exist */
>> +		uint8_t hdcp1_device_downstream:1;
>> +
>> +		/* Bit-1: downstream HDCP 2.0, 2.1 device exist */
>> +		uint8_t hdcp2_legacy_device_downstream:1;
>> +
>> +		/* Bit-2: downstream Topology limit errors */
>> +		uint8_t max_cascade_exceeded:1;
>> +		uint8_t max_devs_exceeded:1;
>> +		uint8_t device_count_lo:4;
>> +
>> +	} fields;
>> +	uint16_t rx_info_value;
> Should be probably __le16 and better to use bitmask then bit fields.
>
>> +} __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 {
>> +	uint8_t			version;
>> +
>> +	/* Reserved for HDCP and DP Spec. Read as Zero */
>> +	uint16_t		transmitter_capability_mask;
>> +} __packed;
>> +
>> +/*
>> + * Main structures for HDCP2.2 protocol communication  */ struct
>> +hdcp2_ake_init {
>> +	uint8_t			msg_id;
>> +	uint8_t			r_tx[HDCP_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_RRX_LEN];
>> +	union hdcp2_rx_caps	rx_caps;
>> +} __packed;
>> +
>> +struct hdcp2_ake_no_stored_km {
>> +	uint8_t			msg_id;
>> +	uint8_t			e_kpub_km[HDCP_E_KPUB_KM_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_ake_stored_km {
>> +	uint8_t			msg_id;
>> +	uint8_t			e_kh_km_m[HDCP_E_KH_KM_M_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_ake_send_hprime {
>> +	uint8_t			msg_id;
>> +	uint8_t			h_prime[HDCP_H_PRIME_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_ake_send_pairing_info {
>> +	uint8_t			msg_id;
>> +	uint8_t			e_kh_km[HDCP_E_KH_KM_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_lc_init {
>> +	uint8_t			msg_id;
>> +	uint8_t			r_n[HDCP_RN_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_lc_send_lprime {
>> +	uint8_t			msg_id;
>> +	uint8_t			l_prime[HDCP_L_PRIME_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_ske_send_eks {
>> +	uint8_t			msg_id;
>> +	uint8_t			e_dkey_ks[HDCP_E_DKEY_KS_LEN];
>> +	uint8_t			riv[HDCP_RIV_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_rep_send_receiverid_list {
>> +	uint8_t			msg_id;
>> +	union hdcp2_rx_info	rx_info;
>> +	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];
>> +	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];
>> +	uint8_t			receiver_ids[HDCP_RECEIVER_IDS_MAX_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_rep_send_ack {
>> +	uint8_t			msg_id;
>> +	uint8_t			v[HDCP_LPRIME_HALF_SIZE];
>> +} __packed;
>> +
>> +struct hdcp2_rep_stream_manage {
>> +	uint8_t			msg_id;
>> +	uint8_t			seq_num_m[HDCP_SEQ_NUM_LEN];
>> +	uint16_t		k;
>> +	struct hdcp2_streamid_type
>> streams[MAX_CONTENT_STREAMS_CNT]; }
>> +__packed;
>> +
>> +struct hdcp2_rep_stream_ready {
>> +	uint8_t			msg_id;
>> +	uint8_t			m_prime[HDCP_MPRIME_LEN];
>> +} __packed;
>> +
>> +struct hdcp2_dp_errata_stream_type {
>> +	uint8_t		msg_id;
>> +	uint8_t		stream_type;
>> +} __packed;
>> +
>>   #endif
>> --
>> 2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 22/43] drm/i915: Async execution of hdcp authentication
  2018-02-14 14:13 ` [PATCH 22/43] drm/i915: Async execution of hdcp authentication Ramalingam C
@ 2018-02-22 14:39   ` Sean Paul
  2018-02-26  6:32     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Sean Paul @ 2018-02-22 14:39 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi, tomas.winkler

On Wed, Feb 14, 2018 at 07:43:37PM +0530, Ramalingam C wrote:
> Each HDCP authentication, could take upto 5.1Sec, based on the
> downstream HDCP topology.
> 
> Hence to avoid this much delay in the atomic_commit path, this patch
> schedules the HDCP authentication into a asynchronous work.
> 
> This keeps the UI active, by enabling the flips in parallel to
> HDCP auth.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c |  1 +
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  drivers/gpu/drm/i915/intel_hdcp.c    | 36 ++++++++++++++++++++++--------------
>  3 files changed, 24 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 30e38cbeface..048d60b5143b 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -15317,6 +15317,7 @@ static void intel_hpd_poll_fini(struct drm_device *dev)
>  		if (connector->hdcp_shim) {
>  			cancel_delayed_work_sync(&connector->hdcp_check_work);
>  			cancel_work_sync(&connector->hdcp_prop_work);
> +			cancel_work_sync(&connector->hdcp_enable_work);
>  		}
>  	}
>  	drm_connector_list_iter_end(&conn_iter);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 898064e8bea7..7b9e5f70826f 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -412,6 +412,7 @@ struct intel_connector {
>  	uint64_t hdcp_value; /* protected by hdcp_mutex */
>  	struct delayed_work hdcp_check_work;
>  	struct work_struct hdcp_prop_work;
> +	struct work_struct hdcp_enable_work;
>  };
>  
>  struct intel_digital_connector_state {
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 14ca5d3057a7..e03bd376d92c 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -600,8 +600,14 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  	for (i = 0; i < tries; i++) {
>  		ret = intel_hdcp_auth(conn_to_dig_port(connector),
>  				      connector->hdcp_shim);
> -		if (!ret)
> +		if (!ret) {
> +			connector->hdcp_value =
> +					DRM_MODE_CONTENT_PROTECTION_ENABLED;
> +			schedule_work(&connector->hdcp_prop_work);
> +			schedule_delayed_work(&connector->hdcp_check_work,
> +					      DRM_HDCP_CHECK_PERIOD_MS);
>  			return 0;
> +		}
>  
>  		DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret);
>  
> @@ -613,6 +619,17 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  	return ret;
>  }
>  
> +static void intel_hdcp_enable_work(struct work_struct *work)
> +{
> +	struct intel_connector *connector = container_of(work,
> +							 struct intel_connector,
> +							 hdcp_enable_work);
> +
> +	mutex_lock(&connector->hdcp_mutex);
> +	_intel_hdcp_enable(connector);
> +	mutex_unlock(&connector->hdcp_mutex);
> +}
> +
>  static void intel_hdcp_check_work(struct work_struct *work)
>  {
>  	struct intel_connector *connector = container_of(to_delayed_work(work),
> @@ -669,29 +686,20 @@ int intel_hdcp_init(struct intel_connector *connector,
>  	mutex_init(&connector->hdcp_mutex);
>  	INIT_DELAYED_WORK(&connector->hdcp_check_work, intel_hdcp_check_work);
>  	INIT_WORK(&connector->hdcp_prop_work, intel_hdcp_prop_work);
> +	INIT_WORK(&connector->hdcp_enable_work, intel_hdcp_enable_work);
>  	return 0;
>  }
>  
>  int intel_hdcp_enable(struct intel_connector *connector)
>  {
> -	int ret;
> -
>  	if (!connector->hdcp_shim)
>  		return -ENOENT;
>  
>  	mutex_lock(&connector->hdcp_mutex);

Why do you need to hold this lock to schedule the worker?

> -
> -	ret = _intel_hdcp_enable(connector);
> -	if (ret)
> -		goto out;
> -
> -	connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
> -	schedule_work(&connector->hdcp_prop_work);
> -	schedule_delayed_work(&connector->hdcp_check_work,
> -			      DRM_HDCP_CHECK_PERIOD_MS);
> -out:
> +	schedule_work(&connector->hdcp_enable_work);

How is this worker cancelled when appropriate (enable/disable, hotplug, etc)?

I'm not convinced the extra complexity/worker is worth it. While it's possible
it _could_ take 5 seconds, however I've never experienced any lengthy delays in
practice. IMO, it's more important to remove the modeset requirement (we've
fixed this in CrOS already) than it is to do HDCP asynchronously.

Sean

>  	mutex_unlock(&connector->hdcp_mutex);
> -	return ret;
> +
> +	return 0;
>  }
>  
>  int intel_hdcp_disable(struct intel_connector *connector)
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp
  2018-02-14 14:13 ` [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp Ramalingam C
@ 2018-02-22 14:47   ` Sean Paul
  2018-02-26  6:05     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Sean Paul @ 2018-02-22 14:47 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi, tomas.winkler

On Wed, Feb 14, 2018 at 07:43:38PM +0530, Ramalingam C wrote:
> Considering the upcoming significant no HDCP2.2 variables, it will
> be clean to have separate struct fo HDCP.
> 
> New structure called intel_hdcp is introduced.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c |   9 ++-
>  drivers/gpu/drm/i915/intel_dp.c      |   4 +-
>  drivers/gpu/drm/i915/intel_drv.h     |  20 +++--
>  drivers/gpu/drm/i915/intel_hdcp.c    | 141 ++++++++++++++++++++---------------
>  4 files changed, 100 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 048d60b5143b..22097349529b 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -15314,10 +15314,11 @@ 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);
> -			cancel_work_sync(&connector->hdcp_enable_work);
> +		if (connector->hdcp && connector->hdcp->hdcp_shim) {
> +			cancel_delayed_work_sync(
> +					&connector->hdcp->hdcp_check_work);
> +			cancel_work_sync(&connector->hdcp->hdcp_prop_work);
> +			cancel_work_sync(&connector->hdcp->hdcp_enable_work);
>  		}
>  	}
>  	drm_connector_list_iter_end(&conn_iter);
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f20b25f98e5a..80476689754f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5445,7 +5445,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
>  		WARN(iret, "Acquiring modeset locks failed with %i\n", iret);
>  
>  		/* Short pulse can signify loss of hdcp authentication */
> -		intel_hdcp_check_link(intel_dp->attached_connector);
> +		if (intel_dp->attached_connector->hdcp)
> +			intel_hdcp_check_link(
> +					intel_dp->attached_connector->hdcp);
>  
>  		if (!handled) {
>  			intel_dp->detect_done = false;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7b9e5f70826f..5b170ff7ec14 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -375,6 +375,17 @@ struct intel_hdcp_shim {
>  			    bool *hdcp_capable);
>  };
>  
> +struct intel_hdcp {
> +	struct intel_connector *connector;

You don't need a backpointer, use container_of if necessary.

> +
> +	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 work_struct hdcp_enable_work;
> +};
> +
>  struct intel_connector {
>  	struct drm_connector base;
>  	/*
> @@ -407,12 +418,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 work_struct hdcp_enable_work;
> +	struct intel_hdcp *hdcp;
>  };
>  
>  struct intel_digital_connector_state {
> @@ -1853,7 +1859,7 @@ int intel_hdcp_init(struct intel_connector *connector,
>  		    const struct intel_hdcp_shim *hdcp_shim);
>  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);
> +int intel_hdcp_check_link(struct intel_hdcp *hdcp);
>  bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
>  
>  /* intel_psr.c */
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index e03bd376d92c..9147fb17a9fc 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -545,8 +545,9 @@ struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector)
>  	return enc_to_dig_port(&intel_attached_encoder(&connector->base)->base);
>  }
>  
> -static int _intel_hdcp_disable(struct intel_connector *connector)
> +static int _intel_hdcp_disable(struct intel_hdcp *hdcp)
>  {
> +	struct intel_connector *connector = hdcp->connector;

I'm not sure why we need to change all of the function arguments to intel_hdcp
if the first thing we do is fetch the connector.

>  	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>  	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>  	enum port port = intel_dig_port->base.port;
> @@ -562,7 +563,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>  		return -ETIMEDOUT;
>  	}
>  
> -	ret = connector->hdcp_shim->toggle_signalling(intel_dig_port, false);
> +	ret = hdcp->hdcp_shim->toggle_signalling(intel_dig_port, false);
>  	if (ret) {
>  		DRM_ERROR("Failed to disable HDCP signalling\n");
>  		return ret;
> @@ -572,8 +573,9 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>  	return 0;
>  }
>  
> -static int _intel_hdcp_enable(struct intel_connector *connector)
> +static int _intel_hdcp_enable(struct intel_hdcp *hdcp)
>  {
> +	struct intel_connector *connector = hdcp->connector;
>  	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>  	int i, ret, tries = 3;
>  
> @@ -599,12 +601,12 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  	/* Incase of authentication failures, HDCP spec expects reauth. */
>  	for (i = 0; i < tries; i++) {
>  		ret = intel_hdcp_auth(conn_to_dig_port(connector),
> -				      connector->hdcp_shim);
> +				      hdcp->hdcp_shim);
>  		if (!ret) {
> -			connector->hdcp_value =
> +			hdcp->hdcp_value =
>  					DRM_MODE_CONTENT_PROTECTION_ENABLED;
> -			schedule_work(&connector->hdcp_prop_work);
> -			schedule_delayed_work(&connector->hdcp_check_work,
> +			schedule_work(&hdcp->hdcp_prop_work);
> +			schedule_delayed_work(&hdcp->hdcp_check_work,
>  					      DRM_HDCP_CHECK_PERIOD_MS);
>  			return 0;
>  		}
> @@ -612,7 +614,7 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  		DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret);
>  
>  		/* Ensuring HDCP encryption and signalling are stopped. */
> -		_intel_hdcp_disable(connector);
> +		_intel_hdcp_disable(hdcp);
>  	}
>  
>  	DRM_ERROR("HDCP authentication failed (%d tries/%d)\n", tries, ret);
> @@ -621,47 +623,45 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  
>  static void intel_hdcp_enable_work(struct work_struct *work)
>  {
> -	struct intel_connector *connector = container_of(work,
> -							 struct intel_connector,
> -							 hdcp_enable_work);
> +	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
> +					       hdcp_enable_work);
>  
> -	mutex_lock(&connector->hdcp_mutex);
> -	_intel_hdcp_enable(connector);
> -	mutex_unlock(&connector->hdcp_mutex);
> +	mutex_lock(&hdcp->hdcp_mutex);
> +	_intel_hdcp_enable(hdcp);
> +	mutex_unlock(&hdcp->hdcp_mutex);
>  }
>  
>  static void intel_hdcp_check_work(struct work_struct *work)
>  {
> -	struct intel_connector *connector = container_of(to_delayed_work(work),
> -							 struct intel_connector,
> -							 hdcp_check_work);
> -	if (!intel_hdcp_check_link(connector))
> -		schedule_delayed_work(&connector->hdcp_check_work,
> +	struct intel_hdcp *hdcp = container_of(to_delayed_work(work),
> +					       struct intel_hdcp,
> +					       hdcp_check_work);
> +	if (!intel_hdcp_check_link(hdcp))
> +		schedule_delayed_work(&hdcp->hdcp_check_work,
>  				      DRM_HDCP_CHECK_PERIOD_MS);
>  }
>  
>  static void intel_hdcp_prop_work(struct work_struct *work)
>  {
> -	struct intel_connector *connector = container_of(work,
> -							 struct intel_connector,
> -							 hdcp_prop_work);
> -	struct drm_device *dev = connector->base.dev;
> +	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
> +					       hdcp_prop_work);
> +	struct drm_device *dev = hdcp->connector->base.dev;
>  	struct drm_connector_state *state;
>  
>  	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
> -	mutex_lock(&connector->hdcp_mutex);
> +	mutex_lock(&hdcp->hdcp_mutex);
>  
>  	/*
>  	 * This worker is only used to flip between ENABLED/DESIRED. Either of
>  	 * those to UNDESIRED is handled by core. If hdcp_value == UNDESIRED,
>  	 * we're running just after hdcp has been disabled, so just exit
>  	 */
> -	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> -		state = connector->base.state;
> -		state->content_protection = connector->hdcp_value;
> +	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> +		state = hdcp->connector->base.state;
> +		state->content_protection = hdcp->hdcp_value;
>  	}
>  
> -	mutex_unlock(&connector->hdcp_mutex);
> +	mutex_unlock(&hdcp->hdcp_mutex);
>  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>  }
>  
> @@ -676,48 +676,64 @@ int intel_hdcp_init(struct intel_connector *connector,
>  		    const struct intel_hdcp_shim *hdcp_shim)
>  {
>  	int ret;
> +	struct intel_hdcp *hdcp;
> +
> +	hdcp = kzalloc(sizeof(struct intel_hdcp), GFP_KERNEL);

You're leaking this. You probably don't need it to be dynamically allocated.

> +	if (!hdcp) {
> +		ret = -ENOMEM;
> +		goto err;
> +	}
>  
>  	ret = drm_connector_attach_content_protection_property(
>  			&connector->base);
>  	if (ret)
> -		return ret;
> +		goto err;
> +
> +	hdcp->hdcp_shim = hdcp_shim;
> +	mutex_init(&hdcp->hdcp_mutex);
> +	INIT_DELAYED_WORK(&hdcp->hdcp_check_work, intel_hdcp_check_work);
> +	INIT_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
> +	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
>  
> -	connector->hdcp_shim = hdcp_shim;
> -	mutex_init(&connector->hdcp_mutex);
> -	INIT_DELAYED_WORK(&connector->hdcp_check_work, intel_hdcp_check_work);
> -	INIT_WORK(&connector->hdcp_prop_work, intel_hdcp_prop_work);
> -	INIT_WORK(&connector->hdcp_enable_work, intel_hdcp_enable_work);
> +	connector->hdcp = hdcp;
>  	return 0;
> +
> +err:
> +	kfree(hdcp);
> +	return ret;
>  }
>  
>  int intel_hdcp_enable(struct intel_connector *connector)
>  {
> -	if (!connector->hdcp_shim)
> +	struct intel_hdcp *hdcp = connector->hdcp;
> +
> +	if (!hdcp || !hdcp->hdcp_shim)

Is it possible for hdcp to be != NULL, but hdcp_shim == NULL?

>  		return -ENOENT;
>  
> -	mutex_lock(&connector->hdcp_mutex);
> -	schedule_work(&connector->hdcp_enable_work);
> -	mutex_unlock(&connector->hdcp_mutex);
> +	mutex_lock(&hdcp->hdcp_mutex);
> +	schedule_work(&hdcp->hdcp_enable_work);
> +	mutex_unlock(&hdcp->hdcp_mutex);
>  
>  	return 0;
>  }
>  
>  int intel_hdcp_disable(struct intel_connector *connector)
>  {
> +	struct intel_hdcp *hdcp = connector->hdcp;
>  	int ret = 0;
>  
> -	if (!connector->hdcp_shim)
> +	if (!hdcp || !hdcp->hdcp_shim)
>  		return -ENOENT;
>  
> -	mutex_lock(&connector->hdcp_mutex);
> +	mutex_lock(&hdcp->hdcp_mutex);
>  
> -	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
> -		ret = _intel_hdcp_disable(connector);
> +	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
> +		ret = _intel_hdcp_disable(hdcp);
>  	}
>  
> -	mutex_unlock(&connector->hdcp_mutex);
> -	cancel_delayed_work_sync(&connector->hdcp_check_work);
> +	mutex_unlock(&hdcp->hdcp_mutex);
> +	cancel_delayed_work_sync(&hdcp->hdcp_check_work);
>  	return ret;
>  }
>  
> @@ -755,19 +771,20 @@ 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)
> +int intel_hdcp_check_link(struct intel_hdcp *hdcp)
>  {
> +	struct intel_connector *connector = hdcp->connector;
>  	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>  	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>  	enum port port = intel_dig_port->base.port;
>  	int ret = 0;
>  
> -	if (!connector->hdcp_shim)
> +	if (!hdcp->hdcp_shim)
>  		return -ENOENT;
>  
> -	mutex_lock(&connector->hdcp_mutex);
> +	mutex_lock(&hdcp->hdcp_mutex);
>  
> -	if (connector->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
> +	if (hdcp->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
>  		goto out;
>  
>  	if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) {
> @@ -775,17 +792,17 @@ int intel_hdcp_check_link(struct intel_connector *connector)
>  			  connector->base.name, connector->base.base.id,
>  			  I915_READ(PORT_HDCP_STATUS(port)));
>  		ret = -ENXIO;
> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> -		schedule_work(&connector->hdcp_prop_work);
> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> +		schedule_work(&hdcp->hdcp_prop_work);
>  		goto out;
>  	}
>  
> -	if (connector->hdcp_shim->check_link(intel_dig_port)) {
> -		if (connector->hdcp_value !=
> +	if (hdcp->hdcp_shim->check_link(intel_dig_port)) {
> +		if (hdcp->hdcp_value !=
>  		    DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> -			connector->hdcp_value =
> +			hdcp->hdcp_value =
>  				DRM_MODE_CONTENT_PROTECTION_ENABLED;
> -			schedule_work(&connector->hdcp_prop_work);
> +			schedule_work(&hdcp->hdcp_prop_work);
>  		}
>  		goto out;
>  	}
> @@ -793,23 +810,23 @@ int intel_hdcp_check_link(struct intel_connector *connector)
>  	DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n",
>  		      connector->base.name, connector->base.base.id);
>  
> -	ret = _intel_hdcp_disable(connector);
> +	ret = _intel_hdcp_disable(hdcp);
>  	if (ret) {
>  		DRM_ERROR("Failed to disable hdcp (%d)\n", ret);
> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> -		schedule_work(&connector->hdcp_prop_work);
> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> +		schedule_work(&hdcp->hdcp_prop_work);
>  		goto out;
>  	}
>  
> -	ret = _intel_hdcp_enable(connector);
> +	ret = _intel_hdcp_enable(hdcp);
>  	if (ret) {
>  		DRM_ERROR("Failed to enable hdcp (%d)\n", ret);
> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> -		schedule_work(&connector->hdcp_prop_work);
> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> +		schedule_work(&hdcp->hdcp_prop_work);
>  		goto out;
>  	}
>  
>  out:
> -	mutex_unlock(&connector->hdcp_mutex);
> +	mutex_unlock(&hdcp->hdcp_mutex);
>  	return ret;
>  }
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 25/43] drm/i915: Define HDCP2.2 related variables
  2018-02-14 14:13 ` [PATCH 25/43] drm/i915: Define HDCP2.2 related variables Ramalingam C
  2018-02-14 14:36   ` Chris Wilson
@ 2018-02-22 14:59   ` Sean Paul
  2018-02-26  5:46     ` Ramalingam C
  1 sibling, 1 reply; 79+ messages in thread
From: Sean Paul @ 2018-02-22 14:59 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi, tomas.winkler

On Wed, Feb 14, 2018 at 07:43:40PM +0530, Ramalingam C wrote:
> For upcoming implementation of HDCP2.2 in I915, all variable required
> for HDCP2.2 are defined.
> 
> This includes a translation layer called hdcp2_shim for encoder
> specific HDCP2.2 spec deviations.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h  |  5 +++
>  drivers/gpu/drm/i915/intel_drv.h | 91 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 96 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3f8d824dc313..09d31db90a38 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -44,6 +44,7 @@
>  #include <linux/pm_qos.h>
>  #include <linux/reservation.h>
>  #include <linux/shmem_fs.h>
> +#include <linux/mei_hdcp.h>
>  
>  #include <drm/drmP.h>
>  #include <drm/intel-gtt.h>
> @@ -2365,6 +2366,10 @@ struct drm_i915_private {
>  
>  	struct i915_pmu pmu;
>  
> +	/* Mei interface handle */
> +	struct mei_cl_device *mei_cldev;
> +	int mei_ref_cnt;
> +
>  	/*
>  	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
>  	 * will be rejected. Instead look for a better place.
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 1c0d324c1044..9c05049c25d5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -301,6 +301,62 @@ struct intel_panel {
>  	} backlight;
>  };
>  
> +struct intel_hdcp;

Why?

> +
> +#define HDCP_CAPABILITY				BIT(0)
> +#define HDCP2_CAPABILITY			BIT(1)

These names are pretty vague, without a comment it's hard to know what/where
they're used.

It's really hard to review changes where things are just defined. Can you please
squash this patch into the patch where you actually use it?

> +
> +/*
> + * This structure serves as a translation layer between the generic HDCP2.2 code
> + * and the bus-specific code. What that means is that HDCP over HDMI differs
> + * from HDCP over DP, so to account for these differences, we need to
> + * communicate with the receiver through this shim.
> + *
> + * For completeness, the 2 buses differ in the following ways:
> + *	- DP AUX vs. DDC
> + *		HDCP registers on the receiver are set via DP AUX for DP, and
> + *		they are set via DDC for HDMI.
> + *	- Receiver register offsets
> + *		The offsets of the registers are different for DP vs. HDMI
> + *	- Receiver register masks/offsets
> + *		Few register bit definitions are different between DP and HDMI.
> + *	- HDCP signalling
> + *		Needed for HDMI but not for DP.
> + *	- Configure stream type onto receiver
> + *		Needed only for DP but not for HDMI.
> + */
> +struct intel_hdcp2_shim {

Why don't you just use the same shim? No need to duplicate.

> +
> +	/* Write HDCP2.2 messages */
> +	int (*write_msg)(struct intel_digital_port *intel_dig_port, void *buf,
> +			 size_t size);
> +
> +	/* Read HDCP2.2 messages */
> +	int (*read_msg)(struct intel_digital_port *intel_dig_port,
> +			uint8_t msg_id, void *buf, size_t size);
> +
> +	/*
> +	 * Implementation of DP Errata for the communication of stream type to
> +	 * Receivers. Not applicable for HDMI.
> +	 */
> +	int (*config_stream_type)(struct intel_digital_port *intel_dig_port,
> +				  void *buf, size_t size);
> +
> +	/* Enables HDCP signalling on the port. Not applicable for DP. */
> +	int (*toggle_signalling)(struct intel_digital_port *intel_dig_port,
> +				 bool enable);
> +
> +	/* Link Integrity Check */
> +	int (*check_link)(struct intel_digital_port *intel_dig_port);
> +
> +	/* Detects whether Panel is HDCP2.2 capable */
> +	int (*hdcp_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);
> +};
> +
>  /*
>   * This structure serves as a translation layer between the generic HDCP code
>   * and the bus-specific code. What that means is that HDCP over HDMI differs
> @@ -378,6 +434,10 @@ struct intel_hdcp_shim {
>  struct intel_hdcp {
>  	struct intel_connector *connector;
>  
> +	/* Flags to represent the HDCP capability of the platform and panel */
> +	u32 plat_cap;

I don't think you need this. A simple bool supports_hdcp2 would suffice here.

> +	u32 panel_cap;

This should not be stored here. At best it will be complicated to keep
up-to-date and at worst, it will get stale.

> +
>  	const struct intel_hdcp_shim *hdcp_shim;
>  	struct mutex hdcp_mutex;
>  	uint64_t hdcp_value; /* protected by hdcp_mutex */
> @@ -387,6 +447,37 @@ struct intel_hdcp {
>  
>  	/* To indicate the assertion of CP_IRQ */
>  	struct completion cp_irq_recved;
> +
> +	/* HDCP2.2 related definitions */
> +
> +	/* Content Stream Type defined by content owner */
> +	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;
> +
> +	/* Translation layer for encoder specific functions */
> +	const struct intel_hdcp2_shim *hdcp2_shim;
> +
> +	/* mei interface related information */
> +	struct mei_hdcp_data *mei_hdcp_data;
> +
> +	struct delayed_work hdcp2_check_work;
>  };
>  
>  struct intel_connector {
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers
  2018-02-14 14:13 ` [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers Ramalingam C
@ 2018-02-22 15:43   ` Sean Paul
  2018-02-26  5:33     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Sean Paul @ 2018-02-22 15:43 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi, tomas.winkler

On Wed, Feb 14, 2018 at 07:43:41PM +0530, Ramalingam C wrote:
> Intel HDCP2.2 registers are defined with addr offsets and bit details.
> 
> Macros are defined for referencing the register offsets based on the
> port index.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 120 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 120 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index f6afa5e5e7c1..6a57b12d8dab 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2268,6 +2268,126 @@ enum i915_power_well_id {
>  				   _PORT_TX_DW14_LN0_C) +		\
>  	      _BXT_LANE_OFFSET(lane))
>  
> +/*
> + *HDCP Registers
> + **/

Do you need a new section for these? Just stick them with the existing HDCP
registers.

> +
> +/*
> + * HW register offsets are incresing in the order of B, C, D, A, F, E.
> + * But enum value increses in the order of A, B, C, D, E, F.
> + * So port numbers are adjusted for offset calculations.
> + */
> +#define HDCP_PORT_INDEX_ADJUST(p)	(((p) == PORT_A ? PORT_E : \
> +						(p) == PORT_E ? (0x6) : \
> +						(p)) - 1)
> +#define _MMIO_HDCP_PORT(p, a, b)	_MMIO_PORT(HDCP_PORT_INDEX_ADJUST(p), \
> +						a, b)

Can you do this the same was as I did _PORT_HDCP_AUTHENC, with _PICK? Then you
aren't limited to just ports a and b (and you don't need the arithmatic above.

> +
> +
> +/* RO Registers for I915. Programmable from FW(ME) only */
> +#define HDCP2_AUTH_DDI_A		0x66898
> +#define HDCP2_AUTH_DDI_B		0x66598
> +#define HDCP2_AUTH_DDI_C		0x66698
> +#define HDCP2_AUTH_DDI_D		0x66798
> +#define HDCP2_AUTH_DDI_E		0x66A98
> +#define HDCP2_AUTH_DDI_F		0x66998
> +#define   AUTH_LINK_AUTHENTICATED	(1 << 31)
> +#define   AUTH_LINK_TYPE		(1 << 30)
> +#define   AUTH_FORCE_CLR_INPUTCTR	(1 << 19)
> +#define   AUTH_CLR_KEYS			(1 << 18)
> +
> +#define HDCP2_AUTH_DDI(port)		_MMIO_HDCP_PORT(port, \
> +							HDCP2_AUTH_DDI_B, \
> +							HDCP2_AUTH_DDI_C)
> +
> +
> +/* Multi stream DP registers */
> +/* RO Registers for I915. Programmable from FW(ME) only */
> +#define HDCP2_AUTH_STREAM_A		0x66F00
> +#define HDCP2_AUTH_STREAM_B		0x66F04
> +#define HDCP2_AUTH_STREAM_C		0x66F08
> +#define HDCP2_AUTH_STREAM_D		0x66F0C
> +#define   AUTH_STREAM_TYPE		(1 << 31)
> +
> +#define HDCP2_AUTH_STREAM(stream)	_MMIO_PORT(stream, \
> +						   HDCP2_AUTH_STREAM_A, \
> +						   HDCP2_AUTH_STREAM_B)
> +
> +/* RW Registers for I915 */
> +#define HDCP2_CTL_DDI_A			0x668B0
> +#define HDCP2_CTL_DDI_B			0x665B0
> +#define HDCP2_CTL_DDI_C			0x666B0
> +#define HDCP2_CTL_DDI_D			0x667B0
> +#define HDCP2_CTL_DDI_E			0x66AB0
> +#define HDCP2_CTL_DDI_F			0x669B0
> +#define   CTL_LINK_ENCRYPTION_REQ	(1 << 31)
> +#define   CTL_VBID_TYPE_SELECT_SHIFT	29
> +#define   CTL_VBID_TYPE_SELECT_MASK	(3 << CTL_VBID_TYPE_SELECT_SHIFT)
> +
> +#define HDCP2_CTR_DDI(port)		_MMIO_HDCP_PORT(port, HDCP2_CTL_DDI_B, \
> +							HDCP2_CTL_DDI_C)
> +
> +/* RO only. For Debug purpose */
> +#define HDCP2_INPUTCTR_DDI_A		0x668B8
> +#define HDCP2_INPUTCTR_DDI_B		0x665B8
> +#define HDCP2_INPUTCTR_DDI_C		0x666B8
> +#define HDCP2_INPUTCTR_DDI_D		0x667B8
> +#define HDCP2_INPUTCTR_DDI_E		0x66AB8
> +#define HDCP2_INPUTCTR_DDI_F		0x669B8
> +
> +#define HDCP2_INPUTCTR_LO_DDI(port)	_MMIO_HDCP_PORT(port, \
> +							HDCP2_INPUTCTL_DDI_B, \
> +							HDCP2_INPUTCTL_DDI_C)
> +
> +#define HDCP2_INPUTCTR_HI_DDI(port)	_MMIO_HDCP_PORT(port, \
> +						(HDCP2_INPUTCTL_DDI_B + 4), \
> +						(HDCP2_INPUTCTL_DDI_C + 4))
> +
> +/* RO Registers for I915. Programmable from FW(ME) only */
> +#define HDCP2_RIV_DDI_A			0x66890
> +#define HDCP2_RIV_DDI_B			0x66590
> +#define HDCP2_RIV_DDI_C			0x66690
> +#define HDCP2_RIV_DDI_D			0x66790
> +#define HDCP2_RIV_DDI_E			0x66A90
> +#define HDCP2_RIV_DDI_F			0x66990
> +
> +#define HDCP2_RIV_LO_DDI(port)		_MMIO_HDCP_PORT(port, HDCP2_RIV_DDI_B, \
> +							HDCP2_RIV_DDI_C)
> +
> +#define HDCP2_RIV_HI_DDI(port)		_MMIO_HDCP_PORT(port, \
> +							(HDCP2_RIV_DDI_B + 4), \
> +							(HDCP2_RIV_DDI_C + 4))
> +
> +/* RO only. For Debug purpose */
> +#define HDCP2_STATUS_DDI_A		0x668B4
> +#define HDCP2_STATUS_DDI_B		0x665B4
> +#define HDCP2_STATUS_DDI_C		0x666B4
> +#define HDCP2_STATUS_DDI_D		0x667B4
> +#define HDCP2_STATUS_DDI_E		0x66AB4
> +#define HDCP2_STATUS_DDI_F		0x669B4
> +#define   STREAM_ENCRYPTION_STATUS_A	(1 << 31)
> +#define   STREAM_ENCRYPTION_STATUS_B	(1 << 30)
> +#define   STREAM_ENCRYPTION_STATUS_C	(1 << 29)
> +#define   LINK_TYPE_STATUS		(1 << 22)
> +#define   LINK_AUTH_STATUS		(1 << 21)
> +#define   LINK_ENCRYPTION_STATUS	(1 << 20)
> +
> +#define HDCP2_STATUS_DDI(port)		_MMIO_HDCP_PORT(port, \
> +							HDCP2_STATUS_DDI_B, \
> +							HDCP2_STATUS_DDI_C)
> +
> +/* RO only. For Debug purpose */
> +#define HDCP2_STREAM_STATUS_A		0x668C0
> +#define HDCP2_STREAM_STATUS_B		0x665C0
> +#define HDCP2_STREAM_STATUS_C		0x666C0
> +#define HDCP2_STREAM_STATUS_D		0x667C0
> +#define   STREAM_ENCRYPTION_STATUS	(1 << 31)
> +#define   STREAM_TYPE_STATUS		(1 << 30)
> +
> +#define HDCP2_STREAM_STATUS(stream)	_MMIO_HDCP_PORT(stream, \
> +							HDCP2_STREAM_STATUS_B, \
> +							HDCP2_STREAM_STATUS_C)
> +
>  /* UAIMI scratch pad register 1 */
>  #define UAIMI_SPR1			_MMIO(0x4F074)
>  /* SKL VccIO mask */
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 24/43] drm/i915: wait for cp_irq
  2018-02-14 14:13 ` [PATCH 24/43] drm/i915: wait for cp_irq Ramalingam C
@ 2018-02-22 15:46   ` Sean Paul
  2018-02-26  5:49     ` Ramalingam C
  0 siblings, 1 reply; 79+ messages in thread
From: Sean Paul @ 2018-02-22 15:46 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi, tomas.winkler

On Wed, Feb 14, 2018 at 07:43:39PM +0530, Ramalingam C wrote:
> DP HDCP asserts the CP_IRQ to indicate the msg availability and
> auth state change at the panel.
> 
> Implements a completion structure to communicate the cp_irq
> assertion and provides a function to wait for cp_irq with a timeout.
> 
> This can be used for implementation of both HDCP1.4 and HDCP2.2
> 

But it's not. Please introduce code in the same patch as when it's used.

> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c   | 28 ++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/intel_drv.h  |  3 +++
>  drivers/gpu/drm/i915/intel_hdcp.c |  1 +
>  3 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 80476689754f..8847f1a36504 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4402,6 +4402,7 @@ static bool
>  intel_dp_short_pulse(struct intel_dp *intel_dp)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
> +	struct intel_connector *connector = intel_dp->attached_connector;
>  	u8 sink_irq_vector = 0;
>  	u8 old_sink_count = intel_dp->sink_count;
>  	bool ret;
> @@ -4436,8 +4437,13 @@ 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) {
> +			if (connector->hdcp)
> +				complete(&connector->hdcp->cp_irq_recved);
> +		}
> +
> +		if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
> +			DRM_DEBUG_DRIVER("Sink specific irq unhandled\n");
>  	}
>  
>  	intel_dp_check_link_status(intel_dp);
> @@ -5049,6 +5055,24 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
>  	pps_unlock(intel_dp);
>  }
>  
> +static int wait_for_cp_irq(struct completion *cp_irq_recved, int timeout)
> +{
> +	long ret;
> +
> +	if (completion_done(cp_irq_recved))
> +		reinit_completion(cp_irq_recved);
> +
> +	ret = wait_for_completion_interruptible_timeout(cp_irq_recved,
> +							msecs_to_jiffies(
> +							timeout));
> +	reinit_completion(cp_irq_recved);
> +	if (ret < 0)
> +		return (int)ret;
> +	else if (!ret)
> +		return -ETIMEDOUT;
> +	return 0;
> +}
> +
>  static
>  int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port,
>  				u8 *an)
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 5b170ff7ec14..1c0d324c1044 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -384,6 +384,9 @@ struct intel_hdcp {
>  	struct delayed_work hdcp_check_work;
>  	struct work_struct hdcp_prop_work;
>  	struct work_struct hdcp_enable_work;
> +
> +	/* To indicate the assertion of CP_IRQ */
> +	struct completion cp_irq_recved;
>  };
>  
>  struct intel_connector {
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 9147fb17a9fc..31e1af5b43ec 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -695,6 +695,7 @@ int intel_hdcp_init(struct intel_connector *connector,
>  	INIT_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
>  	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
>  
> +	init_completion(&hdcp->cp_irq_recved);
>  	connector->hdcp = hdcp;
>  	return 0;
>  
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers
  2018-02-22 15:43   ` Sean Paul
@ 2018-02-26  5:33     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-26  5:33 UTC (permalink / raw)
  To: Sean Paul; +Cc: daniel.vetter, intel-gfx, tomas.winkler, rodrigo.vivi



On Thursday 22 February 2018 09:13 PM, Sean Paul wrote:
> On Wed, Feb 14, 2018 at 07:43:41PM +0530, Ramalingam C wrote:
>> Intel HDCP2.2 registers are defined with addr offsets and bit details.
>>
>> Macros are defined for referencing the register offsets based on the
>> port index.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_reg.h | 120 ++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 120 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
>> index f6afa5e5e7c1..6a57b12d8dab 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -2268,6 +2268,126 @@ enum i915_power_well_id {
>>   				   _PORT_TX_DW14_LN0_C) +		\
>>   	      _BXT_LANE_OFFSET(lane))
>>   
>> +/*
>> + *HDCP Registers
>> + **/
> Do you need a new section for these? Just stick them with the existing HDCP
> registers.
ok
>
>> +
>> +/*
>> + * HW register offsets are incresing in the order of B, C, D, A, F, E.
>> + * But enum value increses in the order of A, B, C, D, E, F.
>> + * So port numbers are adjusted for offset calculations.
>> + */
>> +#define HDCP_PORT_INDEX_ADJUST(p)	(((p) == PORT_A ? PORT_E : \
>> +						(p) == PORT_E ? (0x6) : \
>> +						(p)) - 1)
>> +#define _MMIO_HDCP_PORT(p, a, b)	_MMIO_PORT(HDCP_PORT_INDEX_ADJUST(p), \
>> +						a, b)
> Can you do this the same was as I did _PORT_HDCP_AUTHENC, with _PICK? Then you
> aren't limited to just ports a and b (and you don't need the arithmatic above.
Sure. I will use _PICK. Thanks!
--Ram
>
>> +
>> +
>> +/* RO Registers for I915. Programmable from FW(ME) only */
>> +#define HDCP2_AUTH_DDI_A		0x66898
>> +#define HDCP2_AUTH_DDI_B		0x66598
>> +#define HDCP2_AUTH_DDI_C		0x66698
>> +#define HDCP2_AUTH_DDI_D		0x66798
>> +#define HDCP2_AUTH_DDI_E		0x66A98
>> +#define HDCP2_AUTH_DDI_F		0x66998
>> +#define   AUTH_LINK_AUTHENTICATED	(1 << 31)
>> +#define   AUTH_LINK_TYPE		(1 << 30)
>> +#define   AUTH_FORCE_CLR_INPUTCTR	(1 << 19)
>> +#define   AUTH_CLR_KEYS			(1 << 18)
>> +
>> +#define HDCP2_AUTH_DDI(port)		_MMIO_HDCP_PORT(port, \
>> +							HDCP2_AUTH_DDI_B, \
>> +							HDCP2_AUTH_DDI_C)
>> +
>> +
>> +/* Multi stream DP registers */
>> +/* RO Registers for I915. Programmable from FW(ME) only */
>> +#define HDCP2_AUTH_STREAM_A		0x66F00
>> +#define HDCP2_AUTH_STREAM_B		0x66F04
>> +#define HDCP2_AUTH_STREAM_C		0x66F08
>> +#define HDCP2_AUTH_STREAM_D		0x66F0C
>> +#define   AUTH_STREAM_TYPE		(1 << 31)
>> +
>> +#define HDCP2_AUTH_STREAM(stream)	_MMIO_PORT(stream, \
>> +						   HDCP2_AUTH_STREAM_A, \
>> +						   HDCP2_AUTH_STREAM_B)
>> +
>> +/* RW Registers for I915 */
>> +#define HDCP2_CTL_DDI_A			0x668B0
>> +#define HDCP2_CTL_DDI_B			0x665B0
>> +#define HDCP2_CTL_DDI_C			0x666B0
>> +#define HDCP2_CTL_DDI_D			0x667B0
>> +#define HDCP2_CTL_DDI_E			0x66AB0
>> +#define HDCP2_CTL_DDI_F			0x669B0
>> +#define   CTL_LINK_ENCRYPTION_REQ	(1 << 31)
>> +#define   CTL_VBID_TYPE_SELECT_SHIFT	29
>> +#define   CTL_VBID_TYPE_SELECT_MASK	(3 << CTL_VBID_TYPE_SELECT_SHIFT)
>> +
>> +#define HDCP2_CTR_DDI(port)		_MMIO_HDCP_PORT(port, HDCP2_CTL_DDI_B, \
>> +							HDCP2_CTL_DDI_C)
>> +
>> +/* RO only. For Debug purpose */
>> +#define HDCP2_INPUTCTR_DDI_A		0x668B8
>> +#define HDCP2_INPUTCTR_DDI_B		0x665B8
>> +#define HDCP2_INPUTCTR_DDI_C		0x666B8
>> +#define HDCP2_INPUTCTR_DDI_D		0x667B8
>> +#define HDCP2_INPUTCTR_DDI_E		0x66AB8
>> +#define HDCP2_INPUTCTR_DDI_F		0x669B8
>> +
>> +#define HDCP2_INPUTCTR_LO_DDI(port)	_MMIO_HDCP_PORT(port, \
>> +							HDCP2_INPUTCTL_DDI_B, \
>> +							HDCP2_INPUTCTL_DDI_C)
>> +
>> +#define HDCP2_INPUTCTR_HI_DDI(port)	_MMIO_HDCP_PORT(port, \
>> +						(HDCP2_INPUTCTL_DDI_B + 4), \
>> +						(HDCP2_INPUTCTL_DDI_C + 4))
>> +
>> +/* RO Registers for I915. Programmable from FW(ME) only */
>> +#define HDCP2_RIV_DDI_A			0x66890
>> +#define HDCP2_RIV_DDI_B			0x66590
>> +#define HDCP2_RIV_DDI_C			0x66690
>> +#define HDCP2_RIV_DDI_D			0x66790
>> +#define HDCP2_RIV_DDI_E			0x66A90
>> +#define HDCP2_RIV_DDI_F			0x66990
>> +
>> +#define HDCP2_RIV_LO_DDI(port)		_MMIO_HDCP_PORT(port, HDCP2_RIV_DDI_B, \
>> +							HDCP2_RIV_DDI_C)
>> +
>> +#define HDCP2_RIV_HI_DDI(port)		_MMIO_HDCP_PORT(port, \
>> +							(HDCP2_RIV_DDI_B + 4), \
>> +							(HDCP2_RIV_DDI_C + 4))
>> +
>> +/* RO only. For Debug purpose */
>> +#define HDCP2_STATUS_DDI_A		0x668B4
>> +#define HDCP2_STATUS_DDI_B		0x665B4
>> +#define HDCP2_STATUS_DDI_C		0x666B4
>> +#define HDCP2_STATUS_DDI_D		0x667B4
>> +#define HDCP2_STATUS_DDI_E		0x66AB4
>> +#define HDCP2_STATUS_DDI_F		0x669B4
>> +#define   STREAM_ENCRYPTION_STATUS_A	(1 << 31)
>> +#define   STREAM_ENCRYPTION_STATUS_B	(1 << 30)
>> +#define   STREAM_ENCRYPTION_STATUS_C	(1 << 29)
>> +#define   LINK_TYPE_STATUS		(1 << 22)
>> +#define   LINK_AUTH_STATUS		(1 << 21)
>> +#define   LINK_ENCRYPTION_STATUS	(1 << 20)
>> +
>> +#define HDCP2_STATUS_DDI(port)		_MMIO_HDCP_PORT(port, \
>> +							HDCP2_STATUS_DDI_B, \
>> +							HDCP2_STATUS_DDI_C)
>> +
>> +/* RO only. For Debug purpose */
>> +#define HDCP2_STREAM_STATUS_A		0x668C0
>> +#define HDCP2_STREAM_STATUS_B		0x665C0
>> +#define HDCP2_STREAM_STATUS_C		0x666C0
>> +#define HDCP2_STREAM_STATUS_D		0x667C0
>> +#define   STREAM_ENCRYPTION_STATUS	(1 << 31)
>> +#define   STREAM_TYPE_STATUS		(1 << 30)
>> +
>> +#define HDCP2_STREAM_STATUS(stream)	_MMIO_HDCP_PORT(stream, \
>> +							HDCP2_STREAM_STATUS_B, \
>> +							HDCP2_STREAM_STATUS_C)
>> +
>>   /* UAIMI scratch pad register 1 */
>>   #define UAIMI_SPR1			_MMIO(0x4F074)
>>   /* SKL VccIO mask */
>> -- 
>> 2.7.4
>>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 25/43] drm/i915: Define HDCP2.2 related variables
  2018-02-22 14:59   ` Sean Paul
@ 2018-02-26  5:46     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-26  5:46 UTC (permalink / raw)
  To: Sean Paul; +Cc: daniel.vetter, intel-gfx, tomas.winkler, rodrigo.vivi



On Thursday 22 February 2018 08:29 PM, Sean Paul wrote:
> On Wed, Feb 14, 2018 at 07:43:40PM +0530, Ramalingam C wrote:
>> For upcoming implementation of HDCP2.2 in I915, all variable required
>> for HDCP2.2 are defined.
>>
>> This includes a translation layer called hdcp2_shim for encoder
>> specific HDCP2.2 spec deviations.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_drv.h  |  5 +++
>>   drivers/gpu/drm/i915/intel_drv.h | 91 ++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 96 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index 3f8d824dc313..09d31db90a38 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -44,6 +44,7 @@
>>   #include <linux/pm_qos.h>
>>   #include <linux/reservation.h>
>>   #include <linux/shmem_fs.h>
>> +#include <linux/mei_hdcp.h>
>>   
>>   #include <drm/drmP.h>
>>   #include <drm/intel-gtt.h>
>> @@ -2365,6 +2366,10 @@ struct drm_i915_private {
>>   
>>   	struct i915_pmu pmu;
>>   
>> +	/* Mei interface handle */
>> +	struct mei_cl_device *mei_cldev;
>> +	int mei_ref_cnt;
>> +
>>   	/*
>>   	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
>>   	 * will be rejected. Instead look for a better place.
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index 1c0d324c1044..9c05049c25d5 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -301,6 +301,62 @@ struct intel_panel {
>>   	} backlight;
>>   };
>>   
>> +struct intel_hdcp;
> Why?
Sorry this is left over from previous version of hdcp2_shim. I will 
remove it.
>
>> +
>> +#define HDCP_CAPABILITY				BIT(0)
>> +#define HDCP2_CAPABILITY			BIT(1)
> These names are pretty vague, without a comment it's hard to know what/where
> they're used.
These bit definitions are added to update and check the hdcp version 
capability in platform and panel.
If plat_cap and panel_cap are dropped, these definitions are irrelevant.
>
> It's really hard to review changes where things are just defined. Can you please
> squash this patch into the patch where you actually use it?
>
>> +
>> +/*
>> + * This structure serves as a translation layer between the generic HDCP2.2 code
>> + * and the bus-specific code. What that means is that HDCP over HDMI differs
>> + * from HDCP over DP, so to account for these differences, we need to
>> + * communicate with the receiver through this shim.
>> + *
>> + * For completeness, the 2 buses differ in the following ways:
>> + *	- DP AUX vs. DDC
>> + *		HDCP registers on the receiver are set via DP AUX for DP, and
>> + *		they are set via DDC for HDMI.
>> + *	- Receiver register offsets
>> + *		The offsets of the registers are different for DP vs. HDMI
>> + *	- Receiver register masks/offsets
>> + *		Few register bit definitions are different between DP and HDMI.
>> + *	- HDCP signalling
>> + *		Needed for HDMI but not for DP.
>> + *	- Configure stream type onto receiver
>> + *		Needed only for DP but not for HDMI.
>> + */
>> +struct intel_hdcp2_shim {
> Why don't you just use the same shim? No need to duplicate.
If that is ok, i would prefer to maintain hdcp1.4 and hdcp2.2 
definitions and stack independently.
IMO in that way it will be easy to debug and maintain the  issues from 
the corresponding versions.
Please let me know if you feel other way around.
>
>> +
>> +	/* Write HDCP2.2 messages */
>> +	int (*write_msg)(struct intel_digital_port *intel_dig_port, void *buf,
>> +			 size_t size);
>> +
>> +	/* Read HDCP2.2 messages */
>> +	int (*read_msg)(struct intel_digital_port *intel_dig_port,
>> +			uint8_t msg_id, void *buf, size_t size);
>> +
>> +	/*
>> +	 * Implementation of DP Errata for the communication of stream type to
>> +	 * Receivers. Not applicable for HDMI.
>> +	 */
>> +	int (*config_stream_type)(struct intel_digital_port *intel_dig_port,
>> +				  void *buf, size_t size);
>> +
>> +	/* Enables HDCP signalling on the port. Not applicable for DP. */
>> +	int (*toggle_signalling)(struct intel_digital_port *intel_dig_port,
>> +				 bool enable);
>> +
>> +	/* Link Integrity Check */
>> +	int (*check_link)(struct intel_digital_port *intel_dig_port);
>> +
>> +	/* Detects whether Panel is HDCP2.2 capable */
>> +	int (*hdcp_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);
>> +};
>> +
>>   /*
>>    * This structure serves as a translation layer between the generic HDCP code
>>    * and the bus-specific code. What that means is that HDCP over HDMI differs
>> @@ -378,6 +434,10 @@ struct intel_hdcp_shim {
>>   struct intel_hdcp {
>>   	struct intel_connector *connector;
>>   
>> +	/* Flags to represent the HDCP capability of the platform and panel */
>> +	u32 plat_cap;
> I don't think you need this. A simple bool supports_hdcp2 would suffice here.
Added this to facilitate, multiple version support. Anyway lets handle 
issue at hand 2.2 first :)
I will replace it with bool.
>
>> +	u32 panel_cap;
> This should not be stored here. At best it will be complicated to keep
> up-to-date and at worst, it will get stale.
At present this is getting updated and used at the start of authentication.
So as of now we could move to local variable itself. I will bring in the 
change. Thanks

--Ram
>
>> +
>>   	const struct intel_hdcp_shim *hdcp_shim;
>>   	struct mutex hdcp_mutex;
>>   	uint64_t hdcp_value; /* protected by hdcp_mutex */
>> @@ -387,6 +447,37 @@ struct intel_hdcp {
>>   
>>   	/* To indicate the assertion of CP_IRQ */
>>   	struct completion cp_irq_recved;
>> +
>> +	/* HDCP2.2 related definitions */
>> +
>> +	/* Content Stream Type defined by content owner */
>> +	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;
>> +
>> +	/* Translation layer for encoder specific functions */
>> +	const struct intel_hdcp2_shim *hdcp2_shim;
>> +
>> +	/* mei interface related information */
>> +	struct mei_hdcp_data *mei_hdcp_data;
>> +
>> +	struct delayed_work hdcp2_check_work;
>>   };
>>   
>>   struct intel_connector {
>> -- 
>> 2.7.4
>>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 24/43] drm/i915: wait for cp_irq
  2018-02-22 15:46   ` Sean Paul
@ 2018-02-26  5:49     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-26  5:49 UTC (permalink / raw)
  To: Sean Paul; +Cc: daniel.vetter, intel-gfx, tomas.winkler, rodrigo.vivi



On Thursday 22 February 2018 09:16 PM, Sean Paul wrote:
> On Wed, Feb 14, 2018 at 07:43:39PM +0530, Ramalingam C wrote:
>> DP HDCP asserts the CP_IRQ to indicate the msg availability and
>> auth state change at the panel.
>>
>> Implements a completion structure to communicate the cp_irq
>> assertion and provides a function to wait for cp_irq with a timeout.
>>
>> This can be used for implementation of both HDCP1.4 and HDCP2.2
>>
> But it's not. Please introduce code in the same patch as when it's used.
Wanted to keep this as independent preparation patch for both versions.
Anyway i will squash it with the 2.2 patch that needs this implementation.

Thanks
--Ram
>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_dp.c   | 28 ++++++++++++++++++++++++++--
>>   drivers/gpu/drm/i915/intel_drv.h  |  3 +++
>>   drivers/gpu/drm/i915/intel_hdcp.c |  1 +
>>   3 files changed, 30 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 80476689754f..8847f1a36504 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -4402,6 +4402,7 @@ static bool
>>   intel_dp_short_pulse(struct intel_dp *intel_dp)
>>   {
>>   	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
>> +	struct intel_connector *connector = intel_dp->attached_connector;
>>   	u8 sink_irq_vector = 0;
>>   	u8 old_sink_count = intel_dp->sink_count;
>>   	bool ret;
>> @@ -4436,8 +4437,13 @@ 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) {
>> +			if (connector->hdcp)
>> +				complete(&connector->hdcp->cp_irq_recved);
>> +		}
>> +
>> +		if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
>> +			DRM_DEBUG_DRIVER("Sink specific irq unhandled\n");
>>   	}
>>   
>>   	intel_dp_check_link_status(intel_dp);
>> @@ -5049,6 +5055,24 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
>>   	pps_unlock(intel_dp);
>>   }
>>   
>> +static int wait_for_cp_irq(struct completion *cp_irq_recved, int timeout)
>> +{
>> +	long ret;
>> +
>> +	if (completion_done(cp_irq_recved))
>> +		reinit_completion(cp_irq_recved);
>> +
>> +	ret = wait_for_completion_interruptible_timeout(cp_irq_recved,
>> +							msecs_to_jiffies(
>> +							timeout));
>> +	reinit_completion(cp_irq_recved);
>> +	if (ret < 0)
>> +		return (int)ret;
>> +	else if (!ret)
>> +		return -ETIMEDOUT;
>> +	return 0;
>> +}
>> +
>>   static
>>   int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port,
>>   				u8 *an)
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index 5b170ff7ec14..1c0d324c1044 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -384,6 +384,9 @@ struct intel_hdcp {
>>   	struct delayed_work hdcp_check_work;
>>   	struct work_struct hdcp_prop_work;
>>   	struct work_struct hdcp_enable_work;
>> +
>> +	/* To indicate the assertion of CP_IRQ */
>> +	struct completion cp_irq_recved;
>>   };
>>   
>>   struct intel_connector {
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index 9147fb17a9fc..31e1af5b43ec 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -695,6 +695,7 @@ int intel_hdcp_init(struct intel_connector *connector,
>>   	INIT_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
>>   	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
>>   
>> +	init_completion(&hdcp->cp_irq_recved);
>>   	connector->hdcp = hdcp;
>>   	return 0;
>>   
>> -- 
>> 2.7.4
>>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp
  2018-02-22 14:47   ` Sean Paul
@ 2018-02-26  6:05     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-26  6:05 UTC (permalink / raw)
  To: Sean Paul; +Cc: daniel.vetter, intel-gfx, tomas.winkler, rodrigo.vivi



On Thursday 22 February 2018 08:17 PM, Sean Paul wrote:
> On Wed, Feb 14, 2018 at 07:43:38PM +0530, Ramalingam C wrote:
>> Considering the upcoming significant no HDCP2.2 variables, it will
>> be clean to have separate struct fo HDCP.
>>
>> New structure called intel_hdcp is introduced.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_display.c |   9 ++-
>>   drivers/gpu/drm/i915/intel_dp.c      |   4 +-
>>   drivers/gpu/drm/i915/intel_drv.h     |  20 +++--
>>   drivers/gpu/drm/i915/intel_hdcp.c    | 141 ++++++++++++++++++++---------------
>>   4 files changed, 100 insertions(+), 74 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index 048d60b5143b..22097349529b 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -15314,10 +15314,11 @@ 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);
>> -			cancel_work_sync(&connector->hdcp_enable_work);
>> +		if (connector->hdcp && connector->hdcp->hdcp_shim) {
>> +			cancel_delayed_work_sync(
>> +					&connector->hdcp->hdcp_check_work);
>> +			cancel_work_sync(&connector->hdcp->hdcp_prop_work);
>> +			cancel_work_sync(&connector->hdcp->hdcp_enable_work);
>>   		}
>>   	}
>>   	drm_connector_list_iter_end(&conn_iter);
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index f20b25f98e5a..80476689754f 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -5445,7 +5445,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
>>   		WARN(iret, "Acquiring modeset locks failed with %i\n", iret);
>>   
>>   		/* Short pulse can signify loss of hdcp authentication */
>> -		intel_hdcp_check_link(intel_dp->attached_connector);
>> +		if (intel_dp->attached_connector->hdcp)
>> +			intel_hdcp_check_link(
>> +					intel_dp->attached_connector->hdcp);
>>   
>>   		if (!handled) {
>>   			intel_dp->detect_done = false;
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index 7b9e5f70826f..5b170ff7ec14 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -375,6 +375,17 @@ struct intel_hdcp_shim {
>>   			    bool *hdcp_capable);
>>   };
>>   
>> +struct intel_hdcp {
>> +	struct intel_connector *connector;
> You don't need a backpointer, use container_of if necessary.
ok sure.
>
>> +
>> +	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 work_struct hdcp_enable_work;
>> +};
>> +
>>   struct intel_connector {
>>   	struct drm_connector base;
>>   	/*
>> @@ -407,12 +418,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 work_struct hdcp_enable_work;
>> +	struct intel_hdcp *hdcp;
>>   };
>>   
>>   struct intel_digital_connector_state {
>> @@ -1853,7 +1859,7 @@ int intel_hdcp_init(struct intel_connector *connector,
>>   		    const struct intel_hdcp_shim *hdcp_shim);
>>   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);
>> +int intel_hdcp_check_link(struct intel_hdcp *hdcp);
>>   bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
>>   
>>   /* intel_psr.c */
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index e03bd376d92c..9147fb17a9fc 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -545,8 +545,9 @@ struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector)
>>   	return enc_to_dig_port(&intel_attached_encoder(&connector->base)->base);
>>   }
>>   
>> -static int _intel_hdcp_disable(struct intel_connector *connector)
>> +static int _intel_hdcp_disable(struct intel_hdcp *hdcp)
>>   {
>> +	struct intel_connector *connector = hdcp->connector;
> I'm not sure why we need to change all of the function arguments to intel_hdcp
> if the first thing we do is fetch the connector.
>
>>   	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>>   	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>>   	enum port port = intel_dig_port->base.port;
>> @@ -562,7 +563,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>>   		return -ETIMEDOUT;
>>   	}
>>   
>> -	ret = connector->hdcp_shim->toggle_signalling(intel_dig_port, false);
>> +	ret = hdcp->hdcp_shim->toggle_signalling(intel_dig_port, false);
>>   	if (ret) {
>>   		DRM_ERROR("Failed to disable HDCP signalling\n");
>>   		return ret;
>> @@ -572,8 +573,9 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>>   	return 0;
>>   }
>>   
>> -static int _intel_hdcp_enable(struct intel_connector *connector)
>> +static int _intel_hdcp_enable(struct intel_hdcp *hdcp)
>>   {
>> +	struct intel_connector *connector = hdcp->connector;
>>   	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>>   	int i, ret, tries = 3;
>>   
>> @@ -599,12 +601,12 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>>   	/* Incase of authentication failures, HDCP spec expects reauth. */
>>   	for (i = 0; i < tries; i++) {
>>   		ret = intel_hdcp_auth(conn_to_dig_port(connector),
>> -				      connector->hdcp_shim);
>> +				      hdcp->hdcp_shim);
>>   		if (!ret) {
>> -			connector->hdcp_value =
>> +			hdcp->hdcp_value =
>>   					DRM_MODE_CONTENT_PROTECTION_ENABLED;
>> -			schedule_work(&connector->hdcp_prop_work);
>> -			schedule_delayed_work(&connector->hdcp_check_work,
>> +			schedule_work(&hdcp->hdcp_prop_work);
>> +			schedule_delayed_work(&hdcp->hdcp_check_work,
>>   					      DRM_HDCP_CHECK_PERIOD_MS);
>>   			return 0;
>>   		}
>> @@ -612,7 +614,7 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>>   		DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret);
>>   
>>   		/* Ensuring HDCP encryption and signalling are stopped. */
>> -		_intel_hdcp_disable(connector);
>> +		_intel_hdcp_disable(hdcp);
>>   	}
>>   
>>   	DRM_ERROR("HDCP authentication failed (%d tries/%d)\n", tries, ret);
>> @@ -621,47 +623,45 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>>   
>>   static void intel_hdcp_enable_work(struct work_struct *work)
>>   {
>> -	struct intel_connector *connector = container_of(work,
>> -							 struct intel_connector,
>> -							 hdcp_enable_work);
>> +	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
>> +					       hdcp_enable_work);
>>   
>> -	mutex_lock(&connector->hdcp_mutex);
>> -	_intel_hdcp_enable(connector);
>> -	mutex_unlock(&connector->hdcp_mutex);
>> +	mutex_lock(&hdcp->hdcp_mutex);
>> +	_intel_hdcp_enable(hdcp);
>> +	mutex_unlock(&hdcp->hdcp_mutex);
>>   }
>>   
>>   static void intel_hdcp_check_work(struct work_struct *work)
>>   {
>> -	struct intel_connector *connector = container_of(to_delayed_work(work),
>> -							 struct intel_connector,
>> -							 hdcp_check_work);
>> -	if (!intel_hdcp_check_link(connector))
>> -		schedule_delayed_work(&connector->hdcp_check_work,
>> +	struct intel_hdcp *hdcp = container_of(to_delayed_work(work),
>> +					       struct intel_hdcp,
>> +					       hdcp_check_work);
>> +	if (!intel_hdcp_check_link(hdcp))
>> +		schedule_delayed_work(&hdcp->hdcp_check_work,
>>   				      DRM_HDCP_CHECK_PERIOD_MS);
>>   }
>>   
>>   static void intel_hdcp_prop_work(struct work_struct *work)
>>   {
>> -	struct intel_connector *connector = container_of(work,
>> -							 struct intel_connector,
>> -							 hdcp_prop_work);
>> -	struct drm_device *dev = connector->base.dev;
>> +	struct intel_hdcp *hdcp = container_of(work, struct intel_hdcp,
>> +					       hdcp_prop_work);
>> +	struct drm_device *dev = hdcp->connector->base.dev;
>>   	struct drm_connector_state *state;
>>   
>>   	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
>> -	mutex_lock(&connector->hdcp_mutex);
>> +	mutex_lock(&hdcp->hdcp_mutex);
>>   
>>   	/*
>>   	 * This worker is only used to flip between ENABLED/DESIRED. Either of
>>   	 * those to UNDESIRED is handled by core. If hdcp_value == UNDESIRED,
>>   	 * we're running just after hdcp has been disabled, so just exit
>>   	 */
>> -	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
>> -		state = connector->base.state;
>> -		state->content_protection = connector->hdcp_value;
>> +	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
>> +		state = hdcp->connector->base.state;
>> +		state->content_protection = hdcp->hdcp_value;
>>   	}
>>   
>> -	mutex_unlock(&connector->hdcp_mutex);
>> +	mutex_unlock(&hdcp->hdcp_mutex);
>>   	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>>   }
>>   
>> @@ -676,48 +676,64 @@ int intel_hdcp_init(struct intel_connector *connector,
>>   		    const struct intel_hdcp_shim *hdcp_shim)
>>   {
>>   	int ret;
>> +	struct intel_hdcp *hdcp;
>> +
>> +	hdcp = kzalloc(sizeof(struct intel_hdcp), GFP_KERNEL);
> You're leaking this. You probably don't need it to be dynamically allocated.
didn't want the mem spared for struct hdcp, incase of non hdcp capable 
connectors.
May be its ok to have small struct for all connectors. i will move it 
from dynamic alloc.
>
>> +	if (!hdcp) {
>> +		ret = -ENOMEM;
>> +		goto err;
>> +	}
>>   
>>   	ret = drm_connector_attach_content_protection_property(
>>   			&connector->base);
>>   	if (ret)
>> -		return ret;
>> +		goto err;
>> +
>> +	hdcp->hdcp_shim = hdcp_shim;
>> +	mutex_init(&hdcp->hdcp_mutex);
>> +	INIT_DELAYED_WORK(&hdcp->hdcp_check_work, intel_hdcp_check_work);
>> +	INIT_WORK(&hdcp->hdcp_prop_work, intel_hdcp_prop_work);
>> +	INIT_WORK(&hdcp->hdcp_enable_work, intel_hdcp_enable_work);
>>   
>> -	connector->hdcp_shim = hdcp_shim;
>> -	mutex_init(&connector->hdcp_mutex);
>> -	INIT_DELAYED_WORK(&connector->hdcp_check_work, intel_hdcp_check_work);
>> -	INIT_WORK(&connector->hdcp_prop_work, intel_hdcp_prop_work);
>> -	INIT_WORK(&connector->hdcp_enable_work, intel_hdcp_enable_work);
>> +	connector->hdcp = hdcp;
>>   	return 0;
>> +
>> +err:
>> +	kfree(hdcp);
>> +	return ret;
>>   }
>>   
>>   int intel_hdcp_enable(struct intel_connector *connector)
>>   {
>> -	if (!connector->hdcp_shim)
>> +	struct intel_hdcp *hdcp = connector->hdcp;
>> +
>> +	if (!hdcp || !hdcp->hdcp_shim)
> Is it possible for hdcp to be != NULL, but hdcp_shim == NULL?
Along with hdcp2.2, this could be a possibility. Anyway by moving to
static allocation for hdcp, no more check for hdcp ptr :)
--Ram
>
>>   		return -ENOENT;
>>   
>> -	mutex_lock(&connector->hdcp_mutex);
>> -	schedule_work(&connector->hdcp_enable_work);
>> -	mutex_unlock(&connector->hdcp_mutex);
>> +	mutex_lock(&hdcp->hdcp_mutex);
>> +	schedule_work(&hdcp->hdcp_enable_work);
>> +	mutex_unlock(&hdcp->hdcp_mutex);
>>   
>>   	return 0;
>>   }
>>   
>>   int intel_hdcp_disable(struct intel_connector *connector)
>>   {
>> +	struct intel_hdcp *hdcp = connector->hdcp;
>>   	int ret = 0;
>>   
>> -	if (!connector->hdcp_shim)
>> +	if (!hdcp || !hdcp->hdcp_shim)
>>   		return -ENOENT;
>>   
>> -	mutex_lock(&connector->hdcp_mutex);
>> +	mutex_lock(&hdcp->hdcp_mutex);
>>   
>> -	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
>> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
>> -		ret = _intel_hdcp_disable(connector);
>> +	if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
>> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
>> +		ret = _intel_hdcp_disable(hdcp);
>>   	}
>>   
>> -	mutex_unlock(&connector->hdcp_mutex);
>> -	cancel_delayed_work_sync(&connector->hdcp_check_work);
>> +	mutex_unlock(&hdcp->hdcp_mutex);
>> +	cancel_delayed_work_sync(&hdcp->hdcp_check_work);
>>   	return ret;
>>   }
>>   
>> @@ -755,19 +771,20 @@ 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)
>> +int intel_hdcp_check_link(struct intel_hdcp *hdcp)
>>   {
>> +	struct intel_connector *connector = hdcp->connector;
>>   	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>>   	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>>   	enum port port = intel_dig_port->base.port;
>>   	int ret = 0;
>>   
>> -	if (!connector->hdcp_shim)
>> +	if (!hdcp->hdcp_shim)
>>   		return -ENOENT;
>>   
>> -	mutex_lock(&connector->hdcp_mutex);
>> +	mutex_lock(&hdcp->hdcp_mutex);
>>   
>> -	if (connector->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
>> +	if (hdcp->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
>>   		goto out;
>>   
>>   	if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) {
>> @@ -775,17 +792,17 @@ int intel_hdcp_check_link(struct intel_connector *connector)
>>   			  connector->base.name, connector->base.base.id,
>>   			  I915_READ(PORT_HDCP_STATUS(port)));
>>   		ret = -ENXIO;
>> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>> -		schedule_work(&connector->hdcp_prop_work);
>> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>> +		schedule_work(&hdcp->hdcp_prop_work);
>>   		goto out;
>>   	}
>>   
>> -	if (connector->hdcp_shim->check_link(intel_dig_port)) {
>> -		if (connector->hdcp_value !=
>> +	if (hdcp->hdcp_shim->check_link(intel_dig_port)) {
>> +		if (hdcp->hdcp_value !=
>>   		    DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
>> -			connector->hdcp_value =
>> +			hdcp->hdcp_value =
>>   				DRM_MODE_CONTENT_PROTECTION_ENABLED;
>> -			schedule_work(&connector->hdcp_prop_work);
>> +			schedule_work(&hdcp->hdcp_prop_work);
>>   		}
>>   		goto out;
>>   	}
>> @@ -793,23 +810,23 @@ int intel_hdcp_check_link(struct intel_connector *connector)
>>   	DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n",
>>   		      connector->base.name, connector->base.base.id);
>>   
>> -	ret = _intel_hdcp_disable(connector);
>> +	ret = _intel_hdcp_disable(hdcp);
>>   	if (ret) {
>>   		DRM_ERROR("Failed to disable hdcp (%d)\n", ret);
>> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>> -		schedule_work(&connector->hdcp_prop_work);
>> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>> +		schedule_work(&hdcp->hdcp_prop_work);
>>   		goto out;
>>   	}
>>   
>> -	ret = _intel_hdcp_enable(connector);
>> +	ret = _intel_hdcp_enable(hdcp);
>>   	if (ret) {
>>   		DRM_ERROR("Failed to enable hdcp (%d)\n", ret);
>> -		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>> -		schedule_work(&connector->hdcp_prop_work);
>> +		hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>> +		schedule_work(&hdcp->hdcp_prop_work);
>>   		goto out;
>>   	}
>>   
>>   out:
>> -	mutex_unlock(&connector->hdcp_mutex);
>> +	mutex_unlock(&hdcp->hdcp_mutex);
>>   	return ret;
>>   }
>> -- 
>> 2.7.4
>>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 22/43] drm/i915: Async execution of hdcp authentication
  2018-02-22 14:39   ` Sean Paul
@ 2018-02-26  6:32     ` Ramalingam C
  0 siblings, 0 replies; 79+ messages in thread
From: Ramalingam C @ 2018-02-26  6:32 UTC (permalink / raw)
  To: Sean Paul; +Cc: daniel.vetter, intel-gfx, tomas.winkler, rodrigo.vivi



On Thursday 22 February 2018 08:09 PM, Sean Paul wrote:
> On Wed, Feb 14, 2018 at 07:43:37PM +0530, Ramalingam C wrote:
>> Each HDCP authentication, could take upto 5.1Sec, based on the
>> downstream HDCP topology.
>>
>> Hence to avoid this much delay in the atomic_commit path, this patch
>> schedules the HDCP authentication into a asynchronous work.
>>
>> This keeps the UI active, by enabling the flips in parallel to
>> HDCP auth.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_display.c |  1 +
>>   drivers/gpu/drm/i915/intel_drv.h     |  1 +
>>   drivers/gpu/drm/i915/intel_hdcp.c    | 36 ++++++++++++++++++++++--------------
>>   3 files changed, 24 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index 30e38cbeface..048d60b5143b 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -15317,6 +15317,7 @@ static void intel_hpd_poll_fini(struct drm_device *dev)
>>   		if (connector->hdcp_shim) {
>>   			cancel_delayed_work_sync(&connector->hdcp_check_work);
>>   			cancel_work_sync(&connector->hdcp_prop_work);
>> +			cancel_work_sync(&connector->hdcp_enable_work);
>>   		}
>>   	}
>>   	drm_connector_list_iter_end(&conn_iter);
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index 898064e8bea7..7b9e5f70826f 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -412,6 +412,7 @@ struct intel_connector {
>>   	uint64_t hdcp_value; /* protected by hdcp_mutex */
>>   	struct delayed_work hdcp_check_work;
>>   	struct work_struct hdcp_prop_work;
>> +	struct work_struct hdcp_enable_work;
>>   };
>>   
>>   struct intel_digital_connector_state {
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index 14ca5d3057a7..e03bd376d92c 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -600,8 +600,14 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>>   	for (i = 0; i < tries; i++) {
>>   		ret = intel_hdcp_auth(conn_to_dig_port(connector),
>>   				      connector->hdcp_shim);
>> -		if (!ret)
>> +		if (!ret) {
>> +			connector->hdcp_value =
>> +					DRM_MODE_CONTENT_PROTECTION_ENABLED;
>> +			schedule_work(&connector->hdcp_prop_work);
>> +			schedule_delayed_work(&connector->hdcp_check_work,
>> +					      DRM_HDCP_CHECK_PERIOD_MS);
>>   			return 0;
>> +		}
>>   
>>   		DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret);
>>   
>> @@ -613,6 +619,17 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>>   	return ret;
>>   }
>>   
>> +static void intel_hdcp_enable_work(struct work_struct *work)
>> +{
>> +	struct intel_connector *connector = container_of(work,
>> +							 struct intel_connector,
>> +							 hdcp_enable_work);
>> +
>> +	mutex_lock(&connector->hdcp_mutex);
>> +	_intel_hdcp_enable(connector);
>> +	mutex_unlock(&connector->hdcp_mutex);
>> +}
>> +
>>   static void intel_hdcp_check_work(struct work_struct *work)
>>   {
>>   	struct intel_connector *connector = container_of(to_delayed_work(work),
>> @@ -669,29 +686,20 @@ int intel_hdcp_init(struct intel_connector *connector,
>>   	mutex_init(&connector->hdcp_mutex);
>>   	INIT_DELAYED_WORK(&connector->hdcp_check_work, intel_hdcp_check_work);
>>   	INIT_WORK(&connector->hdcp_prop_work, intel_hdcp_prop_work);
>> +	INIT_WORK(&connector->hdcp_enable_work, intel_hdcp_enable_work);
>>   	return 0;
>>   }
>>   
>>   int intel_hdcp_enable(struct intel_connector *connector)
>>   {
>> -	int ret;
>> -
>>   	if (!connector->hdcp_shim)
>>   		return -ENOENT;
>>   
>>   	mutex_lock(&connector->hdcp_mutex);
> Why do you need to hold this lock to schedule the worker?
>
>> -
>> -	ret = _intel_hdcp_enable(connector);
>> -	if (ret)
>> -		goto out;
>> -
>> -	connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
>> -	schedule_work(&connector->hdcp_prop_work);
>> -	schedule_delayed_work(&connector->hdcp_check_work,
>> -			      DRM_HDCP_CHECK_PERIOD_MS);
>> -out:
>> +	schedule_work(&connector->hdcp_enable_work);
> How is this worker cancelled when appropriate (enable/disable, hotplug, etc)?
At present enable flow also non-interuptible on hotplug. disable is not 
even is possible along with enable. correct me if i am wrong.

Since enable flow is blocking the modeset(atomic) also, I am afraid we 
need to adopt a worker for
enable path for facilitate the hotplug processing.

And in case of worker implementation need to check the connector status 
and hdcp preferred state before entering into any wait for msg.
Sleep should be selectively interruptible. every reauth should be 
checking the above conditions. I feel this is do-able.

This patch also not doing all of the above. If you think above prob 
statement needs to be addressed i will work on that.
I am looking for your suggestion. Thanks
>
> I'm not convinced the extra complexity/worker is worth it. While it's possible
> it _could_ take 5 seconds, however I've never experienced any lengthy delays in
> practice.
Because hdcp was passing on all setup, you were done in less than a Sec. 
That is the best case scenario. I wish every setup falls into it :)
Due to a buggy repeater or a buggy receiver connected to a functional 
repeater,
if the repeater authentication is delayed/failed, flip will be blocked 
for ~5Secs x <no of auth_tries>

All these possibilities can be avoided, if we can handle the complexity 
attached to worker
scheduling and canceling. Please share your take on this.
> IMO, it's more important to remove the modeset requirement (we've
> fixed this in CrOS already) than it is to do HDCP asynchronously.
Agreed on modeset removal. We need to do this on priority.

--Ram
>
> Sean
>
>>   	mutex_unlock(&connector->hdcp_mutex);
>> -	return ret;
>> +
>> +	return 0;
>>   }
>>   
>>   int intel_hdcp_disable(struct intel_connector *connector)
>> -- 
>> 2.7.4
>>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver
  2018-02-14 14:54   ` Winkler, Tomas
  2018-02-14 14:58     ` Ramalingam C
@ 2018-02-28 15:43     ` Ramalingam C
  2018-02-28 16:11       ` Winkler, Tomas
  1 sibling, 1 reply; 79+ messages in thread
From: Ramalingam C @ 2018-02-28 15:43 UTC (permalink / raw)
  To: Winkler, Tomas, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter



On Wednesday 14 February 2018 08:24 PM, Winkler, Tomas wrote:
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/misc/mei/Kconfig  | 6 ++++++
>>   drivers/misc/mei/Makefile | 2 ++
>>   2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig index
>> c49e1d2269af..90977132d1e2 100644
>> --- a/drivers/misc/mei/Kconfig
>> +++ b/drivers/misc/mei/Kconfig
>> @@ -43,3 +43,9 @@ config INTEL_MEI_TXE
>>
>>   	  Supported SoCs:
>>   	  Intel Bay Trail
>> +
>> +config INTEL_MEI_HDCP
>> +	tristate "Intel HDCP2.2 services of ME Interface"
>> +	depends on INTEL_MEI && DRM_I915
>> +	help
>> +	  MEI Support for HDCP2.2 Services on Intel SoCs.
>> diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile index
>> cd6825afa8e1..ee19754c1aec 100644
>> --- a/drivers/misc/mei/Makefile
>> +++ b/drivers/misc/mei/Makefile
>> @@ -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) += mei_hdcp.o
> Should go to the separate directory.
Instead of dedicated makefile for a single file, can I do something like

+obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/mei_hdcp.o

--Ram

> Thanks
> Tomas
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver
  2018-02-28 15:43     ` Ramalingam C
@ 2018-02-28 16:11       ` Winkler, Tomas
  0 siblings, 0 replies; 79+ messages in thread
From: Winkler, Tomas @ 2018-02-28 16:11 UTC (permalink / raw)
  To: C, Ramalingam, seanpaul, intel-gfx, Vivi, Rodrigo, daniel.vetter

> On Wednesday 14 February 2018 08:24 PM, Winkler, Tomas wrote:
> >> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> >> ---
> >>   drivers/misc/mei/Kconfig  | 6 ++++++
> >>   drivers/misc/mei/Makefile | 2 ++
> >>   2 files changed, 8 insertions(+)
> >>
> >> diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig
> >> index
> >> c49e1d2269af..90977132d1e2 100644
> >> --- a/drivers/misc/mei/Kconfig
> >> +++ b/drivers/misc/mei/Kconfig
> >> @@ -43,3 +43,9 @@ config INTEL_MEI_TXE
> >>
> >>   	  Supported SoCs:
> >>   	  Intel Bay Trail
> >> +
> >> +config INTEL_MEI_HDCP
> >> +	tristate "Intel HDCP2.2 services of ME Interface"
> >> +	depends on INTEL_MEI && DRM_I915
> >> +	help
> >> +	  MEI Support for HDCP2.2 Services on Intel SoCs.
> >> diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile
> >> index cd6825afa8e1..ee19754c1aec 100644
> >> --- a/drivers/misc/mei/Makefile
> >> +++ b/drivers/misc/mei/Makefile
> >> @@ -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) += mei_hdcp.o
> > Should go to the separate directory.
> Instead of dedicated makefile for a single file, can I do something like
> 
> +obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/mei_hdcp.o
> 
Both will work, but it should be a new Makefile as we need that separation.
Thanks
Tomas

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 79+ messages in thread

end of thread, other threads:[~2018-02-28 16:11 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 14:13 [PATCH 00/43] drm/i915: Implement HDCP2.2 Ramalingam C
2018-02-14 14:13 ` [PATCH 01/43] drm: hdcp2.2 authentication msg definitions Ramalingam C
2018-02-14 15:15   ` Winkler, Tomas
2018-02-14 19:40     ` Jani Nikula
2018-02-22  5:24       ` Ramalingam C
2018-02-22  5:29     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 02/43] drm: HDMI and DP specific HDCP2.2 defines Ramalingam C
2018-02-14 14:13 ` [PATCH 03/43] mei: bus: whitelist hdcp client Ramalingam C
2018-02-14 14:13 ` [PATCH 04/43] mei: me: add gemini lake devices ids Ramalingam C
2018-02-14 14:45   ` Winkler, Tomas
2018-02-22  5:22     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 05/43] misc/mei/hdcp: Client driver for HDCP application Ramalingam C
2018-02-14 14:54   ` Winkler, Tomas
2018-02-14 14:57     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 06/43] misc/mei/hdcp: Add KBuild for mei hdcp driver Ramalingam C
2018-02-14 14:54   ` Winkler, Tomas
2018-02-14 14:58     ` Ramalingam C
2018-02-28 15:43     ` Ramalingam C
2018-02-28 16:11       ` Winkler, Tomas
2018-02-14 14:13 ` [PATCH 07/43] misc/mei/hdcp: Verify mei client device status Ramalingam C
2018-02-14 14:13 ` [PATCH 08/43] misc/mei/hdcp: Get & Put for mei cl_device Ramalingam C
2018-02-14 14:13 ` [PATCH 09/43] misc/mei/hdcp: Define ME FW interface for HDCP2.2 Ramalingam C
2018-02-14 14:13 ` [PATCH 10/43] linux/mei: Header for mei_hdcp driver interface Ramalingam C
2018-02-14 14:13 ` [PATCH 11/43] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Ramalingam C
2018-02-14 14:13 ` [PATCH 12/43] misc/mei/hdcp: Verify Receiver Cert and prepare km Ramalingam C
2018-02-14 14:13 ` [PATCH 13/43] misc/mei/hdcp: Verify H_prime Ramalingam C
2018-02-14 14:13 ` [PATCH 14/43] misc/mei/hdcp: Store the HDCP Pairing info Ramalingam C
2018-02-14 14:13 ` [PATCH 15/43] misc/mei/hdcp: Initiate Locality check Ramalingam C
2018-02-14 14:13 ` [PATCH 16/43] misc/mei/hdcp: Verify L_prime Ramalingam C
2018-02-14 14:13 ` [PATCH 17/43] misc/mei/hdcp: Prepare Session Key Ramalingam C
2018-02-14 14:13 ` [PATCH 18/43] misc/mei/hdcp: Repeater topology verifcation and ack Ramalingam C
2018-02-14 14:13 ` [PATCH 19/43] misc/mei/hdcp: Verify M_prime Ramalingam C
2018-02-14 14:13 ` [PATCH 20/43] misc/mei/hdcp: Enabling the HDCP authentication Ramalingam C
2018-02-14 14:13 ` [PATCH 21/43] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Ramalingam C
2018-02-14 14:13 ` [PATCH 22/43] drm/i915: Async execution of hdcp authentication Ramalingam C
2018-02-22 14:39   ` Sean Paul
2018-02-26  6:32     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 23/43] drm/i915: wrapping all hdcp var into intel_hdcp Ramalingam C
2018-02-22 14:47   ` Sean Paul
2018-02-26  6:05     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 24/43] drm/i915: wait for cp_irq Ramalingam C
2018-02-22 15:46   ` Sean Paul
2018-02-26  5:49     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 25/43] drm/i915: Define HDCP2.2 related variables Ramalingam C
2018-02-14 14:36   ` Chris Wilson
2018-02-14 14:56     ` Ramalingam C
2018-02-22 14:59   ` Sean Paul
2018-02-26  5:46     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 26/43] drm/i915: Define Intel HDCP2.2 registers Ramalingam C
2018-02-22 15:43   ` Sean Paul
2018-02-26  5:33     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 27/43] drm/i915: Wrappers for mei HDCP2.2 services Ramalingam C
2018-02-14 14:13 ` [PATCH 28/43] drm/i915: Implement HDCP2.2 receiver authentication Ramalingam C
2018-02-14 14:13 ` [PATCH 29/43] drm/i915: Implement HDCP2.2 repeater authentication Ramalingam C
2018-02-14 14:13 ` [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption Ramalingam C
2018-02-14 14:38   ` Chris Wilson
2018-02-14 14:52     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 31/43] drm/i915: Implement HDCP2.2 En/Dis-able Ramalingam C
2018-02-14 14:13 ` [PATCH 32/43] drm/i915: Implement HDCP2.2 link integrity check Ramalingam C
2018-02-14 14:13 ` [PATCH 33/43] drm/i915: Handle HDCP2.2 downstream topology change Ramalingam C
2018-02-14 14:13 ` [PATCH 34/43] drm/i915: Pullout the bksv read and validation Ramalingam C
2018-02-14 14:13 ` [PATCH 35/43] drm/i915: Enable HDCP version that is best capable Ramalingam C
2018-02-14 14:42   ` Chris Wilson
2018-02-14 14:51     ` Ramalingam C
2018-02-14 15:00       ` Chris Wilson
2018-02-14 15:00         ` Ramalingam C
2018-02-14 14:13 ` [PATCH 36/43] drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure Ramalingam C
2018-02-14 14:13 ` [PATCH 37/43] drm/i915: Initialize HDCP2.2 and its MEI interface Ramalingam C
2018-02-14 14:45   ` Chris Wilson
2018-02-14 14:45     ` Ramalingam C
2018-02-14 14:13 ` [PATCH 38/43] drm/i915: Implement gmbus burst read Ramalingam C
2018-02-14 14:13 ` [PATCH 39/43] drm/i915: Implement the HDCP2.2 support for DP Ramalingam C
2018-02-14 14:13 ` [PATCH 40/43] drm/i915: Implement the HDCP2.2 support for HDMI Ramalingam C
2018-02-14 14:13 ` [PATCH 41/43] drm/i915: Add HDCP2.2 support for DP connectors Ramalingam C
2018-02-14 14:13 ` [PATCH 42/43] drm/i915: Add HDCP2.2 support for HDMI connectors Ramalingam C
2018-02-14 14:13 ` [PATCH 43/43] drm/i915: Invoke check link on CP_IRQ of DP Ramalingam C
2018-02-14 15:07 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Implement HDCP2.2 Patchwork
2018-02-14 15:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-02-14 15:20 ` ✗ Fi.CI.BAT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.