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: 5903281 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 50EB69F269 for ; Fri, 27 Feb 2015 20:50:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EE0F2021F for ; Fri, 27 Feb 2015 20:50:20 +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 9D3102021B for ; Fri, 27 Feb 2015 20:50:19 +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 1YRRpN-0000pe-AW; Fri, 27 Feb 2015 20:48:05 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YRRpI-0000fU-3h for linux-arm-kernel@lists.infradead.org; Fri, 27 Feb 2015 20:48:00 +0000 Received: by pabrd3 with SMTP id rd3so25467595pab.1 for ; Fri, 27 Feb 2015 12:47:38 -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; bh=mPTsdngGhhHUWlF+Bm5jswP6QmT3KYlVDuQi8iHbjBc=; b=T47CKHoguyNoUiPf/ArJy7YNLnkTS+/hcFhHdNycOVKK4wHdLX5FLOs1HUzGrgBpm0 0pRN3LEYT7fP/qgTBZoZkrp85HzoZFILE1wBeuXbzn5y+YjJGXpS8QoM+LJM7kfGMHWx IWPF6GBWR/CI15vYQvFru0DEVfVGAV5yFch+zT32dvyI9UnLiqPR7VbRR0NEChgJrmuf ekpo3CH0X8laNM5E5kSFuZhg8JJhlOOkGdfrI9fVQ4Ek0KClgiPA/4xDjaDhHmLfT0VJ 9bAzRUje+x9SYEUws+42LskTypcukXUoJrbA4hJdlrbo6MNFcl1D4fs5ik/YgP4eqc2U T0/w== X-Gm-Message-State: ALoCoQkqENLBjBVn8UW7YAtoftZlGn/qz9dI9QwC9Hba3auKXIYj12TzSy5xXxiEH+H17LkqsKlT 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150227_124800_223082_079B604B X-CRM114-Status: GOOD ( 11.20 ) X-Spam-Score: -0.7 (/) Cc: khilman@linaro.org, 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 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))