From patchwork Wed Feb 25 22:54:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 45153 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C21BF20502 for ; Wed, 25 Feb 2015 22:54:51 +0000 (UTC) Received: by wesq59 with SMTP id q59sf5095339wes.2 for ; Wed, 25 Feb 2015 14:54:51 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=GtZgHCvk2gb35bBQ72eQE1MuizK3W8T3+AwimZm8tyo=; b=WQWw2uvcxzO80yi+n22YDLXoZ86LXWyRLi8dxgH1p9cN4Ce/llHGalcLN9OGdcL7wX 2Huu9KVNMpLtw26TvKPnFF8bb8DXMuSATNXxcKUHSrsbOeEe9YFXvvLz7sVhvSXnk7xg X9rNJWsNpTiJjg8iGSneLpxZPACzbNYX2vRVFXgjNSc0awlkI6isu5cqPRBD0+iL9xdH 97DfcxzbbcpObk9lga+ZWE96vNmRxIRFHBlkDzMWf/WcfryJgGle32GKn9BNItgiT0w1 p8fiE/b1ApX8e5ntgGw0c+wIV+MShN2nBCb+KSXbrHP//qCwyXw8fxj4d5tP5GAZcUFy ldoQ== X-Gm-Message-State: ALoCoQmyfRJfnl790aOFsEgGis3HJ4Fc2HwezluDyNhV5EJEF6Pw0MdWPCNkA94Q5E1J/yEVsyqg X-Received: by 10.180.182.44 with SMTP id eb12mr3258140wic.4.1424904891064; Wed, 25 Feb 2015 14:54:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.9 with SMTP id js9ls903820lab.69.gmail; Wed, 25 Feb 2015 14:54:50 -0800 (PST) X-Received: by 10.153.5.33 with SMTP id cj1mr4995836lad.66.1424904890899; Wed, 25 Feb 2015 14:54:50 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id g3si12801510lam.86.2015.02.25.14.54.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 14:54:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labhs14 with SMTP id hs14so7339190lab.4 for ; Wed, 25 Feb 2015 14:54:50 -0800 (PST) X-Received: by 10.152.115.136 with SMTP id jo8mr5148638lab.32.1424904890793; Wed, 25 Feb 2015 14:54:50 -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 h5csp2933316lbj; Wed, 25 Feb 2015 14:54:49 -0800 (PST) X-Received: by 10.68.201.168 with SMTP id kb8mr9319265pbc.89.1424904883720; Wed, 25 Feb 2015 14:54:43 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id au6si19704621pbd.192.2015.02.25.14.54.42; Wed, 25 Feb 2015 14:54:43 -0800 (PST) Received-SPF: none (google.com: linux-arm-msm-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 S1753213AbbBYWyl (ORCPT + 5 others); Wed, 25 Feb 2015 17:54:41 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:41448 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753169AbbBYWyk (ORCPT ); Wed, 25 Feb 2015 17:54:40 -0500 Received: by padfb1 with SMTP id fb1so8769676pad.8 for ; Wed, 25 Feb 2015 14:54:40 -0800 (PST) X-Received: by 10.66.65.138 with SMTP id x10mr9295646pas.152.1424904880255; Wed, 25 Feb 2015 14:54:40 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by mx.google.com with ESMTPSA id pp9sm42274261pbb.65.2015.02.25.14.54.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 14:54:39 -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, Lina Iyer Subject: [PATCH 2/2] qcom: scm: Add scm_set_warm_boot_addr function Date: Wed, 25 Feb 2015 15:54:12 -0700 Message-Id: <1424904852-12719-3-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1424904852-12719-1-git-send-email-lina.iyer@linaro.org> References: <1424904852-12719-1-git-send-email-lina.iyer@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@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.215.52 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 of. 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. Also we do not need to export the warmboot flags. Move them into the implementation file. Signed-off-by: Lina Iyer --- arch/arm/mach-qcom/scm-boot.c | 38 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-qcom/scm-boot.h | 7 +++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-qcom/scm-boot.c b/arch/arm/mach-qcom/scm-boot.c index 45cee3e..cb73134 100644 --- a/arch/arm/mach-qcom/scm-boot.c +++ b/arch/arm/mach-qcom/scm-boot.c @@ -1,4 +1,5 @@ /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. + * Copyright (c) 2014, Linaro Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -21,6 +22,23 @@ #include "scm.h" #include "scm-boot.h" +#define SCM_FLAG_WARMBOOT_CPU0 0x04 +#define SCM_FLAG_WARMBOOT_CPU1 0x02 +#define SCM_FLAG_WARMBOOT_CPU2 0x10 +#define SCM_FLAG_WARMBOOT_CPU3 0x40 + +struct scm_warmboot { + int flag; + void *entry; +}; + +static struct scm_warmboot scm_flags[] = { + { .flag = SCM_FLAG_WARMBOOT_CPU0 }, + { .flag = SCM_FLAG_WARMBOOT_CPU1 }, + { .flag = SCM_FLAG_WARMBOOT_CPU2 }, + { .flag = SCM_FLAG_WARMBOOT_CPU3 }, +}; + /* * Set the cold/warm boot address for one of the CPU cores. */ @@ -31,9 +49,29 @@ int scm_set_boot_addr(phys_addr_t addr, int flags) phys_addr_t addr; } cmd; + might_sleep(); + cmd.addr = addr; cmd.flags = flags; return scm_call(SCM_SVC_BOOT, SCM_BOOT_ADDR, &cmd, sizeof(cmd), NULL, 0); } EXPORT_SYMBOL(scm_set_boot_addr); + +int 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 = scm_set_boot_addr(virt_to_phys(entry), scm_flags[cpu].flag); + if (!ret) + scm_flags[cpu].entry = entry; + + return ret; +} diff --git a/arch/arm/mach-qcom/scm-boot.h b/arch/arm/mach-qcom/scm-boot.h index 02b445c..97dbf58 100644 --- a/arch/arm/mach-qcom/scm-boot.h +++ b/arch/arm/mach-qcom/scm-boot.h @@ -1,4 +1,5 @@ /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. + * Copyright (c) 2014, Linaro Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -9,6 +10,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ + #ifndef __MACH_SCM_BOOT_H #define __MACH_SCM_BOOT_H @@ -16,11 +18,8 @@ #define SCM_FLAG_COLDBOOT_CPU1 0x01 #define SCM_FLAG_COLDBOOT_CPU2 0x08 #define SCM_FLAG_COLDBOOT_CPU3 0x20 -#define SCM_FLAG_WARMBOOT_CPU0 0x04 -#define SCM_FLAG_WARMBOOT_CPU1 0x02 -#define SCM_FLAG_WARMBOOT_CPU2 0x10 -#define SCM_FLAG_WARMBOOT_CPU3 0x40 int scm_set_boot_addr(phys_addr_t addr, int flags); +int scm_set_warm_boot_addr(void *entry, int cpu); #endif