[PATCH] parisc: Fix boot with kernel v5.14

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

 



Kernel v5.14 has various changes to optimize unaligned memory accesses,
e.g. commit 0652035a5794 ("asm-generic: unaligned: remove byteshift helpers").

Those changes break the bootloader on parisc which needs byte-wise
accesses to unaligned memory.

Below is a *** temporary *** patch/hack which fixes those boot problems.

Signed-off-by: Helge Deller <deller@xxxxxx>
---

diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 1c4242416c9f..3ef9a5dd35b5 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -9,10 +9,21 @@
 #include <linux/unaligned/packed_struct.h>
 #include <asm/byteorder.h>

+#if 0
 #define __get_unaligned_t(type, ptr) ({						\
 	const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);	\
 	__pptr->x;								\
 })
+#else
+#define __get_unaligned_t(type, ptr) ({						\
+	unsigned char *a = (unsigned char *)(unsigned long)(ptr);		\
+	sizeof(type) == 1 ? a[0] :						\
+	sizeof(type) == 2 ? a[0] << 8  | a[1] : 				\
+	sizeof(type) == 3 ? a[0] << 16 | a[1] << 8  | a[2] : 			\
+	sizeof(type) == 4 ? a[0] << 24 | a[1] << 16 | a[2] << 8 | a[3] :	\
+	 0 ; \
+})
+#endif

 #define __put_unaligned_t(type, val, ptr) do {					\
 	struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);		\




[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux