All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smcc: fix sign bit expansion
@ 2021-01-05 20:03 Volodymyr Babchuk
  2021-01-21  6:54 ` Jens Wiklander
  2021-01-28 23:56 ` [PATCH] smccc: " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Volodymyr Babchuk @ 2021-01-05 20:03 UTC (permalink / raw)
  To: u-boot

Signed ARM_SMCCC_FAST_CALL value is shifted to 31'st bit. Then, it is expanded
to 64 bit value, which results in 1s in higher 32 bits.

This causes corrupted values in 64-bit SMC IDs and issues in buggy handlers of
32-bit calls.

We need to make ARM_SMCCC_FAST_CALL unsigned long, so it would work properly
on 32 bit architectures.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 include/linux/arm-smccc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index 2d1e6cc156..7f2be23394 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -11,8 +11,8 @@
  * 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		0UL
+#define ARM_SMCCC_FAST_CALL		1UL
 #define ARM_SMCCC_TYPE_SHIFT		31
 
 #define ARM_SMCCC_SMC_32		0
-- 
2.29.2

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

* [PATCH] smcc: fix sign bit expansion
  2021-01-05 20:03 [PATCH] smcc: fix sign bit expansion Volodymyr Babchuk
@ 2021-01-21  6:54 ` Jens Wiklander
  2021-01-28 23:56 ` [PATCH] smccc: " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Wiklander @ 2021-01-21  6:54 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 05, 2021 at 08:03:11PM +0000, Volodymyr Babchuk wrote:
> Signed ARM_SMCCC_FAST_CALL value is shifted to 31'st bit. Then, it is expanded
> to 64 bit value, which results in 1s in higher 32 bits.
> 
> This causes corrupted values in 64-bit SMC IDs and issues in buggy handlers of
> 32-bit calls.
> 
> We need to make ARM_SMCCC_FAST_CALL unsigned long, so it would work properly
> on 32 bit architectures.
> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> ---
>  include/linux/arm-smccc.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

You may want to make the prefix "smccc:" (note the extra c) instead.

Cheers,
Jens

> 
> diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> index 2d1e6cc156..7f2be23394 100644
> --- a/include/linux/arm-smccc.h
> +++ b/include/linux/arm-smccc.h
> @@ -11,8 +11,8 @@
>   * 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		0UL
> +#define ARM_SMCCC_FAST_CALL		1UL
>  #define ARM_SMCCC_TYPE_SHIFT		31
>  
>  #define ARM_SMCCC_SMC_32		0
> -- 
> 2.29.2

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

* [PATCH] smccc: fix sign bit expansion
  2021-01-05 20:03 [PATCH] smcc: fix sign bit expansion Volodymyr Babchuk
  2021-01-21  6:54 ` Jens Wiklander
@ 2021-01-28 23:56 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-01-28 23:56 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 05, 2021 at 08:03:11PM +0000, Volodymyr Babchuk wrote:

> Signed ARM_SMCCC_FAST_CALL value is shifted to 31'st bit. Then, it is expanded
> to 64 bit value, which results in 1s in higher 32 bits.
> 
> This causes corrupted values in 64-bit SMC IDs and issues in buggy handlers of
> 32-bit calls.
> 
> We need to make ARM_SMCCC_FAST_CALL unsigned long, so it would work properly
> on 32 bit architectures.
> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210128/a0e4c28d/attachment.sig>

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

end of thread, other threads:[~2021-01-28 23:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 20:03 [PATCH] smcc: fix sign bit expansion Volodymyr Babchuk
2021-01-21  6:54 ` Jens Wiklander
2021-01-28 23:56 ` [PATCH] smccc: " Tom Rini

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.