[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202209161031.n8n6kDlC-lkp@intel.com>
Date: Fri, 16 Sep 2022 10:28:49 +0800
From: kernel test robot <lkp@...el.com>
To: Lucas De Marchi <lucas.demarchi@...el.com>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, 0day robot <lkp@...el.com>
Subject: drivers/gpu/drm/i915/gem/i915_gem_stolen.c:817:58: warning: shift
count is negative
tree: https://github.com/intel-lab-lkp/linux/commits/UPDATE-20220916-061022/Lucas-De-Marchi/drm-i915-Improvements-to-stolen-memory-setup/20220916-044155
head: 4a6577ccf396fac4cc3313cf6c36ad0ab628d749
commit: fd71936824e711680ce518c4117f35141f49e297 drm/i915: Add missing mask when reading GEN12_DSMBASE
date: 4 hours ago
config: i386-randconfig-a004
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/fd71936824e711680ce518c4117f35141f49e297
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review UPDATE-20220916-061022/Lucas-De-Marchi/drm-i915-Improvements-to-stolen-memory-setup/20220916-044155
git checkout fd71936824e711680ce518c4117f35141f49e297
# 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@...el.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
View attachment "config" of type "text/plain" (127441 bytes)
Powered by blists - more mailing lists