From patchwork Fri Sep 8 11:56:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 811551 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 3xpbRM4638z9s83 for ; Fri, 8 Sep 2017 21:57:35 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xpbRM2bT2zDrcD for ; Fri, 8 Sep 2017 21:57:35 +1000 (AEST) 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=anju@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 3xpbPx43dNzDrZR for ; Fri, 8 Sep 2017 21:56:20 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v88BsR9E039873 for ; Fri, 8 Sep 2017 07:56:13 -0400 Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cun6rghr6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 08 Sep 2017 07:56:13 -0400 Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 Sep 2017 21:56:11 +1000 Received: from d23relay09.au.ibm.com (202.81.31.228) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 8 Sep 2017 21:56:09 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v88Bu9DJ41877560 for ; Fri, 8 Sep 2017 21:56:09 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v88Bu9ql023223 for ; Fri, 8 Sep 2017 21:56:09 +1000 Received: from xenial-xerus.in.ibm.com ([9.78.207.26]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v88Bu6Zw023149 for ; Fri, 8 Sep 2017 21:56:07 +1000 From: Anju T Sudhakar To: skiboot@lists.ozlabs.org Date: Fri, 8 Sep 2017 17:26:05 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable x-cbid: 17090811-0044-0000-0000-000002869900 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17090811-0045-0000-0000-0000071BA02A Message-Id: <1504871765-15773-1-git-send-email-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-08_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709080176 Subject: [Skiboot] [PATCH] Add nest_memory region to exports node 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: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Madhavan Srinivasan Adds nest_memory region to exports node, so that sysfs interface exposes the nest-imc memory dump. This is really helpful incase of debugging nest-imc counters data and verify whether the counter values are updated in the main memory properly or not. Also helps to analyse the values populated in the control block structure. Example: /proc/device-tree/ibm,opal/firmware/exports# ls hdat_map imc_nest_chip_0 name phandle symbol_map /sys/firmware/opal/exports# ls hdat_map imc_nest_chip_0 symbol_map /sys/firmware/opal/exports# hexdump imc_nest_chip_0 0000000 0000 0000 0000 47af 0000 0000 0000 b41e 0000010 0000 0000 0400 7798 0000 0000 0000 0f6c 0000020 0000 0000 0000 0000 0000 0000 0000 c206 0000030 0000 0000 0000 f17b 0000 0000 0000 9100 0000040 0000 0000 0000 0000 0000 0000 0000 b71e 0000050 0000 0000 0400 6f98 0000 0000 0000 fc2b *** Signed-off-by: Madhavan Srinivasan Tested-by : Anju T Sudhakar --- hw/imc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/hw/imc.c b/hw/imc.c index b29a2a1ba270..11df258601d1 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -113,6 +113,7 @@ static char *compress_buf; static size_t compress_buf_size; const char **prop_to_fix(struct dt_node *node); const char *props_to_fix[] = {"events", NULL}; +static uint32_t imc_nest_offset; static bool is_nest_mem_initialized(struct imc_chip_cb *ptr) { @@ -416,6 +417,33 @@ static void imc_dt_update_nest_node(struct dt_node *dev) } } +static void add_nest_mem_exports_node(struct dt_node *root, struct dt_node *dev) +{ + struct proc_chip *chip; + struct dt_node *node; + uint64_t baddr; + const struct dt_property *type; + char namebuf[32]; + int i=0; + + dt_for_each_compatible(dev, node, "ibm,imc-counters") { + type = dt_find_property(node, "type"); + if (type && is_nest_node(node)) + imc_nest_offset = dt_prop_get_u32(node, "offset"); + } + + node = dt_find_by_name(root, "exports"); + if (!node) + return; + + for_each_chip(chip) { + snprintf(namebuf, sizeof(namebuf), "imc_nest_chip_%d", i++); + baddr = chip->homer_base; + baddr += imc_nest_offset; + dt_add_property_u64s(node, namebuf, baddr, 0x40000); + } +} + /* * Load the IMC pnor partition and find the appropriate sub-partition * based on the platform's PVR. @@ -522,6 +550,8 @@ imc_mambo: goto err; } + add_nest_mem_exports_node(dt_root, dev); + free(compress_buf); return; err: