All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parisc: Fix boot with kernel v5.14
@ 2021-08-31 20:46 Helge Deller
  2021-09-02 14:06 ` [PATCH v2] " Helge Deller
  0 siblings, 1 reply; 10+ messages in thread
From: Helge Deller @ 2021-08-31 20:46 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

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@gmx.de>
---

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);		\

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

end of thread, other threads:[~2021-09-06 21:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 20:46 [PATCH] parisc: Fix boot with kernel v5.14 Helge Deller
2021-09-02 14:06 ` [PATCH v2] " Helge Deller
2021-09-02 18:35   ` Arnd Bergmann
2021-09-02 19:48     ` Helge Deller
2021-09-02 20:19       ` Helge Deller
2021-09-02 20:41       ` Arnd Bergmann
2021-09-05 21:40         ` Helge Deller
2021-09-06 10:54           ` Arnd Bergmann
2021-09-06 20:15             ` Helge Deller
2021-09-06 21:49               ` Arnd Bergmann

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.