[Intel-gfx] [PATCH v1 2/4] drm/i915: Add missing mask when reading GEN12_DSMBASE

kernel test robot lkp at intel.com
Fri Sep 16 01:04:42 UTC 2022


Hi Lucas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bb4f6b2281b11b009210f62eecd291f7b75c1e85]

url:    https://github.com/intel-lab-lkp/linux/commits/Lucas-De-Marchi/drm-i915-Improvements-to-stolen-memory-setup/20220916-044155
base:   bb4f6b2281b11b009210f62eecd291f7b75c1e85
config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220916/202209160835.MMBeObmU-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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
        # https://github.com/intel-lab-lkp/linux/commit/b0c14c92efecabadc483675b606c1ce109cfa415
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lucas-De-Marchi/drm-i915-Improvements-to-stolen-memory-setup/20220916-044155
        git checkout b0c14c92efecabadc483675b606c1ce109cfa415
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/i915/

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gem/i915_gem_stolen.c:817:58: warning: shift count is negative [-Wshift-count-negative]
           dsm_base = intel_uncore_read64(uncore, GEN12_DSMBASE) & GEN12_BDSM_MASK;
                                                                   ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_reg.h:7956:28: note: expanded from macro 'GEN12_BDSM_MASK'
   #define   GEN12_BDSM_MASK               GENMASK(63, 20)
                                           ^~~~~~~~~~~~~~~
   include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
                                        ^~~~~~~~~~~~~~~
   include/linux/bits.h:36:11: note: expanded from macro '__GENMASK'
            (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
                    ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +817 drivers/gpu/drm/i915/gem/i915_gem_stolen.c

   798	
   799	struct intel_memory_region *
   800	i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
   801				   u16 instance)
   802	{
   803		struct intel_uncore *uncore = &i915->uncore;
   804		struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
   805		resource_size_t dsm_size, dsm_base, lmem_size;
   806		struct intel_memory_region *mem;
   807		resource_size_t io_start, io_size;
   808		resource_size_t min_page_size;
   809	
   810		if (WARN_ON_ONCE(instance))
   811			return ERR_PTR(-ENODEV);
   812	
   813		if (!i915_pci_resource_valid(pdev, GEN12_LMEM_BAR))
   814			return ERR_PTR(-ENXIO);
   815	
   816		/* Use DSM base address instead for stolen memory */
 > 817		dsm_base = intel_uncore_read64(uncore, GEN12_DSMBASE) & GEN12_BDSM_MASK;
   818		if (IS_DG1(uncore->i915)) {
   819			lmem_size = pci_resource_len(pdev, GEN12_LMEM_BAR);
   820			if (WARN_ON(lmem_size < dsm_base))
   821				return ERR_PTR(-ENODEV);
   822		} else {
   823			resource_size_t lmem_range;
   824	
   825			lmem_range = intel_gt_mcr_read_any(&i915->gt0, XEHP_TILE0_ADDR_RANGE) & 0xFFFF;
   826			lmem_size = lmem_range >> XEHP_TILE_LMEM_RANGE_SHIFT;
   827			lmem_size *= SZ_1G;
   828		}
   829	
   830		dsm_size = lmem_size - dsm_base;
   831		if (pci_resource_len(pdev, GEN12_LMEM_BAR) < lmem_size) {
   832			io_start = 0;
   833			io_size = 0;
   834		} else {
   835			io_start = pci_resource_start(pdev, GEN12_LMEM_BAR) + dsm_base;
   836			io_size = dsm_size;
   837		}
   838	
   839		min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
   840							I915_GTT_PAGE_SIZE_4K;
   841	
   842		mem = intel_memory_region_create(i915, dsm_base, dsm_size,
   843						 min_page_size,
   844						 io_start, io_size,
   845						 type, instance,
   846						 &i915_region_stolen_lmem_ops);
   847		if (IS_ERR(mem))
   848			return mem;
   849	
   850		/*
   851		 * TODO: consider creating common helper to just print all the
   852		 * interesting stuff from intel_memory_region, which we can use for all
   853		 * our probed regions.
   854		 */
   855	
   856		drm_dbg(&i915->drm, "Stolen Local memory IO start: %pa\n",
   857			&mem->io_start);
   858		drm_dbg(&i915->drm, "Stolen Local DSM base: %pa\n", &dsm_base);
   859	
   860		intel_memory_region_set_name(mem, "stolen-local");
   861	
   862		mem->private = true;
   863	
   864		return mem;
   865	}
   866	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


More information about the Intel-gfx mailing list