[Skiboot] [PATCH 1/2] sensors: occ: Skip GPU sensors for non-gpu systems

Shilpasri G Bhat shilpa.bhat at linux.vnet.ibm.com
Fri Jan 19 16:35:56 AEDT 2018


Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
 hw/occ-sensor.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index cb05f7c..72c8964 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -553,6 +553,7 @@ void occ_sensors_init(void)
 	struct proc_chip *chip;
 	struct dt_node *sg, *exports;
 	int occ_num = 0, i;
+	bool has_gpu = false;
 
 	/* OCC inband sensors is only supported in P9 */
 	if (proc_gen != proc_gen_p9)
@@ -576,6 +577,9 @@ void occ_sensors_init(void)
 	dt_add_property_cells(sg, "#address-cells", 1);
 	dt_add_property_cells(sg, "#size-cells", 0);
 
+	if (dt_find_compatible_node(dt_root, NULL, "ibm,power9-npu"))
+		has_gpu = true;
+
 	for_each_chip(chip) {
 		struct occ_sensor_data_header *hb;
 		struct occ_sensor_name *md;
@@ -604,6 +608,9 @@ void occ_sensors_init(void)
 			if (!(md[i].type & HWMON_SENSORS_MASK))
 				continue;
 
+			if (md[i].location == OCC_SENSOR_LOC_GPU && !has_gpu)
+				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