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 EC40BC54E67 for ; Wed, 20 Mar 2024 03:21:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmmWC-0006MF-HI; Tue, 19 Mar 2024 23:21:32 -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 1rmmWA-0006Lb-AK; Tue, 19 Mar 2024 23:21:30 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmmW7-0007N0-3K; Tue, 19 Mar 2024 23:21:30 -0400 Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Tzv2107Bfz1R7WW; Wed, 20 Mar 2024 11:18:49 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id 7CA6C1A016F; Wed, 20 Mar 2024 11:21:22 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 20 Mar 2024 11:21:21 +0800 Message-ID: <62b8b76c-8aa0-762c-e1c5-7ca20822249f@huawei.com> Date: Wed, 20 Mar 2024 11:21:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [RFC PATCH v8 05/23] target/arm: Support MSR access to ALLINT Content-Language: en-US To: Peter Maydell CC: , , , , , , References: <20240318093546.2786144-1-ruanjinjie@huawei.com> <20240318093546.2786144-6-ruanjinjie@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.109.254] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500008.china.huawei.com (7.221.188.139) Received-SPF: pass client-ip=45.249.212.35; envelope-from=ruanjinjie@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -65 X-Spam_score: -6.6 X-Spam_bar: ------ X-Spam_report: (-6.6 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-2.417, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Reply-to: Jinjie Ruan From: Jinjie Ruan via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 2024/3/20 1:30, Peter Maydell wrote: > On Mon, 18 Mar 2024 at 09:37, Jinjie Ruan wrote: >> >> Support ALLINT msr access as follow: >> mrs , ALLINT // read allint >> msr ALLINT, // write allint with imm >> >> Signed-off-by: Jinjie Ruan >> Reviewed-by: Richard Henderson >> --- >> v5: >> - Add Reviewed-by. >> v4: >> - Remove arm_is_el2_enabled() check in allint_check(). >> - Change to env->pstate instead of env->allint. >> v3: >> - Remove EL0 check in aa64_allint_access() which alreay checks in .access >> PL1_RW. >> - Use arm_hcrx_el2_eff() in aa64_allint_access() instead of env->cp15.hcrx_el2. >> - Make ALLINT msr access function controlled by aa64_nmi. >> --- >> target/arm/helper.c | 34 ++++++++++++++++++++++++++++++++++ >> 1 file changed, 34 insertions(+) >> >> diff --git a/target/arm/helper.c b/target/arm/helper.c >> index b19a0178ce..aa0151c775 100644 >> --- a/target/arm/helper.c >> +++ b/target/arm/helper.c >> @@ -4752,6 +4752,36 @@ static void aa64_daif_write(CPUARMState *env, const ARMCPRegInfo *ri, >> env->daif = value & PSTATE_DAIF; >> } >> >> +static void aa64_allint_write(CPUARMState *env, const ARMCPRegInfo *ri, >> + uint64_t value) >> +{ >> + env->pstate = (env->pstate & ~PSTATE_ALLINT) | (value & PSTATE_ALLINT); >> +} >> + >> +static uint64_t aa64_allint_read(CPUARMState *env, const ARMCPRegInfo *ri) >> +{ >> + return env->pstate & PSTATE_ALLINT; >> +} >> + >> +static CPAccessResult aa64_allint_access(CPUARMState *env, >> + const ARMCPRegInfo *ri, bool isread) >> +{ >> + if (arm_current_el(env) == 1 && (arm_hcrx_el2_eff(env) & HCRX_TALLINT)) { >> + return CP_ACCESS_TRAP_EL2; >> + } >> + return CP_ACCESS_OK; > > Forgot to note in my earlier email: HCRX_EL2.TALLINT traps > only writes to ALLINT, not reads, so the condition > here needs to also look at 'isread'. Thank you! I'll fix it. > >> +} > > thanks > -- PMM