From nobody Sun May 19 03:54:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1562080773; cv=none; d=zoho.com; s=zohoarc; b=oMkvKU154Rx/j/F1Qt7Tqz2XIWQfUL/qQCHP6T8kQFMRVZTPApKu5biewBXwyR94UOysFVOanDhmnAkCjxNoVG25sfw87TL6+8ALJ3QhvkzsGtBjFHGE3prHnf2vny6vHK2t5M6r2QN0aDtbIDR/xKY7FFNUVwgiyWhMxCk32bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562080773; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=PqJ1ISuGV2u+IdiY8ngyBhS17daHeZo+xRM6Jaz465M=; b=F57RmV/PuOundw7dqv1vQm8ZezFW2t04eDvLHERAzEoWsylxHVutKzuWX/VJeN6sPFEng11WZ307mYeaYITZrWBrMB0EfJsru888mgj0Zs5pg9brTXefu137eTi6I4UDK0WhkDLJAlmv9kJu54cee4FAw4aJep0cKt4G70hmL7U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562080773228593.8771762624525; Tue, 2 Jul 2019 08:19:33 -0700 (PDT) Received: from localhost ([::1]:54412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKYx-0008Ol-VZ for importer@patchew.org; Tue, 02 Jul 2019 11:19:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58030) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKLz-0004wB-Bs for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:06:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiKLr-0007Xp-MQ for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:53 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:42664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiKLr-0007X3-Dm for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:47 -0400 Received: by mail-wr1-x42c.google.com with SMTP id x17so18224556wrl.9 for ; Tue, 02 Jul 2019 08:05:46 -0700 (PDT) Received: from localhost.localdomain (93-34-153-63.ip50.fastwebnet.it. [93.34.153.63]) by smtp.gmail.com with ESMTPSA id w10sm12975657wru.76.2019.07.02.08.05.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 08:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PqJ1ISuGV2u+IdiY8ngyBhS17daHeZo+xRM6Jaz465M=; b=cyHnVafp2KqZO+wsTt4EM2ocniQhrz86PrE+Mkf2vqPDmU3Ns3yPx+HxBt74+G5RNA EOfIVsuvHlkmtooFPe1+7ejYstyqgLQOaYCnzUFcWX9uAcBMqiaTMqzNn6rEmi1UeJ2p b7yhN1zwL0NjnZ1bzleqPVhVtoKKbXZF7PtEFcyJm0Gn88b2Zu/htSshirB2+6Z8ac7J QWjn3aS0exNZS5DRYJz7ZFkBbM2ZDlugU9cjlu6jb9qzyYf7Fo3VSF2BPA42O+J99jR8 HdLtlSQkoTTAqbns9uWBXkXAFnpaywvVxLOM/NrhkQ1vIUauQ2het9mokNoA15pezIjb xhrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PqJ1ISuGV2u+IdiY8ngyBhS17daHeZo+xRM6Jaz465M=; b=YD7pOtz8xxgxt7zBsuR1EdiZ82WFMUcCh5N9XV2HF0G0Ciiiezv+JWygtabPBrKEDt dH+qTk1Sbk1IjlFnX6EKoft7+ZEbfwDNjSc6bj/pzT304gMri2vQztta4SA7mAxT/2p5 iyN3JzLvo6aNag4Xc2o4L/7FEzdE7JCYYFiVNXnRvt7UeRCu3zGsPo2Ufk2TWQKtJDZz K8fB6sVb1Ok7d29C6zBmWHCDiAgQUigFi/uloMp5HGHrTSbwBhrp8o+oUvVCqMWsNsDA nnvEeEihOL7o5YQDCu8XnCwQPOquZM7NVHLq87EH3Z6JgZuM+PJFajQS6yNQzfwPdbwn eW8A== X-Gm-Message-State: APjAAAUywUaQvl02iLHCe9XHS7SSVOWe25tmY0x1Y3af6pwUNery1y1L ZqIZcdtQ9m/4UiSLfl5WTeoCKrUW3p5tkQ== X-Google-Smtp-Source: APXvYqx8+K6f3z1BdtukNzJJDbJKCeuEkZ4A8IWl5lPPWAI6R5CsfadO51ZHzmtuM1/+EteYzsWxiA== X-Received: by 2002:adf:e50c:: with SMTP id j12mr25556851wrm.117.1562079945518; Tue, 02 Jul 2019 08:05:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 2 Jul 2019 17:05:40 +0200 Message-Id: <20190702150542.12008-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190702150542.12008-1-richard.henderson@linaro.org> References: <20190702150542.12008-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c Subject: [Qemu-devel] [PULL 1/3] tcg: Fix mmap lock assert on translation failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Check page flags before letting an invalid pc cause a SIGSEGV. Prepare for eventially validating PROT_EXEC. The current wrinkle being that we have a problem with our implementation of signals. We should be using a vdso like the kernel, but we instead put the trampoline on the stack. In the meantime, let PROT_READ match PROT_EXEC. Fixes: https://bugs.launchpad.net/qemu/+bug/1832353 Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 1 + include/exec/cpu_ldst_useronly_template.h | 8 +++++-- accel/tcg/translate-all.c | 29 +++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 536ea58f81..58b8915617 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -259,6 +259,7 @@ int walk_memory_regions(void *, walk_memory_regions_fn); int page_get_flags(target_ulong address); void page_set_flags(target_ulong start, target_ulong end, int flags); int page_check_range(target_ulong start, target_ulong len, int flags); +void validate_exec_access(CPUArchState *env, target_ulong s, target_ulong = l); #endif =20 CPUArchState *cpu_copy(CPUArchState *env); diff --git a/include/exec/cpu_ldst_useronly_template.h b/include/exec/cpu_l= dst_useronly_template.h index bc45e2b8d4..f095415149 100644 --- a/include/exec/cpu_ldst_useronly_template.h +++ b/include/exec/cpu_ldst_useronly_template.h @@ -64,7 +64,9 @@ static inline RES_TYPE glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr) { -#if !defined(CODE_ACCESS) +#ifdef CODE_ACCESS + validate_exec_access(env, ptr, DATA_SIZE); +#else trace_guest_mem_before_exec( env_cpu(env), ptr, trace_mem_build_info(SHIFT, false, MO_TE, false)); @@ -88,7 +90,9 @@ glue(glue(glue(cpu_ld, USUFFIX), MEMSUFFIX), _ra)(CPUArch= State *env, static inline int glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr) { -#if !defined(CODE_ACCESS) +#ifdef CODE_ACCESS + validate_exec_access(env, ptr, DATA_SIZE); +#else trace_guest_mem_before_exec( env_cpu(env), ptr, trace_mem_build_info(SHIFT, true, MO_TE, false)); diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 5d1e08b169..1d4a8a260f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2600,10 +2600,39 @@ int page_check_range(target_ulong start, target_ulo= ng len, int flags) } } } + /* + * FIXME: We place the signal trampoline on the stack, + * even when the guest expects that to be in the vdso. + * Until we fix that, allow execute on any readable page. + */ + if ((flags & PAGE_EXEC) && !(p->flags & (PAGE_EXEC | PAGE_READ))) { + return -1; + } } return 0; } =20 +/* + * Called for each code read, longjmp out to issue SIGSEGV if the page(s) + * do not have execute access. + */ +void validate_exec_access(CPUArchState *env, + target_ulong ptr, target_ulong len) +{ + if (page_check_range(ptr, len, PAGE_EXEC) < 0) { + CPUState *cs =3D env_cpu(env); + CPUClass *cc =3D CPU_GET_CLASS(cs); + + /* Like tb_gen_code, release the memory lock before cpu_loop_exit.= */ + assert_memory_lock(); + mmap_unlock(); + + /* This is user-only. The target must raise an exception. */ + cc->tlb_fill(cs, ptr, 0, MMU_INST_FETCH, MMU_USER_IDX, false, 0); + g_assert_not_reached(); + } +} + /* called from signal handler: invalidate the code and unprotect the * page. Return 0 if the fault was not handled, 1 if it was handled, * and 2 if it was handled but the caller must cause the TB to be --=20 2.17.1 From nobody Sun May 19 03:54:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1562080395; cv=none; d=zoho.com; s=zohoarc; b=fBXzV07qm/TiTaweIJVt6djyRQutwGA0ikdwb0WPg03fb5SyF8nRq3RwCw1cc5/ae4WGNJjkJVG2eyIbQKMUZIPDTfV5IoknAFqgcSxy6tbfkMDda+lb0ovIZ08DIXXRr2sbfaCLsQoFY70Xcv5HzTbyRPJ9AqGVbd5Z5xzmJ3g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562080395; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=cAdcykhsBr9KRoTt+e4UsNPsrOD05Rn6WRA4P8vaXKM=; b=jmFg6KGcjtct3wD1rZtFUGUn8wFiauo8TB957Pym3XPaoHmrKj7gY3JOV536vi97beokZOhbMUB3edkXcI7iDUX6eZK2H08PbCdUuVaWcwt4zI0NGlza7RYTraJtVTiAh6buKCxwLSO6T2uS7MZLhikGMWyfRhR4VAqazrHHcdU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562080395426953.6325948493147; Tue, 2 Jul 2019 08:13:15 -0700 (PDT) Received: from localhost ([::1]:54372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKT2-0003b5-EP for importer@patchew.org; Tue, 02 Jul 2019 11:13:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58027) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKLz-0004w8-BY for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiKLv-0007aO-JQ for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:53 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiKLt-0007Xd-Oc for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:50 -0400 Received: by mail-wr1-x442.google.com with SMTP id p11so7038147wro.5 for ; Tue, 02 Jul 2019 08:05:47 -0700 (PDT) Received: from localhost.localdomain (93-34-153-63.ip50.fastwebnet.it. [93.34.153.63]) by smtp.gmail.com with ESMTPSA id w10sm12975657wru.76.2019.07.02.08.05.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 08:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cAdcykhsBr9KRoTt+e4UsNPsrOD05Rn6WRA4P8vaXKM=; b=U94X5p9dk+Ez+gN8gaKJ1FW8MyToLqAT1fp5T1gw45kWf0e79qSgm16XMo+S6O5dry LjMMYcn12U8neQd340btUsXYHC9PTm4X6TLoLwUJekGN3ipEJ3eVNOcxhvdR+/ZWZCWd JxjZPEPhsgCNTgYS3PnHUGmlg26dndq4GGutDf5ULJt1l+76ZmYuhZWROzONAvB8wGkq VNNJch7k2jL0aRcSjMjWZDDDvbrbsz9zPnW49FJnEXPgePVnQQDGfi3VkHH/GYvfIsYV YgCxzdfWKVcHA13cm3xHAhcUvXf26T4dXcpU1j+P1JCw8cgD/omQU622Al8iFFSSBcsi JxTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cAdcykhsBr9KRoTt+e4UsNPsrOD05Rn6WRA4P8vaXKM=; b=KQxNHo+4KDs7zjGDcXGhmMxNMIXVA4K+salYtJAVup/ek4IXLeFWPpNIbhNMkCvUnW DrDqbJSlIxm8UxINDCLmqBRm5WG/eWqhGCxNixYcRuVJtAtUP8B+V2GN+uvlytHuSVgm BzIsoa01xmkgPmqNkMBUw/QAd8w77tSyuqDK31XX7woOF2IPa6vQem+rgkflh+qPoLrm qNvQcdrT+nos4ZaphPvOCpycNMLVQ7+qBjFc8Rcw6N3wrhu48iqyh7CrYQzs5w1KM46v LUvaQe4uKVcVxN6LZVUrzAbppWwO1U409sHdLI7fFjB1QnEqHeL9sLReihxdViA2+rJk euoA== X-Gm-Message-State: APjAAAXmOzSTi0o7DY89QVxIYzw6DzKV8gXuhdaKSpdaMkQWm/7rzFJA GUwRJlvl3L29bEhLY7M0cDK+CyKyiLkEuw== X-Google-Smtp-Source: APXvYqxblBOYdntwoovufjWbi9/dYo2YTYOYVAuVVocmDjPaA/Gy32FA75dd3+qJ+pQHwTi9kAVRpw== X-Received: by 2002:adf:bc4a:: with SMTP id a10mr18369095wrh.230.1562079946734; Tue, 02 Jul 2019 08:05:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 2 Jul 2019 17:05:41 +0200 Message-Id: <20190702150542.12008-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190702150542.12008-1-richard.henderson@linaro.org> References: <20190702150542.12008-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PULL 2/3] tcg/riscv: Fix RISC-VH host build failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Commit 269bd5d8 "cpu: Move the softmmu tlb to CPUNegativeOffsetState' broke the RISC-V host build as there are two variables that are used but not defined. This patch renames the undefined variables mask_off and table_off to the existing (but unused) mask_ofs and table_ofs variables. Signed-off-by: Alistair Francis Message-Id: <79729cc88ca509e08b5c4aa0aa8a52847af70c0f.1561039316.git.alista= ir.francis@wdc.com> Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 1f0ae64aae..3e76bf5738 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -980,8 +980,8 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg addr= l, int table_ofs =3D fast_ofs + offsetof(CPUTLBDescFast, table); TCGReg mask_base =3D TCG_AREG0, table_base =3D TCG_AREG0; =20 - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, mask_base, mask_off); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, table_base, table_off); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, mask_base, mask_ofs); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, table_base, table_ofs); =20 tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP2, addrl, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); --=20 2.17.1 From nobody Sun May 19 03:54:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1562081152; cv=none; d=zoho.com; s=zohoarc; b=ZaOubsgpnDCT0oJJOKQPYtwuCzjeCohm+x/dBx9nEvQUk7EiMCSg0jO5zp/MaWUfued70fer10ZWLF4ytwAa8EElvhz0jYrlymAj+3KCv3PeLkrl8VEH++pUp5mpy2LDOGPEj1ukYxb9TKjY6hWy3z3jD1dkXhAuIMyr/fYI6JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562081152; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ty0ceSlhLSlZJKGDv3kDThADamDPPm/37CRvid7ZnoA=; b=Qp6lf/a/ap9s1UxCMJU9PqkAA81y84N+t6s+X9FRio5OktAz3l8G3ixRvc8DW5N90fLmHJvU/SDAG4FCtJ9TZ6zV1206VaxzGnuPi9s0z1KjcVTK4i9S40A7fxYNetO1LgKP/uwjGPvRC+tEb3DZ8XWdf4npib+wqMpwOw6lIZ8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562081152833910.1985849838352; Tue, 2 Jul 2019 08:25:52 -0700 (PDT) Received: from localhost ([::1]:54476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKfE-0008DL-PQ for importer@patchew.org; Tue, 02 Jul 2019 11:25:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58029) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKLz-0004wA-BZ for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:06:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiKLv-0007aW-Jv for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:53 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51215) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiKLt-0007YG-Pq for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:05:51 -0400 Received: by mail-wm1-x342.google.com with SMTP id 207so1202762wma.1 for ; Tue, 02 Jul 2019 08:05:48 -0700 (PDT) Received: from localhost.localdomain (93-34-153-63.ip50.fastwebnet.it. [93.34.153.63]) by smtp.gmail.com with ESMTPSA id w10sm12975657wru.76.2019.07.02.08.05.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 08:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ty0ceSlhLSlZJKGDv3kDThADamDPPm/37CRvid7ZnoA=; b=Rz9NQKhrlQwy/RsupH8RGg0IpFk7hNbm+LIaBM8RjeI/5x5jZXfN1JX046AL0djN54 1CjQgOWqxIwFlqjTRkEV/gr5qPbdj+W5E4H5/c+/9taxurNW0DdnmDa3+ffhRE8It+gV KxMnhEB9aAOC25XmPu6H4+viyZqrNzPnsDCJn4v4MBc+WouC341cbQQWcG+LlMOxXgTU S1VCW79oNSa6H2hoId8AKk561lr5dWig7f5E6T0GQp8MromrS3C5JWPsHF11z1nbsAoM lC42dSt/wv3zyrnoydpsUddRAjmmGF4yAsupwU6Oxvabpt5jIK5HqQdYCt3NcPNvWJB2 9w8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ty0ceSlhLSlZJKGDv3kDThADamDPPm/37CRvid7ZnoA=; b=dnBjFTb6VMd1nBpM2xAhPz90UPKO8vvnxA8+AppTNmKdfNKuRP3ssPfRMbTNAnHDy/ k8cqPyi/Qr+VWnJipWllwiFh5RLiTMi34so6ea4BOq4RWklMFbuo+rqQIbttzl/hTzTL HWPMLda9wdt0or4hUNZBF6SkPAdOzHjS3PWMtfdaokxmlsOdmtfdXVi5pwoGYfgy0ft9 MnmYe0FGJ/aQzEeEMvrZeTy+bn5TXkWydEvFmbJz0qkmB5Yfh0tDfleojvsBV5uVFH9U p4Vlk22+AR8RSI2LBxqGewN8ccQ4WzWw4cMGZ7YkPBfT+i5UAD5BuyiCGTxyQUdLxt3y zxOg== X-Gm-Message-State: APjAAAUiSadKvlDjw/2HZ7lo2dIqpl5wYfKP+2NzLDn9rirBMZici5Zo L7uHyc6TiBZpFNG/NNkCeEzpUzTvHLdEgw== X-Google-Smtp-Source: APXvYqxX6KfCQ5auoSAeEczEKgKnlDsldHSbRUPtkkib87IL95Ovh+7rsU3sA/G0k1ophnrBEM+ZNQ== X-Received: by 2002:a1c:39d6:: with SMTP id g205mr3552458wma.85.1562079947701; Tue, 02 Jul 2019 08:05:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 2 Jul 2019 17:05:42 +0200 Message-Id: <20190702150542.12008-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190702150542.12008-1-richard.henderson@linaro.org> References: <20190702150542.12008-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PULL 3/3] tcg: Fix expansion of INDEX_op_not_vec X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This operation can always be emitted, even if we need to fall back to xor. Adjust the assertions to match. Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index c8fdc24f56..6714991bf4 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -90,6 +90,9 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, case INDEX_op_bitsel_vec: /* These opcodes are mandatory and should not be listed. */ g_assert_not_reached(); + case INDEX_op_not_vec: + /* These opcodes have generic expansions using the above. */ + g_assert_not_reached(); default: break; } @@ -438,11 +441,14 @@ static bool do_op2(unsigned vece, TCGv_vec r, TCGv_ve= c a, TCGOpcode opc) =20 void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) { + const TCGOpcode *hold_list =3D tcg_swap_vecop_list(NULL); + if (!TCG_TARGET_HAS_not_vec || !do_op2(vece, r, a, INDEX_op_not_vec)) { TCGv_vec t =3D tcg_const_ones_vec_matching(r); tcg_gen_xor_vec(0, r, a, t); tcg_temp_free_vec(t); } + tcg_swap_vecop_list(hold_list); } =20 void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a) --=20 2.17.1