From patchwork Wed Oct 27 13:12:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1546950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=eVvHRyLr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HfVTs3MJQz9sS8 for ; Thu, 28 Oct 2021 00:51:29 +1100 (AEDT) Received: from localhost ([::1]:45338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfjKx-0002lj-7Z for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2021 09:51:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfijV-000265-WC for qemu-devel@nongnu.org; Wed, 27 Oct 2021 09:12:54 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:37763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfijU-0005ec-1H for qemu-devel@nongnu.org; Wed, 27 Oct 2021 09:12:45 -0400 Received: by mail-ed1-x534.google.com with SMTP id y12so10487720eda.4 for ; Wed, 27 Oct 2021 06:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dRkYjCM4oe/5PiNgXD9yEIB03XmryZs6h1ddz3hgXi4=; b=eVvHRyLrtHGPkShE0MQ/La8Uwyh97XgYrElll8riPUFtnvsmZu87zKThdRsiyKWH2C 0bjRGWHOcRSy1kCzBfGmwZZ8L0NR48/FQnY+Ltq2uTVu44f9FiZ5OjetrBrLwg2QtmkE 7ThxX1lwS8RXaXKyNIOEMJRHOzZNkFkD3sg3rTnQnOI6ErrV1q+1pivsuZU3/JO4U9o5 Pa1D665+sWLkMQxoGHW+8mKnd6xpWQN6xqbDzlqSaVVJXQ2nX2K3i1y/uvEk7GZ4VoQc 4nrk4l3Zs8qNIblLT0Lrkp4+gKFEqxV4kspIzlB8VXWHPgNmGWS4Fak/Kh0qgGVaHnDr uNqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dRkYjCM4oe/5PiNgXD9yEIB03XmryZs6h1ddz3hgXi4=; b=UEj3UGQkXxV5nuXnDjo3YA6j8RsJW6/wPpiYmqmGCg4UiHEl/UtpFrdHRHacZUUxa8 dxQU9iZa8q446CshaJn39j/I3HC74BhV3qNffSEhdKWp4/y8Ohips6m2xbI0+67aOW4Z Lbrzsb5D9jB3l4qNpt8jSFq0+43KuRg5WPWY0zwDkkd8qtmT9Q030jZUDzUZ9kLlj39G qAZMdsFL/r8x7gtc2MfqjQFLvzYUwrjrw8qRwvBAsN/zpAGhP+wx3Ch59o6vsiHg+Qnr nehsoR9HYkUZMv3DB2GcrXnYDmHcNd10scxRJdkygPMFQwjXngvgmpQq/g82vqw5j1MX iujg== X-Gm-Message-State: AOAM531wgJXsPmMeWX373UPPq66wEOBP+Bc0v4RwSdskkroIfWoW45Od 2yPiKqrZJGm5I1Z1aCbMB2fgPN1X7e0= X-Google-Smtp-Source: ABdhPJykxgWfIwmuzTtzJyoKJTllTpOrmGnkgPQN2sWISRYXCgFtXfVyaECRkZc7F2sX6BjmxsIolQ== X-Received: by 2002:a17:907:72d0:: with SMTP id du16mr38876609ejc.226.1635340361612; Wed, 27 Oct 2021 06:12:41 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id p26sm12716943edu.57.2021.10.27.06.12.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 06:12:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 1/3] watchdog: add information from -watchdog help to -device help Date: Wed, 27 Oct 2021 15:12:37 +0200 Message-Id: <20211027131239.802564-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211027131239.802564-1-pbonzini@redhat.com> References: <20211027131239.802564-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x534.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" List all watchdog devices in a separate category, and populate their descriptions. Signed-off-by: Paolo Bonzini --- hw/watchdog/sbsa_gwdt.c | 3 ++- hw/watchdog/wdt_aspeed.c | 3 ++- hw/watchdog/wdt_diag288.c | 3 ++- hw/watchdog/wdt_i6300esb.c | 3 ++- hw/watchdog/wdt_ib700.c | 3 ++- hw/watchdog/wdt_imx2.c | 4 ++-- include/hw/qdev-core.h | 1 + softmmu/qdev-monitor.c | 1 + 8 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/watchdog/sbsa_gwdt.c b/hw/watchdog/sbsa_gwdt.c index d0998f8489..e49cacd0e2 100644 --- a/hw/watchdog/sbsa_gwdt.c +++ b/hw/watchdog/sbsa_gwdt.c @@ -273,8 +273,9 @@ static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, void *data) dc->realize = wdt_sbsa_gwdt_realize; dc->reset = wdt_sbsa_gwdt_reset; dc->hotpluggable = false; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories); dc->vmsd = &vmstate_sbsa_gwdt; + dc->desc = "SBSA-compliant generic watchdog device"; } static const TypeInfo wdt_sbsa_gwdt_info = { diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index 146ffcd713..6aa6f90b66 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -293,9 +293,10 @@ static void aspeed_wdt_class_init(ObjectClass *klass, void *data) dc->desc = "ASPEED Watchdog Controller"; dc->realize = aspeed_wdt_realize; dc->reset = aspeed_wdt_reset; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories); dc->vmsd = &vmstate_aspeed_wdt; device_class_set_props(dc, aspeed_wdt_properties); + dc->desc = "Aspeed watchdog device"; } static const TypeInfo aspeed_wdt_info = { diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c index e135a4de8b..9e8882a11c 100644 --- a/hw/watchdog/wdt_diag288.c +++ b/hw/watchdog/wdt_diag288.c @@ -122,9 +122,10 @@ static void wdt_diag288_class_init(ObjectClass *klass, void *data) dc->unrealize = wdt_diag288_unrealize; dc->reset = wdt_diag288_reset; dc->hotpluggable = false; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories); dc->vmsd = &vmstate_diag288; diag288->handle_timer = wdt_diag288_handle_timer; + dc->desc = "diag288 device for s390x platform"; } static const TypeInfo wdt_diag288_info = { diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 4c52e3bb9e..f99a1c9d29 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -476,7 +476,8 @@ static void i6300esb_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_SYSTEM_OTHER; dc->reset = i6300esb_reset; dc->vmsd = &vmstate_i6300esb; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories); + dc->desc = "Intel 6300ESB"; } static const TypeInfo i6300esb_info = { diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c index 177aaa503f..91d1bdc0da 100644 --- a/hw/watchdog/wdt_ib700.c +++ b/hw/watchdog/wdt_ib700.c @@ -140,7 +140,8 @@ static void wdt_ib700_class_init(ObjectClass *klass, void *data) dc->realize = wdt_ib700_realize; dc->reset = wdt_ib700_reset; dc->vmsd = &vmstate_ib700; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories); + dc->desc = "iBASE 700"; } static const TypeInfo wdt_ib700_info = { diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index a5fb76308f..c3128370b5 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -280,8 +280,8 @@ static void imx2_wdt_class_init(ObjectClass *klass, void *data) dc->realize = imx2_wdt_realize; dc->reset = imx2_wdt_reset; dc->vmsd = &vmstate_imx2_wdt; - dc->desc = "i.MX watchdog timer"; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + dc->desc = "i.MX2 watchdog timer"; + set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories); } static const TypeInfo imx2_wdt_info = { diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 4ff19c714b..0dae5b6f6c 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -26,6 +26,7 @@ typedef enum DeviceCategory { DEVICE_CATEGORY_SOUND, DEVICE_CATEGORY_MISC, DEVICE_CATEGORY_CPU, + DEVICE_CATEGORY_WATCHDOG, DEVICE_CATEGORY_MAX } DeviceCategory; diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 3df99ce9fc..87dd87e801 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -162,6 +162,7 @@ static void qdev_print_devinfos(bool show_no_user) [DEVICE_CATEGORY_SOUND] = "Sound", [DEVICE_CATEGORY_MISC] = "Misc", [DEVICE_CATEGORY_CPU] = "CPU", + [DEVICE_CATEGORY_WATCHDOG]= "Watchdog", [DEVICE_CATEGORY_MAX] = "Uncategorized", }; GSList *list, *elt; From patchwork Wed Oct 27 13:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1546940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=IcIwqJPj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HfVQR52f9z9sS8 for ; Thu, 28 Oct 2021 00:48:31 +1100 (AEDT) Received: from localhost ([::1]:41284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfjI4-0008JE-Ux for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2021 09:48:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfijc-00026P-7j for qemu-devel@nongnu.org; Wed, 27 Oct 2021 09:12:54 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:34425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfijZ-0005fB-4i for qemu-devel@nongnu.org; Wed, 27 Oct 2021 09:12:51 -0400 Received: by mail-ed1-x531.google.com with SMTP id g10so10410513edj.1 for ; Wed, 27 Oct 2021 06:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YP//+gZEuiiaftiEX3vnR7gaMlbwgWW6l4uyF5N0mZQ=; b=IcIwqJPjPD9XNiTPUaJgy8lt7y4SzAHU40wT4ot0Nz9iw25sP/Ln4oEAL+iMFrGuE9 1eTTw5ocgr/IMb5jn3vr92ol33ZrxFa4prooXAJIK7kcwXZ9Dr1C2CnPzlghKtdR9WM3 bqzqbjWgaXPAEstmslhqM713ejzRVihxvzAHcrvJYt+CUqU6vdFiX19yj8lnPOWwt1Zl N3dw/5fVcuoJm4dEzyplyOdtyUXAN+c8rkcGy+wKvCrZFBB2YLLLwhtdRuBQ/0Qd+jYm RIlZLsRMBhW58qdFYkW8xpF5eqHQV0xoNbAbryQy1MJFpURe6qkCLIoIMcMvnoDPt5g3 G1sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=YP//+gZEuiiaftiEX3vnR7gaMlbwgWW6l4uyF5N0mZQ=; b=wsbZdYDt8Vj5v9ojIxRrxngIBlxIAjVf6Bi1glW/P+Q4i3d7JsUauG1WYYnQhEKz8o OzLwGanGBw2csMHuG2bM5KL7WpHWLlS5b5yIQr0Od60I8iKNK4Dqoh39ByOHNVMhmIwP FTg8v/tc7dCPxi+NMZiz/jJgzcRgB8IJdR7g98jVlMd5W0bqJxj2LCEjp2hKhfUfO9gL GfXLoFjoYsxk3SsBLRDFWpL3Yv43EXpk8/Yk6BY3YdpvQiO1y0HXkJBnmMXyvwtEFSpR HUoX9py7cpuF4IwezquQ6eiWreo2Jztk9wE28F6rLKaTA45CN5iLjnIxVDCMFgEHXuY4 V00A== X-Gm-Message-State: AOAM533GWpHhFNfGi4svHa0tH92rHUuSC6XU55037KnYv0Rdw+ODysSn Y1O7XlV5z/PJ4o9xVTgeNLI2TnjE/y4= X-Google-Smtp-Source: ABdhPJze5WB12Jk8ZUM9T032UdXtlpALL14RDBXy/DbreKrZ9LaXenGUIR628IanwdUu74zNqaRKGw== X-Received: by 2002:a17:906:13ce:: with SMTP id g14mr29663508ejc.203.1635340362322; Wed, 27 Oct 2021 06:12:42 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id p26sm12716943edu.57.2021.10.27.06.12.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 06:12:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 2/3] vl: deprecate -watchdog Date: Wed, 27 Oct 2021 15:12:38 +0200 Message-Id: <20211027131239.802564-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211027131239.802564-1-pbonzini@redhat.com> References: <20211027131239.802564-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" -watchdog is the same as -device except that it is case insensitive (and it allows only watchdog devices of course). Now that "-device help" can list as such the available watchdog devices, we can deprecate it. Note that even though -watchdog tries to be case insensitive, it fails at that: "-watchdog i6300xyz" fails with "Unknown -watchdog device", but "-watchdog i6300ESB" also fails (when the generated -device option is processed) with an error "'i6300ESB' is not a valid device model name". For this reason, the documentation update does not mention the case insensitivity of -watchdog. Signed-off-by: Paolo Bonzini --- docs/about/deprecated.rst | 5 +++++ softmmu/vl.c | 1 + 2 files changed, 6 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 0bed6ecb1d..3540f5754b 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -160,6 +160,11 @@ Use ``-display sdl`` instead. Use ``-display curses`` instead. +``-watchdog`` (since 6.2) +''''''''''''''''''''''''' + +Use ``-device`` instead. + ``-smp`` ("parameter=0" SMP configurations) (since 6.2) ''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/softmmu/vl.c b/softmmu/vl.c index 55ab70eb97..33908860e7 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3216,6 +3216,7 @@ void qemu_init(int argc, char **argv, char **envp) error_report("only one watchdog option may be given"); exit(1); } + warn_report("-watchdog is deprecated; use -device instead."); watchdog = optarg; break; case QEMU_OPTION_action: From patchwork Wed Oct 27 13:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1546926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=RZEIymym; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HfV7P2Cr3z9sS8 for ; Thu, 28 Oct 2021 00:35:29 +1100 (AEDT) Received: from localhost ([::1]:47820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfj5S-00010O-S0 for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2021 09:35:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfija-00026N-84 for qemu-devel@nongnu.org; Wed, 27 Oct 2021 09:12:54 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:39932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfijY-0005f7-LJ for qemu-devel@nongnu.org; Wed, 27 Oct 2021 09:12:49 -0400 Received: by mail-ed1-x531.google.com with SMTP id r12so10341656edt.6 for ; Wed, 27 Oct 2021 06:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rnp475mRSCE7gq/B7ARMmQozRUpSW+crMgmW9IoFGmY=; b=RZEIymymi2b4MA15Ha7oejVuZXKBFzBUoCoCmpwBH6Bf+CJzJ7bRZpzFrglj32gLjl WrspqXesqnjt5X958sv57cRrnEOcXQWD3FXU2BeWH26ekJRwgGu494bRDqUxvPnXnedN WmNysXeIr/HKoIBxmSXk1aegcD2CRfBUShmkGSbutAdBPx0WuSO7LTXgE6pEQV8YhGK4 0Wqt11hjoxp4nyJVy9/ETfu2GVjP5gf4a/c/NTvzlR6k5Ekc4qexbzaE4kecBOqg++z6 BUex0EMhQiek5o76AqhfqCehixlT9GTJNMNhT8xlrjBIWhM0HtWge8SEVIfkPBrWHvsc LOgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rnp475mRSCE7gq/B7ARMmQozRUpSW+crMgmW9IoFGmY=; b=sh/S+SEhQvb9mEcn7cPX/kBcx8JJkiQriqp/WkTuaizAgbdgj1lbxvFAhH9+VMsWDT 13fBgG2KDJULeqH5zJxiL3/g6SK0baJ5YBNnpPhSlB4hJc0TBw0S7AXkdijhEpAqEFtk 7nUGczJTeB725Yq1bwGLFDL4GmpNMXfWEP5G2u6JWvxZftUCsNdlunwAYxOBw7XoFVZB z3r0bldwuIsQz/xFFuh3FPZg6mAvMewNlJvsH9RgGvJbFnMZFkJ6vw5eh0v1S6JFTv3D b9DD6Ci8RIhwNiPVAtc2fVbePpLFbYTHmSWaBa4/1QFeWm3GL0aOgmtwDbM31SjagaZh u4gA== X-Gm-Message-State: AOAM5307STiVxHfIkmKvyz6WhuFPlHpVry2iJ6tDYDKXMt9c5OO9UUJ8 lndIEPDRmO3hPjgALRF63BRJmL67oMI= X-Google-Smtp-Source: ABdhPJynS110x4P4Uyqrqqvsf6SjHHqMG0sCdiORl6jHuoKDqLdRhe8k/cCFOuAP9DqFoXAlhcia8Q== X-Received: by 2002:aa7:dbc1:: with SMTP id v1mr20055423edt.49.1635340362991; Wed, 27 Oct 2021 06:12:42 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id p26sm12716943edu.57.2021.10.27.06.12.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 06:12:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 3/3] watchdog: remove select_watchdog_action Date: Wed, 27 Oct 2021 15:12:39 +0200 Message-Id: <20211027131239.802564-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211027131239.802564-1-pbonzini@redhat.com> References: <20211027131239.802564-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of invoking select_watchdog_action from both HMP and command line, go directly from HMP to QMP and use QemuOpts as the intermediary for the command line. This makes -watchdog-action explicitly a shortcut for "-action watchdog", so that "-watchdog-action" and "-action watchdog" override each other based on the position on the command line; previously, "-action watchdog" always won. Signed-off-by: Paolo Bonzini --- hw/watchdog/watchdog.c | 14 -------------- include/sysemu/watchdog.h | 1 - monitor/misc.c | 15 ++++++++++++--- softmmu/vl.c | 10 +++++----- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 0e98ffb73f..1437e6c5b6 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -76,20 +76,6 @@ int select_watchdog(const char *p) return 1; } -int select_watchdog_action(const char *p) -{ - int action; - char *qapi_value; - - qapi_value = g_ascii_strdown(p, -1); - action = qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, NULL); - g_free(qapi_value); - if (action < 0) - return -1; - qmp_watchdog_set_action(action, &error_abort); - return 0; -} - WatchdogAction get_watchdog_action(void) { return watchdog_action; diff --git a/include/sysemu/watchdog.h b/include/sysemu/watchdog.h index a08d16380d..d2d4901dbb 100644 --- a/include/sysemu/watchdog.h +++ b/include/sysemu/watchdog.h @@ -37,7 +37,6 @@ typedef struct WatchdogTimerModel WatchdogTimerModel; /* in hw/watchdog.c */ int select_watchdog(const char *p); -int select_watchdog_action(const char *action); WatchdogAction get_watchdog_action(void); void watchdog_add_model(WatchdogTimerModel *model); void watchdog_perform_action(void); diff --git a/monitor/misc.c b/monitor/misc.c index ffe7966870..f411675e32 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -70,6 +70,7 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-qom.h" +#include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-commands-trace.h" #include "qapi/qapi-init-commands.h" #include "qapi/error.h" @@ -470,10 +471,18 @@ static void hmp_gdbserver(Monitor *mon, const QDict *qdict) static void hmp_watchdog_action(Monitor *mon, const QDict *qdict) { - const char *action = qdict_get_str(qdict, "action"); - if (select_watchdog_action(action) == -1) { - monitor_printf(mon, "Unknown watchdog action '%s'\n", action); + Error *err = NULL; + WatchdogAction action; + char *qapi_value; + + qapi_value = g_ascii_strdown(qdict_get_str(qdict, "action"), -1); + action = qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, &err); + g_free(qapi_value); + if (err) { + hmp_handle_error(mon, err); + return; } + qmp_watchdog_set_action(action, &error_abort); } static void monitor_printc(Monitor *mon, int c) diff --git a/softmmu/vl.c b/softmmu/vl.c index 33908860e7..cf01bd5084 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3225,12 +3225,12 @@ void qemu_init(int argc, char **argv, char **envp) exit(1); } break; - case QEMU_OPTION_watchdog_action: - if (select_watchdog_action(optarg) == -1) { - error_report("unknown -watchdog-action parameter"); - exit(1); - } + case QEMU_OPTION_watchdog_action: { + QemuOpts *opts; + opts = qemu_opts_create(qemu_find_opts("action"), NULL, 0, &error_abort); + qemu_opt_set(opts, "watchdog", optarg, &error_abort); break; + } case QEMU_OPTION_parallel: add_device_config(DEV_PARALLEL, optarg); default_parallel = 0;