From patchwork Fri Jan 19 05:35:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shilpasri G Bhat X-Patchwork-Id: 863329 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zN8h20sLxz9s81 for ; Fri, 19 Jan 2018 16:36:18 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zN8h16JZczF0ys for ; Fri, 19 Jan 2018 16:36:17 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=shilpa.bhat@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zN8gw4CDpzF0yN for ; Fri, 19 Jan 2018 16:36:12 +1100 (AEDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0J5XkQh044217 for ; Fri, 19 Jan 2018 00:36:10 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fk6rwg215-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 19 Jan 2018 00:36:09 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Jan 2018 05:36:07 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 19 Jan 2018 05:36:05 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0J5a5jV43647148; Fri, 19 Jan 2018 05:36:05 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6D4211C05C; Fri, 19 Jan 2018 05:29:47 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8CC3211C058; Fri, 19 Jan 2018 05:29:46 +0000 (GMT) Received: from oc4502181600.ibm.com (unknown [9.79.183.78]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 19 Jan 2018 05:29:46 +0000 (GMT) From: Shilpasri G Bhat To: skiboot@lists.ozlabs.org Date: Fri, 19 Jan 2018 11:05:56 +0530 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 18011905-0040-0000-0000-000004267B89 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011905-0041-0000-0000-000020C9F2AB Message-Id: <1516340157-27298-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-19_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801190068 Subject: [Skiboot] [PATCH 1/2] sensors: occ: Skip GPU sensors for non-gpu systems X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Signed-off-by: Shilpasri G Bhat --- 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); From patchwork Fri Jan 19 05:35:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shilpasri G Bhat X-Patchwork-Id: 863330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zN8hJ24p6z9s81 for ; Fri, 19 Jan 2018 16:36:32 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zN8hJ0skZzF0ym for ; Fri, 19 Jan 2018 16:36:32 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=shilpa.bhat@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zN8gy0zd0zF0yN for ; Fri, 19 Jan 2018 16:36:13 +1100 (AEDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0J5Y1mS010591 for ; Fri, 19 Jan 2018 00:36:12 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fk8npmcjp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 19 Jan 2018 00:36:11 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Jan 2018 05:36:09 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 19 Jan 2018 05:36:08 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0J5a81G46006362; Fri, 19 Jan 2018 05:36:08 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 577DD11C050; Fri, 19 Jan 2018 05:29:50 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 52F4411C04A; Fri, 19 Jan 2018 05:29:49 +0000 (GMT) Received: from oc4502181600.ibm.com (unknown [9.79.183.78]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 19 Jan 2018 05:29:48 +0000 (GMT) From: Shilpasri G Bhat To: skiboot@lists.ozlabs.org Date: Fri, 19 Jan 2018 11:05:57 +0530 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516340157-27298-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> References: <1516340157-27298-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18011905-0020-0000-0000-000003EC5D05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011905-0021-0000-0000-0000427E9E08 Message-Id: <1516340157-27298-2-git-send-email-shilpa.bhat@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-19_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801190068 Subject: [Skiboot] [PATCH 2/2] sensors: occ: Skip power sensors with zero sample value X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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);