From patchwork Thu Jul 27 19:15:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shilpasri G Bhat X-Patchwork-Id: 794558 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 3xJMFg0CqSz9s2G for ; Fri, 28 Jul 2017 05:18:15 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xJMFf5SZjzDrRR for ; Fri, 28 Jul 2017 05:18:14 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org 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 3xJMDT5Qk8zDrRw for ; Fri, 28 Jul 2017 05:17:13 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6RJFlNP068927 for ; Thu, 27 Jul 2017 15:17:11 -0400 Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) by mx0a-001b2d01.pphosted.com with ESMTP id 2byjkxstwd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 27 Jul 2017 15:17:11 -0400 Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Jul 2017 05:17:09 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 28 Jul 2017 05:17:07 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6RJH70723461952 for ; Fri, 28 Jul 2017 05:17:07 +1000 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v6RJGwP3002220 for ; Fri, 28 Jul 2017 05:16:58 +1000 Received: from oc4502181600.ibm.com ([9.195.38.136]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v6RJGSZ3001557; Fri, 28 Jul 2017 05:16:55 +1000 From: Shilpasri G Bhat To: stewart@linux.vnet.ibm.com, cyrilbur@gmail.com Date: Fri, 28 Jul 2017 00:45:32 +0530 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501182933-756-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> References: <1501182933-756-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17072719-0044-0000-0000-000002810424 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072719-0045-0000-0000-00000712A648 Message-Id: <1501182933-756-8-git-send-email-shilpa.bhat@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-27_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707270300 Subject: [Skiboot] [PATCH V9 7/8] sensors: occ: Skip the deconfigured core sensors X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, ego@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch skips the deconfigured cores from the core sensors while parsing the sensor names in the main memory as these sensor values are not updated by OCC. Signed-off-by: Shilpasri G Bhat --- - No changes from V8 hw/occ-sensor.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c index 2b7974a..87886db 100644 --- a/hw/occ-sensor.c +++ b/hw/occ-sensor.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * OCC Sensor Data @@ -474,9 +475,11 @@ static void add_sensor_label(struct dt_node *node, struct occ_sensor_name *md, if (!strncmp(str_maps[i].occ_str, md->name, strlen(str_maps[i].occ_str))) { char *end; - int num; + int num = -1; + + if (md->location != OCC_SENSOR_LOC_CORE) + num = parse_entity(md->name, &end); - num = parse_entity(md->name, &end); if (num != -1) { snprintf(sname, sizeof(sname), "%s%s %d %s", prefix, str_maps[i].opal_str, num, @@ -573,11 +576,22 @@ void occ_sensors_init(void) char name[30]; const char *type, *loc; struct dt_node *node; + struct cpu_thread *c = NULL; u32 handler; if (!(md[i].type & HWMON_SENSORS_MASK)) continue; + if (md[i].location == OCC_SENSOR_LOC_CORE) { + int num = parse_entity(md[i].name, NULL); + + for_each_available_core_in_chip(c, chip->id) + if (pir_to_core_id(c->pir) == num) + break; + if (!c) + continue; + } + type = get_sensor_type_string(md[i].type); loc = get_sensor_loc_string(md[i].location); snprintf(name, sizeof(name), "%s-%s", loc, type); @@ -598,6 +612,9 @@ void occ_sensors_init(void) "ibm,opal-sensor"); dt_add_property_string(node, "occ_label", md[i].name); add_sensor_label(node, &md[i], chip->id); + + if (md[i].location == OCC_SENSOR_LOC_CORE) + dt_add_property_cells(node, "ibm,pir", c->pir); } occ_num++; }