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: 585487 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp422362mab; Mon, 27 Jun 2022 22:00:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5Wq9jxsftjqbX2JsOXyFYlP/szo1SOSr5ViUtIL+F6ifjAjXnOFh7p4g7huUdRMGqFn1A X-Received: by 2002:a05:620a:1a12:b0:6af:228c:ef65 with SMTP id bk18-20020a05620a1a1200b006af228cef65mr6052492qkb.680.1656392417700; Mon, 27 Jun 2022 22:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656392417; cv=none; d=google.com; s=arc-20160816; b=Iy39BIfpdf81uqO3yu9m/P4/qAG/gNOXe9OK0nmPbB7+fu8BgsarwjUct2UMzETpJ9 nQUhrl87pKG/emDYQCnbKp4TPWQN1PRjbw5wZAZXumgLZOSR4C8II43/DYinq9thSDA8 Nlboa6eldFnl8OZU9NtXWVGOglHOOD6iYYq/VrLgqhisjIO+A561iMU56TzwhZBVW0mv EjYCO6iP0KcOXlyVH+QhXZmSnX08HdOClIbsqceSW+uEkeaPSI1cfXc5XrHN/ZuWxWOy eYqnI8J65e+JLTsygTZae1MPb5P5j09sfVdJc9lpjcUzTjxuprO1lDtFgxVwlRQxegnh J7aw== 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=SXozRQJRDsddSiDU4WvdirQqE4A6/ObOnm30QCWvExc=; b=Ax+V/6JouycMxNWeko4cOgFGNe9YOxh9xPHHNmi8g9q65v1Qs/fJLq/KISgBuR9CIJ dnivnduAB2MQkB35S/KfRE6JY0MTD4LV0qGhkWDl1Hxt/B6hu74bwhXtW/dg/QPAXpjH pJRXUMecQWxGSUA7rx1vty9np1sz0TVM+Z7PSPxTuJ1BIGqOqrk/kRUBzBEnIdt37X9Q ymD2uZauAzRVmFeZWshXK+auHacB7R1uFDDZRPw5SgyVr53vttpKejsVIdyk+y4mIHpd wxcA6s17f0rTfCLCyXm4gWER9SPKgW0/UaBosRZUnotuqWnjWyK/FidUm5cLDOfkiJ8H EtuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lw3ZBC5I; 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 o19-20020ac87c53000000b00300c8625c9asi7312437qtv.238.2022.06.27.22.00.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 22:00:17 -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=lw3ZBC5I; 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]:46636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o63Kj-0000Tw-7X for patch@linaro.org; Tue, 28 Jun 2022 01:00:17 -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-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+patch=linaro.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.