From: "Zhang, Rui" <rui.zhang@intel.com>
To: "linux@roeck-us.net" <linux@roeck-us.net>,
"ricardo.neri-calderon@linux.intel.com"
<ricardo.neri-calderon@linux.intel.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"jdelvare@suse.com" <jdelvare@suse.com>
Cc: "srinivas.pandruvada@linux.intel.com"
<srinivas.pandruvada@linux.intel.com>,
"lukasz.luba@arm.com" <lukasz.luba@arm.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Neri, Ricardo" <ricardo.neri@intel.com>
Subject: Re: [PATCH 3/3] hwmon: (coretemp) Use a model-specific bitmask to read registers
Date: Sun, 7 Apr 2024 08:24:40 +0000 [thread overview]
Message-ID: <6411e721a1cd559f59aecd8ac57a941cdaa13ff1.camel@intel.com> (raw)
In-Reply-To: <20240406010416.4821-4-ricardo.neri-calderon@linux.intel.com>
On Fri, 2024-04-05 at 18:04 -0700, Ricardo Neri wrote:
> The Intel Software Development manual defines states the temperature
I failed to parse this, is the above "states" redundant?
[...]
> digital readout as the bits [22:16] of the
> IA32_[PACKAGE]_THERM_STATUS
> registers. In recent processor, however, the range is [23:16]. Use a
> model-specific bitmask to extract the temperature readout correctly.
>
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index 616bd1a5b864..5632e1b1dfb1 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -17,6 +17,7 @@
> #include <linux/sysfs.h>
> #include <linux/hwmon-sysfs.h>
> #include <linux/err.h>
> +#include <linux/intel_tcc.h>
> #include <linux/mutex.h>
> #include <linux/list.h>
> #include <linux/platform_device.h>
> @@ -404,6 +405,8 @@ static ssize_t show_temp(struct device *dev,
> tjmax = get_tjmax(tdata, dev);
> /* Check whether the time interval has elapsed */
> if (time_after(jiffies, tdata->last_updated + HZ)) {
> + u32 mask =
> intel_tcc_get_temp_mask(is_pkg_temp_data(tdata));
> +
> rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax,
> &edx);
> /*
> * Ignore the valid bit. In all observed cases the
> register
> @@ -411,7 +414,7 @@ static ssize_t show_temp(struct device *dev,
> * Return it instead of reporting an error which
> doesn't
> * really help at all.
> */
> - tdata->temp = tjmax - ((eax >> 16) & 0x7f) * 1000;
> + tdata->temp = tjmax - ((eax >> 16) & mask) * 1000;
> tdata->last_updated = jiffies;
> }
>
Besides this one, we can also convert to use intel_tcc_get_tjmax() in
get_tjmax().
thanks,
rui
next prev parent reply other threads:[~2024-04-07 8:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-06 1:04 [PATCH 0/3] drivers: thermal/hwmon: intel: Use model-specific bitmasks for temperature registers Ricardo Neri
2024-04-06 1:04 ` [PATCH 1/3] thermal: intel: intel_tcc: Add model checks " Ricardo Neri
2024-04-07 8:13 ` Zhang, Rui
2024-04-08 14:23 ` Ricardo Neri
2024-04-06 1:04 ` [PATCH 2/3] thermal: intel: intel_tcc_cooling: Use a model-specific bitmask for TCC offset Ricardo Neri
2024-04-06 1:04 ` [PATCH 3/3] hwmon: (coretemp) Use a model-specific bitmask to read registers Ricardo Neri
2024-04-06 13:17 ` Guenter Roeck
2024-04-07 8:39 ` Zhang, Rui
2024-04-08 11:40 ` Guenter Roeck
2024-04-07 8:24 ` Zhang, Rui [this message]
2024-04-15 1:19 ` Ricardo Neri
2024-04-15 12:42 ` 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=6411e721a1cd559f59aecd8ac57a941cdaa13ff1.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lukasz.luba@arm.com \
--cc=rafael.j.wysocki@intel.com \
--cc=ricardo.neri-calderon@linux.intel.com \
--cc=ricardo.neri@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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