From patchwork Thu Oct 17 13:16:01 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: 176668 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1028017ill; Thu, 17 Oct 2019 07:42:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqymFiqgh7ff/0qNohbjBgAK1fR5mmOYs4HqPu7VtJXFa9CZ8XbzOk3UbHfwmA4xI2D0DGfe X-Received: by 2002:aed:2ce7:: with SMTP id g94mr4255778qtd.133.1571323359564; Thu, 17 Oct 2019 07:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571323359; cv=none; d=google.com; s=arc-20160816; b=NT0VV/zjDPLh+6rFXuOtnmE/yJqoNs9Br7bNnICLFEaVWB5e4HbluUdE3n2IOBydPW +/gh52JdOxlMRzs2JiEAvMuPiBMNv9q0C8XA6ERnSdw+uJFe5frEZCiCYQypEtk0P88K /LKCtPu+YsRX1eA4CCWrbXTC1DZZ+wg3CIlqADhXSQkztdABy49Grmi7VSzvAZ5422Xw 52Q58aPBSv26Ee4vxNSsgRBC1LqPox2l2YYjYO0fS7KcvN0Mw+iTvHtCmkb7AHdwz3xK uQM7Z3LjQOPZcbjxy4+/HNP1ueZsW8RT0vzdLSag3qF1nMjy6l35Q54nvuLeMwUIXhiQ A8ow== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wXzF3UTyYexiGoLPILzFIA+g87jBMrJCBXwgiVbZAdU=; b=GH/4D6f2UWOye/nB72yzK/c71KuLo+IjUifNDaeW4G8g9igP4D53VLwUxTNaCfoYN1 Pk2fl/q7UH03mkcDmf4394r65+kyuB/MQiWbAZWKfX+YyD9AJso0H9ICgqJeK+j6634W vOIjSporJrnIqsmkMBQGAgycBkPXDC22rt6mDErllUlouJbr9aCYTvfpB3wwo7C0q7h7 E2PuLAhUBHg7wbJqmm3uMckvZxvxAXqmOkmGvh+7MbIjVYvL8wOXSTiZ7tI5P7ksVjhh /SRZPeVorxcW9ls+Q5pJFZY61bMkMcOjgFd1P80HYcJEsqHR/DOEW2l+0Z3uMcOmeDs0 hMUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xx9cw4yu; 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 x1si2066248qtq.290.2019.10.17.07.42.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2019 07:42:39 -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=Xx9cw4yu; 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]:49551 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL6z8-0003ER-J5 for patch@linaro.org; Thu, 17 Oct 2019 10:42:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37547) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5wB-0005zP-4N for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:35:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5w9-0004SH-2V for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:35:30 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:45501) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5w7-0004Qy-2Q for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:35:28 -0400 Received: by mail-wr1-x441.google.com with SMTP id r5so2365609wrm.12 for ; Thu, 17 Oct 2019 06:35:26 -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=wXzF3UTyYexiGoLPILzFIA+g87jBMrJCBXwgiVbZAdU=; b=Xx9cw4yu1TSSeSMg8VZlvM353VSsXYztlUJMW5eYaIusRFClRVHACQt23jC7UjXfQF OgIVA37dqY8NFY7FcQRUtdRHsil4FZFgOHXrTrM0Fhvfb5CqyYmI86TcWP9PNSDhn+Xv EVZwNxPJQUuo9bSy68nPXw3sr2v0ZuUyYx8hxIjndHXXnmgiO7Vm5d91jEEf26Nvoyov GnhHbGI9K3turwctXPPfmUWvfwAWA0VVuyIwQYF4G12iy4CwMTlHAyazjvoXTt/WjtbN TwqdHTa7ax9ZEtiTL2GI6Vas+nIC3DwjLEWUYrpyCe4Hdyi77JwBe02ota69OGmn03lN mW2w== 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=wXzF3UTyYexiGoLPILzFIA+g87jBMrJCBXwgiVbZAdU=; b=LeaYGGZp4/AHWW2x2q4UsqoN1D0+LCYTbJZuz6Azf3c5suYZozDeq1RNFS5bGT8lgc 5YgftKZcd74yqZKTMbKokB8mJpKeNlU1yQRCPgcIDyR+FXMNX5ndVf7whmWLesg/B7UT NSpf9NhrqqjmwF0HDR+l0v50Zox5dUBFyb3pw93vDtIiOhnY20vXOdqrU4UeB6Hkvwey 3s7r/Pp8/pGlZoxtBQpe2kRWIyTlRCePrihX5XHA6Iz1p6eXoCWyt3dZM071V8USVTaj SYQYcbSwFaH+9rkesuDbH/g2nYbgfJvSlCQv2PV8isw8FpSJ+Cs6Fuh9TBaw7XeO7NpG 5DAA== X-Gm-Message-State: APjAAAXfBYl9/DJmT3Hlso5zON3QjPtt/FHd5mlotLNEGP/DzisveM7S UE4P0435D4x91e5ek0de/vICkw== X-Received: by 2002:a5d:68c7:: with SMTP id p7mr3056653wrw.156.1571319324766; Thu, 17 Oct 2019 06:35:24 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d11sm2248332wrf.80.2019.10.17.06.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:35:21 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A87761FFBF; Thu, 17 Oct 2019 14:16:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v6 40/54] vl: support -plugin option Date: Thu, 17 Oct 2019 14:16:01 +0100 Message-Id: <20191017131615.19660-41-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017131615.19660-1-alex.bennee@linaro.org> References: <20191017131615.19660-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::441 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: robert.foley@futurewei.com, Richard Henderson , peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , =?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 793d70ff93..37f13689e7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4166,6 +4166,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 4489cfb2bb..8b1b4133e4 100644 --- a/vl.c +++ b/vl.c @@ -110,6 +110,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" @@ -2854,6 +2855,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(); @@ -2884,6 +2886,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); @@ -3678,6 +3681,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); @@ -3991,6 +3997,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"),