Subject: [PATCH for-stable-v4.4 15/53] arm/arm64: smccc: Make function identifiers an unsigned quantity

From: Ard Biesheuvel <[email-masked]>
Date: Tue, 5 Nov 2019 21:58:08 +0100

From: Mark Rutland <[email-masked]>

From: Marc Zyngier <[email-masked]>

commit ded4c39e93f3b72968fdb79baba27f3b83dad34c upstream.

Function identifiers are a 32bit, unsigned quantity. But we never
tell so to the compiler, resulting in the following:

 4ac:   b26187e0        mov     x0, #0xffffffff80000001

We thus rely on the firmware narrowing it for us, which is not
always a reasonable expectation.

Reported-by: Ard Biesheuvel <[email-masked]>
Acked-by: Ard Biesheuvel <[email-masked]>
Reviewed-by: Robin Murphy <[email-masked]>
Tested-by: Ard Biesheuvel <[email-masked]>
Signed-off-by: Marc Zyngier <[email-masked]>
Signed-off-by: Catalin Marinas <[email-masked]>
Signed-off-by: Mark Rutland <[email-masked]> [v4.9 backport]
Tested-by: Greg Hackmann <[email-masked]>
Signed-off-by: Greg Kroah-Hartman <[email-masked]>
Signed-off-by: Ard Biesheuvel <[email-masked]>
---
 include/linux/arm-smccc.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index e1ef944ef1da..dd44d8458c04 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -14,14 +14,16 @@
 #ifndef __LINUX_ARM_SMCCC_H
 #define __LINUX_ARM_SMCCC_H
 
+#include <uapi/linux/const.h>
+
 /*
  * This file provides common defines for ARM SMC Calling Convention as
  * specified in
  * http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
  */
 
-#define ARM_SMCCC_STD_CALL		0
-#define ARM_SMCCC_FAST_CALL		1
+#define ARM_SMCCC_STD_CALL	        _AC(0,U)
+#define ARM_SMCCC_FAST_CALL	        _AC(1,U)
 #define ARM_SMCCC_TYPE_SHIFT		31
 
 #define ARM_SMCCC_SMC_32		0
-- 
2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel