diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch new file mode 100644 index 000000000..54dced64f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch @@ -0,0 +1,61 @@ +From b0740cbafa468ece35d26a797e7cf80f04fb5102 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Mon, 11 Jan 2021 16:31:36 -0800 +Subject: [PATCH] Die_CPU: filter first zero from GetTemp + +Peci command GetTemp can return 0 during CPU reset. +It does not have a have completion code either. +Discard the first zero reading and return -ENODATA. +Consecutive zeros will be returned so that real hot +condition will still be detected and logged but possibly delayed +by the sensor polling period, which is normally 500ms-1s. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + drivers/hwmon/peci-cputemp.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c +index c5d92d1d2c25..49670bc80530 100644 +--- a/drivers/hwmon/peci-cputemp.c ++++ b/drivers/hwmon/peci-cputemp.c +@@ -15,6 +15,7 @@ + + struct temp_group { + struct peci_sensor_data die; ++ u32 die_raw_prev; + struct peci_sensor_data dts; + struct peci_sensor_data tcontrol; + struct peci_sensor_data tthrottle; +@@ -119,6 +120,7 @@ static int get_die_temp(struct peci_cputemp *priv) + { + struct peci_get_temp_msg msg; + int ret; ++ bool discard = false; + + if (!peci_sensor_need_update(&priv->temp.die)) + return 0; +@@ -129,6 +131,20 @@ static int get_die_temp(struct peci_cputemp *priv) + if (ret) + return ret; + ++ /* ++ * GET_TEMP command does not have cc and can return zero during ++ * cpu reset. Treat the first zero reading as data not available. ++ * Consecutive zeros will be returned so true hot condition ++ * is not be missed. ++ */ ++ if (msg.temp_raw == 0 && priv->temp.die_raw_prev != 0) { ++ dev_err(priv->dev, "discard first 0 reading from GetTemp\n"); ++ discard = true; ++ } ++ priv->temp.die_raw_prev = msg.temp_raw; ++ if (discard) ++ return -ENODATA; ++ + /* Note that the tjmax should be available before calling it */ + priv->temp.die.value = priv->temp.tjmax.value + + (msg.temp_raw * 1000 / 64); +-- +2.17.1 + |