Skip to content

Commit 56e9461

Browse files
committed
Merge tag 'openrisc-for-linus' of git://github.com/openrisc/linux
Pull Openrisc updates from Stafford Horne: - changes to MAINTAINER for openrisc - probably biggest actual change is the move to memblock from bootmem - ... plus several bug and build fixes * tag 'openrisc-for-linus' of git://github.com/openrisc/linux: openrisc: prevent VGA console, fix builds openrisc: include l.swa in check for write data pagefault openrisc: Updates after openrisc.net has been lost openrisc: Consolidate setup to use memblock instead of bootmem openrisc: remove the redundant of_platform_populate openrisc: add NR_CPUS Kconfig default value openrisc: Support both old (or32) and new (or1k) toolchain openrisc: Add thread-local storage (TLS) support openrisc: restore all regs on rt_sigreturn openrisc: fix PTRS_PER_PGD define
2 parents 709c12e + 7c7808c commit 56e9461

File tree

13 files changed

+59
-56
lines changed

13 files changed

+59
-56
lines changed

MAINTAINERS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8977,9 +8977,11 @@ F: drivers/of/resolver.c
89778977

89788978
OPENRISC ARCHITECTURE
89798979
M: Jonas Bonn <[email protected]>
8980-
W: http://openrisc.net
8980+
M: Stefan Kristiansson <[email protected]>
8981+
M: Stafford Horne <[email protected]>
8982+
8983+
W: http://openrisc.io
89818984
S: Maintained
8982-
T: git git://openrisc.net/~jonas/linux
89838985
F: arch/openrisc/
89848986

89858987
OPENVSWITCH

arch/openrisc/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ config OPENRISC
2626
select HAVE_DEBUG_STACKOVERFLOW
2727
select OR1K_PIC
2828
select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1
29+
select NO_BOOTMEM
2930

3031
config MMU
3132
def_bool y
@@ -98,6 +99,9 @@ config OPENRISC_HAVE_INST_DIV
9899
Select this if your implementation has a hardware divide instruction
99100
endmenu
100101

102+
config NR_CPUS
103+
int
104+
default "1"
101105

102106
source kernel/Kconfig.hz
103107
source kernel/Kconfig.preempt

arch/openrisc/README.openrisc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target architecture, specifically, is the 32-bit OpenRISC 1000 family (or1k).
66

77
For information about OpenRISC processors and ongoing development:
88

9-
website http://openrisc.net
9+
website http://openrisc.io
1010

1111
For more information about Linux on OpenRISC, please contact South Pole AB.
1212

@@ -24,17 +24,17 @@ In order to build and run Linux for OpenRISC, you'll need at least a basic
2424
toolchain and, perhaps, the architectural simulator. Steps to get these bits
2525
in place are outlined here.
2626

27-
1) The toolchain can be obtained from openrisc.net. Instructions for building
27+
1) The toolchain can be obtained from openrisc.io. Instructions for building
2828
a toolchain can be found at:
2929

30-
http://openrisc.net/toolchain-build.html
30+
https://github.com/openrisc/tutorials
3131

3232
2) or1ksim (optional)
3333

3434
or1ksim is the architectural simulator which will allow you to actually run
3535
your OpenRISC Linux kernel if you don't have an OpenRISC processor at hand.
3636

37-
git clone git://openrisc.net/jonas/or1ksim-svn
37+
git clone https://github.com/openrisc/or1ksim.git
3838

3939
cd or1ksim
4040
./configure --prefix=$OPENRISC_PREFIX

arch/openrisc/TODO.openrisc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ that are due for investigation shortly, i.e. our TODO list:
55

66
-- Implement the rest of the DMA API... dma_map_sg, etc.
77

8-
-- Consolidate usage of memblock and bootmem... move everything over to
9-
memblock.
10-
118
-- Finish the renaming cleanup... there are references to or32 in the code
129
which was an older name for the architecture. The name we've settled on is
1310
or1k and this change is slowly trickling through the stack. For the time

arch/openrisc/include/asm/pgalloc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <linux/threads.h>
2424
#include <linux/mm.h>
2525
#include <linux/memblock.h>
26-
#include <linux/bootmem.h>
2726

2827
extern int mem_init_done;
2928

arch/openrisc/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern void paging_init(void);
6969
*/
7070
#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2))
7171

72-
#define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2))
72+
#define PTRS_PER_PGD (1UL << (32-PGDIR_SHIFT))
7373

7474
/* calculate how many PGD entries a user-level program can use
7575
* the first mappable virtual address is 0

arch/openrisc/kernel/entry.S

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ EXCEPTION_ENTRY(_data_page_fault_handler)
264264
l.srli r6,r6,26 // check opcode for write access
265265
#endif
266266

267-
l.sfgeui r6,0x34 // check opcode for write access
267+
l.sfgeui r6,0x33 // check opcode for write access
268268
l.bnf 1f
269269
l.sfleui r6,0x37
270270
l.bnf 1f
@@ -1101,8 +1101,16 @@ ENTRY(__sys_fork)
11011101
l.addi r3,r1,0
11021102

11031103
ENTRY(sys_rt_sigreturn)
1104-
l.j _sys_rt_sigreturn
1104+
l.jal _sys_rt_sigreturn
11051105
l.addi r3,r1,0
1106+
l.sfne r30,r0
1107+
l.bnf _no_syscall_trace
1108+
l.nop
1109+
l.jal do_syscall_trace_leave
1110+
l.addi r3,r1,0
1111+
_no_syscall_trace:
1112+
l.j _resume_userspace
1113+
l.nop
11061114

11071115
/* This is a catch-all syscall for atomic instructions for the OpenRISC 1000.
11081116
* The functions takes a variable number of parameters depending on which

arch/openrisc/kernel/process.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,19 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
173173

174174
if (usp)
175175
userregs->sp = usp;
176+
177+
/*
178+
* For CLONE_SETTLS set "tp" (r10) to the TLS pointer passed to sys_clone.
179+
*
180+
* The kernel entry is:
181+
* int clone (long flags, void *child_stack, int *parent_tid,
182+
* int *child_tid, struct void *tls)
183+
*
184+
* This makes the source r7 in the kernel registers.
185+
*/
186+
if (clone_flags & CLONE_SETTLS)
187+
userregs->gpr[10] = userregs->gpr[7];
188+
176189
userregs->gpr[11] = 0; /* Result from fork() */
177190

178191
kregs->gpr[20] = 0; /* Userspace thread */

arch/openrisc/kernel/setup.c

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <linux/of.h>
3939
#include <linux/memblock.h>
4040
#include <linux/device.h>
41-
#include <linux/of_platform.h>
4241

4342
#include <asm/sections.h>
4443
#include <asm/segment.h>
@@ -51,18 +50,16 @@
5150

5251
#include "vmlinux.h"
5352

54-
static unsigned long __init setup_memory(void)
53+
static void __init setup_memory(void)
5554
{
56-
unsigned long bootmap_size;
5755
unsigned long ram_start_pfn;
58-
unsigned long free_ram_start_pfn;
5956
unsigned long ram_end_pfn;
6057
phys_addr_t memory_start, memory_end;
6158
struct memblock_region *region;
6259

6360
memory_end = memory_start = 0;
6461

65-
/* Find main memory where is the kernel */
62+
/* Find main memory where is the kernel, we assume its the only one */
6663
for_each_memblock(memory, region) {
6764
memory_start = region->base;
6865
memory_end = region->base + region->size;
@@ -75,33 +72,25 @@ static unsigned long __init setup_memory(void)
7572
}
7673

7774
ram_start_pfn = PFN_UP(memory_start);
78-
/* free_ram_start_pfn is first page after kernel */
79-
free_ram_start_pfn = PFN_UP(__pa(_end));
8075
ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM());
8176

77+
/* setup bootmem globals (we use no_bootmem, but mm still depends on this) */
78+
min_low_pfn = ram_start_pfn;
79+
max_low_pfn = ram_end_pfn;
8280
max_pfn = ram_end_pfn;
8381

8482
/*
8583
* initialize the boot-time allocator (with low memory only).
8684
*
8785
* This makes the memory from the end of the kernel to the end of
8886
* RAM usable.
89-
* init_bootmem sets the global values min_low_pfn, max_low_pfn.
9087
*/
91-
bootmap_size = init_bootmem(free_ram_start_pfn,
92-
ram_end_pfn - ram_start_pfn);
93-
free_bootmem(PFN_PHYS(free_ram_start_pfn),
94-
(ram_end_pfn - free_ram_start_pfn) << PAGE_SHIFT);
95-
reserve_bootmem(PFN_PHYS(free_ram_start_pfn), bootmap_size,
96-
BOOTMEM_DEFAULT);
97-
98-
for_each_memblock(reserved, region) {
99-
printk(KERN_INFO "Reserved - 0x%08x-0x%08x\n",
100-
(u32) region->base, (u32) region->size);
101-
reserve_bootmem(region->base, region->size, BOOTMEM_DEFAULT);
102-
}
88+
memblock_reserve(__pa(_stext), _end - _stext);
89+
90+
early_init_fdt_reserve_self();
91+
early_init_fdt_scan_reserved_mem();
10392

104-
return ram_end_pfn;
93+
memblock_dump_all();
10594
}
10695

10796
struct cpuinfo cpuinfo;
@@ -219,15 +208,6 @@ void __init or32_early_setup(void *fdt)
219208
early_init_devtree(fdt);
220209
}
221210

222-
static int __init openrisc_device_probe(void)
223-
{
224-
of_platform_populate(NULL, NULL, NULL, NULL);
225-
226-
return 0;
227-
}
228-
229-
device_initcall(openrisc_device_probe);
230-
231211
static inline unsigned long extract_value_bits(unsigned long reg,
232212
short bit_nr, short width)
233213
{
@@ -282,8 +262,6 @@ void calibrate_delay(void)
282262

283263
void __init setup_arch(char **cmdline_p)
284264
{
285-
unsigned long max_low_pfn;
286-
287265
unflatten_and_copy_device_tree();
288266

289267
setup_cpuinfo();
@@ -304,8 +282,8 @@ void __init setup_arch(char **cmdline_p)
304282
initrd_below_start_ok = 1;
305283
#endif
306284

307-
/* setup bootmem allocator */
308-
max_low_pfn = setup_memory();
285+
/* setup memblock allocator */
286+
setup_memory();
309287

310288
/* paging_init() sets up the MMU and marks all pages as reserved */
311289
paging_init();
@@ -317,7 +295,7 @@ void __init setup_arch(char **cmdline_p)
317295

318296
*cmdline_p = boot_command_line;
319297

320-
printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n");
298+
printk(KERN_INFO "OpenRISC Linux -- http://openrisc.io\n");
321299
}
322300

323301
static int show_cpuinfo(struct seq_file *m, void *v)

arch/openrisc/kernel/vmlinux.lds.S

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@
3030
#include <asm/cache.h>
3131
#include <asm-generic/vmlinux.lds.h>
3232

33-
OUTPUT_FORMAT("elf32-or32", "elf32-or32", "elf32-or32")
33+
#ifdef __OR1K__
34+
#define __OUTPUT_FORMAT "elf32-or1k"
35+
#else
36+
#define __OUTPUT_FORMAT "elf32-or32"
37+
#endif
38+
39+
OUTPUT_FORMAT(__OUTPUT_FORMAT, __OUTPUT_FORMAT, __OUTPUT_FORMAT)
3440
jiffies = jiffies_64 + 4;
3541

3642
SECTIONS

arch/openrisc/mm/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ static void __init map_ram(void)
106106
}
107107

108108
/* Alloc one page for holding PTE's... */
109-
pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
109+
pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
110110
set_pmd(pme, __pmd(_KERNPG_TABLE + __pa(pte)));
111111

112112
/* Fill the newly allocated page with PTE'S */
113-
for (j = 0; p < e && j < PTRS_PER_PGD;
113+
for (j = 0; p < e && j < PTRS_PER_PTE;
114114
v += PAGE_SIZE, p += PAGE_SIZE, j++, pte++) {
115115
if (v >= (u32) _e_kernel_ro ||
116116
v < (u32) _s_kernel_ro)

arch/openrisc/mm/ioremap.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm,
124124
if (likely(mem_init_done)) {
125125
pte = (pte_t *) __get_free_page(GFP_KERNEL);
126126
} else {
127-
pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
128-
#if 0
129-
/* FIXME: use memblock... */
130127
pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
131-
#endif
132128
}
133129

134130
if (pte)

drivers/video/console/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ config VGA_CONSOLE
99
depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && \
1010
!SUPERH && !BLACKFIN && !AVR32 && !MN10300 && !CRIS && \
1111
(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
12-
!ARM64 && !ARC && !MICROBLAZE
12+
!ARM64 && !ARC && !MICROBLAZE && !OPENRISC
1313
default y
1414
help
1515
Saying Y here will allow you to use Linux in text mode through a

0 commit comments

Comments
 (0)