Thread (53 messages) 53 messages, 2 authors, 2023-12-22
STALE931d

[kvm-unit-tests PATCH v5 09/29] powerpc: Fix interrupt stack alignment

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2023-12-16 13:51:29
Also in: kvm
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

ppc64 requires the stack to be 16-byte aligned but the interrupt
stack frame has 8-byte aligned size. Add padding to fix.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 lib/powerpc/setup.c    | 3 +++
 lib/ppc64/asm/ptrace.h | 1 +
 2 files changed, 4 insertions(+)
diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c
index 1be4c030..d98f66fa 100644
--- a/lib/powerpc/setup.c
+++ b/lib/powerpc/setup.c
@@ -18,6 +18,7 @@
 #include <argv.h>
 #include <asm/setup.h>
 #include <asm/page.h>
+#include <asm/ptrace.h>
 #include <asm/hcall.h>
 #include "io.h"
 
@@ -195,6 +196,8 @@ void setup(const void *fdt)
 		freemem += initrd_size;
 	}
 
+	assert(STACK_INT_FRAME_SIZE % 16 == 0);
+
 	/* call init functions */
 	cpu_init();
 
diff --git a/lib/ppc64/asm/ptrace.h b/lib/ppc64/asm/ptrace.h
index 076c9d9c..12de7499 100644
--- a/lib/ppc64/asm/ptrace.h
+++ b/lib/ppc64/asm/ptrace.h
@@ -14,6 +14,7 @@ struct pt_regs {
 	unsigned long xer;
 	unsigned long ccr;
 	unsigned long trap;
+	unsigned long _pad; /* stack must be 16-byte aligned */
 };
 
 #define STACK_INT_FRAME_SIZE    (sizeof(struct pt_regs) + \
-- 
2.42.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help