LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Dead mappings and drivers in MTD
From: Olof Johansson @ 2013-03-11 16:20 UTC (permalink / raw)
  To: dedekind1; +Cc: linuxppc-dev, linux-mtd, LKML, linux-arm-kernel
In-Reply-To: <1363016099.3348.47.camel@sauron.fi.intel.com>

On Mon, Mar 11, 2013 at 8:34 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> Hi MTD folks,
>
> we have huge amount of drivers, espacially mapping drives in
> 'drivers/mtd', and for sure may of them are for ancient devices which
> are long dead and not supported by modern kernels anyway. I would like
> to do a small clean-up. It is difficult to judge which ones are dead for
> me, so I am asking the community to help. Thanks!
>
> There are few easy cases - some drivers depend on Kconfig symbols which
> are not defined anywhere - I guess these are clear candidates for
> removal. For example this one:
>
> config MTD_DBOX2
>         tristate "CFI Flash device mapped on D-Box2"
>         depends on DBOX2 && MTD_CFI_INTELSTD && MTD_CFI_INTELEXT && MTD_CFI_AMDSTD
>         help
>           This enables access routines for the flash chips on the Nokia/Sagem
>           D-Box 2 board. If you have one of these boards and would like to use
>
> Grepping for "DBOX2" gives nothing.

In 2.6.14, it dropped two dependencies that used to be there for PPC32
and 8xx. There still was no DBOX2 symbol to fulfill that dependency
back then.

Take it out, if someone finds a user later on it can always be
reverted. Seems very very unlikely in this case.


-Olof

^ permalink raw reply

* Re: [PATCH] Make PCIe hotplug work with Freescale PCIe controllers
From: Joakim Tjernlund @ 2013-03-11 15:17 UTC (permalink / raw)
  To: Rojhalat Ibrahim; +Cc: linuxppc-dev
In-Reply-To: <3989200.gO920IVs04@pcimr>

Rojhalat Ibrahim <imr@rtschenk.de> wrote on 2013/03/11 15:47:30:
> 
> Hi,
> 
> this issue was brought up before. 
> See this thread: 
https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-July/099529.html
> 
> The following patch works for me.
> Hot-added devices appear after "echo 1 > /sys/bus/pci/rescan".
> I tested it with a P5020DS development system.
> 
> Signed-off-by: Rojhalat Ibrahim <imr@rtschenk.de>

Nice! This LOOKS ok to me(cannot test ATM as I am lagging behind)

 Jocke

> ---
>  arch/powerpc/sysdev/indirect_pci.c |   53 
++++++++++++++++++++++++++++++-------
>  1 file changed, 44 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/indirect_pci.c 
b/arch/powerpc/sysdev/indirect_pci.c
> index 82fdad8..aa36009 100644
> --- a/arch/powerpc/sysdev/indirect_pci.c
> +++ b/arch/powerpc/sysdev/indirect_pci.c
> @@ -20,22 +20,19 @@
>  #include <asm/pci-bridge.h>
>  #include <asm/machdep.h>
> 
> +#ifdef CONFIG_FSL_PCI
> +#include <sysdev/fsl_pci.h>
> +#endif
> +
>  static int
> -indirect_read_config(struct pci_bus *bus, unsigned int devfn, int 
offset,
> -           int len, u32 *val)
> +read_config_no_link_check(struct pci_bus *bus, unsigned int devfn, int 
offset,
> +           int len, u32 *val)
>  {
>     struct pci_controller *hose = pci_bus_to_host(bus);
>     volatile void __iomem *cfg_data;
>     u8 cfg_type = 0;
>     u32 bus_no, reg;
> 
> -   if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
> -      if (bus->number != hose->first_busno)
> -         return PCIBIOS_DEVICE_NOT_FOUND;
> -      if (devfn != 0)
> -         return PCIBIOS_DEVICE_NOT_FOUND;
> -   }
> -
>     if (ppc_md.pci_exclude_device)
>        if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
>           return PCIBIOS_DEVICE_NOT_FOUND;
> @@ -78,6 +75,44 @@ indirect_read_config(struct pci_bus *bus, unsigned 
int 
> devfn, int offset,
>     return PCIBIOS_SUCCESSFUL;
>  }
> 
> +#ifdef CONFIG_FSL_PCI
> +static int fsl_pcie_check_link(struct pci_bus *bus)
> +{
> +   struct pci_controller *hose = pci_bus_to_host(bus);
> +   u32 val = 0;
> +
> +   read_config_no_link_check(bus, 0, PCIE_LTSSM, 4, &val);
> +   if (val < PCIE_LTSSM_L0) {
> +      hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
> +      return 1;
> +   } else {
> +      hose->indirect_type &= ~PPC_INDIRECT_TYPE_NO_PCIE_LINK;
> +      return 0;
> +   }
> +}
> +#endif
> +
> +static int
> +indirect_read_config(struct pci_bus *bus, unsigned int devfn, int 
offset,
> +           int len, u32 *val)
> +{
> +   struct pci_controller *hose = pci_bus_to_host(bus);
> +
> +#ifdef CONFIG_FSL_PCI
> +   if ((bus->number == hose->first_busno) && (devfn == 0)) {
> +      fsl_pcie_check_link(bus);
> +   }
> +#endif
> +   if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
> +      if (bus->number != hose->first_busno)
> +         return PCIBIOS_DEVICE_NOT_FOUND;
> +      if (devfn != 0)
> +         return PCIBIOS_DEVICE_NOT_FOUND;
> +   }
> +
> +   return read_config_no_link_check(bus, devfn, offset, len, val);
> +}
> +
>  static int
>  indirect_write_config(struct pci_bus *bus, unsigned int devfn, int 
offset,
>              int len, u32 val)
> 

^ permalink raw reply

* [PATCH] Make PCIe hotplug work with Freescale PCIe controllers
From: Rojhalat Ibrahim @ 2013-03-11 14:47 UTC (permalink / raw)
  To: galak, benh; +Cc: linuxppc-dev

Hi,

this issue was brought up before. 
See this thread: https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-July/099529.html

The following patch works for me.
Hot-added devices appear after "echo 1 > /sys/bus/pci/rescan".
I tested it with a P5020DS development system.

Signed-off-by: Rojhalat Ibrahim <imr@rtschenk.de>
---
 arch/powerpc/sysdev/indirect_pci.c |   53 ++++++++++++++++++++++++++++++-------
 1 file changed, 44 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index 82fdad8..aa36009 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -20,22 +20,19 @@
 #include <asm/pci-bridge.h>
 #include <asm/machdep.h>
 
+#ifdef CONFIG_FSL_PCI
+#include <sysdev/fsl_pci.h>
+#endif
+
 static int
-indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
-		     int len, u32 *val)
+read_config_no_link_check(struct pci_bus *bus, unsigned int devfn, int offset,
+			  int len, u32 *val)
 {
 	struct pci_controller *hose = pci_bus_to_host(bus);
 	volatile void __iomem *cfg_data;
 	u8 cfg_type = 0;
 	u32 bus_no, reg;
 
-	if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
-		if (bus->number != hose->first_busno)
-			return PCIBIOS_DEVICE_NOT_FOUND;
-		if (devfn != 0)
-			return PCIBIOS_DEVICE_NOT_FOUND;
-	}
-
 	if (ppc_md.pci_exclude_device)
 		if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
 			return PCIBIOS_DEVICE_NOT_FOUND;
@@ -78,6 +75,44 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
 	return PCIBIOS_SUCCESSFUL;
 }
 
+#ifdef CONFIG_FSL_PCI
+static int fsl_pcie_check_link(struct pci_bus *bus)
+{
+	struct pci_controller *hose = pci_bus_to_host(bus);
+	u32 val = 0;
+
+	read_config_no_link_check(bus, 0, PCIE_LTSSM, 4, &val);
+	if (val < PCIE_LTSSM_L0) {
+		hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
+		return 1;
+	} else {
+		hose->indirect_type &= ~PPC_INDIRECT_TYPE_NO_PCIE_LINK;
+		return 0;
+	}
+}
+#endif
+
+static int
+indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
+		     int len, u32 *val)
+{
+	struct pci_controller *hose = pci_bus_to_host(bus);
+
+#ifdef CONFIG_FSL_PCI
+	if ((bus->number == hose->first_busno) && (devfn == 0)) {
+		fsl_pcie_check_link(bus);
+	}
+#endif
+	if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
+		if (bus->number != hose->first_busno)
+			return PCIBIOS_DEVICE_NOT_FOUND;
+		if (devfn != 0)
+			return PCIBIOS_DEVICE_NOT_FOUND;
+	}
+
+	return read_config_no_link_check(bus, devfn, offset, len, val);
+}
+
 static int
 indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
 		      int len, u32 val)

^ permalink raw reply related

* [PATCH -next] powerpc: use for_each_compatible_node() macro
From: Wei Yongjun @ 2013-03-11 14:24 UTC (permalink / raw)
  To: benh, paulus, grant.likely, rob.herring
  Cc: yongjun_wei, linuxppc-dev, devicetree-discuss, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Use for_each_compatible_node() macro instead of open coding it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 arch/powerpc/include/asm/parport.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/parport.h b/arch/powerpc/include/asm/parport.h
index 6dc2577..a452968 100644
--- a/arch/powerpc/include/asm/parport.h
+++ b/arch/powerpc/include/asm/parport.h
@@ -21,9 +21,7 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
 	int count = 0;
 	int virq;
 
-	for (np = NULL; (np = of_find_compatible_node(np,
-						      "parallel",
-						      "pnpPNP,400")) != NULL;) {
+	for_each_compatible_node(np, "parallel", "pnpPNP,400") {
 		prop = of_get_property(np, "reg", &propsize);
 		if (!prop || propsize > 6*sizeof(u32))
 			continue;

^ permalink raw reply related

* [v4][PATCH 7/7] book3e/kgdb: Fix a single stgep case of lazy IRQ
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

When we're in kgdb_singlestep(), we have to work around to get
thread_info by copying from the kernel stack before calling
kgdb_handle_exception(), then copying it back afterwards.

But for PPC64, we have a lazy interrupt implementation. So after
copying thread info frome kernle stack, if we need to replay an
interrupt, we shouldn't restore that previous backup thread info
to make sure we can replay an interrupt lately with a proper
thread info.

This patch use __check_irq_replay() to guarantee this process.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/irq.c  |   10 ++++++++++
 arch/powerpc/kernel/kgdb.c |    3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 4f97fe3..bb8d27a 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -339,7 +339,17 @@ bool prep_irq_for_idle(void)
 	return true;
 }
 
+notrace unsigned int check_irq_replay(void)
+{
+	return __check_irq_replay();
+}
+#else
+notrace unsigned int check_irq_replay(void)
+{
+	return 0;
+}
 #endif /* CONFIG_PPC64 */
+EXPORT_SYMBOL(check_irq_replay);
 
 int arch_show_interrupts(struct seq_file *p, int prec)
 {
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index cde7818..5b30408 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -152,6 +152,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
 }
 
 static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info);
+extern notrace unsigned int check_irq_replay(void);
 static int kgdb_singlestep(struct pt_regs *regs)
 {
 	struct thread_info *thread_info, *exception_thread_info;
@@ -181,7 +182,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
 
 	kgdb_handle_exception(0, SIGTRAP, 0, regs);
 
-	if (thread_info != exception_thread_info)
+	if ((thread_info != exception_thread_info) && (!check_irq_replay()))
 		/* Restore current_thread_info lastly. */
 		memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
 
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 6/7] powerpc/kgdb: use DEFINE_PER_CPU to allocate kgdb's thread_info
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

Use DEFINE_PER_CPU to allocate thread_info statically instead of kmalloc().
This can avoid introducing more memory check codes.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/kgdb.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 1a57307..cde7818 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -151,15 +151,15 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
 	return 1;
 }
 
+static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info);
 static int kgdb_singlestep(struct pt_regs *regs)
 {
 	struct thread_info *thread_info, *exception_thread_info;
-	struct thread_info *backup_current_thread_info;
+	struct thread_info *backup_current_thread_info = &__get_cpu_var(kgdb_thread_info);
 
 	if (user_mode(regs))
 		return 0;
 
-	backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
 	/*
 	 * On Book E and perhaps other processors, singlestep is handled on
 	 * the critical exception stack.  This causes current_thread_info()
@@ -185,7 +185,6 @@ static int kgdb_singlestep(struct pt_regs *regs)
 		/* Restore current_thread_info lastly. */
 		memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
 
-	kfree(backup_current_thread_info);
 	return 1;
 }
 
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 5/7] kgdb/kgdbts: support ppc64
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

We can't look up the address of the entry point of the function simply
via that function symbol for all architectures.

For PPC64 ABI, actually there is a function descriptors structure.

A function descriptor is a three doubleword data structure that contains
the following values:
	* The first doubleword contains the address of the entry point of
		the function.
	* The second doubleword contains the TOC base address for
		the function.
	* The third doubleword contains the environment pointer for
		languages such as Pascal and PL/1.

So we should call a wapperred dereference_function_descriptor() to get
the address of the entry point of the function.

Note this is also safe for other architecture after refer to
"include/asm-generic/sections.h" since:

dereference_function_descriptor(p) always is (p) if without arched definition.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 drivers/misc/kgdbts.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index 3aa9a96..4799e1f 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -103,6 +103,7 @@
 #include <linux/delay.h>
 #include <linux/kthread.h>
 #include <linux/module.h>
+#include <asm/sections.h>
 
 #define v1printk(a...) do { \
 	if (verbose) \
@@ -222,6 +223,7 @@ static unsigned long lookup_addr(char *arg)
 		addr = (unsigned long)do_fork;
 	else if (!strcmp(arg, "hw_break_val"))
 		addr = (unsigned long)&hw_break_val;
+	addr = (unsigned long )dereference_function_descriptor((void *)addr);
 	return addr;
 }
 
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 4/7] powerpc/book3e: support kgdb for kernel space
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

Currently we need to skip this for supporting KGDB.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/exceptions-64e.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 7df9a1f..fd5d61b 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -598,11 +598,13 @@ kernel_dbg_exc:
 	rfdi
 
 	/* Normal debug exception */
+1:	andi.	r14,r11,MSR_PR;		/* check for userspace again */
+#ifndef CONFIG_KGDB
 	/* XXX We only handle coming from userspace for now since we can't
 	 *     quite save properly an interrupted kernel state yet
 	 */
-1:	andi.	r14,r11,MSR_PR;		/* check for userspace again */
 	beq	kernel_dbg_exc;		/* if from kernel mode */
+#endif
 
 	/* Now we mash up things to make it look like we are coming on a
 	 * normal exception
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 3/7] book3e/kgdb: update thread's dbcr0
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

gdb always need to generate a single step properly to invoke
a kgdb state. But with lazy interrupt, book3e can't always
trigger a debug exception with a single step since the current
is blocked for handling those pending exception, then we miss
that expected dbcr configuration at last to generate a debug
exception.

So here we also update thread's dbcr0 to make sure the current
can go back with that missed dbcr0 configuration.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/kgdb.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 5ca82cd..1a57307 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -410,7 +410,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 			       struct pt_regs *linux_regs)
 {
 	char *ptr = &remcom_in_buffer[1];
-	unsigned long addr;
+	unsigned long addr, dbcr0;
 
 	switch (remcom_in_buffer[0]) {
 		/*
@@ -427,8 +427,15 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 		/* set the trace bit if we're stepping */
 		if (remcom_in_buffer[0] == 's') {
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
-			mtspr(SPRN_DBCR0,
-			      mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
+			dbcr0 = mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM;
+			mtspr(SPRN_DBCR0, dbcr0);
+#ifdef CONFIG_PPC_BOOK3E_64
+			/* With lazy interrut we have to update thread dbcr0 here
+			 * to make sure we can set debug properly at last to invoke
+			 * kgdb again to work well.
+			 */
+			current->thread.dbcr0 = dbcr0;
+#endif
 			linux_regs->msr |= MSR_DE;
 #else
 			linux_regs->msr |= MSR_SE;
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 2/7] powerpc/book3e: store critical/machine/debug exception thread info
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

We need to store thread info to these exception thread info like something
we already did for PPC32.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/exceptions-64e.S |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 7fd6af0..7df9a1f 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -67,6 +67,18 @@
 	std	r10,PACA_##level##_STACK(r13);
 #endif
 
+/* Store something to exception thread info */
+#define	BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(type)					\
+	ld	r14,PACAKSAVE(r13);						\
+	CURRENT_THREAD_INFO(r14, r14);						\
+	CURRENT_THREAD_INFO(r15, r1);						\
+	ld	r10,TI_FLAGS(r14);		     				\
+	std	r10,TI_FLAGS(r15);			     			\
+	ld	r10,TI_PREEMPT(r14);		     				\
+	std	r10,TI_PREEMPT(r15);		     				\
+	ld	r10,TI_TASK(r14);			     			\
+	std	r10,TI_TASK(r15);
+
 /* Exception prolog code for all exceptions */
 #define EXCEPTION_PROLOG(n, intnum, type, addition)	    		    \
 	mtspr	SPRN_SPRG_##type##_SCRATCH,r13;	/* get spare registers */   \
@@ -104,6 +116,7 @@
 	BOOK3E_LOAD_EXC_LEVEL_STACK(CRIT);					\
 	ld	r1,PACA_CRIT_STACK(r13);				    \
 	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;					\
+	BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(CRIT);				\
 1:
 #define SPRN_CRIT_SRR0	SPRN_CSRR0
 #define SPRN_CRIT_SRR1	SPRN_CSRR1
@@ -114,6 +127,7 @@
 	BOOK3E_LOAD_EXC_LEVEL_STACK(DBG);					\
 	ld	r1,PACA_DBG_STACK(r13);					    \
 	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;					\
+	BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(DBG);					\
 1:
 #define SPRN_DBG_SRR0	SPRN_DSRR0
 #define SPRN_DBG_SRR1	SPRN_DSRR1
@@ -124,6 +138,7 @@
 	BOOK3E_LOAD_EXC_LEVEL_STACK(MC);					\
 	ld	r1,PACA_MC_STACK(r13);					    \
 	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;					\
+	BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(MC);					\
 1:
 #define SPRN_MC_SRR0	SPRN_MCSRR0
 #define SPRN_MC_SRR1	SPRN_MCSRR1
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 1/7] powerpc/book3e: load critical/machine/debug exception stack
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1362999766-20897-1-git-send-email-tiejun.chen@windriver.com>

We always alloc critical/machine/debug check exceptions. This is
different from the normal exception. So we should load these exception
stack properly like we did for booke.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/exceptions-64e.S |   49 +++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 1e7782b..7fd6af0 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -36,6 +36,37 @@
  */
 #define	SPECIAL_EXC_FRAME_SIZE	INT_FRAME_SIZE
 
+/* only on book3e */
+#define DBG_STACK_BASE		dbgirq_ctx
+#define MC_STACK_BASE		mcheckirq_ctx
+#define CRIT_STACK_BASE		critirq_ctx
+
+#ifdef CONFIG_RELOCATABLE
+#define LOAD_STACK_BASE(reg, level)			\
+	tovirt(r2,r2);					\
+	LOAD_REG_ADDR(reg, level##_STACK_BASE);
+#else
+#define LOAD_STACK_BASE(reg, level)			\
+	LOAD_REG_IMMEDIATE(reg, level##_STACK_BASE);
+#endif
+
+#ifdef CONFIG_SMP
+#define BOOK3E_LOAD_EXC_LEVEL_STACK(level)		\
+	mfspr	r14,SPRN_PIR;				\
+	slwi	r14,r14,3;				\
+	LOAD_STACK_BASE(r10, level);			\
+	add	r10,r10,r14;				\
+	ld	r10,0(r10);				\
+	addi	r10,r10,THREAD_SIZE;			\
+	std	r10,PACA_##level##_STACK(r13);
+#else
+#define BOOK3E_LOAD_EXC_LEVEL_STACK(level)		\
+	LOAD_STACK_BASE(r10, level);			\
+	ld	r10,0(r10);				\
+	addi	r10,r10,THREAD_SIZE;			\
+	std	r10,PACA_##level##_STACK(r13);
+#endif
+
 /* Exception prolog code for all exceptions */
 #define EXCEPTION_PROLOG(n, intnum, type, addition)	    		    \
 	mtspr	SPRN_SPRG_##type##_SCRATCH,r13;	/* get spare registers */   \
@@ -68,20 +99,32 @@
 #define SPRN_GDBELL_SRR1	SPRN_GSRR1
 
 #define CRIT_SET_KSTACK						            \
+	andi.	r10,r11,MSR_PR;							\
+	bne	1f;								\
+	BOOK3E_LOAD_EXC_LEVEL_STACK(CRIT);					\
 	ld	r1,PACA_CRIT_STACK(r13);				    \
-	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;
+	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;					\
+1:
 #define SPRN_CRIT_SRR0	SPRN_CSRR0
 #define SPRN_CRIT_SRR1	SPRN_CSRR1
 
 #define DBG_SET_KSTACK						            \
+	andi.	r10,r11,MSR_PR;							\
+	bne	1f;								\
+	BOOK3E_LOAD_EXC_LEVEL_STACK(DBG);					\
 	ld	r1,PACA_DBG_STACK(r13);					    \
-	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;
+	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;					\
+1:
 #define SPRN_DBG_SRR0	SPRN_DSRR0
 #define SPRN_DBG_SRR1	SPRN_DSRR1
 
 #define MC_SET_KSTACK						            \
+	andi.	r10,r11,MSR_PR;							\
+	bne	1f;								\
+	BOOK3E_LOAD_EXC_LEVEL_STACK(MC);					\
 	ld	r1,PACA_MC_STACK(r13);					    \
-	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;
+	subi	r1,r1,SPECIAL_EXC_FRAME_SIZE;					\
+1:
 #define SPRN_MC_SRR0	SPRN_MCSRR0
 #define SPRN_MC_SRR1	SPRN_MCSRR1
 
-- 
1.7.9.5

^ permalink raw reply related

* [v4][PATCH 0/7] powerpc/book3e: powerpc/book3e: make kgdb to work well
From: Tiejun Chen @ 2013-03-11 11:02 UTC (permalink / raw)
  To: benh, galak; +Cc: linuxppc-dev, linux-kernel, jason.wessel

This patchset is used to support kgdb/gdb on book3e.

Validated on p4080ds and p5040ds with test single step and breakpoint

v4:

* use DEFINE_PER_CPU to allocate kgdb's thread_info
* add patch 7 to make usre copy thread_info only !__check_irq_replay
* leave "andi.   r14,r11,MSR_PR" out of "#ifndef CONFIG_KGDB"
  since cr0 is still used lately.
* retest

v3:

* make work when enable CONFIG_RELOCATABLE
* fix one typo in patch,
  "powerpc/book3e: store critical/machine/debug exception thread info": 
	ld	r1,PACAKSAVE(r13);
    ->  ld	r14,PACAKSAVE(r13);
* remove copying the thread_info since booke and book3e always copy
  the thead_info now when we enter the debug exception, and so drop
  the v2 patch, "book3e/kgdb: Fix a single stgep case of lazy IRQ"

v2:

* Make sure we cover CONFIG_PPC_BOOK3E_64 safely
* Use LOAD_REG_IMMEDIATE() to load properly
	the value of the constant expression in load debug exception stack 
* Copy thread infor form the kernel stack coming from usr
* Rebase latest powerpc git tree

v1:
* Copy thread info only when we are from !user mode since we'll get kernel stack
  coming from usr directly.
* remove save/restore EX_R14/EX_R15 since DBG_EXCEPTION_PROLOG already covered
  this.
* use CURRENT_THREAD_INFO() conveniently to get thread.
* fix some typos
* add a patch to make sure gdb can generate a single step properly to invoke a
  kgdb state.
* add a patch to if we need to replay an interrupt, we shouldn't restore that
  previous backup thread info to make sure we can replay an interrupt lately
  with a proper thread info.
* rebase latest powerpc git tree

v0:
This patchset is used to support kgdb for book3e.

------
Tiejun Chen (7):
      powerpc/book3e: load critical/machine/debug exception stack
      powerpc/book3e: store critical/machine/debug exception thread info
      book3e/kgdb: update thread's dbcr0
      powerpc/book3e: support kgdb for kernel space
      kgdb/kgdbts: support ppc64
      powerpc/kgdb: use DEFINE_PER_CPU to allocate kgdb's thread_info
      book3e/kgdb: Fix a single stgep case of lazy IRQ

 arch/powerpc/kernel/exceptions-64e.S |   68 ++++++++++++++++++++++++++++++++--
 arch/powerpc/kernel/irq.c            |   10 +++++
 arch/powerpc/kernel/kgdb.c           |   21 +++++++----
 drivers/misc/kgdbts.c                |    2 +
 4 files changed, 90 insertions(+), 11 deletions(-)

Tiejun

^ permalink raw reply

* Re: [PATCH]->[PATCH v2] kgdb: Removed kmalloc returned value cast
From: tiejun.chen @ 2013-03-11 10:14 UTC (permalink / raw)
  To: Alex Grad, Benjamin Herrenschmidt, Jason Wessel
  Cc: sfr, mikey, daniel.baluta, linux-kernel, penberg, paulus,
	linuxppc-dev
In-Reply-To: <513D346E.20009@windriver.com>

On 03/11/2013 09:33 AM, tiejun.chen wrote:
> On 03/11/2013 06:39 AM, Alex Grad wrote:
>> While at it, check kmalloc return value.
>>
>> Signed-off-by: Alex Grad <alex.grad@gmail.com>
>> ---
>>   arch/powerpc/kernel/kgdb.c |    5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
>> index 5ca82cd..9e81dd8 100644
>> --- a/arch/powerpc/kernel/kgdb.c
>> +++ b/arch/powerpc/kernel/kgdb.c
>> @@ -159,7 +159,10 @@ static int kgdb_singlestep(struct pt_regs *regs)
>>       if (user_mode(regs))
>>           return 0;
>>
>> -    backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct
>> thread_info), GFP_KERNEL);
>> +    backup_current_thread_info = kmalloc(sizeof(struct thread_info),
>> GFP_KERNEL);
>> +    if (!backup_current_thread_info)
>> +        return -ENOMEM;
>
> I already send a kgdb patchset in "[v3][PATCH 6/6] powerpc/kgdb: remove copying
> the thread_info" to remove these stuff since its unnecessary to copy current
> thread_info now.

I guess that patchset needs to be reviewed with more time and I also think I can 
leave this copying to be compatible for other platforms in the future, but we 
really should fix this problem I introduced right now. So I'd like to fix this 
with DEFINE_PER_CPU.

I send a patch, "powerpc/kgdb: use DEFINE_PER_CPU to allocate kgdb's 
thread_info", so please take a look at if that version is fine to every one.

Any comments are appreciated.

BTW, I will update that kgdb patchset with this change to resend.

Tiejun

^ permalink raw reply

* [PATCH 1/1] powerpc/kgdb: use DEFINE_PER_CPU to allocate kgdb's thread_info
From: Tiejun Chen @ 2013-03-11 10:08 UTC (permalink / raw)
  To: alex.grad, penberg, jason.wessel, benh
  Cc: sfr, daniel.baluta, mikey, linux-kernel, paulus, linuxppc-dev

Use DEFINE_PER_CPU to allocate thread_info statically instead of kmalloc().
This can avoid introducing more memory check codes.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/kgdb.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 1a57307..cde7818 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -151,15 +151,15 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
 	return 1;
 }
 
+static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info);
 static int kgdb_singlestep(struct pt_regs *regs)
 {
 	struct thread_info *thread_info, *exception_thread_info;
-	struct thread_info *backup_current_thread_info;
+	struct thread_info *backup_current_thread_info = &__get_cpu_var(kgdb_thread_info);
 
 	if (user_mode(regs))
 		return 0;
 
-	backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
 	/*
 	 * On Book E and perhaps other processors, singlestep is handled on
 	 * the critical exception stack.  This causes current_thread_info()
@@ -185,7 +185,6 @@ static int kgdb_singlestep(struct pt_regs *regs)
 		/* Restore current_thread_info lastly. */
 		memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
 
-	kfree(backup_current_thread_info);
 	return 1;
 }
 
-- 
1.7.9.5

^ permalink raw reply related

* RE: [PATCH 3/4] TDM Device Tree entries for various Freescale Platforms
From: Singh Sandeep-B37400 @ 2013-03-11  9:27 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Aggrwal Poonam-B10812, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <CAOZdJXW7=3G8STRzaF04dmFZKFjp3=_2uy9F2pTZ-pe7L8nd7A@mail.gmail.com>


> -----Original Message-----
> From: Timur Tabi [mailto:timur@tabi.org]
> Sent: Friday, March 08, 2013 10:17 PM
> To: Singh Sandeep-B37400
> Cc: linuxppc-dev@lists.ozlabs.org; Aggrwal Poonam-B10812
> Subject: Re: [PATCH 3/4] TDM Device Tree entries for various Freescale
> Platforms
>=20
> On Thu, Mar 7, 2013 at 5:27 AM, Sandeep Singh <Sandeep@freescale.com>
> wrote:
> > arch/powerpc/boot/dts/p1022ds_36b.dts       |    3 +++
>=20
> You forgot to update p1022ds_3b.dts.
p1022ds_32b.dts includes "fsl/p1022si-post.dtsi" which is getting updated.
>=20
> > - * Copyright 2011 Freescale Semiconductor Inc.
> > + * Copyright 2011-2012 Freescale Semiconductor Inc.
>=20
> Do not update the copyright year in patches.
Ok, will correct this.
>=20
> --
> Timur Tabi
> Linux kernel developer at Freescale

^ permalink raw reply

* RE: [PATCH] powerpc/85xx: Add platform_device declaration to fsl_pci.h
From: Jia Hongtao-B38951 @ 2013-03-11  2:36 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472
In-Reply-To: <CC45B9DD-7BB6-4E88-B5A0-F3E7A30608A7@kernel.crashing.org>



> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> Sent: Saturday, March 09, 2013 4:38 AM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
> Subject: Re: [PATCH] powerpc/85xx: Add platform_device declaration to
> fsl_pci.h
>=20
>=20
> On Mar 4, 2013, at 2:40 AM, Jia Hongtao wrote:
>=20
> > mpc85xx_pci_err_probe(struct platform_device *op) need platform_device
> > declaration for definition. Otherwise, it will cause compile error if
> > any files including fsl_pci.h without declaration of platform_device.
> >
> > Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > ---
> > arch/powerpc/sysdev/fsl_pci.h |    2 ++
> > 1 files changed, 2 insertions(+), 0 deletions(-)
> >
>=20
> Where does the compile error show up?
>=20
> - k

The function mpc85xx_pci_err_probe(struct platform_device *op) need
*platform_device* declaration so <linux/platform_device.h> must be
included.=20

For now there is no compile error occurred just because the file that
need fsl_pci.h happened to include <linux/platform_device.h> already.

If not the compile error log will be like this:
"
In file included from arch/powerpc/kernel/traps.c:62:0:
arch/powerpc/sysdev/fsl_pci.h:108:34: error: 'struct platform_device' decla=
red inside parameter list
arch/powerpc/sysdev/fsl_pci.h:108:34: error: its scope is only this definit=
ion or declaration, which is probably not what you want
"

You mean I have to show the compile error log in patch description?

Thanks.
-Hongtao.

>=20
> > diff --git a/arch/powerpc/sysdev/fsl_pci.h
> > b/arch/powerpc/sysdev/fsl_pci.h index c495c00..df66721 100644
> > --- a/arch/powerpc/sysdev/fsl_pci.h
> > +++ b/arch/powerpc/sysdev/fsl_pci.h
> > @@ -14,6 +14,8 @@
> > #ifndef __POWERPC_FSL_PCI_H
> > #define __POWERPC_FSL_PCI_H
> >
> > +#include <linux/platform_device.h>
> > +
> > #define PCIE_LTSSM	0x0404		/* PCIE Link Training and
> Status */
> > #define PCIE_LTSSM_L0	0x16		/* L0 state */
> > #define PCIE_IP_REV_2_2		0x02080202 /* PCIE IP block version
> Rev2.2 */
> > --
> > 1.7.5.1
> >
>=20

^ permalink raw reply

* Re: [PATCH]->[PATCH v2] kgdb: Removed kmalloc returned value cast
From: tiejun.chen @ 2013-03-11  1:33 UTC (permalink / raw)
  To: Alex Grad, Benjamin Herrenschmidt, Jason Wessel
  Cc: sfr, mikey, daniel.baluta, linux-kernel, penberg, paulus,
	jason.wessel, linuxppc-dev
In-Reply-To: <1362955188-3023-1-git-send-email-alex.grad@gmail.com>

On 03/11/2013 06:39 AM, Alex Grad wrote:
> While at it, check kmalloc return value.
>
> Signed-off-by: Alex Grad <alex.grad@gmail.com>
> ---
>   arch/powerpc/kernel/kgdb.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index 5ca82cd..9e81dd8 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -159,7 +159,10 @@ static int kgdb_singlestep(struct pt_regs *regs)
>   	if (user_mode(regs))
>   		return 0;
>
> -	backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
> +	backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);
> +	if (!backup_current_thread_info)
> +		return -ENOMEM;

I already send a kgdb patchset in "[v3][PATCH 6/6] powerpc/kgdb: remove copying 
the thread_info" to remove these stuff since its unnecessary to copy current 
thread_info now.

Tiejun

^ permalink raw reply

* [PATCH]->[PATCH v2] kgdb: Removed kmalloc returned value cast
From: Alex Grad @ 2013-03-10 22:39 UTC (permalink / raw)
  To: penberg
  Cc: sfr, mikey, daniel.baluta, linux-kernel, tiejun.chen, paulus,
	Alex Grad, jason.wessel, linuxppc-dev

While at it, check kmalloc return value.

Signed-off-by: Alex Grad <alex.grad@gmail.com>
---
 arch/powerpc/kernel/kgdb.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 5ca82cd..9e81dd8 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -159,7 +159,10 @@ static int kgdb_singlestep(struct pt_regs *regs)
 	if (user_mode(regs))
 		return 0;
 
-	backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
+	backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);
+	if (!backup_current_thread_info)
+		return -ENOMEM;
+
 	/*
 	 * On Book E and perhaps other processors, singlestep is handled on
 	 * the critical exception stack.  This causes current_thread_info()
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH] kgdb: Removed kmalloc returned value cast
From: Daniel Baluta @ 2013-03-10 19:05 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: mikey, fr, linux-kernel, tiejun.chen, paulus, Alex Grad,
	jason.wessel, linuxppc-dev
In-Reply-To: <CAOJsxLGD1fXsGMCQbP8aAMDsRiwPD2hHcfWfupO4jy5=JCM=NA@mail.gmail.com>

On Sun, Mar 10, 2013 at 4:10 PM, Pekka Enberg <penberg@kernel.org> wrote:
> On Sun, Mar 10, 2013 at 3:06 PM, Alex Grad <alex.grad@gmail.com> wrote:
>> Signed-off-by: Alex Grad <alex.grad@gmail.com>
>> ---
>>  arch/powerpc/kernel/kgdb.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
>> index 5ca82cd..c1eef24 100644
>> --- a/arch/powerpc/kernel/kgdb.c
>> +++ b/arch/powerpc/kernel/kgdb.c
>> @@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
>>         if (user_mode(regs))
>>                 return 0;
>>
>> -       backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
>> +       backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);
>
> Looks good to me.
>
> There's two additional problems in the kgdb_singlestep() function: it
> doesn't check if the kmalloc() call fails nor does it kfree() the
> allocated memory.

Hi Pekka,

Indeed there is no check if kmalloc() fails. This should be fixed.

Anyhow, commit fefd9e6f powerpc: kernel/kgdb.c: Fix memory leakage
fixed the problem with kfree.

thanks,
Daniel.

^ permalink raw reply

* Re: [PATCH] kgdb: Removed kmalloc returned value cast
From: Pekka Enberg @ 2013-03-10 14:10 UTC (permalink / raw)
  To: Alex Grad
  Cc: mikey, fr, linux-kernel, tiejun.chen, paulus, jason.wessel,
	linuxppc-dev
In-Reply-To: <1362920779-25925-1-git-send-email-alex.grad@gmail.com>

On Sun, Mar 10, 2013 at 3:06 PM, Alex Grad <alex.grad@gmail.com> wrote:
> Signed-off-by: Alex Grad <alex.grad@gmail.com>
> ---
>  arch/powerpc/kernel/kgdb.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index 5ca82cd..c1eef24 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
>         if (user_mode(regs))
>                 return 0;
>
> -       backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
> +       backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);

Looks good to me.

There's two additional problems in the kgdb_singlestep() function: it
doesn't check if the kmalloc() call fails nor does it kfree() the
allocated memory.

                        Pekka

^ permalink raw reply

* [PATCH] powerpc: place EXPORT_SYMBOL macro right after declaration
From: Valentina Manea @ 2013-03-10 13:22 UTC (permalink / raw)
  To: benh
  Cc: Valentina Manea, agraf, linux-kernel, suzuki, paulus, akpm,
	linuxppc-dev

This fixes the following checkpatch.pl warnings:

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
+EXPORT_SYMBOL(kmap_prot);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
+EXPORT_SYMBOL(kmap_pte);

Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com>
---
 arch/powerpc/mm/mem.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index f1f7409..056732e 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -66,10 +66,9 @@ unsigned long long memory_limit;
 
 #ifdef CONFIG_HIGHMEM
 pte_t *kmap_pte;
+EXPORT_SYMBOL(kmap_pte);
 pgprot_t kmap_prot;
-
 EXPORT_SYMBOL(kmap_prot);
-EXPORT_SYMBOL(kmap_pte);
 
 static inline pte_t *virt_to_kpte(unsigned long vaddr)
 {
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH] powerpc: Use PTR_RET instead of IS_ERR/PTR_ERR
From: Adrian-Leonard Radu @ 2013-03-10 13:07 UTC (permalink / raw)
  To: benh
  Cc: cbe-oss-dev, geoff, fweisbec, akinobu.mita, rostedt, linux-kernel,
	paulus, anton, john.stultz, ady8radu, linuxppc-dev, cascardo

Signed-off-by: Adrian-Leonard Radu <ady8radu@gmail.com>
---
 arch/powerpc/kernel/iommu.c          |    2 +-
 arch/powerpc/kernel/time.c           |    4 +---
 arch/powerpc/platforms/ps3/time.c    |    4 +---
 arch/powerpc/sysdev/rtc_cmos_setup.c |    5 +----
 4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 31c4fdc..c0d0dbd 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -102,7 +102,7 @@ static int __init fail_iommu_debugfs(void)
 	struct dentry *dir = fault_create_debugfs_attr("fail_iommu",
 						       NULL, &fail_iommu);
 
-	return IS_ERR(dir) ? PTR_ERR(dir) : 0;
+	return PTR_RET(dir);
 }
 late_initcall(fail_iommu_debugfs);
 
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index f77fa22..5fc29ad 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1049,10 +1049,8 @@ static int __init rtc_init(void)
 		return -ENODEV;
 
 	pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_RET(pdev);
 }
 
 module_init(rtc_init);
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index 40b5cb4..cba1e6b 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -89,10 +89,8 @@ static int __init ps3_rtc_init(void)
 		return -ENODEV;
 
 	pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_RET(pdev);
 }
 
 module_init(ps3_rtc_init);
diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
index 9afba92..af79e1e 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -62,10 +62,7 @@ static int  __init add_rtc(void)
 	pd = platform_device_register_simple("rtc_cmos", -1,
 					     &res[0], num_res);
 
-	if (IS_ERR(pd))
-		return PTR_ERR(pd);
-
-	return 0;
+	return PTR_RET(pd);
 }
 fs_initcall(add_rtc);
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH] kgdb: Removed kmalloc returned value cast
From: Alex Grad @ 2013-03-10 13:06 UTC (permalink / raw)
  To: benh
  Cc: mikey, fr, linux-kernel, tiejun.chen, paulus, Alex Grad,
	jason.wessel, linuxppc-dev

Signed-off-by: Alex Grad <alex.grad@gmail.com>
---
 arch/powerpc/kernel/kgdb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 5ca82cd..c1eef24 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
 	if (user_mode(regs))
 		return 0;
 
-	backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
+	backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);
 	/*
 	 * On Book E and perhaps other processors, singlestep is handled on
 	 * the critical exception stack.  This causes current_thread_info()
-- 
1.7.10.4

^ permalink raw reply related

* Re: Linux kernel 3.x problems on PowerMac G5
From: Benjamin Herrenschmidt @ 2013-03-10 12:52 UTC (permalink / raw)
  To: Phileas Fogg; +Cc: Andreas Schwab, Denis Kirjanov, linuxppc-dev, Aaro Koskinen
In-Reply-To: <513C6641.2010308@mail.ru>

On Sun, 2013-03-10 at 11:53 +0100, Phileas Fogg wrote:
> Good news :) I found the bug.
> MMU features were not set properly for PPC970MP DD1.0 which,
> unfortunately, my machine has.
> Damn, one line fix but one week searching.
> Linux 3.8.2 boots without problems now :)

Nice one ! I didn't think anybody shipped a DD1.0 chip ! :-)

Looks like some typo/thinko in the cputable and you are one of the very
rare victims of it. I'll fix that up. Regarding the IDE problem, can you
shoot a note to Tejun who wrote that patch (and CC me) ? I do recommend
switching to libata but we should still fix the problem with legacy IDE.

Cheers,
Ben.

^ permalink raw reply

* Re: Linux kernel 3.x problems on PowerMac G5
From: Phileas Fogg @ 2013-03-10 10:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Andreas Schwab, Denis Kirjanov, linuxppc-dev, Aaro Koskinen
In-Reply-To: <1362876308.6977.42.camel@pasglop>

Good news :) I found the bug.
MMU features were not set properly for PPC970MP DD1.0 which,
unfortunately, my machine has.
Damn, one line fix but one week searching.
Linux 3.8.2 boots without problems now :)


Here is my patch:

--- arch/powerpc/kernel/cputable.c.old	2013-03-10 11:48:56.559480758 +0100
+++ arch/powerpc/kernel/cputable.c	2013-03-10 11:41:07.522786804 +0100
@@ -275,7 +275,7 @@
  		.cpu_features		= CPU_FTRS_PPC970,
  		.cpu_user_features	= COMMON_USER_POWER4 |
  			PPC_FEATURE_HAS_ALTIVEC_COMP,
-		.mmu_features		= MMU_FTR_HPTE_TABLE,
+		.mmu_features		= MMU_FTRS_PPC970,
  		.icache_bsize		= 128,
  		.dcache_bsize		= 128,
  		.num_pmcs		= 8,



Regards

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox