[Bug 199781] nouveau: cannot boot without nouveau.modeset=0 and cannot use HDMI output
https://bugzilla.kernel.org/show_bug.cgi?id=199781 Karol Herbst (karolher...@gmail.com) changed: What|Removed |Added CC||karolher...@gmail.com --- Comment #1 from Karol Herbst (karolher...@gmail.com) --- Please check if nouveau.runpm=0 helps -- You are receiving this mail because: You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 17/41] misc/mei/hdcp: Enabling the HDCP authentication
Request to ME to configure a port as authenticated. On Success, ME FW will mark the port as authenticated and provides HDCP cipher with the encryption keys. Enabling the Authentication can be requested once all stages of HDCP2.2 authentication is completed by interacting with ME FW. Only after this stage, driver can enable the HDCP encryption for the port, through HW registers. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style and typos fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 55 include/linux/mei_hdcp.h | 7 + 2 files changed, 62 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 32a039d46738..cbd3a8a3ae3e 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -627,6 +627,61 @@ int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, } EXPORT_SYMBOL(mei_verify_mprime); +/* + * mei_enable_hdcp_authentication: + * Function to request ME FW to mark a port as authenticated. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * + * Returns 0 on Success, <0 on Failure + */ +int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, + struct mei_hdcp_data *data) +{ + struct wired_cmd_enable_auth_in enable_auth_in = { { 0 } }; + struct wired_cmd_enable_auth_out enable_auth_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data) + return -EINVAL; + + dev = >dev; + + enable_auth_in.header.api_version = HDCP_API_VERSION; + enable_auth_in.header.command_id = WIRED_ENABLE_AUTH; + enable_auth_in.header.status = ME_HDCP_STATUS_SUCCESS; + enable_auth_in.header.buffer_len = WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN; + + enable_auth_in.port.integrated_port_type = data->port_type; + enable_auth_in.port.physical_port = data->port; + enable_auth_in.stream_type = data->streams[0].stream_type; + + byte = mei_cldev_send(cldev, (u8 *)_auth_in, + sizeof(enable_auth_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_auth_out, + sizeof(enable_auth_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (enable_auth_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n", + WIRED_ENABLE_AUTH, enable_auth_out.header.status); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(mei_enable_hdcp_authentication); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index e7e1e86c6663..e6b6f9ace0c2 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -137,6 +137,8 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, struct hdcp2_rep_send_ack *rep_send_ack); int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_rep_stream_ready *stream_ready); +int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, + struct mei_hdcp_data *data); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -214,5 +216,10 @@ int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, { return -ENODEV; } +static inline int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, +struct mei_hdcp_data *data) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 23/41] drm/i915: Implement HDCP2.2 receiver authentication
Implements HDCP2.2 authentication for hdcp2.2 receivers, with following steps: Authentication and Key exchange (AKE). Locality Check (LC). Session Key Exchange(SKE). DP Errata for stream type configuration for receivers. At AKE, the HDCP Receiver’s public key certificate is verified by the HDCP Transmitter. A Master Key k m is exchanged. At LC, the HDCP Transmitter enforces locality on the content by requiring that the Round Trip Time (RTT) between a pair of messages is not more than 20 ms. At SKE, The HDCP Transmitter exchanges Session Key ks with the HDCP Receiver. In DP HDCP2.2 encryption and decryption logics use the stream type as one of the parameter. So Before enabling the Encryption DP HDCP2.2 receiver needs to be communicated with stream type. This is added to spec as ERRATA. This generic implementation is complete only with the hdcp2_shim defined. v2: Rebased. v3: No Changes. v4: %s/PARING/PAIRING Coding style fixing [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 187 ++ 1 file changed, 187 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 57c380c91cd0..fa5cbad8afc6 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -18,6 +18,7 @@ #define GET_MEI_DDI_INDEX(port)(((port) == PORT_A) ? DDI_A : \ (enum hdcp_physical_port) (port)) #define KEY_LOAD_TRIES 5 +#define HDCP2_LC_RETRY_CNT 3 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) @@ -1090,3 +1091,189 @@ static inline int hdcp2_deauthenticate_port(struct intel_hdcp *hdcp) { return hdcp2_close_mei_session(hdcp); } + +static int hdcp2_authentication_key_exchange(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct intel_hdcp *hdcp = >hdcp; + union { + struct hdcp2_ake_init ake_init; + struct hdcp2_ake_send_cert send_cert; + struct hdcp2_ake_no_stored_km no_stored_km; + struct hdcp2_ake_send_hprime send_hprime; + struct hdcp2_ake_send_pairing_info pairing_info; + } msgs; + const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; + size_t size; + int ret; + + /* Init for seq_num */ + hdcp->seq_num_v = 0; + hdcp->seq_num_m = 0; + + ret = hdcp2_prepare_ake_init(hdcp, _init); + if (ret < 0) + return ret; + + ret = shim->write_2_2_msg(intel_dig_port, _init, + sizeof(msgs.ake_init)); + if (ret < 0) + return ret; + + ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_AKE_SEND_CERT, +_cert, sizeof(msgs.send_cert)); + if (ret < 0) + return ret; + + if (msgs.send_cert.rx_caps[0] != HDCP_2_2_RX_CAPS_VERSION_VAL) + return -EINVAL; + + hdcp->is_repeater = HDCP_2_2_RX_REPEATER(msgs.send_cert.rx_caps[2]); + + /* +* Here msgs.no_stored_km will hold msgs corresponding to the km +* stored also. +*/ + ret = hdcp2_verify_rx_cert_prepare_km(hdcp, _cert, + >is_paired, + _stored_km, ); + if (ret < 0) + return ret; + + ret = shim->write_2_2_msg(intel_dig_port, _stored_km, size); + if (ret < 0) + return ret; + + ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_AKE_SEND_HPRIME, +_hprime, sizeof(msgs.send_hprime)); + if (ret < 0) + return ret; + + ret = hdcp2_verify_hprime(hdcp, _hprime); + if (ret < 0) + return ret; + + if (!hdcp->is_paired) { + /* Pairing is required */ + ret = shim->read_2_2_msg(intel_dig_port, +HDCP_2_2_AKE_SEND_PAIRING_INFO, +_info, +sizeof(msgs.pairing_info)); + if (ret < 0) + return ret; + + ret = hdcp2_store_pairing_info(hdcp, _info); + if (ret < 0) + return ret; + hdcp->is_paired = true; + } + + return 0; +} + +static int hdcp2_locality_check(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct intel_hdcp *hdcp = >hdcp; + union { + struct hdcp2_lc_init lc_init; + struct hdcp2_lc_send_lprime send_lprime; + } msgs; + const struct intel_hdcp_shim *shim =
[PATCH v4 22/41] drm/i915: Wrappers for mei HDCP2.2 services
Adds the wrapper for all mei hdcp2.2 service functions. v2: Rebased. v3: cldev is moved from mei_hdcp_data to hdcp. v4: %s/hdcp2_store_paring_info/hdcp2_store_pairing_info Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 194 ++ 1 file changed, 194 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index c7d0fa319c01..57c380c91cd0 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -10,10 +10,13 @@ #include #include #include +#include #include "intel_drv.h" #include "i915_reg.h" +#define GET_MEI_DDI_INDEX(port)(((port) == PORT_A) ? DDI_A : \ +(enum hdcp_physical_port) (port)) #define KEY_LOAD_TRIES 5 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, @@ -896,3 +899,194 @@ int intel_hdcp_check_link(struct intel_connector *connector) mutex_unlock(>hdcp_mutex); return ret; } + +static int +hdcp2_prepare_ake_init(struct intel_hdcp *hdcp, struct hdcp2_ake_init *ake_data) +{ + struct mei_hdcp_data *data = >mei_data; + struct intel_connector *connector = container_of(hdcp, +struct intel_connector, +hdcp); + + if (!hdcp->cldev) + return -EINVAL; + + if (data->port == INVALID_PORT && connector->encoder) + data->port = GET_MEI_DDI_INDEX(connector->encoder->port); + + /* Clear ME FW instance for the port, just incase */ + mei_close_hdcp_session(hdcp->cldev, data); + + return mei_initiate_hdcp2_session(hdcp->cldev, data, ake_data); +} + +static int hdcp2_close_mei_session(struct intel_hdcp *hdcp) +{ + struct mei_hdcp_data *data = >mei_data; + + if (!hdcp->cldev || data->port == INVALID_PORT) + return -EINVAL; + + return mei_close_hdcp_session(hdcp->cldev, data); +} + +static int +hdcp2_verify_rx_cert_prepare_km(struct intel_hdcp *hdcp, + struct hdcp2_ake_send_cert *rx_cert, + bool *paired, + struct hdcp2_ake_no_stored_km *ek_pub_km, + size_t *msg_sz) +{ + struct mei_hdcp_data *data = >mei_data; + int ret; + + if (!hdcp->cldev) + return -EINVAL; + + ret = mei_verify_receiver_cert_prepare_km(hdcp->cldev, data, rx_cert, + paired, ek_pub_km, msg_sz); + if (ret < 0) + mei_close_hdcp_session(hdcp->cldev, data); + + return ret; +} + +static int hdcp2_verify_hprime(struct intel_hdcp *hdcp, + struct hdcp2_ake_send_hprime *rx_hprime) +{ + struct mei_hdcp_data *data = >mei_data; + int ret; + + if (!hdcp->cldev) + return -EINVAL; + + ret = mei_verify_hprime(hdcp->cldev, data, rx_hprime); + if (ret < 0) + mei_close_hdcp_session(hdcp->cldev, data); + + return ret; +} + +static int +hdcp2_store_pairing_info(struct intel_hdcp *hdcp, + struct hdcp2_ake_send_pairing_info *pairing_info) +{ + struct mei_hdcp_data *data = >mei_data; + int ret; + + if (!hdcp->cldev) + return -EINVAL; + + ret = mei_store_pairing_info(hdcp->cldev, data, pairing_info); + if (ret < 0) + mei_close_hdcp_session(hdcp->cldev, data); + + return ret; +} + +static int +hdcp2_prepare_lc_init(struct intel_hdcp *hdcp, struct hdcp2_lc_init *lc_init) +{ + struct mei_hdcp_data *data = >mei_data; + int ret; + + if (!hdcp->cldev) + return -EINVAL; + + ret = mei_initiate_locality_check(hdcp->cldev, data, lc_init); + if (ret < 0) + mei_close_hdcp_session(hdcp->cldev, data); + + return ret; +} + +static int +hdcp2_verify_lprime(struct intel_hdcp *hdcp, + struct hdcp2_lc_send_lprime *rx_lprime) +{ + struct mei_hdcp_data *data = >mei_data; + int ret; + + if (!hdcp->cldev) + return -EINVAL; + + ret = mei_verify_lprime(hdcp->cldev, data, rx_lprime); + if (ret < 0) + mei_close_hdcp_session(hdcp->cldev, data); + + return ret; +} + +static int hdcp2_prepare_skey(struct intel_hdcp *hdcp, + struct hdcp2_ske_send_eks *ske_data) +{ + struct mei_hdcp_data *data = >mei_data; + int ret; + + if (!hdcp->cldev) + return -EINVAL; + + ret = mei_get_session_key(hdcp->cldev, data, ske_data); + if (ret < 0) + mei_close_hdcp_session(hdcp->cldev, data); + + return ret; +} + +static int +hdcp2_verify_rep_topology_prepare_ack( + struct
[PATCH v4 16/41] misc/mei/hdcp: Verify M_prime
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. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] endianness conversion func is moved to drm_hdcp.h [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 68 include/drm/drm_hdcp.h | 15 + include/linux/mei_hdcp.h | 8 + 3 files changed, 91 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index d729348f5ae2..32a039d46738 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -559,6 +559,74 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, } EXPORT_SYMBOL(mei_repeater_check_flow_prepare_ack); +/* + * mei_verify_mprime: + * Function to verify mprime. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * stream_ready: pointer for RepeaterAuth_Stream_Ready message. + * + * Returns 0 on Success, <0 on Failure + */ +int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_rep_stream_ready *stream_ready) +{ + struct wired_cmd_repeater_auth_stream_req_in + verify_mprime_in = { { 0 } }; + struct wired_cmd_repeater_auth_stream_req_out + verify_mprime_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!stream_ready || !data) + return -EINVAL; + + dev = >dev; + + verify_mprime_in.header.api_version = HDCP_API_VERSION; + verify_mprime_in.header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ; + verify_mprime_in.header.status = ME_HDCP_STATUS_SUCCESS; + verify_mprime_in.header.buffer_len = + WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN; + + verify_mprime_in.port.integrated_port_type = data->port_type; + verify_mprime_in.port.physical_port = data->port; + + memcpy(verify_mprime_in.m_prime, stream_ready->m_prime, + HDCP_2_2_MPRIME_LEN); + reverse_endianness((u8 *)_mprime_in.seq_num_m, + HDCP_2_2_SEQ_NUM_LEN, (u8 *)>seq_num_m); + memcpy(verify_mprime_in.streams, data->streams, + (data->k * sizeof(struct hdcp2_streamid_type))); + + verify_mprime_in.k = __swab16(data->k); + + byte = mei_cldev_send(cldev, (u8 *)_mprime_in, + sizeof(verify_mprime_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_mprime_out, + sizeof(verify_mprime_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (verify_mprime_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n", + WIRED_REPEATER_AUTH_STREAM_REQ, + verify_mprime_out.header.status); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(mei_verify_mprime); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index efd493306130..6ce9f9d432dc 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -247,4 +247,19 @@ struct hdcp2_dp_errata_stream_type { #define HDCP_2_2_HDMI_RXSTATUS_READY(x)(x & BIT(2)) #define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(x) (x & BIT(3)) +/* + * Library functions for endianness are aligned for 16/32/64 bits. + * But hdcp sequence numbers are 24bits. So for their Byte swapping, + * a conversion function is developed. + */ +static inline void reverse_endianness(u8 *dest, size_t sz, u8 *src) +{ + u32 index; + + if (!sz || sz > sizeof(u32)) + return; + for (index = 0; index < sz; index++) + dest[sz - index - 1] = src[index]; +} + #endif diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index 2713cf321a58..e7e1e86c6663 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -135,6 +135,8 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, struct hdcp2_rep_send_receiverid_list
[PATCH v4 12/41] misc/mei/hdcp: Initiate Locality check
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. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd used for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 57 include/linux/mei_hdcp.h | 10 +++ 2 files changed, 67 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 878485e53d5a..324e50736518 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -308,6 +308,63 @@ int mei_store_pairing_info(struct mei_cl_device *cldev, } EXPORT_SYMBOL(mei_store_pairing_info); +/* + * mei_initiate_locality_check: + * Function to prepare LC_Init. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * hdcp2_lc_init : Pointer for storing LC_Init + * + * Returns 0 on Success, <0 on Failure + */ +int mei_initiate_locality_check(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_lc_init *lc_init_data) +{ + struct wired_cmd_init_locality_check_in lc_init_in = { { 0 } }; + struct wired_cmd_init_locality_check_out lc_init_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !lc_init_data) + return -EINVAL; + + dev = >dev; + + lc_init_in.header.api_version = HDCP_API_VERSION; + lc_init_in.header.command_id = WIRED_INIT_LOCALITY_CHECK; + lc_init_in.header.status = ME_HDCP_STATUS_SUCCESS; + lc_init_in.header.buffer_len = WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN; + + lc_init_in.port.integrated_port_type = data->port_type; + lc_init_in.port.physical_port = data->port; + + byte = mei_cldev_send(cldev, (u8 *)_init_in, sizeof(lc_init_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_init_out, sizeof(lc_init_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (lc_init_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X Failed. status: 0x%X\n", + WIRED_INIT_LOCALITY_CHECK, lc_init_out.header.status); + return -EIO; + } + + lc_init_data->msg_id = HDCP_2_2_LC_INIT; + memcpy(lc_init_data->r_n, lc_init_out.r_n, HDCP_2_2_RN_LEN); + + return 0; +} +EXPORT_SYMBOL(mei_initiate_locality_check); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index 23291d073d4b..54453c34d54e 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -122,6 +122,9 @@ int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, int mei_store_pairing_info(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_ake_send_pairing_info *pairing_info); +int mei_initiate_locality_check(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_lc_init *lc_init_data); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -165,5 +168,12 @@ int mei_store_pairing_info(struct mei_cl_device *cldev, { return -ENODEV; } +static inline +int mei_initiate_locality_check(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_lc_init *lc_init_data) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106499] [regression, bisected] Several games crash on start
https://bugs.freedesktop.org/show_bug.cgi?id=106499 --- Comment #3 from Bas Nieuwenhuizen--- This should be fixed with https://patchwork.freedesktop.org/patch/224584/ -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 104920] Broken hardware video encoding with vaapi/ffmpeg
https://bugs.freedesktop.org/show_bug.cgi?id=104920 --- Comment #7 from gr...@sub.red --- NOTABUG? IMHO, it's a documentation issue, *at least*. Please add the info to https://wiki.freedesktop.org/xorg/RadeonFeature/ or somewhere else. Also, why is it possible to use radeonsi/vaapi for encoding that isn't actually supported? Isn't it possible to return a fail value? It shouldn't be the software *using* vaapi being responsible to check if the hardware supports stuff, or am I wrong? -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC 04/24] arm64/dts: add switch-delay for meson mali
Hi Yuq, On 18/05/2018 11:27, Qiang Yu wrote: > From: Andrei Paulau <7134...@gmail.com> > > Meson mali GPU operate in high clock frequency, need > this value be high to work in a stable state. > > Signed-off-by: Andrei Paulau <7134...@gmail.com> > --- > arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi > index 562c26a0ba33..00cd2fc1aa95 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi > @@ -241,6 +241,7 @@ > "pp2", "ppmmu2"; > clocks = < CLKID_CLK81>, < CLKID_MALI>; > clock-names = "bus", "core"; > + switch-delay = <0x>; > > /* >* Mali clocking is provided by two identical clock paths > Same this one, CC it to : linux-amlo...@lists.infradead.org Thanks, Neil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC 03/24] arm64/dts: add switch-delay for meson mali
Hi Yuq, On 18/05/2018 11:27, Qiang Yu wrote: > Meson mali GPU operate in high clock frequency, need > this value be high to work in a stable state. > > Signed-off-by: Qiang Yu> --- > arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi > b/arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi > index eb327664a4d8..8bed15267c9c 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi > +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi > @@ -23,6 +23,7 @@ > "pp2", "ppmmu2"; > clocks = < CLKID_CLK81>, < CLKID_MALI>; > clock-names = "bus", "core"; > + switch-delay = <0x>; > > /* >* Mali clocking is provided by two identical clock paths > Please CC : linux-amlo...@lists.infradead.org to have these amlogic DT patches reviewed and applied. Same for cover-letter to have context. Thanks, Neil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 1/5] media: cec-notifier: Get notifier by device and connector name
In non device-tree world, we can need to get the notifier by the driver name directly and eventually defer probe if not yet created. This patch adds a variant of the get function by using the device name instead and will not create a notifier if not yet created. But the i915 driver exposes at least 2 HDMI connectors, this patch also adds the possibility to add a connector name tied to the notifier device to form a tuple and associate different CEC controllers for each HDMI connectors. Signed-off-by: Neil Armstrong--- drivers/media/cec/cec-notifier.c | 11 --- include/media/cec-notifier.h | 27 --- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/media/cec/cec-notifier.c b/drivers/media/cec/cec-notifier.c index 16dffa0..dd2078b 100644 --- a/drivers/media/cec/cec-notifier.c +++ b/drivers/media/cec/cec-notifier.c @@ -21,6 +21,7 @@ struct cec_notifier { struct list_head head; struct kref kref; struct device *dev; + const char *conn; struct cec_adapter *cec_adap; void (*callback)(struct cec_adapter *adap, u16 pa); @@ -30,13 +31,14 @@ struct cec_notifier { static LIST_HEAD(cec_notifiers); static DEFINE_MUTEX(cec_notifiers_lock); -struct cec_notifier *cec_notifier_get(struct device *dev) +struct cec_notifier *cec_notifier_get_conn(struct device *dev, const char *conn) { struct cec_notifier *n; mutex_lock(_notifiers_lock); list_for_each_entry(n, _notifiers, head) { - if (n->dev == dev) { + if (n->dev == dev && + (!conn || !strcmp(n->conn, conn))) { kref_get(>kref); mutex_unlock(_notifiers_lock); return n; @@ -46,6 +48,8 @@ struct cec_notifier *cec_notifier_get(struct device *dev) if (!n) goto unlock; n->dev = dev; + if (conn) + n->conn = kstrdup(conn, GFP_KERNEL); n->phys_addr = CEC_PHYS_ADDR_INVALID; mutex_init(>lock); kref_init(>kref); @@ -54,7 +58,7 @@ struct cec_notifier *cec_notifier_get(struct device *dev) mutex_unlock(_notifiers_lock); return n; } -EXPORT_SYMBOL_GPL(cec_notifier_get); +EXPORT_SYMBOL_GPL(cec_notifier_get_conn); static void cec_notifier_release(struct kref *kref) { @@ -62,6 +66,7 @@ static void cec_notifier_release(struct kref *kref) container_of(kref, struct cec_notifier, kref); list_del(>head); + kfree(n->conn); kfree(n); } diff --git a/include/media/cec-notifier.h b/include/media/cec-notifier.h index cf0add7..814eeef 100644 --- a/include/media/cec-notifier.h +++ b/include/media/cec-notifier.h @@ -20,8 +20,10 @@ struct cec_notifier; #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER) /** - * cec_notifier_get - find or create a new cec_notifier for the given device. + * cec_notifier_get_conn - find or create a new cec_notifier for the given + * device and connector tuple. * @dev: device that sends the events. + * @conn: the connector name from which the event occurs * * If a notifier for device @dev already exists, then increase the refcount * and return that notifier. @@ -31,7 +33,8 @@ struct cec_notifier; * * Return NULL if the memory could not be allocated. */ -struct cec_notifier *cec_notifier_get(struct device *dev); +struct cec_notifier *cec_notifier_get_conn(struct device *dev, + const char *conn); /** * cec_notifier_put - decrease refcount and delete when the refcount reaches 0. @@ -85,7 +88,8 @@ void cec_register_cec_notifier(struct cec_adapter *adap, struct cec_notifier *notifier); #else -static inline struct cec_notifier *cec_notifier_get(struct device *dev) +static inline struct cec_notifier *cec_notifier_get_conn(struct device *dev, +const char *conn) { /* A non-NULL pointer is expected on success */ return (struct cec_notifier *)0xdeadfeed; @@ -121,6 +125,23 @@ static inline void cec_register_cec_notifier(struct cec_adapter *adap, #endif /** + * cec_notifier_get - find or create a new cec_notifier for the given device. + * @dev: device that sends the events. + * + * If a notifier for device @dev already exists, then increase the refcount + * and return that notifier. + * + * If it doesn't exist, then allocate a new notifier struct and return a + * pointer to that new struct. + * + * Return NULL if the memory could not be allocated. + */ +static inline struct cec_notifier *cec_notifier_get(struct device *dev) +{ + return cec_notifier_get_conn(dev, NULL); +} + +/** * cec_notifier_phys_addr_invalidate() - set the physical address to INVALID * * @n: the CEC notifier -- 2.7.4 ___ dri-devel mailing list
[PATCH v4 4/5] mfd: cros_ec_dev: Add CEC sub-device registration
The EC can expose a CEC bus, thus add the cros-ec-cec MFD sub-device when the CEC feature bit is present. Signed-off-by: Neil ArmstrongReviewed-by: Enric Balletbo i Serra --- drivers/mfd/cros_ec_dev.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 1d6dc5c..272969e 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -383,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec) kfree(msg); } +static const struct mfd_cell cros_ec_cec_cells[] = { + { .name = "cros-ec-cec" } +}; + static const struct mfd_cell cros_ec_rtc_cells[] = { { .name = "cros-ec-rtc" } }; @@ -426,6 +430,18 @@ static int ec_device_probe(struct platform_device *pdev) if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE)) cros_ec_sensors_register(ec); + /* Check whether this EC instance has CEC host command support */ + if (cros_ec_check_features(ec, EC_FEATURE_CEC)) { + retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, +cros_ec_cec_cells, +ARRAY_SIZE(cros_ec_cec_cells), +NULL, 0, NULL); + if (retval) + dev_err(ec->dev, + "failed to add cros-ec-cec device: %d\n", + retval); + } + /* Check whether this EC instance has RTC host command support */ if (cros_ec_check_features(ec, EC_FEATURE_RTC)) { retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 3/5] mfd: cros-ec: Introduce CEC commands and events definitions.
The EC can expose a CEC bus, this patch adds the CEC related definitions needed by the cros-ec-cec driver. Having a 16 byte mkbp event size makes it possible to send CEC messages from the EC to the AP directly inside the mkbp event instead of first doing a notification and then a read. Signed-off-by: Stefan AdolfssonSigned-off-by: Neil Armstrong --- drivers/platform/chrome/cros_ec_proto.c | 40 ++--- include/linux/mfd/cros_ec.h | 2 +- include/linux/mfd/cros_ec_commands.h| 103 3 files changed, 135 insertions(+), 10 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index e7bbdf9..c4f6c44 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -504,10 +504,31 @@ int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, } EXPORT_SYMBOL(cros_ec_cmd_xfer_status); +static int get_next_event_xfer(struct cros_ec_device *ec_dev, + struct cros_ec_command *msg, + int version, uint32_t size) +{ + int ret; + + msg->version = version; + msg->command = EC_CMD_GET_NEXT_EVENT; + msg->insize = size; + msg->outsize = 0; + + ret = cros_ec_cmd_xfer(ec_dev, msg); + if (ret > 0) { + ec_dev->event_size = ret - 1; + memcpy(_dev->event_data, msg->data, ec_dev->event_size); + } + + return ret; +} + static int get_next_event(struct cros_ec_device *ec_dev) { u8 buffer[sizeof(struct cros_ec_command) + sizeof(ec_dev->event_data)]; struct cros_ec_command *msg = (struct cros_ec_command *) + static int cmd_version = 1; int ret; if (ec_dev->suspended) { @@ -515,18 +536,19 @@ static int get_next_event(struct cros_ec_device *ec_dev) return -EHOSTDOWN; } - msg->version = 0; - msg->command = EC_CMD_GET_NEXT_EVENT; - msg->insize = sizeof(ec_dev->event_data); - msg->outsize = 0; + if (cmd_version == 1) { + ret = get_next_event_xfer(ec_dev, msg, cmd_version, + sizeof(struct ec_response_get_next_event_v1)); + if (ret < 0 || msg->result != EC_RES_INVALID_VERSION) + return ret; - ret = cros_ec_cmd_xfer(ec_dev, msg); - if (ret > 0) { - ec_dev->event_size = ret - 1; - memcpy(_dev->event_data, msg->data, - sizeof(ec_dev->event_data)); + /* Fallback to version 0 for future send attempts */ + cmd_version = 0; } + ret = get_next_event_xfer(ec_dev, msg, cmd_version, + sizeof(struct ec_response_get_next_event)); + return ret; } diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index f36125e..32caef3 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -147,7 +147,7 @@ struct cros_ec_device { bool mkbp_event_supported; struct blocking_notifier_head event_notifier; - struct ec_response_get_next_event event_data; + struct ec_response_get_next_event_v1 event_data; int event_size; u32 host_event_wake_mask; }; diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index f2edd99..9b8bc4a 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -804,6 +804,8 @@ enum ec_feature_code { EC_FEATURE_MOTION_SENSE_FIFO = 24, /* EC has RTC feature that can be controlled by host commands */ EC_FEATURE_RTC = 27, + /* EC supports CEC commands */ + EC_FEATURE_CEC = 35, }; #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) @@ -2078,6 +2080,12 @@ enum ec_mkbp_event { /* EC sent a sysrq command */ EC_MKBP_EVENT_SYSRQ = 6, + /* Notify the AP that something happened on CEC */ + EC_MKBP_CEC_EVENT = 8, + + /* Send an incoming CEC message to the AP */ + EC_MKBP_EVENT_CEC_MESSAGE = 9, + /* Number of MKBP events */ EC_MKBP_EVENT_COUNT, }; @@ -2093,12 +2101,31 @@ union ec_response_get_next_data { uint32_t sysrq; } __packed; +union ec_response_get_next_data_v1 { + uint8_t key_matrix[16]; + + /* Unaligned */ + uint32_t host_event; + + uint32_t buttons; + uint32_t switches; + uint32_t sysrq; + uint32_t cec_events; + uint8_tcec_message[16]; +} __packed; + struct ec_response_get_next_event { uint8_t event_type; /* Followed by event data if any */ union ec_response_get_next_data data; } __packed; +struct ec_response_get_next_event_v1 { + uint8_t event_type; + /* Followed by event data if any */ + union
Re: [PATCH 1/2] drm/fourcc: add a 10bits fully packed variant of NV12
On Mon, May 21, 2018 at 01:17:04AM +0800, Randy Li wrote: > This pixel format is a fully packed and 10bits variant of NV12. > A luma pixel would take 10bits in memory, without any > filled bits between pixels in a stride. The color gamut > follows the BT.2020 standard. > > Signed-off-by: Randy Li> --- > drivers/gpu/drm/drm_fourcc.c | 1 + > include/uapi/drm/drm_fourcc.h | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c > index 5ca6395cd4d3..1f43967c4013 100644 > --- a/drivers/gpu/drm/drm_fourcc.c > +++ b/drivers/gpu/drm/drm_fourcc.c > @@ -173,6 +173,7 @@ const struct drm_format_info *__drm_format_info(u32 > format) > { .format = DRM_FORMAT_UYVY,.depth = 0, > .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 }, > { .format = DRM_FORMAT_VYUY,.depth = 0, > .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 }, > { .format = DRM_FORMAT_AYUV,.depth = 0, > .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true > }, > + { .format = DRM_FORMAT_NV12_10LE40, .depth = 0, > .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2 }, > }; > > unsigned int i; > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h > index e04613d30a13..8eabf01e966f 100644 > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -140,6 +140,9 @@ extern "C" { > #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 > subsampled Cb:Cr plane */ > #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* > non-subsampled Cr:Cb plane */ > #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* > non-subsampled Cb:Cr plane */ > +/* A fully packed variant of NV12_10LE32 */ What does "fully packed" mean? NV12_10LE32 doesn't even exist so referring to it makes no sense. Please try to provide an unambiguous description of new formats like we have for everything else. > +#define DRM_FORMAT_NV12_10LE40 fourcc_code('R', 'K', '2', '0') /* 2x2 > subsampled Cr:Cb plane */ > + > > /* > * 3 plane YCbCr > -- > 2.14.3 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrjälä Intel ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/gma500: Fix Medfield for drm_framebuffer move
bc61c97502e2 moved the gtt_range structure, from being in psb_framebuffer and embedding the GEM object, to being placed in the drm_framebuffer with the gtt_range being derived from the GEM object. The conversion missed out the Medfield subdriver, which was not being built in the default drm-misc config. Do the trivial fixup here. Signed-off-by: Daniel StoneReported-by: kbuild test robot Fixes: bc61c97502e2 ("drm/gma500: Move GEM BO to drm_framebuffer") Cc: Thierry Reding Cc: Patrik Jakobsson --- drivers/gpu/drm/gma500/mdfld_intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c index 5c066448be5b..881d613cc2e5 100644 --- a/drivers/gpu/drm/gma500/mdfld_intel_display.c +++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c @@ -196,7 +196,7 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, if (!gma_power_begin(dev, true)) return 0; - start = psbfb->gtt->offset; + start = to_gtt_range(fb->obj[0])->offset; offset = y * fb->pitches[0] + x * fb->format->cpp[0]; REG_WRITE(map->stride, fb->pitches[0]); -- 2.17.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106594] [radeonsi,regression,apitrace] Prison Architect exhibits glitches
https://bugs.freedesktop.org/show_bug.cgi?id=106594 Bug ID: 106594 Summary: [radeonsi,regression,apitrace] Prison Architect exhibits glitches Product: Mesa Version: git Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Keywords: regression Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel@lists.freedesktop.org Reporter: k...@dev.carbon-project.org QA Contact: dri-devel@lists.freedesktop.org Blocks: 77449 Created attachment 139660 --> https://bugs.freedesktop.org/attachment.cgi?id=139660=edit Compressed trace I wanted to play Prison Architect again, but when I launch the game and during gameplay there are sometimes triangles flickering over the screen in various colours of the rainbow (see the first frame of the trace). And there are actions that trigger these glitches reliably like opening the staff menu and placing the mouse with a staff type selected over the map (see attached screenshot or eg. Frame 599 in the trace). This is a regression, because I was able to play Prison Architect with no trouble in the past. However I cannot say whether this is a regression in PA or in Mesa/LLVM, since it has been a while since I last played PA and there have been updates to PA as well as the graphics stack. In any case I prepared a trace (which looks a bit funny on reply: lots of black with the game window stuck in the lower left corner of the replay), I'll attach as a compressed file to this bug. I'll also attach the log from the game, there are couple of lines, that seem interesting, like: > ==OPENGL==> [location 'Bitmap::ConvertToTexture Before Texture Creation'] > error code 0x502 (invalid operation) While I'm using the "experimental VBO" feature of PA, turning that off, doesn't fix this bug and thus seems unrelated. This bug affects at least the Steam and the Humble Bundle builds of version 13f. The graphics stack I used (fully updated Debian testing as a base) for testing is: GPU: Hawaii PRO [Radeon R9 290] (ChipID = 0x67b1) Mesa: Git:master/6f558fb0f7 libdrm: 2.4.91-2 LLVM: SVN:trunk/r332816 (7.0 devel) X.Org: 2:1.19.6-1 Linux: 4.16.10 Firmware (firmware-amd-graphics): 20170823-1 libclc: Git:master/a2118d58fc DDX (xserver-xorg-video-amdgpu): 18.0.1-1 Let me know, if you need anything else. Referenced Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=77449 [Bug 77449] Tracker bug for all bugs related to Steam titles -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106594] [radeonsi,regression,apitrace] Prison Architect exhibits glitches
https://bugs.freedesktop.org/show_bug.cgi?id=106594 --- Comment #1 from Kai--- Created attachment 139661 --> https://bugs.freedesktop.org/attachment.cgi?id=139661=edit Glitch while placing new staff on the map -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106594] [radeonsi,regression,apitrace] Prison Architect exhibits glitches
https://bugs.freedesktop.org/show_bug.cgi?id=106594 --- Comment #2 from Kai--- Created attachment 139662 --> https://bugs.freedesktop.org/attachment.cgi?id=139662=edit Game output to STDOUT and STDERR -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v6 4/5] phy: rockchip-typec: support variable phy config value
Hi Lin, 2018-05-21 11:37 GMT+02:00 Lin Huang: > the phy config values used to fix in dp firmware, but some boards > need change these values to do training and get the better eye diagram > result. So support that in phy driver. > > Signed-off-by: Chris Zhong > Signed-off-by: Lin Huang > --- > Changes in v2: > - update patch following Enric suggest > Changes in v3: > - delete need_software_training variable > - add default phy config value, if dts do not define phy config value, use > these value > Changes in v4: > - rename variable config to tcphy_default_config > Changes in v5: > - None > Changes in v6: > - split the header file to new patch > > drivers/phy/rockchip/phy-rockchip-typec.c | 261 > -- > 1 file changed, 208 insertions(+), 53 deletions(-) > > diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c > b/drivers/phy/rockchip/phy-rockchip-typec.c > index 795055f..4c4b925 100644 > --- a/drivers/phy/rockchip/phy-rockchip-typec.c > +++ b/drivers/phy/rockchip/phy-rockchip-typec.c > @@ -324,21 +324,29 @@ > * clock 0: PLL 0 div 1 > * clock 1: PLL 1 div 2 > */ > -#define CLK_PLL_CONFIG 0X30 > +#define CLK_PLL1_DIV1 0x20 > +#define CLK_PLL1_DIV2 0x30 > #define CLK_PLL_MASK 0x33 > > #define CMN_READY BIT(0) > > +#define DP_PLL_CLOCK_ENABLE_ACKBIT(3) > #define DP_PLL_CLOCK_ENABLEBIT(2) > +#define DP_PLL_ENABLE_ACK BIT(1) > #define DP_PLL_ENABLE BIT(0) > #define DP_PLL_DATA_RATE_RBR ((2 << 12) | (4 << 8)) > #define DP_PLL_DATA_RATE_HBR ((2 << 12) | (4 << 8)) > #define DP_PLL_DATA_RATE_HBR2 ((1 << 12) | (2 << 8)) > +#define DP_PLL_DATA_RATE_MASK 0xff00 > > -#define DP_MODE_A0 BIT(4) > -#define DP_MODE_A2 BIT(6) > -#define DP_MODE_ENTER_A0 0xc101 > -#define DP_MODE_ENTER_A2 0xc104 > +#define DP_MODE_MASK 0xf > +#define DP_MODE_ENTER_A0 BIT(0) > +#define DP_MODE_ENTER_A2 BIT(2) > +#define DP_MODE_ENTER_A3 BIT(3) > +#define DP_MODE_A0_ACK BIT(4) > +#define DP_MODE_A2_ACK BIT(6) > +#define DP_MODE_A3_ACK BIT(7) > +#define DP_LINK_RESET_DEASSERTED BIT(8) > > #define PHY_MODE_SET_TIMEOUT 10 > > @@ -350,6 +358,8 @@ > #define MODE_DFP_USB BIT(1) > #define MODE_DFP_DPBIT(2) > > +#define DP_DEFAULT_RATE162000 > + > struct phy_reg { > u16 value; > u32 addr; > @@ -372,15 +382,15 @@ struct phy_reg usb3_pll_cfg[] = { > { 0x8, CMN_DIAG_PLL0_LF_PROG }, > }; > > -struct phy_reg dp_pll_cfg[] = { > +struct phy_reg dp_pll_rbr_cfg[] = { > { 0xf0, CMN_PLL1_VCOCAL_INIT }, > { 0x18, CMN_PLL1_VCOCAL_ITER }, > { 0x30b9, CMN_PLL1_VCOCAL_START }, > - { 0x21c,CMN_PLL1_INTDIV }, > + { 0x87, CMN_PLL1_INTDIV }, > { 0,CMN_PLL1_FRACDIV }, > - { 0x5, CMN_PLL1_HIGH_THR }, > - { 0x35, CMN_PLL1_SS_CTRL1 }, > - { 0x7f1e, CMN_PLL1_SS_CTRL2 }, > + { 0x22, CMN_PLL1_HIGH_THR }, > + { 0x8000, CMN_PLL1_SS_CTRL1 }, > + { 0,CMN_PLL1_SS_CTRL2 }, > { 0x20, CMN_PLL1_DSM_DIAG }, > { 0,CMN_PLLSM1_USER_DEF_CTRL }, > { 0,CMN_DIAG_PLL1_OVRD }, > @@ -391,9 +401,52 @@ struct phy_reg dp_pll_cfg[] = { > { 0x8, CMN_DIAG_PLL1_LF_PROG }, > { 0x100,CMN_DIAG_PLL1_PTATIS_TUNE1 }, > { 0x7, CMN_DIAG_PLL1_PTATIS_TUNE2 }, > - { 0x4, CMN_DIAG_PLL1_INCLK_CTRL }, > + { 0x1, CMN_DIAG_PLL1_INCLK_CTRL }, > }; > > +struct phy_reg dp_pll_hbr_cfg[] = { > + { 0xf0, CMN_PLL1_VCOCAL_INIT }, > + { 0x18, CMN_PLL1_VCOCAL_ITER }, > + { 0x30b4, CMN_PLL1_VCOCAL_START }, > + { 0xe1, CMN_PLL1_INTDIV }, > + { 0,CMN_PLL1_FRACDIV }, > + { 0x5, CMN_PLL1_HIGH_THR }, > + { 0x8000, CMN_PLL1_SS_CTRL1 }, > + { 0,CMN_PLL1_SS_CTRL2 }, > + { 0x20, CMN_PLL1_DSM_DIAG }, > + { 0x1000, CMN_PLLSM1_USER_DEF_CTRL }, > + { 0,CMN_DIAG_PLL1_OVRD }, > + { 0,CMN_DIAG_PLL1_FBH_OVRD }, > + { 0,CMN_DIAG_PLL1_FBL_OVRD }, > + { 0x7, CMN_DIAG_PLL1_V2I_TUNE }, > + { 0x45, CMN_DIAG_PLL1_CP_TUNE }, > + { 0x8, CMN_DIAG_PLL1_LF_PROG }, > + { 0x1, CMN_DIAG_PLL1_PTATIS_TUNE1 }, > + { 0x1, CMN_DIAG_PLL1_PTATIS_TUNE2 }, > + { 0x1, CMN_DIAG_PLL1_INCLK_CTRL }, > +}; > + >
Re: [PATCH v6 5/5] drm/rockchip: support dp training outside dp firmware
Hi Lin, 2018-05-21 11:37 GMT+02:00 Lin Huang: > DP firmware uses fixed phy config values to do training, but some > boards need to adjust these values to fit for their unique hardware > design. So get phy config values from dts and use software link training > instead of relying on firmware, if software training fail, keep firmware > training as a fallback if sw training fails. > > Signed-off-by: Chris Zhong > Signed-off-by: Lin Huang > Reviewed-by: Sean Paul > --- > Changes in v2: > - update patch following Enric suggest > Changes in v3: > - use variable fw_training instead sw_training_success > - base on DP SPCE, if training fail use lower link rate to retry training > Changes in v4: > - improve cdn_dp_get_lower_link_rate() and cdn_dp_software_train_link() > follow Sean suggest > Changes in v5: > - fix some whitespcae issue > Changes in v6: > - None > > drivers/gpu/drm/rockchip/Makefile | 3 +- > drivers/gpu/drm/rockchip/cdn-dp-core.c | 24 +- > drivers/gpu/drm/rockchip/cdn-dp-core.h | 2 + > drivers/gpu/drm/rockchip/cdn-dp-link-training.c | 420 > > drivers/gpu/drm/rockchip/cdn-dp-reg.c | 31 +- > drivers/gpu/drm/rockchip/cdn-dp-reg.h | 38 ++- > 6 files changed, 505 insertions(+), 13 deletions(-) > create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-link-training.c > > diff --git a/drivers/gpu/drm/rockchip/Makefile > b/drivers/gpu/drm/rockchip/Makefile > index a314e21..b932f62 100644 > --- a/drivers/gpu/drm/rockchip/Makefile > +++ b/drivers/gpu/drm/rockchip/Makefile > @@ -9,7 +9,8 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \ > rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o > > rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o > -rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o > +rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o \ > + cdn-dp-link-training.o > rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o > rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o > rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o > diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c > b/drivers/gpu/drm/rockchip/cdn-dp-core.c > index cce64c1..d9d0d4d 100644 > --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c > +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c > @@ -629,11 +629,13 @@ static void cdn_dp_encoder_enable(struct drm_encoder > *encoder) > goto out; > } > } > - > - ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_IDLE); > - if (ret) { > - DRM_DEV_ERROR(dp->dev, "Failed to idle video %d\n", ret); > - goto out; > + if (dp->use_fw_training == true) { You don't need to compare to true. Simply do: if (dp->use_fw_training) > + ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_IDLE); > + if (ret) { > + DRM_DEV_ERROR(dp->dev, > + "Failed to idle video %d\n", ret); > + goto out; > + } > } > > ret = cdn_dp_config_video(dp); > @@ -642,11 +644,15 @@ static void cdn_dp_encoder_enable(struct drm_encoder > *encoder) > goto out; > } > > - ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_VALID); > - if (ret) { > - DRM_DEV_ERROR(dp->dev, "Failed to valid video %d\n", ret); > - goto out; > + if (dp->use_fw_training == true) { if (dp->use_fw_training) > + ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_VALID); > + if (ret) { > + DRM_DEV_ERROR(dp->dev, > + "Failed to valid video %d\n", ret); > + goto out; > + } > } > + > out: > mutex_unlock(>lock); > } > diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h > b/drivers/gpu/drm/rockchip/cdn-dp-core.h > index 46159b2..77a9793 100644 > --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h > +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h > @@ -84,6 +84,7 @@ struct cdn_dp_device { > bool connected; > bool active; > bool suspended; > + bool use_fw_training; > > const struct firmware *fw; /* cdn dp firmware */ > unsigned int fw_version;/* cdn fw version */ > @@ -106,6 +107,7 @@ struct cdn_dp_device { > u8 ports; > u8 lanes; > int active_port; > + u8 train_set[4]; > > u8 dpcd[DP_RECEIVER_CAP_SIZE]; > bool sink_has_audio; > diff --git a/drivers/gpu/drm/rockchip/cdn-dp-link-training.c > b/drivers/gpu/drm/rockchip/cdn-dp-link-training.c > new file mode 100644 > index 000..73c3290 > --- /dev/null > +++
[PATCH v4 5/5] media: platform: Add ChromeOS EC CEC driver
The ChromeOS Embedded Controller can expose a CEC bus, this patch add the driver for such feature of the Embedded Controller. This driver is part of the cros-ec MFD and will be add as a sub-device when the feature bit is exposed by the EC. The controller will only handle a single logical address and handles all the messages retries and will only expose Success or Error. The controller will be tied to the HDMI CEC notifier by using the platform DMI Data and the i915 device name and connector name. Signed-off-by: Neil ArmstrongReviewed-by: Enric Balletbo i Serra --- drivers/media/platform/Kconfig | 11 + drivers/media/platform/Makefile | 2 + drivers/media/platform/cros-ec-cec/Makefile | 1 + drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 347 +++ 4 files changed, 361 insertions(+) create mode 100644 drivers/media/platform/cros-ec-cec/Makefile create mode 100644 drivers/media/platform/cros-ec-cec/cros-ec-cec.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index c7a1cf8..bc37ecf 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -546,6 +546,17 @@ menuconfig CEC_PLATFORM_DRIVERS if CEC_PLATFORM_DRIVERS +config VIDEO_CROS_EC_CEC + tristate "ChromeOS EC CEC driver" + depends on MFD_CROS_EC || COMPILE_TEST + select CEC_CORE + select CEC_NOTIFIER + ---help--- + If you say yes here you will get support for the + ChromeOS Embedded Controller's CEC. + The CEC bus is present in the HDMI connector and enables communication + between compatible devices. + config VIDEO_MESON_AO_CEC tristate "Amlogic Meson AO CEC driver" depends on ARCH_MESON || COMPILE_TEST diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 932515d..830696f 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -92,3 +92,5 @@ obj-$(CONFIG_VIDEO_QCOM_CAMSS)+= qcom/camss-8x16/ obj-$(CONFIG_VIDEO_QCOM_VENUS) += qcom/venus/ obj-y += meson/ + +obj-y += cros-ec-cec/ diff --git a/drivers/media/platform/cros-ec-cec/Makefile b/drivers/media/platform/cros-ec-cec/Makefile new file mode 100644 index 000..9ce97f9 --- /dev/null +++ b/drivers/media/platform/cros-ec-cec/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_CROS_EC_CEC) += cros-ec-cec.o diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c new file mode 100644 index 000..7f897a2 --- /dev/null +++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c @@ -0,0 +1,347 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * CEC driver for ChromeOS Embedded Controller + * + * Copyright (c) 2018 BayLibre, SAS + * Author: Neil Armstrong + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRV_NAME "cros-ec-cec" + +/** + * struct cros_ec_cec - Driver data for EC CEC + * + * @cros_ec: Pointer to EC device + * @notifier: Notifier info for responding to EC events + * @adap: CEC adapter + * @notify: CEC notifier pointer + * @rx_msg: storage for a received message + */ +struct cros_ec_cec { + struct cros_ec_device *cros_ec; + struct notifier_block notifier; + struct cec_adapter *adap; + struct cec_notifier *notify; + struct cec_msg rx_msg; +}; + +static void handle_cec_message(struct cros_ec_cec *cros_ec_cec) +{ + struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; + uint8_t *cec_message = cros_ec->event_data.data.cec_message; + unsigned int len = cros_ec->event_size; + + cros_ec_cec->rx_msg.len = len; + memcpy(cros_ec_cec->rx_msg.msg, cec_message, len); + + cec_received_msg(cros_ec_cec->adap, _ec_cec->rx_msg); +} + +static void handle_cec_event(struct cros_ec_cec *cros_ec_cec) +{ + struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; + uint32_t events = cros_ec->event_data.data.cec_events; + + if (events & EC_MKBP_CEC_SEND_OK) + cec_transmit_attempt_done(cros_ec_cec->adap, + CEC_TX_STATUS_OK); + + /* FW takes care of all retries, tell core to avoid more retries */ + if (events & EC_MKBP_CEC_SEND_FAILED) + cec_transmit_attempt_done(cros_ec_cec->adap, + CEC_TX_STATUS_MAX_RETRIES | + CEC_TX_STATUS_NACK); +} + +static int cros_ec_cec_event(struct notifier_block *nb, +unsigned long queued_during_suspend, +void *_notify) +{ + struct cros_ec_cec *cros_ec_cec; + struct cros_ec_device *cros_ec; + +
[PATCH v4 2/5] drm/i915: hdmi: add CEC notifier to intel_hdmi
This patchs adds the cec_notifier feature to the intel_hdmi part of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports. The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter. Signed-off-by: Neil ArmstrongReviewed-by: Hans Verkuil --- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c| 13 + 4 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig index dfd9588..2d65d56 100644 --- a/drivers/gpu/drm/i915/Kconfig +++ b/drivers/gpu/drm/i915/Kconfig @@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics, diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h index 4e7418b..c68d1c8 100644 --- a/drivers/gpu/drm/i915/intel_display.h +++ b/drivers/gpu/drm/i915/intel_display.h @@ -126,6 +126,26 @@ enum port { #define port_name(p) ((p) + 'A') +static inline const char *port_identifier(enum port port) +{ + switch (port) { + case PORT_A: + return "Port A"; + case PORT_B: + return "Port B"; + case PORT_C: + return "Port C"; + case PORT_D: + return "Port D"; + case PORT_E: + return "Port E"; + case PORT_F: + return "Port F"; + default: + return ""; + } +} + enum dpio_channel { DPIO_CH0, DPIO_CH1 diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index d436858..b50e51b 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -39,6 +39,7 @@ #include #include #include +#include /** * __wait_for - magic wait macro @@ -1001,6 +1002,7 @@ struct intel_hdmi { bool has_audio; bool rgb_quant_range_selectable; struct intel_connector *attached_connector; + struct cec_notifier *notifier; }; struct intel_dp_mst_encoder; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 1baef4a..d522b5b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } + cec_notifier_set_phys_addr_from_edid(intel_hdmi->notifier, edid); + return connected; } @@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) { enum drm_connector_status status; struct drm_i915_private *dev_priv = to_i915(connector->dev); + struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); @@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS); + if (status != connector_status_connected) + cec_notifier_phys_addr_invalidate(intel_hdmi->notifier); + return status; } @@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder, static void intel_hdmi_destroy(struct drm_connector *connector) { + if (intel_attached_hdmi(connector)->notifier) + cec_notifier_put(intel_attached_hdmi(connector)->notifier); kfree(to_intel_connector(connector)->detect_edid); drm_connector_cleanup(connector); kfree(connector); @@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, u32 temp = I915_READ(PEG_BAND_GAP_DATA); I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd); } + + intel_hdmi->notifier = cec_notifier_get_conn(dev->dev, +port_identifier(port)); + if (!intel_hdmi->notifier) + DRM_DEBUG_KMS("CEC notifier get failed\n"); } void intel_hdmi_init(struct drm_i915_private *dev_priv, -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 0/5] Add ChromeOS EC CEC Support
Hi All, The new Google "Fizz" Intel-based ChromeOS device is gaining CEC support through it's Embedded Controller, to enable the Linux CEC Core to communicate with it and get the CEC Physical Address from the correct HDMI Connector, the following must be added/changed: - Add the CEC sub-device registration in the ChromeOS EC MFD Driver - Add the CEC related commands and events definitions into the EC MFD driver - Add a way to get a CEC notifier with it's (optional) connector name - Add the CEC notifier to the i915 HDMI driver - Add the proper ChromeOS EC CEC Driver The CEC notifier with the connector name is the tricky point, since even on Device-Tree platforms, there is no way to distinguish between multiple HDMI connectors from the same DRM driver. The solution I implemented is pretty simple and only adds an optional connector name to eventually distinguish an HDMI connector notifier from another if they share the same device. Feel free to comment this patchset ! Changes since v3 (incorrectly reported as v2): - Renamed "Chrome OS" to "ChromeOS" - Updated cros_ec_commands.h new structs definitions to kernel doc format - Added Reviwed-By tags Changes since v2: - Add i915 port_identifier() and use this stable name as cec_notifier conn name - Fixed and cleaned up the CEC commands and events handling - Rebased the CEC sub-device registration on top of Enric's serie - Fixed comments typo on cec driver - Protected the DMI match only with PCI and DMI Kconfigs Changes since v1: - Added cec_notifier_put to intel_hdmi - Fixed all small reported issues on the EC CEC driver - Moved the cec_notifier_get out of the #if .. #else .. #endif Changes since RFC: - Moved CEC sub-device registration after CEC commands and events definitions patch - Removed get_notifier_get_byname - Added CEC_CORE select into i915 Kconfig - Removed CEC driver fallback if notifier is not configured on HW, added explicit warn - Fixed CEC core return type on error - Moved to cros-ec-cec media platform directory - Use bus_find_device() to find the pci i915 device instead of get_notifier_get_byname() - Fix Logical Address setup - Added comment about HW support - Removed memset of msg structures Neil Armstrong (5): media: cec-notifier: Get notifier by device and connector name drm/i915: hdmi: add CEC notifier to intel_hdmi mfd: cros-ec: Introduce CEC commands and events definitions. mfd: cros_ec_dev: Add CEC sub-device registration media: platform: Add ChromeOS EC CEC driver drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_hdmi.c| 13 + drivers/media/cec/cec-notifier.c | 11 +- drivers/media/platform/Kconfig | 11 + drivers/media/platform/Makefile | 2 + drivers/media/platform/cros-ec-cec/Makefile | 1 + drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 347 +++ drivers/mfd/cros_ec_dev.c| 16 ++ drivers/platform/chrome/cros_ec_proto.c | 40 ++- include/linux/mfd/cros_ec.h | 2 +- include/linux/mfd/cros_ec_commands.h | 103 +++ include/media/cec-notifier.h | 27 +- 14 files changed, 580 insertions(+), 16 deletions(-) create mode 100644 drivers/media/platform/cros-ec-cec/Makefile create mode 100644 drivers/media/platform/cros-ec-cec/cros-ec-cec.c -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 0/5] Add ChromeOS EC CEC Support
On 18/05/2018 16:04, Enric Balletbo Serra wrote: > Hi Neil, > > 2018-05-18 15:04 GMT+02:00 Neil Armstrong: >> Hi All, >> >> The new Google "Fizz" Intel-based ChromeOS device is gaining CEC support >> through it's Embedded Controller, to enable the Linux CEC Core to communicate >> with it and get the CEC Physical Address from the correct HDMI Connector, the >> following must be added/changed: >> - Add the CEC sub-device registration in the ChromeOS EC MFD Driver >> - Add the CEC related commands and events definitions into the EC MFD driver >> - Add a way to get a CEC notifier with it's (optional) connector name >> - Add the CEC notifier to the i915 HDMI driver >> - Add the proper ChromeOS EC CEC Driver >> >> The CEC notifier with the connector name is the tricky point, since even on >> Device-Tree platforms, there is no way to distinguish between multiple HDMI >> connectors from the same DRM driver. The solution I implemented is pretty >> simple and only adds an optional connector name to eventually distinguish >> an HDMI connector notifier from another if they share the same device. >> >> Feel free to comment this patchset ! >> >> Changes since v2: >> - Add i915 port_identifier() and use this stable name as cec_notifier conn >> name >> - Fixed and cleaned up the CEC commands and events handling >> - Rebased the CEC sub-device registration on top of Enric's serie >> - Fixed comments typo on cec driver >> - Protected the DMI match only with PCI and DMI Kconfigs >> > > Just because I got confused when I saw two v2 in my inbox. This is v3, right? Yes, sorry it's v3... next will be v4. > >> Changes since v1: >> - Added cec_notifier_put to intel_hdmi >> - Fixed all small reported issues on the EC CEC driver >> - Moved the cec_notifier_get out of the #if .. #else .. #endif >> >> Changes since RFC: >> - Moved CEC sub-device registration after CEC commands and events >> definitions patch >> - Removed get_notifier_get_byname >> - Added CEC_CORE select into i915 Kconfig >> - Removed CEC driver fallback if notifier is not configured on HW, added >> explicit warn >> - Fixed CEC core return type on error >> - Moved to cros-ec-cec media platform directory >> - Use bus_find_device() to find the pci i915 device instead of >> get_notifier_get_byname() >> - Fix Logical Address setup >> - Added comment about HW support >> - Removed memset of msg structures >> >> Neil Armstrong (5): >> media: cec-notifier: Get notifier by device and connector name >> drm/i915: hdmi: add CEC notifier to intel_hdmi >> mfd: cros-ec: Introduce CEC commands and events definitions. >> mfd: cros_ec_dev: Add CEC sub-device registration >> media: platform: Add Chrome OS EC CEC driver >> >> drivers/gpu/drm/i915/Kconfig | 1 + >> drivers/gpu/drm/i915/intel_display.h | 20 ++ >> drivers/gpu/drm/i915/intel_drv.h | 2 + >> drivers/gpu/drm/i915/intel_hdmi.c| 13 + >> drivers/media/cec/cec-notifier.c | 11 +- >> drivers/media/platform/Kconfig | 11 + >> drivers/media/platform/Makefile | 2 + >> drivers/media/platform/cros-ec-cec/Makefile | 1 + >> drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 347 >> +++ >> drivers/mfd/cros_ec_dev.c| 16 ++ >> drivers/platform/chrome/cros_ec_proto.c | 40 ++- >> include/linux/mfd/cros_ec.h | 2 +- >> include/linux/mfd/cros_ec_commands.h | 80 ++ >> include/media/cec-notifier.h | 27 +- >> 14 files changed, 557 insertions(+), 16 deletions(-) >> create mode 100644 drivers/media/platform/cros-ec-cec/Makefile >> create mode 100644 drivers/media/platform/cros-ec-cec/cros-ec-cec.c >> >> -- >> 2.7.4 >> ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 36/41] drm/i915/gmbus: Increase the Bytes per Rd/Wr Op
GMBUS HW supports 511Bytes as Max Bytes per single RD/WR op. Instead of enabling the 511Bytes per RD/WR cycle on legacy platforms for no absolute ROIs, this change allows the max bytes per op upto 511Bytes from Gen9 onwards. v2: No Change. v3: Inline function for max_xfer_size and renaming of the macro.[Jani] v4: Extra brackets removed [ville] Commit msg is modified. v5: Adding the Reviewed-By received. Cc: Jani NikulaCc: Chris Wilson Signed-off-by: Ramalingam C Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_i2c.c | 11 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 8a0da35718aa..ebdf7c9d816e 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3025,6 +3025,7 @@ enum i915_power_well_id { #define GMBUS_CYCLE_STOP (4<<25) #define GMBUS_BYTE_COUNT_SHIFT 16 #define GMBUS_BYTE_COUNT_MAX 256U +#define GEN9_GMBUS_BYTE_COUNT_MAX 511U #define GMBUS_SLAVE_INDEX_SHIFT 8 #define GMBUS_SLAVE_ADDR_SHIFT 1 #define GMBUS_SLAVE_READ (1<<0) diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index e6875509bcd9..1c0f6b56b209 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c @@ -361,6 +361,13 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv) return ret; } +static inline +unsigned int gmbus_max_xfer_size(struct drm_i915_private *dev_priv) +{ + return INTEL_GEN(dev_priv) >= 9 ? GEN9_GMBUS_BYTE_COUNT_MAX : + GMBUS_BYTE_COUNT_MAX; +} + static int gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv, unsigned short addr, u8 *buf, unsigned int len, @@ -400,7 +407,7 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg, int ret; do { - len = min(rx_size, GMBUS_BYTE_COUNT_MAX); + len = min(rx_size, gmbus_max_xfer_size(dev_priv)); ret = gmbus_xfer_read_chunk(dev_priv, msg->addr, buf, len, gmbus1_index); @@ -462,7 +469,7 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg, int ret; do { - len = min(tx_size, GMBUS_BYTE_COUNT_MAX); + len = min(tx_size, gmbus_max_xfer_size(dev_priv)); ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len, gmbus1_index); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 199781] nouveau: cannot boot without nouveau.modeset=0 and cannot use HDMI output
https://bugzilla.kernel.org/show_bug.cgi?id=199781 --- Comment #2 from Frédéric Pierret (frederic.epi...@orange.fr) --- Created attachment 276085 --> https://bugzilla.kernel.org/attachment.cgi?id=276085=edit dmesg log with nouveau.runpm=0 dmesg log with nouveau.runpm=0 -- You are receiving this mail because: You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 35/41] drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ
On DP HDCP1.4 and 2.2, when CP_IRQ is received, start the link integrity check for the HDCP version that is enabled. v2: Rebased. Function name is changed. v3: No Changes. v4: No Changes. Signed-off-by: Ramalingam Ccc: Sean Paul --- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_hdcp.c | 31 ++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 7287dc398afc..528407d608c8 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -4455,7 +4455,7 @@ intel_dp_short_pulse(struct intel_dp *intel_dp) if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST) intel_dp_handle_test_request(intel_dp); if (sink_irq_vector & DP_CP_IRQ) - intel_hdcp_check_link(intel_dp->attached_connector); + intel_hdcp_handle_cp_irq(intel_dp->attached_connector); if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ) DRM_DEBUG_DRIVER("Sink specific irq unhandled\n"); } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 750fc19f..def8e3255742 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1944,8 +1944,8 @@ int intel_hdcp_init(struct intel_connector *connector, bool hdcp2_supported); int intel_hdcp_enable(struct intel_connector *connector); int intel_hdcp_disable(struct intel_connector *connector); -int intel_hdcp_check_link(struct intel_connector *connector); bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port); +void intel_hdcp_handle_cp_irq(struct intel_connector *connector); /* intel_psr.c */ #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index c5a3e0e52853..d060d7f2e13b 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -32,6 +32,7 @@ int intel_hdcp_read_valid_bksv(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim, u8 *bksv); static struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector); +static int intel_hdcp_check_link(struct intel_connector *connector); static bool panel_supports_hdcp(struct intel_connector *connector) { @@ -80,6 +81,26 @@ static inline bool intel_hdcp2_capable(struct intel_connector *connector) panel_supports_hdcp2(connector)); } +static inline bool intel_hdcp_in_force(struct intel_connector *connector) +{ + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + enum port port = connector->encoder->port; + u32 reg; + + reg = I915_READ(PORT_HDCP_STATUS(port)); + return reg & (HDCP_STATUS_AUTH | HDCP_STATUS_ENC); +} + +static inline bool intel_hdcp2_in_force(struct intel_connector *connector) +{ + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + enum port port = connector->encoder->port; + u32 reg; + + reg = I915_READ(HDCP2_STATUS_DDI(port)); + return reg & (LINK_ENCRYPTION_STATUS | LINK_AUTH_STATUS); +} + static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) { @@ -940,7 +961,7 @@ void intel_hdcp_atomic_check(struct drm_connector *connector, } /* Implements Part 3 of the HDCP authorization procedure */ -int intel_hdcp_check_link(struct intel_connector *connector) +static int intel_hdcp_check_link(struct intel_connector *connector) { struct intel_hdcp *hdcp = >hdcp; struct drm_i915_private *dev_priv = connector->base.dev->dev_private; @@ -1821,3 +1842,11 @@ static int intel_hdcp2_init(struct intel_connector *connector) return ret; } + +void intel_hdcp_handle_cp_irq(struct intel_connector *connector) +{ + if (intel_hdcp_in_force(connector)) + intel_hdcp_check_link(connector); + else if (intel_hdcp2_in_force(connector)) + intel_hdcp2_check_link(connector); +} -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 40/41] drm/i915: Add HDCP2.2 support for DP connectors
On DP connector init, intel_hdcp_init is passed with a flag for hdcp2.2 support based on the platform capability. v2: Rebased. v3: No Changes. v4: Collected the reviewed-by received. Signed-off-by: Ramalingam CReviewed-by: Uma Shankar --- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdcp.c | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ee71a26ec23f..0b4491d60fe7 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -6726,7 +6726,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, if (is_hdcp_supported(dev_priv, port) && !intel_dp_is_edp(intel_dp)) { int ret = intel_hdcp_init(intel_connector, _dp_hdcp_shim, - false); + is_hdcp2_supported(dev_priv)); 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 0496ebec287b..caf9db12971a 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1953,6 +1953,7 @@ int intel_hdcp_enable(struct intel_connector *connector); int intel_hdcp_disable(struct intel_connector *connector); bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port); void intel_hdcp_handle_cp_irq(struct intel_connector *connector); +bool is_hdcp2_supported(struct drm_i915_private *dev_priv); /* intel_psr.c */ #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index d502bdb380d2..dcb7c1db1421 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -1801,7 +1801,6 @@ static int mei_cldev_notify(struct notifier_block *nb, unsigned long event, return NOTIFY_OK; } -static inline bool is_hdcp2_supported(struct drm_i915_private *dev_priv) { return (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) || -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 39/41] drm/i915: Implement the HDCP2.2 support for HDMI
Implements the HDMI adaptation specific HDCP2.2 operations. Basically these are DDC read and write for authenticating through HDCP2.2 messages. v2: Rebased. v3: No Changes. v4: No more special handling of Gmbus burst read for AKE_SEND_CERT. Style fixed with few naming. [Uma] %s/PARING/PAIRING Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdmi.c | 186 ++ 1 file changed, 186 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index a5cc73101acb..042205e57e42 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1106,6 +1107,186 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port) return true; } +static +int intel_hdmi_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port, + uint8_t *rx_status) +{ + return intel_hdmi_hdcp_read(intel_dig_port, + HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET, + rx_status, + HDCP_2_2_HDMI_RXSTATUS_LEN); +} + +static inline +int intel_hdmi_hdcp2_timeout_for_msg(uint8_t msg_id, bool is_paired) +{ + int timeout; + + switch (msg_id) { + case HDCP_2_2_AKE_SEND_CERT: + timeout = HDCP_2_2_CERT_TIMEOUT; + break; + case HDCP_2_2_AKE_SEND_HPRIME: + if (is_paired) + timeout = HDCP_2_2_HPRIME_PAIRED_TIMEOUT; + else + timeout = HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT; + break; + case HDCP_2_2_AKE_SEND_PAIRING_INFO: + timeout = HDCP_2_2_PAIRING_TIMEOUT; + break; + case HDCP_2_2_LC_SEND_LPRIME: + timeout = HDCP_2_2_HDMI_LPRIME_TIMEOUT; + break; + case HDCP_2_2_REP_SEND_RECVID_LIST: + timeout = HDCP_2_2_RECVID_LIST_TIMEOUT; + break; + case HDCP_2_2_REP_STREAM_READY: + timeout = HDCP_2_2_STREAM_READY_TIMEOUT; + break; + default: + timeout = -EINVAL; + DRM_ERROR("Unsupported msg_id: %d\n", (int)msg_id); + } + + return timeout; +} + +static inline +int hdcp2_detect_msg_availability(struct intel_digital_port *intel_digital_port, + uint8_t msg_id, bool *msg_ready, + ssize_t *msg_sz) +{ + uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN]; + int ret; + + ret = intel_hdmi_hdcp2_read_rx_status(intel_digital_port, rx_status); + if (ret < 0) { + DRM_DEBUG_KMS("rx_status read failed. Err %d\n", ret); + return ret; + } + + *msg_sz = ((HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(rx_status[1]) << 8) | + rx_status[0]); + + if (msg_id == HDCP_2_2_REP_SEND_RECVID_LIST) + *msg_ready = (HDCP_2_2_HDMI_RXSTATUS_READY(rx_status[1]) && +*msg_sz); + else + *msg_ready = *msg_sz; + + return 0; +} + +static ssize_t +intel_hdmi_hdcp2_wait_for_msg(struct intel_digital_port *intel_dig_port, + uint8_t msg_id, bool paired) +{ + bool msg_ready = false; + int timeout, ret; + ssize_t msg_sz; + + timeout = intel_hdmi_hdcp2_timeout_for_msg(msg_id, paired); + if (timeout < 0) + return timeout; + + ret = __wait_for(ret = hdcp2_detect_msg_availability(intel_dig_port, +msg_id, _ready, _sz), +!ret && msg_ready && msg_sz, timeout * 1000, +1000, 5 * 1000); + if (ret) + DRM_ERROR("msg_id: %d, ret: %d, timeout: %d\n", + msg_id, ret, timeout); + + return ret ? ret : msg_sz; +} + +static +int intel_hdmi_hdcp2_write_msg(struct intel_digital_port *intel_dig_port, + void *buf, size_t size) +{ + unsigned int offset; + + offset = HDCP_2_2_HDMI_REG_WR_MSG_OFFSET; + return intel_hdmi_hdcp_write(intel_dig_port, offset, buf, size); +} + +static +int intel_hdmi_hdcp2_read_msg(struct intel_digital_port *intel_dig_port, + uint8_t msg_id, void *buf, size_t size) +{ + struct intel_hdmi *hdmi = _dig_port->hdmi; + struct intel_hdcp *hdcp = >attached_connector->hdcp; + unsigned int offset; + ssize_t ret; + + ret = intel_hdmi_hdcp2_wait_for_msg(intel_dig_port, msg_id, + hdcp->is_paired); + if (ret < 0) + return ret; + + /* +* Available msg size should be equal to or lesser than the +* available buffer. +*/ + if (ret >
[PATCH v4 38/41] drm/i915: Implement the HDCP2.2 support for DP
Implements the DP adaptation specific HDCP2.2 functions. These functions perform the DPCD read and write for communicating the HDCP2.2 auth message back and forth. Note: Chris Wilson suggested alternate method for waiting for CP_IRQ, than completions concept. WIP to understand and implement that, if needed. Just to unblock the review of other changes, v2 still continues with completions. v2: wait for cp_irq is merged with this patch. Rebased. v3: wait_queue is used for wait for cp_irq [Chris Wilson] v4: Style fixed. %s/PARING/PAIRING Few style fixes [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_dp.c | 358 ++ drivers/gpu/drm/i915/intel_drv.h | 7 + drivers/gpu/drm/i915/intel_hdcp.c | 5 + 3 files changed, 370 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 528407d608c8..ee71a26ec23f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -5057,6 +5058,28 @@ void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) pps_unlock(intel_dp); } +static int intel_dp_hdcp_wait_for_cp_irq(struct intel_hdcp *hdcp, +int timeout) +{ + long ret; + + /* Reinit */ + atomic_set(>cp_irq_recved, 0); + +#define C (atomic_read(>cp_irq_recved) > 0) + ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, C, + msecs_to_jiffies(timeout)); + + if (ret > 0) { + atomic_set(>cp_irq_recved, 0); + return 0; + } else if (!ret) { + return -ETIMEDOUT; + } + return (int)ret; +} + + static int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, u8 *an) @@ -5275,6 +5298,335 @@ int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, return 0; } +static +int intel_dpcd_offset_for_hdcp2_msgid(uint8_t byte, unsigned int *offset) +{ + switch (byte) { + case HDCP_2_2_AKE_INIT: + *offset = DP_HDCP_2_2_AKE_INIT_OFFSET; + break; + case HDCP_2_2_AKE_SEND_CERT: + *offset = DP_HDCP_2_2_AKE_SEND_CERT_OFFSET; + break; + case HDCP_2_2_AKE_NO_STORED_KM: + *offset = DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET; + break; + case HDCP_2_2_AKE_STORED_KM: + *offset = DP_HDCP_2_2_AKE_STORED_KM_OFFSET; + break; + case HDCP_2_2_AKE_SEND_HPRIME: + *offset = DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET; + break; + case HDCP_2_2_AKE_SEND_PAIRING_INFO: + *offset = DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET; + break; + case HDCP_2_2_LC_INIT: + *offset = DP_HDCP_2_2_LC_INIT_OFFSET; + break; + case HDCP_2_2_LC_SEND_LPRIME: + *offset = DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET; + break; + case HDCP_2_2_SKE_SEND_EKS: + *offset = DP_HDCP_2_2_SKE_SEND_EKS_OFFSET; + break; + case HDCP_2_2_REP_SEND_RECVID_LIST: + *offset = DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET; + break; + case HDCP_2_2_REP_SEND_ACK: + *offset = DP_HDCP_2_2_REP_SEND_ACK_OFFSET; + break; + case HDCP_2_2_REP_STREAM_MANAGE: + *offset = DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET; + break; + case HDCP_2_2_REP_STREAM_READY: + *offset = DP_HDCP_2_2_REP_STREAM_READY_OFFSET; + break; + case HDCP_2_2_ERRATA_DP_STREAM_TYPE: + *offset = DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET; + break; + default: + DRM_ERROR("Unrecognized Msg ID\n"); + return -EINVAL; + } + + return 0; +} + +static inline +int intel_dp_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port, + uint8_t *rx_status) +{ + ssize_t ret; + + ret = drm_dp_dpcd_read(_dig_port->dp.aux, + DP_HDCP_2_2_REG_RXSTATUS_OFFSET, rx_status, + HDCP_2_2_DP_RXSTATUS_LEN); + if (ret != HDCP_2_2_DP_RXSTATUS_LEN) { + DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret); + return ret >= 0 ? -EIO : ret; + } + + return 0; +} + +static +int intel_dp_hdcp2_timeout_for_msg(uint8_t msg_id, bool paired) +{ + int timeout; + + switch (msg_id) { + case HDCP_2_2_AKE_SEND_CERT: + timeout = HDCP_2_2_CERT_TIMEOUT; + break; + case HDCP_2_2_AKE_SEND_HPRIME: + if (paired) + timeout = HDCP_2_2_HPRIME_PAIRED_TIMEOUT; +
[PATCH v4 37/41] drm/i915/gmbus: Enable burst read
Support for Burst read in HW is added for HDCP2.2 compliance requirement. This patch enables the burst read for all the gmbus read of more than 511Bytes, on capable platforms. v2: Extra line is removed. v3: Macro is added for detecting the BURST_READ Support [Jani] Runtime detection of the need for burst_read [Jani] Calculation enhancement. v4: GMBUS0 reg val is passed from caller [ville] Removed a extra var [ville] Extra brackets are removed [ville] Implemented the handling of 512Bytes Burst Read. v5: Burst read max length is fixed at 767Bytes [Ville] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/i915_drv.h | 3 ++ drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_i2c.c | 62 +--- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 028691108125..14293fc1a142 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2552,6 +2552,9 @@ intel_info(const struct drm_i915_private *dev_priv) */ #define HAS_AUX_IRQ(dev_priv) true #define HAS_GMBUS_IRQ(dev_priv) (INTEL_GEN(dev_priv) >= 4) +#define HAS_GMBUS_BURST_READ(dev_priv) (INTEL_GEN(dev_priv) >= 10 || \ + IS_GEMINILAKE(dev_priv) || \ + IS_KABYLAKE(dev_priv)) /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte * rows, which changed the alignment requirements and fence programming. diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index ebdf7c9d816e..575d9495f3e2 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2996,6 +2996,7 @@ enum i915_power_well_id { #define GMBUS_RATE_400KHZ(2<<8) /* reserved on Pineview */ #define GMBUS_RATE_1MHZ (3<<8) /* reserved on Pineview */ #define GMBUS_HOLD_EXT (1<<7) /* 300ns hold time, rsvd on Pineview */ +#define GMBUS_BYTE_CNT_OVERRIDE (1<<6) #define GMBUS_PIN_DISABLED 0 #define GMBUS_PIN_SSC1 #define GMBUS_PIN_VGADDC 2 diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 1c0f6b56b209..9e1142a2f81b 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c @@ -371,12 +371,30 @@ unsigned int gmbus_max_xfer_size(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 gmbus0_reg, u32 gmbus1_index) { + unsigned int size = len; + bool burst_read = len > gmbus_max_xfer_size(dev_priv); + bool extra_byte_added = false; + + if (burst_read) { + + /* +* As per HW Spec, for 512Bytes need to read extra Byte and +* Ignore the extra byte read. +*/ + if (len == 512) { + extra_byte_added = true; + len++; + } + size = len % 256 + 256; + I915_WRITE_FW(GMBUS0, gmbus0_reg | GMBUS_BYTE_CNT_OVERRIDE); + } + 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) { @@ -389,17 +407,34 @@ gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv, val = I915_READ_FW(GMBUS3); do { + if (extra_byte_added && len == 1) + break; + *buf++ = val & 0xff; val >>= 8; } while (--len && ++loop < 4); + + if (burst_read && len == size - 4) + /* Reset the override bit */ + I915_WRITE_FW(GMBUS0, gmbus0_reg); } return 0; } +/* + * HW spec says that 512Bytes in Burst read need special treatment. + * But it doesn't talk about other multiple of 256Bytes. And couldn't locate + * an I2C slave, which supports such a lengthy burst read too for experiments. + * + * So until things get clarified on HW support, to avoid the burst read length + * in fold of 256Bytes except 512, max burst read length is fixed at 767Bytes. + */ +#define INTEL_GMBUS_BURST_READ_MAX_LEN 767U + static int gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg, - u32 gmbus1_index) + u32 gmbus0_reg, u32 gmbus1_index) { u8 *buf = msg->buf; unsigned int rx_size = msg->len; @@ -407,10 +442,13 @@ gmbus_xfer_read(struct drm_i915_private
[PATCH v4 32/41] drm/i915: Enable superior HDCP ver that is capable
Considering that HDCP2.2 is more secure than HDCP1.4, When a setup supports HDCP2.2 and HDCP1.4, HDCP2.2 will be enabled. v2: Included few optimization suggestions [Chris Wilson] Commit message is updated as per the rebased version. v3: No changes. v4: Extra comment added and Style issue fixed [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 77 +++ 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 5b14e3668bc5..f53b496073ea 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -27,6 +27,58 @@ static int _intel_hdcp2_disable(struct intel_connector *connector); static void intel_hdcp2_check_work(struct work_struct *work); static int intel_hdcp2_check_link(struct intel_connector *connector); static int intel_hdcp2_init(struct intel_connector *connector); +static +int intel_hdcp_read_valid_bksv(struct intel_digital_port *intel_dig_port, + const struct intel_hdcp_shim *shim, u8 *bksv); +static +struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector); + +static bool panel_supports_hdcp(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct intel_hdcp *hdcp = >hdcp; + bool capable = false; + u8 bksv[5]; + + if (hdcp->hdcp_shim) { + if (hdcp->hdcp_shim->hdcp_capable) { + hdcp->hdcp_shim->hdcp_capable(intel_dig_port, ); + } else { + if (!intel_hdcp_read_valid_bksv(intel_dig_port, + hdcp->hdcp_shim, bksv)) + capable = true; + } + } + + return capable; +} + +static inline +bool panel_supports_hdcp2(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct intel_hdcp *hdcp = >hdcp; + bool capable = false; + + /* Check the panel's hdcp2.2 compliance if platform supports it. */ + if (hdcp->hdcp2_supported) + hdcp->hdcp_shim->hdcp_2_2_capable(intel_dig_port, ); + + return capable; +} + +/* Is HDCP1.4 capable on Platform and Panel */ +static inline bool intel_hdcp_capable(struct intel_connector *connector) +{ + return (connector->hdcp.hdcp_shim && panel_supports_hdcp(connector)); +} + +/* Is HDCP2.2 capable on Platform and Panel */ +static inline bool intel_hdcp2_capable(struct intel_connector *connector) +{ + return (connector->hdcp.hdcp2_supported && + panel_supports_hdcp2(connector)); +} static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) @@ -803,20 +855,27 @@ int intel_hdcp_init(struct intel_connector *connector, int intel_hdcp_enable(struct intel_connector *connector) { struct intel_hdcp *hdcp = >hdcp; - int ret; + int ret = -EINVAL; if (!hdcp->hdcp_shim) return -ENOENT; mutex_lock(>hdcp_mutex); - ret = _intel_hdcp_enable(connector); - if (ret) - goto out; + /* +* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup +* is capable of HDCP2.2, it is preferred to use HDCP2.2. +*/ + if (intel_hdcp2_capable(connector)) + ret = _intel_hdcp2_enable(connector); + else if (intel_hdcp_capable(connector)) + ret = _intel_hdcp_enable(connector); + + if (!ret) { + hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; + schedule_work(>hdcp_prop_work); + } - hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(>hdcp_prop_work); -out: mutex_unlock(>hdcp_mutex); return ret; } @@ -833,10 +892,14 @@ int intel_hdcp_disable(struct intel_connector *connector) if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; + if (hdcp->hdcp2_supported) + _intel_hdcp2_disable(connector); + ret = _intel_hdcp_disable(connector); } mutex_unlock(>hdcp_mutex); + cancel_delayed_work_sync(>hdcp2_check_work); cancel_delayed_work_sync(>hdcp_check_work); return ret; } -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 34/41] drm/i915: hdcp_check_link only on CP_IRQ
HDCP check link is invoked only on CP_IRQ detection, instead of all short pulses. v3: No Changes. v4: Added sean in cc and collected the reviewed-by received. Signed-off-by: Ramalingam Ccc: Sean Paul Reviewed-by: Uma Shankar --- drivers/gpu/drm/i915/intel_dp.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 276eb49113e9..7287dc398afc 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -4454,8 +4454,10 @@ intel_dp_short_pulse(struct intel_dp *intel_dp) if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST) intel_dp_handle_test_request(intel_dp); - if (sink_irq_vector & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ)) - DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n"); + if (sink_irq_vector & DP_CP_IRQ) + intel_hdcp_check_link(intel_dp->attached_connector); + if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ) + DRM_DEBUG_DRIVER("Sink specific irq unhandled\n"); } /* defer to the hotplug work for link retraining if needed */ @@ -5425,9 +5427,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) handled = intel_dp_short_pulse(intel_dp); - /* Short pulse can signify loss of hdcp authentication */ - intel_hdcp_check_link(intel_dp->attached_connector); - if (!handled) { intel_dp->detect_done = false; goto put_power; -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v3 39/40] drm/i915: Add HDCP2.2 support for DP connectors
On Friday 18 May 2018 10:07 PM, Shankar, Uma wrote: -Original Message- From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of Ramalingam C Sent: Tuesday, April 3, 2018 7:28 PM To: intel-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; seanp...@chromium.org; dan...@ffwll.ch; ch...@chris-wilson.co.uk; jani.nik...@linux.intel.com; Winkler, Tomas; Usyskin, Alexander Cc: Vivi, Rodrigo Subject: [Intel-gfx] [PATCH v3 39/40] drm/i915: Add HDCP2.2 support for DP connectors On DP connector init, intel_hdcp_init is passed with a flag for hdcp2.2 support based on the platform capability. Looks ok to me. For me, hdcp2.2 capability should be added in dev_info. As we discussed, since from gen10 onwards all platforms expected to support hdcp2.2, having the hdcp2.2 support field in dev_info doesn't make much sense. With that fixed. Reviewed-by: Uma Shankar If you are ok with above explanation I will add your reviewed-by to the patch. Ram v2: Rebased. v3: No Changes. Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdcp.c | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index e5cb54ceda38..43318003ce14 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -6733,7 +6733,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, _dp_hdcp_shim, - false); + is_hdcp2_supported(dev_priv)); 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 37f9a0e2ea13..2bb562738964 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1941,6 +1941,7 @@ int intel_hdcp_enable(struct intel_connector *connector); int intel_hdcp_disable(struct intel_connector *connector); bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port); void intel_hdcp_handle_cp_irq(struct intel_connector *connector); +bool is_hdcp2_supported(struct drm_i915_private *dev_priv); /* intel_psr.c */ #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 9386b451191e..9d5cade3b236 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -1723,7 +1723,6 @@ static int mei_cldev_notify(struct notifier_block *nb, unsigned long event, return NOTIFY_OK; } -static inline bool is_hdcp2_supported(struct drm_i915_private *dev_priv) { return (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) || -- 2.7.4 ___ Intel-gfx mailing list intel-...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 2/2] drm/panel: Add device_link from panel device to drm device
On 21.05.2018 10:53, Peter Rosin wrote: > On 2018-05-21 10:15, Andrzej Hajda wrote: >> On 19.05.2018 18:48, Peter Rosin wrote: >>> On 2018-05-18 13:51, Andrzej Hajda wrote: On 26.04.2018 10:07, Jyri Sarha wrote: > Add device_link from panel device (supplier) to drm device (consumer) > when drm_panel_attach() is called. This patch should protect the > master drm driver if an attached panel driver unbinds while it is in > use. The device_link should make sure the drm device is unbound before > the panel driver becomes unavailable. > > The device_link is removed when drm_panel_detach() is called. The > drm_panel_detach() should be called by the consumer DRM driver, not the > panel driver, otherwise both drivers are racing to delete the same link. > > Signed-off-by: Jyri Sarha> Reviewed-by: Eric Anholt Hi Jyri, This patch breaks few platforms: tm2, tm2e, trats2 - ie all platforms using exynos_drm_dsi and dsi panels. Exynos-DSI properly handles panels unbind - ie references to panel are properly removed on panels removal and respective drm_connector enters disconnected state, without destroying whole drm device. And again on panel driver re-bind drm_panel is properly attached to exynos-dsi and panel pipeline is working again. This patch will break this behavior, ie it will destroy whole drm device. Making device_links for panels optional seems to me the best solution, what do you think? The funny thing is that due to bug in device link code, your patch has no effect on these platforms. So it does not hurt these platform yet, but the bug will be fixed sooner or later. >>> Ah, that's a pretty strong hint that we are doing something unusual. So, >>> I had a deeper look and I think that device-links (with state, i.e. not >>> DL_FLAG_STATELESS links) are assumed to be created by the .probe function >>> of either the consumer or the supplier. Then it seems to works as expected. >>> And that makes some sense too, because a link indicates that there exist >>> a dependency between the two and that the consumer cannot really exist >>> without the supplier. This is also what happens for the drm devices >>> (panel/bridge consumers) Jyri and I are working with; they call panel or >>> bridge attach during their probe. But this is not the case for exynos, >>> which calls panel/bridge attach at some later stage, and that obviously >>> violates the assumption that the device-link consumer cannot exist w/o >>> the supplier ("obviously" since the drm driver has managed to successfully >>> probe without the supplier). >>> >>> So, when the panel/bridge supplier is probed after the consumer is >>> bound, the link starts out as DL_STATE_DORMANT, and progresses to >>> DL_STATE_AVAILABLE once the panel/bridge has finished the probe. This is >>> not what *we* want. >> And this is also incorrect from Documentation PoV: >> * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present. >> * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer >> is not. >> >>> So, one idea I have is to, on panel/bridge attach, verify if the >>> consumer is in its probe, and only create the link if that is the >>> case. So, the link would be optional, but it would all be automatic. >> Making it automatic looks tempting, but also error prone. In case of >> component framework bind callbacks can be called from probe of any >> component, so sometimes it can be called also from exynos-dsi probe, >> sometimes not (depending on order of probing, which we cannot rely on). >> So in some cases we will end-up with links, sometimes without. Ie >> following scenarios are possible in drm_panel_attach: >> 1. exynos-dsi bound, panel during probe. >> 2. exynos-dsi during probe, panel during probe. > 2. exynos-dsi during probe, panel bound? Or is this case 3, and 2 happens > when drivers probe in parallel? Panel is always probed not earlier than the end of exynos-dsi bind, so only scenarios 1 and 2 should be possible. > Whichever, you are right, I naively thought that the bind happened > after the probe of all devices, but naturally it happens as part of > the last device to register its component, and that normally happens > during its probe. > > Sigh. So, scratch that, I guess we need a flag... > >>> The function device_is_bound seems like a good candidate for that >>> check? >>> >>> Maybe device_link_add should automatically create a DL_FLAG_STATELESS link >>> if either consumer or supplier has "proven" (with a successful probe) that >>> they can exist without the other end? That would also work for us, since >>> a DL_FLAG_STATELESS link does no harm in our case... >> What will be benefit of having stateless device_links, in case of >> panels/bridges? > To have device suspend/resume happen in a predictable order? But maybe that > has no value whatsoever? At the moment
Re: [PATCH v4 2/2] drm/panel: Add device_link from panel device to drm device
On 2018-05-21 10:15, Andrzej Hajda wrote: > On 19.05.2018 18:48, Peter Rosin wrote: >> On 2018-05-18 13:51, Andrzej Hajda wrote: >>> On 26.04.2018 10:07, Jyri Sarha wrote: Add device_link from panel device (supplier) to drm device (consumer) when drm_panel_attach() is called. This patch should protect the master drm driver if an attached panel driver unbinds while it is in use. The device_link should make sure the drm device is unbound before the panel driver becomes unavailable. The device_link is removed when drm_panel_detach() is called. The drm_panel_detach() should be called by the consumer DRM driver, not the panel driver, otherwise both drivers are racing to delete the same link. Signed-off-by: Jyri SarhaReviewed-by: Eric Anholt >>> Hi Jyri, >>> >>> This patch breaks few platforms: tm2, tm2e, trats2 - ie all platforms >>> using exynos_drm_dsi and dsi panels. >>> Exynos-DSI properly handles panels unbind - ie references to panel are >>> properly removed on panels removal and respective drm_connector enters >>> disconnected state, without destroying whole drm device. >>> And again on panel driver re-bind drm_panel is properly attached to >>> exynos-dsi and panel pipeline is working again. >>> This patch will break this behavior, ie it will destroy whole drm device. >>> >>> Making device_links for panels optional seems to me the best solution, >>> what do you think? >>> >>> The funny thing is that due to bug in device link code, your patch has >>> no effect on these platforms. So it does not hurt these platform yet, >>> but the bug will be fixed sooner or later. >> Ah, that's a pretty strong hint that we are doing something unusual. So, >> I had a deeper look and I think that device-links (with state, i.e. not >> DL_FLAG_STATELESS links) are assumed to be created by the .probe function >> of either the consumer or the supplier. Then it seems to works as expected. >> And that makes some sense too, because a link indicates that there exist >> a dependency between the two and that the consumer cannot really exist >> without the supplier. This is also what happens for the drm devices >> (panel/bridge consumers) Jyri and I are working with; they call panel or >> bridge attach during their probe. But this is not the case for exynos, >> which calls panel/bridge attach at some later stage, and that obviously >> violates the assumption that the device-link consumer cannot exist w/o >> the supplier ("obviously" since the drm driver has managed to successfully >> probe without the supplier). >> >> So, when the panel/bridge supplier is probed after the consumer is >> bound, the link starts out as DL_STATE_DORMANT, and progresses to >> DL_STATE_AVAILABLE once the panel/bridge has finished the probe. This is >> not what *we* want. > > And this is also incorrect from Documentation PoV: > * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present. > * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer > is not. > >> >> So, one idea I have is to, on panel/bridge attach, verify if the >> consumer is in its probe, and only create the link if that is the >> case. So, the link would be optional, but it would all be automatic. > > Making it automatic looks tempting, but also error prone. In case of > component framework bind callbacks can be called from probe of any > component, so sometimes it can be called also from exynos-dsi probe, > sometimes not (depending on order of probing, which we cannot rely on). > So in some cases we will end-up with links, sometimes without. Ie > following scenarios are possible in drm_panel_attach: > 1. exynos-dsi bound, panel during probe. > 2. exynos-dsi during probe, panel during probe. 2. exynos-dsi during probe, panel bound? Or is this case 3, and 2 happens when drivers probe in parallel? Whichever, you are right, I naively thought that the bind happened after the probe of all devices, but naturally it happens as part of the last device to register its component, and that normally happens during its probe. Sigh. So, scratch that, I guess we need a flag... > >> >> The function device_is_bound seems like a good candidate for that >> check? >> >> Maybe device_link_add should automatically create a DL_FLAG_STATELESS link >> if either consumer or supplier has "proven" (with a successful probe) that >> they can exist without the other end? That would also work for us, since >> a DL_FLAG_STATELESS link does no harm in our case... > > What will be benefit of having stateless device_links, in case of > panels/bridges? To have device suspend/resume happen in a predictable order? But maybe that has no value whatsoever? Cheers, Peter > Regards > Andrzej > > >> >> Cheers, >> Peter >> >>> The trick in case of exynos-dsi is to use mipi_dsi attach/detach >>> callbacks to get notifications about drm_panel's >>> appearance/disappearance, I guess ultimately such
[PATCH v6 4/5] phy: rockchip-typec: support variable phy config value
the phy config values used to fix in dp firmware, but some boards need change these values to do training and get the better eye diagram result. So support that in phy driver. Signed-off-by: Chris ZhongSigned-off-by: Lin Huang --- Changes in v2: - update patch following Enric suggest Changes in v3: - delete need_software_training variable - add default phy config value, if dts do not define phy config value, use these value Changes in v4: - rename variable config to tcphy_default_config Changes in v5: - None Changes in v6: - split the header file to new patch drivers/phy/rockchip/phy-rockchip-typec.c | 261 -- 1 file changed, 208 insertions(+), 53 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 795055f..4c4b925 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -324,21 +324,29 @@ * clock 0: PLL 0 div 1 * clock 1: PLL 1 div 2 */ -#define CLK_PLL_CONFIG 0X30 +#define CLK_PLL1_DIV1 0x20 +#define CLK_PLL1_DIV2 0x30 #define CLK_PLL_MASK 0x33 #define CMN_READY BIT(0) +#define DP_PLL_CLOCK_ENABLE_ACKBIT(3) #define DP_PLL_CLOCK_ENABLEBIT(2) +#define DP_PLL_ENABLE_ACK BIT(1) #define DP_PLL_ENABLE BIT(0) #define DP_PLL_DATA_RATE_RBR ((2 << 12) | (4 << 8)) #define DP_PLL_DATA_RATE_HBR ((2 << 12) | (4 << 8)) #define DP_PLL_DATA_RATE_HBR2 ((1 << 12) | (2 << 8)) +#define DP_PLL_DATA_RATE_MASK 0xff00 -#define DP_MODE_A0 BIT(4) -#define DP_MODE_A2 BIT(6) -#define DP_MODE_ENTER_A0 0xc101 -#define DP_MODE_ENTER_A2 0xc104 +#define DP_MODE_MASK 0xf +#define DP_MODE_ENTER_A0 BIT(0) +#define DP_MODE_ENTER_A2 BIT(2) +#define DP_MODE_ENTER_A3 BIT(3) +#define DP_MODE_A0_ACK BIT(4) +#define DP_MODE_A2_ACK BIT(6) +#define DP_MODE_A3_ACK BIT(7) +#define DP_LINK_RESET_DEASSERTED BIT(8) #define PHY_MODE_SET_TIMEOUT 10 @@ -350,6 +358,8 @@ #define MODE_DFP_USB BIT(1) #define MODE_DFP_DPBIT(2) +#define DP_DEFAULT_RATE162000 + struct phy_reg { u16 value; u32 addr; @@ -372,15 +382,15 @@ struct phy_reg usb3_pll_cfg[] = { { 0x8, CMN_DIAG_PLL0_LF_PROG }, }; -struct phy_reg dp_pll_cfg[] = { +struct phy_reg dp_pll_rbr_cfg[] = { { 0xf0, CMN_PLL1_VCOCAL_INIT }, { 0x18, CMN_PLL1_VCOCAL_ITER }, { 0x30b9, CMN_PLL1_VCOCAL_START }, - { 0x21c,CMN_PLL1_INTDIV }, + { 0x87, CMN_PLL1_INTDIV }, { 0,CMN_PLL1_FRACDIV }, - { 0x5, CMN_PLL1_HIGH_THR }, - { 0x35, CMN_PLL1_SS_CTRL1 }, - { 0x7f1e, CMN_PLL1_SS_CTRL2 }, + { 0x22, CMN_PLL1_HIGH_THR }, + { 0x8000, CMN_PLL1_SS_CTRL1 }, + { 0,CMN_PLL1_SS_CTRL2 }, { 0x20, CMN_PLL1_DSM_DIAG }, { 0,CMN_PLLSM1_USER_DEF_CTRL }, { 0,CMN_DIAG_PLL1_OVRD }, @@ -391,9 +401,52 @@ struct phy_reg dp_pll_cfg[] = { { 0x8, CMN_DIAG_PLL1_LF_PROG }, { 0x100,CMN_DIAG_PLL1_PTATIS_TUNE1 }, { 0x7, CMN_DIAG_PLL1_PTATIS_TUNE2 }, - { 0x4, CMN_DIAG_PLL1_INCLK_CTRL }, + { 0x1, CMN_DIAG_PLL1_INCLK_CTRL }, }; +struct phy_reg dp_pll_hbr_cfg[] = { + { 0xf0, CMN_PLL1_VCOCAL_INIT }, + { 0x18, CMN_PLL1_VCOCAL_ITER }, + { 0x30b4, CMN_PLL1_VCOCAL_START }, + { 0xe1, CMN_PLL1_INTDIV }, + { 0,CMN_PLL1_FRACDIV }, + { 0x5, CMN_PLL1_HIGH_THR }, + { 0x8000, CMN_PLL1_SS_CTRL1 }, + { 0,CMN_PLL1_SS_CTRL2 }, + { 0x20, CMN_PLL1_DSM_DIAG }, + { 0x1000, CMN_PLLSM1_USER_DEF_CTRL }, + { 0,CMN_DIAG_PLL1_OVRD }, + { 0,CMN_DIAG_PLL1_FBH_OVRD }, + { 0,CMN_DIAG_PLL1_FBL_OVRD }, + { 0x7, CMN_DIAG_PLL1_V2I_TUNE }, + { 0x45, CMN_DIAG_PLL1_CP_TUNE }, + { 0x8, CMN_DIAG_PLL1_LF_PROG }, + { 0x1, CMN_DIAG_PLL1_PTATIS_TUNE1 }, + { 0x1, CMN_DIAG_PLL1_PTATIS_TUNE2 }, + { 0x1, CMN_DIAG_PLL1_INCLK_CTRL }, +}; + +struct phy_reg dp_pll_hbr2_cfg[] = { + { 0xf0, CMN_PLL1_VCOCAL_INIT }, + { 0x18, CMN_PLL1_VCOCAL_ITER }, + { 0x30b4, CMN_PLL1_VCOCAL_START }, + { 0xe1, CMN_PLL1_INTDIV }, + { 0,CMN_PLL1_FRACDIV }, + { 0x5,
[PATCH v6 2/5] Documentation: dt-bindings: phy: add phy_config for Rockchip USB Type-C PHY
If want to do training outside DP Firmware, need phy voltage swing and pre_emphasis value. Signed-off-by: Lin Huang--- Changes in v2: - None Changes in v3: - modify property description and add this property to Example Changes in v4: - None Changes in v5: - None Changes in v6: - change rockchip,phy_config to rockchip,phy-config and descript it in detail. .../devicetree/bindings/phy/phy-rockchip-typec.txt | 36 +- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt index 960da7f..40d5e7a 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt @@ -17,7 +17,11 @@ Required properties: Optional properties: - extcon : extcon specifier for the Power Delivery - + - rockchip,phy-config : A list of voltage swing(mV) and pre-emphasis + (dB) pairs. They are 3 blocks of 4 entries and + correspond to s0p0 ~ s0p3, s1p0 ~ s1p3, + s2p0 ~ s2p3, s3p0 ~ s2p3 swing and pre-emphasis + values. Required nodes : a sub-node is required for each port the phy provides. The sub-node name is used to identify dp or usb3 port, and shall be the following entries: @@ -50,6 +54,21 @@ Example: < SRST_P_UPHY0_TCPHY>; reset-names = "uphy", "uphy-pipe", "uphy-tcphy"; + rockchip,phy-config = <0x2a 0x00>, + <0x1f 0x15>, + <0x14 0x22>, + <0x02 0x2b>, + + <0x21 0x00>, + <0x12 0x15>, + <0x02 0x22>, + <0 0>, + + <0x15 0x00>, + <0x00 0x15>, + <0 0>, + <0 0>; + tcphy0_dp: dp-port { #phy-cells = <0>; }; @@ -74,6 +93,21 @@ Example: < SRST_P_UPHY1_TCPHY>; reset-names = "uphy", "uphy-pipe", "uphy-tcphy"; + rockchip,phy-config = <0x2a 0x00>, + <0x1f 0x15>, + <0x14 0x22>, + <0x02 0x2b>, + + <0x21 0x00>, + <0x12 0x15>, + <0x02 0x22>, + <0 0>, + + <0x15 0x00>, + <0x00 0x15>, + <0 0>, + <0 0>; + tcphy1_dp: dp-port { #phy-cells = <0>; }; -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v6 3/5] soc: rockchip: split rockchip_typec_phy struct to separate header
we may use rockchip_phy_typec struct in other driver, so split it to separate header. Signed-off-by: Lin Huang--- Changes in v2: - None Changes in v3: - None Changes in v4: - None Changes in v5: - None Changes in v6: - new patch here drivers/phy/rockchip/phy-rockchip-typec.c | 47 +-- include/soc/rockchip/rockchip_phy_typec.h | 63 +++ 2 files changed, 64 insertions(+), 46 deletions(-) create mode 100644 include/soc/rockchip/rockchip_phy_typec.h diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 76a4b58..795055f 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -63,6 +63,7 @@ #include #include +#include #define CMN_SSM_BANDGAP(0x21 << 2) #define CMN_SSM_BIAS (0x22 << 2) @@ -349,52 +350,6 @@ #define MODE_DFP_USB BIT(1) #define MODE_DFP_DPBIT(2) -struct usb3phy_reg { - u32 offset; - u32 enable_bit; - u32 write_enable; -}; - -/** - * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. - * @reg: the base address for usb3-phy config. - * @typec_conn_dir: the register of type-c connector direction. - * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. - * @external_psm: the register of type-c phy external psm clock. - * @pipe_status: the register of type-c phy pipe status. - * @usb3_host_disable: the register of type-c usb3 host disable. - * @usb3_host_port: the register of type-c usb3 host port. - * @uphy_dp_sel: the register of type-c phy DP select control. - */ -struct rockchip_usb3phy_port_cfg { - unsigned int reg; - struct usb3phy_reg typec_conn_dir; - struct usb3phy_reg usb3tousb2_en; - struct usb3phy_reg external_psm; - struct usb3phy_reg pipe_status; - struct usb3phy_reg usb3_host_disable; - struct usb3phy_reg usb3_host_port; - struct usb3phy_reg uphy_dp_sel; -}; - -struct rockchip_typec_phy { - struct device *dev; - void __iomem *base; - struct extcon_dev *extcon; - struct regmap *grf_regs; - struct clk *clk_core; - struct clk *clk_ref; - struct reset_control *uphy_rst; - struct reset_control *pipe_rst; - struct reset_control *tcphy_rst; - const struct rockchip_usb3phy_port_cfg *port_cfgs; - /* mutex to protect access to individual PHYs */ - struct mutex lock; - - bool flip; - u8 mode; -}; - struct phy_reg { u16 value; u32 addr; diff --git a/include/soc/rockchip/rockchip_phy_typec.h b/include/soc/rockchip/rockchip_phy_typec.h new file mode 100644 index 000..be6af0e --- /dev/null +++ b/include/soc/rockchip/rockchip_phy_typec.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd + * Author: Lin Huang + */ + +#ifndef __SOC_ROCKCHIP_PHY_TYPEC_H +#define __SOC_ROCKCHIP_PHY_TYPEC_H + +struct usb3phy_reg { + u32 offset; + u32 enable_bit; + u32 write_enable; +}; + +/** + * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. + * @reg: the base address for usb3-phy config. + * @typec_conn_dir: the register of type-c connector direction. + * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. + * @external_psm: the register of type-c phy external psm clock. + * @pipe_status: the register of type-c phy pipe status. + * @usb3_host_disable: the register of type-c usb3 host disable. + * @usb3_host_port: the register of type-c usb3 host port. + * @uphy_dp_sel: the register of type-c phy DP select control. + */ +struct rockchip_usb3phy_port_cfg { + unsigned int reg; + struct usb3phy_reg typec_conn_dir; + struct usb3phy_reg usb3tousb2_en; + struct usb3phy_reg external_psm; + struct usb3phy_reg pipe_status; + struct usb3phy_reg usb3_host_disable; + struct usb3phy_reg usb3_host_port; + struct usb3phy_reg uphy_dp_sel; +}; + +struct phy_config { + int swing; + int pe; +}; + +struct rockchip_typec_phy { + struct device *dev; + void __iomem *base; + struct extcon_dev *extcon; + struct regmap *grf_regs; + struct clk *clk_core; + struct clk *clk_ref; + struct reset_control *uphy_rst; + struct reset_control *pipe_rst; + struct reset_control *tcphy_rst; + const struct rockchip_usb3phy_port_cfg *port_cfgs; + /* mutex to protect access to individual PHYs */ + struct mutex lock; + struct phy_config config[3][4]; + bool flip; + u8 mode; + int (*typec_phy_config)(struct phy *phy, int link_rate, + int lanes, u8 swing, u8 pre_emp); +}; + +#endif -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org
[PATCH 22/33] drm/i915: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Jani NikulaCc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: David Airlie Cc: intel-...@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Yisheng Xie --- drivers/gpu/drm/i915/intel_pipe_crc.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c index 1f5cd57..f6b1335 100644 --- a/drivers/gpu/drm/i915/intel_pipe_crc.c +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c @@ -764,13 +764,12 @@ enum intel_pipe_crc_object { { int i; - for (i = 0; i < ARRAY_SIZE(pipe_crc_objects); i++) - if (!strcmp(buf, pipe_crc_objects[i])) { - *o = i; - return 0; - } + i = match_string(pipe_crc_objects, ARRAY_SIZE(pipe_crc_objects), buf); + if (i < 0) + return -EINVAL; - return -EINVAL; + *o = i; + return 0; } static int display_crc_ctl_parse_pipe(struct drm_i915_private *dev_priv, @@ -796,13 +795,12 @@ static int display_crc_ctl_parse_pipe(struct drm_i915_private *dev_priv, return 0; } - for (i = 0; i < ARRAY_SIZE(pipe_crc_sources); i++) - if (!strcmp(buf, pipe_crc_sources[i])) { - *s = i; - return 0; - } + i = match_string(pipe_crc_sources, ARRAY_SIZE(pipe_crc_sources), buf); + if (i < 0) + return -EINVAL; - return -EINVAL; + *s = i; + return 0; } static int display_crc_ctl_parse(struct drm_i915_private *dev_priv, -- 1.7.12.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 23/33] drm: i2c: ch7006: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: David AirlieCc: Yisheng Xie Cc: Daniel Vetter Cc: Arvind Yadav Cc: dri-devel@lists.freedesktop.org Signed-off-by: Yisheng Xie --- drivers/gpu/drm/i2c/ch7006_drv.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index 544a8a2..405c7fb 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c @@ -464,14 +464,11 @@ static int ch7006_encoder_init(struct i2c_client *client, priv->chip_version = ch7006_read(client, CH7006_VERSION_ID); if (ch7006_tv_norm) { - for (i = 0; i < NUM_TV_NORMS; i++) { - if (!strcmp(ch7006_tv_norm_names[i], ch7006_tv_norm)) { - priv->norm = i; - break; - } - } - - if (i == NUM_TV_NORMS) + i = match_string(ch7006_tv_norm_names, +NUM_TV_NORMS, ch7006_tv_norm); + if (i >= 0) + priv->norm = i; + else ch7006_err(client, "Invalid TV norm setting \"%s\".\n", ch7006_tv_norm); } -- 1.7.12.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v3 11/40] misc/mei/hdcp: Store the HDCP Pairing info
Thanks Jani. I will use free form comments in v4, meanwhile i will explore the required stuff for kernel-doc and add kernel-doc entries where ever it makes sense, in upcoming versions. --Ram On Thursday 17 May 2018 01:47 PM, Jani Nikula wrote: On Thu, 17 May 2018, "C, Ramalingam"wrote: +/** Drop the extra *, unless you really love it :) ha ha. Actually I have added intentionally. But removing them across all patches as per your suggestions. :) /** is a syntax for KDoc, so if you want to receive automatic code documentation you should use it and adhere to KDoc syntax Thanks Alexander for the information. At present I am not adding the KDoc support, if it is not compulsory. So I will remove the /**. It's "kernel-doc" to be pedantic. No such thing as KDoc. If you use /** please stick to the exact kernel-doc format. The below is not. You'll find the documentation under Documentation/doc-guide. If you drop /** please either use free form comments or stick to the kernel-doc format. Please don't leave behind things that look eerily similar to kernel-doc comments but are not. Without /** you won't even get warnings about them. /** * mei_store_pairing_info - Store pairing info received from panel * @cldev: Pointer for mei client device * @data: Intel HW specific Data * @pairing_info: Pointer for AKE_Send_Pairing_Info * * Returns 0 on success, <0 on failure. */ BR, Jani. --Ram + * mei_store_pairing_info: + * Function to store pairing info received from panel + * + * @cldev : Pointer for mei client device + * @data : Intel HW specific Data + * @pairing_info : Pointer for AKE_Send_Pairing_Info + * + * Returns 0 on Success, <0 on Failure */ ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 21/33] drm/nouveau: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Ben SkeggsCc: David Airlie Cc: dri-devel@lists.freedesktop.org Cc: nouv...@lists.freedesktop.org Signed-off-by: Yisheng Xie --- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c index 6d99f11..a6b4c4a 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c @@ -644,14 +644,11 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder, int i; if (nouveau_tv_norm) { - for (i = 0; i < num_tv_norms; i++) { - if (!strcmp(nv17_tv_norm_names[i], nouveau_tv_norm)) { - tv_enc->tv_norm = i; - break; - } - } - - if (i == num_tv_norms) + i = match_string(nv17_tv_norm_names, +num_tv_norms, nouveau_tv_norm); + if (i >= 0) + tv_enc->tv_norm = i; + else NV_WARN(drm, "Invalid TV norm setting \"%s\"\n", nouveau_tv_norm); } -- 1.7.12.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm] xf86drm: Be sure to closedir before return
On Friday, 2018-05-18 12:48:17 -0700, Kevin Strasser wrote: > removed in commit bb45ce4e3ac751315bfd7fbfd9e1425bf515ec0d > > Adding it back as it is still needed in the case where we don't find a > match. > > Signed-off-by: Kevin StrasserGood catch, thanks! Fixes: bb45ce4e3ac751315bfd "libdrm: Use readdir instead of readdir_r to avoid build warnings" Reviewed-by: Eric Engestrom ... and pushed :) > --- > xf86drm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/xf86drm.c b/xf86drm.c > index 3a9d0ed..056dfa4 100644 > --- a/xf86drm.c > +++ b/xf86drm.c > @@ -2855,6 +2855,8 @@ static char *drmGetMinorNameForFD(int fd, int type) > return strdup(dev_name); > } > } > + > +closedir(sysdir); > return NULL; > #else > struct stat sbuf; > -- > 2.7.4 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v6 3/5] soc: rockchip: split rockchip_typec_phy struct to separate header
Hi Lin, 2018-05-21 11:37 GMT+02:00 Lin Huang: > we may use rockchip_phy_typec struct in other driver, so split > it to separate header. > That patch does more than just split some structs to a public header, it also introduces new structs and new parameters related to the phy_config feature. IMHO you should first move the current structs and introduce the new phy_config stuff in the following patch (4/5). I am not sure about the maintainer preferences, but at least, if the maintainer is fine like is now, I'd explain that you introduce new elements in the commit message. Best regards, Enric > Signed-off-by: Lin Huang > --- > Changes in v2: > - None > Changes in v3: > - None > Changes in v4: > - None > Changes in v5: > - None > Changes in v6: > - new patch here > > drivers/phy/rockchip/phy-rockchip-typec.c | 47 +-- > include/soc/rockchip/rockchip_phy_typec.h | 63 > +++ > 2 files changed, 64 insertions(+), 46 deletions(-) > create mode 100644 include/soc/rockchip/rockchip_phy_typec.h > > diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c > b/drivers/phy/rockchip/phy-rockchip-typec.c > index 76a4b58..795055f 100644 > --- a/drivers/phy/rockchip/phy-rockchip-typec.c > +++ b/drivers/phy/rockchip/phy-rockchip-typec.c > @@ -63,6 +63,7 @@ > > #include > #include > +#include > > #define CMN_SSM_BANDGAP(0x21 << 2) > #define CMN_SSM_BIAS (0x22 << 2) > @@ -349,52 +350,6 @@ > #define MODE_DFP_USB BIT(1) > #define MODE_DFP_DPBIT(2) > > -struct usb3phy_reg { > - u32 offset; > - u32 enable_bit; > - u32 write_enable; > -}; > - > -/** > - * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. > - * @reg: the base address for usb3-phy config. > - * @typec_conn_dir: the register of type-c connector direction. > - * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. > - * @external_psm: the register of type-c phy external psm clock. > - * @pipe_status: the register of type-c phy pipe status. > - * @usb3_host_disable: the register of type-c usb3 host disable. > - * @usb3_host_port: the register of type-c usb3 host port. > - * @uphy_dp_sel: the register of type-c phy DP select control. > - */ > -struct rockchip_usb3phy_port_cfg { > - unsigned int reg; > - struct usb3phy_reg typec_conn_dir; > - struct usb3phy_reg usb3tousb2_en; > - struct usb3phy_reg external_psm; > - struct usb3phy_reg pipe_status; > - struct usb3phy_reg usb3_host_disable; > - struct usb3phy_reg usb3_host_port; > - struct usb3phy_reg uphy_dp_sel; > -}; > - > -struct rockchip_typec_phy { > - struct device *dev; > - void __iomem *base; > - struct extcon_dev *extcon; > - struct regmap *grf_regs; > - struct clk *clk_core; > - struct clk *clk_ref; > - struct reset_control *uphy_rst; > - struct reset_control *pipe_rst; > - struct reset_control *tcphy_rst; > - const struct rockchip_usb3phy_port_cfg *port_cfgs; > - /* mutex to protect access to individual PHYs */ > - struct mutex lock; > - > - bool flip; > - u8 mode; > -}; > - > struct phy_reg { > u16 value; > u32 addr; > diff --git a/include/soc/rockchip/rockchip_phy_typec.h > b/include/soc/rockchip/rockchip_phy_typec.h > new file mode 100644 > index 000..be6af0e > --- /dev/null > +++ b/include/soc/rockchip/rockchip_phy_typec.h > @@ -0,0 +1,63 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd > + * Author: Lin Huang > + */ > + > +#ifndef __SOC_ROCKCHIP_PHY_TYPEC_H > +#define __SOC_ROCKCHIP_PHY_TYPEC_H > + > +struct usb3phy_reg { > + u32 offset; > + u32 enable_bit; > + u32 write_enable; > +}; > + > +/** > + * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. > + * @reg: the base address for usb3-phy config. > + * @typec_conn_dir: the register of type-c connector direction. > + * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. > + * @external_psm: the register of type-c phy external psm clock. > + * @pipe_status: the register of type-c phy pipe status. > + * @usb3_host_disable: the register of type-c usb3 host disable. > + * @usb3_host_port: the register of type-c usb3 host port. > + * @uphy_dp_sel: the register of type-c phy DP select control. > + */ > +struct rockchip_usb3phy_port_cfg { > + unsigned int reg; > + struct usb3phy_reg typec_conn_dir; > + struct usb3phy_reg usb3tousb2_en; > + struct usb3phy_reg external_psm; > + struct usb3phy_reg pipe_status; > + struct usb3phy_reg usb3_host_disable; > + struct usb3phy_reg usb3_host_port; > + struct usb3phy_reg uphy_dp_sel; > +}; > + > +struct phy_config { > + int swing; > + int pe; > +}; > + > +struct
[Bug 106589] HP w2207 monitor not waking from sleep
https://bugs.freedesktop.org/show_bug.cgi?id=106589 --- Comment #4 from Sylvain BERTRAND--- I have a similar pb: once my monitor (iiyama g-master) gets into DPMS off mode from the xserver, _often_ (it does work sometimes) the monitor video mode won't be re-programmed and will display "no signal" (displayport whatever the refresh rate). But I can blindly type on the keyboard to reboot the computer when it happens. I am not really investigating since my monitor going in dpms off is quite rare in my computer usage. Just giving the info that there is maybe a lil pb here related to this bug. AMD TAHITI XT xserver: git mesa: git xf86-video-amdgpu: git linux amdgpu: amd-staging-next (I did update with git source code yesterday and performed no test yet on this matter with the new code). Nothing abnormal was reported in the logs (if you really want them, I'll reproduce the pb). -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 199781] New: nouveau: cannot boot without nouveau.modeset=0 and cannot use HDMI output
https://bugzilla.kernel.org/show_bug.cgi?id=199781 Bug ID: 199781 Summary: nouveau: cannot boot without nouveau.modeset=0 and cannot use HDMI output Product: Drivers Version: 2.5 Kernel Version: 4.16.x Hardware: x86-64 OS: Linux Tree: Mainline Status: NEW Severity: blocking Priority: P1 Component: Video(DRI - non Intel) Assignee: drivers_video-...@kernel-bugs.osdl.org Reporter: frederic.epi...@orange.fr Regression: No Created attachment 276083 --> https://bugzilla.kernel.org/attachment.cgi?id=276083=edit dmesg log of kernel entries Hi, I'm currently having an issue while trying to use my discrete card GTX1050TI on my laptop Acer Predator PH317-51 under QubesOS with any kernel (e.g. 4.14+ and 4.16+, the current one is 4.16.9). In order to boot, I have to set nouveau.modeset=0 but I cannot use my HDMI output because it is not detected and it seems that the HDMI port is wired to the NVIDIA card. If I remove this option in the grub conf, and I plug my second screen on the HDMI port, at the boot process, I'm having error such as (full dmesg log is attached): May 21 11:33:01 dom0 kernel: [ cut here ] May 21 11:33:01 dom0 kernel: nouveau :01:00.0: timeout May 21 11:33:01 dom0 kernel: WARNING: CPU: 2 PID: 77 at /home/user/rpmbuild/BUILD/kernel-latest-4.16.9/linux-4.16.9/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c:43 nv50_sor_power_wait+0x8b/0xa0 [nouveau] May 21 11:33:01 dom0 kernel: Modules linked in: loop ebtable_filter ebtables ip6table_filter ip6_tables snd_hda_codec_hdmi joydev dcdbas dell_wmi_descriptor uvcvideo ath10k_pci btusb videobuf2_vmalloc btrtl iTCO_wdt videobuf2_memops btbcm iTCO_vendor_support videobuf2_v4l2 hid_multitouch btintel ath10k_core snd_hda_codec_realtek snd_hda_codec_generic videobuf2_common bluetooth videodev mac80211 media snd_hda_intel ecdh_generic ath intel_rapl snd_hda_codec x86_pkg_temp_thermal intel_powerclamp snd_hda_core coretemp snd_hwdep snd_seq snd_seq_device intel_rapl_perf snd_pcm rtsx_pci_ms pcspkr cfg80211 acer_wmi snd_timer sparse_keymap wmi_bmof intel_wmi_thunderbolt memstick idma64 i2c_i801 r8169 rfkill mii mei_me snd intel_lpss_pci tpm_crb tpm_tis mei intel_pch_thermal intel_lpss soundcore tpm_tis_core pinctrl_sunrisepoint May 21 11:33:01 dom0 kernel: pinctrl_intel tpm xenfs dm_thin_pool dm_persistent_data libcrc32c dm_bio_prison dm_crypt rtsx_pci_sdmmc mmc_core crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel nouveau i915 nvme mxm_wmi ttm i2c_algo_bit serio_raw drm_kms_helper nvme_core rtsx_pci xhci_pci drm xhci_hcd i2c_hid wmi video xen_acpi_processor xen_privcmd xen_pciback xen_blkback xen_gntalloc xen_gntdev xen_evtchn uinput May 21 11:33:01 dom0 kernel: CPU: 2 PID: 77 Comm: kworker/2:1 Tainted: G U W4.16.9-1.pvops.qubes.x86_64 #1 May 21 11:33:01 dom0 kernel: Hardware name: Acer Predator PH317-51/Sienna_KLS, BIOS V1.13 12/26/2017 May 21 11:33:01 dom0 kernel: Workqueue: pm pm_runtime_work May 21 11:33:01 dom0 kernel: RIP: e030:nv50_sor_power_wait+0x8b/0xa0 [nouveau] May 21 11:33:01 dom0 kernel: RSP: e02b:c9000188fb90 EFLAGS: 00010282 May 21 11:33:01 dom0 kernel: RAX: RBX: 880180e8fa60 RCX: May 21 11:33:01 dom0 kernel: RDX: 88018629cd00 RSI: 880186296938 RDI: 880186296938 May 21 11:33:01 dom0 kernel: RBP: 88017bf30c00 R08: R09: 07da May 21 11:33:01 dom0 kernel: R10: ea0005fa6cc0 R11: 0001 R12: 880179fb3d20 May 21 11:33:01 dom0 kernel: R13: 0061d804 R14: 0012119b61c0 R15: May 21 11:33:01 dom0 kernel: FS: () GS:88018628() knlGS: May 21 11:33:01 dom0 kernel: CS: e033 DS: ES: CR0: 80050033 May 21 11:33:01 dom0 kernel: CR2: 5c557ebab0d8 CR3: 00017cae2000 CR4: 00042660 May 21 11:33:01 dom0 kernel: Call Trace: May 21 11:33:01 dom0 kernel: nv50_sor_power+0x50/0x120 [nouveau] May 21 11:33:01 dom0 kernel: nv50_disp_root_init_+0x63/0x80 [nouveau] May 21 11:33:01 dom0 kernel: nvkm_oproxy_init+0x3c/0x60 [nouveau] May 21 11:33:01 dom0 kernel: nvkm_object_init+0x3e/0x190 [nouveau] May 21 11:33:01 dom0 kernel: nvkm_object_init+0xb1/0x190 [nouveau] May 21 11:33:01 dom0 kernel: nvkm_object_init+0xb1/0x190 [nouveau] May 21 11:33:01 dom0 kernel: nvkm_object_fini+0xa2/0x230 [nouveau] May 21 11:33:01 dom0 kernel: ? pci_pm_runtime_resume+0xa0/0xa0 May 21 11:33:01 dom0 kernel: nouveau_do_suspend+0x199/0x2b0 [nouveau] May 21 11:33:01 dom0 kernel: nouveau_pmops_runtime_suspend+0x54/0xb0 [nouveau] May 21 11:33:01 dom0 kernel: pci_pm_runtime_suspend+0x57/0x160 May 21 11:33:01 dom0 kernel: ? pci_pm_runtime_resume+0xa0/0xa0 May 21 11:33:01 dom0 kernel: __rpm_callback+0xc7/0x200 May 21 11:33:01 dom0 kernel: rpm_callback+0x1f/0x70 May 21
[Bug 106548] Failed GfxDrv_DriverAcceptanceQuery.GL_GPU_FREQ_OVERRIDE_MDAPI
https://bugs.freedesktop.org/show_bug.cgi?id=106548 Francesco Balestrierichanged: What|Removed |Added Priority|medium |high -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 05/41] misc/mei/hdcp: Notifier chain for mei cldev state change
Notifier Chain is defined to inform all its clients about the mei client device state change. Routine is defined for the clients to register and unregister for the notification on state change. v2: Rebased. v3: Notifier chain is adopted for cldev state update [Tomas] v4: Made static dummy functions as inline in mei_hdcp.h API for polling client device status IS_ENABLED used in header, for config status for mei_hdcp. Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 46 -- include/linux/mei_hdcp.h | 53 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 include/linux/mei_hdcp.h diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 4cd6fdd01181..0b4e85511a25 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -31,6 +31,42 @@ #include #include #include +#include +#include + +static struct mei_cl_device *mei_cldev; +static BLOCKING_NOTIFIER_HEAD(mei_cldev_notifier_list); + +static void +mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) +{ + if (enabled) + blocking_notifier_call_chain(_cldev_notifier_list, +MEI_CLDEV_ENABLED, cldev); + else + blocking_notifier_call_chain(_cldev_notifier_list, +MEI_CLDEV_DISABLED, NULL); +} + +int mei_cldev_register_notify(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(_cldev_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(mei_cldev_register_notify); + +int mei_cldev_unregister_notify(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(_cldev_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(mei_cldev_unregister_notify); + +int mei_cldev_poll_notification(void) +{ + if (mei_cldev) + mei_cldev_state_notify_clients(mei_cldev, true); + return 0; +} +EXPORT_SYMBOL_GPL(mei_cldev_poll_notification); static int mei_hdcp_probe(struct mei_cl_device *cldev, const struct mei_cl_device_id *id) @@ -38,14 +74,20 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, int ret; ret = mei_cldev_enable(cldev); - if (ret < 0) + if (ret < 0) { dev_err(>dev, "mei_cldev_enable Failed. %d\n", ret); + return ret; + } - return ret; + mei_cldev = cldev; + mei_cldev_state_notify_clients(cldev, true); + return 0; } static int mei_hdcp_remove(struct mei_cl_device *cldev) { + mei_cldev = NULL; + mei_cldev_state_notify_clients(cldev, false); mei_cldev_set_drvdata(cldev, NULL); return mei_cldev_disable(cldev); } diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h new file mode 100644 index ..9c8f140f5344 --- /dev/null +++ b/include/linux/mei_hdcp.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* + * Copyright © 2017-2018 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. + * + * Authors: + * Ramalingam C + */ + +#ifndef _LINUX_MEI_HDCP_H +#define _LINUX_MEI_HDCP_H + +enum mei_cldev_state { + MEI_CLDEV_DISABLED, + MEI_CLDEV_ENABLED +}; + +#if IS_ENABLED(CONFIG_INTEL_MEI_HDCP) +int mei_cldev_register_notify(struct notifier_block *nb); +int mei_cldev_unregister_notify(struct notifier_block *nb); +int mei_cldev_poll_notification(void); +#else +static inline int mei_cldev_register_notify(struct notifier_block *nb) +{ + return -ENODEV; +} +static inline int mei_cldev_unregister_notify(struct notifier_block *nb) +{ + return -ENODEV; +} +static inline int mei_cldev_poll_notification(void) +{ +
[PATCH v4 03/41] mei: bus: whitelist hdcp client
From: Tomas WinklerWhitelist HDCP client for in kernel drm use v2: Rebased. v3: No changes. v4: No changes. Signed-off-by: Tomas Winkler --- 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(>dev, "running hook %s\n", __func__); + + cldev->do_match = 1; +} + #define OSTYPE_LINUX2 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 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 06/41] misc/mei/hdcp: Define ME FW interface for HDCP2.2
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. v2: Rebased. v3: Extra comments are removed. v4: %s/\/\*\*/\/\* Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.h | 415 +++ 1 file changed, 415 insertions(+) create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.h diff --git a/drivers/misc/mei/hdcp/mei_hdcp.h b/drivers/misc/mei/hdcp/mei_hdcp.h new file mode 100644 index ..99e294a595f3 --- /dev/null +++ b/drivers/misc/mei/hdcp/mei_hdcp.h @@ -0,0 +1,415 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* + * Copyright © 2017-2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Ramalingam C + */ + +#ifndef __MEI_HDCP_H__ +#define __MEI_HDCP_H__ + +#include + +/* + * me_hdcp_status: Enumeration of all HDCP Status Codes + */ +enum me_hdcp_status { + ME_HDCP_STATUS_SUCCESS = 0x, + + /* 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 =
[PATCH v4 00/41] drm/i915: Implement HDCP2.2
The sequence for HDCP2.2 authentication and encryption is implemented in I915. Encoder specific implementations are moved into hdcp_shim. Intel HWs supports HDCP2.2 through ME FW. Hence this series introduces a client driver for mei bus, so that for HDCP2.2 authentication, HDCP2.2 stack in I915 can avail the services from ME FW. DRM_I915 selects INTEL_MEI_HDCP, which selects INTEL_MEI_ME and INTEL_MEI. If we are interested in disabling the MEI_HDCP and MEI Bus then we need an option to disable the HDCP2.2 in I915 (like DRM_I915_HDCP2.2!?). Till then they are binded. Userspace interface remains unchanged as version agnostic. When userspace request for HDCP enable, Kernel will detect the HDCP source and sink's HDCP version(1.4/2.2)capability and enable the best capable version for that combination. This series enables the HDCP2.2 for Type0 content streams. Thanks a lot for Usyskin, Alexander and Uma shankar for the review of v3. Thanks Daniel vetter for guiding me to test and confirm that there is no locking issue with respect to notifier usage between I915 and MEI_HDCP. Major Changes in v4: - GMBus Changes to implement the burst read as generic [Jani, Ville and Daniel] - Polling is added for extra Notifier notification when I915 and MEI_HDCP are modules. - Comment and style issues and typos are fixed [Uma and Alexander] - INTEL_MEI_HDCP, INTEL_MEI_ME and INTEL_MEI are selected by I915. - Fixed the #if in include/linux/mei_hdcp.h for build issues. GMBus changes are added here for completeness of the series. They are in review at https://patchwork.freedesktop.org/series/41632/ also. Ramalingam C (40): drm: hdcp2.2 authentication msg definitions drm: HDMI and DP specific HDCP2.2 defines misc/mei/hdcp: Client driver for HDCP application misc/mei/hdcp: Notifier chain for mei cldev state change misc/mei/hdcp: Define ME FW interface for HDCP2.2 linux/mei: Header for mei_hdcp driver interface misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session misc/mei/hdcp: Verify Receiver Cert and prepare km misc/mei/hdcp: Verify H_prime misc/mei/hdcp: Store the HDCP Pairing info misc/mei/hdcp: Initiate Locality check misc/mei/hdcp: Verify L_prime misc/mei/hdcp: Prepare Session Key misc/mei/hdcp: Repeater topology verification and ack misc/mei/hdcp: Verify M_prime misc/mei/hdcp: Enabling the HDCP authentication misc/mei/hdcp: Closing wired HDCP2.2 Tx Session drm/i915: wrapping all hdcp var into intel_hdcp drm/i915: Define HDCP2.2 related variables drm/i915: Define Intel HDCP2.2 registers drm/i915: Wrappers for mei HDCP2.2 services drm/i915: Implement HDCP2.2 receiver authentication drm/i915: Implement HDCP2.2 repeater authentication drm/i915: Enable and Disable HDCP2.2 port encryption drm/i915: Implement HDCP2.2 En/Dis-able drm/i915: Implement HDCP2.2 link integrity check drm/i915: Handle HDCP2.2 downstream topology change drm/i915: Pullout the bksv read and validation drm/i915: Initialize HDCP2.2 and its MEI interface drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable drm/i915: Enable superior HDCP ver that is capable drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure drm/i915: hdcp_check_link only on CP_IRQ drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ drm/i915/gmbus: Increase the Bytes per Rd/Wr Op drm/i915/gmbus: Enable burst read drm/i915: Implement the HDCP2.2 support for DP drm/i915: Implement the HDCP2.2 support for HDMI drm/i915: Add HDCP2.2 support for DP connectors drm/i915: Add HDCP2.2 support for HDMI connectors Tomas Winkler (1): mei: bus: whitelist hdcp client drivers/gpu/drm/i915/Kconfig |1 + drivers/gpu/drm/i915/i915_drv.h |3 + drivers/gpu/drm/i915/i915_reg.h | 34 ++ drivers/gpu/drm/i915/intel_display.c |7 +- drivers/gpu/drm/i915/intel_dp.c | 370 +++- drivers/gpu/drm/i915/intel_drv.h | 88 ++- drivers/gpu/drm/i915/intel_hdcp.c| 1096 -- drivers/gpu/drm/i915/intel_hdmi.c| 189 +- drivers/gpu/drm/i915/intel_i2c.c | 71 ++- drivers/misc/mei/Kconfig |7 + drivers/misc/mei/Makefile|2 + drivers/misc/mei/bus-fixup.c | 16 + drivers/misc/mei/hdcp/Makefile |6 + drivers/misc/mei/hdcp/mei_hdcp.c | 817 + drivers/misc/mei/hdcp/mei_hdcp.h | 415 + include/drm/drm_dp_helper.h | 51 ++ include/drm/drm_hdcp.h | 232 +++ include/linux/mei_hdcp.h | 232 +++ 18 files changed, 3546 insertions(+), 91 deletions(-) create mode 100644 drivers/misc/mei/hdcp/Makefile create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.c create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.h create mode 100644 include/linux/mei_hdcp.h -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org
[PATCH v4 01/41] drm: hdcp2.2 authentication msg definitions
This patch defines the hdcp2.2 protocol messages for authentication. v2: bit_fields are removed. Instead bitmasking used. [Tomas and Jani] prefix HDCP_2_2_ is added to the macros. [Tomas] v3: No Changes. v4: Style and spellings are fixed [Uma] Signed-off-by: Ramalingam C--- include/drm/drm_hdcp.h | 179 + 1 file changed, 179 insertions(+) diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index 98e63d870139..3993c95992eb 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -38,4 +38,183 @@ #define DRM_HDCP_DDC_BSTATUS 0x41 #define DRM_HDCP_DDC_KSV_FIFO 0x43 +#define DRM_HDCP_1_4_SRM_ID0x8 +#define DRM_HDCP_1_4_VRL_LENGTH_SIZE 3 +#define DRM_HDCP_1_4_DCP_SIG_SIZE 40 + +/* Protocol message definition for HDCP2.2 specification */ +#define HDCP_STREAM_TYPE0 0x00 +#define HDCP_STREAM_TYPE1 0x01 + +/* HDCP2.2 Msg IDs */ +#define HDCP_2_2_NULL_MSG 1 +#define HDCP_2_2_AKE_INIT 2 +#define HDCP_2_2_AKE_SEND_CERT 3 +#define HDCP_2_2_AKE_NO_STORED_KM 4 +#define HDCP_2_2_AKE_STORED_KM 5 +#define HDCP_2_2_AKE_SEND_HPRIME 7 +#define HDCP_2_2_AKE_SEND_PAIRING_INFO 8 +#define HDCP_2_2_LC_INIT 9 +#define HDCP_2_2_LC_SEND_LPRIME10 +#define HDCP_2_2_SKE_SEND_EKS 11 +#define HDCP_2_2_REP_SEND_RECVID_LIST 12 +#define HDCP_2_2_REP_SEND_ACK 15 +#define HDCP_2_2_REP_STREAM_MANAGE 16 +#define HDCP_2_2_REP_STREAM_READY 17 +#define HDCP_2_2_ERRATA_DP_STREAM_TYPE 50 + +#define HDCP_2_2_RTX_LEN 8 +#define HDCP_2_2_RRX_LEN 8 + +#define HDCP_2_2_K_PUB_RX_MOD_N_LEN128 +#define HDCP_2_2_K_PUB_RX_EXP_E_LEN3 +#define HDCP_2_2_K_PUB_RX_LEN (HDCP_2_2_K_PUB_RX_MOD_N_LEN + \ +HDCP_2_2_K_PUB_RX_EXP_E_LEN) + +#define HDCP_2_2_DCP_LLC_SIG_LEN 384 + +#define HDCP_2_2_E_KPUB_KM_LEN 128 +#define HDCP_2_2_E_KH_KM_M_LEN (16 + 16) +#define HDCP_2_2_H_PRIME_LEN 32 +#define HDCP_2_2_E_KH_KM_LEN 16 +#define HDCP_2_2_RN_LEN8 +#define HDCP_2_2_L_PRIME_LEN 32 +#define HDCP_2_2_E_DKEY_KS_LEN 16 +#define HDCP_2_2_RIV_LEN 8 +#define HDCP_2_2_SEQ_NUM_LEN 3 +#define HDCP_2_2_LPRIME_HALF_LEN (HDCP_2_2_L_PRIME_LEN / 2) +#define HDCP_2_2_RECEIVER_ID_LEN DRM_HDCP_KSV_LEN +#define HDCP_2_2_MAX_DEVICE_COUNT 31 +#define HDCP_2_2_RECEIVER_IDS_MAX_LEN (HDCP_2_2_RECEIVER_ID_LEN * \ +HDCP_2_2_MAX_DEVICE_COUNT) +#define HDCP_2_2_MPRIME_LEN32 + +/* Following Macros take a byte at a time for bit(s) masking */ +/* + * TODO: This has to be changed for DP MST, as multiple stream on + * same port is possible. + * For HDCP2.2 on HDMI and DP SST this value is always 1. + */ +#define HDCP_2_2_MAX_CONTENT_STREAMS_CNT 1 +#define HDCP_2_2_TXCAP_MASK_LEN2 +#define HDCP_2_2_RXCAPS_LEN3 +#define HDCP_2_2_RX_REPEATER(x)(x & BIT(0)) +#define HDCP_2_2_DP_HDCP_CAPABLE(x)(x & BIT(1)) +#define HDCP_2_2_RXINFO_LEN2 + +/* HDCP1.x compliant device in downstream */ +#define HDCP_2_2_HDCP1_DEVICE_CONNECTED(x) (x & BIT(0)) + +/* HDCP2.0 Compliant repeater in downstream */ +#define HDCP_2_2_HDCP_2_0_REP_CONNECTED(x) (x & BIT(1)) +#define HDCP_2_2_MAX_CASCADE_EXCEEDED(x) (x & BIT(2)) +#define HDCP_2_2_MAX_DEVS_EXCEEDED(x) (x & BIT(3)) +#define HDCP_2_2_DEV_COUNT_LO(x) ((x & (0xF << 4)) >> 4) +#define HDCP_2_2_DEV_COUNT_HI(x) (x & BIT(0)) +#define HDCP_2_2_DEPTH(x) ((x & (0x7 << 1)) >> 1) + +struct hdcp2_cert_rx { + uint8_t receiver_id[HDCP_2_2_RECEIVER_ID_LEN]; + uint8_t kpub_rx[HDCP_2_2_K_PUB_RX_LEN]; + uint8_t reserved[2]; + uint8_t dcp_signature[HDCP_2_2_DCP_LLC_SIG_LEN]; +} __packed; + +struct hdcp2_streamid_type { + uint8_t stream_id; + uint8_t stream_type; +} __packed; + +/* + * The TxCaps field specified in the HDCP HDMI, DP specs + * This field is big endian as specified in the errata. + */ +struct hdcp2_tx_caps { + /* Transmitter must set this to 0x2 */ + uint8_t version; + + /* Reserved for HDCP and DP Spec. Read as Zero */ + uint8_t tx_cap_mask[HDCP_2_2_TXCAP_MASK_LEN]; +} __packed; + +/* Main structures for HDCP2.2 protocol communication */
[PATCH v4 02/41] drm: HDMI and DP specific HDCP2.2 defines
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 as HDCP2.2 register offsets in DPCD offsets are defined at drm_dp_helper.h. v2: bit_field definitions are replaced by macros. [Tomas and Jani] v3: No Changes. v4: Comments style and typos are fixed [Uma] Signed-off-by: Ramalingam C--- include/drm/drm_dp_helper.h | 51 + include/drm/drm_hdcp.h | 30 ++ 2 files changed, 81 insertions(+) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 91c9bcd4196f..a65af33d53ec 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -898,6 +898,57 @@ #define DP_AUX_HDCP_KSV_FIFO 0x6802C #define DP_AUX_HDCP_AINFO 0x6803B +/* DP HDCP2.2 parameter offsets in DPCD address space */ +#define DP_HDCP_2_2_REG_RTX_OFFSET 0x69000 +#define DP_HDCP_2_2_REG_TXCAPS_OFFSET 0x69008 +#define DP_HDCP_2_2_REG_CERT_RX_OFFSET 0x6900B +#define DP_HDCP_2_2_REG_RRX_OFFSET 0x69215 +#define DP_HDCP_2_2_REG_RX_CAPS_OFFSET 0x6921D +#define DP_HDCP_2_2_REG_EKPUB_KM_OFFSET0x69220 +#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_OFFSET0x69318 +#defineDP_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_OFFSET0x69345 +#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_OFFSET0x69493 +#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_OFFSETDP_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_OFFSETDP_HDCP_2_2_REG_EKPUB_KM_OFFSET +#define DP_HDCP_2_2_AKE_STORED_KM_OFFSET DP_HDCP_2_2_REG_EKH_KM_OFFSET +#define DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET DP_HDCP_2_2_REG_HPRIME_OFFSET +#define DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET \ + DP_HDCP_2_2_REG_EKH_KM_RD_OFFSET +#define DP_HDCP_2_2_LC_INIT_OFFSET DP_HDCP_2_2_REG_RN_OFFSET +#define DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET DP_HDCP_2_2_REG_LPRIME_OFFSET +#define DP_HDCP_2_2_SKE_SEND_EKS_OFFSET DP_HDCP_2_2_REG_EDKEY_KS_OFFSET +#define DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET DP_HDCP_2_2_REG_RXINFO_OFFSET +#define DP_HDCP_2_2_REP_SEND_ACK_OFFSETDP_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_OFFSETDP_HDCP_2_2_REG_MPRIME_OFFSET + +#define HDCP_2_2_DP_RXSTATUS_LEN 1 +#define HDCP_2_2_DP_RXSTATUS_READY(x) (x & BIT(0)) +#define HDCP_2_2_DP_RXSTATUS_H_PRIME(x)(x & BIT(1)) +#define HDCP_2_2_DP_RXSTATUS_PAIRING(x)(x & BIT(2)) +#define HDCP_2_2_DP_RXSTATUS_REAUTH_REQ(x) (x & BIT(3)) +#define HDCP_2_2_DP_RXSTATUS_LINK_FAILED(x)(x & BIT(4)) + /* DP 1.2 Sideband message defines */ /* peer device type - DP 1.2a Table 2-92 */ #define DP_PEER_DEVICE_NONE0x0 diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index 3993c95992eb..efd493306130 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -217,4 +217,34 @@ struct hdcp2_dp_errata_stream_type { uint8_t stream_type; } __packed; +/* HDCP2.2 TIMEOUTs in mSec */ +#define HDCP_2_2_CERT_TIMEOUT 100 +#define HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT 1000 +#define HDCP_2_2_HPRIME_PAIRED_TIMEOUT 200 +#define HDCP_2_2_PAIRING_TIMEOUT 200 +#defineHDCP_2_2_HDMI_LPRIME_TIMEOUT20 +#define HDCP_2_2_DP_LPRIME_TIMEOUT 7 +#define HDCP_2_2_RECVID_LIST_TIMEOUT 3000 +#define HDCP_2_2_STREAM_READY_TIMEOUT 100 + +/* HDMI HDCP2.2 Register Offsets */ +#define HDCP_2_2_HDMI_REG_VER_OFFSET 0x50 +#define HDCP_2_2_HDMI_REG_WR_MSG_OFFSET0x60 +#define
[PATCH v6 5/5] drm/rockchip: support dp training outside dp firmware
DP firmware uses fixed phy config values to do training, but some boards need to adjust these values to fit for their unique hardware design. So get phy config values from dts and use software link training instead of relying on firmware, if software training fail, keep firmware training as a fallback if sw training fails. Signed-off-by: Chris ZhongSigned-off-by: Lin Huang Reviewed-by: Sean Paul --- Changes in v2: - update patch following Enric suggest Changes in v3: - use variable fw_training instead sw_training_success - base on DP SPCE, if training fail use lower link rate to retry training Changes in v4: - improve cdn_dp_get_lower_link_rate() and cdn_dp_software_train_link() follow Sean suggest Changes in v5: - fix some whitespcae issue Changes in v6: - None drivers/gpu/drm/rockchip/Makefile | 3 +- drivers/gpu/drm/rockchip/cdn-dp-core.c | 24 +- drivers/gpu/drm/rockchip/cdn-dp-core.h | 2 + drivers/gpu/drm/rockchip/cdn-dp-link-training.c | 420 drivers/gpu/drm/rockchip/cdn-dp-reg.c | 31 +- drivers/gpu/drm/rockchip/cdn-dp-reg.h | 38 ++- 6 files changed, 505 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-link-training.c diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index a314e21..b932f62 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -9,7 +9,8 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \ rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o -rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o +rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o \ + cdn-dp-link-training.o rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index cce64c1..d9d0d4d 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -629,11 +629,13 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) goto out; } } - - ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_IDLE); - if (ret) { - DRM_DEV_ERROR(dp->dev, "Failed to idle video %d\n", ret); - goto out; + if (dp->use_fw_training == true) { + ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_IDLE); + if (ret) { + DRM_DEV_ERROR(dp->dev, + "Failed to idle video %d\n", ret); + goto out; + } } ret = cdn_dp_config_video(dp); @@ -642,11 +644,15 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) goto out; } - ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_VALID); - if (ret) { - DRM_DEV_ERROR(dp->dev, "Failed to valid video %d\n", ret); - goto out; + if (dp->use_fw_training == true) { + ret = cdn_dp_set_video_status(dp, CONTROL_VIDEO_VALID); + if (ret) { + DRM_DEV_ERROR(dp->dev, + "Failed to valid video %d\n", ret); + goto out; + } } + out: mutex_unlock(>lock); } diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h index 46159b2..77a9793 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h @@ -84,6 +84,7 @@ struct cdn_dp_device { bool connected; bool active; bool suspended; + bool use_fw_training; const struct firmware *fw; /* cdn dp firmware */ unsigned int fw_version;/* cdn fw version */ @@ -106,6 +107,7 @@ struct cdn_dp_device { u8 ports; u8 lanes; int active_port; + u8 train_set[4]; u8 dpcd[DP_RECEIVER_CAP_SIZE]; bool sink_has_audio; diff --git a/drivers/gpu/drm/rockchip/cdn-dp-link-training.c b/drivers/gpu/drm/rockchip/cdn-dp-link-training.c new file mode 100644 index 000..73c3290 --- /dev/null +++ b/drivers/gpu/drm/rockchip/cdn-dp-link-training.c @@ -0,0 +1,420 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd + * Author: Chris Zhong + */ + +#include +#include +#include +#include + +#include "cdn-dp-core.h" +#include "cdn-dp-reg.h" + +static void cdn_dp_set_signal_levels(struct cdn_dp_device *dp) +{ + struct cdn_dp_port *port = dp->port[dp->active_port]; +
[PATCH v6 1/5] drm/rockchip: add transfer function for cdn-dp
From: Chris ZhongWe may support training outside firmware, so we need support dpcd read/write to get the message or do some setting with display. Signed-off-by: Chris Zhong Signed-off-by: Lin Huang Reviewed-by: Sean Paul Reviewed-by: Enric Balletbo --- Changes in v2: - update patch following Enric suggest Changes in v3: - None Changes in v4: - None Changes in v5: - None Changes in v6: - None drivers/gpu/drm/rockchip/cdn-dp-core.c | 55 +++ drivers/gpu/drm/rockchip/cdn-dp-core.h | 1 + drivers/gpu/drm/rockchip/cdn-dp-reg.c | 69 ++ drivers/gpu/drm/rockchip/cdn-dp-reg.h | 14 ++- 4 files changed, 122 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index c6fbdcd..cce64c1 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -176,8 +176,8 @@ static int cdn_dp_get_sink_count(struct cdn_dp_device *dp, u8 *sink_count) u8 value; *sink_count = 0; - ret = cdn_dp_dpcd_read(dp, DP_SINK_COUNT, , 1); - if (ret) + ret = drm_dp_dpcd_read(>aux, DP_SINK_COUNT, , 1); + if (ret < 0) return ret; *sink_count = DP_GET_SINK_COUNT(value); @@ -374,9 +374,9 @@ static int cdn_dp_get_sink_capability(struct cdn_dp_device *dp) if (!cdn_dp_check_sink_connection(dp)) return -ENODEV; - ret = cdn_dp_dpcd_read(dp, DP_DPCD_REV, dp->dpcd, - DP_RECEIVER_CAP_SIZE); - if (ret) { + ret = drm_dp_dpcd_read(>aux, DP_DPCD_REV, dp->dpcd, + sizeof(dp->dpcd)); + if (ret < 0) { DRM_DEV_ERROR(dp->dev, "Failed to get caps %d\n", ret); return ret; } @@ -582,8 +582,8 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp) if (!port || !dp->link.rate || !dp->link.num_lanes) return false; - if (cdn_dp_dpcd_read(dp, DP_LANE0_1_STATUS, link_status, -DP_LINK_STATUS_SIZE)) { + if (drm_dp_dpcd_read_link_status(>aux, link_status) != + DP_LINK_STATUS_SIZE) { DRM_ERROR("Failed to get link status\n"); return false; } @@ -1012,6 +1012,40 @@ static int cdn_dp_pd_event(struct notifier_block *nb, return NOTIFY_DONE; } +static ssize_t cdn_dp_aux_transfer(struct drm_dp_aux *aux, + struct drm_dp_aux_msg *msg) +{ + struct cdn_dp_device *dp = container_of(aux, struct cdn_dp_device, aux); + int ret; + u8 status; + + switch (msg->request & ~DP_AUX_I2C_MOT) { + case DP_AUX_NATIVE_WRITE: + case DP_AUX_I2C_WRITE: + case DP_AUX_I2C_WRITE_STATUS_UPDATE: + ret = cdn_dp_dpcd_write(dp, msg->address, msg->buffer, + msg->size); + break; + case DP_AUX_NATIVE_READ: + case DP_AUX_I2C_READ: + ret = cdn_dp_dpcd_read(dp, msg->address, msg->buffer, + msg->size); + break; + default: + return -EINVAL; + } + + status = cdn_dp_get_aux_status(dp); + if (status == AUX_STATUS_ACK) + msg->reply = DP_AUX_NATIVE_REPLY_ACK; + else if (status == AUX_STATUS_NACK) + msg->reply = DP_AUX_NATIVE_REPLY_NACK; + else if (status == AUX_STATUS_DEFER) + msg->reply = DP_AUX_NATIVE_REPLY_DEFER; + + return ret; +} + static int cdn_dp_bind(struct device *dev, struct device *master, void *data) { struct cdn_dp_device *dp = dev_get_drvdata(dev); @@ -1030,6 +1064,13 @@ static int cdn_dp_bind(struct device *dev, struct device *master, void *data) dp->active = false; dp->active_port = -1; dp->fw_loaded = false; + dp->aux.name = "DP-AUX"; + dp->aux.transfer = cdn_dp_aux_transfer; + dp->aux.dev = dev; + + ret = drm_dp_aux_register(>aux); + if (ret) + return ret; INIT_WORK(>event_work, cdn_dp_pd_event_work); diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h index f57e296..46159b2 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h @@ -78,6 +78,7 @@ struct cdn_dp_device { struct platform_device *audio_pdev; struct work_struct event_work; struct edid *edid; + struct drm_dp_aux aux; struct mutex lock; bool connected; diff --git a/drivers/gpu/drm/rockchip/cdn-dp-reg.c b/drivers/gpu/drm/rockchip/cdn-dp-reg.c index eb3042c..979355d 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-reg.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-reg.c @@ -221,7 +221,12 @@
[PATCH 24/33] drm: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Gustavo PadovanCc: Maarten Lankhorst Cc: Sean Paul Cc: David Airlie Cc: dri-devel@lists.freedesktop.org Signed-off-by: Yisheng Xie --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index 902cc1a..3367c36 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -136,7 +136,6 @@ int drm_get_panel_orientation_quirk(int width, int height) const struct dmi_system_id *match; const struct drm_dmi_panel_orientation_data *data; const char *bios_date; - int i; for (match = dmi_first_match(orientation_data); match; @@ -154,10 +153,8 @@ int drm_get_panel_orientation_quirk(int width, int height) if (!bios_date) continue; - for (i = 0; data->bios_dates[i]; i++) { - if (!strcmp(data->bios_dates[i], bios_date)) - return data->orientation; - } + if (match_string(data->bios_dates, -1, bios_date) >= 0) + return data->orientation; } return DRM_MODE_PANEL_ORIENTATION_UNKNOWN; -- 1.7.12.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 20/33] video: fbdev: pxafb: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Bartlomiej ZolnierkiewiczCc: Arvind Yadav Cc: dri-devel@lists.freedesktop.org linux-fb...@vger.kernel.org Signed-off-by: Yisheng Xie --- drivers/video/fbdev/pxafb.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index c3d49e1..702193d 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2115,10 +2115,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, if (ret) s = "color-tft"; - for (i = 0; lcd_types[i]; i++) - if (!strcmp(s, lcd_types[i])) - break; - if (!i || !lcd_types[i]) { + i = match_string(lcd_types, -1, s); + if (i <= 0) { dev_err(dev, "lcd-type %s is unknown\n", s); return -EINVAL; } -- 1.7.12.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 07/41] linux/mei: Header for mei_hdcp driver interface
Data structures and Enum for the I915-MEI_HDCP interface are defined at v2: Rebased. v3: mei_cl_device is removed from mei_hdcp_data [Tomas] v4: Comment style and typo fixed [Uma] Signed-off-by: Ramalingam C--- include/linux/mei_hdcp.h | 70 1 file changed, 70 insertions(+) diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index 9c8f140f5344..c8a8c12782d2 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -27,11 +27,81 @@ #ifndef _LINUX_MEI_HDCP_H #define _LINUX_MEI_HDCP_H +#include + enum mei_cldev_state { MEI_CLDEV_DISABLED, MEI_CLDEV_ENABLED }; +/* + * Enumeration of the physical DDI available on the platform + */ +enum hdcp_physical_port { + INVALID_PORT = 0x00,/* Not a valid port */ + + DDI_RANGE_BEGIN = 0x01, /* Beginning of the valid DDI port range */ + DDI_B = 0x01, /* Port DDI B */ + DDI_C = 0x02, /* Port DDI C */ + DDI_D = 0x03, /* Port DDI D */ + DDI_E = 0x04, /* Port DDI E */ + DDI_F = 0x05, /* Port DDI F */ + DDI_A = 0x07, /* Port DDI A */ + DDI_RANGE_END = DDI_A,/* End of the valid DDI port range */ +}; + +/* The types of HDCP 2.2 ports supported */ +enum hdcp_integrated_port_type { + HDCP_INVALID_TYPE = 0x00, + + /* HDCP 2.x ports that are integrated into Intel HW */ + INTEGRATED = 0x01, + + /* HDCP2.2 discrete wired Tx port with LSPCON (HDMI 2.0) solution */ + LSPCON = 0x02, + + /* HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3) solution */ + CPDP= 0x03, +}; + +/* + * wired_protocol: Supported integrated wired HDCP protocol. + * Based on this value, Minor difference needed between wired specifications + * are handled. + */ +enum hdcp_protocol { + HDCP_PROTOCOL_INVALID, + HDCP_PROTOCOL_HDMI, + HDCP_PROTOCOL_DP +}; + +/* + * mei_hdcp_data: Input data to the mei_hdcp APIs. + */ +struct mei_hdcp_data { + enum hdcp_physical_port port; + enum hdcp_integrated_port_type port_type; + enum hdcp_protocol protocol; + + /* +* No of streams transmitted on a port. +* In case of HDMI & DP SST, single stream will be +* transmitted on a port. +*/ + uint16_t k; + + /* +* Count of RepeaterAuth_Stream_Manage msg propagated. +* Initialized to 0 on AKE_INIT. Incremented after every successful +* transmission of RepeaterAuth_Stream_Manage message. When it rolls +* over re-Auth has to be triggered. +*/ + uint32_t seq_num_m; + + /* k(No of Streams per port) x structure of wired_streamid_type */ + struct hdcp2_streamid_type *streams; +}; + #if IS_ENABLED(CONFIG_INTEL_MEI_HDCP) int mei_cldev_register_notify(struct notifier_block *nb); int mei_cldev_unregister_notify(struct notifier_block *nb); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 13/41] misc/mei/hdcp: Verify L_prime
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. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 60 include/linux/mei_hdcp.h | 8 ++ 2 files changed, 68 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 324e50736518..9582109923e4 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -365,6 +365,66 @@ int mei_initiate_locality_check(struct mei_cl_device *cldev, } EXPORT_SYMBOL(mei_initiate_locality_check); +/* + * mei_verify_lprime: + * Function to verify lprime. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * rx_lprime : Pointer for LC_Send_L_prime + * + * Returns 0 on Success, <0 on Failure + */ +int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_lc_send_lprime *rx_lprime) +{ + struct wired_cmd_validate_locality_in verify_lprime_in = { { 0 } }; + struct wired_cmd_validate_locality_out verify_lprime_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !rx_lprime) + return -EINVAL; + + dev = >dev; + + verify_lprime_in.header.api_version = HDCP_API_VERSION; + verify_lprime_in.header.command_id = WIRED_VALIDATE_LOCALITY; + verify_lprime_in.header.status = ME_HDCP_STATUS_SUCCESS; + verify_lprime_in.header.buffer_len = + WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN; + + verify_lprime_in.port.integrated_port_type = data->port_type; + verify_lprime_in.port.physical_port = data->port; + + memcpy(verify_lprime_in.l_prime, rx_lprime->l_prime, + sizeof(rx_lprime->l_prime)); + + byte = mei_cldev_send(cldev, (u8 *)_lprime_in, + sizeof(verify_lprime_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_lprime_out, + sizeof(verify_lprime_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (verify_lprime_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n", + WIRED_VALIDATE_LOCALITY, + verify_lprime_out.header.status); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(mei_verify_lprime); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index 54453c34d54e..c9a0bb9d10e8 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -125,6 +125,8 @@ int mei_store_pairing_info(struct mei_cl_device *cldev, int mei_initiate_locality_check(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_lc_init *lc_init_data); +int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_lc_send_lprime *rx_lprime); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -175,5 +177,11 @@ int mei_initiate_locality_check(struct mei_cl_device *cldev, { return -ENODEV; } +static inline +int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_lc_send_lprime *rx_lprime) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 14/41] misc/mei/hdcp: Prepare Session Key
Request to ME to prepare the encrypted session key. On Success, ME provides Encrypted session key. Function populates the HDCP2.2 authentication msg SKE_Send_Eks. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 59 include/linux/mei_hdcp.h | 8 ++ 2 files changed, 67 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 9582109923e4..36c54c1c69e6 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -425,6 +425,65 @@ int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, } EXPORT_SYMBOL(mei_verify_lprime); +/* + * mei_get_session_key: + * Function to prepare SKE_Send_Eks. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * ske_data: Pointer for SKE_Send_Eks. + * + * Returns 0 on Success, <0 on Failure + */ +int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_ske_send_eks *ske_data) +{ + struct wired_cmd_get_session_key_in get_skey_in = { { 0 } }; + struct wired_cmd_get_session_key_out get_skey_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !ske_data) + return -EINVAL; + + dev = >dev; + + get_skey_in.header.api_version = HDCP_API_VERSION; + get_skey_in.header.command_id = WIRED_GET_SESSION_KEY; + get_skey_in.header.status = ME_HDCP_STATUS_SUCCESS; + get_skey_in.header.buffer_len = WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN; + + get_skey_in.port.integrated_port_type = data->port_type; + get_skey_in.port.physical_port = data->port; + + byte = mei_cldev_send(cldev, (u8 *)_skey_in, sizeof(get_skey_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_skey_out, sizeof(get_skey_out)); + + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (get_skey_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n", + WIRED_GET_SESSION_KEY, get_skey_out.header.status); + return -EIO; + } + + ske_data->msg_id = HDCP_2_2_SKE_SEND_EKS; + memcpy(ske_data->e_dkey_ks, get_skey_out.e_dkey_ks, + HDCP_2_2_E_DKEY_KS_LEN); + memcpy(ske_data->riv, get_skey_out.r_iv, HDCP_2_2_RIV_LEN); + + return 0; +} +EXPORT_SYMBOL(mei_get_session_key); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index c9a0bb9d10e8..d2efa7107339 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -127,6 +127,8 @@ int mei_initiate_locality_check(struct mei_cl_device *cldev, struct hdcp2_lc_init *lc_init_data); int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_lc_send_lprime *rx_lprime); +int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_ske_send_eks *ske_data); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -183,5 +185,11 @@ int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, { return -ENODEV; } +static inline +int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_ske_send_eks *ske_data) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 15/41] misc/mei/hdcp: Repeater topology verification and ack
Request ME to verify the downstream topology information received. ME FW will validate the Repeaters receiver id list and downstream topology. On Success ME FW will provide the Least Significant 128bits of VPrime, which forms the repeater ack. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style and typos fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 75 include/linux/mei_hdcp.h | 15 2 files changed, 90 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 36c54c1c69e6..d729348f5ae2 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -484,6 +484,81 @@ int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, } EXPORT_SYMBOL(mei_get_session_key); +/* + * mei_repeater_check_flow_prepare_ack: + * Function to validate the Downstream topology and prepare rep_ack. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * rep_topology: Pointer for Receiver Id List to be validated. + * rep_send_ack: Pointer for repeater ack + * + * Returns 0 on Success, <0 on Failure + */ +int +mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_rep_send_receiverid_list + *rep_topology, + struct hdcp2_rep_send_ack *rep_send_ack) +{ + struct wired_cmd_verify_repeater_in verify_repeater_in = { { 0 } }; + struct wired_cmd_verify_repeater_out verify_repeater_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!rep_topology || !rep_send_ack || !data) + return -EINVAL; + + dev = >dev; + + verify_repeater_in.header.api_version = HDCP_API_VERSION; + verify_repeater_in.header.command_id = WIRED_VERIFY_REPEATER; + verify_repeater_in.header.status = ME_HDCP_STATUS_SUCCESS; + verify_repeater_in.header.buffer_len = + WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN; + + verify_repeater_in.port.integrated_port_type = data->port_type; + verify_repeater_in.port.physical_port = data->port; + + memcpy(verify_repeater_in.rx_info, rep_topology->rx_info, + HDCP_2_2_RXINFO_LEN); + memcpy(verify_repeater_in.seq_num_v, rep_topology->seq_num_v, + HDCP_2_2_SEQ_NUM_LEN); + memcpy(verify_repeater_in.v_prime, rep_topology->v_prime, + HDCP_2_2_LPRIME_HALF_LEN); + memcpy(verify_repeater_in.receiver_ids, rep_topology->receiver_ids, + HDCP_2_2_RECEIVER_IDS_MAX_LEN); + + byte = mei_cldev_send(cldev, (u8 *)_repeater_in, + sizeof(verify_repeater_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_repeater_out, + sizeof(verify_repeater_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (verify_repeater_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n", + WIRED_VERIFY_REPEATER, + verify_repeater_out.header.status); + return -EIO; + } + + memcpy(rep_send_ack->v, verify_repeater_out.v, + HDCP_2_2_LPRIME_HALF_LEN); + rep_send_ack->msg_id = HDCP_2_2_REP_SEND_ACK; + + return 0; +} +EXPORT_SYMBOL(mei_repeater_check_flow_prepare_ack); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index d2efa7107339..2713cf321a58 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -129,6 +129,12 @@ int mei_verify_lprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_lc_send_lprime *rx_lprime); int mei_get_session_key(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_ske_send_eks *ske_data); +int +mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_rep_send_receiverid_list + *rep_topology, + struct hdcp2_rep_send_ack *rep_send_ack); #else static
[PATCH v4 04/41] misc/mei/hdcp: Client driver for HDCP application
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. With this change MEI_HDCP drivers selected by I915 by default. In case if we want to exclude the mei_hdcp compilation, we need to introduce a new config called HDCP2.2. Using such CONFIG var we could control the compilation of the HDCP2.2 code in I915 and also the compilation of the MEI_HDCP. v2: hdcp files are moved to drivers/misc/mei/hdcp/ [Tomas] v3: Squashed the Kbuild support [Tomas] UUID renamed and Module License is modified [Tomas] drv_data is set to null at remove [Tomas] v4: Module name is changed to "MEI HDCP" I915 Selects the MEI_HDCP Signed-off-by: Ramalingam CSigned-off-by: Tomas Winkler --- drivers/gpu/drm/i915/Kconfig | 1 + drivers/misc/mei/Kconfig | 7 drivers/misc/mei/Makefile| 2 ++ drivers/misc/mei/hdcp/Makefile | 6 drivers/misc/mei/hdcp/mei_hdcp.c | 74 5 files changed, 90 insertions(+) create mode 100644 drivers/misc/mei/hdcp/Makefile create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.c diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig index dfd95889f4b7..bfa8f987910b 100644 --- a/drivers/gpu/drm/i915/Kconfig +++ b/drivers/gpu/drm/i915/Kconfig @@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select INTEL_MEI_HDCP help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics, diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig index c49e1d2269af..9c518b7f0011 100644 --- a/drivers/misc/mei/Kconfig +++ b/drivers/misc/mei/Kconfig @@ -43,3 +43,10 @@ config INTEL_MEI_TXE Supported SoCs: Intel Bay Trail + +config INTEL_MEI_HDCP + tristate "Intel HDCP2.2 services of ME Interface" + select INTEL_MEI_ME + depends on DRM_I915 + help + MEI Support for HDCP2.2 Services on Intel SoCs. diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile index cd6825afa8e1..e64d1212fb85 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) += hdcp/ diff --git a/drivers/misc/mei/hdcp/Makefile b/drivers/misc/mei/hdcp/Makefile new file mode 100644 index ..75ac50203223 --- /dev/null +++ b/drivers/misc/mei/hdcp/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile - HDCP client driver for Intel MEI Bus Driver. +# Copyright (c) 2010-2014, Intel Corporation. +# +obj-$(CONFIG_INTEL_MEI_HDCP) += mei_hdcp.o diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c new file mode 100644 index ..4cd6fdd01181 --- /dev/null +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ +/* + * Copyright © 2017-2018 Intel Corporation + * + * Mei_hdcp.c: HDCP client driver for mei bus + * + * 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
[PATCH v4 09/41] misc/mei/hdcp: Verify Receiver Cert and prepare km
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. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd is used for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 83 include/linux/mei_hdcp.h | 17 2 files changed, 100 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index be33906a68c1..b6a3ac31410c 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -105,6 +105,89 @@ int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, } EXPORT_SYMBOL(mei_initiate_hdcp2_session); +/* + * mei_verify_receiver_cert_prepare_km: + * Function to verify the Receiver Certificate AKE_Send_Cert + * and prepare AKE_Stored_Km or AKE_No_Stored_Km + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * rx_cert : Pointer for AKE_Send_Cert + * km_stored : Pointer for pairing status flag + * ek_pub_km : Pointer for output msg + * msg_sz : Pointer for size of AKE_X_Km + * + * Returns 0 on Success, <0 on Failure + */ +int +mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_send_cert *rx_cert, + bool *km_stored, + struct hdcp2_ake_no_stored_km *ek_pub_km, + size_t *msg_sz) +{ + struct wired_cmd_verify_receiver_cert_in verify_rxcert_in = { { 0 } }; + struct wired_cmd_verify_receiver_cert_out verify_rxcert_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !rx_cert || !km_stored || !ek_pub_km || !msg_sz) + return -EINVAL; + + dev = >dev; + + verify_rxcert_in.header.api_version = HDCP_API_VERSION; + verify_rxcert_in.header.command_id = WIRED_VERIFY_RECEIVER_CERT; + verify_rxcert_in.header.status = ME_HDCP_STATUS_SUCCESS; + verify_rxcert_in.header.buffer_len = + WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN; + + verify_rxcert_in.port.integrated_port_type = data->port_type; + verify_rxcert_in.port.physical_port = data->port; + + memcpy(_rxcert_in.cert_rx, _cert->cert_rx, + sizeof(rx_cert->cert_rx)); + memcpy(verify_rxcert_in.r_rx, _cert->r_rx, sizeof(rx_cert->r_rx)); + memcpy(verify_rxcert_in.rx_caps, rx_cert->rx_caps, HDCP_2_2_RXCAPS_LEN); + + byte = mei_cldev_send(cldev, (u8 *)_rxcert_in, + sizeof(verify_rxcert_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed: %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_rxcert_out, + sizeof(verify_rxcert_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed: %zd\n", byte); + return byte; + } + + if (verify_rxcert_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n", + WIRED_VERIFY_RECEIVER_CERT, + verify_rxcert_out.header.status); + return -EIO; + } + + *km_stored = verify_rxcert_out.km_stored; + if (verify_rxcert_out.km_stored) { + ek_pub_km->msg_id = HDCP_2_2_AKE_STORED_KM; + *msg_sz = sizeof(struct hdcp2_ake_stored_km); + } else { + ek_pub_km->msg_id = HDCP_2_2_AKE_NO_STORED_KM; + *msg_sz = sizeof(struct hdcp2_ake_no_stored_km); + } + + memcpy(ek_pub_km->e_kpub_km, _rxcert_out.ekm_buff, + sizeof(verify_rxcert_out.ekm_buff)); + + return 0; +} +EXPORT_SYMBOL(mei_verify_receiver_cert_prepare_km); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index 841ab8ffc302..3316386f58d3 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -110,6 +110,13 @@ int mei_cldev_poll_notification(void); int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_ake_init *ake_data); +int
[PATCH v4 10/41] misc/mei/hdcp: Verify H_prime
Requests for the verification of AKE_Send_H_prime. ME will calculate the H and comparing it with received H_Prime. The result will be returned as status. Here AKE_Send_H_prime is a HDCP2.2 Authentication msg. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Styles and typos fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 59 include/linux/mei_hdcp.h | 8 ++ 2 files changed, 67 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index b6a3ac31410c..a521d111751a 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -188,6 +188,65 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, } EXPORT_SYMBOL(mei_verify_receiver_cert_prepare_km); +/* + * mei_verify_hprime: + * Function to verify AKE_Send_H_prime received, through ME FW. + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * rx_hprime : Pointer for AKE_Send_H_prime + * hprime_sz : Input buffer size + * + * Returns 0 on Success, <0 on Failure + */ +int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_ake_send_hprime *rx_hprime) +{ + struct wired_cmd_ake_send_hprime_in send_hprime_in = { { 0 } }; + struct wired_cmd_ake_send_hprime_out send_hprime_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !rx_hprime) + return -EINVAL; + + dev = >dev; + + send_hprime_in.header.api_version = HDCP_API_VERSION; + send_hprime_in.header.command_id = WIRED_AKE_SEND_HPRIME; + send_hprime_in.header.status = ME_HDCP_STATUS_SUCCESS; + send_hprime_in.header.buffer_len = WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN; + + send_hprime_in.port.integrated_port_type = data->port_type; + send_hprime_in.port.physical_port = data->port; + + memcpy(send_hprime_in.h_prime, rx_hprime->h_prime, + sizeof(rx_hprime->h_prime)); + + byte = mei_cldev_send(cldev, (u8 *)_hprime_in, + sizeof(send_hprime_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_hprime_out, + sizeof(send_hprime_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (send_hprime_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n", + WIRED_AKE_SEND_HPRIME, send_hprime_out.header.status); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(mei_verify_hprime); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index 3316386f58d3..b97eb4d15393 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -117,6 +117,8 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, bool *km_stored, struct hdcp2_ake_no_stored_km *ek_pub_km, size_t *msg_sz); +int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_ake_send_hprime *rx_hprime); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -147,5 +149,11 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, { return -ENODEV; } +static inline +int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, + struct hdcp2_ake_send_hprime *rx_hprime) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 08/41] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
Request ME FW to start the HDCP2.2 session for an intel port. Prepares payloads for command WIRED_INITIATE_HDCP2_SESSION and sends to ME FW. On Success, ME FW will start a HDCP2.2 session for the port and provides the content for HDCP2.2 AKE_Init message. v2: Rebased. v3: cldev is add as a separate parameter [Tomas] Redundant comment and typecast are removed [Tomas] v4: %zd is used for size [Alexander] %s/return -1/return -EIO [Alexander] Spellings in commit msg is fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 68 include/linux/mei_hdcp.h | 11 +++ 2 files changed, 79 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index 0b4e85511a25..be33906a68c1 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -33,10 +33,78 @@ #include #include #include +#include + +#include "mei_hdcp.h" static struct mei_cl_device *mei_cldev; static BLOCKING_NOTIFIER_HEAD(mei_cldev_notifier_list); +/* + * mei_initiate_hdcp2_session: + * Function to start a Wired HDCP2.2 Tx Session with ME FW + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * ake_data: ptr to store AKE_Init + * + * Returns 0 on Success, <0 on Failure. + */ +int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_init *ake_data) +{ + struct wired_cmd_initiate_hdcp2_session_in session_init_in = { { 0 } }; + struct wired_cmd_initiate_hdcp2_session_out + session_init_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !ake_data) + return -EINVAL; + + dev = >dev; + + session_init_in.header.api_version = HDCP_API_VERSION; + session_init_in.header.command_id = WIRED_INITIATE_HDCP2_SESSION; + session_init_in.header.status = ME_HDCP_STATUS_SUCCESS; + session_init_in.header.buffer_len = + WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN; + + session_init_in.port.integrated_port_type = data->port_type; + session_init_in.port.physical_port = data->port; + session_init_in.protocol = (uint8_t)data->protocol; + + byte = mei_cldev_send(cldev, (u8 *)_init_in, + sizeof(session_init_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_init_out, + sizeof(session_init_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (session_init_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n", + WIRED_INITIATE_HDCP2_SESSION, + session_init_out.header.status); + return -EIO; + } + + ake_data->msg_id = HDCP_2_2_AKE_INIT; + ake_data->tx_caps = session_init_out.tx_caps; + memcpy(ake_data->r_tx, session_init_out.r_tx, + sizeof(session_init_out.r_tx)); + + return 0; +} +EXPORT_SYMBOL(mei_initiate_hdcp2_session); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index c8a8c12782d2..841ab8ffc302 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -28,6 +28,7 @@ #define _LINUX_MEI_HDCP_H #include +#include enum mei_cldev_state { MEI_CLDEV_DISABLED, @@ -106,6 +107,9 @@ struct mei_hdcp_data { int mei_cldev_register_notify(struct notifier_block *nb); int mei_cldev_unregister_notify(struct notifier_block *nb); int mei_cldev_poll_notification(void); +int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_init *ake_data); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -119,5 +123,12 @@ static inline int mei_cldev_poll_notification(void) { return -ENODEV; } +static inline +int mei_initiate_hdcp2_session(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_init *ake_data) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 11/41] misc/mei/hdcp: Store the HDCP Pairing info
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. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 61 include/linux/mei_hdcp.h | 10 +++ 2 files changed, 71 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index a521d111751a..878485e53d5a 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -247,6 +247,67 @@ int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, } EXPORT_SYMBOL(mei_verify_hprime); +/* + * mei_store_pairing_info: + * Function to store pairing info received from panel + * + * cldev : Pointer for mei client device + * data: Intel HW specific Data + * pairing_info: Pointer for AKE_Send_Pairing_Info + * + * Returns 0 on Success, <0 on Failure + */ +int mei_store_pairing_info(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_send_pairing_info *pairing_info) +{ + struct wired_cmd_ake_send_pairing_info_in pairing_info_in = { { 0 } }; + struct wired_cmd_ake_send_pairing_info_out pairing_info_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data || !pairing_info) + return -EINVAL; + + dev = >dev; + + pairing_info_in.header.api_version = HDCP_API_VERSION; + pairing_info_in.header.command_id = WIRED_AKE_SEND_PAIRING_INFO; + pairing_info_in.header.status = ME_HDCP_STATUS_SUCCESS; + pairing_info_in.header.buffer_len = + WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN; + + pairing_info_in.port.integrated_port_type = data->port_type; + pairing_info_in.port.physical_port = data->port; + + memcpy(pairing_info_in.e_kh_km, pairing_info->e_kh_km, + sizeof(pairing_info_in.e_kh_km)); + + byte = mei_cldev_send(cldev, (u8 *)_info_in, + sizeof(pairing_info_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_info_out, + sizeof(pairing_info_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (pairing_info_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "ME cmd 0x%08X failed. Status: 0x%X\n", + WIRED_AKE_SEND_PAIRING_INFO, + pairing_info_out.header.status); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(mei_store_pairing_info); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index b97eb4d15393..23291d073d4b 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -119,6 +119,9 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev, size_t *msg_sz); int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_ake_send_hprime *rx_hprime); +int mei_store_pairing_info(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_send_pairing_info *pairing_info); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -155,5 +158,12 @@ int mei_verify_hprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, { return -ENODEV; } +static inline +int mei_store_pairing_info(struct mei_cl_device *cldev, + struct mei_hdcp_data *data, + struct hdcp2_ake_send_pairing_info *pairing_info) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 19/41] drm/i915: wrapping all hdcp var into intel_hdcp
Considering significant number of HDCP specific variables, it will be clean to have separate struct for HDCP. New structure called intel_hdcp is added within intel_connector. v2: struct hdcp statically allocated. [Sean Paul] enable and disable function parameters are retained.[Sean Paul] v3: No Changes. v4: Commit msg is rephrased [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_display.c | 7 +-- drivers/gpu/drm/i915/intel_drv.h | 14 -- drivers/gpu/drm/i915/intel_hdcp.c| 94 3 files changed, 66 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 09e96d547c01..1da5d0126eba 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -15499,9 +15499,10 @@ static void intel_hpd_poll_fini(struct drm_device *dev) for_each_intel_connector_iter(connector, _iter) { if (connector->modeset_retry_work.func) cancel_work_sync(>modeset_retry_work); - if (connector->hdcp_shim) { - cancel_delayed_work_sync(>hdcp_check_work); - cancel_work_sync(>hdcp_prop_work); + if (connector->hdcp.hdcp_shim) { + cancel_delayed_work_sync( + >hdcp.hdcp_check_work); + cancel_work_sync(>hdcp.hdcp_prop_work); } } drm_connector_list_iter_end(_iter); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 8b20824e806e..df3a43e6b4d7 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -377,6 +377,14 @@ struct intel_hdcp_shim { bool *hdcp_capable); }; +struct intel_hdcp { + const struct intel_hdcp_shim *hdcp_shim; + struct mutex hdcp_mutex; + uint64_t hdcp_value; /* protected by hdcp_mutex */ + struct delayed_work hdcp_check_work; + struct work_struct hdcp_prop_work; +}; + struct intel_connector { struct drm_connector base; /* @@ -409,11 +417,7 @@ struct intel_connector { /* Work struct to schedule a uevent on link train failure */ struct work_struct modeset_retry_work; - const struct intel_hdcp_shim *hdcp_shim; - struct mutex hdcp_mutex; - uint64_t hdcp_value; /* protected by hdcp_mutex */ - struct delayed_work hdcp_check_work; - struct work_struct hdcp_prop_work; + struct intel_hdcp hdcp; }; struct intel_digital_connector_state { diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 2db5da550a1c..c7d0fa319c01 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -626,6 +626,7 @@ struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector) static int _intel_hdcp_disable(struct intel_connector *connector) { + struct intel_hdcp *hdcp = >hdcp; 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; @@ -641,7 +642,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; @@ -653,6 +654,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector) static int _intel_hdcp_enable(struct intel_connector *connector) { + struct intel_hdcp *hdcp = >hdcp; struct drm_i915_private *dev_priv = connector->base.dev->dev_private; int i, ret, tries = 3; @@ -678,7 +680,7 @@ 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) return 0; @@ -694,36 +696,42 @@ static int _intel_hdcp_enable(struct intel_connector *connector) static void intel_hdcp_check_work(struct work_struct *work) { - struct intel_connector *connector = container_of(to_delayed_work(work), + struct intel_hdcp *hdcp = container_of(to_delayed_work(work), + struct intel_hdcp, + hdcp_check_work); + struct intel_connector *connector = container_of(hdcp,
[PATCH v4 20/41] drm/i915: Define HDCP2.2 related variables
For upcoming implementation of HDCP2.2 in I915, important variable required for HDCP2.2 are defined. HDCP_shim is extended to support encoder specific HDCP2.2 flows. v2: 1.4 shim is extended to support hdcp2.2. [Sean Paul] platform's/panel's hdcp ver capability is removed. [Sean Paul] mei references in i915_private are moved to later patches. [Chris Wilson] v3: mei_cl_device ref is moved into intel_hdcp v4: Extra * in comment is removed [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_drv.h | 61 1 file changed, 61 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index df3a43e6b4d7..ac943ec73987 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "i915_drv.h" #include @@ -375,6 +376,32 @@ struct intel_hdcp_shim { /* Detects panel's hdcp capability. This is optional for HDMI. */ int (*hdcp_capable)(struct intel_digital_port *intel_dig_port, bool *hdcp_capable); + + /* Write HDCP2.2 messages */ + int (*write_2_2_msg)(struct intel_digital_port *intel_dig_port, +void *buf, size_t size); + + /* Read HDCP2.2 messages */ + int (*read_2_2_msg)(struct intel_digital_port *intel_dig_port, + uint8_t msg_id, void *buf, size_t size); + + /* +* Implementation of DP HDCP2.2 Errata for the communication of stream +* type to Receivers. In DP HDCP2.2 Stream type is one of the input to +* the HDCP2.2 Chiper for En/De-Cryption. Not applicable for HDMI. +*/ + int (*config_stream_type)(struct intel_digital_port *intel_dig_port, + void *buf, size_t size); + + /* HDCP2.2 Link Integrity Check */ + int (*check_2_2_link)(struct intel_digital_port *intel_dig_port); + + /* Detects whether Panel is HDCP2.2 capable */ + int (*hdcp_2_2_capable)(struct intel_digital_port *intel_dig_port, + bool *capable); + + /* Detects the HDCP protocol(DP/HDMI) required on the port */ + enum hdcp_protocol (*hdcp_protocol)(void); }; struct intel_hdcp { @@ -383,6 +410,40 @@ struct intel_hdcp { uint64_t hdcp_value; /* protected by hdcp_mutex */ struct delayed_work hdcp_check_work; struct work_struct hdcp_prop_work; + + /* HDCP2.2 related definitions */ + bool hdcp2_supported; + + /* +* Content Stream Type defined by content owner. TYPE0(0x0) content can +* flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1) +* content can flow only through a link protected by HDCP2.2. +*/ + u8 content_type; + + bool is_paired; + bool is_repeater; + + /* +* Count of ReceiverID_List received. Initialized to 0 at AKE_INIT. +* Incremented after processing the RepeaterAuth_Send_ReceiverID_List. +* When it rolls over re-auth has to be triggered. +*/ + uint32_t seq_num_v; + + /* +* Count of RepeaterAuth_Stream_Manage msg propagated. +* Initialized to 0 on AKE_INIT. Incremented after every successful +* transmission of RepeaterAuth_Stream_Manage message. When it rolls +* over re-Auth has to be triggered. +*/ + uint32_t seq_num_m; + + /* mei interface related information */ + struct mei_cl_device *cldev; + struct mei_hdcp_data mei_data; + + struct delayed_work hdcp2_check_work; }; struct intel_connector { -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 18/41] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session
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. v2: Rebased. v3: cldev is passed as first parameter [Tomas] Redundant comments and cast are removed [Tomas] v4: %zd for ssize_t [Alexander] %s/return -1/return -EIO [Alexander] Style and typos fixed [Uma] Signed-off-by: Ramalingam C--- drivers/misc/mei/hdcp/mei_hdcp.c | 56 include/linux/mei_hdcp.h | 7 + 2 files changed, 63 insertions(+) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index cbd3a8a3ae3e..34292e279f8a 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -682,6 +682,62 @@ int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, } EXPORT_SYMBOL(mei_enable_hdcp_authentication); +/* + * mei_close_hdcp_session: + * Function to close the Wired HDCP Tx session of ME FW. + * This also disables the authenticated state of the port. + * + * data: Intel HW specific Data + * + * Returns 0 on Success, <0 on Failure + */ +int mei_close_hdcp_session(struct mei_cl_device *cldev, + struct mei_hdcp_data *data) +{ + struct wired_cmd_close_session_in session_close_in = { { 0 } }; + struct wired_cmd_close_session_out session_close_out = { { 0 } }; + struct device *dev; + ssize_t byte; + + if (!data) + return -EINVAL; + + dev = >dev; + + session_close_in.header.api_version = HDCP_API_VERSION; + session_close_in.header.command_id = WIRED_CLOSE_SESSION; + session_close_in.header.status = ME_HDCP_STATUS_SUCCESS; + session_close_in.header.buffer_len = + WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN; + + session_close_in.port.integrated_port_type = data->port_type; + session_close_in.port.physical_port = data->port; + + + byte = mei_cldev_send(cldev, (u8 *)_close_in, + sizeof(session_close_in)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte); + return byte; + } + + byte = mei_cldev_recv(cldev, (u8 *)_close_out, + sizeof(session_close_out)); + if (byte < 0) { + dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte); + return byte; + } + + if (session_close_out.header.status != ME_HDCP_STATUS_SUCCESS) { + dev_dbg(dev, "Session Close Failed. status: 0x%X\n", + session_close_out.header.status); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(mei_close_hdcp_session); + static void mei_cldev_state_notify_clients(struct mei_cl_device *cldev, bool enabled) { diff --git a/include/linux/mei_hdcp.h b/include/linux/mei_hdcp.h index e6b6f9ace0c2..43bd81488a3a 100644 --- a/include/linux/mei_hdcp.h +++ b/include/linux/mei_hdcp.h @@ -139,6 +139,8 @@ int mei_verify_mprime(struct mei_cl_device *cldev, struct mei_hdcp_data *data, struct hdcp2_rep_stream_ready *stream_ready); int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, struct mei_hdcp_data *data); +int mei_close_hdcp_session(struct mei_cl_device *cldev, + struct mei_hdcp_data *data); #else static inline int mei_cldev_register_notify(struct notifier_block *nb) { @@ -221,5 +223,10 @@ static inline int mei_enable_hdcp_authentication(struct mei_cl_device *cldev, { return -ENODEV; } +static inline int mei_close_hdcp_session(struct mei_cl_device *cldev, +struct mei_hdcp_data *data) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_INTEL_MEI_HDCP) */ #endif /* defined (_LINUX_MEI_HDCP_H) */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 21/41] drm/i915: Define Intel HDCP2.2 registers
Intel HDCP2.2 registers are defined with addr offsets and bit details. v2: Replaced the arith calc with _PICK [Sean Paul] v3: No changes. v4: %s/HDCP2_CTR_DDI/HDCP2_CTL_DDI [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/i915_reg.h | 32 1 file changed, 32 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index fb106026a1f4..8a0da35718aa 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -8539,6 +8539,38 @@ enum skl_power_gate { #define HDCP_STATUS_CIPHERBIT(16) #define HDCP_STATUS_FRAME_CNT(x) ((x >> 8) & 0xff) +/* HDCP2.2 Registers */ +#define _PORTA_HDCP2_BASE 0x66800 +#define _PORTB_HDCP2_BASE 0x66500 +#define _PORTC_HDCP2_BASE 0x66600 +#define _PORTD_HDCP2_BASE 0x66700 +#define _PORTE_HDCP2_BASE 0x66A00 +#define _PORTF_HDCP2_BASE 0x66900 +#define _PORT_HDCP2_BASE(port, x) _MMIO(_PICK(port, \ + _PORTA_HDCP2_BASE, \ + _PORTB_HDCP2_BASE, \ + _PORTC_HDCP2_BASE, \ + _PORTD_HDCP2_BASE, \ + _PORTE_HDCP2_BASE, \ + _PORTF_HDCP2_BASE) + x) + +#define HDCP2_AUTH_DDI(port) _PORT_HDCP2_BASE(port, 0x98) +#define AUTH_LINK_AUTHENTICATED BIT(31) +#define AUTH_LINK_TYPE BIT(30) +#define AUTH_FORCE_CLR_INPUTCTR BIT(19) +#define AUTH_CLR_KEYSBIT(18) + +#define HDCP2_CTL_DDI(port)_PORT_HDCP2_BASE(port, 0xB0) +#define CTL_LINK_ENCRYPTION_REQ BIT(31) + +#define HDCP2_STATUS_DDI(port) _PORT_HDCP2_BASE(port, 0xB4) +#define STREAM_ENCRYPTION_STATUS_A BIT(31) +#define STREAM_ENCRYPTION_STATUS_B BIT(30) +#define STREAM_ENCRYPTION_STATUS_C BIT(29) +#define LINK_TYPE_STATUS BIT(22) +#define LINK_AUTH_STATUS BIT(21) +#define LINK_ENCRYPTION_STATUS BIT(20) + /* Per-pipe DDI Function Control */ #define _TRANS_DDI_FUNC_CTL_A 0x60400 #define _TRANS_DDI_FUNC_CTL_B 0x61400 -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 29/41] drm/i915: Pullout the bksv read and validation
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. v2: Rebased. v3: No Changes. v4: inline tag is removed with modified error msg. Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 37 + 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 61e1aa8ea26e..f3f935046c31 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -404,6 +404,28 @@ int intel_hdcp_validate_v_prime(struct intel_digital_port *intel_dig_port, return 0; } +static +int intel_hdcp_read_valid_bksv(struct intel_digital_port *intel_dig_port, + const struct intel_hdcp_shim *shim, u8 *bksv) +{ + int ret, i, tries = 2; + + /* HDCP spec states that we must retry the bksv if it is invalid */ + for (i = 0; i < tries; i++) { + ret = shim->read_bksv(intel_dig_port, bksv); + if (ret) + return ret; + if (intel_hdcp_is_ksv_valid(bksv)) + break; + } + if (i == tries) { + DRM_ERROR("Bksv is invalid\n"); + return -ENODEV; + } + + return 0; +} + /* Implements Part 2 of the HDCP authorization procedure */ static int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port, @@ -537,18 +559,9 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port, memset(, 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 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 30/41] drm/i915: Initialize HDCP2.2 and its MEI interface
Initialize HDCP2.2 support. This includes the mei interface initialization along with required notifier registration. v2: mei interface handle is protected with mutex. [Chris Wilson] v3: Notifiers are used for the mei interface state. v4: Poll for mei client device state Error msg for out of mem [Uma] Inline req for init function removed [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_hdcp.c | 117 +- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 122 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 62f82c4298ac..276eb49113e9 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -6368,7 +6368,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, intel_dp_add_properties(intel_dp, connector); if (is_hdcp_supported(dev_priv, port) && !intel_dp_is_edp(intel_dp)) { - int ret = intel_hdcp_init(intel_connector, _dp_hdcp_shim); + int ret = intel_hdcp_init(intel_connector, _dp_hdcp_shim, + false); 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 ac943ec73987..750fc19f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -442,7 +442,7 @@ struct intel_hdcp { /* mei interface related information */ struct mei_cl_device *cldev; struct mei_hdcp_data mei_data; - + struct notifier_block mei_cldev_nb; struct delayed_work hdcp2_check_work; }; @@ -1940,7 +1940,8 @@ void intel_hdcp_atomic_check(struct drm_connector *connector, struct drm_connector_state *old_state, struct drm_connector_state *new_state); int intel_hdcp_init(struct intel_connector *connector, - const struct intel_hdcp_shim *hdcp_shim); + const struct intel_hdcp_shim *hdcp_shim, + bool hdcp2_supported); int intel_hdcp_enable(struct intel_connector *connector); int intel_hdcp_disable(struct intel_connector *connector); int intel_hdcp_check_link(struct intel_connector *connector); diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index f3f935046c31..9948e4b4e203 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "intel_drv.h" #include "i915_reg.h" @@ -25,6 +26,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector); static int _intel_hdcp2_disable(struct intel_connector *connector); static void intel_hdcp2_check_work(struct work_struct *work); static int intel_hdcp2_check_link(struct intel_connector *connector); +static int intel_hdcp2_init(struct intel_connector *connector); static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) @@ -766,11 +768,15 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port) } int intel_hdcp_init(struct intel_connector *connector, - const struct intel_hdcp_shim *hdcp_shim) + const struct intel_hdcp_shim *hdcp_shim, + bool hdcp2_supported) { struct intel_hdcp *hdcp = >hdcp; int ret; + if (!hdcp_shim) + return -EINVAL; + ret = drm_connector_attach_content_protection_property( >base); if (ret) @@ -779,7 +785,12 @@ int intel_hdcp_init(struct intel_connector *connector, hdcp->hdcp_shim = hdcp_shim; mutex_init(>hdcp_mutex); INIT_DELAYED_WORK(>hdcp_check_work, intel_hdcp_check_work); + INIT_DELAYED_WORK(>hdcp2_check_work, intel_hdcp2_check_work); INIT_WORK(>hdcp_prop_work, intel_hdcp_prop_work); + + if (hdcp2_supported) + intel_hdcp2_init(connector); + return 0; } @@ -1637,3 +1648,107 @@ static void intel_hdcp2_check_work(struct work_struct *work) schedule_delayed_work(>hdcp2_check_work, DRM_HDCP2_CHECK_PERIOD_MS); } + +static int initialize_mei_hdcp_data(struct intel_connector *connector) +{ + struct intel_hdcp *hdcp = >hdcp; + struct mei_hdcp_data *data = >mei_data; + enum port port; + + if (connector->encoder) { + port = connector->encoder->port; + data->port = GET_MEI_DDI_INDEX(port); + } + + data->port_type = INTEGRATED; + data->protocol = hdcp->hdcp_shim->hdcp_protocol(); + + data->k = 1; + if
[PATCH v4 28/41] drm/i915: Handle HDCP2.2 downstream topology change
When repeater notifies a downstream topology change, this patch reauthenticate the repeater alone without disabling the hdcp encryption. If that fails then complete reauthentication is executed. v2: Rebased. v3: No Changes. v4: Typo in commit msg is fixed [Uma] Signed-off-by: Ramalingam CReviewed-by: Uma Shankar --- drivers/gpu/drm/i915/intel_hdcp.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index a0f97a980606..61e1aa8ea26e 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -1567,8 +1567,23 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) goto out; } - DRM_INFO("[%s:%d] HDCP2.2 link failed, retrying authentication\n", -connector->base.name, connector->base.base.id); + if (ret == DRM_HDCP_TOPOLOGY_CHANGE) { + if (hdcp->hdcp_value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) + goto out; + + DRM_DEBUG_KMS("HDCP2.2 Downstream topology change\n"); + ret = hdcp2_authenticate_repeater_topology(connector); + if (!ret) { + hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; + schedule_work(>hdcp_prop_work); + goto out; + } + DRM_ERROR("[%s:%d] Repeater topology auth failed.(%d)\n", + connector->base.name, connector->base.base.id, ret); + } else { + DRM_ERROR("[%s:%d] HDCP2.2 link failed, retrying auth\n", +connector->base.name, connector->base.base.id); + } ret = _intel_hdcp2_disable(connector); if (ret) { -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 27/41] drm/i915: Implement HDCP2.2 link integrity check
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. v2: Rebased. v3: No Changes. v4: enum check_link_response is used check the link status [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 82 ++- include/drm/drm_hdcp.h| 8 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index ede5bf38ca12..a0f97a980606 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -23,6 +23,8 @@ static int _intel_hdcp2_enable(struct intel_connector *connector); static int _intel_hdcp2_disable(struct intel_connector *connector); +static void intel_hdcp2_check_work(struct work_struct *work); +static int intel_hdcp2_check_link(struct intel_connector *connector); static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) @@ -1526,6 +1528,84 @@ static int _intel_hdcp2_enable(struct intel_connector *connector) hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; schedule_work(>hdcp_prop_work); - + schedule_delayed_work(>hdcp2_check_work, + DRM_HDCP2_CHECK_PERIOD_MS); return 0; } + +static int intel_hdcp2_check_link(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_hdcp *hdcp = >hdcp; + enum port port = connector->encoder->port; + int ret = 0; + + if (!hdcp->hdcp_shim) + return -ENOENT; + + mutex_lock(>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_prop_work); + goto out; + } + + ret = hdcp->hdcp_shim->check_2_2_link(intel_dig_port); + if (ret == DRM_HDCP_LINK_PROTECTED) { + if (hdcp->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { + hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; + schedule_work(>hdcp_prop_work); + } + goto out; + } + + DRM_INFO("[%s:%d] HDCP2.2 link failed, retrying authentication\n", +connector->base.name, connector->base.base.id); + + ret = _intel_hdcp2_disable(connector); + if (ret) { + DRM_ERROR("[%s:%d] Failed to disable hdcp2.2 (%d)\n", + connector->base.name, connector->base.base.id, ret); + + hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(>hdcp_prop_work); + goto out; + } + + ret = _intel_hdcp2_enable(connector); + if (ret) { + DRM_ERROR("[%s:%d] Failed to enable hdcp2.2 (%d)\n", + connector->base.name, connector->base.base.id, ret); + + hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(>hdcp_prop_work); + goto out; + } + +out: + mutex_unlock(>hdcp_mutex); + + return ret; +} + +static void intel_hdcp2_check_work(struct work_struct *work) +{ + struct intel_hdcp *hdcp = container_of(to_delayed_work(work), + struct intel_hdcp, + hdcp2_check_work); + struct intel_connector *connector = container_of(hdcp, + struct intel_connector, + hdcp); + + if (!intel_hdcp2_check_link(connector)) + schedule_delayed_work(>hdcp2_check_work, + DRM_HDCP2_CHECK_PERIOD_MS); +} diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index 6ce9f9d432dc..dcf719f356d8 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)
[PATCH v4 25/41] drm/i915: Enable and Disable HDCP2.2 port encryption
Implements the enable and disable functions for HDCP2.2 encryption of the PORT. v2: intel_wait_for_register is used instead of wait_for. [Chris Wilson] v3: No Changes. v4: Debug msg is added for timeout at Disable of Encryption [Uma] %s/HDCP2_CTL/HDCP2_CTL Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 57 +++ 1 file changed, 57 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index bd0bfcfd5b8f..0386a67c3e32 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -19,6 +19,7 @@ (enum hdcp_physical_port) (port)) #define KEY_LOAD_TRIES 5 #define HDCP2_LC_RETRY_CNT 3 +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) @@ -1397,3 +1398,59 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector) return ret; } + +static int hdcp2_enable_encryption(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_hdcp *hdcp = >hdcp; + enum port port = connector->encoder->port; + int ret; + + if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS) + return 0; + + if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling(intel_dig_port, true); + + if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) { + + /* Link is Authenticated. Now set for Encryption */ + I915_WRITE(HDCP2_CTL_DDI(port), + I915_READ(HDCP2_CTL_DDI(port)) | + CTL_LINK_ENCRYPTION_REQ); + } + + ret = intel_wait_for_register(dev_priv, HDCP2_STATUS_DDI(port), + LINK_ENCRYPTION_STATUS, + LINK_ENCRYPTION_STATUS, + TIME_FOR_ENCRYPT_STATUS_CHANGE); + + return ret; +} + +static int hdcp2_disable_encryption(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_hdcp *hdcp = >hdcp; + enum port port = connector->encoder->port; + int ret; + + if (!(I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS)) + return 0; + + I915_WRITE(HDCP2_CTL_DDI(port), + I915_READ(HDCP2_CTL_DDI(port)) & ~CTL_LINK_ENCRYPTION_REQ); + + ret = intel_wait_for_register(dev_priv, HDCP2_STATUS_DDI(port), + LINK_ENCRYPTION_STATUS, 0x0, + TIME_FOR_ENCRYPT_STATUS_CHANGE); + if (ret == -ETIMEDOUT) + DRM_DEBUG_KMS("Disable Encryption Timedout"); + + if (hdcp->hdcp_shim->toggle_signalling) + hdcp->hdcp_shim->toggle_signalling(intel_dig_port, false); + + return ret; +} -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 26/41] drm/i915: Implement HDCP2.2 En/Dis-able
Implements a sequence of enabling and disabling the HDCP2.2 (auth and encryption). v2: Rebased. v3: No Changes. v4: No Changes. Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 75 +++ 1 file changed, 75 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 0386a67c3e32..ede5bf38ca12 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -21,6 +21,9 @@ #define HDCP2_LC_RETRY_CNT 3 #define TIME_FOR_ENCRYPT_STATUS_CHANGE 32 +static int _intel_hdcp2_enable(struct intel_connector *connector); +static int _intel_hdcp2_disable(struct intel_connector *connector); + static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port, const struct intel_hdcp_shim *shim) { @@ -1454,3 +1457,75 @@ static int hdcp2_disable_encryption(struct intel_connector *connector) return ret; } + +static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector) +{ + int ret, i, tries = 3; + + for (i = 0; i < tries; i++) { + ret = hdcp2_authenticate_sink(connector); + if (!ret) + break; + + /* Clearing the mei hdcp session */ + hdcp2_deauthenticate_port(>hdcp); + DRM_DEBUG_KMS("HDCP2.2 Auth %d of %d Failed.(%d)\n", + i + 1, tries, ret); + } + + if (i != tries) { + + /* +* Ensuring the required 200mSec min time interval between +* Session Key Exchange and encryption. +*/ + msleep(HDCP_2_2_DELAY_BEFORE_ENCRYPTION_EN); + ret = hdcp2_enable_encryption(connector); + if (ret < 0) { + DRM_DEBUG_KMS("Encryption Enable Failed.(%d)\n", ret); + hdcp2_deauthenticate_port(>hdcp); + } + } + + return ret; +} + +static int _intel_hdcp2_disable(struct intel_connector *connector) +{ + int ret; + + DRM_DEBUG_KMS("[%s:%d] HDCP2.2 is being Disabled\n", + connector->base.name, connector->base.base.id); + + ret = hdcp2_disable_encryption(connector); + + hdcp2_deauthenticate_port(>hdcp); + + return ret; +} + +static int _intel_hdcp2_enable(struct intel_connector *connector) +{ + struct intel_hdcp *hdcp = >hdcp; + int ret; + + DRM_DEBUG_KMS("[%s:%d] HDCP2.2 is being enabled. Type: %d\n", + connector->base.name, connector->base.base.id, + hdcp->content_type); + + ret = hdcp2_authenticate_and_encrypt(connector); + if (ret) { + DRM_ERROR("HDCP2 Type%d Enabling Failed. (%d)\n", + hdcp->content_type, ret); + return ret; + } + + DRM_DEBUG_KMS("[%s:%d] HDCP2.2 is enabled. Type %d\n", + connector->base.name, connector->base.base.id, + hdcp->content_type); + + hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; + schedule_work(>hdcp_prop_work); + + return 0; +} -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 24/41] drm/i915: Implement HDCP2.2 repeater authentication
Implements the HDCP2.2 repeaters authentication steps such as verifying the downstream topology and sending stream management information. v2: Rebased. v3: No Changes. v4: -EINVAL is returned for topology error and rollover scenario. Endianness conversion func from drm_hdcp.h is used [Uma] Signed-off-by: Ramalingam C--- drivers/gpu/drm/i915/intel_hdcp.c | 120 ++ 1 file changed, 120 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index fa5cbad8afc6..bd0bfcfd5b8f 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -1226,6 +1226,120 @@ static int hdcp2_session_key_exchange(struct intel_connector *connector) return 0; } +static +int hdcp2_propagate_stream_management_info(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct intel_hdcp *hdcp = >hdcp; + union { + struct hdcp2_rep_stream_manage stream_manage; + struct hdcp2_rep_stream_ready stream_ready; + } msgs; + const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; + int ret; + + /* Prepare RepeaterAuth_Stream_Manage msg */ + msgs.stream_manage.msg_id = HDCP_2_2_REP_STREAM_MANAGE; + reverse_endianness(msgs.stream_manage.seq_num_m, HDCP_2_2_SEQ_NUM_LEN, + (u8 *)>seq_num_m); + + /* K no of streams is fixed as 1. Stored as big-endian. */ + msgs.stream_manage.k = __swab16(1); + + /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */ + msgs.stream_manage.streams[0].stream_id = 0; + msgs.stream_manage.streams[0].stream_type = hdcp->content_type; + + /* Send it to Repeater */ + ret = shim->write_2_2_msg(intel_dig_port, _manage, + sizeof(msgs.stream_manage)); + if (ret < 0) + return ret; + + ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_REP_STREAM_READY, +_ready, sizeof(msgs.stream_ready)); + if (ret < 0) + return ret; + + hdcp->mei_data.seq_num_m = hdcp->seq_num_m; + hdcp->mei_data.streams[0].stream_type = hdcp->content_type; + + ret = hdcp2_verify_mprime(hdcp, _ready); + if (ret < 0) + return ret; + + hdcp->seq_num_m++; + + if (hdcp->seq_num_m > HDCP_2_2_SEQ_NUM_MAX) { + DRM_DEBUG_KMS("seq_num_m roll over.\n"); + return -1; + } + + return 0; +} + +static +int hdcp2_authenticate_repeater_topology(struct intel_connector *connector) +{ + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + struct intel_hdcp *hdcp = >hdcp; + union { + struct hdcp2_rep_send_receiverid_list recvid_list; + struct hdcp2_rep_send_ack rep_ack; + } msgs; + const struct intel_hdcp_shim *shim = hdcp->hdcp_shim; + uint8_t *rx_info; + uint32_t seq_num_v; + int ret; + + ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_REP_SEND_RECVID_LIST, +_list, sizeof(msgs.recvid_list)); + if (ret < 0) + return ret; + + rx_info = msgs.recvid_list.rx_info; + + if (HDCP_2_2_MAX_CASCADE_EXCEEDED(rx_info[1]) || + HDCP_2_2_MAX_DEVS_EXCEEDED(rx_info[1])) { + DRM_DEBUG_KMS("Topology Max Size Exceeded\n"); + return -EINVAL; + } + + /* Converting and Storing the seq_num_v to local variable as DWORD */ + reverse_endianness((u8 *)_num_v, HDCP_2_2_SEQ_NUM_LEN, + msgs.recvid_list.seq_num_v); + + if (seq_num_v < hdcp->seq_num_v) { + /* Roll over of the seq_num_v from repeater. Reauthenticate. */ + DRM_DEBUG_KMS("Seq_num_v roll over.\n"); + return -EINVAL; + } + + ret = hdcp2_verify_rep_topology_prepare_ack(hdcp, _list, + _ack); + if (ret < 0) + return ret; + + hdcp->seq_num_v = seq_num_v; + ret = shim->write_2_2_msg(intel_dig_port, _ack, + sizeof(msgs.rep_ack)); + if (ret < 0) + return ret; + + return 0; +} + +static int hdcp2_authenticate_repeater(struct intel_connector *connector) +{ + int ret; + + ret = hdcp2_authenticate_repeater_topology(connector); + if (ret < 0) + return ret; + + return hdcp2_propagate_stream_management_info(connector); +} + static int hdcp2_authenticate_sink(struct intel_connector *connector) { struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); @@ -1268,6 +1382,12 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector)
[PATCH v4 31/41] drm/i915: Schedule hdcp_check_link in _intel_hdcp_enable
As a preparation for making the intel_hdcp_enable as common function for both HDCP1.4 and HDCP2.2, HDCP1.4 check_link scheduling is moved into _intel_hdcp_enable() function. v3: No Changes. v4: Style fix. Signed-off-by: Ramalingam CReviewed-by: Uma Shankar --- drivers/gpu/drm/i915/intel_hdcp.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 9948e4b4e203..5b14e3668bc5 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -707,7 +707,7 @@ static int _intel_hdcp_enable(struct intel_connector *connector) ret = intel_hdcp_auth(conn_to_dig_port(connector), hdcp->hdcp_shim); if (!ret) - return 0; + break; DRM_DEBUG_KMS("HDCP Auth failure (%d)\n", ret); @@ -715,7 +715,13 @@ static int _intel_hdcp_enable(struct intel_connector *connector) _intel_hdcp_disable(connector); } - DRM_ERROR("HDCP authentication failed (%d tries/%d)\n", tries, ret); + if (i != tries) + schedule_delayed_work(>hdcp_check_work, + DRM_HDCP_CHECK_PERIOD_MS); + else + DRM_ERROR("HDCP authentication failed (%d tries/%d)\n", + tries, ret); + return ret; } @@ -810,8 +816,6 @@ int intel_hdcp_enable(struct intel_connector *connector) hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED; schedule_work(>hdcp_prop_work); - schedule_delayed_work(>hdcp_check_work, - DRM_HDCP_CHECK_PERIOD_MS); out: mutex_unlock(>hdcp_mutex); return ret; -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 33/41] drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure
When HDCP2.2 enabling fails and HDCP1.4 is supported, HDCP1.4 is enabled. v2: Rebased. v3: No Changes. v4: Reviewed-by is collected. Signed-off-by: Ramalingam CReviewed-by: Uma Shankar --- drivers/gpu/drm/i915/intel_hdcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index f53b496073ea..c5a3e0e52853 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -868,7 +868,9 @@ int intel_hdcp_enable(struct intel_connector *connector) */ if (intel_hdcp2_capable(connector)) ret = _intel_hdcp2_enable(connector); - else if (intel_hdcp_capable(connector)) + + /* When HDCP2.2 fails, HDCP1.4 will be attempted */ + if (ret && intel_hdcp_capable(connector)) ret = _intel_hdcp_enable(connector); if (!ret) { -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v3 38/40] drm/i915: Implement the HDCP2.2 support for HDMI
On Friday 18 May 2018 09:59 PM, Shankar, Uma wrote: -Original Message- From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of Ramalingam C Sent: Tuesday, April 3, 2018 7:28 PM To: intel-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; seanp...@chromium.org; dan...@ffwll.ch; ch...@chris-wilson.co.uk; jani.nik...@linux.intel.com; Winkler, Tomas; Usyskin, Alexander Cc: Vivi, Rodrigo Subject: [Intel-gfx] [PATCH v3 38/40] drm/i915: Implement the HDCP2.2 support for HDMI Implements the HDMI adapatation specific HDCP2.2 operations. Typo in adaptation. Basically these are DDC read and write for authenticating through HDCP2.2 messages. v2: Rebased. v3: No Changes. Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/intel_hdmi.c | 203 ++ 1 file changed, 203 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index b8b1086c0cbd..a974d3e2097a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1106,6 +1107,203 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port) return true; } +static +int intel_hdmi_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port, + uint8_t *rx_status) +{ + return intel_hdmi_hdcp_read(intel_dig_port, + HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET, + rx_status, + HDCP_2_2_HDMI_RXSTATUS_LEN); +} + +static inline Don’t make it inline. +int intel_hdmi_hdcp2_timeout_for_msg(uint8_t msg_id, bool is_paired) { + int timeout = -EINVAL; Make it more appropriate. Moved the assignment to default. + + switch (msg_id) { + case HDCP_2_2_AKE_SEND_CERT: + timeout = HDCP_2_2_CERT_TIMEOUT; + break; + case HDCP_2_2_AKE_SEND_HPRIME: + if (is_paired) + timeout = HDCP_2_2_HPRIME_PAIRED_TIMEOUT; + else + timeout = HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT; + break; + case HDCP_2_2_AKE_SEND_PARING_INFO: + timeout = HDCP_2_2_PAIRING_TIMEOUT; + break; + case HDCP_2_2_LC_SEND_LPRIME: + timeout = HDCP_2_2_HDMI_LPRIME_TIMEOUT; + break; + case HDCP_2_2_REP_SEND_RECVID_LIST: + timeout = HDCP_2_2_RECVID_LIST_TIMEOUT; + break; + case HDCP_2_2_REP_STREAM_READY: + timeout = HDCP_2_2_STREAM_READY_TIMEOUT; + break; + default: + DRM_ERROR("Unsupported msg_id: %d\n", (int)msg_id); + } Leave a blank line. + return timeout; +} + +static inline +int hdcp2_detect_msg_availability(struct intel_digital_port *intel_digital_port, + uint8_t msg_id, bool *msg_ready, + ssize_t *msg_sz) +{ + uint8_t rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN]; + int ret; + + ret = intel_hdmi_hdcp2_read_rx_status(intel_digital_port, rx_status); + if (ret < 0) { + DRM_DEBUG_KMS("rx_status read failed. Err %d\n", ret); + return ret; + } + + *msg_sz = ((HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(rx_status[1]) << 8) | + rx_status[0]); + + if (msg_id == HDCP_2_2_REP_SEND_RECVID_LIST) + *msg_ready = (HDCP_2_2_HDMI_RXSTATUS_READY(rx_status[1]) && +*msg_sz); + else + *msg_ready = *msg_sz; + + return 0; +} + +/** Drop the extra "*". + * 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, _ready, _sz), Read it separately to simplify this. __wait_for do the OPs send as first parameter in a freq for the timeout mentioned. On each iteration it check for the condition passed as second parameter. So I guess, this needs to be this way, unless we decide to use the macros for OP and COND. +!ret && msg_ready &&
[Bug 199781] nouveau: cannot boot without nouveau.modeset=0 and cannot use HDMI output
https://bugzilla.kernel.org/show_bug.cgi?id=199781 --- Comment #3 from Frédéric Pierret (frederic.epi...@orange.fr) --- Thank for your answer. Some progress but now freeze with two type of errors: May 21 14:51:58 dom0 kernel: [ cut here ] May 21 14:51:58 dom0 kernel: nouveau :01:00.0: timeout May 21 14:51:58 dom0 kernel: WARNING: CPU: 5 PID: 5140 at /home/user/rpmbuild/BUILD/kernel-latest-4.16.9/linux-4.16.9/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgf100.c:207 gf100_vmm_flush_+0x150/0x190 [nouveau] May 21 14:51:58 dom0 kernel: Modules linked in: loop ebtable_filter ebtables ip6table_filter ip6_tables dcdbas dell_wmi_descriptor snd_hda_codec_hdmi joydev snd_hda_codec_realtek ath10k_pci snd_hda_codec_generic btusb btrtl btbcm btintel hid_multitouch ath10k_core bluetooth uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 iTCO_wdt iTCO_vendor_support mac80211 videobuf2_common snd_hda_intel ecdh_generic ath videodev snd_hda_codec intel_rapl media snd_hda_core x86_pkg_temp_thermal snd_hwdep intel_powerclamp coretemp snd_seq snd_seq_device snd_pcm intel_rapl_perf rtsx_pci_ms idma64 snd_timer cfg80211 acer_wmi pcspkr mei_me intel_wmi_thunderbolt sparse_keymap wmi_bmof r8169 intel_lpss_pci rfkill i2c_i801 snd memstick mii mei soundcore intel_pch_thermal intel_lpss tpm_crb tpm_tis pinctrl_sunrisepoint tpm_tis_core May 21 14:51:58 dom0 kernel: pinctrl_intel tpm xenfs dm_thin_pool dm_persistent_data libcrc32c dm_bio_prison dm_crypt crct10dif_pclmul crc32_pclmul rtsx_pci_sdmmc crc32c_intel mmc_core ghash_clmulni_intel nouveau serio_raw i915 mxm_wmi nvme ttm i2c_algo_bit xhci_pci drm_kms_helper nvme_core rtsx_pci xhci_hcd drm i2c_hid wmi video xen_acpi_processor xen_privcmd xen_pciback xen_blkback xen_gntalloc xen_gntdev xen_evtchn uinput May 21 14:51:58 dom0 kernel: CPU: 5 PID: 5140 Comm: Xorg Tainted: G U W 4.16.9-1.pvops.qubes.x86_64 #1 May 21 14:51:58 dom0 kernel: Hardware name: Acer Predator PH317-51/Sienna_KLS, BIOS V1.13 12/26/2017 May 21 14:51:58 dom0 kernel: RIP: e030:gf100_vmm_flush_+0x150/0x190 [nouveau] May 21 14:51:58 dom0 kernel: RSP: e02b:c900065b7870 EFLAGS: 00010286 May 21 14:51:58 dom0 kernel: RAX: RBX: 880180e8f790 RCX: 0006 May 21 14:51:58 dom0 kernel: RDX: 0007 RSI: 0001 RDI: 880186356930 May 21 14:51:58 dom0 kernel: RBP: 88017ba40400 R08: 00019e50 R09: 08e3 May 21 14:51:58 dom0 kernel: R10: 88017ab70d80 R11: 82998e0d R12: 880179d848a0 May 21 14:51:58 dom0 kernel: R13: 001660cae540 R14: 8001 R15: 88017a91d600 May 21 14:51:58 dom0 kernel: FS: 75cce49d5a40() GS:88018634() knlGS: May 21 14:51:58 dom0 kernel: CS: e033 DS: ES: CR0: 80050033 May 21 14:51:58 dom0 kernel: CR2: 75cce48b2000 CR3: 00017c55a000 CR4: 00042660 May 21 14:51:58 dom0 kernel: Call Trace: May 21 14:51:58 dom0 kernel: nvkm_vmm_unref_pdes+0x10f/0x1f0 [nouveau] May 21 14:51:58 dom0 kernel: nvkm_vmm_unref_ptes+0x4b/0x1d0 [nouveau] May 21 14:51:58 dom0 kernel: ? nv50_instobj_release+0x74/0xc0 [nouveau] May 21 14:51:58 dom0 kernel: nvkm_vmm_iter.constprop.11+0x282/0x850 [nouveau] May 21 14:51:58 dom0 kernel: ? nvkm_vmm_put_region+0x170/0x170 [nouveau] May 21 14:51:58 dom0 kernel: ? gf100_vmm_pgt_dma+0x2b0/0x2b0 [nouveau] May 21 14:51:58 dom0 kernel: nvkm_vmm_ptes_unmap_put+0x2e/0x40 [nouveau] May 21 14:51:58 dom0 kernel: ? gf100_vmm_pgt_dma+0x2b0/0x2b0 [nouveau] May 21 14:51:58 dom0 kernel: nvkm_vmm_put_locked+0x106/0x230 [nouveau] May 21 14:51:58 dom0 kernel: nvkm_uvmm_mthd+0x502/0x8b0 [nouveau] May 21 14:51:58 dom0 kernel: nvkm_ioctl+0x112/0x230 [nouveau] May 21 14:51:58 dom0 kernel: nvif_object_mthd+0xe3/0x130 [nouveau] May 21 14:51:58 dom0 kernel: ? __slab_free+0xb2/0x330 May 21 14:51:58 dom0 kernel: ? __slab_free+0xb2/0x330 May 21 14:51:58 dom0 kernel: nvif_vmm_put+0x5c/0x80 [nouveau] May 21 14:51:58 dom0 kernel: nouveau_vma_del+0x70/0xd0 [nouveau] May 21 14:51:58 dom0 kernel: nouveau_gem_object_close+0x182/0x240 [nouveau] May 21 14:51:58 dom0 kernel: ? drm_gem_handle_create+0x40/0x40 [drm] May 21 14:51:58 dom0 kernel: drm_gem_object_release_handle+0x2f/0x90 [drm] May 21 14:51:58 dom0 kernel: drm_gem_handle_delete+0x5b/0x90 [drm] May 21 14:51:58 dom0 kernel: ? drm_gem_handle_create+0x40/0x40 [drm] May 21 14:51:58 dom0 kernel: drm_ioctl_kernel+0x67/0xb0 [drm] May 21 14:51:58 dom0 kernel: drm_ioctl+0x2d7/0x370 [drm] May 21 14:51:58 dom0 kernel: ? drm_gem_handle_create+0x40/0x40 [drm] May 21 14:51:58 dom0 kernel: ? nvkm_ioctl+0x112/0x230 [nouveau] May 21 14:51:58 dom0 kernel: ? __check_object_size+0x98/0x1a0 May 21 14:51:58 dom0 kernel: nouveau_drm_ioctl+0x66/0xc0 [nouveau] May 21 14:51:58 dom0 kernel: do_vfs_ioctl+0xa2/0x620 May 21 14:51:58 dom0 kernel: ? __audit_syscall_entry+0xae/0x100 May 21 14:51:58 dom0 kernel: ? syscall_trace_enter+0x1ae/0x2c0 May 21 14:51:58 dom0 kernel:
[PATCH v4 41/41] drm/i915: Add HDCP2.2 support for HDMI connectors
On HDMI connector init, intel_hdcp_init is passed with a flag for hdcp2.2 support based on the platform capability. v2: Rebased. v3: No Changes. v4: Collected the reviewed-by received. Signed-off-by: Ramalingam CReviewed-by: Uma Shankar --- 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 042205e57e42..b796eab9897f 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -2520,7 +2520,8 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, if (is_hdcp_supported(dev_priv, port)) { int ret = intel_hdcp_init(intel_connector, - _hdmi_hdcp_shim, false); +_hdmi_hdcp_shim, +is_hdcp2_supported(dev_priv)); if (ret) DRM_DEBUG_KMS("HDCP init failed, skipping.\n"); } -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106589] HP w2207 monitor not waking from sleep
https://bugs.freedesktop.org/show_bug.cgi?id=106589 --- Comment #6 from Sylvain BERTRAND--- Created attachment 139665 --> https://bugs.freedesktop.org/attachment.cgi?id=139665=edit kernel log -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC 06/24] drm/lima: add lima uapi header
Qiang Yuwrites: > Signed-off-by: Qiang Yu > --- > include/uapi/drm/lima_drm.h | 195 > 1 file changed, 195 insertions(+) > create mode 100644 include/uapi/drm/lima_drm.h > > diff --git a/include/uapi/drm/lima_drm.h b/include/uapi/drm/lima_drm.h > new file mode 100644 > index ..9df95e46fb2c > --- /dev/null > +++ b/include/uapi/drm/lima_drm.h > @@ -0,0 +1,195 @@ > +/* > + * Copyright (C) 2017-2018 Lima Project Unless you've made some legal organization, your copyrights should probably be held by the individuals that wrote the code. It would be nice to have some comments explaining the API being described here. However, it does seem to follow our 32-vs-64 ABI rules, so it's in pretty good shape. > + * > + * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. > + */ > + > +#define LIMA_CTX_OP_CREATE 1 > +#define LIMA_CTX_OP_FREE 2 > + > +struct drm_lima_ctx { > + __u32 op; /* in */ > + __u32 id; /* in/out */ > +}; I would recommend separate ioctls for these, given that the implementations are totally separate. signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Xen-devel] [RFC 1/3] xen/balloon: Allow allocating DMA buffers
On 05/21/2018 07:35 PM, Boris Ostrovsky wrote: On 05/21/2018 01:40 AM, Oleksandr Andrushchenko wrote: On 05/19/2018 01:04 AM, Boris Ostrovsky wrote: On 05/17/2018 04:26 AM, Oleksandr Andrushchenko wrote: From: Oleksandr AndrushchenkoA commit message would be useful. Sure, v1 will have it Signed-off-by: Oleksandr Andrushchenko for (i = 0; i < nr_pages; i++) { - page = alloc_page(gfp); - if (page == NULL) { - nr_pages = i; - state = BP_EAGAIN; - break; + if (ext_pages) { + page = ext_pages[i]; + } else { + page = alloc_page(gfp); + if (page == NULL) { + nr_pages = i; + state = BP_EAGAIN; + break; + } } scrub_page(page); list_add(>lru, ); @@ -529,7 +565,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) i = 0; list_for_each_entry_safe(page, tmp, , lru) { /* XENMEM_decrease_reservation requires a GFN */ - frame_list[i++] = xen_page_to_gfn(page); + frames[i++] = xen_page_to_gfn(page); #ifdef CONFIG_XEN_HAVE_PVMMU /* @@ -552,18 +588,22 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) #endif list_del(>lru); - balloon_append(page); + if (!ext_pages) + balloon_append(page); So what you are proposing is not really ballooning. You are just piggybacking on existing interfaces, aren't you? Sort of. Basically I need to {increase|decrease}_reservation, not actually allocating ballooned pages. Do you think I can simply EXPORT_SYMBOL for {increase|decrease}_reservation? Any other suggestion? I am actually wondering how much of that code you end up reusing. You pretty much create new code paths in both routines and common code ends up being essentially the hypercall. Well, I hoped that it would be easier to maintain if I modify existing code to support both use-cases, but I am also ok to create new routines if this seems to be reasonable - please let me know So the question is --- would it make sense to do all of this separately from the balloon driver? This can be done, but which driver will host this code then? If we move from the balloon driver, then this could go to either gntdev or grant-table. What's your preference? -boris Thank you, Oleksandr ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930
https://bugs.freedesktop.org/show_bug.cgi?id=105760 --- Comment #10 from taij...@posteo.de --- This seems to be fixed an the current drm-next-4.18-wip branch. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 105500] AMD Richland (ARUBA) no screen at DP output when using three displays
https://bugs.freedesktop.org/show_bug.cgi?id=105500 --- Comment #5 from Balázs Vinarz--- GCN2 based APUs are not affected with none AMDGPU or Radeon kernel modules. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106402] amdgpu causes kernel Oops: 0002 [#1] SMP PTI
https://bugs.freedesktop.org/show_bug.cgi?id=106402 --- Comment #4 from taij...@posteo.de --- to get a kernel log from a previous boot attempt, try something like: journalctl -kb -1 > error.log where -1 would be the previous boot, -2 the one before that, etc. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v8 2/3] drm: writeback: Add out-fences for writeback connectors
Liviu Dudauwrites: > From: Brian Starkey > > Add the WRITEBACK_OUT_FENCE_PTR property to writeback connectors, to > enable userspace to get a fence which will signal once the writeback is > complete. It is not allowed to request an out-fence without a > framebuffer attached to the connector. > > A timeline is added to drm_writeback_connector for use by the writeback > out-fences. > diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h > index cf3a28676006a..6a7462c1821ad 100644 > --- a/include/drm/drm_writeback.h > +++ b/include/drm/drm_writeback.h > @@ -49,6 +49,32 @@ struct drm_writeback_connector { >* drm_writeback_signal_completion() >*/ > struct list_head job_queue; > + > + /** > + * @fence_context: > + * > + * timeline context used for fence operations. > + */ > + unsigned int fence_context; > + /** > + * @fence_lock: > + * > + * spinlock to protect the fences in the fence_context. > + */ > + spinlock_t fence_lock; > + /** > + * @fence_seqno: > + * > + * Seqno variable used as monotonic counter for the fences > + * created on the connector's timeline. > + */ > + unsigned long fence_seqno; > + /** > + * @timeline_name: > + * > + * The name of the connector's fence timeline. > + */ > + char timeline_name[32]; > }; > > struct drm_writeback_job { > @@ -59,12 +85,14 @@ struct drm_writeback_job { >* framebuffer reference to a workqueue. >*/ > struct work_struct cleanup_work; > + > /** >* @list_entry: >* >* List item for the connector's @job_queue >*/ > struct list_head list_entry; > + > /** >* @fb: >* Move this hunk into patch 1? Other than that, the series is: Reviewed-by: Eric Anholt It's pretty clean and makes sense to me. I only had some questions about the job_queue, which seems superfluous if we aren't supporting firing off a new writeback while an old one is outstanding (and maybe we should throw an error in that case). Still, I think this is ready to land. signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC 05/24] Revert "drm: Nerf the preclose callback for modern drivers"
Qiang Yuwrites: > This reverts commit 45c3d213a400c952ab7119f394c5293bb6877e6b. > > lima driver need preclose to wait all task in the context > created within closing file to finish before free all the > buffer object. Otherwise pending tesk may fail and get > noisy MMU fault message. > > Move this wait to each buffer object free function can > achieve the same result but some buffer object is shared > with other file context, but we only want to wait the > closing file context's tasks. So the implementation is > not that straight forword compared to the preclose one. You should just separate your MMU structures from drm_file, and have drm_file and the jobs using it keep a reference on them. This is what I've done in V3D as well. signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 101262] Need help in running Dying Light
https://bugs.freedesktop.org/show_bug.cgi?id=101262 --- Comment #6 from Mariusz Ceier--- That bug is due to missing /usr/bin/lspci. Dying Light tries to execve /usr/bin/lspci in a fork and when it fails it calls exit function instead of _exit. exit calls exit handler registered by mesa which causes the segmentation fault and 'hangup' of Dying Light. I have reported this bug to the developers on 10th May 2018. Additional info that some people might find useful: a) Dying Light requires haptic support in SDL, otherwise it shows uninformative dialog and exits. b) Dying Light requires OpenGL 4.4 (according to devs) and uses glew to detect OpenGL version which parses GL version string. Since mesa returns OpenGL version 3.0~3.1 for GL contexts created by glew, override variables have to be used to run Dying Light, e.g.: MESA_GL_VERSION_OVERRIDE=4.4 MESA_GLSL_VERSION_OVERRIDE=440 %command% in launch options in steam. Sorry for commenting inside "resolved" bug. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/v3d: Checking for NULL vs IS_ERR()
Dan Carpenterwrites: > The v3d_fence_create() only returns error pointers on error. It never > returns NULL. > > Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D > V3.x+") > Signed-off-by: Dan Carpenter Pushed to drm-misc-next. Thanks! signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 105433] Unreliable Modesetting on Tonga with two DVI Screens
https://bugs.freedesktop.org/show_bug.cgi?id=105433 --- Comment #5 from Thomas R.--- Hm. Well the current state of this machine is: I got an old working AMD DC kernel (4.11) that is starting to give me trouble, and nothing current that works. I'd be willing to bisect from there to current, but there are other bugs and problems in between (some linked in first post) that make me not very hopeful :/. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106589] HP w2207 monitor not waking from sleep
https://bugs.freedesktop.org/show_bug.cgi?id=106589 --- Comment #7 from Sylvain BERTRAND--- I provide the logs since it happened today with the latest code. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: vc4: Detect working driver from cmdline
Stefan Wahrenwrites: > Hi, > in order to improve kernelci.org results and avoid false positive cases like > this [1], i suggested to also test for a working VC4 driver. In order to keep > it simple, we should do it from userspace. > > My first idea was: > > test -d /sys/kernel/debug/dri/0 || echo "Error case" > > But maybe you have a better / more reliable solution? > > [1] - > https://storage.kernelci.org/mainline/master/v4.17-rc5-69-g3acf4e395260/arm64/defconfig/lab-mhart/boot-bcm2837-rpi-3-b.html GL testing involves running piglit and comparing to a previous run to confirm no regressions, and we're building out the intel-gpu-tools support for display testing now. That's what you'd need to make sure the driver actually works. If you just want to make sure module probe doesn't fail, I guess that test is fine (it would catch bugs we've seen in the past). signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106402] amdgpu causes kernel Oops: 0002 [#1] SMP PTI
https://bugs.freedesktop.org/show_bug.cgi?id=106402 --- Comment #5 from taij...@posteo.de --- Also, this is a duplicate of Bug 105760 which is fixed in the current drm-next-4.18-wip. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106402] amdgpu causes kernel Oops: 0002 [#1] SMP PTI
https://bugs.freedesktop.org/show_bug.cgi?id=106402 taij...@posteo.de changed: What|Removed |Added Resolution|--- |DUPLICATE Status|NEW |RESOLVED --- Comment #6 from taij...@posteo.de --- *** This bug has been marked as a duplicate of bug 105760 *** -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930
https://bugs.freedesktop.org/show_bug.cgi?id=105760 taij...@posteo.de changed: What|Removed |Added CC||ratch...@gmail.com --- Comment #11 from taij...@posteo.de --- *** Bug 106402 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 106589] HP w2207 monitor not waking from sleep
https://bugs.freedesktop.org/show_bug.cgi?id=106589 --- Comment #5 from Sylvain BERTRAND--- Created attachment 139664 --> https://bugs.freedesktop.org/attachment.cgi?id=139664=edit Xorg.log -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel