* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
@ 2023-11-25 15:17 ` kernel test robot
2023-11-25 16:48 ` kernel test robot
` (16 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2023-11-25 15:17 UTC (permalink / raw)
To: mac.shen, chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg,
angelogioacchino.delregno, jitao.shi
Cc: llvm, oe-kbuild-all, linux-kernel, dri-devel, mac.shen,
shuijing.li, linux-mediatek, linux-arm-kernel
Hi mac.shen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.7-rc2]
[cannot apply to pza/reset/next pza/imx-drm/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/mac-shen/drm-mediatek-dp-Add-the-HDCP-feature-for-DisplayPort/20231125-152640
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20231124085346.26602-1-mac.shen%40mediatek.com
patch subject: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20231125/202311252324.TTPd9IXz-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231125/202311252324.TTPd9IXz-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311252324.TTPd9IXz-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/mediatek/mtk_dp.c:349:5: warning: no previous prototype for function 'mtk_dp_read' [-Wmissing-prototypes]
349 | u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
| ^
drivers/gpu/drm/mediatek/mtk_dp.c:349:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
349 | u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
| ^
| static
>> drivers/gpu/drm/mediatek/mtk_dp.c:376:5: warning: no previous prototype for function 'mtk_dp_update_bits' [-Wmissing-prototypes]
376 | int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
| ^
drivers/gpu/drm/mediatek/mtk_dp.c:376:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
376 | int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
| ^
| static
>> drivers/gpu/drm/mediatek/mtk_dp.c:2663:6: warning: no previous prototype for function 'mtk_dp_check_hdcp_version' [-Wmissing-prototypes]
2663 | void mtk_dp_check_hdcp_version(struct mtk_dp *mtk_dp, bool only_hdcp1x)
| ^
drivers/gpu/drm/mediatek/mtk_dp.c:2663:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
2663 | void mtk_dp_check_hdcp_version(struct mtk_dp *mtk_dp, bool only_hdcp1x)
| ^
| static
3 warnings generated.
vim +/mtk_dp_read +349 drivers/gpu/drm/mediatek/mtk_dp.c
348
> 349 u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
350 {
351 return mtk_dp_reg_read(mtk_dp->regs, offset);
352 }
353
354 static int mtk_dp_write(struct mtk_dp *mtk_dp, u32 offset, u32 val)
355 {
356 int ret = regmap_write(mtk_dp->regs, offset, val);
357
358 if (ret)
359 dev_err(mtk_dp->dev,
360 "Failed to write register 0x%x with value 0x%x\n",
361 offset, val);
362 return ret;
363 }
364
365 int mtk_dp_reg_update_bits(struct regmap *regs, u32 offset,
366 u32 val, u32 mask)
367 {
368 int ret = regmap_update_bits(regs, offset, mask, val);
369
370 if (ret)
371 pr_err("Failed to update register 0x%x with value 0x%x, mask 0x%x\n",
372 offset, val, mask);
373 return ret;
374 }
375
> 376 int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
377 u32 val, u32 mask)
378 {
379 return mtk_dp_reg_update_bits(mtk_dp->regs, offset, val, mask);
380 }
381
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
2023-11-25 15:17 ` [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort kernel test robot
@ 2023-11-25 16:48 ` kernel test robot
2023-12-01 1:46 ` CK Hu (胡俊光)
` (15 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2023-11-25 16:48 UTC (permalink / raw)
To: mac.shen, chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg,
angelogioacchino.delregno, jitao.shi
Cc: oe-kbuild-all, linux-kernel, dri-devel, mac.shen, shuijing.li,
linux-mediatek, linux-arm-kernel
Hi mac.shen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.7-rc2 next-20231124]
[cannot apply to pza/reset/next pza/imx-drm/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/mac-shen/drm-mediatek-dp-Add-the-HDCP-feature-for-DisplayPort/20231125-152640
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20231124085346.26602-1-mac.shen%40mediatek.com
patch subject: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20231125/202311252346.yBtdeeCP-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231125/202311252346.yBtdeeCP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311252346.yBtdeeCP-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/mediatek/mtk_dp.c:349:5: warning: no previous prototype for 'mtk_dp_read' [-Wmissing-prototypes]
349 | u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
| ^~~~~~~~~~~
>> drivers/gpu/drm/mediatek/mtk_dp.c:376:5: warning: no previous prototype for 'mtk_dp_update_bits' [-Wmissing-prototypes]
376 | int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from include/drm/display/drm_dp_aux_bus.h:13,
from drivers/gpu/drm/mediatek/mtk_dp.c:7:
drivers/gpu/drm/mediatek/mtk_dp.c: In function 'mtk_dp_hpd_sink_event':
>> include/drm/drm_print.h:456:54: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat=]
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/drm/drm_print.h:456:9: note: in expansion of macro 'dev_info'
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~
include/drm/drm_print.h:460:9: note: in expansion of macro '__drm_printk'
460 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/mediatek/mtk_dp.c:1905:17: note: in expansion of macro 'drm_info'
1905 | drm_info(mtk_dp->drm_dev, "Read sink count failed: %ld\n", ret);
| ^~~~~~~~
>> include/drm/drm_print.h:456:54: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat=]
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/drm/drm_print.h:456:9: note: in expansion of macro 'dev_info'
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~
include/drm/drm_print.h:460:9: note: in expansion of macro '__drm_printk'
460 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/mediatek/mtk_dp.c:1911:17: note: in expansion of macro 'drm_info'
1911 | drm_info(mtk_dp->drm_dev,
| ^~~~~~~~
drivers/gpu/drm/mediatek/mtk_dp.c: At top level:
>> drivers/gpu/drm/mediatek/mtk_dp.c:2663:6: warning: no previous prototype for 'mtk_dp_check_hdcp_version' [-Wmissing-prototypes]
2663 | void mtk_dp_check_hdcp_version(struct mtk_dp *mtk_dp, bool only_hdcp1x)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c:38: warning: Function parameter or member 'dp_tee_priv' not described in 'dp_tee_op_send'
>> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c:38: warning: Function parameter or member 'cmd_id' not described in 'dp_tee_op_send'
>> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c:38: warning: Excess function parameter 'chip' description in 'dp_tee_op_send'
vim +/mtk_dp_read +349 drivers/gpu/drm/mediatek/mtk_dp.c
348
> 349 u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
350 {
351 return mtk_dp_reg_read(mtk_dp->regs, offset);
352 }
353
354 static int mtk_dp_write(struct mtk_dp *mtk_dp, u32 offset, u32 val)
355 {
356 int ret = regmap_write(mtk_dp->regs, offset, val);
357
358 if (ret)
359 dev_err(mtk_dp->dev,
360 "Failed to write register 0x%x with value 0x%x\n",
361 offset, val);
362 return ret;
363 }
364
365 int mtk_dp_reg_update_bits(struct regmap *regs, u32 offset,
366 u32 val, u32 mask)
367 {
368 int ret = regmap_update_bits(regs, offset, mask, val);
369
370 if (ret)
371 pr_err("Failed to update register 0x%x with value 0x%x, mask 0x%x\n",
372 offset, val, mask);
373 return ret;
374 }
375
> 376 int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
377 u32 val, u32 mask)
378 {
379 return mtk_dp_reg_update_bits(mtk_dp->regs, offset, val, mask);
380 }
381
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
2023-11-25 15:17 ` [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort kernel test robot
2023-11-25 16:48 ` kernel test robot
@ 2023-12-01 1:46 ` CK Hu (胡俊光)
2023-12-01 1:59 ` CK Hu (胡俊光)
` (14 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2023-12-01 1:46 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/Makefile | 7 +-
> drivers/gpu/drm/mediatek/ca/tci.h | 143 +++
> drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h | 36 +
Use lower case for file name.
> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c | 638 +++++++++++++
> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h | 305 +++++++
Why need a ca folder?
> drivers/gpu/drm/mediatek/mtk_dp.c | 159 +++-
> drivers/gpu/drm/mediatek/mtk_dp.h | 17 +
> drivers/gpu/drm/mediatek/mtk_dp_hdcp.h | 154 ++++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c | 646 +++++++++++++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h | 55 ++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c | 1008
> +++++++++++++++++++++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h | 75 ++
> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 6 +-
> 13 files changed, 3233 insertions(+), 16 deletions(-)
> create mode 100644 drivers/gpu/drm/mediatek/ca/tci.h
> create mode 100644 drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h
> create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c
> create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h
>
This is large patch, so I would like you to separate this patch. Maybe
ca, hdcp1, and hdcp2.
Regards,
CK
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (2 preceding siblings ...)
2023-12-01 1:46 ` CK Hu (胡俊光)
@ 2023-12-01 1:59 ` CK Hu (胡俊光)
2023-12-01 2:56 ` CK Hu (胡俊光)
` (13 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2023-12-01 1:59 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/Makefile | 7 +-
> drivers/gpu/drm/mediatek/ca/tci.h | 143 +++
> drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h | 36 +
> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c | 638 +++++++++++++
> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h | 305 +++++++
> drivers/gpu/drm/mediatek/mtk_dp.c | 159 +++-
> drivers/gpu/drm/mediatek/mtk_dp.h | 17 +
> drivers/gpu/drm/mediatek/mtk_dp_hdcp.h | 154 ++++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c | 646 +++++++++++++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h | 55 ++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c | 1008
> +++++++++++++++++++++
> drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h | 75 ++
> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 6 +-
> 13 files changed, 3233 insertions(+), 16 deletions(-)
> create mode 100644 drivers/gpu/drm/mediatek/ca/tci.h
> create mode 100644 drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h
> create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c
> create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c
> create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h
>
[snip]
> +
> +struct cryptokeys_t {
> + u8 type;
> + u32 len;
> + u32 key;
> +};
Useless, so remove it.
> +
> +struct cmd_hdcp_init_for_verion_t {
> + u32 version;
> + bool need_load_key;
> +};
> +
> +struct cmd_hdcp_write_val_t {
> + u8 type;
> + u8 len;
> + u32 val;
> +};
> +
> +struct cmd_hdcp_calculate_lm_t {
> + u8 bksv[BKSV_LEN];
> +};
> +
> +struct cmd_hdcp_get_aksv_t {
> + u8 aksv[AKSV_LEN];
> +};
> +
> +struct cmd_hdcp_sha1_t {
> + u32 message_len;
> + u32 message_addr;
> +};
Useless, so remove it.
Regards,
CK
> +
> +struct cmd_hdcp_ake_certificate_t {
> + u8 certification[CERT_LEN];
> + bool stored;
> + u8 m[M_LEN];
> + u8 ekm[EKM_LEN];
> +};
> +
> +struct cmd_hdcp_ake_paring_t {
> + u8 ekm[EKM_LEN];
> +};
> +
> +struct cmd_hdcp_enc_km_t {
> + u8 enc_km[ENC_KM_LEN];
> +};
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (3 preceding siblings ...)
2023-12-01 1:59 ` CK Hu (胡俊光)
@ 2023-12-01 2:56 ` CK Hu (胡俊光)
2023-12-01 8:27 ` CK Hu (胡俊光)
` (12 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2023-12-01 2:56 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
>
[snip]
> +
> +int mdrv_dp_tx_hdcp2_fsm(struct mtk_hdcp_info *hdcp_info)
> +{
> + static u32 timeout_value;
> + static u8 pre_main;
> + static u8 pre_sub;
> + static u32 pre_time;
> + int err_code = HDCP_ERR_NONE;
> + bool stored = false;
> + u32 time;
> + int ret = 0;
> + bool tmp = false;
> +
> + if (pre_main != hdcp_info->hdcp2_info.hdcp_handler.main_state
> ||
> + hdcp_info->hdcp2_info.hdcp_handler.sub_state != pre_sub) {
> + DPTXHDCPMSG("Port(M : S)= (%d, %d)", hdcp_info-
> >hdcp2_info.hdcp_handler.main_state,
> + hdcp_info-
> >hdcp2_info.hdcp_handler.sub_state);
> + pre_main = hdcp_info-
> >hdcp2_info.hdcp_handler.main_state;
> + pre_sub = hdcp_info->hdcp2_info.hdcp_handler.sub_state;
> + }
> +
> + switch (hdcp_info->hdcp2_info.hdcp_handler.main_state) {
> + case HDCP2_MS_H1P1:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_ZERO:
> + break;
> + case HDCP2_MSG_AUTH_FAIL:
> + pr_err("HDCP2.x Authentication Fail\n");
> + mdrv_dp_tx_hdcp2_enable_auth(hdcp_info, false);
> + hdcp_info->auth_status = AUTH_FAIL;
> + break;
> + }
> + break;
> + case HDCP2_MS_A0F0:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_ZERO:
> + if (hdcp_info->hdcp2_info.enable) {
> + mdrv_dp_tx_hdcp2_init(hdcp_info);
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + HDCP2_MSG_ZE
> RO);
> + DPTXHDCPMSG("Sink Support Hdcp2x!\n");
> + } else {
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_H1P1,
> + HDCP2_MSG_AU
> TH_FAIL);
> + DPTXHDCPMSG("Sink Doesn't Support
> Hdcp2x!\n");
> + }
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A1F1:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_ZERO:
> + if (hdcp_info->hdcp2_info.retry_count
> + < HDCP2_TX_RETRY_CNT) {
> + hdcp_info->hdcp2_info.retry_count++;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + HDCP2_MSG_AK
> E_INIT);
> + } else {
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_H1P1,
> + HDCP2_MSG_AU
> TH_FAIL);
> + pr_err("Try Max Count\n");
> + }
> + break;
> +
I think you could get rid of switch case and add comment or label to
indicate the state like this:
/* HDCP2_MS_A1F1 */
/* HDCP2_MSG_ZERO */
if (hdcp_info->hdcp2_info.retry_count >= HDCP2_TX_RETRY_CNT)
goto HDCP2_MSG_AUTH_FAIL:
hdcp_info->hdcp2_info.retry_count++;
/* HDCP2_MSG_AKE_INIT */
HDCP2_MSG_AUTH_FAIL:
The code looks more clear.
Regards,
CK
> + case HDCP2_MSG_AKE_INIT:
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_AKE_INIT);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> + mdrv_dp_tx_hdcp2_rest_variable(hdcp_info);
> + hdcp_info->hdcp2_info.read_certrx = true;
> +
> + hdcp_info-
> >hdcp2_info.hdcp_handler.send_ake_init = true;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + HDCP2_MSG_AKE_SEND_C
> ERT);
> + pre_time = get_system_time();
> + break;
> +
> + case HDCP2_MSG_AKE_SEND_CERT:
> + time = get_time_diff(pre_time);
> + if (time < HDCP2_AKESENDCERT_WDT) {
> + msleep(20);
> + break;
> + }
> + if (hdcp_info->hdcp2_info.read_certrx)
> + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> HDCP2_MSG_AKE_SEND_CERT);
> +
> + if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> + break;
> +
> + ret = tee_ake_certificate(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_rx.cert,
> + &stored,
> + hdcp_info-
> >hdcp2_info.stored_pairing_info.m,
> + hdcp_info-
> >hdcp2_info.stored_pairing_info.ekh_km);
> +
> + if (ret != RET_COMPARE_PASS) {
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + hdcp_info->hdcp2_info.hdcp_handler.stored_km =
> stored;
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + hdcp_info-
> >hdcp2_info.hdcp_handler.stored_km ?
> + HDCP2_MSG_AKE_STORED_KM :
> + HDCP2_MSG_AKE_NO_STORED_KM);
> + break;
> +
> + case HDCP2_MSG_AKE_NO_STORED_KM:
> + DPTXHDCPMSG("4. Get Km, derive Ekpub(km)\n");
> +
> + tee_enc_rsaes_oaep(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.ekpub_km);
> + /* Prepare ekpub_km to send */
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> + HDCP2_MSG_AKE_
> NO_STORED_KM);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + HDCP2_MSG_AKE_SEND_H
> _PRIME);
> + timeout_value =
> HDCP2_AKESENDHPRIME_NO_STORED_WDT;
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + pre_time = get_system_time();
> + break;
> + case HDCP2_MSG_AKE_STORED_KM:
> + /* Prepare ekh_km & M to send */
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_AKE_STORED_KM);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + err_code = HDCP_ERR_NONE;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + HDCP2_MSG_AKE_SEND_H
> _PRIME);
> + timeout_value = HDCP2_AKESENDHPRIME_STORED_WDT;
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + pre_time = get_system_time();
> + break;
> +
> + case HDCP2_MSG_AKE_SEND_H_PRIME:
> + if (hdcp_info->hdcp2_info.read_h_prime) {
> + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> + HDCP2_MSG_AKE
> _SEND_H_PRIME);
> + }
> + time = get_time_diff(pre_time);
> + if (time > timeout_value) {
> + err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> + break;
> +
> + ret = tee_ake_h_prime(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.rtx,
> + hdcp_info-
> >hdcp2_info.hdcp_rx.rrx,
> + hdcp_info->hdcp2_info.hdcp_rx.rx_caps,
> + hdcp_info->hdcp2_info.hdcp_tx.tx_caps,
> + hdcp_info->hdcp2_info.hdcp_rx.h_prime,
> + HDCP2_HPRIME_SIZE);
> + if (ret != RET_COMPARE_PASS) {
> + if (hdcp_info-
> >hdcp2_info.hdcp_handler.stored_km)
> + tee_clear_paring(hdcp_info);
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + if (hdcp_info-
> >hdcp2_info.hdcp_handler.stored_km)
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A2F2,
> + HDCP2_MSG_LC
> _INIT);
> + else
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> + HDCP2_MSG_AK
> E_SEND_PAIRING_INFO);
> +
> + pre_time = get_system_time();
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + break;
> +
> + case HDCP2_MSG_AKE_SEND_PAIRING_INFO:
> + if (hdcp_info->hdcp2_info.read_pairing)
> + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> + HDCP2_MSG_AKE
> _SEND_PAIRING_INFO);
> +
> + /* Ekh_Km must be available less than 200ms,
> Give mode time for some Rx */
> + time = get_time_diff(pre_time);
> + if (time > HDCP2_AKESENDPAIRINGINFO_WDT
> * 2) {
> + err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> + break;
> +
> + /* Store m, km, Ekh(km) */
> + tee_ake_paring(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_rx.ekh_km);
> +
> + hdcp_info->hdcp2_info.hdcp_handler.send_pair =
> true;
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A2F2, HDCP2_MSG_LC_INIT);
> + pre_time = get_system_time();
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A2F2:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_LC_INIT:
> + /* prepare Rn to send */
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_LC_INIT);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> + hdcp_info->hdcp2_info.hdcp_handler.send_lc_init
> = true;
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A2F2,
> + HDCP2_MSG_LC_SEND_L_
> PRIME);
> + pre_time = get_system_time();
> + break;
> +
> + case HDCP2_MSG_LC_SEND_L_PRIME:
> + time = get_time_diff(pre_time);
> + if (time < HDCP2_LCSENDLPRIME_WDT)
> + break;
> +
> + if (hdcp_info->hdcp2_info.read_l_prime)
> + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> + HDCP2_MSG_LC_
> SEND_L_PRIME);
> +
> + if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> + break;
> +
> + ret = tee_lc_l_prime(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.rn,
> + hdcp_info-
> >hdcp2_info.hdcp_rx.l_prime,
> + HDCP2_LPRIME_SIZE);
> + if (ret != RET_COMPARE_PASS) {
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + DPTXHDCPMSG("L' is PASS!!\n");
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A3F3, HDCP2_MSG_ZERO);
> + pre_time = get_system_time();
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A3F3:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_ZERO:
> + tee_ske_enc_ks(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.riv,
> + hdcp_info-
> >hdcp2_info.hdcp_tx.eks);
> +
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_SKE_SEND_EKS);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A3F3,
> + HDCP2_MSG_SKE_SEND_E
> KS);
> + pre_time = get_system_time();
> + break;
> +
> + case HDCP2_MSG_SKE_SEND_EKS:
> + time = get_time_diff(pre_time);
> + if (time >= HDCP2_ENC_EN_TIMER) {
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A4F4,
> + HDCP2_MSG_ZE
> RO);
> + }
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A4F4:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_ZERO:
> + if (!hdcp_info->hdcp2_info.repeater) {
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A5F5,
> + HDCP2_MSG_AU
> TH_DONE);
> + } else {
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A6F6,
> + HDCP2_MSG_RE
> PAUTH_SEND_RECVID_LIST);
> + hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg = false;
> + pre_time = get_system_time();
> + }
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A5F5:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_ZERO:
> + break;
> + case HDCP2_MSG_AUTH_DONE:
> + DPTXHDCPMSG("HDCP2.x Authentication done.\n");
> + hdcp_info->auth_status = AUTH_PASS;
> + hdcp_info->hdcp2_info.retry_count = 0;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A5F5, HDCP2_MSG_ZERO);
> + mdrv_dp_tx_hdcp2_enable_auth(hdcp_info, true);
> + break;
> + }
> + break;
> + case HDCP2_MS_A6F6:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_REPAUTH_SEND_RECVID_LIST:
> + if (hdcp_info->hdcp2_info.read_v_prime)
> + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> + HDCP2_MSG_REP
> AUTH_SEND_RECVID_LIST);
> +
> + time = get_time_diff(pre_time);
> + if (time > HDCP2_REPAUTHSENDRECVID_WDT) {
> + err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> + break;
> +
> + pre_time = get_system_time();
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A7F7,
> + HDCP2_MSG_REPAUTH_VE
> RIFY_RECVID_LIST);
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A7F7:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_REPAUTH_VERIFY_RECVID_LIST:
> + if ((hdcp_info->hdcp2_info.hdcp_rx.rx_info[1] &
> (BIT(2) | BIT(3))) != 0) {
> + pr_err("DEVS_EXCEEDED or
> CASCADE_EXCEDDED!\n");
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + /* check seqNumV here */
> + tmp =
> mdrv_dp_tx_hdcp2_check_seq_num_v(hdcp_info);
> + if (!tmp) {
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + tmp =
> mdrv_dp_tx_hdcp2_recv_rep_auth_send_recv_id_list(hdcp_info);
> + if (!tmp) {
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A8F8,
> + HDCP2_MSG_REPAUTH_SE
> ND_ACK);
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A8F8:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_REPAUTH_SEND_ACK:
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> + HDCP2_MSG_REPA
> UTH_SEND_ACK);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + time = get_time_diff(pre_time);
> + if (time > HDCP2_REP_SEND_ACK) {
> + err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A9F9,
> + HDCP2_MSG_REPAUTH_ST
> REAM_MANAGE);
> + hdcp_info->hdcp2_info.hdcp_handler.retry_cnt =
> 0;
> + break;
> + }
> + break;
> +
> + case HDCP2_MS_A9F9:
> + switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> + case HDCP2_MSG_REPAUTH_STREAM_MANAGE:
> + tmp =
> mdrv_dp_tx_hdcp2_process_rep_auth_stream_manage(hdcp_info);
> + if (!tmp) {
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> + HDCP2_MSG_REPA
> UTH_STREAM_MANAGE);
> + if (!tmp) {
> + err_code = HDCP_ERR_SEND_MSG_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + pre_time = get_system_time();
> + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A9F9,
> + HDCP2_MSG_REPAUTH_ST
> REAM_READY);
> + break;
> + case HDCP2_MSG_REPAUTH_STREAM_READY:
> + time = get_time_diff(pre_time);
> + if (time > HDCP2_REPAUTHSTREAMRDY_WDT / 2)
> + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> + HDCP2_MSG_REP
> AUTH_STREAM_READY);
> + else
> + break;
> +
> + time = get_time_diff(pre_time);
> + if (time > HDCP2_REPAUTHSTREAMRDY_WDT) {
> + err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + } else if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg) {
> + if (hdcp_info-
> >hdcp2_info.hdcp_handler.retry_cnt
> + >=
> HDCP2_STREAM_MANAGE_RETRY_CNT) {
> + err_code =
> HDCP_ERR_RESPONSE_TIMEROUT;
> + mdrv_dp_tx_hdcp2_err_handle(hdc
> p_info, err_code, __LINE__);
> + break;
> + }
> +
> + hdcp_info-
> >hdcp2_info.hdcp_handler.retry_cnt++;
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A9F9,
> + HDCP2_MSG_RE
> PAUTH_STREAM_READY);
> + break;
> + }
> +
> + tmp =
> mdrv_dp_tx_hdcp2_recv_rep_auth_stream_ready(hdcp_info);
> + if (!tmp) {
> + err_code = HDCP_ERR_PROCESS_FAIL;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> + break;
> + }
> +
> + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A5F5,
> + HDCP2_MSG_AUTH_DONE)
> ;
> + break;
> + }
> + break;
> + default:
> + err_code = HDCP_ERR_UNKNOWN_STATE;
> + mdrv_dp_tx_hdcp2_err_handle(hdcp_info, err_code,
> __LINE__);
> + break;
> + }
> +
> + return err_code;
> +}
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (4 preceding siblings ...)
2023-12-01 2:56 ` CK Hu (胡俊光)
@ 2023-12-01 8:27 ` CK Hu (胡俊光)
2023-12-01 8:52 ` CK Hu (胡俊光)
` (11 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2023-12-01 8:27 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> +int tee_hdcp_enable_encrypt(struct mtk_hdcp_info *hdcp_info, bool
> enable, u8 version)
> +{
> + int rc;
> + struct dp_tee_private *dp_tee_priv = hdcp_info->g_dp_tee_priv;
> + struct tci_t *tci = (struct tci_t *)dp_tee_priv->shm->kaddr;
> + u8 *share_buffer = (u8 *)dp_tee_priv->shm->kaddr;
> +
> + /* Copy parameters */
> + memset(tci, 0, TCI_LENGTH);
You don't need to clear this structure. The field you do not write in
this command would not be access in tee. So it's not necessary to clear
the field that does not write in this command.
> + tci->command_id = CMD_ENABLE_ENCRYPT;
> + if (enable)
> + tci->cmd_body.cmd_hdcp_write_val.type =
> TYPE_HDCP_ENABLE_ENCRYPT;
> + else
> + tci->cmd_body.cmd_hdcp_write_val.type =
> TYPE_HDCP_DISABLE_ENCRYPT;
> +
> + /* Set HDCP version supportted by device */
> + tci->cmd_body.cmd_hdcp_write_val.len = 1;
> + memset(share_buffer + TCI_LENGTH, version, 1);
It's weird that some data in the range of share_buffer + 0 ~
share_buffer + TCI_LENGTH - 1, and some data is after share_buffer +
TCI_LENGTH. Do not separate them and code would be more clear.
Regards,
CK
> +
> + rc = dp_tee_op_send(dp_tee_priv, (u8 *)tci, TCI_LENGTH + 1,
> CMD_ENABLE_ENCRYPT);
> + if (rc != 0) {
> + TLCERR("tee_op_send failed, error=%x\n", rc);
> + return rc;
> + }
> +
> + return rc;
> +}
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (5 preceding siblings ...)
2023-12-01 8:27 ` CK Hu (胡俊光)
@ 2023-12-01 8:52 ` CK Hu (胡俊光)
2023-12-19 1:59 ` CK Hu (胡俊光)
` (10 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2023-12-01 8:52 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +static int dp_tee_op_send(struct dp_tee_private *dp_tee_priv, u8
> *buf, size_t len, u32 cmd_id)
> +{
> + int rc;
> + u8 *temp_buf;
> + struct tee_ioctl_invoke_arg transceive_args;
> + struct tee_param command_params[4];
> + struct tee_shm *shm = dp_tee_priv->shm;
> +
> + if (len > MAX_COMMAND_SIZE) {
> + TLCERR("%s: len=%zd exceeds MAX_COMMAND_SIZE supported
> by dp TA\n", __func__, len);
> + return -EIO;
> + }
> +
> + memset(&transceive_args, 0, sizeof(transceive_args));
> + memset(command_params, 0, sizeof(command_params));
> + dp_tee_priv->resp_len = 0;
> +
> + /* Invoke FTPM_OPTEE_TA_SUBMIT_COMMAND function of dp TA */
> + transceive_args = (struct tee_ioctl_invoke_arg) {
> + .func = cmd_id,
> + .session = dp_tee_priv->session,
> + .num_params = 4,
> + };
> +
> + /* Fill FTPM_OPTEE_TA_SUBMIT_COMMAND parameters */
> + command_params[0] = (struct tee_param) {
> + .attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT,
> + .u.memref = {
> + .shm = shm,
> + .size = len,
> + .shm_offs = 0,
> + },
> + };
> +
> + temp_buf = tee_shm_get_va(shm, 0);
> + if (IS_ERR(temp_buf)) {
> + TLCERR("%s: tee_shm_get_va failed for transmit\n",
> __func__);
> + return PTR_ERR(temp_buf);
> + }
> +
> + memcpy(temp_buf, buf, len);
temp_buf is equal to buf, so drop temp_buf.
Regards,
CK
> +
> + command_params[1] = (struct tee_param) {
> + .attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT,
> + .u.memref = {
> + .shm = shm,
> + .size = MAX_RESPONSE_SIZE,
> + .shm_offs = MAX_COMMAND_SIZE,
> + },
> + };
> +
> + rc = tee_client_invoke_func(dp_tee_priv->ctx, &transceive_args,
> + command_params);
> + if (rc < 0 || transceive_args.ret != 0) {
> + TLCERR("%s: invoke error: 0x%x\n", __func__,
> transceive_args.ret);
> + return (rc < 0) ? rc : transceive_args.ret;
> + }
> +
> + temp_buf = tee_shm_get_va(shm,
> command_params[1].u.memref.shm_offs);
> + if (IS_ERR(temp_buf)) {
> + TLCERR("%s: tee_shm_get_va failed for receive\n",
> __func__);
> + return PTR_ERR(temp_buf);
> + }
> +
> + /* Sanity checks look good, cache the response */
> + memcpy(dp_tee_priv->resp_buf, temp_buf, MAX_RESPONSE_SIZE / 2);
> + dp_tee_priv->resp_len = MAX_RESPONSE_SIZE / 2;
> +
> + return 0;
> +}
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (6 preceding siblings ...)
2023-12-01 8:52 ` CK Hu (胡俊光)
@ 2023-12-19 1:59 ` CK Hu (胡俊光)
2024-01-04 6:00 ` CK Hu (胡俊光)
` (9 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2023-12-19 1:59 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
>
[snip]
> +
> +static void mhal_dp_tx_hdcp1x_set_repeater(struct mtk_hdcp_info
> *hdcp_info, bool enable)
> +{
> + if (enable)
> + mtk_dp_reg_update_bits(hdcp_info->regs,
> MTK_DP_TRANS_P0_34A4, BIT(15), BIT(15));
> + else
> + mtk_dp_reg_update_bits(hdcp_info->regs,
> MTK_DP_TRANS_P0_34A4, 0, BIT(15));
> +
> +#ifdef IF_ZERO
> + if (hdcp_info->hdcp1x_info.repeater) {
> + u8 temp;
> +
> + temp = BIT(0); /* REAUTHENTICATION_ENABLE_IRQ_HPD */
> + drm_dp_dpcd_write(hdcp_info->aux, DPCD_6803B, &temp,
> 1);
> + }
> +#endif
IF_ZERO is not defined, so remove these.
Regards,
CK
> +}
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (7 preceding siblings ...)
2023-12-19 1:59 ` CK Hu (胡俊光)
@ 2024-01-04 6:00 ` CK Hu (胡俊光)
2024-01-04 6:14 ` CK Hu (胡俊光)
` (8 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 6:00 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> static int mtk_dp_probe(struct platform_device *pdev)
> {
> struct mtk_dp *mtk_dp;
> @@ -2657,6 +2778,16 @@ static int mtk_dp_probe(struct platform_device
> *pdev)
> if (ret)
> return ret;
>
> + INIT_WORK(&mtk_dp->hdcp_work, mtk_dp_hdcp_handle);
> + mtk_dp->hdcp_workqueue = create_workqueue("mtk_dp_hdcp_work");
> + if (!mtk_dp->hdcp_workqueue) {
> + dev_err(mtk_dp->dev, "failed to create hdcp work
> queue");
> + return -ENOMEM;
> + }
> +
> + mtk_dp->hdcp_info.aux = &mtk_dp->aux;
> + mtk_dp->hdcp_info.regs = mtk_dp->regs;
It's not necessary to duplicate aux and regs, so drop this.
Regards,
CK
> +
> mtk_dp->bridge.funcs = &mtk_dp_bridge_funcs;
> mtk_dp->bridge.of_node = dev->of_node;
> mtk_dp->bridge.type = mtk_dp->data->bridge_type;
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (8 preceding siblings ...)
2024-01-04 6:00 ` CK Hu (胡俊光)
@ 2024-01-04 6:14 ` CK Hu (胡俊光)
2024-01-04 6:46 ` CK Hu (胡俊光)
` (7 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 6:14 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> +void mdrv_dp_tx_hdcp1x_set_start_auth(struct mtk_hdcp_info
> *hdcp_info, bool enable)
The prefix 'mdrv' of each function seems redundant. So drop the prifix
'mdrv'.
Regards,
CK
> +{
> + hdcp_info->hdcp1x_info.enable = enable;
> +
> + if (enable) {
> + hdcp_info->auth_status = AUTH_INIT;
> + hdcp_info->hdcp1x_info.main_states =
> HDCP1X_main_state_A0;
> + hdcp_info->hdcp1x_info.sub_states =
> HDCP1X_sub_FSM_IDLE;
> + } else {
> + hdcp_info->auth_status = AUTH_ZERO;
> + hdcp_info->hdcp1x_info.main_states =
> HDCP1X_main_state_H2;
> + hdcp_info->hdcp1x_info.sub_states =
> HDCP1X_sub_FSM_IDLE;
> + tee_hdcp_enable_encrypt(hdcp_info, false, HDCP_NONE);
> + mhal_dp_tx_hdcp1x_start_cipher(hdcp_info, false);
> + tee_hdcp1x_soft_rst(hdcp_info);
> + }
> +
> + hdcp_info->hdcp1x_info.retry_count = 0;
> +}
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (9 preceding siblings ...)
2024-01-04 6:14 ` CK Hu (胡俊光)
@ 2024-01-04 6:46 ` CK Hu (胡俊光)
2024-01-04 7:42 ` CK Hu (胡俊光)
` (6 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 6:46 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +static bool mdrv_dp_tx_hdcp2_inc_seq_num_m(struct mtk_hdcp_info
> *hdcp_info)
> +{
> + u8 i = 0;
> + u32 temp_value = 0;
Use tmp is enough.
> +
> + for (i = 0; i < HDCP2_SEQ_NUM_M_SIZE; i++)
> + temp_value |= hdcp_info-
> >hdcp2_info.hdcp_tx.seq_num_m[i] << (i * 8);
> +
tmp = drm_hdcp_be24_to_cpu(hdcp_info->hdcp2_info.hdcp_tx.seq_num_m);
> + if (temp_value == 0xFFFFFF)
> + return false;
> +
> + temp_value++;
> +
> + for (i = 0; i < HDCP2_SEQ_NUM_M_SIZE; i++)
> + hdcp_info->hdcp2_info.hdcp_tx.seq_num_m[i] =
> + (temp_value & ((u32)0xFF << (i * 8))) >> (i *
> 8);
drm_hdcp_cpu_to_be24(hdcp_info->hdcp2_info.hdcp_tx.seq_num_m, tmp);
Regards,
CK
> + return true;
> +}
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (10 preceding siblings ...)
2024-01-04 6:46 ` CK Hu (胡俊光)
@ 2024-01-04 7:42 ` CK Hu (胡俊光)
2024-01-04 8:01 ` CK Hu (胡俊光)
` (5 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 7:42 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +#define AN_LEN 8
> +#define AKSV_LEN 5
Is this DRM_HDCP_KSV_LEN?
If all these length are defined in HDCP specification, move these
definition to include/drm/drm_hdcp.h
Regards,
CK
> +#define BKSV_LEN 5
> +#define CERT_LEN 522
> +#define EKM_LEN 16
> +#define M_LEN 16
> +#define ENC_KM_LEN 128
> +#define RXX_LEN 8
> +#define CAPS_LEN 3
> +#define RN_LEN 8
> +#define RIV_LEN 8
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (11 preceding siblings ...)
2024-01-04 7:42 ` CK Hu (胡俊光)
@ 2024-01-04 8:01 ` CK Hu (胡俊光)
2024-01-04 8:56 ` CK Hu (胡俊光)
` (4 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 8:01 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> @@ -0,0 +1,154 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2019-2023 MediaTek Inc.
> + */
> +
> +#ifndef _MTK_DP_HDCP_H_
> +#define _MTK_DP_HDCP_H_
> +
> +#include <linux/types.h>
> +#include <drm/display/drm_dp_helper.h>
> +#include <linux/sched/clock.h>
> +
> +#define HDCP2_RXSTATUS_SIZE 1
> +#define HDCP2_RTX_SIZE 8
> +#define HDCP2_RRX_SIZE 8
> +#define HDCP2_TXCAPS_SIZE 3
> +#define HDCP2_RXCAPS_SIZE 3
> +#define HDCP2_M_SIZE 16
> +#define HDCP2_KD_SIZE 32
> +#define HDCP2_CERTRX_SIZE 522
> +#define HDCP2_EKPUBKM_SIZE 128
> +#define HDCP2_EKHKM_SIZE 16
> +#define HDCP2_KM_SIZE 16
> +#define HDCP2_KH_SIZE 16
> +#define HDCP2_RN_SIZE 8
> +#define HDCP2_LPRIME_SIZE 32
> +#define HDCP2_EDKEYKS_SIZE 16
> +#define HDCP2_KS_SIZE 16
> +#define HDCP2_RIV_SIZE 8
> +#define HDCP2_RXINFO_SIZE 2
> +#define HDCP2_SEQ_NUM_V_SIZE 3
> +#define HDCP2_RECVID_SIZE 5
Is this HDCP_2_2_RECEIVERID_LEN? If this is defined in HDCP
specification, move these definition to include/drm/drm_hdcp.h
Regards,
CK
> +#define HDCP2_VPRIME_SIZE 16
> +#define HDCP2_RECV_ID_LIST_SIZE 155
> +#define HDCP2_SEQ_NUM_M_SIZE 3
> +#define HDCP2_STREAMID_TYPE_SIZE 2
> +#define HDCP2_K_SIZE 2
> +#define HDCP2_REP_MPRIME_SIZE 32
> +#define HDCP2_HPRIME_SIZE 32
> +#define HDCP2_RX_ENCKEY_SIZE 104
> +#define HDCP2_TX_ENCKEY_SIZE 448
> +#define HDCP2_LC128_SIZE 16
> +#define HDCP2_KPUBRX_MODULUS_SIZE 128
> +#define HDCP2_KPUBRX_EXPONENT_SIZE 3
> +#define HDCP2_KPUBRX_RESERVED_SIZE 2
> +#define HDCP2_MAX_DEVICE_COUNT 31
> +#define HDCP2_MAX_DEPTH_LEVEL 4
> +#define HDCP2_KPUB_SIZE 384
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (12 preceding siblings ...)
2024-01-04 8:01 ` CK Hu (胡俊光)
@ 2024-01-04 8:56 ` CK Hu (胡俊光)
2024-01-04 9:10 ` CK Hu (胡俊光)
` (3 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 8:56 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> +enum ENUM_HDCP2_MSG_LIST {
> + HDCP2_MSG_ZERO = 0,
> + HDCP2_MSG_AKE_INIT = 1,
> + HDCP2_MSG_AKE_SEND_CERT = 2,
> + HDCP2_MSG_AKE_NO_STORED_KM = 3,
> + HDCP2_MSG_AKE_STORED_KM = 4,
> + HDCP2_MSG_AKE_SEND_H_PRIME = 5,
> + HDCP2_MSG_AKE_SEND_PAIRING_INFO = 6,
> + HDCP2_MSG_LC_INIT = 7,
This looks like HDCP_2_2_LC_INIT in include/drm/drm_hdcp.h. If these
are defined in HDCP specification, move these definition to
include/drm/drm_hdcp.h
Regards,
CK
> + HDCP2_MSG_LC_SEND_L_PRIME = 8,
> + HDCP2_MSG_SKE_SEND_EKS = 9,
> + HDCP2_MSG_REPAUTH_SEND_RECVID_LIST = 10,
> + HDCP2_MSG_REPAUTH_VERIFY_RECVID_LIST = 11,
> + HDCP2_MSG_REPAUTH_SEND_ACK = 12,
> + HDCP2_MSG_REPAUTH_STREAM_MANAGE = 13,
> + HDCP2_MSG_REPAUTH_STREAM_READY = 14,
> + HDCP2_MSG_AUTH_FAIL = 15,
> + HDCP2_MSG_AUTH_DONE = 16,
> +};
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (13 preceding siblings ...)
2024-01-04 8:56 ` CK Hu (胡俊光)
@ 2024-01-04 9:10 ` CK Hu (胡俊光)
2024-01-04 9:43 ` CK Hu (胡俊光)
` (2 subsequent siblings)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 9:10 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> +/* Timeout relative */
> +#define HDCP2_AKESENDCERT_WDT 100 // 100ms
> +#define HDCP2_AKESENDHPRIME_NO_STORED_WDT 1000 // 1sec
> +#define HDCP2_AKESENDHPRIME_STORED_WDT 200 // 200ms
> +#define HDCP2_AKESENDPAIRINGINFO_WDT 200 // 200ms
> +#define HDCP2_LCSENDLPRIME_WDT 7 // 7ms
> +#define HDCP2_ENC_EN_TIMER 200 // 200 ms
> +#define HDCP2_REPAUTHSENDRECVID_WDT 3000 // 3 sec
Is this HDCP_2_2_RECVID_LIST_TIMEOUT_MS? If these are defined in HDCP
specification, move these definition to include/drm/display/drm_hdcp.h
Regards,
CK
> +#define HDCP2_REP_SEND_ACK 2000 // 2 Sec
> +#define HDCP2_REPAUTHSTREAMRDY_WDT 100 // 100 ms
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (14 preceding siblings ...)
2024-01-04 9:10 ` CK Hu (胡俊光)
@ 2024-01-04 9:43 ` CK Hu (胡俊光)
2024-01-05 6:10 ` CK Hu (胡俊光)
2024-01-08 6:00 ` CK Hu (胡俊光)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-04 9:43 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> +struct hdcp2_info_rx {
> + u8 cert[HDCP2_CERTRX_SIZE];
> + u8 rrx[HDCP2_RRX_SIZE];
> + u8 rx_caps[HDCP2_RXCAPS_SIZE];
> + u8 rx_info[HDCP2_RXINFO_SIZE];
> + u8 ekh_km[HDCP2_EKHKM_SIZE];
> + u8 v_prime[HDCP2_VPRIME_SIZE];
> + u8 m_prime[HDCP2_REP_MPRIME_SIZE];
> + u8 h_prime[HDCP2_HPRIME_SIZE];
> + u8 l_prime[HDCP2_LPRIME_SIZE];
This is defined in include/drm/display/drm_hdcp.h as struct
hdcp2_lc_send_lprime{}, so I think you could reuse it. Ditto for all
others in hdcp2_info_rx{}.
Regards,
CK
> + u8 recv_id_list[HDCP2_MAX_DEVICE_COUNT * HDCP2_RECVID_SIZE];
> + u8 seq_num_v[HDCP2_SEQ_NUM_V_SIZE];
> +};
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (15 preceding siblings ...)
2024-01-04 9:43 ` CK Hu (胡俊光)
@ 2024-01-05 6:10 ` CK Hu (胡俊光)
2024-01-08 6:00 ` CK Hu (胡俊光)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-05 6:10 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
>
> @@ -2271,7 +2324,7 @@ static void mtk_dp_bridge_atomic_enable(struct
> drm_bridge *bridge,
>
> mtk_dp->enabled = true;
> mtk_dp_update_plugged_status(mtk_dp);
> -
> + mtk_dp_re_authentication(&mtk_dp->hdcp_info);
According to intel HDCP flow [1], I think you should enable HDCP
according to the connector status set by user space.
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/i915/display/intel_hdcp.c?h=next-20240104#n2413
Regards,
CK
> return;
> power_off_aux:
> mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
` (16 preceding siblings ...)
2024-01-05 6:10 ` CK Hu (胡俊光)
@ 2024-01-08 6:00 ` CK Hu (胡俊光)
17 siblings, 0 replies; 18+ messages in thread
From: CK Hu (胡俊光) @ 2024-01-08 6:00 UTC (permalink / raw)
To: Mac Shen (沈俊),
chunkuang.hu, Jitao Shi (石记涛),
daniel, p.zabel, airlied, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-kernel, linux-mediatek, linux-arm-kernel,
Shuijing Li (李水静)
Hi, Mac:
On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---
[snip]
> +
> +bool mdrv_dp_tx_hdcp2_support(struct mtk_hdcp_info *hdcp_info)
> +{
> + u8 temp_buffer[3];
> + int ret;
> +
> + drm_dp_dpcd_read(hdcp_info->aux,
> DP_HDCP_2_2_REG_RX_CAPS_OFFSET, temp_buffer, 0x3);
> +
> + if ((temp_buffer[2] & BIT(1)) && temp_buffer[0] == 0x02) {
Use defined symbol instead of magic number. According to [1], this
could be:
if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/i915/display/intel_dp_hdcp.c?h=next-20240108#n667
Regards,
CK
> + hdcp_info->hdcp2_info.enable = true;
> + hdcp_info->hdcp2_info.repeater = temp_buffer[2] &
> BIT(0);
> + } else {
> + hdcp_info->hdcp2_info.enable = false;
> + }
> +
> + DPTXHDCPMSG("HDCP.2x CAPABLE: %d, Reapeater: %d\n",
> + hdcp_info->hdcp2_info.enable,
> + hdcp_info->hdcp2_info.repeater);
> +
> + if (!hdcp_info->hdcp2_info.enable)
> + return false;
> +
> + ret = tee_add_device(hdcp_info, HDCP_VERSION_2X);
> + if (ret != RET_SUCCESS) {
> + pr_err("HDCP TA has some error\n");
> + hdcp_info->hdcp2_info.enable = false;
> + }
> +
> + return hdcp_info->hdcp2_info.enable;
> +}
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-01-08 6:00 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20231124085346.26602-1-mac.shen@mediatek.com>
2023-11-25 15:17 ` [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort kernel test robot
2023-11-25 16:48 ` kernel test robot
2023-12-01 1:46 ` CK Hu (胡俊光)
2023-12-01 1:59 ` CK Hu (胡俊光)
2023-12-01 2:56 ` CK Hu (胡俊光)
2023-12-01 8:27 ` CK Hu (胡俊光)
2023-12-01 8:52 ` CK Hu (胡俊光)
2023-12-19 1:59 ` CK Hu (胡俊光)
2024-01-04 6:00 ` CK Hu (胡俊光)
2024-01-04 6:14 ` CK Hu (胡俊光)
2024-01-04 6:46 ` CK Hu (胡俊光)
2024-01-04 7:42 ` CK Hu (胡俊光)
2024-01-04 8:01 ` CK Hu (胡俊光)
2024-01-04 8:56 ` CK Hu (胡俊光)
2024-01-04 9:10 ` CK Hu (胡俊光)
2024-01-04 9:43 ` CK Hu (胡俊光)
2024-01-05 6:10 ` CK Hu (胡俊光)
2024-01-08 6:00 ` CK Hu (胡俊光)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®