From patchwork Wed Nov 4 10:05:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1393768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=tm7l30D3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=jiG9pzxJ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=oiB+RVAy; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CR2P01fKsz9sVK for ; Wed, 4 Nov 2020 21:06:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=i+p5yxbKEerb3mPO8/tUZVz+B8asz2kSpg/CcNel1XM=; b=tm7l30D3LUgAQQr7Cy8NaSwRxC u1mP6npw5ijUX/a0XVdXHgA7E2Xp7YznzyBE1BSaUJelRi25L6+BAaLvbmwgVMSptxdQyqfcPvEtw VQcgnPA3bIxoSsvNss02NkXBVqs+fb7DFKWI59Q0Gd/2ipcyjJ/saaJY4IOofdZnfbz3fvXTpikYq H+Rvwv9q7X3tRToUlLdgeEvJ4yIkh+fmnb8L9HRuhQW1HVdEkw/s0lOTVAcSy1sDe/ig67Rq9db1O El8ZDX/pScS1fwMkgg3XGYlVw1zH8r5cHJv9Q8h7QM9KG3oSG97g32Fz/upTZqieEUQaMrPfpkrNj UL31ZzFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaFgK-0006aV-Kg; Wed, 04 Nov 2020 10:06:20 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaFgH-0006Zv-JC for opensbi@lists.infradead.org; Wed, 04 Nov 2020 10:06:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1604484377; x=1636020377; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=D6yjLTJlDvh5qfF3+cTOsu2GnT3IxP0VNLvr6gL7qD4=; b=jiG9pzxJm2T+NURj2+fHhL+c2GvcXN/Ix/UNi9LevvnsuR30yw45m1ZU 3ZbatrU2GPpT2LriHiL+kWeOrSWE8IR4LU4U6hG182MtK2Sf0xalETKoQ iG3ZWEBsDq52RzSyAo/wv1wc/kku9dJPqF+NCuJVV6iUENeHBQ85vQLa7 8nTX5CF2i68hvGqt/qHRnsrbZLkr6GmIY3jM5tkIyCdNMpM9PQjxBUm2D 3ugS+2YaxdvSlsRlM8onpsZYPz4Xtd80nc666y5DUgSK3V1V8SD4in2HU vwqh6+0DqRzAwAU5+qKRLZOpZz5B7/WUvpq2eW+N40pxBkdlNIuWA5ci2 A==; IronPort-SDR: OdBLIWDrWGPKK1qdCZSePt+xpK8vs9+TTcIzDYaMt8dIceuZV4zFDLoJhxiyIm7j17LKKlmvOO qfTgzVv/ScWHyuIbVl0zkjknoWv0/7/HOA6d0RXhDzLqbxRwLaZA5RY3lyObO4XcZXBMLpxYlq W+clTA4jKFBjAnmJZdTBnYAtB5gYf9VfHrQT6Hw1GXHfIMAfSUgIHXoi8FOvqoC/E5bxQRj4oF mRzqpHsUQBhmv9BSPINP4rM6s02MDYhBEyuLNANVK2Kl7/NlwnChPBjCIjq6b1oH6hsGjbrre+ VCk= X-IronPort-AV: E=Sophos;i="5.77,450,1596470400"; d="scan'208";a="156244245" Received: from mail-dm6nam11lp2172.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.172]) by ob1.hgst.iphmx.com with ESMTP; 04 Nov 2020 18:06:15 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kimvOJqoClrpQqptYNp72IsIxzWL1QsIsqfgC93Ei6wVWL7Y+hgZIeO6dpKuE+0x4LtsMamIuzua6zv+ECBvquY6js/jR3w8P2zJ2Dc3vbXAbdKDHXJGeajPrU15eC2V6Zhjk2ksFhmiwQWtz+sH22Pei1YQ1d5acBPPMjBGUfI9WP2rTm8kt4uqgHP1BN9eV60tFd5JnHy5BEbGYahG2sCHHU9jKJcWHgSflR6+CU95X/ETGZaEa2woFVhgD/Uu3hqO5s0PMMcQCULu1kf9TuG3HJrejuIdZNf1qia2Qm8VVHlQePouJPTgWFoRsKEt3HE7EauD0syv/siq14WQjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IpYrY5DxZv5NICbwJ5fkPASIOJt60JbpfBei04aNf/Q=; b=ZB5d/NVm58lwoezULBmlVAacx09zk0RJBE0K1ns1KemR994oeyRkv5ssqTtyGRHnhhS9SM8eIruEd/CF3iqVQRgBbIShG+okGYvVd5i30m9LEGYjkSeXf/jNtfKzH8Wo8dUXpyfZRG57mOInY2HrW0UOmzlrJbiO/5dhGGQljNFMb4c9iMhoJtqWgxTP7EOWkfH/gC+0taEOexDrX4lIoNGYlgIcrr9Qvh9zPQQbuS2UyD1W/y4zC8VCz5EhV0KNhw1FXX4x7xDUP07EUNzT69gqC7HPZsl9D6FfLg8fSCclb4INzSlJQyBGytrkfT/rzrRs4M3Q5zJPLjhzyeEnQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IpYrY5DxZv5NICbwJ5fkPASIOJt60JbpfBei04aNf/Q=; b=oiB+RVAybtdJ5OduWIwibVccandk62qzep8BlQMaP76/1h/GhR4oyIoHvsDZSMPssQwH+rJIzepAcq7bWbgD8rTHYmkXp5hPzB8h2xyTsO5wdWy2jd4v5ZiObdYBAgVvl+8Z7EJj+23rdyi8ZNxjnbVenO4zqdcptmaaoeap/1M= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB5834.namprd04.prod.outlook.com (2603:10b6:5:162::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.29; Wed, 4 Nov 2020 10:06:14 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd%6]) with mapi id 15.20.3499.032; Wed, 4 Nov 2020 10:06:14 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH] lib: sbi: Improve boot prints in cold boot sequence Date: Wed, 4 Nov 2020 15:35:54 +0530 Message-Id: <20201104100554.3044339-1-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 X-Originating-IP: [122.171.38.184] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.38.184) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 4 Nov 2020 10:06:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f482bf81-a23c-4612-9726-08d880a94368 X-MS-TrafficTypeDiagnostic: DM6PR04MB5834: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yj2dzf8UonDj5gH0+5ILiN8/0WispagrjWkqLDSEXHfaJLq7cmlQhLJWC8/zyrNYqumFY5p2ljbaUUlIcoQ2f30zBQJX2zCNjE/i82s7/1kg91pXlPES0VRS4+lAlC+CkY18AKxCr4Q31KON6aCuwe3IpZON7AWDI5zhPbHHTfGKBdSfUEKHLkt2rGx9X8J4Pe72RWJL5VElCvn9k9Ba2Oj89DHcjsSa6T288MdKjqlfYT18VlHtnHxfhOctKRzI+aGFbt89LOKk3rbe3baxF8BnOCSRJ25AvNsRXCWpn1JTpEjpiiCw9QS0Xj8osEvv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(396003)(376002)(346002)(136003)(83380400001)(5660300002)(1076003)(6636002)(44832011)(2616005)(956004)(8676002)(316002)(8936002)(36756003)(4326008)(54906003)(26005)(110136005)(16526019)(55016002)(186003)(66476007)(2906002)(478600001)(66946007)(66556008)(7696005)(52116002)(86362001)(6666004)(8886007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: rerkEuX6rVlwe8pwFl4lvvta4AhOIBEQGWJPNoG7De7k07ne3zdEuIxQDt0iJfE4UVa4MEb1jhC6aSk03GTQNgDBOgDAi3uo/svNJaTDgSl3mZvQ5Dl9fzIY/dQMQ9OdtYIKz2TryJ9rZAZMzfvLX+T0+hiCpjlwM8o3Sitrj4D3Gwbv5gcC38i87bVDDApL0mBce1WiH2fdxk599ew1byutdGVeA4jYpGlmuXwUaCq3KRBdOknlZOOvbZTP8gPvlU0RezTEFLdTHtgS1fwW/frNPY3n/gupZnNleJUBmDI8M7hG6AyvCMUVJ1YQLWgYZrCAGYJZxjskzjSQHd42/62MhfgTeDEQUX67TJfxDpYUlAdBEzKaRvqhZtmocc2LqUmWEuhIwdYQj13LcZceezn2vUHGhuc1ljCbLVzU+qscwqjcfK+ZnHxjTsIYd/6046M46nfmbcuPKDiIEaJHYo1RPgJwliUddroDgzSHaii1SnyB0fUa5PaqvB0BscD+bGBDKBoeoJUGygXS5LJbiXIn9c8p1sjl017CU/lACV58a6gpZmsDyFE3ss5Pz8ZQoUDmj+8BHQqx+Q4nnOYmj5/wbPiQjSb/zdlomsOFq1bQ3d4YZdkjFLvmZuj0AAQl9vh93pAInXJ9WDbHvcsjnA== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: f482bf81-a23c-4612-9726-08d880a94368 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2020 10:06:14.4279 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: g4IHb/KPtB5H4mNfbA/yMfCPLGOuMJ25eZVJdIIZzOm3nWA3a2fZYP2tgKrXw5LqA59dNmb4Qai/VZf18qFXtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5834 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_050617_914621_36D03B73 X-CRM114-Status: GOOD ( 18.89 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Currently, we have all boot prints at the end of cold boot sequence which means if there is any failure in cold boot sequence before boot prints then we don't get any print. This patch improves boot prints in cold boot sequence as follows: 1. We divide the boot prints into multiple parts and print it from different locations after sbi_console_init() 2. We throw an error print if there is any failure in cold boot sequence after sbi_console_init() Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- lib/sbi/sbi_init.c | 90 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 15ae9da..253bcfb 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -35,12 +35,10 @@ " | |\n" \ " |_|\n\n" -static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) +static void sbi_boot_print_banner(struct sbi_scratch *scratch) { - int xlen; - char str[128]; - const struct sbi_domain *dom = sbi_domain_thishart_ptr(); - const struct sbi_platform *plat = sbi_platform_ptr(scratch); + if (scratch->options & SBI_SCRATCH_NO_BOOT_PRINTS) + return; #ifdef OPENSBI_VERSION_GIT sbi_printf("\nOpenSBI %s\n", OPENSBI_VERSION_GIT); @@ -50,13 +48,15 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) #endif sbi_printf(BANNER); +} - /* Determine MISA XLEN and MISA string */ - xlen = misa_xlen(); - if (xlen < 1) { - sbi_printf("Error %d getting MISA XLEN\n", xlen); - sbi_hart_hang(); - } +static void sbi_boot_print_general(struct sbi_scratch *scratch) +{ + char str[128]; + const struct sbi_platform *plat = sbi_platform_ptr(scratch); + + if (scratch->options & SBI_SCRATCH_NO_BOOT_PRINTS) + return; /* Platform details */ sbi_printf("Platform Name : %s\n", @@ -75,9 +75,32 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) sbi_printf("Runtime SBI Version : %d.%d\n", sbi_ecall_version_major(), sbi_ecall_version_minor()); sbi_printf("\n"); +} + +static void sbi_boot_print_domains(struct sbi_scratch *scratch) +{ + if (scratch->options & SBI_SCRATCH_NO_BOOT_PRINTS) + return; /* Domain details */ sbi_domain_dump_all(" "); +} + +static void sbi_boot_print_hart(struct sbi_scratch *scratch, u32 hartid) +{ + int xlen; + char str[128]; + const struct sbi_domain *dom = sbi_domain_thishart_ptr(); + + if (scratch->options & SBI_SCRATCH_NO_BOOT_PRINTS) + return; + + /* Determine MISA XLEN and MISA string */ + xlen = misa_xlen(); + if (xlen < 1) { + sbi_printf("Error %d getting MISA XLEN\n", xlen); + sbi_hart_hang(); + } /* Boot HART details */ sbi_printf("Boot HART ID : %u\n", hartid); @@ -208,25 +231,40 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) if (rc) sbi_hart_hang(); + sbi_boot_print_banner(scratch); + rc = sbi_platform_irqchip_init(plat, TRUE); - if (rc) + if (rc) { + sbi_printf("%s: platorm irqchip init failed (error %d)\n", + __func__, rc); sbi_hart_hang(); + } rc = sbi_ipi_init(scratch, TRUE); - if (rc) + if (rc) { + sbi_printf("%s: ipi init failed (error %d)\n", __func__, rc); sbi_hart_hang(); + } rc = sbi_tlb_init(scratch, TRUE); - if (rc) + if (rc) { + sbi_printf("%s: tlb init failed (error %d)\n", __func__, rc); sbi_hart_hang(); + } rc = sbi_timer_init(scratch, TRUE); - if (rc) + if (rc) { + sbi_printf("%s: timer init failed (error %d)\n", __func__, rc); sbi_hart_hang(); + } rc = sbi_ecall_init(); - if (rc) + if (rc) { + sbi_printf("%s: ecall init failed (error %d)\n", __func__, rc); sbi_hart_hang(); + } + + sbi_boot_print_general(scratch); /* * Note: Finalize domains after HSM initialization so that we @@ -235,23 +273,33 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) * that we use correct domain for configuring PMP. */ rc = sbi_domain_finalize(scratch, hartid); - if (rc) + if (rc) { + sbi_printf("%s: domain finalize failed (error %d)\n", + __func__, rc); sbi_hart_hang(); + } + + sbi_boot_print_domains(scratch); rc = sbi_hart_pmp_configure(scratch); - if (rc) + if (rc) { + sbi_printf("%s: PMP configure failed (error %d)\n", + __func__, rc); sbi_hart_hang(); + } /* * Note: Platform final initialization should be last so that * it sees correct domain assignment and PMP configuration. */ rc = sbi_platform_final_init(plat, TRUE); - if (rc) + if (rc) { + sbi_printf("%s: platform final init failed (error %d)\n", + __func__, rc); sbi_hart_hang(); + } - if (!(scratch->options & SBI_SCRATCH_NO_BOOT_PRINTS)) - sbi_boot_prints(scratch, hartid); + sbi_boot_print_hart(scratch, hartid); wake_coldboot_harts(scratch, hartid);