From nobody Fri Nov 1 07:35:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708101342; cv=none; d=zohomail.com; s=zohoarc; b=Gq98TR4Aw9e92/NTyVYwAaCbmLx788Ase7zcYcyGEMyX1nNrRMnFzlR7tEGGHE7GdK5vb1Per9mvl89t5PDWY10Q7O755dLF0Ul4Bv0t7HHlYu2nxTtxMzeZEk76TIzdhecy/7kzkJFu3HurUW48wD5gVzwvfnAkf/QZTfhzkH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708101342; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8VoWfZh+ZjeHnIZS/0T0SSPiqruErjk06xElhK1rNbU=; b=PBznX5fXGEhdRgUObr8br5vPV7d57islmfX76AdbQ9AQ4X7UcPuQRGo74aiQR8+pVqJq8Hj4hE+cSH8e0bY3SpDud2cj23IdFEhCSZDYiXoUuZjFwp8FxHCX9iFgPXcRARK8yGmaDFmjePZ3tkIdQ9PW1Y/iyVKBMgY+viAdjHQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708101342582416.24130732641424; Fri, 16 Feb 2024 08:35:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb17H-00050Y-A7; Fri, 16 Feb 2024 11:31: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 1rb173-0004mL-Dw for qemu-devel@nongnu.org; Fri, 16 Feb 2024 11:30:58 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb16k-0002Ek-Ik for qemu-devel@nongnu.org; Fri, 16 Feb 2024 11:30:57 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33d146737e6so1011496f8f.0 for ; Fri, 16 Feb 2024 08:30:37 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n15-20020a5d660f000000b0033b1b1da2adsm2586478wru.99.2024.02.16.08.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 08:30:32 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7E2845F9DE; Fri, 16 Feb 2024 16:30:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708101037; x=1708705837; 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=8VoWfZh+ZjeHnIZS/0T0SSPiqruErjk06xElhK1rNbU=; b=T+x9amNKbnj/T9EiFvykb6xbm7/0Dy+bexMQASLrbxYfOEAN7KspTRK5XgnZFye95C CJn7f6q642r8Xvi7ABiJrv0m0fUtm+i0391IoQSAbMvzs/52P/809+SDwdslUhcTKRg2 wG0Mr9PGR8PbImUC48irY57nuzfX1zzhtNdICpzAAfuh+UnRlfAOUDql3Ilu3OzdkbQT C+iDSsaGYX5spVF6wg2CN6dc47tzykcb/s67e6F23NLbcKvPUfPjWaNkzSrGyPKM2cH3 vrEJjWhnGiCsAecjY4Sut4YoquzGJHCwoZyc/yBWJ6nTfCffQi5P2Hzw2xUFg6vPhJmh gNUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708101037; x=1708705837; 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=8VoWfZh+ZjeHnIZS/0T0SSPiqruErjk06xElhK1rNbU=; b=FfRQVutdyU2q8sjOG0nG/mBfIRwFMLRpCzNwfYX+bnlu6BmuarHiHYse499MJbW9gK dOJUHdMekngsQxieZeqD8E+QWA9Xzlw5BwC355npSWWepnMpFI7g2y9N1n4lnEGA4hxG Hb5nBY25LcCCUIHsTErQ2OqZyLqZZaSz9EEF5SdJ3b4fyBOUDHaD/zN5A6DxnjKJ/0Sy yJ+0DX96Im0vU7IRM8poGODy6TUWGNdNPzSHLa6j+DHHdMvEoJNB73P0ibF4QdmpgxbG Qmdw5PHSLPrzeMTS+C5wMtORq16LRoRoeOPe4FIoN7NtILJooRmOYdN+nIquCjIrp9EM wMgg== X-Gm-Message-State: AOJu0Yw10WXLaHDh3ImlcAv9f9I1EDafw5WeqNGAhFoNKSKJz1GcmjiU DnTDkKDF7pEvS9GxNhjuwS8mumjFzTEwj9SZm8oEEsMPpnSZBDNZf0qVPNvhrrs= X-Google-Smtp-Source: AGHT+IGmn5JWcOL+/P9/Hqn1h0jylEiBMGvGzf8oTZDihPM4Xo1gGti2gBrmKlG5uN2CJrTCucpPeA== X-Received: by 2002:a5d:54c9:0:b0:33b:4e6d:1020 with SMTP id x9-20020a5d54c9000000b0033b4e6d1020mr4050050wrv.34.1708101036858; Fri, 16 Feb 2024 08:30:36 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Yoshinori Sato , David Hildenbrand , Weiwei Li , Richard Henderson , Michael Rolnik , Ilya Leoshkevich , Peter Maydell , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-riscv@nongnu.org, Cleber Rosa , Thomas Huth , Song Gao , qemu-arm@nongnu.org, Pierrick Bouvier , John Snow , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Nicholas Piggin , qemu-s390x@nongnu.org, Laurent Vivier , "Edgar E. Iglesias" , Daniel Henrique Barboza , Yanan Wang , Palmer Dabbelt , Marcel Apfelbaum , Brian Cain , Mahmoud Mandour , Alexandre Iooss , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza , Eduardo Habkost , Alistair Francis , Liu Zhiwei Subject: [PATCH 12/23] plugins: remove previous n_vcpus functions from API Date: Fri, 16 Feb 2024 16:30:14 +0000 Message-Id: <20240216163025.424857-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240216163025.424857-1-alex.bennee@linaro.org> References: <20240216163025.424857-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708101343213100001 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=C3=A9e --- include/qemu/qemu-plugin.h | 10 +++------- plugins/plugin.h | 2 +- contrib/plugins/cache.c | 2 +- plugins/api.c | 30 ------------------------------ plugins/qemu-plugins.symbols | 2 -- 5 files changed, 5 insertions(+), 41 deletions(-) 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 */ =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 1 +#define QEMU_PLUGIN_VERSION 2 =20 /** * 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 *userd= ata); =20 -/* 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" =20 -#define QEMU_PLUGIN_MIN_VERSION 0 +#define QEMU_PLUGIN_MIN_VERSION 2 =20 /* 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, =20 policy =3D LRU; =20 - cores =3D sys ? qemu_plugin_n_vcpus() : 1; + cores =3D sys ? info->system.smp_vcpus : 1; =20 for (i =3D 0; i < argc; i++) { char *opt =3D 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 struc= t qemu_plugin_hwaddr *h) #endif } =20 -/* - * 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; --=20 2.39.2