From patchwork Wed Jul 6 08:24:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587749 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2586691map; Wed, 6 Jul 2022 02:52:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uJDdftUdvIzNoibxCNhJEVF51IP0iGW8HPpgngrxcm+uYZTt/E2o6PB2s73FXmwzP62InS X-Received: by 2002:a05:622a:3cc:b0:317:cdb0:e with SMTP id k12-20020a05622a03cc00b00317cdb0000emr31105313qtx.190.1657101124578; Wed, 06 Jul 2022 02:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657101124; cv=none; d=google.com; s=arc-20160816; b=CAscUCFJJ1w1ETT9EpRTCmNW+JNfKcRZDDpyyqtd9gC6LQgwbYoLrlLn+fQ9rx3y2/ /ff8MnBcy1ZKOxFslFvHIMJIOzjYlDqu5IJUa3/ly/BSWRbweCknvuRYpKq4ik3xJq5I trB/UO48RrVuf06T+5HZG7aaBFRTRqA286T++ejZLLj4b773kPsE9fn1y5GUnUekAjlw JAWl+m6PAnp/DSBU3rLKc8yiOYoqxpfQxaroA/GIiJ0SFNeb9a5bdW284ioRKwCjKKBB kBZJirm50RaJ+pC8mN4NezDg3tHJ4+vaKAc4jH4s63Cqxr59edOnivShJjauOnRx/mBx LX4A== 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=QXu/KgUnFX9XdonKOb4RpodqXgfNtkqVhXPaRa0Wz+g=; b=qMaldD8xh17tNEAX8WTkzFzVQQX30nOwZJPt/xaZ2fkpqbxyfrQZ07qmsTccLlARJM 8q3E0q8u2QFF60mGtHquTcDbfnG/ZZUKPjEIy0sKsK5aTorDoYYW3qxZN+fEYprhxyiz 3BfepkUGKv1lAYetTv5QrIC3CZoAqTwoO6b3oFGFzWu1HmOvpjLIzmySgM3ca9nNbl+f bVEc8LiVQl/cmKdR1DCRoaYlCcNZeix6lgyHorqXt9eUWzqM5CUQce4sSCIZrzjAwuwb vav0JpnGR+8M9AIpWy+4N+GR0VgXrTJQaapzvVapjNN3SvgFNAJNqQFSqZiUuWKdkj/C gOxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vLH8u/YI"; 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 u8-20020a05620a454800b006b052945441si16135034qkp.473.2022.07.06.02.52.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:52:04 -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="vLH8u/YI"; 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]:58546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91hU-0007wN-5c for patch@linaro.org; Wed, 06 Jul 2022 05:52:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90M5-0006oP-OE for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:53 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:45869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90M3-0000nB-5o for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:52 -0400 Received: by mail-pf1-x433.google.com with SMTP id 128so13704299pfv.12 for ; Wed, 06 Jul 2022 01:25:50 -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=QXu/KgUnFX9XdonKOb4RpodqXgfNtkqVhXPaRa0Wz+g=; b=vLH8u/YI6xNxYEqgir1ZeiCndQwgdBo+q/o9gvHh83VvtPfjnuOFng5j5qZUlVptkO zC9ZtRT0OUKcaK5BtjJxZcqIDLjNDpYzOo4Yrogu8y3X8BezJzHfiMYDQjq5xQG6m9Cd kYSJXJfqUrA3pdoHUL6cy/1ZOtUKMUbeRBGKfHU705kU/n+e/wmIJu2gMv0NJ6jRGeMe GDHqpvAszlmFK8TjSzYTDSehB3TnmZd1uVpaQ/pdvOXWcYdPydqFwODtDfLQMP6Z7pzc 4+t/Jfgg41865AqcYK+zFqbgu0ev40xlhFeWZbsOC474WV1Z7eAsDNe8hqq2xROBAF08 M+yA== 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=QXu/KgUnFX9XdonKOb4RpodqXgfNtkqVhXPaRa0Wz+g=; b=It0Uhe6qKcGMHK5K9uwmo9o7YGiLuNrGDcv7nqDGDvkaRHvvQFtaCMnn0SM8tWZVDY j/VarQqucO1CjNcLXHYsVIFMiTFcqDGOOpFblpkgl+VzMEMMS9OWG7ctHQXinKrYR5lU o50y/AyYJBzEWWvhz5uIVlqO7mTRvwpvhib69i/Z1zgSfkSR+MvlunwuWDtpiXDwJwga Agub6HqN2wcMbh3IeFshVpK+OehgxQdTFM8T+jnWh0iEyMGHz6nqhOUpOIillYxjN9oC mNk7QXX90u9aQ8OFXouY2nOMpY57n5jACADlehUIrPkoDx5LXa0Amla7OsdYoxVygN8p Rxpg== X-Gm-Message-State: AJIora++N65W4JzXwNNbffYBuu9QhShQLkV4cUk18ZuMkpLruK+NK5pW ne/KxzyZl7InrsXHD8GBIJxg48xr7sIigXKX X-Received: by 2002:a05:6a00:1901:b0:4fa:fa9e:42e6 with SMTP id y1-20020a056a00190100b004fafa9e42e6mr45598933pfi.1.1657095949999; Wed, 06 Jul 2022 01:25:49 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 34/45] linux-user/aarch64: Reset PSTATE.SM on syscalls Date: Wed, 6 Jul 2022 13:54:00 +0530 Message-Id: <20220706082411.1664825-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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, 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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 f7ef36cd9f..9875d609a9 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],