Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Sebastian Hesselbarth

On 02/12/2014 01:21 AM, Stephen N Chivers wrote:

Sebastian Hesselbarth sebastian.hesselba...@gmail.com wrote on
02/12/2014 10:46:36 AM:


From: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
To: Scott Wood scottw...@freescale.com
Cc: Kumar Gala ga...@kernel.crashing.org, Stephen N Chivers
schiv...@csc.com.au, Chris Proctor cproc...@csc.com.au,
linuxppc-dev@lists.ozlabs.org, Arnd Bergmann a...@arndb.de,
devicetree devicet...@vger.kernel.org
Date: 02/12/2014 11:04 AM
Subject: Re: Linux-3.14-rc2: Order of serial node compatibles in DTS

files.


On 02/12/2014 12:41 AM, Scott Wood wrote:


Regardless of whether .type = serial gets removed, it seems wrong for
of_match_node() to accept a .type-only match (or .name, or anything else
that doesn't involve .compatible) before it accepts a compatible match
other than the first in the compatible property.


Right, I thought about it and came to the same conclusion. I sent a
patch a second ago to prefer .compatible != NULL matches over those
with .compatible == NULL.

Would be great if Stephen can re-test that. If it solves the issue, I
can send a patch tomorrow.

Done.

But, the Interrupt Controller (MPIC)
goes AWOL and it is down hill from there.

The MPIC is specified in the DTS as:

 mpic: pic@4 {
 interrupt-controller;
 #address-cells = 0;
 #interrupt-cells = 2;
 reg = 0x4 0x4;
 compatible = chrp,open-pic;
 device_type = open-pic;
 big-endian;
 };

The board support file has the standard mechanism for allocating
the PIC:

 struct mpic *mpic;

 mpic = mpic_alloc(NULL, 0, 0, 0, 256,  OpenPIC  );
 BUG_ON(mpic == NULL);

 mpic_init(mpic);

I checked for damage in applying the patch and it has applied
correctly.


Hmm, I did a mistake in the patch:

-   while (m-name[0] || m-type[0]) {
+   while (m-compatible[0] || m-name[0] || m-type[0]) {

for the second added match. Otherwise, the matches are not
evaluated down to the sentinel but the loop quits on the first
match table entry without .name and .type set.

Sebastian
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Sebastian Hesselbarth

On 02/12/2014 06:28 AM, Kevin Hao wrote:

On Wed, Feb 12, 2014 at 10:21:58AM +1000, Stephen N Chivers wrote:

But, the Interrupt Controller (MPIC)
goes AWOL and it is down hill from there.

The MPIC is specified in the DTS as:

 mpic: pic@4 {
 interrupt-controller;
 #address-cells = 0;
 #interrupt-cells = 2;
 reg = 0x4 0x4;
 compatible = chrp,open-pic;
 device_type = open-pic;
 big-endian;
 };

The board support file has the standard mechanism for allocating
the PIC:

 struct mpic *mpic;

 mpic = mpic_alloc(NULL, 0, 0, 0, 256,  OpenPIC  );
 BUG_ON(mpic == NULL);

 mpic_init(mpic);

I checked for damage in applying the patch and it has applied
correctly.


How about the following fix?

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ff85450d5683..ca91984d3c4b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -730,32 +730,40 @@ out:
  }
  EXPORT_SYMBOL(of_find_node_with_property);

+static int of_match_type_name(const struct device_node *node,
+   const struct of_device_id *m)


I am fine with having a sub-function here, but it should rather be
named of_match_type_or_name.


+{
+   int match = 1;
+
+   if (m-name[0])
+   match = node-name  !strcmp(m-name, node-name);
+
+   if (m-type[0])
+   match = node-type  !strcmp(m-type, node-type);
+
+   return match;
+}

[...]

+   /* Check against matches without compatible string */
+   m = matches;
+   while (!m-compatible[0]  (m-name[0] || m-type[0])) {


We shouldn't check for anything else than the sentinel here.
Although I guess yours will not quit early as mine did but that
way we don't have to worry about it.

Sebastian


+   match = of_match_type_name(node, m);
+   if (match)
+   return m;
+   m++;
+   }
+
return NULL;
  }



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc: set the correct ksp_limit on ppc32 when switching to irq stack

2014-02-12 Thread Benjamin Herrenschmidt
On Wed, 2014-02-12 at 13:51 +0800, Kevin Hao wrote:
 On Wed, Jan 22, 2014 at 08:48:48AM +1100, Benjamin Herrenschmidt wrote:
  It will be merged when I come back from vacation. It was too late for
  3.13 so I'll send it to Linus next week and will CC -stable.
 
 Hi Ben,
 
 Any reason why this is still not merged yet?

No other than for some reason I missed it in patchwork when I did my
shopping from it yesterday.

I've added it to a bundle so I won't forget on my next round.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Kevin Hao
On Wed, Feb 12, 2014 at 09:30:00AM +0100, Sebastian Hesselbarth wrote:
 On 02/12/2014 06:28 AM, Kevin Hao wrote:
 On Wed, Feb 12, 2014 at 10:21:58AM +1000, Stephen N Chivers wrote:
 But, the Interrupt Controller (MPIC)
 goes AWOL and it is down hill from there.
 
 The MPIC is specified in the DTS as:
 
  mpic: pic@4 {
  interrupt-controller;
  #address-cells = 0;
  #interrupt-cells = 2;
  reg = 0x4 0x4;
  compatible = chrp,open-pic;
  device_type = open-pic;
  big-endian;
  };
 
 The board support file has the standard mechanism for allocating
 the PIC:
 
  struct mpic *mpic;
 
  mpic = mpic_alloc(NULL, 0, 0, 0, 256,  OpenPIC  );
  BUG_ON(mpic == NULL);
 
  mpic_init(mpic);
 
 I checked for damage in applying the patch and it has applied
 correctly.
 
 How about the following fix?
 
 diff --git a/drivers/of/base.c b/drivers/of/base.c
 index ff85450d5683..ca91984d3c4b 100644
 --- a/drivers/of/base.c
 +++ b/drivers/of/base.c
 @@ -730,32 +730,40 @@ out:
   }
   EXPORT_SYMBOL(of_find_node_with_property);
 
 +static int of_match_type_name(const struct device_node *node,
 +const struct of_device_id *m)
 
 I am fine with having a sub-function here, but it should rather be
 named of_match_type_or_name.

OK.

 
 +{
 +int match = 1;
 +
 +if (m-name[0])
 +match = node-name  !strcmp(m-name, node-name);
 +
 +if (m-type[0])
 +match = node-type  !strcmp(m-type, node-type);
 +
 +return match;
 +}
 [...]
 +/* Check against matches without compatible string */
 +m = matches;
 +while (!m-compatible[0]  (m-name[0] || m-type[0])) {
 
 We shouldn't check for anything else than the sentinel here.
 Although I guess yours will not quit early as mine did but that
 way we don't have to worry about it.

Yes, this is still buggy. I will change something like this:

m = matches;
/* Check against matches without compatible string */
while (m-name[0] || m-type[0] || m-compatible[0]) {
if (m-compatible[0]) {
m++;
continue;
}

match = of_match_type_name(node, m);
if (match)
return m;
m++;
}

Thanks,
Kevin


pgps8ftEWKrhl.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Kevin Hao
On Wed, Feb 12, 2014 at 09:25:24AM +0100, Sebastian Hesselbarth wrote:
 
 Hmm, I did a mistake in the patch:
 
 - while (m-name[0] || m-type[0]) {
 + while (m-compatible[0] || m-name[0] || m-type[0]) {
 
 for the second added match. Otherwise, the matches are not
 evaluated down to the sentinel but the loop quits on the first
 match table entry without .name and .type set.

But this is still not right. We also need to skip the matches with
.compatible here.

Thanks,
Kevin
 
 Sebastian
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/linuxppc-dev


pgpwFO4K17beE.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Arnd Bergmann
On Wednesday 12 February 2014, Sebastian Hesselbarth wrote:
 On 02/12/2014 12:38 AM, Stephen N Chivers wrote:
  Sebastian Hesselbarth sebastian.hesselba...@gmail.com wrote on

  I don't think the missing compatible is causing it, but of_serial
  provides a DT match for .type = serial just to fail later on
  with the error seen above.
 
  The commit in question reorders of_match_device in a way that match
  table order is not relevant anymore. This can cause it to match
  .type = serial first here.
 
  Rather than touching the commit, I suggest to remove the problematic
  .type = serial from the match table. It is of no use anyway.
  Deleting the serial line from the match table fixes the problem.
  I tested it for both orderings of compatible.
 
 I revert my statement about removing anything from of_serial.c. Instead
 we should try to prefer matches with compatibles over type/name without
 compatibles. Something like the patch below (compile tested only)

That would probably be a good idea. However, I think in this
case we also want to remove the line from the driver, as it clearly
never works on any hardware and the driver just errors out for the
device_type match.

Arnd
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Sebastian Hesselbarth

On 02/12/14 11:31, Kevin Hao wrote:

On Wed, Feb 12, 2014 at 09:30:00AM +0100, Sebastian Hesselbarth wrote:

On 02/12/2014 06:28 AM, Kevin Hao wrote:

On Wed, Feb 12, 2014 at 10:21:58AM +1000, Stephen N Chivers wrote:

But, the Interrupt Controller (MPIC)
goes AWOL and it is down hill from there.

The MPIC is specified in the DTS as:

 mpic: pic@4 {
 interrupt-controller;
 #address-cells = 0;
 #interrupt-cells = 2;
 reg = 0x4 0x4;
 compatible = chrp,open-pic;
 device_type = open-pic;
 big-endian;
 };

The board support file has the standard mechanism for allocating
the PIC:

 struct mpic *mpic;

 mpic = mpic_alloc(NULL, 0, 0, 0, 256,  OpenPIC  );
 BUG_ON(mpic == NULL);

 mpic_init(mpic);

I checked for damage in applying the patch and it has applied
correctly.


How about the following fix?

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ff85450d5683..ca91984d3c4b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -730,32 +730,40 @@ out:
  }
  EXPORT_SYMBOL(of_find_node_with_property);

+static int of_match_type_name(const struct device_node *node,
+   const struct of_device_id *m)


I am fine with having a sub-function here, but it should rather be
named of_match_type_or_name.


OK.




+{
+   int match = 1;
+
+   if (m-name[0])
+   match = node-name  !strcmp(m-name, node-name);
+
+   if (m-type[0])
+   match = node-type  !strcmp(m-type, node-type);
+
+   return match;
+}

[...]

+   /* Check against matches without compatible string */
+   m = matches;
+   while (!m-compatible[0]  (m-name[0] || m-type[0])) {


We shouldn't check for anything else than the sentinel here.
Although I guess yours will not quit early as mine did but that
way we don't have to worry about it.


Yes, this is still buggy. I will change something like this:

m = matches;
/* Check against matches without compatible string */
while (m-name[0] || m-type[0] || m-compatible[0]) {
if (m-compatible[0]) {
m++;
continue;
}

match = of_match_type_name(node, m);
if (match)
return m;
m++;
}


You can cook it down to:

m = matches;
/* Check against matches without compatible string */
while (m-name[0] || m-type[0] || m-compatible[0]) {
if (!m-compatible[0]  of_match_type_or_name(node, m)
return m;
m++;
}





___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Kevin Hao
On Wed, Feb 12, 2014 at 12:26:14PM +0100, Sebastian Hesselbarth wrote:
 You can cook it down to:
 
   m = matches;
   /* Check against matches without compatible string */
   while (m-name[0] || m-type[0] || m-compatible[0]) {
   if (!m-compatible[0]  of_match_type_or_name(node, m)
   return m;
   m++;
   }

Will do.

Thanks,
Kevin


pgpEyfZ_1f1QZ.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] of: give priority to the compatible match in __of_match_node()

2014-02-12 Thread Kevin Hao
When the device node do have a compatible property, we definitely
prefer the compatible match besides the type and name. Only if
there is no such a match, we then consider the candidate which
doesn't have compatible entry but do match the type or name with
the device node.

This is based on a patch from Sebastian Hesselbarth.
  http://patchwork.ozlabs.org/patch/319434/

I did some code refactoring and also fixed a bug in the original patch.

Cc: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
Signed-off-by: Kevin Hao haoke...@gmail.com
---
 drivers/of/base.c | 55 +--
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ff85450d5683..9d655df458bd 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+   const struct of_device_id *m)
+{
+   int match = 1;
+
+   if (m-name[0])
+   match = node-name  !strcmp(m-name, node-name);
+
+   if (m-type[0])
+   match = node-type  !strcmp(m-type, node-type);
+
+   return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
   const struct device_node *node)
 {
const char *cp;
int cplen, l;
+   const struct of_device_id *m;
+   int match;
 
if (!matches)
return NULL;
 
cp = __of_get_property(node, compatible, cplen);
-   do {
-   const struct of_device_id *m = matches;
+   while (cp  (cplen  0)) {
+   m = matches;
 
/* Check against matches with current compatible string */
while (m-name[0] || m-type[0] || m-compatible[0]) {
-   int match = 1;
-   if (m-name[0])
-   match = node-name
-!strcmp(m-name, node-name);
-   if (m-type[0])
-   match = node-type
-!strcmp(m-type, node-type);
-   if (m-compatible[0])
-   match = cp
-!of_compat_cmp(m-compatible, cp,
+   if (!m-compatible[0]) {
+   m++;
+   continue;
+   }
+
+   match = of_match_type_or_name(node, m);
+   match = cp  !of_compat_cmp(m-compatible, cp,
strlen(m-compatible));
if (match)
return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct 
of_device_id *matches,
}
 
/* Get node's next compatible string */ 
-   if (cp) {
-   l = strlen(cp) + 1;
-   cp += l;
-   cplen -= l;
-   }
-   } while (cp  (cplen  0));
+   l = strlen(cp) + 1;
+   cp += l;
+   cplen -= l;
+   }
+
+   m = matches;
+   /* Check against matches without compatible string */
+   while (m-name[0] || m-type[0] || m-compatible[0]) {
+   if (!m-compatible[0]  of_match_type_or_name(node, m))
+   return m;
+   m++;
+   }
 
return NULL;
 }
-- 
1.8.5.3

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH RFC v7 1/6] dma: mpc512x: reorder mpc8308 specific instructions

2014-02-12 Thread Alexander Popov
Concentrate the specific code for MPC8308 in the 'if' branch
and handle MPC512x in the 'else' branch.
This modification only reorders instructions but doesn't change behaviour.

Signed-off-by: Alexander Popov a13xp0p0...@gmail.com
Acked-by: Anatolij Gustschin ag...@denx.de
Acked-by: Gerhard Sittig g...@denx.de
---
 drivers/dma/mpc512x_dma.c | 42 +-
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 448750d..2ce248b 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -52,9 +52,17 @@
 #define MPC_DMA_DESCRIPTORS64
 
 /* Macro definitions */
-#define MPC_DMA_CHANNELS   64
 #define MPC_DMA_TCD_OFFSET 0x1000
 
+/*
+ * Maximum channel counts for individual hardware variants
+ * and the maximum channel count over all supported controllers,
+ * used for data structure size
+ */
+#define MPC8308_DMACHAN_MAX16
+#define MPC512x_DMACHAN_MAX64
+#define MPC_DMA_CHANNELS   64
+
 /* Arbitration mode of group and channel */
 #define MPC_DMA_DMACR_EDCG (1  31)
 #define MPC_DMA_DMACR_ERGA (1  3)
@@ -710,10 +718,10 @@ static int mpc_dma_probe(struct platform_device *op)
 
dma = mdma-dma;
dma-dev = dev;
-   if (!mdma-is_mpc8308)
-   dma-chancnt = MPC_DMA_CHANNELS;
+   if (mdma-is_mpc8308)
+   dma-chancnt = MPC8308_DMACHAN_MAX;
else
-   dma-chancnt = 16; /* MPC8308 DMA has only 16 channels */
+   dma-chancnt = MPC512x_DMACHAN_MAX;
dma-device_alloc_chan_resources = mpc_dma_alloc_chan_resources;
dma-device_free_chan_resources = mpc_dma_free_chan_resources;
dma-device_issue_pending = mpc_dma_issue_pending;
@@ -747,7 +755,19 @@ static int mpc_dma_probe(struct platform_device *op)
 * - Round-robin group arbitration,
 * - Round-robin channel arbitration.
 */
-   if (!mdma-is_mpc8308) {
+   if (mdma-is_mpc8308) {
+   /* MPC8308 has 16 channels and lacks some registers */
+   out_be32(mdma-regs-dmacr, MPC_DMA_DMACR_ERCA);
+
+   /* enable snooping */
+   out_be32(mdma-regs-dmagpor, MPC_DMA_DMAGPOR_SNOOP_ENABLE);
+   /* Disable error interrupts */
+   out_be32(mdma-regs-dmaeeil, 0);
+
+   /* Clear interrupts status */
+   out_be32(mdma-regs-dmaintl, 0x);
+   out_be32(mdma-regs-dmaerrl, 0x);
+   } else {
out_be32(mdma-regs-dmacr, MPC_DMA_DMACR_EDCG |
MPC_DMA_DMACR_ERGA | 
MPC_DMA_DMACR_ERCA);
 
@@ -768,18 +788,6 @@ static int mpc_dma_probe(struct platform_device *op)
/* Route interrupts to IPIC */
out_be32(mdma-regs-dmaihsa, 0);
out_be32(mdma-regs-dmailsa, 0);
-   } else {
-   /* MPC8308 has 16 channels and lacks some registers */
-   out_be32(mdma-regs-dmacr, MPC_DMA_DMACR_ERCA);
-
-   /* enable snooping */
-   out_be32(mdma-regs-dmagpor, MPC_DMA_DMAGPOR_SNOOP_ENABLE);
-   /* Disable error interrupts */
-   out_be32(mdma-regs-dmaeeil, 0);
-
-   /* Clear interrupts status */
-   out_be32(mdma-regs-dmaintl, 0x);
-   out_be32(mdma-regs-dmaerrl, 0x);
}
 
/* Register DMA engine */
-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH RFC v7 0/6] MPC512x DMA slave s/g support, OF DMA lookup

2014-02-12 Thread Alexander Popov
v2013/7/14 Gerhard Sittig g...@denx.de:
 this series
 - introduces slave s/g support (that's support for DMA transfers which
involve peripherals in contrast to mem-to-mem transfers)
 - adds device tree based lookup support for DMA channels
 - combines floating patches and related feedback which already covered
several aspects of what the suggested LPB driver needs, to demonstrate
how integration might be done
 - carries QD SD card support to enable another DMA client during test,
while this patch needs to get dropped upon pickup

Changes in v2:
 - re-order mpc8308 related code paths for improved readability, no
change in behaviour, introduction of symbolic channel names here
already
 - squash 'execute() start condition' and 'terminate all' into the
introduction of 'slave s/g prep' and 'device control' support; refuse
s/g lists with more than one item since slave support is operational
yet proper s/g support is missing (can get addressed later)
 - always start transfers from software on MPC8308 as there are no
external request lines for peripheral flow control
 - drop dt-bindings header file and symbolic channel names in OF nodes

Changes in v3 and v4:
 Part 1/5:
 - use #define instead of enum since individual channels don't require
special handling.
 Part 2/5:
 - add a flag will_access_peripheral to DMA transfer descriptor
according recommendations of Gerhard Sittig.
This flag is set in mpc_dma_prep_memcpy() and mpc_dma_prep_slave_sg()
and is evaluated in mpc_dma_execute() to choose a type of start for
the transfer.
 - prevent descriptors of transfers which involve peripherals from
being chained together;
each of such transfers needs hardware initiated start.
 - add locking while working with struct mpc_dma_chan
according recommendations of Lars-Peter Clausen.
 - remove default nbytes value. Client kernel modules must set
src_maxburst and dst_maxburst fields of struct dma_slave_config 
(dmaengine.h).

Changes in v5:
 Part 2/5:
 - add and improve comments;
 - improve the code moving transfer descriptors from 'queued' to 'active' list
in mpc_dma_execute();
 - allow mpc_dma_prep_slave_sg() to run with non-empty 'active' list;
 - take 'mdesc' back to 'free' list in case of error in mpc_dma_prep_slave_sg();
 - improve checks of the transfer parameters;
 - provide the default value for 'maxburst' in mpc_dma_device_control().

Changes in v6:
 Part 2/5:
 - remove doubtful comment;
 - fix coding style issues;
 - set default value for 'maxburst' to 1 which applies to most cases;
 Part 3/5:
 - use dma_get_slave_channel() instead of dma_request_channel()
in new function of_dma_xlate_by_chan_id() according recommendations of
Arnd Bergmann;
 Part 4/5:
 - set DMA_PRIVATE flag for MPC512x DMA controller since its driver relies on
of_dma_xlate_by_chan_id() which doesn't use dma_request_channel()
any more; (removed in v7)
 - resolve little patch conflict;
 Part 5/5:
 - resolve little patch conflict;

Changes in v7:
 Part 2:
 - improve comment;
 Part 4:
 - split in two separate patches. Part 4/6 contains device tree
binding document and in part 5/6 MPC512x DMA controller is registered
for device tree channel lookup;
 - remove setting DMA_PRIVATE flag for MPC512x DMA controller from part 5/6;

 known issues:
 - it's yet to get confirmed whether MPC8308 can use slave support or
whether the DMA controller's driver shall actively reject it, the
information that's available so far suggests that peripheral transfers
to IP bus attached I/O is useful and shall not get blocked right away
 - adding support for transfers which don't increment the RAM address or
do increment the peripheral port's address is easy with
this implementation; but which options of the common API
should be used for specifying such transfers?
 - device tree binding document for the MPC512x DMA controller needs
to be improved.


Alexander Popov (3):
  dma: mpc512x: reorder mpc8308 specific instructions
  dma: mpc512x: add support for peripheral transfers
  dma: of: Add common xlate function for matching by channel id

Gerhard Sittig (3):
  dma: mpc512x: add device tree binding document
  dma: mpc512x: register for device tree channel lookup
  HACK mmc: mxcmmc: enable clocks for the MPC512x

 .../devicetree/bindings/dma/mpc512x-dma.txt|  55 
 arch/powerpc/boot/dts/mpc5121.dtsi |   1 +
 drivers/dma/mpc512x_dma.c  | 293 +++--
 drivers/dma/of-dma.c   |  35 +++
 drivers/mmc/host/mxcmmc.c  |  42 ++-
 include/linux/of_dma.h |   4 +
 6 files changed, 391 insertions(+), 39 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/mpc512x-dma.txt

-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org

[PATCH RFC v7 2/6] dma: mpc512x: add support for peripheral transfers

2014-02-12 Thread Alexander Popov
Introduce support for slave s/g transfer preparation and the associated
device control callback in the MPC512x DMA controller driver, which adds
support for data transfers between memory and peripheral I/O to the
previously supported mem-to-mem transfers.

Signed-off-by: Alexander Popov a13xp0p0...@gmail.com
---
 drivers/dma/mpc512x_dma.c | 230 +-
 1 file changed, 225 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 2ce248b..b978ef1 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -2,6 +2,7 @@
  * Copyright (C) Freescale Semicondutor, Inc. 2007, 2008.
  * Copyright (C) Semihalf 2009
  * Copyright (C) Ilya Yanok, Emcraft Systems 2010
+ * Copyright (C) Alexander Popov, Promcontroller 2013
  *
  * Written by Piotr Ziecik ko...@semihalf.com. Hardware description
  * (defines, structures and comments) was taken from MPC5121 DMA driver
@@ -29,8 +30,15 @@
  */
 
 /*
- * This is initial version of MPC5121 DMA driver. Only memory to memory
- * transfers are supported (tested using dmatest module).
+ * MPC512x and MPC8308 DMA driver. It supports
+ * memory to memory data transfers (tested using dmatest module) and
+ * data transfers between memory and peripheral I/O memory
+ * by means of slave s/g with these limitations:
+ * - chunked transfers (transfers with more than one part) are refused
+ * as long as proper support for scatter/gather is missing;
+ * - transfers on MPC8308 always start from software as this SoC appears
+ * not to have external request lines for peripheral flow control;
+ * - minimal memory - I/O memory transfer size is 4 bytes.
  */
 
 #include linux/module.h
@@ -189,6 +197,7 @@ struct mpc_dma_desc {
dma_addr_t  tcd_paddr;
int error;
struct list_headnode;
+   int will_access_peripheral;
 };
 
 struct mpc_dma_chan {
@@ -201,6 +210,10 @@ struct mpc_dma_chan {
struct mpc_dma_tcd  *tcd;
dma_addr_t  tcd_paddr;
 
+   /* Settings for access to peripheral FIFO */
+   dma_addr_t  per_paddr;  /* FIFO address */
+   u32 tcd_nunits;
+
/* Lock for this structure */
spinlock_t  lock;
 };
@@ -251,8 +264,21 @@ static void mpc_dma_execute(struct mpc_dma_chan *mchan)
struct mpc_dma_desc *mdesc;
int cid = mchan-chan.chan_id;
 
-   /* Move all queued descriptors to active list */
-   list_splice_tail_init(mchan-queued, mchan-active);
+   while (!list_empty(mchan-queued)) {
+   mdesc = list_first_entry(mchan-queued,
+   struct mpc_dma_desc, node);
+
+   /* Grab either several mem-to-mem transfer descriptors
+* or one peripheral transfer descriptor,
+* don't mix mem-to-mem and peripheral transfer descriptors
+* within the same 'active' list. */
+   if (mdesc-will_access_peripheral) {
+   if (list_empty(mchan-active))
+   list_move_tail(mdesc-node, mchan-active);
+   break;
+   } else
+   list_move_tail(mdesc-node, mchan-active);
+   }
 
/* Chain descriptors into one transaction */
list_for_each_entry(mdesc, mchan-active, node) {
@@ -278,7 +304,17 @@ static void mpc_dma_execute(struct mpc_dma_chan *mchan)
 
if (first != prev)
mdma-tcd[cid].e_sg = 1;
-   out_8(mdma-regs-dmassrt, cid);
+
+   if (mdma-is_mpc8308) {
+   /* MPC8308, no request lines, software initiated start */
+   out_8(mdma-regs-dmassrt, cid);
+   } else if (first-will_access_peripheral) {
+   /* peripherals involved, start by external request signal */
+   out_8(mdma-regs-dmaserq, cid);
+   } else {
+   /* memory to memory transfer, software initiated start */
+   out_8(mdma-regs-dmassrt, cid);
+   }
 }
 
 /* Handle interrupt on one half of DMA controller (32 channels) */
@@ -596,6 +632,7 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, 
dma_addr_t src,
}
 
mdesc-error = 0;
+   mdesc-will_access_peripheral = 0;
tcd = mdesc-tcd;
 
/* Prepare Transfer Control Descriptor for this transaction */
@@ -643,6 +680,186 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t 
dst, dma_addr_t src,
return mdesc-desc;
 }
 
+static struct dma_async_tx_descriptor *
+mpc_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
+   unsigned int sg_len, enum dma_transfer_direction direction,
+   unsigned long flags, void *context)
+{
+   struct mpc_dma *mdma = dma_chan_to_mpc_dma(chan);
+   struct 

[PATCH RFC v7 3/6] dma: of: Add common xlate function for matching by channel id

2014-02-12 Thread Alexander Popov
This patch adds a new common OF dma xlate callback function which will match a
channel by it's id. The binding expects one integer argument which it will use 
to
lookup the channel by the id.

Unlike of_dma_simple_xlate this function is able to handle a system with
multiple DMA controllers. When registering the of dma provider with
of_dma_controller_register a pointer to the dma_device struct which is
associated with the dt node needs to passed as the data parameter.
New function will use this pointer to match only channels which belong to the
specified DMA controller.

Signed-off-by: Alexander Popov a13xp0p0...@gmail.com
---
 drivers/dma/of-dma.c   | 35 +++
 include/linux/of_dma.h |  4 
 2 files changed, 39 insertions(+)

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index e8fe9dc..d5fbeaa 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -218,3 +218,38 @@ struct dma_chan *of_dma_simple_xlate(struct 
of_phandle_args *dma_spec,
dma_spec-args[0]);
 }
 EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
+
+/**
+ * of_dma_xlate_by_chan_id - Translate dt property to DMA channel by channel id
+ * @dma_spec:  pointer to DMA specifier as found in the device tree
+ * @of_dma:pointer to DMA controller data
+ *
+ * This function can be used as the of xlate callback for DMA driver which 
wants
+ * to match the channel based on the channel id. When using this xlate function
+ * the #dma-cells propety of the DMA controller dt node needs to be set to 1.
+ * The data parameter of of_dma_controller_register must be a pointer to the
+ * dma_device struct the function should match upon.
+ *
+ * Returns pointer to appropriate dma channel on success or NULL on error.
+ */
+struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
+struct of_dma *ofdma)
+{
+   struct dma_device *dev = ofdma-of_dma_data;
+   struct dma_chan *chan, *candidate = NULL;
+
+   if (!dev || dma_spec-args_count != 1)
+   return NULL;
+
+   list_for_each_entry(chan, dev-channels, device_node)
+   if (chan-chan_id == dma_spec-args[0]) {
+   candidate = chan;
+   break;
+   }
+
+   if (!candidate)
+   return NULL;
+
+   return dma_get_slave_channel(candidate);
+}
+EXPORT_SYMBOL_GPL(of_dma_xlate_by_chan_id);
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index ae36298..56bc026 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -41,6 +41,8 @@ extern struct dma_chan *of_dma_request_slave_channel(struct 
device_node *np,
 const char *name);
 extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma);
+extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args 
*dma_spec,
+   struct of_dma *ofdma);
 #else
 static inline int of_dma_controller_register(struct device_node *np,
struct dma_chan *(*of_dma_xlate)
@@ -66,6 +68,8 @@ static inline struct dma_chan *of_dma_simple_xlate(struct 
of_phandle_args *dma_s
return NULL;
 }
 
+#define of_dma_xlate_by_chan_id NULL
+
 #endif
 
 #endif /* __LINUX_OF_DMA_H */
-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH RFC v7 4/6] dma: mpc512x: add device tree binding document

2014-02-12 Thread Alexander Popov
From: Gerhard Sittig g...@denx.de

introduce a device tree binding document for the MPC512x DMA controller

Signed-off-by: Gerhard Sittig g...@denx.de
[ a13xp0p0...@gmail.com: turn this into a separate patch ]
---
 .../devicetree/bindings/dma/mpc512x-dma.txt| 55 ++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/mpc512x-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/mpc512x-dma.txt 
b/Documentation/devicetree/bindings/dma/mpc512x-dma.txt
new file mode 100644
index 000..a4867d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/mpc512x-dma.txt
@@ -0,0 +1,55 @@
+* Freescale MPC512x DMA Controller
+
+The DMA controller in the Freescale MPC512x SoC can move blocks of
+memory contents between memory and peripherals or memory to memory.
+
+Refer to the Generic DMA Controller and DMA request bindings description
+in the dma.txt file for a more detailled discussion of the binding.  The
+MPC512x DMA engine binding follows the common scheme, but doesn't provide
+support for the optional channels and requests counters (those values are
+derived from the detected hardware features) and has a fixed client
+specifier length of 1 integer cell (the value is the DMA channel, since
+the DMA controller uses a fixed assignment of request lines per channel).
+
+
+DMA controller node properties:
+
+Required properties:
+- compatible:  should be fsl,mpc5121-dma
+- reg: address and size of the DMA controller's register set
+- interrupts:  interrupt spec for the DMA controller
+
+Optional properties:
+- #dma-cells:  must be 1, describes the number of integer cells
+   needed to specify the 'dmas' property in client nodes,
+   strongly recommended since common client helper code
+   uses this property
+
+Example:
+
+   dma0: dma@14000 {
+   compatible = fsl,mpc5121-dma;
+   reg = 0x14000 0x1800;
+   interrupts = 65 0x8;
+   #dma-cells = 1;
+   };
+
+
+Client node properties:
+
+Required properties:
+- dmas:list of DMA specifiers, consisting each of a 
handle
+   for the DMA controller and integer cells to specify
+   the channel used within the DMA controller
+- dma-names:   list of identifier strings for the DMA specifiers,
+   client device driver code uses these strings to
+   have DMA channels looked up at the controller
+
+Example:
+
+   sdhc@1500 {
+   compatible = fsl,mpc5121-sdhc;
+   /* ... */
+   dmas = dma0 30;
+   dma-names = rx-tx;
+   };
-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH RFC v7 5/6] dma: mpc512x: register for device tree channel lookup

2014-02-12 Thread Alexander Popov
From: Gerhard Sittig g...@denx.de

register the controller for device tree based lookup of DMA channels
(non-fatal for backwards compatibility with older device trees) and
provide the '#dma-cells' property in the shared mpc5121.dtsi file

Signed-off-by: Gerhard Sittig g...@denx.de
[ a13xp0p0...@gmail.com: resolve little patch conflict and put
  MPC512x DMA controller bindings document to a separate patch ]
---
 arch/powerpc/boot/dts/mpc5121.dtsi |  1 +
 drivers/dma/mpc512x_dma.c  | 21 ++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi 
b/arch/powerpc/boot/dts/mpc5121.dtsi
index 2c0e155..7f9d14f 100644
--- a/arch/powerpc/boot/dts/mpc5121.dtsi
+++ b/arch/powerpc/boot/dts/mpc5121.dtsi
@@ -498,6 +498,7 @@
compatible = fsl,mpc5121-dma;
reg = 0x14000 0x1800;
interrupts = 65 0x8;
+   #dma-cells = 1;
};
};
 
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index b978ef1..1e0b8cf 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -50,6 +50,7 @@
 #include linux/of_address.h
 #include linux/of_device.h
 #include linux/of_irq.h
+#include linux/of_dma.h
 #include linux/of_platform.h
 
 #include linux/random.h
@@ -1013,11 +1014,23 @@ static int mpc_dma_probe(struct platform_device *op)
/* Register DMA engine */
dev_set_drvdata(dev, mdma);
retval = dma_async_device_register(dma);
-   if (retval) {
-   devm_free_irq(dev, mdma-irq, mdma);
-   irq_dispose_mapping(mdma-irq);
+   if (retval)
+   goto out_irq;
+
+   /* register with OF helpers for DMA lookups (nonfatal) */
+   if (dev-of_node) {
+   retval = of_dma_controller_register(dev-of_node,
+   of_dma_xlate_by_chan_id,
+   mdma);
+   if (retval)
+   dev_warn(dev, could not register for OF lookup\n);
}
 
+   return 0;
+
+out_irq:
+   devm_free_irq(dev, mdma-irq, mdma);
+   irq_dispose_mapping(mdma-irq);
return retval;
 }
 
@@ -1026,6 +1039,8 @@ static int mpc_dma_remove(struct platform_device *op)
struct device *dev = op-dev;
struct mpc_dma *mdma = dev_get_drvdata(dev);
 
+   if (dev-of_node)
+   of_dma_controller_free(dev-of_node);
dma_async_device_unregister(mdma-dma);
devm_free_irq(dev, mdma-irq, mdma);
irq_dispose_mapping(mdma-irq);
-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH RFC v7 6/6] HACK mmc: mxcmmc: enable clocks for the MPC512x

2014-02-12 Thread Alexander Popov
From: Gerhard Sittig g...@denx.de

QD HACK to enable SD card support without correct COMMON_CLK support,
best viewed with 'git diff -w -b', NOT acceptable for mainline (NAKed)

Signed-off-by: Gerhard Sittig g...@denx.de
[ a13xp0p0...@gmail.com: resolve little patch conflict ]
---
 drivers/mmc/host/mxcmmc.c | 42 --
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index f7199c8..ddefa60 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1123,20 +1123,29 @@ static int mxcmci_probe(struct platform_device *pdev)
host-res = r;
host-irq = irq;
 
-   host-clk_ipg = devm_clk_get(pdev-dev, ipg);
-   if (IS_ERR(host-clk_ipg)) {
-   ret = PTR_ERR(host-clk_ipg);
-   goto out_iounmap;
-   }
+   if (!is_mpc512x_mmc(host)) {
+   host-clk_ipg = devm_clk_get(pdev-dev, ipg);
+   if (IS_ERR(host-clk_ipg)) {
+   ret = PTR_ERR(host-clk_ipg);
+   goto out_iounmap;
+   }
 
-   host-clk_per = devm_clk_get(pdev-dev, per);
-   if (IS_ERR(host-clk_per)) {
-   ret = PTR_ERR(host-clk_per);
-   goto out_iounmap;
+   host-clk_per = devm_clk_get(pdev-dev, per);
+   if (IS_ERR(host-clk_per)) {
+   ret = PTR_ERR(host-clk_per);
+   goto out_iounmap;
+   }
+   } else {
+   host-clk_per = devm_clk_get(pdev-dev, sdhc_clk);
+   if (IS_ERR(host-clk_per)) {
+   ret = PTR_ERR(host-clk_per);
+   goto out_iounmap;
+   }
}
 
clk_prepare_enable(host-clk_per);
-   clk_prepare_enable(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_prepare_enable(host-clk_ipg);
 
mxcmci_softreset(host);
 
@@ -1206,7 +1215,8 @@ out_free_dma:
dma_release_channel(host-dma);
 out_clk_put:
clk_disable_unprepare(host-clk_per);
-   clk_disable_unprepare(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_disable_unprepare(host-clk_ipg);
 out_iounmap:
iounmap(host-base);
 out_free:
@@ -1236,7 +1246,8 @@ static int mxcmci_remove(struct platform_device *pdev)
dma_release_channel(host-dma);
 
clk_disable_unprepare(host-clk_per);
-   clk_disable_unprepare(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_disable_unprepare(host-clk_ipg);
 
release_mem_region(host-res-start, resource_size(host-res));
 
@@ -1252,7 +1263,9 @@ static int mxcmci_suspend(struct device *dev)
struct mxcmci_host *host = mmc_priv(mmc);
 
clk_disable_unprepare(host-clk_per);
-   clk_disable_unprepare(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_disable_unprepare(host-clk_ipg);
+
return 0;
 }
 
@@ -1262,7 +1275,8 @@ static int mxcmci_resume(struct device *dev)
struct mxcmci_host *host = mmc_priv(mmc);
 
clk_prepare_enable(host-clk_per);
-   clk_prepare_enable(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_prepare_enable(host-clk_ipg);
return 0;
 }
 
-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2] powerpc: thp: Fix crash on mremap

2014-02-12 Thread Greg KH
On Wed, Feb 12, 2014 at 08:22:02AM +0530, Aneesh Kumar K.V wrote:
 Greg KH gre...@linuxfoundation.org writes:
 
  On Fri, Feb 07, 2014 at 07:21:57PM +0530, Aneesh Kumar K.V wrote:
  From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
  
  This patch fix the below crash
  
  NIP [c004cee4] .__hash_page_thp+0x2a4/0x440
  LR [c00439ac] .hash_page+0x18c/0x5e0
  ...
  Call Trace:
  [c00736103c40] [1b00] 0x1b00(unreliable)
  [437908.479693] [c00736103d50] [c00439ac] 
  .hash_page+0x18c/0x5e0
  [437908.479699] [c00736103e30] [c000924c] 
  .do_hash_page+0x4c/0x58
  
  On ppc64 we use the pgtable for storing the hpte slot information and
  store address to the pgtable at a constant offset (PTRS_PER_PMD) from
  pmd. On mremap, when we switch the pmd, we need to withdraw and deposit
  the pgtable again, so that we find the pgtable at PTRS_PER_PMD offset
  from new pmd.
  
  We also want to move the withdraw and deposit before the set_pmd so
  that, when page fault find the pmd as trans huge we can be sure that
  pgtable can be located at the offset.
  
  variant of upstream SHA1: b3084f4db3aeb991c507ca774337c7e7893ed04f
  for 3.12 stable series
 
  This doesn't look like a variant, it looks totally different.  Why
  can't I just take the b3084f4db3aeb991c507ca774337c7e7893ed04f patch
  (and follow-on fix) for 3.12?
 
 Because the code in that function changed in 3.13. Kirill added split
 ptl locks for huge pte, and we decide whether to withdraw and
 deposit again based on the ptl locks in 3.13. In 3.12 we do that only
 for ppc64 using #ifdef

I have no idea what that means...

If you want this patch applied, please be specific as to what is going
on, why the code is _very_ different, and all of that.  Make it
_obvious_ as to what is happening, and why I would be a fool not to take
it in the stable tree.

As it is, the code in this patch looks so different that I'm just
assuming you got something wrong and are trying to really send me
something else, so I'll just ignore it.

greg k-h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v2] powerpc/powernv: Platform dump interface

2014-02-12 Thread Vasant Hegde

On 02/09/2014 02:50 AM, Anton Blanchard wrote:


Hi Vasant,


+static void free_dump_sg_list(struct opal_sg_list *list)
+{
+   struct opal_sg_list *sg1;
+   while (list) {
+   sg1 = list-next;
+   kfree(list);
+   list = sg1;
+   }
+   list = NULL;
+}
+
+/*
+ * Build dump buffer scatter gather list
+ */
+static struct opal_sg_list *dump_data_to_sglist(void)
+{
+   struct opal_sg_list *sg1, *list = NULL;
+   void *addr;
+   int64_t size;
+
+   addr = dump_record.buffer;
+   size = dump_record.size;
+
+   sg1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+   if (!sg1)
+   goto nomem;
+
+   list = sg1;
+   sg1-num_entries = 0;
+   while (size  0) {
+   /* Translate virtual address to physical address */
+   sg1-entry[sg1-num_entries].data =
+   (void *)(vmalloc_to_pfn(addr)  PAGE_SHIFT);
+
+   if (size  PAGE_SIZE)
+   sg1-entry[sg1-num_entries].length =
PAGE_SIZE;
+   else
+   sg1-entry[sg1-num_entries].length = size;
+
+   sg1-num_entries++;
+   if (sg1-num_entries = SG_ENTRIES_PER_NODE) {
+   sg1-next = kzalloc(PAGE_SIZE, GFP_KERNEL);
+   if (!sg1-next)
+   goto nomem;
+
+   sg1 = sg1-next;
+   sg1-num_entries = 0;
+   }
+   addr += PAGE_SIZE;
+   size -= PAGE_SIZE;
+   }
+   return list;
+
+nomem:
+   pr_err(%s : Failed to allocate memory\n, __func__);
+   free_dump_sg_list(list);
+   return NULL;
+}
+
+/*
+ * Translate sg list address to absolute
+ */
+static void sglist_to_phy_addr(struct opal_sg_list *list)
+{
+   struct opal_sg_list *sg, *next;
+
+   for (sg = list; sg; sg = next) {
+   next = sg-next;
+   /* Don't translate NULL pointer for last entry */
+   if (sg-next)
+   sg-next = (struct opal_sg_list
*)__pa(sg-next);
+   else
+   sg-next = NULL;
+
+   /* Convert num_entries to length */
+   sg-num_entries =
+   sg-num_entries * sizeof(struct
opal_sg_entry) + 16;
+   }
+}
+
+static void free_dump_data_buf(void)
+{
+   vfree(dump_record.buffer);
+   dump_record.size = 0;
+}




Anton,


This looks identical to the code in opal-flash.c. Considering how
complicated it is, can we put it somewhere common?


Thanks for the review.. Will look into it next week.

-Vasant



Anton



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2] powerpc: thp: Fix crash on mremap

2014-02-12 Thread Aneesh Kumar K.V
Greg KH gre...@linuxfoundation.org writes:

 On Wed, Feb 12, 2014 at 08:22:02AM +0530, Aneesh Kumar K.V wrote:
 Greg KH gre...@linuxfoundation.org writes:
 
  On Fri, Feb 07, 2014 at 07:21:57PM +0530, Aneesh Kumar K.V wrote:
  From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
  
  This patch fix the below crash
  
  NIP [c004cee4] .__hash_page_thp+0x2a4/0x440
  LR [c00439ac] .hash_page+0x18c/0x5e0
  ...
  Call Trace:
  [c00736103c40] [1b00] 0x1b00(unreliable)
  [437908.479693] [c00736103d50] [c00439ac] 
  .hash_page+0x18c/0x5e0
  [437908.479699] [c00736103e30] [c000924c] 
  .do_hash_page+0x4c/0x58
  
  On ppc64 we use the pgtable for storing the hpte slot information and
  store address to the pgtable at a constant offset (PTRS_PER_PMD) from
  pmd. On mremap, when we switch the pmd, we need to withdraw and deposit
  the pgtable again, so that we find the pgtable at PTRS_PER_PMD offset
  from new pmd.
  
  We also want to move the withdraw and deposit before the set_pmd so
  that, when page fault find the pmd as trans huge we can be sure that
  pgtable can be located at the offset.
  
  variant of upstream SHA1: b3084f4db3aeb991c507ca774337c7e7893ed04f
  for 3.12 stable series
 
  This doesn't look like a variant, it looks totally different.  Why
  can't I just take the b3084f4db3aeb991c507ca774337c7e7893ed04f patch
  (and follow-on fix) for 3.12?
 
 Because the code in that function changed in 3.13. Kirill added split
 ptl locks for huge pte, and we decide whether to withdraw and
 deposit again based on the ptl locks in 3.13. In 3.12 we do that only
 for ppc64 using #ifdef

 I have no idea what that means...

 If you want this patch applied, please be specific as to what is going
 on, why the code is _very_ different, and all of that.  Make it
 _obvious_ as to what is happening, and why I would be a fool not to take
 it in the stable tree.

 As it is, the code in this patch looks so different that I'm just
 assuming you got something wrong and are trying to really send me
 something else, so I'll just ignore it.

3.13 we added split huge ptl lock which introduced separate lock at pmd
level for hugepage (bf929152e9f6c49b66fad4ebf08cc95b02ce48f5). This
required us 3592806cfa08b7cca968f793c33f8e9460bab395. ie, when we move
huge page, we need to withdraw and deposit PTE page if we are moving
them across different pmd page. We did that by checking spin lock
address in 3.13. ie, we have


 if (new_ptl != old_ptl) {
.
   pgtable = pgtable_trans_huge_withdraw(mm, old_pmd);
   pgtable_trans_huge_deposit(mm, new_pmd,pgtable);
...
}

ppc64 even without using split ptl had PTE page per pmd entry. The
details for that are explained in the commit message above. So when
we move huge page we need to withdraw and deposit PTE page always on
ppc64.

Now on 3.13 we added a new function which did


static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
spinlock_t *old_pmd_ptl)
{
   /*
* With split pmd lock we also need to move preallocated
* PTE page table if new_pmd is on different PMD page table.
*/
   return new_pmd_ptl != old_pmd_ptl;
}

for x86

and on ppc64 we did

static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
spinlock_t *old_pmd_ptl)
{
   /*
* Archs like ppc64 use pgtable to store per pmd
* specific information. So when we switch the pmd,
* we should also withdraw and deposit the pgtable
*/
   return true;
}

ie, on ppc64 we always did withdraw and deposit and on x86 we do that
only when spin lock address are different.

For 3.12, since we don't have split huge ptl locks yet, we did the below

+#ifdef CONFIG_ARCH_THP_MOVE_PMD_ALWAYS_WITHDRAW
+   /*
+* Archs like ppc64 use pgtable to store per pmd
+* specific information. So when we switch the pmd,
+* we should also withdraw and deposit the pgtable
+*/
+   pgtable = pgtable_trans_huge_withdraw(mm, old_pmd);
+   pgtable_trans_huge_deposit(mm, new_pmd, pgtable);
+#endif

CONFIG_ARCH_THP_MOVE_PMD_ALWAYS_WITHDRAW is only set for PPC64.

-aneesh

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH RFC v7 1/6] dma: mpc512x: reorder mpc8308 specific instructions

2014-02-12 Thread Gerhard Sittig
[ removed DT from Cc: ]

On Wed, Feb 12, 2014 at 17:25 +0400, Alexander Popov wrote:
 
 Concentrate the specific code for MPC8308 in the 'if' branch
 and handle MPC512x in the 'else' branch.
 This modification only reorders instructions but doesn't change behaviour.

As this one is an obvious improvement and straight forward, it
can be taken regardless of the remainder of the series.  (I guess
this formerly stated judgement is what made Alexander derive
Acked-By tags from.)


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] of: give priority to the compatible match in __of_match_node()

2014-02-12 Thread Stephen N Chivers
Kevin Hao haoke...@gmail.com wrote on 02/12/2014 10:38:04 PM:

 From: Kevin Hao haoke...@gmail.com
 To: devicet...@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
 Cc: Sebastian Hesselbarth sebastian.hesselba...@gmail.com, Stephen
 N Chivers schiv...@csc.com.au, Chris Proctor 
 cproc...@csc.com.au, Arnd Bergmann a...@arndb.de, Scott Wood 
 scottw...@freescale.com, Grant Likely grant.lik...@linaro.org, 
 Rob Herring robh...@kernel.org
 Date: 02/12/2014 10:38 PM
 Subject: [PATCH] of: give priority to the compatible match in 
 __of_match_node()
 
 When the device node do have a compatible property, we definitely
 prefer the compatible match besides the type and name. Only if
 there is no such a match, we then consider the candidate which
 doesn't have compatible entry but do match the type or name with
 the device node.
 
 This is based on a patch from Sebastian Hesselbarth.
   http://patchwork.ozlabs.org/patch/319434/
 
 I did some code refactoring and also fixed a bug in the original patch.
 
 Cc: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
 Signed-off-by: Kevin Hao haoke...@gmail.com
Tested-by: Stephen Chivers schiv...@csc.com

Patch works for both orderings. Platform boots without problems and
I get the normal serial console.
 ---
  drivers/of/base.c | 55 
 +--
  1 file changed, 37 insertions(+), 18 deletions(-)
 
 diff --git a/drivers/of/base.c b/drivers/of/base.c
 index ff85450d5683..9d655df458bd 100644
 --- a/drivers/of/base.c
 +++ b/drivers/of/base.c
 @@ -730,32 +730,45 @@ out:
  }
  EXPORT_SYMBOL(of_find_node_with_property);
 
 +static int of_match_type_or_name(const struct device_node *node,
 +const struct of_device_id *m)
 +{
 +   int match = 1;
 +
 +   if (m-name[0])
 +  match = node-name  !strcmp(m-name, node-name);
 +
 +   if (m-type[0])
 +  match = node-type  !strcmp(m-type, node-type);
 +
 +   return match;
 +}
 +
  static
  const struct of_device_id *__of_match_node(const struct 
 of_device_id *matches,
const struct device_node *node)
  {
 const char *cp;
 int cplen, l;
 +   const struct of_device_id *m;
 +   int match;
 
 if (!matches)
return NULL;
 
 cp = __of_get_property(node, compatible, cplen);
 -   do {
 -  const struct of_device_id *m = matches;
 +   while (cp  (cplen  0)) {
 +  m = matches;
 
/* Check against matches with current compatible string */
while (m-name[0] || m-type[0] || m-compatible[0]) {
 - int match = 1;
 - if (m-name[0])
 -match = node-name
 -!strcmp(m-name, node-name);
 - if (m-type[0])
 -match = node-type
 -!strcmp(m-type, node-type);
 - if (m-compatible[0])
 -match = cp
 -!of_compat_cmp(m-compatible, cp,
 + if (!m-compatible[0]) {
 +m++;
 +continue;
 + }
 +
 + match = of_match_type_or_name(node, m);
 + match = cp  !of_compat_cmp(m-compatible, cp,
   strlen(m-compatible));
   if (match)
  return m;
 @@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node
 (const struct of_device_id *matches,
}
 
/* Get node's next compatible string */ 
 -  if (cp) {
 - l = strlen(cp) + 1;
 - cp += l;
 - cplen -= l;
 -  }
 -   } while (cp  (cplen  0));
 +  l = strlen(cp) + 1;
 +  cp += l;
 +  cplen -= l;
 +   }
 +
 +   m = matches;
 +   /* Check against matches without compatible string */
 +   while (m-name[0] || m-type[0] || m-compatible[0]) {
 +  if (!m-compatible[0]  of_match_type_or_name(node, m))
 + return m;
 +  m++;
 +   }
 
 return NULL;
  }
 -- 
 1.8.5.3
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2] powerpc: thp: Fix crash on mremap

2014-02-12 Thread Benjamin Herrenschmidt
On Wed, 2014-02-12 at 06:23 -0800, Greg KH wrote:
 I have no idea what that means...
 
 If you want this patch applied, please be specific as to what is going
 on, why the code is _very_ different, and all of that.  Make it
 _obvious_ as to what is happening, and why I would be a fool not to
 take
 it in the stable tree.
 
 As it is, the code in this patch looks so different that I'm just
 assuming you got something wrong and are trying to really send me
 something else, so I'll just ignore it.

It looks very different because the function that needs to be fixed
changed a lot upstream in 3.13.

In practice it's *not* very different in behaviour. It's just that
on powerpc we need to unconditionally call withdraw and deposit when
moving PTEs or it will crash, due to how we keep the transparent
huge page in sync with the hash table.

With the 3.13 code, due to lock breaking introduced by Kirill in
3.13-rc's, there's already a generic case for doing that (if we dropped
the lock). So we just changed the condition to essentially force the
condition to true to always do it under control of an arch helper.

The pre-3.13 code didn't do the withdraw and deposit at all in that
function however, so in that case, the patch (this 3.12 one) basically
just adds the calls to withdraw and deposit under control of an ifdef
which is only enabled for powerpc64.

So you are taking 0 risk with other architecture and as the powerpc
maintainer I'm happy with the patch.

Cheers,
Ben.



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code

2014-02-12 Thread Tyrel Datwyler
On 01/31/2014 03:58 PM, Tyrel Datwyler wrote:
 This patchset fixes a couple of issues encountered in the suspend/resume code
 base. First when using the kernel device tree update code update-nodes is
 unnecessarily called more than once. Second the cpu cache lists are not
 updated after a suspend/resume which under certain conditions may cause a
 panic. Finally, since the cache list fix utilzes in kernel device tree update
 code a means for telling drmgr not to perform a device tree update from
 userspace is required.
 
 Changes from v2:
 - Moved dynamic configuration update code into pseries specific routine
   per Nathan's suggestion.
 
 Changes from v1:
 - Fixed several commit message typos
 - Fixed authorship of first two patches
 
 Haren Myneni (2):
   powerpc/pseries: Device tree should only be updated once after
 suspend/migrate
   powerpc/pseries: Update dynamic cache nodes for suspend/resume
 operation
 
 Tyrel Datwyler (1):
   powerpc/pseries: Report in kernel device tree update to drmgr
 
  arch/powerpc/include/asm/rtas.h   |  1 +
  arch/powerpc/platforms/pseries/mobility.c | 26 +++---
  arch/powerpc/platforms/pseries/suspend.c  | 44 
 ++-
  3 files changed, 54 insertions(+), 17 deletions(-)
 

Ping?

Nathan, can I at least get your ack on this v3 patchset. We really need
to get these upstream.

-Tyrel

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node

2014-02-12 Thread Christoph Lameter
Here is another patch with some fixes. The additional logic is only
compiled in if CONFIG_HAVE_MEMORYLESS_NODES is set.

Subject: slub: Memoryless node support

Support memoryless nodes by tracking which allocations are failing.
Allocations targeted to the nodes without memory fall back to the
current available per cpu objects and if that is not available will
create a new slab using the page allocator to fallback from the
memoryless node to some other node.

Signed-off-by: Christoph Lameter c...@linux.com

Index: linux/mm/slub.c
===
--- linux.orig/mm/slub.c2014-02-12 16:07:48.957869570 -0600
+++ linux/mm/slub.c 2014-02-12 16:09:22.198928260 -0600
@@ -134,6 +134,10 @@ static inline bool kmem_cache_has_cpu_pa
 #endif
 }

+#ifdef CONFIG_HAVE_MEMORYLESS_NODES
+static nodemask_t empty_nodes;
+#endif
+
 /*
  * Issues still to be resolved:
  *
@@ -1405,16 +1409,28 @@ static struct page *new_slab(struct kmem
void *last;
void *p;
int order;
+   int alloc_node;

BUG_ON(flags  GFP_SLAB_BUG_MASK);

page = allocate_slab(s,
flags  (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node);
-   if (!page)
+   if (!page) {
+#ifdef CONFIG_HAVE_MEMORYLESS_NODES
+   if (node != NUMA_NO_NODE)
+   node_set(node, empty_nodes);
+#endif
goto out;
+   }

order = compound_order(page);
-   inc_slabs_node(s, page_to_nid(page), page-objects);
+   alloc_node = page_to_nid(page);
+#ifdef CONFIG_HAVE_MEMORYLESS_NODES
+   node_clear(alloc_node, empty_nodes);
+   if (node != NUMA_NO_NODE  alloc_node != node)
+   node_set(node, empty_nodes);
+#endif
+   inc_slabs_node(s, alloc_node, page-objects);
memcg_bind_pages(s, order);
page-slab_cache = s;
__SetPageSlab(page);
@@ -1722,7 +1738,7 @@ static void *get_partial(struct kmem_cac
struct kmem_cache_cpu *c)
 {
void *object;
-   int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node;
+   int searchnode = (node == NUMA_NO_NODE) ? numa_mem_id() : node;

object = get_partial_node(s, get_node(s, searchnode), c, flags);
if (object || node != NUMA_NO_NODE)
@@ -2117,8 +2133,19 @@ static void flush_all(struct kmem_cache
 static inline int node_match(struct page *page, int node)
 {
 #ifdef CONFIG_NUMA
-   if (!page || (node != NUMA_NO_NODE  page_to_nid(page) != node))
+   int page_node = page_to_nid(page);
+
+   if (!page)
return 0;
+
+   if (node != NUMA_NO_NODE) {
+#ifdef CONFIG_HAVE_MEMORYLESS_NODES
+   if (node_isset(node, empty_nodes))
+   return 1;
+#endif
+   if (page_node != node)
+   return 0;
+   }
 #endif
return 1;
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH RFC v7 2/6] dma: mpc512x: add support for peripheral transfers

2014-02-12 Thread Gerhard Sittig
[ removed DT from Cc: ]

On Wed, Feb 12, 2014 at 17:25 +0400, Alexander Popov wrote:
 
 Introduce support for slave s/g transfer preparation and the associated
 device control callback in the MPC512x DMA controller driver, which adds
 support for data transfers between memory and peripheral I/O to the
 previously supported mem-to-mem transfers.
 
 [ ... ]

 --- a/drivers/dma/mpc512x_dma.c
 +++ b/drivers/dma/mpc512x_dma.c
 [ ... ]

 @@ -29,8 +30,15 @@
   */
  
  /*
 - * This is initial version of MPC5121 DMA driver. Only memory to memory
 - * transfers are supported (tested using dmatest module).
 + * MPC512x and MPC8308 DMA driver. It supports
 + * memory to memory data transfers (tested using dmatest module) and
 + * data transfers between memory and peripheral I/O memory
 + * by means of slave s/g with these limitations:
 + * - chunked transfers (transfers with more than one part) are refused
 + * as long as proper support for scatter/gather is missing;
 + * - transfers on MPC8308 always start from software as this SoC appears
 + * not to have external request lines for peripheral flow control;
 + * - minimal memory - I/O memory transfer size is 4 bytes.
   */

Often I assume people would notice themselves, and apparently I'm
wrong. :)  Can you adjust the formatting such (here and
elsewhere) that the bullet list is clearly visible as such?
Flowing text like above obfuscates the fact that the content may
have a structure ...

There are known limitations which are not listed here, minimal
transfer size is incomplete.  It appears that you assume
constraints on start addresses as well as sizes/lengths.  Can you
update the documentation to match the implementation?

 @@ -251,8 +264,21 @@ static void mpc_dma_execute(struct mpc_dma_chan *mchan)
   struct mpc_dma_desc *mdesc;
   int cid = mchan-chan.chan_id;
  
 - /* Move all queued descriptors to active list */
 - list_splice_tail_init(mchan-queued, mchan-active);
 + while (!list_empty(mchan-queued)) {
 + mdesc = list_first_entry(mchan-queued,
 + struct mpc_dma_desc, node);
 +
 + /* Grab either several mem-to-mem transfer descriptors
 +  * or one peripheral transfer descriptor,
 +  * don't mix mem-to-mem and peripheral transfer descriptors
 +  * within the same 'active' list. */
 + if (mdesc-will_access_peripheral) {
 + if (list_empty(mchan-active))
 + list_move_tail(mdesc-node, mchan-active);
 + break;
 + } else
 + list_move_tail(mdesc-node, mchan-active);
 + }
  
   /* Chain descriptors into one transaction */
   list_for_each_entry(mdesc, mchan-active, node) {

There are style issues.  Both in multi line comments, and in the
braces of the if/else block.

 @@ -643,6 +680,186 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t 
 dst, dma_addr_t src,
   return mdesc-desc;
  }
  
 +static struct dma_async_tx_descriptor *
 +mpc_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 + unsigned int sg_len, enum dma_transfer_direction direction,
 + unsigned long flags, void *context)
 +{
 + struct mpc_dma *mdma = dma_chan_to_mpc_dma(chan);
 + struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan);
 + struct mpc_dma_desc *mdesc = NULL;
 + dma_addr_t per_paddr;
 + u32 tcd_nunits;
 + struct mpc_dma_tcd *tcd;
 + unsigned long iflags;
 + struct scatterlist *sg;
 + size_t len;
 + int iter, i;

Personally I much dislike this style of mixing declarations and
instructions.  But others may disagree, and strongly so.

 +
 + /* currently there is no proper support for scatter/gather */
 + if (sg_len != 1)
 + return NULL;
 +
 + for_each_sg(sgl, sg, sg_len, i) {
 + spin_lock_irqsave(mchan-lock, iflags);
 +
 + mdesc = list_first_entry(mchan-free, struct mpc_dma_desc,
 + node);

style (continuation and indentation)

 + if (!mdesc) {
 + spin_unlock_irqrestore(mchan-lock, iflags);
 + /* try to free completed descriptors */
 + mpc_dma_process_completed(mdma);
 + return NULL;
 + }
 +
 + list_del(mdesc-node);
 +
 + per_paddr = mchan-per_paddr;
 + tcd_nunits = mchan-tcd_nunits;
 +
 + spin_unlock_irqrestore(mchan-lock, iflags);
 +
 + if (per_paddr == 0 || tcd_nunits == 0)
 + goto err_prep;
 +
 + mdesc-error = 0;
 + mdesc-will_access_peripheral = 1;
 + tcd = mdesc-tcd;
 +
 + /* Prepare Transfer Control Descriptor for this transaction */
 +
 + memset(tcd, 0, sizeof(struct mpc_dma_tcd));
 +
 + 

Re: [PATCH RFC v7 4/6] dma: mpc512x: add device tree binding document

2014-02-12 Thread Gerhard Sittig
On Wed, Feb 12, 2014 at 17:25 +0400, Alexander Popov wrote:
 
 From: Gerhard Sittig g...@denx.de
 
 introduce a device tree binding document for the MPC512x DMA controller
 
 Signed-off-by: Gerhard Sittig g...@denx.de
 [ a13xp0p0...@gmail.com: turn this into a separate patch ]

As stated in the previous iteration, this one no longer is good
enough.  As time has passed, we have moved forward and learned
something.  We would not write a binding like this today.
Admittedly I went dormant (did not provide an update) since v6.

There are several issues.
- The MPC512x DMA completely lacks a binding document, so one
  should get added.
- The MPC8308 hardware is similar and can re-use the MPC512x
  binding, which should be stated.
- The Linux implementation currently has no OF based channel
  lookup support, so '#dma-cells' is a future feature.  I guess
  the binding can and should already discuss the feature,
  regardless of whether all implementations support it.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH RFC v7 6/6] HACK mmc: mxcmmc: enable clocks for the MPC512x

2014-02-12 Thread Gerhard Sittig
[ removed DT from Cc: ]

On Wed, Feb 12, 2014 at 17:25 +0400, Alexander Popov wrote:
 
 QD HACK to enable SD card support without correct COMMON_CLK support,
 best viewed with 'git diff -w -b', NOT acceptable for mainline (NAKed)

This one has become obsolete, v3.14-rc1 comes with proper
COMMON_CLK support.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH RFC v7 0/6] MPC512x DMA slave s/g support, OF DMA lookup

2014-02-12 Thread Gerhard Sittig
For some reason you have kept the DMA maintainers, but dropped
the dmaengine ML from Cc: -- was this intentional, given that the
series is specifically about DMA and you want to get feedback?

And you may want to help DT people by not sending purely Linux
implementation related stuff to them (they already are drinking
from the firehose).  DT reviewers are foremost interested in
bindings and policy and remaining OS agnostic, and leave
mechanical .dts file updates to subsystem maintainers.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node

2014-02-12 Thread Nishanth Aravamudan
Hi Joonsoo,

On 11.02.2014 [16:42:00 +0900], Joonsoo Kim wrote:
 On Mon, Feb 10, 2014 at 11:13:21AM -0800, Nishanth Aravamudan wrote:
  Hi Christoph,
  
  On 07.02.2014 [12:51:07 -0600], Christoph Lameter wrote:
   Here is a draft of a patch to make this work with memoryless nodes.
   
   The first thing is that we modify node_match to also match if we hit an
   empty node. In that case we simply take the current slab if its there.
   
   If there is no current slab then a regular allocation occurs with the
   memoryless node. The page allocator will fallback to a possible node and
   that will become the current slab. Next alloc from a memoryless node
   will then use that slab.
   
   For that we also add some tracking of allocations on nodes that were not
   satisfied using the empty_node[] array. A successful alloc on a node
   clears that flag.
   
   I would rather avoid the empty_node[] array since its global and there may
   be thread specific allocation restrictions but it would be expensive to do
   an allocation attempt via the page allocator to make sure that there is
   really no page available from the page allocator.
  
  With this patch on our test system (I pulled out the numa_mem_id()
  change, since you Acked Joonsoo's already), on top of 3.13.0 + my
  kthread locality change + CONFIG_HAVE_MEMORYLESS_NODES + Joonsoo's RFC
  patch 1):
  
  MemTotal:8264704 kB
  MemFree: 5924608 kB
  ...
  Slab:1402496 kB
  SReclaimable: 102848 kB
  SUnreclaim:  1299648 kB
  
  And Anton's slabusage reports:
  
  slab   mem objsslabs
used   active   active
  
  kmalloc-16384   207 MB   98.60%  100.00%
  task_struct 134 MB   97.82%  100.00%
  kmalloc-8192117 MB  100.00%  100.00%
  pgtable-2^12111 MB  100.00%  100.00%
  pgtable-2^10104 MB  100.00%  100.00%
  
  For comparison, Anton's patch applied at the same point in the series:
  
  meminfo:
  
  MemTotal:8264704 kB
  MemFree: 4150464 kB
  ...
  Slab:1590336 kB
  SReclaimable: 208768 kB
  SUnreclaim:  1381568 kB
  
  slabusage:
  
  slab   mem objsslabs
used   active   active
  
  kmalloc-16384   227 MB   98.63%  100.00%
  kmalloc-8192130 MB  100.00%  100.00%
  task_struct 129 MB   97.73%  100.00%
  pgtable-2^12112 MB  100.00%  100.00%
  pgtable-2^10106 MB  100.00%  100.00%
  
  
  Consider this patch:
  
  Acked-by: Nishanth Aravamudan n...@linux.vnet.ibm.com
  Tested-by: Nishanth Aravamudan n...@linux.vnet.ibm.com
 
 Hello,
 
 I still think that there is another problem.
 Your report about CONFIG_SLAB said that SLAB uses just 200MB.
 Below is your previous report.
 
   Ok, with your patches applied and CONFIG_SLAB enabled:
 
   MemTotal:8264640 kB
   MemFree: 7119680 kB
   Slab: 207232 kB
   SReclaimable:  32896 kB
   SUnreclaim:   174336 kB
 
 The number on CONFIG_SLUB with these patches tell us that SLUB uses 1.4GB.
 There is large difference on slab usage.

Agreed. But, at least for now, this gets us to not OOM all the time :) I
think that's significant progress. I will continue to look at this
issue for where the other gaps are, but would like to see Christoph's
latest patch get merged (pending my re-testing).

 And, I should note that number of active objects on slabinfo can be
 wrong on some situation, since it doesn't consider cpu slab (and cpu
 partial slab).

Well, I grabbed everything from /sys/kernel/slab for you in the
tarballs, I believe.

 I recommend to confirm page_to_nid() and other things as I mentioned
 earlier.

I believe these all work once CONFIG_HAVE_MEMORYLESS_NODES was set for
ppc64, but will test it again when I have access to the test system.

Also, given that only ia64 and (hopefuly soon) ppc64 can set
CONFIG_HAVE_MEMORYLESS_NODES, does that mean x86_64 can't have
memoryless nodes present? Even with fakenuma? Just curious.

-Nish

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH][v2] powerpc/fsl: Add/update miscellaneous missing bindings

2014-02-12 Thread Harninder Rai
Missing bindings were found on running checkpatch.pl on bsc9132
device tree. This patch add/update the following

- Add bindings for L2 cache controller
- Add bindings for memory controller
- Update bindings for USB controller

Signed-off-by: Harninder Rai harninder@freescale.com
---
Changes since base version:
Incorporated Scott's comments
- Rename l2cc.txt to l2cache.txt
- Add information about ePAPR compliance
- Add missing cache in compatible
- Miscellaneous minors

 .../devicetree/bindings/powerpc/fsl/l2cache.txt|   26 
 .../devicetree/bindings/powerpc/fsl/mem-ctrlr.txt  |   16 
 Documentation/devicetree/bindings/usb/fsl-usb.txt  |2 +
 3 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/l2cache.txt
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/l2cache.txt 
b/Documentation/devicetree/bindings/powerpc/fsl/l2cache.txt
new file mode 100644
index 000..79ef4a1
--- /dev/null
+++ b/Documentation/devicetree/bindings/powerpc/fsl/l2cache.txt
@@ -0,0 +1,26 @@
+Freescale L2 Cache Controller
+
+L2 cache is present in Freescale's QorIQ and QorIQ Qonverge platforms.
+The cache bindings explained below are ePAPR compliant
+
+Required Properties:
+
+- compatible   : Should include fsl,chip-l2-cache-controller and cache
+ where chip is the processor (bsc9132, npc8572 etc.)
+- reg  : Address and size of L2 cache controller registers
+- cache-size   : Size of the entire L2 cache
+- interrupts   : Error interrupt of L2 controller
+
+Optional Properties:
+
+- cache-line-size : Size of L2 cache lines
+
+Example:
+
+   L2: l2-cache-controller@2 {
+   compatible = fsl,bsc9132-l2-cache-controller, cache;
+   reg = 0x2 0x1000;
+   cache-line-size = 32; // 32 bytes
+   cache-size = 0x4; // L2,256K
+   interrupts = 16 2 1 0;
+   };
diff --git a/Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt 
b/Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt
new file mode 100644
index 000..70b42bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt
@@ -0,0 +1,16 @@
+Freescale DDR memory controller
+
+Properties:
+
+- compatible   : Should include fsl,chip-memory-controller where
+ chip is the processor (bsc9132, mpc8572 etc.)
+- reg  : Address and size of DDR controller registers
+- interrupts   : Error interrupt of DDR controller
+
+Example:
+
+   memory-controller@2000 {
+   compatible = fsl,bsc9132-memory-controller;
+   reg = 0x2000 0x1000;
+   interrupts = 16 2 1 8;
+   };
diff --git a/Documentation/devicetree/bindings/usb/fsl-usb.txt 
b/Documentation/devicetree/bindings/usb/fsl-usb.txt
index bd5723f..afa5809 100644
--- a/Documentation/devicetree/bindings/usb/fsl-usb.txt
+++ b/Documentation/devicetree/bindings/usb/fsl-usb.txt
@@ -9,6 +9,8 @@ Required properties :
  - compatible : Should be fsl-usb2-mph for multi port host USB
controllers, or fsl-usb2-dr for dual role USB controllers
or fsl,mpc5121-usb2-dr for dual role USB controllers of MPC5121
+   Wherever applicable, the IP version of the USB controller should
+   also be mentioned (for eg. fsl-usb2-dr-v2.2 for bsc9132).
  - phy_type : For multi port host USB controllers, should be one of
ulpi, or serial. For dual role USB controllers, should be
one of ulpi, utmi, utmi_wide, or serial.
-- 
1.7.6.GIT


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev