From patchwork Thu Oct 15 13:26:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1382667 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=X/mmU1Eg; 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=gUiRMb3R; 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=apd25Jst; 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 4CBqpP2XyXz9sRk for ; Fri, 16 Oct 2020 00:27:41 +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=ff7+O2Ap7mJXfQWpRgqLW9GfeoCRozjPusLHpdteWKs=; b=X/mmU1EgDeVcXLj4MKbp+r9VL nXdSNpyDsX3cYejSDXF3SXTzugNaw+FkH47mQyPFXvXy7okCP0C9wjMcV2rUlhCdoK0kUosc442Jj WsNCrXEeP28ztsBZvhD9b7Xy5KsT4ILiNpU3vWdvmf8BkM0TFIqGFaUC+efgmcDCJzeO07BVphqkS vz5ld1eehQQHR20w8k1LqHENOyyuSlcg1GLSEHmMkJe8Ky/fe+euCoYetR2owdhD1nqkowfr88ywe bPjSLlnZFXEAgIqcwxI16QBdy5yglhKIamQuGC+DuAw8rzjlK2Ubf8Vf0MIiiC2g0Dxq/9YhCXz6U LIJKaNpTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT3I6-0004Ea-LV; Thu, 15 Oct 2020 13:27:34 +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 1kT3I4-0004DJ-Gc for opensbi@lists.infradead.org; Thu, 15 Oct 2020 13:27:33 +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=1602768452; x=1634304452; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=EVQsQqSSEG4MP/aRPY4zJCMkhGcjbdQelhdiBKMohmw=; b=gUiRMb3RNYZDIVE634imYEtPV62xXBtfwDShqZvvvPwvRIwItrjau5/S AA3PDzLn3sGHsbPfTUVmxIROVw5UvkgY+TyoMOc9WU3nzynm1JDPtp1d0 ZkmrMsFDEwdtHcb07siwyKNETOeQYpMMu5AAcKHmGH6+HJAJ2NFk+GC2Y IvKA9917/nIG0X3DQLe0qqkPx1Cu6n8x41NWmRUwL7SSiW1sWCvXwIgC8 es++BVhsIghbMFyc/gTldwd6VmLl9o37A6EamK26T+NxU7c5nioGEQevx jwg0YI3B5FkpOkSAr3pAW3dgTwaNLqdPV30Pv8nzxfO2UfNm38vGxF8a+ Q==; IronPort-SDR: q6rEkYo3H8KCQQqYHzt/0XoF+siYxsw1Esr+r7QoLUYwRIZoFmgu1pIpPbch8hEwARsIuXPSZb 8QR5z7PmekjT/3BZ6wI51if4Wcma7xGnXed8VfueE8eaCQMgTepiRbzIJck9fD+XnYunUCw55s tPunEYGRLhI9Vxq9TuVL6ncXMDLJEB7XsAFAShMAUNukZJsn7160vvH63SQJ+BgwmO64B9NN33 YIDeAeAOOerHcHE+6Qp+Pi8nTTJ/iqZiERYBazBcv82RraCP/Ralmv+wXwzD5tayr8Px55AU4w YuE= X-IronPort-AV: E=Sophos;i="5.77,379,1596470400"; d="scan'208";a="154457424" Received: from mail-cys01nam02lp2054.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([104.47.37.54]) by ob1.hgst.iphmx.com with ESMTP; 15 Oct 2020 21:27:32 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HbN4t9ZE1Tm1vTCPqauwKUUxoXNwp1nQtM+ACX0WX8wYhDwte9taE7FLXQfAsThjQviu3rvtDzwuB7t1L+IZNgvxN9opGnOdPyfF5wOA3y/CLAHRVEvLEnObat9LdbGtlenPer0alHyCKqjnirNrkb1ey1Lo7ZWVm+6J6l4IvNimlQK+V5jQIew0lniRMMlcFXgGc5KCUwjn7cyzX72IqmHR7o7Fno3p8z/7hHdtSPW8QR0UQ5xZqivOP+5vAQE09B/idpS9k71bi2uXCgqpYbL/ghPK2vCdTtetZTYMQP0ttofXWNOCFNnuJPSr3gp0cz+28EzYG8aBIX+L8BcNTw== 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=aL0MR261MM/VWQytajzIh+kKBAbQvN977leaYfoXwTk=; b=KEuk2iMgQBYlWUfmseSM0DJTY/geDjRqzvC1efctk+odGHX0CiYlXXl46QmzLRcRqc17lW3fy4I3M6ml8QWD6I7LgttTHd4m3U8xDw5f6XPTD51Pov01h7CCm2es3At89+96n0GalfThF51pqWDTWsOyMhOTGNWUHcv4Xm/M+fDeRKL3CNjPTLqkLEcFm746/RcCItFN0B/9fqDPqOZW4biAJ+M2jABrSpftJjTTBI8/78UnVAvoUMB1DA2HPNSjfswIU2e8jRa3zJe5lCtxzqVk+Umz5tGE+H3IEBw15x5tA8ewQXP25CjKE72CCam7b1fvdPuDT82BfoJe/bGWgQ== 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=aL0MR261MM/VWQytajzIh+kKBAbQvN977leaYfoXwTk=; b=apd25JstctYRJEzMlrugFiyC6qGJbU9hLYKkTEOTQWHvjzuRFDw3EW8RAwMOyHWqKuAuNiwEb7FDtSaR/C/b+weppjF4TOOBtZuQRYi9/pWTOIhp/VVEdb/E5c+OWCCGFKOZWWZHdA/xkf9mxTPAoc025fUy/w2HkJVyfppLmfM= 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 DM6PR04MB6624.namprd04.prod.outlook.com (2603:10b6:5:1b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21; Thu, 15 Oct 2020 13:27:29 +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.021; Thu, 15 Oct 2020 13:27:29 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v2 02/16] include: sbi: Remove pmp_region callbacks from sbi_platform_operations Date: Thu, 15 Oct 2020 18:56:46 +0530 Message-Id: <20201015132700.2232820-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015132700.2232820-1-anup.patel@wdc.com> References: <20201015132700.2232820-1-anup.patel@wdc.com> X-Originating-IP: [122.167.44.151] X-ClientProxiedBy: MAXPR0101CA0065.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::27) 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.167.44.151) by MAXPR0101CA0065.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.22 via Frontend Transport; Thu, 15 Oct 2020 13:27:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e2018ffb-3183-43f5-fc94-08d8710e1030 X-MS-TrafficTypeDiagnostic: DM6PR04MB6624: 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: AGNI9tV6mmZckht/aejXhC9MdY8z0irB2AHeTdNcsg8K89OBLAdEp9nSiqi3Jls+B9itwGf4lfOjGOtMPc96pzT84X83jSrBdjrd7ePmpeXLnAT4gykdpkryEitfDToFriJq/QzJc0u84fKca3NO1vgkhu61IS6lWXmUcsIG4S/Aqxh5eDlGnQOg8BC1XGJBGIkoYaivZ2NhAuYwpAYZh/A9NkQzBn7zBIsbLlNFNGKsItlXmLoNAdbOfVXDy29tIof4F2hC7+1LcbNd+leYN0FquLBpALOZggenSFuoFIRJOQ6WY4NfVtdEwQY/LD0gxk51D1UiSKJ9XxrT6x+nQ9mhMbYOk9cCeOy/WyQNhcN3qg5SUGUWCL5w3BocyrM7 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)(396003)(376002)(39860400002)(136003)(366004)(346002)(2906002)(66946007)(110136005)(66556008)(5660300002)(44832011)(66476007)(36756003)(6666004)(316002)(54906003)(8886007)(8676002)(8936002)(86362001)(34490700002)(1076003)(52116002)(26005)(16526019)(186003)(55016002)(83380400001)(478600001)(956004)(2616005)(6636002)(4326008)(7696005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: aGJjg68cYg/dMarjR+1aW4hq+B57G078YD4obZ4i4P5FrDXemAhNnjR7iDSMCWJ8cGirBunsf3o4XlGLI/ZdGW1yntRT2FJQDz1R6yD8gDFcg/eVx+ZbG9h689omUyMMqDGW1omx4buS0JKWNbA6oD+Tf3a0yC6+ls0Hb+9Y5LBxPiO31ie/lu8pkrbUEGTSuzNMvjqZv6kkROLmH3gZFZi8Fdy40WZFW358fOjLvZzmLaS+rgq9kmYOq902kogYiY5sfDErIQxIa7yF+Pkakd6kD9H82Hwak8JmQYVuzWnmEGqlfDgzfcXWnmbaKBTScgO7fq+CTq/qtXzTIRFXB0C4odgLHLCOlywEh16eYyID53gaQfWQ+MqehsEu+uW8j5EH87IEhAHuRh1V6q0qj1x+hKNjiLX1ZCk491M+NsHmhP5NV3O2QgCMMGfZ0S/BUtwUHEFPPVoRzYo4U2FKrkpTqpw1uL18hnmtFu60Z52bYvpyYKJz38qCn0ggQ/ErHkSCS9XvNKF58wc2TceEStR2sV56U26hma4QDiOx3BI+NP+cB+uJTf1qtBK3zaxtrB5ecZhxF5DM8OCHn1bwlUl2mB4HawIx2l4ikxho8lOxgVHz1eKKxCEXO2ipKOWuGbsxueiBGnekjd/vT8zGSg== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2018ffb-3183-43f5-fc94-08d8710e1030 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 13:27:29.4057 (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: uzBHDxSCOIhdGzbTuZxLRuCRsl1OAz0jCkYkUxeLxyAQA7duMt5IVY26YiA1nfkv7T878txsPpZR9rZAz1u9fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_092732_812684_F1F5F59E X-CRM114-Status: GOOD ( 18.59 ) 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_EF Message has a valid DKIM or DK signature from envelope-from domain 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.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 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 --- 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: