From patchwork Fri Feb 27 20:47:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 45263 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42C56204BC for ; Fri, 27 Feb 2015 20:47:46 +0000 (UTC) Received: by lbvp9 with SMTP id p9sf16265693lbv.1 for ; Fri, 27 Feb 2015 12:47:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=vPG8PxJiqpkkzRdAgG0jO6L+MRstyRQvtjb2CcYNMGk=; b=fCyp3u569ThQroLq4PaCVTQVakdpD9axw6RmxCHrXfZn7DfmDZ5MUeXonqohzQvpzF Gr9CsQ4HsvJpLQ1JxzOGqmzEXYrx065X4DUdMcYWA11njLgAxnqY+Ti+bWWHP/HWgAF/ 6jHv0zWtSD9zW5evYZGZmFYS9SIqV6f2kQlrGnHufoW2fqSr2Du6e9eH5B9ugI8WBKvI AHVCv884bUbVwPO5GG5Z+Zh/1WokM9WWzvbMaQs1JiUiAeuQHHq9tIifKc4Gc8CbotUt UZ235vsQzxjLzTmpCEhNcp+Fq9gqY4m/x0Th4V57K4EdxQ7rrYjFu23mTo/s0IJT3m4N bC1w== X-Gm-Message-State: ALoCoQluzUdFq1NlsmEhrwr1DmhDHcMN1Rp46m15sGM5nZJ4QWvtq/8TViA3bebD34TvS0+7Xlh+ X-Received: by 10.112.9.65 with SMTP id x1mr2380956lba.16.1425070065246; Fri, 27 Feb 2015 12:47:45 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.229 with SMTP id db5ls242893lac.49.gmail; Fri, 27 Feb 2015 12:47:44 -0800 (PST) X-Received: by 10.152.207.72 with SMTP id lu8mr9714777lac.90.1425070064867; Fri, 27 Feb 2015 12:47:44 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id g12si3796635lbz.5.2015.02.27.12.47.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Feb 2015 12:47:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbiv13 with SMTP id v13so963837lbi.1 for ; Fri, 27 Feb 2015 12:47:44 -0800 (PST) X-Received: by 10.112.211.200 with SMTP id ne8mr14209163lbc.73.1425070064527; Fri, 27 Feb 2015 12:47:44 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp4147391lbj; Fri, 27 Feb 2015 12:47:43 -0800 (PST) X-Received: by 10.68.211.228 with SMTP id nf4mr27304454pbc.66.1425070062791; Fri, 27 Feb 2015 12:47:42 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg6si5660667pdb.151.2015.02.27.12.47.41; Fri, 27 Feb 2015 12:47:42 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754794AbbB0Urj (ORCPT + 11 others); Fri, 27 Feb 2015 15:47:39 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:45469 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753340AbbB0Uri (ORCPT ); Fri, 27 Feb 2015 15:47:38 -0500 Received: by pdjz10 with SMTP id z10so23530078pdj.12 for ; Fri, 27 Feb 2015 12:47:38 -0800 (PST) X-Received: by 10.66.159.138 with SMTP id xc10mr26925426pab.141.1425070058485; Fri, 27 Feb 2015 12:47:38 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by mx.google.com with ESMTPSA id uy8sm4822021pbc.31.2015.02.27.12.47.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Feb 2015 12:47:37 -0800 (PST) From: Lina Iyer To: galak@codeaurora.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, agross@codeaurora.org Cc: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, khilman@linaro.org, Lina Iyer Subject: [PATCH v2] qcom: scm: Add qcom_scm_set_warm_boot_addr function Date: Fri, 27 Feb 2015 13:47:27 -0700 Message-Id: <1425070047-53449-1-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lina.iyer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , A core can be powered down for cpuidle or when it is hotplugged off. In either case, the warmboot return address would be different. Allow setting the warmboot address for a specific cpu, optimize and write to the firmware, if the address is different than the previously set address. Export qcom_scm_set_warm_boot_addr function move the warm boot flags to implementation. Signed-off-by: Lina Iyer --- drivers/firmware/qcom_scm.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/qcom_scm.h | 5 +---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 6e7a72b..19133ca 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -34,6 +34,23 @@ #define QCOM_SCM_ERROR -1 #define QCOM_SCM_INTERRUPTED 1 +#define QCOM_SCM_FLAG_WARMBOOT_CPU0 0x04 +#define QCOM_SCM_FLAG_WARMBOOT_CPU1 0x02 +#define QCOM_SCM_FLAG_WARMBOOT_CPU2 0x10 +#define QCOM_SCM_FLAG_WARMBOOT_CPU3 0x40 + +struct scm_warmboot { + int flag; + void *entry; +}; + +static struct scm_warmboot scm_flags[] = { + { .flag = QCOM_SCM_FLAG_WARMBOOT_CPU0 }, + { .flag = QCOM_SCM_FLAG_WARMBOOT_CPU1 }, + { .flag = QCOM_SCM_FLAG_WARMBOOT_CPU2 }, + { .flag = QCOM_SCM_FLAG_WARMBOOT_CPU3 }, +}; + static DEFINE_MUTEX(qcom_scm_lock); /** @@ -342,3 +359,22 @@ int qcom_scm_set_boot_addr(u32 addr, int flags) &cmd, sizeof(cmd), NULL, 0); } EXPORT_SYMBOL(qcom_scm_set_boot_addr); + +int qcom_scm_set_warm_boot_addr(void *entry, int cpu) +{ + int ret; + + /* + * Reassign only if we are switching from hotplug entry point + * to cpuidle entry point or vice versa. + */ + if (entry == scm_flags[cpu].entry) + return 0; + + ret = qcom_scm_set_boot_addr(virt_to_phys(entry), scm_flags[cpu].flag); + if (!ret) + scm_flags[cpu].entry = entry; + + return ret; +} +EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr); diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index 6bb84cf..fc5aae4 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -15,12 +15,9 @@ #define QCOM_SCM_FLAG_COLDBOOT_CPU1 0x01 #define QCOM_SCM_FLAG_COLDBOOT_CPU2 0x08 #define QCOM_SCM_FLAG_COLDBOOT_CPU3 0x20 -#define QCOM_SCM_FLAG_WARMBOOT_CPU0 0x04 -#define QCOM_SCM_FLAG_WARMBOOT_CPU1 0x02 -#define QCOM_SCM_FLAG_WARMBOOT_CPU2 0x10 -#define QCOM_SCM_FLAG_WARMBOOT_CPU3 0x40 extern int qcom_scm_set_boot_addr(u32 addr, int flags); +extern int qcom_scm_set_warm_boot_addr(void *entry, int cpu); #define QCOM_SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))