[Intel-gfx] [PATCH 3/3] drm/i915/hwmon: Add HWMON current voltage support

Dixit, Ashutosh ashutosh.dixit at intel.com
Sat Jun 11 00:55:32 UTC 2022


On Mon, 23 May 2022 04:08:41 -0700, Badal Nilawar wrote:
>
> +static int
> +i915_in_read(struct i915_hwmon_drvdata *ddat, u32 attr, long *val)
> +{
> +	struct i915_hwmon *hwmon = ddat->dd_hwmon;
> +	intel_wakeref_t wakeref;
> +	u32 reg_value;
> +
> +	switch (attr) {
> +	case hwmon_in_input:
> +		with_intel_runtime_pm(ddat->dd_uncore->rpm, wakeref)
> +			reg_value = intel_uncore_read(ddat->dd_uncore, hwmon->rg.gt_perf_status);
> +		*val = DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) * 25, 10);

A comment here that voltage is in units of 2.5 mV would be nice.

> @@ -440,12 +495,14 @@ i915_hwmon_get_preregistration_info(struct drm_i915_private *i915)
>		hwmon->rg.pkg_rapl_limit = PCU_PACKAGE_RAPL_LIMIT;
>		hwmon->rg.energy_status_all = PCU_PACKAGE_ENERGY_STATUS;
>		hwmon->rg.energy_status_tile = INVALID_MMIO_REG;
> +		hwmon->rg.gt_perf_status = GEN12_RPSTAT1;
>	} else {
>		hwmon->rg.pkg_power_sku_unit = INVALID_MMIO_REG;
>		hwmon->rg.pkg_power_sku = INVALID_MMIO_REG;
>		hwmon->rg.pkg_rapl_limit = INVALID_MMIO_REG;
>		hwmon->rg.energy_status_all = INVALID_MMIO_REG;
>		hwmon->rg.energy_status_tile = INVALID_MMIO_REG;
> +		hwmon->rg.gt_perf_status = INVALID_MMIO_REG;

Looks like this is supportable on XEHPSDV too, so let's add that too.


More information about the Intel-gfx mailing list