Skip to content

Commit 69048e0

Browse files
committed
Merge branch 'parisc-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller: "The three major changes in this patchset is a implementation for flexible userspace memory maps, cache-flushing fixes (again), and a long-discussed ABI change to make EWOULDBLOCK the same value as EAGAIN. parisc has been the only platform where we had EWOULDBLOCK != EAGAIN to keep HP-UX compatibility. Since we will probably never implement full HP-UX support, we prefer to drop this compatibility to make it easier for us with Linux userspace programs which mostly never checked for both values. We don't expect major fall-outs because of this change, and if we face some, we will simply rebuild the necessary applications in the debian archives" * 'parisc-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: add flexible mmap memory layout support parisc: Make EWOULDBLOCK be equal to EAGAIN on parisc parisc: convert uapi/asm/stat.h to use native types only parisc: wire up sched_setattr and sched_getattr parisc: fix cache-flushing parisc/sti_console: prefer Linux fonts over built-in ROM fonts
2 parents 1c0b8a7 + 9dabf60 commit 69048e0

File tree

15 files changed

+278
-73
lines changed

15 files changed

+278
-73
lines changed

arch/parisc/include/asm/cacheflush.h

-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ void mark_rodata_ro(void);
132132
static inline void *kmap(struct page *page)
133133
{
134134
might_sleep();
135-
flush_dcache_page(page);
136135
return page_address(page);
137136
}
138137

@@ -144,7 +143,6 @@ static inline void kunmap(struct page *page)
144143
static inline void *kmap_atomic(struct page *page)
145144
{
146145
pagefault_disable();
147-
flush_dcache_page(page);
148146
return page_address(page);
149147
}
150148

arch/parisc/include/asm/elf.h

+4
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,8 @@ struct pt_regs; /* forward declaration... */
348348

349349
#define ELF_HWCAP 0
350350

351+
struct mm_struct;
352+
extern unsigned long arch_randomize_brk(struct mm_struct *);
353+
#define arch_randomize_brk arch_randomize_brk
354+
351355
#endif

arch/parisc/include/asm/page.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ struct page;
2929
void clear_page_asm(void *page);
3030
void copy_page_asm(void *to, void *from);
3131
#define clear_user_page(vto, vaddr, page) clear_page_asm(vto)
32-
#define copy_user_page(vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom)
32+
void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
33+
struct page *pg);
3334

3435
/* #define CONFIG_PARISC_TMPALIAS */
3536

arch/parisc/include/asm/pgtable.h

+1
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
511511
/* We provide our own get_unmapped_area to provide cache coherency */
512512

513513
#define HAVE_ARCH_UNMAPPED_AREA
514+
#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
514515

515516
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
516517
#define __HAVE_ARCH_PTEP_GET_AND_CLEAR

arch/parisc/include/asm/processor.h

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#endif
3131
#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
3232

33+
#define HAVE_ARCH_PICK_MMAP_LAYOUT
34+
3335
#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
3436
#define TASK_SIZE TASK_SIZE_OF(current)
3537
#define TASK_UNMAPPED_BASE (current->thread.map_base)

arch/parisc/include/asm/thread_info.h

+10
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ struct thread_info {
7676
#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
7777
_TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT)
7878

79+
#ifdef CONFIG_64BIT
80+
# ifdef CONFIG_COMPAT
81+
# define is_32bit_task() (test_thread_flag(TIF_32BIT))
82+
# else
83+
# define is_32bit_task() (0)
84+
# endif
85+
#else
86+
# define is_32bit_task() (1)
87+
#endif
88+
7989
#endif /* __KERNEL__ */
8090

8191
#endif /* _ASM_PARISC_THREAD_INFO_H */

arch/parisc/include/uapi/asm/errno.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106

107107
#define EALREADY 244 /* Operation already in progress */
108108
#define EINPROGRESS 245 /* Operation now in progress */
109-
#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN) */
109+
#define EWOULDBLOCK EAGAIN /* Operation would block (Not HPUX compliant) */
110110
#define ENOTEMPTY 247 /* Directory not empty */
111111
#define ENAMETOOLONG 248 /* File name too long */
112112
#define ELOOP 249 /* Too many symbolic links encountered */

arch/parisc/include/uapi/asm/stat.h

+19-21
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,65 @@
55

66
struct stat {
77
unsigned int st_dev; /* dev_t is 32 bits on parisc */
8-
ino_t st_ino; /* 32 bits */
9-
mode_t st_mode; /* 16 bits */
8+
unsigned int st_ino; /* 32 bits */
9+
unsigned short st_mode; /* 16 bits */
1010
unsigned short st_nlink; /* 16 bits */
1111
unsigned short st_reserved1; /* old st_uid */
1212
unsigned short st_reserved2; /* old st_gid */
1313
unsigned int st_rdev;
14-
off_t st_size;
15-
time_t st_atime;
14+
signed int st_size;
15+
signed int st_atime;
1616
unsigned int st_atime_nsec;
17-
time_t st_mtime;
17+
signed int st_mtime;
1818
unsigned int st_mtime_nsec;
19-
time_t st_ctime;
19+
signed int st_ctime;
2020
unsigned int st_ctime_nsec;
2121
int st_blksize;
2222
int st_blocks;
2323
unsigned int __unused1; /* ACL stuff */
2424
unsigned int __unused2; /* network */
25-
ino_t __unused3; /* network */
25+
unsigned int __unused3; /* network */
2626
unsigned int __unused4; /* cnodes */
2727
unsigned short __unused5; /* netsite */
2828
short st_fstype;
2929
unsigned int st_realdev;
3030
unsigned short st_basemode;
3131
unsigned short st_spareshort;
32-
uid_t st_uid;
33-
gid_t st_gid;
32+
unsigned int st_uid;
33+
unsigned int st_gid;
3434
unsigned int st_spare4[3];
3535
};
3636

3737
#define STAT_HAVE_NSEC
3838

39-
typedef __kernel_off64_t off64_t;
40-
4139
struct hpux_stat64 {
4240
unsigned int st_dev; /* dev_t is 32 bits on parisc */
43-
ino_t st_ino; /* 32 bits */
44-
mode_t st_mode; /* 16 bits */
41+
unsigned int st_ino; /* 32 bits */
42+
unsigned short st_mode; /* 16 bits */
4543
unsigned short st_nlink; /* 16 bits */
4644
unsigned short st_reserved1; /* old st_uid */
4745
unsigned short st_reserved2; /* old st_gid */
4846
unsigned int st_rdev;
49-
off64_t st_size;
50-
time_t st_atime;
47+
signed long long st_size;
48+
signed int st_atime;
5149
unsigned int st_spare1;
52-
time_t st_mtime;
50+
signed int st_mtime;
5351
unsigned int st_spare2;
54-
time_t st_ctime;
52+
signed int st_ctime;
5553
unsigned int st_spare3;
5654
int st_blksize;
57-
__u64 st_blocks;
55+
unsigned long long st_blocks;
5856
unsigned int __unused1; /* ACL stuff */
5957
unsigned int __unused2; /* network */
60-
ino_t __unused3; /* network */
58+
unsigned int __unused3; /* network */
6159
unsigned int __unused4; /* cnodes */
6260
unsigned short __unused5; /* netsite */
6361
short st_fstype;
6462
unsigned int st_realdev;
6563
unsigned short st_basemode;
6664
unsigned short st_spareshort;
67-
uid_t st_uid;
68-
gid_t st_gid;
65+
unsigned int st_uid;
66+
unsigned int st_gid;
6967
unsigned int st_spare4[3];
7068
};
7169

arch/parisc/include/uapi/asm/unistd.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,10 @@
826826
#define __NR_process_vm_writev (__NR_Linux + 331)
827827
#define __NR_kcmp (__NR_Linux + 332)
828828
#define __NR_finit_module (__NR_Linux + 333)
829+
#define __NR_sched_setattr (__NR_Linux + 334)
830+
#define __NR_sched_getattr (__NR_Linux + 335)
829831

830-
#define __NR_Linux_syscalls (__NR_finit_module + 1)
832+
#define __NR_Linux_syscalls (__NR_sched_getattr + 1)
831833

832834

833835
#define __IGNORE_select /* newselect */

arch/parisc/kernel/cache.c

+14
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,20 @@ void flush_kernel_dcache_page_addr(void *addr)
388388
}
389389
EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
390390

391+
void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
392+
struct page *pg)
393+
{
394+
/* Copy using kernel mapping. No coherency is needed (all in
395+
kunmap) for the `to' page. However, the `from' page needs to
396+
be flushed through a mapping equivalent to the user mapping
397+
before it can be accessed through the kernel mapping. */
398+
preempt_disable();
399+
flush_dcache_page_asm(__pa(vfrom), vaddr);
400+
preempt_enable();
401+
copy_page_asm(vto, vfrom);
402+
}
403+
EXPORT_SYMBOL(copy_user_page);
404+
391405
void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
392406
{
393407
unsigned long flags;

arch/parisc/kernel/process.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>
1414
* Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org>
1515
* Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
16-
* Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org>
16+
* Copyright (C) 2001-2014 Helge Deller <deller@gmx.de>
1717
* Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
1818
*
1919
*
@@ -49,6 +49,7 @@
4949
#include <linux/kallsyms.h>
5050
#include <linux/uaccess.h>
5151
#include <linux/rcupdate.h>
52+
#include <linux/random.h>
5253

5354
#include <asm/io.h>
5455
#include <asm/asm-offsets.h>
@@ -286,3 +287,21 @@ void *dereference_function_descriptor(void *ptr)
286287
return ptr;
287288
}
288289
#endif
290+
291+
static inline unsigned long brk_rnd(void)
292+
{
293+
/* 8MB for 32bit, 1GB for 64bit */
294+
if (is_32bit_task())
295+
return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
296+
else
297+
return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT;
298+
}
299+
300+
unsigned long arch_randomize_brk(struct mm_struct *mm)
301+
{
302+
unsigned long ret = PAGE_ALIGN(mm->brk + brk_rnd());
303+
304+
if (ret < mm->brk)
305+
return mm->brk;
306+
return ret;
307+
}

0 commit comments

Comments
 (0)