From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D1AA7C47DD9 for ; Fri, 22 Mar 2024 17:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D+HeGgtbPre+FJQomM79Kk36TcKuq3iVxHtcAbn7XFg=; b=XNTdCq9I1+XPM0 UmDQ8frw8y7620Y7sT13LqjWYGrCmcovZ5SHgIhZcoSAL8ckugZZtIv1Ay6+eFCiIl0jqqmxl3La9 8xHZv01sioEYST9kAmo8oH5Tu9LGJ2K7L5Hu73ZLIdQPjeYV+B98v+5fFb1dtZFLhKF7QmAWKL/rx uOlaQKhIzlwyY+qbuBvU/v4JFVbnDwU9OG5IArZiQvKhv3mb3rf7mzxWjJW0MTrMxcXJZ8GuyD+GT OlWhk1xVpYGUO+cwcz8b51RNqpp2fL+vt54QAM++scX79nEYewYGl+sY6cpNMFrBI+uZtjOKxZ1y/ 3bcreNiaZxdI4+54kHiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rniKb-000000084zL-2IEB; Fri, 22 Mar 2024 17:05:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rniKY-000000084xG-2bU5 for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2024 17:05:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 44C32FEC; Fri, 22 Mar 2024 10:05:53 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 34BE73F67D; Fri, 22 Mar 2024 10:05:16 -0700 (PDT) Date: Fri, 22 Mar 2024 17:05:13 +0000 From: Sudeep Holla To: Marc Zyngier Cc: David Woodhouse , linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Sudeep Holla , 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 , 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 v3 5/5] arm64: Use SYSTEM_OFF2 PSCI call to power off for hibernate Message-ID: References: <20240319130957.1050637-1-dwmw2@infradead.org> <20240319130957.1050637-6-dwmw2@infradead.org> <86jzluz24b.wl-maz@kernel.org> <9efb39597fa7b36b6c4202ab73fae6610194e45e.camel@infradead.org> <86edc2z0hs.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <86edc2z0hs.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240322_100522_786725_6D0EEEF3 X-CRM114-Status: GOOD ( 24.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Mar 22, 2024 at 04:37:19PM +0000, Marc Zyngier wrote: > On Fri, 22 Mar 2024 16:12:44 +0000, > David Woodhouse wrote: > > = > > On Fri, 2024-03-22 at 16:02 +0000, Marc Zyngier wrote: > > > On Tue, 19 Mar 2024 12:59:06 +0000, > > > David Woodhouse wrote: > > > = > > > [...] > > > = > > > > +static void __init psci_init_system_off2(void) > > > > +{ > > > > +=A0=A0=A0=A0=A0=A0=A0int ret; > > > > + > > > > +=A0=A0=A0=A0=A0=A0=A0ret =3D psci_features(PSCI_FN_NATIVE(1_3, SYS= TEM_OFF2)); > > > > + > > > > +=A0=A0=A0=A0=A0=A0=A0if (ret !=3D PSCI_RET_NOT_SUPPORTED) > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0psci_system_off2_supp= orted =3D true; > > > = > > > It'd be worth considering the (slightly broken) case where SYSTEM_OFF2 > > > is supported, but HIBERNATE_OFF is not set in the response, as the > > > spec doesn't say that this bit is mandatory (it seems legal to > > > implement SYSTEM_OFF2 without any hibernate type, making it similar to > > > SYSTEM_OFF). > > = > > Such is not my understanding. If SYSTEM_OFF2 is supported, then > > HIBERNATE_OFF *is* mandatory. > > = > > The next update to the spec is turning the PSCI_FEATURES response into > > a *bitmap* of the available features, and I believe it will mandate > > that bit zero is set. Correct, but we add a extra check as well to be sure even if it is mandated unless the spec relaxes in a way that psci_features(SYSTEM_OFF2) need not return the mandatory types in the bitmask which I doubt. Something like: if (ret !=3D PSCI_RET_NOT_SUPPORTED && (ret & BIT(PSCI_1_3_HIBERNATE_TYPE_OFF))) psci_system_off2_supported =3D true; This will ensure the firmware will not randomly set bit[0]=3D0 if in the future it support some newer types as well. I understand the kernel is not conformance test for the spec but in practice especially for such features and PSCI spec in particular, kernel has become defacto conformance for firmware developers which is sad. It some feature works in the kernel, the firmware is assumed to be conformant to the spec w.r.t the feature. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel