qcom: scm: Add qcom_scm_set_warm_boot_addr function
PATCH v2 1/1 qcom: scm: Add qcom_scm_set_warm_boot_addr function
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.
--- drivers/firmware/qcom_scm.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/qcom_scm.h | 5 +---- 2 files changed, 37 insertions(+), 4 deletions(-)
drivers/firmware/qcom_scm.c +36 -0
@@ -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);
include/linux/qcom_scm.h +1 -4
@@ -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 0x40extern 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))
Signature · 1 line
2.1.0
PATCH v2 1/1 qcom: scm: Add qcom_scm_set_warm_boot_addr function
Quoted 44 lines · Lina Iyer
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_addrfunction move the warm boot flags to implementation.Signed-off-by Lina Iyer <[email protected]>---
drivers/firmware/qcom_scm.c| 36 ++++++++++++++++++++++++++++++++++++include/linux/qcom_scm.h| 5 +----2 files changed, 37 insertions(+), 4 deletions(-)drivers/firmware/qcom_scm.c +17
-0@@ -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);/**
drivers/firmware/qcom_scm.c int qcom_scm_set_boot_addr(u32 addr, int flags) · line 362
Quoted 4 lines
drivers/firmware/qcom_scm.c +1
-0@@ -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); +
Since you are adding a new interface, can you add Kdoc style comment header. I need to do this for the other interfaces as well.
drivers/firmware/qcom_scm.c int qcom_scm_set_boot_addr(u32 addr, int flags) · line 363
Quoted 1 line
drivers/firmware/qcom_scm.c +1
-0+int qcom_scm_set_warm_boot_addr (void *entry,int cpu)
I?d really like to see if we could make the set_boot_addr and set_warm_boot_addr have the same interfaces.
Quoted 42 lines
drivers/firmware/qcom_scm.c +17
-0+{ +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);include/linux/qcom_scm.h +1
-4@@ -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 0x40extern 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))Signature · 6 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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
PATCH v2 1/1 qcom: scm: Add qcom_scm_set_warm_boot_addr function
Quoted 45 lines · Kumar Gala
Quoted 42 lines · Lina Iyer
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_addrfunction move the warm boot flags to implementation.Signed-off-by Lina Iyer <[email protected]>---
drivers/firmware/qcom_scm.c| 36 ++++++++++++++++++++++++++++++++++++include/linux/qcom_scm.h| 5 +----2 files changed, 37 insertions(+), 4 deletions(-)drivers/firmware/qcom_scm.c +17
-0@@ -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);
Quoted 8 lines
drivers/firmware/qcom_scm.c int qcom_scm_set_boot_addr(u32 addr, int flags) · line 362
Quoted 6 lines
drivers/firmware/qcom_scm.c +1
-0/** @@ -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); +Since you are adding a new interface, can you add Kdoc style comment header. I need to do this for the other interfaces as well.
OK.
Quoted 4 lines
drivers/firmware/qcom_scm.c int qcom_scm_set_boot_addr(u32 addr, int flags) · line 363
Quoted 2 lines
drivers/firmware/qcom_scm.c +1
-0+int qcom_scm_set_warm_boot_addr (void *entry,int cpu)I?d really like to see if we could make the
set_boot_addrandset_warm_boot_addrhave the same interfaces.
I am working on making the interfaces similar. There is some check in the platsmp.c that uses the cold boot flag array to determine the present cpus. Do you think, we can ignore that check over there? If that can be done, I will change the interface for cold boot too.
Quoted 49 lines
Quoted 43 lines
drivers/firmware/qcom_scm.c +17
-0+{ +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);include/linux/qcom_scm.h +1
-5@@ -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 0x40extern 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)) --2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 1/1 qcom: scm: Add qcom_scm_set_warm_boot_addr function
Quoted 58 lines · Lina Iyer
Quoted 45 lines · Kumar Gala
Quoted 42 lines · Lina Iyer
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_addrfunction move the warm boot flags to implementation.Signed-off-by Lina Iyer <[email protected]>---
drivers/firmware/qcom_scm.c| 36 ++++++++++++++++++++++++++++++++++++include/linux/qcom_scm.h| 5 +----2 files changed, 37 insertions(+), 4 deletions(-)drivers/firmware/qcom_scm.c +17
-0@@ -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);Quoted 8 lines
drivers/firmware/qcom_scm.c int qcom_scm_set_boot_addr(u32 addr, int flags) · line 362
Quoted 6 lines
drivers/firmware/qcom_scm.c +1
-0/** @@ -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); +Since you are adding a new interface, can you add Kdoc style comment header. I need to do this for the other interfaces as well.
OK.
Quoted 1 line
Quoted 8 lines
Quoted 3 lines
drivers/firmware/qcom_scm.c int qcom_scm_set_boot_addr(u32 addr, int flags) · line 363
Quoted 1 line
drivers/firmware/qcom_scm.c +1
-0+int qcom_scm_set_warm_boot_addr (void *entry,int cpu)I?d really like to see if we could make the
set_boot_addrandset_warm_boot_addrhave the same interfaces.I am working on making the interfaces similar. There is some check in the
platsmp.cthat uses the cold boot flag array to determine the present cpus. Do you think, we can ignore that check over there? If that can be done, I will change the interface for cold boot too.
I don?t see any reason we can?t add qcom_scm_set_cold_boot_addr() move the flags such that they only exist in qcom_scm_set_boot_addr and make qcom_scm_set_boot_addr static.
- 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
PATCH v2 1/1 qcom: scm: Add qcom_scm_set_warm_boot_addr function
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
+int
qcom_scm_set_warm_boot_addr(void *entry, int cpu)I?d really like to see if we could make the
set_boot_addrandset_warm_boot_addrhave the same interfaces.
Quoted 8 lines
Quoted 4 lines
I am working on making the interfaces similar. There is some check in the
platsmp.cthat uses the cold boot flag array to determine the present cpus. Do you think, we can ignore that check over there? If that can be done, I will change the interface for cold boot too.I don?t see any reason we can?t add
qcom_scm_set_cold_boot_addr()move the flags such that they only exist inqcom_scm_set_boot_addrand makeqcom_scm_set_boot_addrstatic.- k
Looking at this for another minute, I think we should have the interfaces be something like:
qcom_scm_set_cold_boot_addr(void * entry, cpumask_t mask); qcom_scm_set_warm_boot_addr(void * entry, cpumask_t mask);
- 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
PATCH v2 1/1 qcom: scm: Add qcom_scm_set_warm_boot_addr function
Quoted 9 lines · Kumar Gala
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
+int
qcom_scm_set_warm_boot_addr(void *entry, int cpu)I?d really like to see if we could make the
set_boot_addrandset_warm_boot_addrhave the same interfaces.I am working on making the interfaces similar. There is some check in the
platsmp.cthat uses the cold boot flag array to determine the present cpus. Do you think, we can ignore that check over there? If that can be done, I will change the interface for cold boot too.
Quoted 8 lines
Quoted 3 lines
I don?t see any reason we can?t add
qcom_scm_set_cold_boot_addr()move the flags such that they only exist inqcom_scm_set_boot_addrand makeqcom_scm_set_boot_addrstatic.- k
Looking at this for another minute, I think we should have the interfaces be something like:
qcom_scm_set_cold_boot_addr(void * entry, cpumask_t mask);qcom_scm_set_warm_boot_addr(void * entry, cpumask_t mask);
Very similar to what I was thinking. I will send another patchest when I get to it.
Quoted 8 lines
- 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