From patchwork Tue Dec 2 17:39:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 5422251 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 75E119F30B for ; Tue, 2 Dec 2014 17:43:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A35B92021B for ; Tue, 2 Dec 2014 17:43:43 +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 D5D20201ED for ; Tue, 2 Dec 2014 17:43:42 +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 1XvrS7-0006WA-K9; Tue, 02 Dec 2014 17:41:31 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XvrRS-00067S-Ek for linux-arm-kernel@lists.infradead.org; Tue, 02 Dec 2014 17:40:51 +0000 Received: by mail-pa0-f44.google.com with SMTP id et14so13855457pad.31 for ; Tue, 02 Dec 2014 09:40:28 -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=QdZTYdtWIxPMoMz4RNrBrZ9B84hzq+gOKuTlEcH6ZVo=; b=OInTfjz6LdG5briy8/boICc4BvifRI4ywnBCq6xsHIkM+kp/VZTbHpBYAFIwDGtc20 e+ZoiBaqz52dfe7HBH+A4BqxXaM3kIXdRwKWq+YLICFobxzov6HnCatViVoMSxsLH6ZM KM/8rZxh5JaBo9ske8lEk2iarjzOXt4yn5DEvBe8JD3k8L5bI3/F7Wjqx3JOVAq+rHUY JKE43h6/gPr7Z64FSQB4mMqjt9wlC0WrgwJjvISO94ePaeX8PuNVXfnMUaqIBb7Wih/P i8PvVU9gxMJ8eqMlxB5Jg0D8GH9gWfigTEpz/tR1oXm3kOp3qYoih821cttUAFS/6eXI UKXQ== X-Gm-Message-State: ALoCoQnbi5VgKHYIIhVizJ7qihu9aAs/tG62xYzhf8lRzXQi/npX/5OyVif75kJ2u2j+rnilG6IR X-Received: by 10.66.157.137 with SMTP id wm9mr618909pab.17.1417542028118; Tue, 02 Dec 2014 09:40:28 -0800 (PST) Received: from ubuntu.localdomain (proxy6-global253.qualcomm.com. [199.106.103.253]) by mx.google.com with ESMTPSA id q3sm20928900pdn.23.2014.12.02.09.40.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Dec 2014 09:40:27 -0800 (PST) From: Lina Iyer To: daniel.lezcano@linaro.org, khilman@linaro.org, sboyd@codeaurora.org, galak@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v14 02/10] qcom: scm: Add SCM warmboot support for quad core SoCs Date: Tue, 2 Dec 2014 10:39:10 -0700 Message-Id: <1417541958-56907-3-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1417541958-56907-1-git-send-email-lina.iyer@linaro.org> References: <1417541958-56907-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141202_094050_546838_DD7BBB3C X-CRM114-Status: GOOD ( 12.95 ) X-Spam-Score: -0.7 (/) Cc: msivasub@codeaurora.org, devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, Lina Iyer 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 Quad core SoCs like APQ8074, APQ8064, APQ8084 need SCM support set up warm boot addresses in the Secure Monitor. Extend the SCM flags to support warm boot addresses for secondary cores. We do not need to export the warmboot flags. Move them into the implementation file. Signed-off-by: Lina Iyer Acked-by: Daniel Lezcano Reviewed-by: Stephen Boyd --- drivers/soc/qcom/scm-boot.c | 35 +++++++++++++++++++++++++++++++++++ include/soc/qcom/scm-boot.h | 3 +-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/scm-boot.c b/drivers/soc/qcom/scm-boot.c index 60ff7b4..f653217a 100644 --- a/drivers/soc/qcom/scm-boot.c +++ b/drivers/soc/qcom/scm-boot.c @@ -21,6 +21,23 @@ #include #include +#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. */ @@ -37,3 +54,21 @@ int scm_set_boot_addr(phys_addr_t addr, int flags) &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/include/soc/qcom/scm-boot.h b/include/soc/qcom/scm-boot.h index 6aabb24..529f55a 100644 --- a/include/soc/qcom/scm-boot.h +++ b/include/soc/qcom/scm-boot.h @@ -16,9 +16,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 int scm_set_boot_addr(phys_addr_t addr, int flags); +int scm_set_warm_boot_addr(void *entry, int cpu); #endif