From patchwork Thu Oct 17 15:14:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2ABB8D374A8 for ; Thu, 17 Oct 2024 15:15:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCq-000754-1Q; Thu, 17 Oct 2024 11:14:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCo-00074h-SF for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:26 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCm-000138-S2 for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:26 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBnMM002180; Thu, 17 Oct 2024 15:14:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=frxO7ahMl8qvacRYWDcpnTuF9WMCVFPghqcWZg2FsOI=; b= IYOeCMu2xiW8rehMUNSZAE6MnlPjgDJHYtaE7cXkE4a77RrPMZYTVxaTKFbx4BKZ ITZM/NOj+xRQR334t4LZjllEUMu94zFcqK+XXE6ynNQCiZk1UOhMWj7eWrKTHcZ5 tMVmc66RiIRJK9mteLbAzZbsct3AQ9B8xG15L+hEGr+XcJdf+DQ78decg+LHaWGs Fgbj+PupBLby4NKj710eO0y373DD/sqEt9xePM+vYfwjlzo9XpRjerRWEnwLbVLt ghOqc1tjg1sozHkIR0tvHxBE9LQidEskHC1oS8G/PqCVvm+cJjUR7d9TQ9ujjASW KcwBM+75MuRKB/jfPtrv6g== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427fw2ptrd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:19 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HEoVhH027387; Thu, 17 Oct 2024 15:14:19 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy648-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:19 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgT017147; Thu, 17 Oct 2024 15:14:18 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-2; Thu, 17 Oct 2024 15:14:18 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 01/14] accel: encapsulate search state Date: Thu, 17 Oct 2024 08:14:02 -0700 Message-Id: <1729178055-207271-2-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: Ojdqa_dkZ128-5jHenRnV6AMNRS9KGr_ X-Proofpoint-ORIG-GUID: Ojdqa_dkZ128-5jHenRnV6AMNRS9KGr_ Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Save the state of the search for a working machine accelerator in the new structure AccelSearch. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas --- system/vl.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/system/vl.c b/system/vl.c index 7439916..8b345dd 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2304,9 +2304,14 @@ static int accelerator_set_property(void *opaque, return object_parse_property_opt(opaque, name, value, "accel", errp); } +typedef struct { + AccelState *accel; + bool init_failed; +} AccelSearch; + static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) { - bool *p_init_failed = opaque; + AccelSearch *acs = opaque; const char *acc = qemu_opt_get(opts, "accel"); AccelClass *ac = accel_find(acc); AccelState *accel; @@ -2340,16 +2345,17 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) goto bad; } + acs->accel = accel; return 1; bad: - *p_init_failed = true; + acs->init_failed = true; return 0; } static void configure_accelerators(const char *progname) { - bool init_failed = false; + AccelSearch acs = {0}; qemu_opts_foreach(qemu_find_opts("icount"), do_configure_icount, NULL, &error_fatal); @@ -2389,7 +2395,7 @@ static void configure_accelerators(const char *progname) if (accel_find(*tmp)) { qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true); } else { - init_failed = true; + acs.init_failed = true; error_report("invalid accelerator %s", *tmp); } } @@ -2402,15 +2408,15 @@ static void configure_accelerators(const char *progname) } if (!qemu_opts_foreach(qemu_find_opts("accel"), - do_configure_accelerator, &init_failed, &error_fatal)) { - if (!init_failed) { + do_configure_accelerator, &acs, &error_fatal)) { + if (!acs.init_failed) { error_report("no accelerator found"); } exit(1); } - if (init_failed && !qtest_chrdev) { - error_report("falling back to %s", current_accel_name()); + if (acs.init_failed && !qtest_chrdev) { + error_report("falling back to %s", ACCEL_GET_CLASS(acs.accel)->name); } if (icount_enabled() && !tcg_enabled()) { From patchwork Thu Oct 17 15:14:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E49DD374A4 for ; Thu, 17 Oct 2024 15:15:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCt-000769-4a; Thu, 17 Oct 2024 11:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCs-00075m-0i for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:30 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCq-00013e-1m for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:29 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBvgP017840; Thu, 17 Oct 2024 15:14:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=PXtvzfzl2yGZ7l+I4dGCA33x//L52uyZUNRRD8cVjlA=; b= NqPOk7iEjKz5ihtB3xzywnPON6KuFzjCaHP7hi5AP9fJmXMBh2oailQviA5/hJIK k0If/Ry0TkMh6TvzOIA/5qjsXfW3uswvMx9Ju47SPA0Q+AYWe7g9YMRTVfzblEVt nj+BLr6kzPerH6Jqu+kdzTDlLp4CQbGf1wPJg7acEUY3TydZ41HY/iMuZC9MaGUw O9vaWbLFCq12pgSX6X6LuLoWKTggfojtTozuXZXPTF4IV+JegAz3YHPjnZDpLcec 98nOssIg/9Visq17M+xK2FTBQdlPWPOHxxffuI39+c/lBJps6a5/fcZxLE4R9nGd GrwoTdv8mwTOZwLmkINkHQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427hntepyv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:22 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HE1UQE027411; Thu, 17 Oct 2024 15:14:20 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy659-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:20 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgV017147; Thu, 17 Oct 2024 15:14:20 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-3; Thu, 17 Oct 2024 15:14:20 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 02/14] accel: accel preinit function Date: Thu, 17 Oct 2024 08:14:03 -0700 Message-Id: <1729178055-207271-3-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-ORIG-GUID: wsrSyCv5AIDFOAELthL4hsZrAKytxc3L X-Proofpoint-GUID: wsrSyCv5AIDFOAELthL4hsZrAKytxc3L Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Extract the first part of the AccelState init_machine function into a new function preinit, which can be called without knowing any machine properties. For now call preinit and init_machine at the same place, so no functional change. Signed-off-by: Steve Sistare --- accel/accel-system.c | 6 +++++ accel/kvm/kvm-all.c | 58 +++++++++++++++++++++++++++++---------------- accel/xen/xen-all.c | 11 ++++++--- include/qemu/accel.h | 1 + target/i386/nvmm/nvmm-all.c | 10 +++++++- target/i386/whpx/whpx-all.c | 14 +++++++---- 6 files changed, 70 insertions(+), 30 deletions(-) diff --git a/accel/accel-system.c b/accel/accel-system.c index f6c947d..fef6625 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -36,8 +36,14 @@ int accel_init_machine(AccelState *accel, MachineState *ms) int ret; ms->accelerator = accel; *(acc->allowed) = true; + ret = acc->preinit(accel); + if (ret < 0) { + goto fail; + } + ret = acc->init_machine(ms); if (ret < 0) { +fail: ms->accelerator = NULL; *(acc->allowed) = false; object_unref(OBJECT(accel)); diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 905fb84..c7c6001 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2484,6 +2484,42 @@ static int kvm_setup_dirty_ring(KVMState *s) return 0; } +static int kvm_preinit(AccelState *accel) +{ + int ret; + KVMState *s = KVM_STATE(accel); + + s->fd = qemu_open_old(s->device ?: "/dev/kvm", O_RDWR); + if (s->fd == -1) { + error_report("Could not access KVM kernel module: %m"); + ret = -errno; + goto err; + } + + ret = kvm_ioctl(s, KVM_GET_API_VERSION, 0); + if (ret < KVM_API_VERSION) { + if (ret >= 0) { + ret = -EINVAL; + } + fprintf(stderr, "kvm version too old\n"); + goto err; + } + + if (ret > KVM_API_VERSION) { + ret = -EINVAL; + error_report("kvm version not supported"); + goto err; + } + return 0; + +err: + assert(ret < 0); + if (s->fd != -1) { + close(s->fd); + } + return ret; +} + static int kvm_init(MachineState *ms) { MachineClass *mc = MACHINE_GET_CLASS(ms); @@ -2523,27 +2559,6 @@ static int kvm_init(MachineState *ms) QTAILQ_INIT(&s->kvm_sw_breakpoints); #endif QLIST_INIT(&s->kvm_parked_vcpus); - s->fd = qemu_open_old(s->device ?: "/dev/kvm", O_RDWR); - if (s->fd == -1) { - error_report("Could not access KVM kernel module: %m"); - ret = -errno; - goto err; - } - - ret = kvm_ioctl(s, KVM_GET_API_VERSION, 0); - if (ret < KVM_API_VERSION) { - if (ret >= 0) { - ret = -EINVAL; - } - error_report("kvm version too old"); - goto err; - } - - if (ret > KVM_API_VERSION) { - ret = -EINVAL; - error_report("kvm version not supported"); - goto err; - } kvm_supported_memory_attributes = kvm_check_extension(s, KVM_CAP_MEMORY_ATTRIBUTES); kvm_guest_memfd_supported = @@ -3891,6 +3906,7 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); ac->name = "KVM"; + ac->preinit = kvm_preinit; ac->init_machine = kvm_init; ac->has_memory = kvm_accel_has_memory; ac->allowed = &kvm_allowed; diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 0bdefce..dfcb90c 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -75,10 +75,8 @@ static void xen_setup_post(MachineState *ms, AccelState *accel) } } -static int xen_init(MachineState *ms) +static int xen_preinit(AccelState *accel) { - MachineClass *mc = MACHINE_GET_CLASS(ms); - xen_xc = xc_interface_open(0, 0, 0); if (xen_xc == NULL) { xen_pv_printf(NULL, 0, "can't open xen interface\n"); @@ -97,6 +95,12 @@ static int xen_init(MachineState *ms) xc_interface_close(xen_xc); return -1; } + return 0; +} + +static int xen_init(MachineState *ms) +{ + MachineClass *mc = MACHINE_GET_CLASS(ms); /* * The XenStore write would fail when running restricted so don't attempt @@ -125,6 +129,7 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) }; ac->name = "Xen"; + ac->preinit = xen_preinit; ac->init_machine = xen_init; ac->setup_post = xen_setup_post; ac->allowed = &xen_allowed; diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 972a849..6b3b1cf 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -37,6 +37,7 @@ typedef struct AccelClass { /*< public >*/ const char *name; + int (*preinit)(AccelState *accel); int (*init_machine)(MachineState *ms); #ifndef CONFIG_USER_ONLY void (*setup_post)(MachineState *ms, AccelState *accel); diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index 65768ac..ce858a0 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -1153,7 +1153,7 @@ static struct RAMBlockNotifier nvmm_ram_notifier = { /* -------------------------------------------------------------------------- */ static int -nvmm_accel_init(MachineState *ms) +nvmm_accel_preinit(MachineState *ms) { int ret, err; @@ -1178,6 +1178,13 @@ nvmm_accel_init(MachineState *ms) error_report("NVMM: Wrong state size %u", qemu_mach.cap.state_size); return -EPROGMISMATCH; } + return 0; +} + +static int +nvmm_accel_init(MachineState *ms) +{ + int ret, err; ret = nvmm_machine_create(&qemu_mach.mach); if (ret == -1) { @@ -1204,6 +1211,7 @@ nvmm_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); ac->name = "NVMM"; + ac->preinit = nvmm_accel_preinit; ac->init_machine = nvmm_accel_init; ac->allowed = &nvmm_allowed; } diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index a6674a8..50bfc19 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2516,6 +2516,14 @@ static void whpx_set_kernel_irqchip(Object *obj, Visitor *v, * Partition support */ +static int whpx_accel_preinit(AccelState *accel) +{ + if (!init_whp_dispatch()) { + return -ENOSYS; + } + return 0; +} + static int whpx_accel_init(MachineState *ms) { struct whpx_state *whpx; @@ -2529,11 +2537,6 @@ static int whpx_accel_init(MachineState *ms) whpx = &whpx_global; - if (!init_whp_dispatch()) { - ret = -ENOSYS; - goto error; - } - whpx->mem_quota = ms->ram_size; hr = whp_dispatch.WHvGetCapability( @@ -2713,6 +2716,7 @@ static void whpx_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); ac->name = "WHPX"; + ac->preinit = whpx_accel_preinit; ac->init_machine = whpx_accel_init; ac->allowed = &whpx_allowed; From patchwork Thu Oct 17 15:14:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C96E5D374A8 for ; Thu, 17 Oct 2024 15:15:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SD5-0007AS-NA; Thu, 17 Oct 2024 11:14:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD4-0007AH-OC for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:42 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD3-00015l-21 for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:42 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBwjk017947; Thu, 17 Oct 2024 15:14:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=Zzn2twQrUlynteH7OoQpeppESF01QeVIW+EvY+2YPK8=; b= lX7ESpAoYvVUw3UB4qhlPg4xeQ4Q+kA/OVVidMx2h8zBJtIL17Eo8SXnqBNvRnpk QtgIK6zzsd379Gea2NBijWcqONE3WQopJpJ7NC6QpsoFZ7mS3U4rpe0oxys5NEMW ujisjM/zXdnL2WlHnHquFzvrKIu+rPxyrK2bNkVtQVnpXxTOPnpDRl2KOAc/LBVK uaY73iHW2MOb2Ey+gPEVat/WCVYX5hX2ZbkTotfRzAdVpRev2ELlcUYhR/yLKbF4 kLsdMp+X94+oMhG9s0PreEtzrQkESYJgfw20mV381xk06DPG9QbRkFxJHu30LiXU pYugBUDity+GFR1AeLqLmQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427hntepyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:23 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HElkJL027278; Thu, 17 Oct 2024 15:14:22 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy668-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:22 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgX017147; Thu, 17 Oct 2024 15:14:21 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-4; Thu, 17 Oct 2024 15:14:21 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 03/14] accel: split configure_accelerators Date: Thu, 17 Oct 2024 08:14:04 -0700 Message-Id: <1729178055-207271-4-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-ORIG-GUID: 3ihe3eCcVZdPjkS-UjYCgM3KeDQ7bArn X-Proofpoint-GUID: 3ihe3eCcVZdPjkS-UjYCgM3KeDQ7bArn Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Split configure_accelerators into a first function (still named configure_accelerators) that loops and chooses the first accelerator for which preinit succeeds, and a second function create_accelerator which calls machine_init on the chosen accelerator. configure_accelerators can be called without knowing any machine properties. create_accelerator cannot be called until the machine properties are defined. For now call them at the same place, so no functional change. Signed-off-by: Steve Sistare --- accel/accel-system.c | 6 ------ system/vl.c | 27 +++++++++++++++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/accel/accel-system.c b/accel/accel-system.c index fef6625..f6c947d 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -36,14 +36,8 @@ int accel_init_machine(AccelState *accel, MachineState *ms) int ret; ms->accelerator = accel; *(acc->allowed) = true; - ret = acc->preinit(accel); - if (ret < 0) { - goto fail; - } - ret = acc->init_machine(ms); if (ret < 0) { -fail: ms->accelerator = NULL; *(acc->allowed) = false; object_unref(OBJECT(accel)); diff --git a/system/vl.c b/system/vl.c index 8b345dd..b94a6b9 100644 --- a/system/vl.c +++ b/system/vl.c @@ -182,6 +182,7 @@ static const char *log_file; static bool list_data_dirs; static const char *qtest_chrdev; static const char *qtest_log; +static AccelState *accel; static int has_defaults = 1; static int default_audio = 1; @@ -2337,7 +2338,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) accel, &error_fatal); - ret = accel_init_machine(accel, current_machine); + ret = ac->preinit ? ac->preinit(accel) : 0; if (ret < 0) { if (!qtest_with_kvm || ret != -ENOENT) { error_report("failed to initialize %s: %s", acc, strerror(-ret)); @@ -2353,13 +2354,10 @@ bad: return 0; } -static void configure_accelerators(const char *progname) +static AccelState *configure_accelerators(const char *progname) { AccelSearch acs = {0}; - qemu_opts_foreach(qemu_find_opts("icount"), - do_configure_icount, NULL, &error_fatal); - if (QTAILQ_EMPTY(&qemu_accel_opts.head)) { char **accel_list, **tmp; @@ -2418,6 +2416,22 @@ static void configure_accelerators(const char *progname) if (acs.init_failed && !qtest_chrdev) { error_report("falling back to %s", ACCEL_GET_CLASS(acs.accel)->name); } + return acs.accel; +} + +static void create_accelerator(AccelState *accel) +{ + int ret; + + qemu_opts_foreach(qemu_find_opts("icount"), + do_configure_icount, NULL, &error_fatal); + + ret = accel_init_machine(accel, current_machine); + if (ret < 0) { + error_report("failed to initialize %s: %s", + ACCEL_GET_CLASS(accel)->name, strerror(-ret)); + exit(1); + } if (icount_enabled() && !tcg_enabled()) { error_report("-icount is not allowed with hardware virtualization"); @@ -3731,7 +3745,8 @@ void qemu_init(int argc, char **argv) * Note: uses machine properties such as kernel-irqchip, must run * after qemu_apply_machine_options. */ - configure_accelerators(argv[0]); + accel = configure_accelerators(argv[0]); + create_accelerator(accel); phase_advance(PHASE_ACCEL_CREATED); /* From patchwork Thu Oct 17 15:14:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DEC22D374A8 for ; Thu, 17 Oct 2024 15:16:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCr-00075V-BF; Thu, 17 Oct 2024 11:14:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCq-00075G-6T for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:28 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCo-00013R-A7 for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:27 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBpD6002238; Thu, 17 Oct 2024 15:14:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=yzlVEiJFH9rvFFZkAgkE2I5r8H8b5bRa4IdpedreMGU=; b= jVfdXk1M57g2PtnyAXY35jrLlNHjg+ikgAOJZlEP9MKPiZQq1y7juLNd61+s0pwM m3Py//YlVn127SVKv44/ckHxSsbb/fVl3v0AHi0HqWadofI9rJRS/BuMJ7wpPgE9 Wh+gAJxBHds/bKY1c8VCn9qTEJ/ZP/Bl+9ZvALNkGDKYpaMI4zsZul5MkqCsHjmc UENybofqwl8cQCqSRhAPeVP+cGLHyFK63lWBAKwX1SNYaDw+82E34ksj35TKEuzB 66A83UclD/5shMNdaGJjtla9ld6Vi7T34COzMTA6Qld4vP73jj6UV4MkBG2rwZic oMncJt75WCvXO4zrWun8ow== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427fw2ptrm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:24 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HE0skF027565; Thu, 17 Oct 2024 15:14:23 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy679-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:23 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgZ017147; Thu, 17 Oct 2024 15:14:22 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-5; Thu, 17 Oct 2024 15:14:22 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 04/14] accel: set accelerator and machine props earlier Date: Thu, 17 Oct 2024 08:14:05 -0700 Message-Id: <1729178055-207271-5-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: hxZSA1qmgIlPA4w3zzq6p4eRX3tTz3Gz X-Proofpoint-ORIG-GUID: hxZSA1qmgIlPA4w3zzq6p4eRX3tTz3Gz Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Make all global and compat properties available before the first objects are created. Set accelerator compatibility properties in configure_accelerators, when the accelerator is chosen, and call configure_accelerators earlier. Set machine options earlier. Signed-off-by: Steve Sistare --- accel/accel-system.c | 2 -- system/vl.c | 34 ++++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/accel/accel-system.c b/accel/accel-system.c index f6c947d..c8aeae4 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -41,8 +41,6 @@ int accel_init_machine(AccelState *accel, MachineState *ms) ms->accelerator = NULL; *(acc->allowed) = false; object_unref(OBJECT(accel)); - } else { - object_set_accelerator_compat_props(acc->compat_props); } return ret; } diff --git a/system/vl.c b/system/vl.c index b94a6b9..bca2292 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2346,6 +2346,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) goto bad; } + object_set_accelerator_compat_props(ac->compat_props); acs->accel = accel; return 1; @@ -3728,29 +3729,14 @@ void qemu_init(int argc, char **argv) parse_memory_options(); qemu_create_machine(machine_opts_dict); - - suspend_mux_open(); - - qemu_disable_default_devices(); - qemu_setup_display(); - qemu_create_default_devices(); - qemu_create_early_backends(); - qemu_apply_legacy_machine_options(machine_opts_dict); qemu_apply_machine_options(machine_opts_dict); qobject_unref(machine_opts_dict); - phase_advance(PHASE_MACHINE_CREATED); - /* - * Note: uses machine properties such as kernel-irqchip, must run - * after qemu_apply_machine_options. - */ accel = configure_accelerators(argv[0]); - create_accelerator(accel); - phase_advance(PHASE_ACCEL_CREATED); /* - * Beware, QOM objects created before this point miss global and + * QOM objects created after this point see all global and * compat properties. * * Global properties get set up by qdev_prop_register_global(), @@ -3765,6 +3751,22 @@ void qemu_init(int argc, char **argv) * called from do_configure_accelerator(). */ + suspend_mux_open(); + + qemu_disable_default_devices(); + qemu_setup_display(); + qemu_create_default_devices(); + qemu_create_early_backends(); + + phase_advance(PHASE_MACHINE_CREATED); + + /* + * Note: uses machine properties such as kernel-irqchip, must run + * after qemu_apply_machine_options. + */ + create_accelerator(accel); + phase_advance(PHASE_ACCEL_CREATED); + machine_class = MACHINE_GET_CLASS(current_machine); if (!qtest_enabled() && machine_class->deprecation_reason) { warn_report("Machine type '%s' is deprecated: %s", From patchwork Thu Oct 17 15:14:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 219B6D374A4 for ; Thu, 17 Oct 2024 15:16:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCy-000780-6P; Thu, 17 Oct 2024 11:14:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCv-00077H-Ql for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:33 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCu-00014Q-3A for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:33 -0400 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBdMG025055; Thu, 17 Oct 2024 15:14:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=zJQyAAgoRK7Sa1RkUhlX0t66qLvJZN64Bq3Y4xKVkos=; b= i8gMZCXedeopozj0wz8e6EwP3/lAW/iJNs+j2Vj/hzKWjVQ9JbBKt0RJDXcZOsvM Ec3j0HuPNBzqcDr8fbx4VZuv/DmAM3jSDS2saw1CCEtjdHY+h8q1qkjxsAepP0yd ABKNs/SLHFlB3FkCnBI0CSQ/azy2VZ3vlRDSCHYfn5wIcowdUAqkZNczOVOa5q6u y1ujihhJ95PTkpXHwWOM21UphZfPxPAjtbpkgPVvmSvU6makkLOG1h16ECu6DT3m 3afKpQCrerREfEWYxUDTUdirb/+DHuWRfhO90e09qQnUpMOxYksmfUbt5JRLuSK/ wotszkuWErhqgmVaWO3S0Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427g1apg1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:26 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HE32Dj027154; Thu, 17 Oct 2024 15:14:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy68j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:24 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgb017147; Thu, 17 Oct 2024 15:14:24 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-6; Thu, 17 Oct 2024 15:14:24 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 05/14] migration: init and listen during precreate Date: Thu, 17 Oct 2024 08:14:06 -0700 Message-Id: <1729178055-207271-6-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: Zoe9OEV40VBqLYRAoDdAtf3JXB0B91v5 X-Proofpoint-ORIG-GUID: Zoe9OEV40VBqLYRAoDdAtf3JXB0B91v5 Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Initialize the migration object as early as possible so that migration configuration commands may be sent during the precreate phase. Also, start listening for the incoming migration connection during precreate, so that the listen port number is assigned (if dynamic), and the user can discover it during precreate via query-migrate. The precreate phase will be delineated in a subsequent patch. The code previously called migration_object_init after memory backends were created so that a subsequent migrate-set-capabilities call to set MIGRATION_CAPABILITY_POSTCOPY_RAM would verify all backends support postcopy. See migrate_caps_check and postcopy_ram_supported_by_host. The new code calls migration_object_init before backends are created. However, migrate-set-capabilities will only be received during the precreate phase for CPR, and CPR does not support postcopy. If the precreate phase is generalized in the future, then the ram compatibility check must be deferred to the start of migration. Signed-off-by: Steve Sistare --- system/vl.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/system/vl.c b/system/vl.c index bca2292..d32203c 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2753,17 +2753,7 @@ void qmp_x_exit_preconfig(Error **errp) replay_vmstate_init(); } - if (incoming) { - Error *local_err = NULL; - if (strcmp(incoming, "defer") != 0) { - qmp_migrate_incoming(incoming, false, NULL, true, true, - &local_err); - if (local_err) { - error_reportf_err(local_err, "-incoming %s: ", incoming); - exit(1); - } - } - } else if (autostart) { + if (!incoming && autostart) { qmp_cont(NULL); } } @@ -3751,6 +3741,18 @@ void qemu_init(int argc, char **argv) * called from do_configure_accelerator(). */ + /* Creates a QOM object */ + migration_object_init(); + + if (incoming && !g_str_equal(incoming, "defer")) { + Error *local_err = NULL; + qmp_migrate_incoming(incoming, false, NULL, true, true, &local_err); + if (local_err) { + error_reportf_err(local_err, "-incoming %s: ", incoming); + exit(1); + } + } + suspend_mux_open(); qemu_disable_default_devices(); @@ -3773,20 +3775,9 @@ void qemu_init(int argc, char **argv) machine_class->name, machine_class->deprecation_reason); } - /* - * Create backends before creating migration objects, so that it can - * check against compatibilities on the backend memories (e.g. postcopy - * over memory-backend-file objects). - */ qemu_create_late_backends(); phase_advance(PHASE_LATE_BACKENDS_CREATED); - /* - * Note: creates a QOM object, must run only after global and - * compat properties have been set up. - */ - migration_object_init(); - /* parse features once if machine provides default cpu_type */ current_machine->cpu_type = machine_class_default_cpu_type(machine_class); if (cpu_option) { From patchwork Thu Oct 17 15:14:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840222 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62C3AD374A4 for ; Thu, 17 Oct 2024 15:17:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCu-00076j-1V; Thu, 17 Oct 2024 11:14:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCs-00076A-Ua for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:30 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCr-000143-EP for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:30 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBoMx002190; Thu, 17 Oct 2024 15:14:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=xxGxWm2fCMgriPnvrLwmwzchcLAluagUkIOmkVXNLsU=; b= DsbkB1MtiEA/H/quXP1T2oYHNgC3AVtvL431UUVyFoJUJPQjme+mEBOOqlL7A/Jf 9yizcyIqY1AYoCeQCDrJupculp9eLjRVPXDnbJT6G8OQid50ZdUfldg7GhP30mfW CZAJ4ntnHYsFS8v/QabC8dZnJeORxPxzkKOeLRdQcuRcrrALKicgnXcGhLck01+/ UiUGgDku0v64L9OSOak3ZlyJxB5cyUaW1wexXfmpjRrKsNoi2mJPB8HF6heW7Ad5 59BcbKosvyxnwmj7qmUpKkaK2uWOusK//wcpF3WrFEy2GXYiWD7nB/Za3Tkc8GeR uryUiJTleApK2x1g9a9+9A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427fw2ptrs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:26 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HF2N3w027223; Thu, 17 Oct 2024 15:14:26 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy69m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:26 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgd017147; Thu, 17 Oct 2024 15:14:25 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-7; Thu, 17 Oct 2024 15:14:25 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 06/14] vl: precreate phase Date: Thu, 17 Oct 2024 08:14:07 -0700 Message-Id: <1729178055-207271-7-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: 0CFsiJWFfy87VHjHHZ1-yOJTxAzY1MQP X-Proofpoint-ORIG-GUID: 0CFsiJWFfy87VHjHHZ1-yOJTxAzY1MQP Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Refactor qemu_init into actions performed during the precreate phase, and actions performed when exiting precreate. For now, always exit the precreate phase immediately at init time. Future patches will add conditions that cause QEMU to linger in the precreate phase while running the main loop. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas --- system/vl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/system/vl.c b/system/vl.c index d32203c..5f5e810 100644 --- a/system/vl.c +++ b/system/vl.c @@ -183,6 +183,7 @@ static bool list_data_dirs; static const char *qtest_chrdev; static const char *qtest_log; static AccelState *accel; +static FILE *vmstate_dump_file; static int has_defaults = 1; static int default_audio = 1; @@ -2731,6 +2732,8 @@ static bool qemu_machine_creation_done(Error **errp) return true; } +static void qemu_exit_precreate(void); + void qmp_x_exit_preconfig(Error **errp) { if (phase_check(PHASE_MACHINE_INITIALIZED)) { @@ -2795,9 +2798,7 @@ void qemu_init(int argc, char **argv) QemuOptsList *olist; int optind; const char *optarg; - MachineClass *machine_class; bool userconfig = true; - FILE *vmstate_dump_file = NULL; qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); @@ -3753,6 +3754,13 @@ void qemu_init(int argc, char **argv) } } + qemu_exit_precreate(); +} + +static void qemu_exit_precreate(void) +{ + MachineClass *machine_class; + suspend_mux_open(); qemu_disable_default_devices(); From patchwork Thu Oct 17 15:14:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8297D374A4 for ; Thu, 17 Oct 2024 15:15:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCw-00077W-SY; Thu, 17 Oct 2024 11:14:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCu-00076s-PG for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:32 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCs-00014G-V1 for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:32 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBvfB024544; Thu, 17 Oct 2024 15:14:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=bOot6nKltj+7FRW7zF9v26svQIOgEmPKYklqUEF0Ey4=; b= aispcUppA+pezU/7Z1+lCPSfM+FHp0DtvFETLS/BsY2nAHFJiTsK9Ffm2EQHT56n dQ9WyXy1DiSgqzGfcrylUUMtvnfe4TNnuKCS7oHfd9CNLwTQL962Y5kTg1KR4mrF sxgJvufZ3kEThEHSw1+Opar98hNWyKiK1WS7s5sSw/2o+MMjc9QNJ29YGQkH+4G8 74Vbdr7Ug/K1MPwV0vSDjzCPGZIsupoliPYs4TLp26T0y0I+YKP/2IalAnhwSGrW Dre6E/siRk1Z8Nwk2IUIhfiyTG0o7tmpCuzE5Gog1s8EYt9Xb1A58LE/WMyNfmD+ 6wcIXJlxEmg18gAY4+HvRA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427fhcp9ew-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:28 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HEMHPD027120; Thu, 17 Oct 2024 15:14:27 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6ag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:27 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgf017147; Thu, 17 Oct 2024 15:14:27 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-8; Thu, 17 Oct 2024 15:14:27 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 07/14] monitor: chardev name Date: Thu, 17 Oct 2024 08:14:08 -0700 Message-Id: <1729178055-207271-8-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=720 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: kZ9iAHODw5NBjBnGpKo35M7_3MwhBIbS X-Proofpoint-ORIG-GUID: kZ9iAHODw5NBjBnGpKo35M7_3MwhBIbS Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Define an accessor that returns the chardev name in monitor options. Signed-off-by: Steve Sistare --- include/monitor/monitor.h | 1 + monitor/monitor.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c3740ec..8edfd12 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -23,6 +23,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp); void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp); int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp); int monitor_init_opts(QemuOpts *opts, Error **errp); +int monitor_chardev_name(QemuOpts *opts, char **name, Error **errp); void monitor_cleanup(void); int monitor_suspend(Monitor *mon); diff --git a/monitor/monitor.c b/monitor/monitor.c index db52a9c..8b356b6 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -777,6 +777,27 @@ int monitor_init_opts(QemuOpts *opts, Error **errp) return ret; } +int monitor_chardev_name(QemuOpts *opts, char **namep, Error **errp) +{ + Visitor *v = opts_visitor_new(opts); + MonitorOptions *options; + + visit_type_MonitorOptions(v, NULL, &options, errp); + visit_free(v); + if (!options) { + return -1; + } + + if (options->chardev) { + *namep = g_strdup(options->chardev); + } else { + *namep = NULL; + } + + qapi_free_MonitorOptions(options); + return 0; +} + QemuOptsList qemu_mon_opts = { .name = "mon", .implied_opt_name = "chardev", From patchwork Thu Oct 17 15:14:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 668D6D374A8 for ; Thu, 17 Oct 2024 15:16:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SCy-000783-N9; Thu, 17 Oct 2024 11:14:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCw-00077i-DE for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:34 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCu-00014b-Ns for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:34 -0400 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBntI019222; Thu, 17 Oct 2024 15:14:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=I6kRe7XWAeep7YalOEQJIxLpst0wY/dkjO24wZibC4o=; b= Mp20yxItkyuXuqU0ail9GztN9w1CGM1E3Om3daSeR3qdRDoN+aeVnVkfuRja4g7K gl9gidDUAX75kJW+RdduiH3pGACbZsGkx21dwguIih8/cv+WpD6ins1NWkxfUXba 3srYGZ+psiQ2ay96ZxTAwdYLNobBtWXLiTsxhC+wh/eFvP2vOZZ/K6FDSpwbjmKG J73pvPH9BO2iO7SaQzqaLBZmNZHTVOXlcTBbhL2CWCi+7y2AjjOaYDRyCPPFqHpH BPMKnVel9Kwt8JpnIj7kdhLfCRh/8k3kj74lJAMfEnFOw6HGRIMS5hR0i76SBIv7 myoGBhyCoxbBUaGKLyUh2g== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427h5cq32q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:29 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HE0skJ027565; Thu, 17 Oct 2024 15:14:29 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6b9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:29 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgh017147; Thu, 17 Oct 2024 15:14:28 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-9; Thu, 17 Oct 2024 15:14:28 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 08/14] qom: get properties Date: Thu, 17 Oct 2024 08:14:09 -0700 Message-Id: <1729178055-207271-9-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-ORIG-GUID: DYbuSD6wqBf0Xw-a9nDdZE3qJnt73d0M X-Proofpoint-GUID: DYbuSD6wqBf0Xw-a9nDdZE3qJnt73d0M Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Extract a subroutine from user_creatable_add_qapi that converts object options to a dictionary of properties and returns them. Use g_autoptr to simplify the code. No functional change. Signed-off-by: Steve Sistare --- include/qapi/visitor.h | 1 + include/qom/object_interfaces.h | 8 ++++++++ qom/object_interfaces.c | 27 ++++++++++++++------------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 27b85d4..640b941 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -268,6 +268,7 @@ void visit_complete(Visitor *v, void *opaque); */ void visit_free(Visitor *v); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(Visitor, visit_free) /*** Visiting structures ***/ diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h index 02b11a7..2384263 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -98,6 +98,14 @@ Object *user_creatable_add_type(const char *type, const char *id, void user_creatable_add_qapi(ObjectOptions *options, Error **errp); /** + * user_creatable_get_props: + * @options: the object definition + * + * Convert @options to a dictionary of properties and return it. + */ +QDict *user_creatable_get_props(ObjectOptions *options); + +/** * user_creatable_parse_str: * @str: the object definition string as passed on the command line * @errp: if an error occurs, a pointer to an area to store the error diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index e0833c8..104d75c 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -139,26 +139,27 @@ out: void user_creatable_add_qapi(ObjectOptions *options, Error **errp) { - Visitor *v; - QObject *qobj; - QDict *props; - Object *obj; + g_autoptr(Visitor) v; + g_autoptr(Object) obj; + g_autoptr(QDict) props = user_creatable_get_props(options); - v = qobject_output_visitor_new(&qobj); - visit_type_ObjectOptions(v, NULL, &options, &error_abort); - visit_complete(v, &qobj); - visit_free(v); - - props = qobject_to(QDict, qobj); qdict_del(props, "qom-type"); qdict_del(props, "id"); v = qobject_input_visitor_new(QOBJECT(props)); obj = user_creatable_add_type(ObjectType_str(options->qom_type), options->id, props, v, errp); - object_unref(obj); - qobject_unref(qobj); - visit_free(v); +} + +QDict *user_creatable_get_props(ObjectOptions *options) +{ + g_autoptr(Visitor) v; + QObject *qobj; + + v = qobject_output_visitor_new(&qobj); + visit_type_ObjectOptions(v, NULL, &options, &error_abort); + visit_complete(v, &qobj); + return qobject_to(QDict, qobj); } char *object_property_help(const char *name, const char *type, From patchwork Thu Oct 17 15:14:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41F09D374A9 for ; Thu, 17 Oct 2024 15:15:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SD0-00078h-L6; Thu, 17 Oct 2024 11:14:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCx-00077s-6P for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:35 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCv-00014r-Iu for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:34 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBv7A024561; Thu, 17 Oct 2024 15:14:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=Plx7NKWG6o8+aXxaD4xxaoc4Ah8qyprSQc9PLk5710I=; b= WwsQ/PquXZh8I23m79IMGler86ZwZAIWpYDiv6UOZ0xNEpqxUnYxQTeKeU18S4Ia ZJeb4pXpGlgFu2KOf8MP4bLOCSwAO9boB526FsnoK8EDh9aEIBvO8+AKWQVSgs8X qy4nap+RYEmgJPpY+e8qREV5LNIau7AF9P2jAcBHNOO0GOAeLKwhwyHsvcTzwJIf TYhgxLp1JeugSkTLMvpyb/BOxRJMmmKSs5N/VdBSFTzOcOgTXf7fdiyQGy4TIocE pIpLT/ObpXbwjGFU91kPobrY8yQYRKCqLgR2xAfaLyfwViQ7qK+FsSKe0s+jIhAG B2cKbJmKxg3z2s5XFpS0fA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427fhcp9f1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:31 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HF0CrK027322; Thu, 17 Oct 2024 15:14:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:30 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgj017147; Thu, 17 Oct 2024 15:14:29 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-10; Thu, 17 Oct 2024 15:14:29 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 09/14] qemu-option: filtered foreach Date: Thu, 17 Oct 2024 08:14:10 -0700 Message-Id: <1729178055-207271-10-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: r5jGEB_J2HRV22nNVxeL8JYINFHdAuqP X-Proofpoint-ORIG-GUID: r5jGEB_J2HRV22nNVxeL8JYINFHdAuqP Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Define an accessor to loop over an options list and call a function for each element that passes a filter function. Signed-off-by: Steve Sistare --- include/qemu/option.h | 5 +++++ util/qemu-option.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/qemu/option.h b/include/qemu/option.h index 01e673a..fe37d4c 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -138,9 +138,14 @@ QDict *qemu_opts_to_qdict_filtered(QemuOpts *opts, QDict *qdict, QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict); bool qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp); +typedef bool (*qemu_opts_filterfunc)(void *opaque, QemuOpts *opts); typedef int (*qemu_opts_loopfunc)(void *opaque, QemuOpts *opts, Error **errp); int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, Error **errp); +int qemu_opts_filter_foreach(QemuOptsList *list, + qemu_opts_filterfunc filter, + qemu_opts_loopfunc func, + void *opaque, Error **errp); void qemu_opts_print(QemuOpts *opts, const char *sep); void qemu_opts_print_help(QemuOptsList *list, bool print_caption); void qemu_opts_free(QemuOptsList *list); diff --git a/util/qemu-option.c b/util/qemu-option.c index 201f7a8..f2f02d6 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1142,6 +1142,31 @@ int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, return rc; } +int qemu_opts_filter_foreach(QemuOptsList *list, + qemu_opts_filterfunc filter, + qemu_opts_loopfunc func, + void *opaque, Error **errp) +{ + Location loc; + QemuOpts *opts, *next; + int rc = 0; + + loc_push_none(&loc); + QTAILQ_FOREACH_SAFE(opts, &list->head, next, next) { + if (!filter(opaque, opts)) { + continue; + } + loc_restore(&opts->loc); + rc = func(opaque, opts, errp); + if (rc) { + break; + } + assert(!errp || !*errp); + } + loc_pop(&loc); + return rc; +} + static size_t count_opts_list(QemuOptsList *list) { QemuOptDesc *desc = NULL; From patchwork Thu Oct 17 15:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 826A2D374A8 for ; Thu, 17 Oct 2024 15:15:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SD5-0007AO-2C; Thu, 17 Oct 2024 11:14:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD3-00079h-6L for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:41 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD1-00015d-BO for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:40 -0400 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBdYS025061; Thu, 17 Oct 2024 15:14:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=58pR73D09nC0coDIb8oa8Lf/5Za9PFAA07dzekbg9L0=; b= d53KGugHTDeEtsYmcVCOr9D9UFF2MYzHd+7EJwRTZwcX19/Vs5DHeDPnY2Siebak uU3HInQMZvLUVqKP0kKPCSfFQ+QT6xe99jQ3QhyUh1f+zkNBaybnZIitZylyGU+T J+gHWjmbqrPNw2+xq2qEL2rrlec5d5d0VlcjMavtHxsugGCJOPP1kmdJuvORb0Kx uGq5c2mfdCg4Nc7xoJhPjr6ZgIKM1Me5Q5Z3ZhonXAZNwM6Kx1TTEOct5IRbznYZ dVPLEydOpP5ZD1GL8DZ+1Crtpmkzk4ZmDUWpdVKeUS9pOpmrRMIE2CydtevnP26/ lZ73Uvyz8OahYfhcQ9EHhg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427g1apg23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:33 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HElkJP027278; Thu, 17 Oct 2024 15:14:31 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:31 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgl017147; Thu, 17 Oct 2024 15:14:31 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-11; Thu, 17 Oct 2024 15:14:31 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 10/14] qemu-options: pass object to filter Date: Thu, 17 Oct 2024 08:14:11 -0700 Message-Id: <1729178055-207271-11-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: jgrHm-urMrIQKq9lgHnAEta7c0eJut20 X-Proofpoint-ORIG-GUID: jgrHm-urMrIQKq9lgHnAEta7c0eJut20 Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Pass the entire options object to the foreach filter function, rather than just the type name, so more aspects of the object can be used as filter criteria in future patches. No functional change. Signed-off-by: Steve Sistare --- system/vl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/system/vl.c b/system/vl.c index 5f5e810..3c592b9 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1801,13 +1801,13 @@ static void qemu_apply_legacy_machine_options(QDict *qdict) } } -static void object_option_foreach_add(bool (*type_opt_predicate)(const char *)) +static void object_option_foreach_add( + bool (*type_opt_predicate)(const ObjectOption *opt)) { ObjectOption *opt, *next; QTAILQ_FOREACH_SAFE(opt, &object_opts, next, next) { - const char *type = ObjectType_str(opt->opts->qom_type); - if (type_opt_predicate(type)) { + if (type_opt_predicate(opt)) { user_creatable_add_qapi(opt->opts, &error_fatal); qapi_free_ObjectOptions(opt->opts); QTAILQ_REMOVE(&object_opts, opt, next); @@ -1859,8 +1859,10 @@ static void object_option_parse(const char *str) /* * Very early object creation, before the sandbox options have been activated. */ -static bool object_create_pre_sandbox(const char *type) +static bool object_create_pre_sandbox(const ObjectOption *opt) { + const char *type = ObjectType_str(opt->opts->qom_type); + /* * Objects should in general not get initialized "too early" without * a reason. If you add one, state the reason in a comment! @@ -1884,15 +1886,17 @@ static bool object_create_pre_sandbox(const char *type) * cannot be created here, as it depends on the chardev * already existing. */ -static bool object_create_early(const char *type) +static bool object_create_early(const ObjectOption *opt) { + const char *type = ObjectType_str(opt->opts->qom_type); + /* * Objects should not be made "delayed" without a reason. If you * add one, state the reason in a comment! */ /* Reason: already created. */ - if (object_create_pre_sandbox(type)) { + if (object_create_pre_sandbox(opt)) { return false; } @@ -2014,9 +2018,9 @@ static void qemu_create_early_backends(void) * The remainder of object creation happens after the * creation of chardev, fsdev, net clients and device data types. */ -static bool object_create_late(const char *type) +static bool object_create_late(const ObjectOption *opt) { - return !object_create_early(type) && !object_create_pre_sandbox(type); + return !object_create_early(opt) && !object_create_pre_sandbox(opt); } static void qemu_create_late_backends(void) From patchwork Thu Oct 17 15:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 325CDD374A4 for ; Thu, 17 Oct 2024 15:16:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SD1-00078q-5q; Thu, 17 Oct 2024 11:14:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCz-00078Z-Ry for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:37 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SCy-00015S-8o for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:37 -0400 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBnqq019214; Thu, 17 Oct 2024 15:14:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=nVLfvU6z6TFVUuJXM+XTPs9gEglgTTsCo0vqv9CyJeE=; b= Qf4cEnW3AcNWkGZYF0+v7uWDeWOz8hDOlEwADSxDLBh1c71/anCxioNKdb86hVgI absQCmV8xcwEN+ggGJ9KIsusEXbF6JE8RfFinpTUFYKhVr8X0MbOl5eBqlfLNwin cq/lGhDEmbHVK2C+K8phj6wgpXPCG8PV5CdbU1aHemHyERMnMBbxL0437Qi9R6/z CFVzr7W3+DgqNFFXsMMpoJzFF8ZN701vE3B2ZnWlMbClrJUyySgxPdORpq/VDLAQ w2qvzm1tsuDGmK7fpR08lZ7FtWBoaBHJhqqOuY0RequAEGi82uNeXgbfq1i/tosZ fHVMbGVLD0QWMnWjCpQI7Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427h5cq32v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:33 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HElkJQ027278; Thu, 17 Oct 2024 15:14:33 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6du-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:33 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgn017147; Thu, 17 Oct 2024 15:14:32 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-12; Thu, 17 Oct 2024 15:14:32 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 11/14] monitor: connect in precreate Date: Thu, 17 Oct 2024 08:14:12 -0700 Message-Id: <1729178055-207271-12-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-ORIG-GUID: axZp5SQDVKM2MrM2ZumBzW2L4RUO4cKJ X-Proofpoint-GUID: axZp5SQDVKM2MrM2ZumBzW2L4RUO4cKJ Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Complete monitor connections as early as possible, prior to qemu_create_early_backends, so the user can issue commands during the precreate phase. Make a list of the chardev's referenced by all monitors. Create the chardevs, then create the monitors. Exclude monitor chardevs and monitors from the later creation phases. Signed-off-by: Steve Sistare --- system/vl.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/system/vl.c b/system/vl.c index 3c592b9..a985ab8 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1939,6 +1939,11 @@ static bool object_create_early(const ObjectOption *opt) return false; } + /* Reason: already created. */ + if (g_str_equal(type, "mon")) { + return false; + } + return true; } @@ -1956,6 +1961,68 @@ static void qemu_apply_machine_options(QDict *qdict) } } +typedef struct NamedElement { + char *name; + QTAILQ_ENTRY(NamedElement) next; +} NamedElement; + +static QTAILQ_HEAD(, NamedElement) monitor_chardevs = + QTAILQ_HEAD_INITIALIZER(monitor_chardevs); + +static void chardev_add(const char *name) +{ + NamedElement *elem = g_new0(NamedElement, 1); + + elem->name = g_strdup(name); + QTAILQ_INSERT_TAIL(&monitor_chardevs, elem, next); +} + +static bool chardev_find(const char *name) +{ + NamedElement *elem; + + QTAILQ_FOREACH(elem, &monitor_chardevs, next) { + if (g_str_equal(elem->name, name)) { + return true; + } + } + return false; +} + +static int monitor_add_chardev(void *opaque, QemuOpts *opts, Error **errp) +{ + g_autofree char *chardev = NULL; + int ret = monitor_chardev_name(opts, &chardev, errp); + + if (!ret && chardev) { + chardev_add(chardev); + } + return ret; +} + +static bool option_is_monitor_chardev(void *opaque, QemuOpts *opts) +{ + return chardev_find(qemu_opts_id(opts)); +} + +static bool option_is_not_monitor_chardev(void *opaque, QemuOpts *opts) +{ + return !chardev_find(qemu_opts_id(opts)); +} + +static void qemu_create_monitors(void) +{ + qemu_opts_foreach(qemu_find_opts("mon"), + monitor_add_chardev, NULL, &error_fatal); + + qemu_opts_filter_foreach(qemu_find_opts("chardev"), + option_is_monitor_chardev, + chardev_init_func, NULL, &error_fatal); + + qemu_opts_foreach(qemu_find_opts("mon"), + mon_init_func, NULL, &error_fatal); +} + static void qemu_create_early_backends(void) { MachineClass *machine_class = MACHINE_GET_CLASS(current_machine); @@ -1994,7 +2061,8 @@ static void qemu_create_early_backends(void) /* spice must initialize before chardevs (for spicevmc and spiceport) */ qemu_spice.init(); - qemu_opts_foreach(qemu_find_opts("chardev"), + qemu_opts_filter_foreach(qemu_find_opts("chardev"), + option_is_not_monitor_chardev, chardev_init_func, NULL, &error_fatal); #ifdef CONFIG_VIRTFS @@ -2020,6 +2088,11 @@ static void qemu_create_early_backends(void) */ static bool object_create_late(const ObjectOption *opt) { + /* Reason: already created. */ + if (g_str_equal(ObjectType_str(opt->opts->qom_type), "mon")) { + return false; + } + return !object_create_early(opt) && !object_create_pre_sandbox(opt); } @@ -2045,9 +2118,6 @@ static void qemu_create_late_backends(void) exit(1); } - qemu_opts_foreach(qemu_find_opts("mon"), - mon_init_func, NULL, &error_fatal); - if (foreach_device_config(DEV_SERIAL, serial_parse) < 0) exit(1); if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0) @@ -3730,6 +3800,9 @@ void qemu_init(int argc, char **argv) accel = configure_accelerators(argv[0]); + os_setup_signal_handling(); + qemu_create_monitors(); + /* * QOM objects created after this point see all global and * compat properties. From patchwork Thu Oct 17 15:14:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43CB1D374A4 for ; Thu, 17 Oct 2024 15:17:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SD6-0007Aw-Rb; Thu, 17 Oct 2024 11:14:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD6-0007An-19 for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:44 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD4-000161-AU for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:43 -0400 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBdwt025043; Thu, 17 Oct 2024 15:14:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=dHqvC9yA3JHZrC5YQ4nbBhN55KnyC1PMPI6TYC5Kff8=; b= Ur8Nmb01oGrzhQr3nhkUbtI1S21aBLVIqJE+qjM2T+Y/IwnUnFSgkT4ajTnO4+qE sgxAV3MDX+nV4NT4xSSqGrFC1OXOwFckpfjtCGYGIWKXHdsPPpMSxD9UNOrn2HPS Gv1od1+eItN8FpHdrSCEF6ZROPcFzPgIMy2ZqvrRgJ6dc/EXbSqwRHSJOwEb4M+n byIwkl5FKF0DhH/UB35OYxd/aXfFpxxo6J8V0wa+30ySPkq3jvdD9zVBsPcoN4Dr 8mdrq31QAHfbn9taWLy5de2Hq5RhyUVSRaP5Bh2bOQKPj3nfnu8qTB0+sNYqUFXJ J2q63/rymln20kXvZdshrg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427g1apg25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:36 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HEYYDG027117; Thu, 17 Oct 2024 15:14:35 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6f7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:34 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgp017147; Thu, 17 Oct 2024 15:14:34 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-13; Thu, 17 Oct 2024 15:14:34 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 12/14] qtest: connect in precreate Date: Thu, 17 Oct 2024 08:14:13 -0700 Message-Id: <1729178055-207271-13-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: W6M4IeVqcy1Rn7hfg9dKg7hqC-nxz0fE X-Proofpoint-ORIG-GUID: W6M4IeVqcy1Rn7hfg9dKg7hqC-nxz0fE Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Initialize the qtest connection and the chardev it depends on during the precreate phase. Handle both forms of syntax: -object qtest,id=,chardev= -qtest chardev: Signed-off-by: Steve Sistare --- system/vl.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/system/vl.c b/system/vl.c index a985ab8..455c693 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1816,6 +1816,19 @@ static void object_option_foreach_add( } } +static void object_option_foreach( + bool (*type_opt_predicate)(const ObjectOption *opt), + void (*func)(ObjectOptions *opts)) +{ + ObjectOption *opt, *next; + + QTAILQ_FOREACH_SAFE(opt, &object_opts, next, next) { + if (type_opt_predicate(opt)) { + func(opt->opts); + } + } +} + static void object_option_add_visitor(Visitor *v) { ObjectOption *opt = g_new0(ObjectOption, 1); @@ -2000,6 +2013,18 @@ static int monitor_add_chardev(void *opaque, QemuOpts *opts, Error **errp) return ret; } +static void qtest_add_chardev(ObjectOptions *opts) +{ + g_autoptr(QDict) props = user_creatable_get_props(opts); + const char *chardev = qdict_get_str(props, "chardev"); + chardev_add(chardev); +} + +static bool option_is_qtest(const ObjectOption *opt) +{ + return g_str_equal(ObjectType_str(opt->opts->qom_type), "qtest"); +} + static bool option_is_monitor_chardev(void *opaque, QemuOpts *opts) { return chardev_find(qemu_opts_id(opts)); @@ -2012,15 +2037,27 @@ static bool option_is_not_monitor_chardev(void *opaque, QemuOpts *opts) static void qemu_create_monitors(void) { + const char *name; + qemu_opts_foreach(qemu_find_opts("mon"), monitor_add_chardev, NULL, &error_fatal); + object_option_foreach(option_is_qtest, qtest_add_chardev); + + if (qtest_chrdev && strstart(qtest_chrdev, "chardev:", &name)) { + chardev_add(g_strdup(name)); + } + qemu_opts_filter_foreach(qemu_find_opts("chardev"), option_is_monitor_chardev, chardev_init_func, NULL, &error_fatal); qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, &error_fatal); + + if (qtest_chrdev) { + qtest_server_init(qtest_chrdev, qtest_log, &error_fatal); + } } static void qemu_create_early_backends(void) @@ -2098,10 +2135,6 @@ static bool object_create_late(const ObjectOption *opt) static void qemu_create_late_backends(void) { - if (qtest_chrdev) { - qtest_server_init(qtest_chrdev, qtest_log, &error_fatal); - } - net_init_clients(); object_option_foreach_add(object_create_late); From patchwork Thu Oct 17 15:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACFE9D374A9 for ; Thu, 17 Oct 2024 15:15:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SD3-0007A9-RN; Thu, 17 Oct 2024 11:14:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD2-00079L-NQ for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:40 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD1-00015f-CL for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:40 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBv7B024561; Thu, 17 Oct 2024 15:14:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=GBIfTLx2DuEIrzmPlqM5ObwCAX5mdO00SssK9p2FeIs=; b= c1lIF5AcS1OmOan38FT8UfIesg+wpJ80wcl7GSbQiLajUB67sFbFJexpOxpFe2m1 5HbpMvZl3uumezaKk+TbvAbajXSjsn48AZCA7cIAsM5vG8GxkgpHUMK2MD0JekrK HhB9nEb4aqrFMesT8qgfkZFMXSFtVgOMYBvH8r+RQwyqo40SRJJNYPYIPwNJIolH vspNxXA0Qldm3JvvND4iGAlOc881GDpwGYJQ2qcsgGs6XiCRKjooHOnbIanfCGyF PD+qSIgQVWeXwGHwwGJF1hWwSDx5c6vLNsYDP0+inulakXBKKS6ekuBEqcpfC5/M 2i4mYLs6aHaLctD5H/8GiA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427fhcp9fa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:36 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HEOSuT027163; Thu, 17 Oct 2024 15:14:36 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:36 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgr017147; Thu, 17 Oct 2024 15:14:35 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-14; Thu, 17 Oct 2024 15:14:35 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 13/14] net: cleanup for precreate phase Date: Thu, 17 Oct 2024 08:14:14 -0700 Message-Id: <1729178055-207271-14-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=903 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: 5IUtBn_T31wwp9HNs3KCn6V3u1QS2YoI X-Proofpoint-ORIG-GUID: 5IUtBn_T31wwp9HNs3KCn6V3u1QS2YoI Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Guard against unconfigured state if cleanup is called early, such as during the precreate phase. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- net/net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index d9b23a8..207fdb0 100644 --- a/net/net.c +++ b/net/net.c @@ -1687,7 +1687,9 @@ void net_cleanup(void) } } - qemu_del_vm_change_state_handler(net_change_state_entry); + if (net_change_state_entry) { + qemu_del_vm_change_state_handler(net_change_state_entry); + } } void net_check_clients(void) From patchwork Thu Oct 17 15:14:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13840216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68BB6D374A8 for ; Thu, 17 Oct 2024 15:17:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1SDA-0007Bc-Jo; Thu, 17 Oct 2024 11:14:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD8-0007BM-Qt for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:46 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1SD7-00016G-96 for qemu-devel@nongnu.org; Thu, 17 Oct 2024 11:14:46 -0400 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HFBcgJ025032; Thu, 17 Oct 2024 15:14:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :date:from:in-reply-to:message-id:references:subject:to; s= corp-2023-11-20; bh=dB4HCRsy8IFj/zUVwchannUOHLDV6S6nVpfFBtaBAXE=; b= QzLs9vFrkNBOzP8y/ysnA9sMK5423ywIBAXQC/AKPcy0ORf8ShC7RJoN89rOCahW Yu19sEsOBxpOHgEfm8oL+EO9nfvZKoi6wy0rdhRrRhMKPwiXh7GO9OTsv7jUKLUj bVmXsi/orQICGaXGZUfQqw3MHlk9yzvNkLE7LjeRGKMJxMffSg/LPDV8n+dK1KAw m4C900tyOA2szOPC1zPCSrYAg167WPnhyOuFRpQymcqZroyqCO7IlAe7RKndrwYK 2LL3Fe8ArmPHRVanBev9E6Z6b+d2XIF5jzPObgm2wARK/G9tegsWMpFIbHh0zjyo qwG7M8bXVMHaBNX/YUC/3A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427g1apg28-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:39 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HEx45S027314; Thu, 17 Oct 2024 15:14:37 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjgy6hd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 15:14:37 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 49HFEHgt017147; Thu, 17 Oct 2024 15:14:37 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 427fjgy62e-15; Thu, 17 Oct 2024 15:14:37 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Eduardo Habkost , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [RFC V1 14/14] migration: allow commands during precreate and preconfig Date: Thu, 17 Oct 2024 08:14:15 -0700 Message-Id: <1729178055-207271-15-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> References: <1729178055-207271-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170105 X-Proofpoint-GUID: fiSzgF2sQTmP4Pkbvt_qT7ZTyMXGMZU5 X-Proofpoint-ORIG-GUID: fiSzgF2sQTmP4Pkbvt_qT7ZTyMXGMZU5 Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Allow various migration commands during the precreate and preconfig phases so migration may be set up and initiated at that time. Signed-off-by: Steve Sistare --- hmp-commands.hx | 2 ++ qapi/migration.json | 16 +++++++++++----- qapi/misc.json | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 06746f0..c0f34e9 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -959,6 +959,7 @@ ERST .params = "uri", .help = "Continue an incoming migration from an -incoming defer", .cmd = hmp_migrate_incoming, + .flags = "p", }, SRST @@ -1000,6 +1001,7 @@ ERST .help = "Enable/Disable the usage of a capability for migration", .cmd = hmp_migrate_set_capability, .command_completion = migrate_set_capability_completion, + .flags = "p", }, SRST diff --git a/qapi/migration.json b/qapi/migration.json index 3af6aa1..0468c07 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -373,7 +373,8 @@ # } # } ## -{ 'command': 'query-migrate', 'returns': 'MigrationInfo' } +{ 'command': 'query-migrate', 'returns': 'MigrationInfo', + 'allow-preconfig': true } ## # @MigrationCapability: @@ -527,7 +528,8 @@ # <- { "return": {} } ## { 'command': 'migrate-set-capabilities', - 'data': { 'capabilities': ['MigrationCapabilityStatus'] } } + 'data': { 'capabilities': ['MigrationCapabilityStatus'] }, + 'allow-preconfig': true } ## # @query-migrate-capabilities: @@ -551,7 +553,9 @@ # {"state": false, "capability": "x-colo"} # ]} ## -{ 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']} +{ 'command': 'query-migrate-capabilities', + 'returns': ['MigrationCapabilityStatus'], + 'allow-preconfig': true } ## # @MultiFDCompression: @@ -1297,7 +1301,8 @@ # } ## { 'command': 'query-migrate-parameters', - 'returns': 'MigrationParameters' } + 'returns': 'MigrationParameters', + 'allow-preconfig': true } ## # @migrate-start-postcopy: @@ -1751,7 +1756,8 @@ { 'command': 'migrate-incoming', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], - '*exit-on-error': 'bool' } } + '*exit-on-error': 'bool' }, + 'allow-preconfig': true } ## # @xen-save-devices-state: diff --git a/qapi/misc.json b/qapi/misc.json index 559b66f..ce60493 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -241,7 +241,8 @@ { 'command': 'human-monitor-command', 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str', - 'features': [ 'savevm-monitor-nodes' ] } + 'features': [ 'savevm-monitor-nodes' ], + 'allow-preconfig': true } ## # @getfd: