From patchwork Wed Dec 12 06:15:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 1011585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F65T4WZSz9s47 for ; Wed, 12 Dec 2018 17:16:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43F65S6ZyCzDqr5 for ; Wed, 12 Dec 2018 17:16:28 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=anju@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com 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 43F64x0RBKzDqhl for ; Wed, 12 Dec 2018 17:16:00 +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 wBC69DdD010607 for ; Wed, 12 Dec 2018 01:15:58 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pauvea6pe-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Dec 2018 01:15:57 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Dec 2018 06:15:55 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Dec 2018 06:15:53 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBC6FqeT4063646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Dec 2018 06:15:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6DC44C059; Wed, 12 Dec 2018 06:15:52 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 141614C04E; Wed, 12 Dec 2018 06:15:52 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.0.138]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Dec 2018 06:15:51 +0000 (GMT) From: Anju T Sudhakar To: stewart@linux.vnet.ibm.com Date: Wed, 12 Dec 2018 11:45:41 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212061545.9756-1-anju@linux.vnet.ibm.com> References: <20181212061545.9756-1-anju@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18121206-0028-0000-0000-000003294ADB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121206-0029-0000-0000-000023E5734C Message-Id: <20181212061545.9756-2-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-12_01:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=636 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812120054 Subject: [Skiboot] [PATCH v2 1/5] skiboot/doc: Add documentation for trace-mode in imc.rst X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add documentation for IMC trace-mode in imc.rst. Signed-off-by: Anju T Sudhakar --- doc/imc.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/imc.rst b/doc/imc.rst index 3324aa36..40d262f0 100644 --- a/doc/imc.rst +++ b/doc/imc.rst @@ -44,6 +44,15 @@ sampling duration) fetches the counter data and accumulate to main memory. Memory to accumulate counter data are refered from "PDBAR" (per-core scom) and "LDBAR" per-thread spr. +Trace mode of IMC: +------------------ + +POWER9 support two modes for IMC which are the Accumulation mode and +Trace mode. In IMC Trace mode, event counted is fixed for cycles and on +each overflow, hardware snapshots the program counter along with other +details and writes into memory pointed by LDBAR. LDBAR has bits to +indicate the IMC trace-mode. + OPAL APIs: ---------- From patchwork Wed Dec 12 06:15:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 1011588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F66Y2NwPz9s4s for ; Wed, 12 Dec 2018 17:17:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43F66Y0VTrzDqhl for ; Wed, 12 Dec 2018 17:17:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=anju@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com 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 43F6523TRwzDqkb for ; Wed, 12 Dec 2018 17:16:06 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBC69CvT113032 for ; Wed, 12 Dec 2018 01:16:04 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pauvc28gy-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Dec 2018 01:16:04 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Dec 2018 06:15:58 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Dec 2018 06:15:56 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBC6Ft3i8061360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Dec 2018 06:15:55 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0565D4C058; Wed, 12 Dec 2018 06:15:55 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AF544C040; Wed, 12 Dec 2018 06:15:54 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.0.138]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Dec 2018 06:15:53 +0000 (GMT) From: Anju T Sudhakar To: stewart@linux.vnet.ibm.com Date: Wed, 12 Dec 2018 11:45:42 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212061545.9756-1-anju@linux.vnet.ibm.com> References: <20181212061545.9756-1-anju@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18121206-0008-0000-0000-000002A01FF5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121206-0009-0000-0000-0000220A9AD6 Message-Id: <20181212061545.9756-3-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-12_01:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812120054 Subject: [Skiboot] [PATCH v2 2/5] skiboot: Edit documentation for IMC opal call to include trace-imc X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" OPAL call APIs for In-Memory Collection Counter infrastructure(IMC), includes a new device type called OPAL_IMC_COUNTERS_TRACE. Edit the documentation to include this information. Signed-off-by: Anju T Sudhakar Reviewed-by: Madhavan Srinivasan --- doc/opal-api/opal-imc-counters.rst | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/doc/opal-api/opal-imc-counters.rst b/doc/opal-api/opal-imc-counters.rst index d0b4d960..6fe56aa3 100644 --- a/doc/opal-api/opal-imc-counters.rst +++ b/doc/opal-api/opal-imc-counters.rst @@ -4,7 +4,7 @@ OPAL_IMC_COUNTERS_INIT ============================== OPAL call interface to initialize In-memory collection infrastructure. Call does multiple scom writes on each -incavation for Core IMC initialization. And for the +invocation for Core/Trace IMC initialization. And for the Nest IMC, at this point, call is a no-op and returns OPAL_SUCCESS. Incase of kexec, OS driver should first stop the engine via OPAL_IMC_COUNTER_STOP(and then @@ -15,16 +15,20 @@ the engine via OPAL_IMC_COUNTER_STOP. OPAL does sanity checks to detect unknown or unsupported IMC device type and nest units. check_imc_device_type() function removes -unsupported IMC device type. disable_unavailable_units() -removes unsupported nest units by the microcode. -This way OPAL can lock down and advertise only -supported device type and nest units. +unsupported IMC device type, and in case of +trace-node it ensures that the node is added +only for Nimbus DD2.2 and later chip versions. +disable_unavailable_units() removes unsupported +nest units by the microcode. This way OPAL can +lock down and advertise only supported device +type and nest units. Parameters ---------- ``uint32_t type`` This parameter specifies the imc counter domain. - The value should be 'OPAL_IMC_COUNTERS_CORE' + The value should be either 'OPAL_IMC_COUNTERS_CORE' + or 'OPAL_IMC_COUNTERS_TRACE'. ``uint64_t addr`` This parameter must have a non-zero value. @@ -43,14 +47,14 @@ OPAL_SUCCESS - On succesfully initialized or even if init operation is a no-op OPAL_IMC_COUNTERS_START ============================ OPAL call interface for starting the In-Memory Collection -counters for a specified domain (NEST/CORE). +counters for a specified domain (NEST/CORE/TRACE). Parameters ---------- ``uint32_t type`` This parameter specifies the imc counter domain. - The value can be either 'OPAL_IMC_COUNTERS_NEST' - or 'OPAL_IMC_COUNTERS_CORE' + The value can be 'OPAL_IMC_COUNTERS_NEST', + 'OPAL_IMC_COUNTERS_CORE' or 'OPAL_IMC_COUNTERS_TRACE'. ``uint64_t cpu_pir`` This parameter specifices target cpu pir @@ -65,7 +69,7 @@ OPAL_SUCCESS - On successful execution of the operation for the given ``type`` OPAL_IMC_COUNTERS_STOP =========================== OPAL call interface for stoping In-Memory -Collection counters for a specified domain (NEST/CORE). +Collection counters for a specified domain (NEST/CORE/TRACE). STOP should always be called after a related START. While STOP *may* run successfully without an associated START call, this is not gaurenteed. @@ -74,8 +78,8 @@ Parameters ---------- ``uint32_t type`` This parameter specifies the imc counter domain. - The value can be either 'OPAL_IMC_COUNTERS_NEST' - or 'OPAL_IMC_COUNTERS_CORE' + The value can be 'OPAL_IMC_COUNTERS_NEST', + 'OPAL_IMC_COUNTERS_CORE' or 'OPAL_IMC_COUNTERS_TRACE' ``uint64_t cpu_pir`` This parameter specifices target cpu pir From patchwork Wed Dec 12 06:15:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 1011586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F65n5c8zz9s4s for ; Wed, 12 Dec 2018 17:16:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43F65n4FbSzDqjY for ; Wed, 12 Dec 2018 17:16:45 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=anju@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 43F6504GL2zDqhl for ; Wed, 12 Dec 2018 17:16:04 +1100 (AEDT) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBC69GC0186645 for ; Wed, 12 Dec 2018 01:16:01 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pasjs6xap-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Dec 2018 01:16:01 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Dec 2018 06:16:00 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Dec 2018 06:15:58 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBC6Fvjf7209246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Dec 2018 06:15:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10A2C4C040; Wed, 12 Dec 2018 06:15:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B0244C050; Wed, 12 Dec 2018 06:15:56 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.0.138]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Dec 2018 06:15:56 +0000 (GMT) From: Anju T Sudhakar To: stewart@linux.vnet.ibm.com Date: Wed, 12 Dec 2018 11:45:43 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212061545.9756-1-anju@linux.vnet.ibm.com> References: <20181212061545.9756-1-anju@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18121206-0016-0000-0000-000002354733 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121206-0017-0000-0000-0000328D7861 Message-Id: <20181212061545.9756-4-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-12_01:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=888 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812120054 Subject: [Skiboot] [PATCH v2 3/5] skiboot: Trace IMC Macro definitions X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add macros needed for Trace mode enablement of IMC(In-Memory Collection Counters). These macros are used to identify the trace node in the device-tree and to make appropriate scom calls to enable trace-mode in the hardware. Signed-off-by: Anju T Sudhakar Reviewed-by: Madhavan Srinivasan --- include/imc.h | 30 ++++++++++++++++++++++++++++++ include/opal-api.h | 1 + 2 files changed, 31 insertions(+) diff --git a/include/imc.h b/include/imc.h index f3d906ee..1f9f57ed 100644 --- a/include/imc.h +++ b/include/imc.h @@ -112,6 +112,7 @@ struct imc_chip_cb #define IMC_COUNTER_CHIP 0x10 #define IMC_COUNTER_CORE 0x4 #define IMC_COUNTER_THREAD 0x1 +#define IMC_COUNTER_TRACE 0x2 /* * Nest IMC operations @@ -128,6 +129,35 @@ struct imc_chip_cb #define CORE_IMC_HTM_MODE_ENABLE 0xE800000000000000ull #define CORE_IMC_HTM_MODE_DISABLE 0xE000000000000000ull +/* + * Trace IMC SCOMs for IMC trace-mode. + * + * TRACE_IMC_SCOM layout + * + * 0 4 8 12 16 20 24 28 + * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | + * [ ] [ CPMC_LOAD [2:33] + * | + * *SAMPSEL + * + * 32 36 40 44 48 52 56 60 + * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | + * ] [ ] [ ] [ ] [ RESERVED [51:63] ] + * | | | + * *CPMC1SEL *CPMC2SEL *BUFFERSIZE + */ +#define TRACE_IMC_ADDR 0x20010AA9ull +#define TRACE_IMC_SAMPLESEL(x) ((uint64_t)x << 62) +#define TRACE_IMC_CPMC_LOAD(x) ((0xffffffff - (uint64_t)x) << 30) +#define TRACE_IMC_CPMC1SEL(x) ((uint64_t)x << 23) +#define TRACE_IMC_CPMC2SEL(x) ((uint64_t)x << 16) +#define TRACE_IMC_BUFFERSIZE(x) ((uint64_t)x << 13) +#define TRACE_IMC_SCOM(a, b, c, d, e) (TRACE_IMC_SAMPLESEL(a) |\ + TRACE_IMC_CPMC_LOAD(b) |\ + TRACE_IMC_CPMC1SEL(c) |\ + TRACE_IMC_CPMC2SEL(d) |\ + TRACE_IMC_BUFFERSIZE(e)) + void imc_init(void); void imc_catalog_preload(void); diff --git a/include/opal-api.h b/include/opal-api.h index 5f397c8e..909a7fa8 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1301,6 +1301,7 @@ enum { enum { OPAL_IMC_COUNTERS_NEST = 1, OPAL_IMC_COUNTERS_CORE = 2, + OPAL_IMC_COUNTERS_TRACE = 3, }; From patchwork Wed Dec 12 06:15:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 1011587 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F66D0PMCz9s47 for ; Wed, 12 Dec 2018 17:17:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43F66C5jNTzDql9 for ; Wed, 12 Dec 2018 17:17:07 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=anju@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 43F6514HrDzDqjQ for ; Wed, 12 Dec 2018 17:16:05 +1100 (AEDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBC69KMM081734 for ; Wed, 12 Dec 2018 01:16:03 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pavg6s4ht-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Dec 2018 01:16:02 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Dec 2018 06:16:01 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Dec 2018 06:16:00 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBC6Fx5b61407252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Dec 2018 06:15:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 408294C04A; Wed, 12 Dec 2018 06:15:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B0FA4C040; Wed, 12 Dec 2018 06:15:58 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.0.138]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Dec 2018 06:15:58 +0000 (GMT) From: Anju T Sudhakar To: stewart@linux.vnet.ibm.com Date: Wed, 12 Dec 2018 11:45:44 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212061545.9756-1-anju@linux.vnet.ibm.com> References: <20181212061545.9756-1-anju@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18121206-0020-0000-0000-000002F5C79D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121206-0021-0000-0000-00002145F1BB Message-Id: <20181212061545.9756-5-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-12_01:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812120054 Subject: [Skiboot] [PATCH v2 4/5] skiboot: Enable opal calls to init/start/stop IMC Trace mode X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Patch to enhance the imc opal call to support and handle trace_imc mode. To initialize the trace-mode, TRACE_IMC_SCOM value is written to TRACE_IMC_ADDR of the respective core. TRACE_IMC_SCOM is a 64bit value, and each bit represent the following: 0:1 : SAMPSEL 2:33 : CPMC_LOAD 34:40 : CPMC1SEL 41:47 : CPMC2SEL 48:50 : BUFFERSIZE 51:63 : RESERVED For the nonce the value for TRACE_IMC_SCOM is hard coded. During initialization htm_mode is disabled, and enabled only at start. The opal calls to start/stop the counters, will write CORE_IMC_HTM_MODE_ENABLE/ CORE_IMC_HTM_MODE_DISABLE respectively to the htm_scom_index of the desired cores. Additional switch cases are added to the current opal calls to start/stop the counters for trace-mode. Signed-off-by: Anju T Sudhakar Reviewed-by: Madhavan Srinivasan Cc: Akshay Adiga --- hw/imc.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/hw/imc.c b/hw/imc.c index 3392eaf1..40c64d58 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -22,6 +22,15 @@ #include #include +/* + * IMC trace scom values + */ +#define samplesel 1 /* select cpmc2 */ +#define cpmcload 0xfa /* Value to be loaded into cpmc2 at sampling start */ +#define cpmc1sel 2 /* Event: CPM_CCYC */ +#define cpmc2sel 2 /* Event: CPM_32MHZ_CYC */ +#define buffersize 0 /* b’000’- 4K entries * 64 per entry = 256K buffersize */ + /* * Nest IMC PMU names along with their bit values as represented in the * imc_chip_avl_vector(in struct imc_chip_cb, look at include/imc.h). @@ -264,6 +273,8 @@ static int get_imc_device_type(struct dt_node *node) return IMC_COUNTER_CORE; case IMC_COUNTER_THREAD: return IMC_COUNTER_THREAD; + case IMC_COUNTER_TRACE: + return IMC_COUNTER_TRACE; default: break; } @@ -283,11 +294,23 @@ static bool is_nest_node(struct dt_node *node) static bool is_imc_device_type_supported(struct dt_node *node) { u32 val = get_imc_device_type(node); + struct proc_chip *chip = get_chip(this_cpu()->chip_id); + uint64_t pvr; if ((val == IMC_COUNTER_CHIP) || (val == IMC_COUNTER_CORE) || (val == IMC_COUNTER_THREAD)) return true; + if (val == IMC_COUNTER_TRACE) { + pvr = mfspr(SPR_PVR); + /* + * Trace mode is supported in Nimbus DD2.2 + * and later versions. + */ + if ((chip->type == PROC_CHIP_P9_NIMBUS) && + (PVR_VERS_MAJ(pvr) == 2) && (PVR_VERS_MIN(pvr) >= 2)) + return true; + } return false; } @@ -644,6 +667,8 @@ static int64_t opal_imc_counters_init(uint32_t type, uint64_t addr, uint64_t cpu int port_id, phys_core_id; int ret; uint32_t scoms; + uint64_t trace_scom_val = TRACE_IMC_SCOM(samplesel, cpmcload, + cpmc1sel, cpmc2sel, buffersize); switch (type) { case OPAL_IMC_COUNTERS_NEST: @@ -738,6 +763,53 @@ static int64_t opal_imc_counters_init(uint32_t type, uint64_t addr, uint64_t cpu return OPAL_HARDWARE; } return OPAL_SUCCESS; + case OPAL_IMC_COUNTERS_TRACE: + if (!c) + return OPAL_PARAMETER; + + phys_core_id = cpu_get_core_index(c); + port_id = phys_core_id % 4; + + if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) + return OPAL_SUCCESS; + + if (has_deep_states) { + if (wakeup_engine_state == WAKEUP_ENGINE_PRESENT) { + struct proc_chip *chip = get_chip(c->chip_id); + + prlog(PR_INFO, "Configuring stopapi for IMC trace-mode\n"); + scoms = XSCOM_ADDR_P9_EC(phys_core_id, TRACE_IMC_ADDR); + ret = p9_stop_save_scom((void *)chip->homer_base, scoms, + trace_scom_val, + P9_STOP_SCOM_REPLACE, + P9_STOP_SECTION_CORE_SCOM); + if (ret) { + prerror("IMC trace_mode stopapi ret = %d, scoms = %x (core id = %x)\n", ret, scoms, phys_core_id); + if (ret != STOP_SAVE_SCOM_ENTRY_UPDATE_FAILED) + wakeup_engine_state = WAKEUP_ENGINE_FAILED; + else + prerror("SCOM entries are full\n"); + return OPAL_HARDWARE; + } + } else { + prerror("IMC: TRACE: Wakeup engine in error state!"); + return OPAL_HARDWARE; + } + } + if (xscom_write(c->chip_id, + XSCOM_ADDR_P9_EP(phys_core_id, htm_scom_index[port_id]), + (u64)CORE_IMC_HTM_MODE_DISABLE)) { + prerror("IMC: error in xscom_write for htm mode\n"); + return OPAL_HARDWARE; + } + if (xscom_write(c->chip_id, + XSCOM_ADDR_P9_EC(phys_core_id, + TRACE_IMC_ADDR), trace_scom_val)) { + prerror("IMC: error in xscom_write for trace mode\n"); + return OPAL_HARDWARE; + } + return OPAL_SUCCESS; + } return OPAL_SUCCESS; @@ -797,6 +869,21 @@ static int64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir) return OPAL_HARDWARE; } + return OPAL_SUCCESS; + case OPAL_IMC_COUNTERS_TRACE: + phys_core_id = cpu_get_core_index(c); + port_id = phys_core_id % 4; + + if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) + return OPAL_SUCCESS; + + if (xscom_write(c->chip_id, + XSCOM_ADDR_P9_EP(phys_core_id, + htm_scom_index[port_id]), + (u64)CORE_IMC_HTM_MODE_ENABLE)) { + prerror("IMC OPAL_start: error in xscom_write for htm_mode\n"); + return OPAL_HARDWARE; + } return OPAL_SUCCESS; } @@ -857,6 +944,22 @@ static int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir) } return OPAL_SUCCESS; + case OPAL_IMC_COUNTERS_TRACE: + phys_core_id = cpu_get_core_index(c); + port_id = phys_core_id % 4; + + if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) + return OPAL_SUCCESS; + + if (xscom_write(c->chip_id, + XSCOM_ADDR_P9_EP(phys_core_id, + htm_scom_index[port_id]), + (u64)CORE_IMC_HTM_MODE_DISABLE)) { + prerror("IMC: error in xscom_write for htm_mode\n"); + return OPAL_HARDWARE; + } + return OPAL_SUCCESS; + } return OPAL_SUCCESS; From patchwork Wed Dec 12 06:15:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 1011589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F66z09wgz9s47 for ; Wed, 12 Dec 2018 17:17:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43F66y5pwZzDqwJ for ; Wed, 12 Dec 2018 17:17:46 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=anju@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 43F6560DdRzDqn5 for ; Wed, 12 Dec 2018 17:16:09 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBC6AGsk046027 for ; Wed, 12 Dec 2018 01:16:05 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2paummtsgf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Dec 2018 01:16:05 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Dec 2018 06:16:03 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Dec 2018 06:16:02 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBC6G1gD58720500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Dec 2018 06:16:01 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BE364C046; Wed, 12 Dec 2018 06:16:01 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8FE434C040; Wed, 12 Dec 2018 06:16:00 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.0.138]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Dec 2018 06:16:00 +0000 (GMT) From: Anju T Sudhakar To: stewart@linux.vnet.ibm.com Date: Wed, 12 Dec 2018 11:45:45 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212061545.9756-1-anju@linux.vnet.ibm.com> References: <20181212061545.9756-1-anju@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18121206-4275-0000-0000-000002EF5057 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121206-4276-0000-0000-000037FC70C7 Message-Id: <20181212061545.9756-6-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-12_01:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812120054 Subject: [Skiboot] [PATCH v2 5/5] skiboot: Mambo hack to add trace-imc nodes in the device-tree X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Update skiboot.tcl device tree to include trace-imc node to help test the code path in mambo. Signed-off-by: Anju T Sudhakar Reviewed-by: Madhavan Srinivasan --- external/mambo/skiboot.tcl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index 545a7cca..bf4e9f6f 100644 --- a/external/mambo/skiboot.tcl +++ b/external/mambo/skiboot.tcl @@ -505,6 +505,27 @@ if { $default_config == "P9" } { mysim of addprop $thread string "scale" "512" mysim of addprop $thread int "events" $ct_et mysim of addprop $thread int "type" 1 + + #Add a common trace event node + set tr_et [mysim of addchild $imc_c "trace-events" ""] + mysim of addprop $tr_et int "#address-cells" 1 + mysim of addprop $tr_et int "#size-cells" 1 + + #Add an event + set tr [mysim of addchild $tr_et event [format 10200000]] + mysim of addprop $tr string "event-name" "cycles" + mysim of addprop $tr string "desc" "Reference cycles" + mysim of addprop $tr int "reg" 0x10200000 + + #Add a trace device node + set trace [mysim of addchild $imc_c "trace" ""] + mysim of addprop $trace string "compatible" "ibm,imc-counters" + mysim of addprop $trace string "events-prefix" "trace_" + mysim of addprop $trace int "reg" 0 + mysim of addprop $trace int "size" 262144 + mysim of addprop $trace int "events" $tr_et + mysim of addprop $trace int "type" 2 + } mconfig enable_stb SKIBOOT_ENABLE_MAMBO_STB 0