From patchwork Mon Jan 23 13:35:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645572 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2228006pvb; Mon, 23 Jan 2023 06:59:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXsz1KQopz3y8cOj56HPn8zKMCL3dR4xsND7wy0lHuYSaSCkLoQl/i8zR5xJaQ2e5ydoJ2ok X-Received: by 2002:ac8:5053:0:b0:3b6:3577:2fe7 with SMTP id h19-20020ac85053000000b003b635772fe7mr32031884qtm.49.1674485959332; Mon, 23 Jan 2023 06:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674485959; cv=none; d=google.com; s=arc-20160816; b=QZ2mhdj5r1PXVih2YeueIni5lvTH/ArOeFi5EsiNMW5NGzX1sAg308sS/7RFd7+B23 G896px9Bq0NHTM8s7qbQ6E+lLcJaXRcDpNYZdJGNITR5ZM4UpT/YQdgdA4zkPXz6aJR/ prkaKbFkOrjynC15cQh3UpC0lGfHFC2X0crjw0WeUO79O5g6adoAjHLVNG+mP7XoQrNT SfDFfUxWrunx1rU/KCqWwDqsRo7ADarrI+lRCk2SQV/odB7zKtflbCtdnNbUPMM2OGlE lZbwMQxku+/3qGEBERO5bOaOc8jCYarZ/ojnwe50T9Rx9dKkXGfmi+t0njLK1Sr/j1ys g7FQ== 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=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=MJM5qfU71VyxAnT6wJWAtdF3valhoyAGVpiBWgORICn0ZfDEySO37fxRwq35YrmfNe vhGvUECuy564X73WJWV/21dpogJ3wojBkim6JNkwQ7mXnl4JK3HGSLfFuPI77x3gzA4+ TZdzQ4a0uuS9RXHFSCTlKAUQjZqDpNZLRDRxw5vZYHvVMlWeYmajj0e5Dm+aLOOeobgr 2oevvwzmDEBKXdJ1qlIzJWZ87rh+FuFERP6w+wOXsTTNOlEO+fP8pX7xhDvIjBjjfwoN lYJuBxreQpqs/XZni2MQgHlIcdUEq3senIEOFs35E6+dtvCtGUNpj3pqBW3wQye/8Sta WiYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LCqb+Q3k; 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 r16-20020ae9d610000000b00705dad47076si24796286qkk.144.2023.01.23.06.59.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:59:19 -0800 (PST) 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=LCqb+Q3k; 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 1pJx03-0006Hy-R3; Mon, 23 Jan 2023 08:36:39 -0500 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 1pJwze-0005y0-VJ for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzc-0002SC-HK for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: by mail-wm1-x32e.google.com with SMTP id o17-20020a05600c511100b003db021ef437so8562774wms.4 for ; Mon, 23 Jan 2023 05:36:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=LCqb+Q3kWHuuK2NSBE+7jCobx112B7Mrc+nhiy3HroRLMkXGZm0VIO9Mv0Uip/btGD 3LAOA20kRwF/K37kMmdUORE+9Gv7JRQ8HHBYrUVYFGNLN3Hy3D1B9lgWZ7a6wFhOThnt maB92wyhIj+P9FD3hkHCIkSopp/NCwxnCn2Ut4ixFBVIsIw7fiAKkgxrP+F6R8LXLogV n98CODzQ6vjEC3vdeoxwX2e4Ugtgt2ASwV2QF/a5bYK7bMCUZBo/4rKjc+e/1jR4u9Pk 0jER1WW+UHmfCilQyryGbIBdmFUB3qk2zev5Iom+91Km+yxZMG+IApqHhkjfs1ZCVPXO CdsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=DWWkTDDT+g2o3XUlEZYEoGWdEbawlxkVeV0aWr+zceH6jmfvjjNlc4ZgLMoI1gia8c iANKKgN5r+kqekP+p9mVaIN3nFlbnwm+VvtB5+J9jtppm5Qrds2PbcRCJRbUHp1BO1w3 GaXzPq+FXqt6+GjHBcg6sucLNC16fHvA8FAQIfnAMYK9bkQQVV8FaqxLIV6tOiIGc/59 70LzzCbdKAYeQjK9/5zf9fnE1eonfDhqvGKMmVULY9Ip31j7V7u2Z8ZQDbuG7xH3my/F bcH99qMbREKCKRH+UziAYwFDU3Mh1AVELLkGcYRPECRMUUiWEwf8eGBBvxQOMg+OwhI7 WqJQ== X-Gm-Message-State: AFqh2koQdOyyAsS1YHZjEG2kcoo1dsJh9Z4xLo3Y4iMUELFqHs2ycw0W vbD4LE4Y3ctEzVRePi+N97U4GsqvEm3vBur+ X-Received: by 2002:a7b:cbd6:0:b0:3db:622:4962 with SMTP id n22-20020a7bcbd6000000b003db06224962mr23984290wmi.21.1674480971019; Mon, 23 Jan 2023 05:36:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:10 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/26] target/arm/sme: Reset ZA state in aarch64_set_svcr() Date: Mon, 23 Jan 2023 13:35:44 +0000 Message-Id: <20230123133553.2171158-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé Message-id: 20230112102436.1913-6-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell --- target/arm/helper.c | 12 ++++++++++++ target/arm/sme_helper.c | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 0ac867c4119..564c5d93320 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6743,6 +6743,18 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) if (change & R_SVCR_SM_MASK) { arm_reset_sve_state(env); } + + /* + * ResetSMEState. + * + * SetPSTATE_ZA zeros on enable and disable. We can zero this only + * on enable: while disabled, the storage is inaccessible and the + * value does not matter. We're not saving the storage in vmstate + * when disabled either. + */ + if (change & new & R_SVCR_ZA_MASK) { + memset(env->zarray, 0, sizeof(env->zarray)); + } } static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index f73bf4d2853..e146c17ba19 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -44,18 +44,6 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i) return; } aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); - - /* - * ResetSMEState. - * - * SetPSTATE_ZA zeros on enable and disable. We can zero this only - * on enable: while disabled, the storage is inaccessible and the - * value does not matter. We're not saving the storage in vmstate - * when disabled either. - */ - if (i) { - memset(env->zarray, 0, sizeof(env->zarray)); - } arm_rebuild_hflags(env); }