[Skiboot] [PATCH] occ-sensors: Check if OCC is reset while reading inband sensors

Shilpasri G Bhat shilpa.bhat at linux.vnet.ibm.com
Tue May 14 19:33:52 AEST 2019


OCC may not be able to mark the sensor buffer as invalid while going
down RESET. If OCC never comes back we will continue to read the stale
sensor data. So verify if OCC is reset while reading the sensor values
and propagate the appropriate error.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
 hw/occ-sensor.c | 3 +++
 hw/occ.c        | 5 +++++
 include/occ.h   | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index c062f64..0337294 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -265,6 +265,9 @@ int occ_sensor_read(u32 handle, u64 *data)
 	if (attr > MAX_SENSOR_ATTR)
 		return OPAL_PARAMETER;
 
+	if (is_occ_reset())
+		return OPAL_HARDWARE;
+
 	hb = get_sensor_header_block(occ_num);
 
 	if (hb->valid != 1)
diff --git a/hw/occ.c b/hw/occ.c
index 5dc05d3..2713604 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -875,6 +875,11 @@ static inline u8 get_cpu_throttle(struct proc_chip *chip)
 	};
 }
 
+bool is_occ_reset(void)
+{
+	return occ_reset;
+}
+
 static void occ_throttle_poll(void *data __unused)
 {
 	struct proc_chip *chip;
diff --git a/include/occ.h b/include/occ.h
index a46b921..6b831e0 100644
--- a/include/occ.h
+++ b/include/occ.h
@@ -50,6 +50,8 @@ extern void occ_add_sensor_groups(struct dt_node *sg, u32  *phandles,
 
 extern int occ_sensor_group_enable(u32 group_hndl, int token, bool enable);
 
+extern bool is_occ_reset(void);
+
 /*
  * OCC Sensor Data
  *
-- 
1.8.3.1



More information about the Skiboot mailing list