Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp386238lqt; Mon, 18 Mar 2024 10:32:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwHgtpnywPPxbBtbTnyF7JftmTlW8uwUU8tHoMt+j/LvJNufNs5TQZKgE5pPhQMT1GX24ipN4dL45kkwFlGg9xiwmYBfrZcq1awHPGLQ== X-Google-Smtp-Source: AGHT+IGU/1v0V5/HYRotXBPF2JWjr0dN87wXmSzPoJHR0BdzalEaxFo4WeZQUoUe82PbaIdzCtsM X-Received: by 2002:a05:6a00:3a12:b0:6e6:bfb6:371 with SMTP id fj18-20020a056a003a1200b006e6bfb60371mr15594463pfb.34.1710783146115; Mon, 18 Mar 2024 10:32:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710783146; cv=pass; d=google.com; s=arc-20160816; b=MK8KVhYTnsqXvtisVVxOLqdkGMW+7lSO9w47NfeZTXbO9TDBnG+v/HwX9CLiFYvfbv Y+8iQrFOcS8ZQa3EcFd8cUgMqipJqZNXBC/IF56LH5l+p/ZCqcN9mA+O5cQVkeCxxg0o Jz4eGndvLlAbeBuPfU3N47PqWEbFUvlrsXg2inimA8uWYJ8xSOG7SXLHNcmAfYoPju7p w33Rlg4mBcEZpvF0WFDLKlBo5+i1KpHDXf3EHlCpUf5acm95eAvAQ5Y0UPKxMgUoZ11a Bw86Hx8Ipe1Cmb8g1YgcTlIUao3qp6u0a+eyrdn4IEpittHEFCLS4zkCXyzkUjvw+KXY aAlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=GS2igQy9xkqi5GGszMnAr2nf7vVfOJIE/2pM7m5/3r0=; fh=/m/KvBm29e8C82BxLyQmZAabVpMOhKD/wkT2O8iGeDs=; b=I2LqIJGKAs8aEkOj6QDgZwhaWghul9KcF5hRlbnwyoMsMc1IKo7KkKrHRrcc3gBSlw mYsBMZd3B1SH/rJ8GeMHSdXUD4d/lQytV/pbGuTE+FCVf2gOIjjPhAmYzaARr0VP1cUd umXHF5MOt+D6ngiTjm0qyMwaRe0/az7OfHyQnB3Ejv5gWDgJ0q94xcyY8L5+KgihylFU FFC+LPZgM2lYNG8QmtMmhn6y3AtLIJkFEg3mf8b+xLYC6kO+H8j03gSR9VQg9eXWxpDC gciDFonTSeRWT4PTSkLRgGSu9TYSqGUx+20A6+M4hVO3YlCgmdOR0HRbfDdCCucMY4cN WeZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1gZduWK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id dq22-20020a056a020f9600b005cdacf9065fsi8451501pgb.720.2024.03.18.10.32.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 10:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1gZduWK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D0D1BB2283A for ; Mon, 18 Mar 2024 17:30:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69DDD55E6C; Mon, 18 Mar 2024 17:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p1gZduWK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68C0655E44; Mon, 18 Mar 2024 17:29:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710782987; cv=none; b=N/m1B0GQPgXd7k9w7e/Ae3GW0ypTGOb0hrcZZPMkH8OeUY/M6vwLv4xS4vuUMbaiuZjAfqQ9332g6+CbVoPaoYMxbHRUkKQZ68vkMvEVRSpDZiUNJCcuZdyjZSgKp2fv486elLs5xlI5PaEbCnVn8VADjAu0GKjI4Uwwvb4UJHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710782987; c=relaxed/simple; bh=jal3puy6u47/+391s6XpWyiWuhu3q01nkmau37uIYME=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=bzdhR3S+Q/PG1im1aulwCSu7TLj9gEH597lg5dQA5LShKaA9ycimpuDvNpHeGKYAJduoljxL4wqNRHeotIe5jU1ESnIcdumpdOmswI2BsOPSK0Ex/iSkCL3YhRpV+auvorqMsezLouqvu5X37hmJ9rnbaFWh74NNh7p5XPTw0Pg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p1gZduWK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD220C433C7; Mon, 18 Mar 2024 17:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710782985; bh=jal3puy6u47/+391s6XpWyiWuhu3q01nkmau37uIYME=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p1gZduWKJ+OsB7PpUBOfl31508AK96L5FBrCL0H/XXWtGumxroNXK4fUdOw8kC0q1 uju6AV9Agrt6SO4hDDdE2eQhlPMpPEKV6WE6bPz7EJiwJGX6yOpHj0cRswTrJBH4K+ b/yvojgx6wA1rUUbAjMb7YxGPs0Y2XcmUJhY7sp6JfxGDXDGPjdfCoINlOPvIKOXG6 iAWaAg+VAqMonfhucZTfckXPo6z7JlMKc80Tx0ipNh4w9OQSy06rkFHSxh6qixCr06 1mHToYqVMkuQBjNYsXLUjmgBrw3PJtNjgxapyMFMTu2vdjMVtpeClk3d5Oq2X68HiT +ZJH2U+5Vnncw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rmGnv-00DKyB-EO; Mon, 18 Mar 2024 17:29:43 +0000 Date: Mon, 18 Mar 2024 17:29:43 +0000 Message-ID: <86v85jzbw8.wl-maz@kernel.org> From: Marc Zyngier To: David Woodhouse Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Paolo Bonzini , Jonathan Corbet , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , "Rafael J. Wysocki" , Len Brown , Pavel Machek , David Woodhouse , Mostafa Saleh , Jean-Philippe Brucker , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-pm@vger.kernel.org Subject: Re: [RFC PATCH v2 2/4] KVM: arm64: Add PSCI SYSTEM_OFF2 function for hibernation In-Reply-To: <20240318164646.1010092-3-dwmw2@infradead.org> References: <20240318164646.1010092-1-dwmw2@infradead.org> <20240318164646.1010092-3-dwmw2@infradead.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz, dwmw@amazon.co.uk, smostafa@google.com, jean-philippe@linaro.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-pm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 18 Mar 2024 16:14:24 +0000, David Woodhouse wrote: > > From: David Woodhouse > > The PSCI v1.3 specification (alpha) adds support for a SYSTEM_OFF2 function > which is analogous to ACPI S4 state. This will allow hosting environments > to determine that a guest is hibernated rather than just powered off, and > ensure that they preserve the virtual environment appropriately to allow > the guest to resume safely (or bump the hardware_signature in the FACS to > trigger a clean reboot instead). > > The beta version will be changed to say that PSCI_FEATURES returns a bit > mask of the supported hibernate types, which is implemented here. > > Signed-off-by: David Woodhouse > --- > Documentation/virt/kvm/api.rst | 11 +++++++++ > arch/arm64/include/asm/kvm_host.h | 2 ++ > arch/arm64/include/uapi/asm/kvm.h | 6 +++++ > arch/arm64/kvm/arm.c | 5 +++++ > arch/arm64/kvm/psci.c | 37 +++++++++++++++++++++++++++++++ > include/uapi/linux/kvm.h | 1 + > 6 files changed, 62 insertions(+) > > diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst > index 0b5a33ee71ee..ff061b6a2393 100644 > --- a/Documentation/virt/kvm/api.rst > +++ b/Documentation/virt/kvm/api.rst > @@ -6761,6 +6761,10 @@ the first `ndata` items (possibly zero) of the data array are valid. > the guest issued a SYSTEM_RESET2 call according to v1.1 of the PSCI > specification. > > + - for arm64, data[0] is set to KVM_SYSTEM_EVENT_SHUTDOWN_FLAG_PSCI_OFF2 > + if the guest issued a SYSTEM_OFF2 call according to v1.3 of the PSCI > + specification. > + > - for RISC-V, data[0] is set to the value of the second argument of the > ``sbi_system_reset`` call. > > @@ -6794,6 +6798,13 @@ either: > - Deny the guest request to suspend the VM. See ARM DEN0022D.b 5.19.2 > "Caller responsibilities" for possible return values. > > +Hibernation using the PSCI SYSTEM_OFF2 call is enabled with the > +KVM_CAP_ARM_SYSTEM_OFF2 VM capability. If a guest invokes the PSCI > +SYSTEM_OFF2 function, KVM will exit to userspace with the > +KVM_SYSTEM_EVENT_SHUTDOWN event type and with data[0] set to > +KVM_SYSTEM_EVENT_SHUTDOWN_FLAG_PSCI_OFF2. The only supported hibernate > +type for the SYSTEM_OFF2 function is HIBERNATE_OFF (0x0). Again, I really oppose this way of doing things. We already have an infrastructure for selecting PSCI levels. You may not like it, but it exists, and I'm not going entertain supporting yet another bike-shed model. Adding an orthogonal cap for a feature that is specific to a new PSCI version is just awful. Please make PSCI 1.3 the only version of PSCI supporting suspend in a non-optional way, and be done with it. M. -- Without deviation from the norm, progress is not possible.