From patchwork Thu Mar 7 07:22:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elena Ufimtseva X-Patchwork-Id: 10842335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29F3E17E9 for ; Thu, 7 Mar 2019 07:49:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1671F2E473 for ; Thu, 7 Mar 2019 07:49:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AA872E48A; Thu, 7 Mar 2019 07:49:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 798222E473 for ; Thu, 7 Mar 2019 07:49:53 +0000 (UTC) Received: from localhost ([127.0.0.1]:46975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1nmq-0000pD-QQ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Mar 2019 02:49:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1nMd-0002nQ-W0 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 02:22:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1nMa-0005lF-WF for qemu-devel@nongnu.org; Thu, 07 Mar 2019 02:22:46 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:48832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h1nMa-0005kB-Ji for qemu-devel@nongnu.org; Thu, 07 Mar 2019 02:22:44 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x277JTTr038001; Thu, 7 Mar 2019 07:22:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=fwMQMc0+FUjjA205VdjmTrASYT470Vr4B0t+OXaWzN0=; b=e26h8PxmpX7/KEkiHx9FpTE/bDqwagZuj0s+tOmRv5zCtLz13Y3laAwW8AHgWclR2PSI McXBWpsYywCjgCOoVgWNDTnNWHjzF/q/YrcTArxAkJ+imBbQR3y7KoZOysepMLOS6Vht A/WO1FH3RP23G85jUjTWUW2v8qlGI64PkCTC32lr+ZSL8iBr6RFh1hNEJ9uts3ffdBl+ qJ8Ub9caws+VQ32tMBCkGAyNCbmj9LEliGHqXfwgQyghTierM/osAY3mX7S+8cvIAIJE cU27r9IuN0f2d1KiPu7orFkS7ok4dvA3ysXZIcZ3078OOdsuQF/0FMZtphqID/raOc2a kA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2qyh8ug99f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Mar 2019 07:22:42 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x277MfnT007326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Mar 2019 07:22:41 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x277MfWH011869; Thu, 7 Mar 2019 07:22:41 GMT Received: from heatpipe.hsd1.ca.comcast.net (/73.170.27.202) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 06 Mar 2019 23:22:41 -0800 From: elena.ufimtseva@oracle.com To: qemu-devel@nongnu.org Date: Wed, 6 Mar 2019 23:22:39 -0800 Message-Id: <20190307072239.9594-1-elena.ufimtseva@oracle.com> X-Mailer: git-send-email 2.17.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9187 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903070053 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [multiprocess RFC PATCH 30/37] multi-process: add processing of rdrive and rdevice command line X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: elena.ufimtseva@oracle.com, john.g.johnson@oracle.com, sstabellini@kernel.org, jag.raman@oracle.com, konrad.wilk@oracle.com, ross.lagerwall@citrix.com, liran.alon@oracle.com, stefanha@redhat.com, pbonzini@redhat.com, kanth.ghatraju@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Elena Ufimtseva Add processing of command line options rdrive and rdevice. After remote devices are created along with their proxies, signal the proxies to finish the configuration steps. Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Please enter the commit message for your changes. Lines starting --- vl.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/vl.c b/vl.c index 4c5cc0d..f6bd66e 100644 --- a/vl.c +++ b/vl.c @@ -30,6 +30,11 @@ #include "qemu/help_option.h" #include "qemu/uuid.h" #include "sysemu/seccomp.h" +#include "qapi/qmp/qdict.h" +#include "block/qdict.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qjson.h" +#include "qapi/qmp/qlist.h" #ifdef CONFIG_SDL #if defined(__APPLE__) || defined(main) @@ -1165,6 +1170,21 @@ static int drive_init_func(void *opaque, QemuOpts *opts, Error **errp) return drive_new(opts, *block_default_type, errp) == NULL; } +#if defined(CONFIG_MPQEMU) +static int rdrive_init_func(void *opaque, QemuOpts *opts, Error **errp) +{ + DeviceState *dev; + + dev = qdev_remote_add(opts, false /* this is drive */, errp); + if (!dev) { + qemu_log_mask(LOG_REMOTE_DEBUG, "qdev_remote_add failed for drive.\n"); + return -1; + } + object_unref(OBJECT(dev)); + return 0; +} +#endif + static int drive_enable_snapshot(void *opaque, QemuOpts *opts, Error **errp) { if (qemu_opt_get(opts, "snapshot") == NULL) { @@ -2298,6 +2318,21 @@ static int device_init_func(void *opaque, QemuOpts *opts, Error **errp) return 0; } +#if defined(CONFIG_MPQEMU) +static int rdevice_init_func(void *opaque, QemuOpts *opts, Error **errp) +{ + DeviceState *dev; + + dev = qdev_remote_add(opts, true /* this is device */, errp); + if (!dev) { + qemu_log_mask(LOG_REMOTE_DEBUG, "qdev_remote_add failed for device.\n"); + return -1; + } + object_unref(OBJECT(dev)); + return 0; +} +#endif + static int chardev_init_func(void *opaque, QemuOpts *opts, Error **errp) { Error *local_err = NULL; @@ -2984,6 +3019,7 @@ int main(int argc, char **argv, char **envp) Error *err = NULL; bool list_data_dirs = false; char *dir, **dirs; + typedef struct BlockdevOptions_queue { BlockdevOptions *bdo; Location loc; @@ -3036,6 +3072,11 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_icount_opts); qemu_add_opts(&qemu_semihosting_config_opts); qemu_add_opts(&qemu_fw_cfg_opts); +#if defined(CONFIG_MPQEMU) + qemu_add_opts(&qemu_rdrive_opts); + qemu_add_opts(&qemu_rdevice_opts); +#endif + module_call_init(MODULE_INIT_OPTS); runstate_init(); @@ -3633,6 +3674,22 @@ int main(int argc, char **argv, char **envp) exit(1); } break; + +#if defined(CONFIG_MPQEMU) + case QEMU_OPTION_rdevice: + if (!qemu_opts_parse_noisily(qemu_find_opts("rdevice"), + optarg, true)) { + exit(1); + } + + break; + case QEMU_OPTION_rdrive: + if (!qemu_opts_parse_noisily(qemu_find_opts("rdrive"), + optarg, false)) { + exit(1); + } + break; +#endif case QEMU_OPTION_smp: if (!qemu_opts_parse_noisily(qemu_find_opts("smp-opts"), optarg, true)) { @@ -4387,6 +4444,7 @@ int main(int argc, char **argv, char **envp) qapi_free_BlockdevOptions(bdo->bdo); g_free(bdo); } + if (snapshot || replay_mode != REPLAY_MODE_NONE) { qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, NULL); @@ -4478,6 +4536,21 @@ int main(int argc, char **argv, char **envp) qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, &error_fatal); +#if defined(CONFIG_MPQEMU) + if (qemu_opts_foreach(qemu_find_opts("rdrive"), rdrive_init_func, + NULL, &err)) { + qemu_log_mask(LOG_REMOTE_DEBUG, + "Failed to execute rdrive_init_func\n."); + } + + if (qemu_opts_foreach(qemu_find_opts("rdevice"), + + rdevice_init_func, NULL, &err)) { + qemu_log_mask(LOG_REMOTE_DEBUG, + "Failed to execute rdevice_init_func\n."); + } +#endif + cpu_synchronize_all_post_init(); rom_reset_order_override(); @@ -4530,10 +4603,13 @@ int main(int argc, char **argv, char **envp) qemu_register_reset(qbus_reset_all_fn, sysbus_get_default()); qemu_run_machine_init_done_notifiers(); +#if defined(CONFIG_MPQEMU) + qdev_proxy_fire(); if (rom_check_and_register_reset() != 0) { error_report("rom check and register reset failed"); exit(1); } +#endif replay_start();