From patchwork Thu Oct 15 13:26:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1382678 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=VlRZ/Sv/; 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=RmIWc9i1; 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=l6QLOxXC; 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 4CBqq35jFxz9sRk for ; Fri, 16 Oct 2020 00:28:15 +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=BP9aMiYuf61TGDP1s37btJtjsAObMVUqePpx/y/K7CI=; b=VlRZ/Sv/DSOlTH8sTdZWiCRrv 23Vh/vxYwwwGvl7DI0Cd5SEdz1ZD/OrZEEr+kKTxYb7f2Ryj55yqiy8Uf3NLAUPsv1X77eLqx1Pez YRQe8ixHZ408kcHpdQ8HP2EszlmGIn/jt/4DaufGFZ+n+DSZsaVavyYDhpBo1S7lT1TcQkmGlwaeC 4LE3RsTyjXSsUVW3Vz4PtCIAckT6znTlqsH0q4ywtmodXznv7/Rj5kwhhav+zwImNsNfXlc+1X4YA uh0rInxqRWFHkABm38v/TJ38fG7VLrfa77+7eKnfaIcN1V/R+MfhhMahnlUatP2oYyg23XTz1+BrJ xCT0uSUvg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT3If-0004Xf-HI; Thu, 15 Oct 2020 13:28:09 +0000 Received: from esa4.hgst.iphmx.com ([216.71.154.42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT3Id-0004Vx-HF for opensbi@lists.infradead.org; Thu, 15 Oct 2020 13:28:08 +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=1602768487; x=1634304487; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=AJnECo3exLPpj9Zpdy5rDbD+lcUNiRSUTDVnSE1Q/n0=; b=RmIWc9i1WsugAXseN+piIGOWTwEZLVd/++dbipWqYkzkRM+nkcfUJGyK 9Qb9d41Ux8VwQciEOOTjdCvrqDPYfNqeyFp3nx8rONaH/Ep94QkvkwZ58 JqjFjgpMFch77x50759iRIru3BFlStSDyBnajObFfkvxztGsBfWQT2+mu X+hRMSVvzNEwecpttZ/l8M+lJrnaEirhG/CkGx1brrWcO64mcbvBS5ltB YYLRdR4IsHMM6WZ+zM6rYYF55WxTpnUmpCuFEe6osd+QJuLMixiN2gbOq zJAeJBZe5/dAEcWJCja/XLHhbArJ3PdczlQnB9HqMbg1QGSNhwtqHIlnu Q==; IronPort-SDR: 30Sirbo6jrQi1mxQvC5yG2HfOYADSEPnNt4/BuENieYhK+QAwqXRz0mXLdoRH86Sow/Gy0XdUu 4i7VspsrAh+eQoHaVFgYkGy5jgUoXofjToz1EDR/jyha3+9wzgrshzmdI4dY+TVCLQj7GQwwYn r7XZjtVl05mz97Ru16F3I3VXUsGuFQ++ZPCRjBMRryIM3/9XZZQUaXGwZDhverj6wmUheTM65L X+zYAoMhA9vF5wYWNXL4soA5wyYTeQfcA3+WzMypEg6HnALkZFC2Vyjj5AoQpRv9NL2O+WLEdU /uQ= X-IronPort-AV: E=Sophos;i="5.77,379,1596470400"; d="scan'208";a="149952388" Received: from mail-bn8nam08lp2041.outbound.protection.outlook.com (HELO NAM04-BN8-obe.outbound.protection.outlook.com) ([104.47.74.41]) by ob1.hgst.iphmx.com with ESMTP; 15 Oct 2020 21:28:05 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SBsMEUHvulLnbFOfY53CrWJKZnnnT+vKSIQJO5x5sizmaIphxVKBLwBKFJU7uwi3r1jxgp5dTaShMYE0vDqMEwZw/jjGnNxvB6NgrSaWbPe8/qlizwVbJr/f7/OL13tLBt6xvVMWbDhR/UgYBu5wR0WXFykba+9G8L3WBkQYo0iJL2UM2idNh/4sXPU3bWzRh2as8+F0DooAzkdpXn7wbgSzIDxbmuzMTN6PcYn+Y+lJWGQeZJIW1qhN6+mtKHi0zI/NYKKmnj/lrnt3t+GjVIS1mN0vA4ggauaOVNYPo2rgg5PO7Nyx0bNU4CdK7xYyCeis50qh1mw033SRNsTLvg== 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=geAa8tedADcNkq1ztkAMYCmDxmJi0ohZ5BuWBdEjBko=; b=DcUZgslASIdcKJ2sU5RIZ768g5560zitNbfg0SUODbEOsfSrh2AIyBcTUsdYtn+HDo1o47TccLd3/GVr3nqjVcBaCqQCzati+8O7+mIb0Bzbu5vHw0mOmhqg/Nq9V1GJG39zwLjtQPHhM2+Ngk0ODsbktdbFWB7Z4bvisKRGhnEnstcWJkZcFxCAWnnd6qmIj6vRTdIcVv9I9udlSsDpRuc0/4nMngvf8NOC7CNzzEehDdRLfYX6idZjaVJ9L6rJ5r2bDevNdlGvDgfzOL9D7TezpDZJFKyLLTp3QbmmTsUs8d8Y8jv1zlwQO4BOTSGrmqPaV7KuQnnWOPacDj6ygQ== 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=geAa8tedADcNkq1ztkAMYCmDxmJi0ohZ5BuWBdEjBko=; b=l6QLOxXCgEJy7w5TEcXPhF0xkPnRlGV3worwCZTaDdBXCOQMsluY1s7UsrNjmrtxWu3WN+6k9NMOs1MWP67JOTg2geWPPOA52FyoBapQLnC4P2u2UMjadn7TzJ6xBMNmHWwXFqj7+olv8potKQNLFYvAGjiNa6oPTpBRZrDfs4A= 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:28:04 +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:28:04 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v2 13/16] lib: sbi: Remove redundant sbi_hart_pmp_xyz() functions Date: Thu, 15 Oct 2020 18:56:57 +0530 Message-Id: <20201015132700.2232820-14-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:28:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0c7a19dc-f8f0-4ecf-97e5-08d8710e2541 X-MS-TrafficTypeDiagnostic: DM6PR04MB6624: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VWaOwJ342oVCEHRGP/f0OGt75CcOidyCMyJz4eyGt90WaV+ooLodoFFBFC8netErqR/ANTiiyvspbq424tTAxJxvt+LedHKWax/EErSR+uh0SDH//ZhKRReRK+sdjGEkCNAZmz8V13LsUTi908GkoGwFU5EwtiecX8jJ7QoKPi8uiz627Z9YLRoCvIoi1uPqTyn/DAkb7ZtnpE+iy8fssB3wSrv2wAOByKh9o3V+LWsv4kYckhIxqNC24n5wCdunmJSS9ly8+SYp1ZxzjvPHKGPon5oMW0USDkv6/auUD3OUu9m38zihFPIb+WHRGYIl0XFz0csdNVHZb8wmAejlXcgc9uy8ALV03NNEfLCaVpO+JSr7mLgTppacsQ0PHVgQ 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: RV78muunBod1djdYdsCBT5DbtI8gIhsVXdoVKYRKmQ8St6SyfO4da2QAExBH33p8cqqecKF5z5TgWyqkQkQul1Oib9fN6SVHWqXrzxJOVCJGF2GuJVqz6RwTIdTLfeNRDnVz216MkPzTHQ0YRI30TGoj2gwFQx0MBPxNNs0gjitxXjCFotToGkZv6ksNBlgtE683SvLiAr5cXQF9NjWqIkRjhzgYD81uhF+rdPcby82ui6LEkEsCvVYpY8FHVPFKKkcWMqJJP4LUYpPmxcS9lsFJRnNwBIoOScZJqKaUxLCcXE7mhf5PuAQ/GFgHzgg3RYtxRkjC65jRZhs6cc645n/s3CpZw6ppgUPmNRN221TxD2Qqk0JMjiZMGzlhUfsZ9Zyhc8aXKyHi9ZpEK2wtj7acz9sHsw3uMomY1ZSa0xe5DH2wNuEwgoTmOa1O13LSA4iTpSg4ojreE+fut1+rC+l1d16Z2hWLeKgvz4JAmi1fEdbCFGXB9c/tiLZQjkQbzeuNeHP7LXSJwM2wMiSw5NJDy+pbtsvUB0dprhu5Swm4Vs9NtwrmJ6Y+5yVLOf5wogpQqwPeTbSN3z86s0N8goyGEN2K8EJIPG7TyvSSpTigRTx3lctAL9YAuFXkJar0fka2C6EAngUuAMR7bmKhWQ== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c7a19dc-f8f0-4ecf-97e5-08d8710e2541 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:28:04.5748 (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: 3qwP3HARY6z0TCZApPw3MNwGidfvKa05Bmw/HrXn+Dy6CcGoC5aURTqTojxZ36ho1DJxl0dnaV+UTfOI3xjsKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_092807_730528_AE27FE22 X-CRM114-Status: GOOD ( 14.62 ) 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.42 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 sbi_hart_pmp_get() and sbi_hart_pmp_check_addr() functions are not used anymore hence this patch removes these functions. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_hart.h | 6 ------ lib/sbi/sbi_hart.c | 42 ------------------------------------------ 2 files changed, 48 deletions(-) diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 2efe44d..79d745a 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -38,13 +38,7 @@ 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); unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch); -int sbi_hart_pmp_get(struct sbi_scratch *scratch, unsigned int n, - unsigned long *prot_out, unsigned long *addr_out, - unsigned long *size); void sbi_hart_pmp_dump(struct sbi_scratch *scratch); -int sbi_hart_pmp_check_addr(struct sbi_scratch *scratch, - unsigned long daddr, unsigned long mode, - unsigned long attr); 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_hart.c b/lib/sbi/sbi_hart.c index 88ffab0..ea5d479 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -153,24 +153,6 @@ unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch) return hfeatures->pmp_count; } -int sbi_hart_pmp_get(struct sbi_scratch *scratch, unsigned int n, - unsigned long *prot_out, unsigned long *addr_out, - unsigned long *size) -{ - int err; - unsigned long log2size; - - if (sbi_hart_pmp_count(scratch) <= n) - return SBI_EINVAL; - - err = pmp_get(n, prot_out, addr_out, &log2size); - if (err) - return err; - *size = (log2size < __riscv_xlen) ? 1UL << log2size : 0; - - return 0; -} - void sbi_hart_pmp_dump(struct sbi_scratch *scratch) { unsigned long prot, addr, size, log2size; @@ -200,30 +182,6 @@ void sbi_hart_pmp_dump(struct sbi_scratch *scratch) } } -int sbi_hart_pmp_check_addr(struct sbi_scratch *scratch, - unsigned long addr, unsigned long mode, - unsigned long attr) -{ - unsigned long prot, size, log2size, tempaddr; - unsigned int i, pmp_count; - - pmp_count = sbi_hart_pmp_count(scratch); - for (i = 0; i < pmp_count; i++) { - pmp_get(i, &prot, &tempaddr, &log2size); - if (!(prot & PMP_A)) - continue; - if (mode == PRV_M && !(prot & PMP_L)) - continue; - size = 1UL << log2size; - if ((log2size >= __riscv_xlen) || - ((tempaddr <= addr && addr <= tempaddr + size))) - if (!(prot & attr)) - return SBI_EINVALID_ADDR; - } - - return SBI_OK; -} - int sbi_hart_pmp_configure(struct sbi_scratch *scratch) { u32 pmp_idx = 0;