Patch "RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     risc-v-selftests-cbo-ensure-asm-operands-match-const.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 95e493750aea3cf8a430082ab1f6e586c5cbb158
Author: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
Date:   Fri Mar 22 14:47:28 2024 +0100

    RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2
    
    [ Upstream commit 49408400d683ae4f41e414dfcb615166cc93be5c ]
    
    Commit 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands
    match constraints") attempted to ensure MK_CBO() would always
    provide to a compile-time constant when given a constant, but
    cpu_to_le32() isn't necessarily going to do that. Switch to manually
    shifting the bytes, when needed, to finally get this right.
    
    Reported-by: Woodrow Shen <woodrow.shen@xxxxxxxxxx>
    Closes: https://lore.kernel.org/all/CABquHATcBTUwfLpd9sPObBgNobqQKEAZ2yxk+TWSpyO5xvpXpg@xxxxxxxxxxxxxx/
    Fixes: a29e2a48afe3 ("RISC-V: selftests: Add CBO tests")
    Fixes: 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands match constraints")
    Signed-off-by: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240322134728.151255-2-ajones@xxxxxxxxxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c
index c537d52fafc58..a40541bb7c7de 100644
--- a/tools/testing/selftests/riscv/hwprobe/cbo.c
+++ b/tools/testing/selftests/riscv/hwprobe/cbo.c
@@ -19,7 +19,7 @@
 #include "hwprobe.h"
 #include "../../kselftest.h"
 
-#define MK_CBO(fn) cpu_to_le32((fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)
+#define MK_CBO(fn) le32_bswap((uint32_t)(fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)
 
 static char mem[4096] __aligned(4096) = { [0 ... 4095] = 0xa5 };
 
diff --git a/tools/testing/selftests/riscv/hwprobe/hwprobe.h b/tools/testing/selftests/riscv/hwprobe/hwprobe.h
index e3fccb390c4dc..f3de970c32227 100644
--- a/tools/testing/selftests/riscv/hwprobe/hwprobe.h
+++ b/tools/testing/selftests/riscv/hwprobe/hwprobe.h
@@ -4,6 +4,16 @@
 #include <stddef.h>
 #include <asm/hwprobe.h>
 
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define le32_bswap(_x)				\
+	((((_x) & 0x000000ffU) << 24) |		\
+	 (((_x) & 0x0000ff00U) <<  8) |		\
+	 (((_x) & 0x00ff0000U) >>  8) |		\
+	 (((_x) & 0xff000000U) >> 24))
+#else
+# define le32_bswap(_x) (_x)
+#endif
+
 /*
  * Rather than relying on having a new enough libc to define this, just do it
  * ourselves.  This way we don't need to be coupled to a new-enough libc to




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux