From patchwork Wed Feb 28 11:56:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776463 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp250985wrn; Wed, 28 Feb 2024 03:58:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWBNNvhcqVf456NyH3hJ+PHacFYoB+x/nAUKmP71jCZ6PfNtqHFG5eo7du2416P74ctwccd52Z99wzr7KlFjnvd X-Google-Smtp-Source: AGHT+IEc69tfl2w75MUZSlYS5wCO36w/DBMpr9jHtWP3FQ9jx2j80uo3qc1+Ih8Z/XZvwMgxHgh3 X-Received: by 2002:a05:6102:b0e:b0:472:7496:5eef with SMTP id b14-20020a0561020b0e00b0047274965eefmr448971vst.29.1709121528335; Wed, 28 Feb 2024 03:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121528; cv=none; d=google.com; s=arc-20160816; b=fXsLaalzTTmvZEWYUyAB25j/IdKqaKB/l3KLPSHUIRE0p831QXTWhCPNphODKH7iR7 nkwjDzHag1YGNEAqBcKp2codVtYTrXNad/yNuaIhQRoa+6BsVAtq/rsnBQxGzOqiUMGU sfYzg4j4OiXq0ULw/7LSu/iuLIQevrLRCznWxisriTp94VL6JQKitTzOOE42Vrnu3Plp EWiRT7xXJ0QLV7cDBr6Uez7I9AlAIMBXHSj9eNxg9q3yE8PxPe0Zwcnaexu78tzLzN5I 7wLowvufIJtnTve8jYdcROMVUSYfKMOha0AsR6aVBdFQEdABk6oRa3ySz2UluqnBRoFM GOoA== 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:dkim-signature; bh=50Y7mogdziFCvw5yBy8ZL3I2hfp9Bk8OYzXMu//+nI0=; fh=nzoFRknjvQZ6CjH2p1xlCiKRLUeKrw905Ex+SOWNK6A=; b=BWUEyzsSV1nFqh+piegT/jReLvuLhakTrC0oWHq7VnJAIMd/9/v31BgAyo8+vG9xgL ikcXG/em7DfsUUybZU6c2pRF6GVJgq7W5IoIXZnO4xVWt93YXL5+DVTilke+oxvsS0PK B/YsOG/NI7EsfOgsjldukh7HPe6mgzGP2wXgygQl8UheP5FS1kNZXCfLqYQxA9MHVK9s gl5G/mxxTsK60F0+m2cVNFtjpTxjEgHqU6B7434QzNqKaGFOqzNbigF6eAl1MdeMM0N8 8VsZIUDfV7hQvaswxIkGe0tDjl0c5jNqPzygXC28EHXhbL9UF0DzBCacbuLUoDMArFkp PHnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LwHglSW7; 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 he37-20020a05622a602500b0042df128ecd0si9177714qtb.218.2024.02.28.03.58.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:58:48 -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; dkim=pass header.i=@linaro.org header.s=google header.b=LwHglSW7; 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 1rfIYi-0005k3-0q; Wed, 28 Feb 2024 06:57:12 -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 1rfIYg-0005f9-0N for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:10 -0500 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYb-0005hZ-Jz for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:09 -0500 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2d2505352e6so75410191fa.3 for ; Wed, 28 Feb 2024 03:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121423; x=1709726223; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=50Y7mogdziFCvw5yBy8ZL3I2hfp9Bk8OYzXMu//+nI0=; b=LwHglSW7GPgdomqZcuxYzbABRWalP0zbBRg2MxiVAyw0I6DRMe+Ac7oI1WBfk9Tmyf 0eyuj/SqwfcviG09lbmCwhxckNZHZCLKlZIHy9DUmS2tL+ji0BylQUQnWDpJ7wXpHD38 2uG4ExwRs2embSVsvcorKMBny9AmbXbFl6G3sDjYgXuv8JBPteUg5rGKPY7hk3pygc8k i0DWki/xAyGkYgtLyMnD7wgv7WV2mLvQ9p1ZafhYOj/DkpYlAmMHJGb52JejD/jDlRce YLOgTSmy4pvHAkClqA7dfXjtEJfvXz02XwInOs6EdDaAjD3Ji/Umb9G4XWXxrEYoHA+t ZFsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121423; x=1709726223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=50Y7mogdziFCvw5yBy8ZL3I2hfp9Bk8OYzXMu//+nI0=; b=qDDE6/+fZcanerZUXOQlAG1KnUefvoLxrj+4qknM3bOVs+r9igPyJkQbgFXg65UzSQ SssxDdtaHjuAICnMXnZzzoRPv29gonkRCcEnCzpF7VJKIHVlbgkR1CWrlH/PJbeA3Kzp 6SUGVFDEOQe4TKbqUvPTM0FH40gphjKaCs5+JRy0F2Sc33+3beMw04TI9wa+QWXgjFeS jVsmrC1WdH0SI9Xed6JpJGxfx3e5iTuSMi9W2RTMmyrtSj1j2jZdmGNt+vMp3ff6tYDZ ndOBThQKnNuBqUKa64CTC0ukse76jh4b45akGMGbgCNojqJVqozju1UUdGk9dF9hULV/ 4ThQ== X-Gm-Message-State: AOJu0YwmZewzmKkd3AcZ6ho2Tzr5Hzdoxjb80OLrm9OCxzt8mVNL9m/Q Et2+Kud3nOHl+I1tPyVcV1OZm4YdaA5YrheCe5mSO/vHNpGwAzDijqYuHEYzJx0= X-Received: by 2002:a2e:8902:0:b0:2d2:9e62:64a3 with SMTP id d2-20020a2e8902000000b002d29e6264a3mr3043263lji.6.1709121422775; Wed, 28 Feb 2024 03:57:02 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id s28-20020a05600c319c00b00412a38e732csm1867729wmp.35.2024.02.28.03.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:02 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 05ECF5F8CE; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Peter Maydell , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs) Subject: [PULL 01/29] tests/tcg: update licenses to GPLv2 as intended Date: Wed, 28 Feb 2024 11:56:33 +0000 Message-Id: <20240228115701.1416107-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x229.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=unavailable 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 My default header template is GPLv3 but for QEMU code we really should stick to GPLv2-or-later (allowing others to up-license it if they wish). While this is test code we should still be consistent on the source distribution. I wrote all of this code so its not a problem. However there remains one GPLv3 file left which is the crt0-tc2x.S for TriCore. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-2-alex.bennee@linaro.org> diff --git a/tests/tcg/aarch64/semicall.h b/tests/tcg/aarch64/semicall.h index 8a3fce35c5f..30d4de9a549 100644 --- a/tests/tcg/aarch64/semicall.h +++ b/tests/tcg/aarch64/semicall.h @@ -1,10 +1,10 @@ /* * Semihosting Tests - AArch64 helper * - * Copyright (c) 2019 + * Copyright (c) 2019, 2024 * Written by Alex Bennée * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) diff --git a/tests/tcg/arm/semicall.h b/tests/tcg/arm/semicall.h index ad8ac51310b..624937c5577 100644 --- a/tests/tcg/arm/semicall.h +++ b/tests/tcg/arm/semicall.h @@ -1,10 +1,10 @@ /* * Semihosting Tests - ARM Helper * - * Copyright (c) 2019 + * Copyright (c) 2019, 2024 * Written by Alex Bennée * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) diff --git a/tests/tcg/multiarch/float_helpers.h b/tests/tcg/multiarch/float_helpers.h index 309f3f4bf10..c42ebe64b9e 100644 --- a/tests/tcg/multiarch/float_helpers.h +++ b/tests/tcg/multiarch/float_helpers.h @@ -1,9 +1,9 @@ /* * Common Float Helpers * - * Copyright (c) 2019 Linaro + * Copyright (c) 2019, 2024 Linaro * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ #include diff --git a/tests/tcg/riscv64/semicall.h b/tests/tcg/riscv64/semicall.h index f8c88f32dc5..11d0650cb06 100644 --- a/tests/tcg/riscv64/semicall.h +++ b/tests/tcg/riscv64/semicall.h @@ -1,10 +1,10 @@ /* * Semihosting Tests - RiscV64 Helper * - * Copyright (c) 2021 + * Copyright (c) 2021, 2024 * Written by Alex Bennée * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) diff --git a/tests/tcg/multiarch/arm-compat-semi/semiconsole.c b/tests/tcg/multiarch/arm-compat-semi/semiconsole.c index 1d82efc589d..1e2268f4b75 100644 --- a/tests/tcg/multiarch/arm-compat-semi/semiconsole.c +++ b/tests/tcg/multiarch/arm-compat-semi/semiconsole.c @@ -1,10 +1,10 @@ /* * linux-user semihosting console * - * Copyright (c) 2019 + * Copyright (c) 2024 * Written by Alex Bennée * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ #define SYS_READC 0x07 diff --git a/tests/tcg/multiarch/arm-compat-semi/semihosting.c b/tests/tcg/multiarch/arm-compat-semi/semihosting.c index 8627eee3cf7..f609c01341a 100644 --- a/tests/tcg/multiarch/arm-compat-semi/semihosting.c +++ b/tests/tcg/multiarch/arm-compat-semi/semihosting.c @@ -1,10 +1,10 @@ /* * linux-user semihosting checks * - * Copyright (c) 2019 + * Copyright (c) 2019, 2024 * Written by Alex Bennée * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ #define SYS_WRITE0 0x04 diff --git a/tests/tcg/multiarch/float_convd.c b/tests/tcg/multiarch/float_convd.c index 0a1f0f93dc5..58d7f8b4c58 100644 --- a/tests/tcg/multiarch/float_convd.c +++ b/tests/tcg/multiarch/float_convd.c @@ -1,9 +1,9 @@ /* * Floating Point Convert Doubles to Various * - * Copyright (c) 2019 Linaro + * Copyright (c) 2019, 2024 Linaro * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ #include diff --git a/tests/tcg/multiarch/float_convs.c b/tests/tcg/multiarch/float_convs.c index 2e4fa55324d..cb1fdd439e3 100644 --- a/tests/tcg/multiarch/float_convs.c +++ b/tests/tcg/multiarch/float_convs.c @@ -1,9 +1,9 @@ /* * Floating Point Convert Single to Various * - * Copyright (c) 2019 Linaro + * Copyright (c) 2019, 2024 Linaro * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ #include diff --git a/tests/tcg/multiarch/float_madds.c b/tests/tcg/multiarch/float_madds.c index 4888f8641f4..a692e052d5b 100644 --- a/tests/tcg/multiarch/float_madds.c +++ b/tests/tcg/multiarch/float_madds.c @@ -1,9 +1,9 @@ /* * Fused Multiply Add (Single) * - * Copyright (c) 2019 Linaro + * Copyright (c) 2019, 2024 Linaro * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ #include diff --git a/tests/tcg/multiarch/libs/float_helpers.c b/tests/tcg/multiarch/libs/float_helpers.c index 4e68d2b6598..fad5fc98933 100644 --- a/tests/tcg/multiarch/libs/float_helpers.c +++ b/tests/tcg/multiarch/libs/float_helpers.c @@ -5,9 +5,9 @@ * floating point constants useful for exercising the edge cases in * floating point tests. * - * Copyright (c) 2019 Linaro + * Copyright (c) 2019, 2024 Linaro * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ /* we want additional float type definitions */ diff --git a/tests/tcg/i386/system/boot.S b/tests/tcg/i386/system/boot.S index 9e8920cbfe0..28902c400d8 100644 --- a/tests/tcg/i386/system/boot.S +++ b/tests/tcg/i386/system/boot.S @@ -2,12 +2,12 @@ * i386 boot code, based on qemu-bmibug. * * Copyright 2019 Doug Gale - * Copyright 2019 Linaro + * Copyright 2019, 2024 Linaro * - * This work is licensed under the terms of the GNU GPL, version 3 or later. + * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ .section .head diff --git a/tests/tcg/x86_64/system/boot.S b/tests/tcg/x86_64/system/boot.S index dac9bd534d7..7213aec63b2 100644 --- a/tests/tcg/x86_64/system/boot.S +++ b/tests/tcg/x86_64/system/boot.S @@ -1,16 +1,16 @@ /* * x86_64 boot and support code * - * Copyright 2019 Linaro + * Copyright 2019, 2024 Linaro * - * This work is licensed under the terms of the GNU GPL, version 3 or later. + * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. * * Unlike the i386 version we instead use Xen's PVHVM booting header * which should drop us automatically into 32 bit mode ready to go. I've * nabbed bits of the Linux kernel setup to achieve this. * - * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-License-Identifier: GPL-2.0-or-later */ .section .head From patchwork Wed Feb 28 11:56:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776466 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251225wrn; Wed, 28 Feb 2024 03:59:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUzYoFP7No9th1cc4XLEy2Bcez6EFs3c8nt7yCQT/nqPR2jKPwZ60ArDWScuCbECPRBBDpR1ZM5zXI+KnHzF1u9 X-Google-Smtp-Source: AGHT+IE7U3ilU3p0FhNWC+HB+yp2DrcxKnARDJlT8xkXjyJfkgKFP7zWBCa7gxMcjPj1XA2FvWE2 X-Received: by 2002:a05:6870:d611:b0:21e:c700:a4b1 with SMTP id a17-20020a056870d61100b0021ec700a4b1mr13619323oaq.34.1709121572140; Wed, 28 Feb 2024 03:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121572; cv=none; d=google.com; s=arc-20160816; b=tT6nb6bbx6XGHHMvAOklH3ToWr63+aXiXmt/2ypDPV/PuS/kSwdgqeSzriQaS+F0Q2 udf8WYXY3PI+TndxtYx8GaR4Kl3z+GbGeQpYDY9d4K0+Pe6Dgf8iQqskar9mDuMl6WW0 vhxchNiEaQxr24jylyjjBYn3FnHolsKcNwbqMfk1FKLNacgto2sRS6OQ+dh/gGppBTn8 Ruy4ED650fakguoF0c4tX3UjeFDqPLI9ztikZLF5lWvHmWLL5NyUobnXG4+gETY/lYUe lRYF79WnyjexuRMpUYeCNqnqBHHibUq7TXJcIQG1RCFWI0P4Rq2Nx7aDDnzpZeo5bbfr YwVg== 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:dkim-signature; bh=BHV/xSviQ+mksdG51pmI4mQIX2turcSeLOZCoK5M7sg=; fh=OcaYDyibnksHeS5Q4sYP8x74o+MLuRR8AV9fLekR3K8=; b=FQEuiheCbRG9eWW/L6HY0ABTfX4/bsE6YSTLB45jNn5z7KjEs/zS9mijFdMQXi/H2c ef/S3vf4l9OMGbb2K+QLDFcq4znA5uN7k35qE0QLe7axK09v28RrqQlr4xFF8t51B0DV iuhcYWNKCLmK7Mr11JXNucmj/3cVE5S3uebIBJ2i/EMZaB9I7lIwgZ7F73KvV3Hp3xjW HDNZWkqkXPframedOw5Vxe/7ZatIQk+HDou89Cy4QsPpqnBLju8a0KfPybTowukzRUfu cTJgRsNlqiwlYh8PF/GJNMdxYROZj40AvHrL/ljGsgEf0+q8XvGG7LgUFIc5OeChAA8M zgjw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l9S9IMzD; 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 w1-20020ac87181000000b0042e6a088f0csi9300273qto.786.2024.02.28.03.59.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:59:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=l9S9IMzD; 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 1rfIYh-0005hS-TJ; Wed, 28 Feb 2024 06:57:11 -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 1rfIYf-0005es-Ip for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:09 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYb-0005hg-MQ for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:09 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-412b434effaso3737105e9.2 for ; Wed, 28 Feb 2024 03:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121423; x=1709726223; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BHV/xSviQ+mksdG51pmI4mQIX2turcSeLOZCoK5M7sg=; b=l9S9IMzDxy9+OL3L2W3b1aoEzV9VAVdh95fQotjqCEpPN5jwA1e7cMgJ+X7AkVq6c0 IU3hQNS4HyHpssItGBRPsmh2M+lHVDHYRFKKPJi8KumDq15YzqIuwxdgaoc6VKBsOOlh 4edpedVAZMdKHT5vMQVKlP70B1CrxvmkXTRVIycKdKS0hlKKnmTrqXXccU3AwjoyMWba 08JqXhfgyK4OkhyXuprb4NUhmS7xUqMcCkQJnaHcN9cyTkFtPjiqxqMEHwIzmpTuZ1QL 0hR1mEeR0h4ixhi2Zo9OKPYoP3DUGD/CfscTtseS+uH9GR2g/Nox4Q0msx1Dw0wcuVp3 H/Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121423; x=1709726223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BHV/xSviQ+mksdG51pmI4mQIX2turcSeLOZCoK5M7sg=; b=QwsWXRZW5yt1GkMa5WMWYBxOdpvTzA+O376/ERU10O30bL+dhNV8ewKjvDKXkAk1Oq 2enEPC0AU62JisG8RE6lwQrqArv4WeJF9A9fh/cZvJdhr86zFustwwtFsMrId29ncIKM HSG6p7rfXThsDQXsYojT/NFlMEl/IhyirbaDJsqncTcg3a653uW5rqtUq4ELVup121zN yy7qLW8RMliq7Lmdr3u9v2oMcRjrcYcJgbeff1MDW6V2KfDfOHH60NYGo7q8lHLTlT+Z YAqUPWy4K0ZHSTKGJdnsWZTm70zPnBKBTdoPre414XAP9nl7IZKJEIkiQpLHNT3MRaIS Fh5Q== X-Gm-Message-State: AOJu0YwkVrhiAgVCD2gH5L4J/8uQtXSfojnAQGKCyBTjdTMXIr5aTcOe +7GlS4N7kV9ayqHQ/pPqfBMFTsOxk5O0/OqpIwJle8L4h+3TDw27MVq8CejXius= X-Received: by 2002:a5d:4fd2:0:b0:33c:dd02:f652 with SMTP id h18-20020a5d4fd2000000b0033cdd02f652mr9238497wrw.10.1709121423348; Wed, 28 Feb 2024 03:57:03 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f14-20020adff98e000000b0033cf60e268fsm14397650wrr.116.2024.02.28.03.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:02 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 1A0B25F8F7; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 02/29] tests/tcg: bump TCG test timeout to 120s Date: Wed, 28 Feb 2024 11:56:34 +0000 Message-Id: <20240228115701.1416107-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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 This is less than ideal but easier than making sure we get all the iterations of the memory test. Update the comment accordingly. Reviewed-by: Thomas Huth Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-3-alex.bennee@linaro.org> diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 8cf65f68dd8..a4c25908fb7 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -93,12 +93,9 @@ QEMU_OPTS= # If TCG debugging, or TCI is enabled things are a lot slower -# ??? Makefile no longer has any indication that TCI is enabled, -# but for the record: -# 15s original default -# 60s with --enable-debug -# 90s with --enable-tcg-interpreter -TIMEOUT=90 +# so we have to set our timeout for that. The current worst case +# offender is the system memory test running under TCI. +TIMEOUT=120 ifeq ($(filter %-softmmu, $(TARGET)),) # The order we include is important. We include multiarch first and From patchwork Wed Feb 28 11:56:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776461 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp250867wrn; Wed, 28 Feb 2024 03:58:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXb6cT/SamHMeEH4V/PVva3H83MaeW1nGdWXw8K2Oy3BcIHZj3kiyjzcAwhWeUdxWDHQVarxctgjIbXpbT+tmQP X-Google-Smtp-Source: AGHT+IHyay80K/micMhTWWax5p1NUApEMELz90RlSoc85vX2Urb42hqwvVVIBBGfpxgYS6AbGcm/ X-Received: by 2002:a67:ee07:0:b0:470:5515:d8f4 with SMTP id f7-20020a67ee07000000b004705515d8f4mr10017162vsp.31.1709121502772; Wed, 28 Feb 2024 03:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121502; cv=none; d=google.com; s=arc-20160816; b=tfDv06ta5EJSW15OS4bQ9/OR7GABrlD5Qm9Wiq5tzbkC3iGc7BUXZ6sdzrZtiRfTT+ 23IIWkklnbYrGS9qlETmmcXSCQ5h1Ea939TlqutgeOeARFtFFVxzuKBhIz65asEDvyMS EGL/tQEaya5ca3R1+ki2vizBYXrkjipRc+NPx5Y0XJdLHA2Vu1qF7mV1+/5v9OT8bvgP 0QrsMNcH/gvfUI6h8KjB/2egv6pe7GpWw0ESFConJY48H9LEeSjc05P1y6FTV8zI4FhN PAiHpSmQcp0GHiTqZii58dhAq50+tGQtdZ+1lJOFw+FVrFBI93aOGHy6sIO6FkdvMHoe hmKg== 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:dkim-signature; bh=Ey89Hl01uX5rJaJ7gx3TbpJ+bjSISZiGwEb8QHXuSjE=; fh=MB7eYd7rnLrXI3nJ9rdxTzQtDWXNOvVrI/pGOS81ev0=; b=YZZ8O/8/zv+reVmx8JQIN0CHPtg+5dEa3ovDqr1FcSF2hZudf6vk58f6mcl+78CdjV DMo5zW+u6Cdt7nuzbgqJ0tYO4T5A2aHF/U/iErLvUL90kDRHpQSAkYqBO7FPvPwjnWO9 af+JDwl792Ve6eeqKva+O3jSdFgdJH5Ak6fX1r32JtlO/AKMF6GOUTJ4jKy3zjP1nM7G H99TjsQS3+sBmQW/jh58VVnd8jbBbBEdLGcSCn8n3uHlhLJH797SFNXFQ5qjgfHcOx3x Ntje5IiWhEDyv3ema9VERYKa1N3mnPZ1iEkIPAJ+E5iMTWulV3MT7AHDjf9atcIFhD2v lwAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KhBFcJns; 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 l9-20020ac84a89000000b0042dd04fe2b7si9404413qtq.294.2024.02.28.03.58.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:58:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=KhBFcJns; 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 1rfIYk-0005ns-SY; Wed, 28 Feb 2024 06:57:14 -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 1rfIYi-0005la-Qa for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:12 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYc-0005hf-AL for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:12 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33dd2f0a0c4so2337621f8f.0 for ; Wed, 28 Feb 2024 03:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121423; x=1709726223; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ey89Hl01uX5rJaJ7gx3TbpJ+bjSISZiGwEb8QHXuSjE=; b=KhBFcJnsRzWa9jYEiZv+G5/UCNmvGJKrqa/bWBIRZPHOOavnshpBVafjJ6AuU4tzMf 6Q6B2LmJfYPyFfjSKbtRZUyRzH/sOIl+uqgVr2bk/njvrkI5XBS3zWCU0I16uQ7+1lhz BU09XBvCPKxOczi+EH+eEogavDHeMlhHMeDWjk3qUmO02hemzNNjJ8G3Xb9Sv8UFSkoU TQ0vmPkYgLnfe6AzCm2Yr9gdGXn5O/cYsfakcNLFpheadQ6om3tE3FLNjUao/2+0TYo3 DDYIPFQJdc0AFqPe8xBuAQpBDMeeL5Azv0wpKjE4JIduU7Jv04virA6z4LrTqWi1HkwZ r23w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121423; x=1709726223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ey89Hl01uX5rJaJ7gx3TbpJ+bjSISZiGwEb8QHXuSjE=; b=QF8lErB7b+c5g6DoGzdb0e8rAud87WZC+esyjvq4tCFAsKdBDX7pPFDlei4raRgKIj TplBPMtVUWm/tU2sx+GnnuVylBs/yZFM8/HCYzRPZ/Wr4LAG6+iNASkP60XDErYvO0qb BkW5qUbqsbTeegqLv0SMyF+11wwNKZmj6tsuy+jQR0yOuYIfZwlRMfQz7RNPvbhu6lvl tmG4lJygvkAKanVJkzZxi6Z+2jGUNwJ8OScbsK5SQiRYyRBCYufzv4IbcnmfnY1XNovd Z8ePwtFM2OuxX1C5VG3eIzwf09dlwKv73sRyFx6YhdP/ofhz2aGv+dNqmBr8skpXG62w /yrQ== X-Gm-Message-State: AOJu0YyhDIz2YAnnb43KG4mnA0Xtt52r4OwVdcmRvpt7IhGmDnrPjhZR phVKMXiHL9bnwp7QWnQCfYT9J5N1AyjKD9F+H8CCvFOaD6ca5r+9KkgZtcEgYMg= X-Received: by 2002:adf:f60f:0:b0:33d:77e:43ab with SMTP id t15-20020adff60f000000b0033d077e43abmr8397438wrp.34.1709121423170; Wed, 28 Feb 2024 03:57:03 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id g7-20020adfe407000000b0033d2ae84fafsm14265079wrm.52.2024.02.28.03.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:02 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2EF035F8F9; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PULL 03/29] tests/vm: avoid re-building the VM images all the time Date: Wed, 28 Feb 2024 11:56:35 +0000 Message-Id: <20240228115701.1416107-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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 The main problem is that "check-venv" is a .PHONY target will always evaluate and trigger a full re-build of the VM images. While its tempting to drop it from the dependencies that does introduce a breakage on freshly configured builds. Fortunately we do have the otherwise redundant --force flag for the script which up until now was always on. If we make the usage of --force conditional on dependencies other than check-venv triggering the update we can avoid the costly rebuild and still run cleanly on a fresh checkout. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2118 Reviewed-by: Thomas Huth Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-4-alex.bennee@linaro.org> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index bf12e0fa3c5..ac56824a87d 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -102,7 +102,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(if $(LOG_CONSOLE),--log-console) \ --source-path $(SRC_PATH) \ --image "$@" \ - --force \ + $(if $(filter-out check-venv, $?), --force) \ --build-image $@, \ " VM-IMAGE $*") diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index c0d62c08031..f8fd751eb14 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -646,9 +646,9 @@ def main(vmcls, config=None): vm = vmcls(args, config=config) if args.build_image: if os.path.exists(args.image) and not args.force: - sys.stderr.writelines(["Image file exists: %s\n" % args.image, + sys.stderr.writelines(["Image file exists, skipping build: %s\n" % args.image, "Use --force option to overwrite\n"]) - return 1 + return 0 return vm.build_image(args.image) if args.build_qemu: vm.add_source_dir(args.build_qemu) From patchwork Wed Feb 28 11:56:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776473 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp252080wrn; Wed, 28 Feb 2024 04:01:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWVcnlFX1/yrE7kpKm5gT6iHzv1606/ZDtlindKueV8D5dGeF5ghV1HCKozQVCX53neTts6Algrc0a6VUB+ZZsr X-Google-Smtp-Source: AGHT+IGc5A0zMKKB3ciiZxGejr9WhrU8Igjzpv4+b1XASAYDQ+rnlwcaNGIz1IKZgBd2k5ZgRMeO X-Received: by 2002:a05:6214:5010:b0:68f:19a7:cd4e with SMTP id jo16-20020a056214501000b0068f19a7cd4emr5065086qvb.33.1709121677397; Wed, 28 Feb 2024 04:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121677; cv=none; d=google.com; s=arc-20160816; b=bhMSegMhhQ2e6itZNH6ibaJsqG8wwDgsBo1rkhuaEdyrdZWdRQH1w2hTI6hVYIHvDK +/KYkTDC+ZDoFL9ky7ByJ7VvFYb3xx5CWQgzNDaDVHChYpe6/pN8sPIWld6Bg1CX51pT ge7qE3qnpZO56Xq1GFFDZgYs3TRdEn4ZgeNfes6d9SFVTKRS8c8zmXJeg296c7skwEQ/ hSf9dYJB/YxFFFsQ0jkNXi9klDlDvCIsHoNsfXdgaDf76TCv0ysShHbuk6JxjeSTay9V niDJBjOThR9gPNRnxpd6uWSnoQ3V0wJd2iOoDbwjuza4QaPIqw8iUYKlYLR3hCXWNSlJ lLdA== 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:dkim-signature; bh=zu0/8AOzvmmeDKRaP7W/OXKcr7paiZGUbKkGoq3Xhmw=; fh=yJqklVec6AnfkSW10xOfcQAM1ERMyT0wAj8+diXpr2Q=; b=ZqgVWQkmKag6kWg4G0XNvVc4KbVsdkOTdACUAp2Y9Sw0FWwKvGQ3QcO1a7Lgw0CJmN n71w9FnUGarfow3OvwgDAksMiK4+TsL709AiS+FtzSxV6cfxiFoeFHG4NVbzhrLjHK0N Uxo28CRWaEpOJl03MBbPYVwDERYS/LEKdzwvvwjCFej02O19cdrPk0agl7f7Z0k/HOdE +kHIWd5JsTBhPv2epGKHFs+CeyNeavDzbG+1GX20LhU2U+2KP9ydxiTA4OOcCXbxoBD/ J8Cf12vwsj0BChtLL+HINcQXXhjmnFa+mUUaDdegPqlXQEU7pbDtxqBvP8Bb4n7SR/XK hffw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dTYrz3vR; 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 eq6-20020ad45966000000b006903e844ab1si212290qvb.56.2024.02.28.04.01.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:01:17 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dTYrz3vR; 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 1rfIYm-0005on-FX; Wed, 28 Feb 2024 06:57: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 1rfIYj-0005mg-VG for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:13 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYe-0005iU-37 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:13 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33d32f74833so2962240f8f.3 for ; Wed, 28 Feb 2024 03:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121426; x=1709726226; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zu0/8AOzvmmeDKRaP7W/OXKcr7paiZGUbKkGoq3Xhmw=; b=dTYrz3vRS6wA533WHSNhsGJwAOQYNp+rPtcYQqAkYBtcy/L1eMJHRFf3h7b5LXT3V9 O8SChwl3g0PjB1TeSsgwAeLfHlVsd73EePEbxU83PKW/MU1ptq70mIjXqt2wW9WF/l/y ZgWovKVNnad61MMSCAY0c0hV5Hwk9bA4gudeEIlyrpmjAqHArw7kQU8scgwmHj0Xqn/3 qe8eVoOP+QhwmTXaJ1iStpxhMBacMsnMW1qZRrd2coZygnMBj7kE6do2pjk0CfSUhHuc HdyGwwVOCnFwr2ceVDzygulOvYigELbbZvhTRIPHZ+zfA5x6ld9N3YJgg0xnnBwldcPt qm/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121426; x=1709726226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zu0/8AOzvmmeDKRaP7W/OXKcr7paiZGUbKkGoq3Xhmw=; b=hvd6I4c/eXyVHMnUexbHla0WWYwlksIPhTXLUUggCQD4w/HS7StSdSk/x3uR5WKg1L 94/W6C3UM6OryJmf6ucuBr95n9ciXm3ytEUg1tlONyCow7KIwVCl1MdPWffh/sclkOsJ lT/RT1tTVFwd5HCjdgM+NUrJ50PVqXF8eRPH3u981HjJuHnEdcbLX7qoxGa0jtbjOHdD RHc6X+NhTWWKNvH1njGasq4pKCqdOOHGMvV/p/udAALmud4yb1mQ/IePg/8ggba0F6Fs 7zsXjvSF8AThF87qqQtDe/kBqoLafWdPuZk/xCbVvVvDedlKdEK6T8xmBDgDUDjg0Utu yEhw== X-Gm-Message-State: AOJu0YwKjVQ5WUeidQrYhMaG7mZNuVUfLTMlHs8leCLk9jhUWuexIj9e RVbwQ2J5b109kkkzguGC9Sk/DHt1w2bFYaRCDDvEU4SbE4PMAgnbCINrIhbkjM8= X-Received: by 2002:adf:cd89:0:b0:33d:3830:769c with SMTP id q9-20020adfcd89000000b0033d3830769cmr9030460wrj.65.1709121426495; Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bt21-20020a056000081500b0033b48190e5esm14789920wrb.67.2024.02.28.03.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:02 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 417345F8FC; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Warner Losh , Kyle Evans , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Brad Smith Subject: [PULL 04/29] tests/vm: update openbsd image to 7.4 Date: Wed, 28 Feb 2024 11:56:36 +0000 Message-Id: <20240228115701.1416107-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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 The old links are dead so even if we have the ISO cached we can't finish the install. Update to the current stable and tweak the install strings. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2192 Tested-by: Thomas Huth Reviewed-by: Thomas Huth Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-5-alex.bennee@linaro.org> diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 85c5bb3536c..85c98636332 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -22,8 +22,8 @@ class OpenBSDVM(basevm.BaseVM): name = "openbsd" arch = "x86_64" - link = "https://cdn.openbsd.org/pub/OpenBSD/7.2/amd64/install72.iso" - csum = "0369ef40a3329efcb978c578c7fdc7bda71e502aecec930a74b44160928c91d3" + link = "https://cdn.openbsd.org/pub/OpenBSD/7.4/amd64/install74.iso" + csum = "a1001736ed9fe2307965b5fcdb426ae11f9b80d26eb21e404a705144a0a224a0" size = "20G" pkgs = [ # tools @@ -99,10 +99,10 @@ class OpenBSDVM(basevm.BaseVM): self.console_wait_send("(I)nstall", "i\n") self.console_wait_send("Terminal type", "xterm\n") self.console_wait_send("System hostname", "openbsd\n") - self.console_wait_send("Which network interface", "vio0\n") + self.console_wait_send("Network interface to configure", "vio0\n") self.console_wait_send("IPv4 address", "autoconf\n") self.console_wait_send("IPv6 address", "none\n") - self.console_wait_send("Which network interface", "done\n") + self.console_wait_send("Network interface to configure", "done\n") self.console_wait("Password for root account") self.console_send("%s\n" % self._config["root_pass"]) self.console_wait("Password for root account") @@ -124,6 +124,7 @@ class OpenBSDVM(basevm.BaseVM): self.console_wait_send("Allow root ssh login", "yes\n") self.console_wait_send("timezone", "UTC\n") self.console_wait_send("root disk", "\n") + self.console_wait_send("Encrypt the root disk with a passphrase", "no\n") self.console_wait_send("(W)hole disk", "\n") self.console_wait_send("(A)uto layout", "c\n") From patchwork Wed Feb 28 11:56:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776474 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp252079wrn; Wed, 28 Feb 2024 04:01:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXzcHl9NJR/z8Yi8dzUcGwT3R8gdN3DSS8C1/q0Kh/dS3Cpvf+ejhzQixMWU1/dj+bEvFyPL5qM7ptVUtyc95AJ X-Google-Smtp-Source: AGHT+IF+9z9B885pqSDVu9GsubMq6Lm2lJbCKYWklqRaNCACG0uC/GV91IW+8K0AX9452IzT0RDY X-Received: by 2002:a05:6808:30a9:b0:3c1:b040:8072 with SMTP id bl41-20020a05680830a900b003c1b0408072mr4910127oib.4.1709121677340; Wed, 28 Feb 2024 04:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121677; cv=none; d=google.com; s=arc-20160816; b=L8A7O90DxUzQEN08JqKADQEkqWWrbZoc6ypFhNYR7GdO4gh8IPoaI8yFcXCoIEFHSp cqRb3zx5VSgbPUWzOIuJGC/sLD4RKFg74IsWpw9lDig3NSAuI3ZB/y/+Fn2AN2eQu0GQ HdYFKiipHQ/Z6KJ1htcUdaVyCrEuJWULGKLrvIycDdUQs9RRbfAAKuejqwPi1jYqhE8g P+XbZYWiNOf5u90G79yeT0OiswEodYUSDZVUvRVJqJBLt/LebrBrhjhFpHNjtUJPoud/ VWgpEKA9auu54NY9u/GIjnwXhbuG0iBVBuZjZXendCMro9FY5dRCZwRaRDctJMoORgPS G0vA== 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:dkim-signature; bh=w/onYrl8VqcRCugRowbFPMU3NNAaZI+mb0EF5o1keEo=; fh=ciSoQgqucu/oEfZlaB6nZdSrNnqkgtVavnibiIeOass=; b=m4BrUbSYYEL1KK45ve+SrFGBnn0sAhYe56yoXKSwgZMpK6rvFrc39GlnTBSK0IhzLh jKHcNxnTv+u7PuRkh/AdjZyhCUrJlm1OHjwzzXpUNnRXfGZsTv7zRSlKMRmM93aWphzS HPJiis4t4Y8SnbvakvsjaPDAcJDu0+7jTRsb3ZjnJCwzFF5mj2sUZt5YcLzqOEldykw9 sSGtBb5lHP5SmukKARJd4Jap3lvXMR47hd5yGlVzik40c0jHJEzxqOpfSi9MuWYmBm2F 8tv4QHv7oJFn47M3vZqaw0yPJbK8bBZNy9VQYp1r8F4FV8E5c4TP7nl5NfvHdLA7jx13 i2iA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T3NoaZss; 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 l17-20020ac848d1000000b0042e61e8513asi9442797qtr.418.2024.02.28.04.01.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:01:17 -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; dkim=pass header.i=@linaro.org header.s=google header.b=T3NoaZss; 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 1rfIZ0-000661-9h; Wed, 28 Feb 2024 06:57:30 -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 1rfIYv-000608-1u for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:25 -0500 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 1rfIYm-0005lm-Am for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:24 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-412a3ebad2aso25500945e9.1 for ; Wed, 28 Feb 2024 03:57:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121433; x=1709726233; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w/onYrl8VqcRCugRowbFPMU3NNAaZI+mb0EF5o1keEo=; b=T3NoaZss8a3AFZEP66syaiX3IXRBvArEFWkxfinbc9llQ09mp6eTt9t1BeYgB4Fyi+ 3Me79vcS1lFZ+l7WnDpcc8pbkWerSzDdfbBBTioe7ZOQg9v3CwEvSiuBD07h6BjcML5+ Bp/75yYU1WS+IyXT8Abv6wT1RJfHBgzlaMSd2lnQxkk6GbBd4yaZIzNu+wzeItRAZwX+ GH6v5asxTC9Y63l3kvndg4wsRvY2CK1L3aRQRKult7uvEvLmxl/e05DgO6/gpG6XV7Ch eGvargU/zHY0SWX64K9/hpbsLFxLnC9YaJWeIed7s5Rlc/bSs+9XpHdBxTunizRk3zNw CZsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121433; x=1709726233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w/onYrl8VqcRCugRowbFPMU3NNAaZI+mb0EF5o1keEo=; b=XavCMsmtpvxH2zmNlrR3ASlgqKFQqPGWxjQDEZcaNV4ty5zGmgyhjqBA00lVTNSToW OOStLy/URBHcPXu5FUSdfCNa8qViO1Pm2nHbWzGTxelBrOCmfIafU24ATSRk+qUuDi3b r46OhVpUJvTer2GTXyadu5Kf/i59wCtLC5I7WV19h/8XY8yhM7wNi04MTy4Eh0kwloaK OYFV9lrz09za+WO5KHVZDw58Kv1iLpRFYDrkjCIOR0Maz2RR4qD7ulfbUZ3lA5VegOeG Dz/IUDFT/BtgnGyXG9dTnHkReDMCpqiWTWzpZkVgB0NZFKQeM8DW3HmH3LbARKIvteKp tOxg== X-Gm-Message-State: AOJu0Yyi5ZomUUMYcMemQy1by3HZnv/Bzxpy+DqCFwkNA2jVCgRzFEke UE8ViiHjU2Hut249O4MvMaVQoHDbark/4ltgxSZXivd1SQPWCDttgMg6rfFAzCgLJxaxLiESjCO d X-Received: by 2002:a05:600c:4fcb:b0:410:85ab:67f3 with SMTP id o11-20020a05600c4fcb00b0041085ab67f3mr10685881wmq.21.1709121433269; Wed, 28 Feb 2024 03:57:13 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id h11-20020a05600c314b00b00412b68cc169sm773793wmo.16.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 58BCC5F8FE; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PULL 05/29] target/arm: Use GDBFeature for dynamic XML Date: Wed, 28 Feb 2024 11:56:37 +0000 Message-Id: <20240228115701.1416107-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@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=unavailable 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 In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki Acked-by: Richard Henderson Message-Id: <20231213-gdb-v17-1-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-6-alex.bennee@linaro.org> diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 63f31e0d984..508a9c1e0d6 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -25,6 +25,7 @@ #include "hw/registerfields.h" #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "exec/gdbstub.h" #include "qapi/qapi-types-common.h" #include "target/arm/multiprocessing.h" #include "target/arm/gtimer.h" @@ -117,23 +118,21 @@ */ /** - * DynamicGDBXMLInfo: - * @desc: Contains the XML descriptions. - * @num: Number of the registers in this XML seen by GDB. + * DynamicGDBFeatureInfo: + * @desc: Contains the feature descriptions. * @data: A union with data specific to the set of registers * @cpregs_keys: Array that contains the corresponding Key of * a given cpreg with the same order of the cpreg * in the XML description. */ -typedef struct DynamicGDBXMLInfo { - char *desc; - int num; +typedef struct DynamicGDBFeatureInfo { + GDBFeature desc; union { struct { uint32_t *keys; } cpregs; } data; -} DynamicGDBXMLInfo; +} DynamicGDBFeatureInfo; /* CPU state for each instance of a generic timer (in cp15 c14) */ typedef struct ARMGenericTimer { @@ -855,10 +854,10 @@ struct ArchCPU { uint64_t *cpreg_vmstate_values; int32_t cpreg_vmstate_array_len; - DynamicGDBXMLInfo dyn_sysreg_xml; - DynamicGDBXMLInfo dyn_svereg_xml; - DynamicGDBXMLInfo dyn_m_systemreg_xml; - DynamicGDBXMLInfo dyn_m_secextreg_xml; + DynamicGDBFeatureInfo dyn_sysreg_feature; + DynamicGDBFeatureInfo dyn_svereg_feature; + DynamicGDBFeatureInfo dyn_m_systemreg_feature; + DynamicGDBFeatureInfo dyn_m_secextreg_feature; /* Timers used by the generic (architected) timer */ QEMUTimer *gt_timer[NUM_GTIMERS]; diff --git a/target/arm/internals.h b/target/arm/internals.h index 50bff445494..05eb9daac7d 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1451,7 +1451,7 @@ static inline uint64_t pmu_counter_mask(CPUARMState *env) } #ifdef TARGET_AARCH64 -int arm_gen_dynamic_svereg_xml(CPUState *cpu, int base_reg); +GDBFeature *arm_gen_dynamic_svereg_feature(CPUState *cpu, int base_reg); int aarch64_gdb_get_sve_reg(CPUARMState *env, GByteArray *buf, int reg); int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg); int aarch64_gdb_get_fpu_reg(CPUARMState *env, GByteArray *buf, int reg); diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index 28f546a5ff9..5949adfb31a 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -26,11 +26,11 @@ #include "cpu-features.h" #include "cpregs.h" -typedef struct RegisterSysregXmlParam { +typedef struct RegisterSysregFeatureParam { CPUState *cs; - GString *s; + GDBFeatureBuilder builder; int n; -} RegisterSysregXmlParam; +} RegisterSysregFeatureParam; /* Old gdb always expect FPA registers. Newer (xml-aware) gdb only expect whatever the target description contains. Due to a historical mishap @@ -216,7 +216,7 @@ static int arm_gdb_get_sysreg(CPUARMState *env, GByteArray *buf, int reg) const ARMCPRegInfo *ri; uint32_t key; - key = cpu->dyn_sysreg_xml.data.cpregs.keys[reg]; + key = cpu->dyn_sysreg_feature.data.cpregs.keys[reg]; ri = get_arm_cp_reginfo(cpu->cp_regs, key); if (ri) { if (cpreg_field_is_64bit(ri)) { @@ -233,34 +233,32 @@ static int arm_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) return 0; } -static void arm_gen_one_xml_sysreg_tag(GString *s, DynamicGDBXMLInfo *dyn_xml, +static void arm_gen_one_feature_sysreg(GDBFeatureBuilder *builder, + DynamicGDBFeatureInfo *dyn_feature, ARMCPRegInfo *ri, uint32_t ri_key, - int bitsize, int regnum) + int bitsize, int n) { - g_string_append_printf(s, "name); - g_string_append_printf(s, " bitsize=\"%d\"", bitsize); - g_string_append_printf(s, " regnum=\"%d\"", regnum); - g_string_append_printf(s, " group=\"cp_regs\"/>"); - dyn_xml->data.cpregs.keys[dyn_xml->num] = ri_key; - dyn_xml->num++; + gdb_feature_builder_append_reg(builder, ri->name, bitsize, n, + "int", "cp_regs"); + + dyn_feature->data.cpregs.keys[n] = ri_key; } -static void arm_register_sysreg_for_xml(gpointer key, gpointer value, - gpointer p) +static void arm_register_sysreg_for_feature(gpointer key, gpointer value, + gpointer p) { uint32_t ri_key = (uintptr_t)key; ARMCPRegInfo *ri = value; - RegisterSysregXmlParam *param = (RegisterSysregXmlParam *)p; - GString *s = param->s; + RegisterSysregFeatureParam *param = p; ARMCPU *cpu = ARM_CPU(param->cs); CPUARMState *env = &cpu->env; - DynamicGDBXMLInfo *dyn_xml = &cpu->dyn_sysreg_xml; + DynamicGDBFeatureInfo *dyn_feature = &cpu->dyn_sysreg_feature; if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_NO_GDB))) { if (arm_feature(env, ARM_FEATURE_AARCH64)) { if (ri->state == ARM_CP_STATE_AA64) { - arm_gen_one_xml_sysreg_tag(s , dyn_xml, ri, ri_key, 64, - param->n++); + arm_gen_one_feature_sysreg(¶m->builder, dyn_feature, + ri, ri_key, 64, param->n++); } } else { if (ri->state == ARM_CP_STATE_AA32) { @@ -269,32 +267,32 @@ static void arm_register_sysreg_for_xml(gpointer key, gpointer value, return; } if (ri->type & ARM_CP_64BIT) { - arm_gen_one_xml_sysreg_tag(s , dyn_xml, ri, ri_key, 64, - param->n++); + arm_gen_one_feature_sysreg(¶m->builder, dyn_feature, + ri, ri_key, 64, param->n++); } else { - arm_gen_one_xml_sysreg_tag(s , dyn_xml, ri, ri_key, 32, - param->n++); + arm_gen_one_feature_sysreg(¶m->builder, dyn_feature, + ri, ri_key, 32, param->n++); } } } } } -static int arm_gen_dynamic_sysreg_xml(CPUState *cs, int base_reg) +static GDBFeature *arm_gen_dynamic_sysreg_feature(CPUState *cs, int base_reg) { ARMCPU *cpu = ARM_CPU(cs); - GString *s = g_string_new(NULL); - RegisterSysregXmlParam param = {cs, s, base_reg}; - - cpu->dyn_sysreg_xml.num = 0; - cpu->dyn_sysreg_xml.data.cpregs.keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs)); - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, ""); - g_hash_table_foreach(cpu->cp_regs, arm_register_sysreg_for_xml, ¶m); - g_string_append_printf(s, ""); - cpu->dyn_sysreg_xml.desc = g_string_free(s, false); - return cpu->dyn_sysreg_xml.num; + RegisterSysregFeatureParam param = {cs}; + gsize num_regs = g_hash_table_size(cpu->cp_regs); + + gdb_feature_builder_init(¶m.builder, + &cpu->dyn_sysreg_feature.desc, + "org.qemu.gdb.arm.sys.regs", + "system-registers.xml", + base_reg); + cpu->dyn_sysreg_feature.data.cpregs.keys = g_new(uint32_t, num_regs); + g_hash_table_foreach(cpu->cp_regs, arm_register_sysreg_for_feature, ¶m); + gdb_feature_builder_end(¶m.builder); + return &cpu->dyn_sysreg_feature.desc; } #ifdef CONFIG_TCG @@ -386,31 +384,29 @@ static int arm_gdb_set_m_systemreg(CPUARMState *env, uint8_t *buf, int reg) return 0; /* TODO */ } -static int arm_gen_dynamic_m_systemreg_xml(CPUState *cs, int orig_base_reg) +static GDBFeature *arm_gen_dynamic_m_systemreg_feature(CPUState *cs, + int base_reg) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; - GString *s = g_string_new(NULL); - int base_reg = orig_base_reg; + GDBFeatureBuilder builder; + int reg = 0; int i; - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, "\n"); + gdb_feature_builder_init(&builder, &cpu->dyn_m_systemreg_feature.desc, + "org.gnu.gdb.arm.m-system", "arm-m-system.xml", + base_reg); for (i = 0; i < ARRAY_SIZE(m_sysreg_def); i++) { if (arm_feature(env, m_sysreg_def[i].feature)) { - g_string_append_printf(s, - "\n", - m_sysreg_def[i].name, base_reg++); + gdb_feature_builder_append_reg(&builder, m_sysreg_def[i].name, 32, + reg++, "int", NULL); } } - g_string_append_printf(s, ""); - cpu->dyn_m_systemreg_xml.desc = g_string_free(s, false); - cpu->dyn_m_systemreg_xml.num = base_reg - orig_base_reg; + gdb_feature_builder_end(&builder); - return cpu->dyn_m_systemreg_xml.num; + return &cpu->dyn_m_systemreg_feature.desc; } #ifndef CONFIG_USER_ONLY @@ -428,31 +424,31 @@ static int arm_gdb_set_m_secextreg(CPUARMState *env, uint8_t *buf, int reg) return 0; /* TODO */ } -static int arm_gen_dynamic_m_secextreg_xml(CPUState *cs, int orig_base_reg) +static GDBFeature *arm_gen_dynamic_m_secextreg_feature(CPUState *cs, + int base_reg) { ARMCPU *cpu = ARM_CPU(cs); - GString *s = g_string_new(NULL); - int base_reg = orig_base_reg; + GDBFeatureBuilder builder; + char *name; + int reg = 0; int i; - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, "\n"); + gdb_feature_builder_init(&builder, &cpu->dyn_m_secextreg_feature.desc, + "org.gnu.gdb.arm.secext", "arm-m-secext.xml", + base_reg); for (i = 0; i < ARRAY_SIZE(m_sysreg_def); i++) { - g_string_append_printf(s, - "\n", - m_sysreg_def[i].name, base_reg++); - g_string_append_printf(s, - "\n", - m_sysreg_def[i].name, base_reg++); + name = g_strconcat(m_sysreg_def[i].name, "_ns", NULL); + gdb_feature_builder_append_reg(&builder, name, 32, reg++, + "int", NULL); + name = g_strconcat(m_sysreg_def[i].name, "_s", NULL); + gdb_feature_builder_append_reg(&builder, name, 32, reg++, + "int", NULL); } - g_string_append_printf(s, ""); - cpu->dyn_m_secextreg_xml.desc = g_string_free(s, false); - cpu->dyn_m_secextreg_xml.num = base_reg - orig_base_reg; + gdb_feature_builder_end(&builder); - return cpu->dyn_m_secextreg_xml.num; + return &cpu->dyn_m_secextreg_feature.desc; } #endif #endif /* CONFIG_TCG */ @@ -462,14 +458,14 @@ const char *arm_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) ARMCPU *cpu = ARM_CPU(cs); if (strcmp(xmlname, "system-registers.xml") == 0) { - return cpu->dyn_sysreg_xml.desc; + return cpu->dyn_sysreg_feature.desc.xml; } else if (strcmp(xmlname, "sve-registers.xml") == 0) { - return cpu->dyn_svereg_xml.desc; + return cpu->dyn_svereg_feature.desc.xml; } else if (strcmp(xmlname, "arm-m-system.xml") == 0) { - return cpu->dyn_m_systemreg_xml.desc; + return cpu->dyn_m_systemreg_feature.desc.xml; #ifndef CONFIG_USER_ONLY } else if (strcmp(xmlname, "arm-m-secext.xml") == 0) { - return cpu->dyn_m_secextreg_xml.desc; + return cpu->dyn_m_secextreg_feature.desc.xml; #endif } return NULL; @@ -487,7 +483,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) */ #ifdef TARGET_AARCH64 if (isar_feature_aa64_sve(&cpu->isar)) { - int nreg = arm_gen_dynamic_svereg_xml(cs, cs->gdb_num_regs); + int nreg = arm_gen_dynamic_svereg_feature(cs, cs->gdb_num_regs)->num_regs; gdb_register_coprocessor(cs, aarch64_gdb_get_sve_reg, aarch64_gdb_set_sve_reg, nreg, "sve-registers.xml", 0); @@ -533,20 +529,20 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) 1, "arm-m-profile-mve.xml", 0); } gdb_register_coprocessor(cs, arm_gdb_get_sysreg, arm_gdb_set_sysreg, - arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs), + arm_gen_dynamic_sysreg_feature(cs, cs->gdb_num_regs)->num_regs, "system-registers.xml", 0); #ifdef CONFIG_TCG if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) { gdb_register_coprocessor(cs, arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg, - arm_gen_dynamic_m_systemreg_xml(cs, cs->gdb_num_regs), + arm_gen_dynamic_m_systemreg_feature(cs, cs->gdb_num_regs)->num_regs, "arm-m-system.xml", 0); #ifndef CONFIG_USER_ONLY if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { gdb_register_coprocessor(cs, arm_gdb_get_m_secextreg, arm_gdb_set_m_secextreg, - arm_gen_dynamic_m_secextreg_xml(cs, cs->gdb_num_regs), + arm_gen_dynamic_m_secextreg_feature(cs, cs->gdb_num_regs)->num_regs, "arm-m-secext.xml", 0); } #endif diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c index d7b79a6589b..5286d5c6043 100644 --- a/target/arm/gdbstub64.c +++ b/target/arm/gdbstub64.c @@ -247,7 +247,7 @@ int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg) return 0; } -static void output_vector_union_type(GString *s, int reg_width, +static void output_vector_union_type(GDBFeatureBuilder *builder, int reg_width, const char *name) { struct TypeSize { @@ -282,10 +282,10 @@ static void output_vector_union_type(GString *s, int reg_width, /* First define types and totals in a whole VL */ for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { - g_string_append_printf(s, - "", - name, vec_lanes[i].sz, vec_lanes[i].suffix, - vec_lanes[i].gdb_type, reg_width / vec_lanes[i].size); + gdb_feature_builder_append_tag( + builder, "", + name, vec_lanes[i].sz, vec_lanes[i].suffix, + vec_lanes[i].gdb_type, reg_width / vec_lanes[i].size); } /* @@ -296,86 +296,77 @@ static void output_vector_union_type(GString *s, int reg_width, for (i = 0; i < ARRAY_SIZE(suf); i++) { int bits = 8 << i; - g_string_append_printf(s, "", name, suf[i]); + gdb_feature_builder_append_tag(builder, "", + name, suf[i]); for (j = 0; j < ARRAY_SIZE(vec_lanes); j++) { if (vec_lanes[j].size == bits) { - g_string_append_printf(s, "", - vec_lanes[j].suffix, name, - vec_lanes[j].sz, vec_lanes[j].suffix); + gdb_feature_builder_append_tag( + builder, "", + vec_lanes[j].suffix, name, + vec_lanes[j].sz, vec_lanes[j].suffix); } } - g_string_append(s, ""); + gdb_feature_builder_append_tag(builder, ""); } /* And now the final union of unions */ - g_string_append_printf(s, "", name); + gdb_feature_builder_append_tag(builder, "", name); for (i = ARRAY_SIZE(suf) - 1; i >= 0; i--) { - g_string_append_printf(s, "", - suf[i], name, suf[i]); + gdb_feature_builder_append_tag(builder, + "", + suf[i], name, suf[i]); } - g_string_append(s, ""); + gdb_feature_builder_append_tag(builder, ""); } -int arm_gen_dynamic_svereg_xml(CPUState *cs, int orig_base_reg) +GDBFeature *arm_gen_dynamic_svereg_feature(CPUState *cs, int base_reg) { ARMCPU *cpu = ARM_CPU(cs); - GString *s = g_string_new(NULL); - DynamicGDBXMLInfo *info = &cpu->dyn_svereg_xml; int reg_width = cpu->sve_max_vq * 128; int pred_width = cpu->sve_max_vq * 16; - int base_reg = orig_base_reg; + GDBFeatureBuilder builder; + char *name; + int reg = 0; int i; - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, ""); + gdb_feature_builder_init(&builder, &cpu->dyn_svereg_feature.desc, + "org.gnu.gdb.aarch64.sve", "sve-registers.xml", + base_reg); /* Create the vector union type. */ - output_vector_union_type(s, reg_width, "svev"); + output_vector_union_type(&builder, reg_width, "svev"); /* Create the predicate vector type. */ - g_string_append_printf(s, - "", - pred_width / 8); + gdb_feature_builder_append_tag( + &builder, "", + pred_width / 8); /* Define the vector registers. */ for (i = 0; i < 32; i++) { - g_string_append_printf(s, - "", - i, reg_width, base_reg++); + name = g_strdup_printf("z%d", i); + gdb_feature_builder_append_reg(&builder, name, reg_width, reg++, + "svev", NULL); } /* fpscr & status registers */ - g_string_append_printf(s, "", base_reg++); - g_string_append_printf(s, "", base_reg++); + gdb_feature_builder_append_reg(&builder, "fpsr", 32, reg++, + "int", "float"); + gdb_feature_builder_append_reg(&builder, "fpcr", 32, reg++, + "int", "float"); /* Define the predicate registers. */ for (i = 0; i < 16; i++) { - g_string_append_printf(s, - "", - i, pred_width, base_reg++); + name = g_strdup_printf("p%d", i); + gdb_feature_builder_append_reg(&builder, name, pred_width, reg++, + "svep", NULL); } - g_string_append_printf(s, - "", - pred_width, base_reg++); + gdb_feature_builder_append_reg(&builder, "ffr", pred_width, reg++, + "svep", "vector"); /* Define the vector length pseudo-register. */ - g_string_append_printf(s, - "", - base_reg++); + gdb_feature_builder_append_reg(&builder, "vg", 64, reg++, "int", NULL); - g_string_append_printf(s, ""); + gdb_feature_builder_end(&builder); - info->desc = g_string_free(s, false); - info->num = base_reg - orig_base_reg; - return info->num; + return &cpu->dyn_svereg_feature.desc; } From patchwork Wed Feb 28 11:56:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776465 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251217wrn; Wed, 28 Feb 2024 03:59:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV1VNFRqWMeTsYhcfrEBeWG+1XRmDnDgl48mcFLRpbj8F7wcYG8cQa0meBRoUB3XoojR8QoQ26bqY32JpBhuqN1 X-Google-Smtp-Source: AGHT+IFdFpvUrO0C2VKEhv+d59X70NyfSFZfOPKZnsdxlPIKoRdC12sp9b9JLKVOxu5hdLAg8Bks X-Received: by 2002:a05:6214:2aa8:b0:690:3813:cf24 with SMTP id js8-20020a0562142aa800b006903813cf24mr923692qvb.7.1709121571404; Wed, 28 Feb 2024 03:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121571; cv=none; d=google.com; s=arc-20160816; b=jPNCVgA1R9ZtfXtMK571UP9hj3m/A3iVcLMdFARR73kLak7gjTTvB1fhYEvdf309zV 75r+T7wwCcLCPes/m8vuDsNFysNJkNoDGbNaIs7228xPnaR2kS8gVaojM1ixCE6Bjv18 pbwXwEjapA5FPsJYm0pL8RfaORaWdX6k0B1NyixqjaxtgiKVvgYHl0+k+0n/0Wp1ul0+ wKOPAo9jZb7ReP4XpgdJU1NviIC74hIuJgTmDoanoevwwmWVqf2puJkyHp2yI4YbeqQ1 xuXTHVyGsaQD53i7ok3wNJkfVBSuBOB/w/clHteTTbCHDNzsgaElb/M2pXSkx2xl8rDk zNBg== 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:dkim-signature; bh=8sM8dwb0jrcajUThrx/FFIuuSH/69cUsX7EmmYQ2YL8=; fh=p/TfpsHyxmqS4i8nnqEg8kKRUI6FpRRoSSmBh7QP7WE=; b=FRpOnvfW4dL4fKvBjh4mrzpPGa3SVEdLnO8inf0JdrVuziBVPwmkPwfbKyxO4jYDGZ 5y1MWU37KR2H3M8HW2wMzT0KrTTALRm/ILnpxiwl0gnWrs+AkPQNlGuk70DUN1tPjwqD 1Zunvle8oQazbCc33uYPtuGiDJeS7/IXwYapJXUar6MehoRS6n3gkBHQXknWstAxSU3u 6nXokznvZDylS9mLC+LBEwaab0a/3PIFhBwQ520CsvUX96/RwGwxZHRfU5tdkjkMgIDQ w0DifyW7ZSXU08JVRU5uvA8CLK3quBeEiThjkadZ1OPTiM7w637750INcLvlkA5lCOgI UvXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zweQDmK7; 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 kj16-20020a056214529000b0068cb0d39be6si9338887qvb.521.2024.02.28.03.59.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:59:31 -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; dkim=pass header.i=@linaro.org header.s=google header.b=zweQDmK7; 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 1rfIYm-0005qh-40; Wed, 28 Feb 2024 06:57: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 1rfIYk-0005mz-8T for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:14 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYf-0005jA-IT for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:13 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33d6f26ff33so3694635f8f.0 for ; Wed, 28 Feb 2024 03:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121428; x=1709726228; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8sM8dwb0jrcajUThrx/FFIuuSH/69cUsX7EmmYQ2YL8=; b=zweQDmK7wn7iP7+LiUzHVEGNYKAfr8buBlXhtEOcnGWmeY31YqY6/ZApnz+FZ+zw1p uh+eEoYW+IqCIj+cRkSCS+fDUakTH7FFiieAb9zqXd/vxIL9w87WSz5F2dP8mnPRJ9ty j5SXiw9HzMe4A6h3RCSykLCa353Xh42KMlfN6K6AMGCRWy9cmTl+Evpj5sAN4bVII8kr ZL4wtQd82aRnqbLoUDLI9+7DHyMn4zOI67ggLLsSOguAydxEQlPhXakG7+jmaMoPAavp YapxIuqS9ti5DZtf5d6l2ojk25S9F9g5nCcZzLzC9mUblIgsHNB9yroaSCiev82/20o2 2n4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121428; x=1709726228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8sM8dwb0jrcajUThrx/FFIuuSH/69cUsX7EmmYQ2YL8=; b=hlRXCiN2MNRUqkqx46USiHgli6eEvFvYxMD4jqWo7/t40DeRRrB48jKUqTwHLNOit5 pIl2xjbY29YiXTFL21NuMDS1/rMqAYgIdd/Mnt25G8rsvN9xk/K2kNnbbgadgvOT82Mf oIpEw5d0+4rAfgnz/ZCy4HMLymMoekXCGIrWBknSbuyPOeojVSGD2Tg0ZSZyQqXm7ZD2 1OG7/XnPfq3DQPMloqjubpeSP/pUxJv3nvQw3I/elb4WkhRJuvvTUOVT9vqSVWSkdtgx v7NlXLLo6x03DeS5phNAdNRciTdVTcHlLrVPLYcJZRBw7OqFgPXg8z/OBWkhmeBJjpAZ KFIA== X-Gm-Message-State: AOJu0YxSo2crR7w9h0Cpsxug/Nslt6m/0IKhCc/f6f7uMF7NGdwKr7pd CxDozXtQ6NzaH9jBXVR5uUB9kcNtcNStTWGbbg64KVIzQ3Ode4AT8ORYZsq3DJY= X-Received: by 2002:adf:e6c8:0:b0:33d:6334:e14 with SMTP id y8-20020adfe6c8000000b0033d63340e14mr8413517wrm.11.1709121428107; Wed, 28 Feb 2024 03:57:08 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f14-20020adff98e000000b0033cf60e268fsm14397679wrr.116.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7010B5F900; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs) Subject: [PULL 06/29] target/ppc: Use GDBFeature for dynamic XML Date: Wed, 28 Feb 2024 11:56:38 +0000 Message-Id: <20240228115701.1416107-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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 In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki Reviewed-by: Richard Henderson Message-Id: <20231213-gdb-v17-2-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-7-alex.bennee@linaro.org> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 0241609efef..8247fa23367 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -20,6 +20,7 @@ #ifndef QEMU_PPC_CPU_QOM_H #define QEMU_PPC_CPU_QOM_H +#include "exec/gdbstub.h" #include "hw/core/cpu.h" #ifdef TARGET_PPC64 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index ec14574d142..c66989a5e60 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1492,8 +1492,7 @@ struct PowerPCCPUClass { int bfd_mach; uint32_t l1_dcache_size, l1_icache_size; #ifndef CONFIG_USER_ONLY - unsigned int gdb_num_sprs; - const char *gdb_spr_xml; + GDBFeature gdb_spr; #endif const PPCHash64Options *hash64_opts; struct ppc_radix_page_info *radix_page_info; @@ -1546,7 +1545,6 @@ int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg); #ifndef CONFIG_USER_ONLY hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -void ppc_gdb_gen_spr_xml(PowerPCCPU *cpu); const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name); #endif int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 9bccddb350c..5f0ecf443d8 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -6682,10 +6682,6 @@ static void init_ppc_proc(PowerPCCPU *cpu) /* PowerPC implementation specific initialisations (SPRs, timers, ...) */ (*pcc->init_proc)(env); -#if !defined(CONFIG_USER_ONLY) - ppc_gdb_gen_spr_xml(cpu); -#endif - /* MSR bits & flags consistency checks */ if (env->msr_mask & (1 << 25)) { switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index dfe31d0f47f..c4c55961083 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -300,15 +300,23 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint8_t *mem_buf, int n) } #ifndef CONFIG_USER_ONLY -void ppc_gdb_gen_spr_xml(PowerPCCPU *cpu) +static void gdb_gen_spr_feature(CPUState *cs) { - PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); + PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs); + PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - GString *xml; - char *spr_name; + GDBFeatureBuilder builder; unsigned int num_regs = 0; int i; + if (pcc->gdb_spr.xml) { + return; + } + + gdb_feature_builder_init(&builder, &pcc->gdb_spr, + "org.qemu.power.spr", "power-spr.xml", + cs->gdb_num_regs); + for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { ppc_spr_t *spr = &env->spr_cb[i]; @@ -326,35 +334,13 @@ void ppc_gdb_gen_spr_xml(PowerPCCPU *cpu) */ spr->gdb_id = num_regs; num_regs++; - } - - if (pcc->gdb_spr_xml) { - return; - } - xml = g_string_new(""); - g_string_append(xml, ""); - g_string_append(xml, ""); - - for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { - ppc_spr_t *spr = &env->spr_cb[i]; - - if (!spr->name) { - continue; - } - - spr_name = g_ascii_strdown(spr->name, -1); - g_string_append_printf(xml, ""); + gdb_feature_builder_append_reg(&builder, g_ascii_strdown(spr->name, -1), + TARGET_LONG_BITS, num_regs, + "int", "spr"); } - g_string_append(xml, ""); - - pcc->gdb_num_sprs = num_regs; - pcc->gdb_spr_xml = g_string_free(xml, false); + gdb_feature_builder_end(&builder); } const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name) @@ -362,7 +348,7 @@ const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs); if (strcmp(xml_name, "power-spr.xml") == 0) { - return pcc->gdb_spr_xml; + return pcc->gdb_spr.xml; } return NULL; } @@ -635,7 +621,8 @@ void ppc_gdb_init(CPUState *cs, PowerPCCPUClass *pcc) 32, "power-vsx.xml", 0); } #ifndef CONFIG_USER_ONLY + gdb_gen_spr_feature(cs); gdb_register_coprocessor(cs, gdb_get_spr_reg, gdb_set_spr_reg, - pcc->gdb_num_sprs, "power-spr.xml", 0); + pcc->gdb_spr.num_regs, "power-spr.xml", 0); #endif } From patchwork Wed Feb 28 11:56:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776467 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251291wrn; Wed, 28 Feb 2024 03:59:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhGh4fi6j1MHgx8sRjHmiiIGZcktE76mZtFIS/MlvXCJXJMEgiI+m6emstFkFe6u8D29FSWQsZf/uXlP4SpaJa X-Google-Smtp-Source: AGHT+IH/YsjPHZoyfvc2rv4EhpXXqhjXMbctbpO4/HHikA8CJ7XjZGZ4oh0pKEBSDHIrREuxd/co X-Received: by 2002:a05:6358:6520:b0:17a:c9b2:607c with SMTP id v32-20020a056358652000b0017ac9b2607cmr14873303rwg.27.1709121585636; Wed, 28 Feb 2024 03:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121585; cv=none; d=google.com; s=arc-20160816; b=LDw+ih9bGucmT7ylouAcn47PPwu7djszUqNvkXJH00+cxpLMaGsQlH2a+uHim/x4at 1p93QaJzZIZlfHarH2bRsm33QymdIRp/m3WBobH75NqldK5FcG5Gb9a2dhh3auJ5Xysu YCnh3Oa4vgwjggBLGJx9p3hIz7iW4CSoMHQeJcmthO6NuVt5sMqipGScTP2h0PzPb/G2 hVgGF0nX/oC41rWgUFrAzUP8mhEEQi5udUcW97x5j6CwBRokK7X2G1IoogPGCWjeg9Nk qiVFQI91lgVFeOEV6Ln1pIM03TFsxMAEOEM7TzwrL2xboh1qeh33TWAVkEFtK4siEhf4 i5Nw== 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:dkim-signature; bh=AbQdVw/YztuyMtaq/sRI5jSQkRgrESmuKm2t9XrlKQQ=; fh=9jJHrC5PrJaZEpYolodfKVbyWk7Nrvl/dH0bi7QOqKg=; b=M/kNTfEyY4A8cHeAxFsqppDnDNzE/kpBfEDnF5xoSyoPO9oAmC0N5IOX8ajm95xO91 3j9LcuUvFE6odROjqHXeqqdyxjSjXLcxF1MR+Sqiusqotlzwdtj0g/yDS3S0bYoKR3Ll ukcIYO/ll311kjR5NFhtMnOQYsisnpWisdEZ08jiTci5ayKwmRUTc2b4gaR+ru4adPtn 76aez3JEOI4c7RZt4Zy9C3kY9w63xPi4gaudzH7VUT90EYEV8iOUvKIPQU1Hq6cnTwMi 3b6xC1voZ6RAceI8KpFiZ/ne+jTVyQXMW2O5rDwwFMwBQVyCppP6fD9UzyXH5XHzsqRx 08rw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEBEXdPN; 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 u12-20020ae9c00c000000b007879b80f197si9549992qkk.680.2024.02.28.03.59.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:59:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=SEBEXdPN; 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 1rfIYo-0005sm-EC; Wed, 28 Feb 2024 06:57:18 -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 1rfIYm-0005rE-PV for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:16 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYh-0005jx-Ts for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:16 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-412ad940fe8so12042785e9.2 for ; Wed, 28 Feb 2024 03:57:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121430; x=1709726230; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AbQdVw/YztuyMtaq/sRI5jSQkRgrESmuKm2t9XrlKQQ=; b=SEBEXdPNSxnfBQ4lPQKJO1nzXTi6LPuuwXxCXfOnv2UItvPetywdmHqSyRbG/YkMio uXGluKf687OujLMiZh1sOa5fkIYWRHotQIF9uhnJbwGpClWU4KDHK2UKSlUlRb+lnV8R Hu7sCw277q7l+1TdteDOBw7VZZTgmXAHwHSYhPfOnxQ92vmAsxfNyfFucwoAQJruloGd fTpwE0Eh1k8Bje94zLXMDEmRTQlKRc6McqnS4FQ6vQQpKkzEnaaNWux96K2ugnH338ms 5p9elheeAiFhZG19Vc9X4unl8rWmTH0ch2BWy0aRoDxyJGbgXhPA4sJSGRDtS9EkZZeU t1vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121430; x=1709726230; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AbQdVw/YztuyMtaq/sRI5jSQkRgrESmuKm2t9XrlKQQ=; b=m2fBNvS0KG0BZMF7fBmzHKWK/L+oc14QmCXCQKiRonDenMcZj2ji5HoaZti04I92HL pSvsLM+1R2u78iySPG8y88WUgJZ3xk6pnhyIG7rZSV3Ui3e2mjEj6pPh+EIBNzvec5ah u6U3OAfEWDEvkxQuGGJ15/gPN62jfgH95Coh5aXQ07j5tWUjfWNJUQkdqIUtSOYlOchR EX8EklA9cMkv77vNs8MuvxwAfzHjeuMz9JejELf73toPiocAD1QOISzI15fU9DHAfYLH gt2fbpH6GKDK+MVvoYCdH1Tk6TUro3JwqHP48sCe9kygY/RTxESW8K8cLR0Zg/Q0TNHR q6Cg== X-Gm-Message-State: AOJu0YyguEt1gqihkX3REo+RAl+dhWc3jpcty8yvdyq3uEDUie19H8Ee 6Kr+UJItSlz7gu7awBaJe8PIEx7oKvz5N+sE/IB31MlxwjHTknd0ErMO+hUnDr8= X-Received: by 2002:a05:600c:458c:b0:411:a751:322b with SMTP id r12-20020a05600c458c00b00411a751322bmr9819514wmo.18.1709121430344; Wed, 28 Feb 2024 03:57:10 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id m20-20020a7bca54000000b0041290251dc2sm1862297wml.14.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 864445F902; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs) Subject: [PULL 07/29] target/riscv: Use GDBFeature for dynamic XML Date: Wed, 28 Feb 2024 11:56:39 +0000 Message-Id: <20240228115701.1416107-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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=unavailable 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 In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki Message-Id: <20231213-gdb-v17-3-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-8-alex.bennee@linaro.org> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index f52dce78baa..5d291a70925 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -24,6 +24,7 @@ #include "hw/registerfields.h" #include "hw/qdev-properties.h" #include "exec/cpu-defs.h" +#include "exec/gdbstub.h" #include "qemu/cpu-float.h" #include "qom/object.h" #include "qemu/int128.h" @@ -445,8 +446,8 @@ struct ArchCPU { CPURISCVState env; - char *dyn_csr_xml; - char *dyn_vreg_xml; + GDBFeature dyn_csr_feature; + GDBFeature dyn_vreg_feature; /* Configuration Settings */ RISCVCPUConfig cfg; diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 1b8d001d237..1b62e269b90 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2305,9 +2305,9 @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) RISCVCPU *cpu = RISCV_CPU(cs); if (strcmp(xmlname, "riscv-csr.xml") == 0) { - return cpu->dyn_csr_xml; + return cpu->dyn_csr_feature.xml; } else if (strcmp(xmlname, "riscv-vector.xml") == 0) { - return cpu->dyn_vreg_xml; + return cpu->dyn_vreg_feature.xml; } return NULL; diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index ca9b71f7bbc..d8da84fa52e 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -214,14 +214,15 @@ static int riscv_gdb_set_virtual(CPURISCVState *cs, uint8_t *mem_buf, int n) return 0; } -static int riscv_gen_dynamic_csr_xml(CPUState *cs, int base_reg) +static GDBFeature *riscv_gen_dynamic_csr_feature(CPUState *cs, int base_reg) { RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cs); RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; - GString *s = g_string_new(NULL); + GDBFeatureBuilder builder; riscv_csr_predicate_fn predicate; int bitsize = riscv_cpu_max_xlen(mcc); + const char *name; int i; #if !defined(CONFIG_USER_ONLY) @@ -233,9 +234,9 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int base_reg) bitsize = 64; } - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, ""); + gdb_feature_builder_init(&builder, &cpu->dyn_csr_feature, + "org.gnu.gdb.riscv.csr", "riscv-csr.xml", + base_reg); for (i = 0; i < CSR_TABLE_SIZE; i++) { if (env->priv_ver < csr_ops[i].min_priv_ver) { @@ -243,72 +244,64 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int base_reg) } predicate = csr_ops[i].predicate; if (predicate && (predicate(env, i) == RISCV_EXCP_NONE)) { - if (csr_ops[i].name) { - g_string_append_printf(s, "", base_reg + i); + + gdb_feature_builder_append_reg(&builder, name, bitsize, i, + "int", NULL); } } - g_string_append_printf(s, ""); - - cpu->dyn_csr_xml = g_string_free(s, false); + gdb_feature_builder_end(&builder); #if !defined(CONFIG_USER_ONLY) env->debugger = false; #endif - return CSR_TABLE_SIZE; + return &cpu->dyn_csr_feature; } -static int ricsv_gen_dynamic_vector_xml(CPUState *cs, int base_reg) +static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg) { RISCVCPU *cpu = RISCV_CPU(cs); - GString *s = g_string_new(NULL); - g_autoptr(GString) ts = g_string_new(""); - int reg_width = cpu->cfg.vlenb << 3; - int num_regs = 0; + int reg_width = cpu->cfg.vlenb; + GDBFeatureBuilder builder; int i; - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, ""); + gdb_feature_builder_init(&builder, &cpu->dyn_vreg_feature, + "org.gnu.gdb.riscv.vector", "riscv-vector.xml", + base_reg); /* First define types and totals in a whole VL */ for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { int count = reg_width / vec_lanes[i].size; - g_string_printf(ts, "%s", vec_lanes[i].id); - g_string_append_printf(s, - "", - ts->str, vec_lanes[i].gdb_type, count); + gdb_feature_builder_append_tag( + &builder, "", + vec_lanes[i].id, vec_lanes[i].gdb_type, count); } /* Define unions */ - g_string_append_printf(s, ""); + gdb_feature_builder_append_tag(&builder, ""); for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { - g_string_append_printf(s, "", - vec_lanes[i].suffix, - vec_lanes[i].id); + gdb_feature_builder_append_tag(&builder, + "", + vec_lanes[i].suffix, vec_lanes[i].id); } - g_string_append(s, ""); + gdb_feature_builder_append_tag(&builder, ""); /* Define vector registers */ for (i = 0; i < 32; i++) { - g_string_append_printf(s, - "", - i, reg_width, base_reg++); - num_regs++; + gdb_feature_builder_append_reg(&builder, g_strdup_printf("v%d", i), + reg_width, i, "riscv_vector", "vector"); } - g_string_append_printf(s, ""); + gdb_feature_builder_end(&builder); - cpu->dyn_vreg_xml = g_string_free(s, false); - return num_regs; + return &cpu->dyn_vreg_feature; } void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) @@ -324,10 +317,9 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) 32, "riscv-32bit-fpu.xml", 0); } if (env->misa_ext & RVV) { - int base_reg = cs->gdb_num_regs; gdb_register_coprocessor(cs, riscv_gdb_get_vector, riscv_gdb_set_vector, - ricsv_gen_dynamic_vector_xml(cs, base_reg), + ricsv_gen_dynamic_vector_feature(cs, cs->gdb_num_regs)->num_regs, "riscv-vector.xml", 0); } switch (mcc->misa_mxl_max) { @@ -347,9 +339,8 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) } if (cpu->cfg.ext_zicsr) { - int base_reg = cs->gdb_num_regs; gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, - riscv_gen_dynamic_csr_xml(cs, base_reg), + riscv_gen_dynamic_csr_feature(cs, cs->gdb_num_regs)->num_regs, "riscv-csr.xml", 0); } } From patchwork Wed Feb 28 11:56:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776468 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251500wrn; Wed, 28 Feb 2024 04:00:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUb45Sgk3/oQBgA8CSbaJJJ1+0CEIXNK+rG2+UW4eENvZgvmT9MVagAWsHKNYAD6/dEsQh7+YM8Gfkoa0alnVaj X-Google-Smtp-Source: AGHT+IFHqhWq3fFfIMUqnkIQ5yNUTLUUQayj5gV7z69Bnkb39e/OPjkLCHyUB1m5W1KRQuMnPe7l X-Received: by 2002:a05:620a:669:b0:787:bb37:3ded with SMTP id a9-20020a05620a066900b00787bb373dedmr4570921qkh.53.1709121616354; Wed, 28 Feb 2024 04:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121616; cv=none; d=google.com; s=arc-20160816; b=OU9sNp9aAcjC043F/uKMk9UG3g53U201CtAC+Pwt9G2XjNSrhp0HLa+K8ZdxVLbVo8 9OO9HTcleioSSQ26qc13i6A+WG6ddHJqsSMWVmOjbmpRysE8IOij07wgEJgFdOoiGhuI prDl5k0phtBJYqV2kUgMmxoS8bR7/NwbG57xVaV3hSUYbv90nPVKsLrFG14jUi6ciLGk 1CRSHTlMVeIdF+yVpJ0X/c+XQ5md5Jay+7L4BRF5v2vgOx36CiQSB0W+ltPdvL1mmtQJ M9TI1Vp9bZHoZ8V6AXZdpuxDChoa+YGM+TXRNKVzp9Yy23ecTD6hWD/90MKKGVo0t7de uPhQ== 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:dkim-signature; bh=/jdTW+fnJYzEnwTgXUzgCTmtD5squb1f+QfBF2bQ5SM=; fh=8Qim1lusSzbOjhXoTVJo55rGQBQUDSkozdz2w8z5e7E=; b=WzddpsT2a8Wo1wFFI9vDRoOhELgaRzqxW82HsDwp/NH2ySiHqjSKv5/b0ON8K86x3M hBPLjTHDx7xVq79tPK8V//YKxaPpxAm6RvGtxpHdH6I1mRGeI3XTXO+5RhMEQeEBSGYm s+yQpxdbSCuRg/5/nV/L0bTKzaytJ8OSi4vP7Tsdza/bWTU+VEhU/wthOBsw6bmGPH3c iUtw53ouw0XOL6MPxxMLS+gfP+Q0mSDipnIJgVQIvOFKRL8zSsxVaT0HGI1R+aCka1XQ pJGL0nBPPA1E/m4uhd5bb/6t1QModPspyrpUWUIBlkp4cz6ObfvmFmp0Rx6VQr58T0Su vS8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J3Q7Nl+J; 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 t18-20020a05620a0b1200b00787889ded5asi9573994qkg.297.2024.02.28.04.00.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:00:16 -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; dkim=pass header.i=@linaro.org header.s=google header.b=J3Q7Nl+J; 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 1rfIYr-0005v7-Jo; Wed, 28 Feb 2024 06:57:21 -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 1rfIYp-0005uA-Rg for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:19 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYi-0005k5-8u for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:19 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-412a390347dso25753315e9.3 for ; Wed, 28 Feb 2024 03:57:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121430; x=1709726230; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/jdTW+fnJYzEnwTgXUzgCTmtD5squb1f+QfBF2bQ5SM=; b=J3Q7Nl+JyYIzLWgtauwX908t0DIlXxEeMmWzRUGnzuJwfBujXB1W7cch/+VqhCAZnY 8rDyRGpE1Bo/eHOAXGZ6afQZd+WO68N3SQQfZe2mlJs8LTOEL9kxtpb+lEzzwvjmT105 FhBCF/9f6a3P6c+/tuVNa21V1nCyAL36Z3vt96UbJUzdHXQWXI+0EE3ZBmmmTyk95iMV 4F8GQmPGth4GSFXdw6E2ybmZ7wtVD/Uvh0jIpsnuYR+X5bUJrqvZ62Y/RWKwv4xLHrjp Q80eCX8eiWvP9faAZKSX80F5bhgaJUTdzXHhaVbLN5t0VF2A4JbCLsNl5ompE6gyqBR7 fNvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121430; x=1709726230; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/jdTW+fnJYzEnwTgXUzgCTmtD5squb1f+QfBF2bQ5SM=; b=Ugal2JaGpt+wQlpNrDiflBQUsoDEsTljOOxpEMotFwphMjdlQkUt0Sl838gM05w9/8 QXBwaMYmE9s7gWSlpw75EjUiQK+yXELpwVgvOH5VxC1r13LfS0jYX+jh/iKJPd0FYjvJ didUQZBwXSFDUBHghwvIzUog6Q9kSGr/gQbmJBUUW4i/KPWEGmV2PIjlsnJJtTr2pFBo xt6UBWVpYCPEYW1NFFk8HDWzE2VOOSpQ/NSc/5TIYoT1hmgVaVm1Oct6FUcgMieU+xS+ pRqQeC3zEPNRXzfb7hDHbwnJuo2zTQtKD/gbXPd7ue5usBSmNLWCP7iX3Y2hCRh+OXo4 G5Iw== X-Gm-Message-State: AOJu0YxyqwDGpU4f0ACLEYsTpcgPCPsS0yMU4SEVxfKs+mTCmJGVWERo LEzgbQJfCuoYFM3FELTIw2y+pS05IXEHs31MaCmcGZ1MtfHRZCPaIiF9SEqrn/c= X-Received: by 2002:a05:600c:1d25:b0:412:6101:915c with SMTP id l37-20020a05600c1d2500b004126101915cmr8482013wms.19.1709121430627; Wed, 28 Feb 2024 03:57:10 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id y16-20020a05600c365000b00412656ba919sm1839637wmq.20.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A4F025F904; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Peter Maydell , Brian Cain , Song Gao , Laurent Vivier , "Edgar E. Iglesias" , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs), qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs), qemu-s390x@nongnu.org (open list:S390 TCG CPUs) Subject: [PULL 08/29] gdbstub: Use GDBFeature for gdb_register_coprocessor Date: Wed, 28 Feb 2024 11:56:40 +0000 Message-Id: <20240228115701.1416107-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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=unavailable 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 This is a tree-wide change to introduce GDBFeature parameter to gdb_register_coprocessor(). The new parameter just replaces num_regs and xml parameters for now. GDBFeature will be utilized to simplify XML lookup in a following change. Signed-off-by: Akihiko Odaki Acked-by: Alex Bennée Message-Id: <20231213-gdb-v17-4-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-9-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index d8a3c56fa2b..ac6fce99a64 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -38,7 +38,7 @@ typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg); */ void gdb_register_coprocessor(CPUState *cpu, gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg, - int num_regs, const char *xml, int g_pos); + const GDBFeature *feature, int g_pos); /** * gdbserver_start: start the gdb server diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 7e73e916bdc..256599c8dfb 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -544,7 +544,7 @@ static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) void gdb_register_coprocessor(CPUState *cpu, gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg, - int num_regs, const char *xml, int g_pos) + const GDBFeature *feature, int g_pos) { GDBRegisterState *s; guint i; @@ -553,7 +553,7 @@ void gdb_register_coprocessor(CPUState *cpu, for (i = 0; i < cpu->gdb_regs->len; i++) { /* Check for duplicates. */ s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (strcmp(s->xml, xml) == 0) { + if (strcmp(s->xml, feature->xmlname) == 0) { return; } } @@ -565,17 +565,18 @@ void gdb_register_coprocessor(CPUState *cpu, g_array_set_size(cpu->gdb_regs, i + 1); s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); s->base_reg = cpu->gdb_num_regs; - s->num_regs = num_regs; + s->num_regs = feature->num_regs; s->get_reg = get_reg; s->set_reg = set_reg; - s->xml = xml; + s->xml = feature->xml; /* Add to end of list. */ - cpu->gdb_num_regs += num_regs; + cpu->gdb_num_regs += feature->num_regs; if (g_pos) { if (g_pos != s->base_reg) { error_report("Error: Bad gdb register numbering for '%s', " - "expected %d got %d", xml, g_pos, s->base_reg); + "expected %d got %d", feature->xml, + g_pos, s->base_reg); } else { cpu->gdb_num_g_regs = cpu->gdb_num_regs; } diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index 5949adfb31a..f2b201d3125 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -483,14 +483,14 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) */ #ifdef TARGET_AARCH64 if (isar_feature_aa64_sve(&cpu->isar)) { - int nreg = arm_gen_dynamic_svereg_feature(cs, cs->gdb_num_regs)->num_regs; + GDBFeature *feature = arm_gen_dynamic_svereg_feature(cs, cs->gdb_num_regs); gdb_register_coprocessor(cs, aarch64_gdb_get_sve_reg, - aarch64_gdb_set_sve_reg, nreg, - "sve-registers.xml", 0); + aarch64_gdb_set_sve_reg, feature, 0); } else { gdb_register_coprocessor(cs, aarch64_gdb_get_fpu_reg, aarch64_gdb_set_fpu_reg, - 34, "aarch64-fpu.xml", 0); + gdb_find_static_feature("aarch64-fpu.xml"), + 0); } /* * Note that we report pauth information via the feature name @@ -501,19 +501,22 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) if (isar_feature_aa64_pauth(&cpu->isar)) { gdb_register_coprocessor(cs, aarch64_gdb_get_pauth_reg, aarch64_gdb_set_pauth_reg, - 4, "aarch64-pauth.xml", 0); + gdb_find_static_feature("aarch64-pauth.xml"), + 0); } #endif } else { if (arm_feature(env, ARM_FEATURE_NEON)) { gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg, - 49, "arm-neon.xml", 0); + gdb_find_static_feature("arm-neon.xml"), + 0); } else if (cpu_isar_feature(aa32_simd_r32, cpu)) { gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg, - 33, "arm-vfp3.xml", 0); + gdb_find_static_feature("arm-vfp3.xml"), + 0); } else if (cpu_isar_feature(aa32_vfp_simd, cpu)) { gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg, - 17, "arm-vfp.xml", 0); + gdb_find_static_feature("arm-vfp.xml"), 0); } if (!arm_feature(env, ARM_FEATURE_M)) { /* @@ -521,29 +524,29 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) * expose to gdb. */ gdb_register_coprocessor(cs, vfp_gdb_get_sysreg, vfp_gdb_set_sysreg, - 2, "arm-vfp-sysregs.xml", 0); + gdb_find_static_feature("arm-vfp-sysregs.xml"), + 0); } } if (cpu_isar_feature(aa32_mve, cpu) && tcg_enabled()) { gdb_register_coprocessor(cs, mve_gdb_get_reg, mve_gdb_set_reg, - 1, "arm-m-profile-mve.xml", 0); + gdb_find_static_feature("arm-m-profile-mve.xml"), + 0); } gdb_register_coprocessor(cs, arm_gdb_get_sysreg, arm_gdb_set_sysreg, - arm_gen_dynamic_sysreg_feature(cs, cs->gdb_num_regs)->num_regs, - "system-registers.xml", 0); + arm_gen_dynamic_sysreg_feature(cs, cs->gdb_num_regs), + 0); #ifdef CONFIG_TCG if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) { gdb_register_coprocessor(cs, arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg, - arm_gen_dynamic_m_systemreg_feature(cs, cs->gdb_num_regs)->num_regs, - "arm-m-system.xml", 0); + arm_gen_dynamic_m_systemreg_feature(cs, cs->gdb_num_regs), 0); #ifndef CONFIG_USER_ONLY if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { gdb_register_coprocessor(cs, arm_gdb_get_m_secextreg, arm_gdb_set_m_secextreg, - arm_gen_dynamic_m_secextreg_feature(cs, cs->gdb_num_regs)->num_regs, - "arm-m-secext.xml", 0); + arm_gen_dynamic_m_secextreg_feature(cs, cs->gdb_num_regs), 0); } #endif } diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 759ea62814d..ebe804e2931 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -319,8 +319,7 @@ static void hexagon_cpu_realize(DeviceState *dev, Error **errp) gdb_register_coprocessor(cs, hexagon_hvx_gdb_read_register, hexagon_hvx_gdb_write_register, - NUM_VREGS + NUM_QREGS, - "hexagon-hvx.xml", 0); + gdb_find_static_feature("hexagon-hvx.xml"), 0); qemu_init_vcpu(cs); cpu_reset(cs); diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 5fc2f19e965..843a869450e 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -118,5 +118,5 @@ static int loongarch_gdb_set_fpu(CPULoongArchState *env, void loongarch_cpu_register_gdb_regs_for_features(CPUState *cs) { gdb_register_coprocessor(cs, loongarch_gdb_get_fpu, loongarch_gdb_set_fpu, - 41, "loongarch-fpu.xml", 0); + gdb_find_static_feature("loongarch-fpu.xml"), 0); } diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 14508dfa118..9808d676a22 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -112,10 +112,10 @@ void m68k_cpu_init_gdb(M68kCPU *cpu) if (m68k_feature(env, M68K_FEATURE_CF_FPU)) { gdb_register_coprocessor(cs, cf_fpu_gdb_get_reg, cf_fpu_gdb_set_reg, - 11, "cf-fp.xml", 18); + gdb_find_static_feature("cf-fp.xml"), 18); } else if (m68k_feature(env, M68K_FEATURE_FPU)) { - gdb_register_coprocessor(cs, m68k_fpu_gdb_get_reg, - m68k_fpu_gdb_set_reg, 11, "m68k-fp.xml", 18); + gdb_register_coprocessor(cs, m68k_fpu_gdb_get_reg, m68k_fpu_gdb_set_reg, + gdb_find_static_feature("m68k-fp.xml"), 18); } /* TODO: Add [E]MAC registers. */ } diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 2002231a6b4..2c62cf048c2 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -313,8 +313,9 @@ static void mb_cpu_initfn(Object *obj) CPUMBState *env = &cpu->env; gdb_register_coprocessor(CPU(cpu), mb_cpu_gdb_read_stack_protect, - mb_cpu_gdb_write_stack_protect, 2, - "microblaze-stack-protect.xml", 0); + mb_cpu_gdb_write_stack_protect, + gdb_find_static_feature("microblaze-stack-protect.xml"), + 0); set_float_rounding_mode(float_round_nearest_even, &env->fp_status); diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index c4c55961083..625ccf96c5b 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -606,23 +606,24 @@ void ppc_gdb_init(CPUState *cs, PowerPCCPUClass *pcc) { if (pcc->insns_flags & PPC_FLOAT) { gdb_register_coprocessor(cs, gdb_get_float_reg, gdb_set_float_reg, - 33, "power-fpu.xml", 0); + gdb_find_static_feature("power-fpu.xml"), 0); } if (pcc->insns_flags & PPC_ALTIVEC) { gdb_register_coprocessor(cs, gdb_get_avr_reg, gdb_set_avr_reg, - 34, "power-altivec.xml", 0); + gdb_find_static_feature("power-altivec.xml"), + 0); } if (pcc->insns_flags & PPC_SPE) { gdb_register_coprocessor(cs, gdb_get_spe_reg, gdb_set_spe_reg, - 34, "power-spe.xml", 0); + gdb_find_static_feature("power-spe.xml"), 0); } if (pcc->insns_flags2 & PPC2_VSX) { gdb_register_coprocessor(cs, gdb_get_vsx_reg, gdb_set_vsx_reg, - 32, "power-vsx.xml", 0); + gdb_find_static_feature("power-vsx.xml"), 0); } #ifndef CONFIG_USER_ONLY gdb_gen_spr_feature(cs); gdb_register_coprocessor(cs, gdb_get_spr_reg, gdb_set_spr_reg, - pcc->gdb_spr.num_regs, "power-spr.xml", 0); + &pcc->gdb_spr, 0); #endif } diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index d8da84fa52e..ec1fc6a29da 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -311,28 +311,32 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) CPURISCVState *env = &cpu->env; if (env->misa_ext & RVD) { gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu, - 32, "riscv-64bit-fpu.xml", 0); + gdb_find_static_feature("riscv-64bit-fpu.xml"), + 0); } else if (env->misa_ext & RVF) { gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu, - 32, "riscv-32bit-fpu.xml", 0); + gdb_find_static_feature("riscv-32bit-fpu.xml"), + 0); } if (env->misa_ext & RVV) { gdb_register_coprocessor(cs, riscv_gdb_get_vector, riscv_gdb_set_vector, - ricsv_gen_dynamic_vector_feature(cs, cs->gdb_num_regs)->num_regs, - "riscv-vector.xml", 0); + ricsv_gen_dynamic_vector_feature(cs, cs->gdb_num_regs), + 0); } switch (mcc->misa_mxl_max) { case MXL_RV32: gdb_register_coprocessor(cs, riscv_gdb_get_virtual, riscv_gdb_set_virtual, - 1, "riscv-32bit-virtual.xml", 0); + gdb_find_static_feature("riscv-32bit-virtual.xml"), + 0); break; case MXL_RV64: case MXL_RV128: gdb_register_coprocessor(cs, riscv_gdb_get_virtual, riscv_gdb_set_virtual, - 1, "riscv-64bit-virtual.xml", 0); + gdb_find_static_feature("riscv-64bit-virtual.xml"), + 0); break; default: g_assert_not_reached(); @@ -340,7 +344,7 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) if (cpu->cfg.ext_zicsr) { gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, - riscv_gen_dynamic_csr_feature(cs, cs->gdb_num_regs)->num_regs, - "riscv-csr.xml", 0); + riscv_gen_dynamic_csr_feature(cs, cs->gdb_num_regs), + 0); } } diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c index f02fa316e53..256f1c7c6db 100644 --- a/target/s390x/gdbstub.c +++ b/target/s390x/gdbstub.c @@ -67,8 +67,6 @@ int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) /* the values represent the positions in s390-acr.xml */ #define S390_A0_REGNUM 0 #define S390_A15_REGNUM 15 -/* total number of registers in s390-acr.xml */ -#define S390_NUM_AC_REGS 16 static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n) { @@ -96,8 +94,6 @@ static int cpu_write_ac_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_FPC_REGNUM 0 #define S390_F0_REGNUM 1 #define S390_F15_REGNUM 16 -/* total number of registers in s390-fpr.xml */ -#define S390_NUM_FP_REGS 17 static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n) { @@ -130,8 +126,6 @@ static int cpu_write_fp_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_V15L_REGNUM 15 #define S390_V16_REGNUM 16 #define S390_V31_REGNUM 31 -/* total number of registers in s390-vx.xml */ -#define S390_NUM_VREGS 32 static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n) { @@ -170,8 +164,6 @@ static int cpu_write_vreg(CPUS390XState *env, uint8_t *mem_buf, int n) /* the values represent the positions in s390-cr.xml */ #define S390_C0_REGNUM 0 #define S390_C15_REGNUM 15 -/* total number of registers in s390-cr.xml */ -#define S390_NUM_C_REGS 16 #ifndef CONFIG_USER_ONLY static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n) @@ -204,8 +196,6 @@ static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_VIRT_CPUTM_REGNUM 1 #define S390_VIRT_BEA_REGNUM 2 #define S390_VIRT_PREFIX_REGNUM 3 -/* total number of registers in s390-virt.xml */ -#define S390_NUM_VIRT_REGS 4 static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n) { @@ -252,8 +242,6 @@ static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_VIRT_KVM_PFT_REGNUM 1 #define S390_VIRT_KVM_PFS_REGNUM 2 #define S390_VIRT_KVM_PFC_REGNUM 3 -/* total number of registers in s390-virt-kvm.xml */ -#define S390_NUM_VIRT_KVM_REGS 4 static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n) { @@ -301,8 +289,6 @@ static int cpu_write_virt_kvm_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_GS_GSD_REGNUM 1 #define S390_GS_GSSM_REGNUM 2 #define S390_GS_GSEPLA_REGNUM 3 -/* total number of registers in s390-gs.xml */ -#define S390_NUM_GS_REGS 4 static int cpu_read_gs_reg(CPUS390XState *env, GByteArray *buf, int n) { @@ -320,33 +306,33 @@ void s390_cpu_gdb_init(CPUState *cs) { gdb_register_coprocessor(cs, cpu_read_ac_reg, cpu_write_ac_reg, - S390_NUM_AC_REGS, "s390-acr.xml", 0); + gdb_find_static_feature("s390-acr.xml"), 0); gdb_register_coprocessor(cs, cpu_read_fp_reg, cpu_write_fp_reg, - S390_NUM_FP_REGS, "s390-fpr.xml", 0); + gdb_find_static_feature("s390-fpr.xml"), 0); gdb_register_coprocessor(cs, cpu_read_vreg, cpu_write_vreg, - S390_NUM_VREGS, "s390-vx.xml", 0); + gdb_find_static_feature("s390-vx.xml"), 0); gdb_register_coprocessor(cs, cpu_read_gs_reg, cpu_write_gs_reg, - S390_NUM_GS_REGS, "s390-gs.xml", 0); + gdb_find_static_feature("s390-gs.xml"), 0); #ifndef CONFIG_USER_ONLY gdb_register_coprocessor(cs, cpu_read_c_reg, cpu_write_c_reg, - S390_NUM_C_REGS, "s390-cr.xml", 0); + gdb_find_static_feature("s390-cr.xml"), 0); gdb_register_coprocessor(cs, cpu_read_virt_reg, cpu_write_virt_reg, - S390_NUM_VIRT_REGS, "s390-virt.xml", 0); + gdb_find_static_feature("s390-virt.xml"), 0); if (kvm_enabled()) { gdb_register_coprocessor(cs, cpu_read_virt_kvm_reg, cpu_write_virt_kvm_reg, - S390_NUM_VIRT_KVM_REGS, "s390-virt-kvm.xml", + gdb_find_static_feature("s390-virt-kvm.xml"), 0); } #endif From patchwork Wed Feb 28 11:56:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776464 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251105wrn; Wed, 28 Feb 2024 03:59:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX+R6+wtgpX3TL5otgBbVvG/QaXuuzXCtbiVTidDY/gEqc6i8mZY76++xDX+WuMxJ2rscTZqAEGhdHcBBueLPS/ X-Google-Smtp-Source: AGHT+IGFwY/40DfkER5pAvD37frpXBcCw6mbMLjzyM1XLC4ZbVNXFh4RuvGBz6d8V5jmF+2IdLQ5 X-Received: by 2002:a05:622a:1652:b0:42e:7e29:b75 with SMTP id y18-20020a05622a165200b0042e7e290b75mr12290129qtj.51.1709121550063; Wed, 28 Feb 2024 03:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121550; cv=none; d=google.com; s=arc-20160816; b=0RO/Pu6ae9Ywxdo4/ezrDHVw7EoVfSAdRZS937iW1gOME+uM7fR0Ek8Dmgd5LslhPE ynKTS9cIUI1jM31eNCa7bhSUHOnFcjjgk8ClwPDZMVwXnmCBZlsuUEK7xLJV0ZZ19kL6 raiUxhDMhEt+CcJetGizkrPkETppw50UYOGg408vrsgrOWd4b1K88KyvvVMSgimQYaxG i8hPRvOcTicT9PGpfZrae9ZIE1z2YG7H/zhfgY+2rvnUY0Jk9GttkHwx1sjiH8zHlRW4 kyHWbjGqAip9KL8Z5qG1F55Bcss1m/5fgxm39uIXMoLUXo7z23iCRbb7sSUoGi3amBjc cL0Q== 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:dkim-signature; bh=qW+nKetcRkdRlQHCRkk2cCjPEjxiMk24CyxL/Jk2Csc=; fh=h9eGh9LdnczKeJ5s9ZJz3SDfuNraEHiWEOL+l5dy014=; b=HAgWnHjSL2scGTedR+k7/kwigN6qyB2SGrcNhp5VKdh5UPtCdn8d63yDesVrl4j1nv 9Gu4+H+VUu+YySL/hNtNNI01on4nKP2nin67yTAi1AOpdpO4wPj2e2WOBKT2tOlZ1k/O f0eKFpV04Vm0gVRu4lAjowQXj5nAc2l78KNdSbkrgrrKloNOy5DeWtMDjUXdQFviW6H1 KCHtfi5ktyj/kSQYGQD818DaTs/DL3djgmWz8bcbX0CvCKY3p8HL+OvROrpwj8WPpulQ XpGtHhcE6/1OVrwTqDKdy9V9BNWYYyRaoiMo63XmEv/k3HHjReIgqcR9agftXbZK3xWc y7Ww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c8zGHcdb; 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 d13-20020ac847cd000000b0042e7a62d105si8435852qtr.703.2024.02.28.03.59.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:59:10 -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; dkim=pass header.i=@linaro.org header.s=google header.b=c8zGHcdb; 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 1rfIYz-00064h-D0; Wed, 28 Feb 2024 06:57:29 -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 1rfIYv-000607-1L for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:25 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYm-0005me-IZ for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:24 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-412b41a1294so4052685e9.3 for ; Wed, 28 Feb 2024 03:57:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121435; x=1709726235; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qW+nKetcRkdRlQHCRkk2cCjPEjxiMk24CyxL/Jk2Csc=; b=c8zGHcdbjr1R0E1uK8cDFQty5RDs+AiBtegyqngFSNz8dYJmHxG2IcBBhLTG0amSZu Dc+AANi7quOgZ+OZNDZSIwDFSsiekD3lIxE+nlVoJFmPvqE0PkH5/maeBiNdWDJXHaMB jbFfl6Ton5xiNWOtWdrHNjVQanuXixwNtpFdNlxnWd1zXEkjhobSp310BjFZbMfDoW+C RscvGNXpp+63y9/ikrfHw87PJkLHF7epIex8DPKmN8BECyObhX0HMdqbCcOxQI+Y7kCo G86Wc0P36Hxc7DMUEWRCWVdTz5W7jYs0oeHP9peDnxO2XyXewxlwSGO1yG69Q8xQrXHa RVmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121435; x=1709726235; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qW+nKetcRkdRlQHCRkk2cCjPEjxiMk24CyxL/Jk2Csc=; b=IjabVp78fgJeNvKPiJpPhIC+0kKUGs3bZV83aECSygbGyB2CfXL7GNu6WjR6aXuWtO kW55JPblzgIsl42zHDNAEzZCeBHZl2znwP13QAOMy5JW1sjhY+hWs8LncZSmlbUnxQiM L4UiASHF4FzKJszRf9CV4WqQeNA3QOxTFmdwci/wgUHnrvSkgso7Z0iYY11NW2rM2Z9U hsHtfPvM6SA/oXWKiBSn/E3XKgx85Xlowh2Y49fpWr75XbGM7Ofqu8ioybUHueuJlc6K /CsDcVgVUQ/jBz0nnl5ODrjulrNeyj76cnGZjjKMmwFBwFWCtKMltV2YP7VK0MPraaj1 zOvQ== X-Gm-Message-State: AOJu0YyU/HRAdRNp8+rPdA4FNOKtRzS589Yx0cSnQnJ+M48g0aZD8HLM 8BksWz8XAD0rjWnGWHm15UkcSW9QoIbjVKGSzqaTUnYeKwlLgGfJCnsc65wjh2U= X-Received: by 2002:a05:600c:4202:b0:411:e2bf:73b9 with SMTP id x2-20020a05600c420200b00411e2bf73b9mr8189620wmh.39.1709121435246; Wed, 28 Feb 2024 03:57:15 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n6-20020a05600c4f8600b0041273fc463csm1910772wmq.17.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B95645F909; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PULL 09/29] gdbstub: Use GDBFeature for GDBRegisterState Date: Wed, 28 Feb 2024 11:56:41 +0000 Message-Id: <20240228115701.1416107-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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 Simplify GDBRegisterState by replacing num_regs and xml members with one member that points to GDBFeature. Signed-off-by: Akihiko Odaki Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20231213-gdb-v17-5-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-10-alex.bennee@linaro.org> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 256599c8dfb..0ea417b2c9a 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -47,10 +47,9 @@ typedef struct GDBRegisterState { int base_reg; - int num_regs; gdb_get_reg_cb get_reg; gdb_set_reg_cb set_reg; - const char *xml; + const GDBFeature *feature; } GDBRegisterState; GDBState gdbserver_state; @@ -391,7 +390,7 @@ static const char *get_feature_xml(const char *p, const char **newp, g_ptr_array_add( xml, g_markup_printf_escaped("", - r->xml)); + r->feature->xmlname)); } } g_ptr_array_add(xml, g_strdup("")); @@ -513,7 +512,7 @@ static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) if (cpu->gdb_regs) { for (guint i = 0; i < cpu->gdb_regs->len; i++) { r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (r->base_reg <= reg && reg < r->base_reg + r->num_regs) { + if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { return r->get_reg(env, buf, reg - r->base_reg); } } @@ -534,7 +533,7 @@ static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) if (cpu->gdb_regs) { for (guint i = 0; i < cpu->gdb_regs->len; i++) { r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (r->base_reg <= reg && reg < r->base_reg + r->num_regs) { + if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { return r->set_reg(env, mem_buf, reg - r->base_reg); } } @@ -553,7 +552,7 @@ void gdb_register_coprocessor(CPUState *cpu, for (i = 0; i < cpu->gdb_regs->len; i++) { /* Check for duplicates. */ s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (strcmp(s->xml, feature->xmlname) == 0) { + if (s->feature == feature) { return; } } @@ -565,10 +564,9 @@ void gdb_register_coprocessor(CPUState *cpu, g_array_set_size(cpu->gdb_regs, i + 1); s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); s->base_reg = cpu->gdb_num_regs; - s->num_regs = feature->num_regs; s->get_reg = get_reg; s->set_reg = set_reg; - s->xml = feature->xml; + s->feature = feature; /* Add to end of list. */ cpu->gdb_num_regs += feature->num_regs; From patchwork Wed Feb 28 11:56:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776470 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251620wrn; Wed, 28 Feb 2024 04:00:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVb20mg0d0UFs+upGp4DvIlDev/KbXOIIevFs2UFMnasiQzMGVJesTzPzrRJJB8VxPRIUKLeqpUVAfrsOYgZ9V6 X-Google-Smtp-Source: AGHT+IF2UzYl8zqbifKut/bt/es407V1S/Z2tpv7wXGjT8KfWUkNUyTmiylsJLKvDzA/H+e/jUHO X-Received: by 2002:a05:622a:1108:b0:42e:aaed:92c7 with SMTP id e8-20020a05622a110800b0042eaaed92c7mr1838265qty.53.1709121632537; Wed, 28 Feb 2024 04:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121632; cv=none; d=google.com; s=arc-20160816; b=DJmKLtv79tMbPTJUBfrBCLGkz46bCdGynGBy0ZqIqtIAsLQuUtS3hVM1zzL5y4moVw /OvuqwT99pJ3YCP4fj/PdphtfLWi19PNYAfQfkJV3JWzzGW47x6smtCcXaN7QT1rP4ST /3ApeBMJ2Vs2VoDooEl+7SAlEJnqo/WGiUeQXMkcqTSlWCZP1HJ2TwwaS4/DnZsAKbvv SBek4ZkCLPPbESLVOhTfWw2qE0vBEDVnptr+y4kfalk2wOozkHBW11rTqcwTzpdki1sm PcRK1IHVVpjfwX9ZOK+Uyjkq/92rYPlfZdgeAuOEVp6jfuINnK2grPf2nPk2iPvUCPXf 2Beg== 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:dkim-signature; bh=T5+GgPrs+CYxtQvCy78P9VuYZ+acqgezMpb+UO1K+Uk=; fh=8Qim1lusSzbOjhXoTVJo55rGQBQUDSkozdz2w8z5e7E=; b=tFzOidFfUU2Ddd3toxDG9LHUu/mHQKwINvskv95QekwQ/2eNqKwGqu5W2H6cNAAnTn C/3hfuys4NZ+PC/8Ginom7yhAG2n325dOdJXrWQpgHHBPV8VUt6r4iirNmmWvTdMgj2I Iyah2k0V2YWZDnfTZZtNponNcxkzSav3w3UBFajEg7SjePf5JjxEdpcqk9jPlrcyzocp mcTO+zI0tAQfStg7HncVfDEf9N9r0bPgynNhzsdytabm4OPsRfEWprJU+wfI0tkJeSy/ RHZ0M13LmK84yqizrV7oSftJagUp/FG3WpHiSDKsld7zd6mHO39iDhZNKhUUGUYpCJnT gCVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sZsUaP0h; 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 f17-20020ac86ed1000000b0042e6231cf0dsi9055329qtv.316.2024.02.28.04.00.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:00:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=sZsUaP0h; 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 1rfIYs-0005xn-G6; Wed, 28 Feb 2024 06:57:22 -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 1rfIYr-0005um-9w for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:21 -0500 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 1rfIYk-0005lJ-6k for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:20 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-412b243926aso6546265e9.2 for ; Wed, 28 Feb 2024 03:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121433; x=1709726233; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T5+GgPrs+CYxtQvCy78P9VuYZ+acqgezMpb+UO1K+Uk=; b=sZsUaP0hBmg7HIxDhxRf/LJ230liKdeyJZt2V2rQJLGFo4+W3/nOhunGM9dh7MJVYO a3LX/fQmsf2JS/HnX324wYV6LPAVWCn65UQbFrLLRAv6/XxBDbXapxVJB4qg3bZIjoxX CgSIblQuxAJmtgEjJE4vxVc0x+5GsMo5utMWlZK2J4kaIaMrVyWa0BMGAtN4t5A9BnSB cpjssleLZ1syQcxAsLQ2CkWgHP5EoKAPFkiRLi+97q+hnQqKTfwos9lpioUl6lNV+nAW IdmlczpZY1ACPg6cMfIp0esC+3MYte6D1jmnAalLExDcmUBGN009Wl1TVYZDhxS9G6JD NqPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121433; x=1709726233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T5+GgPrs+CYxtQvCy78P9VuYZ+acqgezMpb+UO1K+Uk=; b=IffocLNWGArxQJQyPqHI0+yV+g/qeSnWoZaLCMYJK6Vr2Q0kfW/ajSvsghFvx0LumY 0G9WZ+ifWHiuxtVb38Iy0bTfM9WlpMENHias0dafPm9qjVqIpUPCB9vE8qgqMW4woDoa uZj5PSytHB+Rdq0llx0UE6WzFfUAP4Ru7N8BFF8jStY8Z43YwJNUVWJ6CSpZQtOXbZk7 ff0IQNjDWLQ/i8YZWLoTyjQYTzF+xucMfsbSS+DMOZtzt6sf8aFmWuIkZbrrpwxvU/kQ NgqrV5pesnxbSjkXMSeSEL+4tgzRCNfA040D8EmqxquQW6Q2RvSUBC8WgbrJGLaFZ8Br PhOw== X-Gm-Message-State: AOJu0YxsDPJqsuScC3ApFDgRoXx5g4buapzptm/Ia0Ub4Au+EedjIHCu 6FUSqt4PWK+ARt0X8U3bm5CUOIfsabDF9Zl/RvfFX7DpyBxI1Rzn+fk49YMS/BCIaPKCAZOjYus G X-Received: by 2002:a05:600c:3b9d:b0:412:b623:bbcc with SMTP id n29-20020a05600c3b9d00b00412b623bbccmr737293wms.10.1709121432581; Wed, 28 Feb 2024 03:57:12 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id g8-20020a05600c310800b00412b775e979sm258013wmo.2.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id DEF635F8CE; Wed, 28 Feb 2024 11:57:02 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Peter Maydell , Brian Cain , Song Gao , Laurent Vivier , "Edgar E. Iglesias" , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs), qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs), qemu-s390x@nongnu.org (open list:S390 TCG CPUs) Subject: [PULL 10/29] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb Date: Wed, 28 Feb 2024 11:56:42 +0000 Message-Id: <20240228115701.1416107-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@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: Akihiko Odaki Align the parameters of gdb_get_reg_cb and gdb_set_reg_cb with the gdb_read_register and gdb_write_register members of CPUClass to allow to unify the logic to access registers of the core and coprocessors in the future. Signed-off-by: Akihiko Odaki Reviewed-by: Alex Bennée Message-Id: <20231213-gdb-v17-6-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-11-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index ac6fce99a64..bcaab1bc750 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -24,8 +24,8 @@ typedef struct GDBFeatureBuilder { /* Get or set a register. Returns the size of the register. */ -typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg); -typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg); +typedef int (*gdb_get_reg_cb)(CPUState *cpu, GByteArray *buf, int reg); +typedef int (*gdb_set_reg_cb)(CPUState *cpu, uint8_t *buf, int reg); /** * gdb_register_coprocessor() - register a supplemental set of registers diff --git a/target/arm/internals.h b/target/arm/internals.h index 05eb9daac7d..860bcc0c664 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1452,12 +1452,12 @@ static inline uint64_t pmu_counter_mask(CPUARMState *env) #ifdef TARGET_AARCH64 GDBFeature *arm_gen_dynamic_svereg_feature(CPUState *cpu, int base_reg); -int aarch64_gdb_get_sve_reg(CPUARMState *env, GByteArray *buf, int reg); -int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg); -int aarch64_gdb_get_fpu_reg(CPUARMState *env, GByteArray *buf, int reg); -int aarch64_gdb_set_fpu_reg(CPUARMState *env, uint8_t *buf, int reg); -int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg); -int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg); +int aarch64_gdb_get_sve_reg(CPUState *cs, GByteArray *buf, int reg); +int aarch64_gdb_set_sve_reg(CPUState *cs, uint8_t *buf, int reg); +int aarch64_gdb_get_fpu_reg(CPUState *cs, GByteArray *buf, int reg); +int aarch64_gdb_set_fpu_reg(CPUState *cs, uint8_t *buf, int reg); +int aarch64_gdb_get_pauth_reg(CPUState *cs, GByteArray *buf, int reg); +int aarch64_gdb_set_pauth_reg(CPUState *cs, uint8_t *buf, int reg); void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h index d732b6bb3c7..beb08cb7e38 100644 --- a/target/hexagon/internal.h +++ b/target/hexagon/internal.h @@ -33,8 +33,8 @@ int hexagon_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int hexagon_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -int hexagon_hvx_gdb_read_register(CPUHexagonState *env, GByteArray *mem_buf, int n); -int hexagon_hvx_gdb_write_register(CPUHexagonState *env, uint8_t *mem_buf, int n); +int hexagon_hvx_gdb_read_register(CPUState *env, GByteArray *mem_buf, int n); +int hexagon_hvx_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n); void hexagon_debug_vreg(CPUHexagonState *env, int regnum); void hexagon_debug_qreg(CPUHexagonState *env, int regnum); diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 446af5dd4ca..c0c7574dbd5 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -381,8 +381,8 @@ G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, void mb_cpu_dump_state(CPUState *cpu, FILE *f, int flags); int mb_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -int mb_cpu_gdb_read_stack_protect(CPUArchState *cpu, GByteArray *buf, int reg); -int mb_cpu_gdb_write_stack_protect(CPUArchState *cpu, uint8_t *buf, int reg); +int mb_cpu_gdb_read_stack_protect(CPUState *cs, GByteArray *buf, int reg); +int mb_cpu_gdb_write_stack_protect(CPUState *cs, uint8_t *buf, int reg); static inline uint32_t mb_cpu_read_msr(const CPUMBState *env) { diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 0ea417b2c9a..486ceb52d2e 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -502,7 +502,6 @@ const GDBFeature *gdb_find_static_feature(const char *xmlname) static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { CPUClass *cc = CPU_GET_CLASS(cpu); - CPUArchState *env = cpu_env(cpu); GDBRegisterState *r; if (reg < cc->gdb_num_core_regs) { @@ -513,7 +512,7 @@ static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) for (guint i = 0; i < cpu->gdb_regs->len; i++) { r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { - return r->get_reg(env, buf, reg - r->base_reg); + return r->get_reg(cpu, buf, reg - r->base_reg); } } } @@ -523,7 +522,6 @@ static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) { CPUClass *cc = CPU_GET_CLASS(cpu); - CPUArchState *env = cpu_env(cpu); GDBRegisterState *r; if (reg < cc->gdb_num_core_regs) { @@ -534,7 +532,7 @@ static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) for (guint i = 0; i < cpu->gdb_regs->len; i++) { r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { - return r->set_reg(env, mem_buf, reg - r->base_reg); + return r->set_reg(cpu, mem_buf, reg - r->base_reg); } } } diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index f2b201d3125..059d84f98e5 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -106,9 +106,10 @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return 0; } -static int vfp_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) +static int vfp_gdb_get_reg(CPUState *cs, GByteArray *buf, int reg) { - ARMCPU *cpu = env_archcpu(env); + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; int nregs = cpu_isar_feature(aa32_simd_r32, cpu) ? 32 : 16; /* VFP data registers are always little-endian. */ @@ -130,9 +131,10 @@ static int vfp_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) return 0; } -static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) +static int vfp_gdb_set_reg(CPUState *cs, uint8_t *buf, int reg) { - ARMCPU *cpu = env_archcpu(env); + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; int nregs = cpu_isar_feature(aa32_simd_r32, cpu) ? 32 : 16; if (reg < nregs) { @@ -156,8 +158,11 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) return 0; } -static int vfp_gdb_get_sysreg(CPUARMState *env, GByteArray *buf, int reg) +static int vfp_gdb_get_sysreg(CPUState *cs, GByteArray *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0: return gdb_get_reg32(buf, env->vfp.xregs[ARM_VFP_FPSID]); @@ -167,8 +172,11 @@ static int vfp_gdb_get_sysreg(CPUARMState *env, GByteArray *buf, int reg) return 0; } -static int vfp_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) +static int vfp_gdb_set_sysreg(CPUState *cs, uint8_t *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0: env->vfp.xregs[ARM_VFP_FPSID] = ldl_p(buf); @@ -180,8 +188,11 @@ static int vfp_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) return 0; } -static int mve_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) +static int mve_gdb_get_reg(CPUState *cs, GByteArray *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0: return gdb_get_reg32(buf, env->v7m.vpr); @@ -190,8 +201,11 @@ static int mve_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) } } -static int mve_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) +static int mve_gdb_set_reg(CPUState *cs, uint8_t *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0: env->v7m.vpr = ldl_p(buf); @@ -210,9 +224,10 @@ static int mve_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) * We return the number of bytes copied */ -static int arm_gdb_get_sysreg(CPUARMState *env, GByteArray *buf, int reg) +static int arm_gdb_get_sysreg(CPUState *cs, GByteArray *buf, int reg) { - ARMCPU *cpu = env_archcpu(env); + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; const ARMCPRegInfo *ri; uint32_t key; @@ -228,7 +243,7 @@ static int arm_gdb_get_sysreg(CPUARMState *env, GByteArray *buf, int reg) return 0; } -static int arm_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) +static int arm_gdb_set_sysreg(CPUState *cs, uint8_t *buf, int reg) { return 0; } @@ -367,8 +382,11 @@ static int m_sysreg_get(CPUARMState *env, GByteArray *buf, return gdb_get_reg32(buf, *ptr); } -static int arm_gdb_get_m_systemreg(CPUARMState *env, GByteArray *buf, int reg) +static int arm_gdb_get_m_systemreg(CPUState *cs, GByteArray *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + /* * Here, we emulate MRS instruction, where CONTROL has a mix of * banked and non-banked bits. @@ -379,7 +397,7 @@ static int arm_gdb_get_m_systemreg(CPUARMState *env, GByteArray *buf, int reg) return m_sysreg_get(env, buf, reg, env->v7m.secure); } -static int arm_gdb_set_m_systemreg(CPUARMState *env, uint8_t *buf, int reg) +static int arm_gdb_set_m_systemreg(CPUState *cs, uint8_t *buf, int reg) { return 0; /* TODO */ } @@ -414,12 +432,15 @@ static GDBFeature *arm_gen_dynamic_m_systemreg_feature(CPUState *cs, * For user-only, we see the non-secure registers via m_systemreg above. * For secext, encode the non-secure view as even and secure view as odd. */ -static int arm_gdb_get_m_secextreg(CPUARMState *env, GByteArray *buf, int reg) +static int arm_gdb_get_m_secextreg(CPUState *cs, GByteArray *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + return m_sysreg_get(env, buf, reg >> 1, reg & 1); } -static int arm_gdb_set_m_secextreg(CPUARMState *env, uint8_t *buf, int reg) +static int arm_gdb_set_m_secextreg(CPUState *cs, uint8_t *buf, int reg) { return 0; /* TODO */ } diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c index 5286d5c6043..caa31ff3fa1 100644 --- a/target/arm/gdbstub64.c +++ b/target/arm/gdbstub64.c @@ -72,8 +72,11 @@ int aarch64_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return 0; } -int aarch64_gdb_get_fpu_reg(CPUARMState *env, GByteArray *buf, int reg) +int aarch64_gdb_get_fpu_reg(CPUState *cs, GByteArray *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0 ... 31: { @@ -92,8 +95,11 @@ int aarch64_gdb_get_fpu_reg(CPUARMState *env, GByteArray *buf, int reg) } } -int aarch64_gdb_set_fpu_reg(CPUARMState *env, uint8_t *buf, int reg) +int aarch64_gdb_set_fpu_reg(CPUState *cs, uint8_t *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0 ... 31: /* 128 bit FP register */ @@ -116,9 +122,10 @@ int aarch64_gdb_set_fpu_reg(CPUARMState *env, uint8_t *buf, int reg) } } -int aarch64_gdb_get_sve_reg(CPUARMState *env, GByteArray *buf, int reg) +int aarch64_gdb_get_sve_reg(CPUState *cs, GByteArray *buf, int reg) { - ARMCPU *cpu = env_archcpu(env); + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; switch (reg) { /* The first 32 registers are the zregs */ @@ -164,9 +171,10 @@ int aarch64_gdb_get_sve_reg(CPUARMState *env, GByteArray *buf, int reg) return 0; } -int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg) +int aarch64_gdb_set_sve_reg(CPUState *cs, uint8_t *buf, int reg) { - ARMCPU *cpu = env_archcpu(env); + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; /* The first 32 registers are the zregs */ switch (reg) { @@ -210,8 +218,11 @@ int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg) return 0; } -int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg) +int aarch64_gdb_get_pauth_reg(CPUState *cs, GByteArray *buf, int reg) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + switch (reg) { case 0: /* pauth_dmask */ case 1: /* pauth_cmask */ @@ -241,7 +252,7 @@ int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg) } } -int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg) +int aarch64_gdb_set_pauth_reg(CPUState *cs, uint8_t *buf, int reg) { /* All pseudo registers are read-only. */ return 0; diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index 54d37e006e0..6007e6462b9 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -81,8 +81,11 @@ static int gdb_get_qreg(CPUHexagonState *env, GByteArray *mem_buf, int n) return total; } -int hexagon_hvx_gdb_read_register(CPUHexagonState *env, GByteArray *mem_buf, int n) +int hexagon_hvx_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { + HexagonCPU *cpu = HEXAGON_CPU(cs); + CPUHexagonState *env = &cpu->env; + if (n < NUM_VREGS) { return gdb_get_vreg(env, mem_buf, n); } @@ -115,8 +118,11 @@ static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n) return MAX_VEC_SIZE_BYTES / 8; } -int hexagon_hvx_gdb_write_register(CPUHexagonState *env, uint8_t *mem_buf, int n) +int hexagon_hvx_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { + HexagonCPU *cpu = HEXAGON_CPU(cs); + CPUHexagonState *env = &cpu->env; + if (n < NUM_VREGS) { return gdb_put_vreg(env, mem_buf, n); } diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 843a869450e..22c6889011e 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -84,9 +84,11 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return length; } -static int loongarch_gdb_get_fpu(CPULoongArchState *env, - GByteArray *mem_buf, int n) +static int loongarch_gdb_get_fpu(CPUState *cs, GByteArray *mem_buf, int n) { + LoongArchCPU *cpu = LOONGARCH_CPU(cs); + CPULoongArchState *env = &cpu->env; + if (0 <= n && n < 32) { return gdb_get_reg64(mem_buf, env->fpr[n].vreg.D(0)); } else if (32 <= n && n < 40) { @@ -97,9 +99,10 @@ static int loongarch_gdb_get_fpu(CPULoongArchState *env, return 0; } -static int loongarch_gdb_set_fpu(CPULoongArchState *env, - uint8_t *mem_buf, int n) +static int loongarch_gdb_set_fpu(CPUState *cs, uint8_t *mem_buf, int n) { + LoongArchCPU *cpu = LOONGARCH_CPU(cs); + CPULoongArchState *env = &cpu->env; int length = 0; if (0 <= n && n < 32) { diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 9808d676a22..1c33995e5da 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -29,8 +29,11 @@ #define SIGNBIT (1u << 31) -static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) +static int cf_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n) { + M68kCPU *cpu = M68K_CPU(cs); + CPUM68KState *env = &cpu->env; + if (n < 8) { float_status s; return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s)); @@ -46,8 +49,11 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) return 0; } -static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n) +static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) { + M68kCPU *cpu = M68K_CPU(cs); + CPUM68KState *env = &cpu->env; + if (n < 8) { float_status s; env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s); @@ -66,8 +72,11 @@ static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n) return 0; } -static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) +static int m68k_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n) { + M68kCPU *cpu = M68K_CPU(cs); + CPUM68KState *env = &cpu->env; + if (n < 8) { int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper); len += gdb_get_reg16(mem_buf, 0); @@ -85,8 +94,11 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) return 0; } -static int m68k_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n) +static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) { + M68kCPU *cpu = M68K_CPU(cs); + CPUM68KState *env = &cpu->env; + if (n < 8) { env->fregs[n].l.upper = lduw_be_p(mem_buf); env->fregs[n].l.lower = ldq_be_p(mem_buf + 4); diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index 29ac6e9c0f7..6ffc5ad0752 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -94,8 +94,10 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) return gdb_get_reg32(mem_buf, val); } -int mb_cpu_gdb_read_stack_protect(CPUMBState *env, GByteArray *mem_buf, int n) +int mb_cpu_gdb_read_stack_protect(CPUState *cs, GByteArray *mem_buf, int n) { + MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); + CPUMBState *env = &cpu->env; uint32_t val; switch (n) { @@ -153,8 +155,11 @@ int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return 4; } -int mb_cpu_gdb_write_stack_protect(CPUMBState *env, uint8_t *mem_buf, int n) +int mb_cpu_gdb_write_stack_protect(CPUState *cs, uint8_t *mem_buf, int n) { + MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); + CPUMBState *env = &cpu->env; + switch (n) { case GDB_SP_SHL: env->slr = ldl_p(mem_buf); diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 625ccf96c5b..43f61130c5f 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -369,8 +369,10 @@ static int gdb_find_spr_idx(CPUPPCState *env, int n) return -1; } -static int gdb_get_spr_reg(CPUPPCState *env, GByteArray *buf, int n) +static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; int reg; int len; @@ -410,8 +412,10 @@ static int gdb_get_spr_reg(CPUPPCState *env, GByteArray *buf, int n) return len; } -static int gdb_set_spr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +static int gdb_set_spr_reg(CPUState *cs, uint8_t *mem_buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; int reg; int len; @@ -439,8 +443,10 @@ static int gdb_set_spr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) } #endif -static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n) +static int gdb_get_float_reg(CPUState *cs, GByteArray *buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; uint8_t *mem_buf; if (n < 32) { gdb_get_reg64(buf, *cpu_fpr_ptr(env, n)); @@ -457,8 +463,11 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n) return 0; } -static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +static int gdb_set_float_reg(CPUState *cs, uint8_t *mem_buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + if (n < 32) { ppc_maybe_bswap_register(env, mem_buf, 8); *cpu_fpr_ptr(env, n) = ldq_p(mem_buf); @@ -472,8 +481,10 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n) return 0; } -static int gdb_get_avr_reg(CPUPPCState *env, GByteArray *buf, int n) +static int gdb_get_avr_reg(CPUState *cs, GByteArray *buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; uint8_t *mem_buf; if (n < 32) { @@ -498,8 +509,11 @@ static int gdb_get_avr_reg(CPUPPCState *env, GByteArray *buf, int n) return 0; } -static int gdb_set_avr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +static int gdb_set_avr_reg(CPUState *cs, uint8_t *mem_buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + if (n < 32) { ppc_avr_t *avr = cpu_avr_ptr(env, n); ppc_maybe_bswap_register(env, mem_buf, 16); @@ -520,8 +534,11 @@ static int gdb_set_avr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) return 0; } -static int gdb_get_spe_reg(CPUPPCState *env, GByteArray *buf, int n) +static int gdb_get_spe_reg(CPUState *cs, GByteArray *buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + if (n < 32) { #if defined(TARGET_PPC64) gdb_get_reg32(buf, env->gpr[n] >> 32); @@ -544,8 +561,11 @@ static int gdb_get_spe_reg(CPUPPCState *env, GByteArray *buf, int n) return 0; } -static int gdb_set_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +static int gdb_set_spe_reg(CPUState *cs, uint8_t *mem_buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + if (n < 32) { #if defined(TARGET_PPC64) target_ulong lo = (uint32_t)env->gpr[n]; @@ -573,8 +593,11 @@ static int gdb_set_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n) return 0; } -static int gdb_get_vsx_reg(CPUPPCState *env, GByteArray *buf, int n) +static int gdb_get_vsx_reg(CPUState *cs, GByteArray *buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + if (n < 32) { gdb_get_reg64(buf, *cpu_vsrl_ptr(env, n)); ppc_maybe_bswap_register(env, gdb_get_reg_ptr(buf, 8), 8); @@ -583,8 +606,11 @@ static int gdb_get_vsx_reg(CPUPPCState *env, GByteArray *buf, int n) return 0; } -static int gdb_set_vsx_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +static int gdb_set_vsx_reg(CPUState *cs, uint8_t *mem_buf, int n) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + if (n < 32) { ppc_maybe_bswap_register(env, mem_buf, 8); *cpu_vsrl_ptr(env, n) = ldq_p(mem_buf); diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index ec1fc6a29da..546e8692d17 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -108,8 +108,11 @@ int riscv_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return length; } -static int riscv_gdb_get_fpu(CPURISCVState *env, GByteArray *buf, int n) +static int riscv_gdb_get_fpu(CPUState *cs, GByteArray *buf, int n) { + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + if (n < 32) { if (env->misa_ext & RVD) { return gdb_get_reg64(buf, env->fpr[n]); @@ -121,8 +124,11 @@ static int riscv_gdb_get_fpu(CPURISCVState *env, GByteArray *buf, int n) return 0; } -static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_t *mem_buf, int n) +static int riscv_gdb_set_fpu(CPUState *cs, uint8_t *mem_buf, int n) { + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + if (n < 32) { env->fpr[n] = ldq_p(mem_buf); /* always 64-bit */ return sizeof(uint64_t); @@ -130,9 +136,11 @@ static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_t *mem_buf, int n) return 0; } -static int riscv_gdb_get_vector(CPURISCVState *env, GByteArray *buf, int n) +static int riscv_gdb_get_vector(CPUState *cs, GByteArray *buf, int n) { - uint16_t vlenb = riscv_cpu_cfg(env)->vlenb; + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + uint16_t vlenb = cpu->cfg.vlenb; if (n < 32) { int i; int cnt = 0; @@ -146,9 +154,11 @@ static int riscv_gdb_get_vector(CPURISCVState *env, GByteArray *buf, int n) return 0; } -static int riscv_gdb_set_vector(CPURISCVState *env, uint8_t *mem_buf, int n) +static int riscv_gdb_set_vector(CPUState *cs, uint8_t *mem_buf, int n) { - uint16_t vlenb = riscv_cpu_cfg(env)->vlenb; + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + uint16_t vlenb = cpu->cfg.vlenb; if (n < 32) { int i; for (i = 0; i < vlenb; i += 8) { @@ -160,8 +170,11 @@ static int riscv_gdb_set_vector(CPURISCVState *env, uint8_t *mem_buf, int n) return 0; } -static int riscv_gdb_get_csr(CPURISCVState *env, GByteArray *buf, int n) +static int riscv_gdb_get_csr(CPUState *cs, GByteArray *buf, int n) { + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + if (n < CSR_TABLE_SIZE) { target_ulong val = 0; int result; @@ -174,8 +187,11 @@ static int riscv_gdb_get_csr(CPURISCVState *env, GByteArray *buf, int n) return 0; } -static int riscv_gdb_set_csr(CPURISCVState *env, uint8_t *mem_buf, int n) +static int riscv_gdb_set_csr(CPUState *cs, uint8_t *mem_buf, int n) { + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + if (n < CSR_TABLE_SIZE) { target_ulong val = ldtul_p(mem_buf); int result; @@ -188,25 +204,31 @@ static int riscv_gdb_set_csr(CPURISCVState *env, uint8_t *mem_buf, int n) return 0; } -static int riscv_gdb_get_virtual(CPURISCVState *cs, GByteArray *buf, int n) +static int riscv_gdb_get_virtual(CPUState *cs, GByteArray *buf, int n) { if (n == 0) { #ifdef CONFIG_USER_ONLY return gdb_get_regl(buf, 0); #else - return gdb_get_regl(buf, cs->priv); + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + + return gdb_get_regl(buf, env->priv); #endif } return 0; } -static int riscv_gdb_set_virtual(CPURISCVState *cs, uint8_t *mem_buf, int n) +static int riscv_gdb_set_virtual(CPUState *cs, uint8_t *mem_buf, int n) { if (n == 0) { #ifndef CONFIG_USER_ONLY - cs->priv = ldtul_p(mem_buf) & 0x3; - if (cs->priv == PRV_RESERVED) { - cs->priv = PRV_S; + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; + + env->priv = ldtul_p(mem_buf) & 0x3; + if (env->priv == PRV_RESERVED) { + env->priv = PRV_S; } #endif return sizeof(target_ulong); diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c index 256f1c7c6db..a9f4eb92adf 100644 --- a/target/s390x/gdbstub.c +++ b/target/s390x/gdbstub.c @@ -68,8 +68,11 @@ int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) #define S390_A0_REGNUM 0 #define S390_A15_REGNUM 15 -static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n) +static int cpu_read_ac_reg(CPUState *cs, GByteArray *buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_A0_REGNUM ... S390_A15_REGNUM: return gdb_get_reg32(buf, env->aregs[n]); @@ -78,8 +81,11 @@ static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n) } } -static int cpu_write_ac_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_ac_reg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_A0_REGNUM ... S390_A15_REGNUM: env->aregs[n] = ldl_p(mem_buf); @@ -95,8 +101,11 @@ static int cpu_write_ac_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_F0_REGNUM 1 #define S390_F15_REGNUM 16 -static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n) +static int cpu_read_fp_reg(CPUState *cs, GByteArray *buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_FPC_REGNUM: return gdb_get_reg32(buf, env->fpc); @@ -107,8 +116,11 @@ static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n) } } -static int cpu_write_fp_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_FPC_REGNUM: env->fpc = ldl_p(mem_buf); @@ -127,8 +139,10 @@ static int cpu_write_fp_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_V16_REGNUM 16 #define S390_V31_REGNUM 31 -static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n) +static int cpu_read_vreg(CPUState *cs, GByteArray *buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; int ret; switch (n) { @@ -146,8 +160,11 @@ static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n) return ret; } -static int cpu_write_vreg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_V0L_REGNUM ... S390_V15L_REGNUM: env->vregs[n][1] = ldtul_p(mem_buf + 8); @@ -166,8 +183,11 @@ static int cpu_write_vreg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_C15_REGNUM 15 #ifndef CONFIG_USER_ONLY -static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n) +static int cpu_read_c_reg(CPUState *cs, GByteArray *buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_C0_REGNUM ... S390_C15_REGNUM: return gdb_get_regl(buf, env->cregs[n]); @@ -176,8 +196,11 @@ static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n) } } -static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_C0_REGNUM ... S390_C15_REGNUM: env->cregs[n] = ldtul_p(mem_buf); @@ -197,8 +220,11 @@ static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_VIRT_BEA_REGNUM 2 #define S390_VIRT_PREFIX_REGNUM 3 -static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n) +static int cpu_read_virt_reg(CPUState *cs, GByteArray *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_VIRT_CKC_REGNUM: return gdb_get_regl(mem_buf, env->ckc); @@ -213,24 +239,27 @@ static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n) } } -static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_VIRT_CKC_REGNUM: env->ckc = ldtul_p(mem_buf); - cpu_synchronize_post_init(env_cpu(env)); + cpu_synchronize_post_init(cs); return 8; case S390_VIRT_CPUTM_REGNUM: env->cputm = ldtul_p(mem_buf); - cpu_synchronize_post_init(env_cpu(env)); + cpu_synchronize_post_init(cs); return 8; case S390_VIRT_BEA_REGNUM: env->gbea = ldtul_p(mem_buf); - cpu_synchronize_post_init(env_cpu(env)); + cpu_synchronize_post_init(cs); return 8; case S390_VIRT_PREFIX_REGNUM: env->psa = ldtul_p(mem_buf); - cpu_synchronize_post_init(env_cpu(env)); + cpu_synchronize_post_init(cs); return 8; default: return 0; @@ -243,8 +272,11 @@ static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_VIRT_KVM_PFS_REGNUM 2 #define S390_VIRT_KVM_PFC_REGNUM 3 -static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n) +static int cpu_read_virt_kvm_reg(CPUState *cs, GByteArray *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_VIRT_KVM_PP_REGNUM: return gdb_get_regl(mem_buf, env->pp); @@ -259,8 +291,11 @@ static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n) } } -static int cpu_write_virt_kvm_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + switch (n) { case S390_VIRT_KVM_PP_REGNUM: env->pp = ldtul_p(mem_buf); @@ -290,13 +325,19 @@ static int cpu_write_virt_kvm_reg(CPUS390XState *env, uint8_t *mem_buf, int n) #define S390_GS_GSSM_REGNUM 2 #define S390_GS_GSEPLA_REGNUM 3 -static int cpu_read_gs_reg(CPUS390XState *env, GByteArray *buf, int n) +static int cpu_read_gs_reg(CPUState *cs, GByteArray *buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + return gdb_get_regl(buf, env->gscb[n]); } -static int cpu_write_gs_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; + env->gscb[n] = ldtul_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; From patchwork Wed Feb 28 11:56:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776472 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251901wrn; Wed, 28 Feb 2024 04:01:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXfgIp2/C2oRj8HrQ/jmpCeZsCSNYix0WXaLOhQmYFQF8RD+7LiZCirtaotMMHVlqcyfFrsSuEMamaGEYWMWNSl X-Google-Smtp-Source: AGHT+IGDW78CnoDZtwY69QQqUQzoNp1g4H1+IlGhnEpfPZ56mwx/2dxiKp29ym4hwBAD+kYr0i9B X-Received: by 2002:a05:620a:12d9:b0:787:755b:faea with SMTP id e25-20020a05620a12d900b00787755bfaeamr4277592qkl.27.1709121660018; Wed, 28 Feb 2024 04:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121660; cv=none; d=google.com; s=arc-20160816; b=py40RWDpOu1NuKeGutE2kpWFRZFqXjrzB9zcAGHEom4EIQOzFDoGmks/6dx4yHNQJz /1xUqUqMzVuToiUq1vDHuL5rh/3Nrp+5bR6D86IWewqS8XM9BiFUmnu1kewFa6hBRejU UH+xf7AkoL0z6p/jbdKjxhrcyP/BgM1PwiM4AXoSC+PJP2As0OnonPLP6nRaeXRx+JBs bFpuX0nzpEp2PdyjqeMbzOhEHViMP9hm81aDoW5h3vhorERvYWa/DBvS55NDLsEwEOKZ 8Sxwa/6dAG6nzphe/NZWg4xG0r3XH/gEWEbLfO/8UoYC9j+wJbhbpWfNSHsAnBkwe/xC uG1A== 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:dkim-signature; bh=JgAv+tQLaa/7Dxj7jFkGh88um0ePTyVloBc6ZuEZWJk=; fh=Lq0BOG4wXvqYgUa45NhGMnvrhaQLHyfy3VSrK1eZP+k=; b=quJzXJ7ZReDQjmcpwGkwy8JrwrMuru3a5goX4OmtawSNQ4wOHq4fVsr0W/9SwEsrzr BXvDcHP+YZ0uCVcLa0vJNb8goM7qOj/ET6MhAHPvANZnG6e+PzmQ+kJ1z2Q8z22lyukT qYjroIUJHtpt+2axvhHyHpperMUSsBcuFB6SHoDbQy336XerhlmH7u5ojcn++m0OU1OE g3LDPqHg6MRrik6PoRqWmLi/JHWoyYNX1V0hlm9ZrG6okCWRM2EsDJp4XYtJol5yJ49R 8e7k26NY7T1gygeQIwGVCwJVYz3muOODdO/oi4tlf7HdGj/jc6COIhuTf9hZVpQAJsQf 8UwA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JGGLEv90; 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 g23-20020a37e217000000b007879e77bd4esi9446702qki.650.2024.02.28.04.00.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:00: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; dkim=pass header.i=@linaro.org header.s=google header.b=JGGLEv90; 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 1rfIYv-00060u-Qu; Wed, 28 Feb 2024 06:57:25 -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 1rfIYs-0005xv-Po for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:22 -0500 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 1rfIYf-0005jF-Qk for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:22 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-412a3ebad2aso25500275e9.1 for ; Wed, 28 Feb 2024 03:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121428; x=1709726228; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JgAv+tQLaa/7Dxj7jFkGh88um0ePTyVloBc6ZuEZWJk=; b=JGGLEv90aD8bSy22MYwJG4dHrzFma0T3ZzVtnPGmt6+8ocPM1yLX0/REqyCgjAk2/L BtE9CDiJ7pIgKnVwXL8/4ZJHZPbDGuM77pwiVdvIiqHHbKkJgqWW5jyKyweG2saifA8T GT70JcJwAqJceMEe5N9rw6aM+/ahwoXbvwNeEbv1QOGoD62d563heKxhV7PXz49fExei +j5BJqK8xy1Pf+lS8cq5uRgvBdDdZ6Au1VNT/EMkunlHWI+3IUwBXgPZdh76dO0R0dBd +6VCCge6P0vXHaEDUGWBvNxFoi7eDXqPZWRVZBAAQQO9VER0qNs55x6L+t8r9AYEsoc4 ulLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121428; x=1709726228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JgAv+tQLaa/7Dxj7jFkGh88um0ePTyVloBc6ZuEZWJk=; b=nngfT+BeLGAjumzdY9WEBbJJbgak2UblVCvE0LNTUS2dLwEma/FlFrZVQNqpX30FFH LyTvTpsd5FWmYGT19lCEhTiWieoJhq9L1HA3jpLH98EI5eWFG/ty2J2CfmJZBg+VryBD IJb9QYBbyygFYSVdrxGJ6RU3wllHxsoMfq+eCJgS2tSc0H9NM3NHCok/y+3ewzfEwxw7 12uczxeYaGtk97loEFMlGjqRmTpGoUxyIkhsJimmnODWeMfaH3+8rsNHToFUgcfIyrEx ye10ojcHuNUnerFAM0YZKoy8g+hrUjBApcd2lxdbrxUupx5AZBwCK3VljrKyPoIx0M7j fFMA== X-Gm-Message-State: AOJu0YxjWytEUioxu8BTD0TtTzXdSsdR/CYho3SrIhOE+6KxqOZufRAg vWN93SregAcm7dlu3zM/o8exdDcGGuOEaH62vUyC+L/FpFayo4/BEcRCnYkBjFU= X-Received: by 2002:a05:6000:50c:b0:33d:2472:eb8c with SMTP id a12-20020a056000050c00b0033d2472eb8cmr8283895wrf.19.1709121428445; Wed, 28 Feb 2024 03:57:08 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f1-20020adfe901000000b0033d8b1ace25sm14456687wrm.2.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0514E5F90B; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 11/29] gdbstub: Simplify XML lookup Date: Wed, 28 Feb 2024 11:56:43 +0000 Message-Id: <20240228115701.1416107-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@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, 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 Now we know all instances of GDBFeature that is used in CPU so we can traverse them to find XML. This removes the need for a CPU-specific lookup function for dynamic XMLs. Signed-off-by: Akihiko Odaki Reviewed-by: Alex Bennée Message-Id: <20231213-gdb-v17-7-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-12-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index bcaab1bc750..82a8afa237f 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -27,6 +27,12 @@ typedef struct GDBFeatureBuilder { typedef int (*gdb_get_reg_cb)(CPUState *cpu, GByteArray *buf, int reg); typedef int (*gdb_set_reg_cb)(CPUState *cpu, uint8_t *buf, int reg); +/** + * gdb_init_cpu(): Initialize the CPU for gdbstub. + * @cpu: The CPU to be initialized. + */ +void gdb_init_cpu(CPUState *cpu); + /** * gdb_register_coprocessor() - register a supplemental set of registers * @cpu - the CPU associated with registers diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 486ceb52d2e..d573f808d2e 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -352,6 +352,7 @@ static const char *get_feature_xml(const char *p, const char **newp, { CPUState *cpu = gdb_get_first_cpu_in_process(process); CPUClass *cc = CPU_GET_CLASS(cpu); + GDBRegisterState *r; size_t len; /* @@ -365,7 +366,6 @@ static const char *get_feature_xml(const char *p, const char **newp, /* Is it the main target xml? */ if (strncmp(p, "target.xml", len) == 0) { if (!process->target_xml) { - GDBRegisterState *r; g_autoptr(GPtrArray) xml = g_ptr_array_new_with_free_func(g_free); g_ptr_array_add( @@ -380,18 +380,12 @@ static const char *get_feature_xml(const char *p, const char **newp, g_markup_printf_escaped("%s", cc->gdb_arch_name(cpu))); } - g_ptr_array_add( - xml, - g_markup_printf_escaped("", - cc->gdb_core_xml_file)); - if (cpu->gdb_regs) { - for (guint i = 0; i < cpu->gdb_regs->len; i++) { - r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - g_ptr_array_add( - xml, - g_markup_printf_escaped("", - r->feature->xmlname)); - } + for (guint i = 0; i < cpu->gdb_regs->len; i++) { + r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); + g_ptr_array_add( + xml, + g_markup_printf_escaped("", + r->feature->xmlname)); } g_ptr_array_add(xml, g_strdup("")); g_ptr_array_add(xml, NULL); @@ -400,20 +394,11 @@ static const char *get_feature_xml(const char *p, const char **newp, } return process->target_xml; } - /* Is it dynamically generated by the target? */ - if (cc->gdb_get_dynamic_xml) { - g_autofree char *xmlname = g_strndup(p, len); - const char *xml = cc->gdb_get_dynamic_xml(cpu, xmlname); - if (xml) { - return xml; - } - } - /* Is it one of the encoded gdb-xml/ files? */ - for (int i = 0; gdb_static_features[i].xmlname; i++) { - const char *name = gdb_static_features[i].xmlname; - if ((strncmp(name, p, len) == 0) && - strlen(name) == len) { - return gdb_static_features[i].xml; + /* Is it one of the features? */ + for (guint i = 0; i < cpu->gdb_regs->len; i++) { + r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); + if (strncmp(p, r->feature->xmlname, len) == 0) { + return r->feature->xml; } } @@ -508,12 +493,10 @@ static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) return cc->gdb_read_register(cpu, buf, reg); } - if (cpu->gdb_regs) { - for (guint i = 0; i < cpu->gdb_regs->len; i++) { - r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { - return r->get_reg(cpu, buf, reg - r->base_reg); - } + for (guint i = 0; i < cpu->gdb_regs->len; i++) { + r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); + if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { + return r->get_reg(cpu, buf, reg - r->base_reg); } } return 0; @@ -528,51 +511,70 @@ static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) return cc->gdb_write_register(cpu, mem_buf, reg); } - if (cpu->gdb_regs) { - for (guint i = 0; i < cpu->gdb_regs->len; i++) { - r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { - return r->set_reg(cpu, mem_buf, reg - r->base_reg); - } + for (guint i = 0; i < cpu->gdb_regs->len; i++) { + r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); + if (r->base_reg <= reg && reg < r->base_reg + r->feature->num_regs) { + return r->set_reg(cpu, mem_buf, reg - r->base_reg); } } return 0; } +static void gdb_register_feature(CPUState *cpu, int base_reg, + gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg, + const GDBFeature *feature) +{ + GDBRegisterState s = { + .base_reg = base_reg, + .get_reg = get_reg, + .set_reg = set_reg, + .feature = feature + }; + + g_array_append_val(cpu->gdb_regs, s); +} + +void gdb_init_cpu(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + const GDBFeature *feature; + + cpu->gdb_regs = g_array_new(false, false, sizeof(GDBRegisterState)); + + if (cc->gdb_core_xml_file) { + feature = gdb_find_static_feature(cc->gdb_core_xml_file); + gdb_register_feature(cpu, 0, + cc->gdb_read_register, cc->gdb_write_register, + feature); + } + + cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs; +} + void gdb_register_coprocessor(CPUState *cpu, gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg, const GDBFeature *feature, int g_pos) { GDBRegisterState *s; guint i; + int base_reg = cpu->gdb_num_regs; - if (cpu->gdb_regs) { - for (i = 0; i < cpu->gdb_regs->len; i++) { - /* Check for duplicates. */ - s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - if (s->feature == feature) { - return; - } + for (i = 0; i < cpu->gdb_regs->len; i++) { + /* Check for duplicates. */ + s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); + if (s->feature == feature) { + return; } - } else { - cpu->gdb_regs = g_array_new(false, false, sizeof(GDBRegisterState)); - i = 0; } - g_array_set_size(cpu->gdb_regs, i + 1); - s = &g_array_index(cpu->gdb_regs, GDBRegisterState, i); - s->base_reg = cpu->gdb_num_regs; - s->get_reg = get_reg; - s->set_reg = set_reg; - s->feature = feature; + gdb_register_feature(cpu, base_reg, get_reg, set_reg, feature); /* Add to end of list. */ cpu->gdb_num_regs += feature->num_regs; if (g_pos) { - if (g_pos != s->base_reg) { + if (g_pos != base_reg) { error_report("Error: Bad gdb register numbering for '%s', " - "expected %d got %d", feature->xml, - g_pos, s->base_reg); + "expected %d got %d", feature->xml, g_pos, base_reg); } else { cpu->gdb_num_g_regs = cpu->gdb_num_regs; } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 67db07741d7..fe16d0d9df8 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -27,6 +27,7 @@ #include "qemu/main-loop.h" #include "exec/log.h" #include "exec/cpu-common.h" +#include "exec/gdbstub.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "sysemu/tcg.h" @@ -240,11 +241,10 @@ static void cpu_common_unrealizefn(DeviceState *dev) static void cpu_common_initfn(Object *obj) { CPUState *cpu = CPU(obj); - CPUClass *cc = CPU_GET_CLASS(obj); + gdb_init_cpu(cpu); cpu->cpu_index = UNASSIGNED_CPU_INDEX; cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX; - cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs; /* user-mode doesn't have configurable SMP topology */ /* the default value is changed by qemu_init_vcpu() for system-mode */ cpu->nr_cores = 1; @@ -264,6 +264,7 @@ static void cpu_common_finalize(Object *obj) { CPUState *cpu = CPU(obj); + g_array_free(cpu->gdb_regs, TRUE); qemu_lockcnt_destroy(&cpu->in_ioctl_lock); qemu_mutex_destroy(&cpu->work_mutex); } From patchwork Wed Feb 28 11:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776460 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp250857wrn; Wed, 28 Feb 2024 03:58:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXtPapcosSj4AkAwVnTAfbzm52zW9gjTRnbpWFuFuNyrIWNpOhMp5GC9w6sCTYfwh1xHoUWPzsYZN3U+mCvf85Y X-Google-Smtp-Source: AGHT+IFxq1OZjDzCjn0qk43kt5duyU1Fen+GfElHBO7NaX0v6eUZiXtN4H+ymJi6ZvvY8sW7d0Dd X-Received: by 2002:ac8:5c8c:0:b0:42e:b34b:613 with SMTP id r12-20020ac85c8c000000b0042eb34b0613mr474876qta.2.1709121500987; Wed, 28 Feb 2024 03:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121500; cv=none; d=google.com; s=arc-20160816; b=uE13llhyKWqLLoFSBp1mN3968DtK52Qcglw/j3ux07eWMz8tM8zmWbOA9NM1Yh19w4 D1/dHikfUPOGOUCmnHnJ00oX9hXEvfkBRolyM1y7uyEYYa5WDzQWz4PNiYYiF68r18Hw cR2B3ZQ8nCLPFrGciQ76oh9HHuL6eEBgjQdJ9qHhgvpJubuUZTwdrpzugx83Ddbntsb8 45MKfUtuqs7zY5Bwm2P57rL1ASC7a1wUfFIS2KFoF8htjaxb7tjfbOlBq0ra1AHeGDsD qsfJNozG65A7BKBpWCEWN20dX0EOM/AhVzE9AA64OJAR7G/i/be2hhI7GZ0D6Wv13+Mq yYZQ== 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:dkim-signature; bh=tlF67/gXODIwphY8iHQIqEehOvTtXVeIZXVLerATEz8=; fh=EfPyIxrsbgMaj/6+10C/TtyCPh00JSInui7zHWDz9d8=; b=NflSNQWr3V4Ska//tqk4hNQGy/2AZHX7mHCRVaeVqKx2E3pxb7m7vhBTBLqa4IBuoL KMIz8i3qsM97flpobApBX/G/JLMfktifWzc1/UHJYjnrgwgXivloCuUcuRdvbNngzrfr L2tzKSnOrIxJ8czUd3iZEJh6NH5jlPLj2cvykvWnponRq8D5Of/PTRLkQOkHWo+zpxwv Lorm4Rmum45md1sSSTzID6czLEYDUV/cSJouE0trqBzZcHUaLYdGxx96YAc6GemTXwuY IhkTF98ZO7Onf46liIAx9FGC4YlTW6jkHPJoOfH4CApUPbzv4CVldo9Sp94pkxeLbv47 ir7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tie8XU1Q; 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 bp41-20020a05622a1ba900b0042e679653d5si10174728qtb.325.2024.02.28.03.58.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:58:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Tie8XU1Q; 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 1rfIYt-0005yw-OR; Wed, 28 Feb 2024 06:57:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfIYq-0005uP-K2 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:20 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYk-0005lR-Gm for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:20 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33d754746c3so3524024f8f.1 for ; Wed, 28 Feb 2024 03:57:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121433; x=1709726233; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tlF67/gXODIwphY8iHQIqEehOvTtXVeIZXVLerATEz8=; b=Tie8XU1QhXwVHHWSGW8CUSA9mDymubuv5OSc+rSB1NiupjeW6bQ0KpNTTtpymvqgZv 9m1NRkGWhVkAAy5r+wkPMHs5Ybc54z3toJEao2+qqshdicLl5yxRBf+B8trVmNRM5517 zTFXLf58JWL4V8D/i6xgQxnWpOXFW2mn0yp5FH+WacO7+z05xQ8Iqb3VHsfAUffu6ZsA iNhuXas/HedqtJj2jMaGHNYmkALGawIZUWYdpp28gwELvEvItwTZKxOvLPUNkx7p1Rz8 4XxvdHWrCfRTaiAfJr6pZ4g8URyF41PDFjdBcs0muKhd5+Qy+LBlPfBP3CXLlxAV5JRp kv1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121433; x=1709726233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tlF67/gXODIwphY8iHQIqEehOvTtXVeIZXVLerATEz8=; b=EROJXG8X3hu/xeD/q65j3DkNMgFRTGuZm96PKwBr2mWjyI+4wEGwhaZP0hkj9nSaLf p04EJl7/MCi8qo5nLAahUNJKNFCmIsTG7URDYCzwkuIJhpxmj8HHnHDqv6bCF51cVe8H 4MBU/NDvkshTtHo0/4v0mE6z6bKyDcv4I/I29I9Tkh1Xxmp4WgKJtsLJfmIo2dL8WbJy p2jPVGsAKNHxKFCsPCMinQcE/NfWVfo3BkpZnpb2cCYS1RWr+LUzPzUUXCk8j3DA93VT rDqynv6xsWiEp03v3qZK/NH8dxGmlxiDdXHQa8+i4HARegR3rDII42G0pWa1GZPH0m1l yGzg== X-Gm-Message-State: AOJu0YxqoGdW3LW2xYqJn2JUDp2qVlBzFnf6H8fCUCnjdT6FkXz66ZrA Bm/qPowarFIf8f/rsTvsPzYkMA91UL8Pg/c8vSsn/ey+Ye7J/lnGjWIDn0AY/gI= X-Received: by 2002:adf:e10f:0:b0:33d:5350:774a with SMTP id t15-20020adfe10f000000b0033d5350774amr9183091wrz.11.1709121432871; Wed, 28 Feb 2024 03:57:12 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bw11-20020a0560001f8b00b0033da4b06632sm14694132wrb.6.2024.02.28.03.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2A6FB5F7DF; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Peter Maydell , Michael Rolnik , Brian Cain , Paolo Bonzini , Song Gao , Laurent Vivier , "Edgar E. Iglesias" , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Yoshinori Sato , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs), qemu-s390x@nongnu.org (open list:S390 TCG CPUs) Subject: [PULL 12/29] gdbstub: Infer number of core registers from XML Date: Wed, 28 Feb 2024 11:56:44 +0000 Message-Id: <20240228115701.1416107-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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=unavailable 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 GDBFeature has the num_regs member so use it where applicable to remove magic numbers. Signed-off-by: Akihiko Odaki Message-Id: <20231213-gdb-v17-8-777047380591@daynix.com> [AJB: remove core reg check from microblaze read reg] Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-13-alex.bennee@linaro.org> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4385ce54c99..1bbf21b2201 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -126,7 +126,8 @@ struct SysemuCPUOps; * @gdb_adjust_breakpoint: Callback for adjusting the address of a * breakpoint. Used by AVR to handle a gdb mis-feature with * its Harvard architecture split code and data. - * @gdb_num_core_regs: Number of core registers accessible to GDB. + * @gdb_num_core_regs: Number of core registers accessible to GDB or 0 to infer + * from @gdb_core_xml_file. * @gdb_core_xml_file: File name for core registers GDB XML description. * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop * before the insn which triggers a watchpoint rather than after it. diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index d37a49b4d92..43a46a5a068 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -491,8 +491,6 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState *env, vaddr *pc, #define S390_R13_REGNUM 15 #define S390_R14_REGNUM 16 #define S390_R15_REGNUM 17 -/* Total Core Registers. */ -#define S390_NUM_CORE_REGS 18 static inline void setcc(S390CPU *cpu, uint64_t cc) { diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index d573f808d2e..f766ee277a0 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -546,9 +546,12 @@ void gdb_init_cpu(CPUState *cpu) gdb_register_feature(cpu, 0, cc->gdb_read_register, cc->gdb_write_register, feature); + cpu->gdb_num_regs = cpu->gdb_num_g_regs = feature->num_regs; } - cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs; + if (cc->gdb_num_core_regs) { + cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs; + } } void gdb_register_coprocessor(CPUState *cpu, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5fa86bc8d55..84887084d95 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2515,7 +2515,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->sysemu_ops = &arm_sysemu_ops; #endif - cc->gdb_num_core_regs = 26; cc->gdb_arch_name = arm_gdb_arch_name; cc->gdb_get_dynamic_xml = arm_gdb_get_dynamic_xml; cc->gdb_stop_before_watchpoint = true; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 0f7a44a28f5..985b1efe160 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -793,7 +793,6 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = aarch64_cpu_gdb_read_register; cc->gdb_write_register = aarch64_cpu_gdb_write_register; - cc->gdb_num_core_regs = 34; cc->gdb_core_xml_file = "aarch64-core.xml"; cc->gdb_arch_name = aarch64_gdb_arch_name; diff --git a/target/avr/cpu.c b/target/avr/cpu.c index a40f445af21..a50170bc69a 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -251,7 +251,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = avr_cpu_gdb_read_register; cc->gdb_write_register = avr_cpu_gdb_write_register; cc->gdb_adjust_breakpoint = avr_cpu_gdb_adjust_breakpoint; - cc->gdb_num_core_regs = 35; cc->gdb_core_xml_file = "avr-cpu.xml"; cc->tcg_ops = &avr_tcg_ops; } diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index ebe804e2931..a10d87b8220 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -362,7 +362,6 @@ static void hexagon_cpu_class_init(ObjectClass *c, void *data) cc->get_pc = hexagon_cpu_get_pc; cc->gdb_read_register = hexagon_gdb_read_register; cc->gdb_write_register = hexagon_gdb_write_register; - cc->gdb_num_core_regs = TOTAL_PER_THREAD_REGS; cc->gdb_stop_before_watchpoint = true; cc->gdb_core_xml_file = "hexagon-core.xml"; cc->disas_set_info = hexagon_cpu_disas_set_info; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7f908236767..733254fab57 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7990,10 +7990,8 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->gdb_arch_name = x86_gdb_arch_name; #ifdef TARGET_X86_64 cc->gdb_core_xml_file = "i386-64bit.xml"; - cc->gdb_num_core_regs = 66; #else cc->gdb_core_xml_file = "i386-32bit.xml"; - cc->gdb_num_core_regs = 50; #endif cc->disas_set_info = x86_disas_set_info; diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 7dc50bf35fc..bc2684179f2 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -815,7 +815,6 @@ static void loongarch32_cpu_class_init(ObjectClass *c, void *data) { CPUClass *cc = CPU_CLASS(c); - cc->gdb_num_core_regs = 35; cc->gdb_core_xml_file = "loongarch-base32.xml"; cc->gdb_arch_name = loongarch32_gdb_arch_name; } @@ -829,7 +828,6 @@ static void loongarch64_cpu_class_init(ObjectClass *c, void *data) { CPUClass *cc = CPU_CLASS(c); - cc->gdb_num_core_regs = 35; cc->gdb_core_xml_file = "loongarch-base64.xml"; cc->gdb_arch_name = loongarch64_gdb_arch_name; } diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index d5a71c63152..cc6e4537be5 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -570,7 +570,6 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) #endif cc->disas_set_info = m68k_cpu_disas_set_info; - cc->gdb_num_core_regs = 18; cc->tcg_ops = &m68k_tcg_ops; } diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 2c62cf048c2..e533e7a95ec 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -444,7 +444,6 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) cc->sysemu_ops = &mb_sysemu_ops; #endif device_class_set_props(dc, mb_properties); - cc->gdb_num_core_regs = 32 + 25; cc->gdb_core_xml_file = "microblaze-core.xml"; cc->disas_set_info = mb_disas_set_info; diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index 6ffc5ad0752..eb168d10070 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -49,14 +49,9 @@ enum { int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); - CPUClass *cc = CPU_GET_CLASS(cs); CPUMBState *env = &cpu->env; uint32_t val; - if (n > cc->gdb_num_core_regs) { - return 0; - } - switch (n) { case 1 ... 31: val = env->regs[n]; diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 1b62e269b90..dd8a0e94897 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2352,7 +2352,6 @@ static void riscv_cpu_common_class_init(ObjectClass *c, void *data) cc->get_pc = riscv_cpu_get_pc; cc->gdb_read_register = riscv_cpu_gdb_read_register; cc->gdb_write_register = riscv_cpu_gdb_write_register; - cc->gdb_num_core_regs = 33; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = riscv_cpu_disas_set_info; #ifndef CONFIG_USER_ONLY diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 5205167da17..2f878d08d6d 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -221,7 +221,6 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data) cc->gdb_write_register = rx_cpu_gdb_write_register; cc->disas_set_info = rx_cpu_disas_set_info; - cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "rx-core.xml"; cc->tcg_ops = &rx_tcg_ops; } diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 49a2341accf..f7194534aeb 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -368,7 +368,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) s390_cpu_class_init_sysemu(cc); #endif cc->disas_set_info = s390_cpu_disas_set_info; - cc->gdb_num_core_regs = S390_NUM_CORE_REGS; cc->gdb_core_xml_file = "s390x-core64.xml"; cc->gdb_arch_name = s390_gdb_arch_name; From patchwork Wed Feb 28 11:56:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776477 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp252436wrn; Wed, 28 Feb 2024 04:01:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWA/bkMdJayNniZ6OlJSCYrLbdKhhLaSAueOVPD63NTGO2r/soD7v6wjut0W7B7VkFRQON2qBQ264B2Su2dAOPr X-Google-Smtp-Source: AGHT+IG/zQeToTOLnGJ1aQ6Y4TXcXTM8dydxeRIS9TaGpXXzebxCmYh3GZmSEsxpd65Tb5p8tLv2 X-Received: by 2002:a05:6214:5188:b0:68f:3453:7bf1 with SMTP id kl8-20020a056214518800b0068f34537bf1mr5370423qvb.28.1709121712818; Wed, 28 Feb 2024 04:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121712; cv=none; d=google.com; s=arc-20160816; b=x8Bg3gj0RMK/x7bO5acEJs37iSTkAkI0lYV7dFWfJQKatyZdGyMlO5qb6lfVG1+3CI eJzWwnKiygaQ9RBbSp6rgenpinNaCdtIU7vyzRIMrmvPv27QyDnh2QLAacu37B+zVI9Y Sv3H7uLAveGUlCf4XMnHU1gg5V8TMJjXC+wSssl42vodxCGc4ZgK89BsAMSwrfKvV8vz RBygqeYf23h14bCU81oZjeB+hCg519cqVGTQimYmzHTM/yjXg/eJ0qim7bExI/ET13HS t7eED1WmK3Lo35T+I5k9DtDf0PcU5GUkuHLHG1Kq+nb2kA8GnqxSXpWO21U9RGZ57Hqu VVjA== 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:dkim-signature; bh=507xwnvGyp+RzNtpx1Atflfg7HETTICpDRubw47grLo=; fh=V//Id55l1kKW5zhW71GxCTaExsgyYKdbPjIrEl6+Cnw=; b=cT416tigzc6EquekR820egfKsBT8IIG3H7l2/GRwyx2HbaP5Z/vCVVcdfuhWlyYdJY rm8q0ZHY4Bhpnf7RSiMkPVssQ+0pEcCmFj16aeG72TpmbK5qikNzPWW5BGwluUlBSHHZ TKqxUzxoZ8dH5JqzuC9N+oP9PX1ER77JyQM4gMp2VbIAmZqqa+eqeowEZNHY+UDqm08r x7bZ6DBks68inhbungOrY0k+5Z1LEzIQP6nbkPjiwhldqjc3dMG29vLM5utYc7gz1GxZ i4x6yr5DCvB2kiezm4PCml7X2sbHH7pVhEupGOi4oBQKkIC4hM4MQVTUl2Sww1VL2rBW bZ1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EvqjAqcE; 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 12-20020a05621420ec00b0069030971fe3si2012180qvk.79.2024.02.28.04.01.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:01:52 -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; dkim=pass header.i=@linaro.org header.s=google header.b=EvqjAqcE; 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 1rfIZ0-00065l-78; Wed, 28 Feb 2024 06:57:30 -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 1rfIYx-00063M-V6 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:27 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYo-0005nI-BX for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:27 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33d90dfe73cso450815f8f.0 for ; Wed, 28 Feb 2024 03:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121437; x=1709726237; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=507xwnvGyp+RzNtpx1Atflfg7HETTICpDRubw47grLo=; b=EvqjAqcE4B+VwMRN4TmWkwOZ9/5NYVlBe6q7ZFLrQt7GeW2zDciKSQGx8Kusf1N2eN okMBixz9Ge37COOh9uGJqka0EX2vOgpSGXfsS1/KwhfbFfvlKQpOh7ZpWH+hCkyH1COK SNKQa0FYQ5fTRcX/qEJjn5oFxENEjI1rwGqMx3L7gIbljiQCLjTgq9Apx6cGuX9UNxx6 /c83IWDkUxXu8uEmIpQ2xSNBn/6ZNZvmM3lcnigiysQa6kZTJ5vwkZcrP/1cL4h2OgtQ lrBdeOaBy7K3nW5H7hVngou8rwj//TwY5nHQ3faRhtJqYElbfP4ect6rTY+FIfKxf4jl aY4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121437; x=1709726237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=507xwnvGyp+RzNtpx1Atflfg7HETTICpDRubw47grLo=; b=U4qTB6CNJ2NEHf/+NZAPW7ZPEG289h7BXtisTcDS1lgV3KLpnz1sIM8yBVr0uL21O2 rWGp1g3eMICc9iL8gwUSp2w2EAWwGvDFMW5zyfUEEfTtmoqj2XdYG7utu0ZhpGhfzefJ RucrbWC8My3i3B8ulfrCWemC3UzlJ109MamC49JBUNGHY5HyO7Pfh/LpQF9PNKvywvBf uGnrRYlT+r0SmJrfY/CVpo8OF5J5At8CU9wjAfD7vVMhubieIxFyKHr5UIULt1d5Gq1i 3Sw0fKwg2qib2osoAhE1lD6dL5ApJLnCCSqG83yR6xZ8t6m2jUqxq6RSVDGLBY/SA5NJ weag== X-Gm-Message-State: AOJu0YxxgKsMBEDScN90O+14e2drD3CFFyjhC4rD18AaDFq/Lv9BK5bP pIZRg+evtKYNedosVjWl1UxW9XDLXW1RxuN3byclkV66aAF1zAVITHSWWr1wjLU= X-Received: by 2002:a5d:50c5:0:b0:33d:545b:a33e with SMTP id f5-20020a5d50c5000000b0033d545ba33emr1990207wrt.13.1709121436810; Wed, 28 Feb 2024 03:57:16 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f1-20020adfe901000000b0033d8b1ace25sm14456814wrm.2.2024.02.28.03.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 486005F90D; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , Peter Maydell , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs), qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs) Subject: [PULL 13/29] hw/core/cpu: Remove gdb_get_dynamic_xml member Date: Wed, 28 Feb 2024 11:56:45 +0000 Message-Id: <20240228115701.1416107-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.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=unavailable 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 This function is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Alex Bennée Message-Id: <20231213-gdb-v17-9-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-14-alex.bennee@linaro.org> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 1bbf21b2201..4b659799b00 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -133,9 +133,6 @@ struct SysemuCPUOps; * before the insn which triggers a watchpoint rather than after it. * @gdb_arch_name: Optional callback that returns the architecture name known * to GDB. The caller must free the returned string with g_free. - * @gdb_get_dynamic_xml: Callback to return dynamically generated XML for the - * gdb stub. Returns a pointer to the XML contents for the specified XML file - * or NULL if the CPU doesn't have a dynamically generated content for it. * @disas_set_info: Setup architecture specific components of disassembly info * @adjust_watchpoint_address: Perform a target-specific adjustment to an * address before attempting to match it against watchpoints. @@ -167,7 +164,6 @@ struct CPUClass { const char *gdb_core_xml_file; const gchar * (*gdb_arch_name)(CPUState *cpu); - const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname); void (*disas_set_info)(CPUState *cpu, disassemble_info *info); diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 508a9c1e0d6..a5b3d8f7da7 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1159,12 +1159,6 @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, int arm_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int arm_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -/* Returns the dynamically generated XML for the gdb stub. - * Returns a pointer to the XML contents for the specified XML file or NULL - * if the XML name doesn't match the predefined one. - */ -const char *arm_gdb_get_dynamic_xml(CPUState *cpu, const char *xmlname); - int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, DumpState *s); int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index c66989a5e60..0133da4e079 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1545,7 +1545,6 @@ int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg); #ifndef CONFIG_USER_ONLY hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name); #endif int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, DumpState *s); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 84887084d95..b2ea5d65132 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2516,7 +2516,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_arch_name = arm_gdb_arch_name; - cc->gdb_get_dynamic_xml = arm_gdb_get_dynamic_xml; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = arm_disas_set_info; diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index 059d84f98e5..a3bb73cfa7c 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -474,24 +474,6 @@ static GDBFeature *arm_gen_dynamic_m_secextreg_feature(CPUState *cs, #endif #endif /* CONFIG_TCG */ -const char *arm_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) -{ - ARMCPU *cpu = ARM_CPU(cs); - - if (strcmp(xmlname, "system-registers.xml") == 0) { - return cpu->dyn_sysreg_feature.desc.xml; - } else if (strcmp(xmlname, "sve-registers.xml") == 0) { - return cpu->dyn_svereg_feature.desc.xml; - } else if (strcmp(xmlname, "arm-m-system.xml") == 0) { - return cpu->dyn_m_systemreg_feature.desc.xml; -#ifndef CONFIG_USER_ONLY - } else if (strcmp(xmlname, "arm-m-secext.xml") == 0) { - return cpu->dyn_m_secextreg_feature.desc.xml; -#endif - } - return NULL; -} - void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) { CPUState *cs = CPU(cpu); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 5f0ecf443d8..1d3d1db7c31 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7385,9 +7385,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) #endif cc->gdb_num_core_regs = 71; -#ifndef CONFIG_USER_ONLY - cc->gdb_get_dynamic_xml = ppc_gdb_get_dynamic_xml; -#endif #ifdef USE_APPLE_GDB cc->gdb_read_register = ppc_cpu_gdb_read_register_apple; cc->gdb_write_register = ppc_cpu_gdb_write_register_apple; diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 43f61130c5f..122ea9d0c00 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -342,16 +342,6 @@ static void gdb_gen_spr_feature(CPUState *cs) gdb_feature_builder_end(&builder); } - -const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name) -{ - PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs); - - if (strcmp(xml_name, "power-spr.xml") == 0) { - return pcc->gdb_spr.xml; - } - return NULL; -} #endif #if !defined(CONFIG_USER_ONLY) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index dd8a0e94897..5ff0192c527 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2300,19 +2300,6 @@ static const gchar *riscv_gdb_arch_name(CPUState *cs) } } -static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) -{ - RISCVCPU *cpu = RISCV_CPU(cs); - - if (strcmp(xmlname, "riscv-csr.xml") == 0) { - return cpu->dyn_csr_feature.xml; - } else if (strcmp(xmlname, "riscv-vector.xml") == 0) { - return cpu->dyn_vreg_feature.xml; - } - - return NULL; -} - #ifndef CONFIG_USER_ONLY static int64_t riscv_get_arch_id(CPUState *cs) { @@ -2359,7 +2346,6 @@ static void riscv_cpu_common_class_init(ObjectClass *c, void *data) cc->get_arch_id = riscv_get_arch_id; #endif cc->gdb_arch_name = riscv_gdb_arch_name; - cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml; device_class_set_props(dc, riscv_cpu_properties); } From patchwork Wed Feb 28 11:56:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776476 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp252380wrn; Wed, 28 Feb 2024 04:01:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUwgZOT6pQaBdnK3/5x3NRm5/QI1y3p0OYknDsFLO+PoNob71DdMf3reN/Wda2i9fqtYLYp1HuVMfQ6Wt9/RYxs X-Google-Smtp-Source: AGHT+IGOXmoh7+DGK5diF/op/721RtH6i5c4tEJD7nAbw1Or+uoKOCkYfSu6h7zXdVoYetU57TbU X-Received: by 2002:a05:6870:c115:b0:21f:a837:500c with SMTP id f21-20020a056870c11500b0021fa837500cmr14017099oad.34.1709121706615; Wed, 28 Feb 2024 04:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121706; cv=none; d=google.com; s=arc-20160816; b=BDAKUWNT2qENlVVvoi0gaDrHEg6Qmw1Xe2SK+WgBTCMsoXBx6H6Ny4d1wWmeC9ygzQ IUQyxMUePXNZVN110S+i0pXAIBKI69E+Ur8AmtDQSJJQJc+LK9DqDysQL41/1OZzCx/E 51yfldHzQMoyTqLj84U5s3Nh6ad0QoZ7pwOFH4p123kbxMknWwwNVbQUXJNCwY9CrzM8 XU5R/2MYun7L/Gw7NadhlP0YHOxAwZQgaxxpQrs5ZtlCNkMd4XAr0n56o+p1tl6RLXUJ uC4Rx02Ss6sZjag0Fk+TeDz2wG/YWMa/Pzf4EbqBBeCMlUmtWoz7ga3Osn1wvshYLRsI BzaQ== 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:dkim-signature; bh=UXC1c6ximoGlLXBLpJrnxbihkxNcYSRT5tnOm2K+8ww=; fh=OzOkdFw+pjRrzcSK76JliJHQhk19MtgmQNIylwB6cQk=; b=f07gcFxIxyJdlQHB2iuSy3wkSR4zx8obbAtcQ9PV23m7oq09jSaZ2+yhqMoBQu/2gy J2SLzLAlbgXV8oJhlFWcIwv+DjnaFa3gNVPGfeiAEdT/YX9lvXJooyUK9Xv9qRMaQed9 BvvfwSFJ3T1vEIMELhd7e4x6/0ZN+4LbxhF0Co1RUTAg3IZVkdyC3777DCqgtcNczVBi Q7qTxLRDZJahYH1fCCFDg7p2BtUBZSiaCe0J3qw9a371ql7tGpXYZsvQwCaiiYRd5yv4 j6hmwFhSfltt0pL5L6Ww9e/ygZK77zdqtxKynXj8Ix7wVAygTbwUWpG8UQZzGIT+RR+h J7Zg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0ftTTKZ; 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 c11-20020ac86e8b000000b0042e770d48dfsi9027924qtv.35.2024.02.28.04.01.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:01: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; dkim=pass header.i=@linaro.org header.s=google header.b=s0ftTTKZ; 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 1rfIZ2-00068x-MD; Wed, 28 Feb 2024 06:57:32 -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 1rfIYz-00064i-64 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:29 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYr-0005oF-7x for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:28 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5131316693cso2149586e87.0 for ; Wed, 28 Feb 2024 03:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121439; x=1709726239; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UXC1c6ximoGlLXBLpJrnxbihkxNcYSRT5tnOm2K+8ww=; b=s0ftTTKZ9+A9srUBeFpP3gGDeENP7dN1Pus5uSdxAgxkljG2PRPIXV7YJhHbVusb05 1fd08BrNXy0p/xp7Sy0voAA8NuihOqL9wOI/s8QVUldXrJzrA3DaVFyVhkfu4029+1yH 9TlPn0Ts+FYZ631bJtWFKtVyaSkUbtPP21nWkfuqpY5rukgaf4Y9Utr2KdsEGa/cfyVh KUdCx7cDLSnrmaY6+b6/T4Zj3K+9A8QIZ+oD8WE7m6n277a2E5XP2JZ8ND4cDFfmzGqp 31ooACGQFkmIKdEDQKdqr/CVJcyZUxlguBIPPKn1Tm5uaQ1/ZqJ3L7Jq2bYW+hoSzhF9 71FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121439; x=1709726239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UXC1c6ximoGlLXBLpJrnxbihkxNcYSRT5tnOm2K+8ww=; b=hQMvOQWgfIrvzMJupKxsfw+ewySq9eBs+3oPOeQ887fozOTSD73lC9GBLnLfsS8Ko/ yp9Lf+H5NPbC5tnvkvyHdvtCF0FNEf6WykxpoaKr8YklYUNES2eC0cpxUVByaNA3g6yK ktAk85Hy5eH7GuCKkguCJxYusSiQr6QzDA5wHkgJxPdGr3YHPckfj0E0ZShDzBb7Ka5v uF81W4ndlyQstdE+M4OJv/5nqhgFoyxn7hkakbcc+sjXgU4JdvT1G8hzhycETfzltXE3 Tu53E41vbRMKiDhz62MS/PDGvf7g35dPq5jFN3J7exoIAfau8LNFXgpYt2MCJyBo2G9f OcYQ== X-Gm-Message-State: AOJu0YxhdZj7e/6IsB85733sUwvQAiWSb9tkf17CVWEybad96vhvJCtN 9US0RBY0CW5qHZbFL+W1z/OIYFnfb9r1Bp0fZUuxPrzA0N/NrExttdxTPOr/1Ks= X-Received: by 2002:a05:6512:48d:b0:512:ec7b:4be6 with SMTP id v13-20020a056512048d00b00512ec7b4be6mr7776364lfq.11.1709121439503; Wed, 28 Feb 2024 03:57:19 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bv26-20020a0560001f1a00b0033e03a6b1ecsm927560wrb.18.2024.02.28.03.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5ED2D5F8F9; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs) Subject: [PULL 14/29] gdbstub: Add members to identify registers to GDBFeature Date: Wed, 28 Feb 2024 11:56:46 +0000 Message-Id: <20240228115701.1416107-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x133.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 These members will be used to help plugins to identify registers. The added members in instances of GDBFeature dynamically generated by CPUs will be filled in later changes. Signed-off-by: Akihiko Odaki Message-Id: <20231213-gdb-v17-10-777047380591@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-15-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 82a8afa237f..da9ddfe54c5 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -13,12 +13,15 @@ typedef struct GDBFeature { const char *xmlname; const char *xml; + const char *name; + const char * const *regs; int num_regs; } GDBFeature; typedef struct GDBFeatureBuilder { GDBFeature *feature; GPtrArray *xml; + GPtrArray *regs; int base_reg; } GDBFeatureBuilder; diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index f766ee277a0..a55b5e6581a 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -419,9 +419,10 @@ void gdb_feature_builder_init(GDBFeatureBuilder *builder, GDBFeature *feature, builder->feature = feature; builder->xml = g_ptr_array_new(); g_ptr_array_add(builder->xml, header); + builder->regs = g_ptr_array_new(); builder->base_reg = base_reg; feature->xmlname = xmlname; - feature->num_regs = 0; + feature->name = name; } void gdb_feature_builder_append_tag(const GDBFeatureBuilder *builder, @@ -440,10 +441,12 @@ void gdb_feature_builder_append_reg(const GDBFeatureBuilder *builder, const char *type, const char *group) { - if (builder->feature->num_regs < regnum) { - builder->feature->num_regs = regnum; + if (builder->regs->len <= regnum) { + g_ptr_array_set_size(builder->regs, regnum + 1); } + builder->regs->pdata[regnum] = (gpointer *)name; + if (group) { gdb_feature_builder_append_tag( builder, @@ -469,6 +472,9 @@ void gdb_feature_builder_end(const GDBFeatureBuilder *builder) } g_ptr_array_free(builder->xml, TRUE); + + builder->feature->num_regs = builder->regs->len; + builder->feature->regs = (void *)g_ptr_array_free(builder->regs, FALSE); } const GDBFeature *gdb_find_static_feature(const char *xmlname) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 546e8692d17..be7a02cd903 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -266,11 +266,9 @@ static GDBFeature *riscv_gen_dynamic_csr_feature(CPUState *cs, int base_reg) } predicate = csr_ops[i].predicate; if (predicate && (predicate(env, i) == RISCV_EXCP_NONE)) { - g_autofree char *dynamic_name = NULL; name = csr_ops[i].name; if (!name) { - dynamic_name = g_strdup_printf("csr%03x", i); - name = dynamic_name; + name = g_strdup_printf("csr%03x", i); } gdb_feature_builder_append_reg(&builder, name, bitsize, i, diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py index e04d6b2df7f..807af0e685c 100644 --- a/scripts/feature_to_c.py +++ b/scripts/feature_to_c.py @@ -50,7 +50,9 @@ def writeliteral(indent, bytes): sys.stderr.write(f'unexpected start tag: {element.tag}\n') exit(1) + feature_name = element.attrib['name'] regnum = 0 + regnames = [] regnums = [] tags = ['feature'] for event, element in events: @@ -67,6 +69,7 @@ def writeliteral(indent, bytes): if 'regnum' in element.attrib: regnum = int(element.attrib['regnum']) + regnames.append(element.attrib['name']) regnums.append(regnum) regnum += 1 @@ -85,6 +88,15 @@ def writeliteral(indent, bytes): writeliteral(8, bytes(os.path.basename(input), 'utf-8')) sys.stdout.write(',\n') writeliteral(8, read) - sys.stdout.write(f',\n {num_regs},\n }},\n') + sys.stdout.write(',\n') + writeliteral(8, bytes(feature_name, 'utf-8')) + sys.stdout.write(',\n (const char * const []) {\n') + + for index, regname in enumerate(regnames): + sys.stdout.write(f' [{regnums[index] - base_reg}] =\n') + writeliteral(16, bytes(regname, 'utf-8')) + sys.stdout.write(',\n') + + sys.stdout.write(f' }},\n {num_regs},\n }},\n') sys.stdout.write(' { NULL }\n};\n') From patchwork Wed Feb 28 11:56:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776471 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251850wrn; Wed, 28 Feb 2024 04:00:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXT5iRoIF6GlP7vOGkjjyk3LVcmvfJFQ9hv5y6CYzTzuy3gFSFS/OCuE72/W9DgpB3X7CfdJ1l+1CyS7tDS0QRd X-Google-Smtp-Source: AGHT+IGeDx3MKB+gm8P4L3plcKt8M7RBStA6sFpoSJZK0InbVyQo/beqcCi344HXCVF8CuKwjaPw X-Received: by 2002:ac8:7f4b:0:b0:42e:8835:592d with SMTP id g11-20020ac87f4b000000b0042e8835592dmr9549981qtk.22.1709121654531; Wed, 28 Feb 2024 04:00:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121654; cv=none; d=google.com; s=arc-20160816; b=mldbA8G99UQA4/1Oufhbk52RpwMvi5HKq/VjQUJ8zdWqKkOzCiKR7q8faKGfM7FTRh VhxpgHcQy8QgJFp/jth8952uyrLsnYeDy4L/4jqvHeoqTsvF6X8WJleoSshWLS4QkYh1 IpYEZ+l+QN5MGrGvmGRGuMbv9pbt9auLagEN2eW+/zrUy8Fvgn754hg1BGMlI/61fLQH oxVauiBOPjLF43KepDMUa7wrAi9tz3SnJOQaA6qYWVi2NspQp2MaKFguZ/QpAgVmFC1q 6FaWpwEykqjf1OuFnQh/tfcUSZk7U8mbdYrm2YarCDd8c8i0Qe7fZ4LcmYfyM+4C+Z5W D7jQ== 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:dkim-signature; bh=H5MR4psNBT9iamDRZsbfoCZ2euS5zGBL3DbUgre87To=; fh=yu0InTeBwSZcLajIY49SmB6DXvx9wTO9ThO8p5pbR7k=; b=PK9HuH+VFhp/lFTiikc/n7FxQ26RVMz1zEOyB6PM1D1hPJHJgcQp1xqoaAjtlksFbf K+II+D+TA8e4IG1gfML9D4fY8w9MjIh2SRM7gjFL71wFxWxUZqT9Zv07S7vvImVKFxqX s2Tgdwq1gWBdzK3mUUNibWHAMIzNTfC4aV7sovfP2hA9JD3snefRec3ePrzj7auj7QBT Umhj1E/8/jhfmkLq3iPfFwDIWhVbrnNJ5c+bwvc2AYa4r7WBaqveB4VyFRew1fAwJgeu PgYtrZET6KFUNbClMAs77W7lS5kEgvfuNJo+Ewg4S3KiIKFX846eaHXQmqtQGriKSWIn PNDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=au8QVJtV; 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 r21-20020ac85c95000000b0042eb365186asi301373qta.25.2024.02.28.04.00.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:00:54 -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; dkim=pass header.i=@linaro.org header.s=google header.b=au8QVJtV; 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 1rfIZ0-00067k-Th; Wed, 28 Feb 2024 06:57:30 -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 1rfIYy-00063o-3d for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:28 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYp-0005nf-7x for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:27 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33d0a7f2424so3675418f8f.0 for ; Wed, 28 Feb 2024 03:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121437; x=1709726237; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H5MR4psNBT9iamDRZsbfoCZ2euS5zGBL3DbUgre87To=; b=au8QVJtVmRBU2QgYMmmAWjrXSPxKsANjmdVKZeUiKQqnPRyuiBiweEtiwwcXb7QIsO xE129/wO9Qb6Rsi3TuW5s0XGFQW/iBlgvuuLzzBCmU5c0YfusVPGIIyHzyy01NxSBa6f z9K3IUev6NC0ANpJWlrKhsLsfRbMp7iEf+zUyxQeRDiZIPVxpyXwwD9hbg9+40b1M8VO RuEKbRMm1XaWiJcwOsCy8UOtwkahd4X7lLRjngI+ZCNuLu34wuOYMOy6evvExUp1O8tq ynY6u3hA2yxseei4wiNCrR3AXDwvVuzLPpX1ozkCX63vJyocYI1WH3j/2zVwZFcgJ0/z bYVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121437; x=1709726237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H5MR4psNBT9iamDRZsbfoCZ2euS5zGBL3DbUgre87To=; b=aa3mibvmGhH3J5ig+r2PkCvPaLseSvOK6sHfn9HVdahc7hMKFc708lCNcwm5ztIUQt go1guk5xEpJQhlmm08bsysuP2FHZg6Hh/W9JVb33cJPfcZWw61MvjDPh2x+X7ll31LV/ BHRQTQFH6Ch1LcFkq92N3zHfyJB3DBodpniH/Xgs7GrkmL9JkTqa/Y+PJ2kHEMxAHWWn JyLhNK3mSsDTGZvr4WHtzNYg6TZGIORfpAaDSpWFzO6I9UNCpDH14Kr71ccEnyBb3my1 R/bCjejkEKCvO2YKgR0R4WI1QtwNLbhNUCqgrq9rc3P65kISLxpZ681+O/WpYZ7+7R2n Vc4w== X-Gm-Message-State: AOJu0YxHNl048YNaR9WpCkf+VYZLlocCiba3LPLqFEX5l9mlzgs5ejOv /4dqD3i+0hlwVTGdVRBh9inFnqsZvmUp/kvV2oQ6thtdu9JM2hIdF0x29Iag07A= X-Received: by 2002:adf:e50d:0:b0:33d:1fce:5e32 with SMTP id j13-20020adfe50d000000b0033d1fce5e32mr8405533wrm.16.1709121437254; Wed, 28 Feb 2024 03:57:17 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id w10-20020adff9ca000000b0033d1b760125sm14452795wrr.92.2024.02.28.03.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 76A175F90F; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 15/29] plugins: remove previous n_vcpus functions from API Date: Wed, 28 Feb 2024 11:56:47 +0000 Message-Id: <20240228115701.1416107-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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: Pierrick Bouvier This information is already accessible using qemu_info_t during plugin install. We will introduce another function (qemu_plugin_num_vcpus) which represent how many cpus were enabled, by tracking new cpu indexes. It's a breaking change, so we bump API version. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-Id: <20240213094009.150349-2-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-16-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 4daab6efd29..e45181c793c 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -50,11 +50,13 @@ typedef uint64_t qemu_plugin_id_t; * * The plugins export the API they were built against by exposing the * symbol qemu_plugin_version which can be checked. + * + * version 2: removed qemu_plugin_n_vcpus and qemu_plugin_n_max_vcpus */ extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; -#define QEMU_PLUGIN_VERSION 1 +#define QEMU_PLUGIN_VERSION 2 /** * struct qemu_info_t - system information for plugins @@ -643,12 +645,6 @@ QEMU_PLUGIN_API void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id, qemu_plugin_udata_cb_t cb, void *userdata); -/* returns -1 in user-mode */ -int qemu_plugin_n_vcpus(void); - -/* returns -1 in user-mode */ -int qemu_plugin_n_max_vcpus(void); - /** * qemu_plugin_outs() - output string via QEMU's logging system * @string: a string diff --git a/plugins/plugin.h b/plugins/plugin.h index 5eb2fdbc85e..90f3f324ab6 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -15,7 +15,7 @@ #include #include "qemu/qht.h" -#define QEMU_PLUGIN_MIN_VERSION 0 +#define QEMU_PLUGIN_MIN_VERSION 2 /* global state */ struct qemu_plugin_state { diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index 9e7ade3b374..c5c8ac75a9c 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -767,7 +767,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, policy = LRU; - cores = sys ? qemu_plugin_n_vcpus() : 1; + cores = sys ? info->system.smp_vcpus : 1; for (i = 0; i < argc; i++) { char *opt = argv[i]; diff --git a/plugins/api.c b/plugins/api.c index 5521b0ad36c..2926b1961a8 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -342,36 +342,6 @@ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h) #endif } -/* - * Queries to the number and potential maximum number of vCPUs there - * will be. This helps the plugin dimension per-vcpu arrays. - */ - -#ifndef CONFIG_USER_ONLY -static MachineState * get_ms(void) -{ - return MACHINE(qdev_get_machine()); -} -#endif - -int qemu_plugin_n_vcpus(void) -{ -#ifdef CONFIG_USER_ONLY - return -1; -#else - return get_ms()->smp.cpus; -#endif -} - -int qemu_plugin_n_max_vcpus(void) -{ -#ifdef CONFIG_USER_ONLY - return -1; -#else - return get_ms()->smp.max_cpus; -#endif -} - /* * Plugin output */ diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 71f6c90549d..ca806000d54 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -16,8 +16,6 @@ qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_store; qemu_plugin_mem_size_shift; - qemu_plugin_n_max_vcpus; - qemu_plugin_n_vcpus; qemu_plugin_outs; qemu_plugin_path_to_binary; qemu_plugin_register_atexit_cb; From patchwork Wed Feb 28 11:56:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776475 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp252090wrn; Wed, 28 Feb 2024 04:01:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV92Nt0as65rnzEWA8DoxwbROlb9gbs+j+uQe6gYcKa7wbP8DwG53OX9hnQOkQjEMe08A7yCbYWUfH79TJ4wu9/ X-Google-Smtp-Source: AGHT+IHKW8ce1qqESLwPuDvgJ/Nw5IfUlD/kDdmTBIZQuV5I6JYEapYTxXgbhGspy0bZTJ6gUTai X-Received: by 2002:a05:6870:c112:b0:21f:1547:35cc with SMTP id f18-20020a056870c11200b0021f154735ccmr14915437oad.47.1709121678195; Wed, 28 Feb 2024 04:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121678; cv=none; d=google.com; s=arc-20160816; b=ID0QsUzGnrB5MgLl3zpBxiGVFuSKXF/Fjutmd9l1XcfFx3M6lkEIFxQaJNZX74M0gt zoWhRTY3JEOINZW4hPThQW68eIn7PDC4Cxwa21wm7VeVHc+qlaR0AtUwX2ePIqXUk93L YBHPs0Z6HRgsPJlfWnE+DJ1BTKPSn1iT1XHl3qbLcKTXeEjQiv49BvJ4chSlcdGvNLBE 1Q7p2M1sPSfV/7kI6LtidIXmcQaVUXTs1utCOHGWsBVSQraPMK2M3AlAJe6znIvjs36V uvfIbei2qCVqPJdj8QBUCyC3eGtKC7GWqDUTw6tCs3IL0fbEWKmaCQjWwRnspzIhRThG WxkQ== 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:dkim-signature; bh=tGh0F9vXnLs+GgGKHlkYhRQ+Pky5JpZ1BGhQUHUGXNk=; fh=yu0InTeBwSZcLajIY49SmB6DXvx9wTO9ThO8p5pbR7k=; b=Cu0y0fr5izzvwRln3Ob0RMlhDeZJsBqG5tWHNYjiATzPUrq4taDxfERuEFxJuIh9ov 9Nzp9TzwcvfOkOt93wXxxe8L+nW9HYHkivB53HzlgxU+ze9RvYNsjWuiVdakGny+gemy qIJol/YDLTB3pu2f4KcL6KuHDv7iMP7zK/NXgjs6JdnAGweOIJryDoO6gzhqaBpPmMIc OaziD4E2HM21Tw9lQJSraDYSy+HopyOuP9WWwJ1d94rGd/BBb50IvwVvZ0a7lIm5bBXJ zUukUDleD1ESxX41u4ls6eF251DcceKULfScAd6jbUPn6YgnBK7IJw4L8TzSpXgu0e4/ Bzrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dQQJPfni; 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 j19-20020a05620a0a5300b00783e5c0ae73si9515511qka.180.2024.02.28.04.01.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:01:18 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dQQJPfni; 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 1rfIZ2-000680-Ev; Wed, 28 Feb 2024 06:57:32 -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 1rfIYx-000637-Po for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:27 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYo-0005nU-B8 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:27 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33d9c3f36c2so2988901f8f.2 for ; Wed, 28 Feb 2024 03:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121437; x=1709726237; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tGh0F9vXnLs+GgGKHlkYhRQ+Pky5JpZ1BGhQUHUGXNk=; b=dQQJPfnimitOjKVmF51NenK71jBuEvuL2eqhXiycUUfoRlEyvPQ/7BVEqm6NNRBPzl 2mR6kqbCZaKQtOlVCHV7LScxr6YfI5Zxkyb/arFbQHV5cDjMA5smu1Gk8t6uMj4T3BfS NiTAK+yFjcZDIq57pDnDWzzZZ9CnEr3Jnxk/rf2OF6hqfZv5DgFpxap04sVOnINEGpY2 Rrk0fWjY4FkTQ8+3m7Z/E69s31BgvXW8HKBredOzwmUPDT/0qpg0Mh6njh6hUYI3umos w0BaK36yFHeHPG95K6LN49Whz3Hw+df0EXvGb81AdBWxlmV3mufqBxtWspiD+uhikPQj BQ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121437; x=1709726237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tGh0F9vXnLs+GgGKHlkYhRQ+Pky5JpZ1BGhQUHUGXNk=; b=SNiDPHeTwQXVnh4c/jHzxLhzIUn2JQpWzj+rlGaSDFv8sQjYSgnFrb3x5PAaN17aUa TRNWs8VD0OZWPKBCu7ifK2KDDhVJJE4jVV7viHuJd6qHKehWUEqzetpdPUL4CVOnicbs YJQstlXzLdilzw//9+BUZFkBpsRC7iDg07zHdSwmsD/pd5XWfaK7v5j11jjezC4opzxl o941GU5h2wnSW1ON5P7Eg3moJcRv4ILxV14Dv1K0m+Oy7uNvR9Q0Ir9fJpACp4OO5Hli cMkOYHes22U6OtxDfVribzKOOxdcwbubk4AdVrDKqu30pr0+ugaQD481tWnThGh0QB4u bdOQ== X-Gm-Message-State: AOJu0YzgZdMPjt4xebH2l4IyPT+8tY+C/ULamNHtgJp036bft62hyJNX odbf675Mjq0eRJ5SY/NocCWmEZxHMvyduUvgCt2q47Sf5bj7+Fr6gAh4y/KQmbM= X-Received: by 2002:adf:f8cd:0:b0:33d:44d8:eacc with SMTP id f13-20020adff8cd000000b0033d44d8eaccmr8478871wrq.39.1709121437052; Wed, 28 Feb 2024 03:57:17 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bp19-20020a5d5a93000000b0033d4c3b0beesm14928545wrb.19.2024.02.28.03.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8D7A65F8F7; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 16/29] plugins: add qemu_plugin_num_vcpus function Date: Wed, 28 Feb 2024 11:56:48 +0000 Message-Id: <20240228115701.1416107-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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: Pierrick Bouvier We now keep track of how many vcpus were started. This way, a plugin can easily query number of any vcpus at any point of execution, which unifies user and system mode workflows. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-Id: <20240213094009.150349-3-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-17-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index e45181c793c..93981f8f89f 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -645,6 +645,9 @@ QEMU_PLUGIN_API void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id, qemu_plugin_udata_cb_t cb, void *userdata); +/* returns how many vcpus were started at this point */ +int qemu_plugin_num_vcpus(void); + /** * qemu_plugin_outs() - output string via QEMU's logging system * @string: a string diff --git a/plugins/plugin.h b/plugins/plugin.h index 90f3f324ab6..00b3509f708 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -44,6 +44,8 @@ struct qemu_plugin_state { * the code cache is flushed. */ struct qht dyn_cb_arr_ht; + /* How many vcpus were started */ + int num_vcpus; }; @@ -97,4 +99,6 @@ void plugin_register_vcpu_mem_cb(GArray **arr, void exec_inline_op(struct qemu_plugin_dyn_cb *cb); +int plugin_num_vcpus(void); + #endif /* PLUGIN_H */ diff --git a/plugins/api.c b/plugins/api.c index 2926b1961a8..116b8bd603c 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -342,6 +342,11 @@ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h) #endif } +int qemu_plugin_num_vcpus(void) +{ + return plugin_num_vcpus(); +} + /* * Plugin output */ diff --git a/plugins/core.c b/plugins/core.c index ee2fa41af9e..caa66311351 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -213,6 +213,7 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu) bool success; qemu_rec_mutex_lock(&plugin.lock); + plugin.num_vcpus = MAX(plugin.num_vcpus, cpu->cpu_index + 1); plugin_cpu_update__locked(&cpu->cpu_index, NULL, NULL); success = g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index, &cpu->cpu_index); @@ -570,3 +571,8 @@ static void __attribute__((__constructor__)) plugin_init(void) QHT_MODE_AUTO_RESIZE); atexit(qemu_plugin_atexit_cb); } + +int plugin_num_vcpus(void) +{ + return plugin.num_vcpus; +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index ca806000d54..adb67608598 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -16,6 +16,7 @@ qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_store; qemu_plugin_mem_size_shift; + qemu_plugin_num_vcpus; qemu_plugin_outs; qemu_plugin_path_to_binary; qemu_plugin_register_atexit_cb; From patchwork Wed Feb 28 11:56:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776481 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp255324wrn; Wed, 28 Feb 2024 04:07:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWTxqbk0GXl3TqrUtFuzpbf5BfZOaWBBcUJBxU6+SSSLIjpneN0MmFnzNmFcN5r+OAPBvFouXnScRlBDzJULKsz X-Google-Smtp-Source: AGHT+IGpSsnxPrNsnRJoOj+y/T7Wt6A0t4iEH+NJ6BfHP7zPofVmeY6cZKEhYoz71J2omEdgKyKw X-Received: by 2002:a05:6808:1894:b0:3c1:b144:9914 with SMTP id bi20-20020a056808189400b003c1b1449914mr4729681oib.48.1709122057894; Wed, 28 Feb 2024 04:07:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122057; cv=none; d=google.com; s=arc-20160816; b=A80X2W4YsQG7UaKduGld1tz0beznd1wYnIDKuN7MgJqMTzW+JPdsICOhfpujthhDxR +xt7CR+pjr8dvnQCYYG4jFClNZL//vscyDAw3r2GnJSkO5xXzhjgG8mFMt3npbodJBGo BUMkXYldBFG9dvD3884B23NpaMDGf++T6Mfux7HNHryvmBu74UQlNwmjfbDz0zRxe2Cv uOthRdoRDSCm0RdApmeW4+LmuC0GqseOEZ7UkkJTlRVoN/1hesAMeRMtE/93ag0JA3gw lFkw2HVn/wsS0WyaR01n2mRk7e/40dPQm0GwRLT9EGvC4JgOnPjfgL1M9gB4fd9Ujs2h f1jw== 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:dkim-signature; bh=ITjmGoGHy7/JLnU20+irN4PvElz9B05xt+jQzipQhG0=; fh=yu0InTeBwSZcLajIY49SmB6DXvx9wTO9ThO8p5pbR7k=; b=hfNFw/S4dMbd74cI8uBSB9T6HJAEWq5Kvcx8RBG2pmMIPCYe/rycN03cs+m+BYGwiD A6x0W/3K7OZt+1hkS7sblZdFpZEB6htdvVS4okBMJJ62/+tToNlPg7Hp1jsypvmwexXp jdCvsSwMV+tvuKJNihcPaSLkeOy/0Q/tkpRxgT1yAtLLwT9Vre5AvAjweh4GZvqcykta /HI9SAZj2LZd5qFeyrnh3vz4ZQfzSrzdc94W7D/b3wH8FDSi2vqsUFsSDi+FIvaS2fhi U/4ZGR8OtP79u8pZyWeXCNpPumyN5D0dzdaaT1IN87jEYRE95PUiJKiyhUFD+wWTr9fd 5L4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DB+7yv9L; 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 a12-20020a05620a124c00b00787b7d22a90si9536526qkl.288.2024.02.28.04.07.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:07:37 -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; dkim=pass header.i=@linaro.org header.s=google header.b=DB+7yv9L; 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 1rfIeO-0004dG-Eb; Wed, 28 Feb 2024 07:03:04 -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 1rfIeJ-0004OJ-QT for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:00 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeI-00034d-4V for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:02:59 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33ddd1624beso496892f8f.1 for ; Wed, 28 Feb 2024 04:02:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121776; x=1709726576; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ITjmGoGHy7/JLnU20+irN4PvElz9B05xt+jQzipQhG0=; b=DB+7yv9LofiFhURPv+uCUBY488uvitCzb5lC8jiFVQIu/4J1e5bzoMr5s/WYIGtYmD apwFOixs5BiLZ9NTLK3EjKojQeaDrEaUjPINO1hMUlTqdJUDrL6R8sfnY2oI/orIMlKc cy9oijNGfXWhAZMZuj2vg6sCuGJ4kXFDlL/NR3YsmyaDBc97B/jJdBf4SLmGGSfjBFX2 gxdcTFfTZJ0tfB3sbg/ZAUQb4BKdJ3tQhJTWCAxUtJc1qpfemmoO8oQe1Hf5sGrb4kRf Z9JXWdSA38PkTybVPtenchaPuWKmV74+jQzjpQ0kYduKO0OR9Qp0mu2N4++KQdayVGZX m7jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121776; x=1709726576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ITjmGoGHy7/JLnU20+irN4PvElz9B05xt+jQzipQhG0=; b=Ujt6/cWixgXJb5ETymw9iqlsHttSormrG/KjsKTUiFKP1HWGMrvlpmTKQkvxNowOsP nnrGtQnoJEKPVnqu8cDq5X0VDcPNyJafG+hb1nn7BgoCupd450yQUfkfqgR6X7W/RvRT GKY0GkTZBl8F+zmznc7LmZgda3klTdCHry7Yk6Qcw8cn4mbNOfVWfBnJk+OJJ2r3AVTM 54B1YwgeoiQB/R+YNmgNYLqqrF5iG6f/x0p3gnysEQb/1WD1SyhZbgTZIj0jJzU/x0Pz glczlTIBL88ECOVV14c2jPnX0ksHtdFKu048pI2QkrEFiwDrD8bIEKUyYiUoBF7TSaph Sd5Q== X-Gm-Message-State: AOJu0Yx+zyAwaSKhLZy7wTFM3YgaQAYnpfaZP14huh8zdGWZF0xNsFlU oz8GrK2VUw76KCB5lNPVnY9rs4d4MTw+a5vHfran6tRBWQECjviLZp/9ucvdxfo= X-Received: by 2002:a05:6000:103:b0:33d:1ece:d618 with SMTP id o3-20020a056000010300b0033d1eced618mr2006821wrx.8.1709121776508; Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a26-20020a5d457a000000b0033dd56b002asm10205342wrc.73.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9FF3C5F911; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 17/29] plugins: fix order of init/idle/resume callback Date: Wed, 28 Feb 2024 11:56:49 +0000 Message-Id: <20240228115701.1416107-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.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: Pierrick Bouvier We found that vcpu_init_hook was called *after* idle callback. vcpu_init is called from cpu_realize_fn, while idle/resume cb are called from qemu_wait_io_event (in vcpu thread). This change ensures we only call idle and resume cb only once a plugin was init for a given vcpu. Next change in the series will run vcpu_init asynchronously, which will make it run *after* resume callback as well. So we fix this now. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240213094009.150349-4-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-18-alex.bennee@linaro.org> diff --git a/plugins/core.c b/plugins/core.c index caa66311351..2392bbb8889 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -391,12 +391,17 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret) void qemu_plugin_vcpu_idle_cb(CPUState *cpu) { - plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_IDLE); + /* idle and resume cb may be called before init, ignore in this case */ + if (cpu->cpu_index < plugin.num_vcpus) { + plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_IDLE); + } } void qemu_plugin_vcpu_resume_cb(CPUState *cpu) { - plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME); + if (cpu->cpu_index < plugin.num_vcpus) { + plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME); + } } void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, From patchwork Wed Feb 28 11:56:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776484 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp256236wrn; Wed, 28 Feb 2024 04:09:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWXnkke4bRDh999ViPjCES2xVpLh70sDAaxtED4LKVytZLfZ5IS/u3Jl/YZ1xNt+iFefWdso+UlIT79dHbq1ZCt X-Google-Smtp-Source: AGHT+IF3jihfcvFZPcjtHX3Sih7+jfKQa1ASEYVwWzzTovT5tzGE/usMlsR3LbO58E6431r7FHV+ X-Received: by 2002:a05:620a:1998:b0:787:b833:7036 with SMTP id bm24-20020a05620a199800b00787b8337036mr3774351qkb.6.1709122182486; Wed, 28 Feb 2024 04:09:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122182; cv=none; d=google.com; s=arc-20160816; b=o37TZyUIQQRqIzoAvgyzxJoFEVgheexY2aG81t3Y2pFenMy/0vxaYu6Dfzn3t+XUap WYb3vHKfHqw5uOyH9cAkkBN3LgMGwQ5LfltyADZxGDkNlQEhstYMLxe3F5NLyExP8pHC vAVnABTh91Y1ZSef0DiWftJbo0t7CphjynsQHX0go4CS63XG387tlsUFee866Q49yH7u 9igDwnNhvmyBkOCFDkvwBGOViCyKUlS0APxmv0S+5le93fGYmUsOElauCVhwfFmGY+ZX 5uQc4GO+ICHN1tzpWxQR2by278dURscVgfj2RBeU0zQxGcoR7knNhUUEF50RYzdyE+Vk W6hQ== 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:dkim-signature; bh=mr8xNnhDGY0/lMKUx04e9LXvXJNCxTVqWEKyAEz4psM=; fh=CHuNtIurDMBuhNI6pD8gCAtm0S9S/wC24WfpQfwaLzA=; b=swDK9V79VAEbsVEUXQ2MDcGsrZ5vumjq/cnR6UsBTKKxLL9SqWti5dIHEkIrwDom7C 5HAfvqdNrcYF9sf7Gju4qmSrLFb7Or8i9xWfhVt9ZD6E0InSg6nDMRx5Ev6nwXW1s35d SKI8r648uv6uYaGsGWGgYiwOAAciAdPP3geHY0FLpoC06xcq9A7MC5W48+h8WOoUHioT ggFgIakBF0xQFers8OqxBLVqWDPQxzkmj8rxYhwL3dOoiDBF+yn2InOiRetVjSKNG/98 G1zT9n5pTxnOxhvfu8+9KPT6qV1Ex918DwQsEPjKTnWK3iBR0h4sLi6RuQUfsPFhsJCn F1XA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f+A4ehjj; 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 wg13-20020a05620a568d00b00787bc601c72si9107146qkn.165.2024.02.28.04.09.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:09:42 -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; dkim=pass header.i=@linaro.org header.s=google header.b=f+A4ehjj; 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 1rfIeZ-0005E0-7v; Wed, 28 Feb 2024 07:03:15 -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 1rfIeR-0004qM-8y for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeP-000367-E0 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:06 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-512bc0e8ce1so5767154e87.0 for ; Wed, 28 Feb 2024 04:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121783; x=1709726583; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mr8xNnhDGY0/lMKUx04e9LXvXJNCxTVqWEKyAEz4psM=; b=f+A4ehjjMLGBP6JR8CMIOxaSAqnZvKkPFtzAD2sEMlkR2kIlI5e6GXD0SEMrCXQnzt OaylmzMhHCFoIYBfK2tH78nMtV/eR9Bucjhr9y+XN1V3JJ4hxz4jiT/4RTj7/TPbsvUL rLI+kxUtq2wzPathn23pC73/iqDYet1Q4CiiXCeMwVNgpkjHp8/TcuPNq8Gr2XBpKMlp QazevKcHpFs4KzrP6Ggcp7jxwBXg+Nmr/2JACD8kGxIn3pcRAIDSs+uXtz0STNZUFyZF 7xAih89/vWhkJu6qGX0k8Yz+vBlSuKkabG8QMJqtCXTGBKzHe1eJPA18F/D5E6Ovpjp3 VBpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121783; x=1709726583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mr8xNnhDGY0/lMKUx04e9LXvXJNCxTVqWEKyAEz4psM=; b=s3zpBGPLBtoRGVuvklJrMxEPhHfHpP2aM/OztfndruK9jp8m1wzgU2/K9KKLLasu7B 4EWXER+WUTUPV/buXfLc1LHKSoFNHjPqtdj0wiHg3UVu7yC3DyVamW+pKELe6kBjjGOn ojy3qU2Rrebxe1reMeWrDZ1gXmy3p67GSRpDrMOcwtOK8AAHJ7xpvd/LNE7QYE4cSf6q nczPCBsRvXZdtETHiIDPgcm1XulAh+drokiV8XOcwgUd5QlLwT9AtYouxkVQw4Ix2WG9 Z4vqH3RyLSANiQ4GooilwqRx/KAnIZXdj4SBfGztIDj0djEwJgAJzWjFztOlMYgktCVX oETg== X-Gm-Message-State: AOJu0YzzcVqQHMzfr5hO8U3uA0LSJH8rkJjWCF2CADeAwuvGWwukly7Y 7WTZjvdyO8SjQ2gK16tjlp56MVXIGloeObwbdLQc9MVWSD8UoWOJCat+b6phX6E= X-Received: by 2002:a19:5e19:0:b0:512:b27c:18b5 with SMTP id s25-20020a195e19000000b00512b27c18b5mr8018445lfb.30.1709121783438; Wed, 28 Feb 2024 04:03:03 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c4f5500b00412b0ef22basm1918683wmq.10.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B2E465F920; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Richard Henderson , Laurent Vivier Subject: [PULL 18/29] linux-user: ensure nios2 processes queued work Date: Wed, 28 Feb 2024 11:56:50 +0000 Message-Id: <20240228115701.1416107-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x130.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 While async processes are rare for linux-user we do use them from time to time. The most obvious one is tb_flush when we run out of translation space. We will also need this when we move plugin vcpu_init to an async task. Fix nios2 to follow its older, wiser and more stable siblings. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-19-alex.bennee@linaro.org> diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index da77ede76bd..7fe08c87501 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -32,6 +32,7 @@ void cpu_loop(CPUNios2State *env) cpu_exec_start(cs); trapnr = cpu_exec(cs); cpu_exec_end(cs); + process_queued_cpu_work(cs); switch (trapnr) { case EXCP_INTERRUPT: From patchwork Wed Feb 28 11:56:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776480 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp254822wrn; Wed, 28 Feb 2024 04:06:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWLDyO3lhDUkavVX3xu9gaiTIz/jmPBeX0gudTp4AVYSFma+oT84AKmCWV7YIDaMYlAc44igxH1haLM7cVLxRmq X-Google-Smtp-Source: AGHT+IF49wEGNu59k50usQCYnhYpaxJ7c/gyfqvjV2GDuM2KiJmMJtnVyhxs/WUWu42Fp/fsNXmW X-Received: by 2002:a05:6358:726:b0:17b:c1e6:c4de with SMTP id e38-20020a056358072600b0017bc1e6c4demr3165584rwj.14.1709121993472; Wed, 28 Feb 2024 04:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121993; cv=none; d=google.com; s=arc-20160816; b=sCBCeC1qrYCtkpUhbc2blbW0tPaCAKHtSYWZPEQQWbYk4Or6YJiCuIv6AT/sr+y+TE bHWIqMOh+mDKUm1YjIiccKgVfIkFvgJecvHQ12307XzNOJ6nF1rAF8YU7Ma4hk4tGwTh Nmq011Rs/zxLluXCc8tZeb65hE/QkR9ntxP03ilohkslM8ZiaaljVjS2eZ8iV0pZJf2p hyzeg6EjaVix9AsEfInuCKsXr4VtX/6cGafkeKqYhg5t2YUzyFuRFum7h6x/YqwflsmJ URVWo90T8LP59rINO4jpduUQFULNjizwwNjjqz0UluDlED19Hckp9MYYKEPHmF4R+ITh Fb6g== 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:dkim-signature; bh=p+CwTreRkCfrSZnPVcfTsMUgX3CVXEY/vFHik/E/mjA=; fh=Z10CJok2AG8ZQlEfwg3IWupzqdA1R4wHf1sF/OcGomk=; b=ggar1Fp9w670I7waHaTpXjzuijFq0qkrH1HoifoEe9hxjsuId87dtVnSEuiyKj7qZn Fgc1lr9YBomKYch0AsFtMYj0Lncl0if2X1K8oJ0VeanJ6hAXRFjekXJANrKRVtkMDZJa v7O7crac1QhVCqeyh5SfVf1cr66TAVSrbFLZZIxjXTU8lrljtps4SByp/R4/+WBUa0fh yYMqG2is5a69vOydZbUgbS5aYb57zWVXnUIcAe/eIxiqE0N+r57XlJnfjILeK1YPbumu zIxW+sbTGql+2EwjpDmSD+NFwP3wWAwhUFN99/XquDuwb6AFGgFeKMNpu/4qevYrxmaU nWYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E6HXij9p; 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 gw13-20020a0562140f0d00b0068f85ca0a1asi9372830qvb.231.2024.02.28.04.06.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:06: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; dkim=pass header.i=@linaro.org header.s=google header.b=E6HXij9p; 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 1rfIea-0005Km-D9; Wed, 28 Feb 2024 07:03: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 1rfIeR-0004qn-MU for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeP-000368-5B for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:07 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33de64c91abso1498901f8f.1 for ; Wed, 28 Feb 2024 04:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121783; x=1709726583; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p+CwTreRkCfrSZnPVcfTsMUgX3CVXEY/vFHik/E/mjA=; b=E6HXij9pDarR8WFjK7MfS2Ma8Lwak6J7kuk1KhJK9L4xrwj8K+6/xiF6ofPUYIveLM cdoV4p7xKKZRvS3OG2p5EZBbQ2uHUAAr0H5j7OwpNkHly4wKMw0EYMzAV/DpP0U/Qggf WwF4kO2VF1YO+nFop3VmIrqf3ittMgrrZnfL+f+2gStjIL/fNzxH0ZMU2AVA8HE8yH8O isf/5HiEJB36PI3Wmn0IekRV4bW/E0NsZRDjOV3tjRRRqHSvGJEcHSBUeFxlpc9EXiCi H83A+6TqYAp31iKcyMehcMX4R5ycf499JkT6UHxFJCXg7xWeufcf6Gmj8fmGbA7xqMqJ sRYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121783; x=1709726583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p+CwTreRkCfrSZnPVcfTsMUgX3CVXEY/vFHik/E/mjA=; b=vQImUcCoD2l/4RwgR1G4Lco0ejt80ESauCZRChzlyvEgWWsk+FBhHN49fSpiM2OdKq DskdBzxo14XV9P46m/+K4k9mPpgx1FWYRxKmTLym9sLHfd3K/IGMJLMHb4JlGQ0MZxEz ob7Prp7g3vLHgZ1uNX4WRt13y19iD0Uee7+ajDr1yLQckPDL8Tz+U+pEndiTJbsTjRPU 3dNTR7tUG5pLCfcAr2pmjx8EhbDhApM60FEHWDNBVhJchw8bat3+pQFjx65cJ31W5DXv zHqZ+Vsk1qGBkpoOMqzk1lNM/+07nieRIUQTsk1O9WLLVVXE3U2qAQc++UdQmweqEXdu Jn6g== X-Gm-Message-State: AOJu0Yy0CZPml2oIdoTFeKNl+iu9HueV5se4BpcRqu0zNIJj9eikFEuZ HVjaThbnvwxl7hkbVeTZ9G8WZ59wxOMpk8TUrSAYq36lR42eX8wYqg6O/vtwnnQ= X-Received: by 2002:a5d:6649:0:b0:33d:aa78:ed82 with SMTP id f9-20020a5d6649000000b0033daa78ed82mr9214879wrw.34.1709121783637; Wed, 28 Feb 2024 04:03:03 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a10-20020a5d4d4a000000b0033d13530134sm14173688wru.106.2024.02.28.04.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C5A4D5F923; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang Subject: [PULL 19/29] cpu: call plugin init hook asynchronously Date: Wed, 28 Feb 2024 11:56:51 +0000 Message-Id: <20240228115701.1416107-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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: Pierrick Bouvier This ensures we run during a cpu_exec, which allows to call start/end exclusive from this init hook (needed for new scoreboard API introduced later). async work is run before any tb is translated/executed, so we can guarantee plugin init will be called before any other hook. The previous change made sure that any idle/resume cb call will not be done before initializing plugin for a given vcpu. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240213094009.150349-5-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-20-alex.bennee@linaro.org> diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index fe16d0d9df8..68786360ea5 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -194,6 +194,11 @@ static void cpu_common_parse_features(const char *typename, char *features, } } +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) +{ + qemu_plugin_vcpu_init_hook(cpu); +} + static void cpu_common_realizefn(DeviceState *dev, Error **errp) { CPUState *cpu = CPU(dev); @@ -217,9 +222,9 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) cpu_resume(cpu); } - /* Plugin initialization must wait until the cpu is fully realized. */ + /* Plugin initialization must wait until the cpu start executing code */ if (tcg_enabled()) { - qemu_plugin_vcpu_init_hook(cpu); + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); } /* NOTE: latest generic point where the cpu is fully realized */ From patchwork Wed Feb 28 11:56:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776482 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp255514wrn; Wed, 28 Feb 2024 04:08:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUw3DfyX4MmIQPMJg9pwlt+4Og17H+XapYmMKMSKLdcOw5PIOJ0jEux7oxN/dZuwAgkz7pNtD9DPZLYL10M4oyU X-Google-Smtp-Source: AGHT+IF/pWZthrWDXSgYpENCQHG7FvIvwocHP8oJyq/24J9Lvvto7y81IwGpduMbA9/rRM5HxtVl X-Received: by 2002:a05:622a:120c:b0:42e:6b9a:425d with SMTP id y12-20020a05622a120c00b0042e6b9a425dmr17235141qtx.15.1709122085270; Wed, 28 Feb 2024 04:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122085; cv=none; d=google.com; s=arc-20160816; b=i8wqcoTeDI/1Ukt9LlDQhOwtP4oruOe1QqvPeZZlo1BZUQ4eRUfHwBSDHAsgZxD/90 mvK5pdP+RjNT1UYV1A8kcHqNppqNyqgapJX0fo+HHhOI5GWL7EdlwCCi9UKL+9e6psKC 7NOydJZLU3/5FlHzCMFWUMU5nh0ePrJizIgz/WQhxBc5JYCWEhHxJsHU+elEcezLn9oJ x8efquJo2t2ErySAS9vSngYGYSrM0Y0CIBg87KFAoDTKxdCkU/9qJCS8E6sAzZPOu0SX GPDGScjwKG5KdAycKbkfkAa0CJMQfKeBB0TJzj6vsLtBvu9uwxf6WfT2sHDwqNRBJEa0 EPAA== 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:dkim-signature; bh=OHZr5g1hexJ/POwBKHCb+23J2Mo4xjXMQFtOkiBczO8=; fh=O5esa8zVHr7zlsHhJcVYQ6gA/1WNw4kWS9EpqJGOqkw=; b=p3cMk0r+zGK5zgxszshlXU3Rqz5JL0TIDRDXhld4nfI/M3SxwsbkRbSVfAUs5dAg83 /2V/BvbMUHxycO7H53G9cmUmnYHzX62ZGog1F1OWpxzWzIDMUC3DTVXstdfEoiJmYC4s 9g4lEekLPm/J8/RRMYGyoFvPwn87GBJGgSzdsjhj3qwa8EOfmvZ8ANmkqAgCpsx6n7W/ k1lnsQB8ypzFA39wI2fLvtiHKdcEpcvHsWp+sdd48GSVdn/cXoQN7e+hX44tI8HxYvnb 9ZCYjroSkinkXd59hn/Nr1mRXLNBzqmjDCdg458yZnTtvPRDpCE46/dFyLKszzqWK9TE mvMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dDsQlRRI; 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 i14-20020ac84f4e000000b0042e5f6ad275si9230203qtw.183.2024.02.28.04.08.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:08:05 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dDsQlRRI; 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 1rfIee-0005Tj-6s; Wed, 28 Feb 2024 07:03:21 -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 1rfIeT-0004tn-8O for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 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 1rfIeR-00036f-Cb for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-412b243926aso6596535e9.2 for ; Wed, 28 Feb 2024 04:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121786; x=1709726586; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OHZr5g1hexJ/POwBKHCb+23J2Mo4xjXMQFtOkiBczO8=; b=dDsQlRRIENM1kIcpHDaBa7LBVBQPtel4iTAqsgBbZuwmq10xiey2fAHFnzCtRv6xGP lybtN5utZpirczVfXS07wlhPRVrNsbzM0gf2kUjB8ptag5WsJhGYoTsT9frLYVJdVOaX nZgxFcEusA+VSA0y3tmLWd9WWG0u+xMRfH+ofC+6Eyn5J+2LEILipNfqNbviX8aQ1DNB fVlFu+M8UTmOsI/wo/cY1DhKHuawogBYhEj3+diH6LhmIQLFuY9CWBaG1Bg0Q+TWaIsJ +oFdCJ7QSN112QdhPT6tnBkkUkuW8EjaG6hmxEvKhck8v9oMQrOy2zOPZs6pNqyVqIqt GABA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121786; x=1709726586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OHZr5g1hexJ/POwBKHCb+23J2Mo4xjXMQFtOkiBczO8=; b=KgzLx9CBPqTAwG2WUh4q4/wJxNT/Mj30gzcKa2kmkjFSUGqe/lEmUV3UahXJxbcx3N YT4VfIj8NQTkgKeYbo2KpfttTE5Unom2YV5LC0o/kr0laScPEZ/XPbSTOYNJfWsX22rM gWyNukEMsg0EHpxLTn9dyyFIrQdVw29gJbjsqqbH2lpjAY8ukZpJgvmCMtyJAW0gVQ90 Wz198SW8y7cH0sraAZlcKeM4q0LWTAUvoeiHmHrGMQn9ypsclePIlmQHuOqQVZvh9LPP nRxUW1WmzhUQ9ImtkgC8xdgSFDIqssjjvdN73s+O9F5uK4FrB9pf37F2nWkSJ+Ue/Pd0 9j1w== X-Gm-Message-State: AOJu0YxNzTPiCZhjFOupl2paG4TR+9egIuwz8bDxteOLa67vzIvK4r0J +D4WbKD3vquGrADUxIcR1MjDReoTsp9zAlLXAg0nvYvn73dA772h+2KkpA6aXpU= X-Received: by 2002:a05:600c:4f86:b0:412:8814:9885 with SMTP id n6-20020a05600c4f8600b0041288149885mr9794382wmq.4.1709121785714; Wed, 28 Feb 2024 04:03:05 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id p13-20020a7bcc8d000000b00412a5b6ac5csm1877851wma.36.2024.02.28.04.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id DC5445F924; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Paolo Bonzini , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 20/29] plugins: Use different helpers when reading registers Date: Wed, 28 Feb 2024 11:56:52 +0000 Message-Id: <20240228115701.1416107-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@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 This avoids optimizations incompatible when reading registers. Signed-off-by: Akihiko Odaki Reviewed-by: Pierrick Bouvier Message-Id: <20231213-gdb-v17-12-777047380591@daynix.com> Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-21-alex.bennee@linaro.org> diff --git a/accel/tcg/plugin-helpers.h b/accel/tcg/plugin-helpers.h index 8e685e06545..11796436f35 100644 --- a/accel/tcg/plugin-helpers.h +++ b/accel/tcg/plugin-helpers.h @@ -1,4 +1,5 @@ #ifdef CONFIG_PLUGIN -DEF_HELPER_FLAGS_2(plugin_vcpu_udata_cb, TCG_CALL_NO_RWG | TCG_CALL_PLUGIN, void, i32, ptr) +DEF_HELPER_FLAGS_2(plugin_vcpu_udata_cb_no_wg, TCG_CALL_NO_WG | TCG_CALL_PLUGIN, void, i32, ptr) +DEF_HELPER_FLAGS_2(plugin_vcpu_udata_cb_no_rwg, TCG_CALL_NO_RWG | TCG_CALL_PLUGIN, void, i32, ptr) DEF_HELPER_FLAGS_4(plugin_vcpu_mem_cb, TCG_CALL_NO_RWG | TCG_CALL_PLUGIN, void, i32, i32, i64, ptr) #endif diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 7fdc3a4849f..b0c5ac68293 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -73,6 +73,7 @@ enum plugin_dyn_cb_type { enum plugin_dyn_cb_subtype { PLUGIN_CB_REGULAR, + PLUGIN_CB_REGULAR_R, PLUGIN_CB_INLINE, PLUGIN_N_CB_SUBTYPES, }; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 78b331b2510..b37ce7683e6 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -79,6 +79,7 @@ enum plugin_gen_from { enum plugin_gen_cb { PLUGIN_GEN_CB_UDATA, + PLUGIN_GEN_CB_UDATA_R, PLUGIN_GEN_CB_INLINE, PLUGIN_GEN_CB_MEM, PLUGIN_GEN_ENABLE_MEM_HELPER, @@ -90,7 +91,10 @@ enum plugin_gen_cb { * These helpers are stubs that get dynamically switched out for calls * direct to the plugin if they are subscribed to. */ -void HELPER(plugin_vcpu_udata_cb)(uint32_t cpu_index, void *udata) +void HELPER(plugin_vcpu_udata_cb_no_wg)(uint32_t cpu_index, void *udata) +{ } + +void HELPER(plugin_vcpu_udata_cb_no_rwg)(uint32_t cpu_index, void *udata) { } void HELPER(plugin_vcpu_mem_cb)(unsigned int vcpu_index, @@ -98,7 +102,7 @@ void HELPER(plugin_vcpu_mem_cb)(unsigned int vcpu_index, void *userdata) { } -static void gen_empty_udata_cb(void) +static void gen_empty_udata_cb(void (*gen_helper)(TCGv_i32, TCGv_ptr)) { TCGv_i32 cpu_index = tcg_temp_ebb_new_i32(); TCGv_ptr udata = tcg_temp_ebb_new_ptr(); @@ -106,12 +110,22 @@ static void gen_empty_udata_cb(void) tcg_gen_movi_ptr(udata, 0); tcg_gen_ld_i32(cpu_index, tcg_env, -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)); - gen_helper_plugin_vcpu_udata_cb(cpu_index, udata); + gen_helper(cpu_index, udata); tcg_temp_free_ptr(udata); tcg_temp_free_i32(cpu_index); } +static void gen_empty_udata_cb_no_wg(void) +{ + gen_empty_udata_cb(gen_helper_plugin_vcpu_udata_cb_no_wg); +} + +static void gen_empty_udata_cb_no_rwg(void) +{ + gen_empty_udata_cb(gen_helper_plugin_vcpu_udata_cb_no_rwg); +} + /* * For now we only support addi_i64. * When we support more ops, we can generate one empty inline cb for each. @@ -192,7 +206,8 @@ static void plugin_gen_empty_callback(enum plugin_gen_from from) gen_empty_mem_helper); /* fall through */ case PLUGIN_GEN_FROM_TB: - gen_wrapped(from, PLUGIN_GEN_CB_UDATA, gen_empty_udata_cb); + gen_wrapped(from, PLUGIN_GEN_CB_UDATA, gen_empty_udata_cb_no_rwg); + gen_wrapped(from, PLUGIN_GEN_CB_UDATA_R, gen_empty_udata_cb_no_wg); gen_wrapped(from, PLUGIN_GEN_CB_INLINE, gen_empty_inline_cb); break; default: @@ -588,6 +603,12 @@ static void plugin_gen_tb_udata(const struct qemu_plugin_tb *ptb, inject_udata_cb(ptb->cbs[PLUGIN_CB_REGULAR], begin_op); } +static void plugin_gen_tb_udata_r(const struct qemu_plugin_tb *ptb, + TCGOp *begin_op) +{ + inject_udata_cb(ptb->cbs[PLUGIN_CB_REGULAR_R], begin_op); +} + static void plugin_gen_tb_inline(const struct qemu_plugin_tb *ptb, TCGOp *begin_op) { @@ -602,6 +623,14 @@ static void plugin_gen_insn_udata(const struct qemu_plugin_tb *ptb, inject_udata_cb(insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR], begin_op); } +static void plugin_gen_insn_udata_r(const struct qemu_plugin_tb *ptb, + TCGOp *begin_op, int insn_idx) +{ + struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx); + + inject_udata_cb(insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR_R], begin_op); +} + static void plugin_gen_insn_inline(const struct qemu_plugin_tb *ptb, TCGOp *begin_op, int insn_idx) { @@ -721,6 +750,9 @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) case PLUGIN_GEN_CB_UDATA: plugin_gen_tb_udata(plugin_tb, op); break; + case PLUGIN_GEN_CB_UDATA_R: + plugin_gen_tb_udata_r(plugin_tb, op); + break; case PLUGIN_GEN_CB_INLINE: plugin_gen_tb_inline(plugin_tb, op); break; @@ -737,6 +769,9 @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) case PLUGIN_GEN_CB_UDATA: plugin_gen_insn_udata(plugin_tb, op, insn_idx); break; + case PLUGIN_GEN_CB_UDATA_R: + plugin_gen_insn_udata_r(plugin_tb, op, insn_idx); + break; case PLUGIN_GEN_CB_INLINE: plugin_gen_insn_inline(plugin_tb, op, insn_idx); break; diff --git a/plugins/api.c b/plugins/api.c index 116b8bd603c..54df72c1c00 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -89,7 +89,11 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, void *udata) { if (!tb->mem_only) { - plugin_register_dyn_cb__udata(&tb->cbs[PLUGIN_CB_REGULAR], + int index = flags == QEMU_PLUGIN_CB_R_REGS || + flags == QEMU_PLUGIN_CB_RW_REGS ? + PLUGIN_CB_REGULAR_R : PLUGIN_CB_REGULAR; + + plugin_register_dyn_cb__udata(&tb->cbs[index], cb, flags, udata); } } @@ -109,7 +113,11 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, void *udata) { if (!insn->mem_only) { - plugin_register_dyn_cb__udata(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR], + int index = flags == QEMU_PLUGIN_CB_R_REGS || + flags == QEMU_PLUGIN_CB_RW_REGS ? + PLUGIN_CB_REGULAR_R : PLUGIN_CB_REGULAR; + + plugin_register_dyn_cb__udata(&insn->cbs[PLUGIN_CB_INSN][index], cb, flags, udata); } } From patchwork Wed Feb 28 11:56:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776486 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp257980wrn; Wed, 28 Feb 2024 04:13:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU0Zsn/i3WmYDi/ZXt5rTIpBBTNeXjhppeUr3gc5S5/RuqRulYTunjGvaSUp+Ud6yi7oa9//etoICwvURp1iwW7 X-Google-Smtp-Source: AGHT+IH+pgHYfSgRCRVcJ7MfxA9PSOFESfJKC3+Zqvj/diTB7K6+2ekBQM4qjgo7uVk/xJDC09S2 X-Received: by 2002:a67:ea54:0:b0:471:e1ac:d108 with SMTP id r20-20020a67ea54000000b00471e1acd108mr8777421vso.20.1709122438959; Wed, 28 Feb 2024 04:13:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122438; cv=none; d=google.com; s=arc-20160816; b=ryP0FN/3LE//5QbrAOi7tFVLk7MeP4SI9yqHQ3yMZmj1CBQeGlOb2SndrlD22uFaGu QZXz9ZQKyveuvAsZipRauOFGgdw1T3wrytp9WWgRHJL2tqXVemaf8zctIMfRz/HlKDbX uq8C9fi2dcRZdBwxqdKDrZMXPfSsfYYTEZ1rAgAVuXDTWv36E32iLVzOwJieBCEHn6y5 l6VO6apHE4RU2MVMzwnXqjvmuO3X2srRGVt2zvErgjfZnMvamlNWwId3MxPRQ2Yf5X7n Aij1Rj2t4Y/U5pI6KWYX9o07sonl9wpJ1XjFptZmbFk/UHWFme4JGM7w2EsJ1XPFuGcs SbRw== 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:dkim-signature; bh=ahM/+kL0fDsDOWiFdIDq3kYt2sIQjOO/d/8sCwn+DTM=; fh=UxbDL+1Ia/1DkenQ8TquoebiK4+BTVc52aeziOuEfXg=; b=d2Ea+xlLs4UU1SNVsdReYDSiBjLztSxw9AkVOLGdQ9kCgDz5MlgCZ5PSMoN9vlLts5 4xO6MuHwhn/xpICAb3XamYqFhwzTVvXK/Ox5WTfzP8nGmYOhyYW/mocDLuNmN6dahofs PNG+Pvf3YQHZgrB28qqoolbTOiYs7VJSAojWCgquQKYIEPQXGe5S5mYzPV0/ONP34ENm 5gN4i834T+Y0iflnUiS90xYlmgI+d1lYld2uLaihdohn+2YHu1LQXJOWq+ZDvhEhQybD hWrPdLhQDQwrjcweWsGXWhwKlwoS+/AySMCnS1iFxGd9ZPaDSkALSbXOoWZYnxInzNrV HLHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DldCi9zT; 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 j10-20020ac85c4a000000b0042eadf46734si978483qtj.104.2024.02.28.04.13.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:13:58 -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; dkim=pass header.i=@linaro.org header.s=google header.b=DldCi9zT; 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 1rfIeO-0004cL-8O; Wed, 28 Feb 2024 07:03:04 -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 1rfIeM-0004Tq-SG for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:02 -0500 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 1rfIeL-000352-2S for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:02 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-412a9e9c776so4677275e9.0 for ; Wed, 28 Feb 2024 04:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121779; x=1709726579; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ahM/+kL0fDsDOWiFdIDq3kYt2sIQjOO/d/8sCwn+DTM=; b=DldCi9zTmuRrc1F0D5KPvWt3Hn7TVmNGnye1cL1LBnLfsTf01nanmGYhUY+jvmVIXL GNQHEA5p+FgYEvrYY/JSD48NrPci6ypUA3Z65qSOLg7+6SZXVjpiyk2+0Ba3yUWn/rkw Gnik6Fc1er5dMRZI3MDicEYf45Xj8UGBnZNAKHsYHyymJ7ziXb+IjfRNvfImCjIjd0dJ OFk6GGhtbYkwBW4nLjcTPg2JEWSOF0nI9JFntVipIzZsFpFbg0parfPVrtwx/bPiwGEB atc8258O2Km/oklpUyWYRZB6ZttYjNjM6SpY54w9KrsFDOLzpz3wuuVJoapozXDg5LA9 6ekA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121779; x=1709726579; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ahM/+kL0fDsDOWiFdIDq3kYt2sIQjOO/d/8sCwn+DTM=; b=RNUmPgcoIYb9YMOq26bz78EZHZeeJ8Ma+eaTZeF2INDIbrV5Dys9uB9WEY5RNumGOP dxxZa5a0JjssbncTuyLJ5zOBVc7on0mm8mCabhfoJVN7zWSYj45bAKJ7le6BSJo1AhYh ZMYVxjFaFibDM0Er1ONnqDOGLetfTSYesEocH02dCLMuY+ppjKkfTPUkCtagTTLkX2o5 EwDovzrIyis4jtpvf7abJjETwZKBvUA+COjRp0AhRHsjuFOfkYLfSsfSx7odTy15uB21 BLvaHCz+GF/7h+F32Pta7++2a+VwxRInx+Lh5MwELAr/OwY8Yt5iPexNHbHXMK9dx+bJ j6tQ== X-Gm-Message-State: AOJu0Ywh6PvJTPTZ62SczoPq+a6jpADifU1fGW8KN5rV6xcV+TjtaYk7 NtCjiYGWuHUVVB2ZZ8fhBz2ZcZIZx4QGQjfUf+q1poRURbNGhB87n3aRZomwgWYEgFN+hsfP7Xu 0 X-Received: by 2002:a05:600c:4f07:b0:412:a3f2:d641 with SMTP id l7-20020a05600c4f0700b00412a3f2d641mr2185224wmq.19.1709121779173; Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id jj18-20020a05600c6a1200b004129e8af6absm1873676wmb.33.2024.02.28.04.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F08415F928; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 21/29] gdbstub: expose api to find registers Date: Wed, 28 Feb 2024 11:56:53 +0000 Message-Id: <20240228115701.1416107-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@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 Expose an internal API to QEMU to return all the registers for a vCPU. The list containing the details required to called gdb_read_register(). Based-on: <20231025093128.33116-15-akihiko.odaki@daynix.com> Cc: Akihiko Odaki Reviewed-by: Akihiko Odaki Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-22-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index da9ddfe54c5..eb14b91139b 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -111,6 +111,34 @@ void gdb_feature_builder_end(const GDBFeatureBuilder *builder); */ const GDBFeature *gdb_find_static_feature(const char *xmlname); +/** + * gdb_read_register() - Read a register associated with a CPU. + * @cpu: The CPU associated with the register. + * @buf: The buffer that the read register will be appended to. + * @reg: The register's number returned by gdb_find_feature_register(). + * + * Return: The number of read bytes. + */ +int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); + +/** + * typedef GDBRegDesc - a register description from gdbstub + */ +typedef struct { + int gdb_reg; + const char *name; + const char *feature_name; +} GDBRegDesc; + +/** + * gdb_get_register_list() - Return list of all registers for CPU + * @cpu: The CPU being searched + * + * Returns a GArray of GDBRegDesc, caller frees array but not the + * const strings. + */ +GArray *gdb_get_register_list(CPUState *cpu); + void gdb_set_stop_cpu(CPUState *cpu); /* in gdbstub-xml.c, generated by scripts/feature_to_c.py */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index a55b5e6581a..2909bc8c69f 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -490,7 +490,32 @@ const GDBFeature *gdb_find_static_feature(const char *xmlname) g_assert_not_reached(); } -static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) +GArray *gdb_get_register_list(CPUState *cpu) +{ + GArray *results = g_array_new(true, true, sizeof(GDBRegDesc)); + + /* registers are only available once the CPU is initialised */ + if (!cpu->gdb_regs) { + return results; + } + + for (int f = 0; f < cpu->gdb_regs->len; f++) { + GDBRegisterState *r = &g_array_index(cpu->gdb_regs, GDBRegisterState, f); + for (int i = 0; i < r->feature->num_regs; i++) { + const char *name = r->feature->regs[i]; + GDBRegDesc desc = { + r->base_reg + i, + name, + r->feature->name + }; + g_array_append_val(results, desc); + } + } + + return results; +} + +int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { CPUClass *cc = CPU_GET_CLASS(cpu); GDBRegisterState *r; From patchwork Wed Feb 28 11:56:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776488 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp258215wrn; Wed, 28 Feb 2024 04:14:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWd5smZdfEPD1D/Ub7Y0LJmSZTB7pEk2R4RD9rAPC2D8NRSk25yC2PkA2smg8Gi1u8QTmShXKwbYRGRCz9WK9NM X-Google-Smtp-Source: AGHT+IGLzMMbBzso9xm0GgTBAihCUjonu2/40myqTWDV4TyclmAF31k5ioDCGdxFO4e4qeT/70lU X-Received: by 2002:a05:622a:8b:b0:42e:7927:8554 with SMTP id o11-20020a05622a008b00b0042e79278554mr3308144qtw.3.1709122477244; Wed, 28 Feb 2024 04:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122477; cv=none; d=google.com; s=arc-20160816; b=NHTxZPulpXNEdzDDEaHwe4iCCt49diDE/99KPKgDCpNCCliiv8RF7jaBVnNaq0Pq2c rcN+zWDag2w3ajorut148MWDkQ2tTq/PMEGBhbhf7DheW7Yh32DeqyCXBduViyaac9sM /+aP6IkbE5TXWZRChdhFI+aa6VVUNadyo3ZhDxzKPB9Zx6IWd0tht4q/faOUXOSiZLsW SXH/A+DCj74jNvoII2XqbkTMzY3G3TucEiSmlofn3qEXdxbvaOEc5SK0SDkhgXRqll4E WNGjom1nIQaE/Up7jXU6KfOfaots7sb7VaxVQ4qMdv5iIYmqqWYhQrxW7hx24D/Crnp4 zw+w== 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:dkim-signature; bh=5gI8EUY5DFBBef2QZLwJknMk02YZ7ugqhbMHpkMVd7s=; fh=kdvjoyh7/zQLcTNGtcxcjGjDBq8+rVYoIT8vvL6ahQA=; b=vpgMPbWsR6KSAmvI60BsH2QKhmZkNGL8Mtq32pUUtyKoKQxW8KDcMQnmNxIGmEODZh u6Lk8I/Va8CCjaenqm7NOydEXoWW175WMe+dQt5zaq3LwGDCjpgEdFnWDxbmfgikrMpG iJkI2yWLgqr+VftxKHygxKJ/Rp/9e/56kH7DcNhAj90/5c2fpXmTiRXkCyleKzgf1ilq EHIcNmA+B9q734+2191riIHUxd+rkWBkGkRUQSgbo1eBPnDHgah8O85IZ2mAZ4M0cs13 Icpk5AFVNgsP/zQmo89eYkaO411RVT8eHUv8WLNbdoYifdOV9SloK81zcHEEizBwfkov xL4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nDdsqSx+; 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 vz5-20020a05620a494500b00785982ccee8si9546396qkn.130.2024.02.28.04.14.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:14:37 -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; dkim=pass header.i=@linaro.org header.s=google header.b=nDdsqSx+; 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 1rfIeZ-00058Y-0W; Wed, 28 Feb 2024 07:03:15 -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 1rfIeQ-0004lq-2C for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:06 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeM-00035Z-VE for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:05 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-412b5a3d2e3so2934965e9.0 for ; Wed, 28 Feb 2024 04:03:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121781; x=1709726581; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5gI8EUY5DFBBef2QZLwJknMk02YZ7ugqhbMHpkMVd7s=; b=nDdsqSx+EXjeTR1U2NMJ0YbZp8uxIR/kJvjfF4EKwczHK9OhlbfryQlTA3KtmfCErp XlqlAkKPwi/+rP9IBkYK0l9bdrnkBQMbYm/CevkO0EjAfyibHHw98g/VoWuwqi3exTWm 4Sql5M7AtOg1dX7uKOORbZy7Mw67DIvtvJikZkFffePwdQqppYkj6/KrOn5w1jQvaFt6 me+TpEseBdqKSTwTrSzs0i6yHLMHCHV+A8zVze44C/danqFsEw6vhu2y+mKZQk+LIDxz uE9at0yA30TpVpdWcnZNxe0po+LjdtxoeYq8G8txscM7wmz04hRtGXYK5Vnosjvnt8Uv TLJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121781; x=1709726581; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5gI8EUY5DFBBef2QZLwJknMk02YZ7ugqhbMHpkMVd7s=; b=v1yx7tPEv2MsnORB94FAva+34R0ROp+bmZCFtCizH7R/tUf31AVE6nxuLpiai+YLbS 6fz/1eS/i+M2mUNUqp9/XjpWYqc35zPnVrfx9Pe7vYliwExP0nvoB2fki/1K6m60dFmh yF63lbL6rk77pDvLzGH5vpzHuxIH6IPqcdnF1kfpY8oqz/bJgwukxJXPjEnarfbQJZir rDBbxMFVeK4bvUAe92hIVXuBhOLPbzWyxSkNhmPqgtnuKfeapDItj0Hxz+ebu8HAaPPH uUnY3WKNw+rGnUecR0vxvW5DQBu+4W94oBDtYiYqlJ6tVWGLbARcq5/NeXnlQQHmOdNZ D+rQ== X-Gm-Message-State: AOJu0Ywfmh3yIZTv3VhmmSRE+OgJmHGUuwGf2BktjruVPe3H0V+mCZsL mAaQVv8kdPBhjexKrn8o8gOZwu62SF7ZUF9a67jyMT7jcWiMcSxl752N0DV82LU= X-Received: by 2002:a05:600c:4885:b0:412:981d:2889 with SMTP id j5-20020a05600c488500b00412981d2889mr8425789wmp.40.1709121781462; Wed, 28 Feb 2024 04:03:01 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id z7-20020a05600c220700b00412b65672d2sm998696wml.9.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 147FD5F929; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 22/29] plugins: create CPUPluginState and migrate plugin_mask Date: Wed, 28 Feb 2024 11:56:54 +0000 Message-Id: <20240228115701.1416107-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.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 As we expand the per-vCPU data for plugins we don't want to pollute CPUState. For now this just moves the plugin_mask (renamed to event_mask) as the memory callbacks are accessed directly by TCG generated code. Reviewed-by: Pierrick Bouvier Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-23-alex.bennee@linaro.org> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4b659799b00..af1a29526d4 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -31,7 +31,6 @@ #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" -#include "qemu/plugin-event.h" #include "qom/object.h" typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size, @@ -434,7 +433,8 @@ struct qemu_work_item; * @kvm_fd: vCPU file descriptor for KVM. * @work_mutex: Lock to prevent multiple access to @work_list. * @work_list: List of pending asynchronous work. - * @plugin_mask: Plugin event bitmap. Modified only via async work. + * @plugin_mem_cbs: active plugin memory callbacks + * @plugin_state: per-CPU plugin state * @ignore_memory_transaction_failures: Cached copy of the MachineState * flag of the same name: allows the board to suppress calling of the * CPU do_transaction_failed hook function. @@ -526,10 +526,13 @@ struct CPUState { /* Use by accel-block: CPU is executing an ioctl() */ QemuLockCnt in_ioctl_lock; - DECLARE_BITMAP(plugin_mask, QEMU_PLUGIN_EV_MAX); - #ifdef CONFIG_PLUGIN + /* + * The callback pointer stays in the main CPUState as it is + * accessed via TCG (see gen_empty_mem_helper). + */ GArray *plugin_mem_cbs; + CPUPluginState *plugin_state; #endif /* TODO Move common fields from CPUArchState here. */ diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index b0c5ac68293..b3c94a34aa4 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -186,6 +186,19 @@ struct qemu_plugin_insn *qemu_plugin_tb_insn_get(struct qemu_plugin_tb *tb, return insn; } +/** + * struct CPUPluginState - per-CPU state for plugins + * @event_mask: plugin event bitmap. Modified only via async work. + */ +struct CPUPluginState { + DECLARE_BITMAP(event_mask, QEMU_PLUGIN_EV_MAX); +}; + +/** + * qemu_plugin_create_vcpu_state: allocate plugin state + */ +CPUPluginState *qemu_plugin_create_vcpu_state(void); + void qemu_plugin_vcpu_init_hook(CPUState *cpu); void qemu_plugin_vcpu_exit_hook(CPUState *cpu); void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb); diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index d7c703b4ae9..a028dba4d0b 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -42,6 +42,7 @@ typedef struct CompatProperty CompatProperty; typedef struct ConfidentialGuestSupport ConfidentialGuestSupport; typedef struct CPUAddressSpace CPUAddressSpace; typedef struct CPUArchState CPUArchState; +typedef struct CPUPluginState CPUPluginState; typedef struct CpuInfoFast CpuInfoFast; typedef struct CPUJumpCache CPUJumpCache; typedef struct CPUState CPUState; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index b37ce7683e6..ac6b52b9ec9 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -43,6 +43,7 @@ * CPU's index into a TCG temp, since the first callback did it already. */ #include "qemu/osdep.h" +#include "qemu/plugin.h" #include "cpu.h" #include "tcg/tcg.h" #include "tcg/tcg-temp-internal.h" @@ -831,7 +832,7 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, { bool ret = false; - if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_mask)) { + if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_state->event_mask)) { struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb; int i; diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 68786360ea5..0108fb11dbc 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -194,10 +194,12 @@ static void cpu_common_parse_features(const char *typename, char *features, } } +#ifdef CONFIG_PLUGIN static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) { qemu_plugin_vcpu_init_hook(cpu); } +#endif static void cpu_common_realizefn(DeviceState *dev, Error **errp) { @@ -223,9 +225,12 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) } /* Plugin initialization must wait until the cpu start executing code */ +#ifdef CONFIG_PLUGIN if (tcg_enabled()) { + cpu->plugin_state = qemu_plugin_create_vcpu_state(); async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); } +#endif /* NOTE: latest generic point where the cpu is fully realized */ } diff --git a/plugins/core.c b/plugins/core.c index 2392bbb8889..2db4d31354b 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -17,6 +17,7 @@ #include "qapi/error.h" #include "qemu/lockable.h" #include "qemu/option.h" +#include "qemu/plugin.h" #include "qemu/rcu_queue.h" #include "qemu/xxhash.h" #include "qemu/rcu.h" @@ -53,7 +54,8 @@ struct qemu_plugin_ctx *plugin_id_to_ctx_locked(qemu_plugin_id_t id) static void plugin_cpu_update__async(CPUState *cpu, run_on_cpu_data data) { - bitmap_copy(cpu->plugin_mask, &data.host_ulong, QEMU_PLUGIN_EV_MAX); + bitmap_copy(cpu->plugin_state->event_mask, + &data.host_ulong, QEMU_PLUGIN_EV_MAX); tcg_flush_jmp_cache(cpu); } @@ -208,6 +210,11 @@ plugin_register_cb_udata(qemu_plugin_id_t id, enum qemu_plugin_event ev, do_plugin_register_cb(id, ev, func, udata); } +CPUPluginState *qemu_plugin_create_vcpu_state(void) +{ + return g_new0(CPUPluginState, 1); +} + void qemu_plugin_vcpu_init_hook(CPUState *cpu) { bool success; @@ -356,7 +363,7 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1, uint64_t a2, struct qemu_plugin_cb *cb, *next; enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL; - if (!test_bit(ev, cpu->plugin_mask)) { + if (!test_bit(ev, cpu->plugin_state->event_mask)) { return; } @@ -378,7 +385,7 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret) struct qemu_plugin_cb *cb, *next; enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL_RET; - if (!test_bit(ev, cpu->plugin_mask)) { + if (!test_bit(ev, cpu->plugin_state->event_mask)) { return; } From patchwork Wed Feb 28 11:56:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776487 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp257986wrn; Wed, 28 Feb 2024 04:14:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU1PU0P9hHj3WkOH7p5q+43M6taz1DHBTUp34ZciC7u0viR2go9kyzw+XlMlnFjkq376S5p2l+1RAXzGrpa5qkO X-Google-Smtp-Source: AGHT+IFvcgSkb43wlxQsq7Ur5Sg1UiYYsuIXeOmRG/4EZPQOhc1fONvpfRWVMvN3Pmx3oQTDvQOT X-Received: by 2002:a05:622a:8b:b0:42e:7927:8554 with SMTP id o11-20020a05622a008b00b0042e79278554mr3305226qtw.3.1709122440273; Wed, 28 Feb 2024 04:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122440; cv=none; d=google.com; s=arc-20160816; b=jGzO3wvmRSJtGOOHnC7JSWuRPhySa79GO4EiQhz2JC5ckWF5MRGZRlCWt80YTe+lZL qu3K0e6fmmoYYudgoe2qNqkox/Ad4Y3cQkzr0iqDkGpWLgYw72Kl5kuZa7rQ8Gj48MWd ILPOOQBXHigQ6bm+lz9U9xS/zAZt4tr48qkLCO+hSKHrYtvH5H7tCnxZ32ZXA4Mahjzc T/dcQq7UQ8LdCmK1B0LltBUEskER0hH0+yPOyDk87f3u8Pm9JBA2zDzrbOhP4giVZuZP L3928CaHmdLyFro6kHTGp6Gote4zFnPEetUeZmIhASiRqxGbAz3Mv/rpFLr3avaKzzpM N0wg== 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:dkim-signature; bh=5fqJzaG+rra4qIDd/yb84hh5r0ZoEwCIgugl/C1mkk8=; fh=YI+4jWtKoAWW1ifbuByWzL0Wr+HdHS9GDHQi3IxX3cs=; b=xZI8zhCLxU7u/yF6VCbu/EEMWzYfbdmktYYZWeORkWEpL2g1bfs4+LaI5D1g7P95Hf pbJMF/mFNl+c6Zx2XuXy6Iz25dl9dJm/qVfo7deXMPyhX9UVEwBtjOWhbBS2Sb/gd6hi SGivlG+YxfzzEzgOVENW84YZL0T8iYJEF9GdBQHMsl9zPMcc0LpHextxqtWfissBev7Y blw/lREd++wMsxu7b8BAHZx3pgTSQVdsvdDqg1Cu0sfkUUc7oUNTwTX4OVpsHycrGlS/ CeNVwnErPLAbcKSFkwMQL40E0/PiZdVT4tzqS9g3TNpKv+NvEnWzBSFRpcWrCeOxoBie UCqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SZado+C7; 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 i5-20020ac87645000000b0042c5c5855e1si9003143qtr.736.2024.02.28.04.14.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:14: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; dkim=pass header.i=@linaro.org header.s=google header.b=SZado+C7; 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 1rfIeP-0004iz-Hr; Wed, 28 Feb 2024 07:03:05 -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 1rfIeK-0004P3-DG for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:02 -0500 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 1rfIeI-00034c-4V for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:00 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-412a390347dso25801225e9.3 for ; Wed, 28 Feb 2024 04:02:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121776; x=1709726576; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5fqJzaG+rra4qIDd/yb84hh5r0ZoEwCIgugl/C1mkk8=; b=SZado+C7i16ig+U4mDd6i7aIipnf+cN5tL/yuBgXTHcsf91I+FHaB+i6T3ugIcuCqb /Bc/OaMwoS8UQ6NkSQijeglcsg8eCEfUtXCg0/dI1TF6LDmKRNESFoYkgKB9kzudYC41 vW9BygGM4gycF5YNvdkrEgd0d03jl75CL3YLHyB89pgX3I0PJLAOrh02pKOckzGdY2MZ b7QUgtNH0kVMA2uXTtK7w7YCnssQ1XEvQtLNeZV6787OlYRrnwd3Q32/kqZpnD9BYVJ2 PtlgKF+gGiQUJ2XYcyq9qZJuOaQmQTUtDkKFGTLi1zpx6ouITPQUDpBqq/2xVGBFgx7Z L66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121776; x=1709726576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5fqJzaG+rra4qIDd/yb84hh5r0ZoEwCIgugl/C1mkk8=; b=IYe1/ubOxzBMPyuCK3JdU0xaTRPdcCnV0b4UJd36Oi71dtZ+TqU+JUR6DC1JNEIxl3 wg/BJ+7yl62BWP2pSNMMvHNy7xltR7Faa67GLdiyWZA+7PCn1VzEXzhs7vEelzaJIB4w oGEMDa0/Kc6viWKwaFXeC7Dg7+43m+Iskf37EHAZx/v6LiAcRT/UrLhPNi5S2N0aU6F7 B5mElZ3FvYRHjoElnQp8pkpphS5oEkhcwTw08GPNCqiYwSKLyL0+zjmIxSaymllBTLYf NG6YtlZecfbpblXczn2JfIcYJJedBcm9DbgZ4bGcH3b2vdQmklcbjSlW/9lIyObwXhkm kGJA== X-Gm-Message-State: AOJu0Yyam8srsdBUIu/iDg7+oHzj9aroqeENaB0E0sVNVGWuVqzTfc8y dY6InBy3cNlPGISH4RTmdgDyAD91p+WWkSHMVoK2ddlR9IxFCipD/Y4y7ZWJqrvkVUOgSF8mFXB h X-Received: by 2002:a05:600c:4591:b0:412:a5ed:bb57 with SMTP id r17-20020a05600c459100b00412a5edbb57mr6152075wmo.31.1709121776292; Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id j17-20020a5d6191000000b0033d4cf751b2sm14313773wru.33.2024.02.28.04.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 297D65F92A; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Akihiko Odaki , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 23/29] plugins: add an API to read registers Date: Wed, 28 Feb 2024 11:56:55 +0000 Message-Id: <20240228115701.1416107-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@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 We can only request a list of registers once the vCPU has been initialised so the user needs to use either call the get function on vCPU initialisation or during the translation phase. We don't expose the reg number to the plugin instead hiding it behind an opaque handle. For now this is just the gdb_regnum encapsulated in an anonymous GPOINTER but in future as we add more state for plugins to track we can expand it. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1706 Based-on: <20231025093128.33116-18-akihiko.odaki@daynix.com> Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-24-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 93981f8f89f..45e2ebc8f8f 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -11,6 +11,7 @@ #ifndef QEMU_QEMU_PLUGIN_H #define QEMU_QEMU_PLUGIN_H +#include #include #include #include @@ -229,8 +230,8 @@ struct qemu_plugin_insn; * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs * - * Note: currently unused, plugins cannot read or change system - * register state. + * Note: currently QEMU_PLUGIN_CB_RW_REGS is unused, plugins cannot change + * system register state. */ enum qemu_plugin_cb_flags { QEMU_PLUGIN_CB_NO_REGS, @@ -707,4 +708,49 @@ uint64_t qemu_plugin_end_code(void); QEMU_PLUGIN_API uint64_t qemu_plugin_entry_code(void); +/** struct qemu_plugin_register - Opaque handle for register access */ +struct qemu_plugin_register; + +/** + * typedef qemu_plugin_reg_descriptor - register descriptions + * + * @handle: opaque handle for retrieving value with qemu_plugin_read_register + * @name: register name + * @feature: optional feature descriptor, can be NULL + */ +typedef struct { + struct qemu_plugin_register *handle; + const char *name; + const char *feature; +} qemu_plugin_reg_descriptor; + +/** + * qemu_plugin_get_registers() - return register list for current vCPU + * + * Returns a potentially empty GArray of qemu_plugin_reg_descriptor. + * Caller frees the array (but not the const strings). + * + * Should be used from a qemu_plugin_register_vcpu_init_cb() callback + * after the vCPU is initialised, i.e. in the vCPU context. + */ +QEMU_PLUGIN_API +GArray *qemu_plugin_get_registers(void); + +/** + * qemu_plugin_read_register() - read register for current vCPU + * + * @handle: a @qemu_plugin_reg_handle handle + * @buf: A GByteArray for the data owned by the plugin + * + * This function is only available in a context that register read access is + * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. + * + * Returns the size of the read register. The content of @buf is in target byte + * order. On failure returns -1. + */ +QEMU_PLUGIN_API +int qemu_plugin_read_register(struct qemu_plugin_register *handle, + GByteArray *buf); + + #endif /* QEMU_QEMU_PLUGIN_H */ diff --git a/plugins/api.c b/plugins/api.c index 54df72c1c00..81f43c9ce8a 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -8,6 +8,7 @@ * * qemu_plugin_tb * qemu_plugin_insn + * qemu_plugin_register * * Which can then be passed back into the API to do additional things. * As such all the public functions in here are exported in @@ -35,10 +36,12 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qemu/plugin.h" #include "qemu/log.h" #include "tcg/tcg.h" #include "exec/exec-all.h" +#include "exec/gdbstub.h" #include "exec/ram_addr.h" #include "disas/disas.h" #include "plugin.h" @@ -410,3 +413,55 @@ uint64_t qemu_plugin_entry_code(void) #endif return entry; } + +/* + * Create register handles. + * + * We need to create a handle for each register so the plugin + * infrastructure can call gdbstub to read a register. They are + * currently just a pointer encapsulation of the gdb_reg but in + * future may hold internal plugin state so its important plugin + * authors are not tempted to treat them as numbers. + * + * We also construct a result array with those handles and some + * ancillary data the plugin might find useful. + */ + +static GArray *create_register_handles(GArray *gdbstub_regs) +{ + GArray *find_data = g_array_new(true, true, + sizeof(qemu_plugin_reg_descriptor)); + + for (int i = 0; i < gdbstub_regs->len; i++) { + GDBRegDesc *grd = &g_array_index(gdbstub_regs, GDBRegDesc, i); + qemu_plugin_reg_descriptor desc; + + /* skip "un-named" regs */ + if (!grd->name) { + continue; + } + + /* Create a record for the plugin */ + desc.handle = GINT_TO_POINTER(grd->gdb_reg); + desc.name = g_intern_string(grd->name); + desc.feature = g_intern_string(grd->feature_name); + g_array_append_val(find_data, desc); + } + + return find_data; +} + +GArray *qemu_plugin_get_registers(void) +{ + g_assert(current_cpu); + + g_autoptr(GArray) regs = gdb_get_register_list(current_cpu); + return create_register_handles(regs); +} + +int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf) +{ + g_assert(current_cpu); + + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg)); +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index adb67608598..27fe97239be 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -3,6 +3,7 @@ qemu_plugin_end_code; qemu_plugin_entry_code; qemu_plugin_get_hwaddr; + qemu_plugin_get_registers; qemu_plugin_hwaddr_device_name; qemu_plugin_hwaddr_is_io; qemu_plugin_hwaddr_phys_addr; @@ -19,6 +20,7 @@ qemu_plugin_num_vcpus; qemu_plugin_outs; qemu_plugin_path_to_binary; + qemu_plugin_read_register; qemu_plugin_register_atexit_cb; qemu_plugin_register_flush_cb; qemu_plugin_register_vcpu_exit_cb; From patchwork Wed Feb 28 11:56:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776485 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp256243wrn; Wed, 28 Feb 2024 04:09:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVaNh9rNRjYHeyJG3NgHZcMjcAj3BihOusguRE9m4dlpR4QGurDkPOZ7lrqQoRuFjmg5L3SYWst6zYV/xo0HeCL X-Google-Smtp-Source: AGHT+IF1ad/fOvPVdWgQm4a/zxHZ63SjEtg+OkpF9dU3Np6FrB/3AyBjpHZdGGTGfEPsdPBpL0Cn X-Received: by 2002:a05:6871:7292:b0:220:1870:2a7e with SMTP id mm18-20020a056871729200b0022018702a7emr9064038oac.46.1709122182915; Wed, 28 Feb 2024 04:09:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122182; cv=none; d=google.com; s=arc-20160816; b=PdV4xxKAAmPcmHk4V9vUN29XFKWBjEtRlBfTGhclgW64zRFl/7nec5UWH7W96Mk/30 DVr0hECataRZgmv3dmnyJpz658JXQrzeOfoRBSznhaZyr49Q0ku/Y4VYUnxfbe6Q7b21 TXhfyQpwcqy176FVTW9BrMSLaADBQf0gKWwa53b4V5z0RHIfo+RAFC3hf3FQgdTi3nlN liu4z5nklnWwbtWYlkkSS6PQR35ez0vV/4HUVBvOJPntC5zK6zhFzr17/R08upQ2wo35 l2P+dw49fmgE9zIZ7w/ouYsvzsZxnbpzJ/l3JlFs+6cd82k6Ispv2BJ+GBP37CrMe+Ui PfTA== 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:dkim-signature; bh=2cnCNv8y43FexcD7a6Rtr0pLIxQ1zciWAgu6ycEDUXY=; fh=FAL2D6uTyIa7tGzjyRrQN+DzefW95j5rgBe4AZL1gi8=; b=gyl6HhyO9ZTj2TdbMVPO8l9mEHSEV3I80QybhD81Yf3jfZAJMfMjs1vcElddyYYRLX Jx+8pV4u1ypFxNgFAZ7Io6jm9eqT/5jdFSHyo7X8OBJBZq9wPScqzhGFlEVT6sXQCf4x A/bcYLFb21V/9GTLHbGRRhvn88yeJBdpZNkWavXARFReV8IdLBWpdC+qKApUWEnxORRL pP5Kz/fAzIF7Ij5HGRxm9b5mMorm64xfE6aDDsvAxaCjPRfchZ/6tg8G5KmyDcqZul5A AaA508XgtBAN65vFcD3J8rTh00s97a32vyLyLTx3ENmr9z1ZSGTuzUKp/1jxlnXzxSIY HkBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HQfM91uZ; 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 d23-20020a05620a159700b0078784bc4e64si9514516qkk.615.2024.02.28.04.09.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:09:42 -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; dkim=pass header.i=@linaro.org header.s=google header.b=HQfM91uZ; 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 1rfIeY-00053x-05; Wed, 28 Feb 2024 07:03:14 -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 1rfIeR-0004qm-La for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeM-00035S-Jj for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:07 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-412a14299a4so30083385e9.1 for ; Wed, 28 Feb 2024 04:03:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121781; x=1709726581; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2cnCNv8y43FexcD7a6Rtr0pLIxQ1zciWAgu6ycEDUXY=; b=HQfM91uZaFBNHPv4q42sC2CTcSwBQGZLSkMsUnM1BHvfLYO2vbw/f0hxXadl5gpJq1 i2/B+7dXrEywiZXBC4YyVaHm4wlCId2BBHCihkIAmGF7AiLZblZRjX8BlCkclCt9a6Wd kbUqSm9tM2il2F9FsUTssoVCs+MhWKlU0z9spcoeOLcZH1ztx3lLdfNPi8/6dPp/JoPG ao6ZTeRHsygrXaXFImCKACpDcJ6iAd1hWieTjVq/u/plXo7TPBSEv0Qi48dUNZ9o+fF1 uG/D1YFbUDadMbVXiHSP87LWDwtMfduZoRaaw9O65Db+1T9cxnA8W4Xuq+ZbCb80O3wL aDGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121781; x=1709726581; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2cnCNv8y43FexcD7a6Rtr0pLIxQ1zciWAgu6ycEDUXY=; b=taJ86oxmDAj8Imqb9wiC9gpp9ixNkTqhbVK9nvmNc9lDMhQ3qeWM4IOlc2J0HBwYP1 +iUKdSixJ3mQL2+PszyvLKKjo80kXlhx81F2L/XjSh9a4ok8WG5pAu0p+R0Nj4cXDvPM wgjKqDhTl/mk45KbYIJIL7LLQ0XgP43PMJBdGybCjF+95dPAWgpUYfKRnu023sX75ygT 2Dbgk3Q3+m07P3iZ3W7crL81E6nRgRpfGuYZx6qlKPTvPaq4PTIOg2nY86+ewv9guxMR a0ePP++5chZkkM6xjUuJYbcvG60ljb4ROTX85EMazLE5adnPx+EgPc0H3piOdbtmEQEd wFMw== X-Gm-Message-State: AOJu0YzaQS5z6cCrl+piyOMDmNjY/IBJvSjV+L4okaoKRdDAcMs0TtQZ uUdC5VaLWOPaGzY5KDK9Z6z60EmUX+vs5KiZbM5hkbSqv0KTjqG8EF+mrj13ndA= X-Received: by 2002:a5d:484a:0:b0:33d:b01e:c4d6 with SMTP id n10-20020a5d484a000000b0033db01ec4d6mr8741219wrs.17.1709121781204; Wed, 28 Feb 2024 04:03:01 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bw1-20020a0560001f8100b0033af3a43e91sm14608368wrb.46.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3CCA15F92B; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Subject: [PULL 24/29] tests/tcg: expand insn test case to exercise register API Date: Wed, 28 Feb 2024 11:56:56 +0000 Message-Id: <20240228115701.1416107-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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 This ensure we at least read every register the plugin API reports at least once during the check-tcg checks. Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-25-alex.bennee@linaro.org> diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c index 5fd3017c2b3..54da06fcf26 100644 --- a/tests/plugin/insn.c +++ b/tests/plugin/insn.c @@ -46,6 +46,25 @@ typedef struct { char *disas; } Instruction; +/* + * Initialise a new vcpu with reading the register list + */ +static void vcpu_init(qemu_plugin_id_t id, unsigned int vcpu_index) +{ + g_autoptr(GArray) reg_list = qemu_plugin_get_registers(); + g_autoptr(GByteArray) reg_value = g_byte_array_new(); + + if (reg_list) { + for (int i = 0; i < reg_list->len; i++) { + qemu_plugin_reg_descriptor *rd = &g_array_index( + reg_list, qemu_plugin_reg_descriptor, i); + int count = qemu_plugin_read_register(rd->handle, reg_value); + g_assert(count > 0); + } + } +} + + static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata) { unsigned int i = cpu_index % MAX_CPUS; @@ -212,6 +231,8 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, sizes = g_array_new(true, true, sizeof(unsigned long)); } + /* Register init, translation block and exit callbacks */ + qemu_plugin_register_vcpu_init_cb(id, vcpu_init); qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); return 0; From patchwork Wed Feb 28 11:56:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776459 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp250858wrn; Wed, 28 Feb 2024 03:58:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUzEW1lCpNL1lxR1fp5tv0u3eCw6oMxitdKk56guszNjCmv/qjCKaIjnCfRw58UrZFduPkVD9rBDqbLjIDnWewK X-Google-Smtp-Source: AGHT+IF6uSNQ0KLxO+uFeFX1NXPdRKtqhLFZpBNW2sGPBv49J8ZGWQgWrrt0vdARLi5kikzKOxpY X-Received: by 2002:a0c:cd0f:0:b0:68f:60fd:d319 with SMTP id b15-20020a0ccd0f000000b0068f60fdd319mr4020608qvm.22.1709121500891; Wed, 28 Feb 2024 03:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121500; cv=none; d=google.com; s=arc-20160816; b=zS1SAcU7RFBYiFDy0+7yk/CjfGt6+7Pg9mGROYbW9ia0IoPXMiuOt7ASqLlcfPA2Zw dxel/f2Sona9hpoqpvb5ijxhP+Rr82Wr0XOJEzr9XDW8gOou1a7UOGfqQA7WO5xYPMQo ep9qE5xPFJ3fT1b+f2mED1FUHBcthnwI+FIQJ2NyMuz+Ur1IbBaeYsN1hKxRCQwgnXZO gZu6rghh13Z7jTsE4UP5ZrwEa/JJrWqZVcAV1gYwa2D2iZhib3NvhmoO2t7+Km5+Osm+ VLjWhOmL6gUrW2bL5xesJaVKtB2MOXOVI7exG6ekKjg1Kiizsg6RD1wcIA3PgatA8w5V 7HkQ== 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:dkim-signature; bh=Onyf0n7PQDnbuNd7HujOMaHnjKe5rcDTFcPdFWfXURM=; fh=wMx2pEWokZQt3/WejUyv0DjwzJbvjdRuhKfwHrLFRYw=; b=z9+C80xgg2uLIftkUM/K6UIRfqLNZ+/IktQZJ9yPy5xEkCLz/1DXEliWKpJfQPHmL+ 5hcWoZTRi40VCeyy0teFDnwO8dppFreKFzzp2ersS0TGeRMMU5V/rEf+JbBCEXk5livB /reXZKQMAVS313zEcQ+2kXAdlq4K5D7w9JMk+/uxl7Bn5JBFGSvzld4sEgK1V+OsMMzk qgJziP9+heMEb5bxggkhHetmRNefIqk3SwnpmTMFiKKPVlY54ALp6YBCwwh64Fkk7Sx/ MwgLyFYzlQYLP72QQasZyxzjgf51l5Rj9jExBmJFWBGyJMcYlDsbaDUQe7L80VfTurb0 AD+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pG4BuZ/B"; 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 14-20020a05621420ce00b0068fe4f0982fsi9769514qve.156.2024.02.28.03.58.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 03:58:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b="pG4BuZ/B"; 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 1rfIZA-0006Ap-Gk; Wed, 28 Feb 2024 06:57:40 -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 1rfIZ6-00069o-C5 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:36 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYr-0005oJ-Hz for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:36 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33aeb088324so3402905f8f.2 for ; Wed, 28 Feb 2024 03:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121440; x=1709726240; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Onyf0n7PQDnbuNd7HujOMaHnjKe5rcDTFcPdFWfXURM=; b=pG4BuZ/Bj1149mqlfTGDl2fS7v6f+3RtH3bKu/cB6TEiyz6enByafnkIz1Sfgy/IPj /d0j42l3v9FwN3om+ZBydejv19kn9T42G7EGF2rQOf7VvOprBjWOeJOniYbVLNhErIVl DJO60CyDiumWxO2ojFq0clP4yeAWT6uRi5tOXer2E7gL80b6VdWEcEWALG8QrC/Da3YP zVW64mDBK6vlsE32Yk9DVtWuuHw1KWsRzZM3wWgfAcjcy12SrZsOXzycHHzXCtP3aJL6 T/YTUtoygoCQDBRxKaXoHV3lXfqO8b6OmepPefrGU/MRlgH2RtpjEoLH/AWKzv6h/eAn WkcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121440; x=1709726240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Onyf0n7PQDnbuNd7HujOMaHnjKe5rcDTFcPdFWfXURM=; b=iX3r+DKgSYgDyx9s6NP4P/TRcdV36zQoDSdzKj42LycfTNaw7QtApD7zO6nKLzVp3K VRk89ziDqF0dhHzIJrnrmmIPfytpPCNrmtdryCJPKkGrhLxodvg/lmA+mgg6cVZ3Bu3k bhQJMrYFcZfjkM6vECxrbiOFx1y3mitHKZqCqBjyuVnr+FE8dyfGu6giuMPCoiv+9+yG Bw3uq4t6rO0h0cmVE70lqFqZhblk7Hkp1V5JK6IuOLsSVSLd7lhOJvFfpk3zc9THzXyL sdbARr2nVkybNHViBUuyeU295DRL9Kj8toK6IF/eiayCaFARX9Zc+2qW+76XgfUqItSm KRTQ== X-Gm-Message-State: AOJu0YxddWMe2m6aQgREiGXD/cJNarVDUWirIAYQ7oh1lkCnS8xcLO+W 8QS8PVm7tpT24RmfyKSRyv9KeVIHDfdElmt6AmZ83l0CKU1wVPelte5rAJVHGqQ= X-Received: by 2002:a5d:4392:0:b0:33b:8050:291f with SMTP id i18-20020a5d4392000000b0033b8050291fmr8383359wrq.32.1709121439915; Wed, 28 Feb 2024 03:57:19 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id b3-20020a5d4b83000000b0033df1f1dabcsm4516862wrt.90.2024.02.28.03.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:16 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4FD285F92C; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Subject: [PULL 25/29] contrib/plugins: fix imatch Date: Wed, 28 Feb 2024 11:56:57 +0000 Message-Id: <20240228115701.1416107-26-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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, 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 We can't directly save the ephemeral imatch from argv as that memory will get recycled. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-26-alex.bennee@linaro.org> diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index 82dc2f584e2..f262e5555eb 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -199,7 +199,7 @@ static void parse_insn_match(char *match) if (!imatches) { imatches = g_ptr_array_new(); } - g_ptr_array_add(imatches, match); + g_ptr_array_add(imatches, g_strdup(match)); } static void parse_vaddr_match(char *match) From patchwork Wed Feb 28 11:56:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776469 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp251560wrn; Wed, 28 Feb 2024 04:00:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVH0BHYxS3NX5S5/47c1FYh9H1Qo4+TbyhP2tn4E8f+ItrzKL9LX4gtnfIpu95/Jlnn5gMe+rY2bCoueBDiFcZx X-Google-Smtp-Source: AGHT+IFFniT5WsGqkd6K4WQB1RsmXCRTUbvOaxlNjO6nOB8LJPsBTsAVyzfSuuLOgs5EPdvAHq3X X-Received: by 2002:ac8:5c0d:0:b0:42e:7cdd:2744 with SMTP id i13-20020ac85c0d000000b0042e7cdd2744mr11339131qti.41.1709121624162; Wed, 28 Feb 2024 04:00:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121624; cv=none; d=google.com; s=arc-20160816; b=sO22DbRQh09YaLymlVBo2LfSfmn9rIgmom+NL9iKHTWDwFFnAhbcMsFRKL7mmntlvq En0FT0G5ulvK+LE9XP2utKTfeQriVsZ0tS6N96S4L/geUAmxNz6ymLAL+jHeRE1gPbFB yspsB6pFEs1mEJvS5Yl/rpxMAhgroyWRq1PwYlxRMZxe1A5hOB0rKFjD9sGlfOHffabS jR628b2h99X+vId9Y43gZteZLQ+z9cFNGBkK2LT0fBtIeiRe0bq+5aedwLvWVGGjoMWh AElj4aHRnPNjxY7Ac3c/nEDrpyzkEn5SSZ30Gp4AEg1y90vl/VIUTskckko4SZxz8ks6 Nr4g== 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:dkim-signature; bh=DvmebrYkiR/CIRHk29ULS2jF/JHwcdmBL9IMoweIW9A=; fh=mNt2plR5Ft1M6UDO56Miou28qVinVzO6nazzWEIYEHc=; b=1Eb8vrX6vg8PX95fC0OykbV/+daYWliRnuTOULcVnJDOKmihXrz6fo5wjoRcZB2edT 9r3WzzmpKTPQKJIeIhmRH9zmTM98bVFQt/71eRFv1W1K+n6PU92HzdJdJzkR2C/ThfCM xAwE/GqKfPqF3z09bTdFhOhlhgFkHcvzL/uZRCFEfzx8wQmY+sYgr/AZw6ps3pi/0shO y6n9OFVCCgOOmtmiqiB/jClgeT4Bgg88a2X7joJVLKOGkZ79uXF7dm8+QLmo7w2t8wUw u9/4ZNBaWBLcbwogZ64tcn06bwTSf3+pVmSLwdiux+vb2YXKM4a6PZ/n8jwQmGQ1f8hL iatA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dtSr0hn8; 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 v16-20020ac87490000000b0042e78dd6fdfsi8611536qtq.296.2024.02.28.04.00.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:00:24 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dtSr0hn8; 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 1rfIZ4-00069I-As; Wed, 28 Feb 2024 06:57:34 -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 1rfIZ0-00066c-DD for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:30 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIYs-0005od-4Q for qemu-devel@nongnu.org; Wed, 28 Feb 2024 06:57:30 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33d6fe64a9bso3948823f8f.0 for ; Wed, 28 Feb 2024 03:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121441; x=1709726241; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DvmebrYkiR/CIRHk29ULS2jF/JHwcdmBL9IMoweIW9A=; b=dtSr0hn8j8S1TT7PBPpuyzde83vu2VKIe13WxT1DmFmELVDoozEdyJKK9EiHeDJ9t5 KBWQOt+9z99YU+hVEGd6U/aZ8zGggpG3EDGBpzonc/LWi9Ukr33HtDnfajVAA7bBVTKl tr85nJ4+L2h/dCiipEY5vvbqENd4h7BUZWT7QS4xu02+BsiC8uuD+DgaQoHUb3pAujMC UC8RXZE66TPoZME9SutrEdqswA3e2rTiW3wnVFPIZKHWgirSUoNhFiVoTjgE+CZNB8FR hB2bOsTKRVWnVRg9hTyoY3EjjjphspQSKHa01Bpn7VWPv7AX3RrKhUCIEOWTCre3+bqK G98Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121441; x=1709726241; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DvmebrYkiR/CIRHk29ULS2jF/JHwcdmBL9IMoweIW9A=; b=ZBY0DRNhmV1pRDauPPzmippaNoy3rv6GU85IuH1VPnVJtB4kBL+MOCvBd8LBgLANln MBf8Ahh37OAjSMFLOTqDbjFUtgOY/gRlTRbM5fMcxj4o29cpOVR787MiokTqr4ygC9Te TJPAAo7Q66ZVJcaMgbxtYxWlC6zSVzd+CXamJGYaOZX/nUoGQl00BUtKTXTz6yY5le9W oTQcNLPKgglEGMucPIYWhbyBB6T68c3hrkbZBExOQiDTVcogjfTgMpQoyCjoUUxXe4xm p6wwDwEyezrk5etM+YSrfqFp8uyHWRSByGSDxIq41gdi4ySJ09jnrSayZQP8ycnD0gnQ n2Hw== X-Gm-Message-State: AOJu0YxatF6jcDTdYZBoH/03Tpkd4WGWVlBCwB6GOEbwT5aIykDnfOOc lQVw0isJzWPzyV+tsenmYxvJ67XxMUrlt7s1nHd89TeWgTRXKIOIcZxXbAghnpk= X-Received: by 2002:a5d:548a:0:b0:33d:32fc:4340 with SMTP id h10-20020a5d548a000000b0033d32fc4340mr8876218wrv.39.1709121440702; Wed, 28 Feb 2024 03:57:20 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id g7-20020adfe407000000b0033d2ae84fafsm14265522wrm.52.2024.02.28.03.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:57:17 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 67A695F92D; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Akihiko Odaki , Alexandre Iooss , Mahmoud Mandour , Richard Henderson , Paolo Bonzini Subject: [PULL 26/29] contrib/plugins: extend execlog to track register changes Date: Wed, 28 Feb 2024 11:56:58 +0000 Message-Id: <20240228115701.1416107-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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 With the new plugin register API we can now track changes to register values. Currently the implementation is fairly dumb which will slow down if a large number of register values are being tracked. This could be improved by only instrumenting instructions which mention registers we are interested in tracking. Example usage: ./qemu-aarch64 -D plugin.log -d plugin \ -cpu max,sve256=on \ -plugin contrib/plugins/libexeclog.so,reg=sp,reg=z\* \ ./tests/tcg/aarch64-linux-user/sha512-sve will display in the execlog any changes to the stack pointer (sp) and the SVE Z registers. As testing registers every instruction will be quite a heavy operation there is an additional flag which attempts to optimise the register tracking by only instrumenting instructions which are likely to change its value. This relies on the QEMU disassembler showing up the register names in disassembly so is an explicit opt-in. Reviewed-by: Pierrick Bouvier Cc: Akihiko Odaki Based-On: <20231025093128.33116-19-akihiko.odaki@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-27-alex.bennee@linaro.org> diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 81dcd43a612..fa7421279f5 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -497,6 +497,22 @@ arguments if required:: $ qemu-system-arm $(QEMU_ARGS) \ -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin +This plugin can also dump registers when they change value. Specify the name of the +registers with multiple ``reg`` options. You can also use glob style matching if you wish:: + + $ qemu-system-arm $(QEMU_ARGS) \ + -plugin ./contrib/plugins/libexeclog.so,reg=\*_el2,reg=sp -d plugin + +Be aware that each additional register to check will slow down +execution quite considerably. You can optimise the number of register +checks done by using the rdisas option. This will only instrument +instructions that mention the registers in question in disassembly. +This is not foolproof as some instructions implicitly change +instructions. You can use the ifilter to catch these cases: + + $ qemu-system-arm $(QEMU_ARGS) \ + -plugin ./contrib/plugins/libexeclog.so,ifilter=msr,ifilter=blr,reg=x30,reg=\*_el1,rdisas=on + - contrib/plugins/cache.c Cache modelling plugin that measures the performance of a given L1 cache @@ -583,4 +599,3 @@ The following API is generated from the inline documentation in include the full kernel-doc annotations. .. kernel-doc:: include/qemu/qemu-plugin.h - diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index f262e5555eb..a1dfd59ab71 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2021, Alexandre Iooss * - * Log instruction execution with memory access. + * Log instruction execution with memory access and register changes * * License: GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. @@ -15,29 +15,40 @@ #include +typedef struct { + struct qemu_plugin_register *handle; + GByteArray *last; + GByteArray *new; + const char *name; +} Register; + +typedef struct CPU { + /* Store last executed instruction on each vCPU as a GString */ + GString *last_exec; + /* Ptr array of Register */ + GPtrArray *registers; +} CPU; + QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; -/* Store last executed instruction on each vCPU as a GString */ -static GPtrArray *last_exec; +static GArray *cpus; static GRWLock expand_array_lock; static GPtrArray *imatches; static GArray *amatches; +static GPtrArray *rmatches; +static bool disas_assist; +static GMutex add_reg_name_lock; +static GPtrArray *all_reg_names; -/* - * Expand last_exec array. - * - * As we could have multiple threads trying to do this we need to - * serialise the expansion under a lock. - */ -static void expand_last_exec(int cpu_index) +static CPU *get_cpu(int vcpu_index) { - g_rw_lock_writer_lock(&expand_array_lock); - while (cpu_index >= last_exec->len) { - GString *s = g_string_new(NULL); - g_ptr_array_add(last_exec, s); - } - g_rw_lock_writer_unlock(&expand_array_lock); + CPU *c; + g_rw_lock_reader_lock(&expand_array_lock); + c = &g_array_index(cpus, CPU, vcpu_index); + g_rw_lock_reader_unlock(&expand_array_lock); + + return c; } /** @@ -46,13 +57,10 @@ static void expand_last_exec(int cpu_index) static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t info, uint64_t vaddr, void *udata) { - GString *s; + CPU *c = get_cpu(cpu_index); + GString *s = c->last_exec; /* Find vCPU in array */ - g_rw_lock_reader_lock(&expand_array_lock); - g_assert(cpu_index < last_exec->len); - s = g_ptr_array_index(last_exec, cpu_index); - g_rw_lock_reader_unlock(&expand_array_lock); /* Indicate type of memory access */ if (qemu_plugin_mem_is_store(info)) { @@ -73,32 +81,91 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t info, } /** - * Log instruction execution + * Log instruction execution, outputting the last one. + * + * vcpu_insn_exec() is a copy and paste of vcpu_insn_exec_with_regs() + * without the checking of register values when we've attempted to + * optimise with disas_assist. */ -static void vcpu_insn_exec(unsigned int cpu_index, void *udata) +static void insn_check_regs(CPU *cpu) { - GString *s; + for (int n = 0; n < cpu->registers->len; n++) { + Register *reg = cpu->registers->pdata[n]; + int sz; - /* Find or create vCPU in array */ - g_rw_lock_reader_lock(&expand_array_lock); - if (cpu_index >= last_exec->len) { - g_rw_lock_reader_unlock(&expand_array_lock); - expand_last_exec(cpu_index); - g_rw_lock_reader_lock(&expand_array_lock); + g_byte_array_set_size(reg->new, 0); + sz = qemu_plugin_read_register(reg->handle, reg->new); + g_assert(sz == reg->last->len); + + if (memcmp(reg->last->data, reg->new->data, sz)) { + GByteArray *temp = reg->last; + g_string_append_printf(cpu->last_exec, ", %s -> 0x", reg->name); + /* TODO: handle BE properly */ + for (int i = sz; i >= 0; i--) { + g_string_append_printf(cpu->last_exec, "%02x", + reg->new->data[i]); + } + reg->last = reg->new; + reg->new = temp; + } + } +} + +/* Log last instruction while checking registers */ +static void vcpu_insn_exec_with_regs(unsigned int cpu_index, void *udata) +{ + CPU *cpu = get_cpu(cpu_index); + + /* Print previous instruction in cache */ + if (cpu->last_exec->len) { + if (cpu->registers) { + insn_check_regs(cpu); + } + + qemu_plugin_outs(cpu->last_exec->str); + qemu_plugin_outs("\n"); + } + + /* Store new instruction in cache */ + /* vcpu_mem will add memory access information to last_exec */ + g_string_printf(cpu->last_exec, "%u, ", cpu_index); + g_string_append(cpu->last_exec, (char *)udata); +} + +/* Log last instruction while checking registers, ignore next */ +static void vcpu_insn_exec_only_regs(unsigned int cpu_index, void *udata) +{ + CPU *cpu = get_cpu(cpu_index); + + /* Print previous instruction in cache */ + if (cpu->last_exec->len) { + if (cpu->registers) { + insn_check_regs(cpu); + } + + qemu_plugin_outs(cpu->last_exec->str); + qemu_plugin_outs("\n"); } - s = g_ptr_array_index(last_exec, cpu_index); - g_rw_lock_reader_unlock(&expand_array_lock); + + /* reset */ + cpu->last_exec->len = 0; +} + +/* Log last instruction without checking regs, setup next */ +static void vcpu_insn_exec(unsigned int cpu_index, void *udata) +{ + CPU *cpu = get_cpu(cpu_index); /* Print previous instruction in cache */ - if (s->len) { - qemu_plugin_outs(s->str); + if (cpu->last_exec->len) { + qemu_plugin_outs(cpu->last_exec->str); qemu_plugin_outs("\n"); } /* Store new instruction in cache */ /* vcpu_mem will add memory access information to last_exec */ - g_string_printf(s, "%u, ", cpu_index); - g_string_append(s, (char *)udata); + g_string_printf(cpu->last_exec, "%u, ", cpu_index); + g_string_append(cpu->last_exec, (char *)udata); } /** @@ -111,6 +178,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) { struct qemu_plugin_insn *insn; bool skip = (imatches || amatches); + bool check_regs_this = rmatches; + bool check_regs_next = false; size_t n = qemu_plugin_tb_n_insns(tb); for (size_t i = 0; i < n; i++) { @@ -131,7 +200,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) /* * If we are filtering we better check out if we have any * hits. The skip "latches" so we can track memory accesses - * after the instruction we care about. + * after the instruction we care about. Also enable register + * checking on the next instruction. */ if (skip && imatches) { int j; @@ -139,6 +209,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) char *m = g_ptr_array_index(imatches, j); if (g_str_has_prefix(insn_disas, m)) { skip = false; + check_regs_next = rmatches; } } } @@ -153,8 +224,39 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) } } + /* + * Check the disassembly to see if a register we care about + * will be affected by this instruction. This relies on the + * dissembler doing something sensible for the registers we + * care about. + */ + if (disas_assist && rmatches) { + check_regs_next = false; + gchar *args = g_strstr_len(insn_disas, -1, " "); + for (int n = 0; n < all_reg_names->len; n++) { + gchar *reg = g_ptr_array_index(all_reg_names, n); + if (g_strrstr(args, reg)) { + check_regs_next = true; + skip = false; + } + } + } + + /* + * We now have 3 choices: + * + * - Log insn + * - Log insn while checking registers + * - Don't log this insn but check if last insn changed registers + */ + if (skip) { - g_free(insn_disas); + if (check_regs_this) { + qemu_plugin_register_vcpu_insn_exec_cb(insn, + vcpu_insn_exec_only_regs, + QEMU_PLUGIN_CB_R_REGS, + NULL); + } } else { uint32_t insn_opcode; insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); @@ -167,30 +269,124 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) QEMU_PLUGIN_MEM_RW, NULL); /* Register callback on instruction */ - qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec, - QEMU_PLUGIN_CB_NO_REGS, output); + if (check_regs_this) { + qemu_plugin_register_vcpu_insn_exec_cb( + insn, vcpu_insn_exec_with_regs, + QEMU_PLUGIN_CB_R_REGS, + output); + } else { + qemu_plugin_register_vcpu_insn_exec_cb( + insn, vcpu_insn_exec, + QEMU_PLUGIN_CB_NO_REGS, + output); + } /* reset skip */ skip = (imatches || amatches); } + /* set regs for next */ + if (disas_assist && rmatches) { + check_regs_this = check_regs_next; + } + + g_free(insn_disas); } } +static Register *init_vcpu_register(qemu_plugin_reg_descriptor *desc) +{ + Register *reg = g_new0(Register, 1); + g_autofree gchar *lower = g_utf8_strdown(desc->name, -1); + int r; + + reg->handle = desc->handle; + reg->name = g_intern_string(lower); + reg->last = g_byte_array_new(); + reg->new = g_byte_array_new(); + + /* read the initial value */ + r = qemu_plugin_read_register(reg->handle, reg->last); + g_assert(r > 0); + return reg; +} + +static GPtrArray *registers_init(int vcpu_index) +{ + g_autoptr(GPtrArray) registers = g_ptr_array_new(); + g_autoptr(GArray) reg_list = qemu_plugin_get_registers(); + + if (rmatches && reg_list->len) { + /* + * Go through each register in the complete list and + * see if we want to track it. + */ + for (int r = 0; r < reg_list->len; r++) { + qemu_plugin_reg_descriptor *rd = &g_array_index( + reg_list, qemu_plugin_reg_descriptor, r); + for (int p = 0; p < rmatches->len; p++) { + g_autoptr(GPatternSpec) pat = g_pattern_spec_new(rmatches->pdata[p]); + g_autofree gchar *rd_lower = g_utf8_strdown(rd->name, -1); + if (g_pattern_match_string(pat, rd->name) || + g_pattern_match_string(pat, rd_lower)) { + Register *reg = init_vcpu_register(rd); + g_ptr_array_add(registers, reg); + + /* we need a list of regnames at TB translation time */ + if (disas_assist) { + g_mutex_lock(&add_reg_name_lock); + if (!g_ptr_array_find(all_reg_names, reg->name, NULL)) { + g_ptr_array_add(all_reg_names, reg->name); + } + g_mutex_unlock(&add_reg_name_lock); + } + } + } + } + } + + return registers->len ? g_steal_pointer(®isters) : NULL; +} + +/* + * Initialise a new vcpu/thread with: + * - last_exec tracking data + * - list of tracked registers + * - initial value of registers + * + * As we could have multiple threads trying to do this we need to + * serialise the expansion under a lock. + */ +static void vcpu_init(qemu_plugin_id_t id, unsigned int vcpu_index) +{ + CPU *c; + + g_rw_lock_writer_lock(&expand_array_lock); + if (vcpu_index >= cpus->len) { + g_array_set_size(cpus, vcpu_index + 1); + } + g_rw_lock_writer_unlock(&expand_array_lock); + + c = get_cpu(vcpu_index); + c->last_exec = g_string_new(NULL); + c->registers = registers_init(vcpu_index); +} + /** * On plugin exit, print last instruction in cache */ static void plugin_exit(qemu_plugin_id_t id, void *p) { guint i; - GString *s; - for (i = 0; i < last_exec->len; i++) { - s = g_ptr_array_index(last_exec, i); - if (s->str) { - qemu_plugin_outs(s->str); + g_rw_lock_reader_lock(&expand_array_lock); + for (i = 0; i < cpus->len; i++) { + CPU *c = get_cpu(i); + if (c->last_exec && c->last_exec->str) { + qemu_plugin_outs(c->last_exec->str); qemu_plugin_outs("\n"); } } + g_rw_lock_reader_unlock(&expand_array_lock); } /* Add a match to the array of matches */ @@ -212,6 +408,18 @@ static void parse_vaddr_match(char *match) g_array_append_val(amatches, v); } +/* + * We have to wait until vCPUs are started before we can check the + * patterns find anything. + */ +static void add_regpat(char *regpat) +{ + if (!rmatches) { + rmatches = g_ptr_array_new(); + } + g_ptr_array_add(rmatches, g_strdup(regpat)); +} + /** * Install the plugin */ @@ -223,11 +431,8 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, * Initialize dynamic array to cache vCPU instruction. In user mode * we don't know the size before emulation. */ - if (info->system_emulation) { - last_exec = g_ptr_array_sized_new(info->system.max_vcpus); - } else { - last_exec = g_ptr_array_new(); - } + cpus = g_array_sized_new(true, true, sizeof(CPU), + info->system_emulation ? info->system.max_vcpus : 1); for (int i = 0; i < argc; i++) { char *opt = argv[i]; @@ -236,13 +441,22 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, parse_insn_match(tokens[1]); } else if (g_strcmp0(tokens[0], "afilter") == 0) { parse_vaddr_match(tokens[1]); + } else if (g_strcmp0(tokens[0], "reg") == 0) { + add_regpat(tokens[1]); + } else if (g_strcmp0(tokens[0], "rdisas") == 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &disas_assist)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", opt); + return -1; + } + all_reg_names = g_ptr_array_new(); } else { fprintf(stderr, "option parsing failed: %s\n", opt); return -1; } } - /* Register translation block and exit callbacks */ + /* Register init, translation block and exit callbacks */ + qemu_plugin_register_vcpu_init_cb(id, vcpu_init); qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); From patchwork Wed Feb 28 11:56:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776479 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp253556wrn; Wed, 28 Feb 2024 04:03:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUP5AW+4QwRQXCUdLtx0dexGDYoYWwWA/PdXyg9hDYLkU/V794P3kmqJhwVKunpsOQWQgX8ln+nZAlU0hsQxdJ+ X-Google-Smtp-Source: AGHT+IHFykbL0875ZcTHQSDZJxXkHm//sUBdTA/m6i5gv99N9fL1pnYqywkIvqK1bsVvDSYPVzyd X-Received: by 2002:a05:620a:1998:b0:787:b833:7036 with SMTP id bm24-20020a05620a199800b00787b8337036mr3747333qkb.6.1709121834460; Wed, 28 Feb 2024 04:03:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121834; cv=none; d=google.com; s=arc-20160816; b=uPKxNUCW6K6+bvVkIVWrtOlFBuS50b27sma1D+SaoqOxN/eKIL6Oy4TCvkN6X+mlBB /LFFZP79eiyR2hYckFY6hnISuwIyVmkWApXfBFBsKIirk1AlgFOpPlnDyr4iHLF41jT5 DQnG8wWAnNkVAFUtldsaqMbpd/mOIJoP7LMV3mKjI81MXe/QY+wsyjwK9WGYDkpIAb7C 4wJX0ZPiPXN5FNtarWbv7/Rs0YfhFJHSqgKK7purfaHfsxdQPx6KgDTK+rAjGNU5MBhz 7H+3/vHrCLarfpLw/kKejw75XpjnrDDqZCbZudzA+EFUzwsh/zjZ6/oMbQ8K/op2LQum Le4w== 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:dkim-signature; bh=LrGWCpGE1wAXQ1EpZJv0VK14aG5z8id0pl8bqptEn7w=; fh=mmbtyFGVZGP3QrjtXO70GCL1P+X0FpV9eW98wSEyozA=; b=wsv0UhMRPUu0bJM8aJJK0mn/dT4CnBWZLiSpsvtQwrfTXoxgQQwA58XywNI/kNzVng CKSV5zBvUOguTeYkFZQoXJkrmSypmPbTbRZJHppk1wvVuztnFIXIGQ7JjWCFFoxNjcG8 4s7md42UTPHnjyo402xL2frmE55GTeVDVCPjQIKc6TUXfxYuaYU7BeWcHYqL4oxrx+sh YbGlMBqhleY12dbZNYvsm3C7WP8uRfCxuXJY/bBEdR5xFQ5AYDRduohpvMYprzC93g7j iEsfW+NSiOdGsKrg/aMjBc3SM6j/l3+fNcPCabBFVkKE2qgaciyxQxOHoOcBypAK0KY6 HOnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QhluJfGh; 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 m13-20020a05620a214d00b00787e111310dsi3856164qkm.30.2024.02.28.04.03.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:03:54 -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; dkim=pass header.i=@linaro.org header.s=google header.b=QhluJfGh; 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 1rfIec-0005N3-5T; Wed, 28 Feb 2024 07:03:18 -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 1rfIeR-0004ql-Ku for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 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 1rfIeO-000361-Sa for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:07 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-412b434effaso3787155e9.2 for ; Wed, 28 Feb 2024 04:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121783; x=1709726583; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LrGWCpGE1wAXQ1EpZJv0VK14aG5z8id0pl8bqptEn7w=; b=QhluJfGh0dSDcVpc3ccYVXEReYSjjMqjoisF9vbMkRkM/gEMShXNEF8bgHKTRs1Q4Y CWzNk1Jui5f8YQDisKXTU7Y0AzJDkakQAX0gL8mxiSkrrrk9v6WvXQwuelNm3W3qLFyT AdVWxL89WsOipk7FtMlR/zNefb6EgHjkczK3lokN10tckqBksP/J96Orcj8qNXBKelkf c2LzMGK8TQEkKVipoi62DALYEljd/0KPc0EJe/HzFMFb17ylRNlJOOo2C4f0wj3NuHSC 9s5TD1tQwxThzna9I1iiZiajnDNdZFI18WQOR+VBNf54zU7GdsJkCWn7B10BwQ/YvIlZ Oumw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121783; x=1709726583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LrGWCpGE1wAXQ1EpZJv0VK14aG5z8id0pl8bqptEn7w=; b=kaYcc0foHxRDAtq7XROXsP2Rubwx3/RpYvrrOt7ZnGIfyj+PyxS6Sr60JQAaw9ykEs DXdqQnf+CUb5Q6pdlDr8ob41EgL/8LPuloa3x9jh7zsvxKkFVl6V1YcBWXceOyH14NcY kssG9QNM7Wcudim1wWP09Uy6/LRk9tTMlN+XzLfvmGThc1NqD1zsHN5GDTuCoMl1yMpN xsxMBO0zhgUnFyvKBJlrgXDm2bZtznOTN8BctIGG0VfwfHWMnYIQcXE5Sax4yP3siIIT pXVRO0Gf0vgtukEwJmNXqkW/9zvq1bzzwaVW30JhueaiVmXJwO3p3Ijz9CmhrdxEfw// ZrKQ== X-Gm-Message-State: AOJu0YzK3r/fBAqMikH93eHIjbv9y+bBYiG/wKjTKKWVDSffcFHaCk4X 3x249NfRw/0ETBD8cKpa4rHGNbme1E5PTqw3+M0XsLeB2/4UwLVOkrpuKe/wfho= X-Received: by 2002:a05:600c:3b84:b0:412:b53f:99e4 with SMTP id n4-20020a05600c3b8400b00412b53f99e4mr782387wms.40.1709121783177; Wed, 28 Feb 2024 04:03:03 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id z13-20020a1c4c0d000000b00412b390362asm1851564wmf.17.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7B4A75F92E; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Alexandre Iooss , Mahmoud Mandour , Richard Henderson , Paolo Bonzini Subject: [PULL 27/29] docs/devel: lift example and plugin API sections up Date: Wed, 28 Feb 2024 11:56:59 +0000 Message-Id: <20240228115701.1416107-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@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 This makes them a bit more visible in the TCG emulation menu rather than hiding them away bellow the ToC limit. Reviewed-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-28-alex.bennee@linaro.org> diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index fa7421279f5..535a74684c5 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -143,7 +143,7 @@ requested. The plugin isn't completely uninstalled until the safe work has executed while all vCPUs are quiescent. Example Plugins ---------------- +=============== There are a number of plugins included with QEMU and you are encouraged to contribute your own plugins plugins upstream. There is a @@ -591,8 +591,8 @@ The plugin has a number of arguments, all of them are optional: configuration arguments implies ``l2=on``. (default: N = 2097152 (2MB), B = 64, A = 16) -API ---- +Plugin API +========== The following API is generated from the inline documentation in ``include/qemu/qemu-plugin.h``. Please ensure any updates to the API From patchwork Wed Feb 28 11:57:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776478 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp253535wrn; Wed, 28 Feb 2024 04:03:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXWgWqgf7wLdtEQaWHcYYXKBo/3FtAZvxGSA4RvyKkmBjhMIDLRYjI+kaTft5HzXvtbeSXSQq9OYdU5CH9kdpAo X-Google-Smtp-Source: AGHT+IHlsMKSa05dCjlhxOEYR7tSXgQ5FY1StbpsCSYu/JytESFqf2FOx/A6QP1F/HnvSzUIZlrm X-Received: by 2002:ac8:5c96:0:b0:42e:aa90:ab6e with SMTP id r22-20020ac85c96000000b0042eaa90ab6emr2470975qta.48.1709121829557; Wed, 28 Feb 2024 04:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709121829; cv=none; d=google.com; s=arc-20160816; b=yV4OjNoUf2/kbLzs7O+sMl9a3A7iKKLWO3xDfUe7ffO8wVQYaPBwM69eq+qiOFjGoX RE9QY5juSNDTxH0Xn2FBKkgZiqvlITTuFMvpUJaTN8TuKP3CYuBIDnXcOnw2s2V9aY02 bt1kBc2bjgjT1kyqHRnmncqMjOzRUweXznyWY5//4lLDzQiBD/5U3iWFGa+2ydw0bHme nCqunp108+/JYf3CBd6mEe1CkdhyAysAjZAXx0vFfLsL9+eeJredCdb1BLQRxg/BMmPy zZZI8Sb1twnn5sIbimclgPeVkRvNFNN4EJFdVcJUCEVwKK8wD6tzhw5uTY9znxpwWRrL fHVg== 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:dkim-signature; bh=pC0CILfvkT1LAPjD+cy5PSMJ+8YOfVMAkY3CpGh5+Vk=; fh=J1mEt/br0T95fqv/QqsgNqYqKUXznBIGHik03n80zmI=; b=kmMe2RF5iRTCzaU+xwM6JBkdlXfzMfcqaD9MSDkQXLSsamt9YyMIM4KSqExqJTGb1D Y9HCPs8lB/w0JWVpeSIyh/twGm/2PqVg0HOVEEKXeYF7sRhj7QAZgJvz23AJg6pJ5LMt TtKIjuhFj4r/eV3/14pPRvu7nKV5xIBIYePoAt4yl7pI08x1pZmjNVmhjipBIm5JBK8X tcgY+Jm3qt4Nafv3iaOt92EWpKwhvCXi0r5wPGQB8fHZ/qivulnxFYA3SErY0BhM3plh ooY+3u5xCh0YUsDe1ywXTnhTxs11DPZGv20yob0Bholrs87U9UwBAtGjdKtA4tEhpPNs ohpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EzsGqqv/"; 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 p18-20020ae9f312000000b00787187a0b6fsi9567587qkg.692.2024.02.28.04.03.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:03:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EzsGqqv/"; 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 1rfIeT-0004nA-Lq; Wed, 28 Feb 2024 07:03:10 -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 1rfIeO-0004dm-Bl for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:04 -0500 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeI-00034h-AZ for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:04 -0500 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d28387db09so45489231fa.0 for ; Wed, 28 Feb 2024 04:02:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121776; x=1709726576; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pC0CILfvkT1LAPjD+cy5PSMJ+8YOfVMAkY3CpGh5+Vk=; b=EzsGqqv/OZUmEcdlXjmGNBRONrKIG5AxkP+ZT5wtEROzkND9WnNCuWEMaiYVzpzzsN C7jqBulZ+swpfDZLNtEIJPSY0qLXn5+3OzN2Jo/sQI6DM6fYXCwbbfJHREdAXtqyHwpF O7HdyNrr1x/q3xDc07HMU/Hd0Ith4UfYGGb/Ft/j7kDdBoDzlqODsO0EkwZu13qVkUPM a9jnVslufT/OYIRJNdUeufBAdp87dEwDJlWyqsiVx3iHr3hzO9Vz/OeMmKcOzxLQATNN pJnAoal0tqcuK6PfsoXTwz4EL/Ww7IFa3FNO/GQHi7L4ns6OP4pB/rTQhMEyh7374o7w 8P9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121776; x=1709726576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pC0CILfvkT1LAPjD+cy5PSMJ+8YOfVMAkY3CpGh5+Vk=; b=GbxaEl/+tDDIOxK7Pj7vky/0HekHkWTu6YTFIaec+/IRj5mfdP0tIkMvLJiVcUOKZs YuOYbV5m+oUF6bb/DcE8cT0cSJJWYyAEQ0SDZcFhAA+enqNR9GDv718CJ5RPaLZH0I+U PDJCECLeI6zhw9y7H07bMHfRZID9nA9zReXCuDOO/tVj97i92AMRYlrHy/OFWloNuRVv /VnEa5Gthx1bbiLkYKWjoGdnIy8XiuUPjHY3L4fGJmBsboBDLHVCPYhRuHLuClYUGlPr /0Gag2SXL2D8286SvqZNYlYGkMBeRKgDUpHnWSIQ7pvh+UghCMmcx9xCXR/0WAsPfqaF HM+w== X-Gm-Message-State: AOJu0Yxw9DXsuzvSfDNUnVpWTknZrZDcBI/WkDurF3SAYuTG6nMVMlZE E7D6RWvqQhNi70saiqMMCiEk//Mrl+52GwwLTJ5GSOiYCWE65dTS2I8vALtisR4= X-Received: by 2002:a2e:6a06:0:b0:2d1:1ef3:3c84 with SMTP id f6-20020a2e6a06000000b002d11ef33c84mr7438014ljc.28.1709121776728; Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id az8-20020adfe188000000b0033d7dd27d97sm14421391wrb.45.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8E2165F92F; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Richard Henderson , Paolo Bonzini , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 28/29] docs/devel: document some plugin assumptions Date: Wed, 28 Feb 2024 11:57:00 +0000 Message-Id: <20240228115701.1416107-29-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x232.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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 While we attempt to hide implementation details from the plugin we shouldn't be totally obtuse. Let the user know what they can and can't expect with the various instrumentation options. Reviewed-by: Pierrick Bouvier Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-29-alex.bennee@linaro.org> diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 535a74684c5..9cc09d8c3da 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -112,6 +112,55 @@ details are opaque to plugins. The plugin is able to query select details of instructions and system configuration only through the exported *qemu_plugin* functions. +However the following assumptions can be made: + +Translation Blocks +++++++++++++++++++ + +All code will go through a translation phase although not all +translations will be necessarily be executed. You need to instrument +actual executions to track what is happening. + +It is quite normal to see the same address translated multiple times. +If you want to track the code in system emulation you should examine +the underlying physical address (``qemu_plugin_insn_haddr``) to take +into account the effects of virtual memory although if the system does +paging this will change too. + +Not all instructions in a block will always execute so if its +important to track individual instruction execution you need to +instrument them directly. However asynchronous interrupts will not +change control flow mid-block. + +Instructions +++++++++++++ + +Instruction instrumentation runs before the instruction executes. You +can be can be sure the instruction will be dispatched, but you can't +be sure it will complete. Generally this will be because of a +synchronous exception (e.g. SIGILL) triggered by the instruction +attempting to execute. If you want to be sure you will need to +instrument the next instruction as well. See the ``execlog.c`` plugin +for examples of how to track this and finalise details after execution. + +Memory Accesses ++++++++++++++++ + +Memory callbacks are called after a successful load or store. +Unsuccessful operations (i.e. faults) will not be visible to memory +instrumentation although the execution side effects can be observed +(e.g. entering a exception handler). + +System Idle and Resume States ++++++++++++++++++++++++++++++ + +The ``qemu_plugin_register_vcpu_idle_cb`` and +``qemu_plugin_register_vcpu_resume_cb`` functions can be used to track +when CPUs go into and return from sleep states when waiting for +external I/O. Be aware though that these may occur less frequently +than in real HW due to the inefficiencies of emulation giving less +chance for the CPU to idle. + Internals --------- From patchwork Wed Feb 28 11:57:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 776483 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp255583wrn; Wed, 28 Feb 2024 04:08:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVYHF3rhOOTFcsIR9pI4TynI5QJK9Ydx6zyBIt5Ik/wtJdVV9wQKRrjTgapsJfbLbWyf+qHOeTlGrCUESoaU3Dm X-Google-Smtp-Source: AGHT+IFhSPky6d7sdphb7jY/PGMjFxXSO6JphHBmmXDaCCy31/t+xKWTT1Nl4lzUv7oRLJAffAm6 X-Received: by 2002:ac8:5996:0:b0:42e:b3a8:f236 with SMTP id e22-20020ac85996000000b0042eb3a8f236mr380488qte.50.1709122096255; Wed, 28 Feb 2024 04:08:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709122096; cv=none; d=google.com; s=arc-20160816; b=LCQ1D6YbBrqHlRJmkNNJEmdCnc20UcpFeKzzO/vW7Snsy1vOqhrRojgUbvtcoZT0Yu nTtUM+41wDT+o5DJHnxS3riaWbu8T5oKZZ+3XJO6geB9jQjNqdDjbyup/jz5CfkahYR8 xJuU6mrH0qsZv+eowjjZIkBmy7pydnNi5ga2P3a0flg70TO8kVFrwuDZ2z2ku3kMU44J +ySF6oMMQfcfX4D8h3PLkcsVBvNG3lobWgWNQdbntYJQpqUUIjflm5FgKCSwVsRN2eMB xBeLcVwHQ62YgrmN6h2AwgCZLsr+/ax35QGqHsgH+sF3WwbNZd+j5LL7CSytBVCByzmU LaPQ== 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:dkim-signature; bh=MPogCxF/I1D7c/GvuPtEU4hQQ0c9+qX3NiL8uhsKxPs=; fh=Sqah+ZH1XDzGWNJD8nKcY4Qg7pDaURM/fxX7mtVNzyY=; b=UPxUkreu4UdDlHwDjG/05zfPy7UI7J+4ntgwH7JL0/YhPzocsjKoZD9Y+wtR3gErpT i4JLKW1H/fCSDkRFGgM+NJeAOMwb6wjeM1+Y1kLePuCuX4SmDQtUGr+/NNzVCmkgNM7q 77w68RMGrm3DubJouP/IXeeeWtFH4RQLJm6/D5HtvPBidVwpekZ3ySUlmayC/2tIk4bF 8gYeMT3Uv/Tm4QJ4wyOdTY4sF/qFqgnmGxw5rOESDAKBjj8prHlYPGDicz9AZbZ/Qqdt CzbP0K2uHe4KkAK2lCHQxrTtwpNsTt2pMkBQSbBjo4oX/7taQ5fbNYhsYIB892IofSod rMAA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dD0GeyNP; 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 k15-20020ac8604f000000b0042e50877c7bsi9171970qtm.266.2024.02.28.04.08.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 04:08:16 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dD0GeyNP; 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 1rfIeX-0004yB-L9; Wed, 28 Feb 2024 07:03:13 -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 1rfIeO-0004bg-1b for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:04 -0500 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeL-000350-6F for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:03 -0500 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2d094bc2244so65625811fa.1 for ; Wed, 28 Feb 2024 04:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121779; x=1709726579; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MPogCxF/I1D7c/GvuPtEU4hQQ0c9+qX3NiL8uhsKxPs=; b=dD0GeyNPC9o+TRq+VI11rSW+JokwT/ODdvtNK4UB5XCi+ODxGm4WOp+jHMMtcX7Qgx JjcY+H/1Jub6tmeeQdZrgvAXi6sxc80dwkTMfB/IbzBvukre2Mqvu1li5lELSVkqHbOD /qjtqQ0/BYGn+ljGXUUu5rO6oeVJ6sNSRGH1kQnKy05hoSNLFwUSSbSvpkTxY1xp0I1R n1rka+N4Vr9KJUfMWUwAWZFZ8wyRtiEpmbsB3sueesKD93IIQsjPzpbDqlJi3fx5T+oG LiGhwDNQveJHj4gsbn5G0BWPP5MejP5/X67XBK/t1tDW0j9oxIoVKN8NbmRedik4OVYJ Bw/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121779; x=1709726579; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MPogCxF/I1D7c/GvuPtEU4hQQ0c9+qX3NiL8uhsKxPs=; b=TksLgPFAvU+TWnD04PakgK2CUCGfDkOY1My4mug+jFYQldK9NhBbKz8IRsgL2e7ZS0 U98pM/qTQowEeHCD6ffN1kL9mclvVlASatFCJ1/gNM4aZfmLeGaJZMesg9XK3ouGPaCW ABUQ/EtMzKdz1GeQfnLTLgO9YFLQXMQDoXFutJZ2TNUvhBu/gKF3CXn5NFJqX1kb/8nW YBPBU6n42stTqYX4F+nwg594unJZJPttDF5dK+tNKh5092rHXzZCaRKOMI3oxtuf4BoQ 64Q7/nw5uODXQqXPlCTPHSzzc6i0MEgQ27oh9KKJEVxIP1ADTrBxVJuwL46gRAAYn3zJ wxbQ== X-Gm-Message-State: AOJu0YyboMdo4A1rYRzgz78yYt/5OY8mjbEGG1EkMBkmHBEbYUwwszOd /VqM+Av3VcbH6ZybOup9uW8vA0iecJhwo5geU/evyfzlTjjas0MqAarsxxhk0DM= X-Received: by 2002:a2e:834c:0:b0:2d2:463b:e991 with SMTP id l12-20020a2e834c000000b002d2463be991mr7666566ljh.29.1709121778934; Wed, 28 Feb 2024 04:02:58 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id s11-20020a05600c45cb00b0040fdf5e6d40sm1945992wmo.20.2024.02.28.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9FD875F930; Wed, 28 Feb 2024 11:57:04 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= Subject: [PULL 29/29] docs/devel: plugins can trigger a tb flush Date: Wed, 28 Feb 2024 11:57:01 +0000 Message-Id: <20240228115701.1416107-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x231.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: Pierrick Bouvier When scoreboards need to be reallocated. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-Id: <20240213094009.150349-8-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240227144335.1196131-30-alex.bennee@linaro.org> diff --git a/docs/devel/multi-thread-tcg.rst b/docs/devel/multi-thread-tcg.rst index 7302c3bf534..1420789fff3 100644 --- a/docs/devel/multi-thread-tcg.rst +++ b/docs/devel/multi-thread-tcg.rst @@ -109,6 +109,7 @@ including: - debugging operations (breakpoint insertion/removal) - some CPU helper functions - linux-user spawning its first thread + - operations related to TCG Plugins This is done with the async_safe_run_on_cpu() mechanism to ensure all vCPUs are quiescent when changes are being made to shared global