Skip to content

Commit 04cde03

Browse files
committed
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: powerpc: Use generic compat_sys_old_readdir powerpc/kexec: Fix up KEXEC_CONTROL_CODE_SIZE missed during conversion powerpc: Remove dead module_find_bug code powerpc: Add CMO enabled flag and paging space data to lparcfg powerpc: Fix CMM page loaning on 64k page kernel with 4k hardware pages powerpc: Make CMO paging space pool ID and page size available powerpc: Fix lockdep IRQ tracing bug powerpc: Fix TLB invalidation on boot on 32-bit powerpc: Fix loss of vdso on fork on 32-bit
2 parents 1de481d + 50d0b17 commit 04cde03

File tree

11 files changed

+78
-88
lines changed

11 files changed

+78
-88
lines changed

arch/powerpc/include/asm/hvcall.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,28 @@ struct hvcall_mpp_data {
291291
};
292292

293293
int h_get_mpp(struct hvcall_mpp_data *);
294+
295+
#ifdef CONFIG_PPC_PSERIES
296+
extern int CMO_PrPSP;
297+
extern int CMO_SecPSP;
298+
extern unsigned long CMO_PageSize;
299+
300+
static inline int cmo_get_primary_psp(void)
301+
{
302+
return CMO_PrPSP;
303+
}
304+
305+
static inline int cmo_get_secondary_psp(void)
306+
{
307+
return CMO_SecPSP;
308+
}
309+
310+
static inline unsigned long cmo_get_page_size(void)
311+
{
312+
return CMO_PageSize;
313+
}
314+
#endif /* CONFIG_PPC_PSERIES */
315+
294316
#endif /* __ASSEMBLY__ */
295317
#endif /* __KERNEL__ */
296318
#endif /* _ASM_POWERPC_HVCALL_H */

arch/powerpc/include/asm/irqflags.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#define TRACE_ENABLE_INTS bl .trace_hardirqs_on
2121
#define TRACE_DISABLE_INTS bl .trace_hardirqs_off
2222
#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
23-
cmpdi en, 0; \
23+
cmpdi en,0; \
2424
bne 95f; \
2525
stb en,PACASOFTIRQEN(r13); \
2626
bl .trace_hardirqs_off; \
@@ -29,7 +29,8 @@
2929
li en,1;
3030
#define TRACE_AND_RESTORE_IRQ(en) \
3131
TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
32-
96: stb en,PACASOFTIRQEN(r13)
32+
stb en,PACASOFTIRQEN(r13); \
33+
96:
3334
#else
3435
#define TRACE_ENABLE_INTS
3536
#define TRACE_DISABLE_INTS

arch/powerpc/include/asm/mmu_context.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ static inline void get_mmu_context(struct mm_struct *mm)
147147
static inline int init_new_context(struct task_struct *t, struct mm_struct *mm)
148148
{
149149
mm->context.id = NO_CONTEXT;
150-
mm->context.vdso_base = 0;
151150
return 0;
152151
}
153152

arch/powerpc/include/asm/systbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ COMPAT_SYS_SPU(readlink)
9292
SYSCALL(uselib)
9393
SYSCALL(swapon)
9494
SYSCALL(reboot)
95-
SYSX(sys_ni_syscall,old32_readdir,old_readdir)
95+
SYSX(sys_ni_syscall,compat_sys_old_readdir,old_readdir)
9696
SYSCALL_SPU(mmap)
9797
SYSCALL_SPU(munmap)
9898
SYSCALL_SPU(truncate)

arch/powerpc/kernel/head_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ flush_tlbs:
11551155
lis r10, 0x40
11561156
1: addic. r10, r10, -0x1000
11571157
tlbie r10
1158-
blt 1b
1158+
bgt 1b
11591159
sync
11601160
blr
11611161

arch/powerpc/kernel/lparcfg.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ static void pseries_cmo_data(struct seq_file *m)
416416
unsigned long cmo_faults = 0;
417417
unsigned long cmo_fault_time = 0;
418418

419+
seq_printf(m, "cmo_enabled=%d\n", firmware_has_feature(FW_FEATURE_CMO));
420+
419421
if (!firmware_has_feature(FW_FEATURE_CMO))
420422
return;
421423

@@ -427,6 +429,9 @@ static void pseries_cmo_data(struct seq_file *m)
427429
seq_printf(m, "cmo_faults=%lu\n", cmo_faults);
428430
seq_printf(m, "cmo_fault_time_usec=%lu\n",
429431
cmo_fault_time / tb_ticks_per_usec);
432+
seq_printf(m, "cmo_primary_psp=%d\n", cmo_get_primary_psp());
433+
seq_printf(m, "cmo_secondary_psp=%d\n", cmo_get_secondary_psp());
434+
seq_printf(m, "cmo_page_size=%lu\n", cmo_get_page_size());
430435
}
431436

432437
static int pseries_lparcfg_data(struct seq_file *m, void *v)

arch/powerpc/kernel/misc_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ relocate_new_kernel:
899899

900900
/* set a new stack at the bottom of our page... */
901901
/* (not really needed now) */
902-
addi r1, r4, KEXEC_CONTROL_CODE_SIZE - 8 /* for LR Save+Back Chain */
902+
addi r1, r4, KEXEC_CONTROL_PAGE_SIZE - 8 /* for LR Save+Back Chain */
903903
stw r0, 0(r1)
904904

905905
/* Do the copies */

arch/powerpc/kernel/module.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,3 @@ void module_arch_cleanup(struct module *mod)
9999
{
100100
module_bug_cleanup(mod);
101101
}
102-
103-
struct bug_entry *module_find_bug(unsigned long bugaddr)
104-
{
105-
struct mod_arch_specific *mod;
106-
unsigned int i;
107-
struct bug_entry *bug;
108-
109-
list_for_each_entry(mod, &module_bug_list, bug_list) {
110-
bug = mod->bug_table;
111-
for (i = 0; i < mod->num_bugs; ++i, ++bug)
112-
if (bugaddr == bug->bug_addr)
113-
return bug;
114-
}
115-
return NULL;
116-
}

arch/powerpc/kernel/sys_ppc32.c

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -52,63 +52,6 @@
5252
#include <asm/ppc-pci.h>
5353
#include <asm/syscalls.h>
5454

55-
struct old_linux_dirent32 {
56-
u32 d_ino;
57-
u32 d_offset;
58-
unsigned short d_namlen;
59-
char d_name[1];
60-
};
61-
62-
struct readdir_callback32 {
63-
struct old_linux_dirent32 __user * dirent;
64-
int count;
65-
};
66-
67-
static int fillonedir(void * __buf, const char * name, int namlen,
68-
off_t offset, u64 ino, unsigned int d_type)
69-
{
70-
struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
71-
struct old_linux_dirent32 __user * dirent;
72-
ino_t d_ino;
73-
74-
if (buf->count)
75-
return -EINVAL;
76-
d_ino = ino;
77-
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
78-
return -EOVERFLOW;
79-
buf->count++;
80-
dirent = buf->dirent;
81-
put_user(d_ino, &dirent->d_ino);
82-
put_user(offset, &dirent->d_offset);
83-
put_user(namlen, &dirent->d_namlen);
84-
copy_to_user(dirent->d_name, name, namlen);
85-
put_user(0, dirent->d_name + namlen);
86-
return 0;
87-
}
88-
89-
asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
90-
{
91-
int error = -EBADF;
92-
struct file * file;
93-
struct readdir_callback32 buf;
94-
95-
file = fget(fd);
96-
if (!file)
97-
goto out;
98-
99-
buf.count = 0;
100-
buf.dirent = dirent;
101-
102-
error = vfs_readdir(file, (filldir_t)fillonedir, &buf);
103-
if (error < 0)
104-
goto out_putf;
105-
error = buf.count;
106-
107-
out_putf:
108-
fput(file);
109-
out:
110-
return error;
111-
}
11255

11356
asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
11457
compat_ulong_t __user *outp, compat_ulong_t __user *exp,

arch/powerpc/platforms/pseries/plpar_wrappers.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define _PSERIES_PLPAR_WRAPPERS_H
33

44
#include <asm/hvcall.h>
5+
#include <asm/page.h>
56

67
static inline long poll_pending(void)
78
{
@@ -44,12 +45,34 @@ static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
4445

4546
static inline long plpar_page_set_loaned(unsigned long vpa)
4647
{
47-
return plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa, 0);
48+
unsigned long cmo_page_sz = cmo_get_page_size();
49+
long rc = 0;
50+
int i;
51+
52+
for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz)
53+
rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa + i, 0);
54+
55+
for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz)
56+
plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE,
57+
vpa + i - cmo_page_sz, 0);
58+
59+
return rc;
4860
}
4961

5062
static inline long plpar_page_set_active(unsigned long vpa)
5163
{
52-
return plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa, 0);
64+
unsigned long cmo_page_sz = cmo_get_page_size();
65+
long rc = 0;
66+
int i;
67+
68+
for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz)
69+
rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa + i, 0);
70+
71+
for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz)
72+
plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED,
73+
vpa + i - cmo_page_sz, 0);
74+
75+
return rc;
5376
}
5477

5578
extern void vpa_init(int cpu);

arch/powerpc/platforms/pseries/setup.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
#include "plpar_wrappers.h"
6969
#include "pseries.h"
7070

71+
int CMO_PrPSP = -1;
72+
int CMO_SecPSP = -1;
73+
unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT);
7174

7275
int fwnmi_active; /* TRUE if an FWNMI handler is present */
7376

@@ -325,8 +328,7 @@ void pSeries_cmo_feature_init(void)
325328
{
326329
char *ptr, *key, *value, *end;
327330
int call_status;
328-
int PrPSP = -1;
329-
int SecPSP = -1;
331+
int page_order = IOMMU_PAGE_SHIFT;
330332

331333
pr_debug(" -> fw_cmo_feature_init()\n");
332334
spin_lock(&rtas_data_buf_lock);
@@ -365,21 +367,31 @@ void pSeries_cmo_feature_init(void)
365367
break;
366368
}
367369

368-
if (0 == strcmp(key, "PrPSP"))
369-
PrPSP = simple_strtol(value, NULL, 10);
370+
if (0 == strcmp(key, "CMOPageSize"))
371+
page_order = simple_strtol(value, NULL, 10);
372+
else if (0 == strcmp(key, "PrPSP"))
373+
CMO_PrPSP = simple_strtol(value, NULL, 10);
370374
else if (0 == strcmp(key, "SecPSP"))
371-
SecPSP = simple_strtol(value, NULL, 10);
375+
CMO_SecPSP = simple_strtol(value, NULL, 10);
372376
value = key = ptr + 1;
373377
}
374378
ptr++;
375379
}
376380

377-
if (PrPSP != -1 || SecPSP != -1) {
381+
/* Page size is returned as the power of 2 of the page size,
382+
* convert to the page size in bytes before returning
383+
*/
384+
CMO_PageSize = 1 << page_order;
385+
pr_debug("CMO_PageSize = %lu\n", CMO_PageSize);
386+
387+
if (CMO_PrPSP != -1 || CMO_SecPSP != -1) {
378388
pr_info("CMO enabled\n");
379-
pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP);
389+
pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
390+
CMO_SecPSP);
380391
powerpc_firmware_features |= FW_FEATURE_CMO;
381392
} else
382-
pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP);
393+
pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
394+
CMO_SecPSP);
383395
spin_unlock(&rtas_data_buf_lock);
384396
pr_debug(" <- fw_cmo_feature_init()\n");
385397
}

0 commit comments

Comments
 (0)