Add SCM warmboot support for QCOM SoCs
cover Add SCM warmboot support for QCOM SoCs
Hi,
These patches used to be part of my cpuidle patchset, think these can go in independently.
The patches do the following -
1. Add QCOM Secure Monitor specific enumeration for warm boot on qcom targets
2. Add an API to set up the warmboot address. Consolidate the warm boot flags into the implementation file
Thanks,
Lina
Lina Iyer (2):
ARM: qcom: Add SCM warmboot flags for quad core targets.
qcom: scm: Add scm_set_warm_boot_addr function
arch/arm/mach-qcom/scm-boot.c | 38 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-qcom/scm-boot.h | 5 +++-- 2 files changed, 41 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/2 ARM: qcom: Add SCM warmboot flags for quad core targets.
Quad core targets like APQ8074, APQ8064, APQ8084 need SCM support set up warm boot addresses in the Secure Monitor. Extend the SCM flags to support warmboot addresses for secondary cores.
--- arch/arm/mach-qcom/scm-boot.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-qcom/scm-boot.h +2 -0
@@ -18,6 +18,8 @@#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 0x40int scm_set_boot_addr (phys_addr_t addr,int flags);
Signature · 1 line
2.1.0
PATCH 2/2 qcom: scm: Add scm_set_warm_boot_addr function
In reply to Lina IyerA 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.
--- arch/arm/mach-qcom/scm-boot.c | 38 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-qcom/scm-boot.h | 7 +++---- 2 files changed, 41 insertions(+), 4 deletions(-)
arch/arm/mach-qcom/scm-boot.c +38 -0
@@ -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; +}
arch/arm/mach-qcom/scm-boot.h +3 -4
@@ -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 0x40int scm_set_boot_addr (phys_addr_t addr,int flags); +int scm_set_warm_boot_addr (void *entry,int cpu);#endif
Signature · 1 line
2.1.0
PATCH 2/2 qcom: scm: Add scm_set_warm_boot_addr function
Quoted 1 line · Lina Iyer
A core can be powered down for cpuidle or when it is hotplugged of.
s/of/off/ ?
Quoted 50 lines
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 <[email protected]>--- arch/arm/mach-qcom/scm-boot.c | 38 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-qcom/scm-boot.h | 7 +++---- 2 files changed, 41 insertions(+), 4 deletions(-)arch/arm/mach-qcom/scm-boot.c +18
-0@@ -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. */
arch/arm/mach-qcom/scm-boot.c int scm_set_boot_addr(phys_addr_t addr, int flags) · line 53
Quoted 5 lines
arch/arm/mach-qcom/scm-boot.c +2
-0@@ -31,9 +49,29 @@ int scm_set_boot_addr(phys_addr_t addr, int flags)phys_addr_t addr; } cmd; +might_sleep (); +
Unrelated change?
Looking closer at scm_call(), looks like the might_sleep() should go inside scm_call() where it uses the mutex.
Quoted 43 lines
arch/arm/mach-qcom/scm-boot.c +18
-0cmd.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; +}arch/arm/mach-qcom/scm-boot.h +2
-0@@ -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
arch/arm/mach-qcom/scm-boot.h line 22
Quoted 7 lines
arch/arm/mach-qcom/scm-boot.h +0
-4@@ -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
You just added these in patch 1, and now moved them. I would just squash the 2 patches together.
Kevin
PATCH 2/2 qcom: scm: Add scm_set_warm_boot_addr function
Quoted 6 lines · Kevin Hilman
Quoted 1 line · Lina Iyer
A core can be powered down for cpuidle or when it is hotplugged of.
s/of/off/ ?
Thanks, took care of it.
Quoted 53 lines
Quoted 53 lines
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 <[email protected]>--- arch/arm/mach-qcom/scm-boot.c | 38 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-qcom/scm-boot.h | 7 +++---- 2 files changed, 41 insertions(+), 4 deletions(-)arch/arm/mach-qcom/scm-boot.c +18
-0@@ -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;
Quoted 8 lines
arch/arm/mach-qcom/scm-boot.c int scm_set_boot_addr(phys_addr_t addr, int flags) · line 53
Quoted 2 lines
arch/arm/mach-qcom/scm-boot.c +2
-0+might_sleep (); +Unrelated change?
Looking closer at
scm_call(), looks like themight_sleep()should go insidescm_call()where it uses the mutex.
Removed it from this patch.
Quoted 42 lines
Quoted 42 lines
arch/arm/mach-qcom/scm-boot.c +18
-0cmd.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; +}arch/arm/mach-qcom/scm-boot.h +2
-0@@ -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
Quoted 12 lines
arch/arm/mach-qcom/scm-boot.h line 22
Quoted 8 lines
arch/arm/mach-qcom/scm-boot.h +0
-4@@ -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 0x40You just added these in patch 1, and now moved them. I would just squash the 2 patches together.
Sure. Thanks!
Quoted 1 line
Kevin
cover Add SCM warmboot support for QCOM SoCs
In reply to Lina IyerQuoted 14 lines · Lina Iyer
Hi,
These patches used to be part of my cpuidle patchset, think these can go in independently.
The patches do the following -
1. Add QCOM Secure Monitor specific enumeration for warm boot on qcom targets
2. Add an API to set up the warmboot address. Consolidate the warm boot flags into the implementation fileThanks,
Lina
Quoted 7 lines
Lina Iyer (2):
ARM: qcom: Add SCM warmboot flags for quad core targets.
qcom: scm: Addscm_set_warm_boot_addrfunction
arch/arm/mach-qcom/scm-boot.c| 38 ++++++++++++++++++++++++++++++++++++++arch/arm/mach-qcom/scm-boot.h| 5 +++--2 files changed, 41 insertions(+), 2 deletions(-)
Lina,
Do you mind rebasing these patches on my recent SCM cleanup set. You find it at:
git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.git qcom/scm-cleanup
thanks
- k
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
cover Add SCM warmboot support for QCOM SoCs
Quoted 25 lines · Kumar Gala
Quoted 14 lines · Lina Iyer
Hi,
These patches used to be part of my cpuidle patchset, think these can go in independently.
The patches do the following -
1. Add QCOM Secure Monitor specific enumeration for warm boot on qcom targets
2. Add an API to set up the warmboot address. Consolidate the warm boot flags into the implementation fileThanks,
LinaQuoted 7 lines
Lina Iyer (2):
ARM: qcom: Add SCM warmboot flags for quad core targets.
qcom: scm: Addscm_set_warm_boot_addrfunction
arch/arm/mach-qcom/scm-boot.c| 38 ++++++++++++++++++++++++++++++++++++++arch/arm/mach-qcom/scm-boot.h| 5 +++--2 files changed, 41 insertions(+), 2 deletions(-)
Quoted 6 lines
Lina,
Do you mind rebasing these patches on my recent SCM cleanup set. You find it at:
git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.gitqcom/scm-cleanup
Sure. As suggested by Kevin H, I will merge the two patches and rebase on top yours and resubmit.
Quoted 9 lines
thanks
- k
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
cover Add SCM warmboot support for QCOM SoCs
Quoted 28 lines · Lina Iyer
Quoted 27 lines · Kumar Gala
Quoted 14 lines · Lina Iyer
Hi,
These patches used to be part of my cpuidle patchset, think these can go in independently.
The patches do the following -
1. Add QCOM Secure Monitor specific enumeration for warm boot on qcom targets
2. Add an API to set up the warmboot address. Consolidate the warm boot flags into the implementation fileThanks,
LinaQuoted 7 lines
Lina Iyer (2):
ARM: qcom: Add SCM warmboot flags for quad core targets.
qcom: scm: Addscm_set_warm_boot_addrfunction
arch/arm/mach-qcom/scm-boot.c| 38 ++++++++++++++++++++++++++++++++++++++arch/arm/mach-qcom/scm-boot.h| 5 +++--2 files changed, 41 insertions(+), 2 deletions(-)Lina,
Quoted 8 lines
Quoted 4 lines
Do you mind rebasing these patches on my recent SCM cleanup set. You find it at:
git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.gitqcom/scm-cleanupSure. As suggested by Kevin H, I will merge the two patches and rebase on top yours and resubmit.
I have rebased on top of yours. I will send it shortly. But please note that source "driver/firmware/Kconfig" is missing in arch/arm/Kconfig for the driver/firmware to build.
Also, I have a dependency on the scm_call_atomic() api introduced by Stephen [1] for cpuidle. When can I expect to see that?
[1]. https://lkml.org/lkml/2014/8/4/765
Thanks,
Lina
cover Add SCM warmboot support for QCOM SoCs
Quoted 34 lines · Lina Iyer
Quoted 33 lines · Lina Iyer
Quoted 31 lines · Kumar Gala
Quoted 14 lines · Lina Iyer
Hi,
These patches used to be part of my cpuidle patchset, think these can go in independently.
The patches do the following -
1. Add QCOM Secure Monitor specific enumeration for warm boot on qcom targets
2. Add an API to set up the warmboot address. Consolidate the warm boot flags into the implementation fileThanks,
LinaQuoted 7 lines
Lina Iyer (2):
ARM: qcom: Add SCM warmboot flags for quad core targets.
qcom: scm: Addscm_set_warm_boot_addrfunction
arch/arm/mach-qcom/scm-boot.c| 38 ++++++++++++++++++++++++++++++++++++++arch/arm/mach-qcom/scm-boot.h| 5 +++--2 files changed, 41 insertions(+), 2 deletions(-)Lina,
Do you mind rebasing these patches on my recent SCM cleanup set. You find it at:
git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.gitqcom/scm-cleanup
Quoted 6 lines
Quoted 3 lines
Sure. As suggested by Kevin H, I will merge the two patches and rebase on top yours and resubmit.
I have rebased on top of yours. I will send it shortly. But please note that source "driver/firmware/Kconfig" is missing in
arch/arm/Kconfigfor the driver/firmware to build.
I?ll fix this.
Quoted 5 lines
Also, I have a dependency on the
scm_call_atomic()api introduced by Stephen [1] for cpuidle. When can I expect to see that?
Please add the patch to your patchset.
- k
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project