All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] qcom SCM updates
@ 2014-08-05  1:31 ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

The SCM code in the mainline kernel is woefully out of data from what
is in the downstream msm kernels. Update the code to be at least 
functionally correct and useful for features like cpuidle and
suspend.

Olav Haugan (1):
  msm: scm: Add logging of actual return code from scm call

Saravana Kannan (1):
  msm: scm: Add API to query for service/command availability.

Stephen Boyd (5):
  msm: scm: Fix incorrect cache invalidation
  msm: scm: Get cacheline size from CTR
  msm: scm: Add atomic SCM APIs
  msm: scm: Add a feat version query API
  msm: scm: Move the scm driver to drivers/soc/qcom

Vikram Mulukutla (1):
  msm: scm: Flush the command buffer only instead of the entire cache

 arch/arm/mach-qcom/Kconfig                     |   3 -
 arch/arm/mach-qcom/Makefile                    |   4 +-
 arch/arm/mach-qcom/scm-boot.c                  |   2 +-
 drivers/soc/qcom/Kconfig                       |   2 +
 drivers/soc/qcom/Makefile                      |   2 +
 {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c | 162 ++++++++++++++++++++++---
 {arch/arm/mach-qcom => include/soc/qcom}/scm.h |   8 +-
 7 files changed, 158 insertions(+), 25 deletions(-)
 rename {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c (62%)
 rename {arch/arm/mach-qcom => include/soc/qcom}/scm.h (69%)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 0/8] qcom SCM updates
@ 2014-08-05  1:31 ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

The SCM code in the mainline kernel is woefully out of data from what
is in the downstream msm kernels. Update the code to be at least 
functionally correct and useful for features like cpuidle and
suspend.

Olav Haugan (1):
  msm: scm: Add logging of actual return code from scm call

Saravana Kannan (1):
  msm: scm: Add API to query for service/command availability.

Stephen Boyd (5):
  msm: scm: Fix incorrect cache invalidation
  msm: scm: Get cacheline size from CTR
  msm: scm: Add atomic SCM APIs
  msm: scm: Add a feat version query API
  msm: scm: Move the scm driver to drivers/soc/qcom

Vikram Mulukutla (1):
  msm: scm: Flush the command buffer only instead of the entire cache

 arch/arm/mach-qcom/Kconfig                     |   3 -
 arch/arm/mach-qcom/Makefile                    |   4 +-
 arch/arm/mach-qcom/scm-boot.c                  |   2 +-
 drivers/soc/qcom/Kconfig                       |   2 +
 drivers/soc/qcom/Makefile                      |   2 +
 {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c | 162 ++++++++++++++++++++++---
 {arch/arm/mach-qcom => include/soc/qcom}/scm.h |   8 +-
 7 files changed, 158 insertions(+), 25 deletions(-)
 rename {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c (62%)
 rename {arch/arm/mach-qcom => include/soc/qcom}/scm.h (69%)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 1/8] msm: scm: Fix incorrect cache invalidation
  2014-08-05  1:31 ` Stephen Boyd
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

The cache invalidation in scm_call() correctly rounds down the
start address to invalidate the beginning of the cacheline but
doesn't properly round up the 'end' address to make it aligned.
The last chunk of the buffer won't be invalidated when 'end' is
not cacheline size aligned so make sure to invalidate the last
few bytes in such situations. It also doesn't do anything about
outer caches so make sure to invalidate and flush those as well.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index c536fd6bf827..820c72165e19 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -22,6 +22,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 
+#include <asm/outercache.h>
 #include <asm/cacheflush.h>
 
 #include "scm.h"
@@ -203,6 +204,7 @@ static int __scm_call(const struct scm_command *cmd)
 	 * side in the buffer.
 	 */
 	flush_cache_all();
+	outer_flush_all();
 	ret = smc(cmd_addr);
 	if (ret < 0)
 		ret = scm_remap_error(ret);
@@ -210,6 +212,20 @@ static int __scm_call(const struct scm_command *cmd)
 	return ret;
 }
 
+static void scm_inv_range(unsigned long start, unsigned long end)
+{
+	start = round_down(start, CACHELINESIZE);
+	end = round_up(end, CACHELINESIZE);
+	outer_inv_range(start, end);
+	while (start < end) {
+		asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
+		     : "memory");
+		start += CACHELINESIZE;
+	}
+	dsb();
+	isb();
+}
+
 /**
  * scm_call() - Send an SCM command
  * @svc_id: service identifier
@@ -227,6 +243,7 @@ int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
 	int ret;
 	struct scm_command *cmd;
 	struct scm_response *rsp;
+	unsigned long start, end;
 
 	cmd = alloc_scm_command(cmd_len, resp_len);
 	if (!cmd)
@@ -243,17 +260,15 @@ int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
 		goto out;
 
 	rsp = scm_command_to_response(cmd);
+	start = (unsigned long)rsp;
+
 	do {
-		u32 start = (u32)rsp;
-		u32 end = (u32)scm_get_response_buffer(rsp) + resp_len;
-		start &= ~(CACHELINESIZE - 1);
-		while (start < end) {
-			asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
-			     : "memory");
-			start += CACHELINESIZE;
-		}
+		scm_inv_range(start, start + sizeof(*rsp));
 	} while (!rsp->is_complete);
 
+	end = (unsigned long)scm_get_response_buffer(rsp) + resp_len;
+	scm_inv_range(start, end);
+
 	if (resp_buf)
 		memcpy(resp_buf, scm_get_response_buffer(rsp), resp_len);
 out:
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 1/8] msm: scm: Fix incorrect cache invalidation
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

The cache invalidation in scm_call() correctly rounds down the
start address to invalidate the beginning of the cacheline but
doesn't properly round up the 'end' address to make it aligned.
The last chunk of the buffer won't be invalidated when 'end' is
not cacheline size aligned so make sure to invalidate the last
few bytes in such situations. It also doesn't do anything about
outer caches so make sure to invalidate and flush those as well.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index c536fd6bf827..820c72165e19 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -22,6 +22,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 
+#include <asm/outercache.h>
 #include <asm/cacheflush.h>
 
 #include "scm.h"
@@ -203,6 +204,7 @@ static int __scm_call(const struct scm_command *cmd)
 	 * side in the buffer.
 	 */
 	flush_cache_all();
+	outer_flush_all();
 	ret = smc(cmd_addr);
 	if (ret < 0)
 		ret = scm_remap_error(ret);
@@ -210,6 +212,20 @@ static int __scm_call(const struct scm_command *cmd)
 	return ret;
 }
 
+static void scm_inv_range(unsigned long start, unsigned long end)
+{
+	start = round_down(start, CACHELINESIZE);
+	end = round_up(end, CACHELINESIZE);
+	outer_inv_range(start, end);
+	while (start < end) {
+		asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
+		     : "memory");
+		start += CACHELINESIZE;
+	}
+	dsb();
+	isb();
+}
+
 /**
  * scm_call() - Send an SCM command
  * @svc_id: service identifier
@@ -227,6 +243,7 @@ int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
 	int ret;
 	struct scm_command *cmd;
 	struct scm_response *rsp;
+	unsigned long start, end;
 
 	cmd = alloc_scm_command(cmd_len, resp_len);
 	if (!cmd)
@@ -243,17 +260,15 @@ int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
 		goto out;
 
 	rsp = scm_command_to_response(cmd);
+	start = (unsigned long)rsp;
+
 	do {
-		u32 start = (u32)rsp;
-		u32 end = (u32)scm_get_response_buffer(rsp) + resp_len;
-		start &= ~(CACHELINESIZE - 1);
-		while (start < end) {
-			asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
-			     : "memory");
-			start += CACHELINESIZE;
-		}
+		scm_inv_range(start, start + sizeof(*rsp));
 	} while (!rsp->is_complete);
 
+	end = (unsigned long)scm_get_response_buffer(rsp) + resp_len;
+	scm_inv_range(start, end);
+
 	if (resp_buf)
 		memcpy(resp_buf, scm_get_response_buffer(rsp), resp_len);
 out:
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 2/8] msm: scm: Get cacheline size from CTR
  2014-08-05  1:31 ` Stephen Boyd
  (?)
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-arm-msm, linux-kernel, linux-arm-kernel, Lina Iyer

Instead of hardcoding the cacheline size as 32, get the cacheline
size from the CTR register.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index 820c72165e19..c08786ebf116 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -27,9 +27,6 @@
 
 #include "scm.h"
 
-/* Cache line size for msm8x60 */
-#define CACHELINESIZE 32
-
 #define SCM_ENOMEM		-5
 #define SCM_EOPNOTSUPP		-4
 #define SCM_EINVAL_ADDR		-3
@@ -214,13 +211,18 @@ static int __scm_call(const struct scm_command *cmd)
 
 static void scm_inv_range(unsigned long start, unsigned long end)
 {
-	start = round_down(start, CACHELINESIZE);
-	end = round_up(end, CACHELINESIZE);
+	u32 cacheline_size, ctr;
+
+	asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
+	cacheline_size = 4 << ((ctr >> 16) & 0xf);
+
+	start = round_down(start, cacheline_size);
+	end = round_up(end, cacheline_size);
 	outer_inv_range(start, end);
 	while (start < end) {
 		asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
 		     : "memory");
-		start += CACHELINESIZE;
+		start += cacheline_size;
 	}
 	dsb();
 	isb();
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 2/8] msm: scm: Get cacheline size from CTR
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

Instead of hardcoding the cacheline size as 32, get the cacheline
size from the CTR register.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index 820c72165e19..c08786ebf116 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -27,9 +27,6 @@
 
 #include "scm.h"
 
-/* Cache line size for msm8x60 */
-#define CACHELINESIZE 32
-
 #define SCM_ENOMEM		-5
 #define SCM_EOPNOTSUPP		-4
 #define SCM_EINVAL_ADDR		-3
@@ -214,13 +211,18 @@ static int __scm_call(const struct scm_command *cmd)
 
 static void scm_inv_range(unsigned long start, unsigned long end)
 {
-	start = round_down(start, CACHELINESIZE);
-	end = round_up(end, CACHELINESIZE);
+	u32 cacheline_size, ctr;
+
+	asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
+	cacheline_size = 4 << ((ctr >> 16) & 0xf);
+
+	start = round_down(start, cacheline_size);
+	end = round_up(end, cacheline_size);
 	outer_inv_range(start, end);
 	while (start < end) {
 		asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
 		     : "memory");
-		start += CACHELINESIZE;
+		start += cacheline_size;
 	}
 	dsb();
 	isb();
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 2/8] msm: scm: Get cacheline size from CTR
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of hardcoding the cacheline size as 32, get the cacheline
size from the CTR register.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index 820c72165e19..c08786ebf116 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -27,9 +27,6 @@
 
 #include "scm.h"
 
-/* Cache line size for msm8x60 */
-#define CACHELINESIZE 32
-
 #define SCM_ENOMEM		-5
 #define SCM_EOPNOTSUPP		-4
 #define SCM_EINVAL_ADDR		-3
@@ -214,13 +211,18 @@ static int __scm_call(const struct scm_command *cmd)
 
 static void scm_inv_range(unsigned long start, unsigned long end)
 {
-	start = round_down(start, CACHELINESIZE);
-	end = round_up(end, CACHELINESIZE);
+	u32 cacheline_size, ctr;
+
+	asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
+	cacheline_size = 4 << ((ctr >> 16) & 0xf);
+
+	start = round_down(start, cacheline_size);
+	end = round_up(end, cacheline_size);
 	outer_inv_range(start, end);
 	while (start < end) {
 		asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
 		     : "memory");
-		start += CACHELINESIZE;
+		start += cacheline_size;
 	}
 	dsb();
 	isb();
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 3/8] msm: scm: Flush the command buffer only instead of the entire cache
  2014-08-05  1:31 ` Stephen Boyd
  (?)
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-arm-msm, Vikram Mulukutla, linux-kernel, linux-arm-kernel,
	Lina Iyer

From: Vikram Mulukutla <markivx@codeaurora.org>

scm_call flushes the entire cache before calling into the
secure world. This is both a performance penalty as well
as insufficient on SMP systems where the CPUs possess a
write-back L1 cache. Flush only the command and response
buffers instead, moving the responsibility of flushing any
other cached buffer (being passed to the secure world) to
callers.

Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index c08786ebf116..ec37b037e69c 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -196,12 +196,12 @@ static int __scm_call(const struct scm_command *cmd)
 	u32 cmd_addr = virt_to_phys(cmd);
 
 	/*
-	 * Flush the entire cache here so callers don't have to remember
-	 * to flush the cache when passing physical addresses to the secure
-	 * side in the buffer.
+	 * Flush the command buffer so that the secure world sees
+	 * the correct data.
 	 */
-	flush_cache_all();
-	outer_flush_all();
+	__cpuc_flush_dcache_area((void *)cmd, cmd->len);
+	outer_flush_range(cmd_addr, cmd_addr + cmd->len);
+
 	ret = smc(cmd_addr);
 	if (ret < 0)
 		ret = scm_remap_error(ret);
@@ -238,6 +238,13 @@ static void scm_inv_range(unsigned long start, unsigned long end)
  * @resp_len: length of the response buffer
  *
  * Sends a command to the SCM and waits for the command to finish processing.
+ *
+ * A note on cache maintenance:
+ * Note that any buffers that are expected to be accessed by the secure world
+ * must be flushed before invoking scm_call and invalidated in the cache
+ * immediately after scm_call returns. Cache maintenance on the command and
+ * 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)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 3/8] msm: scm: Flush the command buffer only instead of the entire cache
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: Vikram Mulukutla, linux-kernel, linux-arm-msm, linux-arm-kernel,
	Lina Iyer

From: Vikram Mulukutla <markivx@codeaurora.org>

scm_call flushes the entire cache before calling into the
secure world. This is both a performance penalty as well
as insufficient on SMP systems where the CPUs possess a
write-back L1 cache. Flush only the command and response
buffers instead, moving the responsibility of flushing any
other cached buffer (being passed to the secure world) to
callers.

Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index c08786ebf116..ec37b037e69c 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -196,12 +196,12 @@ static int __scm_call(const struct scm_command *cmd)
 	u32 cmd_addr = virt_to_phys(cmd);
 
 	/*
-	 * Flush the entire cache here so callers don't have to remember
-	 * to flush the cache when passing physical addresses to the secure
-	 * side in the buffer.
+	 * Flush the command buffer so that the secure world sees
+	 * the correct data.
 	 */
-	flush_cache_all();
-	outer_flush_all();
+	__cpuc_flush_dcache_area((void *)cmd, cmd->len);
+	outer_flush_range(cmd_addr, cmd_addr + cmd->len);
+
 	ret = smc(cmd_addr);
 	if (ret < 0)
 		ret = scm_remap_error(ret);
@@ -238,6 +238,13 @@ static void scm_inv_range(unsigned long start, unsigned long end)
  * @resp_len: length of the response buffer
  *
  * Sends a command to the SCM and waits for the command to finish processing.
+ *
+ * A note on cache maintenance:
+ * Note that any buffers that are expected to be accessed by the secure world
+ * must be flushed before invoking scm_call and invalidated in the cache
+ * immediately after scm_call returns. Cache maintenance on the command and
+ * 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)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 3/8] msm: scm: Flush the command buffer only instead of the entire cache
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Vikram Mulukutla <markivx@codeaurora.org>

scm_call flushes the entire cache before calling into the
secure world. This is both a performance penalty as well
as insufficient on SMP systems where the CPUs possess a
write-back L1 cache. Flush only the command and response
buffers instead, moving the responsibility of flushing any
other cached buffer (being passed to the secure world) to
callers.

Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index c08786ebf116..ec37b037e69c 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -196,12 +196,12 @@ static int __scm_call(const struct scm_command *cmd)
 	u32 cmd_addr = virt_to_phys(cmd);
 
 	/*
-	 * Flush the entire cache here so callers don't have to remember
-	 * to flush the cache when passing physical addresses to the secure
-	 * side in the buffer.
+	 * Flush the command buffer so that the secure world sees
+	 * the correct data.
 	 */
-	flush_cache_all();
-	outer_flush_all();
+	__cpuc_flush_dcache_area((void *)cmd, cmd->len);
+	outer_flush_range(cmd_addr, cmd_addr + cmd->len);
+
 	ret = smc(cmd_addr);
 	if (ret < 0)
 		ret = scm_remap_error(ret);
@@ -238,6 +238,13 @@ static void scm_inv_range(unsigned long start, unsigned long end)
  * @resp_len: length of the response buffer
  *
  * Sends a command to the SCM and waits for the command to finish processing.
+ *
+ * A note on cache maintenance:
+ * Note that any buffers that are expected to be accessed by the secure world
+ * must be flushed before invoking scm_call and invalidated in the cache
+ * immediately after scm_call returns. Cache maintenance on the command and
+ * 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)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 4/8] msm: scm: Add atomic SCM APIs
  2014-08-05  1:31 ` Stephen Boyd
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

The atomic SCM APIs are useful for commands that are guaranteed
by the secure side to be uninterruptable, atomic and SMP safe.
The calling convention use registers for passing parameters and
return values between the secure and non-secure side. Support
this interface with  scm_call_atomic[1-2]() functions
corresponding to the number of arguments passed.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-qcom/scm.h |  5 +++-
 2 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index ec37b037e69c..a05cad3fa1c5 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -286,6 +286,79 @@ out:
 }
 EXPORT_SYMBOL(scm_call);
 
+#define SCM_CLASS_REGISTER	(0x2 << 8)
+#define SCM_MASK_IRQS		BIT(5)
+#define SCM_ATOMIC(svc, cmd, n) (((((svc) << 10)|((cmd) & 0x3ff)) << 12) | \
+				SCM_CLASS_REGISTER | \
+				SCM_MASK_IRQS | \
+				(n & 0xf))
+
+/**
+ * scm_call_atomic1() - Send an atomic SCM command with one argument
+ * @svc_id: service identifier
+ * @cmd_id: command identifier
+ * @arg1: first argument
+ *
+ * This shall only be used with commands that are guaranteed to be
+ * uninterruptable, atomic and SMP safe.
+ */
+s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1)
+{
+	int context_id;
+	register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 1);
+	register u32 r1 asm("r1") = (u32)&context_id;
+	register u32 r2 asm("r2") = arg1;
+
+	asm volatile(
+		__asmeq("%0", "r0")
+		__asmeq("%1", "r0")
+		__asmeq("%2", "r1")
+		__asmeq("%3", "r2")
+#ifdef REQUIRES_SEC
+			".arch_extension sec\n"
+#endif
+		"smc	#0	@ switch to secure world\n"
+		: "=r" (r0)
+		: "r" (r0), "r" (r1), "r" (r2)
+		: "r3");
+	return r0;
+}
+EXPORT_SYMBOL(scm_call_atomic1);
+
+/**
+ * scm_call_atomic2() - Send an atomic SCM command with two arguments
+ * @svc_id: service identifier
+ * @cmd_id: command identifier
+ * @arg1: first argument
+ * @arg2: second argument
+ *
+ * This shall only be used with commands that are guaranteed to be
+ * uninterruptable, atomic and SMP safe.
+ */
+s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2)
+{
+	int context_id;
+	register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 2);
+	register u32 r1 asm("r1") = (u32)&context_id;
+	register u32 r2 asm("r2") = arg1;
+	register u32 r3 asm("r3") = arg2;
+
+	asm volatile(
+		__asmeq("%0", "r0")
+		__asmeq("%1", "r0")
+		__asmeq("%2", "r1")
+		__asmeq("%3", "r2")
+		__asmeq("%4", "r3")
+#ifdef REQUIRES_SEC
+			".arch_extension sec\n"
+#endif
+		"smc	#0	@ switch to secure world\n"
+		: "=r" (r0)
+		: "r" (r0), "r" (r1), "r" (r2), "r" (r3));
+	return r0;
+}
+EXPORT_SYMBOL(scm_call_atomic2);
+
 u32 scm_get_version(void)
 {
 	int context_id;
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index 00b31ea58f29..1f0f0180e767 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2014, The Linux Foundation. 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
@@ -18,6 +18,9 @@
 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);
 
+extern s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1);
+extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
+
 #define SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
 
 extern u32 scm_get_version(void);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 4/8] msm: scm: Add atomic SCM APIs
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

The atomic SCM APIs are useful for commands that are guaranteed
by the secure side to be uninterruptable, atomic and SMP safe.
The calling convention use registers for passing parameters and
return values between the secure and non-secure side. Support
this interface with  scm_call_atomic[1-2]() functions
corresponding to the number of arguments passed.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-qcom/scm.h |  5 +++-
 2 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index ec37b037e69c..a05cad3fa1c5 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -286,6 +286,79 @@ out:
 }
 EXPORT_SYMBOL(scm_call);
 
+#define SCM_CLASS_REGISTER	(0x2 << 8)
+#define SCM_MASK_IRQS		BIT(5)
+#define SCM_ATOMIC(svc, cmd, n) (((((svc) << 10)|((cmd) & 0x3ff)) << 12) | \
+				SCM_CLASS_REGISTER | \
+				SCM_MASK_IRQS | \
+				(n & 0xf))
+
+/**
+ * scm_call_atomic1() - Send an atomic SCM command with one argument
+ * @svc_id: service identifier
+ * @cmd_id: command identifier
+ * @arg1: first argument
+ *
+ * This shall only be used with commands that are guaranteed to be
+ * uninterruptable, atomic and SMP safe.
+ */
+s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1)
+{
+	int context_id;
+	register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 1);
+	register u32 r1 asm("r1") = (u32)&context_id;
+	register u32 r2 asm("r2") = arg1;
+
+	asm volatile(
+		__asmeq("%0", "r0")
+		__asmeq("%1", "r0")
+		__asmeq("%2", "r1")
+		__asmeq("%3", "r2")
+#ifdef REQUIRES_SEC
+			".arch_extension sec\n"
+#endif
+		"smc	#0	@ switch to secure world\n"
+		: "=r" (r0)
+		: "r" (r0), "r" (r1), "r" (r2)
+		: "r3");
+	return r0;
+}
+EXPORT_SYMBOL(scm_call_atomic1);
+
+/**
+ * scm_call_atomic2() - Send an atomic SCM command with two arguments
+ * @svc_id: service identifier
+ * @cmd_id: command identifier
+ * @arg1: first argument
+ * @arg2: second argument
+ *
+ * This shall only be used with commands that are guaranteed to be
+ * uninterruptable, atomic and SMP safe.
+ */
+s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2)
+{
+	int context_id;
+	register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 2);
+	register u32 r1 asm("r1") = (u32)&context_id;
+	register u32 r2 asm("r2") = arg1;
+	register u32 r3 asm("r3") = arg2;
+
+	asm volatile(
+		__asmeq("%0", "r0")
+		__asmeq("%1", "r0")
+		__asmeq("%2", "r1")
+		__asmeq("%3", "r2")
+		__asmeq("%4", "r3")
+#ifdef REQUIRES_SEC
+			".arch_extension sec\n"
+#endif
+		"smc	#0	@ switch to secure world\n"
+		: "=r" (r0)
+		: "r" (r0), "r" (r1), "r" (r2), "r" (r3));
+	return r0;
+}
+EXPORT_SYMBOL(scm_call_atomic2);
+
 u32 scm_get_version(void)
 {
 	int context_id;
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index 00b31ea58f29..1f0f0180e767 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2014, The Linux Foundation. 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
@@ -18,6 +18,9 @@
 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);
 
+extern s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1);
+extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
+
 #define SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
 
 extern u32 scm_get_version(void);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 5/8] msm: scm: Add API to query for service/command availability.
  2014-08-05  1:31 ` Stephen Boyd
  (?)
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-arm-msm, Saravana Kannan, linux-kernel, linux-arm-kernel,
	Lina Iyer

From: Saravana Kannan <skannan@codeaurora.org>

Some drivers may need to query the secure environment about the
availability of a particular service/command. Add support for
this.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
[sboyd@codeaurora.org: Add some commit text]

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 18 +++++++++++++++++-
 arch/arm/mach-qcom/scm.h |  2 ++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index a05cad3fa1c5..e80571f57ca4 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2014, The Linux Foundation. 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
@@ -394,3 +394,19 @@ u32 scm_get_version(void)
 	return version;
 }
 EXPORT_SYMBOL(scm_get_version);
+
+#define IS_CALL_AVAIL_CMD	1
+int scm_is_call_available(u32 svc_id, u32 cmd_id)
+{
+	int ret;
+	u32 svc_cmd = (svc_id << 10) | cmd_id;
+	u32 ret_val = 0;
+
+	ret = scm_call(SCM_SVC_INFO, IS_CALL_AVAIL_CMD, &svc_cmd,
+			sizeof(svc_cmd), &ret_val, sizeof(ret_val));
+	if (ret)
+		return ret;
+
+	return ret_val;
+}
+EXPORT_SYMBOL(scm_is_call_available);
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index 1f0f0180e767..f94c7279616a 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -14,6 +14,7 @@
 
 #define SCM_SVC_BOOT			0x1
 #define SCM_SVC_PIL			0x2
+#define SCM_SVC_INFO			0x6
 
 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);
@@ -24,5 +25,6 @@ extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
 #define SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
 
 extern u32 scm_get_version(void);
+extern int scm_is_call_available(u32 svc_id, u32 cmd_id);
 
 #endif
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 5/8] msm: scm: Add API to query for service/command availability.
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: Saravana Kannan, linux-kernel, linux-arm-msm, linux-arm-kernel,
	Lina Iyer

From: Saravana Kannan <skannan@codeaurora.org>

Some drivers may need to query the secure environment about the
availability of a particular service/command. Add support for
this.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
[sboyd@codeaurora.org: Add some commit text]

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 18 +++++++++++++++++-
 arch/arm/mach-qcom/scm.h |  2 ++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index a05cad3fa1c5..e80571f57ca4 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2014, The Linux Foundation. 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
@@ -394,3 +394,19 @@ u32 scm_get_version(void)
 	return version;
 }
 EXPORT_SYMBOL(scm_get_version);
+
+#define IS_CALL_AVAIL_CMD	1
+int scm_is_call_available(u32 svc_id, u32 cmd_id)
+{
+	int ret;
+	u32 svc_cmd = (svc_id << 10) | cmd_id;
+	u32 ret_val = 0;
+
+	ret = scm_call(SCM_SVC_INFO, IS_CALL_AVAIL_CMD, &svc_cmd,
+			sizeof(svc_cmd), &ret_val, sizeof(ret_val));
+	if (ret)
+		return ret;
+
+	return ret_val;
+}
+EXPORT_SYMBOL(scm_is_call_available);
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index 1f0f0180e767..f94c7279616a 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -14,6 +14,7 @@
 
 #define SCM_SVC_BOOT			0x1
 #define SCM_SVC_PIL			0x2
+#define SCM_SVC_INFO			0x6
 
 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);
@@ -24,5 +25,6 @@ extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
 #define SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
 
 extern u32 scm_get_version(void);
+extern int scm_is_call_available(u32 svc_id, u32 cmd_id);
 
 #endif
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 5/8] msm: scm: Add API to query for service/command availability.
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Saravana Kannan <skannan@codeaurora.org>

Some drivers may need to query the secure environment about the
availability of a particular service/command. Add support for
this.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
[sboyd at codeaurora.org: Add some commit text]

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 18 +++++++++++++++++-
 arch/arm/mach-qcom/scm.h |  2 ++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index a05cad3fa1c5..e80571f57ca4 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2014, The Linux Foundation. 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
@@ -394,3 +394,19 @@ u32 scm_get_version(void)
 	return version;
 }
 EXPORT_SYMBOL(scm_get_version);
+
+#define IS_CALL_AVAIL_CMD	1
+int scm_is_call_available(u32 svc_id, u32 cmd_id)
+{
+	int ret;
+	u32 svc_cmd = (svc_id << 10) | cmd_id;
+	u32 ret_val = 0;
+
+	ret = scm_call(SCM_SVC_INFO, IS_CALL_AVAIL_CMD, &svc_cmd,
+			sizeof(svc_cmd), &ret_val, sizeof(ret_val));
+	if (ret)
+		return ret;
+
+	return ret_val;
+}
+EXPORT_SYMBOL(scm_is_call_available);
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index 1f0f0180e767..f94c7279616a 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -14,6 +14,7 @@
 
 #define SCM_SVC_BOOT			0x1
 #define SCM_SVC_PIL			0x2
+#define SCM_SVC_INFO			0x6
 
 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);
@@ -24,5 +25,6 @@ extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
 #define SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
 
 extern u32 scm_get_version(void);
+extern int scm_is_call_available(u32 svc_id, u32 cmd_id);
 
 #endif
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 6/8] msm: scm: Add a feat version query API
  2014-08-05  1:31 ` Stephen Boyd
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

Some users of SCM need to detect features and also detect if
those features have certain versions available. Add this API.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 13 +++++++++++++
 arch/arm/mach-qcom/scm.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index e80571f57ca4..7c62c03324f4 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -410,3 +410,16 @@ int scm_is_call_available(u32 svc_id, u32 cmd_id)
 	return ret_val;
 }
 EXPORT_SYMBOL(scm_is_call_available);
+
+#define GET_FEAT_VERSION_CMD	3
+int scm_get_feat_version(u32 feat)
+{
+	if (scm_is_call_available(SCM_SVC_INFO, GET_FEAT_VERSION_CMD)) {
+		u32 version;
+		if (!scm_call(SCM_SVC_INFO, GET_FEAT_VERSION_CMD, &feat,
+				sizeof(feat), &version, sizeof(version)))
+			return version;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(scm_get_feat_version);
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index f94c7279616a..6348b08524e7 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -26,5 +26,6 @@ extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
 
 extern u32 scm_get_version(void);
 extern int scm_is_call_available(u32 svc_id, u32 cmd_id);
+extern int scm_get_feat_version(u32 feat);
 
 #endif
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 6/8] msm: scm: Add a feat version query API
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

Some users of SCM need to detect features and also detect if
those features have certain versions available. Add this API.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 13 +++++++++++++
 arch/arm/mach-qcom/scm.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index e80571f57ca4..7c62c03324f4 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -410,3 +410,16 @@ int scm_is_call_available(u32 svc_id, u32 cmd_id)
 	return ret_val;
 }
 EXPORT_SYMBOL(scm_is_call_available);
+
+#define GET_FEAT_VERSION_CMD	3
+int scm_get_feat_version(u32 feat)
+{
+	if (scm_is_call_available(SCM_SVC_INFO, GET_FEAT_VERSION_CMD)) {
+		u32 version;
+		if (!scm_call(SCM_SVC_INFO, GET_FEAT_VERSION_CMD, &feat,
+				sizeof(feat), &version, sizeof(version)))
+			return version;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(scm_get_feat_version);
diff --git a/arch/arm/mach-qcom/scm.h b/arch/arm/mach-qcom/scm.h
index f94c7279616a..6348b08524e7 100644
--- a/arch/arm/mach-qcom/scm.h
+++ b/arch/arm/mach-qcom/scm.h
@@ -26,5 +26,6 @@ extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2);
 
 extern u32 scm_get_version(void);
 extern int scm_is_call_available(u32 svc_id, u32 cmd_id);
+extern int scm_get_feat_version(u32 feat);
 
 #endif
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 7/8] msm: scm: Add logging of actual return code from scm call
  2014-08-05  1:31 ` Stephen Boyd
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: Olav Haugan, linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

From: Olav Haugan <ohaugan@codeaurora.org>

When an error occurs during an scm call the error returned is
remapped so we lose the original error code. This means that
when an error occurs we have no idea what actually failed within
the secure environment.

Add a logging statement that will log the actual error code from
scm call allowing us to easily determine what caused the error
to occur.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index 7c62c03324f4..cfd4717aec78 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -152,6 +152,7 @@ static inline void *scm_get_response_buffer(const struct scm_response *rsp)
 
 static int scm_remap_error(int err)
 {
+	pr_err("scm_call failed with error code %d\n", err);
 	switch (err) {
 	case SCM_ERROR:
 		return -EIO;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 7/8] msm: scm: Add logging of actual return code from scm call
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Olav Haugan <ohaugan@codeaurora.org>

When an error occurs during an scm call the error returned is
remapped so we lose the original error code. This means that
when an error occurs we have no idea what actually failed within
the secure environment.

Add a logging statement that will log the actual error code from
scm call allowing us to easily determine what caused the error
to occur.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/scm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index 7c62c03324f4..cfd4717aec78 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -152,6 +152,7 @@ static inline void *scm_get_response_buffer(const struct scm_response *rsp)
 
 static int scm_remap_error(int err)
 {
+	pr_err("scm_call failed with error code %d\n", err);
 	switch (err) {
 	case SCM_ERROR:
 		return -EIO;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2014-08-05  1:31 ` Stephen Boyd
@ 2014-08-05  1:31   ` Stephen Boyd
  -1 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: David Brown, Kumar Gala
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer

Architectural changes in the ARM Linux kernel tree mandate
the eventual removal of the mach-* directories. Move the
scm driver to drivers/soc/qcom and the scm header to
include/soc/qcom to support that removal.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/Kconfig                     | 3 ---
 arch/arm/mach-qcom/Makefile                    | 4 +---
 arch/arm/mach-qcom/scm-boot.c                  | 2 +-
 drivers/soc/qcom/Kconfig                       | 2 ++
 drivers/soc/qcom/Makefile                      | 2 ++
 {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c | 3 ++-
 {arch/arm/mach-qcom => include/soc/qcom}/scm.h | 0
 7 files changed, 8 insertions(+), 8 deletions(-)
 rename {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c (99%)
 rename {arch/arm/mach-qcom => include/soc/qcom}/scm.h (100%)

diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig
index ee5697ba05bc..57d112d62018 100644
--- a/arch/arm/mach-qcom/Kconfig
+++ b/arch/arm/mach-qcom/Kconfig
@@ -23,7 +23,4 @@ config ARCH_MSM8974
 	bool "Enable support for MSM8974"
 	select HAVE_ARM_ARCH_TIMER
 
-config QCOM_SCM
-	bool
-
 endif
diff --git a/arch/arm/mach-qcom/Makefile b/arch/arm/mach-qcom/Makefile
index 8f756ae1ae31..db41e8c27aec 100644
--- a/arch/arm/mach-qcom/Makefile
+++ b/arch/arm/mach-qcom/Makefile
@@ -1,5 +1,3 @@
 obj-y			:= board.o
 obj-$(CONFIG_SMP)	+= platsmp.o
-obj-$(CONFIG_QCOM_SCM)	+= scm.o scm-boot.o
-
-CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
+obj-$(CONFIG_QCOM_SCM)	+= scm-boot.o
diff --git a/arch/arm/mach-qcom/scm-boot.c b/arch/arm/mach-qcom/scm-boot.c
index 45cee3e469a5..5add20e64d99 100644
--- a/arch/arm/mach-qcom/scm-boot.c
+++ b/arch/arm/mach-qcom/scm-boot.c
@@ -17,8 +17,8 @@
 
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <soc/qcom/scm.h>
 
-#include "scm.h"
 #include "scm-boot.h"
 
 /*
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 7bd2c94f54a4..7dcd554496c7 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -9,3 +9,5 @@ config QCOM_GSBI
           functions for connecting the underlying serial UART, SPI, and I2C
           devices to the output pins.
 
+config QCOM_SCM
+	bool
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index 438901257ac1..a39446d08ac6 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -1 +1,3 @@
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
+CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
+obj-$(CONFIG_QCOM_SCM) += scm.o
diff --git a/arch/arm/mach-qcom/scm.c b/drivers/soc/qcom/scm.c
similarity index 99%
rename from arch/arm/mach-qcom/scm.c
rename to drivers/soc/qcom/scm.c
index cfd4717aec78..2e98d80e2387 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/drivers/soc/qcom/scm.c
@@ -22,10 +22,11 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 
+#include <soc/qcom/scm.h>
+
 #include <asm/outercache.h>
 #include <asm/cacheflush.h>
 
-#include "scm.h"
 
 #define SCM_ENOMEM		-5
 #define SCM_EOPNOTSUPP		-4
diff --git a/arch/arm/mach-qcom/scm.h b/include/soc/qcom/scm.h
similarity index 100%
rename from arch/arm/mach-qcom/scm.h
rename to include/soc/qcom/scm.h
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2014-08-05  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 43+ messages in thread
From: Stephen Boyd @ 2014-08-05  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

Architectural changes in the ARM Linux kernel tree mandate
the eventual removal of the mach-* directories. Move the
scm driver to drivers/soc/qcom and the scm header to
include/soc/qcom to support that removal.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/Kconfig                     | 3 ---
 arch/arm/mach-qcom/Makefile                    | 4 +---
 arch/arm/mach-qcom/scm-boot.c                  | 2 +-
 drivers/soc/qcom/Kconfig                       | 2 ++
 drivers/soc/qcom/Makefile                      | 2 ++
 {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c | 3 ++-
 {arch/arm/mach-qcom => include/soc/qcom}/scm.h | 0
 7 files changed, 8 insertions(+), 8 deletions(-)
 rename {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c (99%)
 rename {arch/arm/mach-qcom => include/soc/qcom}/scm.h (100%)

diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig
index ee5697ba05bc..57d112d62018 100644
--- a/arch/arm/mach-qcom/Kconfig
+++ b/arch/arm/mach-qcom/Kconfig
@@ -23,7 +23,4 @@ config ARCH_MSM8974
 	bool "Enable support for MSM8974"
 	select HAVE_ARM_ARCH_TIMER
 
-config QCOM_SCM
-	bool
-
 endif
diff --git a/arch/arm/mach-qcom/Makefile b/arch/arm/mach-qcom/Makefile
index 8f756ae1ae31..db41e8c27aec 100644
--- a/arch/arm/mach-qcom/Makefile
+++ b/arch/arm/mach-qcom/Makefile
@@ -1,5 +1,3 @@
 obj-y			:= board.o
 obj-$(CONFIG_SMP)	+= platsmp.o
-obj-$(CONFIG_QCOM_SCM)	+= scm.o scm-boot.o
-
-CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
+obj-$(CONFIG_QCOM_SCM)	+= scm-boot.o
diff --git a/arch/arm/mach-qcom/scm-boot.c b/arch/arm/mach-qcom/scm-boot.c
index 45cee3e469a5..5add20e64d99 100644
--- a/arch/arm/mach-qcom/scm-boot.c
+++ b/arch/arm/mach-qcom/scm-boot.c
@@ -17,8 +17,8 @@
 
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <soc/qcom/scm.h>
 
-#include "scm.h"
 #include "scm-boot.h"
 
 /*
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 7bd2c94f54a4..7dcd554496c7 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -9,3 +9,5 @@ config QCOM_GSBI
           functions for connecting the underlying serial UART, SPI, and I2C
           devices to the output pins.
 
+config QCOM_SCM
+	bool
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index 438901257ac1..a39446d08ac6 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -1 +1,3 @@
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
+CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
+obj-$(CONFIG_QCOM_SCM) += scm.o
diff --git a/arch/arm/mach-qcom/scm.c b/drivers/soc/qcom/scm.c
similarity index 99%
rename from arch/arm/mach-qcom/scm.c
rename to drivers/soc/qcom/scm.c
index cfd4717aec78..2e98d80e2387 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/drivers/soc/qcom/scm.c
@@ -22,10 +22,11 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 
+#include <soc/qcom/scm.h>
+
 #include <asm/outercache.h>
 #include <asm/cacheflush.h>
 
-#include "scm.h"
 
 #define SCM_ENOMEM		-5
 #define SCM_EOPNOTSUPP		-4
diff --git a/arch/arm/mach-qcom/scm.h b/include/soc/qcom/scm.h
similarity index 100%
rename from arch/arm/mach-qcom/scm.h
rename to include/soc/qcom/scm.h
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2014-08-05  1:31   ` Stephen Boyd
@ 2014-08-05  4:07     ` Lina Iyer
  -1 siblings, 0 replies; 43+ messages in thread
From: Lina Iyer @ 2014-08-05  4:07 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: David Brown, Kumar Gala, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Lina Iyer

On Mon, 4 Aug 2014, Stephen Boyd wrote:

> Architectural changes in the ARM Linux kernel tree mandate
> the eventual removal of the mach-* directories. Move the
> scm driver to drivers/soc/qcom and the scm header to
> include/soc/qcom to support that removal.
> 
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
>  arch/arm/mach-qcom/Kconfig                     | 3 ---
>  arch/arm/mach-qcom/Makefile                    | 4 +---
>  arch/arm/mach-qcom/scm-boot.c                  | 2 +-

 diff --git a/arch/arm/mach-qcom/scm.h b/include/soc/qcom/scm.h
> similarity index 100%
> rename from arch/arm/mach-qcom/scm.h
> rename to include/soc/qcom/scm.h

Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2014-08-05  4:07     ` Lina Iyer
  0 siblings, 0 replies; 43+ messages in thread
From: Lina Iyer @ 2014-08-05  4:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 4 Aug 2014, Stephen Boyd wrote:

> Architectural changes in the ARM Linux kernel tree mandate
> the eventual removal of the mach-* directories. Move the
> scm driver to drivers/soc/qcom and the scm header to
> include/soc/qcom to support that removal.
> 
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
>  arch/arm/mach-qcom/Kconfig                     | 3 ---
>  arch/arm/mach-qcom/Makefile                    | 4 +---
>  arch/arm/mach-qcom/scm-boot.c                  | 2 +-

 diff --git a/arch/arm/mach-qcom/scm.h b/include/soc/qcom/scm.h
> similarity index 100%
> rename from arch/arm/mach-qcom/scm.h
> rename to include/soc/qcom/scm.h

Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2014-08-05  4:07     ` Lina Iyer
  (?)
@ 2014-08-05 20:12       ` Bjorn Andersson
  -1 siblings, 0 replies; 43+ messages in thread
From: Bjorn Andersson @ 2014-08-05 20:12 UTC (permalink / raw)
  To: Lina Iyer
  Cc: Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel

On Mon, Aug 4, 2014 at 9:07 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> On Mon, 4 Aug 2014, Stephen Boyd wrote:
[...]
> Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?

Yes, we can do that.

But as of now we seem to only have one caller of this wrapper, so
maybe we could move the functionality into platsmp.c and drop the file
instead?

I looked at this a while back and was considering suggesting that we
move the scm access behind firmware_ops, but then we should probably
also extend the ops struct with all the needed ops related to firmware
loading and other things; so I'm not sure if it's a beneficial move.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2014-08-05 20:12       ` Bjorn Andersson
  0 siblings, 0 replies; 43+ messages in thread
From: Bjorn Andersson @ 2014-08-05 20:12 UTC (permalink / raw)
  To: Lina Iyer
  Cc: Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel

On Mon, Aug 4, 2014 at 9:07 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> On Mon, 4 Aug 2014, Stephen Boyd wrote:
[...]
> Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?

Yes, we can do that.

But as of now we seem to only have one caller of this wrapper, so
maybe we could move the functionality into platsmp.c and drop the file
instead?

I looked at this a while back and was considering suggesting that we
move the scm access behind firmware_ops, but then we should probably
also extend the ops struct with all the needed ops related to firmware
loading and other things; so I'm not sure if it's a beneficial move.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2014-08-05 20:12       ` Bjorn Andersson
  0 siblings, 0 replies; 43+ messages in thread
From: Bjorn Andersson @ 2014-08-05 20:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 4, 2014 at 9:07 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> On Mon, 4 Aug 2014, Stephen Boyd wrote:
[...]
> Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?

Yes, we can do that.

But as of now we seem to only have one caller of this wrapper, so
maybe we could move the functionality into platsmp.c and drop the file
instead?

I looked at this a while back and was considering suggesting that we
move the scm access behind firmware_ops, but then we should probably
also extend the ops struct with all the needed ops related to firmware
loading and other things; so I'm not sure if it's a beneficial move.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2014-08-05 20:12       ` Bjorn Andersson
  (?)
@ 2014-08-05 20:17         ` Lina Iyer
  -1 siblings, 0 replies; 43+ messages in thread
From: Lina Iyer @ 2014-08-05 20:17 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Lina Iyer, Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel




On Tue, 5 Aug 2014, Bjorn Andersson wrote:

> On Mon, Aug 4, 2014 at 9:07 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> > On Mon, 4 Aug 2014, Stephen Boyd wrote:
> [...]
> > Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?
> 
> Yes, we can do that.
> 
> But as of now we seem to only have one caller of this wrapper, so
> maybe we could move the functionality into platsmp.c and drop the file
> instead?
I am working on cpuidle drivers for QCOM targets and would very much
like the scm-boot to be accessible from drivers/soc/qcom.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2014-08-05 20:17         ` Lina Iyer
  0 siblings, 0 replies; 43+ messages in thread
From: Lina Iyer @ 2014-08-05 20:17 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Lina Iyer, Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel




On Tue, 5 Aug 2014, Bjorn Andersson wrote:

> On Mon, Aug 4, 2014 at 9:07 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> > On Mon, 4 Aug 2014, Stephen Boyd wrote:
> [...]
> > Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?
> 
> Yes, we can do that.
> 
> But as of now we seem to only have one caller of this wrapper, so
> maybe we could move the functionality into platsmp.c and drop the file
> instead?
I am working on cpuidle drivers for QCOM targets and would very much
like the scm-boot to be accessible from drivers/soc/qcom.


^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2014-08-05 20:17         ` Lina Iyer
  0 siblings, 0 replies; 43+ messages in thread
From: Lina Iyer @ 2014-08-05 20:17 UTC (permalink / raw)
  To: linux-arm-kernel




On Tue, 5 Aug 2014, Bjorn Andersson wrote:

> On Mon, Aug 4, 2014 at 9:07 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> > On Mon, 4 Aug 2014, Stephen Boyd wrote:
> [...]
> > Could we move scm-boot.c as well to drivers/soc/qcom and scm-boot.h to include/soc/qcom ?
> 
> Yes, we can do that.
> 
> But as of now we seem to only have one caller of this wrapper, so
> maybe we could move the functionality into platsmp.c and drop the file
> instead?
I am working on cpuidle drivers for QCOM targets and would very much
like the scm-boot to be accessible from drivers/soc/qcom.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/8] qcom SCM updates
  2014-08-05  1:31 ` Stephen Boyd
@ 2014-09-17 22:08   ` Kumar Gala
  -1 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2014-09-17 22:08 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: David Brown, linux-kernel, linux-arm-msm, linux-arm-kernel, Lina Iyer


On Aug 4, 2014, at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:

> The SCM code in the mainline kernel is woefully out of data from what
> is in the downstream msm kernels. Update the code to be at least 
> functionally correct and useful for features like cpuidle and
> suspend.
> 
> Olav Haugan (1):
>  msm: scm: Add logging of actual return code from scm call
> 
> Saravana Kannan (1):
>  msm: scm: Add API to query for service/command availability.
> 
> Stephen Boyd (5):
>  msm: scm: Fix incorrect cache invalidation
>  msm: scm: Get cacheline size from CTR
>  msm: scm: Add atomic SCM APIs
>  msm: scm: Add a feat version query API
>  msm: scm: Move the scm driver to drivers/soc/qcom
> 
> Vikram Mulukutla (1):
>  msm: scm: Flush the command buffer only instead of the entire cache
> 
> arch/arm/mach-qcom/Kconfig                     |   3 -
> arch/arm/mach-qcom/Makefile                    |   4 +-
> arch/arm/mach-qcom/scm-boot.c                  |   2 +-
> drivers/soc/qcom/Kconfig                       |   2 +
> drivers/soc/qcom/Makefile                      |   2 +
> {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c | 162 ++++++++++++++++++++++---
> {arch/arm/mach-qcom => include/soc/qcom}/scm.h |   8 +-
> 7 files changed, 158 insertions(+), 25 deletions(-)
> rename {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c (62%)
> rename {arch/arm/mach-qcom => include/soc/qcom}/scm.h (69%)

I took patches 1-4,7-8.  There are no immediate users for 5-6 at this time.

- k

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 0/8] qcom SCM updates
@ 2014-09-17 22:08   ` Kumar Gala
  0 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2014-09-17 22:08 UTC (permalink / raw)
  To: linux-arm-kernel


On Aug 4, 2014, at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:

> The SCM code in the mainline kernel is woefully out of data from what
> is in the downstream msm kernels. Update the code to be at least 
> functionally correct and useful for features like cpuidle and
> suspend.
> 
> Olav Haugan (1):
>  msm: scm: Add logging of actual return code from scm call
> 
> Saravana Kannan (1):
>  msm: scm: Add API to query for service/command availability.
> 
> Stephen Boyd (5):
>  msm: scm: Fix incorrect cache invalidation
>  msm: scm: Get cacheline size from CTR
>  msm: scm: Add atomic SCM APIs
>  msm: scm: Add a feat version query API
>  msm: scm: Move the scm driver to drivers/soc/qcom
> 
> Vikram Mulukutla (1):
>  msm: scm: Flush the command buffer only instead of the entire cache
> 
> arch/arm/mach-qcom/Kconfig                     |   3 -
> arch/arm/mach-qcom/Makefile                    |   4 +-
> arch/arm/mach-qcom/scm-boot.c                  |   2 +-
> drivers/soc/qcom/Kconfig                       |   2 +
> drivers/soc/qcom/Makefile                      |   2 +
> {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c | 162 ++++++++++++++++++++++---
> {arch/arm/mach-qcom => include/soc/qcom}/scm.h |   8 +-
> 7 files changed, 158 insertions(+), 25 deletions(-)
> rename {arch/arm/mach-qcom => drivers/soc/qcom}/scm.c (62%)
> rename {arch/arm/mach-qcom => include/soc/qcom}/scm.h (69%)

I took patches 1-4,7-8.  There are no immediate users for 5-6 at this time.

- k

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2014-08-05  1:31   ` Stephen Boyd
  (?)
@ 2015-01-22  1:13     ` Olof Johansson
  -1 siblings, 0 replies; 43+ messages in thread
From: Olof Johansson @ 2015-01-22  1:13 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: David Brown, Kumar Gala, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Lina Iyer

I just saw this in the pull request from Kumar, so this is a bit late
w.r.t. to the patch, but so was his merging of the code. :)



On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> Architectural changes in the ARM Linux kernel tree mandate
> the eventual removal of the mach-* directories. Move the
> scm driver to drivers/soc/qcom and the scm header to
> include/soc/qcom to support that removal.

The idea is not blindly move one dumping ground to a new place.

I see only two exported functions from scm.c:

scm_get_version: This is not used anywhere in the kernel and can just be removed
scm_call: This is used by scm-boot, and would be better to translate
over to firmware_ops in the first place.


So, can you please rework this with the above in mind instead of just
moving the files over? Thanks!


-Olof

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-22  1:13     ` Olof Johansson
  0 siblings, 0 replies; 43+ messages in thread
From: Olof Johansson @ 2015-01-22  1:13 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: David Brown, Kumar Gala, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Lina Iyer

I just saw this in the pull request from Kumar, so this is a bit late
w.r.t. to the patch, but so was his merging of the code. :)



On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> Architectural changes in the ARM Linux kernel tree mandate
> the eventual removal of the mach-* directories. Move the
> scm driver to drivers/soc/qcom and the scm header to
> include/soc/qcom to support that removal.

The idea is not blindly move one dumping ground to a new place.

I see only two exported functions from scm.c:

scm_get_version: This is not used anywhere in the kernel and can just be removed
scm_call: This is used by scm-boot, and would be better to translate
over to firmware_ops in the first place.


So, can you please rework this with the above in mind instead of just
moving the files over? Thanks!


-Olof

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-22  1:13     ` Olof Johansson
  0 siblings, 0 replies; 43+ messages in thread
From: Olof Johansson @ 2015-01-22  1:13 UTC (permalink / raw)
  To: linux-arm-kernel

I just saw this in the pull request from Kumar, so this is a bit late
w.r.t. to the patch, but so was his merging of the code. :)



On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> Architectural changes in the ARM Linux kernel tree mandate
> the eventual removal of the mach-* directories. Move the
> scm driver to drivers/soc/qcom and the scm header to
> include/soc/qcom to support that removal.

The idea is not blindly move one dumping ground to a new place.

I see only two exported functions from scm.c:

scm_get_version: This is not used anywhere in the kernel and can just be removed
scm_call: This is used by scm-boot, and would be better to translate
over to firmware_ops in the first place.


So, can you please rework this with the above in mind instead of just
moving the files over? Thanks!


-Olof

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2015-01-22  1:13     ` Olof Johansson
  (?)
@ 2015-01-22  1:53       ` Bjorn Andersson
  -1 siblings, 0 replies; 43+ messages in thread
From: Bjorn Andersson @ 2015-01-22  1:53 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel, Lina Iyer

On Wed, Jan 21, 2015 at 5:13 PM, Olof Johansson <olof@lixom.net> wrote:
[..]
> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> Architectural changes in the ARM Linux kernel tree mandate
>> the eventual removal of the mach-* directories. Move the
>> scm driver to drivers/soc/qcom and the scm header to
>> include/soc/qcom to support that removal.
>
> The idea is not blindly move one dumping ground to a new place.
>
> I see only two exported functions from scm.c:
>
> scm_get_version: This is not used anywhere in the kernel and can just be removed
> scm_call: This is used by scm-boot, and would be better to translate
> over to firmware_ops in the first place.
>

Hi Olof,

I started this a while ago, as it felt like the right thing to do <tm>.

The problem with this approach is that e.g. firmware loading is
partially handled through this interface. So implementing a remoteproc
driver for wifi etc required me to add 6 new ops to the struct,
loading the modem looks like it requires one more. HDMI requires one.

Looking at the downstream branch there's a bunch more (20+), so we
would explode the firmware_ops struct with Qualcomm "specific" ops.
This is not necessarily a bad idea, but needs to be considered before
we jump the gun.


I haven't looked at the arm64 stuff in detail, but it looks to be
shared between the two platforms, so either way it seems like the
right approach to have this moved out to drivers/soc/qcom.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-22  1:53       ` Bjorn Andersson
  0 siblings, 0 replies; 43+ messages in thread
From: Bjorn Andersson @ 2015-01-22  1:53 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel, Lina Iyer

On Wed, Jan 21, 2015 at 5:13 PM, Olof Johansson <olof@lixom.net> wrote:
[..]
> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> Architectural changes in the ARM Linux kernel tree mandate
>> the eventual removal of the mach-* directories. Move the
>> scm driver to drivers/soc/qcom and the scm header to
>> include/soc/qcom to support that removal.
>
> The idea is not blindly move one dumping ground to a new place.
>
> I see only two exported functions from scm.c:
>
> scm_get_version: This is not used anywhere in the kernel and can just be removed
> scm_call: This is used by scm-boot, and would be better to translate
> over to firmware_ops in the first place.
>

Hi Olof,

I started this a while ago, as it felt like the right thing to do <tm>.

The problem with this approach is that e.g. firmware loading is
partially handled through this interface. So implementing a remoteproc
driver for wifi etc required me to add 6 new ops to the struct,
loading the modem looks like it requires one more. HDMI requires one.

Looking at the downstream branch there's a bunch more (20+), so we
would explode the firmware_ops struct with Qualcomm "specific" ops.
This is not necessarily a bad idea, but needs to be considered before
we jump the gun.


I haven't looked at the arm64 stuff in detail, but it looks to be
shared between the two platforms, so either way it seems like the
right approach to have this moved out to drivers/soc/qcom.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-22  1:53       ` Bjorn Andersson
  0 siblings, 0 replies; 43+ messages in thread
From: Bjorn Andersson @ 2015-01-22  1:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 21, 2015 at 5:13 PM, Olof Johansson <olof@lixom.net> wrote:
[..]
> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> Architectural changes in the ARM Linux kernel tree mandate
>> the eventual removal of the mach-* directories. Move the
>> scm driver to drivers/soc/qcom and the scm header to
>> include/soc/qcom to support that removal.
>
> The idea is not blindly move one dumping ground to a new place.
>
> I see only two exported functions from scm.c:
>
> scm_get_version: This is not used anywhere in the kernel and can just be removed
> scm_call: This is used by scm-boot, and would be better to translate
> over to firmware_ops in the first place.
>

Hi Olof,

I started this a while ago, as it felt like the right thing to do <tm>.

The problem with this approach is that e.g. firmware loading is
partially handled through this interface. So implementing a remoteproc
driver for wifi etc required me to add 6 new ops to the struct,
loading the modem looks like it requires one more. HDMI requires one.

Looking at the downstream branch there's a bunch more (20+), so we
would explode the firmware_ops struct with Qualcomm "specific" ops.
This is not necessarily a bad idea, but needs to be considered before
we jump the gun.


I haven't looked at the arm64 stuff in detail, but it looks to be
shared between the two platforms, so either way it seems like the
right approach to have this moved out to drivers/soc/qcom.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2015-01-22  1:53       ` Bjorn Andersson
  (?)
@ 2015-01-22 16:49         ` Kumar Gala
  -1 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2015-01-22 16:49 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Stephen Boyd, Bjorn Andersson, David Brown, linux-kernel,
	linux-arm-msm, linux-arm-kernel, Lina Iyer


On Jan 21, 2015, at 7:53 PM, Bjorn Andersson <bjorn@kryo.se> wrote:

> On Wed, Jan 21, 2015 at 5:13 PM, Olof Johansson <olof@lixom.net> wrote:
> [..]
>> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>> Architectural changes in the ARM Linux kernel tree mandate
>>> the eventual removal of the mach-* directories. Move the
>>> scm driver to drivers/soc/qcom and the scm header to
>>> include/soc/qcom to support that removal.
>> 
>> The idea is not blindly move one dumping ground to a new place.
>> 
>> I see only two exported functions from scm.c:
>> 
>> scm_get_version: This is not used anywhere in the kernel and can just be removed
>> scm_call: This is used by scm-boot, and would be better to translate
>> over to firmware_ops in the first place.
>> 
> 
> Hi Olof,
> 
> I started this a while ago, as it felt like the right thing to do <tm>.
> 
> The problem with this approach is that e.g. firmware loading is
> partially handled through this interface. So implementing a remoteproc
> driver for wifi etc required me to add 6 new ops to the struct,
> loading the modem looks like it requires one more. HDMI requires one.
> 
> Looking at the downstream branch there's a bunch more (20+), so we
> would explode the firmware_ops struct with Qualcomm "specific" ops.
> This is not necessarily a bad idea, but needs to be considered before
> we jump the gun.
> 
> 
> I haven't looked at the arm64 stuff in detail, but it looks to be
> shared between the two platforms, so either way it seems like the
> right approach to have this moved out to drivers/soc/qcom.

As Bjorn says the scm interface ends up having a number of qcom specific calls that I don’t think the firmware ops should be implementing.  I don’t see any value in adding qcom specific function pointers to the ops struct just to create another level of indirection.

I’m fine with adding a firmware_ops implementation that uses scm for those things that firmware_ops has today.  However, I’m not clear on what the view of extending firmware_ops to arm64 is.  If we do this do we move the firmware_ops code into drivers/soc ?

- k

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-22 16:49         ` Kumar Gala
  0 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2015-01-22 16:49 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Stephen Boyd, Bjorn Andersson, David Brown, linux-kernel,
	linux-arm-msm, linux-arm-kernel, Lina Iyer


On Jan 21, 2015, at 7:53 PM, Bjorn Andersson <bjorn@kryo.se> wrote:

> On Wed, Jan 21, 2015 at 5:13 PM, Olof Johansson <olof@lixom.net> wrote:
> [..]
>> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>> Architectural changes in the ARM Linux kernel tree mandate
>>> the eventual removal of the mach-* directories. Move the
>>> scm driver to drivers/soc/qcom and the scm header to
>>> include/soc/qcom to support that removal.
>> 
>> The idea is not blindly move one dumping ground to a new place.
>> 
>> I see only two exported functions from scm.c:
>> 
>> scm_get_version: This is not used anywhere in the kernel and can just be removed
>> scm_call: This is used by scm-boot, and would be better to translate
>> over to firmware_ops in the first place.
>> 
> 
> Hi Olof,
> 
> I started this a while ago, as it felt like the right thing to do <tm>.
> 
> The problem with this approach is that e.g. firmware loading is
> partially handled through this interface. So implementing a remoteproc
> driver for wifi etc required me to add 6 new ops to the struct,
> loading the modem looks like it requires one more. HDMI requires one.
> 
> Looking at the downstream branch there's a bunch more (20+), so we
> would explode the firmware_ops struct with Qualcomm "specific" ops.
> This is not necessarily a bad idea, but needs to be considered before
> we jump the gun.
> 
> 
> I haven't looked at the arm64 stuff in detail, but it looks to be
> shared between the two platforms, so either way it seems like the
> right approach to have this moved out to drivers/soc/qcom.

As Bjorn says the scm interface ends up having a number of qcom specific calls that I don’t think the firmware ops should be implementing.  I don’t see any value in adding qcom specific function pointers to the ops struct just to create another level of indirection.

I’m fine with adding a firmware_ops implementation that uses scm for those things that firmware_ops has today.  However, I’m not clear on what the view of extending firmware_ops to arm64 is.  If we do this do we move the firmware_ops code into drivers/soc ?

- k

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-22 16:49         ` Kumar Gala
  0 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2015-01-22 16:49 UTC (permalink / raw)
  To: linux-arm-kernel


On Jan 21, 2015, at 7:53 PM, Bjorn Andersson <bjorn@kryo.se> wrote:

> On Wed, Jan 21, 2015 at 5:13 PM, Olof Johansson <olof@lixom.net> wrote:
> [..]
>> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>> Architectural changes in the ARM Linux kernel tree mandate
>>> the eventual removal of the mach-* directories. Move the
>>> scm driver to drivers/soc/qcom and the scm header to
>>> include/soc/qcom to support that removal.
>> 
>> The idea is not blindly move one dumping ground to a new place.
>> 
>> I see only two exported functions from scm.c:
>> 
>> scm_get_version: This is not used anywhere in the kernel and can just be removed
>> scm_call: This is used by scm-boot, and would be better to translate
>> over to firmware_ops in the first place.
>> 
> 
> Hi Olof,
> 
> I started this a while ago, as it felt like the right thing to do <tm>.
> 
> The problem with this approach is that e.g. firmware loading is
> partially handled through this interface. So implementing a remoteproc
> driver for wifi etc required me to add 6 new ops to the struct,
> loading the modem looks like it requires one more. HDMI requires one.
> 
> Looking at the downstream branch there's a bunch more (20+), so we
> would explode the firmware_ops struct with Qualcomm "specific" ops.
> This is not necessarily a bad idea, but needs to be considered before
> we jump the gun.
> 
> 
> I haven't looked at the arm64 stuff in detail, but it looks to be
> shared between the two platforms, so either way it seems like the
> right approach to have this moved out to drivers/soc/qcom.

As Bjorn says the scm interface ends up having a number of qcom specific calls that I don?t think the firmware ops should be implementing.  I don?t see any value in adding qcom specific function pointers to the ops struct just to create another level of indirection.

I?m fine with adding a firmware_ops implementation that uses scm for those things that firmware_ops has today.  However, I?m not clear on what the view of extending firmware_ops to arm64 is.  If we do this do we move the firmware_ops code into drivers/soc ?

- k

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
  2015-01-22  1:13     ` Olof Johansson
  (?)
@ 2015-01-23  1:19       ` Rob Clark
  -1 siblings, 0 replies; 43+ messages in thread
From: Rob Clark @ 2015-01-23  1:19 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel, Lina Iyer

On Wed, Jan 21, 2015 at 8:13 PM, Olof Johansson <olof@lixom.net> wrote:
> I just saw this in the pull request from Kumar, so this is a bit late
> w.r.t. to the patch, but so was his merging of the code. :)
>
>
>
> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> Architectural changes in the ARM Linux kernel tree mandate
>> the eventual removal of the mach-* directories. Move the
>> scm driver to drivers/soc/qcom and the scm header to
>> include/soc/qcom to support that removal.
>
> The idea is not blindly move one dumping ground to a new place.
>
> I see only two exported functions from scm.c:
>
> scm_get_version: This is not used anywhere in the kernel and can just be removed
> scm_call: This is used by scm-boot, and would be better to translate
> over to firmware_ops in the first place.
>
>
> So, can you please rework this with the above in mind instead of just
> moving the files over? Thanks!
>


jfyi, we have some pending drm/msm patches blocked on this move

(not trying to comment one way or another on whether all or some
should be moved..  just pointing out there would be more in-tree users
of it if it was moved)

BR,
-R

>
> -Olof
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-23  1:19       ` Rob Clark
  0 siblings, 0 replies; 43+ messages in thread
From: Rob Clark @ 2015-01-23  1:19 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Stephen Boyd, David Brown, Kumar Gala, linux-kernel,
	linux-arm-msm, linux-arm-kernel, Lina Iyer

On Wed, Jan 21, 2015 at 8:13 PM, Olof Johansson <olof@lixom.net> wrote:
> I just saw this in the pull request from Kumar, so this is a bit late
> w.r.t. to the patch, but so was his merging of the code. :)
>
>
>
> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> Architectural changes in the ARM Linux kernel tree mandate
>> the eventual removal of the mach-* directories. Move the
>> scm driver to drivers/soc/qcom and the scm header to
>> include/soc/qcom to support that removal.
>
> The idea is not blindly move one dumping ground to a new place.
>
> I see only two exported functions from scm.c:
>
> scm_get_version: This is not used anywhere in the kernel and can just be removed
> scm_call: This is used by scm-boot, and would be better to translate
> over to firmware_ops in the first place.
>
>
> So, can you please rework this with the above in mind instead of just
> moving the files over? Thanks!
>


jfyi, we have some pending drm/msm patches blocked on this move

(not trying to comment one way or another on whether all or some
should be moved..  just pointing out there would be more in-tree users
of it if it was moved)

BR,
-R

>
> -Olof
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom
@ 2015-01-23  1:19       ` Rob Clark
  0 siblings, 0 replies; 43+ messages in thread
From: Rob Clark @ 2015-01-23  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 21, 2015 at 8:13 PM, Olof Johansson <olof@lixom.net> wrote:
> I just saw this in the pull request from Kumar, so this is a bit late
> w.r.t. to the patch, but so was his merging of the code. :)
>
>
>
> On Mon, Aug 4, 2014 at 6:31 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> Architectural changes in the ARM Linux kernel tree mandate
>> the eventual removal of the mach-* directories. Move the
>> scm driver to drivers/soc/qcom and the scm header to
>> include/soc/qcom to support that removal.
>
> The idea is not blindly move one dumping ground to a new place.
>
> I see only two exported functions from scm.c:
>
> scm_get_version: This is not used anywhere in the kernel and can just be removed
> scm_call: This is used by scm-boot, and would be better to translate
> over to firmware_ops in the first place.
>
>
> So, can you please rework this with the above in mind instead of just
> moving the files over? Thanks!
>


jfyi, we have some pending drm/msm patches blocked on this move

(not trying to comment one way or another on whether all or some
should be moved..  just pointing out there would be more in-tree users
of it if it was moved)

BR,
-R

>
> -Olof
> --
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2015-01-23  1:19 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05  1:31 [PATCH 0/8] qcom SCM updates Stephen Boyd
2014-08-05  1:31 ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 1/8] msm: scm: Fix incorrect cache invalidation Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 2/8] msm: scm: Get cacheline size from CTR Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 3/8] msm: scm: Flush the command buffer only instead of the entire cache Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 4/8] msm: scm: Add atomic SCM APIs Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 5/8] msm: scm: Add API to query for service/command availability Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 6/8] msm: scm: Add a feat version query API Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 7/8] msm: scm: Add logging of actual return code from scm call Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  1:31 ` [PATCH 8/8] msm: scm: Move the scm driver to drivers/soc/qcom Stephen Boyd
2014-08-05  1:31   ` Stephen Boyd
2014-08-05  4:07   ` Lina Iyer
2014-08-05  4:07     ` Lina Iyer
2014-08-05 20:12     ` Bjorn Andersson
2014-08-05 20:12       ` Bjorn Andersson
2014-08-05 20:12       ` Bjorn Andersson
2014-08-05 20:17       ` Lina Iyer
2014-08-05 20:17         ` Lina Iyer
2014-08-05 20:17         ` Lina Iyer
2015-01-22  1:13   ` Olof Johansson
2015-01-22  1:13     ` Olof Johansson
2015-01-22  1:13     ` Olof Johansson
2015-01-22  1:53     ` Bjorn Andersson
2015-01-22  1:53       ` Bjorn Andersson
2015-01-22  1:53       ` Bjorn Andersson
2015-01-22 16:49       ` Kumar Gala
2015-01-22 16:49         ` Kumar Gala
2015-01-22 16:49         ` Kumar Gala
2015-01-23  1:19     ` Rob Clark
2015-01-23  1:19       ` Rob Clark
2015-01-23  1:19       ` Rob Clark
2014-09-17 22:08 ` [PATCH 0/8] qcom SCM updates Kumar Gala
2014-09-17 22:08   ` Kumar Gala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.