From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DD42EB64DD for ; Wed, 9 Aug 2023 10:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbjHIKZJ convert rfc822-to-8bit (ORCPT ); Wed, 9 Aug 2023 06:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbjHIKZI (ORCPT ); Wed, 9 Aug 2023 06:25:08 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D0B1BFB; Wed, 9 Aug 2023 03:25:06 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 1CD4D8016; Wed, 9 Aug 2023 18:24:58 +0800 (CST) Received: from EXMBX064.cuchost.com (172.16.6.64) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 9 Aug 2023 18:24:58 +0800 Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX064.cuchost.com (172.16.6.64) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 9 Aug 2023 18:24:57 +0800 Received: from EXMBX066.cuchost.com ([fe80::5947:9245:907e:339f]) by EXMBX066.cuchost.com ([fe80::5947:9245:907e:339f%17]) with mapi id 15.00.1497.044; Wed, 9 Aug 2023 18:24:57 +0800 From: JeeHeng Sia To: Conor Dooley CC: Conor Dooley , "palmer@dabbelt.com" , Paul Walmsley , Atish Patra , Anup Patel , Alexandre Ghiti , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Song Shuai , Petr Tesarik , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: RE: [RFT 1/2] RISC-V: handle missing "no-map" properties for OpenSBI's PMP protected regions Thread-Topic: [RFT 1/2] RISC-V: handle missing "no-map" properties for OpenSBI's PMP protected regions Thread-Index: AQHZxTKPVELaCqW/WUK93+UXGxBdOK/eAqwggAHhD4CAAed1gA== Date: Wed, 9 Aug 2023 10:24:57 +0000 Message-ID: <3931cc7932e644bd88f9baf2beddd00d@EXMBX066.cuchost.com> References: <20230802-purse-hydrant-6f44f77364b0@wendy> <20230802-detention-second-82ab2b53e07a@wendy> <3e066032031e4552b4b7903755deb669@EXMBX066.cuchost.com> <20230808-humility-rut-e1e46cf75708@spud> In-Reply-To: <20230808-humility-rut-e1e46cf75708@spud> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [210.186.215.22] x-yovoleruleagent: yovoleflag Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org > -----Original Message----- > From: Conor Dooley > Sent: Tuesday, August 8, 2023 9:13 PM > To: JeeHeng Sia > Cc: Conor Dooley ; palmer@dabbelt.com; Paul Walmsley ; Atish Patra > ; Anup Patel ; Alexandre Ghiti ; Björn Töpel > ; Song Shuai ; Petr Tesarik ; linux- > riscv@lists.infradead.org; linux-kernel@vger.kernel.org; stable@vger.kernel.org > Subject: Re: [RFT 1/2] RISC-V: handle missing "no-map" properties for OpenSBI's PMP protected regions > > On Mon, Aug 07, 2023 at 12:44:07AM +0000, JeeHeng Sia wrote: > > > > +/* SBI implementation IDs */ > > > +#define SBI_IMP_OPENSBI 1 > > I would suggest to create an enum struct for the SBI Imp ID in > > the sbi.h file. What do you think? > > I'm not really sure what the advantage of doing so is. The macro SBI_IMP_OPENSBI seems weird (I would read it as "SBI Implementation OpenSBI"). However, if we implement an enum struct for SBI_IMP_ID (There are numerous IDs available), the macro can be abbreviated to OpenSBI. By doing this, the conditional checking of the implementation ID would be more readable, as shown below: if (sbi_firmware_id != OPENSBI)