From patchwork Mon Feb 26 16:56:32 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: 775884 Delivered-To: patch@linaro.org Received: by 2002:ab3:621a:0:b0:258:3251:9e33 with SMTP id w26csp1475555lte; Mon, 26 Feb 2024 09:01:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV/tPojwhGLJZIyCkh8TkvEvI9vGRsoJZ3Zgf4hgwnRhglfNk4CYicqFudB0q5Rw1hIY6XhbpBVgVzi2aT4mr50 X-Google-Smtp-Source: AGHT+IG1TlwR2xh/no+2ZUZs5OXAsUqDnik3OlMPZtjcBkT5iblYXJua9K8TD9/nHh/Wli13Zn3u X-Received: by 2002:ac8:5a04:0:b0:42e:58e0:e082 with SMTP id n4-20020ac85a04000000b0042e58e0e082mr10253614qta.33.1708966896453; Mon, 26 Feb 2024 09:01:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708966896; cv=none; d=google.com; s=arc-20160816; b=nCs8bksWSgMUKkXrqphR2+RYr5v6Vm/+nXeWSTlbMJsJ8g1IbX7x3BQw10lmuAuirN GZsUGVQWPxPwzhnTGNdJyTfm851tKc3rWq93ousy4tDZRFjlemHj7Whyw2s8Mb635dRG 346mRuZmo3vfbSuDOvjUAu8VGi2k5ivCLKyYEVLOHqNRdUDYqBvXAm7STCIGztEfw8Vr eSEeY+GzB9HTxc8dqua8BUx2RA7SnyCflaAkbXOYRL2u7O9uT6mmBVgHTlTi1k/424+c ku/Bk8mXe3FIAGQZfJT3RY43txTTOgkz3KSNz6a96Cw2NXGZlxat3QXxFFbpo2zD3CnJ 84iA== 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=8VoWfZh+ZjeHnIZS/0T0SSPiqruErjk06xElhK1rNbU=; fh=FlRWjczXzB3kjfNm0MZCBQ0e7zrqTwZz0mkKu1n+VQY=; b=h4zheIaVeVFWF9F4Ll/Yy6i8H6ZkXtESGF5L47xPZvbSrITDpxnd/akdwzHrnIv8NT p4empghwmsbFSVanShuY1G3sOCgozSmLLEbSkYtWuWDWZ/fMUBCVD+E/vcyr6mAC7DEd Q6YZuLF7x8CMWbDc541tk/qGzaFEEa+FPHVTvw7TL4aB8iolYeNffyOp13X3154p+qeY n5OfX4EUSkGF2xMBsOjbpMiyrqt0esAumEzydEqMpeYZ/kEWwfw7tSp4NZujLcpsIU7x kZQ8MTUP/GtcP6AODvBHI3aHg+ow8pa5Z73bddIc59qhq7BJz3Ne6SZok39Mznpt7M5H MmSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AzX6eXcL; 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 u2-20020a05622a010200b0042e808c4b11si3370377qtw.784.2024.02.26.09.01.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Feb 2024 09:01:36 -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=AzX6eXcL; 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 1reeIb-0006Pl-Ch; Mon, 26 Feb 2024 11:57:53 -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 1reeIZ-0006Ov-W1 for qemu-devel@nongnu.org; Mon, 26 Feb 2024 11:57:52 -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 1reeHm-0007h1-Jj for qemu-devel@nongnu.org; Mon, 26 Feb 2024 11:57:51 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41298159608so15572225e9.0 for ; Mon, 26 Feb 2024 08:57:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708966620; x=1709571420; 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=AzX6eXcLUDk2UiThbXqWKQib0NExtyIpM9fesqdu3IkDxQA91oFPM3OFlddXlY0trg iXka/UG0XXYVWJaj870q+/6UhD+rrCHZt1mhKHRpsnqi7y5w50kwSXOSKZdufy3KfXQV 9v/LZvxOgnCSIxN4uL+a/yejHFXQGgLNHUxRyQLzuIYCDXbKXGrQHWRXpjoD0sh+VOn0 QeHJYtQp5zwfhi1WRLWocmG+V+mVC3fqm83MVCSqQzu5mIvr8JUVjxhyGzSFoei1NdoV chPb9AZLQ53Tz91h1CkrAbecRkle3Snbr03CiDBye41lYPhrVKptI2mECsW1v2OdSnHH hi3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708966620; x=1709571420; 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=aLYCXelPApJolGuHlRWGW+NfxpMZ72Og3GsDsXknl2Tk2E1A5175LRVHA3OXQz4Z2v Hq16npTSsRiWJLwB/6msUG54V8F9xHhrk8vBbr/YBUM4hikrL/jOzczEH8jztGJfa93i D3sii0QMNlMod4ojrMNN6QEyIiuOpIEzoBI1GBmohy1yrCv5YQUoO0Vu6P+nNyQCiPGi tmsrYYMMQ+tB+oDkFiy2DvGDLGRfqof3qB/9LL4U8+tPWMGEeEELMZBMVSSGvhuSGCvD +Fog3aOfPthvZ9cd0cp0V+LEvg+MEqpV7mMiSt5/gw9anhI+M8ybtMm70HomSk2rGIkS cIwQ== X-Gm-Message-State: AOJu0YyxthhgRbZfE45147k+mn+ZwgdFQMWjUpmHr6c8+8Iesjlkf/3c Qus1jAvgQLHd22O1rqzhemvEdI3Peo4aasQzxdBqBu25jB36tOxBThvYhhahEME= X-Received: by 2002:a05:600c:4ecd:b0:412:a109:502d with SMTP id g13-20020a05600c4ecd00b00412a109502dmr3866968wmq.0.1708966620613; Mon, 26 Feb 2024 08:57:00 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 7-20020a05600c230700b00412886cbc44sm12471866wmo.24.2024.02.26.08.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 08:56:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 1AE3A5F923; 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 13/27] plugins: remove previous n_vcpus functions from API Date: Mon, 26 Feb 2024 16:56:32 +0000 Message-Id: <20240226165646.425600-14-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::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, 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: 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 --- 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 */ 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;