From patchwork Mon Jan 29 19:28:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13536298 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 763C5C47DB3 for ; Mon, 29 Jan 2024 19:29:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUXJ6-0003i9-Qt; Mon, 29 Jan 2024 14:28:36 -0500 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 1rUXIy-0003gm-Fh for qemu-devel@nongnu.org; Mon, 29 Jan 2024 14:28:28 -0500 Received: from todd.t-8ch.de ([159.69.126.157]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUXIv-0003Om-RN for qemu-devel@nongnu.org; Mon, 29 Jan 2024 14:28:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1706556501; bh=FVw+c6Ce+wkmxqh1+XbMbzjBtVo4IHWXj7KAS4yyaNY=; h=From:Subject:Date:To:Cc:From; b=kngt+Q95OEXPv+r9NpH4pFXm5lucSg/36DDFjgNyjlSAI3ak7NwXD3bGBO/+GoCht Bal7Qxv8CY/TRulqb5pRC0xWqa4VLxqbMM0iQ9hxOzKLsgw9hd5BaRyuA9ejrkVMJS FVHqhB9cbn8qDpThS0+l2ZIspL6ToGjm0EDmxtRY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH v5 0/6] hw/misc/pvpanic: add support for normal shutdowns Date: Mon, 29 Jan 2024 20:28:08 +0100 Message-Id: <20240129-pvpanic-shutdown-v5-0-f5a060b87c74@t-8ch.de> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAEj8t2UC/33NTWrDMBCG4asErasyf6qlrHqP0oUlK7U2trFcN SH47pUDBRNMl9/A885d5TinmNX5dFdzLCmncajDvJxU6NvhK+rU1a0IiBFB9FSmdkhB5/576ca fQQNF8RK8OHGqsmmOl3R9JD8+6+5TXsb59vhQcLv+EyuooRbZMJrGOvTvi7ahf+2i2lqFdp7sg afqLQM79mKCf3vyvPfuwHP1wbVkHV2CIX7y8ucFEJoDL9t/NABtEwUs7vy6rr/jHKfbbwEAAA= = To: "Michael S. Tsirkin" , Cornelia Huck , Paolo Bonzini , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, Alejandro Jimenez , =?utf-8?q?Thomas_Wei?= =?utf-8?q?=C3=9Fschuh?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706556500; l=3086; i=thomas@t-8ch.de; s=20221212; h=from:subject:message-id; bh=FVw+c6Ce+wkmxqh1+XbMbzjBtVo4IHWXj7KAS4yyaNY=; b=mYYA2ig3eRt0XwuRimONDgPLcvniQLeU/hSvGbEwgs1kEnJtMq7jrGuc4HvBEjhhX0ftYMkn9 UR/qjSELAr5Bj5NJtB/oLYEaSZ1EqKuakLCn03ax49p2Q/BXQdFSON8 X-Developer-Key: i=thomas@t-8ch.de; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Received-SPF: pass client-ip=159.69.126.157; envelope-from=thomas@t-8ch.de; helo=todd.t-8ch.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 Shutdown requests are normally hardware dependent. By extending pvpanic to also handle shutdown requests, guests can submit such requests with an easily implementable and cross-platform mechanism. The background is the usage of minimal Linux kernels with different architectures for testing purposes. Poweroff support varies highly per architecture and requires a bunch of code to be compiled to work. pvpanic on the other hand is very small and uniform. Patch 1, 2 and 3 are general cleanups, that seems useful even without this proposal being implemented. They should also be ready to be picked up from the series on their own. A corresponding patch has been submitted for Linux [0]. This is also where the request was voiced to drop move away from a pvpanic uapi header in Linux. [0] https://lore.kernel.org/lkml/20231104-pvpanic-shutdown-v1-1-5ee7c9b3e301@weissschuh.net/ Signed-off-by: Thomas Weißschuh --- Changes in v5: - Add patch from Alejandro to emit a QMP event. - Update cover letter. - Add tests. - Link to v4: https://lore.kernel.org/r/20240107-pvpanic-shutdown-v4-0-81500a7e4081@t-8ch.de Changes in v4: - Rebase on 8.2 master - Resend after tree reopened and holidays - Link to v3: https://lore.kernel.org/r/20231129-pvpanic-shutdown-v3-0-c9a2892fc523@t-8ch.de Changes in v3: - Drop from Linux imported pvpanic header as discussed with Cornelia and requested by Greg - Link to v2: https://lore.kernel.org/r/20231128-pvpanic-shutdown-v2-0-830393b45cb6@t-8ch.de Changes in v2: - Remove RFC status - Add Ack from Thomas to 2nd patch - Fix typo in title of 2nd patch - Link to v1: https://lore.kernel.org/r/20231104-pvpanic-shutdown-v1-0-02353157891b@t-8ch.de --- Alejandro Jimenez (1): pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal Thomas Weißschuh (5): linux-headers: drop pvpanic.h hw/misc/pvpanic: centralize definition of supported events tests/qtest/pvpanic: use centralized definition of supported events hw/misc/pvpanic: add support for normal shutdowns tests/qtest/pvpanic: add tests for pvshutdown event docs/specs/pvpanic.rst | 2 ++ hw/misc/pvpanic-isa.c | 3 +-- hw/misc/pvpanic-pci.c | 3 +-- hw/misc/pvpanic.c | 8 ++++-- include/hw/misc/pvpanic.h | 5 ++++ include/standard-headers/linux/pvpanic.h | 9 ------- include/sysemu/runstate.h | 1 + qapi/run-state.json | 14 ++++++++++ scripts/update-linux-headers.sh | 3 +-- system/runstate.c | 6 +++++ tests/qtest/pvpanic-pci-test.c | 44 ++++++++++++++++++++++++++++++-- tests/qtest/pvpanic-test.c | 34 ++++++++++++++++++++++-- 12 files changed, 111 insertions(+), 21 deletions(-) --- base-commit: 11be70677c70fdccd452a3233653949b79e97908 change-id: 20231104-pvpanic-shutdown-02e4b4cb4949 Best regards,