ARM: qcom: Merge scm and scm boot code together
PATCH 1/4 ARM: qcom: Merge scm and scm boot code together
Put all scm related code into a single file as a first step in cleaning up the scm interface to just expose functional behavior insteam of making direct scm calls.
--- arch/arm/mach-qcom/Makefile | 2 +- arch/arm/mach-qcom/platsmp.c | 2 +- arch/arm/mach-qcom/scm-boot.c | 39 --------------------------------------- arch/arm/mach-qcom/scm-boot.h | 26 -------------------------- arch/arm/mach-qcom/scm.c | 17 +++++++++++++++++ arch/arm/mach-qcom/scm.h | 11 +++++++++++ 6 files changed, 30 insertions(+), 67 deletions(-) delete mode 100644 arch/arm/mach-qcom/scm-boot.c delete mode 100644 arch/arm/mach-qcom/scm-boot.h
arch/arm/mach-qcom/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-y := board.o obj-$(CONFIG_SMP) += platsmp.o -obj-$(CONFIG_QCOM_SCM) += scm.o scm-boot.o +obj-$(CONFIG_QCOM_SCM) += scm.o CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
arch/arm/mach-qcom/platsmp.c +1 -1
@@ -20,7 +20,7 @@#include <asm/smp_plat.h> -#include "scm-boot.h" +#include "scm.h" #define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x35a0#define SCSS_CPU1CORE_RESET 0x2d80
arch/arm/mach-qcom/scm-boot.c deleted +0 -39
@@ -1,39 +0,0 @@ -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. -* -* 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 -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -* 02110-1301, USA. -*/ - -#include <linux/module.h> -#include <linux/slab.h> - -#include "scm.h" -#include "scm-boot.h" - -/* -* Set the cold/warm boot address for one of the CPU cores. -*/ -int scm_set_boot_addr (u32 addr,int flags) -{ -struct { -__le32 flags; -__le32 addr; - } cmd; - - cmd.addr =cpu_to_le32 (addr); - cmd.flags =cpu_to_le32 (flags); -return scm_call (SCM_SVC_BOOT ,SCM_BOOT_ADDR , - &cmd,sizeof (cmd),NULL ,0 ); -} -EXPORT_SYMBOL (scm_set_boot_addr);
arch/arm/mach-qcom/scm-boot.h deleted +0 -26
@@ -1,26 +0,0 @@ -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. -* -* 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 -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* 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 - -#define SCM_BOOT_ADDR 0x1 -#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 (u32 addr,int flags); - -#endif
arch/arm/mach-qcom/scm.c +17 -0
@@ -324,3 +324,20 @@ u32 scm_get_version(void)return version; }EXPORT_SYMBOL (scm_get_version); + +/* +* Set the cold/warm boot address for one of the CPU cores. +*/ +int scm_set_boot_addr (u32 addr,int flags) +{ +struct { +__le32 flags; +__le32 addr; + } cmd; + + cmd.addr =cpu_to_le32 (addr); + cmd.flags =cpu_to_le32 (flags); +return scm_call (SCM_SVC_BOOT ,SCM_BOOT_ADDR , + &cmd,sizeof (cmd),NULL ,0 ); +} +EXPORT_SYMBOL (scm_set_boot_addr);
arch/arm/mach-qcom/scm.h +11 -0
@@ -18,6 +18,17 @@extern int scm_call (u32 svc_id,u32 cmd_id,const void *cmd_buf,size_t cmd_len,void *resp_buf,size_t resp_len); +#define SCM_BOOT_ADDR 0x1 +#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 + +extern int scm_set_boot_addr (u32 addr,int flags); +#define SCM_VERSION (major, minor) (((major) << 16) | ((minor) & 0xFF))extern u32 scm_get_version (void );
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 2/4 ARM: qcom: Cleanup scm interface to only export what is needed
Now that scom boot interface is merged we don't need export scm_call anymore. Some other minor cleanups related to boot interface to only export what is needed by scm_set_boot_addr().
--- arch/arm/mach-qcom/scm.c | 7 ++++--- arch/arm/mach-qcom/scm.h | 7 ------- 2 files changed, 4 insertions(+), 10 deletions(-)
arch/arm/mach-qcom/scm.c +4 -3
@@ -249,8 +249,8 @@ static void scm_inv_range(unsigned long start, unsigned long end)* response buffers is taken care of by scm_call; however, callers are * responsible for any other cached buffers passed over to the secure world. */ -int scm_call (u32 svc_id,u32 cmd_id,const void *cmd_buf,size_t cmd_len, -void *resp_buf,size_t resp_len) +static int scm_call (u32 svc_id,u32 cmd_id,const void *cmd_buf,size_t cmd_len, +void *resp_buf,size_t resp_len) {int ret;struct scm_command *cmd;
@@ -287,7 +287,6 @@ out:free_scm_command (cmd);return ret; } -EXPORT_SYMBOL (scm_call);u32 scm_get_version (void ) {
@@ -325,6 +324,8 @@ u32 scm_get_version(void) }EXPORT_SYMBOL (scm_get_version); +#define SCM_SVC_BOOT 0x1 +#define SCM_BOOT_ADDR 0x1/* * Set the cold/warm boot address for one of the CPU cores. */
arch/arm/mach-qcom/scm.h +0 -7
@@ -12,13 +12,6 @@#ifndef __MACH_SCM_H#define __MACH_SCM_H -#define SCM_SVC_BOOT 0x1 -#define SCM_SVC_PIL 0x2 - -extern int scm_call (u32 svc_id,u32 cmd_id,const void *cmd_buf,size_t cmd_len, -void *resp_buf,size_t resp_len); - -#define SCM_BOOT_ADDR 0x1#define SCM_FLAG_COLDBOOT_CPU1 0x01#define SCM_FLAG_COLDBOOT_CPU2 0x08#define SCM_FLAG_COLDBOOT_CPU3 0x20
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 3/4 ARM: qcom: Prep scm code for move to drivers/firmware
In reply to Kumar GalaAdd qcom prefix to functions, etc to create a unique name space for the scm code as it gets ready to move out of qcom specific mach dir.
--- arch/arm/mach-qcom/platsmp.c | 8 +-- arch/arm/mach-qcom/scm.c | 148 +++++++++++++++++++++---------------------- arch/arm/mach-qcom/scm.h | 24 +++---- 3 files changed, 90 insertions(+), 90 deletions(-)
arch/arm/mach-qcom/platsmp.c +4 -4
@@ -323,9 +323,9 @@ static void __init qcom_smp_prepare_cpus(unsigned int max_cpus)unsigned int flags =0 ;static const int cold_boot_flags[] = {0 , -SCM_FLAG_COLDBOOT_CPU1 , -SCM_FLAG_COLDBOOT_CPU2 , -SCM_FLAG_COLDBOOT_CPU3 , +QCOM_SCM_FLAG_COLDBOOT_CPU1 , +QCOM_SCM_FLAG_COLDBOOT_CPU2 , +QCOM_SCM_FLAG_COLDBOOT_CPU3 , };for_each_present_cpu (cpu) {
@@ -337,7 +337,7 @@ static void __init qcom_smp_prepare_cpus(unsigned int max_cpus) flags |= cold_boot_flags[map]; } -if (scm_set_boot_addr (virt_to_phys (secondary_startup_arm), flags)) { +if (qcom_scm_set_boot_addr (virt_to_phys (secondary_startup_arm), flags)) {for_each_present_cpu (cpu) {if (cpu ==smp_processor_id ())continue ;
arch/arm/mach-qcom/scm.c +74 -74
331 lines not on this page · raw message
arch/arm/mach-qcom/scm.h +12 -12
@@ -9,21 +9,21 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#ifndef __MACH_SCM_H -#define __MACH_SCM_H +#ifndef __QCOM_SCM_H +#define __QCOM_SCM_H -#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 +#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 scm_set_boot_addr (u32 addr,int flags); +extern int qcom_scm_set_boot_addr (u32 addr,int flags); -#define SCM_VERSION (major, minor) (((major) << 16) | ((minor) & 0xFF)) +#define QCOM_SCM_VERSION (major, minor) (((major) << 16) | ((minor) & 0xFF)) -extern u32 scm_get_version (void ); +extern u32 qcom_scm_get_version (void );#endif
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 4/4 firmware: qcom: scm: Move the scm driver to drivers/firmware
In reply to Kumar GalaArchitectural changes in the ARM Linux kernel tree mandate the eventual removal of the mach-* directories. Move the scm driver to drivers/firmware and the scm header to include/linux to support that removal.
--- MAINTAINERS | 1 + arch/arm/mach-qcom/Kconfig | 3 - arch/arm/mach-qcom/Makefile | 3 - arch/arm/mach-qcom/platsmp.c | 2 +- arch/arm/mach-qcom/scm.c | 344 ------------------------------------------- arch/arm/mach-qcom/scm.h | 29 ---- drivers/firmware/Kconfig | 4 + drivers/firmware/Makefile | 2 + drivers/firmware/qcom_scm.c | 344 +++++++++++++++++++++++++++++++++++++++++++ include/linux/qcom_scm.h | 29 ++++ 10 files changed, 381 insertions(+), 380 deletions(-) delete mode 100644 arch/arm/mach-qcom/scm.c delete mode 100644 arch/arm/mach-qcom/scm.h create mode 100644 drivers/firmware/qcom_scm.c create mode 100644 include/linux/qcom_scm.h
MAINTAINERS +1 -0
@@ -1317,6 +1317,7 @@ L: linux-soc at vger.kernel.org S: Maintained F: arch/arm/mach-qcom/ F: drivers/soc/qcom/ +F: drivers/firmware/qcom_scm.c T: git git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.git ARM/RADISYS ENP2611 MACHINE SUPPORT
arch/arm/mach-qcom/Kconfig +0 -3
@@ -22,7 +22,4 @@ config ARCH_MSM8974 bool "Enable support for MSM8974" select HAVE_ARM_ARCH_TIMER -config QCOM_SCM - bool - endif
arch/arm/mach-qcom/Makefile +0 -3
@@ -1,5 +1,2 @@ obj-y := board.o obj-$(CONFIG_SMP) += platsmp.o -obj-$(CONFIG_QCOM_SCM) += scm.o - -CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
arch/arm/mach-qcom/platsmp.c +1 -1
@@ -17,10 +17,10 @@#include <linux/of_address.h> #include <linux/smp.h> #include <linux/io.h> +#include <linux/qcom_scm.h> #include <asm/smp_plat.h> -#include "scm.h" #define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x35a0#define SCSS_CPU1CORE_RESET 0x2d80
arch/arm/mach-qcom/scm.c deleted +0 -344
344 lines not on this page · raw message
arch/arm/mach-qcom/scm.h deleted +0 -29
@@ -1,29 +0,0 @@ -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. -* -* 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 -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ -#ifndef __QCOM_SCM_H -#define __QCOM_SCM_H - -#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); - -#define QCOM_SCM_VERSION (major, minor) (((major) << 16) | ((minor) & 0xFF)) - -extern u32 qcom_scm_get_version (void ); - -#endif
drivers/firmware/Kconfig +4 -0
@@ -132,6 +132,10 @@ config ISCSI_IBFT detect iSCSI boot parameters dynamically during system boot, say Y. Otherwise, say N. +config QCOM_SCM + bool + depends on ARM || ARM64 + source "drivers/firmware/google/Kconfig" source "drivers/firmware/efi/Kconfig"
drivers/firmware/Makefile +2 -0
@@ -11,6 +11,8 @@ obj-$(CONFIG_DMIID) += dmi-id.o obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o +obj-$(CONFIG_QCOM_SCM) += qcom_scm.o +CFLAGS_qcom_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1) obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ obj-$(CONFIG_EFI) += efi/
drivers/firmware/qcom_scm.c new file +344 -0
344 lines not on this page · raw message
include/linux/qcom_scm.h new file +29 -0
@@ -0,0 +1,29 @@ +/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. +* +* 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 +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ +#ifndef __QCOM_SCM_H +#define __QCOM_SCM_H + +#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); + +#define QCOM_SCM_VERSION (major, minor) (((major) << 16) | ((minor) & 0xFF)) + +extern u32 qcom_scm_get_version (void ); + +#endif
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
Re: [PATCH 4/4] firmware: qcom: scm: Move the scm driver to drivers/firmware
Quoted 6 lines · Kumar Gala
Architectural changes in the ARM Linux kernel tree mandate the eventual removal of the mach-* directories. Move the scm driver to
drivers/firmwareand the scm header toinclude/linuxto support that removal.Signed-off-by Kumar Gala <[email protected]>
Quoted 16 lines
--- MAINTAINERS | 1 + arch/arm/mach-qcom/Kconfig | 3 - arch/arm/mach-qcom/Makefile | 3 - arch/arm/mach-qcom/platsmp.c | 2 +- arch/arm/mach-qcom/scm.c | 344 ------------------------------------------- arch/arm/mach-qcom/scm.h | 29 ---- drivers/firmware/Kconfig | 4 + drivers/firmware/Makefile | 2 + drivers/firmware/qcom_scm.c | 344 +++++++++++++++++++++++++++++++++++++++++++ include/linux/qcom_scm.h | 29 ++++ 10 files changed, 381 insertions(+), 380 deletions(-) delete mode 100644 arch/arm/mach-qcom/scm.c delete mode 100644 arch/arm/mach-qcom/scm.h create mode 100644 drivers/firmware/qcom_scm.c create mode 100644 include/linux/qcom_scm.h
Can you generate this with -M -C? Or just throw
[diff]
renames = copy
int your git config.
The files are the same right?
drivers/firmware/Kconfig config ISCSI_IBFT · line 137
Quoted 11 lines
drivers/firmware/Kconfig +3
-0@@ -132,6 +132,10 @@ config ISCSI_IBFT detect iSCSI boot parameters dynamically during system boot, say Y. Otherwise, say N. +config QCOM_SCM + bool + depends on ARM || ARM64
No need to have depends on here if the option is hidden. Just make sure it isn't selected unless the depends are true.
Also, the drivers/firmware/Kconfig file needs to be sourced in the arch/arm/Kconfig so that we can still get this option on arm (Lina noticed it isn't working on arm). It looks like arm64 is already sourcing it.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 4/4] firmware: qcom: scm: Move the scm driver to drivers/firmware
Quoted 24 lines · Stephen Boyd
Quoted 18 lines · Kumar Gala
Architectural changes in the ARM Linux kernel tree mandate the eventual removal of the mach-* directories. Move the scm driver to
drivers/firmwareand the scm header toinclude/linuxto support that removal.Signed-off-by Kumar Gala <[email protected]>---
MAINTAINERS | 1 + arch/arm/mach-qcom/Kconfig | 3 - arch/arm/mach-qcom/Makefile | 3 - arch/arm/mach-qcom/platsmp.c | 2 +- arch/arm/mach-qcom/scm.c | 344 ------------------------------------------- arch/arm/mach-qcom/scm.h | 29 ---- drivers/firmware/Kconfig | 4 + drivers/firmware/Makefile | 2 + drivers/firmware/qcom_scm.c | 344 +++++++++++++++++++++++++++++++++++++++++++ include/linux/qcom_scm.h | 29 ++++ 10 files changed, 381 insertions(+), 380 deletions(-)Quoted 4 lines
delete mode 100644
arch/arm/mach-qcom/scm.c
delete mode 100644arch/arm/mach-qcom/scm.h
create mode 100644drivers/firmware/qcom_scm.c
create mode 100644include/linux/qcom_scm.h
Quoted 8 lines
Can you generate this with -M -C? Or just throw
[diff]
renames = copyint your git config.
The files are the same right?
Will, do.. I keep forgetting to make this change in .gitconfig
Quoted 9 lines
Quoted 9 lines
drivers/firmware/Kconfig +0
-0@@ -132,6 +132,10 @@ config ISCSI_IBFT detect iSCSI boot parameters dynamically during system boot, say Y. Otherwise, say N.
Quoted 6 lines
drivers/firmware/Kconfig config ISCSI_IBFT · line 137
Quoted 3 lines
drivers/firmware/Kconfig +3
-0+config QCOM_SCM + bool + depends on ARM || ARM64No need to have depends on here if the option is hidden. Just make sure it isn't selected unless the depends are true.
While not needed, I?d like to keep it since there is some ARM asm code.
Quoted 4 lines
Also, the
drivers/firmware/Kconfigfile needs to be sourced in thearch/arm/Kconfigso that we can still get this option on arm (Lina noticed it isn't working on arm). It looks like arm64 is already sourcing it.
will fix
- 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