Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
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-...@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-...@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 | Closes: https://lore.kernel.org/oe-kbuild-all/202311252346.ybtdeecp-...@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: >> dr
Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
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-...@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-...@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 | Closes: https://lore.kernel.org/oe-kbuild-all/202311252324.ttpd9ixz-...@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
[PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort to support the HDCP feature. Signed-off-by: mac.shen --- 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 diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index d4d193f60271..6839c96221e3 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -26,4 +26,9 @@ mediatek-drm-hdmi-objs := mtk_cec.o \ obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o -obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk_dp.o +mtk-dp-objs := mtk_dp_hdcp1x.o \ + mtk_dp_hdcp2.o \ + ca/tlcDpHdcp.o \ + mtk_dp.o + +obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk-dp.o diff --git a/drivers/gpu/drm/mediatek/ca/tci.h b/drivers/gpu/drm/mediatek/ca/tci.h new file mode 100644 index ..527f77d9308d --- /dev/null +++ b/drivers/gpu/drm/mediatek/ca/tci.h @@ -0,0 +1,143 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2019-2023 MediaTek Inc. + */ + +#ifndef _TCI_H_ +#define _TCI_H_ + +#define RET_COMPARE_PASS 0 +#define RET_COMPARE_FAIL 1 +#define RET_NEW_DEVICE 2 +#define RET_STORED_DEVICE 3 + +#define AN_LEN 8 +#define AKSV_LEN 5 +#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 + +#define TYPE_HDCP_PARAM_AN 10 +#define TYPE_HDCP_PARAM_RST_1 11 +#define TYPE_HDCP_PARAM_RST_2 12 +#define TYPE_HDCP_ENABLE_ENCRYPT 13 +#define TYPE_HDCP_DISABLE_ENCRYPT 14 + +#define TYPE_HDCP13_KEY 20 +#define TYPE_HDCP22_KEY 21 + +#define TCI_LENGTH sizeof(struct tci_t) + +struct cryptokeys_t { + u8 type; + u32 len; + u32 key; +}; + +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; +}; + +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]; +}; + +struct cmd_hdcp_ake_h_prime_t { + u8 rtx[RXX_LEN]; + u8 rrx[RXX_LEN]; + u8 rx_caps[CAPS_LEN]; + u8 tx_caps[CAPS_LEN]; + u32 rx_h_len; + u32 rx_h; +}; + +struct cmd_hdcp_lc_l_prime_t { + u8 rn[RN_LEN]; + u32 rx_l_len; + u32 rx_l; +}; + +struct cmd_hdcp_ske_eks_t { + u8 riv[RIV_LEN]; + u32 eks_len; + u32 eks; +}; + +struct cmd_hdcp_compare_t { + u32 rx_val_len; + u32 rx_val; + u32 param_len; + u32 param; + u32 out_len; + u32 out; +}; + +union tci_cmd_body_t { + /* Init with special HDCP version */ + struct cmd_hdcp_init_for_verion_t cmd_hdcp_init_for_verion; + /* Write uint32 data to hw */ + struct cmd_hdcp_write_val_t cmd_hdcp_write_val; + /* Get aksv */ + struct cmd_hdcp_get_aksv_t cmd_hdcp_get_aksv; + /* Calculate r0 */ + struct cmd_hdcp_calculate_lm_t cmd_hdcp_calculate_lm; + /* Generate signature for certificate */ + struct cmd_hdcp_ake_certificate_t cmd_hdcp_ake_certificate; + /* To store ekm */ + struct cmd_hdcp_ake_paring_t cmd_hdcp_ake_paring; + /* Encrypt km for V2.2 */ + struct cmd_hdcp_enc_km_t cmd_hdcp_enc_km; + /*