From patchwork Mon May 13 19:22:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 164057 Delivered-To: patches@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1728376ili; Mon, 13 May 2019 12:23:21 -0700 (PDT) X-Received: by 2002:a19:9f01:: with SMTP id i1mr13971956lfe.98.1557775401147; Mon, 13 May 2019 12:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557775401; cv=none; d=google.com; s=arc-20160816; b=OmA1zewHfpxkNvnlEI3j+l1g9tYS3idEnDE7zhMHNsSGTGg260RBTAnTYGgH1VfOZ7 2D6SbHq5IESMA4FhwVH3847z8gIc/VrXx/7kVx+vwt/90o1f/qrVM1mIj1cVMo6ftL9I i8xFpH5UiqMFFlXYI3YKI2Vx22dNHsAO7TmtQsZH1ICjBF0JSjjlicjwNJPXQHgpFjFi F07BPWYYP88OzC7TO7F9922kFx52m2saRzTtU/hbDNng1CNQqsBsgF6fnHumM5pydC9f c3xdqX4lHylt2TZRWA+0Hcctz03bJfBCTQXcUgctmnIAxbKS8Fd4e8+Z4s4hhc4sOEZK AGjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tL+sK5pEBsAoCFopnPPwt4es9T7EwxPGgYEkm8O7IBI=; b=u9illhJ1WvKn7gMkWKIKxqP9HPMb7tCICnzvHnwJ2L8hQt/RKpyXq4qdLwsyD40gGo eDNn5pJYY71g8NxCo9PuCUZC/Sjv3P1fQrG1nuYLMOTSO8qcdQmy0kDp7vyhb3BetVDV CzKVXNjR3TVZ5n3sKMvT4d5e8/seCNopZ08hoCOFuTapVwx0SR6ScPuwY2+3sAINa0Cd 1mtddmQ55eilbM2p1KAcRCMKQ5r8aZ0nvvEZbT1QtYTIglvdEG6b1m23q5bFSpHAN7Nt D/zP0RqvFqLnOGDl70D4cYuFj+0NwNK7quYRUVPWuwXECPzs0ComKp9331l59nYIDSkn qpCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PleXZ03X; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m80sor2938830lje.32.2019.05.13.12.23.20 for (Google Transport Security); Mon, 13 May 2019 12:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PleXZ03X; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tL+sK5pEBsAoCFopnPPwt4es9T7EwxPGgYEkm8O7IBI=; b=PleXZ03XqpXkNBmDfAycSfGQdOAnwKcgjPE/yvddT6ahyVQYQIimbvzlM0ZT24i2e5 LUFZWo+Tdttrv0PhN9+zyZsiyAIl0piyFql/WuOFoJwf6rT/ApfowwA2yVJk5ycqSnHJ tVjZQ/8bSIufYfq7D+pcmCxP7awzaUFp1ndubavu4Rg3LGgEgIDKhT1v5im0eJXErzwM yeE7sM0FGOsZqtCWMwGXPx4qW6dtJwALcEcJrbDFKC6sEY00Uvvm8/vcCf8KVozLm45m GNwRj8IB28P/Qgq9gd8i2bHXXGget+HBMR2KuUq4pUtz49trTZoVO+c/X53DLD2flOHv U9zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tL+sK5pEBsAoCFopnPPwt4es9T7EwxPGgYEkm8O7IBI=; b=iYS/4mE9xTR7pEGEflpKb2QSs3opovaQnzne9Vmp/jxZzKKizocv+u39+icHGj38By ZgoVPpAlUSr8NQk4N9lzf7jn4zNQlqLW9Dgz2bHiDIOnRX79mncb2kKJKg6U4mUsTJWv 6pGbfYUsCFzV6Qsby7Wj0exjd3QGVvlwBkm6PCUXFMmQZua4W7tPeh3JBQwpB9bMuuK0 gz+JyyRMVR3b12oD/cYK++bqmb8JTy04zVaHoVCEGH4zPs+9s8hvAEVvJDUjzK69III4 pEPPwr4FVA2E6O5dsBLrxcmrZH6B4dqaU9a1NX0Wu6c9phOrcI5HTyYCh/pPnQjWLFyE 11bQ== X-Gm-Message-State: APjAAAUbCc7D99fX3MC5r6JrcJz/nCCGgyLZoyNjgmTnYhS87ZITejoc zLAhZBMgJwVFjEiEat0GU0SYqUB+ X-Google-Smtp-Source: APXvYqx4whMnRpTm4m80h2xmvQbwZJE+FnBv/f7E0p3WgnHRPkfQ9mN1Bj/AUSzvNa+UTmcvCbPkvw== X-Received: by 2002:a2e:81cf:: with SMTP id s15mr14626643ljg.193.1557775400776; Mon, 13 May 2019 12:23:20 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id q21sm3449365lfa.84.2019.05.13.12.23.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 12:23:19 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-arm-kernel@lists.infradead.org Cc: "Rafael J . Wysocki" , Daniel Lezcano , "Raju P . L . S . S . S . N" , Amit Kucheria , Bjorn Andersson , Stephen Boyd , Niklas Cassel , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , Souvik Chakravarty , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH 08/18] drivers: firmware: psci: Prepare to support PM domains Date: Mon, 13 May 2019 21:22:50 +0200 Message-Id: <20190513192300.653-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190513192300.653-1-ulf.hansson@linaro.org> References: <20190513192300.653-1-ulf.hansson@linaro.org> Subsequent changes implements support for PM domains to PSCI. Those changes are mainly implemented in a new separate c-file, hence a couple of the internal PSCI functions needs to be shared to be accessible. Let's do that via adding a new PSCI header file. Moreover, to implement support for PM domains, switching the PSCI FW into the OS initiated mode is sometimes needed. Therefore, let's share a new function that implement this. Signed-off-by: Ulf Hansson --- Changes: - Convert psci_set_osi_mode() to return an int. - Don't share psci_get_domain_state() as that's no longer needed. - Update changelog. --- drivers/firmware/psci/psci.c | 17 ++++++++++++++--- drivers/firmware/psci/psci.h | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 drivers/firmware/psci/psci.h -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 4aec513136e4..0e91d864e346 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -34,6 +34,8 @@ #include #include +#include "psci.h" + /* * While a 64-bit OS can make calls with SMC32 calling conventions, for some * calls it is necessary to use SMC64 to pass or return 64-bit values. @@ -96,7 +98,7 @@ static inline bool psci_has_ext_power_state(void) PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; } -static inline bool psci_has_osi_support(void) +bool psci_has_osi_support(void) { return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; } @@ -161,6 +163,15 @@ static u32 psci_get_version(void) return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0); } +int psci_set_osi_mode(void) +{ + int err; + + err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE, + PSCI_1_0_SUSPEND_MODE_OSI, 0, 0); + return psci_to_linux_errno(err); +} + static int psci_cpu_suspend(u32 state, unsigned long entry_point) { int err; @@ -292,12 +303,12 @@ static inline u32 psci_get_domain_state(void) return __this_cpu_read(domain_state); } -static inline void psci_set_domain_state(u32 state) +void psci_set_domain_state(u32 state) { __this_cpu_write(domain_state, state); } -static int psci_dt_parse_state_node(struct device_node *np, u32 *state) +int psci_dt_parse_state_node(struct device_node *np, u32 *state) { int err = of_property_read_u32(np, "arm,psci-suspend-param", state); diff --git a/drivers/firmware/psci/psci.h b/drivers/firmware/psci/psci.h new file mode 100644 index 000000000000..f2277c3ad405 --- /dev/null +++ b/drivers/firmware/psci/psci.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __PSCI_H +#define __PSCI_H + +struct device_node; + +int psci_set_osi_mode(void); +bool psci_has_osi_support(void); + +#ifdef CONFIG_CPU_IDLE +void psci_set_domain_state(u32 state); +int psci_dt_parse_state_node(struct device_node *np, u32 *state); +#endif + +#endif /* __PSCI_H */