From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>
Cc: linux-hwmon@vger.kernel.org, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval
Date: Thu, 22 Sep 2022 21:23:38 -0700 [thread overview]
Message-ID: <877d1un2gl.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <878rman6pq.wl-ashutosh.dixit@intel.com>
On Thu, 22 Sep 2022 19:51:45 -0700, Dixit, Ashutosh wrote:
>
> On Thu, 22 Sep 2022 00:13:00 -0700, Gupta, Anshuman wrote:
> >
>
> Hi Anshuman,
>
> > > +static ssize_t
> > > +hwm_power1_max_interval_store(struct device *dev,
> > > + struct device_attribute *attr,
> > > + const char *buf, size_t count)
> > > +{
> > > + struct hwm_drvdata *ddat = dev_get_drvdata(dev);
> > > + struct i915_hwmon *hwmon = ddat->hwmon;
> > > + long val, max_win, ret;
> > > + u32 x, y, rxy, x_w = 2; /* 2 bits */
> > > + u64 tau4, r;
> > > +
> > > +#define PKG_MAX_WIN_DEFAULT 0x12ull
> > > +
> > > + ret = kstrtoul(buf, 0, &val);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + /*
> > > + * val must be < max in hwmon interface units. The steps below are
> > > + * explained in i915_power1_max_interval_show()
> > > + */
> > > + r = FIELD_PREP(PKG_MAX_WIN, PKG_MAX_WIN_DEFAULT);
> >
> > AFAIU we need to read r from PACKAGE_POWER_SKU reg untill unless it has
> > some known issue?
>
> The platform on which I tried had an incorrect value (that is why I didn't
> read it from PACKAGE_POWER_SKU) but let me investigate it some more for
> other platforms and get back.
I checked, the value is correct on DG1/DG2 which have a valid
PACKAGE_POWER_SKU (XEHPSDV does not have a valid
PACKAGE_POWER_SKU). Therefore the one line above should be replaced with
the code below:
if (i915_mmio_reg_valid(hwmon->rg.pkg_power_sku))
with_intel_runtime_pm(ddat->uncore->rpm, wakeref)
r = intel_uncore_read64(ddat->uncore, hwmon->rg.pkg_power_sku);
else
r = FIELD_PREP(PKG_MAX_WIN, PKG_MAX_WIN_DEFAULT);
> > > + x = REG_FIELD_GET(PKG_MAX_WIN_X, r);
> > > + y = REG_FIELD_GET(PKG_MAX_WIN_Y, r);
> > > + tau4 = ((1 << x_w) | x) << y;
> > > + max_win = mul_u64_u32_shr(tau4, SF_TIME, hwmon->scl_shift_time + x_w);
> > > +
> > > + if (val > max_win)
> > > + return -EINVAL;
> > > +
> > > + /* val in hw units */
> > > + val = DIV_ROUND_CLOSEST_ULL((u64)val << hwmon->scl_shift_time, SF_TIME);
> > > + /* Convert to 1.x * power(2,y) */
> > > + if (!val)
> > > + return -EINVAL;
> > > + y = ilog2(val);
> > > + /* x = (val - (1 << y)) >> (y - 2); */
> > > + x = (val - (1ul << y)) << x_w >> y;
> > > +
> > > + rxy = REG_FIELD_PREP(PKG_PWR_LIM_1_TIME_X, x) | REG_FIELD_PREP(PKG_PWR_LIM_1_TIME_Y, y);
> > > +
> > > + hwm_locked_with_pm_intel_uncore_rmw(ddat, hwmon->rg.pkg_rapl_limit,
> > > + PKG_PWR_LIM_1_TIME, rxy);
> > > + return count;
> > > +}
> > > +
> > /snip
> > > if (IS_ERR(hwmon_dev)) {
> > > mutex_destroy(&hwmon->hwmon_lock);
> > > i915->hwmon = NULL;
> > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > > index 956e5298ef1e..68e7cc85dc53 100644
> > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > @@ -1811,6 +1811,9 @@
> > > * *_PACKAGE_POWER_SKU - SKU power and timing parameters.
> > > */
> > > #define PKG_PKG_TDP GENMASK_ULL(14, 0)
> > > +#define PKG_MAX_WIN GENMASK_ULL(54, 48)
> > > +#define PKG_MAX_WIN_X GENMASK_ULL(54, 53)
> > > +#define PKG_MAX_WIN_Y GENMASK_ULL(52, 48)
> > These GENMASK fields needs a reg definition.
>
> Yes this is the same _PACKAGE_POWER_SKU register so should get fixed when
> we add it in Patch 3.
Looks like PCU_PACKAGE_POWER_SKU for DG1/DG2 will need to be declared in
intel_mchbar_regs.h so these fields will need to also move there (in
Patch 3).
Thanks.
--
Ashutosh
next prev parent reply other threads:[~2022-09-23 4:23 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 15:00 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Badal Nilawar
2022-09-16 15:00 ` [Intel-gfx] [PATCH 1/7] drm/i915/hwmon: Add HWMON infrastructure Badal Nilawar
2022-09-21 10:59 ` Gupta, Anshuman
2022-09-21 12:44 ` Andi Shyti
2022-09-21 15:17 ` Nilawar, Badal
2022-09-21 15:45 ` Andi Shyti
2022-09-24 3:10 ` Dixit, Ashutosh
2022-09-16 15:00 ` [Intel-gfx] [PATCH 2/7] drm/i915/hwmon: Add HWMON current voltage support Badal Nilawar
2022-09-21 11:08 ` Gupta, Anshuman
2022-09-16 15:00 ` [Intel-gfx] [PATCH 3/7] drm/i915/hwmon: Power PL1 limit and TDP setting Badal Nilawar
2022-09-21 0:02 ` Dixit, Ashutosh
2022-09-21 11:44 ` Tvrtko Ursulin
2022-09-21 11:45 ` Gupta, Anshuman
2022-09-21 14:53 ` Nilawar, Badal
2022-09-22 7:08 ` Gupta, Anshuman
2022-09-23 2:26 ` Dixit, Ashutosh
2022-09-16 15:00 ` [Intel-gfx] [PATCH 4/7] drm/i915/hwmon: Show device level energy usage Badal Nilawar
2022-09-21 12:02 ` Gupta, Anshuman
2022-10-13 15:53 ` Dixit, Ashutosh
2022-09-16 15:00 ` [Intel-gfx] [PATCH 5/7] drm/i915/hwmon: Expose card reactive critical power Badal Nilawar
2022-09-21 15:07 ` Gupta, Anshuman
2022-09-22 3:17 ` Dixit, Ashutosh
2022-09-22 5:24 ` Gupta, Anshuman
2022-09-16 15:00 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-09-22 7:13 ` Gupta, Anshuman
2022-09-23 2:51 ` Dixit, Ashutosh
2022-09-23 4:23 ` Dixit, Ashutosh [this message]
2022-09-16 15:00 ` [Intel-gfx] [PATCH 7/7] drm/i915/hwmon: Extend power/energy for XEHPSDV Badal Nilawar
2022-09-22 7:37 ` Gupta, Anshuman
2022-09-16 17:37 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add HWMON support (rev6) Patchwork
2022-09-16 17:37 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-09-16 17:59 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-09-19 10:45 ` Nilawar, Badal
2022-09-19 10:15 ` [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Gupta, Anshuman
2022-09-19 12:13 ` Nilawar, Badal
2022-09-19 15:35 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Add HWMON support (rev6) Patchwork
2022-09-19 17:13 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2022-10-13 15:45 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Ashutosh Dixit
2022-10-13 15:45 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Ashutosh Dixit
2022-09-27 5:50 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Badal Nilawar
2022-09-27 5:50 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-09-28 7:09 ` Gupta, Anshuman
2022-10-03 21:32 ` Andi Shyti
2022-10-13 15:55 ` Dixit, Ashutosh
2022-09-26 17:52 [Intel-gfx] [PATCH 0/7] Add HWMON support Badal Nilawar
2022-09-26 17:52 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-09-27 13:54 ` Gupta, Anshuman
2022-09-23 19:56 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Badal Nilawar
2022-09-23 19:56 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-09-24 3:58 ` Dixit, Ashutosh
2022-08-25 13:21 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Badal Nilawar
2022-08-25 13:21 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-08-18 19:38 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Badal Nilawar
2022-08-18 19:39 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-08-12 17:37 [Intel-gfx] [PATCH 0/7] drm/i915: Add HWMON support Badal Nilawar
2022-08-12 17:37 ` [Intel-gfx] [PATCH 6/7] drm/i915/hwmon: Expose power1_max_interval Badal Nilawar
2022-08-12 18:10 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877d1un2gl.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-hwmon@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox