From patchwork Tue Jun 28 04:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1649234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=lw3ZBC5I; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LXC7M629Mz9sGC for ; Tue, 28 Jun 2022 14:59:27 +1000 (AEST) Received: from localhost ([::1]:46636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o63Js-0000Tw-Ro for incoming@patchwork.ozlabs.org; Tue, 28 Jun 2022 00:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o62nl-0000R7-Sh for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:26:14 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:34500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o62nk-0004Nu-CV for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:26:13 -0400 Received: by mail-pl1-x62f.google.com with SMTP id jh14so9999970plb.1 for ; Mon, 27 Jun 2022 21:26:11 -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=SXozRQJRDsddSiDU4WvdirQqE4A6/ObOnm30QCWvExc=; b=lw3ZBC5IAkdqx1p1s2KVFqXCc6vW6k1VFV64JFiVW4zFkG5KdVnVQK1JGC8aSYfHXx 3woHK+egJwJ2qOXjvFDPXy3InKWNCqPiMA1v3P1YjJucKsBEgFwOaaaiVhREgD+jZh+P OKlzLPpHI2sCukSVETWVXw3ATh0uKiOgYEHCZ4UEqwqGm5sJbGW275g0ZHs83SWTRT8H /XrkD5ghWLO6LK+9HYhR/lQF8x+2T2H6R8ufQNMS3E/o75Rd/tEf4MUiDneQzJ1kxJ9D 3EINihabLq0WW4sesm1jjhANIOJaeoAaOKTl/KuM8B7NbSON+Rzn/QVya+bmGfd7Gdx8 mQCA== 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=SXozRQJRDsddSiDU4WvdirQqE4A6/ObOnm30QCWvExc=; b=JSy6/FfXZNDs9suRAqggqBfURyq6ngfRya1zJZcJXPoKtlLDH62a5bPLkNjYFFnFez vZlxUTYf7wbl9CGuY2/cBUBk6dg7JFpwcYA4l0+YWojwIe/0VefDKFun2veuUvpM09vN ZutJXi+YYJCcE0H1ulUMLAToUrEH2A20OG4/PHqcIq0At3rh7kdv3x3d/WbITStfI1Sm 4C1/W2si26uNYUjVS2GCz7t1XuLoAF1IULUiG0VoIAtEaWV1qLivRVigf2c6e+o+m17T NAuDSn6brRXGtvKR3uMb7Q5EfwEJHQcgFUzSaV+Kbatzq2Cs8z9kDnTU5gTSgA7c2pXw Gplg== X-Gm-Message-State: AJIora/8BSLX41tH9TI3jVj/+IEMpXluN1LCjjf7+MGjSi5iWefFMd3H h/eX+nrP29NiocNZr+PcJPS5TJpz66kSDA== X-Google-Smtp-Source: AGRyM1sA/qHuZH5zlcCEgU5FfSAdrBl0BxVmnqbHpWvvgDFxmpLG08uSk3DXwV31VxLpiRwN/As20Q== X-Received: by 2002:a17:90a:a40b:b0:1ec:a22d:5c3 with SMTP id y11-20020a17090aa40b00b001eca22d05c3mr25318448pjp.118.1656390371598; Mon, 27 Jun 2022 21:26:11 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id k26-20020aa7821a000000b0052517150777sm8160565pfi.41.2022.06.27.21.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:26:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v4 44/45] target/arm: Enable SME for user-only Date: Tue, 28 Jun 2022 09:51:16 +0530 Message-Id: <20220628042117.368549-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628042117.368549-1-richard.henderson@linaro.org> References: <20220628042117.368549-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Enable SME, TPIDR2_EL0, and FA64 if supported by the cpu. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 20cb622083..87d836fb2f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -210,6 +210,17 @@ static void arm_cpu_reset(DeviceState *dev) CPACR_EL1, ZEN, 3); env->vfp.zcr_el[1] = cpu->sve_default_vq - 1; } + /* and for SME instructions, with default vector length, and TPIDR2 */ + if (cpu_isar_feature(aa64_sme, cpu)) { + env->cp15.sctlr_el[1] |= SCTLR_EnTP2; + env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, + CPACR_EL1, SMEN, 3); + env->vfp.smcr_el[1] = cpu->sme_default_vq - 1; + if (cpu_isar_feature(aa64_sme_fa64, cpu)) { + env->vfp.smcr_el[1] = FIELD_DP64(env->vfp.smcr_el[1], + SMCR, FA64, 1); + } + } /* * Enable 48-bit address space (TODO: take reserved_va into account). * Enable TBI0 but not TBI1.