[Intel-gfx] [PATCH 04/14] drm/hdcp: Expand HDCP helper library for enable/disable/check

kernel test robot lkp at intel.com
Tue Sep 14 07:39:37 UTC 2021


Hi Sean,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next linus/master v5.15-rc1 next-20210914]
[cannot apply to drm-intel/for-linux-next drm/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]

url:    https://github.com/0day-ci/linux/commits/Sean-Paul/drm-hdcp-Pull-HDCP-auth-exchange-check-into/20210914-020004
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: riscv-randconfig-r042-20210913 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ceee3075ca23d7911b80eb6a71a0b352d7c6b52c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sean-Paul/drm-hdcp-Pull-HDCP-auth-exchange-check-into/20210914-020004
        git checkout ceee3075ca23d7911b80eb6a71a0b352d7c6b52c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/drm_hdcp.c:13:
   In file included from include/linux/i2c.h:18:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from drivers/gpu/drm/drm_hdcp.c:13:
   In file included from include/linux/i2c.h:18:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from drivers/gpu/drm/drm_hdcp.c:13:
   In file included from include/linux/i2c.h:18:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
                                                     ~~~~~~~~~~ ^
>> drivers/gpu/drm/drm_hdcp.c:1280:21: warning: variable 'needs_enable' set but not used [-Wunused-but-set-variable]
           bool type_changed, needs_enable;
                              ^
   8 warnings generated.


vim +/needs_enable +1280 drivers/gpu/drm/drm_hdcp.c

  1251	
  1252	/**
  1253	 * drm_hdcp_helper_atomic_commit - Helper for drivers to call during commit to
  1254	 * enable/disable HDCP
  1255	 *
  1256	 * @data: pointer to the @drm_hdcp_helper_data for the connector
  1257	 * @state: pointer to the atomic state being committed
  1258	 * @driver_mutex: driver-provided lock to be used while interacting with the driver
  1259	 *
  1260	 * This function can be used by display drivers to determine when HDCP should be
  1261	 * enabled or disabled based on the connector state. It should be called during
  1262	 * steady-state commits as well as connector enable/disable. The function will
  1263	 * handle the HDCP authentication/encryption logic, calling back into the driver
  1264	 * when source operations are necessary.
  1265	 *
  1266	 * @driver_mutex will be retained and used for the duration of the HDCP session
  1267	 * since it will be needed for link checks and retries. This mutex is useful if
  1268	 * the driver has shared resources across connectors which must be serialized.
  1269	 * For example, driver_mutex can be used for MST connectors sharing a common
  1270	 * encoder which should not be accessed/changed concurrently. When the
  1271	 * connector's session is torn down, the mutex will be forgotten by the helper
  1272	 * for this connector until the next session.
  1273	 */
  1274	void drm_hdcp_helper_atomic_commit(struct drm_hdcp_helper_data *data,
  1275					   struct drm_atomic_state *state,
  1276					   struct mutex *driver_mutex)
  1277	{
  1278		struct drm_connector *connector = data->connector;
  1279		struct drm_connector_state *conn_state;
> 1280		bool type_changed, needs_enable;
  1281	
  1282		conn_state = drm_atomic_get_new_connector_state(state, connector);
  1283	
  1284		type_changed = conn_state->hdcp_content_type != data->enabled_type;
  1285		needs_enable = type_changed;
  1286	
  1287		if (conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
  1288			drm_hdcp_helper_disable_hdcp(data);
  1289			return;
  1290		}
  1291	
  1292		if (!conn_state->crtc) {
  1293			drm_hdcp_helper_disable_hdcp(data);
  1294	
  1295			/* Restore property to DESIRED so it's retried later */
  1296			if (conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
  1297				mutex_lock(&data->mutex);
  1298				drm_hdcp_update_value(data, DRM_MODE_CONTENT_PROTECTION_DESIRED,
  1299						true);
  1300				mutex_unlock(&data->mutex);
  1301			}
  1302			return;
  1303		}
  1304	
  1305		/* Already enabled */
  1306		if (conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED)
  1307			return;
  1308	
  1309		/* Disable and re-enable HDCP on content type change */
  1310		if (type_changed)
  1311			drm_hdcp_helper_disable_hdcp(data);
  1312	
  1313		drm_hdcp_helper_enable_hdcp(data, state, driver_mutex);
  1314	}
  1315	EXPORT_SYMBOL(drm_hdcp_helper_atomic_commit);
  1316	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32723 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210914/7326a5a1/attachment-0001.gz>


More information about the dri-devel mailing list