From patchwork Thu Nov 9 13:42:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742570 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp844990wrw; Thu, 9 Nov 2023 05:47:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQANVk6YrkdI5qOtqdMb9PfoARtnxKU2Eyu4mv5XvRzrZDNHXZjtx5hMi9DchycbVa+ih7 X-Received: by 2002:ac8:598d:0:b0:418:cd5:ac97 with SMTP id e13-20020ac8598d000000b004180cd5ac97mr5442048qte.65.1699537666985; Thu, 09 Nov 2023 05:47:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699537666; cv=none; d=google.com; s=arc-20160816; b=IPDZc1GMOcCpS2zkgx6sEfluCuzeUKwHQHHXUDQX3gef+oiXGZXZm1+3NTqzlVKR/m mIdmqRZObxEltqShJWQTcnztWqLyj7kTvW+U371sJF4rL0UOW51Y56n5UN3K2rLAAaOK FLD4EolQOyhv7GOyeScQcMqSoJ9iCkxG744GTKbS062PvoIqBlwBUUzeV1jakMVubbbo AqMt+ST7Ur7dqysuC9vElBYC3Uh8S2SiIO2ag7dh09IXwETIO5rP3GQBnHOJDUZq50Ar 9OF98NcQ6lj7nNjJZMHDHjxfstAgYDkgw9Xf6I/pyHfXcLTZurOJk2AvLRFOntWrIjMH 8H6w== 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=DQ6j0RuA60GMp0cUunO3KaGY1tPI0zaG4mxxMFqQMJw=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=qPFXLAaaoEheZzTjB0virWW7xeF8p/8NqBL4ZARi/OEi47rM6zXGb3x5zoivBHy5hT H70mHgRJzsw5YtOa8duhdUVXFJFuEQWtdwgcIdNbJU0f3ylHe0jvLdAkZI2IQLIE6nL6 CTDCu709+IuVlmvsAuxVloG6wkXTLXMC6CKrAzT8KZAG4fbHS3l12EWHprgIjNffKs2R rkWBk6+5pg7KgaLR65U9cYFmepqfOaHgeAE/9j1g79cqf6eeHzrPiK2fCOngCCfxGiBQ Cg2rigXSGtZkRdcMFKhUsrGB57dWh2Naicv1UK1uEYBsj43QfbwxynEoF+8Yd12VuGPy fSkg== 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 h19-20020a05622a171300b0041cb5262974si2786782qtk.483.2023.11.09.05.47.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:47: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 1r15Kh-0000dZ-Ce; Thu, 09 Nov 2023 08:44:31 -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 1r15KX-0008Hy-CM; Thu, 09 Nov 2023 08:44:21 -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 1r15KV-0001Ar-Ba; Thu, 09 Nov 2023 08:44:21 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A3F2B31B02; Thu, 9 Nov 2023 16:43:11 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id B28CC344A9; Thu, 9 Nov 2023 16:43:03 +0300 (MSK) Received: (nullmailer pid 1461794 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.1.3 11/55] linux-user: Fixes for zero_bss Date: Thu, 9 Nov 2023 16:42:15 +0300 Message-Id: <20231109134300.1461632-11-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 The previous change, 2d385be6152, assumed !PAGE_VALID meant that the page would be unmapped by the elf image. However, since we reserved the entire image space via mmap, PAGE_VALID will always be set. Instead, assume PROT_NONE for the same condition. Furthermore, assume bss is only ever present for writable segments, and that there is no page overlap between PT_LOAD segments. Instead of an assert, return false to indicate failure. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1854 Fixes: 2d385be6152 ("linux-user: Do not adjust zero_bss for host page size") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit e6e66b03287331abc6f184456dbc6d25505590ec) Signed-off-by: Michael Tokarev diff --git a/linux-user/elfload.c b/linux-user/elfload.c index a69e7d7eab..47170fe5d3 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2217,31 +2217,58 @@ static abi_ulong setup_arg_pages(struct linux_binprm *bprm, * Map and zero the bss. We need to explicitly zero any fractional pages * after the data section (i.e. bss). Return false on mapping failure. */ -static bool zero_bss(abi_ulong start_bss, abi_ulong end_bss, int prot) +static bool zero_bss(abi_ulong start_bss, abi_ulong end_bss, + int prot, Error **errp) { abi_ulong align_bss; + /* We only expect writable bss; the code segment shouldn't need this. */ + if (!(prot & PROT_WRITE)) { + error_setg(errp, "PT_LOAD with non-writable bss"); + return false; + } + align_bss = TARGET_PAGE_ALIGN(start_bss); end_bss = TARGET_PAGE_ALIGN(end_bss); if (start_bss < align_bss) { int flags = page_get_flags(start_bss); - if (!(flags & PAGE_VALID)) { - /* Map the start of the bss. */ + if (!(flags & PAGE_BITS)) { + /* + * The whole address space of the executable was reserved + * at the start, therefore all pages will be VALID. + * But assuming there are no PROT_NONE PT_LOAD segments, + * a PROT_NONE page means no data all bss, and we can + * simply extend the new anon mapping back to the start + * of the page of bss. + */ align_bss -= TARGET_PAGE_SIZE; - } else if (flags & PAGE_WRITE) { - /* The page is already mapped writable. */ - memset(g2h_untagged(start_bss), 0, align_bss - start_bss); } else { - /* Read-only zeros? */ - g_assert_not_reached(); + /* + * The start of the bss shares a page with something. + * The only thing that we expect is the data section, + * which would already be marked writable. + * Overlapping the RX code segment seems malformed. + */ + if (!(flags & PAGE_WRITE)) { + error_setg(errp, "PT_LOAD with bss overlapping " + "non-writable page"); + return false; + } + + /* The page is already mapped and writable. */ + memset(g2h_untagged(start_bss), 0, align_bss - start_bss); } } - return align_bss >= end_bss || - target_mmap(align_bss, end_bss - align_bss, prot, - MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0) != -1; + if (align_bss < end_bss && + target_mmap(align_bss, end_bss - align_bss, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0) == -1) { + error_setg_errno(errp, errno, "Error mapping bss"); + return false; + } + return true; } #if defined(TARGET_ARM) @@ -3265,8 +3292,8 @@ static void load_elf_image(const char *image_name, int image_fd, /* If the load segment requests extra zeros (e.g. bss), map it. */ if (vaddr_ef < vaddr_em && - !zero_bss(vaddr_ef, vaddr_em, elf_prot)) { - goto exit_mmap; + !zero_bss(vaddr_ef, vaddr_em, elf_prot, &err)) { + goto exit_errmsg; } /* Find the full program boundaries. */ From patchwork Thu Nov 9 13:42:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742574 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp846809wrw; Thu, 9 Nov 2023 05:52:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbD6S1Zp/oex7GFCQEf+rynWdsVTNwnIpzrowNnGRpolTbZ3JcAZQoWQFBABOvLo2JWpS/ X-Received: by 2002:ad4:4ea1:0:b0:671:6003:73b1 with SMTP id ed1-20020ad44ea1000000b00671600373b1mr5375942qvb.60.1699537920986; Thu, 09 Nov 2023 05:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699537920; cv=none; d=google.com; s=arc-20160816; b=mC2cXF3ltYO1w5zZvh47e92pucoyqhHh1aC91G9xGAy1ngjCeX9wKeIaCnK4Gsp4Vh SC3t3IRaZxezdAGavN10+Tb5ek5pAUFOWMrnb4VhFIPesVvsnre+1aJH5wFkbfFYud77 0COKNw9+oZ44wH6jluB3eKbfvpvl/BzCCJbSi00Xa6sh3mUQa8Agygpyik7RQEaITFdE znJDdrNgfnre4qaE4/v7W9U2j99YnZ1iH149Va+2a8naiPX3WX10oaDN3uXKzCIy66AD ktPZt+YpoG1j4HK3jBr4vMJqMttBiJ0K7/2ujRM0Tlw+AwnDfgABoyahMjv32Sg5zDXN NzVA== 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=wR4jZ65b+Xt1pN/LFa4Rm+DbYzHu/ROF9ij88MQbxv8=; fh=jNjahvLDFDChdETa+zrIo/WbVWEt3Ji9EhcELd73wAE=; b=0P13X5w65TT5UCtXg3pAgqUQ/+dIU/LBF2u64xaRfHMXLifdewEo1+Nc+pfY8uwCwD TVhZIjOd9vjSuiEl1BcIRPJZTz9fwM7pxHRpo159AQ9Hu9UnUUAf9R7JeYvnN3juGR0i LsVI10uB9eVpYo+zdcr8btM3JUAoDGvBZqM4Eyp+FyBqHGZNDLAKhSeHjVcoU/Hni+vQ dUGAduKtIpXAZQgFkPSQxdLg3KyqE55gKujEBTDLej15xehNVP9OMqtG3L7qj1EzytsY wga/g6J95GUNCPJNMairS3YeVRAm96ihNVV/JBGGjVvYob7lTJTs99tOEqThlJnaJdfE lMAg== 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 p6-20020ad45f46000000b0066ac82c4487si3122854qvg.365.2023.11.09.05.52.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:52:00 -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 1r15LT-00033d-Ch; Thu, 09 Nov 2023 08:45:19 -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 1r15L6-0002Xh-9t; Thu, 09 Nov 2023 08:44:59 -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 1r15L2-0001Hj-4j; Thu, 09 Nov 2023 08:44:55 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 4A92431B08; Thu, 9 Nov 2023 16:43:12 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 5C640344AF; Thu, 9 Nov 2023 16:43:04 +0300 (MSK) Received: (nullmailer pid 1461812 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Michael Tokarev Subject: [Stable-8.1.3 17/55] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port() Date: Thu, 9 Nov 2023 16:42:21 +0300 Message-Id: <20231109134300.1461632-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 In query_port() we pass the address of a local pvrdma_port_attr struct to the rdma_query_backend_port() function. Unfortunately, rdma_backend_query_port() wants a pointer to a struct ibv_port_attr, and the two are not the same length. Coverity spotted this (CID 1507146): pvrdma_port_attr is 48 bytes long, and ibv_port_attr is 52 bytes, because it has a few extra fields at the end. Fortunately, all we do with the attrs struct after the call is to read a few specific fields out of it which are all at the same offsets in both structs, so we can simply make the local variable the correct type. This also lets us drop the cast (which should have been a bit of a warning flag that we were doing something wrong here). We do however need to add extra casts for the fields of the struct that are enums: clang will complain about the implicit cast to a different enum type otherwise. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev (cherry picked from commit 4ab9a7429bf7507fba4b96b97d4147628c91ba14) diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index c6ed025982..d385d18d9c 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -129,23 +129,27 @@ static int query_port(PVRDMADev *dev, union pvrdma_cmd_req *req, { struct pvrdma_cmd_query_port *cmd = &req->query_port; struct pvrdma_cmd_query_port_resp *resp = &rsp->query_port_resp; - struct pvrdma_port_attr attrs = {}; + struct ibv_port_attr attrs = {}; if (cmd->port_num > MAX_PORTS) { return -EINVAL; } - if (rdma_backend_query_port(&dev->backend_dev, - (struct ibv_port_attr *)&attrs)) { + if (rdma_backend_query_port(&dev->backend_dev, &attrs)) { return -ENOMEM; } memset(resp, 0, sizeof(*resp)); - resp->attrs.state = dev->func0->device_active ? attrs.state : - PVRDMA_PORT_DOWN; - resp->attrs.max_mtu = attrs.max_mtu; - resp->attrs.active_mtu = attrs.active_mtu; + /* + * The state, max_mtu and active_mtu fields are enums; the values + * for pvrdma_port_state and pvrdma_mtu match those for + * ibv_port_state and ibv_mtu, so we can cast them safely. + */ + resp->attrs.state = dev->func0->device_active ? + (enum pvrdma_port_state)attrs.state : PVRDMA_PORT_DOWN; + resp->attrs.max_mtu = (enum pvrdma_mtu)attrs.max_mtu; + resp->attrs.active_mtu = (enum pvrdma_mtu)attrs.active_mtu; resp->attrs.phys_state = attrs.phys_state; resp->attrs.gid_tbl_len = MIN(MAX_PORT_GIDS, attrs.gid_tbl_len); resp->attrs.max_msg_sz = 1024; From patchwork Thu Nov 9 13:42:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742569 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp844229wrw; Thu, 9 Nov 2023 05:46:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6R0DXwg+ycReQp4IPFRv2sO74P3S6+qJD6BOytGruq9rjTifol9REU8IiCd0ObPlGyVtL X-Received: by 2002:a05:620a:240a:b0:76f:1eac:e726 with SMTP id d10-20020a05620a240a00b0076f1eace726mr5273959qkn.15.1699537575834; Thu, 09 Nov 2023 05:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699537575; cv=none; d=google.com; s=arc-20160816; b=qmKElNoQe4wyadPImOt8o99W7MlPOULdYIPbZ6fCL3SaHeVcsmMd6YK4FWhdlqMPFC ClYZ00SVIfrKOcTlJ/mslOgYeQ0D5SL74gFowV8oeFD/o5+9xUj7djMn3LN32lHIuj6v mSwrO7ZP54xa8Jxfl9KJYdGMJI/nhru1EE0RiSSUG/sI0xc/lAMiE6Ipz50qMFuf3cWW oSe15uishsQblSayC1vRtog7GrTjyKGee1fF1ZaXI7eBmmr9T+Tk4FBPq7aJJTfdgUdi L6NrI38rcI9qp3JKPzcCZQyQqOn7f0z8QRlept2dJHYtZjaZENc/2RVL5nhIkja/Hd0v GmoA== 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=GpHfy5JuyZHC5XWIVJ/F4YLlC/gayqYlZN1I5ydAmmM=; fh=Hz+vO67F8PFDrY9UzplP5vp0zJFRafxlSjmXbk0LEmc=; b=ndFfy7BgAaYaMgFXZ9cJM/TFMdJIPLrANiKVG5Vlbiy7TyIljSc2X1SgFuTGWLINfe cdpTr8JRM0vlL7da2WC+x6wuD7DTcmesMiSj6C1N34TFpK0hHLVyix7Y/cvgp1GjLvRR O68tYPFfzNcd7PRdNR4wJWdXRep2g0eHHpOu4eIJ7flb55TCh4weWK8xUhH4vdKuVDg6 8wfxSr9cBT6H2cXQDMcW62erQBSoN4KuJRfSAO4jb9mRsoMXvwxiosKUejhp69Jtx2Rg bS1GKu2ZMexPzXzChHi9S1AyjQ2XdndXKLigxni5ung8ZAYTGA9ZV4SY1MsWwUegOWb3 4tCw== 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 g3-20020a05620a108300b0076dcf1b910bsi2808146qkk.748.2023.11.09.05.46.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:46:15 -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 1r15LP-0002hb-Kg; Thu, 09 Nov 2023 08:45: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 1r15L5-0002Xa-QR; Thu, 09 Nov 2023 08:44:59 -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 1r15L4-0001I6-1j; Thu, 09 Nov 2023 08:44:55 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 5C55531B09; Thu, 9 Nov 2023 16:43:12 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 6C955344B0; Thu, 9 Nov 2023 16:43:04 +0300 (MSK) Received: (nullmailer pid 1461815 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Mark Cave-Ayland , Michael Tokarev Subject: [Stable-8.1.3 18/55] target/sparc: Clear may_lookup for npc == DYNAMIC_PC Date: Thu, 9 Nov 2023 16:42:22 +0300 Message-Id: <20231109134300.1461632-18-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 With pairs of jmp+rett, pc == DYNAMIC_PC_LOOKUP and npc == DYNAMIC_PC. Make sure that we exit for interrupts. Cc: qemu-stable@nongnu.org Fixes: 633c42834c7 ("target/sparc: Introduce DYNAMIC_PC_LOOKUP") Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson (cherry picked from commit 930f1865cc654b637ffe1207fa5b44bf0a156279) Signed-off-by: Michael Tokarev diff --git a/target/sparc/translate.c b/target/sparc/translate.c index bd877a5e4a..9074a90818 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5664,10 +5664,10 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) break; } + may_lookup = true; if (dc->pc & 3) { switch (dc->pc) { case DYNAMIC_PC_LOOKUP: - may_lookup = true; break; case DYNAMIC_PC: may_lookup = false; @@ -5677,10 +5677,24 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } else { tcg_gen_movi_tl(cpu_pc, dc->pc); - may_lookup = true; } - save_npc(dc); + if (dc->npc & 3) { + switch (dc->npc) { + case JUMP_PC: + gen_generic_branch(dc); + break; + case DYNAMIC_PC: + may_lookup = false; + break; + case DYNAMIC_PC_LOOKUP: + break; + default: + g_assert_not_reached(); + } + } else { + tcg_gen_movi_tl(cpu_npc, dc->npc); + } if (may_lookup) { tcg_gen_lookup_and_goto_ptr(); } else { From patchwork Thu Nov 9 13:42:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742577 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp847590wrw; Thu, 9 Nov 2023 05:53:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRjgyb117Yy+4zhfIg7Mqo34KuSC7uO/0lIsb5faxeWAYI4sVNYqp0MOrMB24FTpWe/M7y X-Received: by 2002:ad4:5cad:0:b0:66d:169a:d41c with SMTP id q13-20020ad45cad000000b0066d169ad41cmr4970584qvh.19.1699538039362; Thu, 09 Nov 2023 05:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699538039; cv=none; d=google.com; s=arc-20160816; b=hSvY8D9lEqeCpjF4t897P7d3EU5Kx52sMXYpTepBEtg976i7atQ+V9ZOo5GaqYKK9e 5eMP7WMrSk4Bdl4eeLBwKpK46954+ME6SSDECL/6tcs/yZFEsdqfhbw6H/z0VQcj4giL g9H8+p6ijbViyT3oBBNC/TVBRz0hVcDHCmR6VvJB/1OKrAQP0xh8OJJDIX/NHgqibwAW e8gps9d5FTRZzM7e0Rrwvw8YWk4BIl5qwxvE9vCrXmCgyAaLBohgueEbg59UiYcHupEO i7jdf/stZFCkxAjsQB0iP9jzvdv9+zR+ZYpmsQlyatJgtduhsXhveLPwfsYs7Qgi10Gi y7FQ== 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=HFfLcRtRh2K4TU3fjm1oXrZJuo0We/2XVBteRvIwzEI=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=j4RJXiOScduin1bWOIHcB1ia/5uA6x1IagWXzobAhaNuX+T1x69mfDbttTmfZ48ake l1lCJaRtkJR+ADJOhWEbVwio9xpJ64VZOabHBJSvQm+UEHSnM8UhkK7N40wHPwlQfDbU d/M/cAC8DlpsJMvKLwl9JyqiVHnoKXWattelxSQCelb+bFV/yf7ngs8iDZ1K+0uZ4ca0 wq6sXsY5l17o2TwbzBd/JlbMM7Z7+nad1BF9aDlfx10PkZ/w0VuAmCFUIo+UqFH8SdD9 xas5DFnh9TnJPxuNJF3kSN36W1fw5w0kOKudHZKMmQh3Ui/JSxlvP0CwooVqitRj3NDQ qvWw== 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 dn1-20020a056214094100b0066cf666c6fbsi2773070qvb.313.2023.11.09.05.53.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:53:59 -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 1r15LQ-0002nH-DG; Thu, 09 Nov 2023 08:45: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 1r15LA-0002au-Us; Thu, 09 Nov 2023 08:45:02 -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 1r15L7-0001MR-8I; Thu, 09 Nov 2023 08:44:59 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 6E34031B0A; Thu, 9 Nov 2023 16:43:12 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 7DC0C344B1; Thu, 9 Nov 2023 16:43:04 +0300 (MSK) Received: (nullmailer pid 1461818 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.1.3 19/55] target/arm: Fix syndrome for FGT traps on ERET Date: Thu, 9 Nov 2023 16:42:23 +0300 Message-Id: <20231109134300.1461632-19-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 442c9d682c94fc2 when we converted the ERET, ERETAA, ERETAB instructions to decodetree, the conversion accidentally lost the correct setting of the syndrome register when taking a trap because of the FEAT_FGT HFGITR_EL1.ERET bit. Instead of reporting a correct full syndrome value with the EC and IL bits, we only reported the low two bits of the syndrome, because the call to syn_erettrap() got dropped. Fix the syndrome values for these traps by reinstating the syn_erettrap() calls. Fixes: 442c9d682c94fc2 ("target/arm: Convert ERET, ERETAA, ERETAB to decodetree") Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20231024172438.2990945-1-peter.maydell@linaro.org (cherry picked from commit 307521d6e29e559c89afa9dbd337ae75fe3c436d) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 5fa1257d32..58787ee8a7 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1627,7 +1627,7 @@ static bool trans_ERET(DisasContext *s, arg_ERET *a) return false; } if (s->fgt_eret) { - gen_exception_insn_el(s, 0, EXCP_UDEF, 0, 2); + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(0), 2); return true; } dst = tcg_temp_new_i64(); @@ -1654,7 +1654,7 @@ static bool trans_ERETA(DisasContext *s, arg_reta *a) } /* The FGT trap takes precedence over an auth trap. */ if (s->fgt_eret) { - gen_exception_insn_el(s, 0, EXCP_UDEF, a->m ? 3 : 2, 2); + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(a->m ? 3 : 2), 2); return true; } dst = tcg_temp_new_i64(); From patchwork Thu Nov 9 13:42:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742571 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp845328wrw; Thu, 9 Nov 2023 05:48:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgLFvClWGEizdvaiDy960Y0dpGZlHEg0rf/Z9NnF66EpGt+HkwzI8k+a9tsvWwOQpLlHFH X-Received: by 2002:ac8:7d86:0:b0:419:4c70:c54e with SMTP id c6-20020ac87d86000000b004194c70c54emr4120785qtd.52.1699537713166; Thu, 09 Nov 2023 05:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699537713; cv=none; d=google.com; s=arc-20160816; b=IURAPNpEbA20R66ZveupQrS0A5C4UuAOY2g27640oTBRM+0tpEjTd9LVnfGneoVIcv xvJOtwHLQ87pto0q89fFtFvFMLjNH1cXN1WBy6gkUxpbn7tP7DlghrFv5e+0m/ZCikWo tb4f1NuO0x0T8qkeOkysSILSSp/7H9G9/wpmd8TruZQjP7q3vEJqZoTlwb04hqBb3EFd 2T38udJTuSEpS9XqQJokGRkk9t5w/XWEWtNr9Nw5BDO48ScKclB0zDpthEkRkkHruEi/ RUSp1zIDrnlvhSNaRqTKDiIvi3eRaKjYIB3t1bVEv659bT578TSOenYNQ8UbTvTcake+ 6bsw== 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=PIAjhKVPypLaMwaijw/BpHhj/W3kfFRxPn6XV3SklU8=; fh=LpRsuFZ4Xrkq7gy4UTty7NeerQeaiM6FkYWG44Rdy8M=; b=AJmb4h06xZ9YXsx9O3FFuAxYfdVNQRO9EGP5Pxmtyi4g2owIJCxMsT1YOtzcH+/oXZ pwSV+BAaaZGcZm12eyVFUa1JFdI1DZTGgIrfomP/YhlWWX6Q2QlRxix5WPuLrwTFgM4D Y+LLRE2ayxDvHRSgVk8PoOyu6ERXkLaABzDpvyAr7ycTy74dXhE2JTRCZa6iTcg9Uyvq 4DNI3cuGIxYgDMuCUNv9SQXbGOgc+BFox91FrXzQsmFTWZSwi21QtfFgVhTlLFmnwM+7 3MG6beAfa12sCUVq1I/MSIXyakwA0SAbtsNBj3dIkOhrnPMvyMbWIgoR4f4FyezNLQIa KpDg== 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 f18-20020ac85d12000000b0041cb522af7asi3027599qtx.199.2023.11.09.05.48.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:48: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 1r15Lp-0004qt-Ey; Thu, 09 Nov 2023 08:45:41 -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 1r15Lg-0003si-Lg; Thu, 09 Nov 2023 08:45:32 -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 1r15Le-0001fN-G9; Thu, 09 Nov 2023 08:45:32 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 25EAA31B11; Thu, 9 Nov 2023 16:43:13 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 270DB344B7; Thu, 9 Nov 2023 16:43:05 +0300 (MSK) Received: (nullmailer pid 1461836 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Michael Tokarev , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [Stable-8.1.3 25/55] target/arm: Fix SVE STR increment Date: Thu, 9 Nov 2023 16:42:29 +0300 Message-Id: <20231109134300.1461632-25-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 The previous change missed updating one of the increments and one of the MemOps. Add a test case for all vector lengths. Cc: qemu-stable@nongnu.org Fixes: e6dd5e782be ("target/arm: Use tcg_gen_qemu_{ld, st}_i128 in gen_sve_{ld, st}r") Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231031143215.29764-1-richard.henderson@linaro.org [PMM: fixed checkpatch nit] Signed-off-by: Peter Maydell (cherry picked from commit b11293c212c2927fcea1befc50dabec9baba4fcc) Signed-off-by: Michael Tokarev (Mjt: context fix in tests/tcg/aarch64/Makefile.target) Tested-by: Alex Bennée diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 2ba5efadfd..90865d8696 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4294,7 +4294,7 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64(); t16 = tcg_temp_new_i128(); - for (i = 0; i < len_align; i += 8) { + for (i = 0; i < len_align; i += 16) { tcg_gen_ld_i64(t0, base, vofs + i); tcg_gen_ld_i64(t1, base, vofs + i + 8); tcg_gen_concat_i64_i128(t16, t0, t1); @@ -4320,7 +4320,8 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, t16 = tcg_temp_new_i128(); tcg_gen_concat_i64_i128(t16, t0, t1); - tcg_gen_qemu_st_i128(t16, clean_addr, midx, MO_LEUQ); + tcg_gen_qemu_st_i128(t16, clean_addr, midx, + MO_LE | MO_128 | MO_ATOM_NONE); tcg_gen_addi_i64(clean_addr, clean_addr, 16); tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 49e1ffea93..6c2a6d6206 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -100,7 +100,11 @@ sha512-sve: CFLAGS=-O3 -march=armv8.1-a+sve sha512-sve: sha512.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -TESTS += sha512-sve +sve-str: CFLAGS=-O1 -march=armv8.1-a+sve +sve-str: sve-str.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +TESTS += sha512-sve sve-str endif ifeq ($(HOST_GDB_SUPPORTS_ARCH),y) diff --git a/tests/tcg/aarch64/sve-str.c b/tests/tcg/aarch64/sve-str.c new file mode 100644 index 0000000000..ae271c9d87 --- /dev/null +++ b/tests/tcg/aarch64/sve-str.c @@ -0,0 +1,49 @@ +#include +#include + +#define N (256 + 16) + +static int __attribute__((noinline)) test(int vl) +{ + unsigned char buf[N]; + int err = 0; + + for (int i = 0; i < N; ++i) { + buf[i] = (unsigned char)i; + } + + asm volatile ( + "mov z0.b, #255\n\t" + "str z0, %0" + : : "m" (buf) : "z0", "memory"); + + for (int i = 0; i < vl; ++i) { + if (buf[i] != 0xff) { + fprintf(stderr, "vl %d, index %d, expected 255, got %d\n", + vl, i, buf[i]); + err = 1; + } + } + + for (int i = vl; i < N; ++i) { + if (buf[i] != (unsigned char)i) { + fprintf(stderr, "vl %d, index %d, expected %d, got %d\n", + vl, i, (unsigned char)i, buf[i]); + err = 1; + } + } + + return err; +} + +int main() +{ + int err = 0; + + for (int i = 16; i <= 256; i += 16) { + if (prctl(PR_SVE_SET_VL, i, 0, 0, 0, 0) == i) { + err |= test(i); + } + } + return err; +} From patchwork Thu Nov 9 13:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742576 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp847541wrw; Thu, 9 Nov 2023 05:53:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGYFqdhkNDciuNjvsVUmLeF3a+NfXcaG0Sa+R3gXPyvUrJfQtYg0IuxF83v6xuwU8utkYg X-Received: by 2002:ac8:5945:0:b0:41b:7759:124a with SMTP id 5-20020ac85945000000b0041b7759124amr6135378qtz.12.1699538031862; Thu, 09 Nov 2023 05:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699538031; cv=none; d=google.com; s=arc-20160816; b=meMq2UU+o9yliWQbMsmw45T/3W583cZi40EgV1nCgM9XSDFfvMLGLYaknxVF8QM5kC QZM+S+Odzoo+XlLF96znXoCido8u3qfzhFww8P3v6+Uhl4aMVEYp9QQSielCf/Zjrky6 WZT71lQF7f4TaSDgapbMWv1WX9opfrb1t19qgokZfMTLwjZTaaVV+u5CEYcMxusRnTYX pHp1egrM42b2d6J2nVr0ckOmC4rRKy6c/5tjmwA1qSWDJF4RXicakpgZP8D+O3XZddU7 foiyIsjIHN1IwdUo8+LsN3ba0wkqeONtbpfI+LYrJqoY08dJmK1WaJsFu7Y6LyUcO04c Th4Q== 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=0/E0+NghdH5ccLdk7MH7Y5ghMwaBhfZ8bZ2XOjcfX94=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=ed7zIWbvP1MMuY112KPSPHnq/ZgX1SzPBnKIDbho4q8O+qMTkdL6xSlhpGoUxqqhg7 Pq2a8NXJTfBzPO3XH5SW/rWkBVNYzKXDfSPj4lefGH+u9L+lUTSTHy6kSmTjXxhzMVN7 LMy6HDKIIxN2hHyAkFsHaFP2A9JX9K61Oj7O2/mIHy0Mhz8/fc5qQVuyLv7fAR3DSsY5 Gfl/hoqF/ei7sk+oeLXwfrbztiMFzwcE5HvAoLyTk3NcOOirMyYCQNSlLEpgNalCAIJY 37dQZWhwJurnSoKAM2NMK3ufGJFGzGxQPEIiVSE7lV5exzX9qWc75CP2frH+d/RKtuT+ n7Hg== 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 f21-20020a05622a105500b00418113fb90asi2940341qte.425.2023.11.09.05.53.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:53:51 -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 1r15M7-0006DC-E0; Thu, 09 Nov 2023 08:45:59 -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 1r15M2-00063b-2p; Thu, 09 Nov 2023 08:45:54 -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 1r15Lz-0001fa-7p; Thu, 09 Nov 2023 08:45:53 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3746231B12; Thu, 9 Nov 2023 16:43:13 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 4763D344B8; Thu, 9 Nov 2023 16:43:05 +0300 (MSK) Received: (nullmailer pid 1461839 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.1.3 26/55] target/arm: Correctly propagate stage 1 BTI guarded bit in a two-stage walk Date: Thu, 9 Nov 2023 16:42:30 +0300 Message-Id: <20231109134300.1461632-26-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 a two-stage translation, the result of the BTI guarded bit should be the guarded bit from the first stage of translation, as there is no BTI guard information in stage two. Our code tried to do this, but got it wrong, because we currently have two fields where the GP bit information might live (ARMCacheAttrs::guarded and CPUTLBEntryFull::extra::arm::guarded), and we were storing the GP bit in the latter during the stage 1 walk but trying to copy the former in combine_cacheattrs(). Remove the duplicated storage, and always use the field in CPUTLBEntryFull; correctly propagate the stage 1 value to the output in get_phys_addr_twostage(). Note for stable backports: in v8.0 and earlier the field is named result->f.guarded, not result->f.extra.arm.guarded. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1950 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20231031173723.26582-1-peter.maydell@linaro.org (cherry picked from commit 4c09abeae8704970ff03bf2196973f6bf08ab6f9) Signed-off-by: Michael Tokarev (Mjt: replace f.extra.arm.guarded -> f.guarded due to v8.1.0-1179-ga81fef4b64) diff --git a/target/arm/internals.h b/target/arm/internals.h index 0f01bc32a8..784f1e0fab 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1180,7 +1180,6 @@ typedef struct ARMCacheAttrs { unsigned int attrs:8; unsigned int shareability:2; /* as in the SH field of the VMSAv8-64 PTEs */ bool is_s2_format:1; - bool guarded:1; /* guarded bit of the v8-64 PTE */ } ARMCacheAttrs; /* Fields that are valid upon success. */ diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 8f94100c61..3195d5d401 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2979,7 +2979,6 @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr, assert(!s1.is_s2_format); ret.is_s2_format = false; - ret.guarded = s1.guarded; if (s1.attrs == 0xf0) { tagged = true; @@ -3119,7 +3118,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, int s1_prot, s1_lgpgsz; bool is_secure = ptw->in_secure; ARMSecuritySpace in_space = ptw->in_space; - bool ret, ipa_secure; + bool ret, ipa_secure, s1_guarded; ARMCacheAttrs cacheattrs1; ARMSecuritySpace ipa_space; uint64_t hcr; @@ -3147,6 +3146,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, */ s1_prot = result->f.prot; s1_lgpgsz = result->f.lg_page_size; + s1_guarded = result->f.guarded; cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); @@ -3197,6 +3197,9 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, result->cacheattrs = combine_cacheattrs(hcr, cacheattrs1, result->cacheattrs); + /* No BTI GP information in stage 2, we just use the S1 value */ + result->f.guarded = s1_guarded; + /* * Check if IPA translates to secure or non-secure PA space. * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA. From patchwork Thu Nov 9 13:42:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742572 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp845548wrw; Thu, 9 Nov 2023 05:49:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzSDAxln7aSjd4x+YpGpMIfWsZkQHR+k4ZmOh8lwufAlDqcj9f5QdO/Rn2ypb9pjEtDTY9 X-Received: by 2002:a05:622a:130c:b0:419:5b97:2fbb with SMTP id v12-20020a05622a130c00b004195b972fbbmr5351712qtk.34.1699537747006; Thu, 09 Nov 2023 05:49:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699537746; cv=none; d=google.com; s=arc-20160816; b=BhvwO+Tol9d8v8YGGDW9JwqphkMuTxWMo+ADqyumk/TmqGFD44vaEgsot4el1LeyEX ugf86t+NTX6RkNIW4zoAz/95UOayO7zeXJcQF8wo5Ksjw2aEdzJGJ5/BSn44vWxeR2dk Q+wvKaHUmqeZhbj3lFbAEP5rXyleaX4ENhEd2Gssa5Bh+Qb4phKWxobPG641D6PxFx11 S27sNHBuem44f59nyfnSlhP+cTv79tURvFMrjPbCdEYhjl/jndU2gA1OfHeOorb9/U5F 4h35NfE9k7/pEEsXGvXiWov3s7HG/GVPXzPw0zEMEhAJawM56nXF8tu3nW1ofvZQSRlg amYA== 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=GMjk2oFcSN1uFAEC/0Y2hnCAJZTdDme830V46OphV2k=; fh=He0A/96iGS/hdBTIvTFKPoE7yByjlEm52ubAJxr7bqo=; b=UTwh7tLzwQeS4XIjjBy+I/1oj4e8ws3KQhfmKqoJyWXvNxLjgSNoI3Po4kx0FWXAvZ HLcRgWQK8EcNGzUvh5QnpaekstIuQyW/5gfYr5wZRkzDyEXP3D7VX683oSSr+h8uE/8v VFLNf6Hw1sg+A+JeaaIoXduD3DFGS0xrg2t2nnRi8M0fdRCUJu03y9rz52CdgxpUezQG 1QRmcg/Fxhjfy9Lmg3myNqc0Mij4pAbus2/rqh0kHe6JhULs+IBcFzEts6F7q2H4gWRa jqpPM1FmrVspgah7+Q6RoQ3aocccZQ/WekOgNbTcKY3Mtk6ybnjxtylrjrL2sZtsuaIV QRgw== 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 q11-20020a05622a030b00b0041972bc1dd8si3100646qtw.93.2023.11.09.05.49.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:49:06 -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 1r15Nt-0001iU-V6; Thu, 09 Nov 2023 08:47:50 -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 1r15NP-0007vG-Ae; Thu, 09 Nov 2023 08:47:19 -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 1r15NM-00028q-N5; Thu, 09 Nov 2023 08:47:18 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 8202C31B1F; Thu, 9 Nov 2023 16:43:14 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 927E9344C5; Thu, 9 Nov 2023 16:43:06 +0300 (MSK) Received: (nullmailer pid 1461879 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.1.3 39/55] target/arm: Fix A64 LDRA immediate decode Date: Thu, 9 Nov 2023 16:42:43 +0300 Message-Id: <20231109134300.1461632-39-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 be23a049 in the conversion to decodetree we broke the decoding of the immediate value in the LDRA instruction. This should be a 10 bit signed value that is scaled by 8, but in the conversion we incorrectly ended up scaling it only by 2. Fix the scaling factor. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1970 Fixes: be23a049 ("target/arm: Convert load (pointer auth) insns to decodetree") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231106113445.1163063-1-peter.maydell@linaro.org (cherry picked from commit 5722fc471296d5f042df4b005a851cc8008df0c9) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index ef64a3f9cb..7e09fd18b4 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -461,7 +461,7 @@ LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 # Load/store register (pointer authentication) # LDRA immediate is 10 bits signed and scaled, but the bits aren't all contiguous -%ldra_imm 22:s1 12:9 !function=times_2 +%ldra_imm 22:s1 12:9 !function=times_8 LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index d1cacff0b2..1afcd16ab1 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -203,6 +203,11 @@ static inline int times_4(DisasContext *s, int x) return x * 4; } +static inline int times_8(DisasContext *s, int x) +{ + return x * 8; +} + static inline int times_2_plus_1(DisasContext *s, int x) { return x * 2 + 1; From patchwork Thu Nov 9 13:42:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742575 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp847449wrw; Thu, 9 Nov 2023 05:53:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IElafdikjpP0ns8Ol1zaMOQnrh0Y3cPcWX0xZjzcVQQb2Xzv6XuY4DyoRdbSUlytEy9SNn4 X-Received: by 2002:a05:622a:10f:b0:418:797:20b6 with SMTP id u15-20020a05622a010f00b00418079720b6mr5471467qtw.5.1699538020172; Thu, 09 Nov 2023 05:53:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699538020; cv=none; d=google.com; s=arc-20160816; b=CJ641syi2xILaHP1/iwZtCjEPjrtsOj2vv6w0TAJIhDmapQznYlgBwsiB3dnTljlnz 5LWWuUymUlUbZyAP41ydCS3fpbtZu4oDHMOKHYg2h9+1jFiOXBSGZHpP4ugBSojpwDSF mS3aVb5V9lCpSQkc3hBMeh2VO2iwhseJ6h5tDyXzZuYzbKDClzEN05PNDK2hFSlWc/UN tkMcQrQc426IGAPXZthTSEf91gRPf4DVP1k/DmiOfnKka3lCcnDKuANLv7/h0tobMB6e l3G/u0dpRp9Es6P/SyAorAf++0nhArgFx6/SoAmqjXMlDBB0Yf2LAt0av+NzC3N/jal8 gwPA== 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=+w//xop9vwl7oT1uRjINapQzVvAujLRM7+s81oK0Yiw=; fh=PiAP/tcXQRrLKJkD8+IkmRB/YLniLgzd6sMPrV2nVKI=; b=AbZ1dI1YQ25FeLs9WyoUbAwbdVTnJTFax+joncLZFLhoLZuw+fmQ7q4Baa/dR3MkzH vAE57HewYJ33UBfGq2TYY0E10W7sCN/DrH7f8np1xhWCUh1LiLenLONbUtpvwDVsTDy4 DI+sJX/iXumDQ113DCWHbRHOAMQyXVzvYjVWsIqFgx9pxVjmDtN6S9MKIJrZalV3iwnU NzD70vh+AIsG9mLK2Qrb3tihabQ2ppMRTZg1wWQ/9K5FDDLhtZgsfXKbA6z0rwNaMw95 TjSiDqoIjMtHe9GsSIeTAVa7KP8tBGZ/jcsAKE75BaPdK9HiPsmN+IbzkU57emWBd165 qUrw== 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 d1-20020a05622a100100b00418114c96e8si2909716qte.390.2023.11.09.05.53.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:53:40 -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 1r15OZ-00048x-5i; Thu, 09 Nov 2023 08:48:31 -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 1r15O7-0002jS-U5; Thu, 09 Nov 2023 08:48:04 -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 1r15O5-0002P3-7O; Thu, 09 Nov 2023 08:48:03 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 22D6631B27; Thu, 9 Nov 2023 16:43:15 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 31A14344CD; Thu, 9 Nov 2023 16:43:07 +0300 (MSK) Received: (nullmailer pid 1461904 invoked by uid 1000); Thu, 09 Nov 2023 13:43:02 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Sergey Evlashev , Richard Henderson , Michael Tokarev Subject: [Stable-8.1.3 47/55] target/mips: Fix MSA BZ/BNZ opcodes displacement Date: Thu, 9 Nov 2023 16:42:51 +0300 Message-Id: <20231109134300.1461632-47-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: Philippe Mathieu-Daudé The PC offset is *signed*. Cc: qemu-stable@nongnu.org Reported-by: Sergey Evlashev Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1624 Fixes: c7a9ef7517 ("target/mips: Introduce decode tree bindings for MSA ASE") Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20230914085807.12241-1-philmd@linaro.org> (cherry picked from commit 04591b3ddd9a96b9298a1dd437a6464ab55e62ee) Signed-off-by: Michael Tokarev diff --git a/target/mips/tcg/msa.decode b/target/mips/tcg/msa.decode index 9575289195..4410e2a02e 100644 --- a/target/mips/tcg/msa.decode +++ b/target/mips/tcg/msa.decode @@ -31,8 +31,8 @@ @lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &r @ldst ...... sa:s10 ws:5 wd:5 .... df:2 &msa_i -@bz_v ...... ... .. wt:5 sa:16 &msa_bz df=3 -@bz ...... ... df:2 wt:5 sa:16 &msa_bz +@bz_v ...... ... .. wt:5 sa:s16 &msa_bz df=3 +@bz ...... ... df:2 wt:5 sa:s16 &msa_bz @elm_df ...... .... ...... ws:5 wd:5 ...... &msa_elm_df df=%elm_df n=%elm_n @elm ...... .......... ws:5 wd:5 ...... &msa_elm @vec ...... ..... wt:5 ws:5 wd:5 ...... &msa_r df=0 From patchwork Thu Nov 9 13:42:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 742573 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp846162wrw; Thu, 9 Nov 2023 05:50:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFL1+O3t1Aiz/PQ1enE54ooxWQzHty1b2UMjDJiihmeoo5bB9Mw3g70r7SaNjksDxhxYtUV X-Received: by 2002:a67:e1c5:0:b0:45d:9a4d:dc1d with SMTP id p5-20020a67e1c5000000b0045d9a4ddc1dmr3819630vsl.8.1699537835497; Thu, 09 Nov 2023 05:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699537835; cv=none; d=google.com; s=arc-20160816; b=m+PqIk97ow4hJrhik7i12c/+5pEUVGQZck2tR+mzbCnJK4/yoHhTIMfZ72CU1rNYy8 4WPaWq6BNskXJsyTmv/kP6ozszwWmnymZiJ9RquOu45gQUSsc3l7ojXj6F2OqPl23gOJ AXMexcqr1vVz1CW795bIB9YUlsD/mvmC15QgIzaydieLGMTkeyHP0C1d+r4hCNgp40h6 2JrGY6fRhhxuj57qP/pqPAkyhjLPg/nmyZZtUF8oEoU1GjVsAq2kfxU2MaCLFFJWcGJP nB0BI0XKgzBHtw4/DXiQeDA5Mu0RPi/retewT0LYOLu82CbjbkH5o2EWUbm9TzCDeTLD E73w== 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=dW/+JbcP/FD3T0rjC3e39+Ij2RYo3CiD9vdJR7fZwto=; fh=UbSczJHoK8QyPNwfbKMWepRwzNWZsm+gkdUzUXKForo=; b=JEPsKITekktUHxyVDbEq/MElEU70el/MdUBTI+vjClAzXav5HGo7qr+rn1nuJy6r6l 5B19zYoH1uq/n9HjuDJrJDNhqWdM5HFgkyaRDOdh55xFkBTXU6ihZKB+3GFfaSmO3Hbc f3ovqAzp/3MaHfdgraKpMOtBV+HUgLqSWKJpKFnuAmi7WvzFhKsKd/CVqHP1SYxouVai iS87udmaY6qCLmeQwZlfapQFXzGEkt1Mjyf+hkg7WZpsvEd4MoVuoFs/IthN3iNfhgiz nnPnHtglH1kGJK9c7TBH35WR7CPCGYgUvqC7NMM+EiiDOyaGTDGWn0b8eo7olMZRpOkX H47w== 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 f1-20020ad442c1000000b006708e35d522si2920849qvr.200.2023.11.09.05.50.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2023 05:50:35 -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 1r15Oz-0004yJ-IB; Thu, 09 Nov 2023 08:48:59 -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 1r15OA-0002wm-HS; Thu, 09 Nov 2023 08:48:06 -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 1r15O8-0002S0-NU; Thu, 09 Nov 2023 08:48:06 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3638B31B28; Thu, 9 Nov 2023 16:43:15 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 441D2344CE; Thu, 9 Nov 2023 16:43:07 +0300 (MSK) Received: (nullmailer pid 1461907 invoked by uid 1000); Thu, 09 Nov 2023 13:43:03 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Michael Tokarev Subject: [Stable-8.1.3 48/55] target/mips: Fix TX79 LQ/SQ opcodes Date: Thu, 9 Nov 2023 16:42:52 +0300 Message-Id: <20231109134300.1461632-48-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: Philippe Mathieu-Daudé The base register address offset is *signed*. Cc: qemu-stable@nongnu.org Fixes: aaaa82a9f9 ("target/mips/tx79: Introduce LQ opcode (Load Quadword)") Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20230914090447.12557-1-philmd@linaro.org> (cherry picked from commit 18f86aecd6a1bea0f78af14587a684ad966d8d3a) Signed-off-by: Michael Tokarev diff --git a/target/mips/tcg/tx79.decode b/target/mips/tcg/tx79.decode index 57d87a2076..578b8c54c0 100644 --- a/target/mips/tcg/tx79.decode +++ b/target/mips/tcg/tx79.decode @@ -24,7 +24,7 @@ @rs ...... rs:5 ..... .......... ...... &r sa=0 rt=0 rd=0 @rd ...... .......... rd:5 ..... ...... &r sa=0 rs=0 rt=0 -@ldst ...... base:5 rt:5 offset:16 &i +@ldst ...... base:5 rt:5 offset:s16 &i ###########################################################################