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=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 449ACC43381 for ; Mon, 1 Apr 2019 18:15:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1439F2133D for ; Mon, 1 Apr 2019 18:15:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NytHmByU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1439F2133D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=iki.fi Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=aqKmVDmayzmwCsXrJW0qA+KUvuLo1wvknxfN7v7QEss=; b=Nyt HmByU66qLTOnz7c/ADf22hJ25EX0y8URAmWyL+JUtvNmoiVIrBvRT49b61Yg+xSND8NSx1dKCo5Qw iRyst8hLOtOhscgMGDc4TfN8Do4Yb4YsplvwUvm6H+khQQc5YIC6py7kYy8HtZMUDRC8LsD93ovBe FSJMtt0NeqvdB2Vr0hxMSSGinhFmDBsqoE7thIi7MCNwcja1uj6MAYWN/PA1ytz+VNaV8Ff5yXVSK kxe2MZa7fzqI8fiaYVC9vuGFJEijNeFpEb/KMaIlYXMkSBqNHbS179pA0LL4gkYIixAQPwRXrP3/A 0t7KLdteH2j4swhdHVyDsknv76iVreg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Ss-0005zf-KE; Mon, 01 Apr 2019 18:15:22 +0000 Received: from emh07.mail.saunalahti.fi ([62.142.5.117]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Sp-0005yu-8S for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 18:15:21 +0000 Received: from localhost.localdomain (85-76-9-223-nat.elisa-mobile.fi [85.76.9.223]) by emh07.mail.saunalahti.fi (Postfix) with ESMTP id ABA4CB00A4; Mon, 1 Apr 2019 21:15:13 +0300 (EEST) From: Aaro Koskinen To: Mark Rutland , Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers: firmware: psci: add support for warm reset Date: Mon, 1 Apr 2019 21:14:43 +0300 Message-Id: <20190401181443.6459-1-aaro.koskinen@iki.fi> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_111519_491874_BE7C11FD X-CRM114-Status: GOOD ( 10.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aaro Koskinen MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Aaro Koskinen Add support for warm reset using SYSTEM_RESET2 introduced in PSCI 1.1 specification. Signed-off-by: Aaro Koskinen --- drivers/firmware/psci.c | 25 +++++++++++++++++++++++++ include/uapi/linux/psci.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index c80ec1d03274..1d95b5f6d403 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -73,6 +73,7 @@ enum psci_function { PSCI_FN_CPU_ON, PSCI_FN_CPU_OFF, PSCI_FN_MIGRATE, + PSCI_FN_SYSTEM_RESET2, PSCI_FN_MAX, }; @@ -256,6 +257,14 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); } +static void psci_sys_reset2(enum reboot_mode reboot_mode, const char *cmd) +{ + if (reboot_mode == REBOOT_WARM) + invoke_psci_fn(psci_function_id[PSCI_FN_SYSTEM_RESET2], 0, 0, 0); + else + psci_sys_reset(reboot_mode, cmd); +} + static void psci_sys_poweroff(void) { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); @@ -564,6 +573,20 @@ static void __init psci_0_2_set_functions(void) pm_power_off = psci_sys_poweroff; } +static void __init psci_1_1_set_functions(void) +{ + int sys_reset2; + int feature; + + sys_reset2 = PSCI_FN_NATIVE(1_1, SYSTEM_RESET2); + feature = psci_features(sys_reset2); + + if (feature != PSCI_RET_NOT_SUPPORTED) { + psci_function_id[PSCI_FN_SYSTEM_RESET2] = sys_reset2; + arm_pm_restart = psci_sys_reset2; + } +} + /* * Probe function for PSCI firmware versions >= 0.2 */ @@ -588,6 +611,8 @@ static int __init psci_probe(void) psci_init_smccc(); psci_init_cpu_suspend(); psci_init_system_suspend(); + if (PSCI_VERSION_MINOR(ver) >= 1) + psci_1_1_set_functions(); } return 0; diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b3bcabe380da..f36e616c3b3f 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -52,6 +52,9 @@ #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) +#define PSCI_1_1_FN_SYSTEM_RESET2 PSCI_0_2_FN(18) +#define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18) + /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 -- 2.17.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel