From patchwork Tue Feb 28 14:53:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: maddy X-Patchwork-Id: 733596 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 3vXhTK0rfgz9s7c for ; Wed, 1 Mar 2017 01:55:33 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vXhTK02y5zDqKQ for ; Wed, 1 Mar 2017 01:55:33 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org 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 3vXhSG1SlyzDqLC for ; Wed, 1 Mar 2017 01:54:37 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1SEsTdR103512 for ; Tue, 28 Feb 2017 09:54:35 -0500 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0b-001b2d01.pphosted.com with ESMTP id 28wam8tka9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 28 Feb 2017 09:54:35 -0500 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 28 Feb 2017 20:24:04 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 28 Feb 2017 20:24:01 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id D5293E0024 for ; Tue, 28 Feb 2017 20:25:44 +0530 (IST) Received: from d28av07.in.ibm.com (d28av07.in.ibm.com [9.184.220.146]) by d28relay02.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1SEs0ks13762742 for ; Tue, 28 Feb 2017 20:24:00 +0530 Received: from d28av07.in.ibm.com (localhost [127.0.0.1]) by d28av07.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1SErxp8020447 for ; Tue, 28 Feb 2017 20:24:00 +0530 Received: from SrihariSrinidhi.in.ibm.com (sriharisrinidhi.in.ibm.com [9.124.31.189] (may be forged)) by d28av07.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1SErtK2020405; Tue, 28 Feb 2017 20:23:58 +0530 From: Madhavan Srinivasan To: stewart@linux.vnet.ibm.com Date: Tue, 28 Feb 2017 20:23:30 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488293617-27265-1-git-send-email-maddy@linux.vnet.ibm.com> References: <1488293617-27265-1-git-send-email-maddy@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022814-0008-0000-0000-00000534DE7A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022814-0009-0000-0000-0000133DEB05 Message-Id: <1488293617-27265-4-git-send-email-maddy@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-28_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702280137 Subject: [Skiboot] [PATCH v6 03/10] skiboot: Add chip id to HOMER reserved region 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: mikey@neuling.org, skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Vasant Hegde This patch adds a "ibm,chip-id" property to HOMER reserved region. That helps us in relating the HOMER reserved region to the chip that its associated with. This patch is required for nest IMC counters since, the counter values are stored in an offset inside the HOMER region. To read those values from the kernel for a chip, we need to associate the region to its associated chip. Signed-off-by: Vasant Hegde Signed-off-by: Madhavan Srinivasan --- core/init.c | 3 +++ hw/homer.c | 30 ++++++++++++++++++++++++++++++ include/skiboot.h | 1 + 3 files changed, 34 insertions(+) diff --git a/core/init.c b/core/init.c index 983ead5d4c2f..cfb50424884c 100644 --- a/core/init.c +++ b/core/init.c @@ -968,6 +968,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) prd_register_reserved_memory(); + /* Add ibm,chip-id porperty to homer reserved region */ + homer_fixup_dt(); + load_and_boot_kernel(false); } diff --git a/hw/homer.c b/hw/homer.c index 84eb536e632c..c7b17c4f6cf2 100644 --- a/hw/homer.c +++ b/hw/homer.c @@ -116,6 +116,36 @@ static void homer_init_chip(struct proc_chip *chip) } } +void homer_fixup_dt(void) +{ + struct mem_region *region; + struct proc_chip *chip; + + lock(&mem_region_lock); + + for (region = mem_region_next(NULL); region; + region = mem_region_next(region)) { + if (region->type != REGION_HW_RESERVED) + continue; + + if (!region->node) + continue; + + if (strncmp("ibm,homer-image", + region->node->name, strlen("ibm,homer-image"))) + continue; + + for_each_chip(chip) { + if (region->start == chip->homer_base) { + dt_add_property_cells(region->node, + "ibm,chip-id", chip->id); + break; + } + } + } + unlock(&mem_region_lock); +} + void homer_init(void) { struct proc_chip *chip; diff --git a/include/skiboot.h b/include/skiboot.h index 7904eee9e921..d9135f59dd38 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -270,6 +270,7 @@ extern void prd_tmgt_interrupt(uint32_t proc); extern void prd_occ_reset(uint32_t proc); extern void prd_init(void); extern void prd_register_reserved_memory(void); +extern void homer_fixup_dt(void); /* Flatten device-tree */ extern void *create_dtb(const struct dt_node *root, bool exclusive);