From patchwork Thu Jan 12 10:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 641652 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp3730289pvb; Thu, 12 Jan 2023 02:45:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXsrlc3qUDUTZrzIY02kYzwX3piezZ40AyVvV7df5N0pcsgVFF2dwe5haN9HZsgIDdvVTf4v X-Received: by 2002:ad4:4152:0:b0:532:2d6c:5deb with SMTP id z18-20020ad44152000000b005322d6c5debmr19491069qvp.27.1673520353743; Thu, 12 Jan 2023 02:45:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673520353; cv=none; d=google.com; s=arc-20160816; b=TJYQkNN/1Jqoy4jfUMuFAR8LpPkLDjdebmB6sdPPuD7wEjq35QdRwBIhYnARcPkbNw sd08lQ6CiVeh2yvnNsMW+8KKf8Mbp+dCQaDobkZjVOViahXnF46a78FaMHIObp8RddNW YAzshPt0hFomG2rqGmXKoT6JwhrP4qjqJ2ux8VEPCeai8pHpuedThhclwwTsTR1LCqbD qDSw/RsVh+C4RBuhYDpeCKMye98v/lRygy6iq535EB/0mK7soy9haJGSDQXQ0oQkHujX B5X70vkxHy1dogZHT4VQs1EOkdsLvSx5xoaNWxhVScn9tuO2bREE+9XElFo59L5o3Fe+ jS1A== 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=QdbzZcLHTRdT4BdGiWixXL1Aa81U11XaY7492Ze75as=; b=OedWGiW0poUoCPliXkssTg09KeNXGXspre50FjojNkvRB7/dsSTtP1AfanDsZqUEO4 P7wEhh9kDnS2U+4MUMFhVBbueyw4jPPsR5wmymauxmJ7HW53kTnn6yn8dzfbbC+zthT1 NQbrcVDM1B6HIn86F+80Dv44Nw8t/EQutkWxKtun4Sngsl7UgB8DUivaR90dko+owNbJ eGEXElJvksewFhKitYSbPm54a9q7zY/eXdoIxCl6tFTK1umTD0fHoufvi9EHYRIiCI0G VAvl4AvgS/FEkgomEfLbr83KK0SDGzi5A1bm1VvgkIudiDZhF2CHIQepuFtONjS+2EWm 5Wwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nAWbmTJj; 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 m14-20020a05620a290e00b006fc97875494si10827877qkp.650.2023.01.12.02.45.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Jan 2023 02:45:53 -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=nAWbmTJj; 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 1pFulh-0002r3-Cn; Thu, 12 Jan 2023 05:25:09 -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 1pFulf-0002pp-SU for qemu-devel@nongnu.org; Thu, 12 Jan 2023 05:25:07 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFuld-0000JT-Hm for qemu-devel@nongnu.org; Thu, 12 Jan 2023 05:25:07 -0500 Received: by mail-wr1-x433.google.com with SMTP id r2so17594171wrv.7 for ; Thu, 12 Jan 2023 02:25:05 -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:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QdbzZcLHTRdT4BdGiWixXL1Aa81U11XaY7492Ze75as=; b=nAWbmTJjZr2z4XR4KZiNPTDBbXLEH7I+zKOmGMhXO3LcAU+nArtF+TPvbsZs/I38iK zwEV8Qy8eXsf9JKUKkYkbE/c5w35qD/JlVuOIFR9jKGA90HmLAcj+4gs+BAkvXafI401 5k5+QhWohkWjRIzlLMq0R7oIQjL6MQDYsJCMAj/0tfZniY04m4eyQXwKFZThXbHsu6ZS OI66zpcIIMY6zYyfywVmG6p4J6vRX6fIO5BQ5a8FU7y7t/+CJ7Bgtr1BOkwd5CfQwflg fXxHNLxnWFbI94nBtPGdhVgWM5rWasCFPWn3bXOkJPIp9rX9Z1yyDdmXd9GUpFDltTnQ Pg9w== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QdbzZcLHTRdT4BdGiWixXL1Aa81U11XaY7492Ze75as=; b=tdCJ+nq3A+ffxCxXzGDRxSYH4roEpCVWmUIKupzz04vCI5O8EBqRCH+s/AELi4zfnZ iOuuWwEAq/VvmZ7k41ePDpvvyE8cLjr5oHdZeX7swsSdrTfLDDqTmI4YdA2d//TuK02m 8RwCENXXYzFdypQf/2NVn6avOsHT9DxH9Q1ljgpZdt5qt1HBtm0tSj3fFOx3T0VN/PIS 2jISvZUMnj2PEUfb4uQLjdW6IMv92KyH0d1dtClcdilLAkZ+FkMHlirIWTcFI7cZa5K5 lwTjng1QwygzuMW0qIRbFo51/ZpV3XnqQeFtZQ78PXXDTS/p9sqPtug55zpyk9QeX+F7 KfjQ== X-Gm-Message-State: AFqh2krd7Hzc7usLr0dKapySOmq9IqD94aiAq+yd1zr3Uutq1WqEY1dY GXZ1HetxeG5O1nQYHBhn2vPUo9pPBXYCvp3K X-Received: by 2002:a5d:6b87:0:b0:2bc:371a:8a1 with SMTP id n7-20020a5d6b87000000b002bc371a08a1mr9088673wrx.22.1673519103792; Thu, 12 Jan 2023 02:25:03 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bp28-20020a5d5a9c000000b00273cd321a1bsm16093843wrb.107.2023.01.12.02.25.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 12 Jan 2023 02:25:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Richard Henderson Cc: Laurent Vivier , Peter Maydell , Fabiano Rosas , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 5/7] target/arm/sme: Reset ZA state in aarch64_set_svcr() Date: Thu, 12 Jan 2023 11:24:34 +0100 Message-Id: <20230112102436.1913-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230112102436.1913-1-philmd@linaro.org> References: <20230112102436.1913-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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=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-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daudé --- 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 b655dde27d..26c3bb4cdf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6740,6 +6740,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 f73bf4d285..e146c17ba1 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); }