From patchwork Sun Feb 10 23:12:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Menefy X-Patchwork-Id: 10804969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACD5B14E1 for ; Sun, 10 Feb 2019 23:12:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9305029ABD for ; Sun, 10 Feb 2019 23:12:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8476629ABF; Sun, 10 Feb 2019 23:12:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E4FE29ABD for ; Sun, 10 Feb 2019 23:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726243AbfBJXMQ (ORCPT ); Sun, 10 Feb 2019 18:12:16 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53943 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfBJXMQ (ORCPT ); Sun, 10 Feb 2019 18:12:16 -0500 Received: by mail-wm1-f65.google.com with SMTP id d15so14023243wmb.3 for ; Sun, 10 Feb 2019 15:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=oVLeNIK2v7xGD88oxSGqKlkJywd3+U5L9XFsrljhhLM=; b=hzcZ9rxz7nfFwp5Lv4608WnwEwk7Fn3pd2GWJSDGEN+TJ+1R0A4u4ErCW5Ryj9MkFT gzKSpCxjqeIKSvcgjj/adMTCZBkbtjnex89YR1xDWSq6S3++bZi+IoIda3R5JQP9K/3s rQmbDQ8XncYENJQIrlz9DAyyvv/lt+/aRLbs1T0TFm02ZmoEOTWw2rhkIEtSfmEnONs3 TkG4S+nHUTaV1oVBakOZdkDSIwrrgxPrmDgwrw1UZJyK8bqrzNb9JB9Nu93f0KGUwQMv fFHhZS43Unq8LTFf8+j7DBjenGD4UgGoAVmtvqD7AKI0/okoO2I6LoWqoqSxTJUfI6JO WZvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=oVLeNIK2v7xGD88oxSGqKlkJywd3+U5L9XFsrljhhLM=; b=U6YTWMBD8zcDBv25R1+8ykVW4PaOYv4UW8838J8Zzu/DKnD0Z55j2b/Bs6ae+/tI0Z KzjjtpZ9AbjfUVdHrfkVM9nBXOHV0NyQs815ntNgxE5TcHuB5/h/234lK/19MP5LOTpS mZKPbaANNqgMcCizGc2/FQMZdPJWiYvlatf3iSmPuwreNCRqhJoT6UpYh0ISkRvp/0kK T7Mi57EDr/puYyt2n3vD9booUI+M2ZYROKr/xpLEmS3qsw+Bg66BCJx9W1KixDokGTYY EJTrB8Q0umwJ2SVegBIfGGBvmePHa8e4GHgEA6DngPyluCN2BjBz9Ve4lMQKIyrYoCXK 0pUg== X-Gm-Message-State: AHQUAuZiaQQclI3jV40Da1U1jycT/HVCrkZ0A5KNi0Z8DrTxC4RrBLvc 6Z/IGDQpAd8FtK7O7RL6CADypg== X-Google-Smtp-Source: AHgI3IZ3Y2ayJZ8czzdu9TXxKnXntPmATptyuoV5GjnC7k5wWo+C4KDcl3pYAlxNRATx6ciESl446g== X-Received: by 2002:a1c:544f:: with SMTP id p15mr6992103wmi.37.1549840334025; Sun, 10 Feb 2019 15:12:14 -0800 (PST) Received: from localhost.localdomain (host86-176-243-198.range86-176.btcentralplus.com. [86.176.243.198]) by smtp.gmail.com with ESMTPSA id y22sm21101858wrd.45.2019.02.10.15.12.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Feb 2019 15:12:13 -0800 (PST) From: Stuart Menefy To: Russell King , Arnd Bergmann , Will Deacon , Nicolas Pitre , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] ARM: MCPM: Add provision for platform specific wfi alternative Date: Sun, 10 Feb 2019 23:12:12 +0000 Message-Id: <20190210231212.20470-1-stuart.menefy@mathembedded.com> X-Mailer: git-send-email 2.13.6 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On some platforms (in particular the Exynos5260) the wfi is not executed directly by the operating system but by trapping into the secure monitor. This allows us to replicate the behaviour of the vendor supplied kernel using the MCPM framework. Signed-off-by: Stuart Menefy --- arch/arm/common/mcpm_entry.c | 8 ++++++-- arch/arm/include/asm/mcpm.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c index ad574d20415c..524be627c87e 100644 --- a/arch/arm/common/mcpm_entry.c +++ b/arch/arm/common/mcpm_entry.c @@ -289,8 +289,12 @@ void mcpm_cpu_power_down(void) __mcpm_cpu_down(cpu, cluster); /* Now we are prepared for power-down, do it: */ - if (cpu_going_down) - wfi(); + if (cpu_going_down) { + if (platform_ops->wfi_alternative) + platform_ops->wfi_alternative(last_man); + else + wfi(); + } /* * It is possible for a power_up request to happen concurrently diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h index acd4983d9b1f..96fdb41ac626 100644 --- a/arch/arm/include/asm/mcpm.h +++ b/arch/arm/include/asm/mcpm.h @@ -223,6 +223,7 @@ struct mcpm_platform_ops { int (*cluster_powerup)(unsigned int cluster); void (*cpu_suspend_prepare)(unsigned int cpu, unsigned int cluster); void (*cpu_powerdown_prepare)(unsigned int cpu, unsigned int cluster); + void (*wfi_alternative)(bool last_man); void (*cluster_powerdown_prepare)(unsigned int cluster); void (*cpu_cache_disable)(void); void (*cluster_cache_disable)(void);