From patchwork Mon Oct 19 12:54:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1384291 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=yrEI2OSH; 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=dA1nFkyY; 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=mQpSF/AE; 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 4CFGwK3wbhz9sVS for ; Mon, 19 Oct 2020 23:56:17 +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=69k5qpCWm8hLk6Gh22QmcmYqyIa8DuAPNEvp8E//1yg=; b=yrEI2OSHtwIty5w848rX+27nS I8xCL6SiXw5hcmnql0jt/xyDwZHcoiYCX+Fnui8Sc3uXZ9i3RPtDal9uKyvMj6ttmKjWPJVIyUA3R Ylw+Z6AdGq60gxI2nRcJQvm4oj0hb5YA/oxxsJkq/VRhj0jtQTxNUKxIBNy44lParsmT8+g5W2q0W 7xESTezHuZ2Q/KduywbFKxOSfKbN1cbCe2LMc0AuxyImC0aOY51jS7iv99IPOtNfwlXzQuwUXWwqk ZzKzg/ea6c3JeLiTwbOOHKLWtXo/ailLqLnTTL7GTvf3mWduBi4eHRPxLyAmtsEnzru3qUKERCIYq 2AgxCT/Kg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUUht-000592-F7; Mon, 19 Oct 2020 12:56:09 +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 1kUUhk-0004yp-H6 for opensbi@lists.infradead.org; Mon, 19 Oct 2020 12:56:05 +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=1603112161; x=1634648161; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=JcKBbHmzwoZ1QihPlN7zoD0XG1e0CSXldx+Dwy4VANI=; b=dA1nFkyYZp/zyenupAdAhY1POylx+HJjyudlB8dYimYLmxgPHK5lv9qF 0d/pEQ3jFAtCe63v458JBHFbz17v22HTX1G1n4Tj69FlZWxVCN8E+GP9O RFQUzRdAc7Wni3D9t0ZqXpes22jb3BWcb8rzTVZu3LOaZgIx03PRL/wfR nrIFoBb1+rNxo8OW3n5onyRgTfY67Cb2por5sFUXdj9W17AknGr2TJw7m lcx/5eCp+U1GrfHS95cHYMq9O42lwxcspZ8z0ilPKWIbdSDpu2aQNAmap pbjvdsLtgFPv0r8bPz4w2+TkNidQ9S3y673rIx4Nq+7bYRgx3gI6CCEU9 w==; IronPort-SDR: xF2caMaOcxAeQrfFWC8dDTJ70ZvzouI7RpRpE/PLxvcQO2AgmMtQkugBUQh/Sxo0G3NRvd2eej h+xF/lIwLGJ3R2zGPgqxCfLUU2DOd7xke5bJYS9wbtkw1G6nnsy2XB6y3Hc1sTovIC9OLtjXLU UZzaZ90xxjwe54EfQBgM8p8KW/3BvjbdTnvOBEfCo4fw90yOERiAQBpa1UqcaVuDrPie4LZuSo JYG4bFlR82oWAML2JTHflbb8SaTliaH/1iB5IUQRq7NcHVn//TBTEZIO3OIgUXvjhKgkOhwF20 Ojc= X-IronPort-AV: E=Sophos;i="5.77,394,1596470400"; d="scan'208";a="154752576" 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; 19 Oct 2020 20:56:00 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3JjkENPGZBBv2bJkfvhXr1SEevKA/mW+3DjtedpiGXF/0LHOZYgBghuKs4gtH2CpCQWlVnZYEz0INUUlrJnFZ6YNGX0+MXZrT5j0mItsD+PWFhMewkcZedv9EIAv1fwWz0AqiPpi0vFfWBqAz6CcL0D/8oeckm0mtwkq7fanc3sQxZsH1tN7pe31RyW8a9QcBOtU7cGpfCzAMsjBcH5pyUc8Kq0if+Sv8xaf/w3cIcX0BkIfuZ0Pzm0SxNdYbLvJlFElTRefiSngT2JMd/r8Uq8NW5dIpWFg5CXsuJpvRD8Iuy4GGOk6oNyHiGExeASfzc+JxsMMCpMesUkKZVZ+g== 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=Y8+BwJW8xY4y2wu5k7SW9oJl9WmtH5WuraDyZa/8UIM=; b=Wrjn++cMYZdBscJkYAUmTRfHqZwyEAPrEwEI80jKg/i6/9gP+1keJnNxvj4fqVNu04jG2jf7K4NlHV19dN//LJxx1mK/IXiDohsoNwFenwu9tsmfGOTbrDrxxjaIsrN9Ti2lxnViUeZYHrw1erfbZc7ZHDM5sUYcA1ST9psxlzE3m1E4XK40CZ+HdhreBJYw/0IV8g1IvkefBBEYNB5BIj1ZLB0Hub0Lrrezgof26OxSvjDJJz1B+01tpqR+EmaAAct4rRMr6sJ6Yd1md37pudO7To1YY/i1yz7QDGqbaL0yogUtV198Euhqo/9juoVuZ4ZsmqgdAk4piRI6wC7ZrA== 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=Y8+BwJW8xY4y2wu5k7SW9oJl9WmtH5WuraDyZa/8UIM=; b=mQpSF/AE1jcXSzXbRozdxp+DAJl5lJ1LX8QBmWcryej+B0DNt9QCU5vZj93zeNM/JoLifNZ80XEOT/zPSGDCSBKt/0WLn+fAqRdueLqiz5kzRgV/YHsdGwKaAPEldJrneyJJ760Sr8bvft6JWFGzbPTXq1ysKju4hErRmda1xPs= 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 DM6PR04MB5548.namprd04.prod.outlook.com (2603:10b6:5:12a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.27; Mon, 19 Oct 2020 12:55:58 +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; Mon, 19 Oct 2020 12:55:58 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v3 13/16] lib: sbi: Remove redundant sbi_hart_pmp_xyz() functions Date: Mon, 19 Oct 2020 18:24:50 +0530 Message-Id: <20201019125453.2460105-14-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201019125453.2460105-1-anup.patel@wdc.com> References: <20201019125453.2460105-1-anup.patel@wdc.com> X-Originating-IP: [122.172.253.92] X-ClientProxiedBy: MAXPR0101CA0060.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::22) 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.253.92) by MAXPR0101CA0060.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Mon, 19 Oct 2020 12:55:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 327bdcde-b7ae-4825-79d0-08d8742e52a3 X-MS-TrafficTypeDiagnostic: DM6PR04MB5548: 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: V3EfNedE2EKnnyg/LUZFWt1Vy8r3JqBshC32HzCCNo8uy9Wt55OB80xOAmngvdqnddW2UhNUV2YnNt8LkC1qZyjTDRebzZAeFew/e22SFAWTfotcXs8+EwR5QfgZA4A0wzrX69+9mRNWdqel2lzjVh92ocdsj0DKD2uEfLcV95shsFfjqcKNTKfsRevytuczPub0XDFwbixCaM2ODDz5d3165Oazuro9V1giBQPKR3tHy091tzrcJo/VqiDclJYbqDJEyIELPIcU+3OQh+pU3ZNaPTnSHat+lubYJZKC45rUIXQ6swImbn8pyG5qLPywn7dzA+DLzTKfwNV9RWWoQA== 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)(366004)(136003)(396003)(376002)(346002)(39860400002)(6636002)(55016002)(6666004)(8886007)(66946007)(66476007)(8936002)(8676002)(66556008)(2906002)(86362001)(44832011)(83380400001)(2616005)(956004)(16526019)(5660300002)(186003)(54906003)(110136005)(52116002)(7696005)(55236004)(1076003)(4326008)(478600001)(316002)(36756003)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Tg66l8lA1EhlWyW+Onbl2PAijLkmYXvnmQ6EH+93cWaPTAazkqzTTg3VgqWbQ/rg3pjtMSUvvgt9Ia4CoC0sJKt0/wYEVyPYQ4EAth9sCVcDpZFI6euck5AZ1XizJfaleW9BgIQBVTzw942sqEt7WI4x4wuSZRJzUpGz3Rs4V9/oXxoKH33R/X+SVYoLHeenhajNVlpCDU+ERxOHZTnUD1oG9+vZwJEpRs5QTag9sapyuLTgqr4HgZy9j/5znIzvyv4GoekBISoL6wDm1clCz/w4ypVJ8uqMjvJ4UtZo1hLBtr2p4f2FK1KMqKZsD4C4duqRNJNwZexX66NLfYlOdiZ1fn90Qf/5/EbyG7f9ZVFMkTwKXijEzTASH+BAs5/JbaDH5OX5uhzDL2hH3UIZcUud7V21oQESPM5O3YUys1DIKLriD+lepgwq1IMlEe2yRUx+MM8zHEwJLg5gOCyOlOmsDLURlHh57JyNu6fAJ9MF63I2WaJ2tTVk+lG1NIWkBruQl28P3LGb4VjqxBtgo3oFZWzXR9cVeeahMru/ZgnklWyYVD7dnzJ9QAEKqTPRLj4gQwjQl5num55E844V1IIA8JIlqR/8rXraSMh1C54xmanMMBVTZe1NoGSxg8/O8teO2s1p1qVVoVZEbC5gkw== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 327bdcde-b7ae-4825-79d0-08d8742e52a3 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2020 12:55:58.3243 (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: 5X1U+UtrBb0hbRzhqQAWpXVzX3gqBoeowh/rzUlFtQ27JZ+eTznvEnEXlb8X+NCaDh6CXOGwNjyrP7UJrJAddw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5548 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_085600_979385_6F514498 X-CRM114-Status: GOOD ( 15.03 ) 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_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 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;