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: 5885161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E78D69F54F for ; Wed, 25 Feb 2015 22:57:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E56C2037B for ; Wed, 25 Feb 2015 22:57:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24DA420375 for ; Wed, 25 Feb 2015 22:57:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YQkrb-0001FO-Ou; Wed, 25 Feb 2015 22:55:31 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YQkrC-0000Ex-BB for linux-arm-kernel@bombadil.infradead.org; Wed, 25 Feb 2015 22:55:06 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YQkr9-0004oP-5N for linux-arm-kernel@lists.infradead.org; Wed, 25 Feb 2015 22:55:04 +0000 Received: by pdbnh10 with SMTP id nh10so8134157pdb.11 for ; Wed, 25 Feb 2015 14:54:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Heo5Krc+KkNmariGHG31T279HCVCkHTx1eGFZto77+g=; b=f3LnzQ97pD0xnNje3u1uYqDVPkuq4WxkG8gtNLfj7n1m69d2pFpZASxxDt4ewzim/L eOPQlFYfF2DT7wDwW0wMy3ary5C6znzLG+goU0mADClG/h6Ntl9CPciRzUlR+SdfwXDv JIqwEYoeWEfkm3QuG4RC5CVekdF/uFbunJPpYEfkxxrQD0QONrincdEq/FOP364tDT9V t9zHZgVqHonkxDyobdoB+YHxnAzNHtUfZDL1q1JGQjsVO6+YgQVPY/VcI9D3MzHZtMn+ 4kNwXPH6stwmSmO2kWqdABLxcbOQj9wn/xtBqusz+po4jy6NlQbwJXLXk+v3ryv8/Dof /uZw== X-Gm-Message-State: ALoCoQkK7LFpq52GbmcY1sQvcoccWKWtbxDwMq2ZamZeaVxoG7vET1qrNx2lXbTE4t0XbbQXsN/5 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150225_225503_348597_F029ADF4 X-CRM114-Status: GOOD ( 19.26 ) X-Spam-Score: -2.6 (--) Cc: Lina Iyer , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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