LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] powerpc: add POWER8 DAWR support
From: Michael Neuling @ 2012-12-21  0:06 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie

Add support for the Data Address Watchpoint Register (DAWR) as found in POWER8.
This replaces the DABR found in POWER7 and earlier and allows for wider
watchpoint areas.

-- 
1.7.10.4

^ permalink raw reply

* Re: [v1][PATCH 3/6] book3e/kgdb: update thread's dbcr0
From: Kumar Gala @ 2012-12-20 18:41 UTC (permalink / raw)
  To: Tiejun Chen; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-4-git-send-email-tiejun.chen@windriver.com>


On Dec 20, 2012, at 3:08 AM, Tiejun Chen wrote:

> 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.
>=20
> So here we also update thread's dbcr0 to make sure the current
> can go back with that missed dbcr0 configuration.
>=20
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
> arch/powerpc/kernel/kgdb.c |   10 ++++++++++
> 1 file changed, 10 insertions(+)
>=20
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index c470a40..516b44b 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -426,8 +426,18 @@ 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] =3D=3D 's') {
> #ifdef CONFIG_PPC_ADV_DEBUG_REGS
> +#ifdef CONFIG_PPC_BOOK3E

Should this really be CONFIG_PPC64 or 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 =3D
> +				mfspr(SPRN_DBCR0) | DBCR0_IC | =
DBCR0_IDM;
> +			mtspr(SPRN_DBCR0, current->thread.dbcr0);
> +#else
> 			mtspr(SPRN_DBCR0,
> 			      mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
> +#endif

Can we code this so we don't need the #else?

> 			linux_regs->msr |=3D MSR_DE;
> #else
> 			linux_regs->msr |=3D MSR_SE;
> --=20
> 1.7.9.5
>=20
> --
> To unsubscribe from this list: send the line "unsubscribe =
linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: Adding 'of_platform' bus support to the platform driver
From: Scott Wood @ 2012-12-20 17:53 UTC (permalink / raw)
  To: R.Patil; +Cc: linuxppc-dev
In-Reply-To: <OFC91E62B9.4D486BD1-ON65257ADA.002E22B1-65257ADA.002E22B7@LocalDomain>

On 12/20/2012 02:23:55 AM, R.Patil@mei-india.com wrote:
> Hello,
>=20
> We are working on one of the platform drivers for our board (based on =20
> MPC8313ERDB). Previously, this driver was supporting platform bus but =20
> now we want to change it to support 'of_platform' bus. While =20
> supporting platform bus, the platform device structure is initialised =20
> in board setup file, and platform device is registered using =20
> 'platform_device_register_simple' call.
>=20
> Now if we want to support 'of_platform' bus, the information related =20
> to the the device will be extracted from device tree in the platform =20
> driver itself and we would not be required to call =20
> 'platform_device_register_simple' to register the platform device. Is =20
> this understanding correct?

What kernel version are you using?  The of_platform bus doesn't exist =20
anymore.  The current way is to use a normal platform driver, and =20
supply an "of_match_table" in the driver struct.

-Scott=

^ permalink raw reply

* Re: [PATCH] KVM: PPC: Fix mfspr/mtspr MMUCFG emulation
From: Alexander Graf @ 2012-12-20 15:08 UTC (permalink / raw)
  To: Mihai Caraman; +Cc: linuxppc-dev, kvm, kvm-ppc
In-Reply-To: <1356015159-7777-1-git-send-email-mihai.caraman@freescale.com>


On 20.12.2012, at 15:52, Mihai Caraman wrote:

> On mfspr/mtspr emulation path Book3E's MMUCFG SPR with value 1015 clashes
> with G4's MSSSR0 SPR. Move MSSSR0 emulation from generic part to Books3S.
> MSSSR0 also clashes with Book3S's DABRX SPR. DABRX was not explicitly
> handled so Book3S execution flow will behave as before.
> 
> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>

Thanks, applied to ppc-queue.


Alex

^ permalink raw reply

* [PATCH] KVM: PPC: Fix mfspr/mtspr MMUCFG emulation
From: Mihai Caraman @ 2012-12-20 14:52 UTC (permalink / raw)
  To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm

On mfspr/mtspr emulation path Book3E's MMUCFG SPR with value 1015 clashes
with G4's MSSSR0 SPR. Move MSSSR0 emulation from generic part to Books3S.
MSSSR0 also clashes with Book3S's DABRX SPR. DABRX was not explicitly
handled so Book3S execution flow will behave as before.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/kvm/book3s_emulate.c |    2 ++
 arch/powerpc/kvm/emulate.c        |    5 -----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index d31a716..4800a7b 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -427,6 +427,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
 	case SPRN_PMC3_GEKKO:
 	case SPRN_PMC4_GEKKO:
 	case SPRN_WPAR_GEKKO:
+	case SPRN_MSSSR0:
 		break;
 unprivileged:
 	default:
@@ -523,6 +524,7 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
 	case SPRN_PMC3_GEKKO:
 	case SPRN_PMC4_GEKKO:
 	case SPRN_WPAR_GEKKO:
+	case SPRN_MSSSR0:
 		*spr_val = 0;
 		break;
 	default:
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index b0855e5..71abcf4 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -149,8 +149,6 @@ static int kvmppc_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
 	case SPRN_TBWL: break;
 	case SPRN_TBWU: break;
 
-	case SPRN_MSSSR0: break;
-
 	case SPRN_DEC:
 		vcpu->arch.dec = spr_val;
 		kvmppc_emulate_dec(vcpu);
@@ -201,9 +199,6 @@ static int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
 	case SPRN_PIR:
 		spr_val = vcpu->vcpu_id;
 		break;
-	case SPRN_MSSSR0:
-		spr_val = 0;
-		break;
 
 	/* Note: mftb and TBRL/TBWL are user-accessible, so
 	 * the guest can always access the real TB anyways.
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] powerpc: add missing NULL terminator to avoid boot panic on PPC40x
From: Grant Likely @ 2012-12-20 13:56 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: linuxppc-dev@lists.ozlabs.org, stable
In-Reply-To: <1356011068-26349-1-git-send-email-juhosg@openwrt.org>

On Thu, Dec 20, 2012 at 1:44 PM, Gabor Juhos <juhosg@openwrt.org> wrote:
> The missing NULL terminator can cause a panic on
> PPC405 boards during boot:
>
>   Linux/PowerPC load: console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd init=/etc/preinit
>   Finalizing device tree... flat tree at 0x6a5160
>   bootconsole [udbg0] enabled
>   Page fault in user mode with in_atomic() = 1 mm = (null)
>   NIP = c0275f50  MSR = fffffffe
>   Oops: Weird page fault, sig: 11 [#1]
>   PowerPC 40x Platform
>   Modules linked in:
>   NIP: c0275f50 LR: c0275f60 CTR: c0280000
>   REGS: c0275eb0 TRAP: 636f7265   Not tainted  (3.7.1)
>   MSR: fffffffe <VEC,VSX,EE,PR,FP,ME,SE,BE,IR,DR,PMM,RI> CR: c06a6190  XER: 00000001
>   TASK = c02662a8[0] 'swapper' THREAD: c0274000
>   GPR00: c0275ec0 c000c658 c027c4bf 00000000 c0275ee0 c000a0ec c020a1a8 c020a1f0
>   GPR08: c020f631 c020f404 c025f078 c025f080 c0275f10
>    Call Trace:
>    ---[ end trace 31fd0ba7d8756001 ]---
>
>   Kernel panic - not syncing: Attempted to kill the idle task!
>
> The panic happens since commit 9597abe00c1bab2aedce6b49866bf6d1e81c9eed
> (sections: fix section conflicts in arch/powerpc), however the root
> cause of this is that the NULL terminator were not added in commit
> a4f740cf33f7f6c164bbde3c0cdbcc77b0c4997c (of/flattree: Add of_flat_dt_match()
> helper function).
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> ---
>  arch/powerpc/platforms/40x/ppc40x_simple.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
> index 969dddc..8f3920e 100644
> --- a/arch/powerpc/platforms/40x/ppc40x_simple.c
> +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
> @@ -57,7 +57,8 @@ static const char * const board[] __initconst = {
>         "amcc,makalu",
>         "apm,klondike",
>         "est,hotfoot",
> -       "plathome,obs600"
> +       "plathome,obs600",
> +       NULL
>  };

Obviously correct. Acked-by: Grant Likely <grant.likely@secretlab.ca>

>
>  static int __init ppc40x_probe(void)
> --
> 1.7.10
>



--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH] powerpc: add missing NULL terminator to avoid boot panic on PPC40x
From: Gabor Juhos @ 2012-12-20 13:44 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Gabor Juhos, linuxppc-dev, stable

The missing NULL terminator can cause a panic on
PPC405 boards during boot:

  Linux/PowerPC load: console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd init=/etc/preinit
  Finalizing device tree... flat tree at 0x6a5160
  bootconsole [udbg0] enabled
  Page fault in user mode with in_atomic() = 1 mm = (null)
  NIP = c0275f50  MSR = fffffffe
  Oops: Weird page fault, sig: 11 [#1]
  PowerPC 40x Platform
  Modules linked in:
  NIP: c0275f50 LR: c0275f60 CTR: c0280000
  REGS: c0275eb0 TRAP: 636f7265   Not tainted  (3.7.1)
  MSR: fffffffe <VEC,VSX,EE,PR,FP,ME,SE,BE,IR,DR,PMM,RI> CR: c06a6190  XER: 00000001
  TASK = c02662a8[0] 'swapper' THREAD: c0274000
  GPR00: c0275ec0 c000c658 c027c4bf 00000000 c0275ee0 c000a0ec c020a1a8 c020a1f0
  GPR08: c020f631 c020f404 c025f078 c025f080 c0275f10
   Call Trace:
   ---[ end trace 31fd0ba7d8756001 ]---

  Kernel panic - not syncing: Attempted to kill the idle task!

The panic happens since commit 9597abe00c1bab2aedce6b49866bf6d1e81c9eed
(sections: fix section conflicts in arch/powerpc), however the root
cause of this is that the NULL terminator were not added in commit
a4f740cf33f7f6c164bbde3c0cdbcc77b0c4997c (of/flattree: Add of_flat_dt_match()
helper function).

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: <stable@vger.kernel.org>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 arch/powerpc/platforms/40x/ppc40x_simple.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 969dddc..8f3920e 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -57,7 +57,8 @@ static const char * const board[] __initconst = {
 	"amcc,makalu",
 	"apm,klondike",
 	"est,hotfoot",
-	"plathome,obs600"
+	"plathome,obs600",
+	NULL
 };
 
 static int __init ppc40x_probe(void)
-- 
1.7.10

^ permalink raw reply related

* Re: [PATCH 1/3] powerpc/book3e: load critical/machine/debug exception stack
From: tiejun.chen @ 2012-12-20  9:14 UTC (permalink / raw)
  To: Tabi Timur-B04825
  Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	jason.wessel@windriver.com
In-Reply-To: <6AE080B68D46FC4BA2D2769E68D765B7081D305D@039-SN2MPN1-023.039d.mgd.msft.net>

On 12/19/2012 06:10 AM, Tabi Timur-B04825 wrote:
> On Thu, Oct 25, 2012 at 1:43 AM, Tiejun Chen <tiejun.chen@windriver.com> wrote:
>> 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.
>
> Tiejun,
>
> I'm a little confused by these patches, because the actual critical
> exception handlers are still commented out:
>
> /* Critical Input Interrupt */
> 	START_EXCEPTION(critical_input);
> 	CRIT_EXCEPTION_PROLOG(0x100, BOOKE_INTERRUPT_CRITICAL,
> 			      PROLOG_ADDITION_NONE)
> //	EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE)
> //	bl	special_reg_save_crit
> //	CHECK_NAPPING();
> //	addi	r3,r1,STACK_FRAME_OVERHEAD
> //	bl	.critical_exception
> //	b	ret_from_crit_except
> 	b	.
>
> Are you working on fixing this?  I'm trying to fix it, too, but I

No, I have no approach to Crit/MC and currently I'm focus only on Debug so 
please do this as you expect :)

BTW, I send next version just now since there are something needed to 
correct/improve.

Tiejun

^ permalink raw reply

* [v1][PATCH 6/6] kgdb/kgdbts: support ppc64
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-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

* [v1][PATCH 5/6] powerpc/book3e: support kgdb for kernel space
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-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 |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 9a99cba..a24baef 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -588,11 +588,14 @@ kernel_dbg_exc:
 	rfdi
 
 	/* Normal debug exception */
+1:
+#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 */
+	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

* [v1][PATCH 4/6] book3e/kgdb: Fix a single stgep case of lazy IRQ
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-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 71413f4..30a9cb0 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -332,7 +332,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 516b44b..6a48db9 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -151,6 +151,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
 	return 1;
 }
 
+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

* [v1][PATCH 3/6] book3e/kgdb: update thread's dbcr0
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-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 |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index c470a40..516b44b 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -426,8 +426,18 @@ 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
+#ifdef CONFIG_PPC_BOOK3E
+			/* 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 =
+				mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM;
+			mtspr(SPRN_DBCR0, current->thread.dbcr0);
+#else
 			mtspr(SPRN_DBCR0,
 			      mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
+#endif
 			linux_regs->msr |= MSR_DE;
 #else
 			linux_regs->msr |= MSR_SE;
-- 
1.7.9.5

^ permalink raw reply related

* [v1][PATCH 2/6] powerpc/book3e: store critical/machine/debug exception thread info
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-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 376e3d1..9a99cba 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -58,6 +58,18 @@
 	std	r10,PACA_##level##_STACK(r13);
 #endif
 
+/* Store something to exception thread info */
+#define	BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(type)					\
+	ld	r14,PACA_EX##type+EX_R1(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 */   \
@@ -95,6 +107,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
@@ -105,6 +118,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
@@ -115,6 +129,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

* [v1][PATCH 1/6] powerpc/book3e: load critical/machine/debug exception stack
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
In-Reply-To: <1355994510-11934-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 |   40 +++++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 4684e33..376e3d1 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -36,6 +36,28 @@
  */
 #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_SMP
+#define BOOK3E_LOAD_EXC_LEVEL_STACK(level)		\
+	mfspr	r14,SPRN_PIR;				\
+	slwi	r14,r14,3;				\
+	LOAD_REG_ADDR(r10, level##_STACK_BASE);		\
+	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_REG_ADDR(r10, level##_STACK_BASE);		\
+	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 +90,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

* [v1][PATCH 0/6] powerpc/book3e: make kgdb to work well
From: Tiejun Chen @ 2012-12-20  9:08 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel

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 (6):
      powerpc/book3e: load critical/machine/debug exception stack
      powerpc/book3e: store critical/machine/debug exception thread info
      book3e/kgdb: update thread's dbcr0
      book3e/kgdb: Fix a single stgep case of lazy IRQ
      powerpc/book3e: support kgdb for kernel space
      kgdb/kgdbts: support ppc64

 arch/powerpc/kernel/exceptions-64e.S |   60 +++++++++++++++++++++++++++++++---
 arch/powerpc/kernel/irq.c            |   10 ++++++
 arch/powerpc/kernel/kgdb.c           |   13 +++++++-
 drivers/misc/kgdbts.c                |    2 ++
 4 files changed, 80 insertions(+), 5 deletions(-)

Tiejun

^ permalink raw reply

* Adding 'of_platform' bus support to the platform driver
From: R.Patil @ 2012-12-20  8:23 UTC (permalink / raw)
  To: linuxppc-dev

Hello,

We are working on one of the platform drivers for our board (based on MPC83=
13ERDB). Previously, this driver was supporting platform bus but now we wan=
t to change it to support 'of=5Fplatform' bus. While supporting platform bu=
s, the platform device structure is initialised in board setup file, and pl=
atform device is registered using 'platform=5Fdevice=5Fregister=5Fsimple' c=
all.=20

Now if we want to support 'of=5Fplatform' bus, the information related to t=
he the device will be extracted from device tree in the platform driver its=
elf and we would not be required to call 'platform=5Fdevice=5Fregister=5Fsi=
mple' to register the platform device. Is this understanding correct?

Thanks and Regards,
RahulEmail Disclaimer:
  ---------------------------

This e-mail and any files transmitted with it are for the sole use of the i=
ntended recipient(s) and may contain confidential and  privileged informati=
on. Computer viruses can be transmitted via email.The recipient should chec=
k this email and any  attachments for the presence of viruses. The company =
accepts no liability for any damage caused by any virus transmitted by this=
 email.

^ permalink raw reply

* Re: [PATCH] pci: Provide support for parsing PCI DT ranges property
From: Thierry Reding @ 2012-12-20  8:25 UTC (permalink / raw)
  To: Andrew Murray
  Cc: Michal Simek, linux-pci, devicetree-discuss, Liviu Dudau,
	Rob Herring, Rob Herring, linuxppc-dev
In-Reply-To: <20121212163749.GA17371@arm.com>

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

On Wed, Dec 12, 2012 at 04:37:50PM +0000, Andrew Murray wrote:
[...]
> diff --git a/drivers/of/address.c b/drivers/of/address.c
[...]
> +	start = of_get_property(node, "ranges", &rlen);
> +	if (start == NULL)
> +		return NULL;
> +
> +	end = start + rlen;

I'm currently rewriting large parts of the Tegra PCIe controller driver
and I'm trying to use this new API. This seems to work fine, except that
I think this line needs to be:

	end = start + rlen / sizeof(__be32);

Otherwise we'll try to process 4 times as many ranges as there are.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 3/5] perf/POWER7: Make generic event translations available in sysfs
From: Sukadev Bhattiprolu @ 2012-12-20  7:03 UTC (permalink / raw)
  To: Greg KH
  Cc: Peter Zijlstra, robert.richter, Anton Blanchard, linux-kernel,
	linuxppc-dev, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo, Jiri Olsa
In-Reply-To: <20121220053600.GC28007@kroah.com>

Greg KH [greg@kroah.com] wrote:
| On Tue, Dec 18, 2012 at 11:28:49PM -0800, Sukadev Bhattiprolu wrote:
| > 
| > [PATCH 3/5] perf/POWER7: Make generic event translations available in sysfs
| 
| As you are adding new sysfs files, you must also add new
| Documentation/ABI entries at the same time.  Please also do this for the
| other patches in this series that add new sysfs files.

Ok. Will wait for any other review comments on this patchset and repost with
the ABI info.

Sukadev

^ permalink raw reply

* Re: [PATCH 3/5] perf/POWER7: Make generic event translations available in sysfs
From: Greg KH @ 2012-12-20  5:36 UTC (permalink / raw)
  To: Sukadev Bhattiprolu
  Cc: Peter Zijlstra, robert.richter, Anton Blanchard, linux-kernel,
	linuxppc-dev, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo, Jiri Olsa
In-Reply-To: <20121219072848.GB30790@us.ibm.com>

On Tue, Dec 18, 2012 at 11:28:49PM -0800, Sukadev Bhattiprolu wrote:
> 
> [PATCH 3/5] perf/POWER7: Make generic event translations available in sysfs
> 
> Make the generic perf events in POWER7 available via sysfs.
> 
> 	$ ls /sys/bus/event_source/devices/cpu/events
> 	branch-instructions
> 	branch-misses
> 	cache-misses
> 	cache-references
> 	cpu-cycles
> 	instructions
> 	stalled-cycles-backend
> 	stalled-cycles-frontend
> 
> 	$ cat /sys/bus/event_source/devices/cpu/events/cache-misses
> 	event=0x400f0
> 
> This patch is based on commits that implement this functionality on x86.
> Eg:
> 	commit a47473939db20e3961b200eb00acf5fcf084d755
> 	Author: Jiri Olsa <jolsa@redhat.com>
> 	Date:   Wed Oct 10 14:53:11 2012 +0200
> 
> 	    perf/x86: Make hardware event translations available in sysfs
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/perf_event_server.h |   25 +++++++++++++++++++
>  arch/powerpc/perf/core-book3s.c              |   12 +++++++++
>  arch/powerpc/perf/power7-pmu.c               |   34 ++++++++++++++++++++++++++
>  3 files changed, 71 insertions(+), 0 deletions(-)

As you are adding new sysfs files, you must also add new
Documentation/ABI entries at the same time.  Please also do this for the
other patches in this series that add new sysfs files.

thanks,

greg k-h

^ permalink raw reply

* [PATCH] powerpc: enable ARCH_USE_BUILTIN_BSWAP
From: David Woodhouse @ 2012-12-20  1:14 UTC (permalink / raw)
  To: benh; +Cc: linux-arch, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

By using the compiler intrinsics instead of hand-crafted opaque inline
assembler for byte-swapping, we let the compiler see what's actually
happening and it gets to use lwbrx/stwbrx instructions instead of a
normal load/store coupled with a sequence of rlwimi instructions to
move bits around.

Compiled-tested only. It gave a code size reduction of almost 4% for
ext2, and more like 2.5% for ext3/ext4.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 951a517..064e418 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -146,6 +146,7 @@ config PPC
 	select MODULES_USE_ELF_RELA
 	select GENERIC_KERNEL_EXECVE
 	select CLONE_BACKWARDS
+	select ARCH_USE_BUILTIN_BSWAP
 
 config EARLY_PRINTK
 	bool
-- 
1.8.0.1


-- 
dwmw2


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

^ permalink raw reply related

* Re: [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2012-12-19 23:10 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, Linux Kernel list
In-Reply-To: <CA+55aFw-cRskrvW07FVJd9HfrBhn41Ogi1Vv_v1U12zahzFu=A@mail.gmail.com>

On Tue, 2012-12-18 at 10:02 -0800, Linus Torvalds wrote:

> Anyway, I've pulled it in, but got a conflict on the kernel_thread
> cleanups from Al. And since the conflict was in the powerpc assembly
> code that I don't really know the details of, I did the
> straightforward resolve of it, but I'd like you to check it out.
> 
> (I haven't pushed it out yet, I'm waiting for the allmodconfig to
> finish compiling, so if you see this email quickly, but don't see the
> powerpc merge yet, just wait a few minutes)

Sorry for the delay, I verified that it looked right yesterday but
didn't manage to actually test it until today due to a problem with our
test farm. It's all good, thanks !

Cheers,
Ben.

^ permalink raw reply

* Re: PS3 platform is broken on Linux 3.7.0
From: Benjamin Herrenschmidt @ 2012-12-19 21:53 UTC (permalink / raw)
  To: Phileas Fogg; +Cc: linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <1355488506.55692113@f147.mail.ru>

On Fri, 2012-12-14 at 16:35 +0400, Phileas Fogg wrote:
> Hi,
> 
> I wanted to bring to your attention the fact that the PS3 platform is broken on Linux 3.7.0.
> 
> i'm not able to boot Linux 3.7.0 on my PS3 slim. Linux 3.6.10 boots just fine but not 3.7.0
> When i try to boot Linux 3.7.0 then my PS3  shuts down.
> 
> So i cloned the Linux powerpc GIT repository and tried to find out which commits broke the PS3 platform.
> After some time I tracked it down to 2 commits:

Aneesh, do you have any idea what might be going on there ? Can you look
at the PS3 hash code ? It's a bit different from the rest, you might
have missed an update or two...

Michael, same deal with PACA...

Cheers,
Ben.

> ---------------------------------------------------------------------------------------------
> 
> commit 407821a34fce89b4f0b031dbab5cec7d059f46bc
> Author: Michael Ellerman <michael@ellerman.id.au>
> Date:   Fri Sep 7 15:31:44 2012 +0000
> 
>     powerpc: Initialise paca.data_offset with poison
>     
>     It's possible for the cpu_possible_mask to change between the time we
>     initialise the pacas and the time we setup per_cpu areas.
>     
>     Obviously impossible cpus shouldn't ever be running, but stranger things
>     have happened. So be paranoid and initialise data_offset with a poison
>     value in case we don't set it up later.
>     
>     Based on a patch from Anton Blanchard.
>     
>     Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>     Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> 
> ------------------------------------------------------------------------------------------------
> 
> commit 048ee0993ec8360abb0b51bdf8f8721e9ed62ec4
> Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Date:   Mon Sep 10 02:52:55 2012 +0000
> 
>     powerpc/mm: Add 64TB support
>     
>     Increase max addressable range to 64TB. This is not tested on
>     real hardware yet.
>     
>     Reviewed-by: Paul Mackerras <paulus@samba.org>
>     Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>     Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> ----------------------------------------------------------------------------------------------------------
> 
> The first commit causes my PS3 to shut down. If i revert it then i'm able to boot Linux 3.7.0 and even see some boot messages
> on my screen. But then it hangs. The second commit is the reason for the hang as i figured it out.
> 
> I reverted both commits in current Linux 3.7.0 and was able to boot Linux 3.7.0 on my PS3 slim successfully.
> 
> Regards
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH] of: Fix export of of_find_matching_node_and_match()
From: Stephen Warren @ 2012-12-19 16:24 UTC (permalink / raw)
  To: Grant Likely
  Cc: Stephen Warren, devicetree-discuss, linuxppc-dev, linux-kernel,
	Rob Herring
In-Reply-To: <1355914716-19469-1-git-send-email-grant.likely@secretlab.ca>

On 12/19/2012 03:58 AM, Grant Likely wrote:
> Commit 50c8af4cf9, "of: introduce for_each_matching_node_and_match()"
> renamed of_find_matching_node() to of_find_matching_node_and_match() and
> created a new static inline of_find_matching_node() wrapper around the
> new name. However, the change neglected to change the EXPORT_SYMBOL()
> reference causing build errors for modules.
> 
> This patch fixes the EXPORT_SYMBOL() statement. Discovered on a PowerPC
> Efika build with the mpc52xx_uart driver being built as a module.

Oops. The patch is obviously correct,
Reviewed-by: Stephen Warren <swarren@nvidia.com>

I guess none of the ARM defconfigs enable any module that uses this,
since I have built all of them multiple times recently:-(

^ permalink raw reply

* Re: [PATCH] powerpc: Add support for context switching the TAR register
From: Kumar Gala @ 2012-12-19 15:34 UTC (permalink / raw)
  To: Ian Munsie; +Cc: Michael Neuling, linuxppc-dev, Matt Evans
In-Reply-To: <1355897036-13917-1-git-send-email-imunsie@au1.ibm.com>


On Dec 19, 2012, at 12:03 AM, Ian Munsie wrote:

> From: Ian Munsie <imunsie@au1.ibm.com>
>=20
> This patch adds support for enabling and context switching the Target
> Address Register in Power8. The TAR is a new special purpose register
> that can be used for computed branches with the bctar[l] (branch
> conditional to TAR) instruction in the same manner as the count and =
link
> registers.
>=20
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Matt Evans <matt@ozlabs.org>
> ---
> arch/powerpc/include/asm/cputable.h   |    3 ++-
> arch/powerpc/include/asm/processor.h  |    1 +
> arch/powerpc/include/asm/reg.h        |    3 +++
> arch/powerpc/kernel/asm-offsets.c     |    1 +
> arch/powerpc/kernel/cpu_setup_power.S |    7 +++++++
> arch/powerpc/kernel/entry_64.S        |   16 ++++++++++++++++
> 6 files changed, 30 insertions(+), 1 deletion(-)
>=20
> diff --git a/arch/powerpc/include/asm/cputable.h =
b/arch/powerpc/include/asm/cputable.h
> index 74458e69..cbbec56a 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -172,6 +172,7 @@ extern const char *powerpc_base_platform;
> #define CPU_FTR_ICSWX			=
LONG_ASM_CONST(0x1000000000000000)
> #define CPU_FTR_VMX_COPY		=
LONG_ASM_CONST(0x2000000000000000)
> #define CPU_FTR_TM			=
LONG_ASM_CONST(0x4000000000000000)
> +#define CPU_FTR_BCTAR			=
LONG_ASM_CONST(0x8000000000000000)
>=20
> #ifndef __ASSEMBLY__
>=20
> @@ -417,7 +418,7 @@ extern const char *powerpc_base_platform;
> 	    CPU_FTR_DSCR | CPU_FTR_SAO  | \
> 	    CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | =
CPU_FTR_POPCNTD | \
> 	    CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | =
CPU_FTR_VMX_COPY | \
> -	    CPU_FTR_DBELL | CPU_FTR_TM_COMP)
> +	    CPU_FTR_DBELL | CPU_FTR_TM_COMP | CPU_FTR_BCTAR)
> #define CPU_FTRS_CELL	(CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
> 	    CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
> 	    CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
> diff --git a/arch/powerpc/include/asm/processor.h =
b/arch/powerpc/include/asm/processor.h
> index 8b2bf7a..cbbd82d 100644
> --- a/arch/powerpc/include/asm/processor.h
> +++ b/arch/powerpc/include/asm/processor.h
> @@ -275,6 +275,7 @@ struct thread_struct {
> 	unsigned long	dscr;
> 	int		dscr_inherit;
> #endif
> +	unsigned long	tar;

This needs a #ifdef CONFIG_PPC64 and personally I'd rather it be a =
CONFIG_PPC_BOOK3S_64.  This will also ripple into other locations like =
asm-offsets.c.

> };
>=20
> #define ARCH_MIN_TASKALIGN 16
> diff --git a/arch/powerpc/include/asm/reg.h =
b/arch/powerpc/include/asm/reg.h
> index 5c9fe38..1fa8a56 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -257,6 +257,9 @@
> #define SPRN_HRMOR	0x139	/* Real mode offset register */
> #define SPRN_HSRR0	0x13A	/* Hypervisor Save/Restore 0 */
> #define SPRN_HSRR1	0x13B	/* Hypervisor Save/Restore 1 */
> +#define SPRN_FSCR	0x099	/* Facility Status & Control Register */
> +#define FSCR_TAR	(1<<8)	/* Enable Target Adress Register */
> +#define SPRN_TAR	0x32f	/* Target Address Register */
> #define SPRN_LPCR	0x13E	/* LPAR Control Register */
> #define   LPCR_VPM0	(1ul << (63-0))
> #define   LPCR_VPM1	(1ul << (63-1))
> diff --git a/arch/powerpc/kernel/asm-offsets.c =
b/arch/powerpc/kernel/asm-offsets.c
> index 42a4243..77e941e 100644
> --- a/arch/powerpc/kernel/asm-offsets.c
> +++ b/arch/powerpc/kernel/asm-offsets.c
> @@ -145,6 +145,7 @@ int main(void)
> 	DEFINE(TM_FRAME_SIZE, STACK_FRAME_OVERHEAD +
> 	       sizeof(struct pt_regs) + 16);
> #endif /* CONFIG_TRANSACTIONAL_MEM */
> +	DEFINE(THREAD_TAR, offsetof(struct thread_struct, tar));
>=20
> 	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
> 	DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, =
local_flags));
> diff --git a/arch/powerpc/kernel/cpu_setup_power.S =
b/arch/powerpc/kernel/cpu_setup_power.S
> index 57cf140..d29facb 100644
> --- a/arch/powerpc/kernel/cpu_setup_power.S
> +++ b/arch/powerpc/kernel/cpu_setup_power.S
> @@ -56,6 +56,7 @@ _GLOBAL(__setup_cpu_power8)
> 	mfspr	r3,SPRN_LPCR
> 	oris	r3, r3, LPCR_AIL_3@h
> 	bl	__init_LPCR
> +	bl	__init_FSCR
> 	bl	__init_TLB
> 	mtlr	r11
> 	blr
> @@ -112,6 +113,12 @@ __init_LPCR:
> 	isync
> 	blr
>=20
> +__init_FSCR:
> +	mfspr	r3,SPRN_FSCR
> +	ori	r3,r3,FSCR_TAR
> +	mtspr	SPRN_FSCR,r3
> +	blr
> +
> __init_TLB:
> 	/* Clear the TLB */
> 	li	r6,128
> diff --git a/arch/powerpc/kernel/entry_64.S =
b/arch/powerpc/kernel/entry_64.S
> index b3590c3..253885d 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -451,6 +451,17 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR)
> 	std	r23,_CCR(r1)
> 	std	r1,KSP(r3)	/* Set old stack pointer */
>=20
> +BEGIN_FTR_SECTION
> +	/*
> +	 * Back up the TAR across context switches.  Note that the TAR =
is not
> +	 * available for use in the kernel.  (To provide this, the TAR =
should
> +	 * be backed up/restored on exception entry/exit instead, and be =
in
> +	 * pt_regs.  FIXME, this should be in pt_regs anyway (for =
debug).)
> +	 */
> +	mfspr	r0,SPRN_TAR
> +	std	r0,THREAD_TAR(r3)
> +END_FTR_SECTION_IFSET(CPU_FTR_BCTAR)
> +
> #ifdef CONFIG_SMP
> 	/* We need a sync somewhere here to make sure that if the
> 	 * previous task gets rescheduled on another CPU, it sees all
> @@ -533,6 +544,11 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
> 	mr	r1,r8		/* start using new stack pointer */
> 	std	r7,PACAKSAVE(r13)
>=20
> +BEGIN_FTR_SECTION
> +	ld	r0,THREAD_TAR(r4)
> +	mtspr	SPRN_TAR,r0
> +END_FTR_SECTION_IFSET(CPU_FTR_BCTAR)
> +
> #ifdef CONFIG_ALTIVEC
> BEGIN_FTR_SECTION
> 	ld	r0,THREAD_VRSAVE(r4)
> --=20
> 1.7.10.4
>=20
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH] of: Fix export of of_find_matching_node_and_match()
From: Grant Likely @ 2012-12-19 15:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Warren, devicetree-discuss, linuxppc-dev@lists.ozlabs.org,
	Linux Kernel Mailing List, Rob Herring
In-Reply-To: <50D1C608.9040001@gmail.com>

On Wed, 19 Dec 2012 07:50:00 -0600, Rob Herring <robherring2@gmail.com> wrote:
> On 12/19/2012 05:02 AM, Grant Likely wrote:
> > On Wed, Dec 19, 2012 at 10:58 AM, Grant Likely
> > <grant.likely@secretlab.ca> wrote:
> >> Commit 50c8af4cf9, "of: introduce for_each_matching_node_and_match()"
> >> renamed of_find_matching_node() to of_find_matching_node_and_match() and
> >> created a new static inline of_find_matching_node() wrapper around the
> >> new name. However, the change neglected to change the EXPORT_SYMBOL()
> >> reference causing build errors for modules.
> >>
> >> This patch fixes the EXPORT_SYMBOL() statement. Discovered on a PowerPC
> >> Efika build with the mpc52xx_uart driver being built as a module.
> >>
> >> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> >> Cc: Stephen Warren <swarren@nvidia.com>
> >> Cc: Rob Herring <rob.herring@calxeda.com>
> >> Cc: Anatolij Gustschin <agust@denx.de>
> > 
> > Rob, I've just pushed this out to my devicetree/merge branch. If
> > you've got any fixes queued up for Linus, then please pull this in
> > before sending them on to him. Otherwise I'll send Linus a pull req
> > for this fix this evening. Ether way, please reply to let me know what
> > you're going to do.
> > 
> 
> The only item on my todo is this one:
> 
> "of: define struct device in of_platform.h if !OF_DEVICE and !OF_ADDRESS"
> 
> But I'm not going to get to it today if you want to pick it up.

I don't see that one anywhere. Where did it come from?

g.

^ 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