Skip to content

Commit

Permalink
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
Linus Torvalds committed Jun 25, 2014
2 parents 07f4695 + 6663a4f commit d91d66e
Show file tree
Hide file tree
Showing 21 changed files with 93 additions and 501 deletions.
1 change: 0 additions & 1 deletion arch/powerpc/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO
This correspond to which /dev/hvcN you want to use for early
debug.

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

Expand Down
11 changes: 11 additions & 0 deletions arch/powerpc/include/asm/code-patching.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,15 @@ static inline unsigned long ppc_function_entry(void *func)
#endif
}

static inline unsigned long ppc_global_function_entry(void *func)
{
#if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2
/* PPC64 ABIv2 the global entry point is at the address */
return (unsigned long)func;
#else
/* All other cases there is no change vs ppc_function_entry() */
return ppc_function_entry(func);
#endif
}

#endif /* _ASM_POWERPC_CODE_PATCHING_H */
29 changes: 0 additions & 29 deletions arch/powerpc/include/asm/opal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,7 @@
#ifndef __OPAL_H
#define __OPAL_H

/****** Takeover interface ********/

/* PAPR H-Call used to querty the HAL existence and/or instanciate
* it from within pHyp (tech preview only).
*
* This is exclusively used in prom_init.c
*/

#ifndef __ASSEMBLY__

struct opal_takeover_args {
u64 k_image; /* r4 */
u64 k_size; /* r5 */
u64 k_entry; /* r6 */
u64 k_entry2; /* r7 */
u64 hal_addr; /* r8 */
u64 rd_image; /* r9 */
u64 rd_size; /* r10 */
u64 rd_loc; /* r11 */
};

/*
* SG entry
*
Expand All @@ -55,15 +35,6 @@ struct opal_sg_list {
/* We calculate number of sg entries based on PAGE_SIZE */
#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))

extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);

extern long opal_do_takeover(struct opal_takeover_args *args);

struct rtas_args;
extern int opal_enter_rtas(struct rtas_args *args,
unsigned long data,
unsigned long entry);

#endif /* __ASSEMBLY__ */

/****** OPAL APIs ******/
Expand Down
43 changes: 0 additions & 43 deletions arch/powerpc/include/asm/swab.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,30 @@

#include <uapi/asm/swab.h>

#ifdef __GNUC__
#ifndef __powerpc64__
#endif /* __powerpc64__ */

static __inline__ __u16 ld_le16(const volatile __u16 *addr)
{
__u16 val;

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

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

static inline void __arch_swab16s(__u16 *addr)
{
st_le16(addr, *addr);
}
#define __arch_swab16s __arch_swab16s

static __inline__ __u32 ld_le32(const volatile __u32 *addr)
{
__u32 val;

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

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

static inline void __arch_swab32s(__u32 *addr)
{
st_le32(addr, *addr);
}
#define __arch_swab32s __arch_swab32s

static inline __attribute_const__ __u16 __arch_swab16(__u16 value)
{
__u16 result;

__asm__("rlwimi %0,%1,8,16,23"
: "=r" (result)
: "r" (value), "0" (value >> 8));
return result;
}
#define __arch_swab16 __arch_swab16

static inline __attribute_const__ __u32 __arch_swab32(__u32 value)
{
__u32 result;

__asm__("rlwimi %0,%1,24,16,23\n\t"
"rlwimi %0,%1,8,8,15\n\t"
"rlwimi %0,%1,24,0,7"
: "=r" (result)
: "r" (value), "0" (value >> 24));
return result;
}
#define __arch_swab32 __arch_swab32

#endif /* __GNUC__ */
#endif /* _ASM_POWERPC_SWAB_H */
52 changes: 25 additions & 27 deletions arch/powerpc/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*
*/

#define pr_fmt(fmt) "ftrace-powerpc: " fmt

#include <linux/spinlock.h>
#include <linux/hardirq.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -105,7 +107,7 @@ __ftrace_make_nop(struct module *mod,
struct dyn_ftrace *rec, unsigned long addr)
{
unsigned int op;
unsigned long ptr;
unsigned long entry, ptr;
unsigned long ip = rec->ip;
void *tramp;

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

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

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

if (!is_module_trampoline(tramp)) {
printk(KERN_ERR "Not a trampoline\n");
pr_err("Not a trampoline\n");
return -EINVAL;
}

if (module_trampoline_target(mod, tramp, &ptr)) {
printk(KERN_ERR "Failed to get trampoline target\n");
pr_err("Failed to get trampoline target\n");
return -EFAULT;
}

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

entry = ppc_global_function_entry((void *)addr);
/* This should match what was called */
if (ptr != ppc_function_entry((void *)addr)) {
printk(KERN_ERR "addr %lx does not match expected %lx\n",
ptr, ppc_function_entry((void *)addr));
if (ptr != entry) {
pr_err("addr %lx does not match expected %lx\n", ptr, entry);
return -EINVAL;
}

Expand Down Expand Up @@ -179,7 +181,7 @@ __ftrace_make_nop(struct module *mod,

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

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

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

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

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

if (tramp != addr) {
printk(KERN_ERR
"Trampoline location %08lx does not match addr\n",
pr_err("Trampoline location %08lx does not match addr\n",
tramp);
return -EINVAL;
}
Expand Down Expand Up @@ -263,15 +264,13 @@ int ftrace_make_nop(struct module *mod,
*/
if (!rec->arch.mod) {
if (!mod) {
printk(KERN_ERR "No module loaded addr=%lx\n",
addr);
pr_err("No module loaded addr=%lx\n", addr);
return -EFAULT;
}
rec->arch.mod = mod;
} else if (mod) {
if (mod != rec->arch.mod) {
printk(KERN_ERR
"Record mod %p not equal to passed in mod %p\n",
pr_err("Record mod %p not equal to passed in mod %p\n",
rec->arch.mod, mod);
return -EINVAL;
}
Expand Down Expand Up @@ -307,26 +306,25 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
* The load offset is different depending on the ABI. For simplicity
* just mask it out when doing the compare.
*/
if ((op[0] != 0x48000008) || ((op[1] & 0xffff00000) != 0xe8410000)) {
printk(KERN_ERR "Unexpected call sequence: %x %x\n",
op[0], op[1]);
if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) {
pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]);
return -EINVAL;
}

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

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

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

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

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

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

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

Expand Down Expand Up @@ -397,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
* already have a module defined.
*/
if (!rec->arch.mod) {
printk(KERN_ERR "No module loaded\n");
pr_err("No module loaded\n");
return -EINVAL;
}

Expand Down
20 changes: 10 additions & 10 deletions arch/powerpc/kernel/iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ unsigned int ioread16(void __iomem *addr)
}
unsigned int ioread16be(void __iomem *addr)
{
return in_be16(addr);
return readw_be(addr);
}
unsigned int ioread32(void __iomem *addr)
{
return readl(addr);
}
unsigned int ioread32be(void __iomem *addr)
{
return in_be32(addr);
return readl_be(addr);
}
EXPORT_SYMBOL(ioread8);
EXPORT_SYMBOL(ioread16);
Expand All @@ -49,15 +49,15 @@ void iowrite16(u16 val, void __iomem *addr)
}
void iowrite16be(u16 val, void __iomem *addr)
{
out_be16(addr, val);
writew_be(val, addr);
}
void iowrite32(u32 val, void __iomem *addr)
{
writel(val, addr);
}
void iowrite32be(u32 val, void __iomem *addr)
{
out_be32(addr, val);
writel_be(val, addr);
}
EXPORT_SYMBOL(iowrite8);
EXPORT_SYMBOL(iowrite16);
Expand All @@ -75,31 +75,31 @@ EXPORT_SYMBOL(iowrite32be);
*/
void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
{
_insb((u8 __iomem *) addr, dst, count);
readsb(addr, dst, count);
}
void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
{
_insw_ns((u16 __iomem *) addr, dst, count);
readsw(addr, dst, count);
}
void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
{
_insl_ns((u32 __iomem *) addr, dst, count);
readsl(addr, dst, count);
}
EXPORT_SYMBOL(ioread8_rep);
EXPORT_SYMBOL(ioread16_rep);
EXPORT_SYMBOL(ioread32_rep);

void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
{
_outsb((u8 __iomem *) addr, src, count);
writesb(addr, src, count);
}
void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
{
_outsw_ns((u16 __iomem *) addr, src, count);
writesw(addr, src, count);
}
void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
{
_outsl_ns((u32 __iomem *) addr, src, count);
writesl(addr, src, count);
}
EXPORT_SYMBOL(iowrite8_rep);
EXPORT_SYMBOL(iowrite16_rep);
Expand Down
Loading

0 comments on commit d91d66e

Please sign in to comment.