From patchwork Tue Sep 12 11:45:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: maddy X-Patchwork-Id: 812811 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 3xs3Ct4ZBWz9s7f for ; Tue, 12 Sep 2017 21:56:10 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xs3Cs5yxRzDr5F for ; Tue, 12 Sep 2017 21:56:09 +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.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=maddy@linux.vnet.ibm.com; receiver=) 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 3xs30R4Gf4zDr5F for ; Tue, 12 Sep 2017 21:46:14 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8CBhoxP069635 for ; Tue, 12 Sep 2017 07:46:12 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0b-001b2d01.pphosted.com with ESMTP id 2cxcm085am-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 12 Sep 2017 07:46:11 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Sep 2017 21:46:08 +1000 Received: from d23relay06.au.ibm.com (202.81.31.225) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 12 Sep 2017 21:46:06 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8CBk52b34340996 for ; Tue, 12 Sep 2017 21:46:05 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v8CBk5UJ007840 for ; Tue, 12 Sep 2017 21:46:05 +1000 Received: from localhost.localdomain (sriharisrinidhi.in.ibm.com [9.121.0.47]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v8CBk2Ur007769; Tue, 12 Sep 2017 21:46:03 +1000 From: Madhavan Srinivasan To: stewart@linux.vnet.ibm.com Date: Tue, 12 Sep 2017 17:15:59 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable x-cbid: 17091211-0040-0000-0000-00000355D2D2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17091211-0041-0000-0000-00000CD60B4B Message-Id: <1505216759-15076-1-git-send-email-maddy@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-12_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=4 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709120165 Subject: [Skiboot] [PATCH v2] skiboot/hw/imc: Add nest_memory region to "exports" node X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Exports the In-Memory Collection counter nest memory to the OS. This allows the OS to view the nest counter region directly. This helps in nest microcode debug and to check counter raw value. Signed-off-by: Madhavan Srinivasan --- Changelog v1: - Fixed the chip index in file name - Moved from dt_root to opal_node when searching for "exports" - Moved the logic to imc_dt_update_nest_node() hw/imc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hw/imc.c b/hw/imc.c index 60fc39d6b761..99293ee36f9e 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -402,6 +402,9 @@ static void imc_dt_update_nest_node(struct dt_node *dev) int i=0, nr_chip = nr_chips(); struct dt_node *node; const struct dt_property *type; + uint32_t offset = 0, size = 0; + uint64_t baddr; + char namebuf[32]; /* Add the base_addr and chip-id properties for the nest node */ base_addr = malloc(sizeof(uint64_t) * nr_chip); @@ -417,8 +420,27 @@ static void imc_dt_update_nest_node(struct dt_node *dev) if (type && is_nest_node(node)) { dt_add_property(node, "base-addr", base_addr, (i * sizeof(u64))); dt_add_property(node, "chip-id", chipids, (i * sizeof(u32))); + offset = dt_prop_get_u32(node, "offset"); + size = dt_prop_get_u32(node, "size"); } } + + /* + * Enable only if we have active nest pmus. + */ + if (!size) + return; + + node = dt_find_by_name(opal_node, "exports"); + if (!node) + return; + + for_each_chip(chip) { + snprintf(namebuf, sizeof(namebuf), "imc_nest_chip_%x", chip->id); + baddr = chip->homer_base; + baddr += offset; + dt_add_property_u64s(node, namebuf, baddr, size); + } } /*