[PATCH] block: fully initialize queue in blk_mq_init_allocated_queue

2015-03-13 Thread Sergey Senozhatsky
Commit c9e8c91f8a279b87eb0d94b037504ea9fc1bef7c
 Author: Mike Snitzer 
 Date:   Tue Mar 10 15:54:41 2015 -0400

 blk-mq: fix use of incorrect goto label in blk_mq_init_queue error path

for some reason has moved queue allocation 'q = blk_alloc_queue_node()'
after 'percpu_ref_init(&q->mq_usage_counter...)', so we are doing percpu
init on something that is not a request_queue.

Further commit 716452cd27b145d611e4399e7cc35df6c943686e
 Author: Mike Snitzer 
 Date:   Tue Mar 10 17:20:20 2015 -0400

 blk-mq: add blk_mq_init_allocated_queue and export

has introduced abother issue.
In blk_mq_init_queue() we allocate new request_queue:

   uninit_q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node);
   if (!uninit_q)
   return ERR_PTR(-ENOMEM);

and pass `uninit_q' as a 'request_queue *q' parameter to
blk_mq_init_allocated_queue():

   q = blk_mq_init_allocated_queue(set, uninit_q);

blk_mq_init_allocated_queue(), however, firstly use passed `uninit_q' to init
its percpu, but then it allocates a new request_queue and returns it back,
not being properly initialized:

blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, struct request_queue *q)
[..]
   if (percpu_ref_init(&q->mq_usage_counter, blk_mq_usage_counter_release,
PERCPU_REF_INIT_ATOMIC, GFP_KERNEL))
   goto err_hctxs;

   q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node);
   if (!q)
   goto err_hctxs;

[..]
   return q;

Which eventually leads to different problems, including a NULL pointer
dereference.

Remove blk_alloc_queue_node() from blk_mq_init_allocated_queue() and use
supplied request_queue.

Signed-off-by: Sergey Senozhatsky 
---
 block/blk-mq.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index b838dfc..59fa239 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1955,10 +1955,6 @@ struct request_queue *blk_mq_init_allocated_queue(struct 
blk_mq_tag_set *set,
PERCPU_REF_INIT_ATOMIC, GFP_KERNEL))
goto err_hctxs;
 
-   q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node);
-   if (!q)
-   goto err_hctxs;
-
setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q);
blk_queue_rq_timeout(q, 3);
 
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/2] dma: at_hdmac: Fix residue calculation and add mem to

2015-03-13 Thread Vinod Koul
On Mon, Feb 23, 2015 at 05:54:09PM +0100, Torsten Fleischer wrote:
> From: Torsten Fleischer 
> 
> This series fixes the calculation of the residual bytes and adds support for
> memory to memory scatter-gather transfers.

Applied both,

Thanks

-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] selftest: add a test case to check how locks are shown in fdinfo

2015-03-13 Thread Andrew Vagin
On Thu, Mar 12, 2015 at 02:43:19PM -0600, Shuah Khan wrote:
> Hi Andrey,
> 
> Looks good in general. Couple of comments.

Thanks. The updated version is attached.

> 
> On 03/12/2015 10:30 AM, Andrey Vagin wrote:
> > The main idea of this test is to check that locks are shown correctly
> > when they can't be placed in a default seq_file buffer due to its size.
> > 
> > Cc: Andrew Morton 
> > Cc: Shuah Khan 
> > Signed-off-by: Andrey Vagin 
> > ---
> >  tools/testing/selftests/Makefile|   1 +
> >  tools/testing/selftests/fdinfo/Makefile |  11 +++
> >  tools/testing/selftests/fdinfo/locks.c  | 119 
> > 
> >  3 files changed, 131 insertions(+)
> >  create mode 100644 tools/testing/selftests/fdinfo/Makefile
> >  create mode 100644 tools/testing/selftests/fdinfo/locks.c
> > 
> > diff --git a/tools/testing/selftests/Makefile 
> > b/tools/testing/selftests/Makefile
> > index 4e51122..8cd57f6 100644
> > --- a/tools/testing/selftests/Makefile
> > +++ b/tools/testing/selftests/Makefile
> > @@ -17,6 +17,7 @@ TARGETS += sysctl
> >  TARGETS += timers
> >  TARGETS += user
> >  TARGETS += vm
> > +TARGETS += fdinfo
> >  #Please keep the TARGETS list alphabetically sorted
> 
> Please move the new target up to keep the TARGETS list
> alphabetically sorted. This helps avoid conflicts as new
> tests get added.
> 
> >  
> >  TARGETS_HOTPLUG = cpu-hotplug
> > diff --git a/tools/testing/selftests/fdinfo/Makefile 
> > b/tools/testing/selftests/fdinfo/Makefile
> > new file mode 100644
> > index 000..83f34ef
> > --- /dev/null
> > +++ b/tools/testing/selftests/fdinfo/Makefile
> > @@ -0,0 +1,11 @@
> > +CFLAGS += -Wall
> > +
> > +all: locks
> > +
> > +run_tests: all
> > +   @./locks || echo "locks: [FAIL]"
> > +
> > +locks: locks.c
> > +
> > +clean:
> > +   rm -f locks
> > diff --git a/tools/testing/selftests/fdinfo/locks.c 
> > b/tools/testing/selftests/fdinfo/locks.c
> > new file mode 100644
> > index 000..93f25c6
> > --- /dev/null
> > +++ b/tools/testing/selftests/fdinfo/locks.c
> > @@ -0,0 +1,119 @@
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define pr_perror(fmt, ...) fprintf(stderr, "%s:%d: " fmt ": %m\n", \
> > +   __FILE__, __LINE__, ##__VA_ARGS__)
> > +
> > +#define FILE_SIZE 4096
> > +
> > +int main(int argc, char **argv)
> > +{
> > +   int fd, fdinfo, i, ret, size, bsize = 4096;
> > +   char *buf, *p, fdinfo_path[] = "/proc/self/fdinfo/XX";
> > +
> > +   fd = open("test_file", O_RDWR | O_CREAT, 0666);
> > +   if (fd == -1) {
> > +   pr_perror("Unable to open test_file");
> > +   return 1;
> > +   }
> > +   unlink("test_file");
> > +   if (ftruncate(fd, FILE_SIZE) == -1) {
> > +   pr_perror("Unable to truncate test_file");
> > +   return 1;
> > +   }
> > +
> > +   /*
> > +* Generate FILE_SIZE locks. We are going to exceed the default
> > +* size of seq buffer
> > +*/
> > +   for (i = 0; i < FILE_SIZE; i++) {
> > +   struct flock lock;
> > +
> > +   if (i % 2)
> > +   lock.l_type = F_WRLCK;
> > +   else
> > +   lock.l_type = F_RDLCK;
> > +   lock.l_whence = SEEK_SET;
> > +   lock.l_start  = i;
> > +   lock.l_len= 1;
> > +   lock.l_pid= -1;
> > +   if (fcntl(fd, F_SETLK, &lock)) {
> > +   pr_perror("Unable to set lock %d\n", i);
> > +   return 1;
> > +   }
> > +   }
> > +
> > +   snprintf(fdinfo_path, sizeof(fdinfo_path), "/proc/self/fdinfo/%d", fd);
> > +   fdinfo = open(fdinfo_path, O_RDONLY);
> > +   if (fdinfo < 0) {
> > +   pr_perror("Unable to open %s", fdinfo_path);
> > +   return 1;
> > +   }
> > +
> > +   buf = malloc(bsize);
> > +   if (buf == NULL) {
> > +   pr_perror("Unable to allocate a buffer");
> > +   return 1;
> > +   }
> > +   size = 0;
> > +   while (1) {
> > +   ret = read(fdinfo, buf + size, bsize - 1 - size);
> > +   if (ret == 0)
> > +   break;
> > +   if (ret == -1) {
> > +   pr_perror("Unable to read %s", fdinfo_path);
> > +   return 1;
> > +   }
> > +   size += ret;
> > +   if (bsize - size < 4096)
> > +   bsize += 4096;
> > +   buf = realloc(buf, bsize);
> > +   if (buf == NULL) {
> > +   pr_perror("Unable to allocate a buffer");
> > +   return 1;
> > +   }
> > +   }
> > +   buf[size] = 0;
> > +
> > +   i = 0;
> > +   for (p = buf - 1; p != NULL; p = strchr(p, '\n')) {
> > +   char fl_flag[10], fl_type[15], fl_option[10], end[32];
> > +   int fl_id, fl_owner, maj, min;
> > +   unsigned long ino;
> > +   unsigned long long start;
> > +
> > +   p++;
> > +
> > +   if (strncmp(p, "lock:", 5))
> > +   c

Re: [PATCH resend v4] phy: Add driver to support individual USB PHYs on sun9i

2015-03-13 Thread Paul Bolle
Just a license nit.

On Thu, 2015-03-12 at 17:54 +0800, Chen-Yu Tsai wrote:
> --- /dev/null
> +++ b/drivers/phy/phy-sun9i-usb.c

> + * 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 of the License, 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.
> + */

This states that the license is GPL v2 or later.

> +MODULE_LICENSE("GPL v2");

And it's
MODULE_LICENSE("GPL");

that matches that statement.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/6] mtd: nand: vf610_nfc: Freescale NFC for VF610

2015-03-13 Thread Stefan Agner
This adds support for Freescale NAND flash controller (NFC) found on
various devices such as Vybrid (VF610), MPC5125, MCF54418 (ColdFire)
and Kinetis K70.

The patchset is based on the patchset by Bill Pringlemeir, see:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/295419

A variant of this driver is in upstream U-Boot now. During this
process, various points have been discussed and changed. Those
changes are also incorporated in this patchset, including the
change to the name "vf610_nfc" (discussion in first patchset).
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/192465
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/193142
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/193351
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/195441
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/195513

MTD tests worked, except mtd_nandecctest.ko: The test stopped
already after changing the first bit. I guess this is due to not
properly working raw page read/write implementation. However,
implementing those functions is not feasible since ECC is always
done on-the-fly.

Performance keypoints (slightly less for page write/reads):
[ 1782.284398] mtd_speedtest: testing eraseblock write speed
[ 1963.472907] mtd_speedtest: eraseblock write speed is 2877 KiB/s
[ 1963.478913] mtd_speedtest: testing eraseblock read speed
[ 2004.906267] mtd_speedtest: eraseblock read speed is 12586 KiB/s

The driver has only been tested on Freescale Vybrid. Tests on other
platforms welcome, especially on big endian architectures...

Changes since v2:
- Updated binding documentation

Changes since v1:
- Nest nfc_config struct within the main nfc struct
- Use assigned clock binding to specify NFC clock
- Rebased ontop of MSCM IR patchset (driver parts have been merged)
- Split out arch Kconfig in a seperate config
- Fix module license
- Updated MAINTAINERS

Changes since RFC (Bill Pringlemeir):
- Renamed driver from fsl_nfc to vf610_nfc
- Use readl/writel for all register in accessor functions
- Optimized field accessor functions
- Implemented PM (suspend/resume) functions
- Implemented basic support for ECC strength/ECC step size from dt
- Improved performance of count_written_bits by using hweight32
- Support ECC with 60-bytes to correct up to 32 bit errors
- Changed to in-band BBT (NAND_BBT_NO_OOB) which also allows ECC modes
  which uses up to 60 bytes on 64 byte OOB
- Removed custom (downstream) BBT pattern since BBT table won't be
  compatible anyway (due to the change above)

Stefan Agner (6):
  mtd: nand: vf610_nfc: Freescale NFC for VF610, MPC5125 and others
  mtd: nand: vf610_nfc: add hardware BCH-ECC support
  mtd: nand: vf610_nfc: add device tree bindings
  ARM: vf610: enable NAND Flash Controller
  ARM: dts: vf610: add NAND flash controller peripherial
  ARM: dts: vf-colibri: enable NAND flash controller

 .../devicetree/bindings/mtd/vf610-nfc.txt  |  45 ++
 MAINTAINERS|   6 +
 arch/arm/boot/dts/vf-colibri.dtsi  |  32 +
 arch/arm/boot/dts/vf610-twr.dts|  44 ++
 arch/arm/boot/dts/vfxxx.dtsi   |   8 +
 arch/arm/mach-imx/Kconfig  |   1 +
 drivers/mtd/nand/Kconfig   |  14 +
 drivers/mtd/nand/Makefile  |   1 +
 drivers/mtd/nand/vf610_nfc.c   | 856 +
 9 files changed, 1007 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/vf610-nfc.txt
 create mode 100644 drivers/mtd/nand/vf610_nfc.c

-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 6/6] ARM: dts: vf-colibri: enable NAND flash controller

2015-03-13 Thread Stefan Agner
Enable NAND access by adding pinmux and NAND flash controller  node
to device tree. The NAND chips currently used on the Colibri VF61
requires 8-bit ECC per 512 byte page, hence specify 32-bit ECC
strength per 2k page size.

Signed-off-by: Stefan Agner 
---
 arch/arm/boot/dts/vf-colibri.dtsi | 32 
 1 file changed, 32 insertions(+)

diff --git a/arch/arm/boot/dts/vf-colibri.dtsi 
b/arch/arm/boot/dts/vf-colibri.dtsi
index 5c2b732..76139d7 100644
--- a/arch/arm/boot/dts/vf-colibri.dtsi
+++ b/arch/arm/boot/dts/vf-colibri.dtsi
@@ -46,6 +46,19 @@
pinctrl-0 = <&pinctrl_i2c0>;
 };
 
+&nfc {
+   assigned-clocks = <&clks VF610_CLK_NFC>;
+   assigned-clock-rates = <3300>;
+   nand-bus-width = <8>;
+   nand-ecc-mode = "hw";
+   nand-on-flash-bbt;
+   nand-ecc-strength = <32>;
+   nand-ecc-step-size = <2048>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_nfc_1>;
+   status = "okay";
+};
+
 &pwm0 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm0>;
@@ -141,6 +154,25 @@
>;
};
 
+   pinctrl_nfc_1: nfcgrp_1 {
+   fsl,pins = <
+   VF610_PAD_PTD23__NF_IO7 0x28df
+   VF610_PAD_PTD22__NF_IO6 0x28df
+   VF610_PAD_PTD21__NF_IO5 0x28df
+   VF610_PAD_PTD20__NF_IO4 0x28df
+   VF610_PAD_PTD19__NF_IO3 0x28df
+   VF610_PAD_PTD18__NF_IO2 0x28df
+   VF610_PAD_PTD17__NF_IO1 0x28df
+   VF610_PAD_PTD16__NF_IO0 0x28df
+   VF610_PAD_PTB24__NF_WE_B0x28c2
+   VF610_PAD_PTB25__NF_CE0_B   0x28c2
+   VF610_PAD_PTB27__NF_RE_B0x28c2
+   VF610_PAD_PTC26__NF_RB_B0x283d
+   VF610_PAD_PTC27__NF_ALE 0x28c2
+   VF610_PAD_PTC28__NF_CLE 0x28c2
+   >;
+   };
+
pinctrl_pwm0: pwm0grp {
fsl,pins = <
VF610_PAD_PTB0__FTM0_CH00x1182
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 5/6] ARM: dts: vf610: add NAND flash controller peripherial

2015-03-13 Thread Stefan Agner
This adds the NAND flash controller (NFC) peripherial. The driver
supports the SLC NAND chips found on Freescale's Vybrid Tower System
Module. The Micron NAND chip on the module needs 4-bit ECC per 512
byte page. Use 24-bit ECC per 2k page, which is supported by the
driver.

Signed-off-by: Bill Pringlemeir 
Signed-off-by: Stefan Agner 
---
 arch/arm/boot/dts/vf610-twr.dts | 44 +
 arch/arm/boot/dts/vfxxx.dtsi|  8 
 2 files changed, 52 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index f64fddc..f42d155 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -287,6 +287,50 @@
status = "okay";
 };
 
+&iomuxc {
+   vf610-twr {
+   pinctrl_nfc_1: nfcgrp_1 {
+   fsl,pins = <
+   VF610_PAD_PTD31__NF_IO150x28df
+   VF610_PAD_PTD30__NF_IO140x28df
+   VF610_PAD_PTD29__NF_IO130x28df
+   VF610_PAD_PTD28__NF_IO120x28df
+   VF610_PAD_PTD27__NF_IO110x28df
+   VF610_PAD_PTD26__NF_IO100x28df
+   VF610_PAD_PTD25__NF_IO9 0x28df
+   VF610_PAD_PTD24__NF_IO8 0x28df
+   VF610_PAD_PTD23__NF_IO7 0x28df
+   VF610_PAD_PTD22__NF_IO6 0x28df
+   VF610_PAD_PTD21__NF_IO5 0x28df
+   VF610_PAD_PTD20__NF_IO4 0x28df
+   VF610_PAD_PTD19__NF_IO3 0x28df
+   VF610_PAD_PTD18__NF_IO2 0x28df
+   VF610_PAD_PTD17__NF_IO1 0x28df
+   VF610_PAD_PTD16__NF_IO0 0x28df
+   VF610_PAD_PTB24__NF_WE_B0x28c2
+   VF610_PAD_PTB25__NF_CE0_B   0x28c2
+   VF610_PAD_PTB27__NF_RE_B0x28c2
+   VF610_PAD_PTC26__NF_RB_B0x283d
+   VF610_PAD_PTC27__NF_ALE 0x28c2
+   VF610_PAD_PTC28__NF_CLE 0x28c2
+   >;
+   };
+   };
+};
+
+&nfc {
+   assigned-clocks = <&clks VF610_CLK_NFC>;
+   assigned-clock-rates = <3300>;
+   nand-bus-width = <16>;
+   nand-ecc-mode = "hw";
+   nand-on-flash-bbt;
+   nand-ecc-strength = <24>;
+   nand-ecc-step-size = <2048>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_nfc_1>;
+   status = "okay";
+};
+
 &uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index 32de809..8c85972 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -507,6 +507,14 @@
status = "disabled";
};
 
+   nfc: nand@400e {
+   compatible = "fsl,vf610-nfc";
+   reg = <0x400e 0x4000>;
+   interrupts = <83 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = <&clks VF610_CLK_NFC>;
+   clock-names = "nfc";
+   status = "disabled";
+   };
};
};
 };
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/6] mtd: nand: vf610_nfc: Freescale NFC for VF610, MPC5125 and others

2015-03-13 Thread Stefan Agner
This driver supports Freescale NFC (NAND flash controller) found on
Vybrid (VF610), MPC5125, MCF54418 and Kinetis K70.

Limitations:
- DMA and pipelining not used
- Pages larger than 2k are not supported
- No hardware ECC

The driver has only been tested on Vybrid (VF610).

Signed-off-by: Bill Pringlemeir 
Signed-off-by: Stefan Agner 
---
 MAINTAINERS  |   6 +
 drivers/mtd/nand/Kconfig |  12 +
 drivers/mtd/nand/Makefile|   1 +
 drivers/mtd/nand/vf610_nfc.c | 713 +++
 4 files changed, 732 insertions(+)
 create mode 100644 drivers/mtd/nand/vf610_nfc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index eaf9996..d8cbaee 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10363,6 +10363,12 @@ S: Maintained
 F: Documentation/fb/uvesafb.txt
 F: drivers/video/fbdev/uvesafb.*
 
+VF610 NAND DRIVER
+M: Stefan Agner 
+L: linux-...@lists.infradead.org
+S: Supported
+F: drivers/mtd/nand/vf610_nfc.c
+
 VFAT/FAT/MSDOS FILESYSTEM
 M: OGAWA Hirofumi 
 S: Maintained
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5b76a17..1be30a6 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -455,6 +455,18 @@ config MTD_NAND_MPC5121_NFC
  This enables the driver for the NAND flash controller on the
  MPC5121 SoC.
 
+config HAVE_NAND_VF610_NFC
+   bool
+
+config MTD_NAND_VF610_NFC
+   tristate "Support for Freescale NFC for VF610/MPC5125"
+   depends on HAVE_NAND_VF610_NFC
+   help
+ Enables support for NAND Flash Controller on some Freescale
+ processors like the VF610, MPC5125, MCF54418 or Kinetis K70.
+ The driver supports a maximum 2k page size. The driver
+ currently does not support hardware ECC.
+
 config MTD_NAND_MXC
tristate "MXC NAND support"
depends on ARCH_MXC
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 582bbd05..e97ca7b 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_MTD_NAND_SOCRATES)   += 
socrates_nand.o
 obj-$(CONFIG_MTD_NAND_TXX9NDFMC)   += txx9ndfmc.o
 obj-$(CONFIG_MTD_NAND_NUC900)  += nuc900_nand.o
 obj-$(CONFIG_MTD_NAND_MPC5121_NFC) += mpc5121_nfc.o
+obj-$(CONFIG_MTD_NAND_VF610_NFC)   += vf610_nfc.o
 obj-$(CONFIG_MTD_NAND_RICOH)   += r852.o
 obj-$(CONFIG_MTD_NAND_JZ4740)  += jz4740_nand.o
 obj-$(CONFIG_MTD_NAND_GPMI_NAND)   += gpmi-nand/
diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
new file mode 100644
index 000..5c8be4a
--- /dev/null
+++ b/drivers/mtd/nand/vf610_nfc.c
@@ -0,0 +1,713 @@
+/*
+ * Copyright 2009-2015 Freescale Semiconductor, Inc. and others
+ *
+ * Description: MPC5125, VF610, MCF54418 and Kinetis K70 Nand driver.
+ * Jason ported to M54418TWR and MVFA5 (VF610).
+ * Authors: Stefan Agner 
+ *  Bill Pringlemeir 
+ *  Shaohui Xie 
+ *  Jason Jin 
+ *
+ * Based on original driver mpc5121_nfc.c.
+ *
+ * This 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 of the License, or
+ * (at your option) any later version.
+ *
+ * Limitations:
+ * - Untested on MPC5125 and M54418.
+ * - DMA not used.
+ * - 2K pages or less.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineDRV_NAME"vf610_nfc"
+
+/* Register Offsets */
+#define NFC_FLASH_CMD1 0x3F00
+#define NFC_FLASH_CMD2 0x3F04
+#define NFC_COL_ADDR   0x3F08
+#define NFC_ROW_ADDR   0x3F0c
+#define NFC_ROW_ADDR_INC   0x3F14
+#define NFC_FLASH_STATUS1  0x3F18
+#define NFC_FLASH_STATUS2  0x3F1c
+#define NFC_CACHE_SWAP 0x3F28
+#define NFC_SECTOR_SIZE0x3F2c
+#define NFC_FLASH_CONFIG   0x3F30
+#define NFC_IRQ_STATUS 0x3F38
+
+/* Addresses for NFC MAIN RAM BUFFER areas */
+#define NFC_MAIN_AREA(n)   ((n) *  0x1000)
+
+#define PAGE_2K0x0800
+#define OOB_64 0x0040
+
+/*
+ * NFC_CMD2[CODE] values. See section:
+ *  - 31.4.7 Flash Command Code Description, Vybrid manual
+ *  - 23.8.6 Flash Command Sequencer, MPC5125 manual
+ *
+ * Briefly these are bitmasks of controller cycles.
+ */
+#define READ_PAGE_CMD_CODE 0x7EE0
+#define PROGRAM_PAGE_CMD_CODE  0x7FC0
+#define ERASE_CMD_CODE 0x4EC0
+#define READ_ID_CMD_CODE   0x4804
+#define RESET_CMD_CODE 0x4040
+#define STATUS_READ_CMD_CODE   0x4068
+
+/* NFC ECC mode define */
+#define ECC_BYPASS 0
+
+/*** Register Mask and bit definitions */
+
+/* NFC_FLASH_CMD1 Fie

arm64 crash in today's next due to 'blk-mq: fix use of incorrect goto label in blk_mq_init_queue error path'

2015-03-13 Thread Guenter Roeck

I see an arm64 crash in today's -next.

[] blk_mq_freeze_queue_start+0x38/0x54
[] blk_mq_update_tag_set_depth+0x2c/0xb8
[] blk_mq_init_allocated_queue+0x6e4/0x71c
[] blk_mq_init_queue+0x2c/0x6c
[] loop_add+0xc0/0x24c
[] loop_init+0x134/0x190
[] do_one_initcall+0x88/0x1a8
[] kernel_init_freeable+0x140/0x1e8
[] kernel_init+0xc/0xdc

See 
http://server.roeck-us.net:8010/builders/qemu-arm64-next/builds/132/steps/qemubuildcommand/logs/stdio
for a complete log.

Bisect results:

# bad: [4516740d361710d8a554749c63a75b410edd2fdc] fs: btrfs: Add missing 
include file
# good: [9eccca0843205f87c00404b663188b88eb248051] Linux 4.0-rc3
git bisect start 'HEAD' 'v4.0-rc3'
# good: [07534ed768c6b5d4ffa048e643597e7d0690b572] Merge remote-tracking branch 
'sound/for-next'
git bisect good 07534ed768c6b5d4ffa048e643597e7d0690b572
# bad: [b27544a5a14c901833f254f8bd17bdc132a7a765] Merge remote-tracking branch 
'tty/tty-next'
git bisect bad b27544a5a14c901833f254f8bd17bdc132a7a765
# bad: [a16a3cc1cb1e956e294b5e36d1f9e082406676a5] Merge remote-tracking branch 
'spi/for-next'
git bisect bad a16a3cc1cb1e956e294b5e36d1f9e082406676a5
# bad: [c4b2457b90df42abe46e463d5da149c9a4515262] Merge remote-tracking branch 
'md/for-next'
git bisect bad c4b2457b90df42abe46e463d5da149c9a4515262
# good: [c96db850880a5f76d727725607ab82c4733d1c60] Merge remote-tracking branch 
'input/next'
git bisect good c96db850880a5f76d727725607ab82c4733d1c60
# bad: [b083904c28374ec4d1f4bbeafb7faa68985e289f] Merge remote-tracking branch 
'device-mapper/for-next'
git bisect bad b083904c28374ec4d1f4bbeafb7faa68985e289f
# good: [c7b1fb7cfa638bdcb9ff71a55ce0a9b8554bf927] Merge branch 'for-3.20/core' 
into for-next
git bisect good c7b1fb7cfa638bdcb9ff71a55ce0a9b8554bf927
# good: [40852b59c07610139755a707fde327c4b33b8b26] dm: remove request-based 
logic from make_request_fn wrapper
git bisect good 40852b59c07610139755a707fde327c4b33b8b26
# bad: [716452cd27b145d611e4399e7cc35df6c943686e] blk-mq: add 
blk_mq_init_allocated_queue and export blk_mq_register_disk
git bisect bad 716452cd27b145d611e4399e7cc35df6c943686e
# good: [8124ec8334d7ffa0ca496a52c7351b9ed610fa03] dm: don't start current 
request if it would've merged with the previous
git bisect good 8124ec8334d7ffa0ca496a52c7351b9ed610fa03
# good: [5013e29ef8a49fd276150f566880766938dc0e20] dm: impose configurable 
deadline for dm_request_fn's merge heuristic
git bisect good 5013e29ef8a49fd276150f566880766938dc0e20
# bad: [c9e8c91f8a279b87eb0d94b037504ea9fc1bef7c] blk-mq: fix use of incorrect 
goto label in blk_mq_init_queue error path
git bisect bad c9e8c91f8a279b87eb0d94b037504ea9fc1bef7c
# first bad commit: [c9e8c91f8a279b87eb0d94b037504ea9fc1bef7c] blk-mq: fix use 
of incorrect goto label in blk_mq_init_queue error path

Looking into the patch, this is not surprising, since 'q' is now used before it 
is allocated.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/6] mtd: nand: vf610_nfc: add device tree bindings

2015-03-13 Thread Stefan Agner
Signed-off-by: Bill Pringlemeir 
Signed-off-by: Stefan Agner 
---
 .../devicetree/bindings/mtd/vf610-nfc.txt  | 45 ++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/vf610-nfc.txt

diff --git a/Documentation/devicetree/bindings/mtd/vf610-nfc.txt 
b/Documentation/devicetree/bindings/mtd/vf610-nfc.txt
new file mode 100644
index 000..5f0d344
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/vf610-nfc.txt
@@ -0,0 +1,45 @@
+Freescale's NAND flash controller (NFC)
+
+This variant of the Freescale NAND flash controller (NFC) is on Vybrid (vf610),
+MPC5125, MCF54418 and Kinetis K70.
+
+Required properties:
+- compatible: "fsl,vf610-nfc"
+- reg: address range of the NFC
+- interrupts: interrupt of the NFC
+- nand-bus-width: see nand.txt
+- nand-ecc-mode: see nand.txt
+- nand-on-flash-bbt: see nand.txt
+- assigned-clocks: main clock from the SoC, for Vybrid <&clks VF610_CLK_NFC>;
+- assigned-clock-rates: The NAND bus timing is derived from this clock
+rate and should not exceed maximum timing for any NAND memory chip
+in a board stuffing. Typical NAND memory timings derived from this
+clock are found in the SoC hardware reference manual. Furthermore,
+there might be restrictions on maximum rates when using hardware ECC.
+
+- #address-cells, #size-cells : Must be present if the device has sub-nodes
+  representing partitions.
+
+Required properties for hardware ECC:
+- nand-ecc-strength: supported strengths are 24 and 32 bit (see nand.txt)
+- nand-ecc-step-size: step size equals page size, currently only 2k pages are
+supported
+
+Example:
+
+   nfc: nand@400e {
+   compatible = "fsl,vf610-nfc";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   reg = <0x400e 0x4000>;
+   interrupts = ;
+   clocks = <&clks VF610_CLK_NFC>;
+   clock-names = "nfc";
+   assigned-clocks = <&clks VF610_CLK_NFC>;
+   assigned-clock-rates = <3300>;
+   nand-bus-width = <8>;
+   nand-ecc-mode = "hw";
+   nand-on-flash-bbt;
+   nand-ecc-strength = <32>;
+   nand-ecc-step-size = <2048>;
+   };
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 4/6] ARM: vf610: enable NAND Flash Controller

2015-03-13 Thread Stefan Agner
Enable the NAND Flash Controller driver which is part of the Vybrid
SoC by default.

Signed-off-by: Stefan Agner 
---
 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index c8dffce..182e30e 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -635,6 +635,7 @@ config SOC_VF610
select ARM_GIC
select PINCTRL_VF610
select PL310_ERRATA_769419 if CACHE_L2X0
+   select HAVE_NAND_VF610_NFC
 
help
  This enable support for Freescale Vybrid VF610 processor.
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/6] mtd: nand: vf610_nfc: add hardware BCH-ECC support

2015-03-13 Thread Stefan Agner
This adds hardware ECC support using the BCH encoder in the NFC IP.
The ECC encoder supports up to 32-bit correction by using 60 error
correction bytes. There is no sub-page ECC step, ECC is calculated
always accross the whole page (up to 2k pages).

Signed-off-by: Bill Pringlemeir 
Signed-off-by: Stefan Agner 
---
 drivers/mtd/nand/Kconfig |   6 +-
 drivers/mtd/nand/vf610_nfc.c | 193 +--
 2 files changed, 172 insertions(+), 27 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 1be30a6..0fb97b3 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -464,8 +464,10 @@ config MTD_NAND_VF610_NFC
help
  Enables support for NAND Flash Controller on some Freescale
  processors like the VF610, MPC5125, MCF54418 or Kinetis K70.
- The driver supports a maximum 2k page size. The driver
- currently does not support hardware ECC.
+ The driver supports a maximum 2k page size. With 2k pages and
+ 64 bytes or more of OOB, hardware ECC with up to 32-bit error
+ correction is supported. Hardware ECC is only enabled through
+ device tree.
 
 config MTD_NAND_MXC
tristate "MXC NAND support"
diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
index 5c8be4a..3540168 100644
--- a/drivers/mtd/nand/vf610_nfc.c
+++ b/drivers/mtd/nand/vf610_nfc.c
@@ -19,6 +19,7 @@
  * - Untested on MPC5125 and M54418.
  * - DMA not used.
  * - 2K pages or less.
+ * - Only 2K page w. 64+OOB and hardware ECC.
  */
 
 #include 
@@ -71,6 +72,8 @@
 
 /* NFC ECC mode define */
 #define ECC_BYPASS 0
+#define ECC_45_BYTE6
+#define ECC_60_BYTE7
 
 /*** Register Mask and bit definitions */
 
@@ -103,6 +106,8 @@
 #define STATUS_BYTE1_MASK  0x00FF
 
 /* NFC_FLASH_CONFIG Field */
+#define CONFIG_ECC_SRAM_ADDR_MASK  0x7FC0
+#define CONFIG_ECC_SRAM_ADDR_SHIFT 22
 #define CONFIG_ECC_SRAM_REQ_BIT(1<<21)
 #define CONFIG_DMA_REQ_BIT (1<<20)
 #define CONFIG_ECC_MODE_MASK   0x000E
@@ -123,12 +128,31 @@
 
 #define NFC_TIMEOUT(HZ)
 
+/* ECC status placed at end of buffers. */
+#define ECC_SRAM_ADDR  ((PAGE_2K+256-8) >> 3)
+#define ECC_STATUS_MASK0x80
+#define ECC_ERR_COUNT  0x3F
+
+/*
+ * ECC status is stored at NFC_CFG[ECCADD] +4 for little-endian
+ * and +7 for big-endian SoCs.
+ */
+#ifdef CONFIG_SOC_VF610
+#define ECC_OFFSET 4
+#else
+#define ECC_OFFSET 7
+#endif
+
 struct vf610_nfc_config {
+   bool hardware_ecc;
+   int ecc_strength;
+   int ecc_step_size;
int width;
int flash_bbt;
+   u32 ecc_mode;
 };
 
-struct fsl_nfc {
+struct vf610_nfc {
struct mtd_infomtd;
struct nand_chip   chip;
struct device *dev;
@@ -148,27 +172,32 @@ struct fsl_nfc {
 
 #define mtd_to_nfc(_mtd) container_of(_mtd, struct vf610_nfc, mtd)
 
-static u8 bbt_pattern[] = {'B', 'b', 't', '0' };
-static u8 mirror_pattern[] = {'1', 't', 'b', 'B' };
-
-static struct nand_bbt_descr bbt_main_descr = {
-   .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE |
-  NAND_BBT_2BIT | NAND_BBT_VERSION,
-   .offs = 11,
-   .len = 4,
-   .veroffs = 15,
-   .maxblocks = 4,
-   .pattern = bbt_pattern,
+static struct nand_ecclayout vf610_nfc_ecc45 = {
+   .eccbytes = 45,
+   .eccpos = {19, 20, 21, 22, 23,
+  24, 25, 26, 27, 28, 29, 30, 31,
+  32, 33, 34, 35, 36, 37, 38, 39,
+  40, 41, 42, 43, 44, 45, 46, 47,
+  48, 49, 50, 51, 52, 53, 54, 55,
+  56, 57, 58, 59, 60, 61, 62, 63},
+   .oobfree = {
+   {.offset = 2,
+.length = 17} }
 };
 
-static struct nand_bbt_descr bbt_mirror_descr = {
-   .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE |
-  NAND_BBT_2BIT | NAND_BBT_VERSION,
-   .offs = 11,
-   .len = 4,
-   .veroffs = 15,
-   .maxblocks = 4,
-   .pattern = mirror_pattern,
+static struct nand_ecclayout vf610_nfc_ecc60 = {
+   .eccbytes = 60,
+   .eccpos = { 4,  5,  6,  7,  8,  9, 10, 11,
+  12, 13, 14, 15, 16, 17, 18, 19,
+  20, 21, 22, 23, 24, 25, 26, 27,
+  28, 29, 30, 31, 32, 33, 34, 35,
+  36, 37, 38, 39, 40, 41, 42, 43,
+  44, 45, 46, 47, 48, 49, 50, 51,
+  52, 53, 54, 55, 56, 57, 58, 59,
+  60, 61, 62, 63 },
+   .oobfree = {
+   {.offset = 2,
+.length = 2} }
 };
 
 static inline u32 vf610_nfc_read(struct vf610_nfc *nfc, uint reg)
@@ -469,6 +498,60 @@ static void vf610_nfc_select_chip(struct mtd_info *mtd, 
int chip)
 #endif
 }
 
+/* Count the number of 0's in buff up to max_bits *

Re: [PATCH v3 10/15] serial: stm32-usart: Add STM32 USART Driver

2015-03-13 Thread Paul Bolle
Just a license nit, I'm afraid.

On Thu, 2015-03-12 at 22:55 +0100, Maxime Coquelin wrote:
> --- /dev/null
> +++ b/drivers/tty/serial/stm32-usart.c
> @@ -0,0 +1,695 @@
> +/*
> + * Copyright (C) Maxime Coquelin 2015
> + * Author:  Maxime Coquelin 
> + * License terms:  GNU General Public License (GPL), version 2
> + *
> + * Inspired by st-asc.c from STMicroelectronics (c)
> + */

This states the license is GPL v2.

> +MODULE_LICENSE("GPL");

And
MODULE_LICENSE("GPL v2");

would match that statement.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 3/3] ARM: dts: vf610: add Miscellaneous System Control Module (MSCM)

2015-03-13 Thread Stefan Agner
On 2015-03-13 05:48, Shawn Guo wrote:
> On Thu, Mar 12, 2015 at 10:03:08AM +0100, Stefan Agner wrote:
>> On 2015-03-11 01:48, Shawn Guo wrote:
>> > On Sun, Mar 01, 2015 at 11:41:29PM +0100, Stefan Agner wrote:
>> >> Add the Miscellaneous System Control Module (MSCM) to the base
>> >> device tree for Vybrid SoC's. This module contains registers
>> >> to get information of the individual and current (accessing)
>> >> CPU. In a second block, there is an interrupt router, which
>> >> handles the routing of the interrupts between the two CPU cores
>> >> on VF6xx variants of the SoC. However, also on single core
>> >> variants the interrupt router needs to be configured in order
>> >> to receive interrupts on the CPU's interrupt controller. Almost
>> >> all peripheral interrupts are routed through the router, hence
>> >> the MSCM module is the default interrupt parent for this SoC.
>> >>
>> >> In a earlier commit the interrupt nodes were moved out of the
>> >> peripheral nodes and specified in the CPU specific vf500.dtsi
>> >> device tree. This allowed to use the base device tree vfxxx.dtsi
>> >> also for a Cortex-M4 specific device tree, which uses different
>> >> interrupt nodes due to the NVIC interrupt controller. However,
>> >> since the interrupt parent for peripherals is the MSCM module
>> >> independently which CPU the device tree is used for, we can move
>> >> the interrupt nodes into the base device tree vfxxx.dtsi again.
>> >> Depending on which CPU this base device tree will be used with,
>> >> the correct parent interrupt controller has to be assigned to
>> >> the MSCM-IR node (GIC or NVIC). The driver takes care of the
>> >> parent interrupt controller specific needs (interrupt-cells).
>> >>
>> >> Acked-by: Marc Zyngier 
>> >> Signed-off-by: Stefan Agner 
>> >
>> > Stefan,
>> >
>> > I guess this patch has a run-time dependency on the first two in the
>> > series, right?  Or put it another way, if I apply this single patch on
>> > my branch, the dtb and kernel built from the same branch do not work
>> > together, right?  If so, we will need to either wait for the first two
>> > hit mainline or pull Jason's irqchip/vybrid branch into my tree as
>> > prerequisite (irqchip/vybrid needs to be stable).
>> >
>> > Shawn
>>
>> Yes, that is true. The driver need to be in place in order to
>> successfully boot with the new device tree.
> 
> Okay.  Pulled Jason's irqchip/vybrid branch in, and applied the patch.
> 
> Stefan,
> 
> There was a conflict on device dspi1 when applying the patch to my
> imx/dt branch.  Please take a look to see if I solved it correctly.
> 

Hi Shawn,

Your updated patch looks good to me. Also quickly boot tested the
branch, worked fine.

Thx!

--
Stefan


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf callchain: separate eh/debug frame offset cache.

2015-03-13 Thread Namhyung Kim
Hi Wang,

On Fri, Mar 13, 2015 at 03:02:56PM +0800, Wang Nan wrote:
> Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for
> dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr.
> Unfortunately, it makes them share a same cache (dso->frame_offset).
> Which causes unwind failure on ARM:
> 
>$ perf test unwind
>   Test dwarf unwind: FAILED!
> 
> The reason is that, if a dso has '.debug_frame' but doesn't have
> '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset
> of '.debug_frame' during the first time calling of find_proc_info() ->
> read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when
> the second time calling of find_proc_info() ->
> read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to
> '.debug_frame'.
> 
> This patch solves the problem by creating two cache fields for
> '.eh_frame_hdr' and '.debug_frame'.
> 
> Signed-off-by: Wang Nan 

Acked-by: Namhyung Kim 

Thanks,
Namhyung


> ---
>  tools/perf/util/dso.h  | 3 ++-
>  tools/perf/util/unwind-libunwind.c | 8 
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> index ced9284..408c65f 100644
> --- a/tools/perf/util/dso.h
> +++ b/tools/perf/util/dso.h
> @@ -139,7 +139,8 @@ struct dso {
>   u32  status_seen;
>   size_t   file_size;
>   struct list_head open_entry;
> - u64  frame_offset;
> + u64  debug_frame_offset;
> + u64  eh_frame_hdr_offset;
>   } data;
> 
>   union { /* Tool specific area */
> diff --git a/tools/perf/util/unwind-libunwind.c 
> b/tools/perf/util/unwind-libunwind.c
> index e3c40a5..7b09a44 100644
> --- a/tools/perf/util/unwind-libunwind.c
> +++ b/tools/perf/util/unwind-libunwind.c
> @@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, 
> struct machine *machine,
>u64 *fde_count)
>  {
>   int ret = -EINVAL, fd;
> - u64 offset = dso->data.frame_offset;
> + u64 offset = dso->data.eh_frame_hdr_offset;
> 
>   if (offset == 0) {
>   fd = dso__data_fd(dso, machine);
> @@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, 
> struct machine *machine,
> 
>   /* Check the .eh_frame section for unwinding info */
>   offset = elf_section_offset(fd, ".eh_frame_hdr");
> - dso->data.frame_offset = offset;
> + dso->data.eh_frame_hdr_offset = offset;
>   }
> 
>   if (offset)
> @@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
>   struct machine *machine, u64 *offset)
>  {
>   int fd;
> - u64 ofs = dso->data.frame_offset;
> + u64 ofs = dso->data.debug_frame_offset;
> 
>   if (ofs == 0) {
>   fd = dso__data_fd(dso, machine);
> @@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
> 
>   /* Check the .debug_frame section for unwinding info */
>   ofs = elf_section_offset(fd, ".debug_frame");
> - dso->data.frame_offset = ofs;
> + dso->data.debug_frame_offset = ofs;
>   }
> 
>   *offset = ofs;
> --
> 1.8.3.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 1/6] drm: Add top level Kconfig option for DRM fbdev emulation

2015-03-13 Thread Jani Nikula
On Fri, 13 Mar 2015, Daniel Vetter  wrote:
> #if defined(CONFIG_FB)
> #include 
> #else

Side note, #if IS_ENABLED(CONFIG_FB)

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: fix a segfault problem.

2015-03-13 Thread Namhyung Kim
On Fri, Mar 13, 2015 at 08:41:32AM +, Wang Nan wrote:
> Without this patch, perf report cause segfault if pass "" as '-t':
> 
>   $ perf report -t ""
> 
> # To display the perf.data header info, please use --header/--header-only 
> options.
> #
> # Samples: 37  of event 'syscalls:sys_enter_write'
> # Event count (approx.): 37
> #
> # ChildrenSelfCommand   Shared Object Symbol
> Segmentation fault
> 
> This patch avoid the segfault by checking empty string for
> 'symbol_conf.field_sep'.

What about resetting it to NULL if empty string was given?

Thanks,
Namhyung


> 
> Signed-off-by: Wang Nan 
> ---
>  tools/perf/util/sort.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 4593f36..7f563a0 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -31,7 +31,8 @@ static int repsep_snprintf(char *bf, size_t size, const 
> char *fmt, ...)
>  
>   va_start(ap, fmt);
>   n = vsnprintf(bf, size, fmt, ap);
> - if (symbol_conf.field_sep && n > 0) {
> + if (symbol_conf.field_sep && n > 0 &&
> + (symbol_conf.field_sep[0] != '\0')) {
>   char *sep = bf;
>  
>   while (1) {
> -- 
> 1.8.3.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] x86/fpu: document user_fpu_begin()

2015-03-13 Thread Borislav Petkov
On Wed, Mar 11, 2015 at 06:34:09PM +0100, Oleg Nesterov wrote:
> Currently user_fpu_begin() has a single caller and it is not clear that
> why do we actually need it, and why we should not worry about preemption
> right after preempt_enable().
> 
> Signed-off-by: Oleg Nesterov 
> ---
>  arch/x86/include/asm/fpu-internal.h |4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/include/asm/fpu-internal.h 
> b/arch/x86/include/asm/fpu-internal.h
> index 4bec98f..c615ae9 100644
> --- a/arch/x86/include/asm/fpu-internal.h
> +++ b/arch/x86/include/asm/fpu-internal.h
> @@ -464,7 +464,9 @@ static inline int restore_xstate_sig(void __user *buf, 
> int ia32_frame)
>   * Need to be preemption-safe.
>   *
>   * NOTE! user_fpu_begin() must be used only immediately before restoring
> - * it. This function does not do any save/restore on their own.
> + * it. This function does not do any save/restore on its own. In a lazy
> + * fpu mode this is just optimization to avoid a dna fault, the task can
> + * lose FPU right after preempt_enable().
>   */

I cleaned it up a bit more, if you don't mind:

---
From: Oleg Nesterov 
Date: Wed, 11 Mar 2015 18:34:09 +0100
Subject: [PATCH] x86/fpu: Document user_fpu_begin()

Currently, user_fpu_begin() has a single caller and it is not clear why
do we actually need it and why we should not worry about preemption
right after preempt_enable().

Signed-off-by: Oleg Nesterov 
Cc: Andy Lutomirski 
Cc: Linus Torvalds 
Cc: Pekka Riikonen 
Cc: Rik van Riel 
Cc: Suresh Siddha 
Cc: Fenghua Yu 
Cc: Quentin Casasnovas 
Cc: Dave Hansen 
Cc: Ingo Molnar 
Link: http://lkml.kernel.org/r/20150311173409.gc5...@redhat.com
Signed-off-by: 
---
 arch/x86/include/asm/fpu-internal.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/fpu-internal.h 
b/arch/x86/include/asm/fpu-internal.h
index 810f20fd4e4e..e8ee3da3b924 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -508,10 +508,12 @@ static inline int restore_xstate_sig(void __user *buf, 
int ia32_frame)
 }
 
 /*
- * Need to be preemption-safe.
+ * Needs to be preemption-safe.
  *
  * NOTE! user_fpu_begin() must be used only immediately before restoring
- * it. This function does not do any save/restore on their own.
+ * the save state. It does not do any saving/restoring on its own. In
+ * lazy FPU mode, it is just an optimization to avoid a #NM exception,
+ * the task can lose the FPU right after preempt_enable().
  */
 static inline void user_fpu_begin(void)
 {
-- 

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] arm/dts/ls1021a: Add a TFT LCD panel dts node for DCU

2015-03-13 Thread Jianwei Wang
Add a required display-timings node for the TFT LCD panel
the TFT LCD panel is WQVGA "480x272", and the bpp is 24.

Signed-off-by: Alison Wang 
Signed-off-by: Xiubo Li 
Signed-off-by: Jianwei Wang 
---
 arch/arm/boot/dts/ls1021a-twr.dts | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/ls1021a-twr.dts 
b/arch/arm/boot/dts/ls1021a-twr.dts
index a2c591e..4780b11 100644
--- a/arch/arm/boot/dts/ls1021a-twr.dts
+++ b/arch/arm/boot/dts/ls1021a-twr.dts
@@ -58,6 +58,32 @@
};
 };
 
+&dcu {
+   display = <&display>;
+   status = "okay";
+
+   display: display@0 {
+   bits-per-pixel = <24>;
+
+   display-timings {
+   native-mode = <&timing0>;
+   timing0: nl4827hc19 {
+   clock-frequency = <1087>;
+   hactive = <480>;
+   vactive = <272>;
+   hback-porch = <2>;
+   hfront-porch = <2>;
+   vback-porch = <2>;
+   vfront-porch = <2>;
+   hsync-len = <41>;
+   vsync-len = <4>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
+};
+
 &dspi1 {
bus-num = <0>;
status = "okay";
-- 
2.1.0.27.g96db324

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] arm/dts/ls1021a: Add DCU dts node

2015-03-13 Thread Jianwei Wang
Add DCU node, DCU is a display controller of Freescale
named 2D-ACE.

Signed-off-by: Alison Wang 
Signed-off-by: Xiubo Li 
Signed-off-by: Jianwei Wang 
---
 arch/arm/boot/dts/ls1021a.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
index c70bb27..ea83bdc 100644
--- a/arch/arm/boot/dts/ls1021a.dtsi
+++ b/arch/arm/boot/dts/ls1021a.dtsi
@@ -383,6 +383,16 @@
 <&platform_clk 1>;
};
 
+   dcu: dcu@2ce {
+   compatible = "fsl,dcu";
+   reg = <0x0 0x2ce 0x0 0x1>;
+   interrupts = ;
+   clocks = <&platform_clk 0>;
+   clock-names = "dcu";
+   big-endian;
+   status = "disabled";
+   };
+
mdio0: mdio@2d24000 {
compatible = "gianfar";
device_type = "mdio";
-- 
2.1.0.27.g96db324

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/7] Add simple EEPROM Framework via regmap.

2015-03-13 Thread Srinivas Kandagatla
Thankyou all for providing inputs and comments on previous versions of this
patchset. Here is the v2 of the patchset addressing all the issues raised as
part of previous versions review.

This patchset adds a new simple EEPROM framework to kernel.

Up until now, EEPROM drivers were stored in drivers/misc, where they all had to
duplicate pretty much the same code to register a sysfs file, allow in-kernel
users to access the content of the devices they were driving, etc.

This was also a problem as far as other in-kernel users were involved, since
the solutions used were pretty much different from on driver to another, there
was a rather big abstraction leak.

This introduction of this framework aims at solving this. It also introduces DT
representation for consumer devices to go get the data they require (MAC
Addresses, SoC/Revision ID, part numbers, and so on) from the EEPROMs.

Having regmap interface to this framework would give much better
abstraction for eeproms on different buses.

patch 1-3 Introduces the EEPROM framework.
Patch 4 migrates an existing driver to eeprom framework.
Patch 5-6 Adds Qualcomm specific qfprom driver.
Patch 7 adds entry in MAINTAINERS.

Its also possible to migrate other eeprom drivers to this framework.
Patch 6 can also be made a generic mmio-eeprom driver.

Providers APIs:
eeprom_register/unregister();

Consumers APIs:
eeprom_cell_get()/of_eeprom_cell_get()/of_eeprom_cell_get_byname();
eeprom_cell_read()/eeprom_cell_write();

Device Tree:

/* Provider */
qfprom: qfprom@0070 {
compatible  = "qcom,qfprom";
reg = <0x0070 0x1000>;
...

/* Data cells */
tsens_calibration: calib@404 {
reg = <0x404 0x10>;
};

serial_number: sn {
reg = <0x104 0x4>, <0x204 0x4>, <0x30c 0x4>;

};
...
};

/* Consumer node */
tsens: tsens {
...
eeproms = <&tsens_calibration>;
eeprom-names = "calib";
...
};

userspace interface:

hexdump /sys/class/eeprom/qfprom0/eeprom


  
000        
*
0a0 db10 2240  e000 0c00 0c00  0c00
000        
...
*
0001000


Changes since v1(https://lkml.org/lkml/2015/3/5/153)
 * Fix various Licencing issues spotted by Paul Bolle and Mark Brown
 * Allow eeprom core to build as module spotted by Paul Bolle.
 * Fix various kconfig issues spotted by Paul Bolle.
 * remove unessary atomic varible spotted by Mark Brown.
 * Few cleanups and common up some of the code in core.
 * Add qfprom bindings.

Changes since RFC(https://lkml.org/lkml/2015/2/19/307)
 * Fix documentation and error checks in read/write spotted by Andrew Lunn
 * Kconfig fix suggested by Stephen Boyd.
 * Add module owner suggested by Stephen Boyd and others.
 * Fix unsafe handling of eeprom in unregister spotted by Russell and Mark 
Brown.
 * seperate bindings patch as suggested by Rob.
 * Add MAINTAINERS as suggested by Rob.
 * Added support to allow reading eeprom for things like serial number which
  can be scatters across.
 * Added eeprom data using reg property suggested by Sascha and Stephen.
 * Added non-DT support.
 * Move kerneldoc to the src files spotted by Mark Brown.
 * Remove local list and do eeprom lookup by using class_find_device()


Thanks,
srini


Maxime Ripard (1):
  eeprom: sunxi: Move the SID driver to the eeprom framework

Srinivas Kandagatla (6):
  eeprom: Add a simple EEPROM framework for eeprom providers
  eeprom: Add a simple EEPROM framework for eeprom consumers
  eeprom: Add bindings for simple eeprom framework
  eeprom: qfprom: Add Qualcomm QFPROM support.
  eeprom: qfprom: Add bindings for qfprom
  eeprom: Add to MAINTAINERS for eeprom framework

 Documentation/ABI/testing/sysfs-driver-sunxi-sid   |  22 -
 .../bindings/eeprom/allwinner,sunxi-sid.txt|  21 +
 .../devicetree/bindings/eeprom/eeprom.txt  |  70 +++
 .../devicetree/bindings/eeprom/qfprom.txt  |  23 +
 .../bindings/misc/allwinner,sunxi-sid.txt  |  17 -
 MAINTAINERS|   9 +
 drivers/Kconfig|   2 +
 drivers/Makefile   |   1 +
 drivers/eeprom/Kconfig |  33 ++
 drivers/eeprom/Makefile|   9 +
 drivers/eeprom/core.c  | 517 +
 drivers/eeprom/eeprom-sunxi-sid.c  | 136 ++
 drivers/eeprom/qfprom.c| 

[PATCH v2 2/7] eeprom: Add a simple EEPROM framework for eeprom consumers

2015-03-13 Thread Srinivas Kandagatla
This patch adds just consumers part of the framework just to enable easy
review.

Up until now, EEPROM drivers were stored in drivers/misc, where they all had to
duplicate pretty much the same code to register a sysfs file, allow in-kernel
users to access the content of the devices they were driving, etc.

This was also a problem as far as other in-kernel users were involved, since
the solutions used were pretty much different from on driver to another, there
was a rather big abstraction leak.

This introduction of this framework aims at solving this. It also introduces DT
representation for consumer devices to go get the data they require (MAC
Addresses, SoC/Revision ID, part numbers, and so on) from the EEPROMs.

Having regmap interface to this framework would give much better
abstraction for eeproms on different buses.

Signed-off-by: Maxime Ripard 
[Maxime Ripard: intial version of the framework]
Signed-off-by: Srinivas Kandagatla 
---
 drivers/eeprom/core.c   | 304 
 include/linux/eeprom-consumer.h |  67 +
 2 files changed, 371 insertions(+)
 create mode 100644 include/linux/eeprom-consumer.h

diff --git a/drivers/eeprom/core.c b/drivers/eeprom/core.c
index a9839de..b87e136 100644
--- a/drivers/eeprom/core.c
+++ b/drivers/eeprom/core.c
@@ -16,6 +16,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,13 @@ struct eeprom_device {
int users;
 };
 
+struct eeprom_cell {
+   struct eeprom_device*eeprom;
+   int nblocks;
+   int size;
+   struct eeprom_block blocks[0];
+};
+
 static DEFINE_MUTEX(eeprom_mutex);
 static DEFINE_IDA(eeprom_ida);
 
@@ -121,6 +129,37 @@ static struct class eeprom_class = {
.dev_release= eeprom_release,
 };
 
+static int of_eeprom_match(struct device *dev, const void *eeprom_np)
+{
+   return dev->of_node == eeprom_np;
+}
+
+static struct eeprom_device *of_eeprom_find(struct device_node *eeprom_np)
+{
+   struct device *d;
+
+   if (!eeprom_np)
+   return NULL;
+
+   d = class_find_device(&eeprom_class, NULL, eeprom_np, of_eeprom_match);
+
+   return d ? to_eeprom(d) : NULL;
+}
+
+static int eeprom_match(struct device *dev, const void *data)
+{
+   return !strcmp(dev_name(dev), (const char *)data);
+}
+
+static struct eeprom_device *eeprom_find(const char *name)
+{
+   struct device *d;
+
+   d = class_find_device(&eeprom_class, NULL, (void *)name, eeprom_match);
+
+   return d ? to_eeprom(d) : NULL;
+}
+
 /**
  * eeprom_register(): Register a eeprom device for given eeprom.
  * Also creates an binary entry in /sys/class/eeprom/name-id/eeprom
@@ -194,6 +233,271 @@ int eeprom_unregister(struct eeprom_device *eeprom)
 }
 EXPORT_SYMBOL_GPL(eeprom_unregister);
 
+static int eeprom_cell_sanity_check(struct eeprom_cell *cell)
+{
+   struct eeprom_device *eeprom = cell->eeprom;
+   int i;
+
+   /* byte aligned, no need to check for stride sanity */
+   if (eeprom->stride == 1)
+   return 0;
+
+   for (i = 0; i < cell->nblocks; i++) {
+   if (!IS_ALIGNED(cell->blocks[i].offset, eeprom->stride) ||
+   !IS_ALIGNED(cell->blocks[i].count, eeprom->stride)) {
+   dev_err(&eeprom->dev,
+   "cell unaligned to eeprom stride %d\n",
+   eeprom->stride);
+   return -EINVAL;
+   }
+   }
+
+   return 0;
+}
+
+static struct eeprom_cell *__eeprom_cell_get(struct device_node *cell_np,
+const char *ename,
+struct eeprom_block *blocks,
+int nblocks)
+{
+   struct eeprom_cell *cell;
+   struct eeprom_device *eeprom = NULL;
+   struct property *prop;
+   const __be32 *vp;
+   u32 pv;
+   int i, rval;
+
+   mutex_lock(&eeprom_mutex);
+
+   eeprom = cell_np ? of_eeprom_find(cell_np->parent) : eeprom_find(ename);
+   if (!eeprom) {
+   mutex_unlock(&eeprom_mutex);
+   return ERR_PTR(-EPROBE_DEFER);
+   }
+
+   eeprom->users++;
+   mutex_unlock(&eeprom_mutex);
+
+   if (!try_module_get(eeprom->owner)) {
+   dev_err(&eeprom->dev,
+   "could not increase module refcount for cell %s\n",
+   ename);
+   rval = -EINVAL;
+   goto err_mod;
+   }
+
+   if (cell_np)
+   nblocks = of_property_count_u32_elems(cell_np, "reg") / 2;
+
+   cell = kzalloc(sizeof(*cell) + nblocks * sizeof(*blocks), GFP_KERNEL);
+   if (!cell) {
+   rval = -ENOMEM;
+   goto err_mem;
+   }
+
+   cell->nblocks = nblocks;
+   cell->eeprom = eeprom;
+   cell->size = 0;
+   i = 0;
+
+   if

[PATCH v2 4/7] eeprom: sunxi: Move the SID driver to the eeprom framework

2015-03-13 Thread Srinivas Kandagatla
From: Maxime Ripard 

Now that we have the EEPROM framework, we can consolidate the common driver
code. Move the driver to the framework, and hopefully, it will fix the sysfs
file creation race.

Signed-off-by: Maxime Ripard 
[srinivas.kandagatla: Moved to regmap based EEPROM framework]
Signed-off-by: Srinivas Kandagatla 
---
 Documentation/ABI/testing/sysfs-driver-sunxi-sid   |  22 ---
 .../bindings/eeprom/allwinner,sunxi-sid.txt|  21 +++
 .../bindings/misc/allwinner,sunxi-sid.txt  |  17 ---
 drivers/eeprom/Kconfig |  15 ++
 drivers/eeprom/Makefile|   3 +
 drivers/eeprom/eeprom-sunxi-sid.c  | 136 ++
 drivers/misc/eeprom/Kconfig|  13 --
 drivers/misc/eeprom/Makefile   |   1 -
 drivers/misc/eeprom/sunxi_sid.c| 156 -
 9 files changed, 175 insertions(+), 209 deletions(-)
 delete mode 100644 Documentation/ABI/testing/sysfs-driver-sunxi-sid
 create mode 100644 
Documentation/devicetree/bindings/eeprom/allwinner,sunxi-sid.txt
 delete mode 100644 
Documentation/devicetree/bindings/misc/allwinner,sunxi-sid.txt
 create mode 100644 drivers/eeprom/eeprom-sunxi-sid.c
 delete mode 100644 drivers/misc/eeprom/sunxi_sid.c

diff --git a/Documentation/ABI/testing/sysfs-driver-sunxi-sid 
b/Documentation/ABI/testing/sysfs-driver-sunxi-sid
deleted file mode 100644
index ffb9536..000
--- a/Documentation/ABI/testing/sysfs-driver-sunxi-sid
+++ /dev/null
@@ -1,22 +0,0 @@
-What:  /sys/devices/*//eeprom
-Date:  August 2013
-Contact:   Oliver Schinagl 
-Description:   read-only access to the SID (Security-ID) on current
-   A-series SoC's from Allwinner. Currently supports A10, A10s, A13
-   and A20 CPU's. The earlier A1x series of SoCs exports 16 bytes,
-   whereas the newer A20 SoC exposes 512 bytes split into sections.
-   Besides the 16 bytes of SID, there's also an SJTAG area,
-   HDMI-HDCP key and some custom keys. Below a quick overview, for
-   details see the user manual:
-   0x000  128 bit root-key (sun[457]i)
-   0x010  128 bit boot-key (sun7i)
-   0x020   64 bit security-jtag-key (sun7i)
-   0x028   16 bit key configuration (sun7i)
-   0x02b   16 bit custom-vendor-key (sun7i)
-   0x02c  320 bit low general key (sun7i)
-   0x040   32 bit read-control access (sun7i)
-   0x064  224 bit low general key (sun7i)
-   0x080 2304 bit HDCP-key (sun7i)
-   0x1a0  768 bit high general key (sun7i)
-Users: any user space application which wants to read the SID on
-   Allwinner's A-series of CPU's.
diff --git a/Documentation/devicetree/bindings/eeprom/allwinner,sunxi-sid.txt 
b/Documentation/devicetree/bindings/eeprom/allwinner,sunxi-sid.txt
new file mode 100644
index 000..cceaaf6
--- /dev/null
+++ b/Documentation/devicetree/bindings/eeprom/allwinner,sunxi-sid.txt
@@ -0,0 +1,21 @@
+Allwinner sunxi-sid
+
+Required properties:
+- compatible: "allwinner,sun4i-a10-sid" or "allwinner,sun7i-a20-sid"
+- reg: Should contain registers location and length
+
+= Data cells =
+Are child nodes of qfprom, bindings of which as described in
+bindings/eeprom/eeprom.txt
+
+Example for sun4i:
+   sid@01c23800 {
+   compatible = "allwinner,sun4i-a10-sid";
+   reg = <0x01c23800 0x10>
+   };
+
+Example for sun7i:
+   sid@01c23800 {
+   compatible = "allwinner,sun7i-a20-sid";
+   reg = <0x01c23800 0x200>
+   };
diff --git a/Documentation/devicetree/bindings/misc/allwinner,sunxi-sid.txt 
b/Documentation/devicetree/bindings/misc/allwinner,sunxi-sid.txt
deleted file mode 100644
index fabdf64..000
--- a/Documentation/devicetree/bindings/misc/allwinner,sunxi-sid.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Allwinner sunxi-sid
-
-Required properties:
-- compatible: "allwinner,sun4i-a10-sid" or "allwinner,sun7i-a20-sid"
-- reg: Should contain registers location and length
-
-Example for sun4i:
-   sid@01c23800 {
-   compatible = "allwinner,sun4i-a10-sid";
-   reg = <0x01c23800 0x10>
-   };
-
-Example for sun7i:
-   sid@01c23800 {
-   compatible = "allwinner,sun7i-a20-sid";
-   reg = <0x01c23800 0x200>
-   };
diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig
index 21e1847..fd4fa2f 100644
--- a/drivers/eeprom/Kconfig
+++ b/drivers/eeprom/Kconfig
@@ -9,3 +9,18 @@ menuconfig EEPROM
  from both the Linux Kernel and the userspace.
 
  If unsure, say no.
+
+if EEPROM
+
+config EEPROM_SUNXI_SID
+   tristate "Allwinner SoCs SID support"
+   depends on ARCH_SUNXI
+   select REGMAP_MMIO
+   help
+ This is a driver for the 'security ID' available on various Allwinner
+ devices.
+

[PATCH v2 1/7] eeprom: Add a simple EEPROM framework for eeprom providers

2015-03-13 Thread Srinivas Kandagatla
This patch adds just providers part of the framework just to enable easy
review.

Up until now, EEPROM drivers were stored in drivers/misc, where they all had to
duplicate pretty much the same code to register a sysfs file, allow in-kernel
users to access the content of the devices they were driving, etc.

This was also a problem as far as other in-kernel users were involved, since
the solutions used were pretty much different from on driver to another, there
was a rather big abstraction leak.

This introduction of this framework aims at solving this. It also introduces DT
representation for consumer devices to go get the data they require (MAC
Addresses, SoC/Revision ID, part numbers, and so on) from the EEPROMs.

Having regmap interface to this framework would give much better
abstraction for eeproms on different buses.

Signed-off-by: Maxime Ripard 
[Maxime Ripard: intial version of eeprom framework]
Signed-off-by: Srinivas Kandagatla 
---
 drivers/Kconfig |   2 +
 drivers/Makefile|   1 +
 drivers/eeprom/Kconfig  |  11 +++
 drivers/eeprom/Makefile |   5 +
 drivers/eeprom/core.c   | 213 
 include/linux/eeprom-provider.h |  47 +
 6 files changed, 279 insertions(+)
 create mode 100644 drivers/eeprom/Kconfig
 create mode 100644 drivers/eeprom/Makefile
 create mode 100644 drivers/eeprom/core.c
 create mode 100644 include/linux/eeprom-provider.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index c70d6e4..d7afc82 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -184,4 +184,6 @@ source "drivers/thunderbolt/Kconfig"
 
 source "drivers/android/Kconfig"
 
+source "drivers/eeprom/Kconfig"
+
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 527a6da..57eb5b0 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -165,3 +165,4 @@ obj-$(CONFIG_RAS)   += ras/
 obj-$(CONFIG_THUNDERBOLT)  += thunderbolt/
 obj-$(CONFIG_CORESIGHT)+= coresight/
 obj-$(CONFIG_ANDROID)  += android/
+obj-$(CONFIG_EEPROM)   += eeprom/
diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig
new file mode 100644
index 000..21e1847
--- /dev/null
+++ b/drivers/eeprom/Kconfig
@@ -0,0 +1,11 @@
+menuconfig EEPROM
+   tristate "EEPROM Support"
+   depends on OF
+   select REGMAP
+   help
+ Support for EEPROM alike devices.
+
+ This framework is designed to provide a generic interface to EEPROM
+ from both the Linux Kernel and the userspace.
+
+ If unsure, say no.
diff --git a/drivers/eeprom/Makefile b/drivers/eeprom/Makefile
new file mode 100644
index 000..250c95a
--- /dev/null
+++ b/drivers/eeprom/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for eeprom drivers.
+#
+
+obj-$(CONFIG_EEPROM)   += core.o
diff --git a/drivers/eeprom/core.c b/drivers/eeprom/core.c
new file mode 100644
index 000..a9839de
--- /dev/null
+++ b/drivers/eeprom/core.c
@@ -0,0 +1,213 @@
+/*
+ * EEPROM framework core.
+ *
+ * Copyright (C) 2015 Srinivas Kandagatla 
+ * Copyright (C) 2013 Maxime Ripard 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct eeprom_device {
+   struct regmap   *regmap;
+   int stride;
+   size_t  size;
+
+   struct module   *owner;
+   struct device   dev;
+   int id;
+   int users;
+};
+
+static DEFINE_MUTEX(eeprom_mutex);
+static DEFINE_IDA(eeprom_ida);
+
+#define to_eeprom(d) container_of(d, struct eeprom_device, dev)
+
+static ssize_t bin_attr_eeprom_read(struct file *filp, struct kobject *kobj,
+   struct bin_attribute *attr,
+   char *buf, loff_t offset, size_t count)
+{
+   struct device *dev = container_of(kobj, struct device, kobj);
+   struct eeprom_device *eeprom = to_eeprom(dev);
+   int rc;
+
+   if (offset > eeprom->size)
+   return -EINVAL;
+
+   if (offset + count > eeprom->size)
+   count = eeprom->size - offset;
+
+   rc = regmap_bulk_read(eeprom->regmap, offset,
+ buf, count/eeprom->stride);
+
+   if (IS_ERR_VALUE(rc))
+   return rc;
+
+   return count - count % eeprom->stride;
+}
+
+static ssize_t bin_attr_eeprom_write(struct file *filp, struct kobject *kobj,
+

[PATCH v2 3/7] eeprom: Add bindings for simple eeprom framework

2015-03-13 Thread Srinivas Kandagatla
This patch adds bindings for simple eeprom framework which allows eeprom
consumers to talk to eeprom providers to get access to eeprom cell data.

Signed-off-by: Maxime Ripard 
[Maxime Ripard: intial version of eeprom framework]
Signed-off-by: Srinivas Kandagatla 
---
 .../devicetree/bindings/eeprom/eeprom.txt  | 70 ++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/eeprom/eeprom.txt

diff --git a/Documentation/devicetree/bindings/eeprom/eeprom.txt 
b/Documentation/devicetree/bindings/eeprom/eeprom.txt
new file mode 100644
index 000..8348d18
--- /dev/null
+++ b/Documentation/devicetree/bindings/eeprom/eeprom.txt
@@ -0,0 +1,70 @@
+= EEPROM Data Device Tree Bindings =
+
+This binding is intended to represent the location of hardware
+configuration data stored in EEPROMs.
+
+On a significant proportion of boards, the manufacturer has stored
+some data on an EEPROM-like device, for the OS to be able to retrieve
+these information and act upon it. Obviously, the OS has to know
+about where to retrieve these data from, and where they are stored on
+the storage device.
+
+This document is here to document this.
+
+= Data providers =
+Contains bindings specific to provider drivers and data cells as children
+to this node.
+
+= Data cells =
+These are the child nodes of the provider which contain data cell
+information like offset and size in eeprom provider.
+
+Required properties:
+reg:   specifies the offset in byte within that storage device, and the length
+   in bytes of the data we care about.
+   There could be more then one offset-length pairs in this property.
+
+Optional properties:
+As required by specific data parsers/interpreters.
+
+For example:
+
+   /* Provider */
+   qfprom: qfprom@0070 {
+   compatible  = "qcom,qfprom";
+   reg = <0x0070 0x1000>;
+   ...
+
+   /* Data cells */
+   tsens_calibration: calib@404 {
+   reg = <0x404 0x10>;
+   };
+
+   serial_number: sn {
+   reg = <0x104 0x4>, <0x204 0x4>, <0x30c 0x4>;
+
+   };
+   ...
+   };
+
+= Data consumers =
+Are device nodes which consume eeprom data cells.
+
+Required properties:
+
+eeproms: List of phandle and data cell the device might be interested in.
+
+Optional properties:
+
+eeprom-names: List of data cell name strings sorted in the same order
+ as the eeproms property. Consumers drivers will use
+ eeprom-names to differentiate between multiple cells,
+ and hence being able to know what these cells are for.
+
+For example:
+
+   tsens {
+   ...
+   eeproms = <&tsens_calibration>;
+   eeprom-names = "calibration";
+   };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 7/7] eeprom: Add to MAINTAINERS for eeprom framework

2015-03-13 Thread Srinivas Kandagatla
This patch adds MAINTAINERS to eeprom framework.

Signed-off-by: Srinivas Kandagatla 
---
 MAINTAINERS | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d66a97d..ee7ba92 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3657,6 +3657,15 @@ T:   git git://git.alsa-project.org/alsa-kernel.git
 S: Maintained
 F: sound/usb/misc/ua101.c
 
+EEPROM FRAMEWORK
+M: Srinivas Kandagatla 
+M: Maxime Ripard 
+S: Maintained
+F: drivers/eeprom/
+F: Documentation/devicetree/bindings/eeprom/
+F: include/linux/eeprom-provider.h
+F: include/linux/eeprom-consumer.h
+
 EXTENSIBLE FIRMWARE INTERFACE (EFI)
 M: Matt Fleming 
 L: linux-...@vger.kernel.org
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 6/7] eeprom: qfprom: Add bindings for qfprom

2015-03-13 Thread Srinivas Kandagatla
This patch adds bindings for qfprom found in QCOM SOCs. QFPROM driver
is based on simple eeprom framework.

Signed-off-by: Srinivas Kandagatla 
---
 .../devicetree/bindings/eeprom/qfprom.txt  | 23 ++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/eeprom/qfprom.txt

diff --git a/Documentation/devicetree/bindings/eeprom/qfprom.txt 
b/Documentation/devicetree/bindings/eeprom/qfprom.txt
new file mode 100644
index 000..d5baed6
--- /dev/null
+++ b/Documentation/devicetree/bindings/eeprom/qfprom.txt
@@ -0,0 +1,23 @@
+= Qualcomm QFPROM device tree bindings =
+
+This binding is intended to represent QFPROM which is found in most QCOM SOCs.
+
+Required properties:
+- compatible: should be "qcom,qfprom"
+- reg: Should contain registers location and length
+
+= Data cells =
+Are child nodes of qfprom, bindings of which as described in
+bindings/eeprom/eeprom.txt
+
+Example:
+
+   qfprom: qfprom@0070 {
+   compatible  = "qcom,qfprom";
+   reg = <0x0070 0x1000>;
+   ...
+   /* Data cells */
+   tsens_calibration: calib@404 {
+   reg = <0x404 0x10>;
+   };
+   };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/7] eeprom: qfprom: Add Qualcomm QFPROM support.

2015-03-13 Thread Srinivas Kandagatla
This patch adds QFPROM support driver which is used by other drivers
like thermal sensor and cpufreq.

On MSM parts there are some efuses (called qfprom) these fuses store things like
calibration data, speed bins.. etc. Drivers like cpufreq, thermal sensors would
read out this data for configuring the driver.

Signed-off-by: Srinivas Kandagatla 
---
 drivers/eeprom/Kconfig  |  9 -
 drivers/eeprom/Makefile |  1 +
 drivers/eeprom/qfprom.c | 87 +
 3 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 drivers/eeprom/qfprom.c

diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig
index fd4fa2f..b77828b 100644
--- a/drivers/eeprom/Kconfig
+++ b/drivers/eeprom/Kconfig
@@ -23,4 +23,11 @@ config EEPROM_SUNXI_SID
  This driver can also be built as a module. If so, the module
  will be called eprom-sunxi-sid.
 
-endif
\ No newline at end of file
+config QCOM_QFPROM
+   tristate "QCOM QFPROM Support"
+   depends on EEPROM
+   select REGMAP_MMIO
+   help
+ Say y here to enable QFPROM support. The QFPROM provides access
+ functions for QFPROM data to rest of the drivers via eeprom interface.
+endif
diff --git a/drivers/eeprom/Makefile b/drivers/eeprom/Makefile
index 546a27c..9c1bb03 100644
--- a/drivers/eeprom/Makefile
+++ b/drivers/eeprom/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_EEPROM)+= core.o
 
 # Devices
 obj-$(CONFIG_EEPROM_SUNXI_SID) += eeprom-sunxi-sid.o
+obj-$(CONFIG_QCOM_QFPROM)  += qfprom.o
diff --git a/drivers/eeprom/qfprom.c b/drivers/eeprom/qfprom.c
new file mode 100644
index 000..7d9e5e9
--- /dev/null
+++ b/drivers/eeprom/qfprom.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2015 Srinivas Kandagatla 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct regmap_config qfprom_regmap_config = {
+   .reg_bits = 32,
+   .val_bits = 8,
+   .reg_stride = 1,
+};
+
+static struct eeprom_config econfig = {
+   .stride = 1,
+   .name = "qfprom",
+};
+
+static int qfprom_remove(struct platform_device *pdev)
+{
+   struct eeprom_device *eeprom = platform_get_drvdata(pdev);
+
+   return eeprom_unregister(eeprom);
+}
+
+static int qfprom_probe(struct platform_device *pdev)
+{
+   struct resource *res;
+   void __iomem *base;
+   struct device *dev = &pdev->dev;
+   struct eeprom_device *eeprom;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   base = devm_ioremap_resource(dev, res);
+   if (IS_ERR(base))
+   return PTR_ERR(base);
+
+   qfprom_regmap_config.max_register = resource_size(res) - 1;
+
+   econfig.regmap = devm_regmap_init_mmio(dev, base,
+  &qfprom_regmap_config);
+   if (IS_ERR(econfig.regmap)) {
+   dev_err(dev, "regmap init failed\n");
+   return PTR_ERR(econfig.regmap);
+   }
+   econfig.owner = THIS_MODULE;
+   econfig.dev = dev;
+   econfig.size = resource_size(res) - 1;
+   eeprom = eeprom_register(&econfig);
+   if (IS_ERR(eeprom))
+   return PTR_ERR(eeprom);
+
+   platform_set_drvdata(pdev, eeprom);
+   return 0;
+}
+
+static const struct of_device_id qfprom_of_match[] = {
+   { .compatible = "qcom,qfprom"},
+   {/* sentinel */},
+};
+MODULE_DEVICE_TABLE(of, qfprom_of_match);
+
+static struct platform_driver qfprom_driver = {
+   .probe = qfprom_probe,
+   .remove = qfprom_remove,
+   .driver = {
+   .name = "qcom,qfprom",
+   .of_match_table = qfprom_of_match,
+   },
+};
+module_platform_driver(qfprom_driver);
+MODULE_AUTHOR("Srinivas Kandagatla ");
+MODULE_DESCRIPTION("Qualcomm QFPROM driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -next] mm: MEMTEST depends on MEMBLOCK

2015-03-13 Thread Vladimir Murzin
On 13/03/15 09:03, Guenter Roeck wrote:
> Building alpha:allmodconfig fails with
> 
> mm/memtest.c: In function 'reserve_bad_mem':
> mm/memtest.c:38:2: error: implicit declaration of function 'memblock_reserve'
> mm/memtest.c: In function 'do_one_pass':
> mm/memtest.c:77:2: error: implicit declaration of function 
> 'for_each_free_mem_range'
> mm/memtest.c:77:73: error: expected ';' before '{' token
> 
> because it depends on MEMBLOCK which is not defined for the alpha
> architecture.
> 
> Fixes: 420c89e6185d ("mm: move memtest under mm")
> Cc: Vladimir Murzin 
> Signed-off-by: Guenter Roeck 
> ---
>  lib/Kconfig.debug | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 8b4e69a..dc1e69c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -1797,6 +1797,7 @@ config TEST_UDELAY
>  
>  config MEMTEST
>   bool "Memtest"
> + depends on MEMBLOCK
>   ---help---
> This option adds a kernel parameter 'memtest', which allows memtest
> to be set.
> 

Thanks for fixing it!

Acked-by: Vladimir Murzin 

Cheers
Vladimir

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Daniel Borkmann

On 03/13/2015 03:21 AM, Alexei Starovoitov wrote:

introduce user accessible mirror of in-kernel 'struct sk_buff':
struct __sk_buff {
 __u32 len;
 __u32 pkt_type;
 __u32 mark;
 __u32 ifindex;
 __u32 queue_mapping;
};

bpf programs can do:
struct __sk_buff *ptr;
var = ptr->pkt_type;

which will be compiled to bpf assembler as:
dst_reg = *(u32 *)(src_reg + 4) // 4 == offsetof(struct __sk_buff, pkt_type)

bpf verifier will check validity of access and will convert it to:
dst_reg = *(u8 *)(src_reg + offsetof(struct sk_buff, __pkt_type_offset))
dst_reg &= 7

since 'pkt_type' is a bitfield.

When pkt_type field is moved around, goes into different structure, removed or
its size changes, the function sk_filter_convert_ctx_access() would need to be
updated. Just like the function convert_bpf_extensions() in case of classic bpf.


For each member, I'd also add BUILD_BUG_ON()s similarly as we have in
convert_bpf_extensions(). That way, people won't forget to adjust the
code.

General idea for this offset map looks good, imho. Well defined members
that are already exported to uapi e.g. through classic socket filters or
other socket api places could be used here.


Signed-off-by: Alexei Starovoitov 

...

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 3fa1af8a58d7..66a82d6cd75b 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -168,4 +168,12 @@ enum bpf_func_id {
__BPF_FUNC_MAX_ID,
  };

+struct __sk_buff {
+   __u32 len;
+   __u32 pkt_type;
+   __u32 mark;
+   __u32 ifindex;
+   __u32 queue_mapping;
+};


I'd add a comment saying that fields may _only_ be safely added at
the end of the structure. Rearranging or removing members here,
naturally would break user space.

The remaining fields we export in classic BPF would be skb->hash,
skb->protocol, skb->vlan_tci, are we adding them as well to match
up functionality with classic BPF? For example, I can see hash being
useful as a key to be used with eBPF maps, etc.

...

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index e6b522496250..c22ebd36fa4b 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c

...

+/* convert load instructions that access fields of 'struct __sk_buff'
+ * into sequence of instructions that access fields of 'struct sk_buff'
+ */
+static int convert_ctx_accesses(struct verifier_env *env)
+{
+   struct bpf_insn *insn = env->prog->insnsi;
+   int insn_cnt = env->prog->len;
+   struct bpf_insn insn_buf[16];
+   struct bpf_prog *new_prog;
+   u32 cnt;
+   int i;
+
+   if (!env->prog->aux->ops->convert_ctx_access)
+   return 0;
+
+   for (i = 0; i < insn_cnt; i++, insn++) {
+   if (insn->code != (BPF_LDX | BPF_MEM | BPF_W))
+   continue;
+
+   if (insn->imm != PTR_TO_CTX) {
+   /* clear internal mark */
+   insn->imm = 0;
+   continue;
+   }
+
+   cnt = env->prog->aux->ops->
+   convert_ctx_access(insn->dst_reg, insn->src_reg,
+  insn->off, insn_buf);
+   if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf)) {
+   verbose("bpf verifier is misconfigured\n");
+   return -EINVAL;
+   }
+
+   if (cnt == 1) {
+   memcpy(insn, insn_buf, sizeof(*insn));
+   continue;
+   }
+
+   /* several new insns need to be inserted. Make room for them */
+   insn_cnt += cnt - 1;
+   new_prog = bpf_prog_realloc(env->prog,
+   bpf_prog_size(insn_cnt),
+   GFP_USER);
+   if (!new_prog)
+   return -ENOMEM;


Seems a bit expensive, do you think we could speculatively allocate a
bit more space in bpf_prog_load() when we detect that we have access
to ctx that we need to convert?


+   new_prog->len = insn_cnt;
+
+   memmove(new_prog->insnsi + i + cnt, new_prog->insns + i + 1,
+   sizeof(*insn) * (insn_cnt - i - cnt));
+
+   /* copy substitute insns in place of load instruction */
+   memcpy(new_prog->insnsi + i, insn_buf, sizeof(*insn) * cnt);
+
+   /* adjust branches in the whole program */
+   adjust_branches(new_prog, i, cnt - 1);
+
+   /* keep walking new program and skip insns we just inserted */
+   env->prog = new_prog;
+   insn = new_prog->insnsi + i + cnt - 1;
+   i += cnt - 1;
+   }
+
+   return 0;
+}
+
  static void free_states(struct verifier_env *env)
  {
struct verifier_state_list *sl, *sln;

...

diff --git a/net/core/filter.c b/net/core/filter.c
index 7a4eb7030dba..b5fcc7e2b608 100644
--- a/net/core/filte

Re: [RFC PATCH] Don't reset timestamps in include/generated if not needed

2015-03-13 Thread Michal Marek
Dne 13.3.2015 v 05:59 Masahiro Yamada napsal(a):
> 2015-03-11 19:01 GMT+09:00 Michal Marek :
>> We already have it and it is called "filechk." Valdis, can you check if
>> the below patch works equally well for you?
> 
> This looks almost nice, but a few comments below.

Thanks for the review!


>>  $(obj)/$(bounds-file): kernel/bounds.s Kbuild
> 
> You are checking the resulting file content,
> so the dependency on "Kbuild" is not necessary.
> 
> Instead, you need to add "FORCE" so that this rule is always invoked.

Good point.


>> $(Q)mkdir -p $(dir $@)
> 
> You can drop this line because filechk automatically creates the
> output directory.

Likewise.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-13 Thread Jianwei Wang
This patch add support for Two Dimensional Animation and Compositing
Engine (2D-ACE) on Freescale SoCs.

2D-ACE is a Freescale display controller. It provide an hardware
cursor.

This is a simplified version, only a primary plane, a fb created for
fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
encoder is not in use.

Signed-off-by: Alison Wang 
Signed-off-by: Xiubo Li 
Signed-off-by: Jianwei Wang 
---

Changed in v2:??
- Add atomic support
- Modify bindings file
- Rename node for compatibility
- Move platform related code out for compatibility

Added in v1:??
-??Add support for DCU display controller on the Freescale LS102x SoCs.
- Create a primary plane, a fb created for fbdev, a crtc, a connector
for TFT LCD panel, an encoder.

 arch/arm/mach-imx/mach-ls1021a.c|  36 
 drivers/gpu/drm/Kconfig |   2 +
 drivers/gpu/drm/Makefile|   1 +
 drivers/gpu/drm/fsl/Kconfig |  17 ++
 drivers/gpu/drm/fsl/Makefile|   8 +
 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c | 203 
 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h |  28 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c  | 164 
 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h  |  26 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c   | 288 
 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h   | 168 
 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c |  26 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c   |  42 
 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h   |  17 ++
 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c | 187 ++
 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h |  23 +++
 include/linux/fsl/dcu.h |  22 +++
 17 files changed, 1258 insertions(+)
 create mode 100644 drivers/gpu/drm/fsl/Kconfig
 create mode 100644 drivers/gpu/drm/fsl/Makefile
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
 create mode 100644 include/linux/fsl/dcu.h

diff --git a/arch/arm/mach-imx/mach-ls1021a.c b/arch/arm/mach-imx/mach-ls1021a.c
index b89c858..4fb346d 100644
--- a/arch/arm/mach-imx/mach-ls1021a.c
+++ b/arch/arm/mach-imx/mach-ls1021a.c
@@ -8,9 +8,44 @@
  */
 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include "common.h"
 
+void dcu_pixclk_disable(void)
+{
+   struct regmap *scfg_regmap;
+
+   scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
+   if (IS_ERR(scfg_regmap)) {
+   pr_err("No syscfg phandle specified\n");
+   return;
+   }
+
+   regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_DISABLE);
+}
+
+void dcu_pixclk_enable(void)
+{
+   struct regmap *scfg_regmap;
+
+   scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
+   if (IS_ERR(scfg_regmap)) {
+   pr_err("No syscfg phandle specified\n");
+   return;
+   }
+
+   regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_ENABLE);
+}
+
+static void __init ls1021a_init_machine(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   dcu_pixclk_enable();
+}
 static const char * const ls1021a_dt_compat[] __initconst = {
"fsl,ls1021a",
NULL,
@@ -18,5 +53,6 @@ static const char * const ls1021a_dt_compat[] __initconst = {
 
 DT_MACHINE_START(LS1021A, "Freescale LS1021A")
.smp= smp_ops(ls1021a_smp_ops),
+   .init_machine   = ls1021a_init_machine,
.dt_compat  = ls1021a_dt_compat,
 MACHINE_END
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..a6957aa 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig"
 
 source "drivers/gpu/drm/msm/Kconfig"
 
+source "drivers/gpu/drm/fsl/Kconfig"
+
 source "drivers/gpu/drm/tegra/Kconfig"
 
 source "drivers/gpu/drm/panel/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c239b9..ab5b9ef 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_ARMADA) += armada/
 obj-$(CONFIG_DRM_ATMEL_HLCDC)  += atmel-hlcdc/
+obj-$(CONFIG_DRM_FSL_DCU) += fsl/
 obj-$(CONFIG_DRM_RCAR_DU) += rcar-du/
 obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
 obj-$(CONFIG_DRM_OMAP) += omapdrm/
diff --git a

Re: [PATCH v2.0 0/3] ARM: AT91: pm cleanup for 4.1

2015-03-13 Thread Nicolas Ferre
Le 09/03/2015 04:43, Wenyou Yang a Ă©crit :
> Hi,
> 
> The patch series purpose is to clean up the AT91 PM code.
> 
> It is based on the branch: at91-4.0-fixes
> git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git
>   + [PATCH] ARM: at91: pm: change at91_pm_set_standby() to static
> 
> Change log for v2.0
>  - rebase on the branch: at91-4.0-fixes + the above patch. 
> 
> Wenyou Yang (3):
>   pm: at91: pm_slowclock: remove the unused code related with
> SLOWDOWN_MASTER_CLOCK
>   ARM: at91: move "select SRAM" under SOC_AT91SAM9 and SOC_SAMA5
>   pm: at91: remove CONFIG_AT91_SLOW_CLOCK config option

Whole series:
Acked-by: Nicolas Ferre 

And stacked on top of at91-4.1-cleanup: thanks for your patience Wenyou ;-)

> 
>  arch/arm/mach-at91/Kconfig|   17 +++--
>  arch/arm/mach-at91/Makefile   |2 +-
>  arch/arm/mach-at91/pm.c   |   12 +---
>  arch/arm/mach-at91/pm_slowclock.S |   37 
> -
>  4 files changed, 5 insertions(+), 63 deletions(-)
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/15] ARM: cns3xxx: don't export static symbol

2015-03-13 Thread Arnd Bergmann
On Friday 13 March 2015 06:59:38 Krzysztof Hałasa wrote:
> Arnd Bergmann  writes:
> 
> > Looks good. Krzysztof, do you want to pick this up and send me a
> > pull request together with other patches, or should I apply this
> > to the arm-soc fixes directly?
> 
> The latter, please.
> Acked-by: Krzysztof Hałasa 
> -- 

Applied to next/fixes-non-critical with your Ack, thanks!

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2.0 0/6] ARM: AT91: pm improvement for 4.1

2015-03-13 Thread Nicolas Ferre
Le 09/03/2015 04:47, Wenyou Yang a Ă©crit :
> Hi,
> 
> The patch series purpose is to improve the AT91 pm code.
>   Create a procedure to handle the sdram self-fresh mode.
>   The standby mode uses same sram function as the suspend to memory mode,
> 
> It is based on the branch, at91-4.0-fixes
> git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git
>   + [PATCH] ARM: AT91: pm cleanup for 4.1
> 
> Chang log for v2.0
>  - reserve the at91_xxx_standby() for at91_cpuidle_device.
>  - rebase
> 
> Wenyou Yang (6):
>   pm: at91: pm_slowclock: create the procedure to handle the sdram
> self-refresh
>   pm: at91: move the copying the sram function to the sram
> initializationi phase
>   pm: at91: standby mode uses the same sram function as suspend to
> memory mode
>   pm: at91: rename file name: pm_slowclock.S -->pm_suspend.S
>   pm: at91: rename function name:
> at91_slow_clock()-->at91_pm_suspend_sram_fn
>   pm: at91: remove unused void (*at91_pm_standby)(void)

Whole series:
Acked-by: Nicolas Ferre 

And stacked on top of at91-4.1-cleanup

Thanks.

BTW, I had to rework the commit subject as all AT91 patches must begin
with: "ARM: at91". So I reworked them as "ARM: at91/pm:"

Bye,

>  arch/arm/mach-at91/Makefile   |2 +-
>  arch/arm/mach-at91/pm.c   |  121 +++--
>  arch/arm/mach-at91/pm.h   |   10 ++
>  arch/arm/mach-at91/pm_slowclock.S |  296 ---
>  arch/arm/mach-at91/pm_suspend.S   |  349 
> +
>  5 files changed, 420 insertions(+), 358 deletions(-)
>  delete mode 100644 arch/arm/mach-at91/pm_slowclock.S
>  create mode 100644 arch/arm/mach-at91/pm_suspend.S
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: fix a segfault problem.

2015-03-13 Thread Wang Nan
On 2015/3/13 17:46, Namhyung Kim wrote:
> On Fri, Mar 13, 2015 at 08:41:32AM +, Wang Nan wrote:
>> Without this patch, perf report cause segfault if pass "" as '-t':
>>
>>   $ perf report -t ""
>>
>> # To display the perf.data header info, please use 
>> --header/--header-only options.
>> #
>> # Samples: 37  of event 'syscalls:sys_enter_write'
>> # Event count (approx.): 37
>> #
>> # ChildrenSelfCommand   Shared Object Symbol
>> Segmentation fault
>>
>> This patch avoid the segfault by checking empty string for
>> 'symbol_conf.field_sep'.
> 
> What about resetting it to NULL if empty string was given?
> 

In fact I'm not very clear why we need such 'symbol_conf.field_sep', so I'm
not sure whether '-t ""' is totally meanless or not.

-t option replaces a group of character with '.' and appends them after a field.
With -t 'abc' I get something like:

 #
 # OverheadabcCommand   abcShared ObjectabcSymbol
  100.00%abcb.beltr.ceabc[kernel.k.llsyms]abc[k] 0x810118f0
  ...

Hard to read...

I read docs and your commit messages, but still not understand the option. 
Could you
please explain the goal and usage of that option again?

Thank you.

> Thanks,
> Namhyung
> 
> 
>>
>> Signed-off-by: Wang Nan 
>> ---
>>  tools/perf/util/sort.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
>> index 4593f36..7f563a0 100644
>> --- a/tools/perf/util/sort.c
>> +++ b/tools/perf/util/sort.c
>> @@ -31,7 +31,8 @@ static int repsep_snprintf(char *bf, size_t size, const 
>> char *fmt, ...)
>>  
>>  va_start(ap, fmt);
>>  n = vsnprintf(bf, size, fmt, ap);
>> -if (symbol_conf.field_sep && n > 0) {
>> +if (symbol_conf.field_sep && n > 0 &&
>> +(symbol_conf.field_sep[0] != '\0')) {
>>  char *sep = bf;
>>  
>>  while (1) {
>> -- 
>> 1.8.3.4
>>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] pinctrl: mediatek: Adjust mt8173 pinctrl kconfig

2015-03-13 Thread Arnd Bergmann
On Friday 13 March 2015 14:46:35 Yingjoe Chen wrote:
> > which will let you turn on the options if COMPILE_TEST is set, but not
> > let you turn them off when the drivers are required.
> 
> Yes, this is preferred. Because we don't have MACH_MT8173, so it is
> possible a ARM64 + ARCH_MEDIATEK system doesn't need PINCTRL_MT8173, so
> we still need 2 slightly different logic. Is it OK if I do this?
> Also add some comments so future SoCs can follow the correct template.
> 
> # For ARMv7 SoCs
> config PINCTRL_MT8135
> bool "Mediatek MT8135 pin control" if COMPILE_TEST && !MACH_MT8135
> default MACH_MT8135
> select PINCTRL_MTK_COMMON
> 
> # For ARMv8 SoCs
> config PINCTRL_MT8173
> bool "Mediatek MT8173 pin control"
> depends on ARM64 || COMPILE_TEST
> default ARM64
> select PINCTRL_MTK_COMMON
> 

Looks good with one modification: please make it

default ARM64 && ARCH_MEDIATEK

so the driver does not get turned on by default for ARM64 configurations that
do not contain support for mediatek chips.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix page-flags build

2015-03-13 Thread Jiri Olsa
On Thu, Mar 12, 2015 at 03:54:39PM -0700, Andrew Morton wrote:
> On Thu, 12 Mar 2015 15:39:13 -0700 Andi Kleen  wrote:
> 
> > From: Andi Kleen 
> > 
> > libabikfs.a doesn't exist anymore, so we now need to link with
> > libapi.a
> > 
> > Signed-off-by: Andi Kleen 
> > ---
> >  tools/vm/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/vm/Makefile b/tools/vm/Makefile
> > index ac884b6..93aadaf 100644
> > --- a/tools/vm/Makefile
> > +++ b/tools/vm/Makefile
> > @@ -3,7 +3,7 @@
> >  TARGETS=page-types slabinfo page_owner_sort
> >  
> >  LIB_DIR = ../lib/api
> > -LIBS = $(LIB_DIR)/libapikfs.a
> > +LIBS = $(LIB_DIR)/libapi.a
> >  
> >  CC = $(CROSS_COMPILE)gcc
> >  CFLAGS = -Wall -Wextra -I../lib/
> 
> A bit more info would have helped!
> 
> This appears to be a fix for 285a8f247b08c2 ("tools lib api: Rename
> libapikfs.a to libapi.a"), authored by Jiri, committed by Arnaldo and
> presently in linux-next.

oops, sry I missed this bit..

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


3.18 to 3.19+: moon key stopped working

2015-03-13 Thread Pavel Machek
Hi!

Suspend-to-RAM works on the desktop, but moon key in X no longer
triggers it. Booting to older kernel seems to fix it.

3.19+ may be 4.0-rc0, not sure. Let me try latest 4.0.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tracing: add trace event for memory-failure

2015-03-13 Thread Xie XiuQi
Memory-failure as the high level machine check handler, it's necessary
to report memory page recovery action result to user space by ftrace.

This patch add a event at ras group for memory-failure.

The output like below:
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2   #P:24
#
#  _-=> irqs-off
# / _=> need-resched
#| / _---=> hardirq/softirq
#|| / _--=> preempt-depth
#||| / delay
#   TASK-PID   CPU#  TIMESTAMP  FUNCTION
#  | |   |      | |
  mce-inject-13150 [001]    277.019359: memory_failure_event: pfn 
0x19869: free buddy page recovery: Delayed

Signed-off-by: Xie XiuQi 
---
 include/ras/ras_event.h |   36 
 mm/memory-failure.c |3 +++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index 79abb9c..0a6c8f3 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -232,6 +232,42 @@ TRACE_EVENT(aer_event,
__print_flags(__entry->status, "|", aer_uncorrectable_errors))
 );
 
+/*
+ * memory-failure recovery action result event
+ *
+ * unsigned long pfn - Page Number of the corrupted page
+ * char * action - Recovery action: "free buddy", "free huge", "high
+ * order kernel", "free buddy, 2nd try", "different
+ * compound page after locking", "hugepage already
+ * hardware poisoned", "unmapping failed", "already
+ * truncated LRU", etc.
+ * char * result - Action result: Ignored, Failed, Delayed, Recovered.
+ */
+TRACE_EVENT(memory_failure_event,
+   TP_PROTO(const unsigned long pfn,
+const char *action,
+const char *result),
+
+   TP_ARGS(pfn, action, result),
+
+   TP_STRUCT__entry(
+   __field(unsigned long, pfn)
+   __string(action, action)
+   __string(result, result)
+   ),
+
+   TP_fast_assign(
+   __entry->pfn = pfn;
+   __assign_str(action, action);
+   __assign_str(result, result);
+   ),
+
+   TP_printk("pfn %#lx: %s page recovery: %s",
+   __entry->pfn,
+   __get_str(action),
+   __get_str(result)
+   )
+);
 #endif /* _TRACE_HW_EVENT_MC_H */
 
 /* This part must be outside protection */
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index d487f8d..86a9cce 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -56,6 +56,7 @@
 #include 
 #include 
 #include "internal.h"
+#include 
 
 int sysctl_memory_failure_early_kill __read_mostly = 0;
 
@@ -837,6 +838,8 @@ static struct page_state {
  */
 static void action_result(unsigned long pfn, char *msg, int result)
 {
+   trace_memory_failure_event(pfn, msg, action_name[result]);
+
pr_err("MCE %#lx: %s page recovery: %s\n",
pfn, msg, action_name[result]);
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 07/10] ARM: at91: time: move the system timer driver to drivers/clocksource

2015-03-13 Thread Daniel Lezcano

On 03/12/2015 01:07 PM, Alexandre Belloni wrote:

Import at91rm9200_time.c from mach-at91 as timer-atmel-st.c. Further cleanup is
required to get rid of the mach-at91 headers.

Signed-off-by: Alexandre Belloni 
Acked-by: Boris Brezillon 


It would have make more sense to remove the mach headers first and then 
move the code in the clocksource directory, but anyway ... :)


Acked-by: Daniel Lezcano 


---
  arch/arm/mach-at91/Kconfig| 1 +
  arch/arm/mach-at91/Makefile   | 2 +-
  drivers/clocksource/Kconfig   | 4 
  drivers/clocksource/Makefile  | 1 +
  .../at91rm9200_time.c => drivers/clocksource/timer-atmel-st.c | 0
  5 files changed, 7 insertions(+), 1 deletion(-)
  rename arch/arm/mach-at91/at91rm9200_time.c => 
drivers/clocksource/timer-atmel-st.c (100%)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index c74a44324e5b..dabce086fa47 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -77,6 +77,7 @@ if SOC_SAM_V4_V5
  config SOC_AT91RM9200
bool "AT91RM9200"
select ATMEL_AIC_IRQ
+   select ATMEL_ST
select COMMON_CLK_AT91
select CPU_ARM920T
select GENERIC_CLOCKEVENTS
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 827fdbcce1c7..963c29169242 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -7,7 +7,7 @@ obj-y   := setup.o
  obj-$(CONFIG_SOC_AT91SAM9)+= sam9_smc.o

  # CPU-specific support
-obj-$(CONFIG_SOC_AT91RM9200)   += at91rm9200.o at91rm9200_time.o
+obj-$(CONFIG_SOC_AT91RM9200)   += at91rm9200.o
  obj-$(CONFIG_SOC_AT91SAM9)+= at91sam9.o
  obj-$(CONFIG_SOC_SAMA5)   += sama5.o

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f68122..6c45f504baff 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -138,6 +138,10 @@ config ATMEL_PIT
select CLKSRC_OF if OF
def_bool SOC_AT91SAM9 || SOC_SAMA5

+config ATMEL_ST
+   bool
+   select CLKSRC_OF
+
  config CLKSRC_METAG_GENERIC
def_bool y if METAG
help
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 752d5c70b0ef..5b85f6adb258 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -1,5 +1,6 @@
  obj-$(CONFIG_CLKSRC_OF)   += clksrc-of.o
  obj-$(CONFIG_ATMEL_PIT)   += timer-atmel-pit.o
+obj-$(CONFIG_ATMEL_ST) += timer-atmel-st.o
  obj-$(CONFIG_ATMEL_TCB_CLKSRC)+= tcb_clksrc.o
  obj-$(CONFIG_X86_PM_TIMER)+= acpi_pm.o
  obj-$(CONFIG_SCx200HR_TIMER)  += scx200_hrt.o
diff --git a/arch/arm/mach-at91/at91rm9200_time.c 
b/drivers/clocksource/timer-atmel-st.c
similarity index 100%
rename from arch/arm/mach-at91/at91rm9200_time.c
rename to drivers/clocksource/timer-atmel-st.c




--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mmc: sdhci: fix card presence logic in sdhci_request function

2015-03-13 Thread Ulf Hansson
On 10 March 2015 at 19:35, Scott Branden  wrote:
> The sdhci_request function should consider a non-removable device
> always present.
> Call the correct logic already available in sdhci_do_get_cd function.
>
> This fixes some logic paths where MMC requests are being made to
> non-removable devices that do not have the card detect pin connected
> on the hardware as it is non-removable.
>
> Signed-off-by: Scott Branden 

Thanks, applied!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci.c | 20 +++-
>  1 file changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 0ad412a..bafc7ac 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -56,6 +56,7 @@ static void sdhci_enable_preset_value(struct sdhci_host 
> *host, bool enable);
>  static int sdhci_pre_dma_transfer(struct sdhci_host *host,
> struct mmc_data *data,
> struct sdhci_host_next *next);
> +static int sdhci_do_get_cd(struct sdhci_host *host);
>
>  #ifdef CONFIG_PM
>  static int sdhci_runtime_pm_get(struct sdhci_host *host);
> @@ -1356,7 +1357,8 @@ static void sdhci_request(struct mmc_host *mmc, struct 
> mmc_request *mrq)
>
> sdhci_runtime_pm_get(host);
>
> -   present = mmc_gpio_get_cd(host->mmc);
> +   /* Firstly check card presence */
> +   present = sdhci_do_get_cd(host);
>
> spin_lock_irqsave(&host->lock, flags);
>
> @@ -1379,22 +1381,6 @@ static void sdhci_request(struct mmc_host *mmc, struct 
> mmc_request *mrq)
>
> host->mrq = mrq;
>
> -   /*
> -* Firstly check card presence from cd-gpio.  The return could
> -* be one of the following possibilities:
> -* negative: cd-gpio is not available
> -* zero: cd-gpio is used, and card is removed
> -* one: cd-gpio is used, and card is present
> -*/
> -   if (present < 0) {
> -   /* If polling, assume that the card is always present. */
> -   if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
> -   present = 1;
> -   else
> -   present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
> -   SDHCI_CARD_PRESENT;
> -   }
> -
> if (!present || host->flags & SDHCI_DEVICE_DEAD) {
> host->mrq->cmd->error = -ENOMEDIUM;
> tasklet_schedule(&host->finish_tasklet);
> --
> 2.3.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mmc: sdhci-iproc: fix oops in sdhci_iproc_writew

2015-03-13 Thread Ulf Hansson
On 13 March 2015 at 02:11, Dmitry Torokhov  wrote:
> The driver co-allocates sdhci_iproc_host with sdhci_pltfm_host and so to
> access it we need to use sdhci_pltfm_priv() and not pltfm_host->priv.
>
> Signed-off-by: Dmitry Torokhov 

Thanks, applied!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-iproc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 4139d34..3b423b0 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -97,7 +97,7 @@ static inline void sdhci_iproc_writel(struct sdhci_host 
> *host, u32 val, int reg)
>  static void sdhci_iproc_writew(struct sdhci_host *host, u16 val, int reg)
>  {
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -   struct sdhci_iproc_host *iproc_host = pltfm_host->priv;
> +   struct sdhci_iproc_host *iproc_host = sdhci_pltfm_priv(pltfm_host);
> u32 word_shift = REG_OFFSET_IN_BITS(reg);
> u32 mask = 0x << word_shift;
> u32 oldval, newval;
> --
> 2.2.0.rc0.207.ga3a616c
>
>
> --
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/5] i2c: recovery: change input parameter to i2c_adapter for prepare/unprepare_recovery

2015-03-13 Thread grygorii.stras...@linaro.org
Hi Wolfram,

On 03/12/2015 01:32 PM, Alexander Sverdlin wrote:
> On 01/12/14 16:34, Grygorii Strashko wrote:
>> This patch changes type of input parameter for .prepare/unprepare_recovery()
>> callbacks from struct i2c_bus_recovery_info * to struct i2c_adapter *.
>> This allows to simplify implementation of these callbacks and avoid
>> type conversations from i2c_bus_recovery_info to i2c_adapter.
>> The i2c_bus_recovery_info can be simply retrieved from struct i2c_adapter
>> which contains pointer on it.
>>
>> CC: Sekhar Nori 
>> CC: Kevin Hilman 
>> CC: Santosh Shilimkar 
>> CC: Murali Karicheri 
>> Acked-by: Uwe Kleine-König 
>> Signed-off-by: Grygorii Strashko 
>> ---
>>   drivers/i2c/i2c-core.c | 4 ++--
>>   include/linux/i2c.h| 4 ++--
>>   2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
>> index 2f90ac6..72b6e34 100644
>> --- a/drivers/i2c/i2c-core.c
>> +++ b/drivers/i2c/i2c-core.c
>> @@ -563,7 +563,7 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
>>  int i = 0, val = 1, ret = 0;
>>   
>>  if (bri->prepare_recovery)
>> -bri->prepare_recovery(bri);
>> +bri->prepare_recovery(adap);
>>   
>>  /*
>>   * By this time SCL is high, as we need to give 9 falling-rising edges
>> @@ -588,7 +588,7 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
>>  }
>>   
>>  if (bri->unprepare_recovery)
>> -bri->unprepare_recovery(bri);
>> +bri->unprepare_recovery(adap);
>>   
>>  return ret;
>>   }
>> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
>> index b556e0a..cf9380f 100644
>> --- a/include/linux/i2c.h
>> +++ b/include/linux/i2c.h
>> @@ -404,8 +404,8 @@ struct i2c_bus_recovery_info {
>>  void (*set_scl)(struct i2c_adapter *, int val);
>>  int (*get_sda)(struct i2c_adapter *);
>>   
>> -void (*prepare_recovery)(struct i2c_bus_recovery_info *bri);
>> -void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri);
>> +void (*prepare_recovery)(struct i2c_adapter *);
>> +void (*unprepare_recovery)(struct i2c_adapter *);
>>   
>>  /* gpio recovery */
>>  int scl_gpio;
>>
> 
> Acked-by: Alexander Sverdlin 
> 

Could I ask you to consider this patch for 4.1?
Now my I2C Davinci series is based on it and probably I2C OMAP changes
will need to be based on it too - if Felipe would agree with this of course.

regards,
-grygorii


-- 
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 08/10] clocksource: atmel-st: use syscon/regmap

2015-03-13 Thread Daniel Lezcano

On 03/12/2015 01:07 PM, Alexandre Belloni wrote:

The register range from the system timer is also used by the watchdog driver.
Use a regmap to handle concurrent accesses.

Signed-off-by: Alexandre Belloni 
Acked-by: Boris Brezillon 


Acked-by: Daniel Lezcano 


---
  drivers/clocksource/timer-atmel-st.c | 94 ++--
  1 file changed, 35 insertions(+), 59 deletions(-)

diff --git a/drivers/clocksource/timer-atmel-st.c 
b/drivers/clocksource/timer-atmel-st.c
index 7d062ab32674..674ef2519d6b 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -24,18 +24,19 @@
  #include 
  #include 
  #include 
-#include 
-#include 
+#include 
+#include 
  #include 
+#include 

  #include 

-#include 
  #include 

  static unsigned long last_crtr;
  static u32 irqmask;
  static struct clock_event_device clkevt;
+static struct regmap *regmap_st;

  #define RM9200_TIMER_LATCH((AT91_SLOW_CLOCK + HZ/2) / HZ)

@@ -46,11 +47,11 @@ static struct clock_event_device clkevt;
   */
  static inline unsigned long read_CRTR(void)
  {
-   unsigned long x1, x2;
+   unsigned int x1, x2;

-   x1 = at91_st_read(AT91_ST_CRTR);
+   regmap_read(regmap_st, AT91_ST_CRTR, &x1);
do {
-   x2 = at91_st_read(AT91_ST_CRTR);
+   regmap_read(regmap_st, AT91_ST_CRTR, &x2);
if (x1 == x2)
break;
x1 = x2;
@@ -63,7 +64,10 @@ static inline unsigned long read_CRTR(void)
   */
  static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
  {
-   u32 sr = at91_st_read(AT91_ST_SR) & irqmask;
+   u32 sr;
+
+   regmap_read(regmap_st, AT91_ST_SR, &sr);
+   sr &= irqmask;

/*
 * irqs should be disabled here, but as the irq is shared they are only
@@ -115,23 +119,25 @@ static struct clocksource clk32k = {
  static void
  clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
  {
+   unsigned int val;
+
/* Disable and flush pending timer interrupts */
-   at91_st_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS);
-   at91_st_read(AT91_ST_SR);
+   regmap_write(regmap_st, AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS);
+   regmap_read(regmap_st, AT91_ST_SR, &val);

last_crtr = read_CRTR();
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
/* PIT for periodic irqs; fixed rate of 1/HZ */
irqmask = AT91_ST_PITS;
-   at91_st_write(AT91_ST_PIMR, RM9200_TIMER_LATCH);
+   regmap_write(regmap_st, AT91_ST_PIMR, RM9200_TIMER_LATCH);
break;
case CLOCK_EVT_MODE_ONESHOT:
/* ALM for oneshot irqs, set by next_event()
 * before 32 seconds have passed
 */
irqmask = AT91_ST_ALMS;
-   at91_st_write(AT91_ST_RTAR, last_crtr);
+   regmap_write(regmap_st, AT91_ST_RTAR, last_crtr);
break;
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_UNUSED:
@@ -139,7 +145,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct 
clock_event_device *dev)
irqmask = 0;
break;
}
-   at91_st_write(AT91_ST_IER, irqmask);
+   regmap_write(regmap_st, AT91_ST_IER, irqmask);
  }

  static int
@@ -147,6 +153,7 @@ clkevt32k_next_event(unsigned long delta, struct 
clock_event_device *dev)
  {
u32 alm;
int status = 0;
+   unsigned intval;

BUG_ON(delta < 2);

@@ -162,12 +169,12 @@ clkevt32k_next_event(unsigned long delta, struct 
clock_event_device *dev)
alm = read_CRTR();

/* Cancel any pending alarm; flush any pending IRQ */
-   at91_st_write(AT91_ST_RTAR, alm);
-   at91_st_read(AT91_ST_SR);
+   regmap_write(regmap_st, AT91_ST_RTAR, alm);
+   regmap_read(regmap_st, AT91_ST_SR, &val);

/* Schedule alarm by writing RTAR. */
alm += delta;
-   at91_st_write(AT91_ST_RTAR, alm);
+   regmap_write(regmap_st, AT91_ST_RTAR, alm);

return status;
  }
@@ -180,57 +187,26 @@ static struct clock_event_device clkevt = {
.set_mode   = clkevt32k_mode,
  };

-void __iomem *at91_st_base;
-EXPORT_SYMBOL_GPL(at91_st_base);
-
-static const struct of_device_id at91rm9200_st_timer_ids[] = {
-   { .compatible = "atmel,at91rm9200-st" },
-   { /* sentinel */ }
-};
-
-static int __init of_at91rm9200_st_init(void)
-{
-   struct device_node *np;
-   int ret;
-
-   np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
-   if (!np)
-   goto err;
-
-   at91_st_base = of_iomap(np, 0);
-   if (!at91_st_base)
-   goto node_err;
-
-   /* Get the interrupts property */
-   ret = irq_of_parse_and_map(np, 0);
-   if (!ret)
-   goto ioremap_err;
-   at91rm9200_timer_irq.irq = ret;
-
-   of_node_put(np);
-
-   ret

[PATCH v2] uio: Fix uio driver to refcount device

2015-03-13 Thread Brian Russell
Protect uio driver from crashing if its owner is hot unplugged while there
are open fds.

Signed-off-by: Brian Russell 
---
 drivers/uio/uio.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 6276f13..70ce015 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -434,9 +434,11 @@ static int uio_open(struct inode *inode, struct file 
*filep)
goto out;
}
 
+   get_device(idev);
+
if (!try_module_get(idev->owner)) {
ret = -ENODEV;
-   goto out;
+   goto err_module_get;
}
 
listener = kmalloc(sizeof(*listener), GFP_KERNEL);
@@ -462,6 +464,9 @@ err_infoopen:
 err_alloc_listener:
module_put(idev->owner);
 
+err_module_get:
+   put_device(idev);
+
 out:
return ret;
 }
@@ -485,6 +490,7 @@ static int uio_release(struct inode *inode, struct file 
*filep)
 
module_put(idev->owner);
kfree(listener);
+   put_device(idev);
return ret;
 }
 
-- 
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 09/10] clocksource: atmel-st: remove mach/hardware dependency

2015-03-13 Thread Daniel Lezcano

On 03/12/2015 01:07 PM, Alexandre Belloni wrote:

Remove the mach/hardware dependency to prepare the driver for multiplatform
support.
Also switch from setup_irq() to request_irq()

Signed-off-by: Alexandre Belloni 
---
  drivers/clocksource/timer-atmel-st.c | 21 +
  1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/clocksource/timer-atmel-st.c 
b/drivers/clocksource/timer-atmel-st.c
index 674ef2519d6b..91d6cbb7a56b 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -31,13 +31,12 @@

  #include 


Couldn't the header above be removed ?

Other than that:

Acked-by: Daniel Lezcano 


-#include 
-
  static unsigned long last_crtr;
  static u32 irqmask;
  static struct clock_event_device clkevt;
  static struct regmap *regmap_st;

+#define AT91_SLOW_CLOCK32768
  #define RM9200_TIMER_LATCH((AT91_SLOW_CLOCK + HZ/2) / HZ)

  /*
@@ -96,13 +95,6 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void 
*dev_id)
return IRQ_NONE;
  }

-static struct irqaction at91rm9200_timer_irq = {
-   .name   = "at91_tick",
-   .flags  = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
-   .handler= at91rm9200_timer_interrupt,
-   .irq= NR_IRQS_LEGACY + AT91_ID_SYS,
-};
-
  static cycle_t read_clk32k(struct clocksource *cs)
  {
return read_CRTR();
@@ -193,6 +185,7 @@ static struct clock_event_device clkevt = {
  static void __init atmel_st_timer_init(struct device_node *node)
  {
unsigned int val;
+   int irq, ret;

regmap_st = syscon_node_to_regmap(node);
if (IS_ERR(regmap_st))
@@ -204,12 +197,16 @@ static void __init atmel_st_timer_init(struct device_node 
*node)
regmap_read(regmap_st, AT91_ST_SR, &val);

/* Get the interrupts property */
-   at91rm9200_timer_irq.irq  = irq_of_parse_and_map(node, 0);
-   if (!at91rm9200_timer_irq.irq)
+   irq  = irq_of_parse_and_map(node, 0);
+   if (!irq)
panic(pr_fmt("Unable to get IRQ from DT\n"));

/* Make IRQs happen for the system timer */
-   setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq);
+   ret = request_irq(irq, at91rm9200_timer_interrupt,
+ IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
+ "at91_tick", regmap_st);
+   if (ret)
+   panic(pr_fmt("Unable to setup IRQ\n"));

/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
 * directly for the clocksource and all clockevents, after adjusting




--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 10/10] ARM: at91: remove useless include

2015-03-13 Thread Daniel Lezcano

On 03/12/2015 01:07 PM, Alexandre Belloni wrote:

Both drivers using the system timer are now converted to an MFD. mach/at91_st.h
is now useless.

Signed-off-by: Alexandre Belloni 
Acked-by: Boris Brezillon 


Acked-by: Daniel Lezcano 


---
  arch/arm/mach-at91/include/mach/at91_st.h | 61 ---
  1 file changed, 61 deletions(-)
  delete mode 100644 arch/arm/mach-at91/include/mach/at91_st.h

diff --git a/arch/arm/mach-at91/include/mach/at91_st.h 
b/arch/arm/mach-at91/include/mach/at91_st.h
deleted file mode 100644
index 67fdbd13c3ed..
--- a/arch/arm/mach-at91/include/mach/at91_st.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91_st.h
- *
- * Copyright (C) 2005 Ivan Kokshaysky
- * Copyright (C) SAN People
- *
- * System Timer (ST) - System peripherals registers.
- * Based on AT91RM9200 datasheet revision E.
- *
- * 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 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef AT91_ST_H
-#define AT91_ST_H
-
-#ifndef __ASSEMBLY__
-extern void __iomem *at91_st_base;
-
-#define at91_st_read(field) \
-   __raw_readl(at91_st_base + field)
-
-#define at91_st_write(field, value) \
-   __raw_writel(value, at91_st_base + field)
-#else
-.extern at91_st_base
-#endif
-
-#defineAT91_ST_CR  0x00/* Control 
Register */
-#defineAT91_ST_WDRST   (1 << 0)  /* Watchdog Timer 
Restart */
-
-#defineAT91_ST_PIMR0x04/* Period 
Interval Mode Register */
-#defineAT91_ST_PIV (0x <<  0)/* 
Period Interval Value */
-
-#defineAT91_ST_WDMR0x08/* Watchdog 
Mode Register */
-#defineAT91_ST_WDV (0x <<  0)/* 
Watchdog Counter Value */
-#defineAT91_ST_RSTEN   (1  << 16)/* 
Reset Enable */
-#defineAT91_ST_EXTEN   (1  << 17)/* 
External Signal Assertion Enable */
-
-#defineAT91_ST_RTMR0x0c/* Real-time 
Mode Register */
-#defineAT91_ST_RTPRES  (0x <<  0)/* 
Real-time Prescalar Value */
-
-#defineAT91_ST_SR  0x10/* Status 
Register */
-#defineAT91_ST_PITS(1 << 0)  /* Period 
Interval Timer Status */
-#defineAT91_ST_WDOVF   (1 << 1)  /* Watchdog 
Overflow */
-#defineAT91_ST_RTTINC  (1 << 2)  /* Real-time 
Timer Increment */
-#defineAT91_ST_ALMS(1 << 3)  /* Alarm 
Status */
-
-#defineAT91_ST_IER 0x14/* Interrupt 
Enable Register */
-#defineAT91_ST_IDR 0x18/* Interrupt 
Disable Register */
-#defineAT91_ST_IMR 0x1c/* Interrupt 
Mask Register */
-
-#defineAT91_ST_RTAR0x20/* Real-time 
Alarm Register */
-#defineAT91_ST_ALMV(0xf << 0)/* 
Alarm Value */
-
-#defineAT91_ST_CRTR0x24/* Current 
Real-time Register */
-#defineAT91_ST_CRTV(0xf << 0)/* 
Current Real-Time Value */
-
-#endif




--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 00/10] Atmel System Timer cleanups

2015-03-13 Thread Daniel Lezcano

On 03/12/2015 01:07 PM, Alexandre Belloni wrote:

This patch set cleans up the system timer driver.

The main goal is to get rid of the mach/ headers dependency. At the same time,
it introduces proper probing and locking (using a regmap) for the watchdog
driver.

This is based on 4.0-rc1 and will have two merge conflicts with my cleanup #1 in
mach-at91/at91rm9200.c

It also needs this patch to probe the watchdog properly:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/327274.html



Hi Alexandre,

through which tree do you want this patchset to be merged ?

Thanks
  -- Daniel


Changes in v5:
  - Documented the watchdog compatible
  - Switched to simple-mfd to probe the system timer subnodes
  - Selected ATMEL_ST from mach-at91/Kconfig instead of using def_bool 
SOC_AT91RM9200
  - Reordered the atmel-st probe cleanup and its move to driver/clocksource
  - Added a patch to replace setup_irq by request_irq
  - Merged the reset handling in the watchdog timer as we are using the watchdog
anyway to reset the board.
  - Used a simple space after a #define for registers

Changes in v4:
  - Added MODULE_* metadata in at91rm9200-reset
  - Proper copyright in at91rm9200-reset
  - Use BIT() in atmel-st.h
  - changed MODULE_ALIAS in at91rm9200_wdt.c

Changes in v3:
  - stop using an mfd and get the syscon directly from the watchdog driver
  - introduce a proper reset driver to handle reset

Changes in v2:
  - cleaned up more includes in the watchdog driver
  - stop using if OF when selecting CLKSRC_OF
  - stop initializing .owner


Alexandre Belloni (10):
   ARM: at91/dt: declare atmel,at91rm9200-st as a syscon
   mfd: syscon: Add atmel system timer registers definition
   watchdog: at91rm9200: use the system timer syscon
   watchdog: at91rm9200: implement restart handler
   ARM: at91: at91rm9200: remove deprecated arm_pm_restart
   ARM: at91: properly initialize timer
   ARM: at91: time: move the system timer driver to drivers/clocksource
   clocksource: atmel-st: use syscon/regmap
   clocksource: atmel-st: remove mach/hardware dependency
   ARM: at91: remove useless include

  .../devicetree/bindings/arm/atmel-at91.txt |   4 +-
  arch/arm/boot/dts/at91rm9200.dtsi  |   6 +-
  arch/arm/mach-at91/Kconfig |   1 +
  arch/arm/mach-at91/Makefile|   2 +-
  arch/arm/mach-at91/at91rm9200.c|  19 
  arch/arm/mach-at91/generic.h   |   3 -
  arch/arm/mach-at91/include/mach/at91_st.h  |  61 ---
  drivers/clocksource/Kconfig|   4 +
  drivers/clocksource/Makefile   |   1 +
  .../clocksource/timer-atmel-st.c   | 115 -
  drivers/watchdog/Kconfig   |   2 +-
  drivers/watchdog/at91rm9200_wdt.c  |  61 +--
  include/linux/mfd/syscon/atmel-st.h|  49 +
  13 files changed, 164 insertions(+), 164 deletions(-)
  delete mode 100644 arch/arm/mach-at91/include/mach/at91_st.h
  rename arch/arm/mach-at91/at91rm9200_time.c => 
drivers/clocksource/timer-atmel-st.c (74%)
  create mode 100644 include/linux/mfd/syscon/atmel-st.h




--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 05/12] clocksource: add dependencies for Vybrid pit clocksource

2015-03-13 Thread Daniel Lezcano

On 03/13/2015 12:36 AM, Stefan Agner wrote:

Add the minimal dependencies required to use the Vybrid PIT
clocksource driver. Those are not part of the SoC dependencies.

Signed-off-by: Stefan Agner 


Acked-by: Daniel Lezcano 


---
  drivers/clocksource/Kconfig | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f..350e742 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -164,6 +164,8 @@ config FSL_FTM_TIMER

  config VF_PIT_TIMER
bool
+   select CLKSRC_MMIO
+   select CLKSRC_OF
help
  Support for Period Interrupt Timer on Freescale Vybrid Family SoCs.





--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/56] staging: comedi: introduce comedi_pci.h header

2015-03-13 Thread Ian Abbott

On 12/03/15 10:29, Ian Abbott wrote:

On 10/03/15 16:25, Joe Perches wrote:

On Tue, 2015-03-10 at 16:10 +, Ian Abbott wrote:

"comedidev.h" includes PCI-specific stuff that gets included by all
comedi drivers including non-PCI ones.  Separate it out into its own
header "comedi_pci.h".  Make the new header include  and
"comedidev.h" so that comedi PCI drivers do not need to include them
explicitly.


Isn't the kernel progressing to avoid indirect includes?


I could do it that way if you think it would help.  Better to redo it
before it is committed than after.


I have a v2 series ready to post now, that doesn't use the indirect 
includes.  Should I post that one, Greg, or are you okay with the 
existing series?


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 1/7] zram: remove `num_migrated' device attr

2015-03-13 Thread Sergey Senozhatsky
Remove sysfs `num_migrated' attribute. We are moving away from
per-stat device attrs towards 3 stat files that will accumulate
io and mm stats in a format similar to block layer statistics in
/sys/block//stat. That will be easier to use in user space,
and reduce the number of syscalls needed to read zram device
statistics.

`num_migrated' will return back in zram/mm_stat file.

Acked-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 Documentation/ABI/testing/sysfs-block-zram | 7 ---
 drivers/block/zram/zram_drv.c  | 2 --
 2 files changed, 9 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-block-zram 
b/Documentation/ABI/testing/sysfs-block-zram
index bede902..91ad707 100644
--- a/Documentation/ABI/testing/sysfs-block-zram
+++ b/Documentation/ABI/testing/sysfs-block-zram
@@ -149,10 +149,3 @@ Description:
The compact file is write-only and trigger compaction for
allocator zrm uses. The allocator moves some objects so that
it could free fragment space.
-
-What:  /sys/block/zram/num_migrated
-Date:  August 2015
-Contact:   Minchan Kim 
-Description:
-   The compact file is read-only and shows how many object
-   migrated by compaction.
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 0194799..660999f 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -392,7 +392,6 @@ ZRAM_ATTR_RO(invalid_io);
 ZRAM_ATTR_RO(notify_free);
 ZRAM_ATTR_RO(zero_pages);
 ZRAM_ATTR_RO(compr_data_size);
-ZRAM_ATTR_RO(num_migrated);
 
 static inline bool zram_meta_get(struct zram *zram)
 {
@@ -1069,7 +1068,6 @@ static struct attribute *zram_disk_attrs[] = {
&dev_attr_num_writes.attr,
&dev_attr_failed_reads.attr,
&dev_attr_failed_writes.attr,
-   &dev_attr_num_migrated.attr,
&dev_attr_compact.attr,
&dev_attr_invalid_io.attr,
&dev_attr_notify_free.attr,
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 2/7] zram: move compact_store() to sysfs functions area

2015-03-13 Thread Sergey Senozhatsky
A cosmetic change. We have a new code layout and keep zram per-device
sysfs store and show functions in one place. Move compact_store() to
that handlers block to conform to current layout.

Acked-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 drivers/block/zram/zram_drv.c | 42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 660999f..2d5848a 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -67,27 +67,6 @@ static inline struct zram *dev_to_zram(struct device *dev)
return (struct zram *)dev_to_disk(dev)->private_data;
 }
 
-static ssize_t compact_store(struct device *dev,
-   struct device_attribute *attr, const char *buf, size_t len)
-{
-   unsigned long nr_migrated;
-   struct zram *zram = dev_to_zram(dev);
-   struct zram_meta *meta;
-
-   down_read(&zram->init_lock);
-   if (!init_done(zram)) {
-   up_read(&zram->init_lock);
-   return -EINVAL;
-   }
-
-   meta = zram->meta;
-   nr_migrated = zs_compact(meta->mem_pool);
-   atomic64_add(nr_migrated, &zram->stats.num_migrated);
-   up_read(&zram->init_lock);
-
-   return len;
-}
-
 /* flag operations require table entry bit_spin_lock() being held */
 static int zram_test_flag(struct zram_meta *meta, u32 index,
enum zram_pageflags flag)
@@ -384,6 +363,27 @@ static ssize_t comp_algorithm_store(struct device *dev,
return len;
 }
 
+static ssize_t compact_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t len)
+{
+   unsigned long nr_migrated;
+   struct zram *zram = dev_to_zram(dev);
+   struct zram_meta *meta;
+
+   down_read(&zram->init_lock);
+   if (!init_done(zram)) {
+   up_read(&zram->init_lock);
+   return -EINVAL;
+   }
+
+   meta = zram->meta;
+   nr_migrated = zs_compact(meta->mem_pool);
+   atomic64_add(nr_migrated, &zram->stats.num_migrated);
+   up_read(&zram->init_lock);
+
+   return len;
+}
+
 ZRAM_ATTR_RO(num_reads);
 ZRAM_ATTR_RO(num_writes);
 ZRAM_ATTR_RO(failed_reads);
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 0/7] new zram statistics reporting scheme

2015-03-13 Thread Sergey Senozhatsky
Hello,

This patch introduces rework to zram stats. We have per-stat sysfs
nodes, and it makes things a bit hard to use in user space: it doesn't
give an immediate stats 'snapshot', it requires user space to use
more syscals -- open, read, close for every stat file, with
appropriate error checks on every step, etc.

First, zram now accounts block layer statistics. available in
/sys/block/zram/stat and /proc/diskstats files. So some new
stats are available (see Documentation/block/stat.txt), besides,
zram's activities are now can be monitored by sysstat's iostat
or similar tools.

Example:
cat /sys/block/zram0/stat
248 019840   251029 0  2008232   5120   0   5116   5116



Second, group currently exported on per-stat basis nodes into two
categories (files):

-- zram/io_stat
accumulates device's IO stats, that are not accounted by block layer,
and contains:
failed_reads
failed_writes
invalid_io
notify_free

Example:
cat /sys/block/zram0/io_stat
000   652572


-- zram/mm_stat
accumulates zram mm stats and contains:
orig_data_size
compr_data_size
mem_used_total
mem_limit
mem_used_max
zero_pages
num_migrated


Example:
cat /sys/block/zram0/mm_stat
434634752 270288572 2791587840 579895296150600


per-stat sysfs nodes are now considered to be deprecated and we plan
to remove them (and clean up some of the existing stat code) in two
years (as of now, there is no warning printed to syslog about deprecated
stats being used). user space is advised to use the above mentioned 3
files.


note:
util-linux mailing list is not Cc-ed into this series. once we settle
it down, I'll write to Karel. (we have several months ahead until 4.1
will be released).

v3:
-- show pid and comm in deprecated attr show() functions (Minchan)

v2:
-- fixed a couple of typos noted by Minchan
-- documented obsolete ABI (Minchan)
-- added pr_warn_once() to deprecated sysfs attr functions (Minchan)


Sergey Senozhatsky (7):
  zram: remove `num_migrated' device attr
  zram: move compact_store() to sysfs functions area
  zram: use generic start/end io accounting
  zram: describe device attrs in documentation
  zram: export new 'io_stat' sysfs attrs
  zram: export new 'mm_stat' sysfs attrs
  zram: deprecate zram attrs sysfs nodes

 Documentation/ABI/obsolete/sysfs-block-zram | 119 
 Documentation/ABI/testing/sysfs-block-zram  |  18 -
 Documentation/blockdev/zram.txt |  91 +
 drivers/block/zram/zram_drv.c   | 116 +--
 4 files changed, 303 insertions(+), 41 deletions(-)
 create mode 100644 Documentation/ABI/obsolete/sysfs-block-zram

-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 4/7] zram: describe device attrs in documentation

2015-03-13 Thread Sergey Senozhatsky
Briefly describe exported device stat attrs in zram documentation.
We will eventually get rid of per-stat sysfs nodes and, thus,
clean up Documentation/ABI/testing/sysfs-block-zram file, which is
the only source of information about device sysfs nodes.

Add `num_migrated' description, since there is no independent
`num_migrated' sysfs node (and no corresponding sysfs-block-zram
entry), it will be exported via zram/mm_stat file.

At this point we can provide minimal description, because
sysfs-block-zram still contains detailed information.

Acked-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 Documentation/blockdev/zram.txt | 49 +
 1 file changed, 35 insertions(+), 14 deletions(-)

diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt
index 902c97c..5d5e8be 100644
--- a/Documentation/blockdev/zram.txt
+++ b/Documentation/blockdev/zram.txt
@@ -117,20 +117,41 @@ execute
echo X > /sys/class/zram-control/zram_remove
 
 8) Stats:
-   Per-device statistics are exported as various nodes under
-   /sys/block/zram/
-   disksize
-   num_reads
-   num_writes
-   failed_reads
-   failed_writes
-   invalid_io
-   notify_free
-   zero_pages
-   orig_data_size
-   compr_data_size
-   mem_used_total
-   mem_used_max
+Per-device statistics are exported as various nodes under /sys/block/zram/
+
+A brief description of exported device attritbutes. For more details please
+read Documentation/ABI/testing/sysfs-block-zram.
+
+Nameaccessdescription
+-----
+disksize  RWshow and set the device's disk size
+initstate ROshows the initialization state of the device
+reset WOtrigger device reset
+num_reads ROthe number of reads
+failed_reads  ROthe number of failed reads
+num_write ROthe number of writes
+failed_writes ROthe number of failed writes
+invalid_ioROthe number of non-page-size-aligned I/O requests
+max_comp_streams  RWthe number of possible concurrent compress operations
+comp_algorithmRWshow and change the compression algorithm
+notify_free   ROthe number of notifications to free pages (either
+slot free notifications or REQ_DISCARD requests)
+zero_pagesROthe number of zero filled pages written to this disk
+orig_data_sizeROuncompressed size of data stored in this disk
+compr_data_size   ROcompressed size of data stored in this disk
+mem_used_totalROthe amount of memory allocated for this disk
+mem_used_max  RWthe maximum amount memory zram have consumed to
+store compressed data
+mem_limit RWthe maximum amount of memory ZRAM can use to store
+the compressed data
+num_migrated  ROthe number of objects migrated migrated by compaction
+compact   WOtrigger memory compaction
+
+
+File /sys/block/zram/stat
+
+Represents block layer statistics. Read Documentation/block/stat.txt for
+details.
 
 9) Deactivate:
swapoff /dev/zram0
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] parisc: fix pmd accounting with 3-level page tables

2015-03-13 Thread Kirill A. Shutemov
There's hack in pgd_alloc() on parisc to initialize one pmd, which is
not accounted. It leads to underflow on exit.

Let's adjust nr_pmds on pgd_alloc() to get accounting correct.

Signed-off-by: Kirill A. Shutemov 
Cc: John David Anglin 
Cc: Aaro Koskinen 
Cc: Graham Gower 
Cc: Domenico Andreoli 
---
 arch/parisc/include/asm/pgalloc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/parisc/include/asm/pgalloc.h 
b/arch/parisc/include/asm/pgalloc.h
index 55ad8be9b7f3..068b2fb9a47c 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -38,6 +38,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
/* The first pmd entry also is marked with _PAGE_GATEWAY as
 * a signal that this pmd may not be freed */
__pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
+   mm_inc_nr_pmds(mm);
 #endif
}
return actual_pgd;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 7/7] zram: deprecate zram attrs sysfs nodes

2015-03-13 Thread Sergey Senozhatsky
Add Documentation/ABI/obsolete/sysfs-block-zram file and list
obsolete and deprecated attributes there. The patch also adds
additional information to zram documentation and describes the
basic strategy:
- the existing RW nodes will be downgraded to WO nodes (in 4.11)
- deprecated RO sysfs nodes will eventually be removed (in 4.11)

Users will be additionally notified about deprecated attr usage
by pr_warn_once() (added to every deprecated attr _show()), as
suggested by Minchan Kim.

User space is advised to use zram/stat, zram/io_stat and
zram/mm_stat files.

Reported-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 Documentation/ABI/obsolete/sysfs-block-zram | 119 
 Documentation/blockdev/zram.txt |  16 
 drivers/block/zram/zram_drv.c   |  15 
 3 files changed, 150 insertions(+)
 create mode 100644 Documentation/ABI/obsolete/sysfs-block-zram

diff --git a/Documentation/ABI/obsolete/sysfs-block-zram 
b/Documentation/ABI/obsolete/sysfs-block-zram
new file mode 100644
index 000..720ea92
--- /dev/null
+++ b/Documentation/ABI/obsolete/sysfs-block-zram
@@ -0,0 +1,119 @@
+What:  /sys/block/zram/num_reads
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The num_reads file is read-only and specifies the number of
+   reads (failed or successful) done on this device.
+   Now accessible via zram/stat node.
+
+What:  /sys/block/zram/num_writes
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The num_writes file is read-only and specifies the number of
+   writes (failed or successful) done on this device.
+   Now accessible via zram/stat node.
+
+What:  /sys/block/zram/invalid_io
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The invalid_io file is read-only and specifies the number of
+   non-page-size-aligned I/O requests issued to this device.
+   Now accessible via zram/io_stat node.
+
+What:  /sys/block/zram/failed_reads
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The failed_reads file is read-only and specifies the number of
+   failed reads happened on this device.
+   Now accessible via zram/io_stat node.
+
+What:  /sys/block/zram/failed_writes
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The failed_writes file is read-only and specifies the number of
+   failed writes happened on this device.
+   Now accessible via zram/io_stat node.
+
+What:  /sys/block/zram/notify_free
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The notify_free file is read-only. Depending on device usage
+   scenario it may account a) the number of pages freed because
+   of swap slot free notifications or b) the number of pages freed
+   because of REQ_DISCARD requests sent by bio. The former ones
+   are sent to a swap block device when a swap slot is freed, which
+   implies that this disk is being used as a swap disk. The latter
+   ones are sent by filesystem mounted with discard option,
+   whenever some data blocks are getting discarded.
+   Now accessible via zram/io_stat node.
+
+What:  /sys/block/zram/zero_pages
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The zero_pages file is read-only and specifies number of zero
+   filled pages written to this disk. No memory is allocated for
+   such pages.
+   Now accessible via zram/mm_stat node.
+
+What:  /sys/block/zram/orig_data_size
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The orig_data_size file is read-only and specifies uncompressed
+   size of data stored in this disk. This excludes zero-filled
+   pages (zero_pages) since no memory is allocated for them.
+   Unit: bytes
+   Now accessible via zram/mm_stat node.
+
+What:  /sys/block/zram/compr_data_size
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The compr_data_size file is read-only and specifies compressed
+   size of data stored in this disk. So, compression ratio can be
+   calculated using orig_data_size and this statistic.
+   Unit: bytes
+   Now accessible via zram/mm_stat node.
+
+What:  /sys/block/zram/mem_used_total
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The mem_used_total file is read-only and specifies the amount
+   of memory, inc

Re: [rtc-linux] [PATCH 2/2] rtc: mediatek: Add MT63xx RTC driver

2015-03-13 Thread Eddie Huang
Hi,

On Mon, 2015-02-23 at 13:50 -0800, Andrew Morton wrote:
> On Wed, 28 Jan 2015 17:27:56 +0800 Eddie Huang  
> wrote:
> 
> > From: Tianping Fang 
> > 
> > Add Mediatek MT63xx RTC driver
> 
> There are a couple of checkpatch warnings which should be addressed,
> please:
> 
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #150: 
> new file mode 100644
> 
> WARNING: DT compatible string "mediatek,mt6397-rtc" appears un-documented -- 
> check ./Documentation/devicetree/bindings/
> #488: FILE: drivers/rtc/rtc-mt6397.c:334:
> + { .compatible = "mediatek,mt6397-rtc", },
> 
> 
> 
> 
> >
> > ...
> >
> > +static u16 rtc_read(struct mt6397_rtc *rtc, u32 offset)
> > +{
> > +   u32 rdata = 0;
> > +   u32 addr = rtc->addr_base + offset;
> > +
> > +   if (offset < rtc->addr_range)
> > +   regmap_read(rtc->regmap, addr, &rdata);
> > +
> > +   return (u16)rdata;
> > +}
> > +
> > +static void rtc_write(struct mt6397_rtc *rtc, u32 offset, u32 data)
> > +{
> > +   u32 addr;
> > +
> > +   addr = rtc->addr_base + offset;
> > +
> > +   if (offset < rtc->addr_range)
> > +   regmap_write(rtc->regmap, addr, data);
> > +}
> 
> regmap_read() and regmap_write() can return errors.  There is no
> checking for this.
> 

I encounter some trouble when I add code to check return value of
regmap_read and regmap_write. Every RTC register access through regmap,
and there are many register read/write in this driver. If I check every
return value, the driver will become ugly. I try to make this driver
clean using following macro.

static int __rtc_read(struct mt6397_rtc *rtc, u32 offset, u32 *data)
{
u32 addr = rtc->addr_base + offset;

if (offset < rtc->addr_range)
return regmap_read(rtc->regmap, addr, data);

return -EINVAL;
}

#define rtc_read(ret, rtc, offset, data)\
({  \
ret = __rtc_read(rtc, offset, data);\
if (ret < 0)\
goto rtc_exit;  \
})  \


And function call rtc_read, rtc_write looks like:

static int mtk_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
unsigned long time;
struct mt6397_rtc *rtc = dev_get_drvdata(dev);
int ret = 0;
u32 sec;

mutex_lock(&rtc->lock);
do {
rtc_read(ret, rtc, RTC_TC_SEC, &tm->tm_sec);
rtc_read(ret, rtc, RTC_TC_MIN, &tm->tm_min);
rtc_read(ret, rtc, RTC_TC_HOU, &tm->tm_hour);
rtc_read(ret, rtc, RTC_TC_DOM, &tm->tm_mday);
rtc_read(ret, rtc, RTC_TC_MTH, &tm->tm_mon);
rtc_read(ret, rtc, RTC_TC_YEA, &tm->tm_year);
rtc_read(ret, rtc, RTC_TC_SEC, &sec);
} while (sec < tm->tm_sec);
mutex_unlock(&rtc->lock);

tm->tm_year += RTC_MIN_YEAR_OFFSET;
tm->tm_mon--;
rtc_tm_to_time(tm, &time);

tm->tm_wday = (time / 86400 + 4) % 7;

return 0;

rtc_exit:
mutex_unlock(&rtc->lock);
return ret;
}

It's a little tricky, does anyone have good suggestion ?

Eddie




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 6/7] zram: export new 'mm_stat' sysfs attrs

2015-03-13 Thread Sergey Senozhatsky
Per-device `zram/mm_stat' file provides mm statistics of a
particular zram device in a format similar to block layer statistics.
The file consists of a single line and represents the following stats
(separated by whitespace):
orig_data_size
compr_data_size
mem_used_total
mem_limit
mem_used_max
zero_pages
num_migrated

Acked-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 Documentation/ABI/testing/sysfs-block-zram |  8 
 Documentation/blockdev/zram.txt| 14 ++
 drivers/block/zram/zram_drv.c  | 31 ++
 3 files changed, 53 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-block-zram 
b/Documentation/ABI/testing/sysfs-block-zram
index a7f622f..2e69e83 100644
--- a/Documentation/ABI/testing/sysfs-block-zram
+++ b/Documentation/ABI/testing/sysfs-block-zram
@@ -158,3 +158,11 @@ Description:
statistics not accounted by block layer. For example,
failed_reads, failed_writes, etc. File format is similar to
block layer statistics file format.
+
+What:  /sys/block/zram/mm_stat
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The mm_stat file is read-only and represents device's mm
+   statistics (orig_data_size, compr_data_size, etc.) in a format
+   similar to block layer statistics file format.
diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt
index 5ed4dd5..b133138 100644
--- a/Documentation/blockdev/zram.txt
+++ b/Documentation/blockdev/zram.txt
@@ -165,6 +165,20 @@ whitespace:
invalid_io
notify_free
 
+
+File /sys/block/zram/mm_stat
+
+The stat file represents device's mm statistics. It consists of a single
+line of text and contains the following stats separated by whitespace:
+   orig_data_size
+   compr_data_size
+   mem_used_total
+   mem_limit
+   mem_used_max
+   zero_pages
+   num_migrated
+
+
 9) Deactivate:
swapoff /dev/zram0
umount /dev/zram1
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 99d9286..f2dc90d 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -402,7 +402,37 @@ static ssize_t io_stat_show(struct device *dev,
return ret;
 }
 
+static ssize_t mm_stat_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct zram *zram = dev_to_zram(dev);
+   u64 orig_size, mem_used = 0;
+   long max_used;
+   ssize_t ret;
+
+   down_read(&zram->init_lock);
+   if (init_done(zram))
+   mem_used = zs_get_total_pages(zram->meta->mem_pool);
+
+   orig_size = atomic64_read(&zram->stats.pages_stored);
+   max_used = atomic_long_read(&zram->stats.max_used_pages);
+
+   ret = scnprintf(buf, PAGE_SIZE,
+   "%8llu %8llu %8llu %8lu %8ld %8llu %8llu\n",
+   orig_size << PAGE_SHIFT,
+   (u64)atomic64_read(&zram->stats.compr_data_size),
+   mem_used << PAGE_SHIFT,
+   zram->limit_pages << PAGE_SHIFT,
+   max_used << PAGE_SHIFT,
+   (u64)atomic64_read(&zram->stats.zero_pages),
+   (u64)atomic64_read(&zram->stats.num_migrated));
+   up_read(&zram->init_lock);
+
+   return ret;
+}
+
 static DEVICE_ATTR_RO(io_stat);
+static DEVICE_ATTR_RO(mm_stat);
 ZRAM_ATTR_RO(num_reads);
 ZRAM_ATTR_RO(num_writes);
 ZRAM_ATTR_RO(failed_reads);
@@ -1105,6 +1135,7 @@ static struct attribute *zram_disk_attrs[] = {
&dev_attr_max_comp_streams.attr,
&dev_attr_comp_algorithm.attr,
&dev_attr_io_stat.attr,
+   &dev_attr_mm_stat.attr,
NULL,
 };
 
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] crypto: algif_rng - zeroize buffer holding random data

2015-03-13 Thread Herbert Xu
On Wed, Mar 11, 2015 at 07:45:35AM +0100, Stephan Mueller wrote:
> Due to the change to RNGs to always return zero in success case, the RNG
> interface must zeroize the buffer with the length provided by the
> caller.
> 
> Signed-off-by: Stephan Mueller 

Your patch is line-wrapped and doesn't apply.  Please resend.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 5/7] zram: export new 'io_stat' sysfs attrs

2015-03-13 Thread Sergey Senozhatsky
Per-device `zram/io_stat' file provides accumulated I/O statistics
of particular zram device in a format similar to block layer statistics.
The file consists of a single line and represents the following stats
(separated by whitespace):
failed_reads
failed_writes
invalid_io
notify_free

Acked-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 Documentation/ABI/testing/sysfs-block-zram |  9 +
 Documentation/blockdev/zram.txt| 12 
 drivers/block/zram/zram_drv.c  | 20 
 3 files changed, 41 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-block-zram 
b/Documentation/ABI/testing/sysfs-block-zram
index 91ad707..a7f622f 100644
--- a/Documentation/ABI/testing/sysfs-block-zram
+++ b/Documentation/ABI/testing/sysfs-block-zram
@@ -149,3 +149,12 @@ Description:
The compact file is write-only and trigger compaction for
allocator zrm uses. The allocator moves some objects so that
it could free fragment space.
+
+What:  /sys/block/zram/io_stat
+Date:  August 2015
+Contact:   Sergey Senozhatsky 
+Description:
+   The io_stat file is read-only and accumulates device's I/O
+   statistics not accounted by block layer. For example,
+   failed_reads, failed_writes, etc. File format is similar to
+   block layer statistics file format.
diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt
index 5d5e8be..5ed4dd5 100644
--- a/Documentation/blockdev/zram.txt
+++ b/Documentation/blockdev/zram.txt
@@ -153,6 +153,18 @@ File /sys/block/zram/stat
 Represents block layer statistics. Read Documentation/block/stat.txt for
 details.
 
+
+File /sys/block/zram/io_stat
+
+The stat file represents device's I/O statistics not accounted by block
+layer and, thus, not available in zram/stat file. It consists of a
+single line of text and contains the following stats separated by
+whitespace:
+   failed_reads
+   failed_writes
+   invalid_io
+   notify_free
+
 9) Deactivate:
swapoff /dev/zram0
umount /dev/zram1
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 6adccdf..99d9286 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -384,6 +384,25 @@ static ssize_t compact_store(struct device *dev,
return len;
 }
 
+static ssize_t io_stat_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct zram *zram = dev_to_zram(dev);
+   ssize_t ret;
+
+   down_read(&zram->init_lock);
+   ret = scnprintf(buf, PAGE_SIZE,
+   "%8llu %8llu %8llu %8llu\n",
+   (u64)atomic64_read(&zram->stats.failed_reads),
+   (u64)atomic64_read(&zram->stats.failed_writes),
+   (u64)atomic64_read(&zram->stats.invalid_io),
+   (u64)atomic64_read(&zram->stats.notify_free));
+   up_read(&zram->init_lock);
+
+   return ret;
+}
+
+static DEVICE_ATTR_RO(io_stat);
 ZRAM_ATTR_RO(num_reads);
 ZRAM_ATTR_RO(num_writes);
 ZRAM_ATTR_RO(failed_reads);
@@ -1085,6 +1104,7 @@ static struct attribute *zram_disk_attrs[] = {
&dev_attr_mem_used_max.attr,
&dev_attr_max_comp_streams.attr,
&dev_attr_comp_algorithm.attr,
+   &dev_attr_io_stat.attr,
NULL,
 };
 
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv3 3/7] zram: use generic start/end io accounting

2015-03-13 Thread Sergey Senozhatsky
Use bio generic_start_io_acct() and generic_end_io_acct() to account
device's block layer statistics. This will let users to monitor zram
activities using sysstat and similar packages/tools.

Apart from the usual per-stat sysfs attr, zram IO stats are now also
available in '/sys/block/zram/stat' and '/proc/diskstats' files.

We will slowly get rid of per-stat sysfs files.

Acked-by: Minchan Kim 
Signed-off-by: Sergey Senozhatsky 
---
 drivers/block/zram/zram_drv.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 2d5848a..6adccdf 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -743,8 +743,12 @@ static void zram_bio_discard(struct zram *zram, u32 index,
 static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
int offset, int rw)
 {
+   unsigned long start_time = jiffies;
int ret;
 
+   generic_start_io_acct(rw, bvec->bv_len >> SECTOR_SHIFT,
+   &zram->disk->part0);
+
if (rw == READ) {
atomic64_inc(&zram->stats.num_reads);
ret = zram_bvec_read(zram, bvec, index, offset);
@@ -753,6 +757,8 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec 
*bvec, u32 index,
ret = zram_bvec_write(zram, bvec, index, offset);
}
 
+   generic_end_io_acct(rw, &zram->disk->part0, start_time);
+
if (unlikely(ret)) {
if (rw == READ)
atomic64_inc(&zram->stats.failed_reads);
-- 
2.3.2.223.g7a9409c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] crypto: AES-NI - fix memory usage in GCM decryption

2015-03-13 Thread Herbert Xu
On Thu, Mar 12, 2015 at 09:17:51AM +0100, Stephan Mueller wrote:
> The kernel crypto API logic requires the caller to provide the
> length of (ciphertext || authentication tag) as cryptlen for the
> AEAD decryption operation. Thus, the cipher implementation must
> calculate the size of the plaintext output itself and cannot simply use
> cryptlen.
> 
> The RFC4106 GCM decryption operation tries to overwrite cryptlen memory
> in req->dst. As the destination buffer for decryption only needs to hold
> the plaintext memory but cryptlen references the input buffer holding
> (ciphertext || authentication tag), the assumption of the destination
> buffer length in RFC4106 GCM operation leads to a too large size. This
> patch simply uses the already calculated plaintext size.
> 
> In addition, this patch fixes the offset calculation of the AAD buffer
> pointer: as mentioned before, cryptlen already includes the size of the
> tag. Thus, the tag does not need to be added. With the addition, the AAD
> will be written beyond the already allocated buffer.
> 
> Note, this fixes a kernel crash that can be triggered from user space
> via AF_ALG(aead) -- simply use the libkcapi test application
> from [1] and update it to use rfc4106-gcm-aes.
> 
> Using [1], the changes were tested using CAVS vectors to demonstrate
> that the crypto operation still delivers the right results.
> 
> [1] http://www.chronox.de/libkcapi.html
> 
> CC: Tadeusz Struk 
> Signed-off-by: Stephan Mueller 

Patch applied.  Thanks!
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 00/10] Atmel System Timer cleanups

2015-03-13 Thread Alexandre Belloni
On 13/03/2015 at 11:23:05 +0100, Daniel Lezcano wrote :
> On 03/12/2015 01:07 PM, Alexandre Belloni wrote:
> >This patch set cleans up the system timer driver.
> >
> >The main goal is to get rid of the mach/ headers dependency. At the same 
> >time,
> >it introduces proper probing and locking (using a regmap) for the watchdog
> >driver.
> >
> >This is based on 4.0-rc1 and will have two merge conflicts with my cleanup 
> >#1 in
> >mach-at91/at91rm9200.c
> >
> >It also needs this patch to probe the watchdog properly:
> >http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/327274.html
> 
> 
> Hi Alexandre,
> 
> through which tree do you want this patchset to be merged ?
> 

I'd say through the at91 tree as I have another series that depend on
that one


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 00/10] Atmel System Timer cleanups

2015-03-13 Thread Daniel Lezcano

On 03/13/2015 11:33 AM, Alexandre Belloni wrote:

On 13/03/2015 at 11:23:05 +0100, Daniel Lezcano wrote :

On 03/12/2015 01:07 PM, Alexandre Belloni wrote:

This patch set cleans up the system timer driver.

The main goal is to get rid of the mach/ headers dependency. At the same time,
it introduces proper probing and locking (using a regmap) for the watchdog
driver.

This is based on 4.0-rc1 and will have two merge conflicts with my cleanup #1 in
mach-at91/at91rm9200.c

It also needs this patch to probe the watchdog properly:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/327274.html



Hi Alexandre,

through which tree do you want this patchset to be merged ?



I'd say through the at91 tree as I have another series that depend on
that one


Ok.


--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 2/4] arm64: dts: Add Qualcomm MSM8916 SoC and evaluation board dts

2015-03-13 Thread Mark Rutland
> > Which of spin-table/psci are you planning on using for SMP support, and
> > when would that be likely to appear?
> 
> We have a qcom specific SMP enablement method for this device.  This
> was one of our first devices so it utilized as much from arm 32-bit as
> possible.

Implementation specific enable methods are something we really don't
want to see for arm64. If PSCI is out of the question then a spin-table
shim in your bootloader shouldn't be too hard to implement.

> > Which exception level do CPUs enter the kernel? Even without a
> > virt-capable GIC booting at EL2 is less work for the FW and gives the
> > kernel a better chance of fixing things up (e.g. CNTVOFF).
> 
> I think the enter in EL1.

That's unfortunate, but so long as they are consistent, it's not the end
of the world.

Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] x86/fpu: introduce restore_init_xstate()

2015-03-13 Thread Borislav Petkov
On Wed, Mar 11, 2015 at 06:34:29PM +0100, Oleg Nesterov wrote:
> Extract the "use_eager_fpu()" code from drop_init_fpu() into the new
> simple helper, restore_init_xstate(). The next patch adds another user.
> 
> - It is not clear why we do not check use_fxsr() like fpu_restore_checking()
>   does.

Tell me about it.

> - It is not clear why we can't call setup_init_fpu_buf() unconditionally
>   to always create init_xstate_buf().

I also don't understand what the thought behind xstate_enable_boot_cpu()
and eager_fpu_init_bp() - we do call xstate_enable_boot_cpu() and alloc
init_xstate_buf and then when we come to

eager_fpu_init
|-> eager_fpu_init_bp

we get to init it if not initted yet.

When can that ever happen?

> Then do_device_not_available() path
>   (at least) could use restore_init_xstate() too. It doesn't need to init
>   fpu->state, its content doesn't matter until unlazy_fpu/__switch_to/etc
>   which overwrites this memory anyway.
> 
> Signed-off-by: Oleg Nesterov 
> ---
>  arch/x86/include/asm/fpu-internal.h |   16 ++--
>  1 files changed, 10 insertions(+), 6 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] selftests/kcmp: exit with non-zero code in a fail case

2015-03-13 Thread Michael Ellerman
On Fri, 2015-03-13 at 12:27 +0300, Andrey Vagin wrote:
> diff --git a/tools/testing/selftests/kselftest.h 
> b/tools/testing/selftests/kselftest.h
> index 572c888..a0ec8b8 100644
> --- a/tools/testing/selftests/kselftest.h
> +++ b/tools/testing/selftests/kselftest.h
> @@ -58,5 +58,17 @@ static inline int ksft_exit_skip(void)
>  {
>   exit(4);
>  }
> +static inline int ksft_exit(void)
> +{
> + if (ksft_cnt.ksft_fail)
> + return ksft_exit_fail();
> + if (ksft_cnt.ksft_xpass)
> + return ksft_exit_xpass();
> + if (ksft_cnt.ksft_xskip)
> + return ksft_exit_skip();
> + if (ksft_cnt.ksft_xfail)
> + return ksft_exit_xfail();
> + ksft_exit_pass();
> +}

This function claims to return 'int', but doesn't. So do all the others.

It could be as simple as:

static inline void ksft_exit(void)
{
if (ksft_cnt.ksft_fail)
exit(1);

if (ksft_cnt.ksft_xpass)
exit(3);

if (ksft_cnt.ksft_xskip)
exit(4);

if (ksft_cnt.ksft_xfail)
exit(2);

exit(0);
}

cheers



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/15] crypto: don't export static symbol

2015-03-13 Thread Herbert Xu
On Wed, Mar 11, 2015 at 05:56:26PM +0100, Julia Lawall wrote:
> From: Julia Lawall 
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // 
> @r@
> type T;
> identifier f;
> @@
> 
> static T f (...) { ... }
> 
> @@
> identifier r.f;
> declarer name EXPORT_SYMBOL_GPL;
> @@
> 
> -EXPORT_SYMBOL_GPL(f);
> // 
> 
> Signed-off-by: Julia Lawall 

Applied.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net-next 0/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Daniel Borkmann

On 03/13/2015 03:21 AM, Alexei Starovoitov wrote:
...

Daniel,
patch 1 includes a bit of code that does prog_realloc and branch adjustment
to make room for new instructions. I think you'd need the same for your
'constant blinding' work. If indeed that would be the case, we'll make it
into a helper function.


Yes, thanks will take care of that.

Cheers,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 02/10] mfd: syscon: Add atmel system timer registers definition

2015-03-13 Thread Alexandre Belloni
Hi,

On 13/03/2015 at 08:03:15 +, Lee Jones wrote :
> On Thu, 12 Mar 2015, Alexandre Belloni wrote:
> 
> > AT91RM920 has a memory range reserved for timer and watchdog configuration.
> > Expose those registers so that drivers can make use of the system timer 
> > syscon
> > declared in at91 DTs.
> > 
> > Signed-off-by: Alexandre Belloni 
> > Acked-by: Lee Jones 
> > ---
> >  include/linux/mfd/syscon/atmel-st.h | 49 
> > +
> >  1 file changed, 49 insertions(+)
> >  create mode 100644 include/linux/mfd/syscon/atmel-st.h
> 
> Applied, thanks.
> 

Actually, I was thinking this could go through the at91 to avoid
depending on your branch.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RT 16/39] locking/rt-mutex: avoid a NULL pointer dereference on deadlock

2015-03-13 Thread Sebastian Andrzej Siewior
* Steven Rostedt | 2015-03-12 15:13:23 [-0400]:

>3.14.34-rt32-rc1 stable review patch.
>If anyone has any objections, please let me know.

If you take this, could you take 9d3e2d02f54160725d97f4ab1e1e8de493fbf33a
("locking/rtmutex: Set state back to running on error") it sits on my
queue and is upstream already.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 09/10] clocksource: atmel-st: remove mach/hardware dependency

2015-03-13 Thread Alexandre Belloni
On 13/03/2015 at 11:21:35 +0100, Daniel Lezcano wrote :
> On 03/12/2015 01:07 PM, Alexandre Belloni wrote:
> >Remove the mach/hardware dependency to prepare the driver for multiplatform
> >support.
> >Also switch from setup_irq() to request_irq()
> >
> >Signed-off-by: Alexandre Belloni 
> >---
> >  drivers/clocksource/timer-atmel-st.c | 21 +
> >  1 file changed, 9 insertions(+), 12 deletions(-)
> >
> >diff --git a/drivers/clocksource/timer-atmel-st.c 
> >b/drivers/clocksource/timer-atmel-st.c
> >index 674ef2519d6b..91d6cbb7a56b 100644
> >--- a/drivers/clocksource/timer-atmel-st.c
> >+++ b/drivers/clocksource/timer-atmel-st.c
> >@@ -31,13 +31,12 @@
> >
> >  #include 
> 
> Couldn't the header above be removed ?
> 

Indeed, it can but that is starting to be further cleanup than I
intended ;)

I'll send a v6 of that patch for Nicolas to pick.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND] crypto: algif_rng - zeroize buffer with random data

2015-03-13 Thread Stephan Mueller
Due to the change to RNGs to always return zero in success case, the RNG
interface must zeroize the buffer with the length provided by the
caller.

Signed-off-by: Stephan Mueller 
---
 crypto/algif_rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/algif_rng.c b/crypto/algif_rng.c
index 67f612c..a346173 100644
--- a/crypto/algif_rng.c
+++ b/crypto/algif_rng.c
@@ -87,7 +87,7 @@ static int rng_recvmsg(struct kiocb *unused, struct socket 
*sock,
return genlen;
 
err = memcpy_to_msg(msg, result, len);
-   memzero_explicit(result, genlen);
+   memzero_explicit(result, len);
 
return err ? err : len;
 }
-- 
2.1.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] iio: si7020: Fix endianness for I2C reads

2015-03-13 Thread Lars-Peter Clausen

On 03/13/2015 03:53 AM, Andrey Smirnov wrote:

Si7020 outputs most significant byte of the measurement result first
and least significant byte last. As a result the data returned by
i2c_smbus_read_word_data appears as big endian. Fix this by making a
call to an approbriate byte conversion routine.


i2c_smbus_read_word_data() returns data in native endianess. But it 
interprets the word on the bus as little-endian (As specified by the SMBus 
spec). If your chip returns data in big-endian use 
i2c_smbus_read_word_data_swapped().


- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/4] x86/fpu: use restore_init_xstate() instead of math_state_restore() on kthread exec

2015-03-13 Thread Borislav Petkov
On Wed, Mar 11, 2015 at 06:34:49PM +0100, Oleg Nesterov wrote:
> Change flush_thread() to do user_fpu_begin() + restore_init_xstate()
> and avoid math_state_restore().
> 
> Note: "TODO: cleanup this horror" is still valid. We do not need
> init_fpu() at all, we only need fpu_alloc() + memset(0). But this needs
> other changes, in particular user_fpu_begin() should set used_math().
> 
> Signed-off-by: Oleg Nesterov 
> ---
>  arch/x86/kernel/process.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index dd9a069..c396de2 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -142,7 +142,8 @@ void flush_thread(void)
>   /* kthread execs. TODO: cleanup this horror. */
>   if (WARN_ON(init_fpu(current)))
>   force_sig(SIGKILL, current);
> - math_state_restore();
> + user_fpu_begin();
> + restore_init_xstate();

Ok, question: so math_state_restore() does kernel_fpu_disable() before
doing those, why is it ok for flush_thread() to not do it?

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] powercap/rapl: handle domain energy unit

2015-03-13 Thread Jacob Pan
The current driver assumes all RAPL domains within a CPU package
have the same energy unit. This is no longer true for HSW server
CPUs since DRAM domain has is own fixed energy unit which can be
different than the package energy unit enumerated by package
power MSR. In fact, the default HSW EP package power unit is 61uJ
whereas DRAM domain unit is 15.3uJ. The result is that DRAM power
consumption is counted 4x more than real power reported by energy
counters, similarly for max_energy_range_uj of DRAM domain.

This patch adds domain specific energy unit per cpu type, it allows
domain energy unit to override package energy unit if non zero.

Please see this document for details.
"Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, Volume 2
of 2. Datasheet, September 2014, Reference Number: 330784-001 "

Signed-off-by: Jacob Pan 
---
 drivers/powercap/intel_rapl.c | 54 +++
 1 file changed, 39 insertions(+), 15 deletions(-)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index 97b5e4e..63d4033 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -73,7 +73,7 @@
 
 #define TIME_WINDOW_MAX_MSEC 4
 #define TIME_WINDOW_MIN_MSEC 250
-
+#define ENERGY_UNIT_SCALE1000 /* scale from driver unit to powercap unit */
 enum unit_type {
ARBITRARY_UNIT, /* no translation */
POWER_UNIT,
@@ -158,6 +158,7 @@ struct rapl_domain {
struct rapl_power_limit rpl[NR_POWER_LIMITS];
u64 attr_map; /* track capabilities */
unsigned int state;
+   unsigned int domain_energy_unit;
int package_id;
 };
 #define power_zone_to_rapl_domain(_zone) \
@@ -190,6 +191,7 @@ struct rapl_defaults {
void (*set_floor_freq)(struct rapl_domain *rd, bool mode);
u64 (*compute_time_window)(struct rapl_package *rp, u64 val,
bool to_raw);
+   unsigned int dram_domain_energy_unit;
 };
 static struct rapl_defaults *rapl_defaults;
 
@@ -227,7 +229,8 @@ static int rapl_read_data_raw(struct rapl_domain *rd,
 static int rapl_write_data_raw(struct rapl_domain *rd,
enum rapl_primitives prim,
unsigned long long value);
-static u64 rapl_unit_xlate(int package, enum unit_type type, u64 value,
+static u64 rapl_unit_xlate(struct rapl_domain *rd, int package,
+   enum unit_type type, u64 value,
int to_raw);
 static void package_power_limit_irq_save(int package_id);
 
@@ -305,7 +308,9 @@ static int get_energy_counter(struct powercap_zone 
*power_zone, u64 *energy_raw)
 
 static int get_max_energy_counter(struct powercap_zone *pcd_dev, u64 *energy)
 {
-   *energy = rapl_unit_xlate(0, ENERGY_UNIT, ENERGY_STATUS_MASK, 0);
+   struct rapl_domain *rd = power_zone_to_rapl_domain(pcd_dev);
+
+   *energy = rapl_unit_xlate(rd, 0, ENERGY_UNIT, ENERGY_STATUS_MASK, 0);
return 0;
 }
 
@@ -639,6 +644,11 @@ static void rapl_init_domains(struct rapl_package *rp)
rd->msrs[4] = MSR_DRAM_POWER_INFO;
rd->rpl[0].prim_id = PL1_ENABLE;
rd->rpl[0].name = pl1_name;
+   rd->domain_energy_unit =
+   rapl_defaults->dram_domain_energy_unit;
+   if (rd->domain_energy_unit)
+   pr_info("DRAM domain energy unit %dpj\n",
+   rd->domain_energy_unit);
break;
}
if (mask) {
@@ -648,11 +658,13 @@ static void rapl_init_domains(struct rapl_package *rp)
}
 }
 
-static u64 rapl_unit_xlate(int package, enum unit_type type, u64 value,
+static u64 rapl_unit_xlate(struct rapl_domain *rd, int package,
+   enum unit_type type, u64 value,
int to_raw)
 {
u64 units = 1;
struct rapl_package *rp;
+   u64 scale = 1;
 
rp = find_package_by_id(package);
if (!rp)
@@ -663,7 +675,12 @@ static u64 rapl_unit_xlate(int package, enum unit_type 
type, u64 value,
units = rp->power_unit;
break;
case ENERGY_UNIT:
-   units = rp->energy_unit;
+   scale = ENERGY_UNIT_SCALE;
+   /* per domain unit takes precedence */
+   if (rd && rd->domain_energy_unit)
+   units = rd->domain_energy_unit;
+   else
+   units = rp->energy_unit;
break;
case TIME_UNIT:
return rapl_defaults->compute_time_window(rp, value, to_raw);
@@ -673,11 +690,11 @@ static u64 rapl_unit_xlate(int package, enum unit_type 
type, u64 value,
};
 
if (to_raw)
-   return div64_u64(value, units);
+   return div64_u64(value, units) * scale;
 
value *= units;
 
-   return value;
+   return di

Re: [PATCH v4 2/4] arm64: dts: Add Qualcomm MSM8916 SoC and evaluation board dts

2015-03-13 Thread Mark Rutland
> +/ {
> + chosen {
> + stdout-path = &blsp1_uart2;
> + };

It would be good if we had the configuration too (see
Documentation/devicetree/bindings/chosen.txt), as that avoids any
reliance on kernel defaults.

You can refer to an alias, so this could be:

aliases {
serial0 = &blsp1_uart2;
};

chosen {
stdout-path = "serial0:115200n8";
};

...assuming that 115200n8 is correct for your UART, of course.


[...]

> +#include "skeleton.dtsi"

I'd like to get rid of skeleton.dtsi; it causes more problems than it
solves (the address/size cells mismatch is confusing and hidden, people
forget to fill in memory nodes appropriately, etc).

Please remove this include and place appropriate #address-cells and #size-cells 
here.

I'd strongly recommend going with /#size-cells = <2>; it' will save on a
lot of pain if you need to add PCIe or something with large ranges
later. If things all fall in 4GB within the SoC then have
/soc/#size=cells = <1> and an appropriate /soc/ranges property.

I note this DT doesn't have any memory nodes. Is that an accident or
does the loader fill that in?

If the latter, have an empty node with a comment to that effect.

Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powercap/rapl: handle domain energy unit

2015-03-13 Thread Jacob Pan
On Thu, 12 Mar 2015 17:50:20 -0500
kazutomo  wrote:

> On 03/12/2015 05:05 PM, Jacob Pan wrote:
> > On Thu, 12 Mar 2015 16:59:43 -0500
> > kazutomo  wrote:
> >
> >>> according to the document, future DRAM energy unit will always be
> >>> hardcoded to 15.3uJ, no enumeration since there is no domain
> >>> specific MSR for energy unit.  
> >> Which document are you referring to?
> > Intel DocID:330784-001 Sept 2014
> > Intel Xeon Processor E5-1600 and E5-2600 V2 of 2.
> 
> I think V2 is Ivy Bridge.  Is this typo?
>  
v2 is volume 2, glad you found the doc.

BTW, i just sent out v2 of the patch to address the issues, changes are
1. use pJ for driver energy unit
2. fix max_energy_range_uj, makes it per domain
3. add reference doc info to commit message

Thanks,

Jacob
> By googling, I found a datasheet titled:
> "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, Volume
> 2 of 2. Datasheet, September 2014, Reference Number: 330784-001 "
> 
> It clearly says "ENERGY_UNIT for DRAM domain is 15.3uJ."
> 
> - kaz
> 




-- 
Jacob Pan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 18/24] perf stat: Output running time and run/enabled ratio in CSV mode

2015-03-13 Thread Arnaldo Carvalho de Melo
Em Fri, Mar 13, 2015 at 08:34:41AM +0100, Ingo Molnar escreveu:
> * Arnaldo Carvalho de Melo  wrote:
> > From: Andi Kleen 
> > +static void print_running(u64 run, u64 ena)
> > +{
> > +   if (csv_output) {
> > +   fprintf(output, "%s%" PRIu64 "%s%.2f",
> > +   csv_sep,
> > +   run,
> > +   csv_sep,
> > +   ena ? 100.0 * run / ena : 100.0);
> > +   } else if (run != ena)
> > +   fprintf(output, "  (%.2f%%)", 100.0 * run / ena);
 
> That's not the standard pattern for 'else if' branches, but:
> 
>   } else {
>   if ()
>   ...
>   }
> 
> to make it stand apart more from a simple 'else' branch.

I think it is preferred to make it match the if branch if it uses curly
braces, i.e. make it look:

} else if () {
}


i.e switch like series of else if, to avoid too much indentation for such
constructs.

Fixed it and the other file, redid the perf-core-for-mingo tag, pushed.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] x86/fpu: don't abuse drop_init_fpu() in flush_thread()

2015-03-13 Thread Borislav Petkov
On Wed, Mar 11, 2015 at 06:35:07PM +0100, Oleg Nesterov wrote:
> drop_init_fpu() makes no sense. We need drop_fpu() and only if

Oh, please explain why. I can try to rhyme it up as something like "we
don't need to restore FPU context when flushing the thread" but I'm not
sure...

> !use_eager_fpu().
> 
> Signed-off-by: Oleg Nesterov 
> ---
>  arch/x86/kernel/process.c |   11 ---
>  1 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index c396de2..2e71120 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -131,14 +131,11 @@ void flush_thread(void)
>   flush_ptrace_hw_breakpoint(tsk);
>   memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
>  
> - drop_init_fpu(tsk);
> - /*
> -  * Free the FPU state for non xsave platforms. They get reallocated
> -  * lazily at the first use.
> -  */
> - if (!use_eager_fpu())
> + if (!use_eager_fpu()) {
> + /* FPU state will be reallocated lazily at the first use. */
> + drop_fpu(tsk);
>   free_thread_xstate(tsk);
> - else if (!used_math()) {
> + } else if (!used_math()) {
>   /* kthread execs. TODO: cleanup this horror. */
>   if (WARN_ON(init_fpu(current)))
>   force_sig(SIGKILL, current);

Also, can we clean up the tsk/current usage here?

We assign current to tsk and we work with it but then later use current
again. Needlessly confusing.

Thanks.

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 09/10] clocksource: atmel-st: remove mach/hardware dependency

2015-03-13 Thread Alexandre Belloni
Remove the mach/hardware dependency to prepare the driver for multiplatform
support.
Also switch from setup_irq() to request_irq()

Signed-off-by: Alexandre Belloni 
Acked-by: Daniel Lezcano 
---
 drivers/clocksource/timer-atmel-st.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/clocksource/timer-atmel-st.c 
b/drivers/clocksource/timer-atmel-st.c
index 674ef2519d6b..1692e17e096b 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -29,15 +29,12 @@
 #include 
 #include 
 
-#include 
-
-#include 
-
 static unsigned long last_crtr;
 static u32 irqmask;
 static struct clock_event_device clkevt;
 static struct regmap *regmap_st;
 
+#define AT91_SLOW_CLOCK32768
 #define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ)
 
 /*
@@ -96,13 +93,6 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void 
*dev_id)
return IRQ_NONE;
 }
 
-static struct irqaction at91rm9200_timer_irq = {
-   .name   = "at91_tick",
-   .flags  = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
-   .handler= at91rm9200_timer_interrupt,
-   .irq= NR_IRQS_LEGACY + AT91_ID_SYS,
-};
-
 static cycle_t read_clk32k(struct clocksource *cs)
 {
return read_CRTR();
@@ -193,6 +183,7 @@ static struct clock_event_device clkevt = {
 static void __init atmel_st_timer_init(struct device_node *node)
 {
unsigned int val;
+   int irq, ret;
 
regmap_st = syscon_node_to_regmap(node);
if (IS_ERR(regmap_st))
@@ -204,12 +195,16 @@ static void __init atmel_st_timer_init(struct device_node 
*node)
regmap_read(regmap_st, AT91_ST_SR, &val);
 
/* Get the interrupts property */
-   at91rm9200_timer_irq.irq  = irq_of_parse_and_map(node, 0);
-   if (!at91rm9200_timer_irq.irq)
+   irq  = irq_of_parse_and_map(node, 0);
+   if (!irq)
panic(pr_fmt("Unable to get IRQ from DT\n"));
 
/* Make IRQs happen for the system timer */
-   setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq);
+   ret = request_irq(irq, at91rm9200_timer_interrupt,
+ IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
+ "at91_tick", regmap_st);
+   if (ret)
+   panic(pr_fmt("Unable to setup IRQ\n"));
 
/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
 * directly for the clocksource and all clockevents, after adjusting
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RT 16/39] locking/rt-mutex: avoid a NULL pointer dereference on deadlock

2015-03-13 Thread Sebastian Andrzej Siewior
* Sebastian Andrzej Siewior | 2015-03-13 11:40:47 [+0100]:

>If you take this, could you take 9d3e2d02f54160725d97f4ab1e1e8de493fbf33a
>("locking/rtmutex: Set state back to running on error") it sits on my
>queue and is upstream already.

Or forget what I said. It is there already, it has been removed in
v4.0-rc1. That is why it was on my queue and I did not apply it…

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [rtc-linux] [PATCH 2/2] rtc: mediatek: Add MT63xx RTC driver

2015-03-13 Thread Sascha Hauer
Hi Eddie,

On Fri, Mar 13, 2015 at 06:29:23PM +0800, Eddie Huang wrote:
> > regmap_read() and regmap_write() can return errors.  There is no
> > checking for this.
> > 
> 
> I encounter some trouble when I add code to check return value of
> regmap_read and regmap_write. Every RTC register access through regmap,
> and there are many register read/write in this driver. If I check every
> return value, the driver will become ugly. I try to make this driver
> clean using following macro.
> 
> static int __rtc_read(struct mt6397_rtc *rtc, u32 offset, u32 *data)
> {
> u32 addr = rtc->addr_base + offset;
> 
> if (offset < rtc->addr_range)
> return regmap_read(rtc->regmap, addr, data);
> 
> return -EINVAL;
> }
> 
> #define rtc_read(ret, rtc, offset, data)\
> ({  \
> ret = __rtc_read(rtc, offset, data);\
> if (ret < 0)\
> goto rtc_exit;  \
> })  \

Hiding a goto (or return) in a macro is a very bad idea.

what you can do is

ret |= regmap_read(rtc->regmap, RTC_TC_SEC, &tm->tm_sec);
ret |= regmap_read(rtc->regmap, RTC_TC_MIN, &tm->tm_min);

if (ret)
return -EIO;

(Don't return ret in this case though as it might contain different
error codes orred together)

Another possibilty at least for contiguous registers would be
regmap_bulk_read().

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 1/6] drm: Add top level Kconfig option for DRM fbdev emulation

2015-03-13 Thread Archit Taneja



On 03/13/2015 02:36 PM, Daniel Vetter wrote:

On Fri, Mar 13, 2015 at 11:55:07AM +0530, Archit Taneja wrote:



On 03/11/2015 08:47 PM, Daniel Vetter wrote:

On Wed, Mar 11, 2015 at 01:51:02PM +0530, Archit Taneja wrote:



On 03/10/2015 05:47 PM, Daniel Vetter wrote:

On Tue, Mar 10, 2015 at 03:52:41PM +0530, Archit Taneja wrote:

On 03/10/2015 03:35 PM, Daniel Vetter wrote:

On Tue, Mar 10, 2015 at 03:22:49PM +0530, Archit Taneja wrote:

On 03/10/2015 03:17 PM, Daniel Vetter wrote:

On Tue, Mar 10, 2015 at 03:11:28PM +0530, Archit Taneja wrote:

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..38f83a0 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -40,6 +40,24 @@ config DRM_KMS_FB_HELPER
help
  FBDEV helpers for KMS drivers.

+config DRM_FBDEV_EMULATION
+   bool "Enable legacy fbdev support for your modesetting driver"
+   depends on DRM
+   select DRM_KMS_HELPER
+   select DRM_KMS_FB_HELPER
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+   select FB_SYS_FOPS
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
+   default y
+   help
+ Choose this option if you have a need for the legacy fbdev
+ support. Note that this support also provide the linux console
+ support on top of your modesetting driver.


Maybe clarify that for linux console support you also need
CONFIG_FRAMEBUFFER_CONSOLE? fbdev alone isn't enough.


DRM_KMS_FB_HELPER selects that for us, right?


Hm right I've missed that. Reminds me that you need one more patch at the
end to remove all the various select DRM_KMS_FB_HELPER from all drm
drivers. Otherwise this knob here won't work by default if you e.g. select
radeon. In general we can't mix explicit options with menu entries with a
select.


I was trying that out. Removing DRM_KMS_FB_HELPER and having
DRM_FBDEV_EMULATION disabled breaks drivers which use FB stuff internally in
their respective xyz_fbdev.c files.


But with the stubbed out functions that should work, right? Why doesn't
it?


There are still calls to functions from fb core like fb_set_suspend and
register_framebuffer which aren't covered by the drm fb helper functions.


Hm, sounds like we need another patch to stub out fb_set_suspend when
fbdev isn't enabled. Is there anything else?


There are a handful of fb core functions which are called by drm drivers:

fb_alloc_cmap/fb_dealloc_cmap

fb_sys_read/fb_sys_write

register_framebuffer/unregister_framebuffer/unlink_framebuffer/
remove_conflicting_framebuffers

fb_set_suspend

fb_deferred_io_init/fb_deferred_io_cleanup

framebuffer_alloc/framebuffer_release


Hm yeah that's somewhat annoying indeed. What about the following:
1. We move all the #include  from drivers into drm_fb_helper.h

2. Then we add stubs for these functions in drm_fb_helper.h, like this

#if defined(CONFIG_FB)
#include 
#else

/* static inline stubs for all the fb stuff used by kms drivers */
#endif

Imo this makes sense since kms drivers really have a bit a special
situation with fbdev. They're not full-blown fbdev drivers and can be
useful fully without fbdev.

What do you think?


This looks good! I'll give it a try.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RT 00/39] Linux 3.14.34-rt32-rc1

2015-03-13 Thread Sebastian Andrzej Siewior
* Steven Rostedt | 2015-03-12 15:13:07 [-0400]:

>Please scream at me if I messed something up. Please test the patches too.

Could you add Mike's "3.14.23-rt20 - fs,btrfs: fix rt deadlock on
extent_buffer->loc" [0] and that is the upper chunk (ctree.c only). As I
mentioned in the thread, the code is gone in v3.18 and I didn't apply
it.

[0] https://lkml.org/lkml/2014/11/2/34

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v10 18/21] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64

2015-03-13 Thread Lorenzo Pieralisi
On Fri, Mar 13, 2015 at 03:28:45AM +, Hanjun Guo wrote:

[...]

> >  /*
> >   * acpi_boot_table_init() called from setup_arch(), always.
> >   * 1. find RSDP and get its address, and then find XSDT
> >   * 2. extract all tables and checksums them all
> >   * 3. check ACPI FADT revision
> > + * 4. check ACPI FADT HW reduced flag
> >   *
> >   * We can parse ACPI boot-time tables such as MADT after
> >   * this function is called.
> >   */
> >  void __init acpi_boot_table_init(void)
> >  {
> > +   struct acpi_table_header *table;
> > +   struct acpi_table_fadt *fadt;
> > +   acpi_status status;
> > +   acpi_size tbl_size;
> > +
> > /*
> >  * Enable ACPI instead of device tree unless
> >  * - ACPI has been disabled explicitly (acpi=off), or
> > @@ -351,19 +318,52 @@ void __init acpi_boot_table_init(void)
> > (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
> > return;
> >  
> > -   enable_acpi();
> > -
> > /* Initialize the ACPI boot-time table parser. */
> > if (acpi_table_init()) {
> 
> Since we disable ACPI in default, it is a bit strange for me to init all
> the ACPI tables and parse FADT when ACPI is disabled, could you
> put some comments here to clarify the purpose? other than that, it is looks
> good to me.

Ok, the purpose was to make things simpler, but I think that given
current code it is not 100% safe to init ACPI tables with
acpi_disabled == 1.

To me having to enable ACPI to parse the tables and check *if* ACPI tables
are there is a bit crazy, but I agree with you that given current code
it is safer.

Patch rewritten, here below, please have a look, test it and rework
bits as needed, I added comments where I thought they were needed but
please add to that if you feel it is worth it.

It should be easy to split, let me know if you want an incremental
version.

Thanks !
Lorenzo

---
 arch/arm64/kernel/acpi.c | 103 +++
 1 file changed, 69 insertions(+), 34 deletions(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 5819ef7..e5ee4d4 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -291,43 +291,60 @@ void acpi_unregister_gsi(u32 gsi)
 }
 EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
 
-static int __init acpi_parse_fadt(struct acpi_table_header *table)
+/*
+ * acpi_fadt_sanity_check() - Check FADT presence and carry out sanity
+ *   checks on it
+ *
+ * Return 0 on success,  <0 on failure
+ */
+static int __init acpi_fadt_sanity_check(void)
 {
-   struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
+   struct acpi_table_header *table;
+   struct acpi_table_fadt *fadt;
+   acpi_status status;
+   acpi_size tbl_size;
+   int ret = 0;
+
+   /*
+* FADT is required on arm64; retrieve it to check its presence
+* and carry out revision and ACPI HW reduced compliancy tests
+*/
+   status = acpi_get_table_with_size(ACPI_SIG_FADT, 0, &table, &tbl_size);
+   if (ACPI_FAILURE(status)) {
+   const char *msg = acpi_format_exception(status);
+
+   pr_err("Failed to get FADT table, %s\n", msg);
+   return -ENODEV;
+   }
+
+   fadt = (struct acpi_table_fadt *)table;
 
/*
 * Revision in table header is the FADT Major revision, and there
 * is a minor revision of FADT which was introduced by ACPI 5.1,
 * we only deal with ACPI 5.1 or newer revision to get GIC and SMP
-* boot protocol configuration data, or we will disable ACPI.
+* boot protocol configuration data.
 */
-   if (table->revision > 5 ||
-   (table->revision == 5 && fadt->minor_revision >= 1)) {
-   if (!acpi_gbl_reduced_hardware) {
-   pr_err("Not hardware reduced ACPI mode, will not be 
supported\n");
-   goto disable_acpi;
-   }
-
-   /*
-* ACPI 5.1 only has two explicit methods to boot up SMP,
-* PSCI and Parking protocol, but the Parking protocol is
-* only specified for ARMv7 now, so make PSCI as the only
-* way for the SMP boot protocol before some updates for
-* the Parking protocol spec.
-*/
-   if (acpi_psci_present())
-   return 0;
-
-   pr_warn("No PSCI support, will not bring up secondary CPUs\n");
-   return -EOPNOTSUPP;
+   if (table->revision < 5 ||
+  (table->revision == 5 && fadt->minor_revision < 1)) {
+   pr_err("Unsupported FADT revision %d.%d, should be 5.1+\n",
+  table->revision, fadt->minor_revision);
+   ret = -EINVAL;
+   goto out;
}
 
-   pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable 
ACPI\n",
-   table->revision, fadt->minor_revision);
+

Re: [PATCH v2 0/3] btrfs: ENOMEM bugfixes

2015-03-13 Thread David Sterba
On Wed, Mar 11, 2015 at 09:40:17PM -0700, Omar Sandoval wrote:
> Ping. For anyone following along, it looks like commit cc87317726f8
> ("mm: page_alloc: revert inadvertent !__GFP_FS retry behavior change")
> reverted the commit that exposed these bugs. Josef said he was okay with
> taking these, will they make it to an upcoming -rc soon?

Upcoming yes, but based on my experience with pushing patches that are
not really regressions in late rc's it's unlikely for 4.1.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] Documentation: omap-twl4030: Remove ti,codec property

2015-03-13 Thread Arnd Bergmann
On Thursday 12 March 2015 22:14:59 Marek Belisko wrote:
> diff --git a/Documentation/devicetree/bindings/sound/omap-twl4030.txt 
> b/Documentation/devicetree/bindings/sound/omap-twl4030.txt
> index 1ab6bc8..656165f 100644
> --- a/Documentation/devicetree/bindings/sound/omap-twl4030.txt
> +++ b/Documentation/devicetree/bindings/sound/omap-twl4030.txt
> @@ -4,7 +4,6 @@ Required properties:
>  - compatible: "ti,omap-twl4030"
>  - ti,model: Name of the sound card (for example "omap3beagle")
>  - ti,mcbsp: phandle for the McBSP node
> -- ti,codec: phandle for the twl4030 audio node

As this was a required property, are you sure that no other operating system
uses it?

Even if not, you should probably change it to be an optional property, so
that the existing dtbs do not become noncompliant after the change.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] selftests/kcmp: exit with non-zero code in a fail case

2015-03-13 Thread Andrey Wagin
2015-03-13 13:37 GMT+03:00 Michael Ellerman :
> On Fri, 2015-03-13 at 12:27 +0300, Andrey Vagin wrote:
>> diff --git a/tools/testing/selftests/kselftest.h 
>> b/tools/testing/selftests/kselftest.h
>> index 572c888..a0ec8b8 100644
>> --- a/tools/testing/selftests/kselftest.h
>> +++ b/tools/testing/selftests/kselftest.h
>> @@ -58,5 +58,17 @@ static inline int ksft_exit_skip(void)
>>  {
>>   exit(4);
>>  }
>> +static inline int ksft_exit(void)
>> +{
>> + if (ksft_cnt.ksft_fail)
>> + return ksft_exit_fail();
>> + if (ksft_cnt.ksft_xpass)
>> + return ksft_exit_xpass();
>> + if (ksft_cnt.ksft_xskip)
>> + return ksft_exit_skip();
>> + if (ksft_cnt.ksft_xfail)
>> + return ksft_exit_xfail();
>> + ksft_exit_pass();
>> +}
>
> This function claims to return 'int', but doesn't. So do all the others.

I agree with this. I haven't seen any warning, because exit() never
returns back.

>
> It could be as simple as:

I think it isn't a good idea. In my version we can be sure that
ksft_exit_fail() and ksft_exit() return the same code in a fail case.

>
> static inline void ksft_exit(void)
> {
> if (ksft_cnt.ksft_fail)
> exit(1);
>
> if (ksft_cnt.ksft_xpass)
> exit(3);
>
> if (ksft_cnt.ksft_xskip)
> exit(4);
>
> if (ksft_cnt.ksft_xfail)
> exit(2);
>
> exit(0);
> }
>
> cheers
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 2/4] pci: iProc: define iProc PCIe platform bus binding

2015-03-13 Thread Arnd Bergmann
On Thursday 12 March 2015 16:14:48 Bjorn Helgaas wrote:
> [+cc Rob, Pawel, Mark, Ian, Kumar]
> 
> On Wed, Mar 11, 2015 at 11:06:07AM -0700, Ray Jui wrote:
> > Document the Broadcom iProc PCIe platform interface device tree binding
> > 
> > Signed-off-by: Ray Jui 
> > Reviewed-by: Scott Branden 
> 
> I'd like to get an ack for this from Arnd, Rob, or other device tree folks
> (CC'd).
> 

Sorry, I should have given my ack earlier. I've carefully reviewed the
previous versions and am happy with the current one.

Acked-by: Arnd Bergmann 

for the whole series.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/16] staging: rtl8723au: Reformat whitespace to increase readability

2015-03-13 Thread M. Vefa Bicakci
On 13/03/15 12:53 AM, Sudip Mukherjee wrote:
> you have not added the maintainers in your To list, and usually
> initials are discouraged in the Signed-off-by. The name here should
> be the name the way you use it to sign legal documents.

Hello Sudip,

This is a first for me, so thank you for the comments!

Regarding not including the maintainers in the To: list of the e-mail, good
point! In this case should I resend the patches after making sure that I include
Greg Kroah-Hartman, Larry Finger and Jes Sorensen's e-mail addresses in the To:
list? (get_maintainers.pl reports their names as the maintainers, and based on
the commit history, they are the major contributors and/or gate-keepers to this
staging driver.)

Actually, my first name is Vefa, and the "M" is for my middle name, for which I
only use an initial, as otherwise everyone ends up addressing me with my middle
name. Now, the question would be: Why is my middle name placed before my first
name? I realize this is quickly becoming off-topic for the mailing lists. If you
would like to learn more, I can explain the reasons in a private discussion.

Thanks again,

Vefa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [rtc-linux] [PATCH 2/2] rtc: mediatek: Add MT63xx RTC driver

2015-03-13 Thread Matthias Brugger


On 13/03/15 11:29, Eddie Huang wrote:
> 
> I encounter some trouble when I add code to check return value of
> regmap_read and regmap_write. Every RTC register access through regmap,
> and there are many register read/write in this driver. If I check every
> return value, the driver will become ugly. I try to make this driver
> clean using following macro.
> 
> static int __rtc_read(struct mt6397_rtc *rtc, u32 offset, u32 *data)
> {
> u32 addr = rtc->addr_base + offset;
> 
> if (offset < rtc->addr_range)
> return regmap_read(rtc->regmap, addr, data);
> 
> return -EINVAL;
> }
> 
> #define rtc_read(ret, rtc, offset, data)\
> ({  \
> ret = __rtc_read(rtc, offset, data);\
> if (ret < 0)\
> goto rtc_exit;  \
> })  \
> 

I agree with Sascha on hiding a goto statement in a macro is not a good idea.

> 
> And function call rtc_read, rtc_write looks like:
> 
> static int mtk_rtc_read_time(struct device *dev, struct rtc_time *tm)
> {
> unsigned long time;
> struct mt6397_rtc *rtc = dev_get_drvdata(dev);
> int ret = 0;
> u32 sec;
> 
> mutex_lock(&rtc->lock);
> do {
> rtc_read(ret, rtc, RTC_TC_SEC, &tm->tm_sec);
> rtc_read(ret, rtc, RTC_TC_MIN, &tm->tm_min);
> rtc_read(ret, rtc, RTC_TC_HOU, &tm->tm_hour);
> rtc_read(ret, rtc, RTC_TC_DOM, &tm->tm_mday);
> rtc_read(ret, rtc, RTC_TC_MTH, &tm->tm_mon);
> rtc_read(ret, rtc, RTC_TC_YEA, &tm->tm_year);
> rtc_read(ret, rtc, RTC_TC_SEC, &sec);
> } while (sec < tm->tm_sec);

What about introducing
static int __mtk_rtc_read_time(struct mt6397_rtc *rtc, struct rtc_time *tm, u32 
*sec)
and hide the checks of return values from regmap_read and the offset check in 
there. You return the error code or 0.

This way the while loop would look like this:

do {
ret = __mtk_rtc_read_time(rtc, &tm, &sec);
if (ret < 0)
goto rtc_exit;
} while (sec < tm->tm_sec);

Best regards,
Matthias

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mmc: dw_mmc: Add a timeout for sending CMD11

2015-03-13 Thread Jaehoon Chung
Hi Doug.

This patch is a right process. Just i wonder something.

On 03/10/2015 08:18 AM, Doug Anderson wrote:
> In the Designware databook's description of the "Voltage Switch Normal
> Scenario" it instructs us to set a timer and fail the voltage change
> if we don't see the voltage change interrupt within 2ms.  Let's
> implement that.  Without implementing this I have often been able to
> reproduce a hang while trying to send CMD11 on an rk3288-based board
> while constantly ejecting and inserting UHS cards.
> 
> Signed-off-by: Doug Anderson 
> ---
>  drivers/mmc/host/dw_mmc.c  | 26 ++
>  include/linux/mmc/dw_mmc.h |  2 ++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 47dfd0e..d259662 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1020,6 +1020,15 @@ static void __dw_mci_start_request(struct dw_mci *host,
>  
>   dw_mci_start_command(host, cmd, cmdflags);
>  
> + if (cmd->opcode == SD_SWITCH_VOLTAGE) {
> + /*
> +  * Databook says to fail after 2ms w/ no response; give an
> +  * extra jiffy just in case we're about to roll over.
> +  */
> + mod_timer(&host->cmd11_timer,
> +   jiffies + msecs_to_jiffies(2) + 1);

What's "plus one"?

> + }
> +
>   if (mrq->stop)
>   host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
>   else
> @@ -2158,6 +2167,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void 
> *dev_id)
>   /* Check volt switch first, since it can look like an error */
>   if ((host->state == STATE_SENDING_CMD11) &&
>   (pending & SDMMC_INT_VOLT_SWITCH)) {
> + del_timer(&host->cmd11_timer);
> +
>   mci_writel(host, RINTSTS, SDMMC_INT_VOLT_SWITCH);
>   pending &= ~SDMMC_INT_VOLT_SWITCH;
>   dw_mci_cmd_interrupt(host, pending);
> @@ -2571,6 +2582,18 @@ ciu_out:
>   return ret;
>  }
>  
> +static void dw_mci_cmd11_timer(unsigned long arg)
> +{
> + struct dw_mci *host = (struct dw_mci *)arg;
> +
> + if (host->state != STATE_SENDING_CMD11)
> + dev_info(host->dev, "Unexpected CMD11 timeout\n");

If Unexpected CMD11 timeout, can it do  just" return"?
Well, I think Unexpected CMD11 timeout is an rare case.

Best Regards,
Jaehoon Chung

> +
> + host->cmd_status = SDMMC_INT_RTO;
> + set_bit(EVENT_CMD_COMPLETE, &host->pending_events);
> + tasklet_schedule(&host->tasklet);
> +}
> +
>  #ifdef CONFIG_OF
>  static struct dw_mci_of_quirks {
>   char *quirk;
> @@ -2745,6 +2768,9 @@ int dw_mci_probe(struct dw_mci *host)
>   }
>   }
>  
> + setup_timer(&host->cmd11_timer,
> + dw_mci_cmd11_timer, (unsigned long)host);
> +
>   host->quirks = host->pdata->quirks;
>  
>   spin_lock_init(&host->lock);
> diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
> index 471fb31..9efc567 100644
> --- a/include/linux/mmc/dw_mmc.h
> +++ b/include/linux/mmc/dw_mmc.h
> @@ -202,6 +202,8 @@ struct dw_mci {
>   int irq;
>  
>   int sdio_id0;
> +
> + struct timer_list   cmd11_timer;
>  };
>  
>  /* DMA ops for Internal/External DMAC interface */
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCHv2 2/8] perf probe: Improve detection of file/function name in the probe pattern

2015-03-13 Thread Masami Hiramatsu
(2015/03/13 5:24), Arnaldo Carvalho de Melo wrote:
> Em Mon, Dec 15, 2014 at 08:20:32PM +0530, Naveen N. Rao escreveu:
>> Currently, perf probe considers patterns including a '.' to be a file.
>> However, this causes problems on powerpc ABIv1 where all functions have
>> a leading '.':
>>
>>   $ perf probe -F | grep schedule_timeout_interruptible
>>   .schedule_timeout_interruptible
>>   $ perf probe .schedule_timeout_interruptible
>>   Semantic error :File always requires line number or lazy pattern.
>> Error: Command Parse Error.
>>
>> Fix this by checking the probe pattern in more detail.
> 
> Masami, can I have your Acked-by or Reviewed-by?

As far as I can see, this is not enough for fixing that issue.
Could you fold the first half of [4/8] to this patch?
I also have some comments on it. See below.

>  
>> Signed-off-by: Naveen N. Rao 
>> ---
>>  tools/perf/util/probe-event.c | 23 ---
>>  1 file changed, 20 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>> index 28eb141..9943ff3 100644
>> --- a/tools/perf/util/probe-event.c
>> +++ b/tools/perf/util/probe-event.c
>> @@ -999,6 +999,24 @@ static int parse_perf_probe_point(char *arg, struct 
>> perf_probe_event *pev)
>>  arg = tmp;
>>  }
>>  
>> +/*
>> + * Check arg is function or file name and copy it.
>> + *
>> + * We consider arg to be a file spec if and only if it satisfies
>> + * all of the below criteria::
>> + * - it does not include any of "+@%",
>> + * - it includes one of ":;", and
>> + * - it has a period '.' in the name.
>> + *
>> + * Otherwise, we consider arg to be a function specification.
>> + */
>> +c = 0;

Oh please, don't reuse 'char c' for a boolean flag, you should
introduce new 'bool file_loc' etc.

>> +if (!strpbrk(arg, "+@%") && (ptr = strpbrk(arg, ";:")) != NULL) {
>> +/* This is a file spec if it includes a '.' before ; or : */
>> +if (memchr(arg, '.', ptr-arg))
^^ add spaces around '-'.

Thank you,


>> +c = 1;
>> +}
>> +
>>  ptr = strpbrk(arg, ";:+@%");
>>  if (ptr) {
>>  nc = *ptr;
>> @@ -1009,10 +1027,9 @@ static int parse_perf_probe_point(char *arg, struct 
>> perf_probe_event *pev)
>>  if (tmp == NULL)
>>  return -ENOMEM;
>>  
>> -/* Check arg is function or file and copy it */
>> -if (strchr(tmp, '.'))   /* File */
>> +if (c == 1)
>>  pp->file = tmp;
>> -else/* Function */
>> +else
>>  pp->function = tmp;
>>  
>>  /* Parse other options */
>> -- 
>> 2.1.3
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@hitachi.com


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: fix a segfault problem.

2015-03-13 Thread Namhyung Kim
On Fri, Mar 13, 2015 at 06:07:34PM +0800, Wang Nan wrote:
> On 2015/3/13 17:46, Namhyung Kim wrote:
> > On Fri, Mar 13, 2015 at 08:41:32AM +, Wang Nan wrote:
> >> Without this patch, perf report cause segfault if pass "" as '-t':
> >>
> >>   $ perf report -t ""
> >>
> >> # To display the perf.data header info, please use 
> >> --header/--header-only options.
> >> #
> >> # Samples: 37  of event 'syscalls:sys_enter_write'
> >> # Event count (approx.): 37
> >> #
> >> # ChildrenSelfCommand   Shared Object Symbol
> >> Segmentation fault
> >>
> >> This patch avoid the segfault by checking empty string for
> >> 'symbol_conf.field_sep'.
> > 
> > What about resetting it to NULL if empty string was given?
> > 
> 
> In fact I'm not very clear why we need such 'symbol_conf.field_sep', so I'm
> not sure whether '-t ""' is totally meanless or not.
> 
> -t option replaces a group of character with '.' and appends them after a 
> field.
> With -t 'abc' I get something like:
> 
>  #
>  # OverheadabcCommand   abcShared ObjectabcSymbol
>   100.00%abcb.beltr.ceabc[kernel.k.llsyms]abc[k] 0x810118f0
>   ...
> 
> Hard to read...
> 
> I read docs and your commit messages, but still not understand the option. 
> Could you
> please explain the goal and usage of that option again?

Well, I'm not the person who wrote the doc and introduced this
option. ;-)

Anyway AFAIK it's to generate a CSV file so usual value would be ','.
To reduce possible confusion due to the separation character in the
original output, it replaces the character during the generation.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: LZ4 : fix the data abort issue.

2015-03-13 Thread David Sterba
On Thu, Mar 12, 2015 at 08:28:55AM +, Yeon, JeHyeon (Tom) wrote:
> If the part of the compression data are corrupted, or the compression
> data is totally fake, the memory access over the limit is possible.
> 
> This is the log from my system usning lz4 decompression.
>[6502]data abort, halting
>[6503]r0  0x r1  0x r2  0xdcea0ffc r3  0xdcea0ffc
>[6509]r4  0xb9ab0bfd r5  0xdcea0ffc r6  0xdcea0ff8 r7  0xdce8
>[6515]r8  0x r9  0x r10 0x r11 0xb9a98000
>[6522]r12 0xdcea1000 usp 0x ulr 0x pc  0x820149bc
>[6528]spsr 0x41f3
> and the memory addresses of some variables at the moment are
> ref:0xdcea0ffc, op:0xdcea0ffc, oend:0xdcea1000
> 
> As you can see, COPYLENGH is 8bytes, so @ref and @op can access the momory
> over @oend.
> 
> Signed-off-by: tom.yeon 

Reviewed-by: David Sterba 

Matches implementation in lz4 upstream.

Btw, why is it a reply and not a standalone patch? I don't seem to find
any prior message in relevant mailinglists.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH] amdkfd: Convert timestamping to use 64bit time accessors

2015-03-13 Thread Arnd Bergmann
On Thursday 12 March 2015 10:23:40 John Stultz wrote:
> Convert the timestamping in the amdkfd driver to use
> a timespec64 and 64bit time accessors.
> 
> Cc: Arnd Bergmann 
> Cc: Oded Gabbay 
> Cc: David Airlie 
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: John Stultz 
> 

The patch looks good, but I'd always include at least a one-liner
about what it's good for. In this case, the existing code
is completely safe beyond y2038 because you are dealing with
monotonic time, so it's worth mentioning that we do this in
order to kill off all uses of struct timespec.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mtd: fsl_ifc_nand: use msecs_to_jiffies for time conversion

2015-03-13 Thread Nicholas Mc Guire
This is only an API consolidation and should make things more readable
it replaces var * HZ / 1000 by msecs_to_jiffies(var) which helps readability
and also handles all corner-cases properly.

Signed-off-by: Nicholas Mc Guire 
---

Patch was compile tested with corenet64_smp_defconfig 
(implies CONFIG_MTD_NAND_FSL_IFC=y)

Patch is against 4.0-rc3 (localversion-next is -next-20150313

 drivers/mtd/nand/fsl_ifc_nand.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 4c05f4f..51394e5 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -317,7 +317,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
 
/* wait for command complete flag or timeout */
wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat,
-  IFC_TIMEOUT_MSECS * HZ/1000);
+  msecs_to_jiffies(IFC_TIMEOUT_MSECS));
 
/* ctrl->nand_stat will be updated from IRQ context */
if (!ctrl->nand_stat)
@@ -860,7 +860,7 @@ static void fsl_ifc_sram_init(struct fsl_ifc_mtd *priv)
 
/* wait for command complete flag or timeout */
wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat,
-  IFC_TIMEOUT_MSECS * HZ/1000);
+  msecs_to_jiffies(IFC_TIMEOUT_MSECS));
 
if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC)
printk(KERN_ERR "fsl-ifc: Failed to Initialise SRAM\n");
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 tip 3/8] tracing: allow BPF programs to call bpf_ktime_get_ns()

2015-03-13 Thread He Kuang

Hi, Alexei

I've followed up your bpf version. In bpf filter, sometimes we need to
get 'pid' and some other context informations to decide whether to
filter or not.

For example, to trace a vfs read procedure, we can insert bpf program to
'__vfs_read(struct file *file, char __user *buf ...)', mark some of
'buf' addresses and only trace the read procedure of these 'buf's. But
this parameter is a userspace pointer, the value is meaningless to other
processes, so we should also record 'pid' to make sense.

To a function like __vfs_read, 'pid' can't be extracted from function
parameters directly. What's your opinion on this issue?

Thanks!

On 2015/3/11 12:18, Alexei Starovoitov wrote:

bpf_ktime_get_ns() is used by programs to compue time delta between events
or as a timestamp

Signed-off-by: Alexei Starovoitov 
---
  include/uapi/linux/bpf.h |1 +
  kernel/trace/bpf_trace.c |   11 +++
  2 files changed, 12 insertions(+)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 4486d36d2e9e..101e509d1001 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -165,6 +165,7 @@ enum bpf_func_id {
BPF_FUNC_map_update_elem, /* int map_update_elem(&map, &key, &value, 
flags) */
BPF_FUNC_map_delete_elem, /* int map_delete_elem(&map, &key) */
BPF_FUNC_probe_read,  /* int bpf_probe_read(void *dst, int size, 
void *src) */
+   BPF_FUNC_ktime_get_ns,/* u64 bpf_ktime_get_ns(void) */
__BPF_FUNC_MAX_ID,
  };
  
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c

index 450ea93ac4ab..ee7c2c629e75 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -56,6 +56,12 @@ static u64 bpf_probe_read(u64 r1, u64 r2, u64 r3, u64 r4, 
u64 r5)
return probe_kernel_read(dst, unsafe_ptr, size);
  }
  
+static u64 bpf_ktime_get_ns(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5)

+{
+   /* NMI safe access to clock monotonic */
+   return ktime_get_mono_fast_ns();
+}
+
  static struct bpf_func_proto kprobe_prog_funcs[] = {
[BPF_FUNC_probe_read] = {
.func = bpf_probe_read,
@@ -65,6 +71,11 @@ static struct bpf_func_proto kprobe_prog_funcs[] = {
.arg2_type = ARG_CONST_STACK_SIZE,
.arg3_type = ARG_ANYTHING,
},
+   [BPF_FUNC_ktime_get_ns] = {
+   .func = bpf_ktime_get_ns,
+   .gpl_only = true,
+   .ret_type = RET_INTEGER,
+   },
  };
  
  static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func_id)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    1   2   3   4   5   6   7   8   9   >