From patchwork Tue Oct 20 09:39:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1384752 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=Ni8tJS6Y; 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=gtX7Gem7; 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=fbrETcRZ; 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 4CFpf70qs9z9sRR for ; Tue, 20 Oct 2020 20:45:51 +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=Ll0yqVlylFRTNFXyWs2M6yo1vuseklpKx0mAjH2A00g=; b=Ni8tJS6YPjKAyMMC0syz5WYPl dawUTYI68+WfuaamqkkLdh39tYoz4KKLy3hqx1cP74q3cjHV+GlcbkKt/TpqlC03Sr7ZSjWjTGE2U MAJVmG+m9zthvk5hGT+ynRcUSVxSBDeQ1+gJEwFNR4LpcMK9X+lcKx51Ng7yT8dcZDIRaP1McCMwU vuy1eOmYbVpXjPXMTcvs1G/JUkjAks+RStmbfA0qudmuQ2wMjjXOYEfRjmpO7cj1jNh3TY4gp0TnW zau0e858isqu8O/NzKpfypFSbhKO4zPAKrSuFpu7v60yCQK3FVhIN0bfzbLU2/LYUnpaAk2MBbXJ4 412t+dmDw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUoDB-0002kE-U8; Tue, 20 Oct 2020 09:45:45 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUoD8-0002iv-Jn for opensbi@lists.infradead.org; Tue, 20 Oct 2020 09:45:43 +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=1603187188; x=1634723188; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=rOwONRIdOzNSvuiO+1CcEbzXQ8vartgu6+4WIIxnEIw=; b=gtX7Gem7Vfu1RyEEkB38WwAZ/8XuV3dv6inPqWrPXuCzMHR5983Tq2Ir oJOL+PwbSjYVGqya8Bd8EQQpfq2JJ91kyTMtE7/h66KMfA1TCZM81iRXq qGfmgFlMo98idOwBj6X6sbBNaRuIk9e2/i2z0S3T/Zny6ilSQC4ykBq5K NVnSR4A9k1Vfi4mhsyXtwl9vq+jT7vUfKAr7MXVnMeK1VPnUY3Wj/xvPl BN9RcxUn1ZomaYeJLImGZrfjqxxMxTDXCswCoIljNgMBFUzaPnCreraN1 cPUct4NdnRXbuHccf7jFDr6ZyPQU7ZmmP2rWxRBBG8eRQwwjF+aEJJl70 g==; IronPort-SDR: +oaobJ1RgXDAoCK8yn6wiI+JmJoDh/jO2NIpdRffssZSEIUDAgSO6qNedDZI8Ms6djLqKjDvTX TPVcMoTag/nf0B7lP5WGfMQU0d5voRow01GBpiIFkx987RbA4cZ3BwFV3S78nC8FopizrDbR6z 4s0QigLmpxgi5sI+OL1bz0U22sOO3ntA0CBCT84YszVMo4lTPugHikPtU+L4jQSxEV/of9mHbt Hp5+2nqKy5xw4O70DYbdX9RuMNRvdxRf1rp0ixKA1LBLdCLD1aIlYTBVqQiZ3mUTqJja+uSYne hqg= X-IronPort-AV: E=Sophos;i="5.77,396,1596470400"; d="scan'208";a="253896129" Received: from mail-mw2nam10lp2100.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.100]) by ob1.hgst.iphmx.com with ESMTP; 20 Oct 2020 17:46:26 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ngHMfB9hm8ZwybmuPNMUOtKrHXniR34BuIjgrvR6/EK0Ic6tbNcXArhgmKzyu3d6Q6sdKMBAwL4Q7ym50EPj38uXRAeRoC2T22EHRA4H44tYV/XgF654QtT14/vGKUxccXJE5yxKYj5Ehw0S2SkBPjA1UZL/d3DXLtgK7p3Cf4qJiTeLQHmb0pthTkDAKU6wXPcUtbV/ZaErcRSAAP/zVeGASbCFWPn76yzVgNbRS8hlHSue9xYMMQDMMQhW5l6sclYtUosIEHxp+NZQAI99VkE+9jIxJWcpD4D8k8myHbHOaZLF3A4RusFlc/g0is6tariJClsKI3bfJ+4z69J1wA== 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=WdqND45w17mP35HDTDTcCl2nsKLAxGtE1JnP5YJQkv8=; b=CxL1bDNvnkIyCMv22EBX2/TJlpFbI+E/NLJpBF5HxmCHPUI2ZAc4jhDcdwtHu4DPtO51EBc0GCEJurP8gkONWPI/2KUtzDxfVA+GOd1WYZbAEcRZE7Ntms0c4DqVymi+LjpToJeLVFjGNGDvh05oWdNJPFRkaoPOKKMGWBewm3xNYP50u0OI6L3k0qIN9qjowYj/6Ga0ULVGYAZ2vUXrYYm7pICg50JrPXRhUpdckHF5rNFZ4iiCYx4vBoq++ZC/g3FAlY7bhZODdGVUuBeo+GhbAflcw7Q/UZUQArUkCcJa1LzT8NI5NgcZw9pUbH76oeOdMMGMLZFnwX5fyy355g== 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=WdqND45w17mP35HDTDTcCl2nsKLAxGtE1JnP5YJQkv8=; b=fbrETcRZaCjPRwe+OdQtO8uZvq0ofCdhsi9MsNTCjbUrBokGlTNDDWe/x2PoIv78pk3tF0jn19RsVGVb7Kdji8cSw0TUYy3ru+27WeqayBxP4Fbl+M7Dk6AAJCU3LOPwd3kA+Q1fvFJvKuDiKqklHH3MK29otCzxH+nRtUiLRX8= 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:45:40 +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:45:40 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v4 02/16] include: sbi: Remove pmp_region callbacks from sbi_platform_operations Date: Tue, 20 Oct 2020 15:09:16 +0530 Message-Id: <20201020093930.2551352-3-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:45:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 29d804d3-d87f-477e-6735-08d874dce788 X-MS-TrafficTypeDiagnostic: DM6PR04MB5833: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1060; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2/IPJf6CmlHMSqUYcsQK100tBhLZdxrleU5RCuqvbtTeBeXve9DvRYKOQ7/bmsJ41py8/Evjm+LtVvngY4YQEGp2WcA4DzV/vdRkt3Kd9dS1mdNxK2KDJmkI/ixflHUwXTu5XVDcC9KOI+xrIbsifWNodoEZqV4Ydlazvhm8WMYY1Dm1N0SPQdBZzCahyFkcdih+9zbuiLkLLREXBi0pumEMHihDHirpAMKUNHtXYqOymdRzZ95OYu+5hAQcW5PhQ1Lx+/sl+ihjwg9DTdAcOjm3pdlPg6XxCyo533mtWTfBm6YXinfkKVwLBNDQ99KQsBhhrhCKbR3XNccZTDkB0A== 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: vkWqSPlcUv29MGvO/N28ZVStZmmPBt834WPwODvHt9jPXe9MUVMSdmSvgMQ6S8Vzf7c1IjDunsdddSw2jcdE0H5BBDh+CAx3ibY/JyP/HiBk8VEqbDvZYLdTdKbP/4N4st30Ey7hJkfrK6zkAcFyz2xYq7DOz9/Xypv1wLWeAD+QfwyYwMEdOwLKh4mJU/TVhh+qTADVbzWM6j3+PGZT9crzs0l3yz2+zq7uY6177jbzRrKBYdNxWnWELJIKylCS7jKOzptTDUnxrSpIxGco/XLK0zRxzw46cx8JJFirDQF3ZvzPOU9s3G2rVU5pNf1edOY9VAybUWPp3czbB2HYz08rV397juoKYHweBPtaQV5oWR1rK4jC4sp5R8+hoaHSu+QCNM2iMxOpb7T+l2K+ULc2f8FZwKX8ekWt8u7rZCV3SAV6BIeHreN7WvXuq9mpVQAdM+kPZumnAJCnpow3X20E9kk+RvxqvHLpgoxZb4DOq3P0NciEq0h9hVAmVRPKYBiGVhD2PJvzXZFwyOWT51Zird9nSXg2pYiMXe7Q05lY7Hv8KCQjq/1lUk0oLew3+N+S8OrjGpXmt4+1F/lRFU+p9qcVR86xrhGwbAlMyVex90R7kboMcKCuUgeJiIHXasjxDlrLdFxGH0/vgwX1eA== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29d804d3-d87f-477e-6735-08d874dce788 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:45:40.2166 (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: 1L16f2wr3ZfrdQCAfQOzhY3J2U4atMSsGeK48uBZVsPXkIlW4IXL2Jr22IGowpT7qtkVdulCKIYdeyQlB/O0Cw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5833 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201020_054542_780959_3C760CEB X-CRM114-Status: GOOD ( 18.17 ) 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 [68.232.143.124 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 , Alistair Francis , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The pmp_region_xyz() callbacks are not required in sbi_platform_operations because we will be using OpenSBI domain memory regions to program the PMP CSRs. Signed-off-by: Anup Patel Reviewed-by: Atish Patra Reviewed-by: Alistair Francis --- include/sbi/sbi_platform.h | 50 -------------------------------------- lib/sbi/sbi_hart.c | 14 +---------- 2 files changed, 1 insertion(+), 63 deletions(-) diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index f51e36a..f2c3237 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -89,15 +89,6 @@ struct sbi_platform_operations { */ int (*misa_get_xlen)(void); - /** Get number of PMP regions for given HART */ - u32 (*pmp_region_count)(u32 hartid); - /** - * Get PMP regions details (namely: protection, base address, - * and size) for given HART - */ - int (*pmp_region_info)(u32 hartid, u32 index, ulong *prot, ulong *addr, - ulong *log2size); - /** Write a character to the platform console output */ void (*console_putc)(char ch); /** Read a character from the platform console input */ @@ -456,47 +447,6 @@ static inline int sbi_platform_misa_xlen(const struct sbi_platform *plat) return -1; } -/** - * Get the number of PMP regions of a HART - * - * @param plat pointer to struct sbi_platform - * @param hartid HART ID - * - * @return number of PMP regions - */ -static inline u32 sbi_platform_pmp_region_count(const struct sbi_platform *plat, - u32 hartid) -{ - if (plat && sbi_platform_ops(plat)->pmp_region_count) - return sbi_platform_ops(plat)->pmp_region_count(hartid); - return 0; -} - -/** - * Get PMP regions details (namely: protection, base address, - * and size) of a HART - * - * @param plat pointer to struct sbi_platform - * @param hartid HART ID - * @param index index of PMP region for which we want details - * @param prot output pointer for PMP region protection - * @param addr output pointer for PMP region base address - * @param log2size output pointer for log-of-2 PMP region size - * - * @return 0 on success and negative error code on failure - */ -static inline int sbi_platform_pmp_region_info(const struct sbi_platform *plat, - u32 hartid, u32 index, - ulong *prot, ulong *addr, - ulong *log2size) -{ - if (plat && sbi_platform_ops(plat)->pmp_region_info) - return sbi_platform_ops(plat)->pmp_region_info(hartid, index, - prot, addr, - log2size); - return 0; -} - /** * Write a character to the platform console output * diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 55a04da..edf79b7 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -226,10 +226,8 @@ int sbi_hart_pmp_check_addr(struct sbi_scratch *scratch, static int pmp_init(struct sbi_scratch *scratch, u32 hartid) { - u32 i, pmp_idx = 0, pmp_count, count; + u32 pmp_idx = 0; unsigned long fw_start, fw_size_log2; - ulong prot, addr, log2size; - const struct sbi_platform *plat = sbi_platform_ptr(scratch); if (!sbi_hart_pmp_count(scratch)) return 0; @@ -239,16 +237,6 @@ static int pmp_init(struct sbi_scratch *scratch, u32 hartid) fw_start = scratch->fw_start & ~((1UL << fw_size_log2) - 1UL); pmp_set(pmp_idx++, 0, fw_start, fw_size_log2); - /* Platform specific PMP regions */ - count = sbi_platform_pmp_region_count(plat, hartid); - pmp_count = sbi_hart_pmp_count(scratch); - for (i = 0; i < count && pmp_idx < (pmp_count - 1); i++) { - if (sbi_platform_pmp_region_info(plat, hartid, i, &prot, &addr, - &log2size)) - continue; - pmp_set(pmp_idx++, prot, addr, log2size); - } - /* * Default PMP region for allowing S-mode and U-mode access to * memory not covered by: