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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC924C6FD1C for ; Thu, 23 Mar 2023 02:05:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfAKC-0005yP-0K; Wed, 22 Mar 2023 22:05:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfAKA-0005y9-8l; Wed, 22 Mar 2023 22:05:06 -0400 Received: from out30-97.freemail.mail.aliyun.com ([115.124.30.97]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfAK7-0002qL-Ti; Wed, 22 Mar 2023 22:05:06 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R161e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046059; MF=zhiwei_liu@linux.alibaba.com; NM=1; PH=DS; RN=7; SR=0; TI=SMTPD_---0VeSSY4Q_1679537095; Received: from 30.221.98.101(mailfrom:zhiwei_liu@linux.alibaba.com fp:SMTPD_---0VeSSY4Q_1679537095) by smtp.aliyun-inc.com; Thu, 23 Mar 2023 10:04:55 +0800 Message-ID: <48c6807a-f56c-e233-6247-f52088b126e8@linux.alibaba.com> Date: Thu, 23 Mar 2023 10:04:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH for-8.1 v4 10/25] target/riscv/cpu.c: avoid set_misa() in validate_set_extensions() Content-Language: en-US To: Daniel Henrique Barboza , qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, palmer@rivosinc.com References: <20230322222004.357013-1-dbarboza@ventanamicro.com> <20230322222004.357013-11-dbarboza@ventanamicro.com> From: LIU Zhiwei In-Reply-To: <20230322222004.357013-11-dbarboza@ventanamicro.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=115.124.30.97; envelope-from=zhiwei_liu@linux.alibaba.com; helo=out30-97.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 2023/3/23 6:19, Daniel Henrique Barboza wrote: > set_misa() will be tuned up to do more than it's already doing and it > will be redundant to what riscv_cpu_validate_set_extensions() does. > > Note that we don't ever change env->misa_mlx typo. > in this function, so > set_misa() can be replaced by just assigning env->misa_ext and > env->misa_ext_mask to 'ext'. > > Signed-off-by: Daniel Henrique Barboza > --- > target/riscv/cpu.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index c7b6e7b84b..36c55abda0 100644 > --- a/target/riscv/cpu.c > +++ b/target/riscv/cpu.c > @@ -949,7 +949,8 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp) > > /* > * Check consistency between chosen extensions while setting > - * cpu->cfg accordingly, doing a set_misa() in the end. > + * cpu->cfg accordingly, setting env->misa_ext and > + * misa_ext_mask in the end. > */ > static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) > { > @@ -1168,7 +1169,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) > ext |= RVJ; > } > > - set_misa(env, env->misa_mxl, ext); > + env->misa_ext_mask = env->misa_ext = ext; Reviewed-by: LIU Zhiwei Zhiwei > } > > #ifndef CONFIG_USER_ONLY