Skip to content

Commit 871bfa0

Browse files
committed
Merge tag 'for-linus' of git://github.com/openrisc/linux
Pull OpenRISC updates from Stafford Horne: "A few fixups and enhancements for OpenRISC: - Fix to add proper wrapper for clone3 to save callee saved regs - Cleanups for clone, fork and switch - Add support for common clk so OpenRISC and use more drivers" * tag 'for-linus' of git://github.com/openrisc/linux: openrisc: init: Add support for common clk openrisc: Add clone3 ABI wrapper openrisc: Use delay slot for clone and fork wrappers openrisc: Cleanup switch code and comments
2 parents 29ec39f + 7f435e4 commit 871bfa0

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

arch/openrisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config OPENRISC
1010
select ARCH_HAS_DMA_SET_UNCACHED
1111
select ARCH_HAS_DMA_CLEAR_UNCACHED
1212
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
13+
select COMMON_CLK
1314
select OF
1415
select OF_EARLY_FLATTREE
1516
select IRQ_DOMAIN

arch/openrisc/include/asm/syscalls.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsigned long *v1,
2222

2323
asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
2424
void __user *parent_tid, void __user *child_tid, int tls);
25+
asmlinkage long __sys_clone3(struct clone_args __user *uargs, size_t size);
2526
asmlinkage long __sys_fork(void);
2627

2728
#define sys_clone __sys_clone
29+
#define sys_clone3 __sys_clone3
2830
#define sys_fork __sys_fork
2931

3032
#endif /* __ASM_OPENRISC_SYSCALLS_H */

arch/openrisc/kernel/entry.S

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,11 +1001,10 @@ ENTRY(ret_from_fork)
10011001
l.lwz r11,PT_GPR11(r1)
10021002

10031003
/* The syscall fast path return expects call-saved registers
1004-
* r12-r28 to be untouched, so we restore them here as they
1004+
* r14-r28 to be untouched, so we restore them here as they
10051005
* will have been effectively clobbered when arriving here
10061006
* via the call to switch()
10071007
*/
1008-
l.lwz r12,PT_GPR12(r1)
10091008
l.lwz r14,PT_GPR14(r1)
10101009
l.lwz r16,PT_GPR16(r1)
10111010
l.lwz r18,PT_GPR18(r1)
@@ -1037,10 +1036,10 @@ ENTRY(ret_from_fork)
10371036

10381037
/* _switch MUST never lay on page boundry, cause it runs from
10391038
* effective addresses and beeing interrupted by iTLB miss would kill it.
1040-
* dTLB miss seams to never accour in the bad place since data accesses
1039+
* dTLB miss seems to never accour in the bad place since data accesses
10411040
* are from task structures which are always page aligned.
10421041
*
1043-
* The problem happens in RESTORE_ALL_NO_R11 where we first set the EPCR
1042+
* The problem happens in RESTORE_ALL where we first set the EPCR
10441043
* register, then load the previous register values and only at the end call
10451044
* the l.rfe instruction. If get TLB miss in beetwen the EPCR register gets
10461045
* garbled and we end up calling l.rfe with the wrong EPCR. (same probably
@@ -1068,9 +1067,8 @@ ENTRY(_switch)
10681067
/* No need to store r1/PT_SP as it goes into KSP below */
10691068
l.sw PT_GPR2(r1),r2
10701069
l.sw PT_GPR9(r1),r9
1071-
/* This is wrong, r12 shouldn't be here... but GCC is broken for the time being
1072-
* and expects r12 to be callee-saved... */
1073-
l.sw PT_GPR12(r1),r12
1070+
1071+
/* Save callee-saved registers to the new pt_regs */
10741072
l.sw PT_GPR14(r1),r14
10751073
l.sw PT_GPR16(r1),r16
10761074
l.sw PT_GPR18(r1),r18
@@ -1111,9 +1109,7 @@ ENTRY(_switch)
11111109
/* No need to restore r10 */
11121110
/* ...and do not restore r11 */
11131111

1114-
/* This is wrong, r12 shouldn't be here... but GCC is broken for the time being
1115-
* and expects r12 to be callee-saved... */
1116-
l.lwz r12,PT_GPR12(r1)
1112+
/* Restore callee-saved registers */
11171113
l.lwz r14,PT_GPR14(r1)
11181114
l.lwz r16,PT_GPR16(r1)
11191115
l.lwz r18,PT_GPR18(r1)
@@ -1166,15 +1162,18 @@ _fork_save_extra_regs_and_call:
11661162

11671163
ENTRY(__sys_clone)
11681164
l.movhi r29,hi(sys_clone)
1169-
l.ori r29,r29,lo(sys_clone)
11701165
l.j _fork_save_extra_regs_and_call
1171-
l.nop
1166+
l.ori r29,r29,lo(sys_clone)
1167+
1168+
ENTRY(__sys_clone3)
1169+
l.movhi r29,hi(sys_clone3)
1170+
l.j _fork_save_extra_regs_and_call
1171+
l.ori r29,r29,lo(sys_clone3)
11721172

11731173
ENTRY(__sys_fork)
11741174
l.movhi r29,hi(sys_fork)
1175-
l.ori r29,r29,lo(sys_fork)
11761175
l.j _fork_save_extra_regs_and_call
1177-
l.nop
1176+
l.ori r29,r29,lo(sys_fork)
11781177

11791178
ENTRY(sys_rt_sigreturn)
11801179
l.jal _sys_rt_sigreturn

arch/openrisc/kernel/time.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/clockchips.h>
2121
#include <linux/irq.h>
2222
#include <linux/io.h>
23+
#include <linux/of_clk.h>
2324

2425
#include <asm/cpuinfo.h>
2526

@@ -169,4 +170,7 @@ void __init time_init(void)
169170

170171
openrisc_timer_init();
171172
openrisc_clockevent_init();
173+
174+
of_clk_init(NULL);
175+
timer_probe();
172176
}

0 commit comments

Comments
 (0)