From patchwork Mon Feb 26 16: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: 1904602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=P9aEdzqt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tk6Tl291kz23cb for ; Tue, 27 Feb 2024 04:06:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reeOU-0005zf-S1; Mon, 26 Feb 2024 12:04:00 -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 1reeNe-0004PU-BL for qemu-ppc@nongnu.org; Mon, 26 Feb 2024 12:03:11 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reeNO-0000pP-0f for qemu-ppc@nongnu.org; Mon, 26 Feb 2024 12:03:06 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d27184197cso39579561fa.1 for ; Mon, 26 Feb 2024 09:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708966968; x=1709571768; 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=v93sjlrKGHF/8PcF+jkx1JshiyYwDWnn08uJwR8C/sE=; b=P9aEdzqtR5Hy+CkVZofR9lKcj/UbNq1xJzNu+J9orYvOg6HSjeigOdbuX94S8wJnrS +proRR1Gu3FhGjD9vTL8B7UB/U2Q86EWIXlZjqun37Soe2NNrNbpAdemMe75bI0N5kNa vdrEQJrbRTZltynp+H1C1C+l2+GSzmMeG5+XJAubm4KPfFz1hHZ49xP6z+zPY8pdEe+F McbUrAtnAYcemkpTVSY1wrqCAgk82nHruiq9/10n8gZoI1zwv3emaCIn64ELRMAc4Gfk rtcEMeoW0ZzHq8kq7FgO/yHqOWLN7UoML679IjdlxIGtEDsRdr9DbY+2pVQu0pPO5jSq cFTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708966968; x=1709571768; 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=v93sjlrKGHF/8PcF+jkx1JshiyYwDWnn08uJwR8C/sE=; b=cYO9SsRwDmZ+kXctn1gUiLd/9az+o7wdelsoSvs5lv+mQlIQOXL5o0i5Afs5ps3hFd 2RZwSB7+1AzjqAhr7W4+y6vf2CIdY/S3Fw7kXvvKs94byHyIGC7wu6GTzAtKCoBzx6SI bLoJvWS9oZ3gCowvMHchL7jLgzBFIFdGmIK/JG623FgL68w5sT++mDZDh1tqWaXb8x3O uTbWeqEiHgzVv+3t/AnkjqFZPSN/a1MbQ+SjC9MvnB+GaVD5qYJbrDQ/pYORLYvsV+Ux SCodRNzzePf0tanebfN34hRjk4/FHi0Yrf83nbR6/LAOPJL4maC0mt5lasw7OIB9KXZn uDWQ== X-Forwarded-Encrypted: i=1; AJvYcCVEf7+4gHetg4GaLRENzFKit/jp9qrI1IfwZKtYo+ZXjU+QYsoVsS2qY6pVZtuPVzM2UgDSn0uzPpTZv0Z8fIn8Qnhy X-Gm-Message-State: AOJu0YyHL5bProoHPNxSY8vUBp8V4xUFhnRvNW1RhEdGCPxoqBLymYje Ph1RhX8AKlCGJzE20YsqyQU+NDlU0g708zsGHAd52h0aYQvWKtPcb1DR6uDqjCs= X-Google-Smtp-Source: AGHT+IGbDugMR0kDdCrbQaJkrbtleHSHhjIH2zSNNRFtFTPf/4DMzgoMm5ynIOMjVnPd+x1jOaDl1A== X-Received: by 2002:a2e:bc19:0:b0:2d2:6ed5:e45a with SMTP id b25-20020a2ebc19000000b002d26ed5e45amr5648419ljf.12.1708966968037; Mon, 26 Feb 2024 09:02:48 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 20-20020a05600c22d400b0041069adbd87sm12429148wmg.21.2024.02.26.09.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:02:45 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id DDFA65F92F; Mon, 26 Feb 2024 16:56:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Liu Zhiwei , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-riscv@nongnu.org, Michael Rolnik , Song Gao , Alexandre Iooss , Marcel Apfelbaum , David Hildenbrand , Pierrick Bouvier , John Snow , Eduardo Habkost , Mahmoud Mandour , qemu-arm@nongnu.org, =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Cleber Rosa , qemu-ppc@nongnu.org, Richard Henderson , qemu-s390x@nongnu.org, Daniel Henrique Barboza , Thomas Huth , Yoshinori Sato , Yanan Wang , Brian Cain , Ilya Leoshkevich , Weiwei Li , "Edgar E. Iglesias" , Bin Meng , Laurent Vivier , Palmer Dabbelt , Daniel Henrique Barboza , Alistair Francis Subject: [PATCH v3 22/27] tests/tcg: expand insn test case to exercise register API Date: Mon, 26 Feb 2024 16:56:41 +0000 Message-Id: <20240226165646.425600-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240226165646.425600-1-alex.bennee@linaro.org> References: <20240226165646.425600-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x233.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.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 --- tests/plugin/insn.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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;