Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d91d66e8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 07f4695c 6663a4fa
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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.

+11 −0
Original line number Diff line number Diff line
@@ -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 */
+0 −29
Original line number Diff line number Diff line
@@ -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
 *
@@ -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 ******/
+0 −43
Original line number Diff line number Diff line
@@ -9,10 +9,6 @@

#include <uapi/asm/swab.h>

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

static __inline__ __u16 ld_le16(const volatile __u16 *addr)
{
	__u16 val;
@@ -20,19 +16,12 @@ static __inline__ __u16 ld_le16(const volatile __u16 *addr)
	__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;
@@ -40,42 +29,10 @@ static __inline__ __u32 ld_le32(const volatile __u32 *addr)
	__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 */
+25 −27
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@
 *
 */

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

#include <linux/spinlock.h>
#include <linux/hardirq.h>
#include <linux/uaccess.h>
@@ -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;

@@ -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;
	}

@@ -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;
	}

@@ -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;
	}

@@ -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;
	}

@@ -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;
	}

@@ -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;
	}
@@ -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;
		}
@@ -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;
	}

@@ -345,13 +343,13 @@ __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;
	}

@@ -359,7 +357,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
	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;
	}

@@ -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;
	}

Loading