LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC PATCH 1/1] powerpc/embedded6xx: Add support for Motorola/Emerson MVME5100.
From: Stephen N Chivers @ 2013-08-12 21:57 UTC (permalink / raw)
  To: Scott Wood; +Cc: Chris Proctor, linuxppc-dev, paulus, Stephen N Chivers
In-Reply-To: <1375985244.4514.21.camel@snotra.buserror.net>

Scott Wood <scottwood@freescale.com> wrote on 08/09/2013 04:07:24 AM:

> From: Scott Wood <scottwood@freescale.com>
> To: Kumar Gala <galak@kernel.crashing.org>
> Cc: Stephen N Chivers <schivers@csc.com.au>, <paulus@samba.org>, 
> <linuxppc-dev@lists.ozlabs.org>, Chris Proctor <cproctor@csc.com.au>
> Date: 08/09/2013 04:08 AM
> Subject: Re: [RFC PATCH 1/1] powerpc/embedded6xx: Add support for 
> Motorola/Emerson MVME5100.
> 
> On Thu, 2013-08-08 at 10:30 -0500, Kumar Gala wrote:
> > On Aug 7, 2013, at 7:03 PM, Stephen N Chivers wrote:
> > 
> > > Add support for the Motorola/Emerson MVME5100 Single Board Computer.
> > > 
> > > The MVME5100 is a 6U form factor VME64 computer with:
> > > 
> > >        - A single MPC7410 or MPC750 CPU
> > >        - A HAWK Processor Host Bridge (CPU to PCI) and
> > >          MultiProcessor Interrupt Controller (MPIC)
> > >        - Up to 500Mb of onboard memory
> > >        - A M48T37 Real Time Clock (RTC) and Non-Volatile Memory chip
> > >        - Two 16550 compatible UARTS
> > >        - Two Intel E100 Fast Ethernets
> > >        - Two PCI Mezzanine Card (PMC) Slots
> > >        - PPCBug Firmware
> > > 
> > > The HAWK PHB/MPIC is compatible with the MPC10x devices.
> > > 
> > > There is no onboard disk support. This is usually provided by 
> installing a 
> > > PMC
> > > in first PMC slot.
> > > 
> > > This patch revives the board support, it was present in early 2.6
> > > series kernels. The board support in those days was by Matt Porter 
of
> > > MontaVista Software.
> > > 
> > > CSC Australia has around 31 of these boards in service. The kernel 
in use
> > > for the boards is based on 2.6.31. The boards are operated without 
disks
> > > from a file server. 
> > > 
> > > This patch is based on linux-3.11-rc4 and has been boot tested.
> > > 
> > > Signed-off-by: Stephen Chivers <schivers@csc.com>
> > > ---
> > > arch/powerpc/boot/dts/mvme5100.dts            |  195 ++
> > > arch/powerpc/boot/mvme5100.c                  |   28 +
> > > arch/powerpc/configs/mvme5100_defconfig       | 2597 
> > > +++++++++++++++++++++++++
> > > arch/powerpc/platforms/embedded6xx/mvme5100.c |  288 +++
> > > 4 files changed, 3108 insertions(+), 0 deletions(-)
> > 
> > Please look at fixing the white space issues you seem to have 
> throughout this patch.
> > 
> > Also, we don't take full defconfigs in the tree, look at 'make 
> savedefconfig'
> 
> Why does this board need its own defconfig at all?  Just add it to
> ppc6xx_defconfig.

The boards firmware as stated above is PPCBug. PPCBug is not Open Firmware
compatible.

There is no U-Boot support for the board.

In ppc6xx_defconfig the e100 network device and NFS support is modular and
that forces the use of an initrd.

PPCBugs network boot command takes only one file argument and so makes
it difficult to use an initrd.

So the choices are:
        - Providing a defconfig for the board,
        - Building the kernel with the initrd embedded in it,
        - Finding an alternative boot loader,
        - Doing the board support for U-Boot.
The first choice is simple and documents the configuration of the
board without mixing it into ppc6xx_defconfig.
The second choice would, I believe, fail for ppc6xx_defconfig when built
by the automaton at "kisskb". The failure would be caused by the lack of
a ramdisk in the vanilla kernel source.
For the third, I spent a lot of time over the weekend looking for an
alternative boot loader to no avail. 
The last choice is possibly difficult and would take considerable time.

Other possibilities include:
        - a boot script for PPCBug that loads the initrd first and
          then executes the network boot command. I believe that the
          initrd start and size can be specified in the dts file.
        - porting the "tftplilo" program used with the ancient
          MVME-167 68k SBCs. This is probably feasible as PPCBug is
          a descendant of the older 167Bug. tftplilo uses the network
          routines in 167Bug to do its work and similar things exist
          in PPCBug.

Suggestions please. 
> 
> -Scott
> 
> 
>
Stephen Chivers.

^ permalink raw reply

* Re: [RFC PATCH 1/1] powerpc/embedded6xx: Add support for Motorola/Emerson MVME5100.
From: Scott Wood @ 2013-08-12 22:04 UTC (permalink / raw)
  To: Stephen N Chivers; +Cc: Chris Proctor, linuxppc-dev, paulus
In-Reply-To: <OF23301F36.A839CDA8-ONCA257BC5.0073F671-CA257BC5.00789A7F@csc.com>

On Tue, 2013-08-13 at 08:57 +1100, Stephen N Chivers wrote:
> Scott Wood <scottwood@freescale.com> wrote on 08/09/2013 04:07:24 AM:
> 
> > From: Scott Wood <scottwood@freescale.com>
> > To: Kumar Gala <galak@kernel.crashing.org>
> > Cc: Stephen N Chivers <schivers@csc.com.au>, <paulus@samba.org>, 
> > <linuxppc-dev@lists.ozlabs.org>, Chris Proctor <cproctor@csc.com.au>
> > Date: 08/09/2013 04:08 AM
> > Subject: Re: [RFC PATCH 1/1] powerpc/embedded6xx: Add support for 
> > Motorola/Emerson MVME5100.
> > 
> > On Thu, 2013-08-08 at 10:30 -0500, Kumar Gala wrote:
> > > Also, we don't take full defconfigs in the tree, look at 'make 
> > savedefconfig'
> > 
> > Why does this board need its own defconfig at all?  Just add it to
> > ppc6xx_defconfig.
> 
> The boards firmware as stated above is PPCBug. PPCBug is not Open Firmware
> compatible.
> 
> There is no U-Boot support for the board.

I'm not sure why that precludes the use of ppc6xx_defconfig...

> In ppc6xx_defconfig the e100 network device and NFS support is modular and
> that forces the use of an initrd.

OK, then let's enable those in ppc6xx_defconfig.  We do in a lot of the
other defconfigs (such as 85xx and derivatives).

> PPCBugs network boot command takes only one file argument and so makes
> it difficult to use an initrd.
> 
> So the choices are:
>         - Providing a defconfig for the board,
>         - Building the kernel with the initrd embedded in it,
>         - Finding an alternative boot loader,
>         - Doing the board support for U-Boot.
> The first choice is simple and documents the configuration of the
> board without mixing it into ppc6xx_defconfig.

The first choice means your board would get much less build-testing, and
would increase maintenance costs of defconfig changes (and/or lead to
divergence from other defconfigs that doesn't actually have anything to
do with this board or its use cases).

The fifth choice is "add what you need to ppc6xx_defconfig".  Within
reason of course, but I think a common PCI network device and NFS root
support is reasonable.

-Scott

^ permalink raw reply

* Re: [PATCH] powerpc: 52xx: provide a default in mpc52xx_irqhost_map()
From: Anatolij Gustschin @ 2013-08-12 22:16 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linuxppc-dev, Wolfram Sang
In-Reply-To: <1376317073-14302-1-git-send-email-bigeasy@linutronix.de>

On Mon, 12 Aug 2013 16:17:53 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> My gcc-4.3.5 fails to compile due to:
>=20
> |cc1: warnings being treated as errors
> |arch/powerpc/platforms/52xx/mpc52xx_pic.c: In function =E2=80=98mpc52xx_=
irqhost_map=E2=80=99:
> |arch/powerpc/platforms/52xx/mpc52xx_pic.c:343: error: =E2=80=98irqchip=
=E2=80=99 may be used uninitialized in this function
>=20
> since commit e34298c ("powerpc: 52xx: nop out unsupported critical
> IRQs"). This warning is complete crap since only values 0=E2=80=A63 are p=
ossible
> which are checked but gcc fails to understand that. I wouldn't care much
> but since this is compiled with -Werror I made this patch.
> While add it, I replaced the warning from l2irq to l1irq since this is
> the number that is evaluated.
>=20
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  arch/powerpc/platforms/52xx/mpc52xx_pic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks!

Anatolij

^ permalink raw reply

* Re: powerpc: Mark low level irq handlers NO_THREAD
From: Scott Wood @ 2013-08-12 23:11 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Marcelo Tosatti, Thomas Gleixner, linuxppc-dev
In-Reply-To: <1376318939-14447-1-git-send-email-bigeasy@linutronix.de>

On Mon, 2013-08-12 at 16:48 +0200, Sebastian Andrzej Siewior wrote:
> From: Thomas Gleixner <tglx@linutronix.de>
> 
> These low level handlers cannot be threaded. Mark them NO_THREAD
> 
> Reported-by: leroy christophe <christophe.leroy@c-s.fr>
> Tested-by: leroy christophe <christophe.leroy@c-s.fr>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 
> This patch has been posted on Feb 13, 2013 and nobody responded back then.

It went in v3.11-rc1.

-Scott

^ permalink raw reply

* Re: mm/slab: ppc: ubi: kmalloc_slab WARNING / PPC + UBI driver
From: Benjamin Herrenschmidt @ 2013-08-12 23:24 UTC (permalink / raw)
  To: Wladislav Wiebe
  Cc: dedekind1, linuxppc-dev, Aaro Koskinen, penberg, linux-mm,
	linux-mtd, cl, dwmw2
In-Reply-To: <5208C1CD.3040601@gmail.com>

On Mon, 2013-08-12 at 13:06 +0200, Wladislav Wiebe wrote:
> Hi guys,
> 
> we got the real root cause of the allocation issue:
> 
> Subject: [PATCH 1/1] of: fdt: fix memory initialization for expanded DT
> 
> Already existing property flags are filled wrong for properties created from
> initial FDT. This could cause problems if this DYNAMIC device-tree functions
> are used later, i.e. properties are attached/detached/replaced. Simply dumping
> flags from the running system show, that some initial static (not allocated via
> kzmalloc()) nodes are marked as dynamic.

This should go into stable as well...

> I putted some debug extensions to property_proc_show(..) :
> ..
> +       if (OF_IS_DYNAMIC(pp))
> +               pr_err("DEBUG: xxx : OF_IS_DYNAMIC\n");
> +       if (OF_IS_DETACHED(pp))
> +               pr_err("DEBUG: xxx : OF_IS_DETACHED\n");
> 
> when you operate on the nodes (e.g.: ~$ cat /proc/device-tree/*some_node*) you
> will see that those flags are filled wrong, basically in most cases it will dump
> a DYNAMIC or DETACHED status, which is in not true.
> (BTW. this OF_IS_DETACHED is a own define for debug purposes which which just
> make a test_bit(OF_DETACHED, &x->_flags)
> 
> If nodes are dynamic kernel is allowed to kfree() them. But it will crash
> attempting to do so on the nodes from FDT -- they are not allocated via
> kzmalloc().
> 
> Signed-off-by: Wladislav Wiebe <wladislav.kw@gmail.com>
> ---
>  drivers/of/fdt.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 6bb7cf2..b10ba00 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -392,6 +392,8 @@ static void __unflatten_device_tree(struct boot_param_header *blob,
>  	mem = (unsigned long)
>  		dt_alloc(size + 4, __alignof__(struct device_node));
> 
> +	memset((void *)mem, 0, size);
> +
>  	((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
> 
>  	pr_debug("  unflattening %lx...\n", mem);
> -- 1.7.1
> 
> This is committed to the mainline - hope it comes in soon.
> 
> Thanks & BR,
> Wladislav Wiebe
> 
> 
> On 31/07/13 19:34, Aaro Koskinen wrote:
> > Hi,
> > 
> > On Wed, Jul 31, 2013 at 01:42:31PM +0200, Wladislav Wiebe wrote:
> >> DEBUG: xxx kmalloc_slab, requested 'size' = 8388608, KMALLOC_MAX_SIZE = 4194304
> > [...]
> >> [ccd3be60] [c0099fd4] kmalloc_slab+0x48/0xe8 (unreliable)
> >> [ccd3be70] [c00ae650] __kmalloc+0x20/0x1b4
> >> [ccd3be90] [c00d46f4] seq_read+0x2a4/0x540
> >> [ccd3bee0] [c00fe09c] proc_reg_read+0x5c/0x90
> >> [ccd3bef0] [c00b4e1c] vfs_read+0xa4/0x150
> >> [ccd3bf10] [c00b500c] SyS_read+0x4c/0x84
> >> [ccd3bf40] [c000be80] ret_from_syscall+0x0/0x3c
> > 
> > It seems some procfs file is trying to dump 8 MB at a single go. You
> > need to fix that to return data in smaller chunks. What file is it?
> > 
> > A.
> > 
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: Powerpc: Kernel warn_on when enabling IOMMU_API
From: Alexey Kardashevskiy @ 2013-08-13  0:11 UTC (permalink / raw)
  To: Bhushan Bharat-R65777; +Cc: linuxppc-dev@lists.ozlabs.org
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D0710E32E@039-SN2MPN1-013.039d.mgd.msft.net>

On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote:
> 
> 
>> -----Original Message-----
>> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru]
>> Sent: Monday, August 12, 2013 7:44 PM
>> To: Bhushan Bharat-R65777
>> Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org
>> Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API
>>
>> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote:
>>> And this simple fix work for me
>>> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
>>> index b20ff17..8869b0d 100644
>>> --- a/arch/powerpc/kernel/iommu.c
>>> +++ b/arch/powerpc/kernel/iommu.c
>>> @@ -48,6 +48,8 @@
>>>  #include <asm/vio.h>
>>>  #include <asm/tce.h>
>>>
>>> +#define DEBUG
>>> +
>>>  #define DBG(...)
>>>
>>>  static int novmerge;
>>> @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t
>> size,
>>>         }
>>>  }
>>>
>>> -#ifdef CONFIG_IOMMU_API
>>> +#ifdef SPAPR_TCE_IOMMU
>>>  /*
>>>   * SPAPR TCE API
>>>   */
>>> ----------------------
>>
>>
>> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print?
> 
> It shows the list of group id and respective devices:
> 

Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there?


-- 
Alexey

^ permalink raw reply

* [PATCH] powerpc: Avoid link stack corruption for MMU on exceptions
From: Michael Neuling @ 2013-08-13  2:20 UTC (permalink / raw)
  To: benh; +Cc: Linux PPC dev, Paul Mackerras, anton

When we have MMU on exceptions (POWER8) and a relocatable kernel, we
need to branch from the initial exception vectors at 0x0 to up high
where the kernel might be located.  Currently we do this using the link
register.

Unfortunately this corrupts the link stack and instead we should use the
count register.  We did this for the syscall entry path in: 
  6a40480 powerpc: Avoid link stack corruption in MMU on syscall entry path 
but I stupidly forgot to do the same for other exceptions.

This patches changes the initial exception vectors to use the count
register instead of the link register when we need to branch up to the
relocated kernel.

I have a dodgy userspace test which loops calling a function that reads
the PVR (mfpvr in userspace will be emulated by the kernel via the
program check exception).  On POWER8 and with CONFIG_RELOCATABLE=y, I
get a ~10% performance improvement with my userspace test with this
patch.

Signed-off-by: Michael Neuling <mikey@neuling.org>

diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 07ca627..01ed463 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -48,17 +48,18 @@
 #define EX_LR		72
 #define EX_CFAR		80
 #define EX_PPR		88	/* SMT thread status register (priority) */
+#define EX_CTR		96
 
 #ifdef CONFIG_RELOCATABLE
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)			\
 	ld	r12,PACAKBASE(r13);	/* get high part of &label */	\
 	mfspr	r11,SPRN_##h##SRR0;	/* save SRR0 */			\
 	LOAD_HANDLER(r12,label);					\
-	mtlr	r12;							\
+	mtctr	r12;							\
 	mfspr	r12,SPRN_##h##SRR1;	/* and SRR1 */			\
 	li	r10,MSR_RI;						\
 	mtmsrd 	r10,1;			/* Set RI (EE=0) */		\
-	blr;
+	bctr;
 #else
 /* If not relocatable, we can jump directly -- and save messing with LR */
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)			\
@@ -101,14 +102,14 @@
  * kernel, we need to use LR to get to the 2nd level handler.  So, save/restore
  * it when required.
  */
-#define SAVE_LR(reg, area)	mflr	reg ; 	std	reg,area+EX_LR(r13)
-#define GET_LR(reg, area) 			ld	reg,area+EX_LR(r13)
-#define RESTORE_LR(reg, area)	ld	reg,area+EX_LR(r13) ; mtlr reg
+#define SAVE_CTR(reg, area)	mfctr	reg ; 	std	reg,area+EX_CTR(r13)
+#define GET_CTR(reg, area) 			ld	reg,area+EX_CTR(r13)
+#define RESTORE_CTR(reg, area)	ld	reg,area+EX_CTR(r13) ; mtctr reg
 #else
 /* ...else LR is unused and in register. */
-#define SAVE_LR(reg, area)
-#define GET_LR(reg, area) 	mflr	reg
-#define RESTORE_LR(reg, area)
+#define SAVE_CTR(reg, area)
+#define GET_CTR(reg, area) 	mfctr	reg
+#define RESTORE_CTR(reg, area)
 #endif
 
 /*
@@ -164,7 +165,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
 #define __EXCEPTION_PROLOG_1(area, extra, vec)				\
 	OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR);		\
 	OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR);		\
-	SAVE_LR(r10, area);						\
+	SAVE_CTR(r10, area);						\
 	mfcr	r9;							\
 	extra(vec);							\
 	std	r11,area+EX_R11(r13);					\
@@ -270,7 +271,7 @@ do_kvm_##n:								\
 	sth	r1,PACA_TRAP_SAVE(r13);					   \
 	std	r3,area+EX_R3(r13);					   \
 	addi	r3,r13,area;		/* r3 -> where regs are saved*/	   \
-	RESTORE_LR(r1, area);						   \
+	RESTORE_CTR(r1, area);						   \
 	b	bad_stack;						   \
 3:	std	r9,_CCR(r1);		/* save CR in stackframe	*/ \
 	std	r11,_NIP(r1);		/* save SRR0 in stackframe	*/ \
@@ -298,10 +299,10 @@ do_kvm_##n:								\
 	ld	r10,area+EX_CFAR(r13);					   \
 	std	r10,ORIG_GPR3(r1);					   \
 	END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66);		   \
-	GET_LR(r9,area);		/* Get LR, later save to stack	*/ \
+	mflr	r9;			/* Get LR, later save to stack	*/ \
 	ld	r2,PACATOC(r13);	/* get kernel TOC into r2	*/ \
 	std	r9,_LINK(r1);						   \
-	mfctr	r10;			/* save CTR in stackframe	*/ \
+	GET_CTR(r10, area);						   \
 	std	r10,_CTR(r1);						   \
 	lbz	r10,PACASOFTIRQEN(r13);				   \
 	mfspr	r11,SPRN_XER;		/* save XER in stackframe	*/ \
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 77c91e7..17d40a2 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -93,9 +93,9 @@ struct paca_struct {
 	 * Now, starting in cacheline 2, the exception save areas
 	 */
 	/* used for most interrupts/exceptions */
-	u64 exgen[12] __attribute__((aligned(0x80)));
-	u64 exmc[12];		/* used for machine checks */
-	u64 exslb[12];		/* used for SLB/segment table misses
+	u64 exgen[13] __attribute__((aligned(0x80)));
+	u64 exmc[13];		/* used for machine checks */
+	u64 exslb[13];		/* used for SLB/segment table misses
  				 * on the linear mapping */
 	/* SLB related definitions */
 	u16 vmalloc_sllp;

^ permalink raw reply related

* Re: Build errors on mainline kernel
From: Michael Ellerman @ 2013-08-13  2:23 UTC (permalink / raw)
  To: Sukadev Bhattiprolu; +Cc: linuxppc-dev
In-Reply-To: <20130812060228.GA8608@us.ibm.com>

On Sun, Aug 11, 2013 at 11:02:28PM -0700, Sukadev Bhattiprolu wrote:
> Michael Ellerman [michael@ellerman.id.au] wrote:
> | On Fri, 2013-08-09 at 11:24 -0700, Sukadev Bhattiprolu wrote:
> | > I am tryng to compile clean mainline kernel with a few different config files
> | > and running into errors with some configs.
> | > 
> | > I am building on RHEL6.3 with following binaries:
> | > 
> | > 	gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
> | > 	GNU ld version 2.20.51.0.2-5.34.el6 20100205
> | > 	binutils-2.20.51.0.2-5.34.el6.ppc64
> | > 	binutils-devel-2.20.51.0.2-5.34.el6.ppc64
> | > 
> | > I am getting the error with several files and configs, but other configs 
> | > (eg: ppc64_defconfig, pmac32_defconfig) build fine.
> | > 
> | > For instance, with latest mainline kernel (commit 6c2580c) and ppc64_defconfig, I get:
> | 
> | Here you say ppc64_defconfig ..
> 
> That was a stupid typo. ppc64_defconfig works.
> 
> | 
> | > 	make O=linux-obj mrproper
> | > 	make O=linux-obj ppc64e_defconfig
> | 
> | But here you say ppc64e_defconfig ?
> 
> ppc64e_defconfig fails (checked again now).

OK. I don't have a RHEL 6 system around. But I can build
ppc64e_defconfig on debian with gcc 4.4.7-2.

So not sure what's going on.
 
cheers

^ permalink raw reply

* Re: [PATCH] powerpc: Avoid link stack corruption for MMU on exceptions
From: Stephen Rothwell @ 2013-08-13  5:06 UTC (permalink / raw)
  To: Michael Neuling; +Cc: Paul Mackerras, anton, Linux PPC dev
In-Reply-To: <18522.1376360422@ale.ozlabs.ibm.com>

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

Hi Mikey,

On Tue, 13 Aug 2013 12:20:22 +1000 Michael Neuling <mikey@neuling.org> wrote:
>
> @@ -101,14 +102,14 @@
>   * kernel, we need to use LR to get to the 2nd level handler.  So, save/restore
                             ^^
CTR

>   * it when required.
>   */
> -#define SAVE_LR(reg, area)	mflr	reg ; 	std	reg,area+EX_LR(r13)
> -#define GET_LR(reg, area) 			ld	reg,area+EX_LR(r13)
> -#define RESTORE_LR(reg, area)	ld	reg,area+EX_LR(r13) ; mtlr reg
> +#define SAVE_CTR(reg, area)	mfctr	reg ; 	std	reg,area+EX_CTR(r13)
> +#define GET_CTR(reg, area) 			ld	reg,area+EX_CTR(r13)
> +#define RESTORE_CTR(reg, area)	ld	reg,area+EX_CTR(r13) ; mtctr reg
>  #else
>  /* ...else LR is unused and in register. */
              ^^
and again

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

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

^ permalink raw reply

* (no subject)
From: Michael Neuling @ 2013-08-13  5:40 UTC (permalink / raw)
  To: benh; +Cc: Linux PPC dev, Paul Mackerras, anton, Stephen Rothwell

Fcc: +outbox
Subject: [PATCH v2] powerpc: Avoid link stack corruption for MMU on exceptions
In-reply-to: <20130813150617.dba639d38dad2ea41668c4d4@canb.auug.org.au>
References: <18522.1376360422@ale.ozlabs.ibm.com> <20130813150617.dba639d38dad2ea41668c4d4@canb.auug.org.au>
Comments: In-reply-to Stephen Rothwell <sfr@canb.auug.org.au>
   message dated "Tue, 13 Aug 2013 15:06:17 +1000."
X-Mailer: MH-E 8.2; nmh 1.5; GNU Emacs 23.4.1
--------
When we have MMU on exceptions (POWER8) and a relocatable kernel, we
need to branch from the initial exception vectors at 0x0 to up high
where the kernel might be located.  Currently we do this using the link
register.

Unfortunately this corrupts the link stack and instead we should use the
count register.  We did this for the syscall entry path in:
  6a40480 powerpc: Avoid link stack corruption in MMU on syscall entry path
but I stupidly forgot to do the same for other exceptions.

This patches changes the initial exception vectors to use the count
register instead of the link register when we need to branch up to the
relocated kernel.

I have a dodgy userspace test which loops calling a function that reads
the PVR (mfpvr in userspace will be emulated by the kernel via the
program check exception).  On POWER8 and with CONFIG_RELOCATABLE=y, I
get a ~10% performance improvement with my userspace test with this
patch.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
v2: fix comments as noticed by sfr

diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 07ca627..fe5e523 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -48,17 +48,18 @@
 #define EX_LR		72
 #define EX_CFAR		80
 #define EX_PPR		88	/* SMT thread status register (priority) */
+#define EX_CTR		96
 
 #ifdef CONFIG_RELOCATABLE
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)			\
 	ld	r12,PACAKBASE(r13);	/* get high part of &label */	\
 	mfspr	r11,SPRN_##h##SRR0;	/* save SRR0 */			\
 	LOAD_HANDLER(r12,label);					\
-	mtlr	r12;							\
+	mtctr	r12;							\
 	mfspr	r12,SPRN_##h##SRR1;	/* and SRR1 */			\
 	li	r10,MSR_RI;						\
 	mtmsrd 	r10,1;			/* Set RI (EE=0) */		\
-	blr;
+	bctr;
 #else
 /* If not relocatable, we can jump directly -- and save messing with LR */
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)			\
@@ -97,18 +98,18 @@
 
 #if defined(CONFIG_RELOCATABLE)
 /*
- * If we support interrupts with relocation on AND we're a relocatable
- * kernel, we need to use LR to get to the 2nd level handler.  So, save/restore
- * it when required.
+ * If we support interrupts with relocation on AND we're a relocatable kernel,
+ * we need to use CTR to get to the 2nd level handler.  So, save/restore it
+ * when required.
  */
-#define SAVE_LR(reg, area)	mflr	reg ; 	std	reg,area+EX_LR(r13)
-#define GET_LR(reg, area) 			ld	reg,area+EX_LR(r13)
-#define RESTORE_LR(reg, area)	ld	reg,area+EX_LR(r13) ; mtlr reg
+#define SAVE_CTR(reg, area)	mfctr	reg ; 	std	reg,area+EX_CTR(r13)
+#define GET_CTR(reg, area) 			ld	reg,area+EX_CTR(r13)
+#define RESTORE_CTR(reg, area)	ld	reg,area+EX_CTR(r13) ; mtctr reg
 #else
-/* ...else LR is unused and in register. */
-#define SAVE_LR(reg, area)
-#define GET_LR(reg, area) 	mflr	reg
-#define RESTORE_LR(reg, area)
+/* ...else CTR is unused and in register. */
+#define SAVE_CTR(reg, area)
+#define GET_CTR(reg, area) 	mfctr	reg
+#define RESTORE_CTR(reg, area)
 #endif
 
 /*
@@ -164,7 +165,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
 #define __EXCEPTION_PROLOG_1(area, extra, vec)				\
 	OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR);		\
 	OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR);		\
-	SAVE_LR(r10, area);						\
+	SAVE_CTR(r10, area);						\
 	mfcr	r9;							\
 	extra(vec);							\
 	std	r11,area+EX_R11(r13);					\
@@ -270,7 +271,7 @@ do_kvm_##n:								\
 	sth	r1,PACA_TRAP_SAVE(r13);					   \
 	std	r3,area+EX_R3(r13);					   \
 	addi	r3,r13,area;		/* r3 -> where regs are saved*/	   \
-	RESTORE_LR(r1, area);						   \
+	RESTORE_CTR(r1, area);						   \
 	b	bad_stack;						   \
 3:	std	r9,_CCR(r1);		/* save CR in stackframe	*/ \
 	std	r11,_NIP(r1);		/* save SRR0 in stackframe	*/ \
@@ -298,10 +299,10 @@ do_kvm_##n:								\
 	ld	r10,area+EX_CFAR(r13);					   \
 	std	r10,ORIG_GPR3(r1);					   \
 	END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66);		   \
-	GET_LR(r9,area);		/* Get LR, later save to stack	*/ \
+	mflr	r9;			/* Get LR, later save to stack	*/ \
 	ld	r2,PACATOC(r13);	/* get kernel TOC into r2	*/ \
 	std	r9,_LINK(r1);						   \
-	mfctr	r10;			/* save CTR in stackframe	*/ \
+	GET_CTR(r10, area);						   \
 	std	r10,_CTR(r1);						   \
 	lbz	r10,PACASOFTIRQEN(r13);				   \
 	mfspr	r11,SPRN_XER;		/* save XER in stackframe	*/ \
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 77c91e7..17d40a2 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -93,9 +93,9 @@ struct paca_struct {
 	 * Now, starting in cacheline 2, the exception save areas
 	 */
 	/* used for most interrupts/exceptions */
-	u64 exgen[12] __attribute__((aligned(0x80)));
-	u64 exmc[12];		/* used for machine checks */
-	u64 exslb[12];		/* used for SLB/segment table misses
+	u64 exgen[13] __attribute__((aligned(0x80)));
+	u64 exmc[13];		/* used for machine checks */
+	u64 exslb[13];		/* used for SLB/segment table misses
  				 * on the linear mapping */
 	/* SLB related definitions */
 	u16 vmalloc_sllp;

^ permalink raw reply related

* [PATCH v2] powerpc: Avoid link stack corruption for MMU on exceptions
From: Michael Neuling @ 2013-08-13  5:54 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Paul Mackerras, anton, Linux PPC dev
In-Reply-To: <20130813150617.dba639d38dad2ea41668c4d4@canb.auug.org.au>

When we have MMU on exceptions (POWER8) and a relocatable kernel, we
need to branch from the initial exception vectors at 0x0 to up high
where the kernel might be located.  Currently we do this using the link
register.

Unfortunately this corrupts the link stack and instead we should use the
count register.  We did this for the syscall entry path in:
  6a40480 powerpc: Avoid link stack corruption in MMU on syscall entry path
but I stupidly forgot to do the same for other exceptions.

This patch changes the initial exception vectors to use the count
register instead of the link register when we need to branch up to the
relocated kernel.

I have a dodgy userspace test which loops calling a function that reads
the PVR (mfpvr in userspace will be emulated by the kernel via the
program check exception).  On POWER8 and with CONFIG_RELOCATABLE=y, I
get a ~10% performance improvement with my userspace test with this
patch.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
v2: fix comments as noticed by sfr

Note to self, give emails a subject :-(

diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 07ca627..fe5e523 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -48,17 +48,18 @@
 #define EX_LR		72
 #define EX_CFAR		80
 #define EX_PPR		88	/* SMT thread status register (priority) */
+#define EX_CTR		96
 
 #ifdef CONFIG_RELOCATABLE
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)			\
 	ld	r12,PACAKBASE(r13);	/* get high part of &label */	\
 	mfspr	r11,SPRN_##h##SRR0;	/* save SRR0 */			\
 	LOAD_HANDLER(r12,label);					\
-	mtlr	r12;							\
+	mtctr	r12;							\
 	mfspr	r12,SPRN_##h##SRR1;	/* and SRR1 */			\
 	li	r10,MSR_RI;						\
 	mtmsrd 	r10,1;			/* Set RI (EE=0) */		\
-	blr;
+	bctr;
 #else
 /* If not relocatable, we can jump directly -- and save messing with LR */
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)			\
@@ -97,18 +98,18 @@
 
 #if defined(CONFIG_RELOCATABLE)
 /*
- * If we support interrupts with relocation on AND we're a relocatable
- * kernel, we need to use LR to get to the 2nd level handler.  So, save/restore
- * it when required.
+ * If we support interrupts with relocation on AND we're a relocatable kernel,
+ * we need to use CTR to get to the 2nd level handler.  So, save/restore it
+ * when required.
  */
-#define SAVE_LR(reg, area)	mflr	reg ; 	std	reg,area+EX_LR(r13)
-#define GET_LR(reg, area) 			ld	reg,area+EX_LR(r13)
-#define RESTORE_LR(reg, area)	ld	reg,area+EX_LR(r13) ; mtlr reg
+#define SAVE_CTR(reg, area)	mfctr	reg ; 	std	reg,area+EX_CTR(r13)
+#define GET_CTR(reg, area) 			ld	reg,area+EX_CTR(r13)
+#define RESTORE_CTR(reg, area)	ld	reg,area+EX_CTR(r13) ; mtctr reg
 #else
-/* ...else LR is unused and in register. */
-#define SAVE_LR(reg, area)
-#define GET_LR(reg, area) 	mflr	reg
-#define RESTORE_LR(reg, area)
+/* ...else CTR is unused and in register. */
+#define SAVE_CTR(reg, area)
+#define GET_CTR(reg, area) 	mfctr	reg
+#define RESTORE_CTR(reg, area)
 #endif
 
 /*
@@ -164,7 +165,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
 #define __EXCEPTION_PROLOG_1(area, extra, vec)				\
 	OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR);		\
 	OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR);		\
-	SAVE_LR(r10, area);						\
+	SAVE_CTR(r10, area);						\
 	mfcr	r9;							\
 	extra(vec);							\
 	std	r11,area+EX_R11(r13);					\
@@ -270,7 +271,7 @@ do_kvm_##n:								\
 	sth	r1,PACA_TRAP_SAVE(r13);					   \
 	std	r3,area+EX_R3(r13);					   \
 	addi	r3,r13,area;		/* r3 -> where regs are saved*/	   \
-	RESTORE_LR(r1, area);						   \
+	RESTORE_CTR(r1, area);						   \
 	b	bad_stack;						   \
 3:	std	r9,_CCR(r1);		/* save CR in stackframe	*/ \
 	std	r11,_NIP(r1);		/* save SRR0 in stackframe	*/ \
@@ -298,10 +299,10 @@ do_kvm_##n:								\
 	ld	r10,area+EX_CFAR(r13);					   \
 	std	r10,ORIG_GPR3(r1);					   \
 	END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66);		   \
-	GET_LR(r9,area);		/* Get LR, later save to stack	*/ \
+	mflr	r9;			/* Get LR, later save to stack	*/ \
 	ld	r2,PACATOC(r13);	/* get kernel TOC into r2	*/ \
 	std	r9,_LINK(r1);						   \
-	mfctr	r10;			/* save CTR in stackframe	*/ \
+	GET_CTR(r10, area);						   \
 	std	r10,_CTR(r1);						   \
 	lbz	r10,PACASOFTIRQEN(r13);				   \
 	mfspr	r11,SPRN_XER;		/* save XER in stackframe	*/ \
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 77c91e7..17d40a2 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -93,9 +93,9 @@ struct paca_struct {
 	 * Now, starting in cacheline 2, the exception save areas
 	 */
 	/* used for most interrupts/exceptions */
-	u64 exgen[12] __attribute__((aligned(0x80)));
-	u64 exmc[12];		/* used for machine checks */
-	u64 exslb[12];		/* used for SLB/segment table misses
+	u64 exgen[13] __attribute__((aligned(0x80)));
+	u64 exmc[13];		/* used for machine checks */
+	u64 exslb[13];		/* used for SLB/segment table misses
  				 * on the linear mapping */
 	/* SLB related definitions */
 	u16 vmalloc_sllp;

^ permalink raw reply related

* RE: Powerpc: Kernel warn_on when enabling IOMMU_API
From: Bhushan Bharat-R65777 @ 2013-08-13 10:44 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev@lists.ozlabs.org
In-Reply-To: <520979A6.8040200@ozlabs.ru>



> -----Original Message-----
> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru]
> Sent: Tuesday, August 13, 2013 5:41 AM
> To: Bhushan Bharat-R65777
> Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org
> Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API
>=20
> On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote:
> >
> >
> >> -----Original Message-----
> >> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru]
> >> Sent: Monday, August 12, 2013 7:44 PM
> >> To: Bhushan Bharat-R65777
> >> Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org
> >> Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API
> >>
> >> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote:
> >>> And this simple fix work for me
> >>> diff --git a/arch/powerpc/kernel/iommu.c
> >>> b/arch/powerpc/kernel/iommu.c index b20ff17..8869b0d 100644
> >>> --- a/arch/powerpc/kernel/iommu.c
> >>> +++ b/arch/powerpc/kernel/iommu.c
> >>> @@ -48,6 +48,8 @@
> >>>  #include <asm/vio.h>
> >>>  #include <asm/tce.h>
> >>>
> >>> +#define DEBUG
> >>> +
> >>>  #define DBG(...)
> >>>
> >>>  static int novmerge;
> >>> @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table
> >>> *tbl, size_t
> >> size,
> >>>         }
> >>>  }
> >>>
> >>> -#ifdef CONFIG_IOMMU_API
> >>> +#ifdef SPAPR_TCE_IOMMU
> >>>  /*
> >>>   * SPAPR TCE API
> >>>   */
> >>> ----------------------
> >>
> >>
> >> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print=
?
> >
> > It shows the list of group id and respective devices:
> >
>=20
> Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there?

It is 3.11-rc1 + (FSL_IOMMU + VFIO-PCI : local changes).

root@p5040ds:~# lspci
00:00.0 Class 0604: 1957:0450
01:00.0 Class 0200: 8086:10fb
00:00.0 Class 0604: 1957:0450
01:00.0 Class 0200: 8086:10d3


We uses the bus_set_iommu(), generic iommu api, which creates a iommu_group=
 for a device (drivers/iommu/iommu.c) using. Also this have notifier to sup=
port hotplug-able device.
So when this initcall (in arch/powerpc/kernel/iommu.c) is called, iommu gro=
up is already setup for the device/s.

I think we do not need this piece of code for powerpc.
So what is the best way to stub this out for FSL PowerPC/IOMMU?

Will the above #ifdef SPAPR_TCE_IOMMU work?
Other way can be selecting iommu.c and dma-iommu.c in Makefile if SPAPR_TCE=
_IOMMU defined and not if CONFIG_64BIT.

-Bharat

>=20
>=20
> --
> Alexey

^ permalink raw reply

* Re: Powerpc: Kernel warn_on when enabling IOMMU_API
From: Alexey Kardashevskiy @ 2013-08-13 12:54 UTC (permalink / raw)
  To: Bhushan Bharat-R65777; +Cc: linuxppc-dev@lists.ozlabs.org
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D0710F3DA@039-SN2MPN1-013.039d.mgd.msft.net>

On 08/13/2013 08:44 PM, Bhushan Bharat-R65777 wrote:
> 
> 
>> -----Original Message----- From: Alexey Kardashevskiy
>> [mailto:aik@ozlabs.ru] Sent: Tuesday, August 13, 2013 5:41 AM To:
>> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org;
>> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on
>> when enabling IOMMU_API
>> 
>> On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote:
>>> 
>>> 
>>>> -----Original Message----- From: Alexey Kardashevskiy
>>>> [mailto:aik@ozlabs.ru] Sent: Monday, August 12, 2013 7:44 PM To:
>>>> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org;
>>>> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on
>>>> when enabling IOMMU_API
>>>> 
>>>> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote:
>>>>> And this simple fix work for me diff --git
>>>>> a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
>>>>> index b20ff17..8869b0d 100644 --- a/arch/powerpc/kernel/iommu.c 
>>>>> +++ b/arch/powerpc/kernel/iommu.c @@ -48,6 +48,8 @@ #include
>>>>> <asm/vio.h> #include <asm/tce.h>
>>>>> 
>>>>> +#define DEBUG + #define DBG(...)
>>>>> 
>>>>> static int novmerge; @@ -871,7 +873,7 @@ void
>>>>> iommu_free_coherent(struct iommu_table *tbl, size_t
>>>> size,
>>>>> } }
>>>>> 
>>>>> -#ifdef CONFIG_IOMMU_API +#ifdef SPAPR_TCE_IOMMU /* * SPAPR TCE
>>>>> API */ ----------------------
>>>> 
>>>> 
>>>> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/"
>>>> print?
>>> 
>>> It shows the list of group id and respective devices:
>>> 
>> 
>> Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there?
> 
> It is 3.11-rc1 + (FSL_IOMMU + VFIO-PCI : local changes).
> 
> root@p5040ds:~# lspci
00:00.0 Class 0604: 1957:0450
01:00.0 Class 0200: 8086:10fb
00:00.0 Class 0604: 1957:0450
01:00.0 Class 0200: 8086:10d3


Is it one PCI domain or two PCI domains? Hm.

> We uses the bus_set_iommu(), generic iommu api, which creates a
> iommu_group for a device (drivers/iommu/iommu.c) using. Also this have
> notifier to support hotplug-able device. So when this initcall (in
> arch/powerpc/kernel/iommu.c) is called, iommu group is already setup for
> the device/s.

> I think we do not need this piece of code for powerpc. So what is the
> best way to stub this out for FSL PowerPC/IOMMU?


So you implemented iommu_ops? Can you share your code somewhere, just to
have a look?


> Will the above #ifdef SPAPR_TCE_IOMMU work? Other way can be selecting
> iommu.c and dma-iommu.c in Makefile if SPAPR_TCE_IOMMU defined and not
> if CONFIG_64BIT.

If SPAPR_TCE_IOMMU is enabled, the code would compile and the subsys_init
would be called anyway, so normal production kernel will fail anyway.



-- 
Alexey

^ permalink raw reply

* RE: Powerpc: Kernel warn_on when enabling IOMMU_API
From: Bhushan Bharat-R65777 @ 2013-08-13 15:30 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev@lists.ozlabs.org
In-Reply-To: <520A2C9E.7070004@ozlabs.ru>



> -----Original Message-----
> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru]
> Sent: Tuesday, August 13, 2013 6:25 PM
> To: Bhushan Bharat-R65777
> Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org
> Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API
>=20
> On 08/13/2013 08:44 PM, Bhushan Bharat-R65777 wrote:
> >
> >
> >> -----Original Message----- From: Alexey Kardashevskiy
> >> [mailto:aik@ozlabs.ru] Sent: Tuesday, August 13, 2013 5:41 AM To:
> >> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org;
> >> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on
> >> when enabling IOMMU_API
> >>
> >> On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote:
> >>>
> >>>
> >>>> -----Original Message----- From: Alexey Kardashevskiy
> >>>> [mailto:aik@ozlabs.ru] Sent: Monday, August 12, 2013 7:44 PM To:
> >>>> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org;
> >>>> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on
> >>>> when enabling IOMMU_API
> >>>>
> >>>> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote:
> >>>>> And this simple fix work for me diff --git
> >>>>> a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index
> >>>>> b20ff17..8869b0d 100644 --- a/arch/powerpc/kernel/iommu.c
> >>>>> +++ b/arch/powerpc/kernel/iommu.c @@ -48,6 +48,8 @@ #include
> >>>>> <asm/vio.h> #include <asm/tce.h>
> >>>>>
> >>>>> +#define DEBUG + #define DBG(...)
> >>>>>
> >>>>> static int novmerge; @@ -871,7 +873,7 @@ void
> >>>>> iommu_free_coherent(struct iommu_table *tbl, size_t
> >>>> size,
> >>>>> } }
> >>>>>
> >>>>> -#ifdef CONFIG_IOMMU_API +#ifdef SPAPR_TCE_IOMMU /* * SPAPR TCE
> >>>>> API */ ----------------------
> >>>>
> >>>>
> >>>> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/"
> >>>> print?
> >>>
> >>> It shows the list of group id and respective devices:
> >>>
> >>
> >> Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there?
> >
> > It is 3.11-rc1 + (FSL_IOMMU + VFIO-PCI : local changes).
> >
> > root@p5040ds:~# lspci
> 00:00.0 Class 0604: 1957:0450
> 01:00.0 Class 0200: 8086:10fb
> 00:00.0 Class 0604: 1957:0450
> 01:00.0 Class 0200: 8086:10d3
>=20
>=20
> Is it one PCI domain or two PCI domains? Hm.
>=20
> > We uses the bus_set_iommu(), generic iommu api, which creates a
> > iommu_group for a device (drivers/iommu/iommu.c) using. Also this have
> > notifier to support hotplug-able device. So when this initcall (in
> > arch/powerpc/kernel/iommu.c) is called, iommu group is already setup
> > for the device/s.
>=20
> > I think we do not need this piece of code for powerpc. So what is the
> > best way to stub this out for FSL PowerPC/IOMMU?
>=20
>=20
> So you implemented iommu_ops? Can you share your code somewhere, just to =
have a
> look?

https://lkml.org/lkml/2013/7/1/158

>=20
>=20
> > Will the above #ifdef SPAPR_TCE_IOMMU work? Other way can be selecting
> > iommu.c and dma-iommu.c in Makefile if SPAPR_TCE_IOMMU defined and not
> > if CONFIG_64BIT.
>=20
> If SPAPR_TCE_IOMMU is enabled, the code would compile and the subsys_init=
 would
> be called anyway, so normal production kernel will fail anyway.

We will not enable this on FSL powerpc,

-Bharat

>=20
>=20
>=20
> --
> Alexey

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Sudeep KarkadaNagesha @ 2013-08-13 15:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, rob.herring@calxeda.com,
	Benjamin Herrenschmidt, linuxppc-dev
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	Sudeep KarkadaNagesha, Viresh Kumar, linux-kernel@vger.kernel.org,
	Olof Johansson, linux-arm-kernel@lists.infradead.org
In-Reply-To: <3356439.a21MloFP7n@vostro.rjw.lan>

Adding PowerPC list

On 13/08/13 14:00, Rafael J. Wysocki wrote:
> On Monday, August 12, 2013 02:27:47 PM Sudeep KarkadaNagesha wrote:
>> The following changes since commit
>> d4e4ab86bcba5a72779c43dc1459f71fea3d89c8:
>>=20
>> Linux 3.11-rc5 (2013-08-11 18:04:20 -0700)
>>=20
>> are available in the git repository at:
>>=20
>> git://linux-arm.org/linux-skn.git cpu_of_node
>>=20
>> for you to fetch changes up to
>> 9e9e26dde91f22635c87d0e45f3938b5ded96f0d:
>>=20
>> cpufreq: pmac32-cpufreq: remove device tree parsing for cpu nodes=20
>> (2013-08-12 10:22:29 +0100)
>>=20
>> ----------------------------------------------------------------=20
>> Sudeep KarkadaNagesha (16): of: add support for retrieving cpu node
>> for a given logical cpu index ARM: DT/kernel: define ARM specific
>> arch_match_cpu_phys_id driver/core: cpu: initialize of_node in
>> cpu's device struture of/device: add helper to get cpu device node
>> from logical cpu index ARM: topology: remove hwid/MPIDR dependency
>> from cpu_capacity ARM: mvebu: remove device tree parsing for cpu
>> nodes drivers/bus: arm-cci: avoid parsing DT for cpu device nodes=20
>> cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes=20
>> cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes=20
>> cpufreq: highbank-cpufreq: remove device tree parsing for cpu
>> nodes cpufreq: spear-cpufreq: remove device tree parsing for cpu
>> nodes cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu
>> nodes cpufreq: arm_big_little: remove device tree parsing for cpu
>> nodes cpufreq: maple-cpufreq: remove device tree parsing for cpu
>> nodes cpufreq: pmac64-cpufreq: remove device tree parsing for cpu
>> nodes cpufreq: pmac32-cpufreq: remove device tree parsing for cpu
>> nodes
>>=20
>> arch/arm/kernel/devtree.c           |  5 +++++=20
>> arch/arm/kernel/topology.c          | 61=20
>> +++++++++++++++++++------------------------------------------=20
>> arch/arm/mach-imx/mach-imx6q.c      |  3 +--=20
>> arch/arm/mach-mvebu/platsmp.c       | 52=20
>> ++++++++++++++++++++++++----------------------------=20
>> drivers/base/cpu.c                  |  2 ++ drivers/bus/arm-cci.c
>> | 28 +++++++---------------------=20
>> drivers/cpufreq/arm_big_little_dt.c | 40=20
>> ++++++++++++++--------------------------=20
>> drivers/cpufreq/cpufreq-cpu0.c      | 23 ++++-------------------=20
>> drivers/cpufreq/highbank-cpufreq.c  | 18 ++++++------------=20
>> drivers/cpufreq/imx6q-cpufreq.c     |  4 +---=20
>> drivers/cpufreq/kirkwood-cpufreq.c  |  8 +++++---=20
>> drivers/cpufreq/maple-cpufreq.c     | 23 +++--------------------=20
>> drivers/cpufreq/pmac32-cpufreq.c    |  5 +++--=20
>> drivers/cpufreq/pmac64-cpufreq.c    | 47=20
>> +++++++++++------------------------------------=20
>> drivers/cpufreq/spear-cpufreq.c     |  4 ++-- drivers/of/base.c
>> | 73=20
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
+
>>
>>=20
include/linux/cpu.h                 |  1 +
>> include/linux/of.h                  |  6 ++++++=20
>> include/linux/of_device.h           | 15 +++++++++++++++ 19 files
>> changed, 202 insertions(+), 216 deletions(-)
>>=20
>>=20
>> PS: This patch series is reviewed and acknowledged @
>>=20
>> v1: https://lkml.org/lkml/2013/7/15/128 v2:
>> https://lkml.org/lkml/2013/7/17/341 v3:
>> https://lkml.org/lkml/2013/7/22/219
>=20
> Pulled, thanks!
>=20
Hi Rob, Rafael,

On 13/08/13 15:16, kbuild test robot wrote:> tree:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
bleeding-edge
> head:   0d4bcb5dc7d3040c0ce7572ea30ab9e5d9455bfa commit:
> 7939ff8d991de2c0b15064e76ee549a6df5ae67f [151/204] of: add
> support for retrieving cpu node for a given logical cpu index
> config: make ARCH=3Dpowerpc allmodconfig
>=20
> All error/warnings:
>=20
> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
> In file included from arch/powerpc/include/asm/kvm_para.h:26:0, from
> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,=20
> from include/linux/kvm_host.h:30, from
> arch/powerpc/kernel/asm-offsets.c:53:
> include/linux/of.h:269:28: error: conflicting types for
>'of_get_cpu_node'
> extern struct device_node *of_get_cpu_node(int cpu); ^ In file
> included from include/linux/of.h:139:0, from
> arch/powerpc/include/asm/kvm_para.h:26, from
> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,=20
> from include/linux/kvm_host.h:30, from
> arch/powerpc/kernel/asm-offsets.c:53:=20
> arch/powerpc/include/asm/prom.h:47:21: note: previous declaration
> of 'of_get_cpu_node' was here
> struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);=20
> ^ make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1 make[2]:
> Target `__build' not remade because of errors. make[1]: ***
> [prepare0] Error 2 make[1]: Target `prepare' not remade because of
> errors. make: *** [sub-make] Error 2
>=20

There seems to be conflict in the new function "of_get_cpu_node" added.
PowerPC also defines the same function name. Further microblaze and
openrisc declares it(can be removed) but doesn't define it.
To fix this:
1. I can rename the newly added function to something different like
   `of_get_cpunode` or
2. If of_* namespace should be used by only OF/FDT and not by any
   architecture specific code, then the arch specific version can be
   renamed to some thing like arch_of_get_cpu_node.
   Also most of the calls to arch specific function can be moved to
   generic code.

Let me know your thoughts.

Regards,
Sudeep

^ permalink raw reply

* Re: [alsa-devel] [PATCH v4 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver
From: Fabio Estevam @ 2013-08-13 17:58 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: devicetree, alsa-devel, lars, timur, rob.herring, broonie,
	p.zabel, Shawn Guo, linuxppc-dev
In-Reply-To: <1376308870-14232-2-git-send-email-b42378@freescale.com>

On Mon, Aug 12, 2013 at 9:01 AM, Nicolin Chen <b42378@freescale.com> wrote:
> +Required properties:
> +
> +  - compatible : Compatible list, contains "fsl,<chip>-spdif". Using general

Can't we just use "fsl,fsl-spdif" instead?

> +  "fsl,fsl-spdif" will get the default SoC type -- imx6q-spdif.
> +

I think this is not the usual approach we do with dt.

> +static const struct of_device_id fsl_spdif_dt_ids[] = {
> +       { .compatible = "fsl,fsl-spdif", },

Isn't only the first entry enough here?

> +       { .compatible = "fsl,imx6q-spdif", },
> +       { .compatible = "fsl,imx6sl-spdif", },
> +       { .compatible = "fsl,imx53-spdif", },
> +       {}
> +};
> +MODULE_DEVICE_TABLE(of, fsl_spdif_dt_ids);
> +
> +static struct platform_driver fsl_spdif_driver = {
> +       .driver = {
> +               .name = "fsl-spdif-dai",
> +               .owner = THIS_MODULE,
> +               .of_match_table = fsl_spdif_dt_ids,
> +       },
> +       .probe = fsl_spdif_probe,
> +       .remove = fsl_spdif_remove,
> +};
> +
> +module_platform_driver(fsl_spdif_driver);
> +
> +MODULE_AUTHOR("Freescale Semiconductor, Inc.");
> +MODULE_DESCRIPTION("Freescale S/PDIF CPU DAI Driver");
> +MODULE_LICENSE("GPL v2");
> +MODULE_ALIAS("platform:fsl_spdif");

This MODULE_ALIAS name does not match the name you provided earlier:

.name = "fsl-spdif-dai"

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Sudeep KarkadaNagesha @ 2013-08-13 18:29 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev@lists.ozlabs.org
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	Sudeep KarkadaNagesha, Viresh Kumar, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com, Rafael J. Wysocki, Olof Johansson,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <520A536C.3030600@arm.com>

On 13/08/13 16:40, Sudeep KarkadaNagesha wrote:
> Adding PowerPC list
>=20
> On 13/08/13 14:00, Rafael J. Wysocki wrote:
>> On Monday, August 12, 2013 02:27:47 PM Sudeep KarkadaNagesha wrote:
>>> The following changes since commit
>>> d4e4ab86bcba5a72779c43dc1459f71fea3d89c8:
>>>
>>> Linux 3.11-rc5 (2013-08-11 18:04:20 -0700)
>>>
>>> are available in the git repository at:
>>>
>>> git://linux-arm.org/linux-skn.git cpu_of_node
>>>
>>> for you to fetch changes up to
>>> 9e9e26dde91f22635c87d0e45f3938b5ded96f0d:
>>>
>>> cpufreq: pmac32-cpufreq: remove device tree parsing for cpu nodes=20
>>> (2013-08-12 10:22:29 +0100)
>>>
>>> ----------------------------------------------------------------=20
>>> Sudeep KarkadaNagesha (16): of: add support for retrieving cpu node
>>> for a given logical cpu index ARM: DT/kernel: define ARM specific
>>> arch_match_cpu_phys_id driver/core: cpu: initialize of_node in
>>> cpu's device struture of/device: add helper to get cpu device node
>>> from logical cpu index ARM: topology: remove hwid/MPIDR dependency
>>> from cpu_capacity ARM: mvebu: remove device tree parsing for cpu
>>> nodes drivers/bus: arm-cci: avoid parsing DT for cpu device nodes=20
>>> cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes=20
>>> cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes=20
>>> cpufreq: highbank-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: spear-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: arm_big_little: remove device tree parsing for cpu
>>> nodes cpufreq: maple-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: pmac64-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: pmac32-cpufreq: remove device tree parsing for cpu
>>> nodes
>>>
>>> arch/arm/kernel/devtree.c           |  5 +++++=20
>>> arch/arm/kernel/topology.c          | 61=20
>>> +++++++++++++++++++------------------------------------------=20
>>> arch/arm/mach-imx/mach-imx6q.c      |  3 +--=20
>>> arch/arm/mach-mvebu/platsmp.c       | 52=20
>>> ++++++++++++++++++++++++----------------------------=20
>>> drivers/base/cpu.c                  |  2 ++ drivers/bus/arm-cci.c
>>> | 28 +++++++---------------------=20
>>> drivers/cpufreq/arm_big_little_dt.c | 40=20
>>> ++++++++++++++--------------------------=20
>>> drivers/cpufreq/cpufreq-cpu0.c      | 23 ++++-------------------=20
>>> drivers/cpufreq/highbank-cpufreq.c  | 18 ++++++------------=20
>>> drivers/cpufreq/imx6q-cpufreq.c     |  4 +---=20
>>> drivers/cpufreq/kirkwood-cpufreq.c  |  8 +++++---=20
>>> drivers/cpufreq/maple-cpufreq.c     | 23 +++--------------------=20
>>> drivers/cpufreq/pmac32-cpufreq.c    |  5 +++--=20
>>> drivers/cpufreq/pmac64-cpufreq.c    | 47=20
>>> +++++++++++------------------------------------=20
>>> drivers/cpufreq/spear-cpufreq.c     |  4 ++-- drivers/of/base.c
>>> | 73=20
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
++
>>>
>>>
> include/linux/cpu.h                 |  1 +
>>> include/linux/of.h                  |  6 ++++++=20
>>> include/linux/of_device.h           | 15 +++++++++++++++ 19 files
>>> changed, 202 insertions(+), 216 deletions(-)
>>>
>>>
>>> PS: This patch series is reviewed and acknowledged @
>>>
>>> v1: https://lkml.org/lkml/2013/7/15/128 v2:
>>> https://lkml.org/lkml/2013/7/17/341 v3:
>>> https://lkml.org/lkml/2013/7/22/219
>>
>> Pulled, thanks!
>>
> Hi Rob, Rafael,
>=20
> On 13/08/13 15:16, kbuild test robot wrote:> tree:
> git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> bleeding-edge
>> head:   0d4bcb5dc7d3040c0ce7572ea30ab9e5d9455bfa commit:
>> 7939ff8d991de2c0b15064e76ee549a6df5ae67f [151/204] of: add
>> support for retrieving cpu node for a given logical cpu index
>> config: make ARCH=3Dpowerpc allmodconfig
>>
>> All error/warnings:
>>
>> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
>> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
>> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
>> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
>> In file included from arch/powerpc/include/asm/kvm_para.h:26:0, from
>> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,=20
>> from include/linux/kvm_host.h:30, from
>> arch/powerpc/kernel/asm-offsets.c:53:
>> include/linux/of.h:269:28: error: conflicting types for
>> 'of_get_cpu_node'
>> extern struct device_node *of_get_cpu_node(int cpu); ^ In file
>> included from include/linux/of.h:139:0, from
>> arch/powerpc/include/asm/kvm_para.h:26, from
>> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,=20
>> from include/linux/kvm_host.h:30, from
>> arch/powerpc/kernel/asm-offsets.c:53:=20
>> arch/powerpc/include/asm/prom.h:47:21: note: previous declaration
>> of 'of_get_cpu_node' was here
>> struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);=20
>> ^ make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1 make[2]:
>> Target `__build' not remade because of errors. make[1]: ***
>> [prepare0] Error 2 make[1]: Target `prepare' not remade because of
>> errors. make: *** [sub-make] Error 2
>>
>=20
> There seems to be conflict in the new function "of_get_cpu_node" added.
> PowerPC also defines the same function name. Further microblaze and
> openrisc declares it(can be removed) but doesn't define it.
> To fix this:
> 1. I can rename the newly added function to something different like
>    `of_get_cpunode` or
> 2. If of_* namespace should be used by only OF/FDT and not by any
>    architecture specific code, then the arch specific version can be
>    renamed to some thing like arch_of_get_cpu_node.
>    Also most of the calls to arch specific function can be moved to
>    generic code.
>=20
> Let me know your thoughts.

Hi Benjamin,

I don't understand completely the use of ibm,ppc-interrupt-server#s and
its implications on generic of_get_cpu_node implementation.
I see the PPC specific definition of of_get_cpu_node uses thread id only
in 2 instances. Based on that, I have tried to move all the other
instances to use generic definition.

Let me know if the idea is correct.

---->8--------

diff --git a/arch/powerpc/include/asm/prom.h
b/arch/powerpc/include/asm/prom.h
index 42ee294..b48bbfe 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -44,7 +44,7 @@ void of_parse_dma_window(struct device_node *dn, const
void *dma_window_prop,
 extern void kdump_move_device_tree(void);

 /* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
+struct device_node *arch_of_get_cpu_node_by_tid(int cpu, unsigned int
*thread);

 #ifdef CONFIG_NUMA
 extern int of_node_to_nid(struct device_node *device);
diff --git a/arch/powerpc/kernel/cacheinfo.c
b/arch/powerpc/kernel/cacheinfo.c
index 9262cf2..c60eef9 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -434,7 +434,7 @@ static struct cache
*cache_chain_instantiate(unsigned int cpu_id)

 =09pr_debug("creating cache object(s) for CPU %i\n", cpu_id);

-=09cpu_node =3D of_get_cpu_node(cpu_id, NULL);
+=09cpu_node =3D of_get_cpu_node(cpu_id);
 =09WARN_ONCE(!cpu_node, "no OF node found for CPU %i\n", cpu_id);
 =09if (!cpu_node)
 =09=09goto out;
@@ -764,7 +764,7 @@ static struct cache *cache_lookup_by_cpu(unsigned
int cpu_id)
 =09struct device_node *cpu_node;
 =09struct cache *cache;

-=09cpu_node =3D of_get_cpu_node(cpu_id, NULL);
+=09cpu_node =3D of_get_cpu_node(cpu_id);
 =09WARN_ONCE(!cpu_node, "no OF node found for CPU %i\n", cpu_id);
 =09if (!cpu_node)
 =09=09return NULL;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index af09e32..fe48a70 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -33,6 +33,7 @@
 #include <linux/irq.h>
 #include <linux/memblock.h>
 #include <linux/of.h>
+#include <linux/cpu.h>

 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -834,15 +835,23 @@ static int __init prom_reconfig_setup(void)
 __initcall(prom_reconfig_setup);
 #endif

+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+=09return phys_id =3D=3D get_hard_smp_processor_id(cpu);
+}
+
 /* Find the device node for a given logical cpu number, also returns
the cpu
  * local thread number (index in ibm,interrupt-server#s) if relevant and
  * asked for (non NULL)
  */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
+struct device_node *arch_of_get_cpunode_by_tid(int cpu, unsigned int
*thread)
 {
 =09int hardid;
 =09struct device_node *np;

+=09if (thread =3D=3D NULL)
+=09=09return of_get_cpu_node(cpu);
+
 =09hardid =3D get_hard_smp_processor_id(cpu);

 =09for_each_node_by_type(np, "cpu") {
@@ -855,14 +864,9 @@ struct device_node *of_get_cpu_node(int cpu,
unsigned int *thread)
 =09=09intserv =3D of_get_property(np, "ibm,ppc-interrupt-server#s",
 =09=09=09=09&plen);
 =09=09if (intserv =3D=3D NULL) {
-=09=09=09const u32 *reg =3D of_get_property(np, "reg", NULL);
-=09=09=09if (reg =3D=3D NULL)
-=09=09=09=09continue;
-=09=09=09if (*reg =3D=3D hardid) {
-=09=09=09=09if (thread)
-=09=09=09=09=09*thread =3D 0;
-=09=09=09=09return np;
-=09=09=09}
+=09=09=09np =3D of_get_cpu_node(cpu);
+=09=09=09*thread =3D 0;
+=09=09=09return np;
 =09=09} else {
 =09=09=09plen /=3D sizeof(u32);
 =09=09=09for (t =3D 0; t < plen; t++) {
@@ -876,7 +880,6 @@ struct device_node *of_get_cpu_node(int cpu,
unsigned int *thread)
 =09}
 =09return NULL;
 }
-EXPORT_SYMBOL(of_get_cpu_node);

 #if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
 static struct debugfs_blob_wrapper flat_dt_blob;
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 38b0ba6..cc0e3a27 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -560,7 +560,7 @@ int cpu_to_core_id(int cpu)
 =09const int *reg;
 =09int id =3D -1;

-=09np =3D of_get_cpu_node(cpu, NULL);
+=09np =3D of_get_cpu_node(cpu);
 =09if (!np)
 =09=09goto out;

@@ -598,7 +598,7 @@ static struct device_node *cpu_to_l2cache(int cpu)
 =09if (!cpu_present(cpu))
 =09=09return NULL;

-=09np =3D of_get_cpu_node(cpu, NULL);
+=09np =3D of_get_cpu_node(cpu);
 =09if (np =3D=3D NULL)
 =09=09return NULL;

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5850798..4b06158 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -520,7 +520,7 @@ static int of_drconf_to_nid_single(struct
of_drconf_cell *drmem,
 static int numa_setup_cpu(unsigned long lcpu)
 {
 =09int nid =3D 0;
-=09struct device_node *cpu =3D of_get_cpu_node(lcpu, NULL);
+=09struct device_node *cpu =3D of_get_cpu_node(lcpu);

 =09if (!cpu) {
 =09=09WARN_ON(1);
@@ -699,7 +699,7 @@ static int __init parse_numa_properties(void)
 =09=09struct device_node *cpu;
 =09=09int nid;

-=09=09cpu =3D of_get_cpu_node(i, NULL);
+=09=09cpu =3D of_get_cpu_node(i);
 =09=09BUG_ON(!cpu);
 =09=09nid =3D of_node_to_nid_single(cpu);
 =09=09of_node_put(cpu);
diff --git a/arch/powerpc/platforms/44x/currituck.c
b/arch/powerpc/platforms/44x/currituck.c
index 7f1b71a..84eb64e 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -98,7 +98,7 @@ static void smp_ppc47x_setup_cpu(int cpu)

 static int smp_ppc47x_kick_cpu(int cpu)
 {
-=09struct device_node *cpunode =3D of_get_cpu_node(cpu, NULL);
+=09struct device_node *cpunode =3D of_get_cpu_node(cpu);
 =09const u64 *spin_table_addr_prop;
 =09u32 *spin_table;
 =09extern void start_secondary_47x(void);
diff --git a/arch/powerpc/platforms/44x/iss4xx.c
b/arch/powerpc/platforms/44x/iss4xx.c
index 4241bc8..8195456 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -88,7 +88,7 @@ static void smp_iss4xx_setup_cpu(int cpu)

 static int smp_iss4xx_kick_cpu(int cpu)
 {
-=09struct device_node *cpunode =3D of_get_cpu_node(cpu, NULL);
+=09struct device_node *cpunode =3D of_get_cpu_node(cpu);
 =09const u64 *spin_table_addr_prop;
 =09u32 *spin_table;
 =09extern void start_secondary_47x(void);
diff --git a/arch/powerpc/platforms/85xx/smp.c
b/arch/powerpc/platforms/85xx/smp.c
index 5ced4f5..e32c532 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -156,7 +156,7 @@ static int smp_85xx_kick_cpu(int nr)

 =09pr_debug("smp_85xx_kick_cpu: kick CPU #%d\n", nr);

-=09np =3D of_get_cpu_node(nr, NULL);
+=09np =3D of_get_cpu_node(nr);
 =09cpu_rel_addr =3D of_get_property(np, "cpu-release-addr", NULL);

 =09if (cpu_rel_addr =3D=3D NULL) {
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c
b/arch/powerpc/platforms/cell/cbe_regs.c
index 1428d58..a055b74 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.c
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -182,7 +182,7 @@ static struct device_node *cbe_get_be_node(int cpu_id)
 =09=09=09return np;

 =09=09for (i=3D0; i<len; i++)
-=09=09=09if (of_find_node_by_phandle(cpu_handle[i]) =3D=3D
of_get_cpu_node(cpu_id, NULL))
+=09=09=09if (of_find_node_by_phandle(cpu_handle[i]) =3D=3D of_get_cpu_node=
(cpu_id))
 =09=09=09=09return np;
 =09}

@@ -240,7 +240,8 @@ void __init cbe_regs_init(void)

 =09/* Build local fast map of CPUs */
 =09for_each_possible_cpu(i) {
-=09=09cbe_thread_map[i].cpu_node =3D of_get_cpu_node(i, &thread_id);
+=09=09cbe_thread_map[i].cpu_node =3D
+=09=09=09=09arch_of_get_cpunode_by_tid(i, &thread_id);
 =09=09cbe_thread_map[i].be_node =3D cbe_get_be_node(i);
 =09=09cbe_thread_map[i].thread_id =3D thread_id;
 =09}
diff --git a/arch/powerpc/platforms/wsp/ics.c
b/arch/powerpc/platforms/wsp/ics.c
index 2d3b1dd..b83bc2e 100644
--- a/arch/powerpc/platforms/wsp/ics.c
+++ b/arch/powerpc/platforms/wsp/ics.c
@@ -137,7 +137,7 @@ void cpus_on_chip(int chip_id, cpumask_t *mask,
cpumask_t *ret)

 =09cpumask_clear(ret);
 =09for_each_cpu(cpu, mask) {
-=09=09cpu_dn =3D of_get_cpu_node(cpu, NULL);
+=09=09cpu_dn =3D of_get_cpu_node(cpu);
 =09=09if (!cpu_dn)
 =09=09=09continue;

@@ -649,7 +649,7 @@ static void __init wsp_ics_set_default_server(void)
 =09u32 hwid;

 =09/* Find the server number for the boot cpu. */
-=09np =3D of_get_cpu_node(boot_cpuid, NULL);
+=09np =3D of_get_cpu_node(boot_cpuid);
 =09BUG_ON(!np);

 =09hwid =3D get_hard_smp_processor_id(boot_cpuid);
diff --git a/arch/powerpc/platforms/wsp/smp.c
b/arch/powerpc/platforms/wsp/smp.c
index 332a18b..2abe794 100644
--- a/arch/powerpc/platforms/wsp/smp.c
+++ b/arch/powerpc/platforms/wsp/smp.c
@@ -40,7 +40,7 @@ int smp_a2_kick_cpu(int nr)
 =09if (nr < 0 || nr >=3D NR_CPUS)
 =09=09return -ENOENT;

-=09np =3D of_get_cpu_node(nr, &thr_idx);
+=09np =3D arch_of_get_cpunode_by_tid(nr, &thr_idx);
 =09if (!np)
 =09=09return -ENODEV;

diff --git a/arch/powerpc/platforms/wsp/wsp.c
b/arch/powerpc/platforms/wsp/wsp.c
index d25cc96..43a17a2 100644
--- a/arch/powerpc/platforms/wsp/wsp.c
+++ b/arch/powerpc/platforms/wsp/wsp.c
@@ -90,7 +90,7 @@ void wsp_halt(void)
 =09struct device_node *mine;
 =09struct device_node *me;

-=09me =3D of_get_cpu_node(smp_processor_id(), NULL);
+=09me =3D of_get_cpu_node(smp_processor_id());
 =09mine =3D scom_find_parent(me);

 =09/* This will halt all the A2s but not power off the chip */
diff --git a/arch/powerpc/sysdev/xics/xics-common.c
b/arch/powerpc/sysdev/xics/xics-common.c
index 9049d9f..d16082f 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -53,7 +53,7 @@ void xics_update_irq_servers(void)
 =09u32 hcpuid;

 =09/* Find the server numbers for the boot cpu. */
-=09np =3D of_get_cpu_node(boot_cpuid, NULL);
+=09np =3D of_get_cpu_node(boot_cpuid);
 =09BUG_ON(!np);

 =09hcpuid =3D get_hard_smp_processor_id(boot_cpuid);
diff --git a/drivers/cpufreq/pasemi-cpufreq.c
b/drivers/cpufreq/pasemi-cpufreq.c
index b704da4..692755f 100644
--- a/drivers/cpufreq/pasemi-cpufreq.c
+++ b/drivers/cpufreq/pasemi-cpufreq.c
@@ -149,7 +149,7 @@ static int pas_cpufreq_cpu_init(struct
cpufreq_policy *policy)
 =09struct device_node *cpu, *dn;
 =09int err =3D -ENODEV;

-=09cpu =3D of_get_cpu_node(policy->cpu, NULL);
+=09cpu =3D of_get_cpu_node(policy->cpu);

 =09if (!cpu)
 =09=09goto out;
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c
b/drivers/cpufreq/ppc-corenet-cpufreq.c
index 3cae452..64fb70a 100644
--- a/drivers/cpufreq/ppc-corenet-cpufreq.c
+++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
@@ -150,7 +150,7 @@ static int corenet_cpufreq_cpu_init(struct
cpufreq_policy *policy)
 =09struct cpu_data *data;
 =09unsigned int cpu =3D policy->cpu;

-=09np =3D of_get_cpu_node(cpu, NULL);
+=09np =3D of_get_cpu_node(cpu);
 =09if (!np)
 =09=09return -ENODEV;

diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c
b/drivers/cpufreq/ppc_cbe_cpufreq.c
index 5936f8d..0700445 100644
--- a/drivers/cpufreq/ppc_cbe_cpufreq.c
+++ b/drivers/cpufreq/ppc_cbe_cpufreq.c
@@ -75,7 +75,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy
*policy)
 =09int i, cur_pmode;
 =09struct device_node *cpu;

-=09cpu =3D of_get_cpu_node(policy->cpu, NULL);
+=09cpu =3D of_get_cpu_node(policy->cpu);

 =09if (!cpu)
 =09=09return -ENODEV;

^ permalink raw reply related

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Michal Simek @ 2013-08-13 18:37 UTC (permalink / raw)
  To: Sudeep KarkadaNagesha
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, rob.herring@calxeda.com,
	Rafael J. Wysocki, Viresh Kumar, Olof Johansson, linuxppc-dev,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <520A536C.3030600@arm.com>

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

On 08/13/2013 05:40 PM, Sudeep KarkadaNagesha wrote:
> Adding PowerPC list
> 
> On 13/08/13 14:00, Rafael J. Wysocki wrote:
>> On Monday, August 12, 2013 02:27:47 PM Sudeep KarkadaNagesha wrote:
>>> The following changes since commit
>>> d4e4ab86bcba5a72779c43dc1459f71fea3d89c8:
>>>
>>> Linux 3.11-rc5 (2013-08-11 18:04:20 -0700)
>>>
>>> are available in the git repository at:
>>>
>>> git://linux-arm.org/linux-skn.git cpu_of_node
>>>
>>> for you to fetch changes up to
>>> 9e9e26dde91f22635c87d0e45f3938b5ded96f0d:
>>>
>>> cpufreq: pmac32-cpufreq: remove device tree parsing for cpu nodes 
>>> (2013-08-12 10:22:29 +0100)
>>>
>>> ---------------------------------------------------------------- 
>>> Sudeep KarkadaNagesha (16): of: add support for retrieving cpu node
>>> for a given logical cpu index ARM: DT/kernel: define ARM specific
>>> arch_match_cpu_phys_id driver/core: cpu: initialize of_node in
>>> cpu's device struture of/device: add helper to get cpu device node
>>> from logical cpu index ARM: topology: remove hwid/MPIDR dependency
>>> from cpu_capacity ARM: mvebu: remove device tree parsing for cpu
>>> nodes drivers/bus: arm-cci: avoid parsing DT for cpu device nodes 
>>> cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes 
>>> cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes 
>>> cpufreq: highbank-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: spear-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: arm_big_little: remove device tree parsing for cpu
>>> nodes cpufreq: maple-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: pmac64-cpufreq: remove device tree parsing for cpu
>>> nodes cpufreq: pmac32-cpufreq: remove device tree parsing for cpu
>>> nodes
>>>
>>> arch/arm/kernel/devtree.c           |  5 +++++ 
>>> arch/arm/kernel/topology.c          | 61 
>>> +++++++++++++++++++------------------------------------------ 
>>> arch/arm/mach-imx/mach-imx6q.c      |  3 +-- 
>>> arch/arm/mach-mvebu/platsmp.c       | 52 
>>> ++++++++++++++++++++++++---------------------------- 
>>> drivers/base/cpu.c                  |  2 ++ drivers/bus/arm-cci.c
>>> | 28 +++++++--------------------- 
>>> drivers/cpufreq/arm_big_little_dt.c | 40 
>>> ++++++++++++++-------------------------- 
>>> drivers/cpufreq/cpufreq-cpu0.c      | 23 ++++------------------- 
>>> drivers/cpufreq/highbank-cpufreq.c  | 18 ++++++------------ 
>>> drivers/cpufreq/imx6q-cpufreq.c     |  4 +--- 
>>> drivers/cpufreq/kirkwood-cpufreq.c  |  8 +++++--- 
>>> drivers/cpufreq/maple-cpufreq.c     | 23 +++-------------------- 
>>> drivers/cpufreq/pmac32-cpufreq.c    |  5 +++-- 
>>> drivers/cpufreq/pmac64-cpufreq.c    | 47 
>>> +++++++++++------------------------------------ 
>>> drivers/cpufreq/spear-cpufreq.c     |  4 ++-- drivers/of/base.c
>>> | 73 
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>
>>>
> include/linux/cpu.h                 |  1 +
>>> include/linux/of.h                  |  6 ++++++ 
>>> include/linux/of_device.h           | 15 +++++++++++++++ 19 files
>>> changed, 202 insertions(+), 216 deletions(-)
>>>
>>>
>>> PS: This patch series is reviewed and acknowledged @
>>>
>>> v1: https://lkml.org/lkml/2013/7/15/128 v2:
>>> https://lkml.org/lkml/2013/7/17/341 v3:
>>> https://lkml.org/lkml/2013/7/22/219
>>
>> Pulled, thanks!
>>
> Hi Rob, Rafael,
> 
> On 13/08/13 15:16, kbuild test robot wrote:> tree:
> git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> bleeding-edge
>> head:   0d4bcb5dc7d3040c0ce7572ea30ab9e5d9455bfa commit:
>> 7939ff8d991de2c0b15064e76ee549a6df5ae67f [151/204] of: add
>> support for retrieving cpu node for a given logical cpu index
>> config: make ARCH=powerpc allmodconfig
>>
>> All error/warnings:
>>
>> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
>> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
>> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
>> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
>> In file included from arch/powerpc/include/asm/kvm_para.h:26:0, from
>> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4, 
>> from include/linux/kvm_host.h:30, from
>> arch/powerpc/kernel/asm-offsets.c:53:
>> include/linux/of.h:269:28: error: conflicting types for
>> 'of_get_cpu_node'
>> extern struct device_node *of_get_cpu_node(int cpu); ^ In file
>> included from include/linux/of.h:139:0, from
>> arch/powerpc/include/asm/kvm_para.h:26, from
>> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4, 
>> from include/linux/kvm_host.h:30, from
>> arch/powerpc/kernel/asm-offsets.c:53: 
>> arch/powerpc/include/asm/prom.h:47:21: note: previous declaration
>> of 'of_get_cpu_node' was here
>> struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); 
>> ^ make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1 make[2]:
>> Target `__build' not remade because of errors. make[1]: ***
>> [prepare0] Error 2 make[1]: Target `prepare' not remade because of
>> errors. make: *** [sub-make] Error 2
>>
> 
> There seems to be conflict in the new function "of_get_cpu_node" added.
> PowerPC also defines the same function name. Further microblaze and
> openrisc declares it(can be removed) but doesn't define it.

Feel free to remove it for Microblaze.
There was probably any reason why it was there.
Or maybe no reason and it was just there because Microblaze
was based on powerpc code.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Rob Herring @ 2013-08-13 18:44 UTC (permalink / raw)
  To: Sudeep KarkadaNagesha
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, rob.herring@calxeda.com,
	Rafael J. Wysocki, Viresh Kumar, Olof Johansson, linuxppc-dev,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <520A536C.3030600@arm.com>

On Tue, Aug 13, 2013 at 10:40 AM, Sudeep KarkadaNagesha
<Sudeep.KarkadaNagesha@arm.com> wrote:
> Adding PowerPC list
>
> On 13/08/13 14:00, Rafael J. Wysocki wrote:
>> On Monday, August 12, 2013 02:27:47 PM Sudeep KarkadaNagesha wrote:
>>> The following changes since commit
>>> d4e4ab86bcba5a72779c43dc1459f71fea3d89c8:
>>>
>>> Linux 3.11-rc5 (2013-08-11 18:04:20 -0700)
>>>
>>> are available in the git repository at:
>>>
>>> git://linux-arm.org/linux-skn.git cpu_of_node

[snip]

>> All error/warnings:
>>
>> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
>> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
>> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
>> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
>> In file included from arch/powerpc/include/asm/kvm_para.h:26:0, from
>> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,
>> from include/linux/kvm_host.h:30, from
>> arch/powerpc/kernel/asm-offsets.c:53:
>> include/linux/of.h:269:28: error: conflicting types for
>>'of_get_cpu_node'
>> extern struct device_node *of_get_cpu_node(int cpu); ^ In file
>> included from include/linux/of.h:139:0, from
>> arch/powerpc/include/asm/kvm_para.h:26, from
>> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,
>> from include/linux/kvm_host.h:30, from
>> arch/powerpc/kernel/asm-offsets.c:53:
>> arch/powerpc/include/asm/prom.h:47:21: note: previous declaration
>> of 'of_get_cpu_node' was here
>> struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
>> ^ make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1 make[2]:
>> Target `__build' not remade because of errors. make[1]: ***
>> [prepare0] Error 2 make[1]: Target `prepare' not remade because of
>> errors. make: *** [sub-make] Error 2
>>
>
> There seems to be conflict in the new function "of_get_cpu_node" added.
> PowerPC also defines the same function name. Further microblaze and
> openrisc declares it(can be removed) but doesn't define it.
> To fix this:
> 1. I can rename the newly added function to something different like
>    `of_get_cpunode` or
> 2. If of_* namespace should be used by only OF/FDT and not by any
>    architecture specific code, then the arch specific version can be
>    renamed to some thing like arch_of_get_cpu_node.
>    Also most of the calls to arch specific function can be moved to
>    generic code.
>
> Let me know your thoughts.

It is up to Rafael if he is willing/able to rebase his tree, but I
would drop this series until this is sorted out. I think the new
common function should be and can be generalized to work for powerpc.
It would need to make reg property optional and pass in the device
node to the arch specific function.

A short term solution would be just to make the function "#ifndef CONFIG_PPC".

Rob

^ permalink raw reply

* Re: [alsa-devel] [PATCH v4 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver
From: Fabio Estevam @ 2013-08-13 19:01 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: devicetree, alsa-devel, lars, timur, rob.herring, broonie,
	p.zabel, Shawn Guo, linuxppc-dev
In-Reply-To: <CAOMZO5A7noEb98yuCPY6o2mf-FikFcMYiDLpg3huPKHMO7Fwdw@mail.gmail.com>

On Tue, Aug 13, 2013 at 2:58 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Mon, Aug 12, 2013 at 9:01 AM, Nicolin Chen <b42378@freescale.com> wrote:
>> +Required properties:
>> +
>> +  - compatible : Compatible list, contains "fsl,<chip>-spdif". Using general
>
> Can't we just use "fsl,fsl-spdif" instead?

Or maybe "fsl,imx35-spdif", since mx35 was the first imx SoC with this
spdif IP block.

^ permalink raw reply

* Re: [alsa-devel] [PATCH v4 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver
From: Mark Brown @ 2013-08-13 19:02 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: devicetree, alsa-devel, lars, Nicolin Chen, timur, rob.herring,
	p.zabel, Shawn Guo, linuxppc-dev
In-Reply-To: <CAOMZO5A7noEb98yuCPY6o2mf-FikFcMYiDLpg3huPKHMO7Fwdw@mail.gmail.com>

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

On Tue, Aug 13, 2013 at 02:58:26PM -0300, Fabio Estevam wrote:
> On Mon, Aug 12, 2013 at 9:01 AM, Nicolin Chen <b42378@freescale.com> wrote:
> > +Required properties:

> > +  - compatible : Compatible list, contains "fsl,<chip>-spdif". Using general

> Can't we just use "fsl,fsl-spdif" instead?

It's better to list the specific chips in the DT so that we can quirk if
we need to later.  

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

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Rafael J. Wysocki @ 2013-08-13 19:45 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	Sudeep KarkadaNagesha, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com, Viresh Kumar, Olof Johansson,
	linuxppc-dev, linux-arm-kernel@lists.infradead.org
In-Reply-To: <CAL_JsqJdGXuTmb2kgBwgmRYGs9f92-dsawDXSXjmJW8cwjFVQQ@mail.gmail.com>

On Tuesday, August 13, 2013 01:44:23 PM Rob Herring wrote:
> On Tue, Aug 13, 2013 at 10:40 AM, Sudeep KarkadaNagesha
> <Sudeep.KarkadaNagesha@arm.com> wrote:
> > Adding PowerPC list
> >
> > On 13/08/13 14:00, Rafael J. Wysocki wrote:
> >> On Monday, August 12, 2013 02:27:47 PM Sudeep KarkadaNagesha wrote:
> >>> The following changes since commit
> >>> d4e4ab86bcba5a72779c43dc1459f71fea3d89c8:
> >>>
> >>> Linux 3.11-rc5 (2013-08-11 18:04:20 -0700)
> >>>
> >>> are available in the git repository at:
> >>>
> >>> git://linux-arm.org/linux-skn.git cpu_of_node
> 
> [snip]
> 
> >> All error/warnings:
> >>
> >> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
> >> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
> >> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC && MTD_NAND_FSL_UPM)
> >> selects FSL_LBC which has unmet direct dependencies (FSL_SOC)
> >> In file included from arch/powerpc/include/asm/kvm_para.h:26:0, from
> >> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,
> >> from include/linux/kvm_host.h:30, from
> >> arch/powerpc/kernel/asm-offsets.c:53:
> >> include/linux/of.h:269:28: error: conflicting types for
> >>'of_get_cpu_node'
> >> extern struct device_node *of_get_cpu_node(int cpu); ^ In file
> >> included from include/linux/of.h:139:0, from
> >> arch/powerpc/include/asm/kvm_para.h:26, from
> >> include/uapi/linux/kvm_para.h:26, from include/linux/kvm_para.h:4,
> >> from include/linux/kvm_host.h:30, from
> >> arch/powerpc/kernel/asm-offsets.c:53:
> >> arch/powerpc/include/asm/prom.h:47:21: note: previous declaration
> >> of 'of_get_cpu_node' was here
> >> struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
> >> ^ make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1 make[2]:
> >> Target `__build' not remade because of errors. make[1]: ***
> >> [prepare0] Error 2 make[1]: Target `prepare' not remade because of
> >> errors. make: *** [sub-make] Error 2
> >>
> >
> > There seems to be conflict in the new function "of_get_cpu_node" added.
> > PowerPC also defines the same function name. Further microblaze and
> > openrisc declares it(can be removed) but doesn't define it.
> > To fix this:
> > 1. I can rename the newly added function to something different like
> >    `of_get_cpunode` or
> > 2. If of_* namespace should be used by only OF/FDT and not by any
> >    architecture specific code, then the arch specific version can be
> >    renamed to some thing like arch_of_get_cpu_node.
> >    Also most of the calls to arch specific function can be moved to
> >    generic code.
> >
> > Let me know your thoughts.
> 
> It is up to Rafael if he is willing/able to rebase his tree, but I
> would drop this series until this is sorted out.

Yeah, I've just done that.

> I think the new common function should be and can be generalized to work for
> powerpc.
> It would need to make reg property optional and pass in the device
> node to the arch specific function.
> 
> A short term solution would be just to make the function "#ifndef CONFIG_PPC".

I wouldn't do that, it's almost guaranteed to be messy going forward.

I'd go for 1 above personally.

Thanks,
Rafael

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Benjamin Herrenschmidt @ 2013-08-13 21:03 UTC (permalink / raw)
  To: Sudeep KarkadaNagesha
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	Viresh Kumar, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com, Rafael J. Wysocki, Olof Johansson,
	linuxppc-dev, linux-arm-kernel@lists.infradead.org
In-Reply-To: <520A536C.3030600@arm.com>

On Tue, 2013-08-13 at 16:40 +0100, Sudeep KarkadaNagesha wrote:
> There seems to be conflict in the new function "of_get_cpu_node" added.
> PowerPC also defines the same function name. Further microblaze and
> openrisc declares it(can be removed) but doesn't define it.
> To fix this:
> 1. I can rename the newly added function to something different like
>    `of_get_cpunode` or
> 2. If of_* namespace should be used by only OF/FDT and not by any
>    architecture specific code, then the arch specific version can be
>    renamed to some thing like arch_of_get_cpu_node.
>    Also most of the calls to arch specific function can be moved to
>    generic code.
> 
> Let me know your thoughts.

What is your new function about ? Does it perform the same job as the
one in powerpc ? If yes, make sure you have the same signature and
either copy the powerpc one over to a generic place or make the generic
one weak if you don't want the powerpc thread counting logic.

Cheers,
Ben.

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Benjamin Herrenschmidt @ 2013-08-13 21:07 UTC (permalink / raw)
  To: Sudeep KarkadaNagesha
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	Viresh Kumar, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com, Rafael J. Wysocki, Olof Johansson,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <520A7B00.8060405@arm.com>

On Tue, 2013-08-13 at 19:29 +0100, Sudeep KarkadaNagesha wrote:
> I don't understand completely the use of ibm,ppc-interrupt-server#s and
> its implications on generic of_get_cpu_node implementation.
> I see the PPC specific definition of of_get_cpu_node uses thread id only
> in 2 instances. Based on that, I have tried to move all the other
> instances to use generic definition.
> 
> Let me know if the idea is correct.

No. The device-tree historically only represents cores, not HW threads, so
it makes sense to retrieve also the thread number corresponding to the CPU.

However, the mechanism to represent HW threads in the device-tree is currently
somewhat platform specific (the ibm,ppc-interrupt-server#s).

So what you could do for now is:

 - Have a generic version that always returns 0 as the thread, which is weak

 - powerpc keeps its own implementation

 - Start a discussion on the bindings (if not already there) to define threads
in a better way at which point the generic function can be updated.

Cheers,
Ben.

^ permalink raw reply

* Re: [GIT PULL] DT/core: cpu_ofnode updates for v3.12
From: Benjamin Herrenschmidt @ 2013-08-13 21:08 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	Sudeep KarkadaNagesha, Viresh Kumar, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com, Rafael J. Wysocki, Olof Johansson,
	linuxppc-dev, linux-arm-kernel@lists.infradead.org
In-Reply-To: <CAL_JsqJdGXuTmb2kgBwgmRYGs9f92-dsawDXSXjmJW8cwjFVQQ@mail.gmail.com>

On Tue, 2013-08-13 at 13:44 -0500, Rob Herring wrote:
> It is up to Rafael if he is willing/able to rebase his tree, but I
> would drop this series until this is sorted out. I think the new
> common function should be and can be generalized to work for powerpc.
> It would need to make reg property optional and pass in the device
> node to the arch specific function.
> 
> A short term solution would be just to make the function "#ifndef
> CONFIG_PPC".

Please, no ifdef's with different signatures. Let's agree on the
prototype first (ie, thread output argument) and make the generic
one weak.

Cheers,
Ben.

^ 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