Skip to content

Commit d91d66e

Browse files
committed
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc fixes and cleanups from Ben Herrenschmidt: "Here are a handful or two of powerpc fixes and simple/trivial cleanups. A bunch of them fix ftrace with the new ABI v2 in Little Endian, the rest is a scattering of fairly simple things" * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: powerpc: Don't skip ePAPR spin-table CPUs powerpc/module: Fix TOC symbol CRC powerpc/powernv: Remove OPAL v1 takeover powerpc/kmemleak: Do not scan the DART table selftests/powerpc: Use the test harness for the TM DSCR test powerpc/cell: cbe_thermal.c: Cleaning up a variable is of the wrong type powerpc/kprobes: Fix jprobes on ABI v2 (LE) powerpc/ftrace: Use pr_fmt() to namespace error messages powerpc/ftrace: Fix nop of modules on 64bit LE (ABIv2) powerpc/ftrace: Fix inverted check of create_branch() powerpc/ftrace: Fix typo in mask of opcode powerpc: Add ppc_global_function_entry() powerpc/macintosh/smu.c: Fix closing brace followed by if powerpc: Remove __arch_swab* powerpc: Remove ancient DEBUG_SIG code powerpc/kerenl: Enable EEH for IO accessors
2 parents 07f4695 + 6663a4f commit d91d66e

File tree

21 files changed

+93
-501
lines changed

21 files changed

+93
-501
lines changed

arch/powerpc/Kconfig.debug

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO
303303
This correspond to which /dev/hvcN you want to use for early
304304
debug.
305305

306-
On OPAL v1 (takeover) this should always be 0
307306
On OPAL v2, this will be 0 for network console and 1 or 2 for
308307
the machine built-in serial ports.
309308

arch/powerpc/include/asm/code-patching.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,15 @@ static inline unsigned long ppc_function_entry(void *func)
8888
#endif
8989
}
9090

91+
static inline unsigned long ppc_global_function_entry(void *func)
92+
{
93+
#if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2
94+
/* PPC64 ABIv2 the global entry point is at the address */
95+
return (unsigned long)func;
96+
#else
97+
/* All other cases there is no change vs ppc_function_entry() */
98+
return ppc_function_entry(func);
99+
#endif
100+
}
101+
91102
#endif /* _ASM_POWERPC_CODE_PATCHING_H */

arch/powerpc/include/asm/opal.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,7 @@
1212
#ifndef __OPAL_H
1313
#define __OPAL_H
1414

15-
/****** Takeover interface ********/
16-
17-
/* PAPR H-Call used to querty the HAL existence and/or instanciate
18-
* it from within pHyp (tech preview only).
19-
*
20-
* This is exclusively used in prom_init.c
21-
*/
22-
2315
#ifndef __ASSEMBLY__
24-
25-
struct opal_takeover_args {
26-
u64 k_image; /* r4 */
27-
u64 k_size; /* r5 */
28-
u64 k_entry; /* r6 */
29-
u64 k_entry2; /* r7 */
30-
u64 hal_addr; /* r8 */
31-
u64 rd_image; /* r9 */
32-
u64 rd_size; /* r10 */
33-
u64 rd_loc; /* r11 */
34-
};
35-
3616
/*
3717
* SG entry
3818
*
@@ -55,15 +35,6 @@ struct opal_sg_list {
5535
/* We calculate number of sg entries based on PAGE_SIZE */
5636
#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
5737

58-
extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);
59-
60-
extern long opal_do_takeover(struct opal_takeover_args *args);
61-
62-
struct rtas_args;
63-
extern int opal_enter_rtas(struct rtas_args *args,
64-
unsigned long data,
65-
unsigned long entry);
66-
6738
#endif /* __ASSEMBLY__ */
6839

6940
/****** OPAL APIs ******/

arch/powerpc/include/asm/swab.h

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,73 +9,30 @@
99

1010
#include <uapi/asm/swab.h>
1111

12-
#ifdef __GNUC__
13-
#ifndef __powerpc64__
14-
#endif /* __powerpc64__ */
15-
1612
static __inline__ __u16 ld_le16(const volatile __u16 *addr)
1713
{
1814
__u16 val;
1915

2016
__asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
2117
return val;
2218
}
23-
#define __arch_swab16p ld_le16
2419

2520
static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
2621
{
2722
__asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
2823
}
2924

30-
static inline void __arch_swab16s(__u16 *addr)
31-
{
32-
st_le16(addr, *addr);
33-
}
34-
#define __arch_swab16s __arch_swab16s
35-
3625
static __inline__ __u32 ld_le32(const volatile __u32 *addr)
3726
{
3827
__u32 val;
3928

4029
__asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
4130
return val;
4231
}
43-
#define __arch_swab32p ld_le32
4432

4533
static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
4634
{
4735
__asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
4836
}
4937

50-
static inline void __arch_swab32s(__u32 *addr)
51-
{
52-
st_le32(addr, *addr);
53-
}
54-
#define __arch_swab32s __arch_swab32s
55-
56-
static inline __attribute_const__ __u16 __arch_swab16(__u16 value)
57-
{
58-
__u16 result;
59-
60-
__asm__("rlwimi %0,%1,8,16,23"
61-
: "=r" (result)
62-
: "r" (value), "0" (value >> 8));
63-
return result;
64-
}
65-
#define __arch_swab16 __arch_swab16
66-
67-
static inline __attribute_const__ __u32 __arch_swab32(__u32 value)
68-
{
69-
__u32 result;
70-
71-
__asm__("rlwimi %0,%1,24,16,23\n\t"
72-
"rlwimi %0,%1,8,8,15\n\t"
73-
"rlwimi %0,%1,24,0,7"
74-
: "=r" (result)
75-
: "r" (value), "0" (value >> 24));
76-
return result;
77-
}
78-
#define __arch_swab32 __arch_swab32
79-
80-
#endif /* __GNUC__ */
8138
#endif /* _ASM_POWERPC_SWAB_H */

arch/powerpc/kernel/ftrace.c

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*
1111
*/
1212

13+
#define pr_fmt(fmt) "ftrace-powerpc: " fmt
14+
1315
#include <linux/spinlock.h>
1416
#include <linux/hardirq.h>
1517
#include <linux/uaccess.h>
@@ -105,7 +107,7 @@ __ftrace_make_nop(struct module *mod,
105107
struct dyn_ftrace *rec, unsigned long addr)
106108
{
107109
unsigned int op;
108-
unsigned long ptr;
110+
unsigned long entry, ptr;
109111
unsigned long ip = rec->ip;
110112
void *tramp;
111113

@@ -115,7 +117,7 @@ __ftrace_make_nop(struct module *mod,
115117

116118
/* Make sure that that this is still a 24bit jump */
117119
if (!is_bl_op(op)) {
118-
printk(KERN_ERR "Not expected bl: opcode is %x\n", op);
120+
pr_err("Not expected bl: opcode is %x\n", op);
119121
return -EINVAL;
120122
}
121123

@@ -125,21 +127,21 @@ __ftrace_make_nop(struct module *mod,
125127
pr_devel("ip:%lx jumps to %p", ip, tramp);
126128

127129
if (!is_module_trampoline(tramp)) {
128-
printk(KERN_ERR "Not a trampoline\n");
130+
pr_err("Not a trampoline\n");
129131
return -EINVAL;
130132
}
131133

132134
if (module_trampoline_target(mod, tramp, &ptr)) {
133-
printk(KERN_ERR "Failed to get trampoline target\n");
135+
pr_err("Failed to get trampoline target\n");
134136
return -EFAULT;
135137
}
136138

137139
pr_devel("trampoline target %lx", ptr);
138140

141+
entry = ppc_global_function_entry((void *)addr);
139142
/* This should match what was called */
140-
if (ptr != ppc_function_entry((void *)addr)) {
141-
printk(KERN_ERR "addr %lx does not match expected %lx\n",
142-
ptr, ppc_function_entry((void *)addr));
143+
if (ptr != entry) {
144+
pr_err("addr %lx does not match expected %lx\n", ptr, entry);
143145
return -EINVAL;
144146
}
145147

@@ -179,7 +181,7 @@ __ftrace_make_nop(struct module *mod,
179181

180182
/* Make sure that that this is still a 24bit jump */
181183
if (!is_bl_op(op)) {
182-
printk(KERN_ERR "Not expected bl: opcode is %x\n", op);
184+
pr_err("Not expected bl: opcode is %x\n", op);
183185
return -EINVAL;
184186
}
185187

@@ -198,7 +200,7 @@ __ftrace_make_nop(struct module *mod,
198200

199201
/* Find where the trampoline jumps to */
200202
if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) {
201-
printk(KERN_ERR "Failed to read %lx\n", tramp);
203+
pr_err("Failed to read %lx\n", tramp);
202204
return -EFAULT;
203205
}
204206

@@ -209,7 +211,7 @@ __ftrace_make_nop(struct module *mod,
209211
((jmp[1] & 0xffff0000) != 0x398c0000) ||
210212
(jmp[2] != 0x7d8903a6) ||
211213
(jmp[3] != 0x4e800420)) {
212-
printk(KERN_ERR "Not a trampoline\n");
214+
pr_err("Not a trampoline\n");
213215
return -EINVAL;
214216
}
215217

@@ -221,8 +223,7 @@ __ftrace_make_nop(struct module *mod,
221223
pr_devel(" %lx ", tramp);
222224

223225
if (tramp != addr) {
224-
printk(KERN_ERR
225-
"Trampoline location %08lx does not match addr\n",
226+
pr_err("Trampoline location %08lx does not match addr\n",
226227
tramp);
227228
return -EINVAL;
228229
}
@@ -263,15 +264,13 @@ int ftrace_make_nop(struct module *mod,
263264
*/
264265
if (!rec->arch.mod) {
265266
if (!mod) {
266-
printk(KERN_ERR "No module loaded addr=%lx\n",
267-
addr);
267+
pr_err("No module loaded addr=%lx\n", addr);
268268
return -EFAULT;
269269
}
270270
rec->arch.mod = mod;
271271
} else if (mod) {
272272
if (mod != rec->arch.mod) {
273-
printk(KERN_ERR
274-
"Record mod %p not equal to passed in mod %p\n",
273+
pr_err("Record mod %p not equal to passed in mod %p\n",
275274
rec->arch.mod, mod);
276275
return -EINVAL;
277276
}
@@ -307,26 +306,25 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
307306
* The load offset is different depending on the ABI. For simplicity
308307
* just mask it out when doing the compare.
309308
*/
310-
if ((op[0] != 0x48000008) || ((op[1] & 0xffff00000) != 0xe8410000)) {
311-
printk(KERN_ERR "Unexpected call sequence: %x %x\n",
312-
op[0], op[1]);
309+
if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) {
310+
pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]);
313311
return -EINVAL;
314312
}
315313

316314
/* If we never set up a trampoline to ftrace_caller, then bail */
317315
if (!rec->arch.mod->arch.tramp) {
318-
printk(KERN_ERR "No ftrace trampoline\n");
316+
pr_err("No ftrace trampoline\n");
319317
return -EINVAL;
320318
}
321319

322320
/* Ensure branch is within 24 bits */
323-
if (create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
324-
printk(KERN_ERR "Branch out of range");
321+
if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
322+
pr_err("Branch out of range\n");
325323
return -EINVAL;
326324
}
327325

328326
if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
329-
printk(KERN_ERR "REL24 out of range!\n");
327+
pr_err("REL24 out of range!\n");
330328
return -EINVAL;
331329
}
332330

@@ -345,21 +343,21 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
345343

346344
/* It should be pointing to a nop */
347345
if (op != PPC_INST_NOP) {
348-
printk(KERN_ERR "Expected NOP but have %x\n", op);
346+
pr_err("Expected NOP but have %x\n", op);
349347
return -EINVAL;
350348
}
351349

352350
/* If we never set up a trampoline to ftrace_caller, then bail */
353351
if (!rec->arch.mod->arch.tramp) {
354-
printk(KERN_ERR "No ftrace trampoline\n");
352+
pr_err("No ftrace trampoline\n");
355353
return -EINVAL;
356354
}
357355

358356
/* create the branch to the trampoline */
359357
op = create_branch((unsigned int *)ip,
360358
rec->arch.mod->arch.tramp, BRANCH_SET_LINK);
361359
if (!op) {
362-
printk(KERN_ERR "REL24 out of range!\n");
360+
pr_err("REL24 out of range!\n");
363361
return -EINVAL;
364362
}
365363

@@ -397,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
397395
* already have a module defined.
398396
*/
399397
if (!rec->arch.mod) {
400-
printk(KERN_ERR "No module loaded\n");
398+
pr_err("No module loaded\n");
401399
return -EINVAL;
402400
}
403401

arch/powerpc/kernel/iomap.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ unsigned int ioread16(void __iomem *addr)
2323
}
2424
unsigned int ioread16be(void __iomem *addr)
2525
{
26-
return in_be16(addr);
26+
return readw_be(addr);
2727
}
2828
unsigned int ioread32(void __iomem *addr)
2929
{
3030
return readl(addr);
3131
}
3232
unsigned int ioread32be(void __iomem *addr)
3333
{
34-
return in_be32(addr);
34+
return readl_be(addr);
3535
}
3636
EXPORT_SYMBOL(ioread8);
3737
EXPORT_SYMBOL(ioread16);
@@ -49,15 +49,15 @@ void iowrite16(u16 val, void __iomem *addr)
4949
}
5050
void iowrite16be(u16 val, void __iomem *addr)
5151
{
52-
out_be16(addr, val);
52+
writew_be(val, addr);
5353
}
5454
void iowrite32(u32 val, void __iomem *addr)
5555
{
5656
writel(val, addr);
5757
}
5858
void iowrite32be(u32 val, void __iomem *addr)
5959
{
60-
out_be32(addr, val);
60+
writel_be(val, addr);
6161
}
6262
EXPORT_SYMBOL(iowrite8);
6363
EXPORT_SYMBOL(iowrite16);
@@ -75,31 +75,31 @@ EXPORT_SYMBOL(iowrite32be);
7575
*/
7676
void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
7777
{
78-
_insb((u8 __iomem *) addr, dst, count);
78+
readsb(addr, dst, count);
7979
}
8080
void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
8181
{
82-
_insw_ns((u16 __iomem *) addr, dst, count);
82+
readsw(addr, dst, count);
8383
}
8484
void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
8585
{
86-
_insl_ns((u32 __iomem *) addr, dst, count);
86+
readsl(addr, dst, count);
8787
}
8888
EXPORT_SYMBOL(ioread8_rep);
8989
EXPORT_SYMBOL(ioread16_rep);
9090
EXPORT_SYMBOL(ioread32_rep);
9191

9292
void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
9393
{
94-
_outsb((u8 __iomem *) addr, src, count);
94+
writesb(addr, src, count);
9595
}
9696
void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
9797
{
98-
_outsw_ns((u16 __iomem *) addr, src, count);
98+
writesw(addr, src, count);
9999
}
100100
void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
101101
{
102-
_outsl_ns((u32 __iomem *) addr, src, count);
102+
writesl(addr, src, count);
103103
}
104104
EXPORT_SYMBOL(iowrite8_rep);
105105
EXPORT_SYMBOL(iowrite16_rep);

0 commit comments

Comments
 (0)