All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm32: fix build after 063188f4b3
@ 2014-10-10 13:58 Jan Beulich
  2014-10-10 14:12 ` Julien Grall
  2014-10-10 14:17 ` Ian Campbell
  0 siblings, 2 replies; 19+ messages in thread
From: Jan Beulich @ 2014-10-10 13:58 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, Suriyan Ramasami, Stefano Stabellini, Tim Deegan

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

"xen: arm: Add support for the Exynos secure firmware" introduced code
assuming that exynos_smc() would get called with arguments in certain
registers. While the "noinline" attribute guarantees the function to
not get inlined, it does not guarantee that all arguments arrive in the
assumed registers: gcc's interprocedural analysis can result in clone
functions to be created where some of the incoming arguments (commonly
when they have constant values) get replaced by putting in place the
respective values inside the clone.

The alternative of adding __attribute__((optimize("-fno-ipa-cp")))
to the function definition would likely not work with all supported
compiler versions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/arm/platforms/exynos5.c
+++ b/xen/arch/arm/platforms/exynos5.c
@@ -40,6 +40,11 @@ static bool_t secure_firmware;
 static noinline void exynos_smc(register_t function_id, register_t arg0,
                                 register_t arg1, register_t arg2)
 {
+    register register_t fn_id asm("r0") = function_id;
+    register register_t a0 asm("r1") = arg0;
+    register register_t a1 asm("r2") = arg1;
+    register register_t a2 asm("r3") = arg2;
+
     asm volatile(
         __asmeq("%0", "r0")
         __asmeq("%1", "r1")
@@ -47,7 +52,7 @@ static noinline void exynos_smc(register
         __asmeq("%3", "r3")
         "smc #0"
         :
-        : "r" (function_id), "r" (arg0), "r" (arg1), "r" (arg2));
+        : "r" (fn_id), "r" (a0), "r" (a1), "r" (a2));
 }
 
 static int exynos5_init_time(void)




[-- Attachment #2: arm32-exynos5-smc.patch --]
[-- Type: text/plain, Size: 1632 bytes --]

arm32: fix build after 063188f4b3

"xen: arm: Add support for the Exynos secure firmware" introduced code
assuming that exynos_smc() would get called with arguments in certain
registers. While the "noinline" attribute guarantees the function to
not get inlined, it does not guarantee that all arguments arrive in the
assumed registers: gcc's interprocedural analysis can result in clone
functions to be created where some of the incoming arguments (commonly
when they have constant values) get replaced by putting in place the
respective values inside the clone.

The alternative of adding __attribute__((optimize("-fno-ipa-cp")))
to the function definition would likely not work with all supported
compiler versions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/arm/platforms/exynos5.c
+++ b/xen/arch/arm/platforms/exynos5.c
@@ -40,6 +40,11 @@ static bool_t secure_firmware;
 static noinline void exynos_smc(register_t function_id, register_t arg0,
                                 register_t arg1, register_t arg2)
 {
+    register register_t fn_id asm("r0") = function_id;
+    register register_t a0 asm("r1") = arg0;
+    register register_t a1 asm("r2") = arg1;
+    register register_t a2 asm("r3") = arg2;
+
     asm volatile(
         __asmeq("%0", "r0")
         __asmeq("%1", "r1")
@@ -47,7 +52,7 @@ static noinline void exynos_smc(register
         __asmeq("%3", "r3")
         "smc #0"
         :
-        : "r" (function_id), "r" (arg0), "r" (arg1), "r" (arg2));
+        : "r" (fn_id), "r" (a0), "r" (a1), "r" (a2));
 }
 
 static int exynos5_init_time(void)

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2014-10-13 10:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-10 13:58 [PATCH] arm32: fix build after 063188f4b3 Jan Beulich
2014-10-10 14:12 ` Julien Grall
2014-10-10 14:51   ` Jan Beulich
2014-10-10 15:55     ` Julien Grall
2014-10-10 16:01       ` Ian Campbell
2014-10-10 16:14         ` Julien Grall
2014-10-10 16:33           ` Ian Campbell
2014-10-10 16:35           ` Ian Campbell
2014-10-10 16:18       ` Jan Beulich
2014-10-10 16:35         ` Julien Grall
2014-10-10 14:17 ` Ian Campbell
2014-10-10 14:32   ` Stefano Stabellini
2014-10-10 14:58     ` Jan Beulich
2014-10-10 17:03       ` Stefano Stabellini
2014-10-13  6:49         ` Jan Beulich
2014-10-13  9:40           ` Stefano Stabellini
2014-10-13 10:34             ` Jan Beulich
2014-10-10 14:54   ` Jan Beulich
2014-10-10 15:26     ` Ian Campbell

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.