From patchwork Wed Nov 23 08:22:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ppaidipe X-Patchwork-Id: 698099 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tNwMd3yTtz9t0Z for ; Wed, 23 Nov 2016 19:23:25 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tNwMd3LYbzDvsv for ; Wed, 23 Nov 2016 19:23:25 +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 3tNwMR1zd3zDvqt for ; Wed, 23 Nov 2016 19:23:14 +1100 (AEDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAN8JNgf089035 for ; Wed, 23 Nov 2016 03:23:11 -0500 Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142]) by mx0a-001b2d01.pphosted.com with ESMTP id 26w09ac53v-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 23 Nov 2016 03:23:11 -0500 Received: from localhost by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 23 Nov 2016 18:23:03 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 23 Nov 2016 18:23:00 +1000 Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id B8B60357805E for ; Wed, 23 Nov 2016 19:22:57 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAN8MvgI6619578 for ; Wed, 23 Nov 2016 19:22:57 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uAN8Mvd3016698 for ; Wed, 23 Nov 2016 19:22:57 +1100 Received: from localhost.localdomain.in.ibm.com ([9.124.31.207]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uAN8Mud2016653; Wed, 23 Nov 2016 19:22:56 +1100 From: Pridhiviraj Paidipeddi To: skiboot@lists.ozlabs.org Date: Wed, 23 Nov 2016 13:52:48 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112308-0052-0000-0000-000001F0CC9D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112308-0053-0000-0000-00000746FCB0 Message-Id: <1479889369-10385-1-git-send-email-ppaidipe@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-23_01:, , 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-1609300000 definitions=main-1611230153 Subject: [Skiboot] [PATCH v2 1/2] core/init: Add prlog calls to make use of fwts annotations 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" Signed-off-by: Pridhiviraj Paidipeddi --- changes from v1: - Changed the assertion handling to make use of fwts annotations. core/init.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/core/init.c b/core/init.c index 9d4ab60..4d7fd68 100644 --- a/core/init.c +++ b/core/init.c @@ -667,24 +667,30 @@ static void per_thread_sanity_checks(void) { struct cpu_thread *cpu = this_cpu(); - /** - * @fwts-label NonZeroHRMOR - * @fwts-advice The contents of the hypervisor real mode offset register - * (HRMOR) is bitwise orded with the address of any hypervisor real mode - * (i.e Skiboot) memory accesses. Skiboot does not support operating - * with a non-zero HRMOR and setting it will break some things (e.g - * XSCOMs) in hard-to-debug ways. - */ - assert(mfspr(SPR_HRMOR) == 0); + if(mfspr(SPR_HRMOR) != 0) { + /** + * @fwts-label NonZeroHRMOR + * @fwts-advice The contents of the hypervisor real mode offset register + * (HRMOR) is bitwise orded with the address of any hypervisor real mode + * (i.e Skiboot) memory accesses. Skiboot does not support operating + * with a non-zero HRMOR and setting it will break some things (e.g + * XSCOMs) in hard-to-debug ways. + */ + prlog(PR_EMERG, "INIT: Non-zero HRMOR found\n"); + assert(false); + } - /** - * @fwts-label UnknownSecondary - * @fwts-advice The boot CPU attampted to call in a secondary thread - * without initialising the corresponding cpu_thread structure. This may - * happen if the HDAT or devicetree reports too few threads or cores for - * this processor. - */ - assert(cpu->state != cpu_state_no_cpu); + if(cpu->state == cpu_state_no_cpu) { + /** + * @fwts-label UnknownSecondary + * @fwts-advice The boot CPU attampted to call in a secondary thread + * without initialising the corresponding cpu_thread structure. This may + * happen if the HDAT or devicetree reports too few threads or cores for + * this processor. + */ + prlog(PR_EMERG, "INIT: Unknown secondary thread called...\n"); + assert(false); + } } /* Called from head.S, thus no prototype. */