From patchwork Mon Jul 31 14:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 708408 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp2330022wru; Mon, 31 Jul 2023 07:16:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlGdcUTsjUZT0VoG5QIDE4WDaaWutf3z4o4FzUneN5b2UeXHEW3D/Pst7HJXNx1i5rFac5D0 X-Received: by 2002:a67:ef99:0:b0:447:7a6b:2c8b with SMTP id r25-20020a67ef99000000b004477a6b2c8bmr71003vsp.30.1690812973411; Mon, 31 Jul 2023 07:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812973; cv=none; d=google.com; s=arc-20160816; b=KGK1D03MLp5my0iWYNSUx3A334EUM5xWc6erN29XVE+DprfhYjiYeiq2sWcHY5Hna+ Y6XD2yCqKIvD+0SLKTOq5PUzrrEWlDH+c3Yc1z1JMoBpIbIJLwsErwjddGlvVwsnWSYr usGesIO1lzSqTD91eKNnISYb3OReZORRnzWTkkh5GOcnSbUCJcLnntCOOwjgH2idXfvA Z3Ax4eucj5fJBfWenu6+9R/w2YjBLh30G/jI5q/e+E/X9nWq+Qeb1O6DOIsLz+BkLiHm TR0RIHQOr39zXkZjAMvWN613SyzT1HBbcRuj3pp3dDTPXcRACpoaz0WR3rTaO72uuhYh tfmw== 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:to:from :dkim-signature; bh=G2c+LxpkCJdqb0ZH/SG20fuSzrbSnvwdJMIMMiLTze0=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=URKCvrZ+wDDig5rK0aiasJNN9qsNP2rOV9Lda6ZMVnBug9X+sCpcKa40sLYc+urRxd musf3EX6MMrd5XzhifftrJTVCNub+uFuG8CZXL1nmsmrHivYclTCDIAkDrWE0P6JLVga uPM3l7Zda6ns8+o1Er7whyWtd92Tj5gJ0FPTa3aUgbE93QrBlu9BkiBih2cw2YVXEFvw qpJeygXbimuNaskwu28Nk1bUlMv5/CEwbuu+8uN4QK4N1rqzNtb7O435+R205LG3jMF4 VXliHDPRF48umfsqVz72u/wWcdNq6B/64425k/oCzn1r92EgNk2sRRvCfvl9CSlSK4v9 3d/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yq/4W2XG"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g18-20020a056102159200b0044385fbe23bsi741319vsv.403.2023.07.31.07.16.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2023 07:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yq/4W2XG"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQTgT-0005Xg-OA; Mon, 31 Jul 2023 10:15:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQTgS-0005WH-1f for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQTgP-0007eR-N9 for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:39 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so9788865e9.1 for ; Mon, 31 Jul 2023 07:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812936; x=1691417736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=G2c+LxpkCJdqb0ZH/SG20fuSzrbSnvwdJMIMMiLTze0=; b=yq/4W2XGdu8ykukOpT6cYpEf3IlhIlZQI+lS53iuJMxn3wIw0Krfh2abatuug68f1N jCLftmQvJI9tUdrjVSwpm60Sfa6O5w3f+mP3hd/tDzTUUJG1djgw90LJJt6SpTSq0p1G nP3J3RKFg8xAeJ+67hwkOTh1PrDAYOkyy39aiExLMWIrfOTNgLklwIDGf/2x9s6ERaJg gWG2QNyyOk7JeU9tu/f20m/cZ6iRXbkFUC7wb5WV1FkzR3eJ6o1NEKoh9YvRsLAyNEI4 +TTgx46WRYQSh8R5gyTxwdHi3SUDpfV9rVwuxVRPtiZI1dqA61ZATot8YZF9U8qtNUcJ SqCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812936; x=1691417736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G2c+LxpkCJdqb0ZH/SG20fuSzrbSnvwdJMIMMiLTze0=; b=QFtB+MaTwaIDvD5AcAwHZQFBl/KCRxG2WHTzvlubmyPKo7G87r4vNEuGqDXGTaxONW m6ITFGsb4FJm0N+Ojpxx114YOE7UqOlNns37lBByUzVjWr4xBxFVDcnZfHEjaqsLuVu4 2gy+f+nX9ZJ5rNXyYVx0YcrvAbtu5Me2AWPboI9nibJizTLQ5CvBrCmEjBZclRhqsVHB JwFQxVHV4a+EyD6K49BwiYT00ksBxqseHa0rsNyYhCHkcZ8ueE34vCkdn5lXM/3b1UaN QCmD9I/EJPtkzfOxkHLYd3v51hyFUQBOofCGztQtvB3YjaV2zpUu/VtxExAYErCysDIM RAog== X-Gm-Message-State: ABy/qLaz63m0WLMbFWgfHZr0rfjmAaWTvoyupIqWLvsUMdZp2qNOYwEa AVNDxXJI0gUg8bIodiIlWQlv1xdBZyX17PhrFYw= X-Received: by 2002:a1c:7c03:0:b0:3fe:2140:f504 with SMTP id x3-20020a1c7c03000000b003fe2140f504mr71732wmc.20.1690812935803; Mon, 31 Jul 2023 07:15:35 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z15-20020a05600c114f00b003fbb5506e54sm11450675wmz.29.2023.07.31.07.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:15:35 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/6] target/arm: Fix MemOp for STGP Date: Mon, 31 Jul 2023 15:15:28 +0100 Message-Id: <20230731141533.3303894-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731141533.3303894-1-peter.maydell@linaro.org> References: <20230731141533.3303894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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 When converting to decodetree, the code to rebuild mop for the pair only made it into trans_STP and not into trans_STGP. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1790 Fixes: 8c212eb6594 ("target/arm: Convert load/store-pair to decodetree") Signed-off-by: Richard Henderson Message-id: 20230726165416.309624-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ef0c47407a9..5fa1257d32a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -3004,6 +3004,9 @@ static bool trans_STGP(DisasContext *s, arg_ldstpair *a) MemOp mop; TCGv_i128 tmp; + /* STGP only comes in one size. */ + tcg_debug_assert(a->sz == MO_64); + if (!dc_isar_feature(aa64_mte_insn_reg, s)) { return false; } @@ -3029,13 +3032,25 @@ static bool trans_STGP(DisasContext *s, arg_ldstpair *a) gen_helper_stg(cpu_env, dirty_addr, dirty_addr); } - mop = finalize_memop(s, a->sz); - clean_addr = gen_mte_checkN(s, dirty_addr, true, false, 2 << a->sz, mop); + mop = finalize_memop(s, MO_64); + clean_addr = gen_mte_checkN(s, dirty_addr, true, false, 2 << MO_64, mop); tcg_rt = cpu_reg(s, a->rt); tcg_rt2 = cpu_reg(s, a->rt2); - assert(a->sz == 3); + /* + * STGP is defined as two 8-byte memory operations and one tag operation. + * We implement it as one single 16-byte memory operation for convenience. + * Rebuild mop as for STP. + * TODO: The atomicity with LSE2 is stronger than required. + * Need a form of MO_ATOM_WITHIN16_PAIR that never requires + * 16-byte atomicity. + */ + mop = MO_128; + if (s->align_mem) { + mop |= MO_ALIGN_8; + } + mop = finalize_memop_pair(s, mop); tmp = tcg_temp_new_i128(); if (s->be_data == MO_LE) { From patchwork Mon Jul 31 14:15:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 708411 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp2330173wru; Mon, 31 Jul 2023 07:16:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlHJfVUgSVLpELjbqEc2mO/YVxkK2y9nDSONuLaynC3ZQVEhq9/IZt48BRxvilYcGCSrn/3K X-Received: by 2002:a0c:aa17:0:b0:632:30e:314 with SMTP id d23-20020a0caa17000000b00632030e0314mr9387532qvb.44.1690812986150; Mon, 31 Jul 2023 07:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812986; cv=none; d=google.com; s=arc-20160816; b=jW7lHCznMMqW3pKyGwvUKdLvjThjRQ4W2OfhLItc90dhNWihICAQlOfisZtgig1yUq xvd7LYvfRMlfXrq661bKVSVHbsWKXHbDqx7HdO/btecD+ErERwAwFQ46cvvqn0hVkCZr g2r/tZPBTh5oKms1qbC3G/QP6K4/j6j06H13yLWXeyAeoez352i0bcxSCdEwA4Z7RG4A JvUdy8uGFxuAIskByWsPE22WSdsZKlYb4M5NFBwVonL+OA1XGv0/gTQU7OXDDrmMb1Uq kOG34MDtYndgkcdgDdMnDZ91rfO6weCLptPAHOokeqHdGGWiM7AyXyesp23m5yTP0owA GHtQ== 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:to:from :dkim-signature; bh=IRJJsXiQGVscOzwBrvnsqBjJfHH56GzCgg2J9O7gwx0=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=CQ4kxVFw7Id3xW2lqjMKCOpQ2IMKTUAH4l7rEg4Pobms8/BbZd2OsgUxunTzcFT32R cSaxA0Hm56RAG5EIjNH7GASUnxWN2cqJgPT7oyAUULQqkniaEOuvtfSbILrOGuP3JVvq To78MYC2bX+R9qEBlZMwEy2iUNm0DZQU/dXmEar0P8AN8udUPEVDt+OjjrKjpijiMBK4 8LJtJ9WU+zP2RPyikn/wyRv8tzEhZWpcq5SzXlk+/5ah3Ky+7uExLqLHRdXfNObxOIQ3 4K6bovNvvypAfWaNOr4yWZh3fOEnjTcs0UmLU7mqgz68x2eHCLdMIKNsLtH8jG80bk2U z4AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uxeB1Zzk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o2-20020a375a02000000b0076ca1b8aaf6si2684903qkb.634.2023.07.31.07.16.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2023 07:16:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uxeB1Zzk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQTgY-0005a3-7V; Mon, 31 Jul 2023 10:15:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQTgS-0005WX-Go for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQTgP-0007eT-Pi for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso49716645e9.2 for ; Mon, 31 Jul 2023 07:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812936; x=1691417736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IRJJsXiQGVscOzwBrvnsqBjJfHH56GzCgg2J9O7gwx0=; b=uxeB1ZzkopKK73UMeuz+c3AxaygULbEBZEGT7Pyfuwmdu+TqS/mtrbPzKjBJKpuBHG IUI9y6oQw3z08sgSqf1tfMJ3QPNq+yagO18HhLWSWcdprtedSLqTm4oy2WCiAEUSsPEv FHa+gGBRR1c08SqV6WdqnMXoY3X84x4OIQx9ijKMJV3hDs3cizqOAptu0BpMU8vsuIaU ZoxWX0VUMFkCkwXGk6b+X2YqlT8eQTR5RnuNhb7FXGZmtVEq1chCyKWYgmqJC6F4d6Dy 8oiZ4KV3tBrMkAikbidCcbkB7GZ8iLI6cDmjB6xBVv3tgzeoPsu6kEmTH10YXJFKHvTZ 5B1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812936; x=1691417736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IRJJsXiQGVscOzwBrvnsqBjJfHH56GzCgg2J9O7gwx0=; b=MhR//X9ntfC2YuvnbC5zxadsua7qNJAXYPHmhxm3/6uVTRgCkjBxiJg4s2/fPQQgpc OEexS4I9Zo5BOzjIwffcAl+KZEwBXv4DSRz0EP6chPVAFeoSSRu1Wz8bc1rInZnvvin+ ekdEj8xcD3uXSypPEa+lG/CfvX3HsXY985c/18JA7g5CnSUsXsH3+7JBp3VK4uAWN2KV NrAH6FjGhBLhxtNdKw4p805dnrCYeIdbZd/Kox+/R3ZeIMsoU1LS4INW7CkEvKlZfDjx fjc7ShlUldN/LzwkveqyD4CIkdbomc583KRFiNaKpdHCd1kK8Q3WQj7YltdT8sc3whLD Hh5w== X-Gm-Message-State: ABy/qLb2fXz6dUNb5IaF2wLcsXa8ubDKtFsf3Q/xe3mTijl6FfxYuJ3c wsfLB6AEWmkTHCvYTzaNjxGlqllqTLgG+UmwKto= X-Received: by 2002:a7b:cb86:0:b0:3fa:9538:963e with SMTP id m6-20020a7bcb86000000b003fa9538963emr37649wmi.36.1690812936227; Mon, 31 Jul 2023 07:15:36 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z15-20020a05600c114f00b003fbb5506e54sm11450675wmz.29.2023.07.31.07.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:15:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/6] elf2dmp: Don't abandon when Prcb is set to 0 Date: Mon, 31 Jul 2023 15:15:29 +0100 Message-Id: <20230731141533.3303894-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731141533.3303894-1-peter.maydell@linaro.org> References: <20230731141533.3303894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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: Akihiko Odaki Prcb may be set to 0 for some CPUs if the dump was taken before they start. The dump may still contain valuable information for started CPUs so don't abandon conversion in such a case. Signed-off-by: Akihiko Odaki Reviewed-by: Viktor Prutyanov Message-id: 20230611033434.14659-1-akihiko.odaki@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 89f0c69ab0f..6d4d18501a3 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -316,6 +316,11 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg, return 1; } + if (!Prcb) { + eprintf("Context for CPU #%d is missing\n", i); + continue; + } + if (va_space_rw(vs, Prcb + kdbg->OffsetPrcbContext, &Context, sizeof(Context), 0)) { eprintf("Failed to read CPU #%d ContextFrame location\n", i); From patchwork Mon Jul 31 14:15:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 708409 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp2330024wru; Mon, 31 Jul 2023 07:16:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHYTmqNu2Z2dR5kbGUMLH0W74gxmkaRV1Cpo48p2l5T6DZ9M1x0DcnnQ5Jkwlimt0wY+zFy X-Received: by 2002:a1f:3d07:0:b0:486:3f48:be7f with SMTP id k7-20020a1f3d07000000b004863f48be7fmr3728354vka.6.1690812973667; Mon, 31 Jul 2023 07:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812973; cv=none; d=google.com; s=arc-20160816; b=bT57b35yS8ttoLFcW0EFFjAS2m+uQOeSHb0DdvPYPPG/BgPJb1jnRA5+ymAzSR2ihI k6SRser2BvQTpYq/DMSNRfwXnGtkXwe1ST97BF7KUF442GpYuHy250iD24lM7w0RvZ00 9k5P6QqHISgPa/2Jd3YSPDPdENAxlmVGV9siMa3GvNq2KZVTRJJ9a5+XIh+tkjpk/unn k0DlPFbmcE1JC4mrb5FoGFl+ZKkhyA327gMjbkLCPWD+jB0XfJeLkZynZdGvowQ+xyfI LV0L3eXkhkmTjTUX/R9x0sfNmSSFQR3q70QIKaRyOB+sV/RMXVYZhwzFn0fanKJi6O0I ARTA== 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:to:from :dkim-signature; bh=STtOVksr63dEkZ6wAYpplxRzfdJwT/NJYMmDJPe/tsc=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=x7RgHpjnNuTKD6dRgVJAzmL70hmqk5G+V0jAjK0K10XHVHMBVvmkyHrf7hrSaxTy3z hQBRqG3ywep9oMMo8Wk5FimGDPbU/sKH2nvY62wNw347LL+2lvFnzXDNmVn1u5MXWcXS aYfVVIYTAEzVPV7DNM16dl3BSm4r1A0CKoZY1ay5O+sxlw2QSdgTWwogXCIJCC481Yjp JE8u6xjCx3PuOo3hwOPVsQl7NTHPlpuonaU+LvJP01odB2tKwz2xZcZbt4SZW1I8Vm7v 79pYwObbcnjV0xZIB0v05Wu0yDRXA6lQsehXV8FKye2dEAJ5XE9NU/iumK1blazJ1SUr hEDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RJcIdCam; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h8-20020a056102208800b004450872d17dsi786421vsr.396.2023.07.31.07.16.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2023 07:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RJcIdCam; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQTgW-0005a1-0o; Mon, 31 Jul 2023 10:15:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQTgS-0005WZ-KE for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQTgQ-0007eb-CQ for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so9789015e9.1 for ; Mon, 31 Jul 2023 07:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812936; x=1691417736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=STtOVksr63dEkZ6wAYpplxRzfdJwT/NJYMmDJPe/tsc=; b=RJcIdCamjcgBEAeVlxYWD5La8/Z/AbzTtdhYk+pkGqMUv0uURpf3huWY/cBt0RXN7p 2EKT0ClB4sWqzqwji4pluVQFEk8qmPbGyWl8oz9QDijka+vowSzIuKPFTGTd8AjEFbjN zNsAnjVbFc9fRY7hI+mkQFbNoF/vBZbpU7ogrv0tHaQ8b9M5xN/s8fNvV0VWOizi605L Qf0ucEO1WK5Xow24bDOaaX+wooSnQ4rtVtg/7VsgVGMA7ygTjrqCegL02nB7hn0N31XY XUjNRpN4p0xt7qgZ1U5ruOGvVduLJtnSTzbmBdLU2RM17L4UN82jpmosJjTKw5v+tWOZ SU/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812936; x=1691417736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=STtOVksr63dEkZ6wAYpplxRzfdJwT/NJYMmDJPe/tsc=; b=SG/inmGSQWxwfaYiyzjcLHh6PiINhSRcly5/hSBZSpuTyAEkRizUWbJ8/m+HsB/X3w 8CFqxJPmpVvHa8PHe3T6y1bOHlm8ih1ZC43Q3JIAojPjNLYAmW+RTYQ0WGf3gV3JVChS Uo5qIPW4EbHxYzLFL2Y584Y01TohcLSs6KTgNJL68hkEYpSUlRgP5GWJ+2xkraW3lFnp YlZLLG7ctBcFm1PQYF2f0lHKp3i6NJzfZOPrm54oVicRpOeO8Z4dOiwgk/K/gJI3QQzJ BEbH8AliNJKqAyZQf2JD5FgZyn04Ou8AOP28CPrnF6Mhc+pkPCtpmyDnbyJLnM7uXzbz rPpw== X-Gm-Message-State: ABy/qLYcjaqiFdN+018IGBOUnBx6HfVx+QjwE8A1bovKNYZRyeAzQZQ1 jYq+aV+xaQYmv/k6eGwwW4XqN1hFckrZp0mJsx0= X-Received: by 2002:a05:600c:2a4e:b0:3f9:b30f:a013 with SMTP id x14-20020a05600c2a4e00b003f9b30fa013mr76243wme.6.1690812936651; Mon, 31 Jul 2023 07:15:36 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z15-20020a05600c114f00b003fbb5506e54sm11450675wmz.29.2023.07.31.07.15.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:15:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 3/6] target/arm: Avoid writing to constant TCGv in trans_CSEL() Date: Mon, 31 Jul 2023 15:15:30 +0100 Message-Id: <20230731141533.3303894-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731141533.3303894-1-peter.maydell@linaro.org> References: <20230731141533.3303894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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 In commit 0b188ea05acb5 we changed the implementation of trans_CSEL() to use tcg_constant_i32(). However, this change was incorrect, because the implementation of the function sets up the TCGv_i32 rn and rm to be either zero or else a TCG temp created in load_reg(), and these TCG temps are then in both cases written to by the emitted TCG ops. The result is that we hit a TCG assertion: qemu-system-arm: ../../tcg/tcg.c:4455: tcg_reg_alloc_mov: Assertion `!temp_readonly(ots)' failed. (or on a non-debug build, just produce a garbage result) Adjust the code so that rn and rm are always writeable temporaries whether the instruction is using the special case "0" or a normal register as input. Cc: qemu-stable@nongnu.org Fixes: 0b188ea05acb5 ("target/arm: Use tcg_constant in trans_CSEL") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230727103906.2641264-1-peter.maydell@linaro.org --- target/arm/tcg/translate.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 13c88ba1b9f..b71ac2d0d53 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -8799,7 +8799,7 @@ static bool trans_IT(DisasContext *s, arg_IT *a) /* v8.1M CSEL/CSINC/CSNEG/CSINV */ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) { - TCGv_i32 rn, rm, zero; + TCGv_i32 rn, rm; DisasCompare c; if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { @@ -8817,16 +8817,17 @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) } /* In this insn input reg fields of 0b1111 mean "zero", not "PC" */ - zero = tcg_constant_i32(0); + rn = tcg_temp_new_i32(); + rm = tcg_temp_new_i32(); if (a->rn == 15) { - rn = zero; + tcg_gen_movi_i32(rn, 0); } else { - rn = load_reg(s, a->rn); + load_reg_var(s, rn, a->rn); } if (a->rm == 15) { - rm = zero; + tcg_gen_movi_i32(rm, 0); } else { - rm = load_reg(s, a->rm); + load_reg_var(s, rm, a->rm); } switch (a->op) { @@ -8846,7 +8847,7 @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) } arm_test_cc(&c, a->fcond); - tcg_gen_movcond_i32(c.cond, rn, c.value, zero, rn, rm); + tcg_gen_movcond_i32(c.cond, rn, c.value, tcg_constant_i32(0), rn, rm); store_reg(s, a->rd, rn); return true; From patchwork Mon Jul 31 14:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 708412 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp2330178wru; Mon, 31 Jul 2023 07:16:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWwgvlZK35AJIV0n0+S6+phmEqb+Lh5rtLrDhgUbOvXMU+cpAARtdjWNoAK8rED3dKk1Bo X-Received: by 2002:a05:6808:1390:b0:3a3:fa64:bb8d with SMTP id c16-20020a056808139000b003a3fa64bb8dmr11256740oiw.10.1690812986558; Mon, 31 Jul 2023 07:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812986; cv=none; d=google.com; s=arc-20160816; b=dUbRkjSJYNEx8ivnuad78dfM6avUPAIXaAQdCK14oUikyzFjpwWdIM130R2II2UzHf IXcKrkPokh3kEtGE+Q4/Yc6pu/dWMqC5ky648oKZTu+33ESfM6GW65x6Rr3Jgejzortm pwtpphbrxk3tCk+bPxdb1fGDSTjvjZJo08yuBjpuLI41OsElFYnifPUVVvVnLYPkdD7n dW005tA2dznjGShLo0k99e3p9DF8xqAv0GiZG/4dmdINInVuKLZ9xY+KETH/YpkGYHQ0 lmjsFSjaln4mqisdr9cVkobpShcIY2hwz2XUWzdkudJ2MEHFOGW+QMLkLyEWTMBQ175j Sz4w== 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:to:from :dkim-signature; bh=itpHEVbLfs3D8/erGt8kWjQtJGFDTxDKtjwIc6dYdN8=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=r+8ubggH8ChwS3dNfphGK46qvZ2TU1ZQaaxMD3NWgo7QYQIpVORHWk87Mj51Yfk4XT hCGom6FxrR46aGwGu7KX2Ai8F84e2ofyR8ngaNvgVtzBH8P7PEVLc9rwPhYRxw65REDI 64kfMAQK7+uTcBTEp7vAC8XTysOXDEBESUr/rowDtEjs4UPjsrgYcqUQoris0I2KbRvN 6z39ZnUvohnrxLy/dx3xiAQWg9QP0hZDFdMciK75T/PHzFrPITsRMFk8wpU+InPiAg8M +ldvqnVce0xueQ9m2zxRo/dTKyThiUc+8hKlr/kQbSo4gWiVHtNMfzh9TkHbRj6v8Q/o v8CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e5+4En45; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bl18-20020a05620a1a9200b0076ca12d1f83si2830562qkb.392.2023.07.31.07.16.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2023 07:16:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e5+4En45; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQTgY-0005aA-Ad; Mon, 31 Jul 2023 10:15:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQTgS-0005Wa-L8 for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQTgQ-0007ei-ON for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fb4146e8fcso31569445e9.0 for ; Mon, 31 Jul 2023 07:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812937; x=1691417737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=itpHEVbLfs3D8/erGt8kWjQtJGFDTxDKtjwIc6dYdN8=; b=e5+4En45SlVWfKIsyAyz7S0ZUVgFHYMsM+E+yPGBgy+tnKUF/VfSNKbp2JSi68nZv6 AEGVg+pc21h5s1nhNYTDUQD9Ve003ADYmqNRXvbjd58hJgLLIfCiBv1kffNODXG2O5Vi P14BoUUZEbPwOFTllStI91VZF7BVCUQMEwHZipaXgMVWn4OiBOTF53WcXe1T+KS5JXl6 DHyXZJH0u2iu2rNV1qO/lqA/cyDC3hJLwN+iAeKtq9xMRuxk5kjLoeGtlyNvNVFeGV3c nS/DWejQngouDrfRmwbkRFUUeqiB4cbyWLOD7PbgWpD52W4znvEERh0izytx5IboL6En wL2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812937; x=1691417737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=itpHEVbLfs3D8/erGt8kWjQtJGFDTxDKtjwIc6dYdN8=; b=RpS9i4jiYAmOwOSDntEH0ljgdA8Ywj47S8t4TJFnirxtdD4FosxKtZTlZjamyHCbRj Lr69jm1vM94fZNg7IBwk74+iEMV0cRxgXYecNtPNHNpbvRP16PPcXnO2QvXqm2hxNYwp firnFnqw1lSK/cxDjxEWeoq5iV6sMkhy2HTAgim+GA1dkTm+TZG9fMP3cK6e8gEmSBBJ Jf0fJedIN+hjwxETSSX+YQI+I9ov76/NPE5K9qNgdMob5Nu1pQrJX3Ic5Mu/z2kypTIY n3j9LhChXVa5Lcz1BYV/Rglm0MIndiEa20VBVmYjothr94khSkoamOo775Itbhvjyele v8/A== X-Gm-Message-State: ABy/qLZWYpazJBCCwolYoiF2081V7+R4g1ucmRiqSwt9rxiZPOi76H2a Ls/NVfCyLKgGcR7OhmZVELeC4xmd7DMFYFcjsr8= X-Received: by 2002:a05:600c:3d13:b0:3fb:e1d0:6417 with SMTP id bh19-20020a05600c3d1300b003fbe1d06417mr10584857wmb.19.1690812937057; Mon, 31 Jul 2023 07:15:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z15-20020a05600c114f00b003fbb5506e54sm11450675wmz.29.2023.07.31.07.15.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:15:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 4/6] target/arm/tcg: Don't build AArch64 decodetree files for qemu-system-arm Date: Mon, 31 Jul 2023 15:15:31 +0100 Message-Id: <20230731141533.3303894-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731141533.3303894-1-peter.maydell@linaro.org> References: <20230731141533.3303894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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 Currently we list all the Arm decodetree files together and add them unconditionally to arm_ss. This means we build them for both qemu-system-aarch64 and qemu-system-arm. However, some of them are AArch64-specific, so there is no need to build them for qemu-system-arm. (Meson is smart enough to notice that the generated .c.inc file is not used by any objects that go into qemu-system-arm, so we only unnecessarily run decodetree, not anything more heavyweight like a recompile or relink, but it's still unnecessary work.) Split gen into gen_a32 and gen_a64, and only add gen_a64 for TARGET_AARCH64 compiles. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230718104628.1137734-1-peter.maydell@linaro.org --- target/arm/tcg/meson.build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build index bdcab564899..6fca38f2ccb 100644 --- a/target/arm/tcg/meson.build +++ b/target/arm/tcg/meson.build @@ -1,7 +1,11 @@ -gen = [ +gen_a64 = [ + decodetree.process('a64.decode', extra_args: ['--static-decode=disas_a64']), decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), decodetree.process('sme-fa64.decode', extra_args: '--static-decode=disas_sme_fa64'), +] + +gen_a32 = [ decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'), @@ -13,10 +17,10 @@ gen = [ decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'), decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'), decodetree.process('t16.decode', extra_args: ['-w', '16', '--static-decode=disas_t16']), - decodetree.process('a64.decode', extra_args: ['--static-decode=disas_a64']), ] -arm_ss.add(gen) +arm_ss.add(gen_a32) +arm_ss.add(when: 'TARGET_AARCH64', if_true: gen_a64) arm_ss.add(files( 'cpu32.c', From patchwork Mon Jul 31 14:15:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 708410 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp2330095wru; Mon, 31 Jul 2023 07:16:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDJ6v8Ju8zT/2WchMm0TtIW8CFtwcWeZvf+g1IgGWknux2obhf2eOSnXEy1V07wyQJ2eER X-Received: by 2002:a1f:bf4d:0:b0:486:4188:48c9 with SMTP id p74-20020a1fbf4d000000b00486418848c9mr102138vkf.3.1690812979842; Mon, 31 Jul 2023 07:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812979; cv=none; d=google.com; s=arc-20160816; b=kf75oOI+RDHqzMdqtgyVwZR9sZGdnn+EqJmAl2O/4ubdHR4804nO6oQTM6ksxsF8FN +tXwgYYel7zGVksidMmthq6s615jpUiYKuvfsLpT1tU6T2MNwSGEhEHCBHBOhmewRQUh Tbs7Rq5z7I42g74Sw7zKOMqktXGAVHKEjKpBvv0ENLdB1J56mdlYDfDe8fIQ5WJt+gcJ TY5RmBYpZBZEWObVKhOkkrAt0Qh3s64QgDF1ACVV8jLcvfDoFWPpHtC40kzssKH6RYtm h1M2rjAzsXHPkbf4MFNI+GdS0zLZuKMUhmPWj3WHMT3sjw12z2NhFzn90VjICkLDbNRj UFCA== 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:to:from :dkim-signature; bh=nGXXdjxZdAaUuuyvA4vW1eeAGJKvdfA5mFX80NPb9+I=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=MY7SKGN5MNiNbrq0SRLerWXC0grN4YPhzQXjp103uEd3Koeb5sSgEGl+1pc8cz+kqZ EHH4+H6kjXOn0VcE0Lbezfe22ug4qTBV4wGCzCKt5vv93KaRfVy5NC9iK9Q6c6Z+nocG hzKPJ1VEeoP2ZJ9U92oGBBq8BrmeZNvW82o777yLRUjB6i/ppUxJFP6d+orCDLrbD4oW YLqbSq4JWmwqdiTeV5/S/3dn187LjFt0YeUGvqCQxFlNPP+pejyYVd3q+SbZZWXZfU11 NXwvNpzp6uBqy00JXTfYsfnEAyMVOuTHVaYXkpZfmzDq644SKAkOby7e9f2swQiYLn+9 /2Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t0vvZVRQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t8-20020a67ad08000000b00445152e2eb3si754320vsl.459.2023.07.31.07.16.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2023 07:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t0vvZVRQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQTgV-0005Zz-AE; Mon, 31 Jul 2023 10:15:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQTgT-0005XJ-5D for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:41 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQTgR-0007et-07 for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:40 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so9789195e9.1 for ; Mon, 31 Jul 2023 07:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812937; x=1691417737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=nGXXdjxZdAaUuuyvA4vW1eeAGJKvdfA5mFX80NPb9+I=; b=t0vvZVRQbYm4SQlk+vv03R+1hzQ6xwOI/R4QeLRgj9pnOImRQsDwiNR+nRCxon7yUg lbnkGojE7rMLRd7IMiQzrd4PkkXWFOQxf/bo+F/l98PdbVpbbtb1GRV6N8/n4/w45a1F lMbCW9Z+LRaVtcfTm6XKMtHed2RjCMDiOSXDvEjUAl4+ATDlzCwqoRcaZ7+7rnWDfZn3 Wb47otAHEAcO+vr/45bWuOaY1J2rloaKTB8ZmtGEwSsWdzM7dMd3LHrc7BsOgL97bqOg M7pdTdNT/DErhokuoSQoMW2WKmABYByx/fabN9frA13/qhSUUR7pNhz7yDXha3W5epup /gqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812937; x=1691417737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nGXXdjxZdAaUuuyvA4vW1eeAGJKvdfA5mFX80NPb9+I=; b=b7dhNTkLdKTFAKElBfvh8eQXBZwBKQOgBO1P5n6Y0506NfnySO+udOrRpCj9OSduWu ai5vDvQjRPM0LMVpHzmvmzPh5EDg+QUgR1DL0L/NerfjIZZzB3wXkvhwGQPP+91kueLA /trYZE9gVT1u+rAgY9uZ1mf4l4gwFVpS9RILKjFUA4ZvnxhUn/NW3AVVWjUQEfAXY07V 5ryQnJNew/UJpvP05neNf4p5KGbbOYaU2XSqMpjcQgVcjNnH2TxEKGTY+jl8yp7NrK8S ITZSivwgG1+Wkrjy50eHZI9eqcahNmB2eRuUamVH89CTxVEKc1qKRtD/fJ5EIzqocPXl D+uQ== X-Gm-Message-State: ABy/qLYl54KxkEacCMotWZV9k4h4sVcz51h/Os9+iz5+fL0g/2V1HxSL IjXAAggmkQOp8l8xHZ/UL5EGf2NLWOkgloIyYO0= X-Received: by 2002:a05:600c:2482:b0:3fe:2167:97d4 with SMTP id 2-20020a05600c248200b003fe216797d4mr61136wms.29.1690812937549; Mon, 31 Jul 2023 07:15:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z15-20020a05600c114f00b003fbb5506e54sm11450675wmz.29.2023.07.31.07.15.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:15:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 5/6] kvm: Fix crash due to access uninitialized kvm_state Date: Mon, 31 Jul 2023 15:15:32 +0100 Message-Id: <20230731141533.3303894-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731141533.3303894-1-peter.maydell@linaro.org> References: <20230731141533.3303894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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: Gavin Shan Runs into core dump on arm64 and the backtrace extracted from the core dump is shown as below. It's caused by accessing uninitialized @kvm_state in kvm_flush_coalesced_mmio_buffer() due to commit 176d073029 ("hw/arm/virt: Use machine_memory_devices_init()"), where the machine's memory region is added earlier than before. main qemu_init configure_accelerators qemu_opts_foreach do_configure_accelerator accel_init_machine kvm_init virt_kvm_type virt_set_memmap machine_memory_devices_init memory_region_add_subregion memory_region_add_subregion_common memory_region_update_container_subregions memory_region_transaction_begin qemu_flush_coalesced_mmio_buffer kvm_flush_coalesced_mmio_buffer Fix it by bailing early in kvm_flush_coalesced_mmio_buffer() on the uninitialized @kvm_state. With this applied, no crash is observed on arm64. Fixes: 176d073029 ("hw/arm/virt: Use machine_memory_devices_init()") Signed-off-by: Gavin Shan Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230731125946.2038742-1-gshan@redhat.com Signed-off-by: Peter Maydell --- accel/kvm/kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 373d876c058..7b3da8dc3ab 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2812,7 +2812,7 @@ void kvm_flush_coalesced_mmio_buffer(void) { KVMState *s = kvm_state; - if (s->coalesced_flush_in_progress) { + if (!s || s->coalesced_flush_in_progress) { return; } From patchwork Mon Jul 31 14:15:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 708413 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp2330437wru; Mon, 31 Jul 2023 07:16:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlHF6xL9bjDF/83ncuZ6AlLlLUTSe603uY5vn7RUm1dJYxvHfcPsin45iBg+mKitx7OhhZ1m X-Received: by 2002:a05:6214:4014:b0:63c:fa7d:74ee with SMTP id kd20-20020a056214401400b0063cfa7d74eemr13198344qvb.50.1690813009566; Mon, 31 Jul 2023 07:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690813009; cv=none; d=google.com; s=arc-20160816; b=OGKnRqZxE4Y0y1YApvGn2Quu06koyehMhRdm7rPeTmvUQ0NKA8CMtz/AGVw0AoY2kj L9oQZWbLRlSgjyFx8oaQod4PWGYJU7EB2DpnQqe0bocKzR4XJMf/iJCZ5RwPztlqt9J+ aje9saqq8dOFsvQHaWUKEFJa62NbV5e9hbfgCCUNWusgUSlA0PObsIamAQzofzkzYQjU GdGIRehMifVYnsA12B6YYTQvYx1tyP6PLZL2z+N/7HeirUl18tonvEGSEGhfdyE61yql laeuj8FuVH3+djcQC6yg2Nx+Jk2bK52B0fUVMhiByiOQhEhnqcGBQ8ThbzgroQvO9dX0 11lQ== 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:to:from :dkim-signature; bh=umPuKK0TP/i1glV8Qojb6FP6t/DJTY4yK7JJ/sINZ5E=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=eHDsyGF8V9skB6APCaxvkCiOckA75UxG/t5pgSch9UlLV0822s5FvjM+ry0zzNXcVU QeQaI8PxZ+Jdhg8Xw6M+TrbzyOMmkrHypMHTIemgIlJLO/cpMYHSNuVzBnzTpK0VlKIH +hc71PF+2SygvlzieL7m/xNIYtafdYkXJ9zR93AwYlCtrge1MwPwLMO23qqopxtBCMbQ UCuV+CMcr3cnRP7nuUMxBuyCJXcy4S0syA2p2aMoujzaVwCLip0Tp90TTAfM6NsARqZV lssVX34IkTTymvIU2EadG6LQRgdH+ETQ/kK78h4U/wckkH60EDIE8MJAH1DWhHvzQ43h W8qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MFrKBW+i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k13-20020a0cf58d000000b0063d26039f64si5655398qvm.555.2023.07.31.07.16.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2023 07:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MFrKBW+i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQTgb-0005al-2s; Mon, 31 Jul 2023 10:15:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQTgT-0005Xy-Tm for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:41 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQTgR-0007ex-QP for qemu-devel@nongnu.org; Mon, 31 Jul 2023 10:15:41 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so9789235e9.1 for ; Mon, 31 Jul 2023 07:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812938; x=1691417738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=umPuKK0TP/i1glV8Qojb6FP6t/DJTY4yK7JJ/sINZ5E=; b=MFrKBW+iLqvFD3CUTIt8nain8KfYljuJkzxSmKOVH2WaY2eHKUQ/bZBX9g2NqO4BtS vfqZJnerM9oyDYR0uGaMweOhuHoRE9KETpezJxS9yOEDgz6XlJUHGpDS/SNxID04pXfp +R5+CMe1nnV1IHHjeQnuPMjV2NALGZB0wmSdgMpkgu1mBszVXXOE4Yjr2A7dj4qNHQht vPpyzBquqZUn9l86j8j4ugjY/K3ng3KMy6wh6nfKp4O1Hj+TZHuccFzpHG5IxPnIyKU+ TBT6wVsP3q5PrlpS1J8RXPk8VuWJ5ElB6JQCKcSNi/tYKKjGMvww5e0BTNKnoEyffzg7 KUdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812938; x=1691417738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=umPuKK0TP/i1glV8Qojb6FP6t/DJTY4yK7JJ/sINZ5E=; b=KARH+nFz7diFro5g8565NrS4N2fpo+vUpxxaUZ/P7ZSRSgjtVfrrZxveNGxTjGnxZf HIjn3N7Y5qrpPtSPz+yadldoGRViITg9Hwfxm7iEDLxtE8GNnl/TeMPy+rIPfJypafUF an5Bm9rnjZ9O64ClqIe0MWemM63lNztugqKNV+kv55DrFF2toeVbINX+uZ4OOM1u6Q2n BgbXBo12nGMiW/rdgyCjc8al9ches66/RXmnxCSClqTdYMGFCGPHhK9dWwRFs3tV6NpA Y51ajH46eiUCSJBeOmgS64Kp0fej9H0N1ENRPB6oarTjDc4RGL68LY2UfaC4DL883BC8 NgSQ== X-Gm-Message-State: ABy/qLY+vSr3QraxG9TKC+IneB4cMd/7ucMA9w+Yrj7Qi6zYpLeptcDs ZSFBU3SaKR7j52K7wpEBta8TMWcyedg7ZpWsCwE= X-Received: by 2002:a05:600c:215:b0:3fe:25b3:951d with SMTP id 21-20020a05600c021500b003fe25b3951dmr77568wmi.5.1690812938053; Mon, 31 Jul 2023 07:15:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z15-20020a05600c114f00b003fbb5506e54sm11450675wmz.29.2023.07.31.07.15.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:15:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 6/6] gdbstub: Fix client Ctrl-C handling Date: Mon, 31 Jul 2023 15:15:33 +0100 Message-Id: <20230731141533.3303894-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731141533.3303894-1-peter.maydell@linaro.org> References: <20230731141533.3303894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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: Nicholas Piggin The gdb remote protocol has a special interrupt character (0x03) that is transmitted outside the regular packet processing, and represents a Ctrl-C pressed in the client. Despite not being a regular packet, it does expect a regular stop response if the stub successfully stops the running program. See: https://sourceware.org/gdb/onlinedocs/gdb/Interrupts.html Inhibiting the stop reply packet can lead to gdb client hang. So permit a stop response when receiving a character from gdb that stops the vm. Additionally, add a warning if that was not a 0x03 character, because the gdb session is likely to end up getting confused if this happens. Cc: qemu-stable@nongnu.org Fixes: 758370052fb ("gdbstub: only send stop-reply packets when allowed to") Reported-by: Frederic Barrat Signed-off-by: Nicholas Piggin Tested-by: Joel Stanley Message-id: 20230711085903.304496-1-npiggin@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- gdbstub/gdbstub.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 6911b73c079..ce8b42eb159 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch) return; } if (runstate_is_running()) { - /* when the CPU is running, we cannot do anything except stop - it when receiving a char */ + /* + * When the CPU is running, we cannot do anything except stop + * it when receiving a char. This is expected on a Ctrl-C in the + * gdb client. Because we are in all-stop mode, gdb sends a + * 0x03 byte which is not a usual packet, so we handle it specially + * here, but it does expect a stop reply. + */ + if (ch != 0x03) { + warn_report("gdbstub: client sent packet while target running\n"); + } + gdbserver_state.allow_stop_reply = true; vm_stop(RUN_STATE_PAUSED); } else #endif