From nobody Mon Oct 07 17:00:00 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XMlkn0Nj2z5YQxB; Mon, 07 Oct 2024 17:00:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XMlkm6yt9z4d9Q; Mon, 7 Oct 2024 17:00:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728320401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4m02/wxfX66g7jKkCREU2s+Me2uNc0WhfVLTnmI2tZI=; b=hga4s3ee2ijDtFVY5NshDU/0bzd7NNtk5ZA3wZLUQ+nhSvls1GJ2kblsu4DA3gJZWBxtLF BByn9ZVBPxYrtBIetJqvTCTG3DB8V+HAMxnTKBkS9JgpfUz2HScACyRum4cPmO0ipbIR6B WKhWobXSDslEMvsRJHLqh8KlTTKqQx7ZJR0IEToA+Ieu102kWM9bAdqjDVG0B6X+uhdY7o MrX1aF3euWW+jyhUhS7Zgmeeat+MkWC9QnT6947Ed8LaLat656VRIDFdQ7PXLDYY9lYUmF qOqvQJl11cntiuvTOVONsLG4ck72pIQRom06ei4AAbvUYn3IBpxxXSZned4KNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728320401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4m02/wxfX66g7jKkCREU2s+Me2uNc0WhfVLTnmI2tZI=; b=PaD1auaZND+GIrdoetmkYis6b7Iq+KrVRXwHC3YhkoYPycGC8UEmAYp0Cl2pGw3zsPY9oz 5xUOKz8bc9Ht22VJ9qGYmyaEpTnp8eIRyHC0knET9BsDvFU0vFCvR/32yx7zNVS/RjLDcQ rORVkaInLj+ATYy2ZztoLaaGoZrDTRp5GhPRtN60fpge/fm+LowkT/dHp5X0nBXoJPcjGy icke+O7lWb0IdP78bKFea5aVyqjK4ZeJWkyUXy/n45YkbTUqQ4MwK6Twud3x9EcYfi7Jd3 ojSx8hiAvQR77wOw6T6dKYioAavWDncXO/KbVJNraHHycgQJiXh1eHjP15AaLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728320401; a=rsa-sha256; cv=none; b=OgACx7JfGW2D1sswiLVDwZ+Q/DJf3RixhtGml/11JjlmqIw0GYnG/U7INJh+yrSHXbmjv/ 6zdU7eQaYO/wleypkbtk/SsDoXEEEMUIW5G9GDfvNrSaHvMOXnNHXKEfryPoKbJgziOaPH t9lvW8aXPtXxqWaF3hrc1ov/RzzB4DBpboqS3qhk9fsAXMD2oZKP+wWEho1CS8q0sIVbfm Cgu7F1rPiWJ6xfsKsdN29Ei5AF92SkQO9kO1dT/Wz8KV3PZlv7QHIUPese/06vl+gJwxaX wFFPn1WPVaSuM5Zd3F2wwYwsPf97tJn1DoJUJOiNmbR94z8Mse/DmtTtWPBz2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XMlkm6RzkzvRV; Mon, 7 Oct 2024 17:00:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 497H00TY004392; Mon, 7 Oct 2024 17:00:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 497H007m004367; Mon, 7 Oct 2024 17:00:00 GMT (envelope-from git) Date: Mon, 7 Oct 2024 17:00:00 GMT Message-Id: <202410071700.497H007m004367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau =?utf-8?Q?Monn=C3=A9?= Subject: git: 9dd5105f22a2 - main - xen: expose support for poweroff/reboot/suspend on xenbus List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dd5105f22a2276cf099f0e10e318294fcc4f6a7 Auto-Submitted: auto-generated The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=9dd5105f22a2276cf099f0e10e318294fcc4f6a7 commit 9dd5105f22a2276cf099f0e10e318294fcc4f6a7 Author: Roger Pau Monné AuthorDate: 2024-09-30 17:27:56 +0000 Commit: Roger Pau Monné CommitDate: 2024-10-07 16:59:45 +0000 xen: expose support for poweroff/reboot/suspend on xenbus Some toolstacks won't attempt the signal power actions on xenbus unless the VM explicitly exposes support for them. FreeBSD supports all power actions, hence signal on xenbus such support by setting the nodes to the value of "1". Sponsored by: Cloud Software Group Reviewed by: markj Differential review: https://reviews.freebsd.org/D46859 --- sys/dev/xen/control/control.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 1dc1df935b84..4601db70ef16 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -394,6 +394,20 @@ xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len) } /*------------------ Private Device Attachment Functions --------------------*/ + +static void +notify_support(void) +{ + /* + * Notify kernel is ready to handle "control/shutdown" events. Ignore + * errors if the nodes haven't been created by the toolstack, as the + * parent "control" directory should be read-only for the guest. + */ + xs_write(XST_NIL, "control", "feature-poweroff", "1"); + xs_write(XST_NIL, "control", "feature-reboot", "1"); + xs_write(XST_NIL, "control", "feature-suspend", "1"); +} + /** * \brief Identify instances of this device type in the system. * @@ -455,6 +469,8 @@ xctrl_attach(device_t dev) EVENTHANDLER_REGISTER(shutdown_final, xctrl_shutdown_final, NULL, SHUTDOWN_PRI_LAST); + notify_support(); + return (0); } @@ -479,6 +495,14 @@ xctrl_detach(device_t dev) return (0); } +static int +xctrl_resume(device_t dev) +{ + notify_support(); + + return (0); +} + /*-------------------- Private Device Attachment Data -----------------------*/ static device_method_t xctrl_methods[] = { /* Device interface */ @@ -486,6 +510,7 @@ static device_method_t xctrl_methods[] = { DEVMETHOD(device_probe, xctrl_probe), DEVMETHOD(device_attach, xctrl_attach), DEVMETHOD(device_detach, xctrl_detach), + DEVMETHOD(device_resume, xctrl_resume), DEVMETHOD_END };