From patchwork Fri Jul 8 15:15:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 588560 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp793875mab; Fri, 8 Jul 2022 09:05:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uzbVz6dOeDir2z7DKGW5dsqo7VMXyiTQW9SztBF6BzFJyrvHeGtyZCEOdOsR9XJFECPwQI X-Received: by 2002:a05:622a:38a:b0:31e:a1ae:89f9 with SMTP id j10-20020a05622a038a00b0031ea1ae89f9mr3618690qtx.532.1657296346182; Fri, 08 Jul 2022 09:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657296346; cv=none; d=google.com; s=arc-20160816; b=PiTllf1W6kQ4b5DsEpi9smIL1fmXhROBNxZBs7+aWqhBYSO/HRKi617OC06X5MiNf5 847JUWPs7PG3jnWuUIa67OMEggeExz0ADPnWyTM/ph8v72ed5x0GhKNw49JNdG3Y38u6 ebj+SrOs1xnv6qdQt+5OxaWgWaV9yrvs5Ec2F5QvEgvbQ1iTr+wVHhnCMf/khJt1o1Wo X7iSbYPZ1+ztAgpzZ6sIYnwqcAtK2oJRYirW5yoEKqzllLKBsX51wvgPmc3UxioJSeWi jtNZPnku82wf4w+GlufMbitiioPfHvlVurntyE4CvX8wM+DormNn704J0uM/Bv5YeGVG Y2aA== 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=ojyZOIf2uqXDhLYPW4II9jqD/RYb57Q1CkTjNakDECE=; b=zvSQprVD5w9PsB7ACPDUd76igggcrzq02u5Bd7glQdalTwvUzPnhNtuYjPTiTpmzAo UQnzq4OBBLuIIDcKPcoXtTPAhZmERIHJUx2i6VPQRO3ROLXqIziLHplfAVq7ceB3euWC G+jWbvKBTxdxFKBPBwzUDKbp2gt272tUv1+hmPe9Vl6LV62ixB2xkQgaEhwgfFGOHr0t +jc535rBfdldbFHlN+JuDbCwjQxfvrxFcu/EPiEPYYcKxtYtEwCPljCGtetjF4A55NLy 62iLdu2iunG5spxDIxWC/tZMLhl46hcb3Fn/ZIVOsFnRZwePEvkg+fQnR/btebtzvkWt QP5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ugm1HCxk; 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 b22-20020a05620a271600b006af1ba50ab1si22418313qkp.511.2022.07.08.09.05.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jul 2022 09:05:46 -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=Ugm1HCxk; 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]:33622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9qUD-0000dd-Qb for patch@linaro.org; Fri, 08 Jul 2022 12:05:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9pmz-0003gk-DX for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:21:05 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:43715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9pmx-0003IP-O9 for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:21:05 -0400 Received: by mail-pl1-x62f.google.com with SMTP id r1so16590508plo.10 for ; Fri, 08 Jul 2022 08:21:03 -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=ojyZOIf2uqXDhLYPW4II9jqD/RYb57Q1CkTjNakDECE=; b=Ugm1HCxkCao/v3DlPh90pZ+19YwR0BAOX8TjVko46238qJmZWwWqS/+93D7imAmP80 KccZBJDy5gFrkcYzu3N5271KDlcbo05kz8XexqLEIDVSxXZi2ddCQmI3z6rsjKWSApr/ KGVFZhRc8ayjwihQjgzA2sywVqdOBnL8hkAe+vSyhpN190MAHOoe2sdBZP8ymBpSeBrf pXejthiWHlksyMUVCe6w/WwWnkSTSBsp8yJXImSmh6FsbOq15ATsFAExl0VkD8CwIZCW Djj4zbaeirmx9xFlnjQD+uUDQkihpeh5wDnSfJwhLWuzdBeFXBQAJl7VJJNdWRt7Ylt1 HFOQ== 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=ojyZOIf2uqXDhLYPW4II9jqD/RYb57Q1CkTjNakDECE=; b=WiYjH1BxBkfX920RRX2yWMj/sRoTJPpE+sKsvjCwlLnJURQMJdKJ5RXo81DxgSz43v Dt+XX4OdTYnVH4HLI2PvXvO0JxpjDpT1xliTyhaOA28Pn88OALHWIw+fEQmjRcxtZ5Ys vl2YtTt/EV1xlwSeZm2mfUotgIBNsQ6Z5T0XYK+tmEaFo2JMEbrY9v71fPYRC0pnK9a9 jtzhkeY0ks+5dijVAFTB5Yj/fbGybVndNcHPH08KynzGAsysc4OAHKhX6mToKzKwN0Bx L5pgImd8QaaCiDZVZ2QrcrB59S4hIPjOLiuUWoyu6Mlyw3eAm3rTngtB86Ta9/sdC7u+ aORg== X-Gm-Message-State: AJIora/3KbErsuuLdLJJ2emtW5womkHuZgOAgMa2L6tamvcfQvnvDrQ+ +oG0krhEF32xRt2nbQTKjQhIRnnqCL/7nc5d X-Received: by 2002:a17:902:8345:b0:167:879c:abe8 with SMTP id z5-20020a170902834500b00167879cabe8mr4250447pln.7.1657293662404; Fri, 08 Jul 2022 08:21:02 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id cp2-20020a170902e78200b0015e8d4eb1d7sm30067741plb.33.2022.07.08.08.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 08:21:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v6 44/45] target/arm: Enable SME for user-only Date: Fri, 8 Jul 2022 20:45:39 +0530 Message-Id: <20220708151540.18136-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708151540.18136-1-richard.henderson@linaro.org> References: <20220708151540.18136-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=unavailable 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9b54443843..5de7e097e9 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.