From patchwork Mon Oct 14 10:49:30 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: 176160 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4358155ill; Mon, 14 Oct 2019 04:08:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4znxgo9TO3s8JiCRfS5BRFz9bN54jCJsGYWJdykPJUIVEoATc8IUE8cY3kXQWEyNZFseG X-Received: by 2002:ae9:f30e:: with SMTP id p14mr28167817qkg.71.1571051303482; Mon, 14 Oct 2019 04:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571051303; cv=none; d=google.com; s=arc-20160816; b=gX++9qaZ0jjGulNQiu1xdSQHEFoEqGJS8vMnEuW/qAHrXukVi2TOAN97C+JMg6vd/B UGed9G52O68htZHO/88ojzQv3VDrcatvDmwseut7fRWtB48wVVez3dAoxTPQgZ8VaEsg NaISvjo8Dr6XquxYoAJT7fQiRQ8gSl5dijhVrPufnF/QUvhsMOX++bGR8hQemmivLqtU eb5fTv0o/VjoPchq0fjojbI+lv9nJKprxtmUcThfWNhYkAfkI1JDqBfQPSY1TPCTjL8U uq2DA8NN53Zu40AQa2BjaMLKj4Hft0QCEEPrEWbuYMSkbMWgOZhQzCiknL9NpILoFJ6B EOuQ== 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=Tals8a9mIFmx+icrckx2DF+DPIwwPX+blavRmLxcPdQ=; b=OG51gaoatY2ApaX7Ldw2I5uZz+KQ+N4oaS0J4CbGa3/XwjleqROM3ek5YEQXnyGj0v 1mxPbrK5f2ElmBCkkvCwJjJqk5X0zwQfgDR2j8wxlYBEWVLTxnkLVYNV2kWZk5GMLmaw umsrsZ/fsfT8Zzni5ih9p3n88+oDUFsJtdcpgE7RR4ESC8a0JlR8ueZ1fqq7uaD3vjnz U/n5RHl6oqPF3dhmQCiMBiYMeI7ROhRxYh+MBnOtQdFB0eNPhcklyOU5f+fYFgRfhQ68 80jSgM/lQO9HbOjnS1sUFj0WMQ7dc/dXCYCl7J/Be+bS7VE2h6gLRlMME3RsF9X1R7dX azmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AVQ93vwk; 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 u16si17086519qka.86.2019.10.14.04.08.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 04:08:23 -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=AVQ93vwk; 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]:47422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJyD8-0000gi-JZ for patch@linaro.org; Mon, 14 Oct 2019 07:08:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44685) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJxvU-0007Wc-0w for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:50:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJxvS-0006GR-NK for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:50:07 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:38547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJxvS-0006FE-Go for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:50:06 -0400 Received: by mail-wr1-x444.google.com with SMTP id y18so9677482wrn.5 for ; Mon, 14 Oct 2019 03:50:06 -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=Tals8a9mIFmx+icrckx2DF+DPIwwPX+blavRmLxcPdQ=; b=AVQ93vwkw9sJQ6r6kitpmB3sS7F0wtz+A2OzrXXZDBthuEqWmBgg4hfc1jIhlq9DWw eMAUjmsacGZpsNyV9ZII5wI6I5+eis2WC39Qml6Pfsi/QOpHDWsOKg/fcH9xWjHMfetA 2ivuU7QsQmOH1FDcguRUJ3l3HX1P696BvFoaCm8jxtyB7JO1wGshkY56BrTg41juVuhE FhCV2xs3OYQUA8Z4glxWq+MpKCDBKZ1bOmJKmYrHZFBaJ4BNJPBflyPTKr5ocs225kz9 3LIVILg4Vpj6sp912epegj9CSxEzy67diUHwfNoGQX6ij1nl5KjJAN86znNGJc6bYYxd lLwg== 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=Tals8a9mIFmx+icrckx2DF+DPIwwPX+blavRmLxcPdQ=; b=TMWSBNa00vIoSca9hUNeMW1ze0EaQifilXDhsLodJho51zUEdmxLCnELg1X3HBdKDt BTE1Lp8uBIoNPqHw6g2OJ1ZgkGZFzC3L2nAiyckWFafs5/SA9c92+/JkgT45hZfYSI5P gtMaq0xFm+4AQjCgtelv2zLN1Gdf36zfbk5ojVNYEV3jiZnZd9oioHcxj9mLrQGP1VB6 zqCT9U8YGLXPSlaDTD8StIYKAikqdsDr7Q+qVYNtbGfxPzGivu3MW7iBak9ecGPA/+az gTy9B7bnGRCj7UGBK3oi7h8AYdIKmbvSSOvK9IigfET7B7+7Z60GMmFfOJW84Exg2Q54 WJYw== X-Gm-Message-State: APjAAAVyB+ZdNM0eSe8oRTBb/NewXuLB2RYZQ72lN+dFJQk+fTh/9Jf4 C5ViOXZDLap/wWU8uE+uKD1aIOzSWb8= X-Received: by 2002:adf:ed52:: with SMTP id u18mr26668454wro.16.1571050205477; Mon, 14 Oct 2019 03:50:05 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n7sm19335803wrt.59.2019.10.14.03.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 03:50:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5CA631FFC6; Mon, 14 Oct 2019 11:49:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v5 37/55] vl: support -plugin option Date: Mon, 14 Oct 2019 11:49:30 +0100 Message-Id: <20191014104948.4291-38-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014104948.4291-1-alex.bennee@linaro.org> References: <20191014104948.4291-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::444 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 2a04ca6ac5..8dcc88e5ae 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4144,6 +4144,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 002bf4919e..4bdd526029 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" @@ -2904,6 +2905,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(); @@ -2934,6 +2936,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); @@ -3717,6 +3720,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); @@ -4030,6 +4036,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"),