From patchwork Tue Oct 20 09:39:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1384766 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=JVx9snR1; 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=S/d18wvC; 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=KjoIVyuR; 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 4CFpfm0FxBz9sRR for ; Tue, 20 Oct 2020 20:46:24 +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:References:In-Reply-To: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:List-Owner; bh=R7P8GYLtBzxV5ajw7wYzvMIQK4F5CAMHCQMrIXTwox8=; b=JVx9snR11CIMQU6Dvvau/o1/z zBEU/SHx44zxus98eix0Ie9Mm7t6QcyYjGUmZWpkNmFwm8hetLAFItlpFPXJyK0oV43sGpMiD1UJV DAhCWJCnF/RGhNS78BI5u36VtEJc2JbUcrZkFkghPXX8qEEdaMwCDzLvGkg1mDucmSyTj2YZTqHG5 qBvNu765s4wk2NqP2IrT/WGrCS4qkyuyOkz/benzBplTbhLAmp7S3V4VbRGDdkPV1Yji2ZCrW0CYl i5iqNNkvS6MWHPrqrLyzjLdwbGZAWYBGQmW4ApDTnjJm7NlROh/fTi8J5+G2xAr9ZaLpM2jer+2qc 0IFVpbKjw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUoDi-00033i-OU; Tue, 20 Oct 2020 09:46:18 +0000 Received: from esa6.hgst.iphmx.com ([216.71.154.45]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUoDe-00031G-Vr for opensbi@lists.infradead.org; Tue, 20 Oct 2020 09:46:16 +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=1603187175; x=1634723175; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=NwNFyYesh9QWph2DaQxzAgvvXsuD019UtIs8g/H7mVQ=; b=S/d18wvClinKdWrpGj+G7CeSAnzMk3b+gH7NcYRlYgUMt4o1fwYKCJr2 sCJ5E5AOxIxPhwWE4EWh158StOnEJV2NFhziEPeX6IgIjCujKPIacl61F vBaoCD2YeXR1e+FGYs9vlnb9Pcnh/GL/sqUcKMZhnzkbhnEfxoX+jCocs p9TS8uymdJV45+k3IRM14Kti3b1ozpwDcHWkQijmommQhAHYoMEPs5rZR 6nk4GzfTRzj5F6gMzKm6i/pSzIHLcIBGV7oHgAlDrouIsmPWTyRnCKXIQ jrXYilF07X/BzPS2/nUzwSeAJa46PqktT8xvoRK2gmhH6TrkjX1QT3cXq Q==; IronPort-SDR: evh93I9VrV2GhKtH8MUF485uN4BIUFT8PVyt0nkK3nre8LmyYAx/Hw05W3xOzJOgmH9Qk7Fbr9 4EJuo+lbMtzVeinT/1ZgDM+80TxosAm1fg4lhtddL8qndtG/GCnBt0Ar/bZtkgCmDp33yVlup7 4/7bFkx4dSy4gabi4jwpOc2o+6zzcYuzmzi4y6+zTvSTjfPJHm1Pxz7Y773IJTpXKcQhW1r/fL rjFUnyRsaJT/mARFabdbhohqwj4gGcFPfarL6qc5mI0W8BESjUK0FWmIoN0rnSstktoIRiKk3n QTA= X-IronPort-AV: E=Sophos;i="5.77,396,1596470400"; d="scan'208";a="151634537" Received: from mail-mw2nam10lp2106.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.106]) by ob1.hgst.iphmx.com with ESMTP; 20 Oct 2020 17:46:14 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jSayaRRNYRH7yJ67uiiemmV8hTMZMGTu7FLGILLkBqC7EveqP8Zt7p4A7Y38o3VWK8fX52tBeBEmzNBo3nktuidi1wDC7C0AKLaIVGEz25+woshRJH6j2iRKyM5yMNaNJv4UMLXWAwUIzharwfnX1Vsd2y3tFS7TNoa0Z6kn11VK+6AcWJiOC8JbVdkESBvHh9mFUIQW1MRST9SQyrA4iKxJEfzzbyizlzIIxKe3Pdl542iyLoHnKCpelHutF3f/m7dx2I1evbh2b5+IiGQcoG2YoSCrvgXWXMS0DkhlnXkY0x1MZXa4ckYo9FoS5EIZnmvFyE18uoCjLytMjNDPkg== 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=Le7IMyk1pn7CAi7as91+AMENFox5sPHHPqiG7nzxzeA=; b=oM/av0xtNnxxkpM8QwLl+PTihIs378JH3Xv8toQyExaMcDa6KtdBYwZ7ssYJW3cjBkJtH1ZvGPUkr8v4jxG92X6qRZnXZR6Nt9stSHwU0Tc8jiQLXOj+GfforrIaoED3E2QMG8OnhfOB+uDB4NAZRwC/Alvt8D3SQ6a+vP4YzjjiZLb0iIsfyjwio2kmV8MlUtzACEOr9ctwlLSz/fd74UvVxds9wGhzaS+Vf0vIVtF1/wcmEW0nizNR6qFlLCzp9AU1ulWrLomgPUu76oSmqTebV7alSd0z5VWkrBNvzZKBD27A8yeHVbNGdeuRZH53PAOygjKwiuOpo6pl+GmWkg== 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=Le7IMyk1pn7CAi7as91+AMENFox5sPHHPqiG7nzxzeA=; b=KjoIVyuRRmD6Sn/988a4NCirdf9JWXrzoQyu1YRRhAx7NJLNap/bQoTCag34jiaXRszmtt4jdNDH00BZbQ2kpGfnB7+cuWs8ncIecuRB3SxH1cG8KNQitzDl7M/FUhWaxOUdz6cD0X+cxKrLz8fuqhlhRvSdjNNu34ISQicNnFk= 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 DM6PR04MB5833.namprd04.prod.outlook.com (2603:10b6:5:16d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Tue, 20 Oct 2020 09:46:13 +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.3477.028; Tue, 20 Oct 2020 09:46:13 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v4 15/16] lib: sbi: Display domain details in boot prints Date: Tue, 20 Oct 2020 15:09:29 +0530 Message-Id: <20201020093930.2551352-16-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201020093930.2551352-1-anup.patel@wdc.com> References: <20201020093930.2551352-1-anup.patel@wdc.com> X-Originating-IP: [122.172.254.103] X-ClientProxiedBy: MAXPR0101CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::17) 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.172.254.103) by MAXPR0101CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 09:46:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 153d580e-3423-48a2-3917-08d874dcfb27 X-MS-TrafficTypeDiagnostic: DM6PR04MB5833: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:343; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UbZxTIr4+9/akycXurHHlOTzcDQur83o5aAtmDXhiqaRXqu36Y0VCjZEujsEHN9Gz5P9ckPOGQEfmoaef45tqUpEvTTRbc2wSds4+IBjlEOD7eKtzZHVGvXXuz4FoOku3vwA+BHpqTjT3IQNuCyOlRlkz118knV4MEcqJVtqfzpw4JNhRQZzbM0yfGBd5tafsUcbJPE6snjurShhpfA819CVawwt0/qgXQAT1E+lJL9B/2OFYtbUHGqBtZMvtwIyX6cEqRw415fEvTENKRsUfiMYlg0WVmF0AMFRv5rKRAQSRCzHHvLpeLeSGaXAPk/+3CbP/CBDNyxqICeFkclxmQ== 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)(376002)(396003)(346002)(39860400002)(136003)(366004)(6666004)(2616005)(2906002)(956004)(1076003)(55016002)(8886007)(478600001)(44832011)(66476007)(66556008)(5660300002)(66946007)(8676002)(54906003)(316002)(83380400001)(16526019)(186003)(110136005)(26005)(6636002)(55236004)(8936002)(52116002)(4326008)(7696005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NlqXO9VFNNf0ykIhi/U7yIgAzrDKNGHB76yyVgOsHxbQpnQkOUdjITqsVq5nJcQUgaGWOPbwcnZrVem8bZLL5judH4RMr601qd12LWFy7iBuPk2ySuB+g/HD4c8gn2O310S8dSrIBfOaxfJ4ywyPaobjNDHicdo0SRiW36ReJcsEYdvKarbqpl+L2OQwiM9nbcKONz+w0Ok5sWAuwfyCKfhysUuCoh3pB0kl1/8QeyqtEqKdxb1e+GGpS3NAjVBjpv4ehOnV8Fb0+b3AuCzAahEFtNo/IQ4NmUb/Y4tPTsO5Tt4aVe6dKFVCJQSRitU4O6EjbcI+JvG8FzmNMAC14U9QSWLtb4Iy6qROJKyLYvVC9lLuwHRz0XOsC1J9c3Mumqh5JYxrdg3E+zglzkd3YdKbz3aR2++9BhDJpHlDZ9gNffLmx8ftXdXtGILQUFgRDr6HX+3Xk2LHAWiHumV8uVvecrl+Dmrz2mt9Ze0wL0ClzPnXSfVVzXbMwxbXDRjMKfS9ZUrPLikFm2w7hUdgiZCEgZf2j3KlBdpQomMBqwWgObyPN8CIBoAHUEywQKSbXTNkThfc3Wx8FWQ3NFUC+hFGFAGLZP14R68NkAQbRpznHNqmiWd6faKY453Ve9TQrfDijPvegIzEnwr+KbhrcA== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 153d580e-3423-48a2-3917-08d874dcfb27 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2020 09:46:13.1311 (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: E/isTT9PRoXblnOARHMV+uxSa87AHwj+mHTDoIopVSkaENemvCLIg1Jzu6wN7WkG1JWB289iFoaZNHOveIi5Kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5833 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201020_054615_239993_FC80D52D X-CRM114-Status: GOOD ( 21.35 ) 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.154.45 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_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.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 We extend boot prints to display details of each domain. In the process, we remove sbi_hart_pmp_dump() because it shows redundant information which domain details already show. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_domain.h | 6 +++ include/sbi/sbi_hart.h | 4 +- lib/sbi/sbi_domain.c | 94 ++++++++++++++++++++++++++++++++++++++++ lib/sbi/sbi_hart.c | 44 +++++-------------- lib/sbi/sbi_init.c | 27 +++++++----- 5 files changed, 127 insertions(+), 48 deletions(-) diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index 4bb08dc..6f90b26 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -138,6 +138,12 @@ bool sbi_domain_check_addr(const struct sbi_domain *dom, unsigned long addr, unsigned long mode, unsigned long access_flags); +/** Dump domain details on the console */ +void sbi_domain_dump(const struct sbi_domain *dom, const char *suffix); + +/** Dump all domain details on the console */ +void sbi_domain_dump_all(const char *suffix); + /** Finalize domain tables and startup non-root domains */ int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid); diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 79d745a..3ac1500 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -36,9 +36,9 @@ static inline ulong sbi_hart_expected_trap_addr(void) } unsigned int sbi_hart_mhpm_count(struct sbi_scratch *scratch); -void sbi_hart_delegation_dump(struct sbi_scratch *scratch); +void sbi_hart_delegation_dump(struct sbi_scratch *scratch, + const char *prefix, const char *suffix); unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch); -void sbi_hart_pmp_dump(struct sbi_scratch *scratch); int sbi_hart_pmp_configure(struct sbi_scratch *scratch); bool sbi_hart_has_feature(struct sbi_scratch *scratch, unsigned long feature); void sbi_hart_get_features_str(struct sbi_scratch *scratch, diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 9bde5fb..d4b82fe 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -243,6 +244,99 @@ static int sanitize_domain(const struct sbi_platform *plat, return 0; } +void sbi_domain_dump(const struct sbi_domain *dom, const char *suffix) +{ + u32 i, k; + unsigned long rstart, rend; + struct sbi_domain_memregion *reg; + + sbi_printf("Domain%d Name %s: %s\n", + dom->index, suffix, dom->name); + + sbi_printf("Domain%d Boot HART %s: %d\n", + dom->index, suffix, dom->boot_hartid); + + k = 0; + sbi_printf("Domain%d HARTs %s: ", dom->index, suffix); + sbi_hartmask_for_each_hart(i, dom->possible_harts) + sbi_printf("%s%d%s", (k++) ? "," : "", + i, sbi_domain_is_assigned_hart(dom, i) ? "*" : ""); + sbi_printf("\n"); + + i = 0; + sbi_domain_for_each_memregion(dom, reg) { + rstart = reg->base; + rend = (reg->order < __riscv_xlen) ? + rstart + ((1UL << reg->order) - 1) : -1UL; + +#if __riscv_xlen == 32 + sbi_printf("Domain%d Region%02d %s: 0x%08lx-0x%08lx ", +#else + sbi_printf("Domain%d Region%02d %s: 0x%016lx-0x%016lx ", +#endif + dom->index, i, suffix, rstart, rend); + + k = 0; + if (reg->flags & SBI_DOMAIN_MEMREGION_MMODE) + sbi_printf("%cM", (k++) ? ',' : '('); + if (reg->flags & SBI_DOMAIN_MEMREGION_MMIO) + sbi_printf("%cI", (k++) ? ',' : '('); + if (reg->flags & SBI_DOMAIN_MEMREGION_READABLE) + sbi_printf("%cR", (k++) ? ',' : '('); + if (reg->flags & SBI_DOMAIN_MEMREGION_WRITEABLE) + sbi_printf("%cW", (k++) ? ',' : '('); + if (reg->flags & SBI_DOMAIN_MEMREGION_EXECUTABLE) + sbi_printf("%cX", (k++) ? ',' : '('); + sbi_printf("%s\n", (k++) ? ")" : "()"); + + i++; + } + +#if __riscv_xlen == 32 + sbi_printf("Domain%d Next Address%s: 0x%08lx\n", +#else + sbi_printf("Domain%d Next Address%s: 0x%016lx\n", +#endif + dom->index, suffix, dom->next_addr); + +#if __riscv_xlen == 32 + sbi_printf("Domain%d Next Arg1 %s: 0x%08lx\n", +#else + sbi_printf("Domain%d Next Arg1 %s: 0x%016lx\n", +#endif + dom->index, suffix, dom->next_arg1); + + sbi_printf("Domain%d Next Mode %s: ", dom->index, suffix); + switch (dom->next_mode) { + case PRV_M: + sbi_printf("M-mode\n"); + break; + case PRV_S: + sbi_printf("S-mode\n"); + break; + case PRV_U: + sbi_printf("U-mode\n"); + break; + default: + sbi_printf("Unknown\n"); + break; + }; + + sbi_printf("Domain%d SysReset %s: %s\n", + dom->index, suffix, (dom->system_reset_allowed) ? "yes" : "no"); +} + +void sbi_domain_dump_all(const char *suffix) +{ + u32 i; + const struct sbi_domain *dom; + + sbi_domain_for_each(i, dom) { + sbi_domain_dump(dom, suffix); + sbi_printf("\n"); + } +} + int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid) { int rc; diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 1871a1e..ff18c9d 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -123,18 +123,23 @@ static int delegate_traps(struct sbi_scratch *scratch) return 0; } -void sbi_hart_delegation_dump(struct sbi_scratch *scratch) +void sbi_hart_delegation_dump(struct sbi_scratch *scratch, + const char *prefix, const char *suffix) { if (!misa_extension('S')) /* No delegation possible as mideleg does not exist*/ return; #if __riscv_xlen == 32 - sbi_printf("MIDELEG : 0x%08lx\n", csr_read(CSR_MIDELEG)); - sbi_printf("MEDELEG : 0x%08lx\n", csr_read(CSR_MEDELEG)); + sbi_printf("%sMIDELEG%s: 0x%08lx\n", + prefix, suffix, csr_read(CSR_MIDELEG)); + sbi_printf("%sMEDELEG%s: 0x%08lx\n", + prefix, suffix, csr_read(CSR_MEDELEG)); #else - sbi_printf("MIDELEG : 0x%016lx\n", csr_read(CSR_MIDELEG)); - sbi_printf("MEDELEG : 0x%016lx\n", csr_read(CSR_MEDELEG)); + sbi_printf("%sMIDELEG%s: 0x%016lx\n", + prefix, suffix, csr_read(CSR_MIDELEG)); + sbi_printf("%sMEDELEG%s: 0x%016lx\n", + prefix, suffix, csr_read(CSR_MEDELEG)); #endif } @@ -154,35 +159,6 @@ unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch) return hfeatures->pmp_count; } -void sbi_hart_pmp_dump(struct sbi_scratch *scratch) -{ - unsigned long prot, addr, size, log2size; - unsigned int i, pmp_count; - - pmp_count = sbi_hart_pmp_count(scratch); - for (i = 0; i < pmp_count; i++) { - pmp_get(i, &prot, &addr, &log2size); - if (!(prot & PMP_A)) - continue; - size = (log2size < __riscv_xlen) ? 1UL << log2size : 0; -#if __riscv_xlen == 32 - sbi_printf("PMP%d : 0x%08lx-0x%08lx (A", -#else - sbi_printf("PMP%d : 0x%016lx-0x%016lx (A", -#endif - i, addr, addr + size - 1); - if (prot & PMP_L) - sbi_printf(",L"); - if (prot & PMP_R) - sbi_printf(",R"); - if (prot & PMP_W) - sbi_printf(",W"); - if (prot & PMP_X) - sbi_printf(",X"); - sbi_printf(")\n"); - } -} - int sbi_hart_pmp_configure(struct sbi_scratch *scratch) { struct sbi_domain_memregion *reg; diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 406cb3f..5151d36 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -39,6 +39,7 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) { int xlen; char str[128]; + const struct sbi_domain *dom = sbi_domain_thishart_ptr(); const struct sbi_platform *plat = sbi_platform_ptr(scratch); #ifdef OPENSBI_VERSION_GIT @@ -64,27 +65,29 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) sbi_printf("Platform HART Count : %u\n", sbi_platform_hart_count(plat)); - /* Boot HART details */ - sbi_printf("Boot HART ID : %u\n", hartid); - misa_string(xlen, str, sizeof(str)); - sbi_printf("Boot HART ISA : %s\n", str); - sbi_hart_get_features_str(scratch, str, sizeof(str)); - sbi_printf("BOOT HART Features : %s\n", str); - sbi_printf("BOOT HART PMP Count : %d\n", sbi_hart_pmp_count(scratch)); - sbi_printf("BOOT HART MHPM Count: %d\n", sbi_hart_mhpm_count(scratch)); - /* Firmware details */ sbi_printf("Firmware Base : 0x%lx\n", scratch->fw_start); sbi_printf("Firmware Size : %d KB\n", (u32)(scratch->fw_size / 1024)); - /* Generic details */ + /* SBI details */ sbi_printf("Runtime SBI Version : %d.%d\n", sbi_ecall_version_major(), sbi_ecall_version_minor()); sbi_printf("\n"); - sbi_hart_delegation_dump(scratch); - sbi_hart_pmp_dump(scratch); + /* Domain details */ + sbi_domain_dump_all(""); + + /* Boot HART details */ + sbi_printf("Boot HART ID : %u\n", hartid); + sbi_printf("Boot HART Domain : %s\n", dom->name); + misa_string(xlen, str, sizeof(str)); + sbi_printf("Boot HART ISA : %s\n", str); + sbi_hart_get_features_str(scratch, str, sizeof(str)); + sbi_printf("Boot HART Features : %s\n", str); + sbi_printf("Boot HART PMP Count : %d\n", sbi_hart_pmp_count(scratch)); + sbi_printf("Boot HART MHPM Count: %d\n", sbi_hart_mhpm_count(scratch)); + sbi_hart_delegation_dump(scratch, "Boot HART ", " "); } static spinlock_t coldboot_lock = SPIN_LOCK_INITIALIZER;