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