[Intel-gfx] [PATCH] drm/i915/dg1: Add HWMON power sensor support

kernel test robot lkp at intel.com
Thu Mar 25 23:02:31 UTC 2021


Hi Dale,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip next-20210325]
[cannot apply to v5.12-rc4]
[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/Dale-B-Stimson/drm-i915-dg1-Add-HWMON-power-sensor-support/20210326-035458
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-s022-20210325 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-277-gc089cd2d-dirty
        # https://github.com/0day-ci/linux/commit/a4d0cd77d477a9f1389f4af775878deea0749632
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dale-B-Stimson/drm-i915-dg1-Add-HWMON-power-sensor-support/20210326-035458
        git checkout a4d0cd77d477a9f1389f4af775878deea0749632
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/i915/i915_hwmon.c:720:48: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] val_sku_unit @@
   drivers/gpu/drm/i915/i915_hwmon.c:720:48: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:720:48: sparse:     got unsigned int [assigned] [usertype] val_sku_unit
   drivers/gpu/drm/i915/i915_hwmon.c:721:49: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] val_sku_unit @@
   drivers/gpu/drm/i915/i915_hwmon.c:721:49: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:721:49: sparse:     got unsigned int [assigned] [usertype] val_sku_unit
   drivers/gpu/drm/i915/i915_hwmon.c:722:47: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] val_sku_unit @@
   drivers/gpu/drm/i915/i915_hwmon.c:722:47: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:722:47: sparse:     got unsigned int [assigned] [usertype] val_sku_unit
>> drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] reg_value @@
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     got unsigned int [assigned] [usertype] reg_value
>> drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] bits_to_set @@     got restricted __le32 @@
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     expected unsigned int [usertype] bits_to_set
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     got restricted __le32
>> drivers/gpu/drm/i915/i915_hwmon.c:87:35: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le64 [usertype] v @@     got unsigned long long [assigned] [usertype] reg_value @@
   drivers/gpu/drm/i915/i915_hwmon.c:87:35: sparse:     expected restricted __le64 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:87:35: sparse:     got unsigned long long [assigned] [usertype] reg_value
>> drivers/gpu/drm/i915/i915_hwmon.c:87:35: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le64 [usertype] v @@     got unsigned long long [assigned] [usertype] reg_value @@
   drivers/gpu/drm/i915/i915_hwmon.c:87:35: sparse:     expected restricted __le64 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:87:35: sparse:     got unsigned long long [assigned] [usertype] reg_value
>> drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] reg_value @@
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     got unsigned int [assigned] [usertype] reg_value
>> drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] reg_value @@
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     got unsigned int [assigned] [usertype] reg_value
>> drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] bits_to_set @@     got restricted __le32 @@
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     expected unsigned int [usertype] bits_to_set
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     got restricted __le32
>> drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] bits_to_set @@     got restricted __le32 @@
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     expected unsigned int [usertype] bits_to_set
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     got restricted __le32
>> drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __le32 [usertype] v @@     got unsigned int [assigned] [usertype] reg_value @@
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     expected restricted __le32 [usertype] v
   drivers/gpu/drm/i915/i915_hwmon.c:63:35: sparse:     got unsigned int [assigned] [usertype] reg_value
>> drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] bits_to_set @@     got restricted __le32 @@
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     expected unsigned int [usertype] bits_to_set
   drivers/gpu/drm/i915/i915_hwmon.c:114:21: sparse:     got restricted __le32

vim +720 drivers/gpu/drm/i915/i915_hwmon.c

   664	
   665	static void
   666	i915_hwmon_get_preregistration_info(struct drm_i915_private *i915)
   667	{
   668		struct i915_hwmon *hwmon = &i915->hwmon;
   669		struct intel_uncore *uncore = &i915->uncore;
   670		intel_wakeref_t wakeref;
   671		u32 val_sku_unit;
   672	
   673		if (IS_DG1(i915)) {
   674			hwmon->rg.pkg_power_sku_unit = PCU_PACKAGE_POWER_SKU_UNIT;
   675			hwmon->rg.pkg_power_sku = PCU_PACKAGE_POWER_SKU;
   676			hwmon->rg.pkg_energy_status = PCU_PACKAGE_ENERGY_STATUS;
   677			hwmon->rg.pkg_rapl_limit = PCU_PACKAGE_RAPL_LIMIT;
   678			hwmon->rg.pkg_rapl_limit_udw = PCU_PACKAGE_RAPL_LIMIT_UDW;
   679			hwmon->rg.plt_energy_status = PCU_PLATFORM_ENERGY_STATUS;
   680		} else {
   681			hwmon->rg.pkg_power_sku_unit = INVALID_MMIO_REG;
   682			hwmon->rg.pkg_power_sku = INVALID_MMIO_REG;
   683			hwmon->rg.pkg_energy_status = INVALID_MMIO_REG;
   684			hwmon->rg.pkg_rapl_limit = INVALID_MMIO_REG;
   685			hwmon->rg.pkg_rapl_limit_udw = INVALID_MMIO_REG;
   686			hwmon->rg.plt_energy_status = INVALID_MMIO_REG;
   687		}
   688	
   689		/*
   690		 * If a platform does not support *_PLATFORM_ENERGY_STATUS,
   691		 * try *PACKAGE_ENERGY_STATUS.
   692		 */
   693		if (i915_mmio_reg_valid(hwmon->rg.plt_energy_status))
   694			hwmon->rg.reg_energy_status = hwmon->rg.plt_energy_status;
   695		else
   696			hwmon->rg.reg_energy_status = hwmon->rg.pkg_energy_status;
   697	
   698		wakeref = intel_runtime_pm_get(uncore->rpm);
   699	
   700		/*
   701		 * The contents of register hwmon->rg.pkg_power_sku_unit do not change,
   702		 * so read it once and store the shift values.
   703		 */
   704		if (i915_mmio_reg_valid(hwmon->rg.pkg_power_sku_unit))
   705			val_sku_unit = intel_uncore_read(uncore,
   706							 hwmon->rg.pkg_power_sku_unit);
   707		else
   708			val_sku_unit = 0;
   709	
   710		hwmon->energy_counter_overflow = 0;
   711	
   712		if (i915_mmio_reg_valid(hwmon->rg.reg_energy_status))
   713			hwmon->energy_counter_prev =
   714				intel_uncore_read(uncore, hwmon->rg.reg_energy_status);
   715		else
   716			hwmon->energy_counter_prev = 0;
   717	
   718		intel_runtime_pm_put(uncore->rpm, wakeref);
   719	
 > 720		hwmon->scl_shift_power = le32_get_bits(val_sku_unit, PKG_PWR_UNIT);
   721		hwmon->scl_shift_energy = le32_get_bits(val_sku_unit, PKG_ENERGY_UNIT);
   722		hwmon->scl_shift_time = le32_get_bits(val_sku_unit, PKG_TIME_UNIT);
   723	
   724		/*
   725		 * There is no direct way to obtain the power default_limit.
   726		 * The best known workaround is to use the initial value of power1_max.
   727		 *
   728		 * The value of power1_max is reset to the default on reboot, but is
   729		 * not reset by a module unload/load sequence.  To allow proper
   730		 * functioning after a module reload, the value for power1_max is
   731		 * restored to its original value at module unload time in
   732		 * i915_hwmon_fini().
   733		 */
   734		hwmon->power_max_initial_value =
   735			(u32)_field_read_and_scale(uncore,
   736						   hwmon->rg.pkg_rapl_limit,
   737						   PKG_PWR_LIM_1,
   738						   hwmon->scl_shift_power, SF_POWER);
   739	}
   740	

---
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: 34148 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20210326/6cf02f89/attachment-0001.gz>


More information about the Intel-gfx mailing list