[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <378d3797a94df5df655d47b3bd733da8853cc2e4.camel@infradead.org>
Date: Fri, 27 Sep 2024 15:24:45 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Miguel Luis <miguel.luis@...cle.com>
Cc: Souvik Chakravarty <Souvik.Chakravarty@....com>, Paolo Bonzini
<pbonzini@...hat.com>, Jonathan Corbet <corbet@....net>, Marc Zyngier
<maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>, James Morse
<james.morse@....com>, Suzuki K Poulose <suzuki.poulose@....com>, Zenghui
Yu <yuzenghui@...wei.com>, Catalin Marinas <catalin.marinas@....com>, Will
Deacon <will@...nel.org>, Mark Rutland <mark.rutland@....com>, Lorenzo
Pieralisi <lpieralisi@...nel.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>, Shuah Khan
<shuah@...nel.org>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "kvmarm@...ts.linux.dev"
<kvmarm@...ts.linux.dev>, "linux-pm@...r.kernel.org"
<linux-pm@...r.kernel.org>, "linux-kselftest@...r.kernel.org"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH v4 1/6] firmware/psci: Add definitions for PSCI v1.3
specification
On Fri, 2024-09-27 at 12:43 +0000, Miguel Luis wrote:
>
> The common factor being the bit offset in the bitmap for SYSTEM_OFF2 discovery
> and argument to call SYSTEM_OFF2 as well. Would it be clearer something like:
>
> #defineĀ PSCI_1_3_HIBERNATE_TYPE_OFF BIT(0)
I've updated the tree at
https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/psci-hibernate
to do it that way.
As I did so, I realised that KVM *does* care about the argument to
SYSTEM_OFF2. This is a straight copy of the SYSTEM_RESET2 handling.
Although it doesn't pass the argument up to userspace (presumably
userspace is expected to look at the registers if it cares), it *does*
check it's within the range of permitted values and return
PSCI_RET_INVALID_PARAMS if not.
I've changed that check to:
arg = smccc_get_arg1(vcpu);
/*
* Permit zero to mean HIBERNATE_OFF as well as the bitmap
* form which was introduced in PSCI v1.3 beta.
*/
if (arg && arg != PSCI_1_3_HIBERNATE_TYPE_OFF) {
val = PSCI_RET_INVALID_PARAMS;
break;
}
kvm_psci_system_off2(vcpu);
On the guest side, I've changed the invocation to:
static int psci_sys_hibernate(struct sys_off_data *data)
{
/*
* Zero is an acceptable alternative to PSCI_1_3_HIBERNATE_TYPE_OFF
* and is supported by hypervisors implementing an earlier version
* of the pSCI v1.3 spec.
*/
if (system_entering_hibernation())
invoke_psci_fn(PSCI_FN_NATIVE(1_3, SYSTEM_OFF2),
0 /*PSCI_1_3_HIBERNATE_TYPE_OFF*/, 0, 0);
return NOTIFY_DONE;
}
I'm going to do some careful interop testing with existing and new
hypervisors before reposting this version.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists