RE: [PATCH] fbcon: warn on invalid cursor blink intervals

2016-06-11 Thread Chintakuntla, Radha

> -Original Message-
> From: Henrique de Moraes Holschuh [mailto:h...@hmh.eng.br]
> Sent: Saturday, May 28, 2016 4:49 AM
> To: Scot Doyle 
> Cc: Tomi Valkeinen ; Jean-Christophe Plagniol-
> Villard ; Greg Kroah-Hartman
> ; Jeremy Kerr ; Ming Lei
> ; Daney, David ;
> Dann Frazier ; Peter Hurley
> ; Pavel Machek ; Jonathan Liu
> ; Alistair Popple ; Jean-Philippe
> Brucker ; Chintakuntla, Radha
> ; Jiri Slaby ; David
> Airlie ; David Daney ; dri-
> de...@lists.freedesktop.org; linux-fb...@vger.kernel.org; Linux Kernel
> Mailing List ; stable
> 
> Subject: Re: [PATCH] fbcon: warn on invalid cursor blink intervals
> 
> On Fri, 20 May 2016, Scot Doyle wrote:
> > On Fri, 20 May 2016, Jeremy Kerr wrote:
> > > >Then looks there are two fix patches acked & tested:
> > > >
> > > > - the patch in this thread
> > > > - another one "[PATCH] tty: vt: Fix soft lockup in fbcon cursor
> > > >blink timer."
> > > > https://lkml.org/lkml/2016/5/17/455
> > > >
> > > >So which one will be pushed to linus?
> > >
> > > Not that it's my call, but we may want both; the first as a safety
> > > measure to prevent an invalid cur_blink_jiffies ever being set, and the
> > > second one to actually fix the initialisation of vc_cur_blink_ms (and
> > > address the warning introduced by the first).
> >
> > Tomi / Greg,
> >
> > I'd suggest
> > - applying "tty: vt: Fix soft lockup in fbcon cursor blink timer." to 4.7 
> > and
> stable[4.2]
> > - applying "fbcon: warn on invalid cursor blink intervals" to 4.7
> > - ignoring "fbcon: use default if cursor blink interval is not valid"
> >
> > Note: the patches don't depend on each other
> 
> I applied both recommended patches on top of 4.4.11 for testing, and they
> made things a lot better here.
> 
> I suggest the second patch should be backported to stable too, might as well
> fix this thing for good *and keep the door closed*.

Is this patch available on some tree so that I can point to ?
And hope it will make it to linux-next soon ?

> 
> --
>   "One disk to rule them all, One disk to find them. One disk to bring
>   them all and in the darkness grind them. In the Land of Redmond
>   where the shadows lie." -- The Silicon Valley Tarot
>   Henrique Holschuh


RE: [PATCH] fbcon: warn on invalid cursor blink intervals

2016-06-11 Thread Chintakuntla, Radha

> -Original Message-
> From: Henrique de Moraes Holschuh [mailto:h...@hmh.eng.br]
> Sent: Saturday, May 28, 2016 4:49 AM
> To: Scot Doyle 
> Cc: Tomi Valkeinen ; Jean-Christophe Plagniol-
> Villard ; Greg Kroah-Hartman
> ; Jeremy Kerr ; Ming Lei
> ; Daney, David ;
> Dann Frazier ; Peter Hurley
> ; Pavel Machek ; Jonathan Liu
> ; Alistair Popple ; Jean-Philippe
> Brucker ; Chintakuntla, Radha
> ; Jiri Slaby ; David
> Airlie ; David Daney ; dri-
> de...@lists.freedesktop.org; linux-fb...@vger.kernel.org; Linux Kernel
> Mailing List ; stable
> 
> Subject: Re: [PATCH] fbcon: warn on invalid cursor blink intervals
> 
> On Fri, 20 May 2016, Scot Doyle wrote:
> > On Fri, 20 May 2016, Jeremy Kerr wrote:
> > > >Then looks there are two fix patches acked & tested:
> > > >
> > > > - the patch in this thread
> > > > - another one "[PATCH] tty: vt: Fix soft lockup in fbcon cursor
> > > >blink timer."
> > > > https://lkml.org/lkml/2016/5/17/455
> > > >
> > > >So which one will be pushed to linus?
> > >
> > > Not that it's my call, but we may want both; the first as a safety
> > > measure to prevent an invalid cur_blink_jiffies ever being set, and the
> > > second one to actually fix the initialisation of vc_cur_blink_ms (and
> > > address the warning introduced by the first).
> >
> > Tomi / Greg,
> >
> > I'd suggest
> > - applying "tty: vt: Fix soft lockup in fbcon cursor blink timer." to 4.7 
> > and
> stable[4.2]
> > - applying "fbcon: warn on invalid cursor blink intervals" to 4.7
> > - ignoring "fbcon: use default if cursor blink interval is not valid"
> >
> > Note: the patches don't depend on each other
> 
> I applied both recommended patches on top of 4.4.11 for testing, and they
> made things a lot better here.
> 
> I suggest the second patch should be backported to stable too, might as well
> fix this thing for good *and keep the door closed*.

Is this patch available on some tree so that I can point to ?
And hope it will make it to linux-next soon ?

> 
> --
>   "One disk to rule them all, One disk to find them. One disk to bring
>   them all and in the darkness grind them. In the Land of Redmond
>   where the shadows lie." -- The Silicon Valley Tarot
>   Henrique Holschuh


(.init.text+0x2b8): multiple definition of `plat_irq_setup'

2016-06-11 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8714f8f5fe396ca513ccaaac2304497439c181fb
commit: 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f sh: add device tree support 
and generic board using device tree
date:   3 months ago
config: sh-allyesconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f
# save the attached .config to linux build tree
make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   arch/sh/boards/built-in.o: In function `plat_irq_setup':
>> (.init.text+0x2b8): multiple definition of `plat_irq_setup'
   arch/sh/kernel/built-in.o:(.init.text+0x1250): first defined here
   arch/sh/boards/built-in.o: In function `arch_init_clk_ops':
>> (.init.text+0x294): multiple definition of `arch_init_clk_ops'
   arch/sh/kernel/built-in.o:(.init.text+0x1300): first defined here

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


(.init.text+0x2b8): multiple definition of `plat_irq_setup'

2016-06-11 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8714f8f5fe396ca513ccaaac2304497439c181fb
commit: 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f sh: add device tree support 
and generic board using device tree
date:   3 months ago
config: sh-allyesconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f
# save the attached .config to linux build tree
make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   arch/sh/boards/built-in.o: In function `plat_irq_setup':
>> (.init.text+0x2b8): multiple definition of `plat_irq_setup'
   arch/sh/kernel/built-in.o:(.init.text+0x1250): first defined here
   arch/sh/boards/built-in.o: In function `arch_init_clk_ops':
>> (.init.text+0x294): multiple definition of `arch_init_clk_ops'
   arch/sh/kernel/built-in.o:(.init.text+0x1300): first defined here

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: PROBLEM: Resume form hibernate broken by setting NX on gap

2016-06-11 Thread Logan Gunthorpe

Hey,

On 11/06/16 07:05 PM, Rafael J. Wysocki wrote:

1) Commit ab76f7b4ab only extends the NX bit between __ex_table and
rodata; which, by my understanding, shouldn't be used by anything. And
__ex_table and rodata are fixed by the kernel's binary so both symbols
should be the same in both the image kernel and the boot kernel given
that both are running from the same binary.


Well, what if the kernel is relocated?


Ah, I'm sure I don't fully grasp the implications of that but I would 
assume that if the image kernel were located somewhere else it would 
still be far away from the boot kernel's ex_table/rodata boundary.



2) When ab76f7b4ab is reverted, hibernation seems to work 100%. Though,
when it's in place, it only works some of the time. Given that commit is
only extending the NX region a bit, if there is some random mismatch,
why does it never reach rodata? In other words, why is rodata a magic
line that seems to work all the time -- why doesn't this random mismatch
ever extend into the rodata region? rodata isn't _that_ far away from
the end of ex_table.


That's a very good question. :-)


Yeah, I guess if we knew the answer we'd understand what was going on 
and have a fix.




Can you please check if the patch below makes any difference?


I'm afraid it's no different. The kernel still freezes on resume. 
Though, no warnings with this one.


Thanks,

Logan


Re: PROBLEM: Resume form hibernate broken by setting NX on gap

2016-06-11 Thread Logan Gunthorpe

Hey,

On 11/06/16 07:05 PM, Rafael J. Wysocki wrote:

1) Commit ab76f7b4ab only extends the NX bit between __ex_table and
rodata; which, by my understanding, shouldn't be used by anything. And
__ex_table and rodata are fixed by the kernel's binary so both symbols
should be the same in both the image kernel and the boot kernel given
that both are running from the same binary.


Well, what if the kernel is relocated?


Ah, I'm sure I don't fully grasp the implications of that but I would 
assume that if the image kernel were located somewhere else it would 
still be far away from the boot kernel's ex_table/rodata boundary.



2) When ab76f7b4ab is reverted, hibernation seems to work 100%. Though,
when it's in place, it only works some of the time. Given that commit is
only extending the NX region a bit, if there is some random mismatch,
why does it never reach rodata? In other words, why is rodata a magic
line that seems to work all the time -- why doesn't this random mismatch
ever extend into the rodata region? rodata isn't _that_ far away from
the end of ex_table.


That's a very good question. :-)


Yeah, I guess if we knew the answer we'd understand what was going on 
and have a fix.




Can you please check if the patch below makes any difference?


I'm afraid it's no different. The kernel still freezes on resume. 
Though, no warnings with this one.


Thanks,

Logan


Re: [PATCH v2 2/2] ARM: dts: sd_600eval: Fix eMMC lockup issue

2016-06-11 Thread Bjorn Andersson
On Fri 10 Jun 11:19 PDT 2016, Srinivas Kandagatla wrote:

> From: Parth Pancholi 
> 
> This board locks up if we stress test the eMMC, as the regulator s4 is
> unable to supply enough current for all the peripherials attached to it.
> As this supply is wired up to most of the peripherials including DDR,
> it resulted in such lockup.
> 
> This patch fixes this issue by setting s4 regulator correctly with
> Auto power mode.
> 
> Reported-by: Srinivas Kandagatla 
> [Srinivas Kandagatla: rewrote the change log]
> Tested-by: Girish Sharma 
> Signed-off-by: Parth Pancholi 

If I read the msm-3.4 tree correctly most (perhaps all) 8064 devices
should have this setup.

Acked-by: Bjorn Andersson 

Regards,
Bjorn

> ---
>  arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts 
> b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts
> index 7df0108..39ae2bc 100644
> --- a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts
> +++ b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts
> @@ -1,6 +1,7 @@
>  #include "qcom-apq8064-v2.0.dtsi"
>  #include "qcom-apq8064-arrow-sd-600eval-pins.dtsi"
>  #include 
> +#include 
>  
>  / {
>   model = "Arrow Electronics, APQ8064 SD_600eval";
> @@ -82,7 +83,8 @@
>   s4 {
>   regulator-min-microvolt = <180>;
>   regulator-max-microvolt = <180>;
> - qcom,switch-mode-frequency = <320>;
> + qcom,switch-mode-frequency = <160>;
> + qcom,force-mode = 
> ;
>   bias-pull-down;
>   regulator-always-on;
>   };
> -- 
> 2.8.3
> 


Re: [PATCH v2 2/2] ARM: dts: sd_600eval: Fix eMMC lockup issue

2016-06-11 Thread Bjorn Andersson
On Fri 10 Jun 11:19 PDT 2016, Srinivas Kandagatla wrote:

> From: Parth Pancholi 
> 
> This board locks up if we stress test the eMMC, as the regulator s4 is
> unable to supply enough current for all the peripherials attached to it.
> As this supply is wired up to most of the peripherials including DDR,
> it resulted in such lockup.
> 
> This patch fixes this issue by setting s4 regulator correctly with
> Auto power mode.
> 
> Reported-by: Srinivas Kandagatla 
> [Srinivas Kandagatla: rewrote the change log]
> Tested-by: Girish Sharma 
> Signed-off-by: Parth Pancholi 

If I read the msm-3.4 tree correctly most (perhaps all) 8064 devices
should have this setup.

Acked-by: Bjorn Andersson 

Regards,
Bjorn

> ---
>  arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts 
> b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts
> index 7df0108..39ae2bc 100644
> --- a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts
> +++ b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts
> @@ -1,6 +1,7 @@
>  #include "qcom-apq8064-v2.0.dtsi"
>  #include "qcom-apq8064-arrow-sd-600eval-pins.dtsi"
>  #include 
> +#include 
>  
>  / {
>   model = "Arrow Electronics, APQ8064 SD_600eval";
> @@ -82,7 +83,8 @@
>   s4 {
>   regulator-min-microvolt = <180>;
>   regulator-max-microvolt = <180>;
> - qcom,switch-mode-frequency = <320>;
> + qcom,switch-mode-frequency = <160>;
> + qcom,force-mode = 
> ;
>   bias-pull-down;
>   regulator-always-on;
>   };
> -- 
> 2.8.3
> 


Re: undefined reference to `printk'

2016-06-11 Thread Josh Triplett
[Adding LKML, linux-arch, and Linus.]

On Sun, Jun 12, 2016 at 10:17:01AM +0800, kbuild test robot wrote:
> All errors (new ones prefixed by >>):
> 
>arch/m32r/kernel/built-in.o: In function `default_eit_handler':
> >> (.text+0x3f8): undefined reference to `printk'
>arch/m32r/kernel/built-in.o: In function `default_eit_handler':
>(.text+0x3f8): relocation truncated to fit: R_M32R_26_PCREL_RELA against 
> undefined symbol `printk'

As far as I can tell, there has been a patch available for this for
months, and it still doesn't seem to have been applied anywhere.

m32r is listed in MAINTAINERS as "Orphan", and has been since commit
b4174867bee83e79dc155479cb1b67c452da6476 in 2014.  And that commit
in turn observed no commits from the maintainer since 2009.  Looking at
the log for arch/m32r, I don't see any activity other than random fixes
by others, and based on the signoffs, all of those seem to go through
miscellaneous trees.

Is anyone using m32r?  Is anyone willing to maintain it?  And if not,
should we consider removing it?

- Josh Triplett


Re: undefined reference to `printk'

2016-06-11 Thread Josh Triplett
[Adding LKML, linux-arch, and Linus.]

On Sun, Jun 12, 2016 at 10:17:01AM +0800, kbuild test robot wrote:
> All errors (new ones prefixed by >>):
> 
>arch/m32r/kernel/built-in.o: In function `default_eit_handler':
> >> (.text+0x3f8): undefined reference to `printk'
>arch/m32r/kernel/built-in.o: In function `default_eit_handler':
>(.text+0x3f8): relocation truncated to fit: R_M32R_26_PCREL_RELA against 
> undefined symbol `printk'

As far as I can tell, there has been a patch available for this for
months, and it still doesn't seem to have been applied anywhere.

m32r is listed in MAINTAINERS as "Orphan", and has been since commit
b4174867bee83e79dc155479cb1b67c452da6476 in 2014.  And that commit
in turn observed no commits from the maintainer since 2009.  Looking at
the log for arch/m32r, I don't see any activity other than random fixes
by others, and based on the signoffs, all of those seem to go through
miscellaneous trees.

Is anyone using m32r?  Is anyone willing to maintain it?  And if not,
should we consider removing it?

- Josh Triplett


[PATCH] perf annotate: ARM64 support

2016-06-11 Thread Andrew Pinski
Add basic support to parse ARM64 assembly.

This:

* enables perf to correctly show the disassembly, rather than chopping
  some constants off at the '#'.  '#' is not the comment character
  for ARM64.

* allows perf to identify ARM64 instructions that branch to other parts
  within the same function, thereby properly annotating them.

* allows perf to identify function calls, allowing called functions to
  be followed in the annotated view.

Signed-off-by: Andrew Pinski 
---
 tools/perf/util/annotate.c | 64 +++---
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 7e5a1e8..ea915e8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -65,7 +65,7 @@ static int call__parse(struct ins_operands *ops)
 
name++;
 
-#ifdef __arm__
+#if defined(__arm__) || defined(__aarch64__)
if (strchr(name, '+'))
return -1;
 #endif
@@ -119,9 +119,22 @@ bool ins__is_call(const struct ins *ins)
 
 static int jump__parse(struct ins_operands *ops)
 {
-   const char *s = strchr(ops->raw, '+');
+   const char *raw = ops->raw;
+   const char *s;
+#ifdef __aarch64__
+   /* Skip over one or two commas so that cbz and tbz works. */
+   const char *comma = strchr(raw, ',');
+
+   if (comma) {
+   raw = comma + 1;
+   comma = strchr(raw, ',');
+   if (comma)
+   raw = comma + 1;
+   }
+#endif
+   s = strchr(raw, '+');
 
-   ops->target.addr = strtoull(ops->raw, NULL, 16);
+   ops->target.addr = strtoull(raw, NULL, 16);
 
if (s++ != NULL)
ops->target.offset = strtoull(s, NULL, 16);
@@ -134,6 +147,25 @@ static int jump__parse(struct ins_operands *ops)
 static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
   struct ins_operands *ops)
 {
+#ifdef __aarch64__
+   const char *comma0 = strchr(ops->raw, ',');
+
+   if (comma0) {
+   const char *comma1 = strchr(comma0 + 1, ',');
+
+   if (comma1)
+   return scnprintf(bf, size,
+"%-6.6s %.*s, %.*s, %" PRIx64,
+ins->name,
+(int)(comma0 - ops->raw), ops->raw,
+(int)(comma1 - comma0 - 1), comma0 + 1,
+ops->target.offset);
+
+   return scnprintf(bf, size, "%-6.6s %.*s, %" PRIx64, ins->name,
+(int)(comma0 - ops->raw), ops->raw,
+ops->target.offset);
+   }
+#endif
return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, 
ops->target.offset);
 }
 
@@ -253,6 +285,8 @@ static int mov__parse(struct ins_operands *ops)
target = ++s;
 #ifdef __arm__
comment = strchr(s, ';');
+#elif defined(__aarch64__)
+   comment = strstr(s, "//");
 #else
comment = strchr(s, '#');
 #endif
@@ -355,6 +389,29 @@ static struct ins_ops nop_ops = {
 };
 
 static struct ins instructions[] = {
+#ifdef __aarch64__
+   { .name = "b", .ops  = _ops, }, // might also be a call
+   { .name = "b.cc",  .ops  = _ops, },
+   { .name = "b.cs",  .ops  = _ops, },
+   { .name = "b.eq",  .ops  = _ops, },
+   { .name = "b.ge",  .ops  = _ops, },
+   { .name = "b.gt",  .ops  = _ops, },
+   { .name = "b.hi",  .ops  = _ops, },
+   { .name = "b.le",  .ops  = _ops, },
+   { .name = "b.ls",  .ops  = _ops, },
+   { .name = "b.lt",  .ops  = _ops, },
+   { .name = "b.ne",  .ops  = _ops, },
+   { .name = "b.pl",  .ops  = _ops, },
+   { .name = "bl",.ops  = _ops, },
+   { .name = "cbnz",  .ops  = _ops, },
+   { .name = "cbz",   .ops  = _ops, },
+   { .name = "dec",   .ops  = _ops, },
+   { .name = "lock",  .ops  = _ops, }, // fake one
+   { .name = "mov",   .ops  = _ops, },
+   { .name = "nop",   .ops  = _ops, },
+   { .name = "tbnz",  .ops  = _ops, },
+   { .name = "tbz",   .ops  = _ops, },
+#else
{ .name = "add",   .ops  = _ops, },
{ .name = "addl",  .ops  = _ops, },
{ .name = "addq",  .ops  = _ops, },
@@ -444,6 +501,7 @@ static struct ins instructions[] = {
{ .name = "xadd",  .ops  = _ops, },
{ .name = "xbeginl", .ops  = _ops, },
{ .name = "xbeginq", .ops  = _ops, },
+#endif
 };
 
 static int ins__key_cmp(const void *name, const void *insp)
-- 
1.9.1



[PATCH] perf annotate: ARM64 support

2016-06-11 Thread Andrew Pinski
Add basic support to parse ARM64 assembly.

This:

* enables perf to correctly show the disassembly, rather than chopping
  some constants off at the '#'.  '#' is not the comment character
  for ARM64.

* allows perf to identify ARM64 instructions that branch to other parts
  within the same function, thereby properly annotating them.

* allows perf to identify function calls, allowing called functions to
  be followed in the annotated view.

Signed-off-by: Andrew Pinski 
---
 tools/perf/util/annotate.c | 64 +++---
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 7e5a1e8..ea915e8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -65,7 +65,7 @@ static int call__parse(struct ins_operands *ops)
 
name++;
 
-#ifdef __arm__
+#if defined(__arm__) || defined(__aarch64__)
if (strchr(name, '+'))
return -1;
 #endif
@@ -119,9 +119,22 @@ bool ins__is_call(const struct ins *ins)
 
 static int jump__parse(struct ins_operands *ops)
 {
-   const char *s = strchr(ops->raw, '+');
+   const char *raw = ops->raw;
+   const char *s;
+#ifdef __aarch64__
+   /* Skip over one or two commas so that cbz and tbz works. */
+   const char *comma = strchr(raw, ',');
+
+   if (comma) {
+   raw = comma + 1;
+   comma = strchr(raw, ',');
+   if (comma)
+   raw = comma + 1;
+   }
+#endif
+   s = strchr(raw, '+');
 
-   ops->target.addr = strtoull(ops->raw, NULL, 16);
+   ops->target.addr = strtoull(raw, NULL, 16);
 
if (s++ != NULL)
ops->target.offset = strtoull(s, NULL, 16);
@@ -134,6 +147,25 @@ static int jump__parse(struct ins_operands *ops)
 static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
   struct ins_operands *ops)
 {
+#ifdef __aarch64__
+   const char *comma0 = strchr(ops->raw, ',');
+
+   if (comma0) {
+   const char *comma1 = strchr(comma0 + 1, ',');
+
+   if (comma1)
+   return scnprintf(bf, size,
+"%-6.6s %.*s, %.*s, %" PRIx64,
+ins->name,
+(int)(comma0 - ops->raw), ops->raw,
+(int)(comma1 - comma0 - 1), comma0 + 1,
+ops->target.offset);
+
+   return scnprintf(bf, size, "%-6.6s %.*s, %" PRIx64, ins->name,
+(int)(comma0 - ops->raw), ops->raw,
+ops->target.offset);
+   }
+#endif
return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, 
ops->target.offset);
 }
 
@@ -253,6 +285,8 @@ static int mov__parse(struct ins_operands *ops)
target = ++s;
 #ifdef __arm__
comment = strchr(s, ';');
+#elif defined(__aarch64__)
+   comment = strstr(s, "//");
 #else
comment = strchr(s, '#');
 #endif
@@ -355,6 +389,29 @@ static struct ins_ops nop_ops = {
 };
 
 static struct ins instructions[] = {
+#ifdef __aarch64__
+   { .name = "b", .ops  = _ops, }, // might also be a call
+   { .name = "b.cc",  .ops  = _ops, },
+   { .name = "b.cs",  .ops  = _ops, },
+   { .name = "b.eq",  .ops  = _ops, },
+   { .name = "b.ge",  .ops  = _ops, },
+   { .name = "b.gt",  .ops  = _ops, },
+   { .name = "b.hi",  .ops  = _ops, },
+   { .name = "b.le",  .ops  = _ops, },
+   { .name = "b.ls",  .ops  = _ops, },
+   { .name = "b.lt",  .ops  = _ops, },
+   { .name = "b.ne",  .ops  = _ops, },
+   { .name = "b.pl",  .ops  = _ops, },
+   { .name = "bl",.ops  = _ops, },
+   { .name = "cbnz",  .ops  = _ops, },
+   { .name = "cbz",   .ops  = _ops, },
+   { .name = "dec",   .ops  = _ops, },
+   { .name = "lock",  .ops  = _ops, }, // fake one
+   { .name = "mov",   .ops  = _ops, },
+   { .name = "nop",   .ops  = _ops, },
+   { .name = "tbnz",  .ops  = _ops, },
+   { .name = "tbz",   .ops  = _ops, },
+#else
{ .name = "add",   .ops  = _ops, },
{ .name = "addl",  .ops  = _ops, },
{ .name = "addq",  .ops  = _ops, },
@@ -444,6 +501,7 @@ static struct ins instructions[] = {
{ .name = "xadd",  .ops  = _ops, },
{ .name = "xbeginl", .ops  = _ops, },
{ .name = "xbeginq", .ops  = _ops, },
+#endif
 };
 
 static int ins__key_cmp(const void *name, const void *insp)
-- 
1.9.1



Re: [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver

2016-06-11 Thread kbuild test robot
Hi,

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-Add-MediaTek-USB3-DRD-Driver/20160610-153559
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
usb-testing
config: i386-randconfig-x011-06120748 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

warning: (USB_MTU3) selects USB_XHCI_MTK which has unmet direct dependencies 
(USB_SUPPORT && USB && USB_XHCI_HCD && (ARCH_MEDIATEK || COMPILE_TEST))
   drivers/built-in.o: In function `mtu3_probe':
>> mtu3_plat.c:(.text+0x21471d): undefined reference to 
>> `extcon_get_edev_by_phandle'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver

2016-06-11 Thread kbuild test robot
Hi,

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-Add-MediaTek-USB3-DRD-Driver/20160610-153559
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
usb-testing
config: i386-randconfig-x011-06120748 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

warning: (USB_MTU3) selects USB_XHCI_MTK which has unmet direct dependencies 
(USB_SUPPORT && USB && USB_XHCI_HCD && (ARCH_MEDIATEK || COMPILE_TEST))
   drivers/built-in.o: In function `mtu3_probe':
>> mtu3_plat.c:(.text+0x21471d): undefined reference to 
>> `extcon_get_edev_by_phandle'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH perf/core v10 09/23] perf probe: Show all cached probes

2016-06-11 Thread Masami Hiramatsu
On Sat, 11 Jun 2016 09:28:09 +0900
Masami Hiramatsu  wrote:

> On Thu, 9 Jun 2016 11:22:55 -0300
> Arnaldo Carvalho de Melo  wrote:
> 
> > Em Wed, Jun 08, 2016 at 06:30:30PM +0900, Masami Hiramatsu escreveu:
> > > +char *build_id_cache__origname(const char *sbuild_id)
> > > +{
> > > + char *linkname;
> > > + char buf[PATH_MAX];
> > > + char *ret = NULL, *p;
> > > + size_t offs = 5;/* == strlen("../..") */
> > > +
> > > + linkname = build_id_cache__linkname(sbuild_id, NULL, 0);
> > > + if (!linkname)
> > > + return NULL;
> > > +
> > > + if (readlink(linkname, buf, PATH_MAX) < 0)
> > > + goto out;
> > > + /* The link should be "../../" */
> > > + p = strrchr(buf, '/');  /* Cut off the "/" */
> > > + if (p && (p > buf + offs)) {
> > > + *p = '\0';
> > > + if (buf[offs + 1] == '[')
> > > + offs++; /*
> > > +  * This is a DSO name, like [kernel.kallsyms].
> > > +  * Skip the first '/', since this is not the
> > > +  * cache of a regular file.
> > > +  */
> > > + ret = strdup(buf + offs);   /* Skip "../..[/]" */
> > 
> > strdup can fail.
> 
> Ah, right.

In this case, build_id_cache__origname() returns ret immediately(see below),
so we don't need to take reaction about that :)

> > > + }
> > > +out:
> > > + free(linkname);
> > > + return ret;
> > > +}

here, if strdup() fails, this just return NULL. that is OK.

Thanks!
-- 
Masami Hiramatsu 


Re: [PATCH perf/core v10 09/23] perf probe: Show all cached probes

2016-06-11 Thread Masami Hiramatsu
On Sat, 11 Jun 2016 09:28:09 +0900
Masami Hiramatsu  wrote:

> On Thu, 9 Jun 2016 11:22:55 -0300
> Arnaldo Carvalho de Melo  wrote:
> 
> > Em Wed, Jun 08, 2016 at 06:30:30PM +0900, Masami Hiramatsu escreveu:
> > > +char *build_id_cache__origname(const char *sbuild_id)
> > > +{
> > > + char *linkname;
> > > + char buf[PATH_MAX];
> > > + char *ret = NULL, *p;
> > > + size_t offs = 5;/* == strlen("../..") */
> > > +
> > > + linkname = build_id_cache__linkname(sbuild_id, NULL, 0);
> > > + if (!linkname)
> > > + return NULL;
> > > +
> > > + if (readlink(linkname, buf, PATH_MAX) < 0)
> > > + goto out;
> > > + /* The link should be "../../" */
> > > + p = strrchr(buf, '/');  /* Cut off the "/" */
> > > + if (p && (p > buf + offs)) {
> > > + *p = '\0';
> > > + if (buf[offs + 1] == '[')
> > > + offs++; /*
> > > +  * This is a DSO name, like [kernel.kallsyms].
> > > +  * Skip the first '/', since this is not the
> > > +  * cache of a regular file.
> > > +  */
> > > + ret = strdup(buf + offs);   /* Skip "../..[/]" */
> > 
> > strdup can fail.
> 
> Ah, right.

In this case, build_id_cache__origname() returns ret immediately(see below),
so we don't need to take reaction about that :)

> > > + }
> > > +out:
> > > + free(linkname);
> > > + return ret;
> > > +}

here, if strdup() fails, this just return NULL. that is OK.

Thanks!
-- 
Masami Hiramatsu 


Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file

2016-06-11 Thread Oleg Drokin

On Jun 11, 2016, at 10:50 PM, Jeff Layton wrote:

> On Sat, 2016-06-11 at 22:06 -0400, Oleg Drokin wrote:
>> 
>> Hm. I am trying to lock the newly initialized one and that seems to be 
>> holding up
>> well (but I want 24 hours just to be extra sure).
>> Hn, I just noticed a bug in this, so that'll reset the clock back.
>> 
>> But I think we cannot return with locked one if we found existing one due to 
>> lock
>> inversion?
>> I see that normally first we lock the state rwsem (now mutex) and then
>> lock the fi_lock.
>> Now if we make init_open_stateid() to lock the new state mutex while the 
>> fi_lock
>> is locked - that's probably ok, because we can do it before adding it to the 
>> list,
>> so nobody can find it.
>> Now the existing state that we find, we cannot really lock while holding 
>> that fi_lock,
>> because what if there's a parallel thread that already holds the mutex and 
>> now
>> wants the fi_lock?
>> And so it's probably best to return with existing state unlocked and let 
>> caller lock it?
>> Or do you think it's best to separately lock the found stp outside of 
>> spinlock
>> just for consistency?
> 
> I think we just have to ensure that if the new stateid is hashed that
> its mutex is locked prior to being inserted into the hashtable. That
> should prevent the race you mentioned.
> 
> If we find an existing one in the hashtable in init_open_stateid, then
> we _can_ take the mutex after dropping the spinlocks, since we won't
> call release_open_stateid in that case anyway.

Yes.

> We'll also need to consider what happens if nfs4_get_vfs_file fails
> after we hashed the stateid, but then another task finds it while
> processing another open. So we might have to have release_open_stateid
> unlock the mutex after unhashing the stateid, but before putting the
> reference, and then have init_open_stateid check to see if the thing is
> still hashed after it gets the mutex.

Hm.
So what's going to go wrong if another user reuses the unhashed stateid?
As long as they drop it once they are done it'll be freed and all is fine, no?
Are there other implications?
Hm, it looks like free_ol_stateid_reaplist() just frees the thing without any 
looking
into mutexes and stuff?

Ok, so we get the mutex, check that the stateid is hashed, it's not anymore
(actually unhashing could be done without mutex too, right? so just mutex held
is not going to protect us), then we need to drop the mutex and restart the 
search
from scratch (including all relocking), I assume?
I guess I'll have it as a separate follow on patch.
We'll probably also need some fault-injection here to trigger this case, as 
triggering
it "naturally" will be a tough problem even on my mega-racy setup.

Something like:
if (swapstp) {
…
}
if (FAULTINJECTION) {
msleep(some_random_time);
status = nfserr_eio;
} else
status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, 
open); 

should increase the chance.
Ideally there'd be a way to trigger this case more deterministically,
how do I have two OPEN requests in parallel in NFS for the same file,
just have two threads do it and that would 100% result in two requests,
no merging anywhere along the way that I need to be aware of?


Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file

2016-06-11 Thread Oleg Drokin

On Jun 11, 2016, at 10:50 PM, Jeff Layton wrote:

> On Sat, 2016-06-11 at 22:06 -0400, Oleg Drokin wrote:
>> 
>> Hm. I am trying to lock the newly initialized one and that seems to be 
>> holding up
>> well (but I want 24 hours just to be extra sure).
>> Hn, I just noticed a bug in this, so that'll reset the clock back.
>> 
>> But I think we cannot return with locked one if we found existing one due to 
>> lock
>> inversion?
>> I see that normally first we lock the state rwsem (now mutex) and then
>> lock the fi_lock.
>> Now if we make init_open_stateid() to lock the new state mutex while the 
>> fi_lock
>> is locked - that's probably ok, because we can do it before adding it to the 
>> list,
>> so nobody can find it.
>> Now the existing state that we find, we cannot really lock while holding 
>> that fi_lock,
>> because what if there's a parallel thread that already holds the mutex and 
>> now
>> wants the fi_lock?
>> And so it's probably best to return with existing state unlocked and let 
>> caller lock it?
>> Or do you think it's best to separately lock the found stp outside of 
>> spinlock
>> just for consistency?
> 
> I think we just have to ensure that if the new stateid is hashed that
> its mutex is locked prior to being inserted into the hashtable. That
> should prevent the race you mentioned.
> 
> If we find an existing one in the hashtable in init_open_stateid, then
> we _can_ take the mutex after dropping the spinlocks, since we won't
> call release_open_stateid in that case anyway.

Yes.

> We'll also need to consider what happens if nfs4_get_vfs_file fails
> after we hashed the stateid, but then another task finds it while
> processing another open. So we might have to have release_open_stateid
> unlock the mutex after unhashing the stateid, but before putting the
> reference, and then have init_open_stateid check to see if the thing is
> still hashed after it gets the mutex.

Hm.
So what's going to go wrong if another user reuses the unhashed stateid?
As long as they drop it once they are done it'll be freed and all is fine, no?
Are there other implications?
Hm, it looks like free_ol_stateid_reaplist() just frees the thing without any 
looking
into mutexes and stuff?

Ok, so we get the mutex, check that the stateid is hashed, it's not anymore
(actually unhashing could be done without mutex too, right? so just mutex held
is not going to protect us), then we need to drop the mutex and restart the 
search
from scratch (including all relocking), I assume?
I guess I'll have it as a separate follow on patch.
We'll probably also need some fault-injection here to trigger this case, as 
triggering
it "naturally" will be a tough problem even on my mega-racy setup.

Something like:
if (swapstp) {
…
}
if (FAULTINJECTION) {
msleep(some_random_time);
status = nfserr_eio;
} else
status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, 
open); 

should increase the chance.
Ideally there'd be a way to trigger this case more deterministically,
how do I have two OPEN requests in parallel in NFS for the same file,
just have two threads do it and that would 100% result in two requests,
no merging anywhere along the way that I need to be aware of?


[PATCH 1/8] kexec_file: Remove unused members from struct kexec_buf.

2016-06-11 Thread Thiago Jung Bauermann
kexec_add_buffer uses kexec_buf.buffer and kexec_buf.bufsz to pass along
its own arguments buffer and bufsz, but since they aren't used anywhere
else, it's pointless.

Cc: Eric Biederman 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 kernel/kexec_file.c | 6 ++
 kernel/kexec_internal.h | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 01ab82a40d22..b6eec7527e9f 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -464,8 +464,6 @@ int kexec_add_buffer(struct kimage *image, char *buffer, 
unsigned long bufsz,
memset(, 0, sizeof(struct kexec_buf));
kbuf = 
kbuf->image = image;
-   kbuf->buffer = buffer;
-   kbuf->bufsz = bufsz;
 
kbuf->memsz = ALIGN(memsz, PAGE_SIZE);
kbuf->buf_align = max(buf_align, PAGE_SIZE);
@@ -489,8 +487,8 @@ int kexec_add_buffer(struct kimage *image, char *buffer, 
unsigned long bufsz,
 
/* Found a suitable memory range */
ksegment = >segment[image->nr_segments];
-   ksegment->kbuf = kbuf->buffer;
-   ksegment->bufsz = kbuf->bufsz;
+   ksegment->kbuf = buffer;
+   ksegment->bufsz = bufsz;
ksegment->mem = kbuf->mem;
ksegment->memsz = kbuf->memsz;
image->nr_segments++;
diff --git a/kernel/kexec_internal.h b/kernel/kexec_internal.h
index 0a52315d9c62..eefd5bf960c2 100644
--- a/kernel/kexec_internal.h
+++ b/kernel/kexec_internal.h
@@ -26,8 +26,6 @@ struct kexec_sha_region {
  */
 struct kexec_buf {
struct kimage *image;
-   char *buffer;
-   unsigned long bufsz;
unsigned long mem;
unsigned long memsz;
unsigned long buf_align;
-- 
1.9.1



[PATCH 1/8] kexec_file: Remove unused members from struct kexec_buf.

2016-06-11 Thread Thiago Jung Bauermann
kexec_add_buffer uses kexec_buf.buffer and kexec_buf.bufsz to pass along
its own arguments buffer and bufsz, but since they aren't used anywhere
else, it's pointless.

Cc: Eric Biederman 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 kernel/kexec_file.c | 6 ++
 kernel/kexec_internal.h | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 01ab82a40d22..b6eec7527e9f 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -464,8 +464,6 @@ int kexec_add_buffer(struct kimage *image, char *buffer, 
unsigned long bufsz,
memset(, 0, sizeof(struct kexec_buf));
kbuf = 
kbuf->image = image;
-   kbuf->buffer = buffer;
-   kbuf->bufsz = bufsz;
 
kbuf->memsz = ALIGN(memsz, PAGE_SIZE);
kbuf->buf_align = max(buf_align, PAGE_SIZE);
@@ -489,8 +487,8 @@ int kexec_add_buffer(struct kimage *image, char *buffer, 
unsigned long bufsz,
 
/* Found a suitable memory range */
ksegment = >segment[image->nr_segments];
-   ksegment->kbuf = kbuf->buffer;
-   ksegment->bufsz = kbuf->bufsz;
+   ksegment->kbuf = buffer;
+   ksegment->bufsz = bufsz;
ksegment->mem = kbuf->mem;
ksegment->memsz = kbuf->memsz;
image->nr_segments++;
diff --git a/kernel/kexec_internal.h b/kernel/kexec_internal.h
index 0a52315d9c62..eefd5bf960c2 100644
--- a/kernel/kexec_internal.h
+++ b/kernel/kexec_internal.h
@@ -26,8 +26,6 @@ struct kexec_sha_region {
  */
 struct kexec_buf {
struct kimage *image;
-   char *buffer;
-   unsigned long bufsz;
unsigned long mem;
unsigned long memsz;
unsigned long buf_align;
-- 
1.9.1



[PATCH 5/8] powerpc: Add functions to read ELF files of any endianness.

2016-06-11 Thread Thiago Jung Bauermann
A little endian kernel might need to kexec a big endian kernel (the
opposite is less likely but could happen as well), so we can't just cast
the buffer with the binary to ELF structs and use them as is done
elsewhere.

This patch adds functions which do byte-swapping as necessary when
populating the ELF structs. These functions will be used in the next
patch in the series.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/elf_util.h |  19 ++
 arch/powerpc/kernel/Makefile|   2 +-
 arch/powerpc/kernel/elf_util.c  | 476 
 3 files changed, 496 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
index 19ff3335d17d..9cd24bc528b1 100644
--- a/arch/powerpc/include/asm/elf_util.h
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -20,6 +20,14 @@
 #include 
 
 struct elf_info {
+   /*
+* Where the ELF binary contents are kept.
+* Memory managed by the user of the struct.
+*/
+   const char *buffer;
+
+   const struct elfhdr *ehdr;
+   const struct elf_phdr *proghdrs;
struct elf_shdr *sechdrs;
 
/* Index of stubs section. */
@@ -63,6 +71,17 @@ static inline unsigned long my_r2(const struct elf_info 
*elf_info)
return elf_info->sechdrs[elf_info->toc_section].sh_addr + 0x8000;
 }
 
+static inline bool elf_is_elf_file(const struct elfhdr *ehdr)
+{
+   return memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0;
+}
+
+int elf_read_from_buffer(const char *buf, size_t len, struct elfhdr *ehdr,
+struct elf_info *elf_info);
+void elf_init_elf_info(const struct elfhdr *ehdr, struct elf_shdr *sechdrs,
+  struct elf_info *elf_info);
+void elf_free_info(struct elf_info *elf_info);
+
 int elf64_apply_relocate_add(const struct elf_info *elf_info,
 const char *strtab, const Elf64_Rela *rela,
 unsigned int num_rela, void *syms_base,
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index e99f626acc85..8a53fccaa053 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -125,7 +125,7 @@ obj-y   += iomap.o
 endif
 
 ifeq ($(CONFIG_MODULES)$(CONFIG_WORD_SIZE),y64)
-obj-y  += elf_util_64.o
+obj-y  += elf_util.o elf_util_64.o
 endif
 
 obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM)  += tm.o
diff --git a/arch/powerpc/kernel/elf_util.c b/arch/powerpc/kernel/elf_util.c
new file mode 100644
index ..760be6a5c393
--- /dev/null
+++ b/arch/powerpc/kernel/elf_util.c
@@ -0,0 +1,476 @@
+/*
+ * Utility functions to work with ELF files.
+ *
+ * Copyright (C) 2016, IBM Corporation
+ *
+ * Based on kexec-tools' kexec-elf.c. Heavily modified for the
+ * kernel by Thiago Jung Bauermann .
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include 
+#include 
+#include 
+
+#if ELF_CLASS == ELFCLASS32
+#define elf_addr_to_cpuelf32_to_cpu
+
+#ifndef Elf_Rel
+#define Elf_RelElf32_Rel
+#endif /* Elf_Rel */
+#else /* ELF_CLASS == ELFCLASS32 */
+#define elf_addr_to_cpuelf64_to_cpu
+
+#ifndef Elf_Rel
+#define Elf_RelElf64_Rel
+#endif /* Elf_Rel */
+
+static uint64_t elf64_to_cpu(const struct elfhdr *ehdr, uint64_t value)
+{
+   if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+   value = le64_to_cpu(value);
+   else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+   value = be64_to_cpu(value);
+
+   return value;
+}
+#endif /* ELF_CLASS == ELFCLASS32 */
+
+static uint16_t elf16_to_cpu(const struct elfhdr *ehdr, uint16_t value)
+{
+   if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+   value = le16_to_cpu(value);
+   else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+   value = be16_to_cpu(value);
+
+   return value;
+}
+
+static uint32_t elf32_to_cpu(const struct elfhdr *ehdr, uint32_t value)
+{
+   if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+   value = le32_to_cpu(value);
+   else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+   value = be32_to_cpu(value);
+
+   return value;
+}
+
+/**
+ * elf_is_ehdr_sane - check that it is safe to use the ELF header
+ * @buf_len:   size of the buffer in which the ELF file is loaded.
+ */
+static bool elf_is_ehdr_sane(const struct elfhdr *ehdr, size_t buf_len)
+{
+   if 

[PATCH 5/8] powerpc: Add functions to read ELF files of any endianness.

2016-06-11 Thread Thiago Jung Bauermann
A little endian kernel might need to kexec a big endian kernel (the
opposite is less likely but could happen as well), so we can't just cast
the buffer with the binary to ELF structs and use them as is done
elsewhere.

This patch adds functions which do byte-swapping as necessary when
populating the ELF structs. These functions will be used in the next
patch in the series.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/elf_util.h |  19 ++
 arch/powerpc/kernel/Makefile|   2 +-
 arch/powerpc/kernel/elf_util.c  | 476 
 3 files changed, 496 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
index 19ff3335d17d..9cd24bc528b1 100644
--- a/arch/powerpc/include/asm/elf_util.h
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -20,6 +20,14 @@
 #include 
 
 struct elf_info {
+   /*
+* Where the ELF binary contents are kept.
+* Memory managed by the user of the struct.
+*/
+   const char *buffer;
+
+   const struct elfhdr *ehdr;
+   const struct elf_phdr *proghdrs;
struct elf_shdr *sechdrs;
 
/* Index of stubs section. */
@@ -63,6 +71,17 @@ static inline unsigned long my_r2(const struct elf_info 
*elf_info)
return elf_info->sechdrs[elf_info->toc_section].sh_addr + 0x8000;
 }
 
+static inline bool elf_is_elf_file(const struct elfhdr *ehdr)
+{
+   return memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0;
+}
+
+int elf_read_from_buffer(const char *buf, size_t len, struct elfhdr *ehdr,
+struct elf_info *elf_info);
+void elf_init_elf_info(const struct elfhdr *ehdr, struct elf_shdr *sechdrs,
+  struct elf_info *elf_info);
+void elf_free_info(struct elf_info *elf_info);
+
 int elf64_apply_relocate_add(const struct elf_info *elf_info,
 const char *strtab, const Elf64_Rela *rela,
 unsigned int num_rela, void *syms_base,
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index e99f626acc85..8a53fccaa053 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -125,7 +125,7 @@ obj-y   += iomap.o
 endif
 
 ifeq ($(CONFIG_MODULES)$(CONFIG_WORD_SIZE),y64)
-obj-y  += elf_util_64.o
+obj-y  += elf_util.o elf_util_64.o
 endif
 
 obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM)  += tm.o
diff --git a/arch/powerpc/kernel/elf_util.c b/arch/powerpc/kernel/elf_util.c
new file mode 100644
index ..760be6a5c393
--- /dev/null
+++ b/arch/powerpc/kernel/elf_util.c
@@ -0,0 +1,476 @@
+/*
+ * Utility functions to work with ELF files.
+ *
+ * Copyright (C) 2016, IBM Corporation
+ *
+ * Based on kexec-tools' kexec-elf.c. Heavily modified for the
+ * kernel by Thiago Jung Bauermann .
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include 
+#include 
+#include 
+
+#if ELF_CLASS == ELFCLASS32
+#define elf_addr_to_cpuelf32_to_cpu
+
+#ifndef Elf_Rel
+#define Elf_RelElf32_Rel
+#endif /* Elf_Rel */
+#else /* ELF_CLASS == ELFCLASS32 */
+#define elf_addr_to_cpuelf64_to_cpu
+
+#ifndef Elf_Rel
+#define Elf_RelElf64_Rel
+#endif /* Elf_Rel */
+
+static uint64_t elf64_to_cpu(const struct elfhdr *ehdr, uint64_t value)
+{
+   if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+   value = le64_to_cpu(value);
+   else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+   value = be64_to_cpu(value);
+
+   return value;
+}
+#endif /* ELF_CLASS == ELFCLASS32 */
+
+static uint16_t elf16_to_cpu(const struct elfhdr *ehdr, uint16_t value)
+{
+   if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+   value = le16_to_cpu(value);
+   else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+   value = be16_to_cpu(value);
+
+   return value;
+}
+
+static uint32_t elf32_to_cpu(const struct elfhdr *ehdr, uint32_t value)
+{
+   if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+   value = le32_to_cpu(value);
+   else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+   value = be32_to_cpu(value);
+
+   return value;
+}
+
+/**
+ * elf_is_ehdr_sane - check that it is safe to use the ELF header
+ * @buf_len:   size of the buffer in which the ELF file is loaded.
+ */
+static bool elf_is_ehdr_sane(const struct elfhdr *ehdr, size_t buf_len)
+{
+   if (ehdr->e_phnum > 0 && 

[PATCH 6/8] powerpc: Implement kexec_file_load.

2016-06-11 Thread Thiago Jung Bauermann
Adds the machinery needed by kexec_file_load, except actually loading
a kernel and initrd.

elf64_apply_relocate_add was extended to support relative symbols. This
is necessary because before relocation, the module loading mechanism
adjusts Elf64_Sym.st_value to point to the absolute memory address,
while the kexec purgatory relocation code does that during relocation.

We also add relocation types used by the purgatory.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/Kconfig   |  13 +++
 arch/powerpc/include/asm/elf_util.h|   1 +
 arch/powerpc/include/asm/systbl.h  |   1 +
 arch/powerpc/include/asm/unistd.h  |   2 +-
 arch/powerpc/include/uapi/asm/unistd.h |   1 +
 arch/powerpc/kernel/Makefile   |   4 +-
 arch/powerpc/kernel/elf_util_64.c  |  83 +++-
 arch/powerpc/kernel/machine_kexec_64.c | 139 +
 arch/powerpc/kernel/module_64.c|   5 +-
 9 files changed, 245 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 01f7464d9fea..3ed5770b89e4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -457,6 +457,19 @@ config KEXEC
  interface is strongly in flux, so no good recommendation can be
  made.
 
+config KEXEC_FILE
+   bool "kexec file based system call"
+   select KEXEC_CORE
+   select BUILD_BIN2C
+   depends on PPC64
+   depends on CRYPTO=y
+   depends on CRYPTO_SHA256=y
+   help
+ This is a new version of the kexec system call. This call is
+ file based and takes in file descriptors as system call arguments
+ for kernel and initramfs as opposed to a list of segments as is the
+ case for the older kexec call.
+
 config CRASH_DUMP
bool "Build a kdump crash kernel"
depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
index 9cd24bc528b1..41a172077f9e 100644
--- a/arch/powerpc/include/asm/elf_util.h
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -86,6 +86,7 @@ int elf64_apply_relocate_add(const struct elf_info *elf_info,
 const char *strtab, const Elf64_Rela *rela,
 unsigned int num_rela, void *syms_base,
 void *loc_base, Elf64_Addr addr_base,
+bool relative_symbols, bool check_symbols,
 const char *obj_name);
 
 #endif /* _ASM_POWERPC_ELF_UTIL_H */
diff --git a/arch/powerpc/include/asm/systbl.h 
b/arch/powerpc/include/asm/systbl.h
index 2fc5d4db503c..4b369d83fe9c 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -386,3 +386,4 @@ SYSCALL(mlock2)
 SYSCALL(copy_file_range)
 COMPAT_SYS_SPU(preadv2)
 COMPAT_SYS_SPU(pwritev2)
+SYSCALL(kexec_file_load)
diff --git a/arch/powerpc/include/asm/unistd.h 
b/arch/powerpc/include/asm/unistd.h
index cf12c580f6b2..a01e97d3f305 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
 #include 
 
 
-#define NR_syscalls382
+#define NR_syscalls383
 
 #define __NR__exit __NR_exit
 
diff --git a/arch/powerpc/include/uapi/asm/unistd.h 
b/arch/powerpc/include/uapi/asm/unistd.h
index e9f5f41aa55a..2f26335a3c42 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -392,5 +392,6 @@
 #define __NR_copy_file_range   379
 #define __NR_preadv2   380
 #define __NR_pwritev2  381
+#define __NR_kexec_file_load   382
 
 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 8a53fccaa053..c937b8074464 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -124,9 +124,11 @@ ifneq ($(CONFIG_PPC_INDIRECT_PIO),y)
 obj-y  += iomap.o
 endif
 
-ifeq ($(CONFIG_MODULES)$(CONFIG_WORD_SIZE),y64)
+ifneq ($(CONFIG_MODULES)$(CONFIG_KEXEC_FILE),)
+ifeq ($(CONFIG_WORD_SIZE),64)
 obj-y  += elf_util.o elf_util_64.o
 endif
+endif
 
 obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM)  += tm.o
 
diff --git a/arch/powerpc/kernel/elf_util_64.c 
b/arch/powerpc/kernel/elf_util_64.c
index cde0420add9e..287d381a1a86 100644
--- a/arch/powerpc/kernel/elf_util_64.c
+++ b/arch/powerpc/kernel/elf_util_64.c
@@ -74,6 +74,8 @@ static void squash_toc_save_inst(const char *name, unsigned 
long addr) { }
  * @syms_base: Contents of the associated symbol table.
  * @loc_base:  Contents of the section to which relocations apply.
  * @addr_base: The address where the section will be loaded in memory.
+ * @relative_symbols:  Are the symbols' st_value members relative?
+ * @check_symbols: Fail if an unexpected symbol is found?
  * @obj_name:  The name of the ELF binary, for information messages.
  *
  * Applies RELA 

[PATCH 3/8] powerpc: Factor out relocation code from module_64.c to elf_util_64.c.

2016-06-11 Thread Thiago Jung Bauermann
The kexec_file_load system call needs to relocate the purgatory, so
factor out the module relocation code so that it can be shared.

This patch's purpose is to move the ELF relocation logic from
apply_relocate_add to elf_util_64.c with as few changes as
possible. The following changes were needed:

To avoid having module-specific code in a general purpose utility
function, struct elf_info was created to contain the information
needed for ELF binaries manipulation.

my_r2, stub_for_addr and create_stub were changed to use it instead of
having to receive a struct module, since they are called from
elf64_apply_relocate_add.

local_entry_offset and squash_toc_save_inst were only used by
apply_rellocate_add, so they were moved to elf_util_64.c as well.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Cc: Torsten Duwe 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/elf_util.h |  70 
 arch/powerpc/include/asm/module.h   |  14 +-
 arch/powerpc/kernel/Makefile|   4 +
 arch/powerpc/kernel/elf_util_64.c   | 269 +++
 arch/powerpc/kernel/module_64.c | 312 
 5 files changed, 386 insertions(+), 283 deletions(-)

diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
new file mode 100644
index ..13d3ca113299
--- /dev/null
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -0,0 +1,70 @@
+/*
+ * Utility functions to work with ELF files.
+ *
+ * Copyright (C) 2016, IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _ASM_POWERPC_ELF_UTIL_H
+#define _ASM_POWERPC_ELF_UTIL_H
+
+#include 
+
+struct elf_info {
+   struct elf_shdr *sechdrs;
+
+   /* Index of stubs section. */
+   unsigned int stubs_section;
+   /* Index of TOC section. */
+   unsigned int toc_section;
+};
+
+#ifdef __powerpc64__
+#if defined(_CALL_ELF) && _CALL_ELF == 2
+
+/* An address is simply the address of the function. */
+typedef unsigned long func_desc_t;
+#else
+
+/* An address is address of the OPD entry, which contains address of fn. */
+typedef struct ppc64_opd_entry func_desc_t;
+#endif
+
+/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
+   the kernel itself).  But on PPC64, these need to be used for every
+   jump, actually, to reset r2 (TOC+0x8000). */
+struct ppc64_stub_entry
+{
+   /* 28 byte jump instruction sequence (7 instructions). We only
+* need 6 instructions on ABIv2 but we always allocate 7 so
+* so we don't have to modify the trampoline load instruction. */
+   u32 jump[7];
+   /* Used by ftrace to identify stubs */
+   u32 magic;
+   /* Data for the above code */
+   func_desc_t funcdata;
+};
+#endif
+
+/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this
+   gives the value maximum span in an instruction which uses a signed
+   offset) */
+static inline unsigned long my_r2(const struct elf_info *elf_info)
+{
+   return elf_info->sechdrs[elf_info->toc_section].sh_addr + 0x8000;
+}
+
+int elf64_apply_relocate_add(const struct elf_info *elf_info,
+const char *strtab, unsigned int symindex,
+unsigned int relsec, const char *obj_name);
+
+#endif /* _ASM_POWERPC_ELF_UTIL_H */
diff --git a/arch/powerpc/include/asm/module.h 
b/arch/powerpc/include/asm/module.h
index cd4ffd86765f..f2073115d518 100644
--- a/arch/powerpc/include/asm/module.h
+++ b/arch/powerpc/include/asm/module.h
@@ -12,7 +12,14 @@
 #include 
 #include 
 #include 
+#include 
 
+/* Both low and high 16 bits are added as SIGNED additions, so if low
+   16 bits has high bit set, high 16 bits must be adjusted.  These
+   macros do that (stolen from binutils). */
+#define PPC_LO(v) ((v) & 0x)
+#define PPC_HI(v) (((v) >> 16) & 0x)
+#define PPC_HA(v) PPC_HI ((v) + 0x8000)
 
 #ifndef __powerpc64__
 /*
@@ -33,8 +40,7 @@ struct ppc_plt_entry {
 
 struct mod_arch_specific {
 #ifdef __powerpc64__
-   unsigned int stubs_section; /* Index of stubs section in module */
-   unsigned int toc_section;   /* What section is the TOC? */
+   struct elf_info elf_info;
bool toc_fixed; /* Have we fixed up .TOC.? */
 #ifdef CONFIG_DYNAMIC_FTRACE
unsigned long toc;
@@ -90,6 +96,10 @@ static inline int module_finalize_ftrace(struct module *mod, 
const 

[PATCH 8/8] powerpc: Add purgatory for kexec_file_load implementation.

2016-06-11 Thread Thiago Jung Bauermann
This purgatory implementation comes from kexec-tools, almost unchanged.

The only changes were that the sha256_regions global variable was
renamed to sha_regions to match what kexec_file_load expects, and to
use the sha256.c file from x86's purgatory to avoid adding yet another
SHA-256 implementation.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/Makefile |   4 +
 arch/powerpc/purgatory/.gitignore |   2 +
 arch/powerpc/purgatory/Makefile   |  36 +++
 arch/powerpc/purgatory/console-ppc64.c|  43 
 arch/powerpc/purgatory/crashdump-ppc64.h  |  42 
 arch/powerpc/purgatory/crashdump_backup.c |  40 +++
 arch/powerpc/purgatory/crtsavres.S|   5 +
 arch/powerpc/purgatory/hvCall.S   |  27 +
 arch/powerpc/purgatory/hvCall.h   |   8 ++
 arch/powerpc/purgatory/kexec-sha256.h |  11 ++
 arch/powerpc/purgatory/ppc64_asm.h|  18 
 arch/powerpc/purgatory/printf.c   | 171 ++
 arch/powerpc/purgatory/purgatory-ppc64.c  |  46 
 arch/powerpc/purgatory/purgatory-ppc64.h  |   6 ++
 arch/powerpc/purgatory/purgatory.c|  66 
 arch/powerpc/purgatory/purgatory.h|  11 ++
 arch/powerpc/purgatory/sha256.c   |   6 ++
 arch/powerpc/purgatory/sha256.h   |   1 +
 arch/powerpc/purgatory/string.S   |   1 +
 arch/powerpc/purgatory/v2wrap.S   | 139 
 20 files changed, 683 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 709a22a3e824..293322855cce 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -249,6 +249,7 @@ core-y  += arch/powerpc/kernel/ 
\
 core-$(CONFIG_XMON)+= arch/powerpc/xmon/
 core-$(CONFIG_KVM) += arch/powerpc/kvm/
 core-$(CONFIG_PERF_EVENTS) += arch/powerpc/perf/
+core-$(CONFIG_KEXEC_FILE)  += arch/powerpc/purgatory/
 
 drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
 
@@ -370,6 +371,9 @@ archclean:
$(Q)$(MAKE) $(clean)=$(boot)
 
 archprepare: checkbin
+ifeq ($(CONFIG_KEXEC_FILE),y)
+   $(Q)$(MAKE) $(build)=arch/powerpc/purgatory 
arch/powerpc/purgatory/kexec-purgatory.c
+endif
 
 # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
 # to stdout and these checks are run even on install targets.
diff --git a/arch/powerpc/purgatory/.gitignore 
b/arch/powerpc/purgatory/.gitignore
new file mode 100644
index ..e9e66f178a6d
--- /dev/null
+++ b/arch/powerpc/purgatory/.gitignore
@@ -0,0 +1,2 @@
+kexec-purgatory.c
+purgatory.ro
diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile
new file mode 100644
index ..63daf95e5703
--- /dev/null
+++ b/arch/powerpc/purgatory/Makefile
@@ -0,0 +1,36 @@
+purgatory-y := purgatory.o printf.o string.o v2wrap.o hvCall.o \
+   purgatory-ppc64.o console-ppc64.o crashdump_backup.o \
+   crtsavres.o sha256.o
+
+targets += $(purgatory-y)
+PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
+
+LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostartfiles \
+   -nostdlib -nodefaultlibs
+targets += purgatory.ro
+
+# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
+# in turn leaves some undefined symbols like __fentry__ in purgatory and not
+# sure how to relocate those. Like kexec-tools, use custom flags.
+
+KBUILD_CFLAGS := -Wall -Wstrict-prototypes -fno-strict-aliasing \
+   -fno-zero-initialized-in-bss -fno-builtin -ffreestanding \
+   -fno-PIC -fno-PIE -fno-stack-protector  -fno-exceptions \
+   -msoft-float -MD -Os
+KBUILD_CFLAGS += -m$(CONFIG_WORD_SIZE)
+
+$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
+   $(call if_changed,ld)
+
+targets += kexec-purgatory.c
+
+CMD_BIN2C = $(objtree)/scripts/basic/bin2c
+quiet_cmd_bin2c = BIN2C   $@
+  cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
+
+$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
+   $(call if_changed,bin2c)
+   @:
+
+
+obj-$(CONFIG_KEXEC_FILE)   += kexec-purgatory.o
diff --git a/arch/powerpc/purgatory/console-ppc64.c 
b/arch/powerpc/purgatory/console-ppc64.c
new file mode 100644
index ..a52e043b4813
--- /dev/null
+++ b/arch/powerpc/purgatory/console-ppc64.c
@@ -0,0 +1,43 @@
+/*
+ * kexec: Linux boots Linux
+ *
+ * Created by: Mohan Kumar M (mo...@in.ibm.com)
+ *
+ * Copyright (C) IBM Corporation, 2005. All rights reserved
+ *
+ * Code taken from kexec-tools.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR 

[PATCH 6/8] powerpc: Implement kexec_file_load.

2016-06-11 Thread Thiago Jung Bauermann
Adds the machinery needed by kexec_file_load, except actually loading
a kernel and initrd.

elf64_apply_relocate_add was extended to support relative symbols. This
is necessary because before relocation, the module loading mechanism
adjusts Elf64_Sym.st_value to point to the absolute memory address,
while the kexec purgatory relocation code does that during relocation.

We also add relocation types used by the purgatory.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/Kconfig   |  13 +++
 arch/powerpc/include/asm/elf_util.h|   1 +
 arch/powerpc/include/asm/systbl.h  |   1 +
 arch/powerpc/include/asm/unistd.h  |   2 +-
 arch/powerpc/include/uapi/asm/unistd.h |   1 +
 arch/powerpc/kernel/Makefile   |   4 +-
 arch/powerpc/kernel/elf_util_64.c  |  83 +++-
 arch/powerpc/kernel/machine_kexec_64.c | 139 +
 arch/powerpc/kernel/module_64.c|   5 +-
 9 files changed, 245 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 01f7464d9fea..3ed5770b89e4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -457,6 +457,19 @@ config KEXEC
  interface is strongly in flux, so no good recommendation can be
  made.
 
+config KEXEC_FILE
+   bool "kexec file based system call"
+   select KEXEC_CORE
+   select BUILD_BIN2C
+   depends on PPC64
+   depends on CRYPTO=y
+   depends on CRYPTO_SHA256=y
+   help
+ This is a new version of the kexec system call. This call is
+ file based and takes in file descriptors as system call arguments
+ for kernel and initramfs as opposed to a list of segments as is the
+ case for the older kexec call.
+
 config CRASH_DUMP
bool "Build a kdump crash kernel"
depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
index 9cd24bc528b1..41a172077f9e 100644
--- a/arch/powerpc/include/asm/elf_util.h
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -86,6 +86,7 @@ int elf64_apply_relocate_add(const struct elf_info *elf_info,
 const char *strtab, const Elf64_Rela *rela,
 unsigned int num_rela, void *syms_base,
 void *loc_base, Elf64_Addr addr_base,
+bool relative_symbols, bool check_symbols,
 const char *obj_name);
 
 #endif /* _ASM_POWERPC_ELF_UTIL_H */
diff --git a/arch/powerpc/include/asm/systbl.h 
b/arch/powerpc/include/asm/systbl.h
index 2fc5d4db503c..4b369d83fe9c 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -386,3 +386,4 @@ SYSCALL(mlock2)
 SYSCALL(copy_file_range)
 COMPAT_SYS_SPU(preadv2)
 COMPAT_SYS_SPU(pwritev2)
+SYSCALL(kexec_file_load)
diff --git a/arch/powerpc/include/asm/unistd.h 
b/arch/powerpc/include/asm/unistd.h
index cf12c580f6b2..a01e97d3f305 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
 #include 
 
 
-#define NR_syscalls382
+#define NR_syscalls383
 
 #define __NR__exit __NR_exit
 
diff --git a/arch/powerpc/include/uapi/asm/unistd.h 
b/arch/powerpc/include/uapi/asm/unistd.h
index e9f5f41aa55a..2f26335a3c42 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -392,5 +392,6 @@
 #define __NR_copy_file_range   379
 #define __NR_preadv2   380
 #define __NR_pwritev2  381
+#define __NR_kexec_file_load   382
 
 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 8a53fccaa053..c937b8074464 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -124,9 +124,11 @@ ifneq ($(CONFIG_PPC_INDIRECT_PIO),y)
 obj-y  += iomap.o
 endif
 
-ifeq ($(CONFIG_MODULES)$(CONFIG_WORD_SIZE),y64)
+ifneq ($(CONFIG_MODULES)$(CONFIG_KEXEC_FILE),)
+ifeq ($(CONFIG_WORD_SIZE),64)
 obj-y  += elf_util.o elf_util_64.o
 endif
+endif
 
 obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM)  += tm.o
 
diff --git a/arch/powerpc/kernel/elf_util_64.c 
b/arch/powerpc/kernel/elf_util_64.c
index cde0420add9e..287d381a1a86 100644
--- a/arch/powerpc/kernel/elf_util_64.c
+++ b/arch/powerpc/kernel/elf_util_64.c
@@ -74,6 +74,8 @@ static void squash_toc_save_inst(const char *name, unsigned 
long addr) { }
  * @syms_base: Contents of the associated symbol table.
  * @loc_base:  Contents of the section to which relocations apply.
  * @addr_base: The address where the section will be loaded in memory.
+ * @relative_symbols:  Are the symbols' st_value members relative?
+ * @check_symbols: Fail if an unexpected symbol is found?
  * @obj_name:  The name of the ELF binary, for information messages.
  *
  * Applies RELA 

[PATCH 3/8] powerpc: Factor out relocation code from module_64.c to elf_util_64.c.

2016-06-11 Thread Thiago Jung Bauermann
The kexec_file_load system call needs to relocate the purgatory, so
factor out the module relocation code so that it can be shared.

This patch's purpose is to move the ELF relocation logic from
apply_relocate_add to elf_util_64.c with as few changes as
possible. The following changes were needed:

To avoid having module-specific code in a general purpose utility
function, struct elf_info was created to contain the information
needed for ELF binaries manipulation.

my_r2, stub_for_addr and create_stub were changed to use it instead of
having to receive a struct module, since they are called from
elf64_apply_relocate_add.

local_entry_offset and squash_toc_save_inst were only used by
apply_rellocate_add, so they were moved to elf_util_64.c as well.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Cc: Torsten Duwe 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/elf_util.h |  70 
 arch/powerpc/include/asm/module.h   |  14 +-
 arch/powerpc/kernel/Makefile|   4 +
 arch/powerpc/kernel/elf_util_64.c   | 269 +++
 arch/powerpc/kernel/module_64.c | 312 
 5 files changed, 386 insertions(+), 283 deletions(-)

diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
new file mode 100644
index ..13d3ca113299
--- /dev/null
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -0,0 +1,70 @@
+/*
+ * Utility functions to work with ELF files.
+ *
+ * Copyright (C) 2016, IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _ASM_POWERPC_ELF_UTIL_H
+#define _ASM_POWERPC_ELF_UTIL_H
+
+#include 
+
+struct elf_info {
+   struct elf_shdr *sechdrs;
+
+   /* Index of stubs section. */
+   unsigned int stubs_section;
+   /* Index of TOC section. */
+   unsigned int toc_section;
+};
+
+#ifdef __powerpc64__
+#if defined(_CALL_ELF) && _CALL_ELF == 2
+
+/* An address is simply the address of the function. */
+typedef unsigned long func_desc_t;
+#else
+
+/* An address is address of the OPD entry, which contains address of fn. */
+typedef struct ppc64_opd_entry func_desc_t;
+#endif
+
+/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
+   the kernel itself).  But on PPC64, these need to be used for every
+   jump, actually, to reset r2 (TOC+0x8000). */
+struct ppc64_stub_entry
+{
+   /* 28 byte jump instruction sequence (7 instructions). We only
+* need 6 instructions on ABIv2 but we always allocate 7 so
+* so we don't have to modify the trampoline load instruction. */
+   u32 jump[7];
+   /* Used by ftrace to identify stubs */
+   u32 magic;
+   /* Data for the above code */
+   func_desc_t funcdata;
+};
+#endif
+
+/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this
+   gives the value maximum span in an instruction which uses a signed
+   offset) */
+static inline unsigned long my_r2(const struct elf_info *elf_info)
+{
+   return elf_info->sechdrs[elf_info->toc_section].sh_addr + 0x8000;
+}
+
+int elf64_apply_relocate_add(const struct elf_info *elf_info,
+const char *strtab, unsigned int symindex,
+unsigned int relsec, const char *obj_name);
+
+#endif /* _ASM_POWERPC_ELF_UTIL_H */
diff --git a/arch/powerpc/include/asm/module.h 
b/arch/powerpc/include/asm/module.h
index cd4ffd86765f..f2073115d518 100644
--- a/arch/powerpc/include/asm/module.h
+++ b/arch/powerpc/include/asm/module.h
@@ -12,7 +12,14 @@
 #include 
 #include 
 #include 
+#include 
 
+/* Both low and high 16 bits are added as SIGNED additions, so if low
+   16 bits has high bit set, high 16 bits must be adjusted.  These
+   macros do that (stolen from binutils). */
+#define PPC_LO(v) ((v) & 0x)
+#define PPC_HI(v) (((v) >> 16) & 0x)
+#define PPC_HA(v) PPC_HI ((v) + 0x8000)
 
 #ifndef __powerpc64__
 /*
@@ -33,8 +40,7 @@ struct ppc_plt_entry {
 
 struct mod_arch_specific {
 #ifdef __powerpc64__
-   unsigned int stubs_section; /* Index of stubs section in module */
-   unsigned int toc_section;   /* What section is the TOC? */
+   struct elf_info elf_info;
bool toc_fixed; /* Have we fixed up .TOC.? */
 #ifdef CONFIG_DYNAMIC_FTRACE
unsigned long toc;
@@ -90,6 +96,10 @@ static inline int module_finalize_ftrace(struct module *mod, 
const Elf_Shdr *sec
 }
 #endif
 
+unsigned long stub_for_addr(const struct elf_info 

[PATCH 8/8] powerpc: Add purgatory for kexec_file_load implementation.

2016-06-11 Thread Thiago Jung Bauermann
This purgatory implementation comes from kexec-tools, almost unchanged.

The only changes were that the sha256_regions global variable was
renamed to sha_regions to match what kexec_file_load expects, and to
use the sha256.c file from x86's purgatory to avoid adding yet another
SHA-256 implementation.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/Makefile |   4 +
 arch/powerpc/purgatory/.gitignore |   2 +
 arch/powerpc/purgatory/Makefile   |  36 +++
 arch/powerpc/purgatory/console-ppc64.c|  43 
 arch/powerpc/purgatory/crashdump-ppc64.h  |  42 
 arch/powerpc/purgatory/crashdump_backup.c |  40 +++
 arch/powerpc/purgatory/crtsavres.S|   5 +
 arch/powerpc/purgatory/hvCall.S   |  27 +
 arch/powerpc/purgatory/hvCall.h   |   8 ++
 arch/powerpc/purgatory/kexec-sha256.h |  11 ++
 arch/powerpc/purgatory/ppc64_asm.h|  18 
 arch/powerpc/purgatory/printf.c   | 171 ++
 arch/powerpc/purgatory/purgatory-ppc64.c  |  46 
 arch/powerpc/purgatory/purgatory-ppc64.h  |   6 ++
 arch/powerpc/purgatory/purgatory.c|  66 
 arch/powerpc/purgatory/purgatory.h|  11 ++
 arch/powerpc/purgatory/sha256.c   |   6 ++
 arch/powerpc/purgatory/sha256.h   |   1 +
 arch/powerpc/purgatory/string.S   |   1 +
 arch/powerpc/purgatory/v2wrap.S   | 139 
 20 files changed, 683 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 709a22a3e824..293322855cce 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -249,6 +249,7 @@ core-y  += arch/powerpc/kernel/ 
\
 core-$(CONFIG_XMON)+= arch/powerpc/xmon/
 core-$(CONFIG_KVM) += arch/powerpc/kvm/
 core-$(CONFIG_PERF_EVENTS) += arch/powerpc/perf/
+core-$(CONFIG_KEXEC_FILE)  += arch/powerpc/purgatory/
 
 drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
 
@@ -370,6 +371,9 @@ archclean:
$(Q)$(MAKE) $(clean)=$(boot)
 
 archprepare: checkbin
+ifeq ($(CONFIG_KEXEC_FILE),y)
+   $(Q)$(MAKE) $(build)=arch/powerpc/purgatory 
arch/powerpc/purgatory/kexec-purgatory.c
+endif
 
 # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
 # to stdout and these checks are run even on install targets.
diff --git a/arch/powerpc/purgatory/.gitignore 
b/arch/powerpc/purgatory/.gitignore
new file mode 100644
index ..e9e66f178a6d
--- /dev/null
+++ b/arch/powerpc/purgatory/.gitignore
@@ -0,0 +1,2 @@
+kexec-purgatory.c
+purgatory.ro
diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile
new file mode 100644
index ..63daf95e5703
--- /dev/null
+++ b/arch/powerpc/purgatory/Makefile
@@ -0,0 +1,36 @@
+purgatory-y := purgatory.o printf.o string.o v2wrap.o hvCall.o \
+   purgatory-ppc64.o console-ppc64.o crashdump_backup.o \
+   crtsavres.o sha256.o
+
+targets += $(purgatory-y)
+PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
+
+LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostartfiles \
+   -nostdlib -nodefaultlibs
+targets += purgatory.ro
+
+# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
+# in turn leaves some undefined symbols like __fentry__ in purgatory and not
+# sure how to relocate those. Like kexec-tools, use custom flags.
+
+KBUILD_CFLAGS := -Wall -Wstrict-prototypes -fno-strict-aliasing \
+   -fno-zero-initialized-in-bss -fno-builtin -ffreestanding \
+   -fno-PIC -fno-PIE -fno-stack-protector  -fno-exceptions \
+   -msoft-float -MD -Os
+KBUILD_CFLAGS += -m$(CONFIG_WORD_SIZE)
+
+$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
+   $(call if_changed,ld)
+
+targets += kexec-purgatory.c
+
+CMD_BIN2C = $(objtree)/scripts/basic/bin2c
+quiet_cmd_bin2c = BIN2C   $@
+  cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
+
+$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
+   $(call if_changed,bin2c)
+   @:
+
+
+obj-$(CONFIG_KEXEC_FILE)   += kexec-purgatory.o
diff --git a/arch/powerpc/purgatory/console-ppc64.c 
b/arch/powerpc/purgatory/console-ppc64.c
new file mode 100644
index ..a52e043b4813
--- /dev/null
+++ b/arch/powerpc/purgatory/console-ppc64.c
@@ -0,0 +1,43 @@
+/*
+ * kexec: Linux boots Linux
+ *
+ * Created by: Mohan Kumar M (mo...@in.ibm.com)
+ *
+ * Copyright (C) IBM Corporation, 2005. All rights reserved
+ *
+ * Code taken from kexec-tools.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR 

[PATCH 7/8] powerpc: Add support for loading ELF kernels with kexec_file_load.

2016-06-11 Thread Thiago Jung Bauermann
This uses all the infrastructure built up by the previous patches
in the series to load an ELF vmlinux file and an initrd. It uses the
flattened device tree at initial_boot_params as a base and adjusts memory
reservations and its /chosen node for the next kernel.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/kexec_elf_64.h |  10 +
 arch/powerpc/kernel/Makefile|   1 +
 arch/powerpc/kernel/kexec_elf_64.c  | 564 
 arch/powerpc/kernel/machine_kexec_64.c  |   5 +-
 4 files changed, 579 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/kexec_elf_64.h 
b/arch/powerpc/include/asm/kexec_elf_64.h
new file mode 100644
index ..30da6bc0ccf8
--- /dev/null
+++ b/arch/powerpc/include/asm/kexec_elf_64.h
@@ -0,0 +1,10 @@
+#ifndef __POWERPC_KEXEC_ELF_64_H__
+#define __POWERPC_KEXEC_ELF_64_H__
+
+#ifdef CONFIG_KEXEC_FILE
+
+extern struct kexec_file_ops kexec_elf64_ops;
+
+#endif /* CONFIG_KEXEC_FILE */
+
+#endif /* __POWERPC_KEXEC_ELF_64_H__ */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index c937b8074464..b89a2ae1b2a0 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -110,6 +110,7 @@ obj-$(CONFIG_PCI)   += pci_$(CONFIG_WORD_SIZE).o 
$(pci64-y) \
 obj-$(CONFIG_PCI_MSI)  += msi.o
 obj-$(CONFIG_KEXEC)+= machine_kexec.o crash.o \
   machine_kexec_$(CONFIG_WORD_SIZE).o
+obj-$(CONFIG_KEXEC_FILE)   += kexec_elf_$(CONFIG_WORD_SIZE).o
 obj-$(CONFIG_AUDIT)+= audit.o
 obj64-$(CONFIG_AUDIT)  += compat_audit.o
 
diff --git a/arch/powerpc/kernel/kexec_elf_64.c 
b/arch/powerpc/kernel/kexec_elf_64.c
new file mode 100644
index ..4e71595300ed
--- /dev/null
+++ b/arch/powerpc/kernel/kexec_elf_64.c
@@ -0,0 +1,564 @@
+/*
+ * Load ELF vmlinux file for the kexec_file_load syscall.
+ *
+ * Copyright (C) 2004  Adam Litke (a...@us.ibm.com)
+ * Copyright (C) 2004  IBM Corp.
+ * Copyright (C) 2005  R Sharada (shar...@in.ibm.com)
+ * Copyright (C) 2006  Mohan Kumar M (mo...@in.ibm.com)
+ * Copyright (C) 2016  IBM Corporation
+ *
+ * Based on kexec-tools' kexec-elf-exec.c and kexec-elf-ppc64.c.
+ * Heavily modified for the kernel by
+ * Thiago Jung Bauermann .
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define pr_fmt(fmt)"kexec_elf: " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern size_t kexec_purgatory_size;
+
+#define PURGATORY_STACK_SIZE   (16 * 1024)
+#define SLAVE_CODE_SIZE256
+
+/**
+ * build_elf_exec_info - read ELF executable and check that we can use it
+ */
+static int build_elf_exec_info(const char *buf, size_t len, struct elfhdr 
*ehdr,
+  struct elf_info *elf_info)
+{
+   int i;
+   int ret;
+
+   ret = elf_read_from_buffer(buf, len, ehdr, elf_info);
+   if (ret)
+   return ret;
+
+   if (ehdr->e_type != ET_EXEC) {
+   pr_err("Not an ELF executable.\n");
+   goto error;
+   } else if (!elf_info->proghdrs) {
+   pr_err("No ELF program header.\n");
+   goto error;
+   }
+
+   for (i = 0; i < ehdr->e_phnum; i++) {
+   /*
+* Kexec does not support loading interpreters.
+* In addition this check keeps us from attempting
+* to kexec ordinay executables.
+*/
+   if (elf_info->proghdrs[i].p_type == PT_INTERP) {
+   pr_err("Requires an ELF interpreter.\n");
+   goto error;
+   }
+   }
+
+   return 0;
+error:
+   elf_free_info(elf_info);
+   return -ENOEXEC;
+}
+
+static int elf64_probe(const char *buf, unsigned long len)
+{
+   struct elfhdr ehdr;
+   struct elf_info elf_info;
+   int ret;
+
+   ret = build_elf_exec_info(buf, len, , _info);
+   if (ret)
+   return ret;
+
+   elf_free_info(_info);
+
+   return elf_check_arch()? 0 : -ENOEXEC;
+}
+
+static bool find_debug_console(void *fdt, int chosen_node)
+{
+   int len;
+   int console_node;
+   const void *prop, *colon;
+
+   prop = fdt_getprop(fdt, chosen_node, 

[PATCH 7/8] powerpc: Add support for loading ELF kernels with kexec_file_load.

2016-06-11 Thread Thiago Jung Bauermann
This uses all the infrastructure built up by the previous patches
in the series to load an ELF vmlinux file and an initrd. It uses the
flattened device tree at initial_boot_params as a base and adjusts memory
reservations and its /chosen node for the next kernel.

Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/kexec_elf_64.h |  10 +
 arch/powerpc/kernel/Makefile|   1 +
 arch/powerpc/kernel/kexec_elf_64.c  | 564 
 arch/powerpc/kernel/machine_kexec_64.c  |   5 +-
 4 files changed, 579 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/kexec_elf_64.h 
b/arch/powerpc/include/asm/kexec_elf_64.h
new file mode 100644
index ..30da6bc0ccf8
--- /dev/null
+++ b/arch/powerpc/include/asm/kexec_elf_64.h
@@ -0,0 +1,10 @@
+#ifndef __POWERPC_KEXEC_ELF_64_H__
+#define __POWERPC_KEXEC_ELF_64_H__
+
+#ifdef CONFIG_KEXEC_FILE
+
+extern struct kexec_file_ops kexec_elf64_ops;
+
+#endif /* CONFIG_KEXEC_FILE */
+
+#endif /* __POWERPC_KEXEC_ELF_64_H__ */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index c937b8074464..b89a2ae1b2a0 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -110,6 +110,7 @@ obj-$(CONFIG_PCI)   += pci_$(CONFIG_WORD_SIZE).o 
$(pci64-y) \
 obj-$(CONFIG_PCI_MSI)  += msi.o
 obj-$(CONFIG_KEXEC)+= machine_kexec.o crash.o \
   machine_kexec_$(CONFIG_WORD_SIZE).o
+obj-$(CONFIG_KEXEC_FILE)   += kexec_elf_$(CONFIG_WORD_SIZE).o
 obj-$(CONFIG_AUDIT)+= audit.o
 obj64-$(CONFIG_AUDIT)  += compat_audit.o
 
diff --git a/arch/powerpc/kernel/kexec_elf_64.c 
b/arch/powerpc/kernel/kexec_elf_64.c
new file mode 100644
index ..4e71595300ed
--- /dev/null
+++ b/arch/powerpc/kernel/kexec_elf_64.c
@@ -0,0 +1,564 @@
+/*
+ * Load ELF vmlinux file for the kexec_file_load syscall.
+ *
+ * Copyright (C) 2004  Adam Litke (a...@us.ibm.com)
+ * Copyright (C) 2004  IBM Corp.
+ * Copyright (C) 2005  R Sharada (shar...@in.ibm.com)
+ * Copyright (C) 2006  Mohan Kumar M (mo...@in.ibm.com)
+ * Copyright (C) 2016  IBM Corporation
+ *
+ * Based on kexec-tools' kexec-elf-exec.c and kexec-elf-ppc64.c.
+ * Heavily modified for the kernel by
+ * Thiago Jung Bauermann .
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define pr_fmt(fmt)"kexec_elf: " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern size_t kexec_purgatory_size;
+
+#define PURGATORY_STACK_SIZE   (16 * 1024)
+#define SLAVE_CODE_SIZE256
+
+/**
+ * build_elf_exec_info - read ELF executable and check that we can use it
+ */
+static int build_elf_exec_info(const char *buf, size_t len, struct elfhdr 
*ehdr,
+  struct elf_info *elf_info)
+{
+   int i;
+   int ret;
+
+   ret = elf_read_from_buffer(buf, len, ehdr, elf_info);
+   if (ret)
+   return ret;
+
+   if (ehdr->e_type != ET_EXEC) {
+   pr_err("Not an ELF executable.\n");
+   goto error;
+   } else if (!elf_info->proghdrs) {
+   pr_err("No ELF program header.\n");
+   goto error;
+   }
+
+   for (i = 0; i < ehdr->e_phnum; i++) {
+   /*
+* Kexec does not support loading interpreters.
+* In addition this check keeps us from attempting
+* to kexec ordinay executables.
+*/
+   if (elf_info->proghdrs[i].p_type == PT_INTERP) {
+   pr_err("Requires an ELF interpreter.\n");
+   goto error;
+   }
+   }
+
+   return 0;
+error:
+   elf_free_info(elf_info);
+   return -ENOEXEC;
+}
+
+static int elf64_probe(const char *buf, unsigned long len)
+{
+   struct elfhdr ehdr;
+   struct elf_info elf_info;
+   int ret;
+
+   ret = build_elf_exec_info(buf, len, , _info);
+   if (ret)
+   return ret;
+
+   elf_free_info(_info);
+
+   return elf_check_arch()? 0 : -ENOEXEC;
+}
+
+static bool find_debug_console(void *fdt, int chosen_node)
+{
+   int len;
+   int console_node;
+   const void *prop, *colon;
+
+   prop = fdt_getprop(fdt, chosen_node, "stdout-path", );
+   if 

[PATCH 2/8] kexec_file: Generalize kexec_add_buffer.

2016-06-11 Thread Thiago Jung Bauermann
Allow architectures to specify different memory walking functions for
kexec_add_buffer. Intel uses iomem to track reserved memory ranges,
but PowerPC uses the memblock subsystem.

Also, factor kexec_locate_mem_hole out of kexec_add_buffer. It will be
used by the PowerPC kexec_file_load implementation to find free memory
for the purgatory stack.

Cc: Eric Biederman 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 include/linux/kexec.h | 10 ++
 kernel/kexec_file.c   | 96 +--
 2 files changed, 81 insertions(+), 25 deletions(-)

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index e8acb2b43dd9..920e2cbe5bdd 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -210,6 +210,10 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
struct kexec_segment __user *segments,
unsigned long flags);
 extern int kernel_kexec(void);
+int kexec_locate_mem_hole(struct kimage *image, unsigned long size,
+ unsigned long align, unsigned long start,
+ unsigned long end, bool top_down,
+ unsigned long *addr);
 extern int kexec_add_buffer(struct kimage *image, char *buffer,
unsigned long bufsz, unsigned long memsz,
unsigned long buf_align, unsigned long buf_min,
@@ -315,6 +319,12 @@ int __weak arch_kexec_apply_relocations_add(const Elf_Ehdr 
*ehdr,
Elf_Shdr *sechdrs, unsigned int relsec);
 int __weak arch_kexec_apply_relocations(const Elf_Ehdr *ehdr, Elf_Shdr 
*sechdrs,
unsigned int relsec);
+int __weak arch_walk_iomem(unsigned long desc, unsigned long start,
+  unsigned long end, bool top_down, void *data,
+  int (*func)(u64, u64, void *));
+int __weak arch_walk_system_ram(unsigned long start, unsigned long end,
+   bool top_down, void *data,
+   int (*func)(u64, u64, void *));
 void arch_kexec_protect_crashkres(void);
 void arch_kexec_unprotect_crashkres(void);
 
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index b6eec7527e9f..300f71cb4f72 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -428,6 +428,68 @@ static int locate_mem_hole_callback(u64 start, u64 end, 
void *arg)
return locate_mem_hole_bottom_up(start, end, kbuf);
 }
 
+int __weak arch_walk_iomem(unsigned long desc, unsigned long start,
+  unsigned long end, bool top_down, void *data,
+  int (*func)(u64, u64, void *))
+{
+   return walk_iomem_res_desc(desc,
+  IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY,
+  start, end, data, func);
+}
+
+int __weak arch_walk_system_ram(unsigned long start, unsigned long end,
+   bool top_down, void *data,
+   int (*func)(u64, u64, void *))
+{
+   return walk_system_ram_res(start, end, data, func);
+}
+
+/**
+ * kexec_locate_mem_hole - find free memory to load segment or use in purgatory
+ * @image: kexec image being updated.
+ * @size:  Memory size.
+ * @align: Minimum alignment needed.
+ * @start: Minimum starting address.
+ * @end:   Maximum end address.
+ * @top_down   Find the highest free memory region?
+ * @addr   On success, will have start address of the memory region found.
+ *
+ * Return: 0 on success, negative erro on failure.
+ */
+int kexec_locate_mem_hole(struct kimage *image, unsigned long size,
+ unsigned long align, unsigned long start,
+ unsigned long end, bool top_down, unsigned long *addr)
+{
+   int ret;
+   struct kexec_buf buf;
+
+   memset(, 0, sizeof(struct kexec_buf));
+   buf.image = image;
+
+   buf.memsz = size;
+   buf.buf_align = align;
+   buf.buf_min = start;
+   buf.buf_max = end;
+   buf.top_down = top_down;
+
+   /* Walk the RAM ranges and allocate a suitable range for the buffer */
+   if (image->type == KEXEC_TYPE_CRASH)
+   ret = arch_walk_iomem(crashk_res.desc, crashk_res.start,
+ crashk_res.end, top_down, ,
+ locate_mem_hole_callback);
+   else
+   ret = arch_walk_system_ram(0, -1, top_down, ,
+  locate_mem_hole_callback);
+   if (ret != 1) {
+   /* A suitable memory range could not be found for buffer */
+   return -EADDRNOTAVAIL;
+   }
+
+   *addr = buf.mem;
+
+   return 0;
+}
+
 /*
  * Helper function for placing a buffer in a kexec segment. This assumes
  * that kexec_mutex is held.
@@ -439,8 

[PATCH 4/8] powerpc: Generalize elf64_apply_relocate_add.

2016-06-11 Thread Thiago Jung Bauermann
When apply_relocate_add is called, modules are already loaded at their
final location in memory so Elf64_Shdr.sh_addr can be used for accessing
the section contents as well as the base address for relocations.

This is not the case for kexec's purgatory, because it will only be
copied to its final location right before being executed. Therefore,
it needs to be relocated while it is still in a temporary buffer. In
this case, Elf64_Shdr.sh_addr can't be used to access the sections'
contents.

This patch allows elf64_apply_relocate_add to be used when the ELF
binary is not yet at its final location by adding an addr_base argument
to specify the address at which the section will be loaded, and rela,
loc_base and syms_base to point to the sections' contents.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Cc: Torsten Duwe 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/elf_util.h |  6 ++--
 arch/powerpc/kernel/elf_util_64.c   | 63 +
 arch/powerpc/kernel/module_64.c | 17 --
 3 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
index 13d3ca113299..19ff3335d17d 100644
--- a/arch/powerpc/include/asm/elf_util.h
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -64,7 +64,9 @@ static inline unsigned long my_r2(const struct elf_info 
*elf_info)
 }
 
 int elf64_apply_relocate_add(const struct elf_info *elf_info,
-const char *strtab, unsigned int symindex,
-unsigned int relsec, const char *obj_name);
+const char *strtab, const Elf64_Rela *rela,
+unsigned int num_rela, void *syms_base,
+void *loc_base, Elf64_Addr addr_base,
+const char *obj_name);
 
 #endif /* _ASM_POWERPC_ELF_UTIL_H */
diff --git a/arch/powerpc/kernel/elf_util_64.c 
b/arch/powerpc/kernel/elf_util_64.c
index b53b3959a605..cde0420add9e 100644
--- a/arch/powerpc/kernel/elf_util_64.c
+++ b/arch/powerpc/kernel/elf_util_64.c
@@ -69,33 +69,56 @@ static void squash_toc_save_inst(const char *name, unsigned 
long addr) { }
  * elf64_apply_relocate_add - apply 64 bit RELA relocations
  * @elf_info:  Support information for the ELF binary being relocated.
  * @strtab:String table for the associated symbol table.
- * @symindex:  Section header index for the associated symbol table.
- * @relsec:Section header index for the relocations to apply.
+ * @rela:  Contents of the section with the relocations to apply.
+ * @num_rela:  Number of relocation entries in the section.
+ * @syms_base: Contents of the associated symbol table.
+ * @loc_base:  Contents of the section to which relocations apply.
+ * @addr_base: The address where the section will be loaded in memory.
  * @obj_name:  The name of the ELF binary, for information messages.
+ *
+ * Applies RELA relocations to an ELF file already at its final location
+ * in memory (in which case loc_base == addr_base), or still in a temporary
+ * buffer.
  */
 int elf64_apply_relocate_add(const struct elf_info *elf_info,
-const char *strtab, unsigned int symindex,
-unsigned int relsec, const char *obj_name)
+const char *strtab, const Elf64_Rela *rela,
+unsigned int num_rela, void *syms_base,
+void *loc_base, Elf64_Addr addr_base,
+const char *obj_name)
 {
unsigned int i;
-   Elf64_Shdr *sechdrs = elf_info->sechdrs;
-   Elf64_Rela *rela = (void *)sechdrs[relsec].sh_addr;
-   Elf64_Sym *sym;
unsigned long *location;
+   unsigned long address;
unsigned long value;
+   const char *name;
+   Elf64_Sym *sym;
+
+   for (i = 0; i < num_rela; i++) {
+   /*
+* rels[i].r_offset contains the byte offset from the beginning
+* of section to the storage unit affected.
+*
+* This is the location to update in the temporary buffer where
+* the section is currently loaded. The section will finally
+* be loaded to a different address later, pointed to by
+* addr_base.
+*/
+   location = loc_base + rela[i].r_offset;
+
+   /* Final address of the location. */
+   address = addr_base + rela[i].r_offset;
 
+   /* This is the symbol the relocation is referring to. */
+   sym = (Elf64_Sym *) syms_base + ELF64_R_SYM(rela[i].r_info);
 
-   for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
-   

[PATCH 0/8] kexec_file_load implementation for PowerPC

2016-06-11 Thread Thiago Jung Bauermann
Hello,

This patch series implements the kexec_file_load system call on PowerPC.

It starts by removing an x86 assumption from kexec_file: kexec_add_buffer uses
iomem to find reserved memory ranges, but PowerPC uses the memblock subsystem.
Hooks are added so that each arch can specify how memory ranges can be found.

Also, the memory-walking logic in kexec_add_buffer is useful in this
implementation to find a free area for the purgatory's stack, so that same
patch moves that logic to kexec_locate_mem_hole.

The kexec_file_load system call needs to apply relocations to the purgatory
but adding code for that would duplicate functionality with the module loading
mechanism, which also needs to apply relocations to the kernel modules.
Therefore, this patch series factors out the module relocation code so that it
can be shared.

One thing that is still missing is crashkernel support, which I intend to
submit shortly.

This code is based on kexec-tools, but with many modifications to adapt it to
the kernel environment and facilities. Except the purgatory, which only has
minimal changes.

Thiago Jung Bauermann (8):
  kexec_file: Remove unused members from struct kexec_buf.
  kexec_file: Generalize kexec_add_buffer.
  powerpc: Factor out relocation code from module_64.c to elf_util_64.c.
  powerpc: Generalize elf64_apply_relocate_add.
  powerpc: Add functions to read ELF files of any endianness.
  powerpc: Implement kexec_file_load.
  powerpc: Add support for loading ELF kernels with kexec_file_load.
  powerpc: Add purgatory for kexec_file_load implementation.

 arch/powerpc/Kconfig  |  13 +
 arch/powerpc/Makefile |   4 +
 arch/powerpc/include/asm/elf_util.h   |  92 +
 arch/powerpc/include/asm/kexec_elf_64.h   |  10 +
 arch/powerpc/include/asm/module.h |  14 +-
 arch/powerpc/include/asm/systbl.h |   1 +
 arch/powerpc/include/asm/unistd.h |   2 +-
 arch/powerpc/include/uapi/asm/unistd.h|   1 +
 arch/powerpc/kernel/Makefile  |   7 +
 arch/powerpc/kernel/elf_util.c| 476 +
 arch/powerpc/kernel/elf_util_64.c | 373 
 arch/powerpc/kernel/kexec_elf_64.c| 564 ++
 arch/powerpc/kernel/machine_kexec_64.c| 142 
 arch/powerpc/kernel/module_64.c   | 328 +++--
 arch/powerpc/purgatory/.gitignore |   2 +
 arch/powerpc/purgatory/Makefile   |  36 ++
 arch/powerpc/purgatory/console-ppc64.c|  43 +++
 arch/powerpc/purgatory/crashdump-ppc64.h  |  42 +++
 arch/powerpc/purgatory/crashdump_backup.c |  40 +++
 arch/powerpc/purgatory/crtsavres.S|   5 +
 arch/powerpc/purgatory/hvCall.S   |  27 ++
 arch/powerpc/purgatory/hvCall.h   |   8 +
 arch/powerpc/purgatory/kexec-sha256.h |  11 +
 arch/powerpc/purgatory/ppc64_asm.h|  18 +
 arch/powerpc/purgatory/printf.c   | 171 +
 arch/powerpc/purgatory/purgatory-ppc64.c  |  46 +++
 arch/powerpc/purgatory/purgatory-ppc64.h  |   6 +
 arch/powerpc/purgatory/purgatory.c|  66 
 arch/powerpc/purgatory/purgatory.h|  11 +
 arch/powerpc/purgatory/sha256.c   |   6 +
 arch/powerpc/purgatory/sha256.h   |   1 +
 arch/powerpc/purgatory/string.S   |   1 +
 arch/powerpc/purgatory/v2wrap.S   | 139 
 include/linux/kexec.h |  10 +
 kernel/kexec_file.c   | 102 --
 kernel/kexec_internal.h   |   2 -
 36 files changed, 2504 insertions(+), 316 deletions(-)
 create mode 100644 arch/powerpc/include/asm/elf_util.h
 create mode 100644 arch/powerpc/include/asm/kexec_elf_64.h
 create mode 100644 arch/powerpc/kernel/elf_util.c
 create mode 100644 arch/powerpc/kernel/elf_util_64.c
 create mode 100644 arch/powerpc/kernel/kexec_elf_64.c
 create mode 100644 arch/powerpc/purgatory/.gitignore
 create mode 100644 arch/powerpc/purgatory/Makefile
 create mode 100644 arch/powerpc/purgatory/console-ppc64.c
 create mode 100644 arch/powerpc/purgatory/crashdump-ppc64.h
 create mode 100644 arch/powerpc/purgatory/crashdump_backup.c
 create mode 100644 arch/powerpc/purgatory/crtsavres.S
 create mode 100644 arch/powerpc/purgatory/hvCall.S
 create mode 100644 arch/powerpc/purgatory/hvCall.h
 create mode 100644 arch/powerpc/purgatory/kexec-sha256.h
 create mode 100644 arch/powerpc/purgatory/ppc64_asm.h
 create mode 100644 arch/powerpc/purgatory/printf.c
 create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.c
 create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.h
 create mode 100644 arch/powerpc/purgatory/purgatory.c
 create mode 100644 arch/powerpc/purgatory/purgatory.h
 create mode 100644 arch/powerpc/purgatory/sha256.c
 create mode 100644 arch/powerpc/purgatory/sha256.h
 create mode 100644 arch/powerpc/purgatory/string.S
 create mode 100644 arch/powerpc/purgatory/v2wrap.S

-- 
1.9.1



[PATCH 2/8] kexec_file: Generalize kexec_add_buffer.

2016-06-11 Thread Thiago Jung Bauermann
Allow architectures to specify different memory walking functions for
kexec_add_buffer. Intel uses iomem to track reserved memory ranges,
but PowerPC uses the memblock subsystem.

Also, factor kexec_locate_mem_hole out of kexec_add_buffer. It will be
used by the PowerPC kexec_file_load implementation to find free memory
for the purgatory stack.

Cc: Eric Biederman 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 include/linux/kexec.h | 10 ++
 kernel/kexec_file.c   | 96 +--
 2 files changed, 81 insertions(+), 25 deletions(-)

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index e8acb2b43dd9..920e2cbe5bdd 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -210,6 +210,10 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
struct kexec_segment __user *segments,
unsigned long flags);
 extern int kernel_kexec(void);
+int kexec_locate_mem_hole(struct kimage *image, unsigned long size,
+ unsigned long align, unsigned long start,
+ unsigned long end, bool top_down,
+ unsigned long *addr);
 extern int kexec_add_buffer(struct kimage *image, char *buffer,
unsigned long bufsz, unsigned long memsz,
unsigned long buf_align, unsigned long buf_min,
@@ -315,6 +319,12 @@ int __weak arch_kexec_apply_relocations_add(const Elf_Ehdr 
*ehdr,
Elf_Shdr *sechdrs, unsigned int relsec);
 int __weak arch_kexec_apply_relocations(const Elf_Ehdr *ehdr, Elf_Shdr 
*sechdrs,
unsigned int relsec);
+int __weak arch_walk_iomem(unsigned long desc, unsigned long start,
+  unsigned long end, bool top_down, void *data,
+  int (*func)(u64, u64, void *));
+int __weak arch_walk_system_ram(unsigned long start, unsigned long end,
+   bool top_down, void *data,
+   int (*func)(u64, u64, void *));
 void arch_kexec_protect_crashkres(void);
 void arch_kexec_unprotect_crashkres(void);
 
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index b6eec7527e9f..300f71cb4f72 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -428,6 +428,68 @@ static int locate_mem_hole_callback(u64 start, u64 end, 
void *arg)
return locate_mem_hole_bottom_up(start, end, kbuf);
 }
 
+int __weak arch_walk_iomem(unsigned long desc, unsigned long start,
+  unsigned long end, bool top_down, void *data,
+  int (*func)(u64, u64, void *))
+{
+   return walk_iomem_res_desc(desc,
+  IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY,
+  start, end, data, func);
+}
+
+int __weak arch_walk_system_ram(unsigned long start, unsigned long end,
+   bool top_down, void *data,
+   int (*func)(u64, u64, void *))
+{
+   return walk_system_ram_res(start, end, data, func);
+}
+
+/**
+ * kexec_locate_mem_hole - find free memory to load segment or use in purgatory
+ * @image: kexec image being updated.
+ * @size:  Memory size.
+ * @align: Minimum alignment needed.
+ * @start: Minimum starting address.
+ * @end:   Maximum end address.
+ * @top_down   Find the highest free memory region?
+ * @addr   On success, will have start address of the memory region found.
+ *
+ * Return: 0 on success, negative erro on failure.
+ */
+int kexec_locate_mem_hole(struct kimage *image, unsigned long size,
+ unsigned long align, unsigned long start,
+ unsigned long end, bool top_down, unsigned long *addr)
+{
+   int ret;
+   struct kexec_buf buf;
+
+   memset(, 0, sizeof(struct kexec_buf));
+   buf.image = image;
+
+   buf.memsz = size;
+   buf.buf_align = align;
+   buf.buf_min = start;
+   buf.buf_max = end;
+   buf.top_down = top_down;
+
+   /* Walk the RAM ranges and allocate a suitable range for the buffer */
+   if (image->type == KEXEC_TYPE_CRASH)
+   ret = arch_walk_iomem(crashk_res.desc, crashk_res.start,
+ crashk_res.end, top_down, ,
+ locate_mem_hole_callback);
+   else
+   ret = arch_walk_system_ram(0, -1, top_down, ,
+  locate_mem_hole_callback);
+   if (ret != 1) {
+   /* A suitable memory range could not be found for buffer */
+   return -EADDRNOTAVAIL;
+   }
+
+   *addr = buf.mem;
+
+   return 0;
+}
+
 /*
  * Helper function for placing a buffer in a kexec segment. This assumes
  * that kexec_mutex is held.
@@ -439,8 +501,8 @@ int 

[PATCH 4/8] powerpc: Generalize elf64_apply_relocate_add.

2016-06-11 Thread Thiago Jung Bauermann
When apply_relocate_add is called, modules are already loaded at their
final location in memory so Elf64_Shdr.sh_addr can be used for accessing
the section contents as well as the base address for relocations.

This is not the case for kexec's purgatory, because it will only be
copied to its final location right before being executed. Therefore,
it needs to be relocated while it is still in a temporary buffer. In
this case, Elf64_Shdr.sh_addr can't be used to access the sections'
contents.

This patch allows elf64_apply_relocate_add to be used when the ELF
binary is not yet at its final location by adding an addr_base argument
to specify the address at which the section will be loaded, and rela,
loc_base and syms_base to point to the sections' contents.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Cc: Torsten Duwe 
Cc: ke...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/include/asm/elf_util.h |  6 ++--
 arch/powerpc/kernel/elf_util_64.c   | 63 +
 arch/powerpc/kernel/module_64.c | 17 --
 3 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/include/asm/elf_util.h 
b/arch/powerpc/include/asm/elf_util.h
index 13d3ca113299..19ff3335d17d 100644
--- a/arch/powerpc/include/asm/elf_util.h
+++ b/arch/powerpc/include/asm/elf_util.h
@@ -64,7 +64,9 @@ static inline unsigned long my_r2(const struct elf_info 
*elf_info)
 }
 
 int elf64_apply_relocate_add(const struct elf_info *elf_info,
-const char *strtab, unsigned int symindex,
-unsigned int relsec, const char *obj_name);
+const char *strtab, const Elf64_Rela *rela,
+unsigned int num_rela, void *syms_base,
+void *loc_base, Elf64_Addr addr_base,
+const char *obj_name);
 
 #endif /* _ASM_POWERPC_ELF_UTIL_H */
diff --git a/arch/powerpc/kernel/elf_util_64.c 
b/arch/powerpc/kernel/elf_util_64.c
index b53b3959a605..cde0420add9e 100644
--- a/arch/powerpc/kernel/elf_util_64.c
+++ b/arch/powerpc/kernel/elf_util_64.c
@@ -69,33 +69,56 @@ static void squash_toc_save_inst(const char *name, unsigned 
long addr) { }
  * elf64_apply_relocate_add - apply 64 bit RELA relocations
  * @elf_info:  Support information for the ELF binary being relocated.
  * @strtab:String table for the associated symbol table.
- * @symindex:  Section header index for the associated symbol table.
- * @relsec:Section header index for the relocations to apply.
+ * @rela:  Contents of the section with the relocations to apply.
+ * @num_rela:  Number of relocation entries in the section.
+ * @syms_base: Contents of the associated symbol table.
+ * @loc_base:  Contents of the section to which relocations apply.
+ * @addr_base: The address where the section will be loaded in memory.
  * @obj_name:  The name of the ELF binary, for information messages.
+ *
+ * Applies RELA relocations to an ELF file already at its final location
+ * in memory (in which case loc_base == addr_base), or still in a temporary
+ * buffer.
  */
 int elf64_apply_relocate_add(const struct elf_info *elf_info,
-const char *strtab, unsigned int symindex,
-unsigned int relsec, const char *obj_name)
+const char *strtab, const Elf64_Rela *rela,
+unsigned int num_rela, void *syms_base,
+void *loc_base, Elf64_Addr addr_base,
+const char *obj_name)
 {
unsigned int i;
-   Elf64_Shdr *sechdrs = elf_info->sechdrs;
-   Elf64_Rela *rela = (void *)sechdrs[relsec].sh_addr;
-   Elf64_Sym *sym;
unsigned long *location;
+   unsigned long address;
unsigned long value;
+   const char *name;
+   Elf64_Sym *sym;
+
+   for (i = 0; i < num_rela; i++) {
+   /*
+* rels[i].r_offset contains the byte offset from the beginning
+* of section to the storage unit affected.
+*
+* This is the location to update in the temporary buffer where
+* the section is currently loaded. The section will finally
+* be loaded to a different address later, pointed to by
+* addr_base.
+*/
+   location = loc_base + rela[i].r_offset;
+
+   /* Final address of the location. */
+   address = addr_base + rela[i].r_offset;
 
+   /* This is the symbol the relocation is referring to. */
+   sym = (Elf64_Sym *) syms_base + ELF64_R_SYM(rela[i].r_info);
 
-   for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
-   /* This is where to make the change */
-   location = 

[PATCH 0/8] kexec_file_load implementation for PowerPC

2016-06-11 Thread Thiago Jung Bauermann
Hello,

This patch series implements the kexec_file_load system call on PowerPC.

It starts by removing an x86 assumption from kexec_file: kexec_add_buffer uses
iomem to find reserved memory ranges, but PowerPC uses the memblock subsystem.
Hooks are added so that each arch can specify how memory ranges can be found.

Also, the memory-walking logic in kexec_add_buffer is useful in this
implementation to find a free area for the purgatory's stack, so that same
patch moves that logic to kexec_locate_mem_hole.

The kexec_file_load system call needs to apply relocations to the purgatory
but adding code for that would duplicate functionality with the module loading
mechanism, which also needs to apply relocations to the kernel modules.
Therefore, this patch series factors out the module relocation code so that it
can be shared.

One thing that is still missing is crashkernel support, which I intend to
submit shortly.

This code is based on kexec-tools, but with many modifications to adapt it to
the kernel environment and facilities. Except the purgatory, which only has
minimal changes.

Thiago Jung Bauermann (8):
  kexec_file: Remove unused members from struct kexec_buf.
  kexec_file: Generalize kexec_add_buffer.
  powerpc: Factor out relocation code from module_64.c to elf_util_64.c.
  powerpc: Generalize elf64_apply_relocate_add.
  powerpc: Add functions to read ELF files of any endianness.
  powerpc: Implement kexec_file_load.
  powerpc: Add support for loading ELF kernels with kexec_file_load.
  powerpc: Add purgatory for kexec_file_load implementation.

 arch/powerpc/Kconfig  |  13 +
 arch/powerpc/Makefile |   4 +
 arch/powerpc/include/asm/elf_util.h   |  92 +
 arch/powerpc/include/asm/kexec_elf_64.h   |  10 +
 arch/powerpc/include/asm/module.h |  14 +-
 arch/powerpc/include/asm/systbl.h |   1 +
 arch/powerpc/include/asm/unistd.h |   2 +-
 arch/powerpc/include/uapi/asm/unistd.h|   1 +
 arch/powerpc/kernel/Makefile  |   7 +
 arch/powerpc/kernel/elf_util.c| 476 +
 arch/powerpc/kernel/elf_util_64.c | 373 
 arch/powerpc/kernel/kexec_elf_64.c| 564 ++
 arch/powerpc/kernel/machine_kexec_64.c| 142 
 arch/powerpc/kernel/module_64.c   | 328 +++--
 arch/powerpc/purgatory/.gitignore |   2 +
 arch/powerpc/purgatory/Makefile   |  36 ++
 arch/powerpc/purgatory/console-ppc64.c|  43 +++
 arch/powerpc/purgatory/crashdump-ppc64.h  |  42 +++
 arch/powerpc/purgatory/crashdump_backup.c |  40 +++
 arch/powerpc/purgatory/crtsavres.S|   5 +
 arch/powerpc/purgatory/hvCall.S   |  27 ++
 arch/powerpc/purgatory/hvCall.h   |   8 +
 arch/powerpc/purgatory/kexec-sha256.h |  11 +
 arch/powerpc/purgatory/ppc64_asm.h|  18 +
 arch/powerpc/purgatory/printf.c   | 171 +
 arch/powerpc/purgatory/purgatory-ppc64.c  |  46 +++
 arch/powerpc/purgatory/purgatory-ppc64.h  |   6 +
 arch/powerpc/purgatory/purgatory.c|  66 
 arch/powerpc/purgatory/purgatory.h|  11 +
 arch/powerpc/purgatory/sha256.c   |   6 +
 arch/powerpc/purgatory/sha256.h   |   1 +
 arch/powerpc/purgatory/string.S   |   1 +
 arch/powerpc/purgatory/v2wrap.S   | 139 
 include/linux/kexec.h |  10 +
 kernel/kexec_file.c   | 102 --
 kernel/kexec_internal.h   |   2 -
 36 files changed, 2504 insertions(+), 316 deletions(-)
 create mode 100644 arch/powerpc/include/asm/elf_util.h
 create mode 100644 arch/powerpc/include/asm/kexec_elf_64.h
 create mode 100644 arch/powerpc/kernel/elf_util.c
 create mode 100644 arch/powerpc/kernel/elf_util_64.c
 create mode 100644 arch/powerpc/kernel/kexec_elf_64.c
 create mode 100644 arch/powerpc/purgatory/.gitignore
 create mode 100644 arch/powerpc/purgatory/Makefile
 create mode 100644 arch/powerpc/purgatory/console-ppc64.c
 create mode 100644 arch/powerpc/purgatory/crashdump-ppc64.h
 create mode 100644 arch/powerpc/purgatory/crashdump_backup.c
 create mode 100644 arch/powerpc/purgatory/crtsavres.S
 create mode 100644 arch/powerpc/purgatory/hvCall.S
 create mode 100644 arch/powerpc/purgatory/hvCall.h
 create mode 100644 arch/powerpc/purgatory/kexec-sha256.h
 create mode 100644 arch/powerpc/purgatory/ppc64_asm.h
 create mode 100644 arch/powerpc/purgatory/printf.c
 create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.c
 create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.h
 create mode 100644 arch/powerpc/purgatory/purgatory.c
 create mode 100644 arch/powerpc/purgatory/purgatory.h
 create mode 100644 arch/powerpc/purgatory/sha256.c
 create mode 100644 arch/powerpc/purgatory/sha256.h
 create mode 100644 arch/powerpc/purgatory/string.S
 create mode 100644 arch/powerpc/purgatory/v2wrap.S

-- 
1.9.1



Re: [PATCH v4 2/2] [media] atmel-isc: DT binding for Image Sensor Controller driver

2016-06-11 Thread Wu, Songjun



On 6/9/2016 05:57, Boris Brezillon wrote:

On Tue, 7 Jun 2016 15:11:53 +0800
Songjun Wu  wrote:


DT binding documentation for ISC driver.

Signed-off-by: Songjun Wu 
---

Changes in v4:
- Remove the isc clock nodes.

Changes in v3:
- Remove the 'atmel,sensor-preferred'.
- Modify the isc clock node according to the Rob's remarks.

Changes in v2:
- Remove the unit address of the endpoint.
- Add the unit address to the clock node.
- Avoid using underscores in node names.
- Drop the "0x" in the unit address of the i2c node.
- Modify the description of 'atmel,sensor-preferred'.
- Add the description for the ISC internal clock.

 .../devicetree/bindings/media/atmel-isc.txt| 69 ++
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isc.txt

diff --git a/Documentation/devicetree/bindings/media/atmel-isc.txt 
b/Documentation/devicetree/bindings/media/atmel-isc.txt
new file mode 100644
index 000..3f83524
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/atmel-isc.txt
@@ -0,0 +1,69 @@
+Atmel Image Sensor Controller (ISC)
+--
+
+Required properties for ISC:
+- compatible
+   Must be "atmel,sama5d2-isc".
+- reg
+   Physical base address and length of the registers set for the device.
+- interrupts
+   Should contain IRQ line for the ISC.
+- clocks
+   List of clock specifiers, corresponding to entries in
+   the clock-names property;
+   Please refer to clock-bindings.txt.
+- clock-names
+   Required elements: "hclock".
+- #clock-cells
+   Should be 0.
+- clock-output-names
+   Should contain the name of the clock driving the sensor master clock.
+- pinctrl-names, pinctrl-0
+   Please refer to pinctrl-bindings.txt.
+
+
+ISC supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+isc: isc@f0008000 {
+   compatible = "atmel,sama5d2-isc";
+   reg = <0xf0008000 0x4000>;
+   interrupts = <46 IRQ_TYPE_LEVEL_HIGH 5>;
+   clocks = <_clk>, <>, <_gclk>;
+   clock-names = "hclock";


You have 3 clocks here and only one name. Are you sure this example is
actually working?

The isc_clk is mandatory, but the other two clocks are optional, so I 
did not give their name. This example is tested.

Should I add the name for the other two clocks?


+   #clock-cells = <0>;
+   clock-output-names = "isc-mck";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   isc_0: endpoint {
+   remote-endpoint = <_0>;
+   hsync-active = <1>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   };
+   };
+
+
+};
+
+i2c1: i2c@fc028000 {
+   ov7740: camera@21 {
+   compatible = "ovti,ov7740";
+   reg = <0x21>;
+
+   clocks = <>;
+   clock-names = "xvclk";
+   assigned-clocks = <>;
+   assigned-clock-rates = <2400>;
+
+   port {
+   ov7740_0: endpoint {
+   remote-endpoint = <_0>;
+   };
+   };
+};






Re: [PATCH v4 2/2] [media] atmel-isc: DT binding for Image Sensor Controller driver

2016-06-11 Thread Wu, Songjun



On 6/9/2016 05:57, Boris Brezillon wrote:

On Tue, 7 Jun 2016 15:11:53 +0800
Songjun Wu  wrote:


DT binding documentation for ISC driver.

Signed-off-by: Songjun Wu 
---

Changes in v4:
- Remove the isc clock nodes.

Changes in v3:
- Remove the 'atmel,sensor-preferred'.
- Modify the isc clock node according to the Rob's remarks.

Changes in v2:
- Remove the unit address of the endpoint.
- Add the unit address to the clock node.
- Avoid using underscores in node names.
- Drop the "0x" in the unit address of the i2c node.
- Modify the description of 'atmel,sensor-preferred'.
- Add the description for the ISC internal clock.

 .../devicetree/bindings/media/atmel-isc.txt| 69 ++
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isc.txt

diff --git a/Documentation/devicetree/bindings/media/atmel-isc.txt 
b/Documentation/devicetree/bindings/media/atmel-isc.txt
new file mode 100644
index 000..3f83524
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/atmel-isc.txt
@@ -0,0 +1,69 @@
+Atmel Image Sensor Controller (ISC)
+--
+
+Required properties for ISC:
+- compatible
+   Must be "atmel,sama5d2-isc".
+- reg
+   Physical base address and length of the registers set for the device.
+- interrupts
+   Should contain IRQ line for the ISC.
+- clocks
+   List of clock specifiers, corresponding to entries in
+   the clock-names property;
+   Please refer to clock-bindings.txt.
+- clock-names
+   Required elements: "hclock".
+- #clock-cells
+   Should be 0.
+- clock-output-names
+   Should contain the name of the clock driving the sensor master clock.
+- pinctrl-names, pinctrl-0
+   Please refer to pinctrl-bindings.txt.
+
+
+ISC supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+isc: isc@f0008000 {
+   compatible = "atmel,sama5d2-isc";
+   reg = <0xf0008000 0x4000>;
+   interrupts = <46 IRQ_TYPE_LEVEL_HIGH 5>;
+   clocks = <_clk>, <>, <_gclk>;
+   clock-names = "hclock";


You have 3 clocks here and only one name. Are you sure this example is
actually working?

The isc_clk is mandatory, but the other two clocks are optional, so I 
did not give their name. This example is tested.

Should I add the name for the other two clocks?


+   #clock-cells = <0>;
+   clock-output-names = "isc-mck";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   isc_0: endpoint {
+   remote-endpoint = <_0>;
+   hsync-active = <1>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   };
+   };
+
+
+};
+
+i2c1: i2c@fc028000 {
+   ov7740: camera@21 {
+   compatible = "ovti,ov7740";
+   reg = <0x21>;
+
+   clocks = <>;
+   clock-names = "xvclk";
+   assigned-clocks = <>;
+   assigned-clock-rates = <2400>;
+
+   port {
+   ov7740_0: endpoint {
+   remote-endpoint = <_0>;
+   };
+   };
+};






Re: [Qemu-devel] [RFC PATCH 0/3] x86: Add support for guest DMA dirty page tracking

2016-06-11 Thread Zhou Jie

Hi, Alex

On 2016/6/9 23:39, Alexander Duyck wrote:

On Thu, Jun 9, 2016 at 3:14 AM, Zhou Jie  wrote:

TO Alex
TO Michael

   In your solution you add a emulate PCI bridge to act as
   a bridge between direct assigned devices and the host bridge.
   Do you mean put all direct assigned devices to
   one emulate PCI bridge?
   If yes, this maybe bring some problems.

   We are writing a patchset to support aer feature in qemu.
   When assigning a vfio device with AER enabled, we must check whether
   the device supports a host bus reset (ie. hot reset) as this may be
   used by the guest OS in order to recover the device from an AER
   error.
   QEMU must therefore have the ability to perform a physical
   host bus reset using the existing vfio APIs in response to a virtual
   bus reset in the VM.
   A physical bus reset affects all of the devices on the host bus.
   Therefore all physical devices affected by a bus reset must be
   configured on the same virtual bus in the VM.
   And no devices unaffected by the bus reset,
   be configured on the same virtual bus.

   http://lists.nongnu.org/archive/html/qemu-devel/2016-05/msg02989.html

Sincerely,
Zhou Jie


That makes sense, but I don't think you have to worry much about this
at this point at least on my side as this was mostly just theory and I
haven't had a chance to put any of it into practice as of yet.

My idea has been evolving on this for a while.  One thought I had is
that we may want to have something like an emulated IOMMU and if
possible we would want to split it up over multiple domains just so we
can be certain that the virtual interfaces and the physical ones
existed in separate domains.  In regards to your concerns perhaps what
we could do is put each assigned device into its own domain to prevent
them from affecting each other.  To that end we could probably break
things up so that each device effectively lives in its own PCIe slot
in the emulated system.  Then when we start a migration of the guest
the assigned device domains would then have to be tracked for unmap
and sync calls when the direction is from the device.

I will keep your concerns in mind in the future when I get some time
to look at exploring this solution further.

- Alex


I am thinking about the practice of migration of passthrough device.

In your solution, you use a vendor specific configuration space to
negotiate with guest.
If you put each assigned device into its own domain,
how can qemu negotiate with guest?
Add the vendor specific configuration space to every pci bus which
is assigned a passthrough device?

Sincerely
Zhou Jie




Re: [Qemu-devel] [RFC PATCH 0/3] x86: Add support for guest DMA dirty page tracking

2016-06-11 Thread Zhou Jie

Hi, Alex

On 2016/6/9 23:39, Alexander Duyck wrote:

On Thu, Jun 9, 2016 at 3:14 AM, Zhou Jie  wrote:

TO Alex
TO Michael

   In your solution you add a emulate PCI bridge to act as
   a bridge between direct assigned devices and the host bridge.
   Do you mean put all direct assigned devices to
   one emulate PCI bridge?
   If yes, this maybe bring some problems.

   We are writing a patchset to support aer feature in qemu.
   When assigning a vfio device with AER enabled, we must check whether
   the device supports a host bus reset (ie. hot reset) as this may be
   used by the guest OS in order to recover the device from an AER
   error.
   QEMU must therefore have the ability to perform a physical
   host bus reset using the existing vfio APIs in response to a virtual
   bus reset in the VM.
   A physical bus reset affects all of the devices on the host bus.
   Therefore all physical devices affected by a bus reset must be
   configured on the same virtual bus in the VM.
   And no devices unaffected by the bus reset,
   be configured on the same virtual bus.

   http://lists.nongnu.org/archive/html/qemu-devel/2016-05/msg02989.html

Sincerely,
Zhou Jie


That makes sense, but I don't think you have to worry much about this
at this point at least on my side as this was mostly just theory and I
haven't had a chance to put any of it into practice as of yet.

My idea has been evolving on this for a while.  One thought I had is
that we may want to have something like an emulated IOMMU and if
possible we would want to split it up over multiple domains just so we
can be certain that the virtual interfaces and the physical ones
existed in separate domains.  In regards to your concerns perhaps what
we could do is put each assigned device into its own domain to prevent
them from affecting each other.  To that end we could probably break
things up so that each device effectively lives in its own PCIe slot
in the emulated system.  Then when we start a migration of the guest
the assigned device domains would then have to be tracked for unmap
and sync calls when the direction is from the device.

I will keep your concerns in mind in the future when I get some time
to look at exploring this solution further.

- Alex


I am thinking about the practice of migration of passthrough device.

In your solution, you use a vendor specific configuration space to
negotiate with guest.
If you put each assigned device into its own domain,
how can qemu negotiate with guest?
Add the vendor specific configuration space to every pci bus which
is assigned a passthrough device?

Sincerely
Zhou Jie




Re: [PATCH v2 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG

2016-06-11 Thread kbuild test robot
Hi,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Andrew-F-Davis/mfd-ti-smusbdig-Add-support-for-the-TI-SM-USB-DIG/20160611-012112
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-randconfig-x012-06120748 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `ti_smusbdig_xfer':
>> (.text+0x3053eb): undefined reference to `usb_interrupt_msg'
   drivers/built-in.o: In function `ti_smusbdig_xfer':
   (.text+0x305416): undefined reference to `usb_interrupt_msg'
   drivers/built-in.o: In function `ti_smusbdig_probe':
>> ti-smusbdig.c:(.text+0x3054ac): undefined reference to `usb_get_dev'
   drivers/built-in.o: In function `ti_smusbdig_driver_init':
>> ti-smusbdig.c:(.init.text+0xaf15): undefined reference to 
>> `usb_register_driver'
   drivers/built-in.o: In function `ti_smusbdig_driver_exit':
>> ti-smusbdig.c:(.exit.text+0x13fc): undefined reference to `usb_deregister'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v2 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG

2016-06-11 Thread kbuild test robot
Hi,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Andrew-F-Davis/mfd-ti-smusbdig-Add-support-for-the-TI-SM-USB-DIG/20160611-012112
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-randconfig-x012-06120748 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `ti_smusbdig_xfer':
>> (.text+0x3053eb): undefined reference to `usb_interrupt_msg'
   drivers/built-in.o: In function `ti_smusbdig_xfer':
   (.text+0x305416): undefined reference to `usb_interrupt_msg'
   drivers/built-in.o: In function `ti_smusbdig_probe':
>> ti-smusbdig.c:(.text+0x3054ac): undefined reference to `usb_get_dev'
   drivers/built-in.o: In function `ti_smusbdig_driver_init':
>> ti-smusbdig.c:(.init.text+0xaf15): undefined reference to 
>> `usb_register_driver'
   drivers/built-in.o: In function `ti_smusbdig_driver_exit':
>> ti-smusbdig.c:(.exit.text+0x13fc): undefined reference to `usb_deregister'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 3/3] befs: remove unused functions

2016-06-11 Thread Luis de Bethencourt
befs_iaddr_is_empty() and befs_brun_size() are unused. Removing them.

Signed-off-by: Luis de Bethencourt 
---
 fs/befs/befs.h | 12 
 1 file changed, 12 deletions(-)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index e0f59263a..c5c6cd1 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -140,18 +140,6 @@ befs_iaddrs_per_block(struct super_block *sb)
return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);
 }
 
-static inline int
-befs_iaddr_is_empty(const befs_inode_addr *iaddr)
-{
-   return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len);
-}
-
-static inline size_t
-befs_brun_size(struct super_block *sb, befs_block_run run)
-{
-   return BEFS_SB(sb)->block_size * run.len;
-}
-
 #include "endian.h"
 
 #endif /* _LINUX_BEFS_H */
-- 
2.5.1



[PATCH v3 6/6] drm/panel: simple: Add support for Sharp LQ123P1JX31 2400x1600 panel

2016-06-11 Thread Yakir Yang
The Sharp LQ123P1JX31 is an 12.3", 2400x1600 TFT-LCD panel connected
using eDP interfaces.

Signed-off-by: Yakir Yang 
Reviewed-by: Doug Anderson 
Tested-by: Doug Anderson 
---
Changes in v3:
- Correct the size of panel_desc to active area 259mmx173mm (Doug)
- Add the reviewed/tested flag from Doug

Changes in v2:
- Add detail timing of Sharp LQ123P1JX31 panel in v2

 drivers/gpu/drm/panel/panel-simple.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 17cc973..412746b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1314,6 +1314,29 @@ static const struct panel_desc samsung_ltn140at29_301 = {
},
 };
 
+static const struct drm_display_mode sharp_lq123p1jx31_mode = {
+   .clock = 252750,
+   .hdisplay = 2400,
+   .hsync_start = 2400 + 48,
+   .hsync_end = 2400 + 48 + 32,
+   .htotal = 2400 + 48 + 32 + 80,
+   .vdisplay = 1600,
+   .vsync_start = 1600 + 3,
+   .vsync_end = 1600 + 3 + 10,
+   .vtotal = 1600 + 3 + 10 + 33,
+   .vrefresh = 60,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+};
+
+static const struct panel_desc sharp_lq123p1jx31 = {
+   .modes = _lq123p1jx31_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 259,
+   .height = 173,
+   },
+};
+
 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
.clock = 33300,
.hdisplay = 800,
@@ -1537,6 +1560,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "samsung,ltn140at29-301",
.data = _ltn140at29_301,
}, {
+   .compatible = "sharp,lq123p1jx31",
+   .data = _lq123p1jx31,
+   }, {
.compatible = "shelly,sca07010-bfn-lnn",
.data = _sca07010_bfn_lnn,
}, {
-- 
1.9.1




[PATCH 3/3] befs: remove unused functions

2016-06-11 Thread Luis de Bethencourt
befs_iaddr_is_empty() and befs_brun_size() are unused. Removing them.

Signed-off-by: Luis de Bethencourt 
---
 fs/befs/befs.h | 12 
 1 file changed, 12 deletions(-)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index e0f59263a..c5c6cd1 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -140,18 +140,6 @@ befs_iaddrs_per_block(struct super_block *sb)
return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);
 }
 
-static inline int
-befs_iaddr_is_empty(const befs_inode_addr *iaddr)
-{
-   return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len);
-}
-
-static inline size_t
-befs_brun_size(struct super_block *sb, befs_block_run run)
-{
-   return BEFS_SB(sb)->block_size * run.len;
-}
-
 #include "endian.h"
 
 #endif /* _LINUX_BEFS_H */
-- 
2.5.1



[PATCH v3 6/6] drm/panel: simple: Add support for Sharp LQ123P1JX31 2400x1600 panel

2016-06-11 Thread Yakir Yang
The Sharp LQ123P1JX31 is an 12.3", 2400x1600 TFT-LCD panel connected
using eDP interfaces.

Signed-off-by: Yakir Yang 
Reviewed-by: Doug Anderson 
Tested-by: Doug Anderson 
---
Changes in v3:
- Correct the size of panel_desc to active area 259mmx173mm (Doug)
- Add the reviewed/tested flag from Doug

Changes in v2:
- Add detail timing of Sharp LQ123P1JX31 panel in v2

 drivers/gpu/drm/panel/panel-simple.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 17cc973..412746b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1314,6 +1314,29 @@ static const struct panel_desc samsung_ltn140at29_301 = {
},
 };
 
+static const struct drm_display_mode sharp_lq123p1jx31_mode = {
+   .clock = 252750,
+   .hdisplay = 2400,
+   .hsync_start = 2400 + 48,
+   .hsync_end = 2400 + 48 + 32,
+   .htotal = 2400 + 48 + 32 + 80,
+   .vdisplay = 1600,
+   .vsync_start = 1600 + 3,
+   .vsync_end = 1600 + 3 + 10,
+   .vtotal = 1600 + 3 + 10 + 33,
+   .vrefresh = 60,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+};
+
+static const struct panel_desc sharp_lq123p1jx31 = {
+   .modes = _lq123p1jx31_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 259,
+   .height = 173,
+   },
+};
+
 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
.clock = 33300,
.hdisplay = 800,
@@ -1537,6 +1560,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "samsung,ltn140at29-301",
.data = _ltn140at29_301,
}, {
+   .compatible = "sharp,lq123p1jx31",
+   .data = _lq123p1jx31,
+   }, {
.compatible = "shelly,sca07010-bfn-lnn",
.data = _sca07010_bfn_lnn,
}, {
-- 
1.9.1




[PATCH v3 5/6] dt-bindings: add Sharp LQ123P1JX31 panel binding

2016-06-11 Thread Yakir Yang
The Sharp LQ123P1JX31 is an 12.3" 2400x1600 TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
Reviewed-by: Douglas Anderson 
---
Changes in v3:
- Drop the extra comma in compatible name (Rob)
- Add the reviewed flag from Doug

Changes in v2:
- Add dt-bindings of Sharp LQ123P1JX31 panel in v2

 .../devicetree/bindings/display/panel/sharp,lq123p1jx31.txt| 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt 
b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
new file mode 100644
index 000..bcb0e8a
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
@@ -0,0 +1,7 @@
+Sharp 12.3" (2400x1600 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "sharp,lq123p1jx31"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1




[PATCH 1/3] befs: check return of sb_min_blocksize

2016-06-11 Thread Luis de Bethencourt
Confirm sb_min_blocksize() succeeded before continuing.

Signed-off-by: Luis de Bethencourt 
---
Hi,

This is the main fix I wanted to send. I noticed other file systems check
the return of sb_min_blocksize(), it can fail so it is worth checking before
continuing.

Thanks :)
Luis

 fs/befs/linuxvfs.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c734f21..453bb68 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -756,6 +756,7 @@ befs_fill_super(struct super_block *sb, void *data, int 
silent)
long ret = -EINVAL;
const unsigned long sb_block = 0;
const off_t x86_sb_off = 512;
+   int blocksize;
 
save_mount_options(sb, data);
 
@@ -788,7 +789,11 @@ befs_fill_super(struct super_block *sb, void *data, int 
silent)
 * least 1k to get the second 512 bytes of the volume.
 * -WD 10-26-01
 */ 
-   sb_min_blocksize(sb, 1024);
+   blocksize = sb_min_blocksize(sb, 1024);
+   if (!blocksize) {
+   befs_error(sb, "unable to set blocksize");
+   goto unacquire_priv_sbp;
+   }
 
if (!(bh = sb_bread(sb, sb_block))) {
if (!silent)
-- 
2.5.1



[PATCH 2/3] befs: fix function name in documentation

2016-06-11 Thread Luis de Bethencourt
Documentation of function befs_load_cb lists it as load_befs_sb. Fixing the
misnomer.

Signed-off-by: Luis de Bethencourt 
---
 fs/befs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/befs/super.c b/fs/befs/super.c
index aeafc4d..9d1b56c 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -14,7 +14,7 @@
 #include "super.h"
 
 /**
- * load_befs_sb -- Read from disk and properly byteswap all the fields
+ * befs_load_sb -- Read from disk and properly byteswap all the fields
  * of the befs superblock
  *
  *
-- 
2.5.1



[PATCH v3 5/6] dt-bindings: add Sharp LQ123P1JX31 panel binding

2016-06-11 Thread Yakir Yang
The Sharp LQ123P1JX31 is an 12.3" 2400x1600 TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
Reviewed-by: Douglas Anderson 
---
Changes in v3:
- Drop the extra comma in compatible name (Rob)
- Add the reviewed flag from Doug

Changes in v2:
- Add dt-bindings of Sharp LQ123P1JX31 panel in v2

 .../devicetree/bindings/display/panel/sharp,lq123p1jx31.txt| 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt 
b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
new file mode 100644
index 000..bcb0e8a
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
@@ -0,0 +1,7 @@
+Sharp 12.3" (2400x1600 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "sharp,lq123p1jx31"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1




[PATCH 1/3] befs: check return of sb_min_blocksize

2016-06-11 Thread Luis de Bethencourt
Confirm sb_min_blocksize() succeeded before continuing.

Signed-off-by: Luis de Bethencourt 
---
Hi,

This is the main fix I wanted to send. I noticed other file systems check
the return of sb_min_blocksize(), it can fail so it is worth checking before
continuing.

Thanks :)
Luis

 fs/befs/linuxvfs.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c734f21..453bb68 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -756,6 +756,7 @@ befs_fill_super(struct super_block *sb, void *data, int 
silent)
long ret = -EINVAL;
const unsigned long sb_block = 0;
const off_t x86_sb_off = 512;
+   int blocksize;
 
save_mount_options(sb, data);
 
@@ -788,7 +789,11 @@ befs_fill_super(struct super_block *sb, void *data, int 
silent)
 * least 1k to get the second 512 bytes of the volume.
 * -WD 10-26-01
 */ 
-   sb_min_blocksize(sb, 1024);
+   blocksize = sb_min_blocksize(sb, 1024);
+   if (!blocksize) {
+   befs_error(sb, "unable to set blocksize");
+   goto unacquire_priv_sbp;
+   }
 
if (!(bh = sb_bread(sb, sb_block))) {
if (!silent)
-- 
2.5.1



[PATCH 2/3] befs: fix function name in documentation

2016-06-11 Thread Luis de Bethencourt
Documentation of function befs_load_cb lists it as load_befs_sb. Fixing the
misnomer.

Signed-off-by: Luis de Bethencourt 
---
 fs/befs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/befs/super.c b/fs/befs/super.c
index aeafc4d..9d1b56c 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -14,7 +14,7 @@
 #include "super.h"
 
 /**
- * load_befs_sb -- Read from disk and properly byteswap all the fields
+ * befs_load_sb -- Read from disk and properly byteswap all the fields
  * of the befs superblock
  *
  *
-- 
2.5.1



[PATCH v3 2/6] drm/panel: simple: Add support for LG LP097QX1-SPA1 2048x1536 panel

2016-06-11 Thread Yakir Yang
The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v3:
- Correct the size of panel_desc to active area 208mmx147mm (Emil, Stéphane)
- Sort the lg_lp097qx1_spa1 before lg_lp120up1 (Emil)

Changes in v2: None

 drivers/gpu/drm/panel/panel-simple.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 3a7bdf1..2d40a21 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1017,6 +1017,28 @@ static const struct panel_desc lg_lb070wv8 = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
 };
 
+static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
+   .clock = 205210,
+   .hdisplay = 2048,
+   .hsync_start = 2048 + 150,
+   .hsync_end = 2048 + 150 + 5,
+   .htotal = 2048 + 150 + 5 + 5,
+   .vdisplay = 1536,
+   .vsync_start = 1536 + 3,
+   .vsync_end = 1536 + 3 + 1,
+   .vtotal = 1536 + 3 + 1 + 9,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc lg_lp097qx1_spa1 = {
+   .modes = _lp097qx1_spa1_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 208,
+   .height = 147,
+   },
+};
+
 static const struct drm_display_mode lg_lp120up1_mode = {
.clock = 162300,
.hdisplay = 1920,
@@ -1457,6 +1479,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "lg,lb070wv8",
.data = _lb070wv8,
}, {
+   .compatible = "lg,lp097qx1-spa1",
+   .data = _lp097qx1_spa1,
+   }, {
.compatible = "lg,lp120up1",
.data = _lp120up1,
}, {
-- 
1.9.1




[PATCH v3 3/6] dt-bindings: add Samsung LSN122DL01-C01 panel binding

2016-06-11 Thread Yakir Yang
The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD
panel connected using eDP interfaces.

Signed-off-by: Yakir Yang 
Acked-by: Rob Herring 
---
Changes in v3: None
Changes in v2:
- Add Rob's acked for dt-bindings of Samsung LSN122DL01 panel

 .../devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt   | 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt 
b/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt
new file mode 100644
index 000..dba298b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt
@@ -0,0 +1,7 @@
+Samsung 12.2" (2560x1600 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "samsung,lsn122dl01-c01"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1




[PATCH v3 4/6] drm/panel: simple: Add support for Samsung LSN122DL01-C01 2560x1600 panel

2016-06-11 Thread Yakir Yang
The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v3:
- Correct the size of panel_desc to active area 262mmx164mm (Emil, Stéphane)

Changes in v2: None

 drivers/gpu/drm/panel/panel-simple.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 2d40a21..17cc973 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1246,6 +1246,28 @@ static const struct panel_desc qd43003c0_40 = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
+static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
+   .clock = 271560,
+   .hdisplay = 2560,
+   .hsync_start = 2560 + 48,
+   .hsync_end = 2560 + 48 + 32,
+   .htotal = 2560 + 48 + 32 + 80,
+   .vdisplay = 1600,
+   .vsync_start = 1600 + 2,
+   .vsync_end = 1600 + 2 + 5,
+   .vtotal = 1600 + 2 + 5 + 57,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc samsung_lsn122dl01_c01 = {
+   .modes = _lsn122dl01_c01_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 262,
+   .height = 164,
+   },
+};
+
 static const struct drm_display_mode samsung_ltn101nt05_mode = {
.clock = 54030,
.hdisplay = 1024,
@@ -1506,6 +1528,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "qiaodian,qd43003c0-40",
.data = _40,
}, {
+   .compatible = "samsung,lsn122dl01-c01",
+   .data = _lsn122dl01_c01,
+   }, {
.compatible = "samsung,ltn101nt05",
.data = _ltn101nt05,
}, {
-- 
1.9.1




[PATCH v3 2/6] drm/panel: simple: Add support for LG LP097QX1-SPA1 2048x1536 panel

2016-06-11 Thread Yakir Yang
The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v3:
- Correct the size of panel_desc to active area 208mmx147mm (Emil, Stéphane)
- Sort the lg_lp097qx1_spa1 before lg_lp120up1 (Emil)

Changes in v2: None

 drivers/gpu/drm/panel/panel-simple.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 3a7bdf1..2d40a21 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1017,6 +1017,28 @@ static const struct panel_desc lg_lb070wv8 = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
 };
 
+static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
+   .clock = 205210,
+   .hdisplay = 2048,
+   .hsync_start = 2048 + 150,
+   .hsync_end = 2048 + 150 + 5,
+   .htotal = 2048 + 150 + 5 + 5,
+   .vdisplay = 1536,
+   .vsync_start = 1536 + 3,
+   .vsync_end = 1536 + 3 + 1,
+   .vtotal = 1536 + 3 + 1 + 9,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc lg_lp097qx1_spa1 = {
+   .modes = _lp097qx1_spa1_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 208,
+   .height = 147,
+   },
+};
+
 static const struct drm_display_mode lg_lp120up1_mode = {
.clock = 162300,
.hdisplay = 1920,
@@ -1457,6 +1479,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "lg,lb070wv8",
.data = _lb070wv8,
}, {
+   .compatible = "lg,lp097qx1-spa1",
+   .data = _lp097qx1_spa1,
+   }, {
.compatible = "lg,lp120up1",
.data = _lp120up1,
}, {
-- 
1.9.1




[PATCH v3 3/6] dt-bindings: add Samsung LSN122DL01-C01 panel binding

2016-06-11 Thread Yakir Yang
The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD
panel connected using eDP interfaces.

Signed-off-by: Yakir Yang 
Acked-by: Rob Herring 
---
Changes in v3: None
Changes in v2:
- Add Rob's acked for dt-bindings of Samsung LSN122DL01 panel

 .../devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt   | 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt 
b/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt
new file mode 100644
index 000..dba298b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt
@@ -0,0 +1,7 @@
+Samsung 12.2" (2560x1600 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "samsung,lsn122dl01-c01"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1




[PATCH v3 4/6] drm/panel: simple: Add support for Samsung LSN122DL01-C01 2560x1600 panel

2016-06-11 Thread Yakir Yang
The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v3:
- Correct the size of panel_desc to active area 262mmx164mm (Emil, Stéphane)

Changes in v2: None

 drivers/gpu/drm/panel/panel-simple.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 2d40a21..17cc973 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1246,6 +1246,28 @@ static const struct panel_desc qd43003c0_40 = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
+static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
+   .clock = 271560,
+   .hdisplay = 2560,
+   .hsync_start = 2560 + 48,
+   .hsync_end = 2560 + 48 + 32,
+   .htotal = 2560 + 48 + 32 + 80,
+   .vdisplay = 1600,
+   .vsync_start = 1600 + 2,
+   .vsync_end = 1600 + 2 + 5,
+   .vtotal = 1600 + 2 + 5 + 57,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc samsung_lsn122dl01_c01 = {
+   .modes = _lsn122dl01_c01_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 262,
+   .height = 164,
+   },
+};
+
 static const struct drm_display_mode samsung_ltn101nt05_mode = {
.clock = 54030,
.hdisplay = 1024,
@@ -1506,6 +1528,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "qiaodian,qd43003c0-40",
.data = _40,
}, {
+   .compatible = "samsung,lsn122dl01-c01",
+   .data = _lsn122dl01_c01,
+   }, {
.compatible = "samsung,ltn101nt05",
.data = _ltn101nt05,
}, {
-- 
1.9.1




[PATCH v3 1/6] dt-bindings: add LG LP097QX1-SPA1 panel binding

2016-06-11 Thread Yakir Yang
The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
Acked-by: Rob Herring 
---
Changes in v3: None
Changes in v2:
- Add Rob's acked for dt-bindings of LG LP097QX1-SPA1 panel

 .../devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt | 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt 
b/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt
new file mode 100644
index 000..4214151
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt
@@ -0,0 +1,7 @@
+LG 9.7" (2048x1536 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "lg,lp097qx1-spa1"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1




[PATCH v3 1/6] dt-bindings: add LG LP097QX1-SPA1 panel binding

2016-06-11 Thread Yakir Yang
The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
Acked-by: Rob Herring 
---
Changes in v3: None
Changes in v2:
- Add Rob's acked for dt-bindings of LG LP097QX1-SPA1 panel

 .../devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt | 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt 
b/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt
new file mode 100644
index 000..4214151
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt
@@ -0,0 +1,7 @@
+LG 9.7" (2048x1536 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "lg,lp097qx1-spa1"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1




Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file

2016-06-11 Thread Jeff Layton
On Sat, 2016-06-11 at 22:06 -0400, Oleg Drokin wrote:
> On Jun 11, 2016, at 9:33 PM, Jeff Layton wrote:
> 
> > On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote:
> > > On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote:
> > > 
> > > > On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote:
> > > > > On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote:
> > > > > > On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote:
> > > > > > 
> > > > > > > Currently there's an unprotected access mode check in
> > > > > > > nfs4_upgrade_open
> > > > > > > that then calls nfs4_get_vfs_file which in turn assumes whatever
> > > > > > > access mode was present in the state is still valid which is racy.
> > > > > > > Two nfs4_get_vfs_file van enter the same path as result and get 
> > > > > > > two
> > > > > > > references to nfs4_file, but later drop would only happens once
> > > > > > > because
> > > > > > > access mode is only denoted by bits, so no refcounting.
> > > > > > > 
> > > > > > > The locking around access mode testing is introduced to avoid this
> > > > > > > race.
> > > > > > > 
> > > > > > > Signed-off-by: Oleg Drokin 
> > > > > > > ---
> > > > > > > 
> > > > > > > This patch performs equally well to the st_rwsem -> mutex
> > > > > > > conversion,
> > > > > > > but is a bit ligher-weight I imagine.
> > > > > > > For one it seems to allow truncates in parallel if we ever want 
> > > > > > > it.
> > > > > > > 
> > > > > > > fs/nfsd/nfs4state.c | 28 +---
> > > > > > > 1 file changed, 25 insertions(+), 3 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > > > > > > index f5f82e1..d4b9eba 100644
> > > > > > > --- a/fs/nfsd/nfs4state.c
> > > > > > > +++ b/fs/nfsd/nfs4state.c
> > > > > > > @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct
> > > > > > > svc_rqst *rqstp, struct nfs4_file *fp,
> > > > > > > 
> > > > > > >   spin_lock(>fi_lock);
> > > > > > > 
> > > > > > > + if (test_access(open->op_share_access, stp)) {
> > > > > > > + spin_unlock(>fi_lock);
> > > > > > > + return nfserr_eagain;
> > > > > > > + }
> > > > > > > +
> > > > > > >   /*
> > > > > > >* Are we trying to set a deny mode that would conflict with
> > > > > > >* current access?
> > > > > > > @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp,
> > > > > > > struct nfs4_file *fp, struct svc_fh *c
> > > > > > >   __be32 status;
> > > > > > >   unsigned char old_deny_bmap = stp->st_deny_bmap;
> > > > > > > 
> > > > > > > - if (!test_access(open->op_share_access, stp))
> > > > > > > - return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
> > > > > > > open);
> > > > > > > +again:
> > > > > > > + spin_lock(>fi_lock);
> > > > > > > + if (!test_access(open->op_share_access, stp)) {
> > > > > > > + spin_unlock(>fi_lock);
> > > > > > > + status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
> > > > > > > open);
> > > > > > > + /*
> > > > > > > +  * Somebody won the race for access while we did
> > > > > > > not hold
> > > > > > > +  * the lock here
> > > > > > > +  */
> > > > > > > + if (status == nfserr_eagain)
> > > > > > > + goto again;
> > > > > > > + return status;
> > > > > > > + }
> > > > > > > 
> > > > > > >   /* test and set deny mode */
> > > > > > > - spin_lock(>fi_lock);
> > > > > > >   status = nfs4_file_check_deny(fp, open->op_share_deny);
> > > > > > >   if (status == nfs_ok) {
> > > > > > >   set_deny(open->op_share_deny, stp);
> > > > > > > @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp,
> > > > > > > struct svc_fh *current_fh, struct nf
> > > > > > >   status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp,
> > > > > > > open);
> > > > > > >   if (status) {
> > > > > > >   up_read(>st_rwsem);
> > > > > > > + /*
> > > > > > > +  * EAGAIN is returned when there's a
> > > > > > > racing access,
> > > > > > > +  * this should never happen as we are the
> > > > > > > only user
> > > > > > > +  * of this new state, and since it's not
> > > > > > > yet hashed,
> > > > > > > +  * nobody can find it
> > > > > > > +  */
> > > > > > > + WARN_ON(status == nfserr_eagain);
> > > > > > 
> > > > > > Ok, some more testing shows that this CAN happen.
> > > > > > So this patch is inferior to the mutex one after all.
> > > > > > 
> > > > > 
> > > > > Yeah, that can happen for all sorts of reasons. As Andrew pointed out,
> > > > > you can get this when there is a lease break in progress, and that may
> > > > > be occurring for a completely different stateid (or because of samba,
> > > > > etc...)
> > > > > 
> > > > > It may be possible to do something like this, but we'd need to audit
> > > > > all of the handling of st_access_bmap (and the deny bmap) to ensure
> > > > 

Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file

2016-06-11 Thread Jeff Layton
On Sat, 2016-06-11 at 22:06 -0400, Oleg Drokin wrote:
> On Jun 11, 2016, at 9:33 PM, Jeff Layton wrote:
> 
> > On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote:
> > > On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote:
> > > 
> > > > On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote:
> > > > > On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote:
> > > > > > On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote:
> > > > > > 
> > > > > > > Currently there's an unprotected access mode check in
> > > > > > > nfs4_upgrade_open
> > > > > > > that then calls nfs4_get_vfs_file which in turn assumes whatever
> > > > > > > access mode was present in the state is still valid which is racy.
> > > > > > > Two nfs4_get_vfs_file van enter the same path as result and get 
> > > > > > > two
> > > > > > > references to nfs4_file, but later drop would only happens once
> > > > > > > because
> > > > > > > access mode is only denoted by bits, so no refcounting.
> > > > > > > 
> > > > > > > The locking around access mode testing is introduced to avoid this
> > > > > > > race.
> > > > > > > 
> > > > > > > Signed-off-by: Oleg Drokin 
> > > > > > > ---
> > > > > > > 
> > > > > > > This patch performs equally well to the st_rwsem -> mutex
> > > > > > > conversion,
> > > > > > > but is a bit ligher-weight I imagine.
> > > > > > > For one it seems to allow truncates in parallel if we ever want 
> > > > > > > it.
> > > > > > > 
> > > > > > > fs/nfsd/nfs4state.c | 28 +---
> > > > > > > 1 file changed, 25 insertions(+), 3 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > > > > > > index f5f82e1..d4b9eba 100644
> > > > > > > --- a/fs/nfsd/nfs4state.c
> > > > > > > +++ b/fs/nfsd/nfs4state.c
> > > > > > > @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct
> > > > > > > svc_rqst *rqstp, struct nfs4_file *fp,
> > > > > > > 
> > > > > > >   spin_lock(>fi_lock);
> > > > > > > 
> > > > > > > + if (test_access(open->op_share_access, stp)) {
> > > > > > > + spin_unlock(>fi_lock);
> > > > > > > + return nfserr_eagain;
> > > > > > > + }
> > > > > > > +
> > > > > > >   /*
> > > > > > >* Are we trying to set a deny mode that would conflict with
> > > > > > >* current access?
> > > > > > > @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp,
> > > > > > > struct nfs4_file *fp, struct svc_fh *c
> > > > > > >   __be32 status;
> > > > > > >   unsigned char old_deny_bmap = stp->st_deny_bmap;
> > > > > > > 
> > > > > > > - if (!test_access(open->op_share_access, stp))
> > > > > > > - return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
> > > > > > > open);
> > > > > > > +again:
> > > > > > > + spin_lock(>fi_lock);
> > > > > > > + if (!test_access(open->op_share_access, stp)) {
> > > > > > > + spin_unlock(>fi_lock);
> > > > > > > + status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
> > > > > > > open);
> > > > > > > + /*
> > > > > > > +  * Somebody won the race for access while we did
> > > > > > > not hold
> > > > > > > +  * the lock here
> > > > > > > +  */
> > > > > > > + if (status == nfserr_eagain)
> > > > > > > + goto again;
> > > > > > > + return status;
> > > > > > > + }
> > > > > > > 
> > > > > > >   /* test and set deny mode */
> > > > > > > - spin_lock(>fi_lock);
> > > > > > >   status = nfs4_file_check_deny(fp, open->op_share_deny);
> > > > > > >   if (status == nfs_ok) {
> > > > > > >   set_deny(open->op_share_deny, stp);
> > > > > > > @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp,
> > > > > > > struct svc_fh *current_fh, struct nf
> > > > > > >   status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp,
> > > > > > > open);
> > > > > > >   if (status) {
> > > > > > >   up_read(>st_rwsem);
> > > > > > > + /*
> > > > > > > +  * EAGAIN is returned when there's a
> > > > > > > racing access,
> > > > > > > +  * this should never happen as we are the
> > > > > > > only user
> > > > > > > +  * of this new state, and since it's not
> > > > > > > yet hashed,
> > > > > > > +  * nobody can find it
> > > > > > > +  */
> > > > > > > + WARN_ON(status == nfserr_eagain);
> > > > > > 
> > > > > > Ok, some more testing shows that this CAN happen.
> > > > > > So this patch is inferior to the mutex one after all.
> > > > > > 
> > > > > 
> > > > > Yeah, that can happen for all sorts of reasons. As Andrew pointed out,
> > > > > you can get this when there is a lease break in progress, and that may
> > > > > be occurring for a completely different stateid (or because of samba,
> > > > > etc...)
> > > > > 
> > > > > It may be possible to do something like this, but we'd need to audit
> > > > > all of the handling of st_access_bmap (and the deny bmap) to ensure
> > > > > that we get it 

arch/x86/kvm/svm.c:3866:10: error: implicit declaration of function '__default_cpu_present_to_apicid'

2016-06-11 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8714f8f5fe396ca513ccaaac2304497439c181fb
commit: 340d3bc3664e5d3fb922fe6e3ae2d901d4900d88 svm: Add interrupt injection 
via AVIC
date:   3 weeks ago
config: i386-randconfig-x0-06121009 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
git checkout 340d3bc3664e5d3fb922fe6e3ae2d901d4900d88
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   arch/x86/kvm/svm.c: In function 'svm_deliver_avic_intr':
>> arch/x86/kvm/svm.c:3866:10: error: implicit declaration of function 
>> '__default_cpu_present_to_apicid' [-Werror=implicit-function-declaration]
 __default_cpu_present_to_apicid(vcpu->cpu));
 ^~~
   At top level:
   arch/x86/kvm/svm.c:52:32: warning: 'svm_cpu_id' defined but not used 
[-Wunused-const-variable=]
static const struct x86_cpu_id svm_cpu_id[] = {
   ^~
   cc1: some warnings being treated as errors

vim +/__default_cpu_present_to_apicid +3866 arch/x86/kvm/svm.c

  3860  {
  3861  kvm_lapic_set_irr(vec, vcpu->arch.apic);
  3862  smp_mb__after_atomic();
  3863  
  3864  if (avic_vcpu_is_running(vcpu))
  3865  wrmsrl(SVM_AVIC_DOORBELL,
> 3866 __default_cpu_present_to_apicid(vcpu->cpu));
  3867  else
  3868  kvm_vcpu_wake_up(vcpu);
  3869  }

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


arch/x86/kvm/svm.c:3866:10: error: implicit declaration of function '__default_cpu_present_to_apicid'

2016-06-11 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8714f8f5fe396ca513ccaaac2304497439c181fb
commit: 340d3bc3664e5d3fb922fe6e3ae2d901d4900d88 svm: Add interrupt injection 
via AVIC
date:   3 weeks ago
config: i386-randconfig-x0-06121009 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
git checkout 340d3bc3664e5d3fb922fe6e3ae2d901d4900d88
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   arch/x86/kvm/svm.c: In function 'svm_deliver_avic_intr':
>> arch/x86/kvm/svm.c:3866:10: error: implicit declaration of function 
>> '__default_cpu_present_to_apicid' [-Werror=implicit-function-declaration]
 __default_cpu_present_to_apicid(vcpu->cpu));
 ^~~
   At top level:
   arch/x86/kvm/svm.c:52:32: warning: 'svm_cpu_id' defined but not used 
[-Wunused-const-variable=]
static const struct x86_cpu_id svm_cpu_id[] = {
   ^~
   cc1: some warnings being treated as errors

vim +/__default_cpu_present_to_apicid +3866 arch/x86/kvm/svm.c

  3860  {
  3861  kvm_lapic_set_irr(vec, vcpu->arch.apic);
  3862  smp_mb__after_atomic();
  3863  
  3864  if (avic_vcpu_is_running(vcpu))
  3865  wrmsrl(SVM_AVIC_DOORBELL,
> 3866 __default_cpu_present_to_apicid(vcpu->cpu));
  3867  else
  3868  kvm_vcpu_wake_up(vcpu);
  3869  }

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 3/3] ARM: dts: imx7: add Toradex Colibri iMX7S/iMX7D support

2016-06-11 Thread Shawn Guo
On Tue, Jun 07, 2016 at 07:37:09PM -0700, Stefan Agner wrote:
> + {
> + status = "okay";
> + display = <>;

Please put 'status' at the bottom of property list.

> +
> + display0: lcd-display {
> + bits-per-pixel = <16>;
> + bus-width = <18>;
> +
> + display-timings {
> + native-mode = <_vga>;
> +
> + /* Standard VGA timing */
> + timing_vga: 640x480 {
> + clock-frequency = <25175000>;
> + hactive = <640>;
> + vactive = <480>;
> + hback-porch = <40>;
> + hfront-porch = <24>;
> + vback-porch = <32>;
> + vfront-porch = <11>;
> + hsync-len = <96>;
> + vsync-len = <2>;
> + de-active = <1>;
> + hsync-active = <0>;
> + vsync-active = <0>;
> + pixelclk-active = <0>;
> + };
> + };
> + };
> +};



> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_usdhc1 _cd_usdhc1>;
> + no-1-8-v;
> + cd-gpios = < 0 0>;

Use the macro in include/dt-bindings/gpio/gpio.h.

> + enable-sdio-wakeup;

This is deprecated.  Please use wakeup-source instead.

> + fsl,tuning-step = <2>;
> + keep-power-in-suspend;
> + status = "okay";
> +};



> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_enet1>;
> + clocks = < IMX7D_ENET_AXI_ROOT_CLK>,
> + < IMX7D_ENET_AXI_ROOT_CLK>,
> + < IMX7D_ENET1_TIME_ROOT_CLK>,
> + < IMX7D_PLL_ENET_MAIN_50M_CLK>;
> + clock-names = "ipg", "ahb", "ptp", "enet_clk_ref";
> +

Drop this newline.

> + assigned-clocks = < IMX7D_ENET1_TIME_ROOT_SRC>,
> +   < IMX7D_ENET1_TIME_ROOT_CLK>;
> + assigned-clock-parents = < IMX7D_PLL_ENET_MAIN_100M_CLK>;
> + assigned-clock-rates = <0>, <1>;
> + phy-mode = "rmii";
> + phy-supply = <_LDO1>;
> + fsl,magic-packet;
> +};



> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_uart1 _uart1_ctrl1 _uart1_ctrl2>;
> + assigned-clocks = < IMX7D_UART1_ROOT_SRC>;
> + assigned-clock-parents = < IMX7D_OSC_24M_CLK>;
> + fsl,uart-has-rtscts;

Please use generic 'uart-has-rtscts' instead.

> + fsl,dte-mode;
> +};
> +
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_uart2>;
> + assigned-clocks = < IMX7D_UART2_ROOT_SRC>;
> + assigned-clock-parents = < IMX7D_OSC_24M_CLK>;
> + fsl,uart-has-rtscts;

Ditto

> + fsl,dte-mode;
> +};



> +/ {
> + model = "Toradex Colibri iMX7D on Colibri Evaluation Board V3";
> + compatible = "toradex,colibri_imx7d-eval", "toradex,colibri_imx7d", \

We always use hyphen than underscore in compatible string.

> +  "fsl,imx7d";
> +
> + reg_usb_otg2_vbus: regulator-usb-otg2-vbus {
> + compatible = "regulator-fixed";
> + pinctrl-names = "default";
> + pinctrl-0 = <_usbotg2_reg>;
> + regulator-name = "VCC_USB[1-4]";
> + regulator-min-microvolt = <500>;
> + regulator-max-microvolt = <500>;
> + gpio = < 7 GPIO_ACTIVE_LOW>;
> + };
> +};
> +/ {
> + model = "Toradex Colibri iMX7S on Colibri Evaluation Board V3";
> + compatible = "toradex,colibri_imx7s-eval", "toradex,colibri_imx7s", \
> +  "fsl,imx7s", "fsl,imx7d";

You may not want to have "fsl,imx7d" here.  Otherwise, the detection
between  imx7s and imx7d colibri-eval-v3 board will be difficult.

Shawn

> +};


Re: [PATCH 3/3] ARM: dts: imx7: add Toradex Colibri iMX7S/iMX7D support

2016-06-11 Thread Shawn Guo
On Tue, Jun 07, 2016 at 07:37:09PM -0700, Stefan Agner wrote:
> + {
> + status = "okay";
> + display = <>;

Please put 'status' at the bottom of property list.

> +
> + display0: lcd-display {
> + bits-per-pixel = <16>;
> + bus-width = <18>;
> +
> + display-timings {
> + native-mode = <_vga>;
> +
> + /* Standard VGA timing */
> + timing_vga: 640x480 {
> + clock-frequency = <25175000>;
> + hactive = <640>;
> + vactive = <480>;
> + hback-porch = <40>;
> + hfront-porch = <24>;
> + vback-porch = <32>;
> + vfront-porch = <11>;
> + hsync-len = <96>;
> + vsync-len = <2>;
> + de-active = <1>;
> + hsync-active = <0>;
> + vsync-active = <0>;
> + pixelclk-active = <0>;
> + };
> + };
> + };
> +};



> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_usdhc1 _cd_usdhc1>;
> + no-1-8-v;
> + cd-gpios = < 0 0>;

Use the macro in include/dt-bindings/gpio/gpio.h.

> + enable-sdio-wakeup;

This is deprecated.  Please use wakeup-source instead.

> + fsl,tuning-step = <2>;
> + keep-power-in-suspend;
> + status = "okay";
> +};



> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_enet1>;
> + clocks = < IMX7D_ENET_AXI_ROOT_CLK>,
> + < IMX7D_ENET_AXI_ROOT_CLK>,
> + < IMX7D_ENET1_TIME_ROOT_CLK>,
> + < IMX7D_PLL_ENET_MAIN_50M_CLK>;
> + clock-names = "ipg", "ahb", "ptp", "enet_clk_ref";
> +

Drop this newline.

> + assigned-clocks = < IMX7D_ENET1_TIME_ROOT_SRC>,
> +   < IMX7D_ENET1_TIME_ROOT_CLK>;
> + assigned-clock-parents = < IMX7D_PLL_ENET_MAIN_100M_CLK>;
> + assigned-clock-rates = <0>, <1>;
> + phy-mode = "rmii";
> + phy-supply = <_LDO1>;
> + fsl,magic-packet;
> +};



> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_uart1 _uart1_ctrl1 _uart1_ctrl2>;
> + assigned-clocks = < IMX7D_UART1_ROOT_SRC>;
> + assigned-clock-parents = < IMX7D_OSC_24M_CLK>;
> + fsl,uart-has-rtscts;

Please use generic 'uart-has-rtscts' instead.

> + fsl,dte-mode;
> +};
> +
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_uart2>;
> + assigned-clocks = < IMX7D_UART2_ROOT_SRC>;
> + assigned-clock-parents = < IMX7D_OSC_24M_CLK>;
> + fsl,uart-has-rtscts;

Ditto

> + fsl,dte-mode;
> +};



> +/ {
> + model = "Toradex Colibri iMX7D on Colibri Evaluation Board V3";
> + compatible = "toradex,colibri_imx7d-eval", "toradex,colibri_imx7d", \

We always use hyphen than underscore in compatible string.

> +  "fsl,imx7d";
> +
> + reg_usb_otg2_vbus: regulator-usb-otg2-vbus {
> + compatible = "regulator-fixed";
> + pinctrl-names = "default";
> + pinctrl-0 = <_usbotg2_reg>;
> + regulator-name = "VCC_USB[1-4]";
> + regulator-min-microvolt = <500>;
> + regulator-max-microvolt = <500>;
> + gpio = < 7 GPIO_ACTIVE_LOW>;
> + };
> +};
> +/ {
> + model = "Toradex Colibri iMX7S on Colibri Evaluation Board V3";
> + compatible = "toradex,colibri_imx7s-eval", "toradex,colibri_imx7s", \
> +  "fsl,imx7s", "fsl,imx7d";

You may not want to have "fsl,imx7d" here.  Otherwise, the detection
between  imx7s and imx7d colibri-eval-v3 board will be difficult.

Shawn

> +};


undefined reference to `printk'

2016-06-11 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8714f8f5fe396ca513ccaaac2304497439c181fb
commit: 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a kconfig: make allnoconfig 
disable options behind EMBEDDED and EXPERT
date:   2 years, 2 months ago
config: m32r-allnoconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a
# save the attached .config to linux build tree
make.cross ARCH=m32r 

All errors (new ones prefixed by >>):

   arch/m32r/kernel/built-in.o: In function `default_eit_handler':
>> (.text+0x3f8): undefined reference to `printk'
   arch/m32r/kernel/built-in.o: In function `default_eit_handler':
   (.text+0x3f8): relocation truncated to fit: R_M32R_26_PCREL_RELA against 
undefined symbol `printk'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


undefined reference to `printk'

2016-06-11 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8714f8f5fe396ca513ccaaac2304497439c181fb
commit: 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a kconfig: make allnoconfig 
disable options behind EMBEDDED and EXPERT
date:   2 years, 2 months ago
config: m32r-allnoconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a
# save the attached .config to linux build tree
make.cross ARCH=m32r 

All errors (new ones prefixed by >>):

   arch/m32r/kernel/built-in.o: In function `default_eit_handler':
>> (.text+0x3f8): undefined reference to `printk'
   arch/m32r/kernel/built-in.o: In function `default_eit_handler':
   (.text+0x3f8): relocation truncated to fit: R_M32R_26_PCREL_RELA against 
undefined symbol `printk'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[lkp] [power_supply] 1235baeac8: thermal thermal_zone0: failed to read out thermal zone (-19)

2016-06-11 Thread kernel test robot

FYI, we noticed the following commit:

https://github.com/0day-ci/linux 
Rhyland-Klein/power_supply-power_supply_read_temp-only-if-use_cnt-0/20160610-053415
commit 1235baeac82d3113a7334f55a3fef160c5a4b983 ("power_supply: 
power_supply_read_temp only if use_cnt > 0")


on test machine: vm-vp-quantal-x86_64: 2 threads qemu-system-x86_64 -enable-kvm 
with 360M memory

caused below changes:

[5.908066] __power_supply_register: Expected proper parent device for 
'test_ac'
[5.911184] __power_supply_register: Expected proper parent device for 
'test_battery'
[5.915462] thermal thermal_zone0: failed to read out thermal zone (-19)
[5.917370] __power_supply_register: Expected proper parent device for 
'test_usb'


FYI, raw QEMU command line is:

qemu-system-x86_64 -enable-kvm -kernel 
/pkg/linux/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/vmlinuz-4.6.0-rc2-6-g1235bae
 -append 'root=/dev/ram0 user=lkp 
job=/lkp/scheduled/vm-vp-quantal-x86_64-17/rand_boot-1-quantal-core-x86_64.cgz-x86_64-randconfig-s3-06100451-1235baeac82d3113a7334f55a3fef160c5a4b983-20160610-77925-1xs3hv7-0.yaml~
 ARCH=x86_64 kconfig=x86_64-randconfig-s3-06100451 
branch=linux-devel/devel-spot-201606100535 
commit=1235baeac82d3113a7334f55a3fef160c5a4b983 
BOOT_IMAGE=/pkg/linux/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/vmlinuz-4.6.0-rc2-6-g1235bae
 max_uptime=600 
RESULT_ROOT=/result/boot/1/vm-vp-quantal-x86_64/quantal-core-x86_64.cgz/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/0
 LKP_SERVER=inn earlyprintk=ttyS0,115200 systemd.log_level=err debug apic=debug 
sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100 panic=-1 
softlockup_panic=1 nmi_watchdog=panic oops=panic load_ramdisk=2 
prompt_ramdisk=0 console=ttyS0,115200 console=tty0 vga=normal rw 
ip=vm-vp-quantal-x86_64-17::dhcp drbd.minor_count=8'  -initrd 
/fs/sdb1/initrd-vm-vp-quantal-x86_64-17 -m 360 -smp 2 -device e1000,netdev=net0 
-netdev user,id=net0 -boot order=nc -no-reboot -watchdog i6300esb -rtc 
base=localtime -pidfile /dev/shm/kboot/pid-vm-vp-quantal-x86_64-17 -serial 
file:/dev/shm/kboot/serial-vm-vp-quantal-x86_64-17 -daemonize -display none 
-monitor null 





Thanks,
Xiaolong
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 4.6.0-rc2 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=28
CONFIG_ARCH_MMAP_RND_BITS_MAX=32
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_HAVE_INTEL_TXT=y
CONFIG_X86_64_SMP=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEBUG_RODATA=y
CONFIG_PGTABLE_LEVELS=4
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
CONFIG_KERNEL_BZIP2=y
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
# CONFIG_SWAP is not set
# CONFIG_SYSVIPC is not set
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_FHANDLE=y
# CONFIG_USELIB is not set
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y

[lkp] [power_supply] 1235baeac8: thermal thermal_zone0: failed to read out thermal zone (-19)

2016-06-11 Thread kernel test robot

FYI, we noticed the following commit:

https://github.com/0day-ci/linux 
Rhyland-Klein/power_supply-power_supply_read_temp-only-if-use_cnt-0/20160610-053415
commit 1235baeac82d3113a7334f55a3fef160c5a4b983 ("power_supply: 
power_supply_read_temp only if use_cnt > 0")


on test machine: vm-vp-quantal-x86_64: 2 threads qemu-system-x86_64 -enable-kvm 
with 360M memory

caused below changes:

[5.908066] __power_supply_register: Expected proper parent device for 
'test_ac'
[5.911184] __power_supply_register: Expected proper parent device for 
'test_battery'
[5.915462] thermal thermal_zone0: failed to read out thermal zone (-19)
[5.917370] __power_supply_register: Expected proper parent device for 
'test_usb'


FYI, raw QEMU command line is:

qemu-system-x86_64 -enable-kvm -kernel 
/pkg/linux/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/vmlinuz-4.6.0-rc2-6-g1235bae
 -append 'root=/dev/ram0 user=lkp 
job=/lkp/scheduled/vm-vp-quantal-x86_64-17/rand_boot-1-quantal-core-x86_64.cgz-x86_64-randconfig-s3-06100451-1235baeac82d3113a7334f55a3fef160c5a4b983-20160610-77925-1xs3hv7-0.yaml~
 ARCH=x86_64 kconfig=x86_64-randconfig-s3-06100451 
branch=linux-devel/devel-spot-201606100535 
commit=1235baeac82d3113a7334f55a3fef160c5a4b983 
BOOT_IMAGE=/pkg/linux/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/vmlinuz-4.6.0-rc2-6-g1235bae
 max_uptime=600 
RESULT_ROOT=/result/boot/1/vm-vp-quantal-x86_64/quantal-core-x86_64.cgz/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/0
 LKP_SERVER=inn earlyprintk=ttyS0,115200 systemd.log_level=err debug apic=debug 
sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100 panic=-1 
softlockup_panic=1 nmi_watchdog=panic oops=panic load_ramdisk=2 
prompt_ramdisk=0 console=ttyS0,115200 console=tty0 vga=normal rw 
ip=vm-vp-quantal-x86_64-17::dhcp drbd.minor_count=8'  -initrd 
/fs/sdb1/initrd-vm-vp-quantal-x86_64-17 -m 360 -smp 2 -device e1000,netdev=net0 
-netdev user,id=net0 -boot order=nc -no-reboot -watchdog i6300esb -rtc 
base=localtime -pidfile /dev/shm/kboot/pid-vm-vp-quantal-x86_64-17 -serial 
file:/dev/shm/kboot/serial-vm-vp-quantal-x86_64-17 -daemonize -display none 
-monitor null 





Thanks,
Xiaolong
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 4.6.0-rc2 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=28
CONFIG_ARCH_MMAP_RND_BITS_MAX=32
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_HAVE_INTEL_TXT=y
CONFIG_X86_64_SMP=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEBUG_RODATA=y
CONFIG_PGTABLE_LEVELS=4
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
CONFIG_KERNEL_BZIP2=y
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
# CONFIG_SWAP is not set
# CONFIG_SYSVIPC is not set
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_FHANDLE=y
# CONFIG_USELIB is not set
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y

Re: [PATCH] serial: 8250_early: Add earlycon support for Synopsys DesignWare ABP UART

2016-06-11 Thread Kefeng Wang


On 2016/5/20 5:35, Jon Mason wrote:
> On Thu, May 19, 2016 at 09:45:33AM +0800, Kefeng Wang wrote:
>> +Cc Jon and arm-kernel mailist
>>
>> Any comments, thanks.
> 
> It works for me.  Please feel free to add
> 
> Tested-by: Jon Mason 

Thanks Jon, hi Greg, ping...

BRs,
Kefeng

> 
> Thanks,
> Jon
> 
>>
>> Kefeng
>>
>> On 2016/5/11 14:06, Kefeng Wang wrote:
>>> Some board like Hisilicon D02 uses Synopsys DesignWare ABP UART, declare an
>>> OF early console for it, so early console device can be enabled with comand
>>> line "earlycon"(without option) via the "stdout-path" property in 
>>> device-tree.
>>>
>>> Signed-off-by: Kefeng Wang 
>>> ---
>>>  drivers/tty/serial/8250/8250_early.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_early.c 
>>> b/drivers/tty/serial/8250/8250_early.c
>>> index 8d08ff5..85a12f0 100644
>>> --- a/drivers/tty/serial/8250/8250_early.c
>>> +++ b/drivers/tty/serial/8250/8250_early.c
>>> @@ -150,6 +150,7 @@ EARLYCON_DECLARE(uart, early_serial8250_setup);
>>>  OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup);
>>>  OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
>>>  OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup);
>>> +OF_EARLYCON_DECLARE(uart, "snps,dw-apb-uart", early_serial8250_setup);
>>>  
>>>  #ifdef CONFIG_SERIAL_8250_OMAP
>>>  
>>>
>>
> 
> .
> 



Re: [PATCH] serial: 8250_early: Add earlycon support for Synopsys DesignWare ABP UART

2016-06-11 Thread Kefeng Wang


On 2016/5/20 5:35, Jon Mason wrote:
> On Thu, May 19, 2016 at 09:45:33AM +0800, Kefeng Wang wrote:
>> +Cc Jon and arm-kernel mailist
>>
>> Any comments, thanks.
> 
> It works for me.  Please feel free to add
> 
> Tested-by: Jon Mason 

Thanks Jon, hi Greg, ping...

BRs,
Kefeng

> 
> Thanks,
> Jon
> 
>>
>> Kefeng
>>
>> On 2016/5/11 14:06, Kefeng Wang wrote:
>>> Some board like Hisilicon D02 uses Synopsys DesignWare ABP UART, declare an
>>> OF early console for it, so early console device can be enabled with comand
>>> line "earlycon"(without option) via the "stdout-path" property in 
>>> device-tree.
>>>
>>> Signed-off-by: Kefeng Wang 
>>> ---
>>>  drivers/tty/serial/8250/8250_early.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_early.c 
>>> b/drivers/tty/serial/8250/8250_early.c
>>> index 8d08ff5..85a12f0 100644
>>> --- a/drivers/tty/serial/8250/8250_early.c
>>> +++ b/drivers/tty/serial/8250/8250_early.c
>>> @@ -150,6 +150,7 @@ EARLYCON_DECLARE(uart, early_serial8250_setup);
>>>  OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup);
>>>  OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
>>>  OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup);
>>> +OF_EARLYCON_DECLARE(uart, "snps,dw-apb-uart", early_serial8250_setup);
>>>  
>>>  #ifdef CONFIG_SERIAL_8250_OMAP
>>>  
>>>
>>
> 
> .
> 



Re: [PATCH v2 5/6] dt-bindings: add Sharp LQ123P1JX31 panel binding

2016-06-11 Thread Yakir Yang


On 06/11/2016 12:40 AM, Doug Anderson wrote:

Rob,

On Fri, Jun 10, 2016 at 6:42 AM, Rob Herring  wrote:

On Wed, Jun 08, 2016 at 07:52:45PM +0800, Yakir Yang wrote:

The Sharp LQ123P1JX31 is an 12.3" 2400x1600 TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2:
- Add dt-bindings of Sharp LQ123P1JX31 panel in v2

  .../devicetree/bindings/display/panel/sharp,lq123p1jx31.txt| 7 +++
  1 file changed, 7 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt 
b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
new file mode 100644
index 000..81938c0
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
@@ -0,0 +1,7 @@
+Sharp 12.3" (2400x1600 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "sharp,lq123p1jx31,"

  ^
Need to drop the comma.

Thanks for catching!


Done,




No regulators or resets or pwms?

Could be more explicit I guess, but Yakir does say:


This binding is compatible with the simple-panel binding, which is specified
in simple-panel.txt in this directory.

In that document it shows:

Required properties:
- power-supply: regulator to provide the supply voltage

Optional properties:
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
- enable-gpios: GPIO pin to enable or disable the panel
- backlight: phandle of the backlight device attached to the panel


In general Yakir's bindings document match a huge chunk of the current
existing bindings.  Do this:
   cd Documentation/devicetree/bindings/display/panel
   grep -C20 "This binding is compatible with the simple-panel" *

You'll find a huge chunk of files which are rather formulaic.  It
might make sense to just have one file and a list of panels which are
simple panels?


-Doug








Re: [PATCH v2 5/6] dt-bindings: add Sharp LQ123P1JX31 panel binding

2016-06-11 Thread Yakir Yang


On 06/11/2016 12:40 AM, Doug Anderson wrote:

Rob,

On Fri, Jun 10, 2016 at 6:42 AM, Rob Herring  wrote:

On Wed, Jun 08, 2016 at 07:52:45PM +0800, Yakir Yang wrote:

The Sharp LQ123P1JX31 is an 12.3" 2400x1600 TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2:
- Add dt-bindings of Sharp LQ123P1JX31 panel in v2

  .../devicetree/bindings/display/panel/sharp,lq123p1jx31.txt| 7 +++
  1 file changed, 7 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt 
b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
new file mode 100644
index 000..81938c0
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt
@@ -0,0 +1,7 @@
+Sharp 12.3" (2400x1600 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "sharp,lq123p1jx31,"

  ^
Need to drop the comma.

Thanks for catching!


Done,




No regulators or resets or pwms?

Could be more explicit I guess, but Yakir does say:


This binding is compatible with the simple-panel binding, which is specified
in simple-panel.txt in this directory.

In that document it shows:

Required properties:
- power-supply: regulator to provide the supply voltage

Optional properties:
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
- enable-gpios: GPIO pin to enable or disable the panel
- backlight: phandle of the backlight device attached to the panel


In general Yakir's bindings document match a huge chunk of the current
existing bindings.  Do this:
   cd Documentation/devicetree/bindings/display/panel
   grep -C20 "This binding is compatible with the simple-panel" *

You'll find a huge chunk of files which are rather formulaic.  It
might make sense to just have one file and a list of panels which are
simple panels?


-Doug








Re: [PATCH 2/2] acpi/pmic: Add opregion driver for Intel BXT WhiskeyCove PMIC

2016-06-11 Thread Aaron Lu
On 06/11/2016 03:25 PM, Bin Gao wrote:
> This patch adds operation region driver for Intel BXT WhiskeyCove
> PMIC. The register mapping is done as per the BXT WC data sheet.
> 
> Signed-off-by: Ajay Thomas 
> Signed-off-by: Bin Gao 
> ---
> +static int __init intel_bxtwc_pmic_opregion_driver_init(void)
> +{
> + return platform_driver_register(_bxtwc_pmic_opregion_driver);
> +}
> +
> +module_init(intel_bxtwc_pmic_opregion_driver_init);

Last time Paul suggests device_initcall instead of module_init here:

commit 75829dcf10862966f52716f2d67ac1c1b1eb486b
Author: Paul Gortmaker 
Date:   Mon Feb 15 00:27:51 2016 -0500

drivers/acpi: make pmic/intel_pmic_crc.c explicitly non-modular

Perhaps you should do the same.

Thanks,
Aaron

> +
> +MODULE_DESCRIPTION("BXT WhiskeyCove ACPI opregion driver");
> +MODULE_LICENSE("GPL");
> 



Re: [PATCH 2/2] acpi/pmic: Add opregion driver for Intel BXT WhiskeyCove PMIC

2016-06-11 Thread Aaron Lu
On 06/11/2016 03:25 PM, Bin Gao wrote:
> This patch adds operation region driver for Intel BXT WhiskeyCove
> PMIC. The register mapping is done as per the BXT WC data sheet.
> 
> Signed-off-by: Ajay Thomas 
> Signed-off-by: Bin Gao 
> ---
> +static int __init intel_bxtwc_pmic_opregion_driver_init(void)
> +{
> + return platform_driver_register(_bxtwc_pmic_opregion_driver);
> +}
> +
> +module_init(intel_bxtwc_pmic_opregion_driver_init);

Last time Paul suggests device_initcall instead of module_init here:

commit 75829dcf10862966f52716f2d67ac1c1b1eb486b
Author: Paul Gortmaker 
Date:   Mon Feb 15 00:27:51 2016 -0500

drivers/acpi: make pmic/intel_pmic_crc.c explicitly non-modular

Perhaps you should do the same.

Thanks,
Aaron

> +
> +MODULE_DESCRIPTION("BXT WhiskeyCove ACPI opregion driver");
> +MODULE_LICENSE("GPL");
> 



Re: [PATCH v2 6/6] drm/panel: simple: Add support for Sharp LQ123P1JX31 2400x1600 panel

2016-06-11 Thread Yakir Yang

Doug,

On 06/11/2016 12:11 AM, Doug Anderson wrote:

Hi,

On Wed, Jun 8, 2016 at 9:35 AM, Doug Anderson  wrote:

Yakir,

On Wed, Jun 8, 2016 at 4:52 AM, Yakir Yang  wrote:

The Sharp LQ123P1JX31 is an 12.3", 2400x1600 TFT-LCD panel connected
using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2:
- Add detail timing of Sharp LQ123P1JX31 panel in v2

  drivers/gpu/drm/panel/panel-simple.c | 26 ++
  1 file changed, 26 insertions(+)

Looks good to me.  Values in the table match the EDID I see from this
panel and everything else looks to be in order.

Reviewed-by: Doug Anderson 
Tested-by: Doug Anderson 

Sorry for not noticing.  :(  ...but as others have pointed out for
your earlier patches, the size is incorrect.  I found the correct size
and it should be:

.width = 259,
.height = 173,



Ah, thanks, would correct it now :-D

- Yakir


-Doug








Re: [PATCH v2 6/6] drm/panel: simple: Add support for Sharp LQ123P1JX31 2400x1600 panel

2016-06-11 Thread Yakir Yang

Doug,

On 06/11/2016 12:11 AM, Doug Anderson wrote:

Hi,

On Wed, Jun 8, 2016 at 9:35 AM, Doug Anderson  wrote:

Yakir,

On Wed, Jun 8, 2016 at 4:52 AM, Yakir Yang  wrote:

The Sharp LQ123P1JX31 is an 12.3", 2400x1600 TFT-LCD panel connected
using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2:
- Add detail timing of Sharp LQ123P1JX31 panel in v2

  drivers/gpu/drm/panel/panel-simple.c | 26 ++
  1 file changed, 26 insertions(+)

Looks good to me.  Values in the table match the EDID I see from this
panel and everything else looks to be in order.

Reviewed-by: Doug Anderson 
Tested-by: Doug Anderson 

Sorry for not noticing.  :(  ...but as others have pointed out for
your earlier patches, the size is incorrect.  I found the correct size
and it should be:

.width = 259,
.height = 173,



Ah, thanks, would correct it now :-D

- Yakir


-Doug








Re: [PATCH] libnvdimm, nfit: treat volatile virtual CD region as read-only pmem

2016-06-11 Thread joeyli
On Thu, Jun 09, 2016 at 03:34:52PM -0700, Dan Williams wrote:
> On Thu, Jun 9, 2016 at 3:08 PM, Linda Knippers  wrote:
> > On 6/4/2016 7:01 AM, joeyli wrote:
> >> Hi Dan,
> >>
> >> Thanks for your review.
> >>
> >> On Fri, Jun 03, 2016 at 12:27:34PM -0700, Dan Williams wrote:
> >>> On Fri, Jun 3, 2016 at 12:13 AM, Lee, Chun-Yi  
> >>> wrote:
>  This patch adds codes to treat a volatile virtual CD region as a
>  read-only pmem region, then read-only /dev/pmem* device can be mounted
>  with iso9660.
> 
>  It's useful to work with the httpboot in EFI firmware to pull a remote
>  ISO file to the local memory region for booting and installation.
> 
>  Wiki page of UEFI HTTPBoot with OVMF:
>  https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF
> 
>  Signed-off-by: Lee, Chun-Yi 
>  Cc: Gary Lin 
>  Cc: Dan Williams 
>  Cc: Ross Zwisler 
>  Cc: "Rafael J. Wysocki" 
>  ---
>   drivers/acpi/nfit.c  |  8 +++-
>   drivers/nvdimm/region_devs.c | 26 +-
>   include/linux/libnvdimm.h|  2 ++
>   3 files changed, 34 insertions(+), 2 deletions(-)
> 
>  diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
>  index 2215fc8..b100a17 100644
>  --- a/drivers/acpi/nfit.c
>  +++ b/drivers/acpi/nfit.c
>  @@ -1949,6 +1949,7 @@ static int acpi_nfit_init_mapping(struct 
>  acpi_nfit_desc *acpi_desc,
>  switch (nfit_spa_type(spa)) {
>  case NFIT_SPA_PM:
>  case NFIT_SPA_VOLATILE:
>  +   case NFIT_SPA_VCD:
>  nd_mapping->start = memdev->address;
>  nd_mapping->size = memdev->region_size;
>  break;
> >>>
> >>> Why do we need to distinguish NFIT_SPA_VOLATILE vs NFIT_SPA_VCD, i.e.
> >>> what happens if something writes to a VCD device?
> >>
> >> Actually I didn't try to write SPA-VCD device before. Every time I mount it
> >> that the system responses read-only:
> >>
> >> # mount /dev/pmem0 /mnt/
> >> mount: /dev/pmem0 is write-protected, mounting read-only
> >>
> >> If it can be written, then I think there have no difference between
> >> NFIT_SPA_VOLATILE with NFIT_SPA_VCD region.
> >
> > It's not clear to me what the expectations for this type of device are, or
> > whether they should be read-only.  The ACPI spec is not helpful here.
> > The other Disk Region and CD Region types are also unclear.  Anyone
> > care to define them?
> >
> >> I implemented this patch to treat VCD region as read-only pmem because the
> >> pmem region generates /dev/pmem* device that it can be mounted.
> >
> > I'm a bit worried about this type of device showing up as a "pmem" device.
> > I realize they're described in the NFIT (not sure why but they are) but do
> > any of the operations that we support for other pmem devices work on these?
> 
> It would be just another pmem device, so it would support all of them.
> 
> > Do root device DSMs make any sense?
> 
> Root device DSMs take a physical address so they could apply, but I
> assume a firmware could simply refuse to run any operations against
> them.
> 

Yes, I pasted the ACPI0012 root device in another mail that it doesn't
have _DSM method.

> > Are there other DSMs?
> 
> Not that I can think of...
> 
> > What will happen if someone uses ndctl to reconfigure the device?
> 
> It won't know or care about the difference.  Unless there's a negative
> side effect of allowing writes to a "volatile cd" it would be yet
> another pmem device.
>

I didn't try to using ndctl because the ACPI device doesn't have _DSM method.
 
> > I'm especially concerned on systems that might have one of these devices
> > and also have NVDIMMs.  Do all the pmem devices get numbered different if
> > this device comes and goes across reboots?  (I know, we shouldn't rely on
> > those names but it will still confuse people.)  Can they be some other name
> > that better represents what they're trying to be?
> 
> If they all go through the same driver they should have the same
> naming scheme.  Software should be identifying the block device via
> blkid, not kernel device name.

Honestly I didn't have machine to test this function with a real NVDIMM memory.

This function may also applies to the machines that do not have NVDIMM memory
but it provides httpboot function with ISO file for booting or installation. So
it only generates a ACPI0012 root device and a simple NFIT that it only contains
one SPA range structure.

If we don't want to treat VCD type as PMEM device (I will removed the read-only
parts in patch), then I think that we need another NVDIMM driver to generate
block device for VCD type.


Thanks a lot!
Joey Lee


Re: [PATCH] libnvdimm, nfit: treat volatile virtual CD region as read-only pmem

2016-06-11 Thread joeyli
On Thu, Jun 09, 2016 at 03:34:52PM -0700, Dan Williams wrote:
> On Thu, Jun 9, 2016 at 3:08 PM, Linda Knippers  wrote:
> > On 6/4/2016 7:01 AM, joeyli wrote:
> >> Hi Dan,
> >>
> >> Thanks for your review.
> >>
> >> On Fri, Jun 03, 2016 at 12:27:34PM -0700, Dan Williams wrote:
> >>> On Fri, Jun 3, 2016 at 12:13 AM, Lee, Chun-Yi  
> >>> wrote:
>  This patch adds codes to treat a volatile virtual CD region as a
>  read-only pmem region, then read-only /dev/pmem* device can be mounted
>  with iso9660.
> 
>  It's useful to work with the httpboot in EFI firmware to pull a remote
>  ISO file to the local memory region for booting and installation.
> 
>  Wiki page of UEFI HTTPBoot with OVMF:
>  https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF
> 
>  Signed-off-by: Lee, Chun-Yi 
>  Cc: Gary Lin 
>  Cc: Dan Williams 
>  Cc: Ross Zwisler 
>  Cc: "Rafael J. Wysocki" 
>  ---
>   drivers/acpi/nfit.c  |  8 +++-
>   drivers/nvdimm/region_devs.c | 26 +-
>   include/linux/libnvdimm.h|  2 ++
>   3 files changed, 34 insertions(+), 2 deletions(-)
> 
>  diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
>  index 2215fc8..b100a17 100644
>  --- a/drivers/acpi/nfit.c
>  +++ b/drivers/acpi/nfit.c
>  @@ -1949,6 +1949,7 @@ static int acpi_nfit_init_mapping(struct 
>  acpi_nfit_desc *acpi_desc,
>  switch (nfit_spa_type(spa)) {
>  case NFIT_SPA_PM:
>  case NFIT_SPA_VOLATILE:
>  +   case NFIT_SPA_VCD:
>  nd_mapping->start = memdev->address;
>  nd_mapping->size = memdev->region_size;
>  break;
> >>>
> >>> Why do we need to distinguish NFIT_SPA_VOLATILE vs NFIT_SPA_VCD, i.e.
> >>> what happens if something writes to a VCD device?
> >>
> >> Actually I didn't try to write SPA-VCD device before. Every time I mount it
> >> that the system responses read-only:
> >>
> >> # mount /dev/pmem0 /mnt/
> >> mount: /dev/pmem0 is write-protected, mounting read-only
> >>
> >> If it can be written, then I think there have no difference between
> >> NFIT_SPA_VOLATILE with NFIT_SPA_VCD region.
> >
> > It's not clear to me what the expectations for this type of device are, or
> > whether they should be read-only.  The ACPI spec is not helpful here.
> > The other Disk Region and CD Region types are also unclear.  Anyone
> > care to define them?
> >
> >> I implemented this patch to treat VCD region as read-only pmem because the
> >> pmem region generates /dev/pmem* device that it can be mounted.
> >
> > I'm a bit worried about this type of device showing up as a "pmem" device.
> > I realize they're described in the NFIT (not sure why but they are) but do
> > any of the operations that we support for other pmem devices work on these?
> 
> It would be just another pmem device, so it would support all of them.
> 
> > Do root device DSMs make any sense?
> 
> Root device DSMs take a physical address so they could apply, but I
> assume a firmware could simply refuse to run any operations against
> them.
> 

Yes, I pasted the ACPI0012 root device in another mail that it doesn't
have _DSM method.

> > Are there other DSMs?
> 
> Not that I can think of...
> 
> > What will happen if someone uses ndctl to reconfigure the device?
> 
> It won't know or care about the difference.  Unless there's a negative
> side effect of allowing writes to a "volatile cd" it would be yet
> another pmem device.
>

I didn't try to using ndctl because the ACPI device doesn't have _DSM method.
 
> > I'm especially concerned on systems that might have one of these devices
> > and also have NVDIMMs.  Do all the pmem devices get numbered different if
> > this device comes and goes across reboots?  (I know, we shouldn't rely on
> > those names but it will still confuse people.)  Can they be some other name
> > that better represents what they're trying to be?
> 
> If they all go through the same driver they should have the same
> naming scheme.  Software should be identifying the block device via
> blkid, not kernel device name.

Honestly I didn't have machine to test this function with a real NVDIMM memory.

This function may also applies to the machines that do not have NVDIMM memory
but it provides httpboot function with ISO file for booting or installation. So
it only generates a ACPI0012 root device and a simple NFIT that it only contains
one SPA range structure.

If we don't want to treat VCD type as PMEM device (I will removed the read-only
parts in patch), then I think that we need another NVDIMM driver to generate
block device for VCD type.


Thanks a lot!
Joey Lee


Re: [PATCH v2 2/6] drm/panel: simple: Add support for LG LP097QX1-SPA1 2048x1536 panel

2016-06-11 Thread Yakir Yang

Emil,

On 06/08/2016 08:20 PM, Emil Velikov wrote:

Hi Yakir,

On 8 June 2016 at 12:52, Yakir Yang  wrote:

The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2: None

  drivers/gpu/drm/panel/panel-simple.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 3a7bdf1..41020e1 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1040,6 +1040,28 @@ static const struct panel_desc lg_lp120up1 = {
 },
  };

+static const struct drm_display_mode lg_lp097qx1_spa1_mode = {

I believe that lg_lp097qx1_spa1 should be moved/sorted before lg_lp120up1.


Ah, yes, done  :)


+static const struct panel_desc lg_lp097qx1_spa1 = {
+   .modes = _lp097qx1_spa1_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 2048,
+   .height = 1536,

These are the physical dimensions of the panel. From the documentation
(at the top of the file)

@width: width (in millimeters) of the panel's active display area
...


Got it, this should be the "display area"
Display area 262.656(H) X 164.16(V) (12.2”diagonal)

Thanks,
- Yakir



Thierry, perhaps it's worth renaming 'size' it to
"physical_{size,dimensions}" and/or alike to make it clearer ?
Looks like we have a few cases were people got confused -
innolux_zj070na_01p and samsung_ltn101nt05.

Regards,
Emil








Re: [PATCH v2 2/6] drm/panel: simple: Add support for LG LP097QX1-SPA1 2048x1536 panel

2016-06-11 Thread Yakir Yang

Emil,

On 06/08/2016 08:20 PM, Emil Velikov wrote:

Hi Yakir,

On 8 June 2016 at 12:52, Yakir Yang  wrote:

The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2: None

  drivers/gpu/drm/panel/panel-simple.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 3a7bdf1..41020e1 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1040,6 +1040,28 @@ static const struct panel_desc lg_lp120up1 = {
 },
  };

+static const struct drm_display_mode lg_lp097qx1_spa1_mode = {

I believe that lg_lp097qx1_spa1 should be moved/sorted before lg_lp120up1.


Ah, yes, done  :)


+static const struct panel_desc lg_lp097qx1_spa1 = {
+   .modes = _lp097qx1_spa1_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 2048,
+   .height = 1536,

These are the physical dimensions of the panel. From the documentation
(at the top of the file)

@width: width (in millimeters) of the panel's active display area
...


Got it, this should be the "display area"
Display area 262.656(H) X 164.16(V) (12.2”diagonal)

Thanks,
- Yakir



Thierry, perhaps it's worth renaming 'size' it to
"physical_{size,dimensions}" and/or alike to make it clearer ?
Looks like we have a few cases were people got confused -
innolux_zj070na_01p and samsung_ltn101nt05.

Regards,
Emil








Re: [PATCH 1/2] acpi/pmic: modify the pen function signature to take bit field

2016-06-11 Thread Aaron Lu
On 06/11/2016 03:22 PM, Bin Gao wrote:
> Issue description: On some pmics, the policy enable for thermal alerts
> refers to different bit fields of the same registers, whereas on other
> pmics, the policy enable refers to the same bit field on different
> registers. Previous implementation did not provide the flexibility for
> supporting the first approach.
> 
> Solution: Modified the policy enable function to take bit field as well.
> The use of bit field is left to the pmic specific opregion driver.
> 
> Signed-off-by: Yegnesh Iyer 
> Signed-off-by: Bin Gao 

Acked-by: Aaron Lu 

Thanks,
Aaron

> ---
>  drivers/acpi/pmic/intel_pmic.c | 13 +++--
>  drivers/acpi/pmic/intel_pmic.h |  4 ++--
>  drivers/acpi/pmic/intel_pmic_crc.c |  5 +++--
>  3 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
> index bd772cd..410e96f 100644
> --- a/drivers/acpi/pmic/intel_pmic.c
> +++ b/drivers/acpi/pmic/intel_pmic.c
> @@ -131,7 +131,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion 
> *opregion, int reg,
>  }
>  
>  static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg,
> - u32 function, u64 *value)
> + int bit, u32 function, u64 *value)
>  {
>   struct intel_pmic_opregion_data *d = opregion->data;
>   struct regmap *regmap = opregion->regmap;
> @@ -140,12 +140,12 @@ static int pmic_thermal_pen(struct intel_pmic_opregion 
> *opregion, int reg,
>   return -ENXIO;
>  
>   if (function == ACPI_READ)
> - return d->get_policy(regmap, reg, value);
> + return d->get_policy(regmap, reg, bit, value);
>  
>   if (*value != 0 && *value != 1)
>   return -EINVAL;
>  
> - return d->update_policy(regmap, reg, *value);
> + return d->update_policy(regmap, reg, bit, *value);
>  }
>  
>  static bool pmic_thermal_is_temp(int address)
> @@ -170,13 +170,13 @@ static acpi_status intel_pmic_thermal_handler(u32 
> function,
>  {
>   struct intel_pmic_opregion *opregion = region_context;
>   struct intel_pmic_opregion_data *d = opregion->data;
> - int reg, result;
> + int reg, bit, result;
>  
>   if (bits != 32 || !value64)
>   return AE_BAD_PARAMETER;
>  
>   result = pmic_get_reg_bit(address, d->thermal_table,
> -   d->thermal_table_count, , NULL);
> +   d->thermal_table_count, , );
>   if (result == -ENOENT)
>   return AE_BAD_PARAMETER;
>  
> @@ -187,7 +187,8 @@ static acpi_status intel_pmic_thermal_handler(u32 
> function,
>   else if (pmic_thermal_is_aux(address))
>   result = pmic_thermal_aux(opregion, reg, function, value64);
>   else if (pmic_thermal_is_pen(address))
> - result = pmic_thermal_pen(opregion, reg, function, value64);
> + result = pmic_thermal_pen(opregion, reg, bit,
> + function, value64);
>   else
>   result = -EINVAL;
>  
> diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h
> index d4e90af..e8bfa7b 100644
> --- a/drivers/acpi/pmic/intel_pmic.h
> +++ b/drivers/acpi/pmic/intel_pmic.h
> @@ -12,8 +12,8 @@ struct intel_pmic_opregion_data {
>   int (*update_power)(struct regmap *r, int reg, int bit, bool on);
>   int (*get_raw_temp)(struct regmap *r, int reg);
>   int (*update_aux)(struct regmap *r, int reg, int raw_temp);
> - int (*get_policy)(struct regmap *r, int reg, u64 *value);
> - int (*update_policy)(struct regmap *r, int reg, int enable);
> + int (*get_policy)(struct regmap *r, int reg, int bit, u64 *value);
> + int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
>   struct pmic_table *power_table;
>   int power_table_count;
>   struct pmic_table *thermal_table;
> diff --git a/drivers/acpi/pmic/intel_pmic_crc.c 
> b/drivers/acpi/pmic/intel_pmic_crc.c
> index fcd1852..d7f1761 100644
> --- a/drivers/acpi/pmic/intel_pmic_crc.c
> +++ b/drivers/acpi/pmic/intel_pmic_crc.c
> @@ -141,7 +141,8 @@ static int intel_crc_pmic_update_aux(struct regmap 
> *regmap, int reg, int raw)
>   regmap_update_bits(regmap, reg - 1, 0x3, raw >> 8) ? -EIO : 0;
>  }
>  
> -static int intel_crc_pmic_get_policy(struct regmap *regmap, int reg, u64 
> *value)
> +static int intel_crc_pmic_get_policy(struct regmap *regmap,
> + int reg, int bit, u64 *value)
>  {
>   int pen;
>  
> @@ -152,7 +153,7 @@ static int intel_crc_pmic_get_policy(struct regmap 
> *regmap, int reg, u64 *value)
>  }
>  
>  static int intel_crc_pmic_update_policy(struct regmap *regmap,
> - int reg, int enable)
> + int reg, int bit, int enable)
>  {
>   int 

Re: [PATCH 1/2] acpi/pmic: modify the pen function signature to take bit field

2016-06-11 Thread Aaron Lu
On 06/11/2016 03:22 PM, Bin Gao wrote:
> Issue description: On some pmics, the policy enable for thermal alerts
> refers to different bit fields of the same registers, whereas on other
> pmics, the policy enable refers to the same bit field on different
> registers. Previous implementation did not provide the flexibility for
> supporting the first approach.
> 
> Solution: Modified the policy enable function to take bit field as well.
> The use of bit field is left to the pmic specific opregion driver.
> 
> Signed-off-by: Yegnesh Iyer 
> Signed-off-by: Bin Gao 

Acked-by: Aaron Lu 

Thanks,
Aaron

> ---
>  drivers/acpi/pmic/intel_pmic.c | 13 +++--
>  drivers/acpi/pmic/intel_pmic.h |  4 ++--
>  drivers/acpi/pmic/intel_pmic_crc.c |  5 +++--
>  3 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
> index bd772cd..410e96f 100644
> --- a/drivers/acpi/pmic/intel_pmic.c
> +++ b/drivers/acpi/pmic/intel_pmic.c
> @@ -131,7 +131,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion 
> *opregion, int reg,
>  }
>  
>  static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg,
> - u32 function, u64 *value)
> + int bit, u32 function, u64 *value)
>  {
>   struct intel_pmic_opregion_data *d = opregion->data;
>   struct regmap *regmap = opregion->regmap;
> @@ -140,12 +140,12 @@ static int pmic_thermal_pen(struct intel_pmic_opregion 
> *opregion, int reg,
>   return -ENXIO;
>  
>   if (function == ACPI_READ)
> - return d->get_policy(regmap, reg, value);
> + return d->get_policy(regmap, reg, bit, value);
>  
>   if (*value != 0 && *value != 1)
>   return -EINVAL;
>  
> - return d->update_policy(regmap, reg, *value);
> + return d->update_policy(regmap, reg, bit, *value);
>  }
>  
>  static bool pmic_thermal_is_temp(int address)
> @@ -170,13 +170,13 @@ static acpi_status intel_pmic_thermal_handler(u32 
> function,
>  {
>   struct intel_pmic_opregion *opregion = region_context;
>   struct intel_pmic_opregion_data *d = opregion->data;
> - int reg, result;
> + int reg, bit, result;
>  
>   if (bits != 32 || !value64)
>   return AE_BAD_PARAMETER;
>  
>   result = pmic_get_reg_bit(address, d->thermal_table,
> -   d->thermal_table_count, , NULL);
> +   d->thermal_table_count, , );
>   if (result == -ENOENT)
>   return AE_BAD_PARAMETER;
>  
> @@ -187,7 +187,8 @@ static acpi_status intel_pmic_thermal_handler(u32 
> function,
>   else if (pmic_thermal_is_aux(address))
>   result = pmic_thermal_aux(opregion, reg, function, value64);
>   else if (pmic_thermal_is_pen(address))
> - result = pmic_thermal_pen(opregion, reg, function, value64);
> + result = pmic_thermal_pen(opregion, reg, bit,
> + function, value64);
>   else
>   result = -EINVAL;
>  
> diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h
> index d4e90af..e8bfa7b 100644
> --- a/drivers/acpi/pmic/intel_pmic.h
> +++ b/drivers/acpi/pmic/intel_pmic.h
> @@ -12,8 +12,8 @@ struct intel_pmic_opregion_data {
>   int (*update_power)(struct regmap *r, int reg, int bit, bool on);
>   int (*get_raw_temp)(struct regmap *r, int reg);
>   int (*update_aux)(struct regmap *r, int reg, int raw_temp);
> - int (*get_policy)(struct regmap *r, int reg, u64 *value);
> - int (*update_policy)(struct regmap *r, int reg, int enable);
> + int (*get_policy)(struct regmap *r, int reg, int bit, u64 *value);
> + int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
>   struct pmic_table *power_table;
>   int power_table_count;
>   struct pmic_table *thermal_table;
> diff --git a/drivers/acpi/pmic/intel_pmic_crc.c 
> b/drivers/acpi/pmic/intel_pmic_crc.c
> index fcd1852..d7f1761 100644
> --- a/drivers/acpi/pmic/intel_pmic_crc.c
> +++ b/drivers/acpi/pmic/intel_pmic_crc.c
> @@ -141,7 +141,8 @@ static int intel_crc_pmic_update_aux(struct regmap 
> *regmap, int reg, int raw)
>   regmap_update_bits(regmap, reg - 1, 0x3, raw >> 8) ? -EIO : 0;
>  }
>  
> -static int intel_crc_pmic_get_policy(struct regmap *regmap, int reg, u64 
> *value)
> +static int intel_crc_pmic_get_policy(struct regmap *regmap,
> + int reg, int bit, u64 *value)
>  {
>   int pen;
>  
> @@ -152,7 +153,7 @@ static int intel_crc_pmic_get_policy(struct regmap 
> *regmap, int reg, u64 *value)
>  }
>  
>  static int intel_crc_pmic_update_policy(struct regmap *regmap,
> - int reg, int enable)
> + int reg, int bit, int enable)
>  {
>   int alert0;
>  
> 



Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file

2016-06-11 Thread Oleg Drokin

On Jun 11, 2016, at 9:33 PM, Jeff Layton wrote:

> On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote:
>> On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote:
>> 
>>> On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote:
 On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote:
> On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote:
> 
>> Currently there's an unprotected access mode check in
>> nfs4_upgrade_open
>> that then calls nfs4_get_vfs_file which in turn assumes whatever
>> access mode was present in the state is still valid which is racy.
>> Two nfs4_get_vfs_file van enter the same path as result and get two
>> references to nfs4_file, but later drop would only happens once
>> because
>> access mode is only denoted by bits, so no refcounting.
>> 
>> The locking around access mode testing is introduced to avoid this
>> race.
>> 
>> Signed-off-by: Oleg Drokin 
>> ---
>> 
>> This patch performs equally well to the st_rwsem -> mutex
>> conversion,
>> but is a bit ligher-weight I imagine.
>> For one it seems to allow truncates in parallel if we ever want it.
>> 
>> fs/nfsd/nfs4state.c | 28 +---
>> 1 file changed, 25 insertions(+), 3 deletions(-)
>> 
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index f5f82e1..d4b9eba 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct
>> svc_rqst *rqstp, struct nfs4_file *fp,
>> 
>>  spin_lock(>fi_lock);
>> 
>> +if (test_access(open->op_share_access, stp)) {
>> +spin_unlock(>fi_lock);
>> +return nfserr_eagain;
>> +}
>> +
>>  /*
>>   * Are we trying to set a deny mode that would conflict with
>>   * current access?
>> @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp,
>> struct nfs4_file *fp, struct svc_fh *c
>>  __be32 status;
>>  unsigned char old_deny_bmap = stp->st_deny_bmap;
>> 
>> -if (!test_access(open->op_share_access, stp))
>> -return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
>> open);
>> +again:
>> +spin_lock(>fi_lock);
>> +if (!test_access(open->op_share_access, stp)) {
>> +spin_unlock(>fi_lock);
>> +status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
>> open);
>> +/*
>> + * Somebody won the race for access while we did
>> not hold
>> + * the lock here
>> + */
>> +if (status == nfserr_eagain)
>> +goto again;
>> +return status;
>> +}
>> 
>>  /* test and set deny mode */
>> -spin_lock(>fi_lock);
>>  status = nfs4_file_check_deny(fp, open->op_share_deny);
>>  if (status == nfs_ok) {
>>  set_deny(open->op_share_deny, stp);
>> @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp,
>> struct svc_fh *current_fh, struct nf
>>  status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp,
>> open);
>>  if (status) {
>>  up_read(>st_rwsem);
>> +/*
>> + * EAGAIN is returned when there's a
>> racing access,
>> + * this should never happen as we are the
>> only user
>> + * of this new state, and since it's not
>> yet hashed,
>> + * nobody can find it
>> + */
>> +WARN_ON(status == nfserr_eagain);
> 
> Ok, some more testing shows that this CAN happen.
> So this patch is inferior to the mutex one after all.
> 
 
 Yeah, that can happen for all sorts of reasons. As Andrew pointed out,
 you can get this when there is a lease break in progress, and that may
 be occurring for a completely different stateid (or because of samba,
 etc...)
 
 It may be possible to do something like this, but we'd need to audit
 all of the handling of st_access_bmap (and the deny bmap) to ensure
 that we get it right.
 
 For now, I think just turning that rwsem into a mutex is the best
 solution. That is a per-stateid mutex so any contention is going to be
 due to the client sending racing OPEN calls for the same inode anyway.
 Allowing those to run in parallel again could be useful in some cases,
 but most use-cases won't be harmed by that serialization.
>>> 
>>> OK, so for now my plan is to take "nfsd: Always lock state exclusively"
>>> for 4.7.  Thanks to both of you for your work on this….
>> 
>> 
>> FYI, I just hit this again with the "Always lock state 

Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file

2016-06-11 Thread Oleg Drokin

On Jun 11, 2016, at 9:33 PM, Jeff Layton wrote:

> On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote:
>> On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote:
>> 
>>> On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote:
 On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote:
> On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote:
> 
>> Currently there's an unprotected access mode check in
>> nfs4_upgrade_open
>> that then calls nfs4_get_vfs_file which in turn assumes whatever
>> access mode was present in the state is still valid which is racy.
>> Two nfs4_get_vfs_file van enter the same path as result and get two
>> references to nfs4_file, but later drop would only happens once
>> because
>> access mode is only denoted by bits, so no refcounting.
>> 
>> The locking around access mode testing is introduced to avoid this
>> race.
>> 
>> Signed-off-by: Oleg Drokin 
>> ---
>> 
>> This patch performs equally well to the st_rwsem -> mutex
>> conversion,
>> but is a bit ligher-weight I imagine.
>> For one it seems to allow truncates in parallel if we ever want it.
>> 
>> fs/nfsd/nfs4state.c | 28 +---
>> 1 file changed, 25 insertions(+), 3 deletions(-)
>> 
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index f5f82e1..d4b9eba 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct
>> svc_rqst *rqstp, struct nfs4_file *fp,
>> 
>>  spin_lock(>fi_lock);
>> 
>> +if (test_access(open->op_share_access, stp)) {
>> +spin_unlock(>fi_lock);
>> +return nfserr_eagain;
>> +}
>> +
>>  /*
>>   * Are we trying to set a deny mode that would conflict with
>>   * current access?
>> @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp,
>> struct nfs4_file *fp, struct svc_fh *c
>>  __be32 status;
>>  unsigned char old_deny_bmap = stp->st_deny_bmap;
>> 
>> -if (!test_access(open->op_share_access, stp))
>> -return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
>> open);
>> +again:
>> +spin_lock(>fi_lock);
>> +if (!test_access(open->op_share_access, stp)) {
>> +spin_unlock(>fi_lock);
>> +status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp,
>> open);
>> +/*
>> + * Somebody won the race for access while we did
>> not hold
>> + * the lock here
>> + */
>> +if (status == nfserr_eagain)
>> +goto again;
>> +return status;
>> +}
>> 
>>  /* test and set deny mode */
>> -spin_lock(>fi_lock);
>>  status = nfs4_file_check_deny(fp, open->op_share_deny);
>>  if (status == nfs_ok) {
>>  set_deny(open->op_share_deny, stp);
>> @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp,
>> struct svc_fh *current_fh, struct nf
>>  status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp,
>> open);
>>  if (status) {
>>  up_read(>st_rwsem);
>> +/*
>> + * EAGAIN is returned when there's a
>> racing access,
>> + * this should never happen as we are the
>> only user
>> + * of this new state, and since it's not
>> yet hashed,
>> + * nobody can find it
>> + */
>> +WARN_ON(status == nfserr_eagain);
> 
> Ok, some more testing shows that this CAN happen.
> So this patch is inferior to the mutex one after all.
> 
 
 Yeah, that can happen for all sorts of reasons. As Andrew pointed out,
 you can get this when there is a lease break in progress, and that may
 be occurring for a completely different stateid (or because of samba,
 etc...)
 
 It may be possible to do something like this, but we'd need to audit
 all of the handling of st_access_bmap (and the deny bmap) to ensure
 that we get it right.
 
 For now, I think just turning that rwsem into a mutex is the best
 solution. That is a per-stateid mutex so any contention is going to be
 due to the client sending racing OPEN calls for the same inode anyway.
 Allowing those to run in parallel again could be useful in some cases,
 but most use-cases won't be harmed by that serialization.
>>> 
>>> OK, so for now my plan is to take "nfsd: Always lock state exclusively"
>>> for 4.7.  Thanks to both of you for your work on this….
>> 
>> 
>> FYI, I just hit this again with the "Always lock state exclusively" patch 
>> too.
>> I 

Re: [PATCH v2 4/6] drm/panel: simple: Add support for Samsung LSN122DL01-C01 2560x1600 panel

2016-06-11 Thread Yakir Yang

Stéphane,

On 06/10/2016 08:04 AM, Stéphane Marchesin wrote:

On Wed, Jun 8, 2016 at 4:52 AM, Yakir Yang  wrote:

The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2: None

  drivers/gpu/drm/panel/panel-simple.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 41020e1..067a5c4 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1246,6 +1246,28 @@ static const struct panel_desc qd43003c0_40 = {
 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  };

+static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
+   .clock = 271560,
+   .hdisplay = 2560,
+   .hsync_start = 2560 + 48,
+   .hsync_end = 2560 + 48 + 32,
+   .htotal = 2560 + 48 + 32 + 80,
+   .vdisplay = 1600,
+   .vsync_start = 1600 + 2,
+   .vsync_end = 1600 + 2 + 5,
+   .vtotal = 1600 + 2 + 5 + 57,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc samsung_lsn122dl01_c01 = {
+   .modes = _lsn122dl01_c01_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 2560,
+   .height = 1600,

These are meant to be the physical dimensions (same thing for the
other patches btw).


Got it, so this should be the "active area" in panel book.
Display area 262.656(H) X 164.16(V) (12.2”diagonal)


Thanks,
-Yakir


Stéphane


+   },
+};
+
  static const struct drm_display_mode samsung_ltn101nt05_mode = {
 .clock = 54030,
 .hdisplay = 1024,
@@ -1506,6 +1528,9 @@ static const struct of_device_id platform_of_match[] = {
 .compatible = "qiaodian,qd43003c0-40",
 .data = _40,
 }, {
+   .compatible = "samsung,lsn122dl01-c01",
+   .data = _lsn122dl01_c01,
+   }, {
 .compatible = "samsung,ltn101nt05",
 .data = _ltn101nt05,
 }, {
--
1.9.1


___
dri-devel mailing list
dri-de...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel








Re: [PATCH v2 4/6] drm/panel: simple: Add support for Samsung LSN122DL01-C01 2560x1600 panel

2016-06-11 Thread Yakir Yang

Stéphane,

On 06/10/2016 08:04 AM, Stéphane Marchesin wrote:

On Wed, Jun 8, 2016 at 4:52 AM, Yakir Yang  wrote:

The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel
connected using eDP interfaces.

Signed-off-by: Yakir Yang 
---
Changes in v2: None

  drivers/gpu/drm/panel/panel-simple.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 41020e1..067a5c4 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1246,6 +1246,28 @@ static const struct panel_desc qd43003c0_40 = {
 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  };

+static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
+   .clock = 271560,
+   .hdisplay = 2560,
+   .hsync_start = 2560 + 48,
+   .hsync_end = 2560 + 48 + 32,
+   .htotal = 2560 + 48 + 32 + 80,
+   .vdisplay = 1600,
+   .vsync_start = 1600 + 2,
+   .vsync_end = 1600 + 2 + 5,
+   .vtotal = 1600 + 2 + 5 + 57,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc samsung_lsn122dl01_c01 = {
+   .modes = _lsn122dl01_c01_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 2560,
+   .height = 1600,

These are meant to be the physical dimensions (same thing for the
other patches btw).


Got it, so this should be the "active area" in panel book.
Display area 262.656(H) X 164.16(V) (12.2”diagonal)


Thanks,
-Yakir


Stéphane


+   },
+};
+
  static const struct drm_display_mode samsung_ltn101nt05_mode = {
 .clock = 54030,
 .hdisplay = 1024,
@@ -1506,6 +1528,9 @@ static const struct of_device_id platform_of_match[] = {
 .compatible = "qiaodian,qd43003c0-40",
 .data = _40,
 }, {
+   .compatible = "samsung,lsn122dl01-c01",
+   .data = _lsn122dl01_c01,
+   }, {
 .compatible = "samsung,ltn101nt05",
 .data = _ltn101nt05,
 }, {
--
1.9.1


___
dri-devel mailing list
dri-de...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel








Re: [PATCH] bcache: Remove deprecated create_workqueue

2016-06-11 Thread Jens Axboe

On 06/11/2016 04:52 PM, Tejun Heo wrote:

On Wed, Jun 08, 2016 at 01:57:19AM +0530, Bhaktipriya Shridhar wrote:

alloc_workqueue replaces deprecated create_workqueue().

Dedicated workqueues have been used since bcache_wq and moving_gc_wq
are workqueues for writes and are being used on a memory reclaim path.
WQ_MEM_RECLAIM has been set to ensure forward progress under memory
pressure.
Since there are only a fixed number of work items, explicit concurrency
limit is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar 


Acked-by: Tejun Heo 


Added to 4.8, thanks.

--
Jens Axboe



Re: [PATCH] bcache: Remove deprecated create_workqueue

2016-06-11 Thread Jens Axboe

On 06/11/2016 04:52 PM, Tejun Heo wrote:

On Wed, Jun 08, 2016 at 01:57:19AM +0530, Bhaktipriya Shridhar wrote:

alloc_workqueue replaces deprecated create_workqueue().

Dedicated workqueues have been used since bcache_wq and moving_gc_wq
are workqueues for writes and are being used on a memory reclaim path.
WQ_MEM_RECLAIM has been set to ensure forward progress under memory
pressure.
Since there are only a fixed number of work items, explicit concurrency
limit is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar 


Acked-by: Tejun Heo 


Added to 4.8, thanks.

--
Jens Axboe



Re: [PATCH] libnvdimm, nfit: treat volatile virtual CD region as read-only pmem

2016-06-11 Thread joeyli
Hi Linda, 

Thanks for your review and comments.

On Thu, Jun 09, 2016 at 06:08:17PM -0400, Linda Knippers wrote:
> On 6/4/2016 7:01 AM, joeyli wrote:
> > Hi Dan, 
> > 
> > Thanks for your review.
> > 
> > On Fri, Jun 03, 2016 at 12:27:34PM -0700, Dan Williams wrote:
> >> On Fri, Jun 3, 2016 at 12:13 AM, Lee, Chun-Yi  
> >> wrote:
> >>> This patch adds codes to treat a volatile virtual CD region as a
> >>> read-only pmem region, then read-only /dev/pmem* device can be mounted
> >>> with iso9660.
> >>>
> >>> It's useful to work with the httpboot in EFI firmware to pull a remote
> >>> ISO file to the local memory region for booting and installation.
> >>>
> >>> Wiki page of UEFI HTTPBoot with OVMF:
> >>> https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF
> >>>
> >>> Signed-off-by: Lee, Chun-Yi 
> >>> Cc: Gary Lin 
> >>> Cc: Dan Williams 
> >>> Cc: Ross Zwisler 
> >>> Cc: "Rafael J. Wysocki" 
> >>> ---
> >>>  drivers/acpi/nfit.c  |  8 +++-
> >>>  drivers/nvdimm/region_devs.c | 26 +-
> >>>  include/linux/libnvdimm.h|  2 ++
> >>>  3 files changed, 34 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
> >>> index 2215fc8..b100a17 100644
> >>> --- a/drivers/acpi/nfit.c
> >>> +++ b/drivers/acpi/nfit.c
> >>> @@ -1949,6 +1949,7 @@ static int acpi_nfit_init_mapping(struct 
> >>> acpi_nfit_desc *acpi_desc,
> >>> switch (nfit_spa_type(spa)) {
> >>> case NFIT_SPA_PM:
> >>> case NFIT_SPA_VOLATILE:
> >>> +   case NFIT_SPA_VCD:
> >>> nd_mapping->start = memdev->address;
> >>> nd_mapping->size = memdev->region_size;
> >>> break;
> >>
> >> Why do we need to distinguish NFIT_SPA_VOLATILE vs NFIT_SPA_VCD, i.e.
> >> what happens if something writes to a VCD device?
> > 
> > Actually I didn't try to write SPA-VCD device before. Every time I mount it
> > that the system responses read-only:
> > 
> > # mount /dev/pmem0 /mnt/
> > mount: /dev/pmem0 is write-protected, mounting read-only
> > 
> > If it can be written, then I think there have no difference between
> > NFIT_SPA_VOLATILE with NFIT_SPA_VCD region.
> 
> It's not clear to me what the expectations for this type of device are, or
> whether they should be read-only.  The ACPI spec is not helpful here.
> The other Disk Region and CD Region types are also unclear.  Anyone
> care to define them?
>

In ACPI spec 6.1, it said "a volatile memory region that contains an ISO image":

This GUID defines a RAM Disk supporting a Virtual CD Region – Volatile (a 
volatile memory
region that contains an ISO image):
{ 0x3D5ABD30,0x4175,0x87CE,0x6D,0x64,0xD2,0xAD,0xE5,0x23,0xC4,0xBB }

I think the behavior that is the same with a volatile memory region but it
contains ISO.

I agree doesn't have any spec that it mentions the type should be read-only, I
will remove the code in patch.

I also agree that it doesn't have detail description of those ram disk
types. Do you have any idea or comment that you want to add to spec? Either
for ACPI or UEFI?
 
> > I implemented this patch to treat VCD region as read-only pmem because the
> > pmem region generates /dev/pmem* device that it can be mounted.
> 
> I'm a bit worried about this type of device showing up as a "pmem" device.
> I realize they're described in the NFIT (not sure why but they are) but do
> any of the operations that we support for other pmem devices work on these?
> Do root device DSMs make any sense?  Are there other DSMs?  What will happen
> if someone uses ndctl to reconfigure the device?
>

By using the Ramdisk function in EDK2/OVMF, it only generates a ACPI0012 root
device that it contains a empty _STA but no _DSM support:

DefinitionBlock ("ssdt2.aml", "SSDT", 2, "INTEL ", "RamDisk ", 0x1000)
{
Scope (\_SB)
{   
Device (NVDR)
{   
Name (_HID, "ACPI0012")  // _HID: Hardware ID
Name (_STR, Unicode ("NVDIMM Root Device"))  // _STR: Description 
String
Method (_STA, 0, NotSerialized)  // _STA: Status
{   
Return (0x0F)
}
}
}
}

So there have no way to control this root device through _DSM. The ACPI0012
root device is used to trigger the nfit driver in acpi.

I will put the above parser result to the patch description in next version.


On the other hand, here is the NFIT that it is generated by OVMF:

[000h    4]Signature : "NFIT"[NVDIMM Firmware 
Interface Table]
[004h 0004   4] Table Length : 0060
[008h 0008   1] Revision : 01
[009h 0009   1] Checksum : 0C
[00Ah 0010   6]   Oem ID : "INTEL "
[010h 0016   8] Oem Table ID : "EDK2"
[018h 0024   4] Oem Revision : 0002
[01Ch 0028   4] 

Re: [PATCH] libnvdimm, nfit: treat volatile virtual CD region as read-only pmem

2016-06-11 Thread joeyli
Hi Linda, 

Thanks for your review and comments.

On Thu, Jun 09, 2016 at 06:08:17PM -0400, Linda Knippers wrote:
> On 6/4/2016 7:01 AM, joeyli wrote:
> > Hi Dan, 
> > 
> > Thanks for your review.
> > 
> > On Fri, Jun 03, 2016 at 12:27:34PM -0700, Dan Williams wrote:
> >> On Fri, Jun 3, 2016 at 12:13 AM, Lee, Chun-Yi  
> >> wrote:
> >>> This patch adds codes to treat a volatile virtual CD region as a
> >>> read-only pmem region, then read-only /dev/pmem* device can be mounted
> >>> with iso9660.
> >>>
> >>> It's useful to work with the httpboot in EFI firmware to pull a remote
> >>> ISO file to the local memory region for booting and installation.
> >>>
> >>> Wiki page of UEFI HTTPBoot with OVMF:
> >>> https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF
> >>>
> >>> Signed-off-by: Lee, Chun-Yi 
> >>> Cc: Gary Lin 
> >>> Cc: Dan Williams 
> >>> Cc: Ross Zwisler 
> >>> Cc: "Rafael J. Wysocki" 
> >>> ---
> >>>  drivers/acpi/nfit.c  |  8 +++-
> >>>  drivers/nvdimm/region_devs.c | 26 +-
> >>>  include/linux/libnvdimm.h|  2 ++
> >>>  3 files changed, 34 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
> >>> index 2215fc8..b100a17 100644
> >>> --- a/drivers/acpi/nfit.c
> >>> +++ b/drivers/acpi/nfit.c
> >>> @@ -1949,6 +1949,7 @@ static int acpi_nfit_init_mapping(struct 
> >>> acpi_nfit_desc *acpi_desc,
> >>> switch (nfit_spa_type(spa)) {
> >>> case NFIT_SPA_PM:
> >>> case NFIT_SPA_VOLATILE:
> >>> +   case NFIT_SPA_VCD:
> >>> nd_mapping->start = memdev->address;
> >>> nd_mapping->size = memdev->region_size;
> >>> break;
> >>
> >> Why do we need to distinguish NFIT_SPA_VOLATILE vs NFIT_SPA_VCD, i.e.
> >> what happens if something writes to a VCD device?
> > 
> > Actually I didn't try to write SPA-VCD device before. Every time I mount it
> > that the system responses read-only:
> > 
> > # mount /dev/pmem0 /mnt/
> > mount: /dev/pmem0 is write-protected, mounting read-only
> > 
> > If it can be written, then I think there have no difference between
> > NFIT_SPA_VOLATILE with NFIT_SPA_VCD region.
> 
> It's not clear to me what the expectations for this type of device are, or
> whether they should be read-only.  The ACPI spec is not helpful here.
> The other Disk Region and CD Region types are also unclear.  Anyone
> care to define them?
>

In ACPI spec 6.1, it said "a volatile memory region that contains an ISO image":

This GUID defines a RAM Disk supporting a Virtual CD Region – Volatile (a 
volatile memory
region that contains an ISO image):
{ 0x3D5ABD30,0x4175,0x87CE,0x6D,0x64,0xD2,0xAD,0xE5,0x23,0xC4,0xBB }

I think the behavior that is the same with a volatile memory region but it
contains ISO.

I agree doesn't have any spec that it mentions the type should be read-only, I
will remove the code in patch.

I also agree that it doesn't have detail description of those ram disk
types. Do you have any idea or comment that you want to add to spec? Either
for ACPI or UEFI?
 
> > I implemented this patch to treat VCD region as read-only pmem because the
> > pmem region generates /dev/pmem* device that it can be mounted.
> 
> I'm a bit worried about this type of device showing up as a "pmem" device.
> I realize they're described in the NFIT (not sure why but they are) but do
> any of the operations that we support for other pmem devices work on these?
> Do root device DSMs make any sense?  Are there other DSMs?  What will happen
> if someone uses ndctl to reconfigure the device?
>

By using the Ramdisk function in EDK2/OVMF, it only generates a ACPI0012 root
device that it contains a empty _STA but no _DSM support:

DefinitionBlock ("ssdt2.aml", "SSDT", 2, "INTEL ", "RamDisk ", 0x1000)
{
Scope (\_SB)
{   
Device (NVDR)
{   
Name (_HID, "ACPI0012")  // _HID: Hardware ID
Name (_STR, Unicode ("NVDIMM Root Device"))  // _STR: Description 
String
Method (_STA, 0, NotSerialized)  // _STA: Status
{   
Return (0x0F)
}
}
}
}

So there have no way to control this root device through _DSM. The ACPI0012
root device is used to trigger the nfit driver in acpi.

I will put the above parser result to the patch description in next version.


On the other hand, here is the NFIT that it is generated by OVMF:

[000h    4]Signature : "NFIT"[NVDIMM Firmware 
Interface Table]
[004h 0004   4] Table Length : 0060
[008h 0008   1] Revision : 01
[009h 0009   1] Checksum : 0C
[00Ah 0010   6]   Oem ID : "INTEL "
[010h 0016   8] Oem Table ID : "EDK2"
[018h 0024   4] Oem Revision : 0002
[01Ch 0028   4]  Asl Compiler ID : ""
[020h 0032   4]Asl Compiler Revision : 0113

[024h 0036   4] 

Re: [PATCH v2 1/2] Documentation: bindings: add dt doc for Rockchip PCIe controller

2016-06-11 Thread Shawn Lin

On 2016/6/9 4:44, Rob Herring wrote:

On Wed, Jun 08, 2016 at 04:05:17PM +0800, Shawn Lin wrote:

This patch adds a binding that describes the Rockchip PCIe controller
found on Rockchip SoCs PCIe interface.

Signed-off-by: Shawn Lin 

---

Changes in v2:
- fix lots clk/reset stuff suggested by Heiko
- remove msi-parent and add msi-map suggested by Marc
- drop phy related stuff
- some others minor fixes

 .../devicetree/bindings/pci/rockchip-pcie.txt  | 86 ++
 1 file changed, 86 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/rockchip-pcie.txt

diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt 
b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
new file mode 100644
index 000..eb92e29
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
@@ -0,0 +1,86 @@
+* Rockchip AXI PCIe Root Port Bridge DT description
+
+Required properties:
+- #address-cells: Address representation for root ports, set to <3>
+- #size-cells: Size representation for root ports, set to <2>
+- #interrupt-cells: specifies the number of cells needed to encode an
+   interrupt source. The value must be 1.
+- compatible: Should contain "rockchip,rk3399-pcie"
+- reg: Two register ranges as listed in the reg-names property
+- reg-names: Must include the following names
+   - "axi-base"
+   - "apb-base"
+- clocks: Must contain an entry for each entry in clock-names.
+   See ../clocks/clock-bindings.txt for details.
+- clock-names: Must include the following entries:
+   - "aclk"
+   - "aclk-perf"
+   - "hclk"
+   - "pm"
+- phys: From PHY bindings: Phandle for the Generic PHY for PCIe.
+- phy-names:  MUST be "pcie-phy".


phy-names is kind of pointless for 1 phy.


ok, I will remove it.




+- interrupts: Three interrupt entries must be specified.
+- interrupt-names: Must include the following names
+   - "sys"
+   - "legacy"
+   - "client"
+- resets: Must contain five entries for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following names
+   - "core"
+   - "mgmt"
+   - "mgmt-sticky"
+   - "pipe"
+- pinctrl-names : The pin control state names
+- pinctrl-0: The "default" pinctrl state
+- interrupt-map-mask and interrupt-map: standard PCI properties
+- interrupt-controller: identifies the node as an interrupt controller
+
+Optional Property:
+- ep-gpios: contain the entry for pre-reset gpio
+- num-lanes: number of lanes to use
+- vpcie3v3-supply: The phandle to the 3.3v regulator to use for pcie. If this
+  is specified we'll defer probe until we can find this regulator.
+- vpcie1v8-supply: The phandle to the 1.8v regulator to use for pcie. If this
+  is specified we'll defer probe until we can find this regulator.
+- vpcie0v9-supply: The phandle to the 0.9v regulator to use for pcie. If this
+  is specified we'll defer probe until we can find this regulator.
+
+Example:
+
+pcie0: pcie@f800 {
+   compatible = "rockchip,rk3399-pcie";
+   #address-cells = <3>;
+   #size-cells = <2>;
+   clocks = < ACLK_PCIE>, < ACLK_PERF_PCIE>,
+< PCLK_PCIE>;
+   clock-names = "aclk", "aclk-perf",
+ "hclk";
+   bus-range = <0x0 0x1>;
+   interrupts = , ,
+;
+   interrupt-names: "sys", "legacy", "client";
+   assigned-clocks = < SCLK_PCIEPHY_REF>;
+   assigned-clock-parents = < SCLK_PCIEPHY_REF100M>;
+   assigned-clock-rates = <1>;
+   ep-gpios = < 13 GPIO_ACTIVE_HIGH>;
+   ranges = < 0x8200 0 0xfa00 0x0 0xfa00 0 0x60
+  0x8100 0 0xfa60 0x0 0xfa60 0 0x10 >;


No 64-bit memory space?


Will fix this example. Thanks for catching this:)




+   num-lanes = <4>;
+   reg = < 0x0 0xf800 0x0 0x200 >, < 0x0 0xfd00 0x0 0x100 
>;
+   reg-name = "axi-base", "apb-base";
+   resets = < SRST_PCIEPHY>, < SRST_PCIE_CORE>, < 
SRST_PCIE_MGMT>,
+< SRST_PCIE_MGMT_STICKY>, < SRST_PCIE_PIPE>;
+   reset-names = "core", "mgmt", "mgmt-sticky", "pipe";
+   phys = <_phy>;
+   phy-names = "pcie-phy";
+   pinctrl-names = "default";
+   pinctrl-0 = <_clkreq>;
+   #interrupt-cells = <1>;
+   interrupt-controller;
+   interrupt-map-mask = <0 0 0 7>;
+   interrupt-map = <0 0 0 1  1>,
+   <0 0 0 2  2>,
+   <0 0 0 3  3>,
+   <0 0 0 4  4>;
+};
--
2.3.7




___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip




--
Best Regards
Shawn Lin



Re: [PATCH v2 1/2] Documentation: bindings: add dt doc for Rockchip PCIe controller

2016-06-11 Thread Shawn Lin

On 2016/6/9 4:44, Rob Herring wrote:

On Wed, Jun 08, 2016 at 04:05:17PM +0800, Shawn Lin wrote:

This patch adds a binding that describes the Rockchip PCIe controller
found on Rockchip SoCs PCIe interface.

Signed-off-by: Shawn Lin 

---

Changes in v2:
- fix lots clk/reset stuff suggested by Heiko
- remove msi-parent and add msi-map suggested by Marc
- drop phy related stuff
- some others minor fixes

 .../devicetree/bindings/pci/rockchip-pcie.txt  | 86 ++
 1 file changed, 86 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/rockchip-pcie.txt

diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt 
b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
new file mode 100644
index 000..eb92e29
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
@@ -0,0 +1,86 @@
+* Rockchip AXI PCIe Root Port Bridge DT description
+
+Required properties:
+- #address-cells: Address representation for root ports, set to <3>
+- #size-cells: Size representation for root ports, set to <2>
+- #interrupt-cells: specifies the number of cells needed to encode an
+   interrupt source. The value must be 1.
+- compatible: Should contain "rockchip,rk3399-pcie"
+- reg: Two register ranges as listed in the reg-names property
+- reg-names: Must include the following names
+   - "axi-base"
+   - "apb-base"
+- clocks: Must contain an entry for each entry in clock-names.
+   See ../clocks/clock-bindings.txt for details.
+- clock-names: Must include the following entries:
+   - "aclk"
+   - "aclk-perf"
+   - "hclk"
+   - "pm"
+- phys: From PHY bindings: Phandle for the Generic PHY for PCIe.
+- phy-names:  MUST be "pcie-phy".


phy-names is kind of pointless for 1 phy.


ok, I will remove it.




+- interrupts: Three interrupt entries must be specified.
+- interrupt-names: Must include the following names
+   - "sys"
+   - "legacy"
+   - "client"
+- resets: Must contain five entries for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following names
+   - "core"
+   - "mgmt"
+   - "mgmt-sticky"
+   - "pipe"
+- pinctrl-names : The pin control state names
+- pinctrl-0: The "default" pinctrl state
+- interrupt-map-mask and interrupt-map: standard PCI properties
+- interrupt-controller: identifies the node as an interrupt controller
+
+Optional Property:
+- ep-gpios: contain the entry for pre-reset gpio
+- num-lanes: number of lanes to use
+- vpcie3v3-supply: The phandle to the 3.3v regulator to use for pcie. If this
+  is specified we'll defer probe until we can find this regulator.
+- vpcie1v8-supply: The phandle to the 1.8v regulator to use for pcie. If this
+  is specified we'll defer probe until we can find this regulator.
+- vpcie0v9-supply: The phandle to the 0.9v regulator to use for pcie. If this
+  is specified we'll defer probe until we can find this regulator.
+
+Example:
+
+pcie0: pcie@f800 {
+   compatible = "rockchip,rk3399-pcie";
+   #address-cells = <3>;
+   #size-cells = <2>;
+   clocks = < ACLK_PCIE>, < ACLK_PERF_PCIE>,
+< PCLK_PCIE>;
+   clock-names = "aclk", "aclk-perf",
+ "hclk";
+   bus-range = <0x0 0x1>;
+   interrupts = , ,
+;
+   interrupt-names: "sys", "legacy", "client";
+   assigned-clocks = < SCLK_PCIEPHY_REF>;
+   assigned-clock-parents = < SCLK_PCIEPHY_REF100M>;
+   assigned-clock-rates = <1>;
+   ep-gpios = < 13 GPIO_ACTIVE_HIGH>;
+   ranges = < 0x8200 0 0xfa00 0x0 0xfa00 0 0x60
+  0x8100 0 0xfa60 0x0 0xfa60 0 0x10 >;


No 64-bit memory space?


Will fix this example. Thanks for catching this:)




+   num-lanes = <4>;
+   reg = < 0x0 0xf800 0x0 0x200 >, < 0x0 0xfd00 0x0 0x100 
>;
+   reg-name = "axi-base", "apb-base";
+   resets = < SRST_PCIEPHY>, < SRST_PCIE_CORE>, < 
SRST_PCIE_MGMT>,
+< SRST_PCIE_MGMT_STICKY>, < SRST_PCIE_PIPE>;
+   reset-names = "core", "mgmt", "mgmt-sticky", "pipe";
+   phys = <_phy>;
+   phy-names = "pcie-phy";
+   pinctrl-names = "default";
+   pinctrl-0 = <_clkreq>;
+   #interrupt-cells = <1>;
+   interrupt-controller;
+   interrupt-map-mask = <0 0 0 7>;
+   interrupt-map = <0 0 0 1  1>,
+   <0 0 0 2  2>,
+   <0 0 0 3  3>,
+   <0 0 0 4  4>;
+};
--
2.3.7




___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip




--
Best Regards
Shawn Lin



Re: [PATCH 1/3] ARM: dts: imx7d: create i.MX 7Solo base device tree

2016-06-11 Thread Shawn Guo
On Tue, Jun 07, 2016 at 07:37:07PM -0700, Stefan Agner wrote:
> The i.MX 7 series currently consists of two SoCs: i.MX 7Solo and
> 7Dual. The i.MX 7Solo implements a subset of features available on
> i.MX 7Dual, hence create imx7s.dtsi as the base device tree. The
> i.MX 7Dual's additional features over i.MX 7Solo are:
> - Second Cortex-A7 core
> - Second Gigabit Ethernet controller
> - EPD (Electronc Paper Display, not yet part of the device tree)
> - PCIe (not yet part of the device tree)
> - Additional USB2.0 OTG controller
> 
> Signed-off-by: Stefan Agner 
> ---
>  arch/arm/boot/dts/imx7d.dtsi | 923 
> +++
>  arch/arm/boot/dts/imx7s.dtsi | 880 +
>  2 files changed, 928 insertions(+), 875 deletions(-)

We should probably have a beforehand patch to rename the file, so that
we can avoid this dramatic diffstat.

Shawn


Re: [PATCH 1/3] ARM: dts: imx7d: create i.MX 7Solo base device tree

2016-06-11 Thread Shawn Guo
On Tue, Jun 07, 2016 at 07:37:07PM -0700, Stefan Agner wrote:
> The i.MX 7 series currently consists of two SoCs: i.MX 7Solo and
> 7Dual. The i.MX 7Solo implements a subset of features available on
> i.MX 7Dual, hence create imx7s.dtsi as the base device tree. The
> i.MX 7Dual's additional features over i.MX 7Solo are:
> - Second Cortex-A7 core
> - Second Gigabit Ethernet controller
> - EPD (Electronc Paper Display, not yet part of the device tree)
> - PCIe (not yet part of the device tree)
> - Additional USB2.0 OTG controller
> 
> Signed-off-by: Stefan Agner 
> ---
>  arch/arm/boot/dts/imx7d.dtsi | 923 
> +++
>  arch/arm/boot/dts/imx7s.dtsi | 880 +
>  2 files changed, 928 insertions(+), 875 deletions(-)

We should probably have a beforehand patch to rename the file, so that
we can avoid this dramatic diffstat.

Shawn


Re: [PATCH v2 1/2] Documentation: bindings: add dt doc for Rockchip PCIe controller

2016-06-11 Thread Shawn Lin

在 2016/6/10 12:01, Doug Anderson 写道:

Shawn,

On Wed, Jun 8, 2016 at 1:05 AM, Shawn Lin  wrote:

+pcie0: pcie@f800 {
+   compatible = "rockchip,rk3399-pcie";
+   #address-cells = <3>;
+   #size-cells = <2>;
+   clocks = < ACLK_PCIE>, < ACLK_PERF_PCIE>,
+< PCLK_PCIE>;
+   clock-names = "aclk", "aclk-perf",
+ "hclk";


Code also requires a "pm" clock.


+   bus-range = <0x0 0x1>;
+   interrupts = , ,
+;
+   interrupt-names: "sys", "legacy", "client";


Shouldn't be ":", should be "=".



+   assigned-clocks = < SCLK_PCIEPHY_REF>;
+   assigned-clock-parents = < SCLK_PCIEPHY_REF100M>;
+   assigned-clock-rates = <1>;
+   ep-gpios = < 13 GPIO_ACTIVE_HIGH>;
+   ranges = < 0x8200 0 0xfa00 0x0 0xfa00 0 0x60
+  0x8100 0 0xfa60 0x0 0xfa60 0 0x10 >;


nit: I don't thin it's common to have spaces before/after the ">" and "<".
nit: Be consistent about 0 vs. 0x0 in ranges.



+   num-lanes = <4>;
+   reg = < 0x0 0xf800 0x0 0x200 >, < 0x0 0xfd00 0x0 0x100 
>;
+   reg-name = "axi-base", "apb-base";


Should be "reg-names" (with an "s")



+   resets = < SRST_PCIEPHY>, < SRST_PCIE_CORE>, < 
SRST_PCIE_MGMT>,
+< SRST_PCIE_MGMT_STICKY>, < SRST_PCIE_PIPE>;
+   reset-names = "core", "mgmt", "mgmt-sticky", "pipe";


You have 5 resets but 4 reset names.  That doesn't seem right.  Code
shows you only getting 4, so presumably you need to remove the
SRST_PCIEPHY one.


Thanks for catching these above as I forgot to rework the this sample.




-Doug

___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip




--
Best Regards
Shawn Lin



Re: [PATCH v2 1/2] Documentation: bindings: add dt doc for Rockchip PCIe controller

2016-06-11 Thread Shawn Lin

在 2016/6/10 12:01, Doug Anderson 写道:

Shawn,

On Wed, Jun 8, 2016 at 1:05 AM, Shawn Lin  wrote:

+pcie0: pcie@f800 {
+   compatible = "rockchip,rk3399-pcie";
+   #address-cells = <3>;
+   #size-cells = <2>;
+   clocks = < ACLK_PCIE>, < ACLK_PERF_PCIE>,
+< PCLK_PCIE>;
+   clock-names = "aclk", "aclk-perf",
+ "hclk";


Code also requires a "pm" clock.


+   bus-range = <0x0 0x1>;
+   interrupts = , ,
+;
+   interrupt-names: "sys", "legacy", "client";


Shouldn't be ":", should be "=".



+   assigned-clocks = < SCLK_PCIEPHY_REF>;
+   assigned-clock-parents = < SCLK_PCIEPHY_REF100M>;
+   assigned-clock-rates = <1>;
+   ep-gpios = < 13 GPIO_ACTIVE_HIGH>;
+   ranges = < 0x8200 0 0xfa00 0x0 0xfa00 0 0x60
+  0x8100 0 0xfa60 0x0 0xfa60 0 0x10 >;


nit: I don't thin it's common to have spaces before/after the ">" and "<".
nit: Be consistent about 0 vs. 0x0 in ranges.



+   num-lanes = <4>;
+   reg = < 0x0 0xf800 0x0 0x200 >, < 0x0 0xfd00 0x0 0x100 
>;
+   reg-name = "axi-base", "apb-base";


Should be "reg-names" (with an "s")



+   resets = < SRST_PCIEPHY>, < SRST_PCIE_CORE>, < 
SRST_PCIE_MGMT>,
+< SRST_PCIE_MGMT_STICKY>, < SRST_PCIE_PIPE>;
+   reset-names = "core", "mgmt", "mgmt-sticky", "pipe";


You have 5 resets but 4 reset names.  That doesn't seem right.  Code
shows you only getting 4, so presumably you need to remove the
SRST_PCIEPHY one.


Thanks for catching these above as I forgot to rework the this sample.




-Doug

___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip




--
Best Regards
Shawn Lin



[GIT PULL] Block fixes for 4.7-rc3

2016-06-11 Thread Jens Axboe
Hi Linus,

A small collection of fixes for the current series. This pull request
contains:

- Two fixes for xen-blkfront, from Bob Liu.

- A bug fix for NVMe, releasing only the specific resources we
  requested.

- Fix for a debugfs flags entry for nbd, from Josef.

- Plug fix from Omar, fixing up a case of code being switched between
  two functions.

- A missing bio_put() for the new discard callers of submit_bio_wait(),
  fixing a regression causing a leak of the bio. From Shaun.

- Improve dirty limit calculation precision in the writeback code,
  fixing a case where setting a limit lower than 1% of memory would end
  up being zero. From Tejun.

Please pull!


  git://git.kernel.dk/linux-block.git for-linus



Bob Liu (2):
  xen-blkfront: don't call talk_to_blkback when already connected to blkback
  xen-blkfront: fix resume issues after a migration

Jens Axboe (1):
  Merge branch 'stable/for-jens-4.7' of git://git.kernel.org/.../konrad/xen 
into for-linus

Johannes Thumshirn (1):
  NVMe: Only release requested regions

Josef Bacik (1):
  nbd: pass the nbd pointer for flags debugfs

Omar Sandoval (1):
  blk-mq: really fix plug list flushing for nomerge queues

Shaun Tancheff (1):
  block: missing bio_put following submit_bio_wait

Tejun Heo (1):
  writeback: use higher precision calculation in domain_dirty_limits()

 block/blk-lib.c  | 12 +---
 block/blk-mq.c   | 17 -
 drivers/block/nbd.c  |  2 +-
 drivers/block/xen-blkfront.c | 35 ++-
 drivers/nvme/host/pci.c  |  9 +++--
 mm/page-writeback.c  | 21 -
 6 files changed, 59 insertions(+), 37 deletions(-)

-- 
Jens Axboe



[GIT PULL] Block fixes for 4.7-rc3

2016-06-11 Thread Jens Axboe
Hi Linus,

A small collection of fixes for the current series. This pull request
contains:

- Two fixes for xen-blkfront, from Bob Liu.

- A bug fix for NVMe, releasing only the specific resources we
  requested.

- Fix for a debugfs flags entry for nbd, from Josef.

- Plug fix from Omar, fixing up a case of code being switched between
  two functions.

- A missing bio_put() for the new discard callers of submit_bio_wait(),
  fixing a regression causing a leak of the bio. From Shaun.

- Improve dirty limit calculation precision in the writeback code,
  fixing a case where setting a limit lower than 1% of memory would end
  up being zero. From Tejun.

Please pull!


  git://git.kernel.dk/linux-block.git for-linus



Bob Liu (2):
  xen-blkfront: don't call talk_to_blkback when already connected to blkback
  xen-blkfront: fix resume issues after a migration

Jens Axboe (1):
  Merge branch 'stable/for-jens-4.7' of git://git.kernel.org/.../konrad/xen 
into for-linus

Johannes Thumshirn (1):
  NVMe: Only release requested regions

Josef Bacik (1):
  nbd: pass the nbd pointer for flags debugfs

Omar Sandoval (1):
  blk-mq: really fix plug list flushing for nomerge queues

Shaun Tancheff (1):
  block: missing bio_put following submit_bio_wait

Tejun Heo (1):
  writeback: use higher precision calculation in domain_dirty_limits()

 block/blk-lib.c  | 12 +---
 block/blk-mq.c   | 17 -
 drivers/block/nbd.c  |  2 +-
 drivers/block/xen-blkfront.c | 35 ++-
 drivers/nvme/host/pci.c  |  9 +++--
 mm/page-writeback.c  | 21 -
 6 files changed, 59 insertions(+), 37 deletions(-)

-- 
Jens Axboe



  1   2   3   4   5   6   >