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=-13.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 46F6FC56202 for ; Thu, 26 Nov 2020 17:30:48 +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 B308D21D7F for ; Thu, 26 Nov 2020 17:30:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eFXZs8RM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="OTwG7pth" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B308D21D7F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=1NbqBiR/H8dUwRE7ldaf/rEtVO2RMg+SAm9pV9p8uTQ=; b=eFXZs8RMEAXSY7/yxOrCsgSKt 1Qj7da1gWOnXXD/DPAh8B+nsfRtAyrLMLtFSvHGbEoLPiVXN5/zJi1xaLcrR2q1343aYA82qXu0OT Hf4lgdwJrx243Vqkrld4rUSuw3win5/t163JWgqpcU65YMZVgkL/FoM3mzZIsFcsybnVmklCIpSPa wOAj6gewP/V/ky/TEcpID1YbwqVsac9Ckdev0l2l7us0R9lTWJKLUMf/DlHK7DvceSSGufyrPqWEh ubmCPpgKtyAdM9T7T2sacolH+ApHu6HlxaWIeQAsEp3h2GYeg6eGdwNqnRGB856IONUgJV9MkiSq9 PzWBqXbgA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiL5M-00006g-Aq; Thu, 26 Nov 2020 17:29:36 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiL5K-000062-5r for linux-arm-kernel@lists.infradead.org; Thu, 26 Nov 2020 17:29:34 +0000 Received: by mail-wm1-x344.google.com with SMTP id g25so993761wmh.1 for ; Thu, 26 Nov 2020 09:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eNmmYIntQD41kP5Sy+k/QWgGU3OC7ECA76To2f6sO84=; b=OTwG7pthwmbnQa4O4pEKQm3r7t+DfZH8/A814vskFeIwb1FswL2ou7mn064m+b6JOW ATuWhxu9ybb+JUMtcNuHn9iSPGGKMpNnuEvEaS18eW3zmdEEu55d6WTGi+7xbSMgFQWp EAe58Ogmc6EQdiNxH5da82B8tRgtKqIKsJQ4UgW/7kqj5a6FUqk0iqGtQnHOdRj/rJLI 74XACjmqHWKIsHrhYhyE9sV6/lq+bvG/IH/hWft2e+793kU22Nu/UEN/rrbVQK6wZ+3m fqp/0IH4Z77e15TKRtrkLfcPNbbvcsWtK3G4DfrNsxurhbPDGuxcE766h35FrLx42G5m jhHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eNmmYIntQD41kP5Sy+k/QWgGU3OC7ECA76To2f6sO84=; b=Rf11rgLG6d5/lUItOaMP0kRIam3Ii5PMWF9QegxznSqMtpho6E3Gn9PWFaIqen9bbq aSHHH3m2VFTLTg2495P/tCkoQmuqqBE7Tw2AN4OrRZEY6YVodV3RAiXb3a8NFi8oCF5s KDQmkCh+vitxa5KgPH1SVmRbuZ3kCTJkHxyna76zJJHpuKN+Ui9+nSocehE82bmiQ1HM 1fRwtz7p9S7dPXCdu4sN+0e4t/5MGpZSF44VnP0gj2KGbs8B3YBUcqdsgYOY6GIHl2gp 6VHZlDTn1SEphQafpYvbjEvGq/9okqX1ARTwuExRmgqZseJIe9TbHgmCCaFOzKOhbCvq 7RbQ== X-Gm-Message-State: AOAM530dawo2tyuHWAJMPfqWIuU82MvO+KrJtvs+LtGrP3Fkx0WJteTb FMCXuLCoRVn3nmZLUZr77eS6/Q== X-Google-Smtp-Source: ABdhPJza6j04qFmVsjgAU43nbnlurhLEdweYclMbOSTmqBBsojLWwg3BqabR7gpjOx4N8c/OCFiJaA== X-Received: by 2002:a7b:c319:: with SMTP id k25mr4627247wmj.65.1606411772607; Thu, 26 Nov 2020 09:29:32 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:4ca8:e54e:96f6:f182]) by smtp.gmail.com with ESMTPSA id c64sm9074091wmd.41.2020.11.26.09.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 09:29:31 -0800 (PST) Date: Thu, 26 Nov 2020 17:29:30 +0000 From: David Brazdil To: Mark Rutland Subject: Re: [PATCH v3 02/23] psci: Accessor for configured PSCI function IDs Message-ID: <20201126172930.i63yemxpc5r3mqpq@google.com> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-3-dbrazdil@google.com> <20201126172450.GC38486@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201126172450.GC38486@C02TD0UTHF1T.local> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201126_122934_286750_BA2F2E65 X-CRM114-Status: GOOD ( 27.35 ) 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: Lorenzo Pieralisi , kernel-team@android.com, Jonathan Corbet , Catalin Marinas , Suzuki K Poulose , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , James Morse , linux-arm-kernel@lists.infradead.org, Marc Zyngier , Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hey Mark, On Thu, Nov 26, 2020 at 05:24:50PM +0000, Mark Rutland wrote: > 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 > > 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]; > > +} > > I'd really like if we could namespace this with a psci_0_1_* prefix > before we expose it outside of the PSCI code. I appreciate that's a > larger change, but I reckon we only need a couple of new patches: > > 1) Split the ops which consume the FN ids into separate psci_0_1_*() and > psci_0_2_*() variants, with a common __psci_*() helper that takes the > function ID as an argument. The 0_1 variants would read the function > ID from a variable, and the 0_2 variants would hard-code the id. > > 2) Replace the psci_function_id array with: > > struct psci_0_1_function_ids { > u32 suspend; > u32 cpu_on; > u32 cpu_off; > u32 migrate; > }; > > ... and remove enum psci_function entirely. > > 3) Add a helper which returns the entire psci_0_1_function_ids struct in > one go. No warnings necessary. > > Does that sound OK to you? Sure, sounds easy enough and 2) is in line with how I structured the handlers in KVM. Thanks, David _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel