From patchwork Sun Jan 28 17:50:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 767245 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp559584wro; Sun, 28 Jan 2024 09:55:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoRRMpgtSHpEd3GqpDQAef4iCySwTE9EPIXNLLoA/lCVm94DLZoPhH92fEhShIdTbodqmo X-Received: by 2002:a05:6214:202c:b0:681:8edc:69af with SMTP id 12-20020a056214202c00b006818edc69afmr4626439qvf.65.1706464547115; Sun, 28 Jan 2024 09:55:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706464547; cv=none; d=google.com; s=arc-20160816; b=MoaqZjRvvYwJc+eJkSVmZmLb/PYLRrxZU9olr0ZUjEfryZNXl2QrVA7xaeMGbnK82w NXxSdUBU5lEU2QC/59WiM2XG4kzXjIihwpGizjSx1Bo9SUJ5H2TvVGz7vSvFHvOZrEKK qlK2TMLXoVlk9PSWXKHC06B8hPnYUpWaTDHTF4N0xhECy7RipPdLD/qOfSqIh0m+Oksy h/Krx67E3MQClbxiy7fcQUkN1AiEAplTd/j7VwvbCYjei07vawW8SRFuD89cwwG8oHMy GRrco+KAoG00loCAo8s2JG4DQJ5mSnPDOf8rycYQPZKAfg2lZuLY/IksMjih9ba0vJNy ieNw== 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=an/ghQ/I1RR1mz9Ex+u+dpgwnUINFtp0mGV+acEtGOY=; fh=5+mYOV5+1R3+sD5uEH6Cv4Pbpb7gBGqATVRLHDdux9c=; b=OX+IxByYsE2wgbXmYLnu3cfJ9l7UstpZiCvTA3S5tEdc8cu50FO+Ne64MIAfbts5M5 hldbSHblJ3yY1dS3+f7z/EQKhhgM67/7XQwOAI6eMVQ6NujIcH2Rix9SLffjmGKV7/F8 g7IJXtJZ0Ie9swtze/GmJh+XxwGkTNQhZLfLz9KMFR6SLhLUUFsmluY41J4Df11zVLA/ TZhVsyUyR5LpQ8ysqI5dI0cQ8E6ugbF+wB1Oxfc3NxOQbTv5ono/onZRpn7jMZSN7w2e CYyr05OjyKouBtf1MH2RwEhO156gETovIQCXTHkTRjYcUUBKOuUm3xO5K49W2eLpv2JF Oh5Q== 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 jm6-20020ad45ec6000000b0068c4609942bsi1901347qvb.561.2024.01.28.09.55.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2024 09:55:47 -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; 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 1rU9Jv-0004t4-Np; Sun, 28 Jan 2024 12:51:51 -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 1rU9Ix-0002lf-8c; Sun, 28 Jan 2024 12:50:55 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rU9Iv-0000mX-GL; Sun, 28 Jan 2024 12:50:51 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 2D62848106; Sun, 28 Jan 2024 20:51:29 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id B8A746D522; Sun, 28 Jan 2024 20:50:37 +0300 (MSK) Received: (nullmailer pid 812410 invoked by uid 1000); Sun, 28 Jan 2024 17:50:35 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Michael Tokarev , Thomas Huth Subject: [Stable-8.2.1 57/71] tcg/s390x: Fix encoding of VRIc, VRSa, VRSc insns Date: Sun, 28 Jan 2024 20:50:20 +0300 Message-Id: <20240128175035.812352-3-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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 While the format names the second vector register 'v3', it is still in the second position (bits 12-15) and the argument to RXB must match. Example error: - e7 00 00 10 2a 33 verllf %v16,%v0,16 + e7 00 00 10 2c 33 verllf %v16,%v16,16 Cc: qemu-stable@nongnu.org Reported-by: Michael Tokarev Fixes: 22cb37b4172 ("tcg/s390x: Implement vector shift operations") Fixes: 79cada8693d ("tcg/s390x: Implement tcg_out_dup*_vec") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2054 Reviewed-by: Thomas Huth Tested-by: Michael Tokarev Message-Id: <20240117213646.159697-2-richard.henderson@linaro.org> Signed-off-by: Richard Henderson (cherry picked from commit c1ddc18f37108498f45d57afd6bf33a23b703648) Signed-off-by: Michael Tokarev diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index fbee43d3b0..7f6b84aa2c 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -683,7 +683,7 @@ static void tcg_out_insn_VRIc(TCGContext *s, S390Opcode op, tcg_debug_assert(is_vector_reg(v3)); tcg_out16(s, (op & 0xff00) | ((v1 & 0xf) << 4) | (v3 & 0xf)); tcg_out16(s, i2); - tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, v3, 0) | (m4 << 12)); + tcg_out16(s, (op & 0x00ff) | RXB(v1, v3, 0, 0) | (m4 << 12)); } static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, @@ -738,7 +738,7 @@ static void tcg_out_insn_VRSa(TCGContext *s, S390Opcode op, TCGReg v1, tcg_debug_assert(is_vector_reg(v3)); tcg_out16(s, (op & 0xff00) | ((v1 & 0xf) << 4) | (v3 & 0xf)); tcg_out16(s, b2 << 12 | d2); - tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, v3, 0) | (m4 << 12)); + tcg_out16(s, (op & 0x00ff) | RXB(v1, v3, 0, 0) | (m4 << 12)); } static void tcg_out_insn_VRSb(TCGContext *s, S390Opcode op, TCGReg v1, @@ -762,7 +762,7 @@ static void tcg_out_insn_VRSc(TCGContext *s, S390Opcode op, TCGReg r1, tcg_debug_assert(is_vector_reg(v3)); tcg_out16(s, (op & 0xff00) | (r1 << 4) | (v3 & 0xf)); tcg_out16(s, b2 << 12 | d2); - tcg_out16(s, (op & 0x00ff) | RXB(0, 0, v3, 0) | (m4 << 12)); + tcg_out16(s, (op & 0x00ff) | RXB(0, v3, 0, 0) | (m4 << 12)); } static void tcg_out_insn_VRX(TCGContext *s, S390Opcode op, TCGReg v1, From patchwork Sun Jan 28 17:50:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 767240 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp558876wro; Sun, 28 Jan 2024 09:52:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFPtxKY8qWFnTYCe6SU2t6CK/p52Ns+aoPHVcMB7c6ieERnS+jPQE/so5K0D3EK3FVj7EX X-Received: by 2002:a05:620a:12d1:b0:783:cdc1:9e54 with SMTP id e17-20020a05620a12d100b00783cdc19e54mr3123782qkl.6.1706464366672; Sun, 28 Jan 2024 09:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706464366; cv=none; d=google.com; s=arc-20160816; b=T1KsTOGfnrNlNVuFDUu3g2zQwlDAUbONCMVqFW+OICYY8EcsZHQ3aXWwyXj/OFmg1u 1pdkegezja3tUAUah3Lmykdz2imjrRutonA7u62CWKGxXGfL6xVswTJtJypq4QqLC+kS 38xgGcDCgioynLJhYbchdZarTIZiBOUf8RqGS+mt0QAE0Fwjh+OZ7z1JrWkBvT4VysJC IforVK6ERrzHs1oPB+Sg1csxxewT/1rA6jtOm6wVm0XbYFmHbZJjEjEwvpt3zc58AdXJ YJrQdbHbumCEBfQTAfIpVEyjDkvynr/COa9trLTCfatO4+xFKjAr8hdmFYJWxu7uor4f zGOA== 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=0DECejASNMminUJ/COxBdx86lPnNErqlex8aKAbvEvM=; fh=xKTOpfxQCxorxlvqs779c3/dW1cLbudMtw4cOaOnBdw=; b=KP8ZneDHfnWFfCyG+17dfeinU493fY0p9eWA3tzKCKlf7M2qJdyDtY5dyq+hIzzsp0 SJgFYMzUWecRlstnZh0UuGi52z6qlHLinLlfrA661AAtSZW0RPjSSz8R008wXglb96z+ +rt3HdPGX4V7QZ0fRtEW3EXQpSCzLg65kIJ55Xd/T703TH1dLjcdGGjKS9yQxLacPL/8 9a2mQFxg7/nWJg0q/V643NowQnE45bxKjvXAV2mcaAtyhK8aozxRzUOC3rhjsMz4ZCt8 jxdXH/pz8c4jEGQLVK+zRyggHysL3s88Un5iUoMEAUlz6hEtE8dyJTpWage9SDjswatS PR8g== 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 o10-20020a05622a008a00b00429a5f6c90asi5943514qtw.154.2024.01.28.09.52.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2024 09:52:46 -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; 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 1rU9KB-00068j-LD; Sun, 28 Jan 2024 12:52:07 -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 1rU9J3-0002z9-SC; Sun, 28 Jan 2024 12:51:00 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rU9J2-0000ov-8T; Sun, 28 Jan 2024 12:50:57 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A0D2F4810A; Sun, 28 Jan 2024 20:51:31 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 315C26D526; Sun, 28 Jan 2024 20:50:40 +0300 (MSK) Received: (nullmailer pid 812422 invoked by uid 1000); Sun, 28 Jan 2024 17:50:35 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Vineet Gupta , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Michael Tokarev Subject: [Stable-8.2.1 61/71] linux-user/riscv: Adjust vdso signal frame cfa offsets Date: Sun, 28 Jan 2024 20:50:24 +0300 Message-Id: <20240128175035.812352-7-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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 A typo in sizeof_reg put the registers at the wrong offset. Simplify the expressions to use positive addresses from the start of uc_mcontext instead of negative addresses from the end of uc_mcontext. Reported-by: Vineet Gupta Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson (cherry picked from commit 1b21fe27e75a59bfe2513f5abcc6a18cfc35cfc8) Signed-off-by: Michael Tokarev diff --git a/linux-user/riscv/vdso-32.so b/linux-user/riscv/vdso-32.so index 1ad1e5cbbb..c2ce2a4757 100755 Binary files a/linux-user/riscv/vdso-32.so and b/linux-user/riscv/vdso-32.so differ diff --git a/linux-user/riscv/vdso-64.so b/linux-user/riscv/vdso-64.so index 83992bebe6..ae49f5b043 100755 Binary files a/linux-user/riscv/vdso-64.so and b/linux-user/riscv/vdso-64.so differ diff --git a/linux-user/riscv/vdso.S b/linux-user/riscv/vdso.S index a86d8fc488..c37275233a 100644 --- a/linux-user/riscv/vdso.S +++ b/linux-user/riscv/vdso.S @@ -101,12 +101,12 @@ endf __vdso_flush_icache .cfi_startproc simple .cfi_signal_frame -#define sizeof_reg (__riscv_xlen / 4) +#define sizeof_reg (__riscv_xlen / 8) #define sizeof_freg 8 -#define B_GR (offsetof_uc_mcontext - sizeof_rt_sigframe) -#define B_FR (offsetof_uc_mcontext - sizeof_rt_sigframe + offsetof_freg0) +#define B_GR 0 +#define B_FR offsetof_freg0 - .cfi_def_cfa 2, sizeof_rt_sigframe + .cfi_def_cfa 2, offsetof_uc_mcontext /* Return address */ .cfi_return_column 64 From patchwork Sun Jan 28 17:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 767242 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp559325wro; Sun, 28 Jan 2024 09:54:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrD1rKANnoYGK/anuGhHB0A1L1mlf/OJEnqFTsbsR1qZ03xjVL+oZcTK4aizgawEVvJgw5 X-Received: by 2002:a05:620a:c0b:b0:783:4f59:666f with SMTP id l11-20020a05620a0c0b00b007834f59666fmr3346100qki.14.1706464489683; Sun, 28 Jan 2024 09:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706464489; cv=none; d=google.com; s=arc-20160816; b=GgDhYYLPj1djdq84d2oF/Hur2jJxkztNOvfdn+9DIryfnngHWh0T1C+fEqTGi1ql/I T1OMTls3frwPSDCxjXoykKpBwAvGpimTLOJOlGDM7KWWTpnEQp/iB3BZ5wtySH1A7Oj1 A9+CwprDTScJ9XI3JcUymFMj4kMda0p0XQtkDwVBPZYtMvWR+8Jk2c5GnIAS7jVmHocR YERak87rVLR/+FDSruMcjiTXPRUX/6s+w6rAOXfIw5y6qKmGiJsR0HGaDrEyaJKLo46c ckzVT34rqP4M5CKHLoISrEcMvjojLERNFpXD8/BuZw6gvY6l8LK7jrQR8uHlnzGwt+Nm n+eA== 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=f5cEzJi0TCodXxdxYk1ac8NKV3QE4Se8e6Zk7UhVEQY=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=Rts9YyKYgHCzS7COiepYURW7MRW9BMcgISImelj+/89Vkorm0D6nKLQZElsJMEGWeR 8Tdkr84P+Y4L7ff7K8nRCL5nDPcSB82clW3l+1YQHejXSexDOl5CW+B/5OkkG2RBczNk YPx8uTqBjmnFuzOnaItoVUW954HIm51BV1VU4GzCYsZHk3NqFbujb/DI1vGv9Z1hd2vC 6szFjM7Z5myvQ0v4/y9x2PSA607TQfQJGXObrDYo+gJ1lNjV0TfKS6jHGJxsTOq/JVmL I78aY/HpwVRdzV4QlPhcGb0S//t9i8dhJGA4URyDAucEXngzP+439PLxUg2T9v/ca+q5 Xl/g== 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 e24-20020a05620a209800b0078309bb963asi3596836qka.304.2024.01.28.09.54.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2024 09:54:49 -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; 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 1rU9KQ-0008Lq-SK; Sun, 28 Jan 2024 12:52:23 -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 1rU9K2-0005FL-Gq; Sun, 28 Jan 2024 12:51:58 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rU9Jz-0001Am-S5; Sun, 28 Jan 2024 12:51:58 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D389448113; Sun, 28 Jan 2024 20:51:35 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 81BCD6D52F; Sun, 28 Jan 2024 20:50:44 +0300 (MSK) Received: (nullmailer pid 812449 invoked by uid 1000); Sun, 28 Jan 2024 17:50:35 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.2.1 70/71] target/arm: Fix A64 scalar SQSHRN and SQRSHRN Date: Sun, 28 Jan 2024 20:50:33 +0300 Message-Id: <20240128175035.812352-16-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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: Peter Maydell In commit 1b7bc9b5c8bf374dd we changed handle_vec_simd_sqshrn() so that instead of starting with a 0 value and depositing in each new element from the narrowing operation, it instead started with the raw result of the narrowing operation of the first element. This is fine in the vector case, because the deposit operations for the second and subsequent elements will always overwrite any higher bits that might have been in the first element's result value in tcg_rd. However in the scalar case we only go through this loop once. The effect is that for a signed narrowing operation, if the result is negative then we will now return a value where the bits above the first element are incorrectly 1 (because the narrowfn returns a sign-extended result, not one that is truncated to the element size). Fix this by using an extract operation to get exactly the correct bits of the output of the narrowfn for element 1, instead of a plain move. Cc: qemu-stable@nongnu.org Fixes: 1b7bc9b5c8bf374dd3 ("target/arm: Avoid tcg_const_ptr in handle_vec_simd_sqshrn") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2089 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240123153416.877308-1-peter.maydell@linaro.org (cherry picked from commit 6fffc8378562c7fea6290c430b4f653f830a4c1a) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index a2e49c39f9..f2d05c589c 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8221,7 +8221,7 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, narrowfn(tcg_rd_narrowed, tcg_env, tcg_rd); tcg_gen_extu_i32_i64(tcg_rd, tcg_rd_narrowed); if (i == 0) { - tcg_gen_mov_i64(tcg_final, tcg_rd); + tcg_gen_extract_i64(tcg_final, tcg_rd, 0, esize); } else { tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize); } From patchwork Sun Jan 28 17:50:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 767241 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp559065wro; Sun, 28 Jan 2024 09:53:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEINjEKBcllZEETAf9uXW2S8pz6oVl4JqKeZ/rY4+hg5u0TiaLruA8YuTR0kgxbl86Aklcs X-Received: by 2002:ae9:e20a:0:b0:783:89f1:9c10 with SMTP id c10-20020ae9e20a000000b0078389f19c10mr4093831qkc.82.1706464413930; Sun, 28 Jan 2024 09:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706464413; cv=none; d=google.com; s=arc-20160816; b=HWTjDS45keoXkCweyR0Yo214VFq3tgSHg35ddRnwd/WsRzw10a+qa0oHs+PZOT4Lg9 Zf9PQj6zpRiilvk9Vip7eX+3r9FhpJaXMFMpA/MWC54X7/p/xTsdR18kT7EBRsA425dE tPKfNqCpQXt9yey998ySQis0MqoxiNA+bISVZ6yotIvxse3Ip2668q4JZsmnDWSAonwy lNlRcg0edv8PJqHZ62RUxY3tAA2oRd1QJwX9r2lwmYFsW2bViuj1moh8dS3x5cYN5D/f 5TyRpKvMUO7P0M3TLvBxPqRvFf4/mn7tYChVdyblrs3YdUt3Nv7zJAsaB/rgMpqUFmKA EsuA== 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=poOvik++FXsbb89vccBSsvrZ2nHhvpZ8zCLWhP4YpQw=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=wwXmLfIScyR+5Uv8j82SRaEjUPYxtWfml/MbnyxBQ9g/7JBmnU67gT0J/5dIDZAT0g BYIiPFY4hj+V7w3PG43W+fwDsIr8zUT5fmF47S7ZPKKTHvXNmHduTaynQ1Cop6Uhn8rF cVzFKC9nv9ZGOvRkhKvpw00lwYj2WMo/rdFUP3ykSD+8O3e1knv73kV/3UBVCh4FnqJf 50TQ22Usmp+fknoIHVoOYo8nPBImrIXUoKa7vjMtGN6ytQfebb47wpfmAzuTHmtDUfqw nHjMBJdihJHymhakRms/X3PRoed2GW10ar4bNm4bUqEDZRALIlJP1yhR8z4oHJvBrU2y At+A== 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 o13-20020ae9f50d000000b007833f260edesi5883050qkg.487.2024.01.28.09.53.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2024 09:53:33 -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; 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 1rU9KK-0007VQ-9V; Sun, 28 Jan 2024 12:52:16 -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 1rU9K5-0005d9-SY; Sun, 28 Jan 2024 12:52:01 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rU9K3-0001BP-SX; Sun, 28 Jan 2024 12:52:01 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 4D50248114; Sun, 28 Jan 2024 20:51:36 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 012476D530; Sun, 28 Jan 2024 20:50:44 +0300 (MSK) Received: (nullmailer pid 812452 invoked by uid 1000); Sun, 28 Jan 2024 17:50:35 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.2.1 71/71] target/arm: Fix incorrect aa64_tidcp1 feature check Date: Sun, 28 Jan 2024 20:50:34 +0300 Message-Id: <20240128175035.812352-17-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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: Peter Maydell A typo in the implementation of isar_feature_aa64_tidcp1() means we were checking the field in the wrong ID register, so we might have provided the feature on CPUs that don't have it and not provided it on CPUs that should have it. Correct this bug. Cc: qemu-stable@nongnu.org Fixes: 9cd0c0dec97be9 "target/arm: Implement FEAT_TIDCP1" Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2120 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240123160333.958841-1-peter.maydell@linaro.org (cherry picked from commit ee0a2e3c9d2991a11c13ffadb15e4d0add43c257) Signed-off-by: Michael Tokarev diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index 954d358268..165a497f7b 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -771,7 +771,7 @@ static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id) static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) { - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, TIDCP1) != 0; } static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id)