Received: by 2002:a17:906:aa04:b0:a46:bbde:2c08 with SMTP id ko4csp520834ejb; Mon, 18 Mar 2024 02:38:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVAzXInxUmWfA+TgfSK/MX2sPXTVHtO5OPO+OBqLwMfDWrhIUMjFpPyRlgnQoUmPZ9YtI/GEJksD6Ci8A9C4PmY+5hqJjwM X-Google-Smtp-Source: AGHT+IE9M3PlJm2EFljQUYq8VFfR7Gx0PpTggm5JKfGvZLkVg7v1yukk0EPkv2R2wyZVfWnPe1EZ X-Received: by 2002:a0c:e792:0:b0:691:49d5:470 with SMTP id x18-20020a0ce792000000b0069149d50470mr10431937qvn.45.1710754680697; Mon, 18 Mar 2024 02:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710754680; cv=none; d=google.com; s=arc-20160816; b=vn9XLIWMo2FUh4WH9DuuizytxlyaaNSlP/MUriRW8/jTBwgXJ8LdkJtaX9xMxYhELu +ZBCvjQ+32k6kY5tTuShLilVoh9xcJOjK64N9XsD5mEdzWdZA/Q0sU93CQdoRX3MYWzr jbQo0qjnw2SUbrAOh5k5jr81alvGlp9hK0zAhhzVj9Q3ZBwNly03kUeR+SjSTJUtlmsW +8EJJ3mRXG1F2OBkqbWQysoqtfF1MQTS5j6go+fpsOhACnFAjyp4+VDERkBpk4BSE1WD Kt7AL08jTZ6rGH4ZW2VWPkzld/K4cubpJnUNktjxVxWDHrLh6FA4i7qEITH7tHPx6NI4 QsQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:from:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to; bh=l5oEwPcVpYh/9y2GAxtlXJZwNQW7Qk7FiGFDHcjC9+8=; fh=dR6uRwfo9om/DmWDsGu5eY7/2T4Nd7sHG4YVwbPnVj0=; b=bMEclAuFWTSUOffUOSq1dJvfKF/8ggel48coRahUWgkqYR2EW2m0daBA40g3JCK9ig gl3r1OkmdC+2c0z9l8ucSOUW2RpJ6Ejs2DmeRAmDX73stMQPRYCGFL2M4C7AlPaYT7vG 4Tqp5xM0FGhGrod8yZpgn+gagNuD9mT2MVL+ugFREfDZpcfjpaGDjA1xLk7UuTmUXrgF QtPx1m7BOD4W+ajKIDlPFBTwHt+s48O1ijaEaqDDuo2Gyy1wkZsacUWkd33Hn+rIdbmy 8k6qPxm5qrsefxHXV+altwBM3FQqLeLLRaK8g/P1CxI/vIsGRAsvt7uakLvsXNv5+G2D kIfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q3-20020ad45743000000b00695e33f6b16si3125691qvx.475.2024.03.18.02.38.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Mar 2024 02:38:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rm9R2-00040p-SU; Mon, 18 Mar 2024 05:37:36 -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 1rm9Qp-0003uf-83; Mon, 18 Mar 2024 05:37:24 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rm9Qh-0000tw-4z; Mon, 18 Mar 2024 05:37:22 -0400 Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4TyqT84F1nzNm7x; Mon, 18 Mar 2024 17:35:08 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id A711C1400FD; Mon, 18 Mar 2024 17:36:59 +0800 (CST) Received: from huawei.com (10.67.174.55) 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; Mon, 18 Mar 2024 17:36:59 +0800 To: , , , , , , , CC: Subject: [RFC PATCH v8 01/23] target/arm: Handle HCR_EL2 accesses for bits introduced with FEAT_NMI Date: Mon, 18 Mar 2024 09:35:23 +0000 Message-ID: <20240318093546.2786144-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240318093546.2786144-1-ruanjinjie@huawei.com> References: <20240318093546.2786144-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.174.55] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500008.china.huawei.com (7.221.188.139) Received-SPF: pass client-ip=45.249.212.189; envelope-from=ruanjinjie@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: CaUzsW5ENL4B FEAT_NMI defines another three new bits in HCRX_EL2: TALLINT, HCRX_VINMI and HCRX_VFNMI. When the feature is enabled, allow these bits to be written in HCRX_EL2. Signed-off-by: Jinjie Ruan Reviewed-by: Richard Henderson --- v4: - Update the comment for FEAT_NMI in hcrx_write(). - Update the commit message, s/thress/three/g. v3: - Add Reviewed-by. - Add HCRX_VINMI and HCRX_VFNMI support in HCRX_EL2. - Upate the commit messsage. --- target/arm/cpu-features.h | 5 +++++ target/arm/helper.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index e5758d9fbc..b300d0446d 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -681,6 +681,11 @@ static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; } +static inline bool isar_feature_aa64_nmi(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, NMI) != 0; +} + static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) { return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; diff --git a/target/arm/helper.c b/target/arm/helper.c index 3f3a5b55d4..b19a0178ce 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6190,6 +6190,11 @@ static void hcrx_write(CPUARMState *env, const ARMCPRegInfo *ri, valid_mask |= HCRX_MSCEN | HCRX_MCE2; } + /* FEAT_NMI adds TALLINT, VINMI and VFNMI */ + if (cpu_isar_feature(aa64_nmi, env_archcpu(env))) { + valid_mask |= HCRX_TALLINT | HCRX_VINMI | HCRX_VFNMI; + } + /* Clear RES0 bits. */ env->cp15.hcrx_el2 = value & valid_mask; } -- 2.34.1