From patchwork Wed Jul 31 16:07:09 2019 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: 170196 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4252342ile; Wed, 31 Jul 2019 09:45:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFiC/NU5Tk3Cssrj8dtyCROaLfoM9AR9Y53ATYBpBS4z0GJFPgE7OdCCmqWcXO5EPtTwSs X-Received: by 2002:a05:6402:6d0:: with SMTP id n16mr26060404edy.168.1564591528566; Wed, 31 Jul 2019 09:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564591528; cv=none; d=google.com; s=arc-20160816; b=i5dAkDpZc9xITwqmaxoeGjLtFnWWlqimoJJcHWpn7g7ewx3+gAKKFuAtfTNazYf0Ge 0BlJFxkxNZcSVb+NQygtsPe9P6Yr2dP4d6Ktqt8UVgUlS5MSm9MnGBhDhIpbYquI0l1m rBK8pqCO29PvHu9MbY88iS13q8RVSGmDJCC1ApicZH0ImOFQ9pw6kz3DzreXWfM5wxXh 0gW2bhtfSe9cpTKzwxyiCPznCh5QH95PcU5+QY21aouBEvZ0Oa0AhqWJLo3XKoOnRWq5 jimgODtRjI9IbhUg/j89qLE0w8wsP1vz4aEhxa/wluFhm0lIMGwi7rIXqlyS7zPrdkHN XXUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=mjk2DnvfJD1k/p+MqNImwcO38VXfRv1NAD/8zcwI2MQ=; b=j9Z9Y+7QfYOO7btfPxCGBmSGVfMOuLPVdyBQ88kF5BLjpWcU21FbX7s96yEwaG1W2i botlfvSQseHqWBdiDr2dw3VYFjTGT+0f8A/IM2G+ckKpcjIPEbmCc3sb1gGv7L7NjRVx Yqwc5y/DeJe47hsQMu6MbSDKJ1o3g2c9h3pvKebO+qUr5hV6YCoDPKlxTLymFrb8pRx+ OEj3vuuLnMm31PUtrgo4knqvvZoXw4sjuqaWj6mXfjbkD+Opt0iCPLYhVaPS0uqaQh03 BYjOYu/TsvhEIcMBPB/6si2zLCpybfYp5NWlE9Ibojhwi4XqapCxY5njaXUPM98UjcS5 IRtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vf3Qhf4q; 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=fail (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 k42si20484681eda.162.2019.07.31.09.45.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 09:45:28 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=vf3Qhf4q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrjD-0001hO-IQ for patch@linaro.org; Wed, 31 Jul 2019 12:45:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51208) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrj3-0001h3-5T for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:45:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsrj2-0000qo-28 for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:45:17 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:43165) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsrj1-0000oz-QS for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:45:15 -0400 Received: by mail-wr1-x42f.google.com with SMTP id p13so70408859wru.10 for ; Wed, 31 Jul 2019 09:45:15 -0700 (PDT) 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=mjk2DnvfJD1k/p+MqNImwcO38VXfRv1NAD/8zcwI2MQ=; b=vf3Qhf4qL45sidOgROi8Ul9+tgpNUnxyKODPFMrd5NpW+c3Yya3bnu3xPP6Qm2Xo2z jYsDmCrBSX8Ehlqx3GK3X9DbewB+nZFp5Jh5xy4GbT8Ff0idt1VXCeIKp926jAohQhVB IBSEZXUb3E+e0Ef7KIoXlHP/3Uh6kexxfeObgcycullKID62vZGMlFq6leHxaZoIwZbN itHyHHnPA3kk2/yNEQcbRARG3OYAwG69XnldtFXfqmrbIBc+iljlJV8wmJwJg0ys1wV5 UFxyxs2/C2785hrgov1RaNoXr+5gOOdzaQkOywuR994lE+aAmT6jR4GqgmXFWfQD3hSe vo1g== 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=mjk2DnvfJD1k/p+MqNImwcO38VXfRv1NAD/8zcwI2MQ=; b=jIEWQuy2n3yL1jhNaLJ4G9AbzsyYspRrCa59rZTXFkwGFHGGv+QxXppWyq585Ft+ZG V1gImozwWnc0sKlOrCfsOLX/PEmQqmTejsSZnceFmK4yGz6/Ynz9QJ8of3OiNoPB+5fT KGXx02oy94TgZoEL5+ueOeTBmdHnOmRdMyI+FmXWv8G1WJWvRKkkvDff5041bDDUXo3l zTNrK+bzhrwgxrXXTsVHv4Z2Yksy56tBx9wXV4AHeub3wgyHXorJSeyaM/Drjminn5CW KfLMlzanceXSYZxWF19fNlkDiQ+za6LVWZZbHHiShIlIOmPdhbWdT/A5tQ+aNgNag09o bElA== X-Gm-Message-State: APjAAAUWsTkWPUk1VnSKziXOWfXQEIkxng66IhZLc98vuALeJNajAf+/ C1PqNN48guUYHVPv90yyBKi4940HjUE= X-Received: by 2002:adf:ed41:: with SMTP id u1mr129156373wro.162.1564591514200; Wed, 31 Jul 2019 09:45:14 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z5sm49307630wmf.48.2019.07.31.09.45.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:45:13 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8C49B1FFC2; Wed, 31 Jul 2019 17:07:23 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:07:09 +0100 Message-Id: <20190731160719.11396-45-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f Subject: [Qemu-devel] [PATCH v4 44/54] 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: Richard Henderson , aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , bobby.prani@gmail.com, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , =?utf-8?q?Llu=C3=ADs_Vilanova?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Lluís Vilanova Signed-off-by: Lluís Vilanova [ cota: s/instrument/plugin ] Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- qemu-options.hx | 17 +++++++++++++++++ vl.c | 11 +++++++++++ 2 files changed, 28 insertions(+) -- 2.20.1 diff --git a/qemu-options.hx b/qemu-options.hx index 9621e934c0b..7b438f61734 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4131,6 +4131,23 @@ HXCOMM HX does not support conditional compilation of text. @findex -trace @include qemu-option-trace.texi ETEXI +DEF("plugin", HAS_ARG, QEMU_OPTION_plugin, + "-plugin [file=][,arg=]\n" + " load a plugin\n", + QEMU_ARCH_ALL) +STEXI +@item -plugin file=@var{file}[,arg=@var{string}] +@findex -plugin + +Load a plugin. + +@table @option +@item file=@var{file} +Load the given plugin from a shared library file. +@item arg=@var{string} +Argument string passed to the plugin. (Can be given multiple times.) +@end table +ETEXI HXCOMM Internal use DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL) diff --git a/vl.c b/vl.c index b426b321346..bb62989f776 100644 --- a/vl.c +++ b/vl.c @@ -109,6 +109,7 @@ int main(int argc, char **argv) #include "trace-root.h" #include "trace/control.h" +#include "qemu/plugin.h" #include "qemu/queue.h" #include "sysemu/arch_init.h" @@ -2889,6 +2890,7 @@ int main(int argc, char **argv, char **envp) bool list_data_dirs = false; char *dir, **dirs; BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue); + QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list); os_set_line_buffering(); @@ -2919,6 +2921,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); @@ -3697,6 +3700,9 @@ int main(int argc, char **argv, char **envp) g_free(trace_file); trace_file = trace_opt_parse(optarg); break; + case QEMU_OPTION_plugin: + qemu_plugin_opt_parse(optarg, &plugin_list); + break; case QEMU_OPTION_readconfig: { int ret = qemu_read_config_file(optarg); @@ -4010,6 +4016,11 @@ int main(int argc, char **argv, char **envp) machine_class->default_machine_opts, 0); } + /* process plugin before CPUs are created, but once -smp has been parsed */ + 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"),