From: "Jan Beulich" Subject: [PATCH] arm32: fix build after 063188f4b3 Date: Fri, 10 Oct 2014 14:58:09 +0100 Message-ID: <54380211020000780003DC42@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0F3A61E1.3__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xcahv-0003Qb-Df for xen-devel@lists.xenproject.org; Fri, 10 Oct 2014 13:58:11 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Suriyan Ramasami , Stefano Stabellini , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part0F3A61E1.3__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline "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 --- 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") =3D function_id; + register register_t a0 asm("r1") =3D arg0; + register register_t a1 asm("r2") =3D arg1; + register register_t a2 asm("r3") =3D 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)); } =20 static int exynos5_init_time(void) --=__Part0F3A61E1.3__= Content-Type: text/plain; name="arm32-exynos5-smc.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="arm32-exynos5-smc.patch" arm32: fix build after 063188f4b3=0A=0A"xen: arm: Add support for the = Exynos secure firmware" introduced code=0Aassuming that exynos_smc() would = get called with arguments in certain=0Aregisters. While the "noinline" = attribute guarantees the function to=0Anot get inlined, it does not = guarantee that all arguments arrive in the=0Aassumed registers: gcc's = interprocedural analysis can result in clone=0Afunctions to be created = where some of the incoming arguments (commonly=0Awhen they have constant = values) get replaced by putting in place the=0Arespective values inside = the clone.=0A=0AThe alternative of adding __attribute__((optimize("-fno-ipa= -cp")))=0Ato the function definition would likely not work with all = supported=0Acompiler versions.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/arm/platforms/exynos5.c=0A+++ b/xen/arch/arm/pl= atforms/exynos5.c=0A@@ -40,6 +40,11 @@ static bool_t secure_firmware;=0A = static noinline void exynos_smc(register_t function_id, register_t = arg0,=0A register_t arg1, register_t = arg2)=0A {=0A+ register register_t fn_id asm("r0") =3D function_id;=0A+ = register register_t a0 asm("r1") =3D arg0;=0A+ register register_t = a1 asm("r2") =3D arg1;=0A+ register register_t a2 asm("r3") =3D = arg2;=0A+=0A asm volatile(=0A __asmeq("%0", "r0")=0A = __asmeq("%1", "r1")=0A@@ -47,7 +52,7 @@ static noinline void exynos_smc(reg= ister=0A __asmeq("%3", "r3")=0A "smc #0"=0A :=0A- = : "r" (function_id), "r" (arg0), "r" (arg1), "r" (arg2));=0A+ = : "r" (fn_id), "r" (a0), "r" (a1), "r" (a2));=0A }=0A =0A static int = exynos5_init_time(void)=0A --=__Part0F3A61E1.3__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part0F3A61E1.3__=--