From patchwork Fri Nov 3 06:23:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Gao X-Patchwork-Id: 740654 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp1212743wrv; Thu, 2 Nov 2023 23:24:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkBtgPJHwt7Bmlx4adSF+AJWAdGJrCFPTfSBmwubE1PNdKr79QGATHfUVJTUrk1PlL2XKC X-Received: by 2002:a05:6214:c25:b0:66e:b986:5911 with SMTP id a5-20020a0562140c2500b0066eb9865911mr21989230qvd.4.1698992679038; Thu, 02 Nov 2023 23:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698992679; cv=none; d=google.com; s=arc-20160816; b=ti6V9MjkSyg+fEzanUnP20pYyYr/CqeYDyGmYYNboAYWvJaIKJ1+JWZTpzFMpflnUv WHiJ/DnfNermFkLLkmSQjXJn9Hk17lBC4egFc9xy45vKF8I2epI9+rhajlUFyVQ1+VgN D0naeDBpubocjr1HASSYpsTWnV56cUbePVUNtbXufb1cqX0bTvuyetd/BQFEpVdBfexJ kIfN32xakzS8dEnKyA1yxsnTe4b1K0Y6m/i4TzdZMd4l+ky9AsETywoTZ10cUX7MrFMl Yoynncmeo4Pec6nqlQzU+oICXUJqIzpJWCHnPnh2TPiOwTABJbdjmNBIH8ppZ6TYn7Y2 hBkw== 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; bh=Px3/GqZZL2PicFO8zhe8KIaUKb6cZmge4JV6ZRXlVXM=; fh=JtBSlIzfZ5Snk+A/Yunvj5NEeryE3Oyw+I6/37iYqDY=; b=THe+tqsdax4PLMmMlXys1mATiWwUS+HOloBrtzG+Oo4ohXbeYTdM2XYvEVUIvMiCxY GjYJvdW85xA/D+Ti0kLkfy8YO5Z/OlnXRwC24/tuYqCggTJOkRKsafPBfNsDiB0lx5SX PkrUf4h5TsP/nHTyJjlSzS0sU1C/qs1wvfaCxerf/kmFEKH/430KCSpBV8lO+TEaOONt v9rSR/G2D3C08e4GYHBMvWqYf5yktpBT37RCxBOgwuGUCAEG6IVpKnBB6iHxj7WovBUR RvFqtmDQcRGx830OPZUVMvGifZi62+i6Px+36K+CfKw+dgYCXuvIQ7PeVNRWLRZIKJbg QIpg== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ee5-20020a0562140a4500b0065af80f546asi901281qvb.2.2023.11.02.23.24.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 23:24:39 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qynb0-00069o-RX; Fri, 03 Nov 2023 02:23:54 -0400 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 1qynau-00068L-Eb for qemu-devel@nongnu.org; Fri, 03 Nov 2023 02:23:48 -0400 Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qynar-0004Bl-2o for qemu-devel@nongnu.org; Fri, 03 Nov 2023 02:23:48 -0400 Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8AxJujpkURl0ag2AA--.48484S3; Fri, 03 Nov 2023 14:23:37 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxH93hkURlQfg4AA--.60029S7; Fri, 03 Nov 2023 14:23:36 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, Richard Henderson Subject: [PULL 05/10] linux-user/loongarch64: Use traps to track LSX/LASX usage Date: Fri, 3 Nov 2023 14:23:27 +0800 Message-Id: <20231103062332.2413724-6-gaosong@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231103062332.2413724-1-gaosong@loongson.cn> References: <20231103062332.2413724-1-gaosong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxH93hkURlQfg4AA--.60029S7 X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Received-SPF: pass client-ip=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 Message-Id: <20231101030816.2353416-2-gaosong@loongson.cn> Signed-off-by: Song Gao --- linux-user/loongarch64/cpu_loop.c | 13 +++++++++++++ target/loongarch/insn_trans/trans_vec.c.inc | 11 ----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/linux-user/loongarch64/cpu_loop.c b/linux-user/loongarch64/cpu_loop.c index 894fdd111a..73d7b6796a 100644 --- a/linux-user/loongarch64/cpu_loop.c +++ b/linux-user/loongarch64/cpu_loop.c @@ -72,6 +72,19 @@ void cpu_loop(CPULoongArchState *env) case EXCCODE_BCE: force_sig_fault(TARGET_SIGSYS, TARGET_SI_KERNEL, env->pc); break; + + /* + * Begin with LSX and LASX disabled, then enable on the first trap. + * In this way we can tell if the unit is in use. This is used to + * choose the layout of any signal frame. + */ + case EXCCODE_SXD: + env->CSR_EUEN |= R_CSR_EUEN_SXE_MASK; + break; + case EXCCODE_ASXD: + env->CSR_EUEN |= R_CSR_EUEN_ASXE_MASK; + break; + case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; diff --git a/target/loongarch/insn_trans/trans_vec.c.inc b/target/loongarch/insn_trans/trans_vec.c.inc index 98f856bb29..92b1d22e28 100644 --- a/target/loongarch/insn_trans/trans_vec.c.inc +++ b/target/loongarch/insn_trans/trans_vec.c.inc @@ -4,8 +4,6 @@ * Copyright (c) 2022-2023 Loongson Technology Corporation Limited */ -#ifndef CONFIG_USER_ONLY - static bool check_vec(DisasContext *ctx, uint32_t oprsz) { if ((oprsz == 16) && ((ctx->base.tb->flags & HW_FLAGS_EUEN_SXE) == 0)) { @@ -21,15 +19,6 @@ static bool check_vec(DisasContext *ctx, uint32_t oprsz) return true; } -#else - -static bool check_vec(DisasContext *ctx, uint32_t oprsz) -{ - return true; -} - -#endif - static bool gen_vvvv_ptr_vl(DisasContext *ctx, arg_vvvv *a, uint32_t oprsz, gen_helper_gvec_4_ptr *fn) {