From patchwork Sun Aug 16 17:19:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: maddy X-Patchwork-Id: 507718 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DB4EE140187 for ; Mon, 17 Aug 2015 03:21:25 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id AF0AF1A1916 for ; Mon, 17 Aug 2015 03:21:25 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 100CA1A06BC for ; Mon, 17 Aug 2015 03:20:55 +1000 (AEST) Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Aug 2015 03:20:54 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 17 Aug 2015 03:20:53 +1000 X-Helo: d23dlp03.au.ibm.com X-MailFrom: maddy@linux.vnet.ibm.com X-RcptTo: skiboot@lists.ozlabs.org Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id CAC7D357804F for ; Mon, 17 Aug 2015 03:20:52 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7GHKiXI60752062 for ; Mon, 17 Aug 2015 03:20:52 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7GHKKM2025327 for ; Mon, 17 Aug 2015 03:20:20 +1000 Received: from SrihariMadhavan.ibm.com ([9.126.239.106]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t7GHJldl024894; Mon, 17 Aug 2015 03:20:18 +1000 From: Madhavan Srinivasan To: stewart@linux.vnet.ibm.com, jk@ozlabs.org Date: Sun, 16 Aug 2015 22:49:27 +0530 Message-Id: <1439745567-24930-10-git-send-email-maddy@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439745567-24930-1-git-send-email-maddy@linux.vnet.ibm.com> References: <1439745567-24930-1-git-send-email-maddy@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15081617-1618-0000-0000-0000029EB14B Subject: [Skiboot] [PATCH v4 9/9] Add OPAL call to enable/disable nest pmu X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 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 a new opal call to start and stop pore_slw_ima microcode for nest pmu Counter collection. Also creates a opal-api doc for this call. Signed-off-by: Madhavan Srinivasan --- doc/opal-api/opal-nest-counters.txt | 37 +++++++++++++++++++++++++++++++++++++ hw/nest.c | 20 ++++++++++++++++++++ include/opal-api.h | 3 ++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 doc/opal-api/opal-nest-counters.txt diff --git a/doc/opal-api/opal-nest-counters.txt b/doc/opal-api/opal-nest-counters.txt new file mode 100644 index 000000000000..6bbfc8d4ae32 --- /dev/null +++ b/doc/opal-api/opal-nest-counters.txt @@ -0,0 +1,37 @@ +OPAL_NEST_COUNTERS_CONTROL +---------------------- + +OPAL call interface for nest instrumentation support. +Today, the interface supports start and stop of pore slw ima +(Power On Reset Engine SLeep Wink In Memory Accumulator) engine for +nest instrumentation from Host OS. But it can be extended. + +OPAL_NEST_COUNTERS_CONTROL call accepts four parameters: + + Mode (uint64_t): + Currently, only production mode is supported. + The "IMA_CHIP_PRODUCTION_MODE" macro defined in "nest.h" + is used for this. + + Value_1 (uint64_t): + -For "IMA_CHIP_PRODUCTION_MODE" mode, this parameter is used + to start and stop the pore_slw_ima engine. + 0x0 -- Stop + 0x1 -- Start + + -For other modes, this parameter is undefined for now. + + Value_2 (uint64_t): + - For "IMA_CHIP_PRODUCTION_MODE" mode, this parameter should be + zero. + + -For other modes, this parameter is undefined for now. + + Value_3 (uint64_t): + - For "IMA_CHIP_PRODUCTION_MODE" mode, this parameter should be + zero. + + -For other modes, this parameter is undefined for now. + +OPAL_NEST_COUNTERS_CONTROL will return: + OPAL_SUCCESS on success and IMA_PTS_ERROR on failure. diff --git a/hw/nest.c b/hw/nest.c index 7067b5a84efb..9b6786f09f90 100644 --- a/hw/nest.c +++ b/hw/nest.c @@ -433,3 +433,23 @@ fail: dt_free(dev); return; } + +static int64_t opal_nest_counters_control(uint64_t mode, uint64_t value_1, + uint64_t value_2, uint64_t value_3) +{ + struct proc_chip *chip; + u32 op; + + chip = get_chip(this_cpu()->chip_id); + if (mode == IMA_CHIP_PRODUCTION_MODE && + !value_2 && !value_3) { + op = value_1 ? IMA_PTS_ENABLE: IMA_PTS_DISABLE; + xscom_write(chip->id, IMA_PTS_SCOM, op); + } else { + /* Unknown SLW IMA mode */ + return IMA_PTS_ERROR; + } + + return OPAL_SUCCESS; +} +opal_call(OPAL_NEST_COUNTERS_CONTROL, opal_nest_counters_control, 4); diff --git a/include/opal-api.h b/include/opal-api.h index e22370f7108e..0fa5be603c53 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -162,7 +162,8 @@ #define OPAL_LEDS_GET_INDICATOR 114 #define OPAL_LEDS_SET_INDICATOR 115 #define OPAL_CEC_REBOOT2 116 -#define OPAL_LAST 116 +#define OPAL_NEST_COUNTERS_CONTROL 117 +#define OPAL_LAST 117 /* Device tree flags */