From patchwork Fri Oct 25 06:36:57 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: 177660 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3277242ill; Fri, 25 Oct 2019 00:24:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/jZbL5sG4iyAvatJGqoGTfMlTWsm9mv99PSoTv5aMlqKnXTcuq7WNKEqakkDZD1W5rKmr X-Received: by 2002:ac8:5310:: with SMTP id t16mr1674408qtn.258.1571988297185; Fri, 25 Oct 2019 00:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571988297; cv=none; d=google.com; s=arc-20160816; b=dNYyTDDnt/Ifmhio6QzhAMKX63Cv//gKP5UGwa5epFC8ox7HCB3cchqRWUxa8yQ4kV rAj6hunGJJ1gNwukSJQL74bSt9gIVVC3cTb6u+bdgczo09m+ikz3Hp3Dl5mJutfgazAh YdoXcOej8fPRv2OYI2ru/JBs7w5jyY9Pyyiwmm8xfVwHQW/SZ1hVPTxDP70SkBPALm5i eV4x12jZJ3GsVqMmN9bNWXzdvEvp5cgS9iRnxfRfX2kSlkLglL0C6TcqHpkJ9AJj82RS pv/DyDE7YrrbgcIy/iTtmj3eTrLlGEOn+Asw1oywl/trlK4z+DGinjpYS/cu8VPZ13+r 6jGw== 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=K+n/Y9KbSccr2r/DGSz0DXS7y2h6ZtZ3F8obFCMz1Mk=; b=w5CIF503zoxwy9YjR9vJbwuaYQ7XdW8VnzI1YVIh3UGYNvy80iUIsZ61cN0pQBytC/ o1y4sPJVsdXzlTSbTgC3rFEAwXZG5y90ohr+IrqxlVAr5jsNJEdDYMDRgB5cdYg6cjq+ Ss/eGSJdKca+G0Ewx4vV8h9/2eP6e8yr5Ga+xqBkBe3zKpalj9K1fR5iLvER977PNZya U4qMJG0qpg5g1PMmGKKhyCn7KXwispC/PyyeYDF08R6i5vpSL1Sb6gB3tVUZ+iuGKK6e r635K5q4R1hoq6k+e5QS/Axl8/WVyCPnG/oluUbBbgDpzk2hCJ/NnfEbEHZITZmHEmPg xyCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=miyvIiyn; 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 m28si748775qta.349.2019.10.25.00.24.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 00:24:57 -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=miyvIiyn; 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]:56726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtxw-0002Cj-8L for patch@linaro.org; Fri, 25 Oct 2019 03:24:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37078) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtN8-00088T-60 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNtN6-0003HN-Rd for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:54 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42586) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNtN4-0003D3-MZ for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:52 -0400 Received: by mail-wr1-x436.google.com with SMTP id r1so925634wrs.9 for ; Thu, 24 Oct 2019 23:46:47 -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=K+n/Y9KbSccr2r/DGSz0DXS7y2h6ZtZ3F8obFCMz1Mk=; b=miyvIiynGwz+WCOYGSj8NCPrBieuW4m1B2oZ9XIqGsAZh7/u8EkpIxqlfsWtfyBcdW b7CDLmZgPFMF3nxKbohzZb6Vnu54lszi0+qnf7sw+KFPboOZjEMDmhc5Jp58DPm9L0LF ixKpRhKsKTpPiOl+FBvRj1uKFKbyYIuAK0Czdvd+28irBI3x2y38hDtqnsf0uqteXNnL afrD74r3RNK+t6r5bYS5jDn61YPRVIYqj0QC7vdI1bAEIRKAFHzZOP6gUwyGeP4jGhCL h4lfTWyd/N5+IM6zXDgl5jzrqNOK4sRHWUKZEbmVGaUC+5qj+/MamTYmi8Egp0hb6xyR IY6A== 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=K+n/Y9KbSccr2r/DGSz0DXS7y2h6ZtZ3F8obFCMz1Mk=; b=qmDQTaIZlvEY+219Wc2ji7P2qU7L8mByEELqCpiY8pqLwkDRzk8bgsn/bK95fsdNYP D1w12FkcjnN83ObAAAwIqITXNCY5WM7YNto/KtYuSMIMHVLb/evAMSCj8AoiN1NCxRUn lPf/E3nMKdJxUZOIsmMS9Ct5a3KAAO0mXQ3SGaSf0lfaDN75Fv5pHgnxoGCQ5lwmxLZl tgLy5KCVqmentbPxTWFXlBbpNqixyzZ3F6xSCcMon3EbcFuUqIgRrFdSH4NQ6V5fUTrq D2Ev+GEjUX9qXHRnb6j4i6HsJyo+kbM8D4JTX+Cfoj1DBQ9KOEkDQIEilpCO+ZUJKFnU FEog== X-Gm-Message-State: APjAAAWmk8mYNZVzS6F/t6kTNicgq/FGTyTKupKlBQB1UXmxWzUt5F5V bN7W/YottEZ/PNpX2Ub0kg9QlELrbNE= X-Received: by 2002:a05:6000:343:: with SMTP id e3mr1393355wre.20.1571986006167; Thu, 24 Oct 2019 23:46:46 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id e12sm1352654wrs.49.2019.10.24.23.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 23:46:42 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1B0BB1FFD0; Fri, 25 Oct 2019 07:37:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 57/73] vl: support -plugin option Date: Fri, 25 Oct 2019 07:36:57 +0100 Message-Id: <20191025063713.23374-58-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191025063713.23374-1-alex.bennee@linaro.org> References: <20191025063713.23374-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::436 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 , qemu-devel@nongnu.org, "Emilio G . Cota" , 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 -- 2.20.1 diff --git a/qemu-options.hx b/qemu-options.hx index 996b6fba746..fb6df45193f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4181,6 +4181,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 4489cfb2bb6..8b1b4133e49 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"),