[Skiboot] [PATCH 2/2] sensors: occ: Skip power sensors with zero sample value
Shilpasri G Bhat
shilpa.bhat at linux.vnet.ibm.com
Fri Jan 19 16:35:57 AEDT 2018
APSS is not avialable on platforms like Zaius, Romulus where OCC
can only measure Vdd (core) and Vdn (nest) power from the AVSbus
reading. So all the sensors for APSS channels will be populated
with 0. Different component power sensors like system, memory
which point to the APSS channels will also be 0.
As per OCC team (Martha Broyles) zero'ed power sensor means that the
system doesnot have it. So this patch filters out these sensors.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
hw/occ-sensor.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 72c8964..1e103cb 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -548,6 +548,23 @@ static const char *get_sensor_loc_string(enum occ_sensor_location loc)
return "unknown";
}
+/*
+ * Power sensors can be 0 valued in few platforms like Zaius, Romulus
+ * which do not have APSS. At the moment there is no HDAT/DT property
+ * to indicate if APSS is present. So for now skip zero valued power
+ * sensors.
+ */
+static bool check_sensor_sample(struct occ_sensor_data_header *hb, u32 offset)
+{
+ struct occ_sensor_record *ping, *pong;
+
+ ping = (struct occ_sensor_record *)((u64)hb + hb->reading_ping_offset
+ + offset);
+ pong = (struct occ_sensor_record *)((u64)hb + hb->reading_pong_offset
+ + offset);
+ return ping->sample || pong->sample;
+}
+
void occ_sensors_init(void)
{
struct proc_chip *chip;
@@ -611,6 +628,10 @@ void occ_sensors_init(void)
if (md[i].location == OCC_SENSOR_LOC_GPU && !has_gpu)
continue;
+ if (md[i].type == OCC_SENSOR_TYPE_POWER &&
+ !check_sensor_sample(hb, md[i].reading_offset))
+ continue;
+
if (md[i].location == OCC_SENSOR_LOC_CORE) {
int num = parse_entity(md[i].name, NULL);
--
1.8.3.1
More information about the Skiboot
mailing list