Skip to content

Commit 7ff71e6

Browse files
committed
Merge tag 'alpha-fixes-v6.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha
Pull alpha fixes from Matt Turner: "A few changes for alpha, including some important fixes for kernel stack alignment" * tag 'alpha-fixes-v6.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha: alpha: Use str_yes_no() helper in pci_dac_dma_supported() alpha: Replace one-element array with flexible array member alpha: align stack for page fault and user unaligned trap handlers alpha: make stack 16-byte aligned (most cases) alpha: replace hardcoded stack offsets with autogenerated ones
2 parents 78a632a + 1523226 commit 7ff71e6

File tree

7 files changed

+22
-19
lines changed

7 files changed

+22
-19
lines changed

arch/alpha/include/asm/hwrpb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ struct crb_struct {
135135
/* virtual->physical map */
136136
unsigned long map_entries;
137137
unsigned long map_pages;
138-
struct vf_map_struct map[1];
138+
struct vf_map_struct map[];
139139
};
140140

141141
struct memclust_struct {

arch/alpha/include/uapi/asm/ptrace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ struct pt_regs {
4242
unsigned long trap_a0;
4343
unsigned long trap_a1;
4444
unsigned long trap_a2;
45+
/* This makes the stack 16-byte aligned as GCC expects */
46+
unsigned long __pad0;
4547
/* These are saved by PAL-code: */
4648
unsigned long ps;
4749
unsigned long pc;

arch/alpha/kernel/asm-offsets.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ static void __used foo(void)
1919
DEFINE(TI_STATUS, offsetof(struct thread_info, status));
2020
BLANK();
2121

22+
DEFINE(SP_OFF, offsetof(struct pt_regs, ps));
2223
DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs));
2324
BLANK();
2425

26+
DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
27+
BLANK();
28+
2529
DEFINE(HAE_CACHE, offsetof(struct alpha_machine_vector, hae_cache));
2630
DEFINE(HAE_REG, offsetof(struct alpha_machine_vector, hae_register));
2731
}

arch/alpha/kernel/entry.S

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
.set noat
1616
.cfi_sections .debug_frame
1717

18-
/* Stack offsets. */
19-
#define SP_OFF 184
20-
#define SWITCH_STACK_SIZE 64
21-
2218
.macro CFI_START_OSF_FRAME func
2319
.align 4
2420
.globl \func
@@ -198,8 +194,8 @@ CFI_END_OSF_FRAME entArith
198194
CFI_START_OSF_FRAME entMM
199195
SAVE_ALL
200196
/* save $9 - $15 so the inline exception code can manipulate them. */
201-
subq $sp, 56, $sp
202-
.cfi_adjust_cfa_offset 56
197+
subq $sp, 64, $sp
198+
.cfi_adjust_cfa_offset 64
203199
stq $9, 0($sp)
204200
stq $10, 8($sp)
205201
stq $11, 16($sp)
@@ -214,7 +210,7 @@ CFI_START_OSF_FRAME entMM
214210
.cfi_rel_offset $13, 32
215211
.cfi_rel_offset $14, 40
216212
.cfi_rel_offset $15, 48
217-
addq $sp, 56, $19
213+
addq $sp, 64, $19
218214
/* handle the fault */
219215
lda $8, 0x3fff
220216
bic $sp, $8, $8
@@ -227,15 +223,15 @@ CFI_START_OSF_FRAME entMM
227223
ldq $13, 32($sp)
228224
ldq $14, 40($sp)
229225
ldq $15, 48($sp)
230-
addq $sp, 56, $sp
226+
addq $sp, 64, $sp
231227
.cfi_restore $9
232228
.cfi_restore $10
233229
.cfi_restore $11
234230
.cfi_restore $12
235231
.cfi_restore $13
236232
.cfi_restore $14
237233
.cfi_restore $15
238-
.cfi_adjust_cfa_offset -56
234+
.cfi_adjust_cfa_offset -64
239235
/* finish up the syscall as normal. */
240236
br ret_from_sys_call
241237
CFI_END_OSF_FRAME entMM
@@ -382,8 +378,8 @@ entUnaUser:
382378
.cfi_restore $0
383379
.cfi_adjust_cfa_offset -256
384380
SAVE_ALL /* setup normal kernel stack */
385-
lda $sp, -56($sp)
386-
.cfi_adjust_cfa_offset 56
381+
lda $sp, -64($sp)
382+
.cfi_adjust_cfa_offset 64
387383
stq $9, 0($sp)
388384
stq $10, 8($sp)
389385
stq $11, 16($sp)
@@ -399,7 +395,7 @@ entUnaUser:
399395
.cfi_rel_offset $14, 40
400396
.cfi_rel_offset $15, 48
401397
lda $8, 0x3fff
402-
addq $sp, 56, $19
398+
addq $sp, 64, $19
403399
bic $sp, $8, $8
404400
jsr $26, do_entUnaUser
405401
ldq $9, 0($sp)
@@ -409,15 +405,15 @@ entUnaUser:
409405
ldq $13, 32($sp)
410406
ldq $14, 40($sp)
411407
ldq $15, 48($sp)
412-
lda $sp, 56($sp)
408+
lda $sp, 64($sp)
413409
.cfi_restore $9
414410
.cfi_restore $10
415411
.cfi_restore $11
416412
.cfi_restore $12
417413
.cfi_restore $13
418414
.cfi_restore $14
419415
.cfi_restore $15
420-
.cfi_adjust_cfa_offset -56
416+
.cfi_adjust_cfa_offset -64
421417
br ret_from_sys_call
422418
CFI_END_OSF_FRAME entUna
423419

arch/alpha/kernel/pci_iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/log2.h>
1414
#include <linux/dma-map-ops.h>
1515
#include <linux/iommu-helper.h>
16+
#include <linux/string_choices.h>
1617

1718
#include <asm/io.h>
1819
#include <asm/hwrpb.h>
@@ -212,7 +213,7 @@ static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
212213

213214
/* If both conditions above are met, we are fine. */
214215
DBGA("pci_dac_dma_supported %s from %ps\n",
215-
ok ? "yes" : "no", __builtin_return_address(0));
216+
str_yes_no(ok), __builtin_return_address(0));
216217

217218
return ok;
218219
}

arch/alpha/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ s_reg_to_mem (unsigned long s_reg)
649649
static int unauser_reg_offsets[32] = {
650650
R(r0), R(r1), R(r2), R(r3), R(r4), R(r5), R(r6), R(r7), R(r8),
651651
/* r9 ... r15 are stored in front of regs. */
652-
-56, -48, -40, -32, -24, -16, -8,
652+
-64, -56, -48, -40, -32, -24, -16, /* padding at -8 */
653653
R(r16), R(r17), R(r18),
654654
R(r19), R(r20), R(r21), R(r22), R(r23), R(r24), R(r25), R(r26),
655655
R(r27), R(r28), R(gp),

arch/alpha/mm/fault.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct *next_mm)
7878

7979
/* Macro for exception fixup code to access integer registers. */
8080
#define dpf_reg(r) \
81-
(((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \
82-
(r) <= 18 ? (r)+10 : (r)-10])
81+
(((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 : \
82+
(r) <= 18 ? (r)+11 : (r)-10])
8383

8484
asmlinkage void
8585
do_page_fault(unsigned long address, unsigned long mmcsr,

0 commit comments

Comments
 (0)