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 X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82B48C4742C for ; Tue, 10 Nov 2020 14:43:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1308020678 for ; Tue, 10 Nov 2020 14:43:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2FmHEWNF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="SCPl37DM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1308020678 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A4TbktRkaxnsHuQ81xj2bzfWLBLRC8CDhlPuOMll1KY=; b=2FmHEWNFZAPdKsoLKUlsB0zcd wL5KvlqM6TuD+Q5FzcH4jwBze2S+9YgOL7GKY5ml0TiGIYXTENf1te6Hz+Izt37iDr5Xqt0SI+XuL K0G/gkekMtm2BnngfeGQC4jjRnCX95AfiXqn2QkrsB+MT1pDhbHr/hINeAPiIWo1ieWNVvD77ODMR sz6CKQ+MZq2Hcs/HA0M9ETLRzogQAV9yyC+oOnUELsuSZd83MusonqbcVtesSlckeVnEdh5P3Gt5Z 9BzAM20nT+A49FrKxd+l9C3HNYpGWS/dhNHPdYLdNPHd/FDgCcDCM980roTcdFvOUYJwKNBo6MD07 TTG9Zj55g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcUrU-0004Dm-KH; Tue, 10 Nov 2020 14:43:08 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcUrR-0004D7-5e for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 14:43:06 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1149320678; Tue, 10 Nov 2020 14:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605019384; bh=xRxv/AUxy4vi7s0st2HDTl3DqkNZPZIv8nBqNrHDOhQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SCPl37DM9sd5XiKV8yicyvZuiaMVl2SaLBgBrewwLevvpurSVI2lwFyDBnprrk/k4 ASh85QC3keK9wqhH8bTbXss2eRHeFtiuKpu5lM0LYY/d9mnP213EO6M+NAgFC98Zdu vBBvpW9UGfMrU/MCTZdaTlajV3A8/v2Fskckw4Ck= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcUrN-009Ta1-P7; Tue, 10 Nov 2020 14:43:02 +0000 MIME-Version: 1.0 Date: Tue, 10 Nov 2020 14:43:01 +0000 From: Marc Zyngier To: David Brazdil Subject: Re: [PATCH v1 01/24] psci: Accessor for configured PSCI version In-Reply-To: <20201109113233.9012-2-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-2-dbrazdil@google.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, qperret@google.com, ascull@google.com, qwandor@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_094305_398312_07BEEE9D X-CRM114-Status: GOOD ( 26.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Suzuki K Poulose , Catalin Marinas , Quentin Perret , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry , Andrew Scull Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-11-09 11:32, David Brazdil wrote: > The version of PSCI that the kernel should use to communicate with > firmware is typically obtained from probing PSCI_VERSION. However, that > doesn't work for PSCI v0.1 where the host gets the information from > DT/ACPI, or if PSCI is not supported / was disabled. > > KVM's host PSCI proxy needs to be configured with the same version > used by the host driver. Expose the PSCI version used by the host > with a read-only accessor. > > Signed-off-by: David Brazdil > --- > drivers/firmware/psci/psci.c | 11 +++++++++++ > include/linux/psci.h | 8 ++++++++ > 2 files changed, 19 insertions(+) > > diff --git a/drivers/firmware/psci/psci.c > b/drivers/firmware/psci/psci.c > index 00af99b6f97c..bc1b2d60fdbf 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -49,6 +49,13 @@ static int resident_cpu = -1; > struct psci_operations psci_ops; > static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE; > > +static int driver_version = PSCI_VERSION(0, 0); > + > +int psci_driver_version(void) > +{ > + return driver_version; > +} > + > bool psci_tos_resident_on(int cpu) > { > return cpu == resident_cpu; > @@ -461,6 +468,8 @@ static int __init psci_probe(void) > return -EINVAL; > } > > + driver_version = ver; > + > psci_0_2_set_functions(); > > psci_init_migrate(); > @@ -514,6 +523,8 @@ static int __init psci_0_1_init(struct device_node > *np) > > pr_info("Using PSCI v0.1 Function IDs from DT\n"); > > + driver_version = PSCI_VERSION(0, 1); > + > if (!of_property_read_u32(np, "cpu_suspend", &id)) { > psci_function_id[PSCI_FN_CPU_SUSPEND] = id; > psci_ops.cpu_suspend = psci_cpu_suspend; > diff --git a/include/linux/psci.h b/include/linux/psci.h > index 2a1bfb890e58..5b5dcf176aa6 100644 > --- a/include/linux/psci.h > +++ b/include/linux/psci.h > @@ -21,6 +21,14 @@ bool psci_power_state_is_valid(u32 state); > int psci_set_osi_mode(bool enable); > bool psci_has_osi_support(void); > > +/** > + * The version of the PSCI specification followed by the driver. > + * This is equivalent to calling PSCI_VERSION except: > + * (a) it also works for PSCI v0.1, which does not support > PSCI_VERSION, and > + * (b) it is set to v0.0 if the PSCI driver was not initialized. > + */ > +int psci_driver_version(void); > + > struct psci_operations { > u32 (*get_version)(void); > int (*cpu_suspend)(u32 state, unsigned long entry_point); I still maintain that populating .get_version in all cases instead of duplicating an existing functionality is a better outcome. PSCI not supported would be implied by .get_version being NULL. What breaks? M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel