diff mbox series

[1/2] powercap/intel_rapl: Fix domain detection

Message ID 20201013074241.8797-1-rui.zhang@intel.com
State New
Headers show
Series [1/2] powercap/intel_rapl: Fix domain detection | expand

Commit Message

Zhang Rui Oct. 13, 2020, 7:42 a.m. UTC
As only the low 32 bits of the RAPL_DOMAIN_REG_STATUS register
represents the energy counter, and the high 32 bits are reserved,
detecting the existence of a RAPL domain by checking the low 32 bits only.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/powercap/intel_rapl_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki Oct. 16, 2020, 3:37 p.m. UTC | #1
On Tue, Oct 13, 2020 at 9:42 AM Zhang Rui <rui.zhang@intel.com> wrote:
>
> As only the low 32 bits of the RAPL_DOMAIN_REG_STATUS register
> represents the energy counter, and the high 32 bits are reserved,
> detecting the existence of a RAPL domain by checking the low 32 bits only.
>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/powercap/intel_rapl_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
> index 983d75bd5bd1..2651ea6cd6d3 100644
> --- a/drivers/powercap/intel_rapl_common.c
> +++ b/drivers/powercap/intel_rapl_common.c
> @@ -1228,7 +1228,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
>          * values, otherwise skip it.
>          */
>
> -       ra.mask = ~0;
> +       ra.mask = ENERGY_STATUS_MASK;
>         if (rp->priv->read_raw(cpu, &ra) || !ra.value)
>                 return -ENODEV;
>
> --

Both patches applied as 5.10-rc material with minor edits in the
subject and changelog of the second patch.

Thanks!
diff mbox series

Patch

diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 983d75bd5bd1..2651ea6cd6d3 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -1228,7 +1228,7 @@  static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
 	 * values, otherwise skip it.
 	 */
 
-	ra.mask = ~0;
+	ra.mask = ENERGY_STATUS_MASK;
 	if (rp->priv->read_raw(cpu, &ra) || !ra.value)
 		return -ENODEV;