From patchwork Wed Sep 23 07:14:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pragnesh Patel X-Patchwork-Id: 1369653 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=none (p=none dis=none) header.from=sifive.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=byvluy1u; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=selector1 header.b=MLXphIAk; 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 4Bx93t1Y8Cz9sPB for ; Wed, 23 Sep 2020 17:36:56 +1000 (AEST) 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: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:In-Reply-To:References:List-Owner; bh=jOt+cSNvtrW+IjCW4NY/cbpv3Iz0AlqIznh/+UHa3PI=; b=byvluy1uy7OPNHWjqJPNOm3UNu pdqXAXxq3LoRBbbonvwf5mX7fhAT9TBYIf1nhWWMkcJImPk2JEXCa6oP1l9vk/eX5B6QqHxMRbZY2 Jzp+TzVUgNM63mthi8ISrtJh1wrgYQwGwRiBztM0HjXxZ8RKJ5UrJza8HJHgp070p0gqMSLPrrRZo vgvzdL8BAWNfIeAQkg1L4KDq21DNUVk1/GKnSG5kvZEI2bsnspybb0JekERBbHLlsUSJuMazE3247 Q3xkaPGXi0vBRd34rcScLkEPsv0j5cGT1wu8sESKoU6zxwHEe7t8LHPfttHI332AKvLwY5F1VhgKN XzhpGuvQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKzKS-0007OO-UU; Wed, 23 Sep 2020 07:36:40 +0000 Received: from mail-bn8nam12on2070.outbound.protection.outlook.com ([40.107.237.70] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKyzT-0004H4-SK for opensbi@lists.infradead.org; Wed, 23 Sep 2020 07:15:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z3Xa1BjvNZDgCgGriArV+ukHZ6VgKnm+O/WIq6/mIP5kGybYkZ1ONdjnn7uSyRVRBtFCqi3U0eKDds5d0ctsHkevS5bietSsuLOExzyfqx/ENKIJjrit88UdTEXg1GUzUmagj8BPul73TlzLChj17v3fja5YgRnAMOrCMWn81pRfn2kLq1m18P3sJwZxng598PSPya7GLq8lfxYU4X5GGTp1u/5VBItv70O7R7EB8kKy6l0zGJuvWrpWmQi2w1s5P4OK1MG088Kb6+pwe4iVTwC212cl31perPh7fV8/N7upZmRkaW02WBbw1YrrtrooNM3NKHt5f0iXUyDOzGrMNw== 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=iU2KRW7p9W4k/lStaBJv3ars5ohxYvz5q5GIX3hIYBY=; b=VPb8Pw0PBsI2RIX2JiHJloruZprvHeTRS3ylj7KZ+2xfCWfb6ykDcrvM2MXvzuU+SdalJMwTholDOIxRhlAOWMQRVFp9zDpxMylpehZBX/BCAFZ2y9bkA4Pfwg5OvqTarnoJDCE9YqrJ22zmDudRbdImLvSQaadrbr+L6hGzj30ICr5X26vnSfARYrJjIhE6DY1UI8Q28u/JahkLbqQqn5FOioeYksU2DQckorlZ7Vlgu1Wl2458s/4MgyroSWpec4i9Ou2mt1m7fL09KrLSNW7mdkelcbdj1jJPvdamCyc9Bo+7a+FtiwfENQYujUEVTRQ/KrCGjisEw2hxTAv9Rg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=openfive.com; dmarc=pass action=none header.from=sifive.com; dkim=pass header.d=sifive.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iU2KRW7p9W4k/lStaBJv3ars5ohxYvz5q5GIX3hIYBY=; b=MLXphIAkYMAC7slN9lkvnSJk3aNUC8qIfvOfHG55exssMk66P3fPDyi8yDvtq5tKc7x3LS5wj6yKdza7kjOlN+IrRN5z9ckJ84lH/fBJ8Z2W9c3vaXLNWO8N1vFDp4hLf18Izch13RsqFEMcpIi1FWVJUfE9zzbaU+1mY5s3JCI= Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=none action=none header.from=sifive.com; Received: from MN2PR13MB2797.namprd13.prod.outlook.com (2603:10b6:208:f2::30) by MN2PR13MB3598.namprd13.prod.outlook.com (2603:10b6:208:16e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.10; Wed, 23 Sep 2020 07:14:51 +0000 Received: from MN2PR13MB2797.namprd13.prod.outlook.com ([fe80::dcec:40d7:3fd6:308d]) by MN2PR13MB2797.namprd13.prod.outlook.com ([fe80::dcec:40d7:3fd6:308d%7]) with mapi id 15.20.3412.004; Wed, 23 Sep 2020 07:14:51 +0000 From: Pragnesh Patel To: opensbi@lists.infradead.org Subject: [PATCH] lib: sbi: Fix PMP CSR detection Date: Wed, 23 Sep 2020 12:44:17 +0530 Message-Id: <20200923071417.19000-1-pragnesh.patel@sifive.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [114.143.65.226] X-ClientProxiedBy: LNXP265CA0032.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::20) To MN2PR13MB2797.namprd13.prod.outlook.com (2603:10b6:208:f2::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sachinj2-OptiPlex-7010.open-silicon.com (114.143.65.226) by LNXP265CA0032.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Wed, 23 Sep 2020 07:14:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5c975c4-2739-4055-6cf5-08d85f905caf X-MS-TrafficTypeDiagnostic: MN2PR13MB3598: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:374; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JD3Jn3Kc9ke6ntDFb+lpLnKuS1PgRSJx3Aef8ZdX3ybEaIywd977PJlAhRzk34CHB6eGcjVmts0CmGd0pQacnIW47yIzghveozdeb5klIyNVf82nr/s/xQ/N3sJy3wTFXTDQdAR5PscAJc/yAa7P1rte8METbFWFllAoLhE4bEXjvUoAzyUh1VxpAinRlSbiub9oqASwV2X2L0coyYbWpNJdtdwS3cJ9xf/igB2XzGmGjqyvLZZp5Jss7/LIJLhG0pLS22JsDvba4Xy1iveBaS1n4Aj3TqEt5swjCCpBQnKHuzTDbZrY2iMI8XfDkd0EsfBy1MZio09uUrG7H6Ri4AjlsDkTFGH+3cslrG7TGOesjxeSixXmLBDAJlL53B4S X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR13MB2797.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(376002)(346002)(39850400004)(366004)(136003)(6512007)(1076003)(478600001)(6506007)(6486002)(1006002)(6666004)(36756003)(6916009)(83380400001)(4744005)(956004)(316002)(42882007)(5660300002)(44832011)(52116002)(2906002)(2616005)(66556008)(66476007)(66946007)(107886003)(8676002)(4326008)(16526019)(186003)(8936002)(26005)(83170400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vzoA2nIm5gYtNw5187iVdoT7QTEOfSfF3caFu227dLZDKhfn4BbjFIcJn0jSUuowiL8hbxLa9YeepnKe/baJELerQzBXfUrDWZd/OeKny2agrb/+EBsEX5grU0nB4RYGtYkArUzerbr9rNWMIUQBFvP+g5sOtN5sjMlkM1iXQWMtNqBrf9Qxyi2RQdHrS/tMpdUbJnHe4KSaLNPXBaFUvPl4nBtHBvUo3B9Zyg5GzPoM5xt5VlcAiNBcN9MWCuO4C4eXBX8ANPRVaCWQfj5znHDll6sbdYrrYWYyocvgqMSuSGZXrdL43EvrM5pbcNPIVPPjsiRK7r0XC4mRhPHnSJoclomo4uxq8ll29ncDfz/I5txrlwRUISW23YIpPQKdXFSjWtveIYlKleTAjg9SWpC05dsgsdiG7IUzl1/1DgILxxH/H7nI/qj8XgqdlXtqR9cHHZWBnZsTr8CE0za5KJ4Vp2BGIyOVl5ANbW3+beu7y3QamlGzXmArV2UOPYSoBn+Xr4ISvH5y9YRdQwcg0AwR6aQAnv81lMU8+DAqLrHXeYKSrcx0zPvDsaKDGOXSLZQTIu5WK8S2Ilj/ySonR1tSyFV00ZKHnxE+PkWleWJRAcGcFFgXG/O6bH+EQHxZ3xtR3U5vGTMkXFGRViQAPg== X-OriginatorOrg: sifive.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5c975c4-2739-4055-6cf5-08d85f905caf X-MS-Exchange-CrossTenant-AuthSource: MN2PR13MB2797.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2020 07:14:51.1413 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sOfkgRU71u/Z8W3dZab8AZDna/umgCrj8jixCmSb93hVXwTHuZ7xrfaliBuknFbdOHfgW0tSJwXT2XpWzqJ5clzeXla31jXwPzfr5nIxBuI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_031500_120459_4990F750 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.237.70 listed in list.dnswl.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.237.70 listed in wl.mailspike.net] -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-Mailman-Approved-At: Wed, 23 Sep 2020 03:36:39 -0400 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: yash.shah@sifive.com, bmeng.cn@gmail.com, sagar.kadam@sifive.com, Pragnesh Patel Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org HiFive unleashed currently implements fewer than 56 bits of physical address so existing PMP CSR detection is broken. PMP address register encodes bits 55-2 of a 56-bit physical address, Not all physical address bits may be implemented, So just check minimum 1 bit. Fixes: 74d1db706293 ("lib: sbi: Improve PMP CSR detection and progamming") Signed-off-by: Pragnesh Patel Reviewed-by: Atish Patra Reviewed-by: Anup Patel --- lib/sbi/sbi_hart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 4cbe8ce..6413194 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -403,7 +403,7 @@ static void hart_detect_features(struct sbi_scratch *scratch) __check_csr_32(__csr + 32, __rdonly, __wrval, __field, __skip) /* Detect number of PMP regions */ - __check_csr_64(CSR_PMPADDR0, 0, PMP_ADDR_MASK, pmp_count, __pmp_skip); + __check_csr_64(CSR_PMPADDR0, 0, 1UL, pmp_count, __pmp_skip); __pmp_skip: /* Detect number of MHPM counters */