From patchwork Mon Jun 20 17:51:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 583169 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp916231mab; Mon, 20 Jun 2022 10:57:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJhRJTBDiZFp/mLhBAv4WXBZDUTRxqJ88NQT4Kr9Y2zogynW6x2X3lX0tMl90Z2ntpQB7t X-Received: by 2002:a05:620a:294c:b0:6a7:4413:941b with SMTP id n12-20020a05620a294c00b006a74413941bmr16728424qkp.159.1655747877845; Mon, 20 Jun 2022 10:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655747877; cv=none; d=google.com; s=arc-20160816; b=gzCN3vF8+iYuggmGubUStkoqsvzYj2e7Ih1jNDNbg1ReRRno+kKjgYu5kzpeTUtkwH Fmkh6p6JuxyX77S+ZkdW/lBXSLzk4ZThFGVSZ7OfSMTX8i19/E1Ffkl8ygXfmWjJVqvk St3eHPI7iNA07STVBfKFYJJM+38OC8wyIfgqxGn5BFR/wG5ygdGwd0g9TMs7Fh9AgXc7 yJEXonU2GTPE2MSTnGLtJ0ady07naGUiELQZEWlT/6Td3mXh6jPhM5e9QGRxrgHoq7a3 g9daUmFR3rxdkj//W9U6ha8qlijK1ajwXp2iipia/OhWNgcKL44Qk5bIv1j3B5BQyeYe mqqw== 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:cc:to :from:dkim-signature; bh=viKLoyqhEy5uuARWIFm/MLLiPrBCa2bHnN3PYLnlpNM=; b=bcfckKWJcf99UtVYe4LBMZAkBI2DNULY2z7MGzepig/ycQYfXTVma4ywua6KQmE9iP mp8P+T0Syk33hgG3dvV7vhlceQMNFk8f69CD0hVu1NuiB0zj+uqht8rGO+Os7l3ZXl6H S7HgT+oN3NpL0pZVT8qgnEykXk9ROgjOVf9zXrjC85/Yt/IyYLEtnLoJnnKSviEyQrVM /HRRpAbsdSMhJ5SqsyXt4rEMg3V6WN0OaOrv0/aJVBhfkFoiWlzhaPaxtDRQOwB03DvY PIRUmZTjefHwkqdSyoh+JNKpL6Wxkj1fPX3W+17v6VFPQANZAIlu9NWQuJCeRku/ZbSB f8yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ntM9aoU+; 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 q8-20020a05620a0d8800b006a69f7fd385si9905663qkl.696.2022.06.20.10.57.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Jun 2022 10:57:57 -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=ntM9aoU+; 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]:51516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3Lev-0003W3-Es for patch@linaro.org; Mon, 20 Jun 2022 13:57:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3LZp-0005QH-M9 for qemu-devel@nongnu.org; Mon, 20 Jun 2022 13:52:41 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:39489) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3LZn-0001KZ-9V for qemu-devel@nongnu.org; Mon, 20 Jun 2022 13:52:41 -0400 Received: by mail-pf1-x42c.google.com with SMTP id p14so5192638pfh.6 for ; Mon, 20 Jun 2022 10:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=viKLoyqhEy5uuARWIFm/MLLiPrBCa2bHnN3PYLnlpNM=; b=ntM9aoU+H9gscRilksmOPIALY4nehLFcZnJZ3P2COLMv7IcW7aiFe/5cZbEqE+ESDk YPKgSJFgV+ZwSrK93Iv0sVym5zdY/klSfYPTJXC1bWA1fK/RZ3CkfF8FvswZtKa4vpML KahqRlT9B0pptatVQ3u8OZr3RovqcRbq5/etbOrdvRRda0PmPRFjPgTFGynaOZboRsdB pxDHgAfpb+rteDHSlFRoPOcwdKZzNMOgoAhUNDaAIBjfHxGcNyMnVDFBid/dSLVL9rA6 yyJqngtoriKtIdkGBwwCSESvVr+cvP/ll5qVeKkOM5eHR7U5rE2IL9I+ih1dItsPynxT 8Oig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=viKLoyqhEy5uuARWIFm/MLLiPrBCa2bHnN3PYLnlpNM=; b=xcBnobDVW/BcSGV/F2JBKZXY5xxVVK0guY/ewZsh+ChwEoOI7G1wISHRUPAZoG/aTz lYGIYwBZ70F6fF9JXXP1T69wB49I/O8WYBjoBovRuNbP98Xr+o3WnnVux61+76VmWaCh 2EjdRYiJ+sAoO6z3sG25NHAFqIJlLYhxMGsTvzHiLu3Jmk5iV63p7e26qAfNVmitcr3T f7gDOjTkEHoDNrI6nZBaodhJFeGtycmWXYIhk3Jf7AIZCPklPtMMCpS2IR2I7MsWEZF8 XzF/B2iWdtHwpb9pY2+kfwr/FMa9ZIuVxNuiBExBsIdj2DddsBFZW0Tcvc1wwFQXJs6D uZAA== X-Gm-Message-State: AJIora+cx+MpC5SMd2Agx1Nt8IDQSdH3YyYGHDRqpknHo68cfRXbwpAR 1RE3BLbiYZp4n5JlzBunpDNcC42mcCf/Rg== X-Received: by 2002:a63:f944:0:b0:3fd:4f29:67e9 with SMTP id q4-20020a63f944000000b003fd4f2967e9mr22228777pgk.593.1655747557916; Mon, 20 Jun 2022 10:52:37 -0700 (PDT) Received: from stoup.. ([2602:47:d49e:3c01:a3e0:8a80:7b85:aea6]) by smtp.gmail.com with ESMTPSA id j14-20020aa7928e000000b00525133f98adsm5138138pfa.146.2022.06.20.10.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 10:52:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 01/51] target/arm: Implement TPIDR2_EL0 Date: Mon, 20 Jun 2022 10:51:45 -0700 Message-Id: <20220620175235.60881-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220620175235.60881-1-richard.henderson@linaro.org> References: <20220620175235.60881-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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, 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This register is part of SME, but isn't closely related to the rest of the extension. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/helper.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index df677b2d5d..05d1e2e8dd 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -474,6 +474,7 @@ typedef struct CPUArchState { }; uint64_t tpidr_el[4]; }; + uint64_t tpidr2_el0; /* The secure banks of these registers don't map anywhere */ uint64_t tpidrurw_s; uint64_t tpidrprw_s; diff --git a/target/arm/helper.c b/target/arm/helper.c index 6457e6301c..d21ba7ab83 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6279,6 +6279,35 @@ static const ARMCPRegInfo zcr_reginfo[] = { .writefn = zcr_write, .raw_writefn = raw_write }, }; +#ifdef TARGET_AARCH64 +static CPAccessResult access_tpidr2(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + int el = arm_current_el(env); + + if (el == 0) { + uint64_t sctlr = arm_sctlr(env, el); + if (!(sctlr & SCTLR_EnTP2)) { + return CP_ACCESS_TRAP; + } + } + /* TODO: FEAT_FGT */ + if (el < 3 + && arm_feature(env, ARM_FEATURE_EL3) + && !(env->cp15.scr_el3 & SCR_ENTP2)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + +static const ARMCPRegInfo sme_reginfo[] = { + { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5, + .access = PL0_RW, .accessfn = access_tpidr2, + .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) }, +}; +#endif /* TARGET_AARCH64 */ + void hw_watchpoint_update(ARMCPU *cpu, int n) { CPUARMState *env = &cpu->env; @@ -8440,6 +8469,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) } #ifdef TARGET_AARCH64 + if (cpu_isar_feature(aa64_sme, cpu)) { + define_arm_cp_regs(cpu, sme_reginfo); + } if (cpu_isar_feature(aa64_pauth, cpu)) { define_arm_cp_regs(cpu, pauth_reginfo); }