Skip to content

Commit ed9e84a

Browse files
shenkimpe
authored andcommitted
powerpc: Use SWITCH_FRAME_SIZE for prom and rtas entry
Commit 6c17199 ("powerpc/of: Remove useless register save/restore when calling OF back") removed the saving of srr0 and srr1 when calling into OpenFirmware. Commit e31aa45 ("powerpc: Use LOAD_REG_IMMEDIATE only for constants on 64-bit") did the same for rtas. This means we don't need to save the extra stack space and can use the common SWITCH_FRAME_SIZE. There were already no users of _SRR0 and _SRR1 so we can remove them too. Link: https://github.com/linuxppc/linux/issues/83 Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 65b9fda commit ed9e84a

2 files changed

Lines changed: 5 additions & 14 deletions

File tree

‎arch/powerpc/kernel/asm-offsets.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,6 @@ int main(void)
280280
/* Interrupt register frame */
281281
DEFINE(INT_FRAME_SIZE, STACK_INT_FRAME_SIZE);
282282
DEFINE(SWITCH_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
283-
#ifdef CONFIG_PPC64
284-
/* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */
285-
DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
286-
DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
287-
#endif /* CONFIG_PPC64 */
288283
STACK_PT_REGS_OFFSET(GPR0, gpr[0]);
289284
STACK_PT_REGS_OFFSET(GPR1, gpr[1]);
290285
STACK_PT_REGS_OFFSET(GPR2, gpr[2]);
@@ -328,10 +323,6 @@ int main(void)
328323
STACK_PT_REGS_OFFSET(_ESR, dsisr);
329324
#else /* CONFIG_PPC64 */
330325
STACK_PT_REGS_OFFSET(SOFTE, softe);
331-
332-
/* These _only_ to be used with {PROM,RTAS}_FRAME_SIZE!!! */
333-
DEFINE(_SRR0, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs));
334-
DEFINE(_SRR1, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs)+8);
335326
#endif /* CONFIG_PPC64 */
336327

337328
#if defined(CONFIG_PPC32)

‎arch/powerpc/kernel/entry_64.S‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ _ASM_NOKPROBE_SYMBOL(fast_exception_return);
11241124
_GLOBAL(enter_rtas)
11251125
mflr r0
11261126
std r0,16(r1)
1127-
stdu r1,-RTAS_FRAME_SIZE(r1) /* Save SP and create stack space. */
1127+
stdu r1,-SWITCH_FRAME_SIZE(r1) /* Save SP and create stack space. */
11281128

11291129
/* Because RTAS is running in 32b mode, it clobbers the high order half
11301130
* of all registers that it saves. We therefore save those registers
@@ -1256,7 +1256,7 @@ rtas_restore_regs:
12561256
ld r8,_DSISR(r1)
12571257
mtdsisr r8
12581258

1259-
addi r1,r1,RTAS_FRAME_SIZE /* Unstack our frame */
1259+
addi r1,r1,SWITCH_FRAME_SIZE /* Unstack our frame */
12601260
ld r0,16(r1) /* get return address */
12611261

12621262
mtlr r0
@@ -1267,7 +1267,7 @@ rtas_restore_regs:
12671267
_GLOBAL(enter_prom)
12681268
mflr r0
12691269
std r0,16(r1)
1270-
stdu r1,-PROM_FRAME_SIZE(r1) /* Save SP and create stack space */
1270+
stdu r1,-SWITCH_FRAME_SIZE(r1) /* Save SP and create stack space */
12711271

12721272
/* Because PROM is running in 32b mode, it clobbers the high order half
12731273
* of all registers that it saves. We therefore save those registers
@@ -1324,8 +1324,8 @@ _GLOBAL(enter_prom)
13241324
REST_10GPRS(22, r1)
13251325
ld r4,_CCR(r1)
13261326
mtcr r4
1327-
1328-
addi r1,r1,PROM_FRAME_SIZE
1327+
1328+
addi r1,r1,SWITCH_FRAME_SIZE
13291329
ld r0,16(r1)
13301330
mtlr r0
13311331
blr

0 commit comments

Comments
 (0)