Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1154509pxu; Fri, 27 Nov 2020 00:38:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxz102TLnPmV1yqtrIznQOv2IhYnkbwg/gInf81OdGkvUent0zgJ6/3SJ3u1zjSE4MrdaBk X-Received: by 2002:a17:906:7813:: with SMTP id u19mr6520591ejm.153.1606466325743; Fri, 27 Nov 2020 00:38:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606466325; cv=none; d=google.com; s=arc-20160816; b=vUTGX/gChYFSzgNHhFVTU/esCPRDt9sgDKrJC2gb2MugsyJAQirEHIoIopCr8CMEBp Xx+wEBiIUC/Kj2uu2YcqsklDog06D2WIRjZs2ohvrIfbcL4zwMQGgDDCmXyFKDEBKLQZ jENHsVnCB60LQgxt2lpIrwvXm5fzVx5pCWa7ReQFiqm16sa7h9AgMxc3b89y3uLyncXu lcC4TnFpBbPu4QQFlnCgvBHAYaWbKQpKEIxiBrJxFu7Zx2ocCGDmGEkBKAv3EIy/A62p 8ktMh8w1akxRXeVBLE8956Y+dj/FbHH7vCJL6edbGcB5C5WRI9uakn0fYyERW+qt29Vk BzMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GSII7bvlukbZHPhfaVCPP9hPgpgmGMWcd9TPtAQTp9c=; b=H6f0DHNuz/LdVUHe4BaLjc2K+Iqh0RqSZohKnljUyRmfskO7FAF4xpWwpn+2JG/QrF pG27O3umNdNvTWnr+ct3HKXPio9HdApi+mfWbG8M/Fx+/6zLkiod1gBNBqqzCDK0Rsoc NZsyJ3EV8visfFA6lnQ5xNCvqRbseH86T6TUuFb1J3Hy0NIAIS6irx4rIOpRng61ugEW GNXL3fVYkAjzNyddJXqjk2gyYZNUIJSCZKjgbN6nGEwQkDkezjlVHf6KypVjIR1IwQdc 2wJR303vKk9CXbeP/Ni7PpfFce5PMTrIva3VDlgfM4NnTrK4jqUbQ5h1p6EIZBbvFwEk eioQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yd6si2091431ejb.595.2020.11.27.00.38.22; Fri, 27 Nov 2020 00:38:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391618AbgKZRet (ORCPT + 99 others); Thu, 26 Nov 2020 12:34:49 -0500 Received: from foss.arm.com ([217.140.110.172]:41564 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbgKZRet (ORCPT ); Thu, 26 Nov 2020 12:34:49 -0500 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 8D73D31B; Thu, 26 Nov 2020 09:34:48 -0800 (PST) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C9993F23F; Thu, 26 Nov 2020 09:34:46 -0800 (PST) Date: Thu, 26 Nov 2020 17:34:40 +0000 From: Lorenzo Pieralisi To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, Jonathan Corbet , Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Sudeep Holla , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com Subject: Re: [PATCH v3 02/23] psci: Accessor for configured PSCI function IDs Message-ID: <20201126173440.GA21563@e121166-lin.cambridge.arm.com> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-3-dbrazdil@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126155421.14901-3-dbrazdil@google.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 26, 2020 at 03:54:00PM +0000, David Brazdil wrote: > Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the Side note: in ACPI we don't support versions < 0.2, for commit log accuracy. Other than that I agree with Mark's change request. Thanks, Lorenzo > host is using PSCI v0.1, KVM's host PSCI proxy needs to use the same IDs. > Expose the array holding the information with a read-only accessor. > > Signed-off-by: David Brazdil > --- > drivers/firmware/psci/psci.c | 16 ++++++++-------- > include/linux/psci.h | 10 ++++++++++ > 2 files changed, 18 insertions(+), 8 deletions(-) > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 213c68418a65..40609564595e 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -58,16 +58,16 @@ typedef unsigned long (psci_fn)(unsigned long, unsigned long, > unsigned long, unsigned long); > static psci_fn *invoke_psci_fn; > > -enum psci_function { > - PSCI_FN_CPU_SUSPEND, > - PSCI_FN_CPU_ON, > - PSCI_FN_CPU_OFF, > - PSCI_FN_MIGRATE, > - PSCI_FN_MAX, > -}; > - > static u32 psci_function_id[PSCI_FN_MAX]; > > +u32 psci_get_function_id(enum psci_function fn) > +{ > + if (WARN_ON_ONCE(fn < 0 || fn >= PSCI_FN_MAX)) > + return 0; > + > + return psci_function_id[fn]; > +} > + > #define PSCI_0_2_POWER_STATE_MASK \ > (PSCI_0_2_POWER_STATE_ID_MASK | \ > PSCI_0_2_POWER_STATE_TYPE_MASK | \ > diff --git a/include/linux/psci.h b/include/linux/psci.h > index 2a1bfb890e58..5b49a5c82d6f 100644 > --- a/include/linux/psci.h > +++ b/include/linux/psci.h > @@ -21,6 +21,16 @@ bool psci_power_state_is_valid(u32 state); > int psci_set_osi_mode(bool enable); > bool psci_has_osi_support(void); > > +enum psci_function { > + PSCI_FN_CPU_SUSPEND, > + PSCI_FN_CPU_ON, > + PSCI_FN_CPU_OFF, > + PSCI_FN_MIGRATE, > + PSCI_FN_MAX, > +}; > + > +u32 psci_get_function_id(enum psci_function fn); > + > struct psci_operations { > u32 (*get_version)(void); > int (*cpu_suspend)(u32 state, unsigned long entry_point); > -- > 2.29.2.454.gaff20da3a2-goog >