From patchwork Thu Apr 25 10:39:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 791991 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1311400wrq; Thu, 25 Apr 2024 03:40:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHrkCbY6TgPAUBjEG0yjUizapnzTi2ulj9gQgDc7qrjqiGe5bNuAomYPo3g3xK47rnPsqTpQELNkQkNvB9A5OU X-Google-Smtp-Source: AGHT+IHpQ2QtuPe1mzRyb1jA/yHw9/Vlji2cNkSQzCXak8AxC8Oo/ei3crwT38hwHxxgJuo3c41N X-Received: by 2002:a05:620a:12db:b0:789:ecf2:d777 with SMTP id e27-20020a05620a12db00b00789ecf2d777mr5861055qkl.70.1714041654805; Thu, 25 Apr 2024 03:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714041654; cv=none; d=google.com; s=arc-20160816; b=cI+JbNfzK6n2uz1agK+5kwNeM3xOIH5Q8/L7PJjxgF5XsRHmfsiZ6d2bTitirf7SxQ ycWwgkEDxz+G3x58IJ8yQJ9LPFc/LFj/m/zRwoIObMRcLy9ARO0XbyJNAav6SZl9W6vS PCIrG/X+45JF2GRRqxiqKKl0rh4vdcUlot1DLMdi4wVPHuPuC4A1SJjZtIkEh5q0vS0g sT+OkhgYbhhEXVSIZMsHEfZkr/XZnnTiHSL2qS6NBK3W/B5LuzfEY1CPiIqY5PoGgJk3 Al4YeQyea6Sd/hA1aV6L5hw/rx7xkvsgsv876Cnx2g9f2nho6NuF5i0svMGtiheMAm43 1C9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-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:to:from :dkim-signature; bh=4h8d6UwgIGiFHRbvrM5SoXNPNiyUuHID0a2JGu04tl8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=j1MffKo0Zc/FJ3M3t6a14e1EX3agCIP7oEInBtq5yICyDCKrXWDtx1sNQ4LztYVeDW qjT4rFgN851x+3WFhAIXIbPwaUQ2cSJM86cAw7hoeMaxHE+ExuFkRNL9M23Iu7ra7LQa +UF0kJjcvIooLGel6sYAaKSWIkqOH/XRlF4+bC63OX/TB5H9H5iC67q7fTmRFptCUdYp GsLy+cuABr9gkYW7Ddj9uRudOBRGvnLUpIjkOFrOWbkGmRzPCcLZYpUr40KBZUMsmvoi Yct6zTVkNz9A4W/jmP0nMSWAZmILYcCrbVd6xWhq9iHJSN4eZJffi+OCaIqdOQ3V7mjd Fsog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bj/szA5o"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x14-20020ae9f80e000000b00789f314248bsi17125406qkh.659.2024.04.25.03.40.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2024 03:40:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bj/szA5o"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwWP-0001zK-8j; Thu, 25 Apr 2024 06:40:09 -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 1rzwWN-0001xm-1q for qemu-devel@nongnu.org; Thu, 25 Apr 2024 06:40:07 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwWL-00079Z-BQ for qemu-devel@nongnu.org; Thu, 25 Apr 2024 06:40:06 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-51b09c3a111so1153259e87.1 for ; Thu, 25 Apr 2024 03:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714041603; x=1714646403; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4h8d6UwgIGiFHRbvrM5SoXNPNiyUuHID0a2JGu04tl8=; b=bj/szA5oyR7tLutdUtFaONVA/nF7IIAw0DRks2cvxEECuL7yymK1xp71pGxilQjaeH Vfi6K+5xdXXz9wMoIi7o+vyyzn6OWgU4JbJ2IKQI6P6MPHKZGvVnG2CaP3X+569dhDHc S7hUgb1LPdnRP+/UUEvf7iKTnhG6KNQySURu/E8L7jZu30XtWKm2KezgspMyez8q1xd7 r255IpmMSIGmlCqh7H9qQ5VLeFTwfT9YNiu481E40HER3V4wKKfao768uMqAcXcxg+l2 1cx/qgV8UJJ30k/TdL3aqNDgB+e6hYStcsRWIMNPwi4gdaRmdxjQfgZVPIj2kmJCrK6f hZNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714041603; x=1714646403; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4h8d6UwgIGiFHRbvrM5SoXNPNiyUuHID0a2JGu04tl8=; b=W1VZ3nAvaYG5IDQDXvdNNWCw/cJsi3o4CbIjfKSsV4reoCt2RJOO1A97qTiThlD6aZ 1JfvK2i4iRffRyyNICcKUpZD6YxpL0AP4WSXVk/FyKEbFbKjX+2+RJM8TH/5zJbWkdVT QMZVXenXLYsLOLwvQrQZ75knE+onYsyRcBirKT3CIY47D1tEhVcLUt7Lq5hHxhv81wvc o0hE3jqeptJ4VswOwpp9qfOyKL33NzeOp5icp8LxOY6cflEa2Ph5t4jbtkC68BnxTHRO WnB6ZgVV5bKlwkebJtf3c3APeRaUVZuKApKTLaOmopPcAqk+hfANLf+5of//Add/n/EF Rdrg== X-Gm-Message-State: AOJu0YzlqTc0ejn0AQrPw1b9UJ1ypzli1A7+PdtDbdtjfFOmR9gXTRVw N6V6ffrDNLpAyeza/LDIaJIJe6lhzNwwUr3rZjP3cHlH3RauQM6ay1aeK3jwoIRj+E6MKMFZqze h X-Received: by 2002:a05:6512:1384:b0:51c:76af:f87e with SMTP id fc4-20020a056512138400b0051c76aff87emr430998lfb.57.1714041603278; Thu, 25 Apr 2024 03:40:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id h15-20020a056000000f00b003434c764f01sm19485768wrx.107.2024.04.25.03.40.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 03:40:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/37] target/arm: Support MSR access to ALLINT Date: Thu, 25 Apr 2024 11:39:26 +0100 Message-Id: <20240425103958.3237225-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425103958.3237225-1-peter.maydell@linaro.org> References: <20240425103958.3237225-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Jinjie Ruan 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 Reviewed-by: Peter Maydell Message-id: 20240407081733.3231820-6-ruanjinjie@huawei.com Signed-off-by: Peter Maydell --- target/arm/helper.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 7a25ea65c9a..b9443b1813a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7500,6 +7500,37 @@ static const ARMCPRegInfo rme_mte_reginfo[] = { .opc0 = 1, .opc1 = 6, .crn = 7, .crm = 14, .opc2 = 5, .access = PL3_W, .type = ARM_CP_NOP }, }; + +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 (!isread && arm_current_el(env) == 1 && + (arm_hcrx_el2_eff(env) & HCRX_TALLINT)) { + return CP_ACCESS_TRAP_EL2; + } + return CP_ACCESS_OK; +} + +static const ARMCPRegInfo nmi_reginfo[] = { + { .name = "ALLINT", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .opc2 = 0, .crn = 4, .crm = 3, + .type = ARM_CP_NO_RAW, + .access = PL1_RW, .accessfn = aa64_allint_access, + .fieldoffset = offsetof(CPUARMState, pstate), + .writefn = aa64_allint_write, .readfn = aa64_allint_read, + .resetfn = arm_cp_reset_ignore }, +}; #endif /* TARGET_AARCH64 */ static void define_pmu_regs(ARMCPU *cpu) @@ -9894,6 +9925,10 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (cpu_isar_feature(aa64_nv2, cpu)) { define_arm_cp_regs(cpu, nv2_reginfo); } + + if (cpu_isar_feature(aa64_nmi, cpu)) { + define_arm_cp_regs(cpu, nmi_reginfo); + } #endif if (cpu_isar_feature(any_predinv, cpu)) {