Skip to content
  1. Nov 09, 2022
  2. Nov 07, 2022
  3. Nov 04, 2022
  4. Nov 03, 2022
    • Gwan-gyeong Mun's avatar
      drm/i915/hwmon: Fix a build error used with clang compiler · 8f956e9a
      Gwan-gyeong Mun authored
      
      
      Use REG_FIELD_PREP() and a constant value for hwm_field_scale_and_write()
      
      If the first argument of FIELD_PREP() is not a compile-time constant value
      or unsigned long long type, this routine of the __BF_FIELD_CHECK() macro
      used internally by the FIELD_PREP() macro always returns false.
      
       BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >      \
                        __bf_cast_unsigned(_reg, ~0ull),        \
                        _pfx "type of reg too small for mask"); \
      
      And it returns a build error by the option among the clang
      compilation options. [-Werror,-Wtautological-constant-out-of-range-compare]
      
      Reported build error while using clang compiler:
      
      drivers/gpu/drm/i915/i915_hwmon.c:115:16: error: result of comparison of
      constant 18446744073709551615 with expression of type 'typeof (_Generic((field_msk),
      char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0,
      unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int:
      (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long:
      (unsigned long)0, unsigned long long: (unsigned long long)0, long long:
      (unsigned long long)0, default: (field_msk)))' (aka 'unsigned int') is always false
      [-Werror,-Wtautological-constant-out-of-range-compare]
              bits_to_set = FIELD_PREP(field_msk, nval);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                      BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
      ./include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
                                          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
      ./include/linux/compiler_types.h:357:22: note: expanded from macro 'compiletime_assert'
              _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
              ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/compiler_types.h:345:23: note: expanded from macro '_compiletime_assert'
              __compiletime_assert(condition, msg, prefix, suffix)
              ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/compiler_types.h:337:9: note: expanded from macro '__compiletime_assert'
                      if (!(condition))                                       \
      
      v2: Use REG_FIELD_PREP() macro instead of FIELD_PREP() (Jani)
      
      Fixes: 99f55efb ("drm/i915/hwmon: Power PL1 limit and TDP setting")
      Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
      Cc: Anshuman Gupta <anshuman.gupta@intel.com>
      Cc: Andi Shyti <andi.shyti@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGwan-gyeong Mun <gwan-gyeong.mun@intel.com>
      Reviewed-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      [Joonas: Wrapped commit message error line length to be more reasonable]
      Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221029044230.32128-1-gwan-gyeong.mun@intel.com
      8f956e9a
    • Niranjana Vishwanathapura's avatar
      drm/i915: Do not set cache_dirty for DGFX · 0aeec60c
      Niranjana Vishwanathapura authored
      
      
      Currently on DG1, which does not have LLC, we hit the below
      warning while rebinding an userptr invalidated object.
      
      WARNING: CPU: 4 PID: 13008 at drivers/gpu/drm/i915/gem/i915_gem_pages.c:34 __i915_gem_object_set_pages+0x296/0x2d0 [i915]
      ...
      RIP: 0010:__i915_gem_object_set_pages+0x296/0x2d0 [i915]
      ...
      Call Trace:
       <TASK>
       i915_gem_userptr_get_pages+0x175/0x1a0 [i915]
       ____i915_gem_object_get_pages+0x32/0xb0 [i915]
       i915_gem_object_userptr_submit_init+0x286/0x470 [i915]
       eb_lookup_vmas+0x2ff/0xcf0 [i915]
       ? __intel_wakeref_get_first+0x55/0xb0 [i915]
       i915_gem_do_execbuffer+0x785/0x21d0 [i915]
       i915_gem_execbuffer2_ioctl+0xe7/0x3d0 [i915]
      
      We shouldn't be setting the obj->cache_dirty for DGFX,
      fix it.
      
      Fixes: d70af579 ("drm/i915/shmem: ensure flush during swap-in on non-LLC")
      Suggested-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Reported-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
      Signed-off-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
      Acked-by: default avatarNirmoy Das <nirmoy.das@intel.com>
      Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
      Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221102051416.27327-1-niranjana.vishwanathapura@intel.com
      0aeec60c
  5. Nov 02, 2022