From patchwork Tue Jun 28 04:21:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 585493 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp435452mab; Mon, 27 Jun 2022 22:23:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRZ+84QG5OmXC+sEuGNKl1ZAJXrZxagpQJS5+zwZxEFMnR5jlSUFTo8kjQwRI9FRyeCKkW X-Received: by 2002:ac8:5d89:0:b0:317:c4b2:e89e with SMTP id d9-20020ac85d89000000b00317c4b2e89emr12260142qtx.383.1656393807177; Mon, 27 Jun 2022 22:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656393807; cv=none; d=google.com; s=arc-20160816; b=hRmS7BkuRNQPDVD/w4dqObBc4rZ9KPWOCrp6SQlwQDkdwDZfRz74tZ7AIuvPQsle1z SNZelgyajHkMG6erNeEijv+es7yJBAJ4DPaOVc/TfLhHSZZAH0JRu8rPlNbUd5J4lN3P 1J96tn7vSO1c3kZJbWOtlS3nzoMAarrrBMbtxo2CF6QH3xWLSoWE5JH1FaihDKnlx+tC OSdLC6+KopO2rUncNXUr2mxrilq4G8iE/bf/+e/sdOSw+0g7KypG+rzTbePbRQSwm5S7 +O7KS9AnQBMsqghLOYhIFJqwicVIKvn02zUabbvEpP7B7mEmYnDh9QWg7LCWaQI116gw Kqfg== 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=VJKQ6WoqB0EGYqa/ELNpHbDiJmRFJHnsDZvzPsZOiDk=; b=TAJ5CnaSrX6fSwfs78Dpo6Yr9CCTmq2EYqywLrFNhylCY7hVLG1BSPJgvEzRrWoL/j SveUvLv7TbK97TnnuPsgHB/34PWs/2EMX88kXrF99+Pas8FvdWFGdzjObCrlU6uic7T6 fc+u6AYw6++RBRPI799dbO4mjZXIrFDHcHZTBAtQaxQKH9spZV8UnccbMo8g4ePUXGsW 8Sy+QbLie7APVD/waggEyxsjW3X/Cx7Gcp0pEZnr5Gz06sj9+09I78ouGetqvlCp9fpo lCp8uU4vTAbG6NazXoFr+ut4CbSSelMPYYeio9nz0mQ2hWsazvjvzAeDRUilP4JUiLas fQcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uAebr7q0; 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 130-20020a370488000000b006a7102ef603si6129228qke.267.2022.06.27.22.23.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 22:23:27 -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=uAebr7q0; 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]:53174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o63h8-0000R8-Ni for patch@linaro.org; Tue, 28 Jun 2022 01:23:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o62kS-0002pF-8X for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:49 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:35665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o62kP-0003w0-5J for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:47 -0400 Received: by mail-pl1-x633.google.com with SMTP id o18so10001042plg.2 for ; Mon, 27 Jun 2022 21:22:44 -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=VJKQ6WoqB0EGYqa/ELNpHbDiJmRFJHnsDZvzPsZOiDk=; b=uAebr7q01bnSUQKm6h+8ApekzzBlodGrdvM3f3JVJTMBkA3Z+Ro6IsOnicblepT4Ch O6+NK23iU/XOb/v32Btnz60FqhKvvGbs+504Fq0AwZSMyIwqekmzSebc7DbTlMvbcyM+ rLh9lxpFZJXsEubk1s/xAdNPhYupGnJT9ISCjTXzRnqldMBPFmL0zLMDGAE2N2Q4vqWx zTjBFBbTAzdrGBvbYXe9poS3Djb4mbQ06+AKL/GV7dkWaazvbm23hrA5MEB0hcmerqtA EAZ4IEyOb+7f+Au5lG4S/PJ4t01HDPPhXpjsipl+/YzkL8mfMaFpxouVQc7Gk8x64alS VqjA== 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=VJKQ6WoqB0EGYqa/ELNpHbDiJmRFJHnsDZvzPsZOiDk=; b=LgfI6F1NMpH4Q48NQLmHZewiy2B1BiOTEZWnvSz+wpkn98Gf5xCxr9MdcBHQluV7VO 8IZNAR32S58iDEFyE++sQhPBmS4TrqYXYcG4VAWMzev63nP9ld+neVEaReJlfqceZwEv oxz11Bshdl6kHUf2Nb/BJYWGMKZfIx1EGoozTkvmezDhNMwWFisvmGVh8bLYSIjDZ/LL MHEVin7XMPBdsJ+VVpHNiKJRB9lTbEB0lY7tyqZ+sjhddAsjSr0ia2tUetH7h36R3cE6 IKTvVqLpmkzBGJPrAMrO4jNKPmDSGT8b6vBquM72+rkBEXU5qbFjtrM4xPvRawyoCxLr fQGA== X-Gm-Message-State: AJIora+RWvFqNNz9OZPJeGzh9SkEpbb53Z9S559xSt9niEOrDgOrho5F I4L9zfe1eBU0J+r3yLxuSb1R5jsXyojyFQ== X-Received: by 2002:a17:90b:4c48:b0:1ec:a20e:a9bf with SMTP id np8-20020a17090b4c4800b001eca20ea9bfmr19918140pjb.209.1656390163547; Mon, 27 Jun 2022 21:22:43 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id jg6-20020a17090326c600b0016a087cfad8sm7994929plb.264.2022.06.27.21.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:22:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v4 34/45] linux-user/aarch64: Reset PSTATE.SM on syscalls Date: Tue, 28 Jun 2022 09:51:06 +0530 Message-Id: <20220628042117.368549-35-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/aarch64/cpu_loop.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 3b273f6299..4af6996d57 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -89,6 +89,15 @@ void cpu_loop(CPUARMState *env) switch (trapnr) { case EXCP_SWI: + /* + * On syscall, PSTATE.ZA is preserved, along with the ZA matrix. + * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState. + */ + if (FIELD_EX64(env->svcr, SVCR, SM)) { + env->svcr = FIELD_DP64(env->svcr, SVCR, SM, 0); + arm_rebuild_hflags(env); + arm_reset_sve_state(env); + } ret = do_syscall(env, env->xregs[8], env->xregs[0],