From nobody Tue Feb 10 06:07:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1560536615; cv=none; d=zoho.com; s=zohoarc; b=aw5SOWTFQeieESVqyCbd7z3vplwM5AinwzK9kJwWg6plhYQkj9LsUZaiaQ47wrb/8vK6izvtSBrwo8VlB5HGPy/cYkJMtB5A8k+wKXGwUSfcjcnbi/psOxjmXr/g8AnJpQVWna0toINfWIuCdXrm9UQpGg/IOBeJKLVjOcHmZ3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560536615; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Qg44j1/fmT2WZWQwTd6B39K1u36F6LVDpErcGgO7T1Y=; b=JtCEStywfZFHHeh4bhnast5VzhmjFHmfjAS3XwtXKa1T3vNT0iaLDjmIaQtMTq8dcvFy1DPSatC4cnSz4yinwQatji6HWPRKK/li6AIwltIUJ9JtgpfiQ7YXU6/pv6Xg01GasX+zNsvsTZa9OxndTtH0b5t4GLdhxqysQ6T1nws= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156053661585211.739115270594084; Fri, 14 Jun 2019 11:23:35 -0700 (PDT) Received: from localhost ([::1]:54076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbqrM-00048T-PV for importer@patchew.org; Fri, 14 Jun 2019 14:23:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34112) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbq0M-00076s-BD for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbq0J-00042r-Er for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:44 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:53325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbq0H-0003xQ-Q8 for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:42 -0400 Received: by mail-wm1-x342.google.com with SMTP id x15so3158427wmj.3 for ; Fri, 14 Jun 2019 10:28:39 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l8sm9147766wrg.40.2019.06.14.10.28.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 10:28:36 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E99341FFBE; Fri, 14 Jun 2019 18:12:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qg44j1/fmT2WZWQwTd6B39K1u36F6LVDpErcGgO7T1Y=; b=jPANe3ZRmE/XYvdJ91iBIjo0AzjtFtvfz2kqeTbd4VE8uTA9DM+g5Q5SdeOKOGMVyW Ral1s4CzaK4ijK90X/2ALR9rWxVxERMcgmy3iwB+J4PyFzeUpCpW93UC/6CUJjiy6z6T YLtI9wktTl8mXA781TPfMZAevztaFPnJq79Ni/2T57/mqslcKH8kPvp25B55C99VprZp fi5l0KqCoi8r0JcuuD2vJZnpeZCuRH/LWavGuyhwvsXILgdwnv2VKEfgRxEZma0MN8ML tEd1iIQOmghgpjFJVWuPTzgtBW0UOT4VE4PtcKtIl8H9PhowfARMBjCiU4DVcF/KZp2c LDbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qg44j1/fmT2WZWQwTd6B39K1u36F6LVDpErcGgO7T1Y=; b=N74qB3sBVQ1W+TSt/931fjHBhe/l+H5guGnjCK9vXCJHeY6CY1jT1KlIxhIGJzhBUD cdE5oU2Rd5y19mhupnmsMVoHbD/Pn9RN4NkPJeqEKJWwUk+MniMn5MMrvE4sfaFwUKHJ b5Gq0g321vgLlkbtRCAQJYy8Qq/jwTEcNBh3BXmCNBRFCn2RTZ/2xUuYtlbqraN93VNk EakA1T5LPmCxUbuH4E4zRof8N+1tssaxCSr/DlLYcloK3IwqAg8vwCacDFsqE47YyLbP ItCxHE61HuF0EZu/RSLKWPTgYWY9EN4SXajxo9B1NqnpbvQz/By3afwzV9wdMMDrKqO2 ivYg== X-Gm-Message-State: APjAAAXF8r/TXuIXpPoibZCRvpu9LAna/cHT1hoHhDqZz0mYSd9yO7J/ 6Hd+YTtyS6ROCS516mbqgJfaDQ== X-Google-Smtp-Source: APXvYqwwNF2M+YYJZsJMY/VEd12uNEYgIdt/dZg0hAEOwxtUSHVcWh9xXXMqaCtX65dWo1r7QZxz/A== X-Received: by 2002:a1c:730d:: with SMTP id d13mr8510608wmb.88.1560533318979; Fri, 14 Jun 2019 10:28:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 14 Jun 2019 18:11:49 +0100 Message-Id: <20190614171200.21078-40-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614171200.21078-1-alex.bennee@linaro.org> References: <20190614171200.21078-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v3 39/50] vl: support -plugin option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Emilio G . Cota" , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Llu=C3=ADs Vilanova Signed-off-by: Llu=C3=ADs Vilanova [ cota: s/instrument/plugin ] Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- qemu-options.hx | 17 +++++++++++++++++ vl.c | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 0d8beb4afd..47bbf358db 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4130,6 +4130,23 @@ HXCOMM HX does not support conditional compilation o= f text. @findex -trace @include qemu-option-trace.texi ETEXI +DEF("plugin", HAS_ARG, QEMU_OPTION_plugin, + "-plugin [file=3D][,arg=3D]\n" + " load a plugin\n", + QEMU_ARCH_ALL) +STEXI +@item -plugin file=3D@var{file}[,arg=3D@var{string}] +@findex -plugin + +Load a plugin. + +@table @option +@item file=3D@var{file} +Load the given plugin from a shared library file. +@item arg=3D@var{string} +Argument string passed to the plugin. (Can be given multiple times.) +@end table +ETEXI =20 HXCOMM Internal use DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL) diff --git a/vl.c b/vl.c index 005468cbfb..0be9667315 100644 --- a/vl.c +++ b/vl.c @@ -110,6 +110,7 @@ int main(int argc, char **argv) =20 #include "trace-root.h" #include "trace/control.h" +#include "qemu/plugin.h" #include "qemu/queue.h" #include "sysemu/arch_init.h" =20 @@ -2954,6 +2955,7 @@ int main(int argc, char **argv, char **envp) bool list_data_dirs =3D false; char *dir, **dirs; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); + QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); =20 error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); @@ -2982,6 +2984,7 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_global_opts); qemu_add_opts(&qemu_mon_opts); qemu_add_opts(&qemu_trace_opts); + qemu_plugin_add_opts(); qemu_add_opts(&qemu_option_rom_opts); qemu_add_opts(&qemu_machine_opts); qemu_add_opts(&qemu_accel_opts); @@ -3760,6 +3763,9 @@ int main(int argc, char **argv, char **envp) g_free(trace_file); trace_file =3D trace_opt_parse(optarg); break; + case QEMU_OPTION_plugin: + qemu_plugin_opt_parse(optarg, &plugin_list); + break; case QEMU_OPTION_readconfig: { int ret =3D qemu_read_config_file(optarg); @@ -4068,6 +4074,11 @@ int main(int argc, char **argv, char **envp) machine_class->default_machine_opts, 0); } =20 + /* process plugin before CPUs are created, but once -smp has been pars= ed */ + if (qemu_plugin_load_list(&plugin_list)) { + exit(1); + } + qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, NULL); qemu_opts_foreach(qemu_find_opts("global"), --=20 2.20.1