Re: [PATCH v2 1/5] arm64: dts: fsl: use a generic node name for m25p80 flashes

2018-09-09 Thread Li Yang
On Sun, Sep 9, 2018 at 10:11 PM Shawn Guo  wrote:
>
> The series looks good to me.  @Leo, what about you?

Looks fine to me too.

Acked-by: Li Yang 

>
> Shawn
>
> On Mon, Sep 03, 2018 at 04:08:36PM +0200, Alexandre Belloni wrote:
> > Use a generic node name for the m25p80 flashes on ls1043 and ls1046 boards.
> >
> > Signed-off-by: Alexandre Belloni 
> > ---
> >  arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts | 2 +-
> >  arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts | 2 +-
> >  arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | 4 ++--
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> > index c7b8d2c009cd..af972e91d6bc 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> > @@ -136,7 +136,7 @@
> >   bus-num = <0>;
> >   status = "okay";
> >
> > - qflash0: s25fl128s@0 {
> > + qflash0: flash@0 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> > index e69306e6b0b1..219068220b84 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> > @@ -165,7 +165,7 @@
> >   bus-num = <0>;
> >   status = "okay";
> >
> > - qflash0: s25fl128s@0 {
> > + qflash0: flash@0 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> > index 440e111651d5..df676b30357b 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> > @@ -103,7 +103,7 @@
> >   bus-num = <0>;
> >   status = "okay";
> >
> > - qflash0: s25fs512s@0 {
> > + qflash0: flash@0 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > @@ -111,7 +111,7 @@
> >   reg = <0>;
> >   };
> >
> > - qflash1: s25fs512s@1 {
> > + qflash1: flash@1 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > --
> > 2.19.0.rc1
> >


Re: [PATCH v2 1/5] arm64: dts: fsl: use a generic node name for m25p80 flashes

2018-09-09 Thread Li Yang
On Sun, Sep 9, 2018 at 10:11 PM Shawn Guo  wrote:
>
> The series looks good to me.  @Leo, what about you?

Looks fine to me too.

Acked-by: Li Yang 

>
> Shawn
>
> On Mon, Sep 03, 2018 at 04:08:36PM +0200, Alexandre Belloni wrote:
> > Use a generic node name for the m25p80 flashes on ls1043 and ls1046 boards.
> >
> > Signed-off-by: Alexandre Belloni 
> > ---
> >  arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts | 2 +-
> >  arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts | 2 +-
> >  arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | 4 ++--
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> > index c7b8d2c009cd..af972e91d6bc 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> > @@ -136,7 +136,7 @@
> >   bus-num = <0>;
> >   status = "okay";
> >
> > - qflash0: s25fl128s@0 {
> > + qflash0: flash@0 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> > index e69306e6b0b1..219068220b84 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> > @@ -165,7 +165,7 @@
> >   bus-num = <0>;
> >   status = "okay";
> >
> > - qflash0: s25fl128s@0 {
> > + qflash0: flash@0 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> > index 440e111651d5..df676b30357b 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> > @@ -103,7 +103,7 @@
> >   bus-num = <0>;
> >   status = "okay";
> >
> > - qflash0: s25fs512s@0 {
> > + qflash0: flash@0 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > @@ -111,7 +111,7 @@
> >   reg = <0>;
> >   };
> >
> > - qflash1: s25fs512s@1 {
> > + qflash1: flash@1 {
> >   compatible = "spansion,m25p80";
> >   #address-cells = <1>;
> >   #size-cells = <1>;
> > --
> > 2.19.0.rc1
> >


Re: locking/lockdep: Fix NMI handling

2018-09-09 Thread kbuild test robot
Hi Peter,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/locking/core]
[also build test ERROR on v4.19-rc2 next-20180906]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Peter-Zijlstra/locking-lockdep-Fix-NMI-handling/20180910-124306
config: i386-randconfig-x009-09101226 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/linux/spinlock_types.h:18:0,
from kernel/bounds.c:14:
   include/linux/lockdep.h: In function 'lockdep_off':
>> include/linux/lockdep.h:277:2: error: 'current' undeclared (first use in 
>> this function)
 current->lockdep_recursion++;
 ^~~
   include/linux/lockdep.h:277:2: note: each undeclared identifier is reported 
only once for each function it appears in
   include/linux/lockdep.h: In function 'lockdep_on':
   include/linux/lockdep.h:282:2: error: 'current' undeclared (first use in 
this function)
 current->lockdep_recursion--;
 ^~~
   make[2]: *** [kernel/bounds.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/current +277 include/linux/lockdep.h

   274  
   275  static inline void lockdep_off(void)
   276  {
 > 277  current->lockdep_recursion++;
   278  }
   279  

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


.config.gz
Description: application/gzip


Re: locking/lockdep: Fix NMI handling

2018-09-09 Thread kbuild test robot
Hi Peter,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/locking/core]
[also build test ERROR on v4.19-rc2 next-20180906]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Peter-Zijlstra/locking-lockdep-Fix-NMI-handling/20180910-124306
config: i386-randconfig-x009-09101226 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/linux/spinlock_types.h:18:0,
from kernel/bounds.c:14:
   include/linux/lockdep.h: In function 'lockdep_off':
>> include/linux/lockdep.h:277:2: error: 'current' undeclared (first use in 
>> this function)
 current->lockdep_recursion++;
 ^~~
   include/linux/lockdep.h:277:2: note: each undeclared identifier is reported 
only once for each function it appears in
   include/linux/lockdep.h: In function 'lockdep_on':
   include/linux/lockdep.h:282:2: error: 'current' undeclared (first use in 
this function)
 current->lockdep_recursion--;
 ^~~
   make[2]: *** [kernel/bounds.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/current +277 include/linux/lockdep.h

   274  
   275  static inline void lockdep_off(void)
   276  {
 > 277  current->lockdep_recursion++;
   278  }
   279  

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


.config.gz
Description: application/gzip


Re: [LKP] [tty] 0b4f83d510: INFO:task_blocked_for_more_than#seconds

2018-09-09 Thread Sergey Senozhatsky
On (09/07/18 08:39), Jiri Slaby wrote:
> > [  244.944070] 
> > [  244.944070] Showing all locks held in the system:
> > [  244.945558] 1 lock held by khungtaskd/18:
> > [  244.946495]  #0: (ptrval) (rcu_read_lock){}, at: 
> > debug_show_all_locks+0x16/0x190
> > [  244.948503] 2 locks held by askfirst/235:
> > [  244.949439]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> > [  244.951762]  #1: (ptrval) (>atomic_read_lock){+.+.}, at: 
> > n_tty_read+0x13d/0xa00
> 
> Here, it just seems to wait for input from the user.
> 
> > [  244.953799] 1 lock held by validate_data/655:
> > [  244.954814]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> > [  244.956764] 1 lock held by dnsmasq/668:
> > [  244.957649]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> > [  244.959598] 1 lock held by dropbear/734:
> > [  244.967564]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> 
> Hmm, I assume there is another task waiting for write_ldsem and that one
> prevents these readers to proceed. Unfortunately, due to the defunct
> __ptrval__ pointer hashing crap, we do not see who is waiting for what.
> But I am guessing all are the same locks.

Hmm, interesting. Am I getting it right that the test did pass before.
And now we see that sort of/smells like live-lock right after the
introduction of tty_ldisc_lock() to tty_reopen().

> So I think, we are forced to limit the waiting to 5 seconds in reopen in
> the end too (the same as we do for new open in tty_init_dev).

If I got it right, LKP did test the 5*HZ patch

retval = tty_ldisc_lock(tty, 5 * HZ);

At least it's
 In-Reply-To: <20180829022353.23568-3-d...@arista.com>

and
 Message-Id: <20180829022353.23568-3-d...@arista.com>

is the patch which does the 5*HZ lock timeout thing.

-ss


Re: [LKP] [tty] 0b4f83d510: INFO:task_blocked_for_more_than#seconds

2018-09-09 Thread Sergey Senozhatsky
On (09/07/18 08:39), Jiri Slaby wrote:
> > [  244.944070] 
> > [  244.944070] Showing all locks held in the system:
> > [  244.945558] 1 lock held by khungtaskd/18:
> > [  244.946495]  #0: (ptrval) (rcu_read_lock){}, at: 
> > debug_show_all_locks+0x16/0x190
> > [  244.948503] 2 locks held by askfirst/235:
> > [  244.949439]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> > [  244.951762]  #1: (ptrval) (>atomic_read_lock){+.+.}, at: 
> > n_tty_read+0x13d/0xa00
> 
> Here, it just seems to wait for input from the user.
> 
> > [  244.953799] 1 lock held by validate_data/655:
> > [  244.954814]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> > [  244.956764] 1 lock held by dnsmasq/668:
> > [  244.957649]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> > [  244.959598] 1 lock held by dropbear/734:
> > [  244.967564]  #0: (ptrval) (>ldisc_sem){}, at: 
> > tty_ldisc_ref_wait+0x25/0x50
> 
> Hmm, I assume there is another task waiting for write_ldsem and that one
> prevents these readers to proceed. Unfortunately, due to the defunct
> __ptrval__ pointer hashing crap, we do not see who is waiting for what.
> But I am guessing all are the same locks.

Hmm, interesting. Am I getting it right that the test did pass before.
And now we see that sort of/smells like live-lock right after the
introduction of tty_ldisc_lock() to tty_reopen().

> So I think, we are forced to limit the waiting to 5 seconds in reopen in
> the end too (the same as we do for new open in tty_init_dev).

If I got it right, LKP did test the 5*HZ patch

retval = tty_ldisc_lock(tty, 5 * HZ);

At least it's
 In-Reply-To: <20180829022353.23568-3-d...@arista.com>

and
 Message-Id: <20180829022353.23568-3-d...@arista.com>

is the patch which does the 5*HZ lock timeout thing.

-ss


linux-next: Tree for Sep 10

2018-09-09 Thread Stephen Rothwell
Hi all,

Changes since 20180907:

Dropped trees: xarray, ida (temporarily)

The vfs tree lost a build failure, but I have still disabled erofs.
It also gained other build failures for which I disabled building some
sampels and reverted a commit.

The net-next tree lost its build failure.

The bfp-next tree lost its build failure.

The akpm-current tree gained a conflict against the dma-mapping tree.

Non-merge commits (relative to Linus' tree): 2637
 2932 files changed, 91931 insertions(+), 59121 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc, an allmodconfig for x86_64, a
multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), I do an x86_64 modules_install followed by
builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit),
ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc
and sparc64 defconfig. And finally, a simple boot test of the powerpc
pseries_le_defconfig kernel in qemu (with and without kvm enabled).

Below is a summary of the state of the merge.

I am currently merging 287 trees (counting Linus' and 66 trees of bug
fix patches pending for the current merge release).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (9a5682765a2e Merge branch 'x86-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging fixes/master (72358c0b59b7 linux-next: build warnings from the build of 
Linus' tree)
Merging kbuild-current/fixes (f0b0d88a8251 kbuild: modules_install: warn when 
missing System.map file)
Merging arc-current/for-curr (dd45210b6dd4 ARC: don't check for HIGHMEM pages 
in arch_dma_alloc)
Merging arm-current/fixes (afc9f65e01cd ARM: 8781/1: Fix Thumb-2 syscall return 
for binutils 2.29+)
Merging arm64-fixes/for-next/fixes (fac880c7d074 arm64: fix erroneous warnings 
in page freeing functions)
Merging m68k-current/for-linus (0986b16ab49b m68k/mac: Use correct PMU response 
format)
Merging powerpc-fixes/fixes (cca19f0b684f powerpc/64s/radix: Fix missing global 
invalidations when removing copro)
Merging sparc/master (df2def49c57b Merge tag 'acpi-4.19-rc1-2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm)
Merging fscrypt-current/for-stable (ae64f9bd1d36 Linux 4.15-rc2)
Merging net/master (5d407b071dc3 ip: frags: fix crash in ip_do_fragment())
Merging bpf/master (28619527b8a7 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging ipsec/master (782710e333a5 xfrm: reset crypto_done when iterating over 
multiple input xfrms)
Merging netfilter/master (7acfda539c0b netfilter: nf_tables: release chain in 
flushing set)
Merging ipvs/master (feb9f55c33e5 netfilter: nft_dynset: allow dynamic updates 
of non-anonymous set)
Merging wireless-drivers/master (5b394b2ddf03 Linux 4.19-rc1)
Merging mac80211/master (6eae4a6c2be3 mac80211: fix pending queue hang due to 
TX_DROP)
Merging rdma-fixes/for-rc (8f28b178f71c RDMA/mlx4: Ensure that maximal 
send/receive SGE less than supported by HW)
Merging sound-current/for-linus (f7c50fa636f7 ALSA: hda: Fix several mismatch 
for register mask and value)
Merging sound-asoc-fixes/for-linus (65ee95658ef9 Merge branch 'asoc-4.19' into 
asoc-linus)
Merging regmap-fixes/for-linus (57361846b52b Linux 4.19-rc2)
Merging regulator-fixes/for-linus (25be6316a30a Merge branch 'regulator-4.19' 
into regulator-linus)
Merging spi-fixes/for-linus (af37a01f9f7d Merge branch 'spi-4.19' into 
spi-linus)
Merging pci-current/for-linus (342227b42fe8 PCI: pciehp: Fix hot-add vs 
powerfault detection order)
Merging driver-core.current/driver-core-linus (57361846b52b Linux 4.19-rc2)
Merging tty.current/tty-linus (57361846b52b Linux 4.19-rc2)
Merging usb.current/usb-linus (bfa150f37f80 Merge tag 'fixes-for-v4.19-rc2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus)
Merging usb-gadget-fixes/fixes (d9707490077b usb: 

linux-next: Tree for Sep 10

2018-09-09 Thread Stephen Rothwell
Hi all,

Changes since 20180907:

Dropped trees: xarray, ida (temporarily)

The vfs tree lost a build failure, but I have still disabled erofs.
It also gained other build failures for which I disabled building some
sampels and reverted a commit.

The net-next tree lost its build failure.

The bfp-next tree lost its build failure.

The akpm-current tree gained a conflict against the dma-mapping tree.

Non-merge commits (relative to Linus' tree): 2637
 2932 files changed, 91931 insertions(+), 59121 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc, an allmodconfig for x86_64, a
multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), I do an x86_64 modules_install followed by
builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit),
ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc
and sparc64 defconfig. And finally, a simple boot test of the powerpc
pseries_le_defconfig kernel in qemu (with and without kvm enabled).

Below is a summary of the state of the merge.

I am currently merging 287 trees (counting Linus' and 66 trees of bug
fix patches pending for the current merge release).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (9a5682765a2e Merge branch 'x86-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging fixes/master (72358c0b59b7 linux-next: build warnings from the build of 
Linus' tree)
Merging kbuild-current/fixes (f0b0d88a8251 kbuild: modules_install: warn when 
missing System.map file)
Merging arc-current/for-curr (dd45210b6dd4 ARC: don't check for HIGHMEM pages 
in arch_dma_alloc)
Merging arm-current/fixes (afc9f65e01cd ARM: 8781/1: Fix Thumb-2 syscall return 
for binutils 2.29+)
Merging arm64-fixes/for-next/fixes (fac880c7d074 arm64: fix erroneous warnings 
in page freeing functions)
Merging m68k-current/for-linus (0986b16ab49b m68k/mac: Use correct PMU response 
format)
Merging powerpc-fixes/fixes (cca19f0b684f powerpc/64s/radix: Fix missing global 
invalidations when removing copro)
Merging sparc/master (df2def49c57b Merge tag 'acpi-4.19-rc1-2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm)
Merging fscrypt-current/for-stable (ae64f9bd1d36 Linux 4.15-rc2)
Merging net/master (5d407b071dc3 ip: frags: fix crash in ip_do_fragment())
Merging bpf/master (28619527b8a7 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging ipsec/master (782710e333a5 xfrm: reset crypto_done when iterating over 
multiple input xfrms)
Merging netfilter/master (7acfda539c0b netfilter: nf_tables: release chain in 
flushing set)
Merging ipvs/master (feb9f55c33e5 netfilter: nft_dynset: allow dynamic updates 
of non-anonymous set)
Merging wireless-drivers/master (5b394b2ddf03 Linux 4.19-rc1)
Merging mac80211/master (6eae4a6c2be3 mac80211: fix pending queue hang due to 
TX_DROP)
Merging rdma-fixes/for-rc (8f28b178f71c RDMA/mlx4: Ensure that maximal 
send/receive SGE less than supported by HW)
Merging sound-current/for-linus (f7c50fa636f7 ALSA: hda: Fix several mismatch 
for register mask and value)
Merging sound-asoc-fixes/for-linus (65ee95658ef9 Merge branch 'asoc-4.19' into 
asoc-linus)
Merging regmap-fixes/for-linus (57361846b52b Linux 4.19-rc2)
Merging regulator-fixes/for-linus (25be6316a30a Merge branch 'regulator-4.19' 
into regulator-linus)
Merging spi-fixes/for-linus (af37a01f9f7d Merge branch 'spi-4.19' into 
spi-linus)
Merging pci-current/for-linus (342227b42fe8 PCI: pciehp: Fix hot-add vs 
powerfault detection order)
Merging driver-core.current/driver-core-linus (57361846b52b Linux 4.19-rc2)
Merging tty.current/tty-linus (57361846b52b Linux 4.19-rc2)
Merging usb.current/usb-linus (bfa150f37f80 Merge tag 'fixes-for-v4.19-rc2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus)
Merging usb-gadget-fixes/fixes (d9707490077b usb: 

[RFC][PATCH 5/8] make generic INIT_C_CC a bit more generic

2018-09-09 Thread Al Viro
From: Al Viro 

turn it into an array initializer; then mips variant folds into
it.

Signed-off-by: Al Viro 
---
 arch/mips/include/asm/termios.h  |  9 -
 include/linux/termios_internal.h | 15 ++-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
index dbb62330b7a4..12bc56857bf1 100644
--- a/arch/mips/include/asm/termios.h
+++ b/arch/mips/include/asm/termios.h
@@ -12,13 +12,4 @@
 #include 
 #include 
 
-/*
- * intr=^C quit=^\ erase=del   kill=^U
- * vmin=\1 vtime=\0eol2=\0 swtc=\0
- * start=^Qstop=^S susp=^Z vdsusp=
- * reprint=^R  discard=^U  werase=^W   lnext=^V
- * eof=^D  eol=\0
- */
-#define INIT_C_CC 
"\003\034\177\025\1\0\0\0\021\023\032\0\022\017\027\026\004\0"
-
 #endif /* _ASM_TERMIOS_H */
diff --git a/include/linux/termios_internal.h b/include/linux/termios_internal.h
index a77fd8df783e..d25b9a9c2faf 100644
--- a/include/linux/termios_internal.h
+++ b/include/linux/termios_internal.h
@@ -12,7 +12,20 @@
reprint=^R  discard=^U  werase=^W   lnext=^V
eol2=\0
 */
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+#define INIT_C_CC {\
+   [VINTR] = 'C'-0x40, \
+   [VQUIT] = '\\'-0x40,\
+   [VERASE] = '\177',  \
+   [VKILL] = 'U'-0x40, \
+   [VEOF] = 'D'-0x40,  \
+   [VSTART] = 'Q'-0x40,\
+   [VSTOP] = 'S'-0x40, \
+   [VSUSP] = 'Z'-0x40, \
+   [VREPRINT] = 'R'-0x40,  \
+   [VDISCARD] = 'O'-0x40,  \
+   [VWERASE] = 'W'-0x40,   \
+   [VLNEXT] = 'V'-0x40,\
+   [VMIN] = 1 }
 #endif
 
 #ifndef user_termio_to_kernel_termios
-- 
2.11.0



[RFC][PATCH 8/8] really consolidate INIT_C_CC definitions

2018-09-09 Thread Al Viro
From: Al Viro 

they vary in two respects (renumbering of fields aside):
* sparc (and nobody else) has dsusp; set to ^Y.
* original (on i386) has discard set to historical
value (^O), mistaken comment nonwithstanding.  alpha, ppc
and sparc have followed the comment.  Not that we'd ever
handled that thing anyway...

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/termios_internal.h   |  8 +---
 arch/powerpc/include/asm/termios_internal.h |  3 +--
 arch/sparc/include/asm/termios_internal.h   |  8 +---
 include/linux/termios_internal.h| 16 ++--
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/arch/alpha/include/asm/termios_internal.h 
b/arch/alpha/include/asm/termios_internal.h
index 6c2a67e65992..07d5c1a6cdf6 100644
--- a/arch/alpha/include/asm/termios_internal.h
+++ b/arch/alpha/include/asm/termios_internal.h
@@ -2,13 +2,7 @@
 #ifndef _ALPHA_TERMIOS_H
 #define _ALPHA_TERMIOS_H
 
-/* eof=^D  eol=\0  eol2=\0 erase=del
-   werase=^W   kill=^U reprint=^R  sxtc=\0
-   intr=^C quit=^\ susp=^Z 
-   start=^Qstop=^S lnext=^Vdiscard=^U
-   vmin=\1 vtime=\0
-*/
-#define INIT_C_CC 
"\004\000\000\177\027\025\022\000\003\034\032\000\021\023\026\025\001\000"
+#define INIT_C_CC_VDISCARD 'U'-0x40
 
 /*
  * Translate a "termio" structure into a "termios". Ugh.
diff --git a/arch/powerpc/include/asm/termios_internal.h 
b/arch/powerpc/include/asm/termios_internal.h
index b93e889342cf..116b138ea232 100644
--- a/arch/powerpc/include/asm/termios_internal.h
+++ b/arch/powerpc/include/asm/termios_internal.h
@@ -12,7 +12,6 @@
 #ifndef _ASM_POWERPC_TERMIOS_H
 #define _ASM_POWERPC_TERMIOS_H
 
-/*   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  
^S  ^V  ^U  */
-#define INIT_C_CC 
"\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
+#define INIT_C_CC_VDISCARD 'U'-0x40
 
 #endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/arch/sparc/include/asm/termios_internal.h 
b/arch/sparc/include/asm/termios_internal.h
index 028c6bd6e0a7..1649a0cecda9 100644
--- a/arch/sparc/include/asm/termios_internal.h
+++ b/arch/sparc/include/asm/termios_internal.h
@@ -13,13 +13,7 @@
 #define _VMIN  4
 #define _VTIME 5
 
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  eol=\0  eol2=\0 sxtc=\0
-   start=^Qstop=^S susp=^Z dsusp=^Y
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   vmin=\1 vtime=\0
-*/
-#define INIT_C_CC 
"\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001"
+#define INIT_C_CC_VDISCARD 'U'-0x40
 
 /*
  * Translate a "termios" structure into a "termio". Ugh.
diff --git a/include/linux/termios_internal.h b/include/linux/termios_internal.h
index 343f7868713d..549715b18d22 100644
--- a/include/linux/termios_internal.h
+++ b/include/linux/termios_internal.h
@@ -8,13 +8,24 @@
 #include 
 #endif
 
-#ifndef INIT_C_CC
 /* intr=^C quit=^\ erase=del   kill=^U
eof=^D  vtime=\0vmin=\1 sxtc=\0
start=^Qstop=^S susp=^Z eol=\0
reprint=^R  discard=^U  werase=^W   lnext=^V
eol2=\0
+   ... except that discard is actually ^O on most of them.
 */
+#ifndef INIT_C_CC_VDISCARD
+#define INIT_C_CC_VDISCARD 'O'-0x40
+#endif
+
+#ifdef VDSUSP
+#define INIT_C_CC_VDSUSP_EXTRA [VDSUSP] = 'Y'-0x40,
+#else
+#define INIT_C_CC_VDSUSP_EXTRA
+#endif
+
+#ifndef INIT_C_CC
 #define INIT_C_CC {\
[VINTR] = 'C'-0x40, \
[VQUIT] = '\\'-0x40,\
@@ -25,9 +36,10 @@
[VSTOP] = 'S'-0x40, \
[VSUSP] = 'Z'-0x40, \
[VREPRINT] = 'R'-0x40,  \
-   [VDISCARD] = 'O'-0x40,  \
+   [VDISCARD] = INIT_C_CC_VDISCARD,\
[VWERASE] = 'W'-0x40,   \
[VLNEXT] = 'V'-0x40,\
+   INIT_C_CC_VDSUSP_EXTRA  \
[VMIN] = 1 }
 #endif
 
-- 
2.11.0



[RFC][PATCH 2/8] move user_termio_to_kernel_termios/kernel_termios_to_user_termio

2018-09-09 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/termios.h   | 104 -
 arch/ia64/include/asm/termios.h|  31 ---
 arch/mips/include/asm/termios.h|  57 
 arch/parisc/include/asm/termios.h  |  31 ---
 arch/sparc/include/asm/termios.h   |  52 +++
 include/asm-generic/termios-base.h |  57 
 include/asm-generic/termios.h  |  53 ---
 include/linux/termios_internal.h   |  41 +++
 8 files changed, 114 insertions(+), 312 deletions(-)

diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h
index 1cd44956ae7b..63e1ffc8f719 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios.h
@@ -2,6 +2,7 @@
 #ifndef _ALPHA_TERMIOS_H
 #define _ALPHA_TERMIOS_H
 
+#include 
 #include 
 
 /* eof=^D  eol=\0  eol2=\0 erase=del
@@ -16,60 +17,65 @@
  * Translate a "termio" structure into a "termios". Ugh.
  */
 
-#define user_termio_to_kernel_termios(a_termios, u_termio) 
\
-({ 
\
-   struct ktermios *k_termios = (a_termios);   
\
-   struct termio k_termio; 
\
-   int canon, ret; 
\
-   
\
-   ret = copy_from_user(_termio, u_termio, sizeof(k_termio));
\
-   if (!ret) { 
\
-   /* Overwrite only the low bits.  */ 
\
-   *(unsigned short *)_termios->c_iflag = k_termio.c_iflag;  
\
-   *(unsigned short *)_termios->c_oflag = k_termio.c_oflag;  
\
-   *(unsigned short *)_termios->c_cflag = k_termio.c_cflag;  
\
-   *(unsigned short *)_termios->c_lflag = k_termio.c_lflag;  
\
-   canon = k_termio.c_lflag & ICANON;  
\
-   
\
-   k_termios->c_cc[VINTR]  = k_termio.c_cc[_VINTR];
\
-   k_termios->c_cc[VQUIT]  = k_termio.c_cc[_VQUIT];
\
-   k_termios->c_cc[VERASE] = k_termio.c_cc[_VERASE];   
\
-   k_termios->c_cc[VKILL]  = k_termio.c_cc[_VKILL];
\
-   k_termios->c_cc[VEOL2]  = k_termio.c_cc[_VEOL2];
\
-   k_termios->c_cc[VSWTC]  = k_termio.c_cc[_VSWTC];
\
-   k_termios->c_cc[canon ? VEOF : VMIN]  = k_termio.c_cc[_VEOF];   
\
-   k_termios->c_cc[canon ? VEOL : VTIME] = k_termio.c_cc[_VEOL];   
\
-   }   
\
-   ret;
\
-})
+static inline int user_termio_to_kernel_termios(struct ktermios *termios,
+   struct termio __user *termio)
+{
+   struct termio v;
+   bool canon;
+
+   if (copy_from_user(, termio, sizeof(struct termio)))
+   return -EFAULT;
+
+   termios->c_iflag = (0x & termios->c_iflag) | v.c_iflag;
+   termios->c_oflag = (0x & termios->c_oflag) | v.c_oflag;
+   termios->c_cflag = (0x & termios->c_cflag) | v.c_cflag;
+   termios->c_lflag = (0x & termios->c_lflag) | v.c_lflag;
+   termios->c_line = (0x & termios->c_lflag) | v.c_line;
+
+   canon = v.c_lflag & ICANON;
+   termios->c_cc[VINTR]  = v.c_cc[_VINTR];
+   termios->c_cc[VQUIT]  = v.c_cc[_VQUIT];
+   termios->c_cc[VERASE] = v.c_cc[_VERASE];
+   termios->c_cc[VKILL]  = v.c_cc[_VKILL];
+   termios->c_cc[VEOL2]  = v.c_cc[_VEOL2];
+   termios->c_cc[VSWTC]  = v.c_cc[_VSWTC];
+   termios->c_cc[canon ? VEOF : VMIN]  = v.c_cc[_VEOF];
+   termios->c_cc[canon ? VEOL : VTIME] = v.c_cc[_VEOL];
+
+   return 0;
+}
+#define user_termio_to_kernel_termios user_termio_to_kernel_termios
 
 /*
  * Translate a "termios" structure into a "termio". Ugh.
  *
  * Note the "fun" _VMIN overloading.
  */
-#define kernel_termios_to_user_termio(u_termio, a_termios) \
-({ \
-   struct ktermios *k_termios = (a_termios);   \
-   struct termio k_termio; \
-   int canon;  \
-   \
-   k_termio.c_iflag = k_termios->c_iflag;  \
-   k_termio.c_oflag = k_termios->c_oflag;   

[RFC][PATCH 7/8] switch x86 to generic uapi asm/termios.h

2018-09-09 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/x86/include/uapi/asm/Kbuild| 1 +
 arch/x86/include/uapi/asm/termios.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 arch/x86/include/uapi/asm/termios.h

diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 322681622d1e..56994b75c491 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += bpf_perf_event.h
+generic-y += termios.h
 generated-y += unistd_32.h
 generated-y += unistd_64.h
 generated-y += unistd_x32.h
diff --git a/arch/x86/include/uapi/asm/termios.h 
b/arch/x86/include/uapi/asm/termios.h
deleted file mode 100644
index 280d78a9d966..
--- a/arch/x86/include/uapi/asm/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-#include 
-- 
2.11.0



[RFC][PATCH 8/8] really consolidate INIT_C_CC definitions

2018-09-09 Thread Al Viro
From: Al Viro 

they vary in two respects (renumbering of fields aside):
* sparc (and nobody else) has dsusp; set to ^Y.
* original (on i386) has discard set to historical
value (^O), mistaken comment nonwithstanding.  alpha, ppc
and sparc have followed the comment.  Not that we'd ever
handled that thing anyway...

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/termios_internal.h   |  8 +---
 arch/powerpc/include/asm/termios_internal.h |  3 +--
 arch/sparc/include/asm/termios_internal.h   |  8 +---
 include/linux/termios_internal.h| 16 ++--
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/arch/alpha/include/asm/termios_internal.h 
b/arch/alpha/include/asm/termios_internal.h
index 6c2a67e65992..07d5c1a6cdf6 100644
--- a/arch/alpha/include/asm/termios_internal.h
+++ b/arch/alpha/include/asm/termios_internal.h
@@ -2,13 +2,7 @@
 #ifndef _ALPHA_TERMIOS_H
 #define _ALPHA_TERMIOS_H
 
-/* eof=^D  eol=\0  eol2=\0 erase=del
-   werase=^W   kill=^U reprint=^R  sxtc=\0
-   intr=^C quit=^\ susp=^Z 
-   start=^Qstop=^S lnext=^Vdiscard=^U
-   vmin=\1 vtime=\0
-*/
-#define INIT_C_CC 
"\004\000\000\177\027\025\022\000\003\034\032\000\021\023\026\025\001\000"
+#define INIT_C_CC_VDISCARD 'U'-0x40
 
 /*
  * Translate a "termio" structure into a "termios". Ugh.
diff --git a/arch/powerpc/include/asm/termios_internal.h 
b/arch/powerpc/include/asm/termios_internal.h
index b93e889342cf..116b138ea232 100644
--- a/arch/powerpc/include/asm/termios_internal.h
+++ b/arch/powerpc/include/asm/termios_internal.h
@@ -12,7 +12,6 @@
 #ifndef _ASM_POWERPC_TERMIOS_H
 #define _ASM_POWERPC_TERMIOS_H
 
-/*   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  
^S  ^V  ^U  */
-#define INIT_C_CC 
"\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
+#define INIT_C_CC_VDISCARD 'U'-0x40
 
 #endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/arch/sparc/include/asm/termios_internal.h 
b/arch/sparc/include/asm/termios_internal.h
index 028c6bd6e0a7..1649a0cecda9 100644
--- a/arch/sparc/include/asm/termios_internal.h
+++ b/arch/sparc/include/asm/termios_internal.h
@@ -13,13 +13,7 @@
 #define _VMIN  4
 #define _VTIME 5
 
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  eol=\0  eol2=\0 sxtc=\0
-   start=^Qstop=^S susp=^Z dsusp=^Y
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   vmin=\1 vtime=\0
-*/
-#define INIT_C_CC 
"\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001"
+#define INIT_C_CC_VDISCARD 'U'-0x40
 
 /*
  * Translate a "termios" structure into a "termio". Ugh.
diff --git a/include/linux/termios_internal.h b/include/linux/termios_internal.h
index 343f7868713d..549715b18d22 100644
--- a/include/linux/termios_internal.h
+++ b/include/linux/termios_internal.h
@@ -8,13 +8,24 @@
 #include 
 #endif
 
-#ifndef INIT_C_CC
 /* intr=^C quit=^\ erase=del   kill=^U
eof=^D  vtime=\0vmin=\1 sxtc=\0
start=^Qstop=^S susp=^Z eol=\0
reprint=^R  discard=^U  werase=^W   lnext=^V
eol2=\0
+   ... except that discard is actually ^O on most of them.
 */
+#ifndef INIT_C_CC_VDISCARD
+#define INIT_C_CC_VDISCARD 'O'-0x40
+#endif
+
+#ifdef VDSUSP
+#define INIT_C_CC_VDSUSP_EXTRA [VDSUSP] = 'Y'-0x40,
+#else
+#define INIT_C_CC_VDSUSP_EXTRA
+#endif
+
+#ifndef INIT_C_CC
 #define INIT_C_CC {\
[VINTR] = 'C'-0x40, \
[VQUIT] = '\\'-0x40,\
@@ -25,9 +36,10 @@
[VSTOP] = 'S'-0x40, \
[VSUSP] = 'Z'-0x40, \
[VREPRINT] = 'R'-0x40,  \
-   [VDISCARD] = 'O'-0x40,  \
+   [VDISCARD] = INIT_C_CC_VDISCARD,\
[VWERASE] = 'W'-0x40,   \
[VLNEXT] = 'V'-0x40,\
+   INIT_C_CC_VDSUSP_EXTRA  \
[VMIN] = 1 }
 #endif
 
-- 
2.11.0



[RFC][PATCH 2/8] move user_termio_to_kernel_termios/kernel_termios_to_user_termio

2018-09-09 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/termios.h   | 104 -
 arch/ia64/include/asm/termios.h|  31 ---
 arch/mips/include/asm/termios.h|  57 
 arch/parisc/include/asm/termios.h  |  31 ---
 arch/sparc/include/asm/termios.h   |  52 +++
 include/asm-generic/termios-base.h |  57 
 include/asm-generic/termios.h  |  53 ---
 include/linux/termios_internal.h   |  41 +++
 8 files changed, 114 insertions(+), 312 deletions(-)

diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h
index 1cd44956ae7b..63e1ffc8f719 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios.h
@@ -2,6 +2,7 @@
 #ifndef _ALPHA_TERMIOS_H
 #define _ALPHA_TERMIOS_H
 
+#include 
 #include 
 
 /* eof=^D  eol=\0  eol2=\0 erase=del
@@ -16,60 +17,65 @@
  * Translate a "termio" structure into a "termios". Ugh.
  */
 
-#define user_termio_to_kernel_termios(a_termios, u_termio) 
\
-({ 
\
-   struct ktermios *k_termios = (a_termios);   
\
-   struct termio k_termio; 
\
-   int canon, ret; 
\
-   
\
-   ret = copy_from_user(_termio, u_termio, sizeof(k_termio));
\
-   if (!ret) { 
\
-   /* Overwrite only the low bits.  */ 
\
-   *(unsigned short *)_termios->c_iflag = k_termio.c_iflag;  
\
-   *(unsigned short *)_termios->c_oflag = k_termio.c_oflag;  
\
-   *(unsigned short *)_termios->c_cflag = k_termio.c_cflag;  
\
-   *(unsigned short *)_termios->c_lflag = k_termio.c_lflag;  
\
-   canon = k_termio.c_lflag & ICANON;  
\
-   
\
-   k_termios->c_cc[VINTR]  = k_termio.c_cc[_VINTR];
\
-   k_termios->c_cc[VQUIT]  = k_termio.c_cc[_VQUIT];
\
-   k_termios->c_cc[VERASE] = k_termio.c_cc[_VERASE];   
\
-   k_termios->c_cc[VKILL]  = k_termio.c_cc[_VKILL];
\
-   k_termios->c_cc[VEOL2]  = k_termio.c_cc[_VEOL2];
\
-   k_termios->c_cc[VSWTC]  = k_termio.c_cc[_VSWTC];
\
-   k_termios->c_cc[canon ? VEOF : VMIN]  = k_termio.c_cc[_VEOF];   
\
-   k_termios->c_cc[canon ? VEOL : VTIME] = k_termio.c_cc[_VEOL];   
\
-   }   
\
-   ret;
\
-})
+static inline int user_termio_to_kernel_termios(struct ktermios *termios,
+   struct termio __user *termio)
+{
+   struct termio v;
+   bool canon;
+
+   if (copy_from_user(, termio, sizeof(struct termio)))
+   return -EFAULT;
+
+   termios->c_iflag = (0x & termios->c_iflag) | v.c_iflag;
+   termios->c_oflag = (0x & termios->c_oflag) | v.c_oflag;
+   termios->c_cflag = (0x & termios->c_cflag) | v.c_cflag;
+   termios->c_lflag = (0x & termios->c_lflag) | v.c_lflag;
+   termios->c_line = (0x & termios->c_lflag) | v.c_line;
+
+   canon = v.c_lflag & ICANON;
+   termios->c_cc[VINTR]  = v.c_cc[_VINTR];
+   termios->c_cc[VQUIT]  = v.c_cc[_VQUIT];
+   termios->c_cc[VERASE] = v.c_cc[_VERASE];
+   termios->c_cc[VKILL]  = v.c_cc[_VKILL];
+   termios->c_cc[VEOL2]  = v.c_cc[_VEOL2];
+   termios->c_cc[VSWTC]  = v.c_cc[_VSWTC];
+   termios->c_cc[canon ? VEOF : VMIN]  = v.c_cc[_VEOF];
+   termios->c_cc[canon ? VEOL : VTIME] = v.c_cc[_VEOL];
+
+   return 0;
+}
+#define user_termio_to_kernel_termios user_termio_to_kernel_termios
 
 /*
  * Translate a "termios" structure into a "termio". Ugh.
  *
  * Note the "fun" _VMIN overloading.
  */
-#define kernel_termios_to_user_termio(u_termio, a_termios) \
-({ \
-   struct ktermios *k_termios = (a_termios);   \
-   struct termio k_termio; \
-   int canon;  \
-   \
-   k_termio.c_iflag = k_termios->c_iflag;  \
-   k_termio.c_oflag = k_termios->c_oflag;   

[RFC][PATCH 7/8] switch x86 to generic uapi asm/termios.h

2018-09-09 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/x86/include/uapi/asm/Kbuild| 1 +
 arch/x86/include/uapi/asm/termios.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 arch/x86/include/uapi/asm/termios.h

diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 322681622d1e..56994b75c491 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += bpf_perf_event.h
+generic-y += termios.h
 generated-y += unistd_32.h
 generated-y += unistd_64.h
 generated-y += unistd_x32.h
diff --git a/arch/x86/include/uapi/asm/termios.h 
b/arch/x86/include/uapi/asm/termios.h
deleted file mode 100644
index 280d78a9d966..
--- a/arch/x86/include/uapi/asm/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-#include 
-- 
2.11.0



[RFC][PATCH 5/8] make generic INIT_C_CC a bit more generic

2018-09-09 Thread Al Viro
From: Al Viro 

turn it into an array initializer; then mips variant folds into
it.

Signed-off-by: Al Viro 
---
 arch/mips/include/asm/termios.h  |  9 -
 include/linux/termios_internal.h | 15 ++-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
index dbb62330b7a4..12bc56857bf1 100644
--- a/arch/mips/include/asm/termios.h
+++ b/arch/mips/include/asm/termios.h
@@ -12,13 +12,4 @@
 #include 
 #include 
 
-/*
- * intr=^C quit=^\ erase=del   kill=^U
- * vmin=\1 vtime=\0eol2=\0 swtc=\0
- * start=^Qstop=^S susp=^Z vdsusp=
- * reprint=^R  discard=^U  werase=^W   lnext=^V
- * eof=^D  eol=\0
- */
-#define INIT_C_CC 
"\003\034\177\025\1\0\0\0\021\023\032\0\022\017\027\026\004\0"
-
 #endif /* _ASM_TERMIOS_H */
diff --git a/include/linux/termios_internal.h b/include/linux/termios_internal.h
index a77fd8df783e..d25b9a9c2faf 100644
--- a/include/linux/termios_internal.h
+++ b/include/linux/termios_internal.h
@@ -12,7 +12,20 @@
reprint=^R  discard=^U  werase=^W   lnext=^V
eol2=\0
 */
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+#define INIT_C_CC {\
+   [VINTR] = 'C'-0x40, \
+   [VQUIT] = '\\'-0x40,\
+   [VERASE] = '\177',  \
+   [VKILL] = 'U'-0x40, \
+   [VEOF] = 'D'-0x40,  \
+   [VSTART] = 'Q'-0x40,\
+   [VSTOP] = 'S'-0x40, \
+   [VSUSP] = 'Z'-0x40, \
+   [VREPRINT] = 'R'-0x40,  \
+   [VDISCARD] = 'O'-0x40,  \
+   [VWERASE] = 'W'-0x40,   \
+   [VLNEXT] = 'V'-0x40,\
+   [VMIN] = 1 }
 #endif
 
 #ifndef user_termio_to_kernel_termios
-- 
2.11.0



[RFC][PATCH 4/8] make users of INIT_C_CC pull linux/termios_internal.h

2018-09-09 Thread Al Viro
From: Al Viro 

... and move the default definition in there

Signed-off-by: Al Viro 
---
 arch/ia64/include/asm/termios.h   |  9 -
 arch/parisc/include/asm/termios.h |  9 -
 arch/s390/include/asm/termios.h   |  9 -
 drivers/tty/hvc/hvcs.c|  1 +
 drivers/tty/tty_io.c  |  1 +
 drivers/tty/vcc.c |  1 +
 include/asm-generic/termios.h |  8 
 include/linux/termios_internal.h  | 10 ++
 8 files changed, 13 insertions(+), 35 deletions(-)

diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
index 66ca23c03f3c..1cef02701401 100644
--- a/arch/ia64/include/asm/termios.h
+++ b/arch/ia64/include/asm/termios.h
@@ -10,13 +10,4 @@
 
 #include 
 
-
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/parisc/include/asm/termios.h 
b/arch/parisc/include/asm/termios.h
index 2f5153be531f..1850a90befb3 100644
--- a/arch/parisc/include/asm/termios.h
+++ b/arch/parisc/include/asm/termios.h
@@ -4,13 +4,4 @@
 
 #include 
 
-
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _PARISC_TERMIOS_H */
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index 7ee16b5dcb6f..0e26fe97b0d4 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -9,13 +9,4 @@
 
 #include 
 
-
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _S390_TERMIOS_H */
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index cb4db1b3ca3c..f6be8f999026 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 32bc3e3fe4d3..9da2bd81e97e 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -97,6 +97,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 58b454c34560..f674306be121 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index 3ffed3886ff2..da3b0fe25442 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -6,12 +6,4 @@
 #include 
 #include 
 
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/linux/termios_internal.h b/include/linux/termios_internal.h
index 894f565ffc5f..a77fd8df783e 100644
--- a/include/linux/termios_internal.h
+++ b/include/linux/termios_internal.h
@@ -5,6 +5,16 @@
 #include 
 #include 
 
+#ifndef INIT_C_CC
+/* intr=^C quit=^\ erase=del   kill=^U
+   eof=^D  vtime=\0vmin=\1 sxtc=\0
+   start=^Qstop=^S susp=^Z eol=\0
+   reprint=^R  discard=^U  werase=^W   lnext=^V
+   eol2=\0
+*/
+#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+#endif
+
 #ifndef user_termio_to_kernel_termios
 /*
  * Translate a "termio" structure into a "termios". Ugh.
-- 
2.11.0



[RFC][PATCH 3/8] remove termios-base.h

2018-09-09 Thread Al Viro
From: Al Viro 

empty now

Signed-off-by: Al Viro 
---
 arch/powerpc/include/asm/termios.h |  2 --
 arch/s390/include/asm/termios.h|  2 --
 include/asm-generic/termios-base.h | 10 --
 3 files changed, 14 deletions(-)
 delete mode 100644 include/asm-generic/termios-base.h

diff --git a/arch/powerpc/include/asm/termios.h 
b/arch/powerpc/include/asm/termios.h
index b8353e2032d0..cb1e593e95bf 100644
--- a/arch/powerpc/include/asm/termios.h
+++ b/arch/powerpc/include/asm/termios.h
@@ -17,6 +17,4 @@
 /*   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  
^S  ^V  ^U  */
 #define INIT_C_CC 
"\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
 
-#include 
-
 #endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index 62759ac7a92b..7ee16b5dcb6f 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -18,6 +18,4 @@
 */
 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
-#include 
-
 #endif /* _S390_TERMIOS_H */
diff --git a/include/asm-generic/termios-base.h 
b/include/asm-generic/termios-base.h
deleted file mode 100644
index 63d948ab6746..
--- a/include/asm-generic/termios-base.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* termios.h: generic termios/termio user copying/translation
- */
-
-#ifndef _ASM_GENERIC_TERMIOS_BASE_H
-#define _ASM_GENERIC_TERMIOS_BASE_H
-
-#include 
-
-#endif /* _ASM_GENERIC_TERMIOS_BASE_H */
-- 
2.11.0



[RFC][PATCH 4/8] make users of INIT_C_CC pull linux/termios_internal.h

2018-09-09 Thread Al Viro
From: Al Viro 

... and move the default definition in there

Signed-off-by: Al Viro 
---
 arch/ia64/include/asm/termios.h   |  9 -
 arch/parisc/include/asm/termios.h |  9 -
 arch/s390/include/asm/termios.h   |  9 -
 drivers/tty/hvc/hvcs.c|  1 +
 drivers/tty/tty_io.c  |  1 +
 drivers/tty/vcc.c |  1 +
 include/asm-generic/termios.h |  8 
 include/linux/termios_internal.h  | 10 ++
 8 files changed, 13 insertions(+), 35 deletions(-)

diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
index 66ca23c03f3c..1cef02701401 100644
--- a/arch/ia64/include/asm/termios.h
+++ b/arch/ia64/include/asm/termios.h
@@ -10,13 +10,4 @@
 
 #include 
 
-
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/parisc/include/asm/termios.h 
b/arch/parisc/include/asm/termios.h
index 2f5153be531f..1850a90befb3 100644
--- a/arch/parisc/include/asm/termios.h
+++ b/arch/parisc/include/asm/termios.h
@@ -4,13 +4,4 @@
 
 #include 
 
-
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _PARISC_TERMIOS_H */
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index 7ee16b5dcb6f..0e26fe97b0d4 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -9,13 +9,4 @@
 
 #include 
 
-
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _S390_TERMIOS_H */
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index cb4db1b3ca3c..f6be8f999026 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 32bc3e3fe4d3..9da2bd81e97e 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -97,6 +97,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 58b454c34560..f674306be121 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index 3ffed3886ff2..da3b0fe25442 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -6,12 +6,4 @@
 #include 
 #include 
 
-/* intr=^C quit=^\ erase=del   kill=^U
-   eof=^D  vtime=\0vmin=\1 sxtc=\0
-   start=^Qstop=^S susp=^Z eol=\0
-   reprint=^R  discard=^U  werase=^W   lnext=^V
-   eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
 #endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/linux/termios_internal.h b/include/linux/termios_internal.h
index 894f565ffc5f..a77fd8df783e 100644
--- a/include/linux/termios_internal.h
+++ b/include/linux/termios_internal.h
@@ -5,6 +5,16 @@
 #include 
 #include 
 
+#ifndef INIT_C_CC
+/* intr=^C quit=^\ erase=del   kill=^U
+   eof=^D  vtime=\0vmin=\1 sxtc=\0
+   start=^Qstop=^S susp=^Z eol=\0
+   reprint=^R  discard=^U  werase=^W   lnext=^V
+   eol2=\0
+*/
+#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+#endif
+
 #ifndef user_termio_to_kernel_termios
 /*
  * Translate a "termio" structure into a "termios". Ugh.
-- 
2.11.0



[RFC][PATCH 3/8] remove termios-base.h

2018-09-09 Thread Al Viro
From: Al Viro 

empty now

Signed-off-by: Al Viro 
---
 arch/powerpc/include/asm/termios.h |  2 --
 arch/s390/include/asm/termios.h|  2 --
 include/asm-generic/termios-base.h | 10 --
 3 files changed, 14 deletions(-)
 delete mode 100644 include/asm-generic/termios-base.h

diff --git a/arch/powerpc/include/asm/termios.h 
b/arch/powerpc/include/asm/termios.h
index b8353e2032d0..cb1e593e95bf 100644
--- a/arch/powerpc/include/asm/termios.h
+++ b/arch/powerpc/include/asm/termios.h
@@ -17,6 +17,4 @@
 /*   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  
^S  ^V  ^U  */
 #define INIT_C_CC 
"\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
 
-#include 
-
 #endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index 62759ac7a92b..7ee16b5dcb6f 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -18,6 +18,4 @@
 */
 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
-#include 
-
 #endif /* _S390_TERMIOS_H */
diff --git a/include/asm-generic/termios-base.h 
b/include/asm-generic/termios-base.h
deleted file mode 100644
index 63d948ab6746..
--- a/include/asm-generic/termios-base.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* termios.h: generic termios/termio user copying/translation
- */
-
-#ifndef _ASM_GENERIC_TERMIOS_BASE_H
-#define _ASM_GENERIC_TERMIOS_BASE_H
-
-#include 
-
-#endif /* _ASM_GENERIC_TERMIOS_BASE_H */
-- 
2.11.0



[RFC][PATCH 6/8] untangle asm/termios.h mess

2018-09-09 Thread Al Viro
From: Al Viro 

Currently, asm/termios.h resolves either to uapi/asm/termios.h
(on architectures that don't have it) or to the same plus the
definitions that are only used by those who pull linux/termios_internal.h

That causes tons of inconveniences - e.g. we can't have generic
asm/termios.h with non-generic uapi/asm/termios.h.

Let's do the following:
* rename asm/termios.h to asm/termios_internal.h and make
linux/termios_internal.h pull that; that way all includes of
 will go directly to uapi/asm/termios.h
* all but 3 architectures actually have asm/termios.h completely
generic.  Make those 3 select a new config symbol (HAVE_TERMIOS_INTERNAL)
and make the include of asm/termios_internal.h conditional upon that.
Remove all generic instances of asm/termios.h (including include/asm-generic
one).
* get rid of one pointless include of  in
drivers/tty.

Signed-off-by: Al Viro 
---
 arch/Kconfig  |  3 +++
 arch/alpha/Kconfig|  1 +
 arch/alpha/include/asm/{termios.h => termios_internal.h}  |  3 ---
 arch/ia64/include/asm/termios.h   | 13 -
 arch/mips/include/asm/termios.h   | 15 ---
 arch/parisc/include/asm/termios.h |  7 ---
 arch/powerpc/Kconfig  |  1 +
 .../powerpc/include/asm/{termios.h => termios_internal.h} |  2 --
 arch/riscv/include/asm/Kbuild |  1 -
 arch/s390/include/asm/termios.h   | 12 
 arch/sparc/Kconfig|  1 +
 arch/sparc/include/asm/{termios.h => termios_internal.h}  |  4 
 drivers/tty/n_hdlc.c  |  1 -
 include/asm-generic/termios.h |  9 -
 include/linux/termios_internal.h  |  3 +++
 15 files changed, 9 insertions(+), 67 deletions(-)
 rename arch/alpha/include/asm/{termios.h => termios_internal.h} (97%)
 delete mode 100644 arch/ia64/include/asm/termios.h
 delete mode 100644 arch/mips/include/asm/termios.h
 delete mode 100644 arch/parisc/include/asm/termios.h
 rename arch/powerpc/include/asm/{termios.h => termios_internal.h} (96%)
 delete mode 100644 arch/s390/include/asm/termios.h
 rename arch/sparc/include/asm/{termios.h => termios_internal.h} (98%)
 delete mode 100644 include/asm-generic/termios.h

diff --git a/arch/Kconfig b/arch/Kconfig
index 6801123932a5..a36cce432768 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -727,6 +727,9 @@ config OLD_SIGACTION
 config COMPAT_OLD_SIGACTION
bool
 
+config HAS_TERMIOS_INTERNAL
+   bool
+
 config 64BIT_TIME
def_bool ARCH_HAS_64BIT_TIME
help
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 5b4f88363453..85120bbda191 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -30,6 +30,7 @@ config ALPHA
select MODULES_USE_ELF_RELA
select ODD_RT_SIGACTION
select OLD_SIGSUSPEND
+   select HAS_TERMIOS_INTERNAL
select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
help
  The Alpha is a 64-bit general-purpose processor designed and
diff --git a/arch/alpha/include/asm/termios.h 
b/arch/alpha/include/asm/termios_internal.h
similarity index 97%
rename from arch/alpha/include/asm/termios.h
rename to arch/alpha/include/asm/termios_internal.h
index 63e1ffc8f719..6c2a67e65992 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios_internal.h
@@ -2,9 +2,6 @@
 #ifndef _ALPHA_TERMIOS_H
 #define _ALPHA_TERMIOS_H
 
-#include 
-#include 
-
 /* eof=^D  eol=\0  eol2=\0 erase=del
werase=^W   kill=^U reprint=^R  sxtc=\0
intr=^C quit=^\ susp=^Z 
diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
deleted file mode 100644
index 1cef02701401..
--- a/arch/ia64/include/asm/termios.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Modified 1999
- * David Mosberger-Tang , Hewlett-Packard Co
- *
- * 99/01/28Added N_IRDA and N_SMSBLOCK
- */
-#ifndef _ASM_IA64_TERMIOS_H
-#define _ASM_IA64_TERMIOS_H
-
-#include 
-
-#endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
deleted file mode 100644
index 12bc56857bf1..
--- a/arch/mips/include/asm/termios.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1996, 2000, 2001 by Ralf Baechle
- * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
- */
-#ifndef _ASM_TERMIOS_H
-#define _ASM_TERMIOS_H
-
-#include 
-#include 
-
-#endif /* _ASM_TERMIOS_H */
diff --git 

[RFC][PATCH 1/8] start unifying termios convertors

2018-09-09 Thread Al Viro
From: Al Viro 

* new header (linut/termios_internal.h), pulled by the sole user of those
suckers
* defaults for user_termios_to_kernel_termios{,_1} and
kernel_termios_to_user_termios{,_1} moved over there

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/termios.h   |   6 --
 arch/ia64/include/asm/termios.h|   5 --
 arch/mips/include/asm/termios.h|  24 --
 arch/parisc/include/asm/termios.h  |   5 --
 arch/s390/include/asm/termios.h|   3 -
 arch/sparc/include/asm/termios.h   | 165 -
 drivers/tty/tty_ioctl.c|   1 +
 include/asm-generic/termios-base.h |  11 ---
 include/asm-generic/termios.h  |  38 -
 include/linux/termios_internal.h   |  58 +
 10 files changed, 148 insertions(+), 168 deletions(-)
 create mode 100644 include/linux/termios_internal.h

diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h
index 6a8c53dec57e..1cd44956ae7b 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios.h
@@ -72,10 +72,4 @@
copy_to_user(u_termio, _termio, sizeof(k_termio));\
 })
 
-#define user_termios_to_kernel_termios(k, u) \
-   copy_from_user(k, u, sizeof(struct termios))
-
-#define kernel_termios_to_user_termios(u, k) \
-   copy_to_user(u, k, sizeof(struct termios))
-
 #endif /* _ALPHA_TERMIOS_H */
diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
index 589c026444cc..1bd5ff9745e9 100644
--- a/arch/ia64/include/asm/termios.h
+++ b/arch/ia64/include/asm/termios.h
@@ -50,9 +50,4 @@
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
 })
 
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios2))
-#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, 
sizeof(struct termios))
-#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, 
sizeof(struct termios))
-
 #endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
index ce2d72e34274..3bd98a70e1d1 100644
--- a/arch/mips/include/asm/termios.h
+++ b/arch/mips/include/asm/termios.h
@@ -78,28 +78,4 @@ static inline int kernel_termios_to_user_termio(struct 
termio __user *termio,
return 0;
 }
 
-static inline int user_termios_to_kernel_termios(struct ktermios __user *k,
-   struct termios2 *u)
-{
-   return copy_from_user(k, u, sizeof(struct termios2)) ? -EFAULT : 0;
-}
-
-static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
-   struct ktermios *k)
-{
-   return copy_to_user(u, k, sizeof(struct termios2)) ? -EFAULT : 0;
-}
-
-static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
-   struct termios __user *u)
-{
-   return copy_from_user(k, u, sizeof(struct termios)) ? -EFAULT : 0;
-}
-
-static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
-   struct ktermios *k)
-{
-   return copy_to_user(u, k, sizeof(struct termios)) ? -EFAULT : 0;
-}
-
 #endif /* _ASM_TERMIOS_H */
diff --git a/arch/parisc/include/asm/termios.h 
b/arch/parisc/include/asm/termios.h
index cded9dc90c1b..679d31db8d77 100644
--- a/arch/parisc/include/asm/termios.h
+++ b/arch/parisc/include/asm/termios.h
@@ -44,9 +44,4 @@
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
 })
 
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios2))
-#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, 
sizeof(struct termios))
-#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, 
sizeof(struct termios))
-
 #endif /* _PARISC_TERMIOS_H */
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index 46fa3020b41e..62759ac7a92b 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -18,9 +18,6 @@
 */
 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios2))
-
 #include 
 
 #endif /* _S390_TERMIOS_H */
diff --git a/arch/sparc/include/asm/termios.h b/arch/sparc/include/asm/termios.h
index 4a558efdfa93..27a054a99a58 100644
--- a/arch/sparc/include/asm/termios.h
+++ b/arch/sparc/include/asm/termios.h
@@ -3,6 +3,7 @@
 #define _SPARC_TERMIOS_H
 
 #include 
+#include 
 
 
 /*
@@ -64,84 +65,96 @@
err; \
 })
 
-#define user_termios_to_kernel_termios(k, u) \
-({ \
-   int err; \
-   err  = get_user((k)->c_iflag, &(u)->c_iflag); \
-   err |= get_user((k)->c_oflag, &(u)->c_oflag); \
-   err |= get_user((k)->c_cflag, &(u)->c_cflag); \
-   err |= get_user((k)->c_lflag, 

[RFC][PATCH 6/8] untangle asm/termios.h mess

2018-09-09 Thread Al Viro
From: Al Viro 

Currently, asm/termios.h resolves either to uapi/asm/termios.h
(on architectures that don't have it) or to the same plus the
definitions that are only used by those who pull linux/termios_internal.h

That causes tons of inconveniences - e.g. we can't have generic
asm/termios.h with non-generic uapi/asm/termios.h.

Let's do the following:
* rename asm/termios.h to asm/termios_internal.h and make
linux/termios_internal.h pull that; that way all includes of
 will go directly to uapi/asm/termios.h
* all but 3 architectures actually have asm/termios.h completely
generic.  Make those 3 select a new config symbol (HAVE_TERMIOS_INTERNAL)
and make the include of asm/termios_internal.h conditional upon that.
Remove all generic instances of asm/termios.h (including include/asm-generic
one).
* get rid of one pointless include of  in
drivers/tty.

Signed-off-by: Al Viro 
---
 arch/Kconfig  |  3 +++
 arch/alpha/Kconfig|  1 +
 arch/alpha/include/asm/{termios.h => termios_internal.h}  |  3 ---
 arch/ia64/include/asm/termios.h   | 13 -
 arch/mips/include/asm/termios.h   | 15 ---
 arch/parisc/include/asm/termios.h |  7 ---
 arch/powerpc/Kconfig  |  1 +
 .../powerpc/include/asm/{termios.h => termios_internal.h} |  2 --
 arch/riscv/include/asm/Kbuild |  1 -
 arch/s390/include/asm/termios.h   | 12 
 arch/sparc/Kconfig|  1 +
 arch/sparc/include/asm/{termios.h => termios_internal.h}  |  4 
 drivers/tty/n_hdlc.c  |  1 -
 include/asm-generic/termios.h |  9 -
 include/linux/termios_internal.h  |  3 +++
 15 files changed, 9 insertions(+), 67 deletions(-)
 rename arch/alpha/include/asm/{termios.h => termios_internal.h} (97%)
 delete mode 100644 arch/ia64/include/asm/termios.h
 delete mode 100644 arch/mips/include/asm/termios.h
 delete mode 100644 arch/parisc/include/asm/termios.h
 rename arch/powerpc/include/asm/{termios.h => termios_internal.h} (96%)
 delete mode 100644 arch/s390/include/asm/termios.h
 rename arch/sparc/include/asm/{termios.h => termios_internal.h} (98%)
 delete mode 100644 include/asm-generic/termios.h

diff --git a/arch/Kconfig b/arch/Kconfig
index 6801123932a5..a36cce432768 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -727,6 +727,9 @@ config OLD_SIGACTION
 config COMPAT_OLD_SIGACTION
bool
 
+config HAS_TERMIOS_INTERNAL
+   bool
+
 config 64BIT_TIME
def_bool ARCH_HAS_64BIT_TIME
help
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 5b4f88363453..85120bbda191 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -30,6 +30,7 @@ config ALPHA
select MODULES_USE_ELF_RELA
select ODD_RT_SIGACTION
select OLD_SIGSUSPEND
+   select HAS_TERMIOS_INTERNAL
select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
help
  The Alpha is a 64-bit general-purpose processor designed and
diff --git a/arch/alpha/include/asm/termios.h 
b/arch/alpha/include/asm/termios_internal.h
similarity index 97%
rename from arch/alpha/include/asm/termios.h
rename to arch/alpha/include/asm/termios_internal.h
index 63e1ffc8f719..6c2a67e65992 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios_internal.h
@@ -2,9 +2,6 @@
 #ifndef _ALPHA_TERMIOS_H
 #define _ALPHA_TERMIOS_H
 
-#include 
-#include 
-
 /* eof=^D  eol=\0  eol2=\0 erase=del
werase=^W   kill=^U reprint=^R  sxtc=\0
intr=^C quit=^\ susp=^Z 
diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
deleted file mode 100644
index 1cef02701401..
--- a/arch/ia64/include/asm/termios.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Modified 1999
- * David Mosberger-Tang , Hewlett-Packard Co
- *
- * 99/01/28Added N_IRDA and N_SMSBLOCK
- */
-#ifndef _ASM_IA64_TERMIOS_H
-#define _ASM_IA64_TERMIOS_H
-
-#include 
-
-#endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
deleted file mode 100644
index 12bc56857bf1..
--- a/arch/mips/include/asm/termios.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1996, 2000, 2001 by Ralf Baechle
- * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
- */
-#ifndef _ASM_TERMIOS_H
-#define _ASM_TERMIOS_H
-
-#include 
-#include 
-
-#endif /* _ASM_TERMIOS_H */
diff --git 

[RFC][PATCH 1/8] start unifying termios convertors

2018-09-09 Thread Al Viro
From: Al Viro 

* new header (linut/termios_internal.h), pulled by the sole user of those
suckers
* defaults for user_termios_to_kernel_termios{,_1} and
kernel_termios_to_user_termios{,_1} moved over there

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/termios.h   |   6 --
 arch/ia64/include/asm/termios.h|   5 --
 arch/mips/include/asm/termios.h|  24 --
 arch/parisc/include/asm/termios.h  |   5 --
 arch/s390/include/asm/termios.h|   3 -
 arch/sparc/include/asm/termios.h   | 165 -
 drivers/tty/tty_ioctl.c|   1 +
 include/asm-generic/termios-base.h |  11 ---
 include/asm-generic/termios.h  |  38 -
 include/linux/termios_internal.h   |  58 +
 10 files changed, 148 insertions(+), 168 deletions(-)
 create mode 100644 include/linux/termios_internal.h

diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h
index 6a8c53dec57e..1cd44956ae7b 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios.h
@@ -72,10 +72,4 @@
copy_to_user(u_termio, _termio, sizeof(k_termio));\
 })
 
-#define user_termios_to_kernel_termios(k, u) \
-   copy_from_user(k, u, sizeof(struct termios))
-
-#define kernel_termios_to_user_termios(u, k) \
-   copy_to_user(u, k, sizeof(struct termios))
-
 #endif /* _ALPHA_TERMIOS_H */
diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
index 589c026444cc..1bd5ff9745e9 100644
--- a/arch/ia64/include/asm/termios.h
+++ b/arch/ia64/include/asm/termios.h
@@ -50,9 +50,4 @@
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
 })
 
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios2))
-#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, 
sizeof(struct termios))
-#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, 
sizeof(struct termios))
-
 #endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
index ce2d72e34274..3bd98a70e1d1 100644
--- a/arch/mips/include/asm/termios.h
+++ b/arch/mips/include/asm/termios.h
@@ -78,28 +78,4 @@ static inline int kernel_termios_to_user_termio(struct 
termio __user *termio,
return 0;
 }
 
-static inline int user_termios_to_kernel_termios(struct ktermios __user *k,
-   struct termios2 *u)
-{
-   return copy_from_user(k, u, sizeof(struct termios2)) ? -EFAULT : 0;
-}
-
-static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
-   struct ktermios *k)
-{
-   return copy_to_user(u, k, sizeof(struct termios2)) ? -EFAULT : 0;
-}
-
-static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
-   struct termios __user *u)
-{
-   return copy_from_user(k, u, sizeof(struct termios)) ? -EFAULT : 0;
-}
-
-static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
-   struct ktermios *k)
-{
-   return copy_to_user(u, k, sizeof(struct termios)) ? -EFAULT : 0;
-}
-
 #endif /* _ASM_TERMIOS_H */
diff --git a/arch/parisc/include/asm/termios.h 
b/arch/parisc/include/asm/termios.h
index cded9dc90c1b..679d31db8d77 100644
--- a/arch/parisc/include/asm/termios.h
+++ b/arch/parisc/include/asm/termios.h
@@ -44,9 +44,4 @@
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
 })
 
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios2))
-#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, 
sizeof(struct termios))
-#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, 
sizeof(struct termios))
-
 #endif /* _PARISC_TERMIOS_H */
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index 46fa3020b41e..62759ac7a92b 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -18,9 +18,6 @@
 */
 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, 
sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct 
termios2))
-
 #include 
 
 #endif /* _S390_TERMIOS_H */
diff --git a/arch/sparc/include/asm/termios.h b/arch/sparc/include/asm/termios.h
index 4a558efdfa93..27a054a99a58 100644
--- a/arch/sparc/include/asm/termios.h
+++ b/arch/sparc/include/asm/termios.h
@@ -3,6 +3,7 @@
 #define _SPARC_TERMIOS_H
 
 #include 
+#include 
 
 
 /*
@@ -64,84 +65,96 @@
err; \
 })
 
-#define user_termios_to_kernel_termios(k, u) \
-({ \
-   int err; \
-   err  = get_user((k)->c_iflag, &(u)->c_iflag); \
-   err |= get_user((k)->c_oflag, &(u)->c_oflag); \
-   err |= get_user((k)->c_cflag, &(u)->c_cflag); \
-   err |= get_user((k)->c_lflag, 

RE: [RFC PATCH v3 3/3] reset: reset-zynqmp: Adding support for Xilinx zynqmp reset controller.

2018-09-09 Thread Nava kishore Manne
Hi Philipp

Thanks for the quick response...
Please find my response inline.

> -Original Message-
> From: Philipp Zabel [mailto:p.za...@pengutronix.de]
> Sent: Wednesday, September 5, 2018 4:00 PM
> To: Nava kishore Manne ; robh...@kernel.org;
> mark.rutl...@arm.com; Michal Simek ; Rajan Vaja
> ; Jolly Shah ;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [RFC PATCH v3 3/3] reset: reset-zynqmp: Adding support for Xilinx
> zynqmp reset controller.
> 
> Hi,
> 
> thank you for the patch. I have a few comments below:
> 
> On Wed, 2018-09-05 at 12:39 +0530, Nava kishore Manne wrote:
> > Add a reset controller driver for Xilinx Zynq UltraScale+ MPSoC.
> > The zynqmp reset-controller has the ability to reset lines connected
> > to different blocks and peripheral in the Soc.
> >
> > Signed-off-by: Nava kishore Manne 
> > ---
> > Changes for v3:
> > -None.
> > Changes for v2:
> > -Moved eemi_ops into a priv struct as suggested
> >  by philipp.
> >
> >  drivers/reset/Makefile   |   1 +
> >  drivers/reset/reset-zynqmp.c | 115
> > +++
> >  2 files changed, 116 insertions(+)
> >  create mode 100644 drivers/reset/reset-zynqmp.c
> >
> > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index
> > c1261dc..27e4a33 100644
> > --- a/drivers/reset/Makefile
> > +++ b/drivers/reset/Makefile
> > @@ -21,4 +21,5 @@ obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
> >  obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
> >  obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
> >  obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
> > +obj-$(CONFIG_ARCH_ZYNQMP) += reset-zynqmp.o
> >
> > diff --git a/drivers/reset/reset-zynqmp.c
> > b/drivers/reset/reset-zynqmp.c new file mode 100644 index
> > 000..f908492
> > --- /dev/null
> > +++ b/drivers/reset/reset-zynqmp.c
> > @@ -0,0 +1,115 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2018 Xilinx, Inc.
> > + *
> > + */
> > +
> > +#include 
> 
> I think including io.h is not necessary.
> 
> [...]

Will fix in the next version.

> > +static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
> > +  unsigned long id)
> > +{
> > +   struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
> > +   int val, err;
> > +
> > +   err = priv->eemi_ops->reset_get_status(ZYNQMP_RESET_ID + id, );
> > +   if (!err)
> > +   return -EINVAL;
> 
> This looks like it should be
> 
>   if (err)
>   return err;
> 
> instead.
> 
> [...]
Will fix in the next version.

> > +static struct reset_control_ops zynqmp_reset_ops = {
> 
> static const struct reset_control_ops zynqmp_reset_ops = {
> 
Will fix in the next version.

> > +   .reset = zynqmp_reset_reset,
> > +   .assert = zynqmp_reset_assert,
> > +   .deassert = zynqmp_reset_deassert,
> > +   .status = zynqmp_reset_status,
> > +};
> > +
> > +static int zynqmp_reset_probe(struct platform_device *pdev) {
> > +   struct zynqmp_reset_data *priv;
> > +
> > +   priv = devm_kzalloc(>dev,
> > +   sizeof(*priv), GFP_KERNEL);
> 
> This should fit on one line.
> 
Will fix in the next version.

Regards,
Navakishore.


[RFC][PATCHES] termios.h cleanups

2018-09-09 Thread Al Viro
asm/termios.h has tons of duplication and rather
convoluted logics re includes.

First of all, while everyone has uapi asm/termios.h,
some architectures have asm/termios.h and some do not.  So
include of  can go either to arch asm/termios.h,
or to uapi/asm/termios.h.
In the former case asm/termios.h defines a bunch of
helpers (used in just one file) and a constant (3 more users)
and includes uapi/asm/termios.h
In the latter... uapi/asm/termios.h is in generated-y
or equivalent to it.  Which is to say, it ends up doing
#include .  Userland-side that would
refer to uapi/asm-generic/termios.h, but kernel-side we end
up with plain asm-generic/termios.h.  Which defines the same
set of helpers and a constant and pulls uapi/asm-generic/termios.h

Helpers in question are heavily shared; there is an attempt
to put them into a common header (termios-base.h), but not all
instances use it.  Another unpleasant thing is that said helpers
tend to be macros, with very little typechecking.  And all of that
is pulled in by a lot more places than those that are actually
interested - 500-odd instead of 4.

Below is an attempt to untangle that; the branch is 
vfs.git#work.termios,
patches in followups.  FWIW, diffstat is

 arch/Kconfig   |   3 +
 arch/alpha/Kconfig |   1 +
 arch/alpha/include/asm/termios.h   |  81 
 arch/alpha/include/asm/termios_internal.h  |  72 ++
 arch/ia64/include/asm/termios.h|  58 
 arch/mips/include/asm/termios.h| 105 ---
 arch/parisc/include/asm/termios.h  |  52 
 arch/powerpc/Kconfig   |   1 +
 .../include/asm/{termios.h => termios_internal.h}  |   7 +-
 arch/riscv/include/asm/Kbuild  |   1 -
 arch/s390/include/asm/termios.h|  26 
 arch/sparc/Kconfig |   1 +
 arch/sparc/include/asm/termios.h   | 147 -
 arch/sparc/include/asm/termios_internal.h  | 134 +++
 arch/x86/include/uapi/asm/Kbuild   |   1 +
 arch/x86/include/uapi/asm/termios.h|   1 -
 drivers/tty/hvc/hvcs.c |   1 +
 drivers/tty/n_hdlc.c   |   1 -
 drivers/tty/tty_io.c   |   1 +
 drivers/tty/tty_ioctl.c|   1 +
 drivers/tty/vcc.c  |   1 +
 include/asm-generic/termios-base.h |  78 ---
 include/asm-generic/termios.h  | 108 ---
 include/linux/termios_internal.h   | 137 +++
 24 files changed, 355 insertions(+), 664 deletions(-)
 delete mode 100644 arch/alpha/include/asm/termios.h
 create mode 100644 arch/alpha/include/asm/termios_internal.h
 delete mode 100644 arch/ia64/include/asm/termios.h
 delete mode 100644 arch/mips/include/asm/termios.h
 delete mode 100644 arch/parisc/include/asm/termios.h
 rename arch/powerpc/include/asm/{termios.h => termios_internal.h} (70%)
 delete mode 100644 arch/s390/include/asm/termios.h
 delete mode 100644 arch/sparc/include/asm/termios.h
 create mode 100644 arch/sparc/include/asm/termios_internal.h
 delete mode 100644 arch/x86/include/uapi/asm/termios.h
 delete mode 100644 include/asm-generic/termios-base.h
 delete mode 100644 include/asm-generic/termios.h
 create mode 100644 include/linux/termios_internal.h


RE: [RFC PATCH v3 3/3] reset: reset-zynqmp: Adding support for Xilinx zynqmp reset controller.

2018-09-09 Thread Nava kishore Manne
Hi Philipp

Thanks for the quick response...
Please find my response inline.

> -Original Message-
> From: Philipp Zabel [mailto:p.za...@pengutronix.de]
> Sent: Wednesday, September 5, 2018 4:00 PM
> To: Nava kishore Manne ; robh...@kernel.org;
> mark.rutl...@arm.com; Michal Simek ; Rajan Vaja
> ; Jolly Shah ;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [RFC PATCH v3 3/3] reset: reset-zynqmp: Adding support for Xilinx
> zynqmp reset controller.
> 
> Hi,
> 
> thank you for the patch. I have a few comments below:
> 
> On Wed, 2018-09-05 at 12:39 +0530, Nava kishore Manne wrote:
> > Add a reset controller driver for Xilinx Zynq UltraScale+ MPSoC.
> > The zynqmp reset-controller has the ability to reset lines connected
> > to different blocks and peripheral in the Soc.
> >
> > Signed-off-by: Nava kishore Manne 
> > ---
> > Changes for v3:
> > -None.
> > Changes for v2:
> > -Moved eemi_ops into a priv struct as suggested
> >  by philipp.
> >
> >  drivers/reset/Makefile   |   1 +
> >  drivers/reset/reset-zynqmp.c | 115
> > +++
> >  2 files changed, 116 insertions(+)
> >  create mode 100644 drivers/reset/reset-zynqmp.c
> >
> > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index
> > c1261dc..27e4a33 100644
> > --- a/drivers/reset/Makefile
> > +++ b/drivers/reset/Makefile
> > @@ -21,4 +21,5 @@ obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
> >  obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
> >  obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
> >  obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
> > +obj-$(CONFIG_ARCH_ZYNQMP) += reset-zynqmp.o
> >
> > diff --git a/drivers/reset/reset-zynqmp.c
> > b/drivers/reset/reset-zynqmp.c new file mode 100644 index
> > 000..f908492
> > --- /dev/null
> > +++ b/drivers/reset/reset-zynqmp.c
> > @@ -0,0 +1,115 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2018 Xilinx, Inc.
> > + *
> > + */
> > +
> > +#include 
> 
> I think including io.h is not necessary.
> 
> [...]

Will fix in the next version.

> > +static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
> > +  unsigned long id)
> > +{
> > +   struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
> > +   int val, err;
> > +
> > +   err = priv->eemi_ops->reset_get_status(ZYNQMP_RESET_ID + id, );
> > +   if (!err)
> > +   return -EINVAL;
> 
> This looks like it should be
> 
>   if (err)
>   return err;
> 
> instead.
> 
> [...]
Will fix in the next version.

> > +static struct reset_control_ops zynqmp_reset_ops = {
> 
> static const struct reset_control_ops zynqmp_reset_ops = {
> 
Will fix in the next version.

> > +   .reset = zynqmp_reset_reset,
> > +   .assert = zynqmp_reset_assert,
> > +   .deassert = zynqmp_reset_deassert,
> > +   .status = zynqmp_reset_status,
> > +};
> > +
> > +static int zynqmp_reset_probe(struct platform_device *pdev) {
> > +   struct zynqmp_reset_data *priv;
> > +
> > +   priv = devm_kzalloc(>dev,
> > +   sizeof(*priv), GFP_KERNEL);
> 
> This should fit on one line.
> 
Will fix in the next version.

Regards,
Navakishore.


[RFC][PATCHES] termios.h cleanups

2018-09-09 Thread Al Viro
asm/termios.h has tons of duplication and rather
convoluted logics re includes.

First of all, while everyone has uapi asm/termios.h,
some architectures have asm/termios.h and some do not.  So
include of  can go either to arch asm/termios.h,
or to uapi/asm/termios.h.
In the former case asm/termios.h defines a bunch of
helpers (used in just one file) and a constant (3 more users)
and includes uapi/asm/termios.h
In the latter... uapi/asm/termios.h is in generated-y
or equivalent to it.  Which is to say, it ends up doing
#include .  Userland-side that would
refer to uapi/asm-generic/termios.h, but kernel-side we end
up with plain asm-generic/termios.h.  Which defines the same
set of helpers and a constant and pulls uapi/asm-generic/termios.h

Helpers in question are heavily shared; there is an attempt
to put them into a common header (termios-base.h), but not all
instances use it.  Another unpleasant thing is that said helpers
tend to be macros, with very little typechecking.  And all of that
is pulled in by a lot more places than those that are actually
interested - 500-odd instead of 4.

Below is an attempt to untangle that; the branch is 
vfs.git#work.termios,
patches in followups.  FWIW, diffstat is

 arch/Kconfig   |   3 +
 arch/alpha/Kconfig |   1 +
 arch/alpha/include/asm/termios.h   |  81 
 arch/alpha/include/asm/termios_internal.h  |  72 ++
 arch/ia64/include/asm/termios.h|  58 
 arch/mips/include/asm/termios.h| 105 ---
 arch/parisc/include/asm/termios.h  |  52 
 arch/powerpc/Kconfig   |   1 +
 .../include/asm/{termios.h => termios_internal.h}  |   7 +-
 arch/riscv/include/asm/Kbuild  |   1 -
 arch/s390/include/asm/termios.h|  26 
 arch/sparc/Kconfig |   1 +
 arch/sparc/include/asm/termios.h   | 147 -
 arch/sparc/include/asm/termios_internal.h  | 134 +++
 arch/x86/include/uapi/asm/Kbuild   |   1 +
 arch/x86/include/uapi/asm/termios.h|   1 -
 drivers/tty/hvc/hvcs.c |   1 +
 drivers/tty/n_hdlc.c   |   1 -
 drivers/tty/tty_io.c   |   1 +
 drivers/tty/tty_ioctl.c|   1 +
 drivers/tty/vcc.c  |   1 +
 include/asm-generic/termios-base.h |  78 ---
 include/asm-generic/termios.h  | 108 ---
 include/linux/termios_internal.h   | 137 +++
 24 files changed, 355 insertions(+), 664 deletions(-)
 delete mode 100644 arch/alpha/include/asm/termios.h
 create mode 100644 arch/alpha/include/asm/termios_internal.h
 delete mode 100644 arch/ia64/include/asm/termios.h
 delete mode 100644 arch/mips/include/asm/termios.h
 delete mode 100644 arch/parisc/include/asm/termios.h
 rename arch/powerpc/include/asm/{termios.h => termios_internal.h} (70%)
 delete mode 100644 arch/s390/include/asm/termios.h
 delete mode 100644 arch/sparc/include/asm/termios.h
 create mode 100644 arch/sparc/include/asm/termios_internal.h
 delete mode 100644 arch/x86/include/uapi/asm/termios.h
 delete mode 100644 include/asm-generic/termios-base.h
 delete mode 100644 include/asm-generic/termios.h
 create mode 100644 include/linux/termios_internal.h


RE: [RFC PATCH v3 1/3] firmware: xilinx: Add reset API's

2018-09-09 Thread Nava kishore Manne
Hi Philipp

Thanks for the quick response...
Please find my response inline.

> -Original Message-
> From: Philipp Zabel [mailto:p.za...@pengutronix.de]
> Sent: Wednesday, September 5, 2018 4:00 PM
> To: Nava kishore Manne ; robh...@kernel.org;
> mark.rutl...@arm.com; Michal Simek ; Rajan Vaja
> ; Jolly Shah ;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [RFC PATCH v3 1/3] firmware: xilinx: Add reset API's
> 
> Hi,
> 
> On Wed, 2018-09-05 at 12:39 +0530, Nava kishore Manne wrote:
> > This Patch Adds reset API's to support release, assert and status
> > functionalities by using firmware interface.
> >
> > Signed-off-by: Nava kishore Manne 
> > ---
> > Changes for v3:
> > -None.
> > Changes for v2:
> > -New Patch.
> >
> >  drivers/firmware/xilinx/zynqmp.c |  40 +++
> >  include/linux/firmware/xlnx-zynqmp.h | 136
> > +++
> >  2 files changed, 176 insertions(+)
> >
> > diff --git a/drivers/firmware/xilinx/zynqmp.c
> > b/drivers/firmware/xilinx/zynqmp.c
> > index 7ccedf0..639c72f 100644
> > --- a/drivers/firmware/xilinx/zynqmp.c
> > +++ b/drivers/firmware/xilinx/zynqmp.c
> > @@ -447,6 +447,44 @@ static int zynqmp_pm_clock_getparent(u32
> clock_id, u32 *parent_id)
> > return ret;
> >  }
> >
> > +/**
> > + * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - 
> > release)
> > + * @reset: Reset to be configured
> > + * @assert_flag:   Flag stating should reset be asserted (1) or
> > + * released (0)
> > + *
> > + * Return: Returns status, either success or error+reason  */ static
> > +int zynqmp_pm_reset_assert(const enum zynqmp_pm_reset reset,
> > + const enum zynqmp_pm_reset_action
> assert_flag) {
> > +   return zynqmp_pm_invoke_fn(PM_RESET_ASSERT, reset, assert_flag,
> > +  0, 0, NULL);
> > +}
> > +
> > +/**
> > + * zynqmp_pm_reset_get_status - Get status of the reset
> > + * @reset:  Reset whose status should be returned
> > + * @status: Returned status
> > + *
> > + * Return: Returns status, either success or error+reason  */ static
> > +int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
> > + u32 *status)
> > +{
> > +   u32 ret_payload[PAYLOAD_ARG_CNT];
> > +   int ret;
> > +
> > +   if (!status)
> > +   return -EINVAL;
> > +
> > +   ret = zynqmp_pm_invoke_fn(PM_RESET_GET_STATUS, reset, 0,
> > + 0, 0, ret_payload);
> > +   *status = ret_payload[1];
> 
> It doesn't really matter here, but in general I'd skip writing output 
> arguments in
> case of error.
> For all I know, the result returned in ret_payload could be undefined.
> 

Will fix in the next version.

Regards,
Navakishore.


RE: [RFC PATCH v3 1/3] firmware: xilinx: Add reset API's

2018-09-09 Thread Nava kishore Manne
Hi Philipp

Thanks for the quick response...
Please find my response inline.

> -Original Message-
> From: Philipp Zabel [mailto:p.za...@pengutronix.de]
> Sent: Wednesday, September 5, 2018 4:00 PM
> To: Nava kishore Manne ; robh...@kernel.org;
> mark.rutl...@arm.com; Michal Simek ; Rajan Vaja
> ; Jolly Shah ;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [RFC PATCH v3 1/3] firmware: xilinx: Add reset API's
> 
> Hi,
> 
> On Wed, 2018-09-05 at 12:39 +0530, Nava kishore Manne wrote:
> > This Patch Adds reset API's to support release, assert and status
> > functionalities by using firmware interface.
> >
> > Signed-off-by: Nava kishore Manne 
> > ---
> > Changes for v3:
> > -None.
> > Changes for v2:
> > -New Patch.
> >
> >  drivers/firmware/xilinx/zynqmp.c |  40 +++
> >  include/linux/firmware/xlnx-zynqmp.h | 136
> > +++
> >  2 files changed, 176 insertions(+)
> >
> > diff --git a/drivers/firmware/xilinx/zynqmp.c
> > b/drivers/firmware/xilinx/zynqmp.c
> > index 7ccedf0..639c72f 100644
> > --- a/drivers/firmware/xilinx/zynqmp.c
> > +++ b/drivers/firmware/xilinx/zynqmp.c
> > @@ -447,6 +447,44 @@ static int zynqmp_pm_clock_getparent(u32
> clock_id, u32 *parent_id)
> > return ret;
> >  }
> >
> > +/**
> > + * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - 
> > release)
> > + * @reset: Reset to be configured
> > + * @assert_flag:   Flag stating should reset be asserted (1) or
> > + * released (0)
> > + *
> > + * Return: Returns status, either success or error+reason  */ static
> > +int zynqmp_pm_reset_assert(const enum zynqmp_pm_reset reset,
> > + const enum zynqmp_pm_reset_action
> assert_flag) {
> > +   return zynqmp_pm_invoke_fn(PM_RESET_ASSERT, reset, assert_flag,
> > +  0, 0, NULL);
> > +}
> > +
> > +/**
> > + * zynqmp_pm_reset_get_status - Get status of the reset
> > + * @reset:  Reset whose status should be returned
> > + * @status: Returned status
> > + *
> > + * Return: Returns status, either success or error+reason  */ static
> > +int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
> > + u32 *status)
> > +{
> > +   u32 ret_payload[PAYLOAD_ARG_CNT];
> > +   int ret;
> > +
> > +   if (!status)
> > +   return -EINVAL;
> > +
> > +   ret = zynqmp_pm_invoke_fn(PM_RESET_GET_STATUS, reset, 0,
> > + 0, 0, ret_payload);
> > +   *status = ret_payload[1];
> 
> It doesn't really matter here, but in general I'd skip writing output 
> arguments in
> case of error.
> For all I know, the result returned in ret_payload could be undefined.
> 

Will fix in the next version.

Regards,
Navakishore.


Re: [RFC PATCH v3 1/2] dt-bindings: nand: meson: add Amlogic NAND controller driver

2018-09-09 Thread Liang Yang

Hi boric,

Thanks for your quick reply.

On 9/7/2018 8:19 PM, Boris Brezillon wrote:

On Fri, 7 Sep 2018 18:57:10 +0800
Jianxin Pan  wrote:


From: Liang Yang 

Add Amlogic NAND controller dt-bindings for Meson SoC,
Current this driver support GXBB/GXL/AXG platform.

Signed-off-by: Liang Yang 
Signed-off-by: Yixun Lan 
---
  .../devicetree/bindings/mtd/amlogic,meson-nand.txt | 91 ++
  1 file changed, 91 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt

diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt 
b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt
new file mode 100644
index 000..655a778
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt
@@ -0,0 +1,91 @@
+Amlogic NAND Flash Controller (NFC) for GXBB/GXL/AXG family SoCs
+
+This file documents the properties in addition to those available in
+the MTD NAND bindings.
+
+Required properties:
+- compatible : contains one of:
+  - "amlogic,meson-gxl-nfc"
+  - "amlogic,meson-axg-nfc"
+- clocks :
+   A list of phandle + clock-specifier pairs for the clocks listed
+   in clock-names.
+
+- clock-names: Should contain the following:
+   "core" - NFC module gate clock
+   "device" - device clock from eMMC sub clock controller
+
+- pins : Select pins which NFC need.
+- nand_pins: Detail NAND pins information.


You mean pinctrl-names and pinctrl-0, right? Not sure it's necessary to
document that, but if you do, please use the correct DT prop names.



I find no documentation for that in other xx_nand.txt; I will consider 
to remove it.



+- amlogic,mmc-syscon   : Required for NAND clocks, it's shared with SD/eMMC
+   controller port C
+
+Optional children nodes:
+Children nodes represent the available nand chips.
+
+
+


One too many blank lines here.


ok, i will remove it.


+Other properties:
+see Documentation/devicetree/bindings/mtd/nand.txt for generic bindings.
+
+Example demonstrate on AXG SoC:
+
+   sd_emmc_c_clkc: mmc@7000 {
+   compatible = "amlogic,meson-axg-mmc-clkc", "syscon";
+   reg = <0x0 0x7000 0x0 0x800>;
+   status = "okay";
+   };
+
+   nand: nfc@7800 {
+   compatible = "amlogic,meson-axg-nfc";
+   reg = <0x0 0x7800 0x0 0x100>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   interrupts = ;
+   status = "disabled";
+
+   clocks = < CLKID_SD_EMMC_C>,
+   <_emmc_c_clkc CLKID_MMC_DIV>;
+   clock-names = "core", "device";
+   amlogic,mmc-syscon = <_emmc_c_clkc>;
+
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   nand@0 {
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   nand-on-flash-bbt;
+   nand-ecc-mode = "hw";
+   nand-ecc-strength = <8>;
+   nand-ecc-step-size = <1024>;


Drop nand-ecc- props. I guess you have a sensible default value and I
prefer when ECC requirements are directly extracted during chip
detection. Defining that in the DT is a bad habit. The only one that
could make sense (assuming you support it) is nand-ecc-maximize.


ok, i will drop them.
we adopt auto detection during init stage, it works too.


+
+   amlogic,nand-enable-scrambler;


Please drop this property (it's not longer documented).


em, we should have removed it when nfc driver never use it.


+
+   partition@0 {
+   label = "boot";
+   reg = <0x 0x0020>;
+   read-only;
+   };
+   partition@20 {
+   label = "env";
+   reg = <0x0020 0x0040>;
+   };
+   partition@60 {
+   label = "system";
+   reg = <0x0060 0x00a0>;
+   };
+   partition@100 {
+   label = "rootfs";
+   reg = <0x0100 0x0300>;
+   };
+   partition@400 {
+   label = "media";
+   reg = <0x0400 0x800>;
+   };


No need to define the partitions in your example, especially since they
should be placed in a partitions subnode with a "fixed-partitions"
compat.



ok, i will remove it.


+   };
+   };


.



Re: [RFC PATCH v3 1/2] dt-bindings: nand: meson: add Amlogic NAND controller driver

2018-09-09 Thread Liang Yang

Hi boric,

Thanks for your quick reply.

On 9/7/2018 8:19 PM, Boris Brezillon wrote:

On Fri, 7 Sep 2018 18:57:10 +0800
Jianxin Pan  wrote:


From: Liang Yang 

Add Amlogic NAND controller dt-bindings for Meson SoC,
Current this driver support GXBB/GXL/AXG platform.

Signed-off-by: Liang Yang 
Signed-off-by: Yixun Lan 
---
  .../devicetree/bindings/mtd/amlogic,meson-nand.txt | 91 ++
  1 file changed, 91 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt

diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt 
b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt
new file mode 100644
index 000..655a778
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt
@@ -0,0 +1,91 @@
+Amlogic NAND Flash Controller (NFC) for GXBB/GXL/AXG family SoCs
+
+This file documents the properties in addition to those available in
+the MTD NAND bindings.
+
+Required properties:
+- compatible : contains one of:
+  - "amlogic,meson-gxl-nfc"
+  - "amlogic,meson-axg-nfc"
+- clocks :
+   A list of phandle + clock-specifier pairs for the clocks listed
+   in clock-names.
+
+- clock-names: Should contain the following:
+   "core" - NFC module gate clock
+   "device" - device clock from eMMC sub clock controller
+
+- pins : Select pins which NFC need.
+- nand_pins: Detail NAND pins information.


You mean pinctrl-names and pinctrl-0, right? Not sure it's necessary to
document that, but if you do, please use the correct DT prop names.



I find no documentation for that in other xx_nand.txt; I will consider 
to remove it.



+- amlogic,mmc-syscon   : Required for NAND clocks, it's shared with SD/eMMC
+   controller port C
+
+Optional children nodes:
+Children nodes represent the available nand chips.
+
+
+


One too many blank lines here.


ok, i will remove it.


+Other properties:
+see Documentation/devicetree/bindings/mtd/nand.txt for generic bindings.
+
+Example demonstrate on AXG SoC:
+
+   sd_emmc_c_clkc: mmc@7000 {
+   compatible = "amlogic,meson-axg-mmc-clkc", "syscon";
+   reg = <0x0 0x7000 0x0 0x800>;
+   status = "okay";
+   };
+
+   nand: nfc@7800 {
+   compatible = "amlogic,meson-axg-nfc";
+   reg = <0x0 0x7800 0x0 0x100>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   interrupts = ;
+   status = "disabled";
+
+   clocks = < CLKID_SD_EMMC_C>,
+   <_emmc_c_clkc CLKID_MMC_DIV>;
+   clock-names = "core", "device";
+   amlogic,mmc-syscon = <_emmc_c_clkc>;
+
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   nand@0 {
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   nand-on-flash-bbt;
+   nand-ecc-mode = "hw";
+   nand-ecc-strength = <8>;
+   nand-ecc-step-size = <1024>;


Drop nand-ecc- props. I guess you have a sensible default value and I
prefer when ECC requirements are directly extracted during chip
detection. Defining that in the DT is a bad habit. The only one that
could make sense (assuming you support it) is nand-ecc-maximize.


ok, i will drop them.
we adopt auto detection during init stage, it works too.


+
+   amlogic,nand-enable-scrambler;


Please drop this property (it's not longer documented).


em, we should have removed it when nfc driver never use it.


+
+   partition@0 {
+   label = "boot";
+   reg = <0x 0x0020>;
+   read-only;
+   };
+   partition@20 {
+   label = "env";
+   reg = <0x0020 0x0040>;
+   };
+   partition@60 {
+   label = "system";
+   reg = <0x0060 0x00a0>;
+   };
+   partition@100 {
+   label = "rootfs";
+   reg = <0x0100 0x0300>;
+   };
+   partition@400 {
+   label = "media";
+   reg = <0x0400 0x800>;
+   };


No need to define the partitions in your example, especially since they
should be placed in a partitions subnode with a "fixed-partitions"
compat.



ok, i will remove it.


+   };
+   };


.



RE: [RFC PATCH v3 2/3] dt-bindings: reset: Add bindings for ZynqMP reset driver

2018-09-09 Thread Nava kishore Manne
Hi Philipp

Thanks for the quick response..
Please find my commnets inline.

> -Original Message-
> From: Philipp Zabel [mailto:p.za...@pengutronix.de]
> Sent: Wednesday, September 5, 2018 3:40 PM
> To: Nava kishore Manne ; robh...@kernel.org;
> mark.rutl...@arm.com; Michal Simek ; Rajan Vaja
> ; Jolly Shah ;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [RFC PATCH v3 2/3] dt-bindings: reset: Add bindings for ZynqMP
> reset driver
> 
> Hi,
> 
> On Wed, 2018-09-05 at 12:39 +0530, Nava kishore Manne wrote:
> > Add documentation to describe Xilinx ZynqMP reset driver bindings.
> >
> > Signed-off-by: Nava kishore Manne 
> > ---
> > Changes for v3:
> > -Corrected Commit Msg.
> > Changes for v2:
> > -Moved reset node as a child to firwmare
> >  node.
> >
> >  .../firmware/xilinx/xlnx,zynqmp-firmware.txt   | 142
> +
> >  1 file changed, 142 insertions(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > index 1b431d9..351b1bb 100644
> > ---
> > a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > +++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi
> > +++ rmware.txt
> [...]
> >  ---
> >  Example
> >  ---
> > @@ -25,5 +163,9 @@ firmware {
> > zynqmp_firmware: zynqmp-firmware {
> > compatible = "xlnx,zynqmp-firmware";
> > method = "smc";
> > +   reset-controller:reset-controller@0 {
> 
> I think the label should use underscore instead of hyphen, and the unit 
> address
> part should be removed from the node name. There is no unit address, as there
> is no reg property inside the node and the parent node doesn't have #address-
> cells:
> 

Will fix in the next version.

Regards,
Navakishore.


RE: [RFC PATCH v3 2/3] dt-bindings: reset: Add bindings for ZynqMP reset driver

2018-09-09 Thread Nava kishore Manne
Hi Philipp

Thanks for the quick response..
Please find my commnets inline.

> -Original Message-
> From: Philipp Zabel [mailto:p.za...@pengutronix.de]
> Sent: Wednesday, September 5, 2018 3:40 PM
> To: Nava kishore Manne ; robh...@kernel.org;
> mark.rutl...@arm.com; Michal Simek ; Rajan Vaja
> ; Jolly Shah ;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [RFC PATCH v3 2/3] dt-bindings: reset: Add bindings for ZynqMP
> reset driver
> 
> Hi,
> 
> On Wed, 2018-09-05 at 12:39 +0530, Nava kishore Manne wrote:
> > Add documentation to describe Xilinx ZynqMP reset driver bindings.
> >
> > Signed-off-by: Nava kishore Manne 
> > ---
> > Changes for v3:
> > -Corrected Commit Msg.
> > Changes for v2:
> > -Moved reset node as a child to firwmare
> >  node.
> >
> >  .../firmware/xilinx/xlnx,zynqmp-firmware.txt   | 142
> +
> >  1 file changed, 142 insertions(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > index 1b431d9..351b1bb 100644
> > ---
> > a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > +++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi
> > +++ rmware.txt
> [...]
> >  ---
> >  Example
> >  ---
> > @@ -25,5 +163,9 @@ firmware {
> > zynqmp_firmware: zynqmp-firmware {
> > compatible = "xlnx,zynqmp-firmware";
> > method = "smc";
> > +   reset-controller:reset-controller@0 {
> 
> I think the label should use underscore instead of hyphen, and the unit 
> address
> part should be removed from the node name. There is no unit address, as there
> is no reg property inside the node and the parent node doesn't have #address-
> cells:
> 

Will fix in the next version.

Regards,
Navakishore.


Reply For More Info

2018-09-09 Thread Mr Fridman Mikhail
I have a donation for you and for my charity work in your region. Please reply 
me ASAp for more info 


Reply For More Info

2018-09-09 Thread Mr Fridman Mikhail
I have a donation for you and for my charity work in your region. Please reply 
me ASAp for more info 


Re: [PATCH] mm: hugepage: mark splitted page dirty when needed

2018-09-09 Thread Peter Xu
On Fri, Sep 07, 2018 at 01:54:35PM -0400, Jerome Glisse wrote:
> On Fri, Sep 07, 2018 at 12:35:24PM +0800, Peter Xu wrote:
> > On Thu, Sep 06, 2018 at 05:08:42PM +0300, Kirill A. Shutemov wrote:
> > > On Thu, Sep 06, 2018 at 07:39:33PM +0800, Peter Xu wrote:
> > > > On Wed, Sep 05, 2018 at 03:55:22PM +0300, Kirill A. Shutemov wrote:
> > > > > On Wed, Sep 05, 2018 at 03:30:37PM +0800, Peter Xu wrote:
> > > > > > On Tue, Sep 04, 2018 at 10:00:28AM -0400, Zi Yan wrote:
> > > > > > > On 4 Sep 2018, at 4:01, Kirill A. Shutemov wrote:
> > > > > > > 
> > > > > > > > On Tue, Sep 04, 2018 at 03:55:10PM +0800, Peter Xu wrote:
> > > > > > > >> When splitting a huge page, we should set all small pages as 
> > > > > > > >> dirty if
> > > > > > > >> the original huge page has the dirty bit set before.  
> > > > > > > >> Otherwise we'll
> > > > > > > >> lose the original dirty bit.
> > > > > > > >
> > > > > > > > We don't lose it. It got transfered to struct page flag:
> > > > > > > >
> > > > > > > > if (pmd_dirty(old_pmd))
> > > > > > > > SetPageDirty(page);
> > > > > > > >
> > > > > > > 
> > > > > > > Plus, when split_huge_page_to_list() splits a THP, its subroutine 
> > > > > > > __split_huge_page()
> > > > > > > propagates the dirty bit in the head page flag to all subpages in 
> > > > > > > __split_huge_page_tail().
> > > > > > 
> > > > > > Hi, Kirill, Zi,
> > > > > > 
> > > > > > Thanks for your responses!
> > > > > > 
> > > > > > Though in my test the huge page seems to be splitted not by
> > > > > > split_huge_page_to_list() but by explicit calls to
> > > > > > change_protection().  The stack looks like this (again, this is a
> > > > > > customized kernel, and I added an explicit dump_stack() there):
> > > > > > 
> > > > > >   kernel:  dump_stack+0x5c/0x7b
> > > > > >   kernel:  __split_huge_pmd+0x192/0xdc0
> > > > > >   kernel:  ? update_load_avg+0x8b/0x550
> > > > > >   kernel:  ? update_load_avg+0x8b/0x550
> > > > > >   kernel:  ? account_entity_enqueue+0xc5/0xf0
> > > > > >   kernel:  ? enqueue_entity+0x112/0x650
> > > > > >   kernel:  change_protection+0x3a2/0xab0
> > > > > >   kernel:  mwriteprotect_range+0xdd/0x110
> > > > > >   kernel:  userfaultfd_ioctl+0x50b/0x1210
> > > > > >   kernel:  ? do_futex+0x2cf/0xb20
> > > > > >   kernel:  ? tty_write+0x1d2/0x2f0
> > > > > >   kernel:  ? do_vfs_ioctl+0x9f/0x610
> > > > > >   kernel:  do_vfs_ioctl+0x9f/0x610
> > > > > >   kernel:  ? __x64_sys_futex+0x88/0x180
> > > > > >   kernel:  ksys_ioctl+0x70/0x80
> > > > > >   kernel:  __x64_sys_ioctl+0x16/0x20
> > > > > >   kernel:  do_syscall_64+0x55/0x150
> > > > > >   kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > > > > > 
> > > > > > At the very time the userspace is sending an UFFDIO_WRITEPROTECT 
> > > > > > ioctl
> > > > > > to kernel space, which is handled by mwriteprotect_range().  In case
> > > > > > you'd like to refer to the kernel, it's basically this one from
> > > > > > Andrea's (with very trivial changes):
> > > > > > 
> > > > > >   https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git 
> > > > > > userfault
> > > > > > 
> > > > > > So... do we have two paths to split the huge pages separately?
> > > > > 
> > > > > We have two entiries that can be split: page table enties and 
> > > > > underlying
> > > > > compound page.
> > > > > 
> > > > > split_huge_pmd() (and variants of it) split the PMD entry into a PTE 
> > > > > page
> > > > > table. It doens't touch underlying compound page. The page still can 
> > > > > be
> > > > > mapped in other place as huge.
> > > > > 
> > > > > split_huge_page() (and ivariants of it) split compound page into a 
> > > > > number
> > > > > of 4k (or whatever PAGE_SIZE is). The operation requires splitting all
> > > > > PMD, but not other way around.
> > > > > 
> > > > > > 
> > > > > > Another (possibly very naive) question is: could any of you hint me
> > > > > > how the page dirty bit is finally applied to the PTEs?  These two
> > > > > > dirty flags confused me for a few days already (the SetPageDirty() 
> > > > > > one
> > > > > > which sets the page dirty flag, and the pte_mkdirty() which sets 
> > > > > > that
> > > > > > onto the real PTEs).
> > > > > 
> > > > > Dirty bit from page table entries transferes to sturct page flug and 
> > > > > used
> > > > > for decision making in reclaim path.
> > > > 
> > > > Thanks for explaining.  It's much clearer for me.
> > > > 
> > > > Though for the issue I have encountered, I am still confused on why
> > > > that dirty bit can be ignored for the splitted PTEs.  Indeed we have:
> > > > 
> > > > if (pmd_dirty(old_pmd))
> > > > SetPageDirty(page);
> > > > 
> > > > However to me this only transfers (as you explained above) the dirty
> > > > bit (AFAIU it's possibly set by the hardware when the page is written)
> > > > to the page struct of the compound page.  It did not really apply to
> > > > every small page of the splitted huge page.  As you also explained,
> > > > 

Re: [PATCH] mm: hugepage: mark splitted page dirty when needed

2018-09-09 Thread Peter Xu
On Fri, Sep 07, 2018 at 01:54:35PM -0400, Jerome Glisse wrote:
> On Fri, Sep 07, 2018 at 12:35:24PM +0800, Peter Xu wrote:
> > On Thu, Sep 06, 2018 at 05:08:42PM +0300, Kirill A. Shutemov wrote:
> > > On Thu, Sep 06, 2018 at 07:39:33PM +0800, Peter Xu wrote:
> > > > On Wed, Sep 05, 2018 at 03:55:22PM +0300, Kirill A. Shutemov wrote:
> > > > > On Wed, Sep 05, 2018 at 03:30:37PM +0800, Peter Xu wrote:
> > > > > > On Tue, Sep 04, 2018 at 10:00:28AM -0400, Zi Yan wrote:
> > > > > > > On 4 Sep 2018, at 4:01, Kirill A. Shutemov wrote:
> > > > > > > 
> > > > > > > > On Tue, Sep 04, 2018 at 03:55:10PM +0800, Peter Xu wrote:
> > > > > > > >> When splitting a huge page, we should set all small pages as 
> > > > > > > >> dirty if
> > > > > > > >> the original huge page has the dirty bit set before.  
> > > > > > > >> Otherwise we'll
> > > > > > > >> lose the original dirty bit.
> > > > > > > >
> > > > > > > > We don't lose it. It got transfered to struct page flag:
> > > > > > > >
> > > > > > > > if (pmd_dirty(old_pmd))
> > > > > > > > SetPageDirty(page);
> > > > > > > >
> > > > > > > 
> > > > > > > Plus, when split_huge_page_to_list() splits a THP, its subroutine 
> > > > > > > __split_huge_page()
> > > > > > > propagates the dirty bit in the head page flag to all subpages in 
> > > > > > > __split_huge_page_tail().
> > > > > > 
> > > > > > Hi, Kirill, Zi,
> > > > > > 
> > > > > > Thanks for your responses!
> > > > > > 
> > > > > > Though in my test the huge page seems to be splitted not by
> > > > > > split_huge_page_to_list() but by explicit calls to
> > > > > > change_protection().  The stack looks like this (again, this is a
> > > > > > customized kernel, and I added an explicit dump_stack() there):
> > > > > > 
> > > > > >   kernel:  dump_stack+0x5c/0x7b
> > > > > >   kernel:  __split_huge_pmd+0x192/0xdc0
> > > > > >   kernel:  ? update_load_avg+0x8b/0x550
> > > > > >   kernel:  ? update_load_avg+0x8b/0x550
> > > > > >   kernel:  ? account_entity_enqueue+0xc5/0xf0
> > > > > >   kernel:  ? enqueue_entity+0x112/0x650
> > > > > >   kernel:  change_protection+0x3a2/0xab0
> > > > > >   kernel:  mwriteprotect_range+0xdd/0x110
> > > > > >   kernel:  userfaultfd_ioctl+0x50b/0x1210
> > > > > >   kernel:  ? do_futex+0x2cf/0xb20
> > > > > >   kernel:  ? tty_write+0x1d2/0x2f0
> > > > > >   kernel:  ? do_vfs_ioctl+0x9f/0x610
> > > > > >   kernel:  do_vfs_ioctl+0x9f/0x610
> > > > > >   kernel:  ? __x64_sys_futex+0x88/0x180
> > > > > >   kernel:  ksys_ioctl+0x70/0x80
> > > > > >   kernel:  __x64_sys_ioctl+0x16/0x20
> > > > > >   kernel:  do_syscall_64+0x55/0x150
> > > > > >   kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > > > > > 
> > > > > > At the very time the userspace is sending an UFFDIO_WRITEPROTECT 
> > > > > > ioctl
> > > > > > to kernel space, which is handled by mwriteprotect_range().  In case
> > > > > > you'd like to refer to the kernel, it's basically this one from
> > > > > > Andrea's (with very trivial changes):
> > > > > > 
> > > > > >   https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git 
> > > > > > userfault
> > > > > > 
> > > > > > So... do we have two paths to split the huge pages separately?
> > > > > 
> > > > > We have two entiries that can be split: page table enties and 
> > > > > underlying
> > > > > compound page.
> > > > > 
> > > > > split_huge_pmd() (and variants of it) split the PMD entry into a PTE 
> > > > > page
> > > > > table. It doens't touch underlying compound page. The page still can 
> > > > > be
> > > > > mapped in other place as huge.
> > > > > 
> > > > > split_huge_page() (and ivariants of it) split compound page into a 
> > > > > number
> > > > > of 4k (or whatever PAGE_SIZE is). The operation requires splitting all
> > > > > PMD, but not other way around.
> > > > > 
> > > > > > 
> > > > > > Another (possibly very naive) question is: could any of you hint me
> > > > > > how the page dirty bit is finally applied to the PTEs?  These two
> > > > > > dirty flags confused me for a few days already (the SetPageDirty() 
> > > > > > one
> > > > > > which sets the page dirty flag, and the pte_mkdirty() which sets 
> > > > > > that
> > > > > > onto the real PTEs).
> > > > > 
> > > > > Dirty bit from page table entries transferes to sturct page flug and 
> > > > > used
> > > > > for decision making in reclaim path.
> > > > 
> > > > Thanks for explaining.  It's much clearer for me.
> > > > 
> > > > Though for the issue I have encountered, I am still confused on why
> > > > that dirty bit can be ignored for the splitted PTEs.  Indeed we have:
> > > > 
> > > > if (pmd_dirty(old_pmd))
> > > > SetPageDirty(page);
> > > > 
> > > > However to me this only transfers (as you explained above) the dirty
> > > > bit (AFAIU it's possibly set by the hardware when the page is written)
> > > > to the page struct of the compound page.  It did not really apply to
> > > > every small page of the splitted huge page.  As you also explained,
> > > > 

linux-next: manual merge of the akpm-current tree with the dma-mapping tree

2018-09-09 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the akpm-current tree got a conflict in:

  arch/hexagon/Kconfig

between commit:

  e0a9317d9004 ("hexagon: use generic dma_noncoherent_ops")

from the dma-mapping tree and commit:

  365c1f4922a4 ("hexagon: switch to NO_BOOTMEM")

from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/hexagon/Kconfig
index 6cee842a9b44,f7934998913a..
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@@ -30,7 -29,9 +30,10 @@@ config HEXAGO
select GENERIC_CLOCKEVENTS_BROADCAST
select MODULES_USE_ELF_RELA
select GENERIC_CPU_DEVICES
 +  select DMA_NONCOHERENT_OPS
+   select HAVE_MEMBLOCK
+   select ARCH_DISCARD_MEMBLOCK
+   select NO_BOOTMEM
---help---
  Qualcomm Hexagon is a processor architecture designed for high
  performance and low power across a wide variety of applications.


pgppr7_m2I4eD.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the akpm-current tree with the dma-mapping tree

2018-09-09 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the akpm-current tree got a conflict in:

  arch/hexagon/Kconfig

between commit:

  e0a9317d9004 ("hexagon: use generic dma_noncoherent_ops")

from the dma-mapping tree and commit:

  365c1f4922a4 ("hexagon: switch to NO_BOOTMEM")

from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/hexagon/Kconfig
index 6cee842a9b44,f7934998913a..
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@@ -30,7 -29,9 +30,10 @@@ config HEXAGO
select GENERIC_CLOCKEVENTS_BROADCAST
select MODULES_USE_ELF_RELA
select GENERIC_CPU_DEVICES
 +  select DMA_NONCOHERENT_OPS
+   select HAVE_MEMBLOCK
+   select ARCH_DISCARD_MEMBLOCK
+   select NO_BOOTMEM
---help---
  Qualcomm Hexagon is a processor architecture designed for high
  performance and low power across a wide variety of applications.


pgppr7_m2I4eD.pgp
Description: OpenPGP digital signature


Re: [PATCH] serial: 8250_omap: Make 8250_omap driver driver depend on ARCH_K3

2018-09-09 Thread Vignesh R



On Tuesday 28 August 2018 06:33 AM, Nishanth Menon wrote:
> From: Lokesh Vutla 
> 
> Allow 8250 omap serial driver to be used for K3 platforms.
> 
> Signed-off-by: Lokesh Vutla 
> Signed-off-by: Nishanth Menon 
> ---
> 

Acked-by: Vignesh R 

> Now that we have the device tree support merged integrated AND we have 
> ARCH_K3,
> Lets enable the 820 OMAP Driver to build for ARCH_K3 and make it operational.
> 
>  drivers/tty/serial/8250/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
> index f005eaf8bc57..15c2c5463835 100644
> --- a/drivers/tty/serial/8250/Kconfig
> +++ b/drivers/tty/serial/8250/Kconfig
> @@ -375,7 +375,7 @@ config SERIAL_8250_RT288X
>  
>  config SERIAL_8250_OMAP
>   tristate "Support for OMAP internal UART (8250 based driver)"
> - depends on SERIAL_8250 && ARCH_OMAP2PLUS
> + depends on SERIAL_8250 && (ARCH_OMAP2PLUS || ARCH_K3)
>   help
> If you have a machine based on an Texas Instruments OMAP CPU you
> can enable its onboard serial ports by enabling this option.
> 

-- 
Regards
Vignesh


Re: [PATCH] serial: 8250_omap: Make 8250_omap driver driver depend on ARCH_K3

2018-09-09 Thread Vignesh R



On Tuesday 28 August 2018 06:33 AM, Nishanth Menon wrote:
> From: Lokesh Vutla 
> 
> Allow 8250 omap serial driver to be used for K3 platforms.
> 
> Signed-off-by: Lokesh Vutla 
> Signed-off-by: Nishanth Menon 
> ---
> 

Acked-by: Vignesh R 

> Now that we have the device tree support merged integrated AND we have 
> ARCH_K3,
> Lets enable the 820 OMAP Driver to build for ARCH_K3 and make it operational.
> 
>  drivers/tty/serial/8250/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
> index f005eaf8bc57..15c2c5463835 100644
> --- a/drivers/tty/serial/8250/Kconfig
> +++ b/drivers/tty/serial/8250/Kconfig
> @@ -375,7 +375,7 @@ config SERIAL_8250_RT288X
>  
>  config SERIAL_8250_OMAP
>   tristate "Support for OMAP internal UART (8250 based driver)"
> - depends on SERIAL_8250 && ARCH_OMAP2PLUS
> + depends on SERIAL_8250 && (ARCH_OMAP2PLUS || ARCH_K3)
>   help
> If you have a machine based on an Texas Instruments OMAP CPU you
> can enable its onboard serial ports by enabling this option.
> 

-- 
Regards
Vignesh


linux-next: build failure after merge of the vfs tree

2018-09-09 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (sparc64 defconfig)
failed like this:

In file included from arch/sparc/include/asm/fbio.h:5:0,
 from fs/compat_ioctl.c:76:
arch/sparc/include/uapi/asm/fbio.h:100:25: error: field 'pos' has incomplete 
type
 struct fbcurpos pos;/* cursor position */
 ^~~
arch/sparc/include/uapi/asm/fbio.h:101:25: error: field 'hot' has incomplete 
type
 struct fbcurpos hot;/* cursor hot spot */
 ^~~
arch/sparc/include/uapi/asm/fbio.h:103:25: error: field 'size' has incomplete 
type
 struct fbcurpos size;   /* cursor bit map size */
 ^~~~
In file included from fs/compat_ioctl.c:76:0:
arch/sparc/include/asm/fbio.h:63:18: error: field 'pos' has incomplete type
  struct fbcurpos pos; /* cursor position */
  ^~~
arch/sparc/include/asm/fbio.h:64:18: error: field 'hot' has incomplete type
  struct fbcurpos hot; /* cursor hot spot */
  ^~~
arch/sparc/include/asm/fbio.h:66:18: error: field 'size' has incomplete type
  struct fbcurpos size; /* cursor bit map size */
  ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:21: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
 ^
fs/compat_ioctl.c:650:27: note: in expansion of macro 'COMPATIBLE_IOCTL'
 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
   ^~~~
fs/compat_ioctl.c:1188:1: note: in expansion of macro 'IGNORE_IOCTL'
 IGNORE_IOCTL(FBIOSCURPOS)
 ^~~~
arch/sparc/include/uapi/asm/ioctl.h:47:29: note: in expansion of macro '_IOC'
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
 ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:25: note: in expansion of macro '_IOW'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
 ^~~~
fs/compat_ioctl.c:1188:14: note: in expansion of macro 'FBIOSCURPOS'
 IGNORE_IOCTL(FBIOSCURPOS)
  ^~~
arch/sparc/include/uapi/asm/fbio.h:113:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:28: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
^
fs/compat_ioctl.c:650:27: note: in expansion of macro 'COMPATIBLE_IOCTL'
 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
   ^~~~
fs/compat_ioctl.c:1188:1: note: in expansion of macro 'IGNORE_IOCTL'
 IGNORE_IOCTL(FBIOSCURPOS)
 ^~~~
arch/sparc/include/uapi/asm/ioctl.h:47:29: note: in expansion of macro '_IOC'
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
 ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:25: note: in expansion of macro '_IOW'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
 ^~~~
fs/compat_ioctl.c:1188:14: note: in expansion of macro 'FBIOSCURPOS'
 IGNORE_IOCTL(FBIOSCURPOS)
  ^~~
arch/sparc/include/uapi/asm/fbio.h:113:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:42: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
  ^
fs/compat_ioctl.c:650:27: note: in expansion of macro 'COMPATIBLE_IOCTL'
 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
   ^~~~
fs/compat_ioctl.c:1188:1: note: in expansion of macro 'IGNORE_IOCTL'
 IGNORE_IOCTL(FBIOSCURPOS)
 ^~~~
arch/sparc/include/uapi/asm/ioctl.h:47:29: note: in expansion of macro '_IOC'
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
 ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:25: note: in expansion of macro '_IOW'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
 ^~~~
fs/compat_ioctl.c:1188:14: note: in expansion of macro 'FBIOSCURPOS'
 IGNORE_IOCTL(FBIOSCURPOS)
  ^~~
arch/sparc/include/uapi/asm/fbio.h:114:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOGCURPOS _IOW('F', 27, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:21: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
 ^
fs/compat_ioctl.c:650:27: note: in expansion of macro 

linux-next: build failure after merge of the vfs tree

2018-09-09 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (sparc64 defconfig)
failed like this:

In file included from arch/sparc/include/asm/fbio.h:5:0,
 from fs/compat_ioctl.c:76:
arch/sparc/include/uapi/asm/fbio.h:100:25: error: field 'pos' has incomplete 
type
 struct fbcurpos pos;/* cursor position */
 ^~~
arch/sparc/include/uapi/asm/fbio.h:101:25: error: field 'hot' has incomplete 
type
 struct fbcurpos hot;/* cursor hot spot */
 ^~~
arch/sparc/include/uapi/asm/fbio.h:103:25: error: field 'size' has incomplete 
type
 struct fbcurpos size;   /* cursor bit map size */
 ^~~~
In file included from fs/compat_ioctl.c:76:0:
arch/sparc/include/asm/fbio.h:63:18: error: field 'pos' has incomplete type
  struct fbcurpos pos; /* cursor position */
  ^~~
arch/sparc/include/asm/fbio.h:64:18: error: field 'hot' has incomplete type
  struct fbcurpos hot; /* cursor hot spot */
  ^~~
arch/sparc/include/asm/fbio.h:66:18: error: field 'size' has incomplete type
  struct fbcurpos size; /* cursor bit map size */
  ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:21: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
 ^
fs/compat_ioctl.c:650:27: note: in expansion of macro 'COMPATIBLE_IOCTL'
 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
   ^~~~
fs/compat_ioctl.c:1188:1: note: in expansion of macro 'IGNORE_IOCTL'
 IGNORE_IOCTL(FBIOSCURPOS)
 ^~~~
arch/sparc/include/uapi/asm/ioctl.h:47:29: note: in expansion of macro '_IOC'
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
 ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:25: note: in expansion of macro '_IOW'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
 ^~~~
fs/compat_ioctl.c:1188:14: note: in expansion of macro 'FBIOSCURPOS'
 IGNORE_IOCTL(FBIOSCURPOS)
  ^~~
arch/sparc/include/uapi/asm/fbio.h:113:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:28: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
^
fs/compat_ioctl.c:650:27: note: in expansion of macro 'COMPATIBLE_IOCTL'
 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
   ^~~~
fs/compat_ioctl.c:1188:1: note: in expansion of macro 'IGNORE_IOCTL'
 IGNORE_IOCTL(FBIOSCURPOS)
 ^~~~
arch/sparc/include/uapi/asm/ioctl.h:47:29: note: in expansion of macro '_IOC'
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
 ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:25: note: in expansion of macro '_IOW'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
 ^~~~
fs/compat_ioctl.c:1188:14: note: in expansion of macro 'FBIOSCURPOS'
 IGNORE_IOCTL(FBIOSCURPOS)
  ^~~
arch/sparc/include/uapi/asm/fbio.h:113:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:42: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
  ^
fs/compat_ioctl.c:650:27: note: in expansion of macro 'COMPATIBLE_IOCTL'
 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
   ^~~~
fs/compat_ioctl.c:1188:1: note: in expansion of macro 'IGNORE_IOCTL'
 IGNORE_IOCTL(FBIOSCURPOS)
 ^~~~
arch/sparc/include/uapi/asm/ioctl.h:47:29: note: in expansion of macro '_IOC'
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
 ^~~~
arch/sparc/include/uapi/asm/fbio.h:113:25: note: in expansion of macro '_IOW'
 #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
 ^~~~
fs/compat_ioctl.c:1188:14: note: in expansion of macro 'FBIOSCURPOS'
 IGNORE_IOCTL(FBIOSCURPOS)
  ^~~
arch/sparc/include/uapi/asm/fbio.h:114:39: error: invalid application of 
'sizeof' to incomplete type 'struct fbcurpos'
 #define FBIOGCURPOS _IOW('F', 27, struct fbcurpos)
   ^
fs/compat_ioctl.c:640:21: note: in definition of macro 'XFORM'
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0x)
 ^
fs/compat_ioctl.c:650:27: note: in expansion of macro 

Re: [PATCH V3] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP

2018-09-09 Thread dkota



I see there is no need of taking the spinlock as timeout will be 
handled

after the calculated time as per data size and speed.
There is 99.9% less chances of interrupt during the timeout handler.




https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1201081


The thing is, we want it to be 100% reliable, not 99.9% reliable.  Is
it somehow wrong to add the spinlock?  ...or are you noticing
performance problems with the spinlock there?  It's just nice not to
have to think about it.


As I said, timeout will be handled after the calculated time as per data 
size and speed. Enough time is given for interrupt, there is no chance 
of interrupt occurrence during the handle_fifo_timeout(). So there is no 
need of spinlock.


Re: [PATCH V3] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP

2018-09-09 Thread dkota



I see there is no need of taking the spinlock as timeout will be 
handled

after the calculated time as per data size and speed.
There is 99.9% less chances of interrupt during the timeout handler.




https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1201081


The thing is, we want it to be 100% reliable, not 99.9% reliable.  Is
it somehow wrong to add the spinlock?  ...or are you noticing
performance problems with the spinlock there?  It's just nice not to
have to think about it.


As I said, timeout will be handled after the calculated time as per data 
size and speed. Enough time is given for interrupt, there is no chance 
of interrupt occurrence during the handle_fifo_timeout(). So there is no 
need of spinlock.


[PATCH v2] spi: mediatek: Don't modify spi_transfer when transfer.

2018-09-09 Thread Peter Shih
Mediatek SPI driver modifies some fields (tx_buf, rx_buf, len, tx_dma,
rx_dma) of the spi_transfer* passed in when doing transfer_one and in
interrupt handler. This is somewhat unexpected, and there are some
caller (e.g. Cr50 spi driver) that reuse the spi_transfer for multiple
messages. Add a field to record how many bytes have been transferred,
and calculate the right len / buffer based on it instead.

Signed-off-by: Pi-Hsun Shih 

Change-Id: I23e218cd964f16c0b2b26127d4a5ca6529867673
---
 drivers/spi/spi-mt65xx.c | 37 +
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 86bf45667a040..3dc31627c6558 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -98,6 +98,7 @@ struct mtk_spi {
struct clk *parent_clk, *sel_clk, *spi_clk;
struct spi_transfer *cur_transfer;
u32 xfer_len;
+   u32 num_xfered;
struct scatterlist *tx_sgl, *rx_sgl;
u32 tx_sgl_len, rx_sgl_len;
const struct mtk_spi_compatible *dev_comp;
@@ -385,6 +386,7 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
 
mdata->cur_transfer = xfer;
mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, xfer->len);
+   mdata->num_xfered = 0;
mtk_spi_prepare_transfer(master, xfer);
mtk_spi_setup_packet(master);
 
@@ -415,6 +417,7 @@ static int mtk_spi_dma_transfer(struct spi_master *master,
mdata->tx_sgl_len = 0;
mdata->rx_sgl_len = 0;
mdata->cur_transfer = xfer;
+   mdata->num_xfered = 0;
 
mtk_spi_prepare_transfer(master, xfer);
 
@@ -482,7 +485,7 @@ static int mtk_spi_setup(struct spi_device *spi)
 
 static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
 {
-   u32 cmd, reg_val, cnt, remainder;
+   u32 cmd, reg_val, cnt, remainder, len;
struct spi_master *master = dev_id;
struct mtk_spi *mdata = spi_master_get_devdata(master);
struct spi_transfer *trans = mdata->cur_transfer;
@@ -497,36 +500,38 @@ static irqreturn_t mtk_spi_interrupt(int irq, void 
*dev_id)
if (trans->rx_buf) {
cnt = mdata->xfer_len / 4;
ioread32_rep(mdata->base + SPI_RX_DATA_REG,
-trans->rx_buf, cnt);
+trans->rx_buf + mdata->num_xfered, cnt);
remainder = mdata->xfer_len % 4;
if (remainder > 0) {
reg_val = readl(mdata->base + SPI_RX_DATA_REG);
-   memcpy(trans->rx_buf + (cnt * 4),
-   _val, remainder);
+   memcpy(trans->rx_buf +
+   mdata->num_xfered +
+   (cnt * 4),
+   _val,
+   remainder);
}
}
 
-   trans->len -= mdata->xfer_len;
-   if (!trans->len) {
+   mdata->num_xfered += mdata->xfer_len;
+   if (mdata->num_xfered == trans->len) {
spi_finalize_current_transfer(master);
return IRQ_HANDLED;
}
 
-   if (trans->tx_buf)
-   trans->tx_buf += mdata->xfer_len;
-   if (trans->rx_buf)
-   trans->rx_buf += mdata->xfer_len;
-
-   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, trans->len);
+   len = trans->len - mdata->num_xfered;
+   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, len);
mtk_spi_setup_packet(master);
 
-   cnt = trans->len / 4;
-   iowrite32_rep(mdata->base + SPI_TX_DATA_REG, trans->tx_buf, 
cnt);
+   cnt = len / 4;
+   iowrite32_rep(mdata->base + SPI_TX_DATA_REG,
+   trans->tx_buf + mdata->num_xfered, cnt);
 
-   remainder = trans->len % 4;
+   remainder = len % 4;
if (remainder > 0) {
reg_val = 0;
-   memcpy(_val, trans->tx_buf + (cnt * 4), remainder);
+   memcpy(_val,
+   trans->tx_buf + (cnt * 4) + mdata->num_xfered,
+   remainder);
writel(reg_val, mdata->base + SPI_TX_DATA_REG);
}
 
-- 
2.19.0.rc2.392.g5ba43deb5a-goog



[PATCH v2] spi: mediatek: Don't modify spi_transfer when transfer.

2018-09-09 Thread Peter Shih
Mediatek SPI driver modifies some fields (tx_buf, rx_buf, len, tx_dma,
rx_dma) of the spi_transfer* passed in when doing transfer_one and in
interrupt handler. This is somewhat unexpected, and there are some
caller (e.g. Cr50 spi driver) that reuse the spi_transfer for multiple
messages. Add a field to record how many bytes have been transferred,
and calculate the right len / buffer based on it instead.

Signed-off-by: Pi-Hsun Shih 

Change-Id: I23e218cd964f16c0b2b26127d4a5ca6529867673
---
 drivers/spi/spi-mt65xx.c | 37 +
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 86bf45667a040..3dc31627c6558 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -98,6 +98,7 @@ struct mtk_spi {
struct clk *parent_clk, *sel_clk, *spi_clk;
struct spi_transfer *cur_transfer;
u32 xfer_len;
+   u32 num_xfered;
struct scatterlist *tx_sgl, *rx_sgl;
u32 tx_sgl_len, rx_sgl_len;
const struct mtk_spi_compatible *dev_comp;
@@ -385,6 +386,7 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
 
mdata->cur_transfer = xfer;
mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, xfer->len);
+   mdata->num_xfered = 0;
mtk_spi_prepare_transfer(master, xfer);
mtk_spi_setup_packet(master);
 
@@ -415,6 +417,7 @@ static int mtk_spi_dma_transfer(struct spi_master *master,
mdata->tx_sgl_len = 0;
mdata->rx_sgl_len = 0;
mdata->cur_transfer = xfer;
+   mdata->num_xfered = 0;
 
mtk_spi_prepare_transfer(master, xfer);
 
@@ -482,7 +485,7 @@ static int mtk_spi_setup(struct spi_device *spi)
 
 static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
 {
-   u32 cmd, reg_val, cnt, remainder;
+   u32 cmd, reg_val, cnt, remainder, len;
struct spi_master *master = dev_id;
struct mtk_spi *mdata = spi_master_get_devdata(master);
struct spi_transfer *trans = mdata->cur_transfer;
@@ -497,36 +500,38 @@ static irqreturn_t mtk_spi_interrupt(int irq, void 
*dev_id)
if (trans->rx_buf) {
cnt = mdata->xfer_len / 4;
ioread32_rep(mdata->base + SPI_RX_DATA_REG,
-trans->rx_buf, cnt);
+trans->rx_buf + mdata->num_xfered, cnt);
remainder = mdata->xfer_len % 4;
if (remainder > 0) {
reg_val = readl(mdata->base + SPI_RX_DATA_REG);
-   memcpy(trans->rx_buf + (cnt * 4),
-   _val, remainder);
+   memcpy(trans->rx_buf +
+   mdata->num_xfered +
+   (cnt * 4),
+   _val,
+   remainder);
}
}
 
-   trans->len -= mdata->xfer_len;
-   if (!trans->len) {
+   mdata->num_xfered += mdata->xfer_len;
+   if (mdata->num_xfered == trans->len) {
spi_finalize_current_transfer(master);
return IRQ_HANDLED;
}
 
-   if (trans->tx_buf)
-   trans->tx_buf += mdata->xfer_len;
-   if (trans->rx_buf)
-   trans->rx_buf += mdata->xfer_len;
-
-   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, trans->len);
+   len = trans->len - mdata->num_xfered;
+   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, len);
mtk_spi_setup_packet(master);
 
-   cnt = trans->len / 4;
-   iowrite32_rep(mdata->base + SPI_TX_DATA_REG, trans->tx_buf, 
cnt);
+   cnt = len / 4;
+   iowrite32_rep(mdata->base + SPI_TX_DATA_REG,
+   trans->tx_buf + mdata->num_xfered, cnt);
 
-   remainder = trans->len % 4;
+   remainder = len % 4;
if (remainder > 0) {
reg_val = 0;
-   memcpy(_val, trans->tx_buf + (cnt * 4), remainder);
+   memcpy(_val,
+   trans->tx_buf + (cnt * 4) + mdata->num_xfered,
+   remainder);
writel(reg_val, mdata->base + SPI_TX_DATA_REG);
}
 
-- 
2.19.0.rc2.392.g5ba43deb5a-goog



[PATCH] spi: mediatek: Don't modify spi_transfer when transfer.

2018-09-09 Thread Peter Shih
Mediatek SPI driver modifies some fields (tx_buf, rx_buf, len, tx_dma,
rx_dma) of the spi_transfer* passed in when doing transfer_one and in
interrupt handler. This is somewhat unexpected, and there are some
caller (e.g. Cr50 spi driver) that reuse the spi_transfer for multiple
messages. Add a field to record how many bytes have been transferred,
and calculate the right len / buffer based on it instead.

BUG=b:113973051
TEST=None

Signed-off-by: Pi-Hsun Shih 

Change-Id: I23e218cd964f16c0b2b26127d4a5ca6529867673
---
 drivers/spi/spi-mt65xx.c | 37 +
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 86bf45667a040..3dc31627c6558 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -98,6 +98,7 @@ struct mtk_spi {
struct clk *parent_clk, *sel_clk, *spi_clk;
struct spi_transfer *cur_transfer;
u32 xfer_len;
+   u32 num_xfered;
struct scatterlist *tx_sgl, *rx_sgl;
u32 tx_sgl_len, rx_sgl_len;
const struct mtk_spi_compatible *dev_comp;
@@ -385,6 +386,7 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
 
mdata->cur_transfer = xfer;
mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, xfer->len);
+   mdata->num_xfered = 0;
mtk_spi_prepare_transfer(master, xfer);
mtk_spi_setup_packet(master);
 
@@ -415,6 +417,7 @@ static int mtk_spi_dma_transfer(struct spi_master *master,
mdata->tx_sgl_len = 0;
mdata->rx_sgl_len = 0;
mdata->cur_transfer = xfer;
+   mdata->num_xfered = 0;
 
mtk_spi_prepare_transfer(master, xfer);
 
@@ -482,7 +485,7 @@ static int mtk_spi_setup(struct spi_device *spi)
 
 static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
 {
-   u32 cmd, reg_val, cnt, remainder;
+   u32 cmd, reg_val, cnt, remainder, len;
struct spi_master *master = dev_id;
struct mtk_spi *mdata = spi_master_get_devdata(master);
struct spi_transfer *trans = mdata->cur_transfer;
@@ -497,36 +500,38 @@ static irqreturn_t mtk_spi_interrupt(int irq, void 
*dev_id)
if (trans->rx_buf) {
cnt = mdata->xfer_len / 4;
ioread32_rep(mdata->base + SPI_RX_DATA_REG,
-trans->rx_buf, cnt);
+trans->rx_buf + mdata->num_xfered, cnt);
remainder = mdata->xfer_len % 4;
if (remainder > 0) {
reg_val = readl(mdata->base + SPI_RX_DATA_REG);
-   memcpy(trans->rx_buf + (cnt * 4),
-   _val, remainder);
+   memcpy(trans->rx_buf +
+   mdata->num_xfered +
+   (cnt * 4),
+   _val,
+   remainder);
}
}
 
-   trans->len -= mdata->xfer_len;
-   if (!trans->len) {
+   mdata->num_xfered += mdata->xfer_len;
+   if (mdata->num_xfered == trans->len) {
spi_finalize_current_transfer(master);
return IRQ_HANDLED;
}
 
-   if (trans->tx_buf)
-   trans->tx_buf += mdata->xfer_len;
-   if (trans->rx_buf)
-   trans->rx_buf += mdata->xfer_len;
-
-   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, trans->len);
+   len = trans->len - mdata->num_xfered;
+   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, len);
mtk_spi_setup_packet(master);
 
-   cnt = trans->len / 4;
-   iowrite32_rep(mdata->base + SPI_TX_DATA_REG, trans->tx_buf, 
cnt);
+   cnt = len / 4;
+   iowrite32_rep(mdata->base + SPI_TX_DATA_REG,
+   trans->tx_buf + mdata->num_xfered, cnt);
 
-   remainder = trans->len % 4;
+   remainder = len % 4;
if (remainder > 0) {
reg_val = 0;
-   memcpy(_val, trans->tx_buf + (cnt * 4), remainder);
+   memcpy(_val,
+   trans->tx_buf + (cnt * 4) + mdata->num_xfered,
+   remainder);
writel(reg_val, mdata->base + SPI_TX_DATA_REG);
}
 
-- 
2.19.0.rc2.392.g5ba43deb5a-goog



[PATCH] spi: mediatek: Don't modify spi_transfer when transfer.

2018-09-09 Thread Peter Shih
Mediatek SPI driver modifies some fields (tx_buf, rx_buf, len, tx_dma,
rx_dma) of the spi_transfer* passed in when doing transfer_one and in
interrupt handler. This is somewhat unexpected, and there are some
caller (e.g. Cr50 spi driver) that reuse the spi_transfer for multiple
messages. Add a field to record how many bytes have been transferred,
and calculate the right len / buffer based on it instead.

BUG=b:113973051
TEST=None

Signed-off-by: Pi-Hsun Shih 

Change-Id: I23e218cd964f16c0b2b26127d4a5ca6529867673
---
 drivers/spi/spi-mt65xx.c | 37 +
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 86bf45667a040..3dc31627c6558 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -98,6 +98,7 @@ struct mtk_spi {
struct clk *parent_clk, *sel_clk, *spi_clk;
struct spi_transfer *cur_transfer;
u32 xfer_len;
+   u32 num_xfered;
struct scatterlist *tx_sgl, *rx_sgl;
u32 tx_sgl_len, rx_sgl_len;
const struct mtk_spi_compatible *dev_comp;
@@ -385,6 +386,7 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
 
mdata->cur_transfer = xfer;
mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, xfer->len);
+   mdata->num_xfered = 0;
mtk_spi_prepare_transfer(master, xfer);
mtk_spi_setup_packet(master);
 
@@ -415,6 +417,7 @@ static int mtk_spi_dma_transfer(struct spi_master *master,
mdata->tx_sgl_len = 0;
mdata->rx_sgl_len = 0;
mdata->cur_transfer = xfer;
+   mdata->num_xfered = 0;
 
mtk_spi_prepare_transfer(master, xfer);
 
@@ -482,7 +485,7 @@ static int mtk_spi_setup(struct spi_device *spi)
 
 static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
 {
-   u32 cmd, reg_val, cnt, remainder;
+   u32 cmd, reg_val, cnt, remainder, len;
struct spi_master *master = dev_id;
struct mtk_spi *mdata = spi_master_get_devdata(master);
struct spi_transfer *trans = mdata->cur_transfer;
@@ -497,36 +500,38 @@ static irqreturn_t mtk_spi_interrupt(int irq, void 
*dev_id)
if (trans->rx_buf) {
cnt = mdata->xfer_len / 4;
ioread32_rep(mdata->base + SPI_RX_DATA_REG,
-trans->rx_buf, cnt);
+trans->rx_buf + mdata->num_xfered, cnt);
remainder = mdata->xfer_len % 4;
if (remainder > 0) {
reg_val = readl(mdata->base + SPI_RX_DATA_REG);
-   memcpy(trans->rx_buf + (cnt * 4),
-   _val, remainder);
+   memcpy(trans->rx_buf +
+   mdata->num_xfered +
+   (cnt * 4),
+   _val,
+   remainder);
}
}
 
-   trans->len -= mdata->xfer_len;
-   if (!trans->len) {
+   mdata->num_xfered += mdata->xfer_len;
+   if (mdata->num_xfered == trans->len) {
spi_finalize_current_transfer(master);
return IRQ_HANDLED;
}
 
-   if (trans->tx_buf)
-   trans->tx_buf += mdata->xfer_len;
-   if (trans->rx_buf)
-   trans->rx_buf += mdata->xfer_len;
-
-   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, trans->len);
+   len = trans->len - mdata->num_xfered;
+   mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, len);
mtk_spi_setup_packet(master);
 
-   cnt = trans->len / 4;
-   iowrite32_rep(mdata->base + SPI_TX_DATA_REG, trans->tx_buf, 
cnt);
+   cnt = len / 4;
+   iowrite32_rep(mdata->base + SPI_TX_DATA_REG,
+   trans->tx_buf + mdata->num_xfered, cnt);
 
-   remainder = trans->len % 4;
+   remainder = len % 4;
if (remainder > 0) {
reg_val = 0;
-   memcpy(_val, trans->tx_buf + (cnt * 4), remainder);
+   memcpy(_val,
+   trans->tx_buf + (cnt * 4) + mdata->num_xfered,
+   remainder);
writel(reg_val, mdata->base + SPI_TX_DATA_REG);
}
 
-- 
2.19.0.rc2.392.g5ba43deb5a-goog



linux-next: build failure after merge of the vfs tree

2018-09-09 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (powerpc
allyesconfig) failed like this:

samples/vfs/test-fsinfo.c: In function 'fsinfo':
samples/vfs/test-fsinfo.c:37:17: error: '__NR_fsinfo' undeclared (first use in 
this function); did you mean 'fsinfo'?
  return syscall(__NR_fsinfo, dfd, filename, params, buffer, buf_size);
 ^~~
 fsinfo
samples/vfs/test-fsinfo.c:37:17: note: each undeclared identifier is reported 
only once for each function it appears in
samples/vfs/test-fsinfo.c: In function 'dump_attr_LIMITS':
samples/vfs/test-fsinfo.c:180:30: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax file size: %llx\n", f->max_file_size);
   ~~~^ 
   %lx
samples/vfs/test-fsinfo.c:181:32: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax ids  : u=%llx g=%llx p=%llx\n",
 ~~~^
 %lx
 f->max_uid, f->max_gid, f->max_projid);
 ~~
samples/vfs/test-fsinfo.c:181:39: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax ids  : u=%llx g=%llx p=%llx\n",
~~~^
%lx
 f->max_uid, f->max_gid, f->max_projid);
 ~~
samples/vfs/test-fsinfo.c:181:46: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 4 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax ids  : u=%llx g=%llx p=%llx\n",
   ~~~^
   %lx
 f->max_uid, f->max_gid, f->max_projid);
 ~
samples/vfs/test-fsinfo.c: In function 'dump_attr_SUPPORTS':
samples/vfs/test-fsinfo.c:197:24: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tstx_attr=%llx\n", f->stx_attributes);
 ~~~^ ~
 %lx
samples/vfs/test-fsmount.c: In function 'fsopen':
samples/vfs/test-fsmount.c:63:17: error: '__NR_fsopen' undeclared (first use in 
this function); did you mean 'fsopen'?
  return syscall(__NR_fsopen, fs_name, flags);
 ^~~
 fsopen
samples/vfs/test-fsmount.c:63:17: note: each undeclared identifier is reported 
only once for each function it appears in
samples/vfs/test-fsmount.c: In function 'fsmount':
samples/vfs/test-fsmount.c:68:17: error: '__NR_fsmount' undeclared (first use 
in this function); did you mean 'fsmount'?
  return syscall(__NR_fsmount, fsfd, flags, ms_flags);
 ^~~~
 fsmount
samples/vfs/test-fsmount.c: In function 'fsconfig':
samples/vfs/test-fsmount.c:74:17: error: '__NR_fsconfig' undeclared (first use 
in this function); did you mean 'fsconfig'?
  return syscall(__NR_fsconfig, fsfd, cmd, key, val, aux);
 ^
 fsconfig
samples/vfs/test-fsmount.c: In function 'move_mount':
samples/vfs/test-fsmount.c:81:17: error: '__NR_move_mount' undeclared (first 
use in this function); did you mean 'move_mount'?
  return syscall(__NR_move_mount,
 ^~~
 move_mount
samples/vfs/test-fs-query.c: In function 'fsopen':
samples/vfs/test-fs-query.c:32:17: error: '__NR_fsopen' undeclared (first use 
in this function); did you mean 'fsopen'?
  return syscall(__NR_fsopen, fs_name, flags);
 ^~~
 fsopen
samples/vfs/test-fs-query.c:32:17: note: each undeclared identifier is reported 
only once for each function it appears in
samples/vfs/test-fs-query.c: In function 'fsinfo':
samples/vfs/test-fs-query.c:38:17: error: '__NR_fsinfo' undeclared (first use 
in this function); did you mean 'fsinfo'?
  return syscall(__NR_fsinfo, dfd, filename, params, buffer, buf_size);
 ^~~
 fsinfo
samples/vfs/test-statx.c: In function 'dump_statx':
samples/vfs/test-statx.c:160:29: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
   printf("Attributes: %016llx (", stx->stx_attributes);
   ~~^ ~~~
   %016lx

Caused by commits

  2615362dc9ce ("vfs: Add a sample program for the new mount API")
  e9078278ec11 ("vfs: syscall: Add fsinfo() to query filesystem information")

The directory name has changed, but the errors persist!

I have applied this 

linux-next: build failure after merge of the vfs tree

2018-09-09 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (powerpc
allyesconfig) failed like this:

samples/vfs/test-fsinfo.c: In function 'fsinfo':
samples/vfs/test-fsinfo.c:37:17: error: '__NR_fsinfo' undeclared (first use in 
this function); did you mean 'fsinfo'?
  return syscall(__NR_fsinfo, dfd, filename, params, buffer, buf_size);
 ^~~
 fsinfo
samples/vfs/test-fsinfo.c:37:17: note: each undeclared identifier is reported 
only once for each function it appears in
samples/vfs/test-fsinfo.c: In function 'dump_attr_LIMITS':
samples/vfs/test-fsinfo.c:180:30: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax file size: %llx\n", f->max_file_size);
   ~~~^ 
   %lx
samples/vfs/test-fsinfo.c:181:32: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax ids  : u=%llx g=%llx p=%llx\n",
 ~~~^
 %lx
 f->max_uid, f->max_gid, f->max_projid);
 ~~
samples/vfs/test-fsinfo.c:181:39: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax ids  : u=%llx g=%llx p=%llx\n",
~~~^
%lx
 f->max_uid, f->max_gid, f->max_projid);
 ~~
samples/vfs/test-fsinfo.c:181:46: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 4 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tmax ids  : u=%llx g=%llx p=%llx\n",
   ~~~^
   %lx
 f->max_uid, f->max_gid, f->max_projid);
 ~
samples/vfs/test-fsinfo.c: In function 'dump_attr_SUPPORTS':
samples/vfs/test-fsinfo.c:197:24: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  printf("\tstx_attr=%llx\n", f->stx_attributes);
 ~~~^ ~
 %lx
samples/vfs/test-fsmount.c: In function 'fsopen':
samples/vfs/test-fsmount.c:63:17: error: '__NR_fsopen' undeclared (first use in 
this function); did you mean 'fsopen'?
  return syscall(__NR_fsopen, fs_name, flags);
 ^~~
 fsopen
samples/vfs/test-fsmount.c:63:17: note: each undeclared identifier is reported 
only once for each function it appears in
samples/vfs/test-fsmount.c: In function 'fsmount':
samples/vfs/test-fsmount.c:68:17: error: '__NR_fsmount' undeclared (first use 
in this function); did you mean 'fsmount'?
  return syscall(__NR_fsmount, fsfd, flags, ms_flags);
 ^~~~
 fsmount
samples/vfs/test-fsmount.c: In function 'fsconfig':
samples/vfs/test-fsmount.c:74:17: error: '__NR_fsconfig' undeclared (first use 
in this function); did you mean 'fsconfig'?
  return syscall(__NR_fsconfig, fsfd, cmd, key, val, aux);
 ^
 fsconfig
samples/vfs/test-fsmount.c: In function 'move_mount':
samples/vfs/test-fsmount.c:81:17: error: '__NR_move_mount' undeclared (first 
use in this function); did you mean 'move_mount'?
  return syscall(__NR_move_mount,
 ^~~
 move_mount
samples/vfs/test-fs-query.c: In function 'fsopen':
samples/vfs/test-fs-query.c:32:17: error: '__NR_fsopen' undeclared (first use 
in this function); did you mean 'fsopen'?
  return syscall(__NR_fsopen, fs_name, flags);
 ^~~
 fsopen
samples/vfs/test-fs-query.c:32:17: note: each undeclared identifier is reported 
only once for each function it appears in
samples/vfs/test-fs-query.c: In function 'fsinfo':
samples/vfs/test-fs-query.c:38:17: error: '__NR_fsinfo' undeclared (first use 
in this function); did you mean 'fsinfo'?
  return syscall(__NR_fsinfo, dfd, filename, params, buffer, buf_size);
 ^~~
 fsinfo
samples/vfs/test-statx.c: In function 'dump_statx':
samples/vfs/test-statx.c:160:29: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
   printf("Attributes: %016llx (", stx->stx_attributes);
   ~~^ ~~~
   %016lx

Caused by commits

  2615362dc9ce ("vfs: Add a sample program for the new mount API")
  e9078278ec11 ("vfs: syscall: Add fsinfo() to query filesystem information")

The directory name has changed, but the errors persist!

I have applied this 

Re: [PATCH v2] ARM: dts: imx6ul: Add DTS for ConnectCore 6UL SBC Pro

2018-09-09 Thread Shawn Guo
On Tue, Sep 04, 2018 at 05:28:29PM +0200, Alex Gonzalez wrote:
> The ConnectCore 6UL Single Board Computer (SBC) Pro contains the
> ConnectCore 6UL System-On-Module.
> 
> Its hardware specifications are:
> 
> * 256MB DDR3 memory
> * On module 256MB NAND flash
> * Dual 10/100 Ethernet
> * USB Host and USB OTG
> * Parallel RGB display header
> * LVDS display header
> * CSI camera
> * GPIO header
> * I2C, SPI, CAN headers
> * PCIe mini card and micro SIM slot
> * MicroSD external storage
> * On board 4GB eMMC flash
> * Audio headphone, line in/out, microphone lines
> 
> Signed-off-by: Alex Gonzalez 
> ---
>  arch/arm/boot/dts/Makefile  |   1 +
>  arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts | 394 
> 
>  2 files changed, 395 insertions(+)
>  create mode 100644 arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 6135d3dc381c..3f6f8983f6c6 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -534,6 +534,7 @@ dtb-$(CONFIG_SOC_IMX6SX) += \
>  dtb-$(CONFIG_SOC_IMX6UL) += \
>   imx6ul-14x14-evk.dtb \
>   imx6ul-ccimx6ulsbcexpress.dtb \
> + imx6ul-ccimx6ulsbcpro.dtb \
>   imx6ul-geam.dtb \
>   imx6ul-isiot-emmc.dtb \
>   imx6ul-isiot-nand.dtb \
> diff --git a/arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts 
> b/arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts
> new file mode 100644
> index ..08d550baa684
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts
> @@ -0,0 +1,394 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Digi International's ConnectCore6UL SBC Pro board device tree source
> + *
> + * Copyright 2018 Digi International, Inc.
> + *
> + */
> +
> +/dts-v1/;
> +#include 
> +#include 
> +#include "imx6ul.dtsi"
> +#include "imx6ul-ccimx6ulsom.dtsi"
> +
> +/ {
> + model = "Digi International ConnectCore 6UL SBC Pro.";
> + compatible = "digi,ccimx6ulsbcpro", "digi,ccimx6ulsom", "fsl,imx6ul";
> +
> + lcd_backlight: backlight {
> + compatible = "pwm-backlight";
> + pwms = < 0 5>;
> + brightness-levels = <0 4 8 16 32 64 128 255>;
> + default-brightness-level = <6>;
> + status = "okay";
> + };
> +
> + reg_usb_otg1_vbus: reg-usb-otg1 {

Please spell out 'regulator' in node name:

reg_usb_otg1_vbus: regulator-usb-otg1 {
...
};

Shawn

> + compatible = "regulator-fixed";
> + regulator-name = "usb_otg1_vbus";
> + regulator-min-microvolt = <500>;
> + regulator-max-microvolt = <500>;
> + gpio = < 4 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + };
> +};


Re: [PATCH v2] ARM: dts: imx6ul: Add DTS for ConnectCore 6UL SBC Pro

2018-09-09 Thread Shawn Guo
On Tue, Sep 04, 2018 at 05:28:29PM +0200, Alex Gonzalez wrote:
> The ConnectCore 6UL Single Board Computer (SBC) Pro contains the
> ConnectCore 6UL System-On-Module.
> 
> Its hardware specifications are:
> 
> * 256MB DDR3 memory
> * On module 256MB NAND flash
> * Dual 10/100 Ethernet
> * USB Host and USB OTG
> * Parallel RGB display header
> * LVDS display header
> * CSI camera
> * GPIO header
> * I2C, SPI, CAN headers
> * PCIe mini card and micro SIM slot
> * MicroSD external storage
> * On board 4GB eMMC flash
> * Audio headphone, line in/out, microphone lines
> 
> Signed-off-by: Alex Gonzalez 
> ---
>  arch/arm/boot/dts/Makefile  |   1 +
>  arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts | 394 
> 
>  2 files changed, 395 insertions(+)
>  create mode 100644 arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 6135d3dc381c..3f6f8983f6c6 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -534,6 +534,7 @@ dtb-$(CONFIG_SOC_IMX6SX) += \
>  dtb-$(CONFIG_SOC_IMX6UL) += \
>   imx6ul-14x14-evk.dtb \
>   imx6ul-ccimx6ulsbcexpress.dtb \
> + imx6ul-ccimx6ulsbcpro.dtb \
>   imx6ul-geam.dtb \
>   imx6ul-isiot-emmc.dtb \
>   imx6ul-isiot-nand.dtb \
> diff --git a/arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts 
> b/arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts
> new file mode 100644
> index ..08d550baa684
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dts
> @@ -0,0 +1,394 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Digi International's ConnectCore6UL SBC Pro board device tree source
> + *
> + * Copyright 2018 Digi International, Inc.
> + *
> + */
> +
> +/dts-v1/;
> +#include 
> +#include 
> +#include "imx6ul.dtsi"
> +#include "imx6ul-ccimx6ulsom.dtsi"
> +
> +/ {
> + model = "Digi International ConnectCore 6UL SBC Pro.";
> + compatible = "digi,ccimx6ulsbcpro", "digi,ccimx6ulsom", "fsl,imx6ul";
> +
> + lcd_backlight: backlight {
> + compatible = "pwm-backlight";
> + pwms = < 0 5>;
> + brightness-levels = <0 4 8 16 32 64 128 255>;
> + default-brightness-level = <6>;
> + status = "okay";
> + };
> +
> + reg_usb_otg1_vbus: reg-usb-otg1 {

Please spell out 'regulator' in node name:

reg_usb_otg1_vbus: regulator-usb-otg1 {
...
};

Shawn

> + compatible = "regulator-fixed";
> + regulator-name = "usb_otg1_vbus";
> + regulator-min-microvolt = <500>;
> + regulator-max-microvolt = <500>;
> + gpio = < 4 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + };
> +};


Re: [PATCH v2 1/2] ARM: dts: imx6: RDU2: Use new CODEC reset pin name

2018-09-09 Thread Shawn Guo
On Tue, Sep 04, 2018 at 09:20:17AM -0500, Andrew F. Davis wrote:
> The correct DT property for specifying a GPIO used for reset
> is "reset-gpios", the driver now accepts this name use this here.
> 
> Signed-off-by: Andrew F. Davis 
> ---
> 
> Changes from v1:
>  - Remove "fix" from commit message
> 
>  arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi 
> b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
> index 7fff3717cf7c..a0f5cfda0055 100644
> --- a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
> @@ -384,7 +384,7 @@
>   AVDD-supply = <_3p3v>;
>   IOVDD-supply = <_3p3v>;
>   DVDD-supply = <_reg>;
> - gpio-reset = < 2 GPIO_ACTIVE_HIGH>;
> + reset-gpios = < 2 GPIO_ACTIVE_LOW>;

Is it intended to change the polarity?

Shawn

>   };
>  
>   accel@1c {
> @@ -572,7 +572,7 @@
>   AVDD-supply = <_3p3v>;
>   IOVDD-supply = <_3p3v>;
>   DVDD-supply = <_reg>;
> - gpio-reset = < 0 GPIO_ACTIVE_HIGH>;
> + reset-gpios = < 0 GPIO_ACTIVE_LOW>;
>   };
>  
>   touchscreen@20 {
> -- 
> 2.18.0
> 


Re: [PATCH v2 1/2] ARM: dts: imx6: RDU2: Use new CODEC reset pin name

2018-09-09 Thread Shawn Guo
On Tue, Sep 04, 2018 at 09:20:17AM -0500, Andrew F. Davis wrote:
> The correct DT property for specifying a GPIO used for reset
> is "reset-gpios", the driver now accepts this name use this here.
> 
> Signed-off-by: Andrew F. Davis 
> ---
> 
> Changes from v1:
>  - Remove "fix" from commit message
> 
>  arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi 
> b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
> index 7fff3717cf7c..a0f5cfda0055 100644
> --- a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
> @@ -384,7 +384,7 @@
>   AVDD-supply = <_3p3v>;
>   IOVDD-supply = <_3p3v>;
>   DVDD-supply = <_reg>;
> - gpio-reset = < 2 GPIO_ACTIVE_HIGH>;
> + reset-gpios = < 2 GPIO_ACTIVE_LOW>;

Is it intended to change the polarity?

Shawn

>   };
>  
>   accel@1c {
> @@ -572,7 +572,7 @@
>   AVDD-supply = <_3p3v>;
>   IOVDD-supply = <_3p3v>;
>   DVDD-supply = <_reg>;
> - gpio-reset = < 0 GPIO_ACTIVE_HIGH>;
> + reset-gpios = < 0 GPIO_ACTIVE_LOW>;
>   };
>  
>   touchscreen@20 {
> -- 
> 2.18.0
> 


Re: [PATCH 0/3] x86/boot/KASLR: enhance randomness of kernel load addr when using GiB hugepage

2018-09-09 Thread Baoquan He
Hi Pingfan,

On 09/06/18 at 10:36am, Pingfan Liu wrote:
> commit 747ff6265db4 ("x86/boot/KASLR: Skip specified number of 1GB huge
> pages when doing physical randomization (KASLR)") and commit
> 9b912485e0e7 ("x86/boot/KASLR: Add two new functions for 1GB huge pages
> handling") prevent the physical load addr of kernel from spoiling a good
> candidate of GiB page. But the algorithm deterministicly chooses the most
> front GiB page for hugetlb, and sacrifices the randomness, which
> is the heart of the KASLR. This patch tries to enlarge the randomness in
> the cases where hugepages=X < the num Y of good candidate of GiB
> page.

Better tell how you improve in cover letter or patch log.

> To comparison, taking a typical KVM guest for example, the head 3GiB mem
> can not be used as GiB hugetlb. Denoting the total mem size as Z(GiB), when
> Z=5, then Y=2, assuming X=1, the randomness range before this patch is
> 4GiB, after this patch is 5GiB, and get a 25% improvement of randomness.
> If Z=6, then Y=3, assuming X=2, the improvement equals: 50%( 6/(6-2) - 1);
> assuming X=1, the improvement will be: 20% (6/(6-1) - 1)

Hmm, what if hugepages=1, or 2, even 100, but system owns 1PB memory?

Secondly, even in the case that hugepages=1, system memory is 5G, if no
'movable_node' specified, the last 1G can't be chosen for hugepage.
Because memblock will allocate memory top to down. This is not
improving, but make the code not work.

Lastly, getting better randomness is the heart of KASLR, while
process_mem_region() is the heart of kernel KASLR code. Unless the
current code blocks serious fix, we'd better not touch it. Keeping
it can make the current code logic simple and more readable. It's
like a proved running well machine, we just dig out the unwanted
middle, feed the good head and tail regions into it, then it gives
back good slot for kernel position one by one.

To sum up, I personally think this patchset is not a good idea.

Thanks
Baoquan


Re: [PATCH 0/3] x86/boot/KASLR: enhance randomness of kernel load addr when using GiB hugepage

2018-09-09 Thread Baoquan He
Hi Pingfan,

On 09/06/18 at 10:36am, Pingfan Liu wrote:
> commit 747ff6265db4 ("x86/boot/KASLR: Skip specified number of 1GB huge
> pages when doing physical randomization (KASLR)") and commit
> 9b912485e0e7 ("x86/boot/KASLR: Add two new functions for 1GB huge pages
> handling") prevent the physical load addr of kernel from spoiling a good
> candidate of GiB page. But the algorithm deterministicly chooses the most
> front GiB page for hugetlb, and sacrifices the randomness, which
> is the heart of the KASLR. This patch tries to enlarge the randomness in
> the cases where hugepages=X < the num Y of good candidate of GiB
> page.

Better tell how you improve in cover letter or patch log.

> To comparison, taking a typical KVM guest for example, the head 3GiB mem
> can not be used as GiB hugetlb. Denoting the total mem size as Z(GiB), when
> Z=5, then Y=2, assuming X=1, the randomness range before this patch is
> 4GiB, after this patch is 5GiB, and get a 25% improvement of randomness.
> If Z=6, then Y=3, assuming X=2, the improvement equals: 50%( 6/(6-2) - 1);
> assuming X=1, the improvement will be: 20% (6/(6-1) - 1)

Hmm, what if hugepages=1, or 2, even 100, but system owns 1PB memory?

Secondly, even in the case that hugepages=1, system memory is 5G, if no
'movable_node' specified, the last 1G can't be chosen for hugepage.
Because memblock will allocate memory top to down. This is not
improving, but make the code not work.

Lastly, getting better randomness is the heart of KASLR, while
process_mem_region() is the heart of kernel KASLR code. Unless the
current code blocks serious fix, we'd better not touch it. Keeping
it can make the current code logic simple and more readable. It's
like a proved running well machine, we just dig out the unwanted
middle, feed the good head and tail regions into it, then it gives
back good slot for kernel position one by one.

To sum up, I personally think this patchset is not a good idea.

Thanks
Baoquan


Re: [PATCH v2 4/5] dt-bindings: Add vendor prefix for Microsys

2018-09-09 Thread Shawn Guo
+Rob

@Rob, Are you okay with this?  The patch should really be sent to you
from the beginning.

Shawn

On Mon, Sep 03, 2018 at 04:08:39PM +0200, Alexandre Belloni wrote:
> Add vendor prefix for MicroSys Electronics GmbH
> 
> Signed-off-by: Alexandre Belloni 
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
> b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index 2c3fc512e746..10155a44b783 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -235,6 +235,7 @@ micrelMicrel Inc.
>  microchipMicrochip Technology Inc.
>  microcrystal Micro Crystal AG
>  micron   Micron Technology Inc.
> +microsys MicroSys Electronics GmbH
>  minixMINIX Technology Ltd.
>  miramems MiraMEMS Sensing Technology Co., Ltd.
>  mitsubishi   Mitsubishi Electric Corporation
> -- 
> 2.19.0.rc1
> 


Re: [PATCH v2 1/5] arm64: dts: fsl: use a generic node name for m25p80 flashes

2018-09-09 Thread Shawn Guo
The series looks good to me.  @Leo, what about you?

Shawn

On Mon, Sep 03, 2018 at 04:08:36PM +0200, Alexandre Belloni wrote:
> Use a generic node name for the m25p80 flashes on ls1043 and ls1046 boards.
> 
> Signed-off-by: Alexandre Belloni 
> ---
>  arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts | 2 +-
>  arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts | 2 +-
>  arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> index c7b8d2c009cd..af972e91d6bc 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> @@ -136,7 +136,7 @@
>   bus-num = <0>;
>   status = "okay";
>  
> - qflash0: s25fl128s@0 {
> + qflash0: flash@0 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> index e69306e6b0b1..219068220b84 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> @@ -165,7 +165,7 @@
>   bus-num = <0>;
>   status = "okay";
>  
> - qflash0: s25fl128s@0 {
> + qflash0: flash@0 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> index 440e111651d5..df676b30357b 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> @@ -103,7 +103,7 @@
>   bus-num = <0>;
>   status = "okay";
>  
> - qflash0: s25fs512s@0 {
> + qflash0: flash@0 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> @@ -111,7 +111,7 @@
>   reg = <0>;
>   };
>  
> - qflash1: s25fs512s@1 {
> + qflash1: flash@1 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> -- 
> 2.19.0.rc1
> 


Re: [PATCH v2 4/5] dt-bindings: Add vendor prefix for Microsys

2018-09-09 Thread Shawn Guo
+Rob

@Rob, Are you okay with this?  The patch should really be sent to you
from the beginning.

Shawn

On Mon, Sep 03, 2018 at 04:08:39PM +0200, Alexandre Belloni wrote:
> Add vendor prefix for MicroSys Electronics GmbH
> 
> Signed-off-by: Alexandre Belloni 
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
> b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index 2c3fc512e746..10155a44b783 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -235,6 +235,7 @@ micrelMicrel Inc.
>  microchipMicrochip Technology Inc.
>  microcrystal Micro Crystal AG
>  micron   Micron Technology Inc.
> +microsys MicroSys Electronics GmbH
>  minixMINIX Technology Ltd.
>  miramems MiraMEMS Sensing Technology Co., Ltd.
>  mitsubishi   Mitsubishi Electric Corporation
> -- 
> 2.19.0.rc1
> 


Re: [PATCH v2 1/5] arm64: dts: fsl: use a generic node name for m25p80 flashes

2018-09-09 Thread Shawn Guo
The series looks good to me.  @Leo, what about you?

Shawn

On Mon, Sep 03, 2018 at 04:08:36PM +0200, Alexandre Belloni wrote:
> Use a generic node name for the m25p80 flashes on ls1043 and ls1046 boards.
> 
> Signed-off-by: Alexandre Belloni 
> ---
>  arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts | 2 +-
>  arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts | 2 +-
>  arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> index c7b8d2c009cd..af972e91d6bc 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
> @@ -136,7 +136,7 @@
>   bus-num = <0>;
>   status = "okay";
>  
> - qflash0: s25fl128s@0 {
> + qflash0: flash@0 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> index e69306e6b0b1..219068220b84 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
> @@ -165,7 +165,7 @@
>   bus-num = <0>;
>   status = "okay";
>  
> - qflash0: s25fl128s@0 {
> + qflash0: flash@0 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> index 440e111651d5..df676b30357b 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
> @@ -103,7 +103,7 @@
>   bus-num = <0>;
>   status = "okay";
>  
> - qflash0: s25fs512s@0 {
> + qflash0: flash@0 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> @@ -111,7 +111,7 @@
>   reg = <0>;
>   };
>  
> - qflash1: s25fs512s@1 {
> + qflash1: flash@1 {
>   compatible = "spansion,m25p80";
>   #address-cells = <1>;
>   #size-cells = <1>;
> -- 
> 2.19.0.rc1
> 


[PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset

2018-09-09 Thread zhong jiang
dma_zalloc_coherent has taken the dma_alloc_coherent() and memset() into
account. Therefore, just use dma_zalloc_coherent to replace the open code.

Signed-off-by: zhong jiang 
---
 arch/sh/mm/consistent.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 792f361..aa4e450 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -52,14 +52,12 @@ int __init platform_resource_setup_memory(struct 
platform_device *pdev,
if (!memsize)
return 0;
 
-   buf = dma_alloc_coherent(>dev, memsize, _handle, GFP_KERNEL);
+   buf = dma_zalloc_coherent(>dev, memsize, _handle, GFP_KERNEL);
if (!buf) {
pr_warning("%s: unable to allocate memory\n", name);
return -ENOMEM;
}
 
-   memset(buf, 0, memsize);
-
r->flags = IORESOURCE_MEM;
r->start = dma_handle;
r->end = r->start + memsize - 1;
-- 
1.7.12.4



[PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset

2018-09-09 Thread zhong jiang
dma_zalloc_coherent has taken the dma_alloc_coherent() and memset() into
account. Therefore, just use dma_zalloc_coherent to replace the open code.

Signed-off-by: zhong jiang 
---
 arch/sh/mm/consistent.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 792f361..aa4e450 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -52,14 +52,12 @@ int __init platform_resource_setup_memory(struct 
platform_device *pdev,
if (!memsize)
return 0;
 
-   buf = dma_alloc_coherent(>dev, memsize, _handle, GFP_KERNEL);
+   buf = dma_zalloc_coherent(>dev, memsize, _handle, GFP_KERNEL);
if (!buf) {
pr_warning("%s: unable to allocate memory\n", name);
return -ENOMEM;
}
 
-   memset(buf, 0, memsize);
-
r->flags = IORESOURCE_MEM;
r->start = dma_handle;
r->end = r->start + memsize - 1;
-- 
1.7.12.4



sysfs: Do not return POSIX ACL xattrs via listxattr()

2018-09-09 Thread Marc Aurele La France
Greetings.

Commit 786534b92f3ce68f4afc8a761c80b76887797b0a "tmpfs: listxattr
should include POSIX ACL xattrs", which first appeared in 4.5 kernels,
introduced a regression whereby listxattr() syscalls on anything in
sysfs, or its mountpoint, return the name of the two POSIX ACL xattrs,
but attempts to retrieve these values are denied with EOPNOTSUP.  For
example ...

# getfattr -d --match=- /sys
/sys: system.posix_acl_access: Operation not supported
/sys: system.posix_acl_default: Operation not supported
#

This inconsistent behaviour confuses rsync(1) (among others) when it
runs into a sysfs mountpoint, even when told to not descend into it.
This issue occurs because simple_xattr_list() does not correctly deal
with cached ACLs.

The suggested fix below was developed with a 4.18.7 kernel, but should
apply, modulo patch fuzz, to any kernel >= 4.7.  A fix for 4.5 <=
kernels < 4.7 is trivially different, but I won't bother given such
kernels are no longer maintained.

Note that the only other simple_xattr_list() caller, shmem, avoids
this glitch by previously calling cache_no_acl() on all inodes it
creates, so perhaps sysfs/kernfs should do the same.

Please Reply-To-All.

Thanks and have a great day.

Marc.

Signed-off-by: Marc Aurèle La France 

--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -949,13 +949,13 @@ ssize_t simple_xattr_list(struct inode *inode, struct 
simple_xattrs *xattrs,
int err = 0;

 #ifdef CONFIG_FS_POSIX_ACL
-   if (inode->i_acl) {
+   if (inode->i_acl && !is_uncached_acl(inode->i_acl)) {
err = xattr_list_one(, _size,
 XATTR_NAME_POSIX_ACL_ACCESS);
if (err)
return err;
}
-   if (inode->i_default_acl) {
+   if (inode->i_default_acl && !is_uncached_acl(inode->i_default_acl)) {
err = xattr_list_one(, _size,
 XATTR_NAME_POSIX_ACL_DEFAULT);
if (err)

sysfs: Do not return POSIX ACL xattrs via listxattr()

2018-09-09 Thread Marc Aurele La France
Greetings.

Commit 786534b92f3ce68f4afc8a761c80b76887797b0a "tmpfs: listxattr
should include POSIX ACL xattrs", which first appeared in 4.5 kernels,
introduced a regression whereby listxattr() syscalls on anything in
sysfs, or its mountpoint, return the name of the two POSIX ACL xattrs,
but attempts to retrieve these values are denied with EOPNOTSUP.  For
example ...

# getfattr -d --match=- /sys
/sys: system.posix_acl_access: Operation not supported
/sys: system.posix_acl_default: Operation not supported
#

This inconsistent behaviour confuses rsync(1) (among others) when it
runs into a sysfs mountpoint, even when told to not descend into it.
This issue occurs because simple_xattr_list() does not correctly deal
with cached ACLs.

The suggested fix below was developed with a 4.18.7 kernel, but should
apply, modulo patch fuzz, to any kernel >= 4.7.  A fix for 4.5 <=
kernels < 4.7 is trivially different, but I won't bother given such
kernels are no longer maintained.

Note that the only other simple_xattr_list() caller, shmem, avoids
this glitch by previously calling cache_no_acl() on all inodes it
creates, so perhaps sysfs/kernfs should do the same.

Please Reply-To-All.

Thanks and have a great day.

Marc.

Signed-off-by: Marc Aurèle La France 

--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -949,13 +949,13 @@ ssize_t simple_xattr_list(struct inode *inode, struct 
simple_xattrs *xattrs,
int err = 0;

 #ifdef CONFIG_FS_POSIX_ACL
-   if (inode->i_acl) {
+   if (inode->i_acl && !is_uncached_acl(inode->i_acl)) {
err = xattr_list_one(, _size,
 XATTR_NAME_POSIX_ACL_ACCESS);
if (err)
return err;
}
-   if (inode->i_default_acl) {
+   if (inode->i_default_acl && !is_uncached_acl(inode->i_default_acl)) {
err = xattr_list_one(, _size,
 XATTR_NAME_POSIX_ACL_DEFAULT);
if (err)

[PATCH TRIVIAL] MAINTAINERS: small punctuation fix

2018-09-09 Thread Diego Viola
Signed-off-by: Diego Viola 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index d870cb57c..6567bf245 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -93,7 +93,7 @@ Descriptions of section entries:
   Supported:   Someone is actually paid to look after this.
   Maintained:  Someone actually looks after it.
   Odd Fixes:   It has a maintainer but they don't have time to do
-   much other than throw the odd patch in. See below..
+   much other than throw the odd patch in. See below.
   Orphan:  No current maintainer [but maybe you could take the
role as you write your new code].
   Obsolete:Old code. Something tagged obsolete generally means
-- 
2.18.0



[PATCH TRIVIAL] MAINTAINERS: small punctuation fix

2018-09-09 Thread Diego Viola
Signed-off-by: Diego Viola 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index d870cb57c..6567bf245 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -93,7 +93,7 @@ Descriptions of section entries:
   Supported:   Someone is actually paid to look after this.
   Maintained:  Someone actually looks after it.
   Odd Fixes:   It has a maintainer but they don't have time to do
-   much other than throw the odd patch in. See below..
+   much other than throw the odd patch in. See below.
   Orphan:  No current maintainer [but maybe you could take the
role as you write your new code].
   Obsolete:Old code. Something tagged obsolete generally means
-- 
2.18.0



Re: [RFC 60/60] cosched: Add command line argument to enable coscheduling

2018-09-09 Thread Randy Dunlap
On 9/7/18 2:40 PM, Jan H. Schönherr wrote:
> Add a new command line argument cosched_max_level=, which allows
> enabling coscheduling at boot. The number corresponds to the scheduling
> domain up to which coscheduling can later be enabled for cgroups.
> 
> For example, to enable coscheduling of cgroups at SMT level, one would
> specify cosched_max_level=1.
> 
> The use of symbolic names (like off, core, socket, system) is currently
> not possible, but could be added. However, to force coscheduling at up
> to system level not knowing the scheduling domain topology in advance,
> it is possible to just specify a too large number. It will be clamped
> transparently to system level.
> 
> Signed-off-by: Jan H. Schönherr 
> ---
>  kernel/sched/cosched.c | 32 +++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/cosched.c b/kernel/sched/cosched.c
> index eb6a6a61521e..a1f0d3a7b02a 100644
> --- a/kernel/sched/cosched.c
> +++ b/kernel/sched/cosched.c
> @@ -162,6 +162,29 @@ static int __init cosched_split_domains_setup(char *str)
>  
>  early_param("cosched_split_domains", cosched_split_domains_setup);
>  

> +
> +early_param("cosched_max_level", cosched_max_level_setup);
> +

Hi,
Please document both of these kernel parameters in
Documentation/admin-guide/kernel-parameters.txt.

thanks,
-- 
~Randy


Re: [RFC 60/60] cosched: Add command line argument to enable coscheduling

2018-09-09 Thread Randy Dunlap
On 9/7/18 2:40 PM, Jan H. Schönherr wrote:
> Add a new command line argument cosched_max_level=, which allows
> enabling coscheduling at boot. The number corresponds to the scheduling
> domain up to which coscheduling can later be enabled for cgroups.
> 
> For example, to enable coscheduling of cgroups at SMT level, one would
> specify cosched_max_level=1.
> 
> The use of symbolic names (like off, core, socket, system) is currently
> not possible, but could be added. However, to force coscheduling at up
> to system level not knowing the scheduling domain topology in advance,
> it is possible to just specify a too large number. It will be clamped
> transparently to system level.
> 
> Signed-off-by: Jan H. Schönherr 
> ---
>  kernel/sched/cosched.c | 32 +++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/cosched.c b/kernel/sched/cosched.c
> index eb6a6a61521e..a1f0d3a7b02a 100644
> --- a/kernel/sched/cosched.c
> +++ b/kernel/sched/cosched.c
> @@ -162,6 +162,29 @@ static int __init cosched_split_domains_setup(char *str)
>  
>  early_param("cosched_split_domains", cosched_split_domains_setup);
>  

> +
> +early_param("cosched_max_level", cosched_max_level_setup);
> +

Hi,
Please document both of these kernel parameters in
Documentation/admin-guide/kernel-parameters.txt.

thanks,
-- 
~Randy


Re: [PATCH 2/5] gpio: davinci: Use dev name for label and automatic base selection

2018-09-09 Thread Keerthy



On Sunday 09 September 2018 01:11 AM, Grygorii Strashko wrote:
> 
> 
> On 09/06/2018 09:16 AM, Keerthy wrote:
>>
>>
>> On Wednesday 05 September 2018 04:07 PM, Linus Walleij wrote:
>>> On Mon, Sep 3, 2018 at 7:40 AM Keerthy  wrote:
 On Saturday 01 September 2018 12:43 AM, Andrew F. Davis wrote:
> Use dev_name to get a unique label and use -1 for a base to get our
> selection automatically. We pull in all GPIOs per chip now so this
> does not have the effect of out of order labels like before.
>
> We do these both together so we can drop all the static data in one
> patch. This also lets us normalize the return paths as we don't need
> any cleanup after this change.

 echo 28 > /sys/class/gpio/export
 / # echo 28 > /sys/class/gpi[   12.839205] export_store: invalid GPIO 28
 o/export
 echo 2 > /sys/class/gp[   22.165728] export_store: invalid GPIO 2
 io/export
 / # echo 1 > /sys/class/gp[   25.961392] export_store: invalid GPIO 1
 io/export
 / # echo 3 > /sys/class/gp[   29.981918] export_store: invalid GPIO 3
 io/export

 Export fails with this patch. I am testing this on keystone-k2g-evm.
>>>
>>> I think the GPIO got a new number didn't it?
>>>
>>> Did you check the gpio file in debugfs to see which number
>>> it got.
>>
>> Okay now its numbered differently:
>>
>> cat /sys/class/gpio/gpiochip340/ngpio
>> 144
>>
>> cat /sys/class/gpio/gpiochip272/ngpio
>> 68
> 
> could you or Andrew provide content of /debug/gpio before/after?
> And ls /sys/class/gpio/?

Output on K2G:

Before
==

cat /debug/gpio
gpiochip1: GPIOs 0-143, parent: platform/2603000.gpio, davinci_gpio.0:

gpiochip2: GPIOs 144-211, parent: platform/260a000.gpio, davinci_gpio.1:
 gpio-156 (|cd  ) in  lo

gpiochip0: GPIOs 484-511, parent: platform/2620240.keystone_dsp_gpio,
2620240.keystone_dsp_gpio:

 ls /sys/class/gpio/
export   gpiochip0gpiochip144  gpiochip484  unexport

cat /sys/class/gpio/gpiochip0/label
davinci_gpio.0

cat /sys/class/gpio/gpiochip144/label
davinci_gpio.1

cat /sys/class/gpio/gpiochip144/ngpio
68
/ # cat /sys/class/gpio/gpiochip0/ngpio
144


After
=

 cat /debug/gpio
gpiochip2: GPIOs 272-339, parent: platform/260a000.gpio, 260a000.gpio:
 gpio-284 (|cd  ) in  lo

gpiochip1: GPIOs 340-483, parent: platform/2603000.gpio, 2603000.gpio:

gpiochip0: GPIOs 484-511, parent: platform/2620240.keystone_dsp_gpio,
2620240.keystone_dsp_gpio:

ls /sys/class/gpio/
export   gpiochip272  gpiochip340  gpiochip484  unexport


cat /sys/class/gpio/gpiochip340/label
2603000.gpio
/ # cat /sys/class/gpio/gpiochip272/label
260a000.gpio
/ # cat /sys/class/gpio/gpiochip272/label

cat /sys/class/gpio/gpiochip272/ngpio
68
/ # cat /sys/class/gpio/gpiochip340/ngpio
144

In the case of SoCs that support multiple instances of Davinci GPIO IPs
it is harder to figure out the right gpio number to export.

>>
>> So gpio bank2 and bank1 have different gpio numbers. Is that acceptable?
>>
>>>
>>> This is sadly the global numberspace that we are tying to
>>> get rid of (new apps/scripts should use the chardev).
>>>
>>> Are there applications that rely on the sysfs ABI on DaVinci?
>>>
>>> In that case base needs to be prerseved.
> 
> Not only base, but label also - /sys/class/gpio/gpiochip0/label, as this is
> the way to find proper GPIO chip in sysfs using legacy GPIO ABI.
> 
> Linus, this platform is old and most of the users do not use new ABI 
> (chardev),
> so we could try change this, but need to be prepared for regressions reports.
> 

Totally agree with this.


Re: [PATCH 2/5] gpio: davinci: Use dev name for label and automatic base selection

2018-09-09 Thread Keerthy



On Sunday 09 September 2018 01:11 AM, Grygorii Strashko wrote:
> 
> 
> On 09/06/2018 09:16 AM, Keerthy wrote:
>>
>>
>> On Wednesday 05 September 2018 04:07 PM, Linus Walleij wrote:
>>> On Mon, Sep 3, 2018 at 7:40 AM Keerthy  wrote:
 On Saturday 01 September 2018 12:43 AM, Andrew F. Davis wrote:
> Use dev_name to get a unique label and use -1 for a base to get our
> selection automatically. We pull in all GPIOs per chip now so this
> does not have the effect of out of order labels like before.
>
> We do these both together so we can drop all the static data in one
> patch. This also lets us normalize the return paths as we don't need
> any cleanup after this change.

 echo 28 > /sys/class/gpio/export
 / # echo 28 > /sys/class/gpi[   12.839205] export_store: invalid GPIO 28
 o/export
 echo 2 > /sys/class/gp[   22.165728] export_store: invalid GPIO 2
 io/export
 / # echo 1 > /sys/class/gp[   25.961392] export_store: invalid GPIO 1
 io/export
 / # echo 3 > /sys/class/gp[   29.981918] export_store: invalid GPIO 3
 io/export

 Export fails with this patch. I am testing this on keystone-k2g-evm.
>>>
>>> I think the GPIO got a new number didn't it?
>>>
>>> Did you check the gpio file in debugfs to see which number
>>> it got.
>>
>> Okay now its numbered differently:
>>
>> cat /sys/class/gpio/gpiochip340/ngpio
>> 144
>>
>> cat /sys/class/gpio/gpiochip272/ngpio
>> 68
> 
> could you or Andrew provide content of /debug/gpio before/after?
> And ls /sys/class/gpio/?

Output on K2G:

Before
==

cat /debug/gpio
gpiochip1: GPIOs 0-143, parent: platform/2603000.gpio, davinci_gpio.0:

gpiochip2: GPIOs 144-211, parent: platform/260a000.gpio, davinci_gpio.1:
 gpio-156 (|cd  ) in  lo

gpiochip0: GPIOs 484-511, parent: platform/2620240.keystone_dsp_gpio,
2620240.keystone_dsp_gpio:

 ls /sys/class/gpio/
export   gpiochip0gpiochip144  gpiochip484  unexport

cat /sys/class/gpio/gpiochip0/label
davinci_gpio.0

cat /sys/class/gpio/gpiochip144/label
davinci_gpio.1

cat /sys/class/gpio/gpiochip144/ngpio
68
/ # cat /sys/class/gpio/gpiochip0/ngpio
144


After
=

 cat /debug/gpio
gpiochip2: GPIOs 272-339, parent: platform/260a000.gpio, 260a000.gpio:
 gpio-284 (|cd  ) in  lo

gpiochip1: GPIOs 340-483, parent: platform/2603000.gpio, 2603000.gpio:

gpiochip0: GPIOs 484-511, parent: platform/2620240.keystone_dsp_gpio,
2620240.keystone_dsp_gpio:

ls /sys/class/gpio/
export   gpiochip272  gpiochip340  gpiochip484  unexport


cat /sys/class/gpio/gpiochip340/label
2603000.gpio
/ # cat /sys/class/gpio/gpiochip272/label
260a000.gpio
/ # cat /sys/class/gpio/gpiochip272/label

cat /sys/class/gpio/gpiochip272/ngpio
68
/ # cat /sys/class/gpio/gpiochip340/ngpio
144

In the case of SoCs that support multiple instances of Davinci GPIO IPs
it is harder to figure out the right gpio number to export.

>>
>> So gpio bank2 and bank1 have different gpio numbers. Is that acceptable?
>>
>>>
>>> This is sadly the global numberspace that we are tying to
>>> get rid of (new apps/scripts should use the chardev).
>>>
>>> Are there applications that rely on the sysfs ABI on DaVinci?
>>>
>>> In that case base needs to be prerseved.
> 
> Not only base, but label also - /sys/class/gpio/gpiochip0/label, as this is
> the way to find proper GPIO chip in sysfs using legacy GPIO ABI.
> 
> Linus, this platform is old and most of the users do not use new ABI 
> (chardev),
> so we could try change this, but need to be prepared for regressions reports.
> 

Totally agree with this.


Re: [PATCH] bcache: remove redundant condition before debugfs_remove

2018-09-09 Thread Junhui Tang
LGTM

Reviewed-by: tang.junhui.li...@gmail.com
zhong jiang  于2018年9月8日周六 下午9:08写道:
>
> debugfs_remove has taken the IS_ERR_OR_NULL into account. Just
> remove the unnecessary condition.
>
> Signed-off-by: zhong jiang 
> ---
>  drivers/md/bcache/super.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 2d26f9e..a3d2a94 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1506,8 +1506,7 @@ static void cache_set_free(struct closure *cl)
> struct cache *ca;
> unsigned int i;
>
> -   if (!IS_ERR_OR_NULL(c->debug))
> -   debugfs_remove(c->debug);
> +   debugfs_remove(c->debug);
>
> bch_open_buckets_free(c);
> bch_btree_cache_free(c);
> --
> 1.7.12.4
>


Re: [PATCH] bcache: remove redundant condition before debugfs_remove

2018-09-09 Thread Junhui Tang
LGTM

Reviewed-by: tang.junhui.li...@gmail.com
zhong jiang  于2018年9月8日周六 下午9:08写道:
>
> debugfs_remove has taken the IS_ERR_OR_NULL into account. Just
> remove the unnecessary condition.
>
> Signed-off-by: zhong jiang 
> ---
>  drivers/md/bcache/super.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 2d26f9e..a3d2a94 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1506,8 +1506,7 @@ static void cache_set_free(struct closure *cl)
> struct cache *ca;
> unsigned int i;
>
> -   if (!IS_ERR_OR_NULL(c->debug))
> -   debugfs_remove(c->debug);
> +   debugfs_remove(c->debug);
>
> bch_open_buckets_free(c);
> bch_btree_cache_free(c);
> --
> 1.7.12.4
>


Re: [PATCH resend] uapi/linux/keyctl.h: don't use C++ reserved keyword as a struct member name

2018-09-09 Thread Eugene Syromiatnikov
On Tue, Aug 28, 2018 at 04:34:04PM -0700, Randy Dunlap wrote:
> From: Randy Dunlap 
> 
> Since this header is in "include/uapi/linux/", apparently people
> want to use it in userspace programs -- even in C++ ones.
> However, the header uses a C++ reserved keyword ("private"),
> so change that to "dh_private" instead to allow the header file
> to be used in C++ userspace.

This change breaks all existing C programs that rely on 
uapi header in order to get struct keyctl_dh_params definition, however.

> 
> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=191051
> Fixes: ddbb41148724 ("KEYS: Add KEYCTL_DH_COMPUTE command")
> 
> Signed-off-by: Randy Dunlap 
> Cc: David Howells 
> Cc: James Morris 
> Cc: "Serge E. Hallyn" 
> Cc: keyri...@vger.kernel.org
> Cc: linux-security-mod...@vger.kernel.org
> Cc: Mat Martineau 
> Cc: sta...@vger.kernel.org
> ---
>  include/uapi/linux/keyctl.h |2 +-
>  security/keys/dh.c  |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> --- lnx-416.orig/include/uapi/linux/keyctl.h
> +++ lnx-416/include/uapi/linux/keyctl.h
> @@ -65,7 +65,7 @@
>  
>  /* keyctl structures */
>  struct keyctl_dh_params {
> - __s32 private;
> + __s32 dh_private;

>   __s32 prime;
>   __s32 base;
>  };
> --- lnx-416.orig/security/keys/dh.c
> +++ lnx-416/security/keys/dh.c
> @@ -307,7 +307,7 @@ long __keyctl_dh_compute(struct keyctl_d
>   }
>   dh_inputs.g_size = dlen;
>  
> - dlen = dh_data_from_key(pcopy.private, _inputs.key);
> + dlen = dh_data_from_key(pcopy.dh_private, _inputs.key);
>   if (dlen < 0) {
>   ret = dlen;
>   goto out2;
> 
> 


Re: [PATCH resend] uapi/linux/keyctl.h: don't use C++ reserved keyword as a struct member name

2018-09-09 Thread Eugene Syromiatnikov
On Tue, Aug 28, 2018 at 04:34:04PM -0700, Randy Dunlap wrote:
> From: Randy Dunlap 
> 
> Since this header is in "include/uapi/linux/", apparently people
> want to use it in userspace programs -- even in C++ ones.
> However, the header uses a C++ reserved keyword ("private"),
> so change that to "dh_private" instead to allow the header file
> to be used in C++ userspace.

This change breaks all existing C programs that rely on 
uapi header in order to get struct keyctl_dh_params definition, however.

> 
> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=191051
> Fixes: ddbb41148724 ("KEYS: Add KEYCTL_DH_COMPUTE command")
> 
> Signed-off-by: Randy Dunlap 
> Cc: David Howells 
> Cc: James Morris 
> Cc: "Serge E. Hallyn" 
> Cc: keyri...@vger.kernel.org
> Cc: linux-security-mod...@vger.kernel.org
> Cc: Mat Martineau 
> Cc: sta...@vger.kernel.org
> ---
>  include/uapi/linux/keyctl.h |2 +-
>  security/keys/dh.c  |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> --- lnx-416.orig/include/uapi/linux/keyctl.h
> +++ lnx-416/include/uapi/linux/keyctl.h
> @@ -65,7 +65,7 @@
>  
>  /* keyctl structures */
>  struct keyctl_dh_params {
> - __s32 private;
> + __s32 dh_private;

>   __s32 prime;
>   __s32 base;
>  };
> --- lnx-416.orig/security/keys/dh.c
> +++ lnx-416/security/keys/dh.c
> @@ -307,7 +307,7 @@ long __keyctl_dh_compute(struct keyctl_d
>   }
>   dh_inputs.g_size = dlen;
>  
> - dlen = dh_data_from_key(pcopy.private, _inputs.key);
> + dlen = dh_data_from_key(pcopy.dh_private, _inputs.key);
>   if (dlen < 0) {
>   ret = dlen;
>   goto out2;
> 
> 


Memory leak in dell-smbios-wmi.c

2018-09-09 Thread Xu, Pinzhen
There might be a possible memory leak in drivers/platform/x86/dell-smbios-wmi.c
In the `run_smbios_call' function, the buffer created via ACPI_ALLOCATE_BUFFER
within the output object is not freed properly.


Generally, this buffer should be freed using:
  kfree(output.pointer);


But it hasn't been cleaned up after a `memcpy' being done.
static int run_smbios_call(struct wmi_device *wdev)
{
  struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
  struct wmi_smbios_priv *priv;
  struct acpi_buffer input;
  union acpi_object *obj;
  acpi_status status;

  priv = dev_get_drvdata(>dev);
  input.length = priv->req_buf_size - sizeof(u64);
  input.pointer = >buf->std;

  dev_dbg(>dev, "evaluating: %u/%u [%x,%x,%x,%x]\n",
priv->buf->std.cmd_class, priv->buf->std.cmd_select,
priv->buf->std.input[0], priv->buf->std.input[1],
priv->buf->std.input[2], priv->buf->std.input[3]);

  status = wmidev_evaluate_method(wdev, 0, 1, , );
  if (ACPI_FAILURE(status))
return -EIO;
  obj = (union acpi_object *)output.pointer;
  if (obj->type != ACPI_TYPE_BUFFER) {
dev_dbg(>dev, "received type: %d\n", obj->type);
if (obj->type == ACPI_TYPE_INTEGER)
  dev_dbg(>dev, "SMBIOS call failed: %llu\n",
obj->integer.value);
return -EIO;
  }
  memcpy(>buf->std, obj->buffer.pointer, obj->buffer.length);
  dev_dbg(>dev, "result: [%08x,%08x,%08x,%08x]\n",
priv->buf->std.output[0], priv->buf->std.output[1],
priv->buf->std.output[2], priv->buf->std.output[3]);

  return 0;
}


Found with kmemleak:
unreferenced object 0x8f79382e (size 8192):
  comm "fwupd", pid 3467, jiffies 4294967131 (age 265623.160s)
  hex dump (first 32 bytes):
03 00 00 00 00 10 00 00 18 00 2e 38 79 8f ff ff  ...8y...
00 00 00 00 00 00 00 00 11 00 16 00 00 00 00 00  
  backtrace:
[<00d8a77d>] __kmalloc+0x14e/0x240
[] acpi_os_allocate+0x27/0x29
[<3fd4a388>] acpi_ut_initialize_buffer+0x3f/0x73
[<27ecea33>] acpi_evaluate_object+0x22b/0x3aa
[] wmidev_evaluate_method+0x114/0x150 [wmi]
[] run_smbios_call+0x6d/0x190 [dell_smbios]
[] dell_smbios_wmi_filter+0x71/0xd0 [dell_smbios]
[] wmi_ioctl+0x100/0x232 [wmi]
[] do_vfs_ioctl+0xa8/0x620
[<35f23e13>] ksys_ioctl+0x67/0x90
[] __x64_sys_ioctl+0x1a/0x20
[<477604b1>] do_syscall_64+0x5a/0x110
[] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[] 0x


Memory leak in dell-smbios-wmi.c

2018-09-09 Thread Xu, Pinzhen
There might be a possible memory leak in drivers/platform/x86/dell-smbios-wmi.c
In the `run_smbios_call' function, the buffer created via ACPI_ALLOCATE_BUFFER
within the output object is not freed properly.


Generally, this buffer should be freed using:
  kfree(output.pointer);


But it hasn't been cleaned up after a `memcpy' being done.
static int run_smbios_call(struct wmi_device *wdev)
{
  struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
  struct wmi_smbios_priv *priv;
  struct acpi_buffer input;
  union acpi_object *obj;
  acpi_status status;

  priv = dev_get_drvdata(>dev);
  input.length = priv->req_buf_size - sizeof(u64);
  input.pointer = >buf->std;

  dev_dbg(>dev, "evaluating: %u/%u [%x,%x,%x,%x]\n",
priv->buf->std.cmd_class, priv->buf->std.cmd_select,
priv->buf->std.input[0], priv->buf->std.input[1],
priv->buf->std.input[2], priv->buf->std.input[3]);

  status = wmidev_evaluate_method(wdev, 0, 1, , );
  if (ACPI_FAILURE(status))
return -EIO;
  obj = (union acpi_object *)output.pointer;
  if (obj->type != ACPI_TYPE_BUFFER) {
dev_dbg(>dev, "received type: %d\n", obj->type);
if (obj->type == ACPI_TYPE_INTEGER)
  dev_dbg(>dev, "SMBIOS call failed: %llu\n",
obj->integer.value);
return -EIO;
  }
  memcpy(>buf->std, obj->buffer.pointer, obj->buffer.length);
  dev_dbg(>dev, "result: [%08x,%08x,%08x,%08x]\n",
priv->buf->std.output[0], priv->buf->std.output[1],
priv->buf->std.output[2], priv->buf->std.output[3]);

  return 0;
}


Found with kmemleak:
unreferenced object 0x8f79382e (size 8192):
  comm "fwupd", pid 3467, jiffies 4294967131 (age 265623.160s)
  hex dump (first 32 bytes):
03 00 00 00 00 10 00 00 18 00 2e 38 79 8f ff ff  ...8y...
00 00 00 00 00 00 00 00 11 00 16 00 00 00 00 00  
  backtrace:
[<00d8a77d>] __kmalloc+0x14e/0x240
[] acpi_os_allocate+0x27/0x29
[<3fd4a388>] acpi_ut_initialize_buffer+0x3f/0x73
[<27ecea33>] acpi_evaluate_object+0x22b/0x3aa
[] wmidev_evaluate_method+0x114/0x150 [wmi]
[] run_smbios_call+0x6d/0x190 [dell_smbios]
[] dell_smbios_wmi_filter+0x71/0xd0 [dell_smbios]
[] wmi_ioctl+0x100/0x232 [wmi]
[] do_vfs_ioctl+0xa8/0x620
[<35f23e13>] ksys_ioctl+0x67/0x90
[] __x64_sys_ioctl+0x1a/0x20
[<477604b1>] do_syscall_64+0x5a/0x110
[] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[] 0x


[PATCH v2 3/3] ARM: OMAP1: ams-delta: register MODEM device earlier

2018-09-09 Thread Janusz Krzysztofik
Amstrad Delta MODEM device used to be initialized at arch_initcall
before it was once moved to late_initcall by commit f7519d8c8290 ("ARM:
OMAP1: ams-delta: register latch dependent devices later"). The purpose
of that change was to postpone initialization of devices which depended
on latch2 pins until latch2 converted to GPIO device was ready.

After recent fixes to GPIO handling, it was possible to moove
registration of most of those device back to where they were before.
The same can be safely done with the MODEM device as initialization
of GPIO pins it depends on was moved to machine_init by preceding
patch.

Move registration of the MODEM device to arch_initcall_sync, not to
arch_initcall, so it is never exposed to potential conflict in
registration order hazard against OMAP serial ports.

Signed-off-by: Janusz Krzysztofik 
Reviewed-by: Linus Walleij 
---
 arch/arm/mach-omap1/board-ams-delta.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 1d451142248c..667c3c1f05f5 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -896,11 +896,28 @@ static int __init modem_nreset_init(void)
 /*
  * This function expects MODEM IRQ number already assigned to the port
  * and fails if it's not.
+ * The MODEM device requires its RESET# pin kept high during probe.
+ * That requirement can be fulfilled in several ways:
+ * - with a descriptor of already functional modem_nreset regulator
+ *   assigned to the MODEM private data,
+ * - with the regulator not yet controlled by modem_pm function but
+ *   already enabled by default on probe,
+ * - before the modem_nreset regulator is probed, with the pin already
+ *   set high explicitly.
+ * The last one is already guaranteed by ams_delta_latch2_init() called
+ * from machine_init.
+ * In order to avoid taking over ttyS0 device slot, the MODEM device
+ * should be registered after OMAP serial ports.  Since those ports
+ * are registered at arch_initcall, this function can be called safely
+ * at arch_initcall_sync earliest.
  */
 static int __init ams_delta_modem_init(void)
 {
int err;
 
+   if (!machine_is_ams_delta())
+   return -ENODEV;
+
if (ams_delta_modem_ports[0].irq < 0)
return ams_delta_modem_ports[0].irq;
 
@@ -913,6 +930,7 @@ static int __init ams_delta_modem_init(void)
 
return err;
 }
+arch_initcall_sync(ams_delta_modem_init);
 
 static int __init late_init(void)
 {
@@ -922,10 +940,6 @@ static int __init late_init(void)
if (err)
return err;
 
-   err = ams_delta_modem_init();
-   if (err)
-   return err;
-
/*
 * Once the modem device is registered, the modem_nreset
 * regulator can be requested on behalf of that device.
-- 
2.16.4



[PATCH v2 3/3] ARM: OMAP1: ams-delta: register MODEM device earlier

2018-09-09 Thread Janusz Krzysztofik
Amstrad Delta MODEM device used to be initialized at arch_initcall
before it was once moved to late_initcall by commit f7519d8c8290 ("ARM:
OMAP1: ams-delta: register latch dependent devices later"). The purpose
of that change was to postpone initialization of devices which depended
on latch2 pins until latch2 converted to GPIO device was ready.

After recent fixes to GPIO handling, it was possible to moove
registration of most of those device back to where they were before.
The same can be safely done with the MODEM device as initialization
of GPIO pins it depends on was moved to machine_init by preceding
patch.

Move registration of the MODEM device to arch_initcall_sync, not to
arch_initcall, so it is never exposed to potential conflict in
registration order hazard against OMAP serial ports.

Signed-off-by: Janusz Krzysztofik 
Reviewed-by: Linus Walleij 
---
 arch/arm/mach-omap1/board-ams-delta.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 1d451142248c..667c3c1f05f5 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -896,11 +896,28 @@ static int __init modem_nreset_init(void)
 /*
  * This function expects MODEM IRQ number already assigned to the port
  * and fails if it's not.
+ * The MODEM device requires its RESET# pin kept high during probe.
+ * That requirement can be fulfilled in several ways:
+ * - with a descriptor of already functional modem_nreset regulator
+ *   assigned to the MODEM private data,
+ * - with the regulator not yet controlled by modem_pm function but
+ *   already enabled by default on probe,
+ * - before the modem_nreset regulator is probed, with the pin already
+ *   set high explicitly.
+ * The last one is already guaranteed by ams_delta_latch2_init() called
+ * from machine_init.
+ * In order to avoid taking over ttyS0 device slot, the MODEM device
+ * should be registered after OMAP serial ports.  Since those ports
+ * are registered at arch_initcall, this function can be called safely
+ * at arch_initcall_sync earliest.
  */
 static int __init ams_delta_modem_init(void)
 {
int err;
 
+   if (!machine_is_ams_delta())
+   return -ENODEV;
+
if (ams_delta_modem_ports[0].irq < 0)
return ams_delta_modem_ports[0].irq;
 
@@ -913,6 +930,7 @@ static int __init ams_delta_modem_init(void)
 
return err;
 }
+arch_initcall_sync(ams_delta_modem_init);
 
 static int __init late_init(void)
 {
@@ -922,10 +940,6 @@ static int __init late_init(void)
if (err)
return err;
 
-   err = ams_delta_modem_init();
-   if (err)
-   return err;
-
/*
 * Once the modem device is registered, the modem_nreset
 * regulator can be requested on behalf of that device.
-- 
2.16.4



[PATCH v2 1/3] ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor

2018-09-09 Thread Janusz Krzysztofik
Don't request MODEM IRQ GPIO by its global number in
ams_delta_modem_init().  Instead, obtain its GPIO descriptor
and assign related IRQ to the MODEM.  Do that from
omap_gpio_deps_init(), where the chip is already looked up.  Then, in
ams_delta_modem_init(), just check for the IRQ number having been
already assigned.

Signed-off-by: Janusz Krzysztofik 
Reviewed-by: Linus Walleij 
---
 arch/arm/mach-omap1/board-ams-delta.c | 47 ++-
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 34cb63ff45b3..2b90b543c030 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -630,6 +630,28 @@ static struct gpiod_hog ams_delta_gpio_hogs[] = {
{},
 };
 
+static struct plat_serial8250_port ams_delta_modem_ports[];
+
+/*
+ * Obtain MODEM IRQ GPIO descriptor using its hardware pin
+ * number and assign related IRQ number to the MODEM port.
+ * Keep the GPIO descriptor open so nobody steps in.
+ */
+static void __init modem_assign_irq(struct gpio_chip *chip)
+{
+   struct gpio_desc *gpiod;
+
+   gpiod = gpiochip_request_own_desc(chip, AMS_DELTA_GPIO_PIN_MODEM_IRQ,
+ "modem_irq");
+   if (IS_ERR(gpiod)) {
+   pr_err("%s: modem IRQ GPIO request failed (%ld)\n", __func__,
+  PTR_ERR(gpiod));
+   } else {
+   gpiod_direction_input(gpiod);
+   ams_delta_modem_ports[0].irq = gpiod_to_irq(gpiod);
+   }
+}
+
 /*
  * The purpose of this function is to take care of proper initialization of
  * devices and data structures which depend on GPIO lines provided by OMAP GPIO
@@ -649,7 +671,13 @@ static void __init omap_gpio_deps_init(void)
return;
}
 
+   /*
+* Start with FIQ initialization as it may have to request
+* and release successfully each OMAP GPIO pin in turn.
+*/
ams_delta_init_fiq(chip, _delta_serio_device);
+
+   modem_assign_irq(chip);
 }
 
 static void __init ams_delta_init(void)
@@ -844,20 +872,18 @@ static int __init modem_nreset_init(void)
 }
 
 
+/*
+ * This function expects MODEM IRQ number already assigned to the port
+ * and fails if it's not.
+ */
 static int __init ams_delta_modem_init(void)
 {
int err;
 
-   omap_cfg_reg(M14_1510_GPIO2);
-   ams_delta_modem_ports[0].irq =
-   gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+   if (ams_delta_modem_ports[0].irq < 0)
+   return ams_delta_modem_ports[0].irq;
 
-   err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem");
-   if (err) {
-   pr_err("Couldn't request gpio pin for modem\n");
-   return err;
-   }
-   gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+   omap_cfg_reg(M14_1510_GPIO2);
 
/* Initialize the modem_nreset regulator consumer before use */
modem_priv.regulator = ERR_PTR(-ENODEV);
@@ -866,8 +892,6 @@ static int __init ams_delta_modem_init(void)
AMS_DELTA_LATCH2_MODEM_CODEC);
 
err = platform_device_register(_delta_modem_device);
-   if (err)
-   gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
return err;
 }
@@ -898,7 +922,6 @@ static int __init late_init(void)
 
 unregister:
platform_device_unregister(_delta_modem_device);
-   gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
return err;
 }
 
-- 
2.16.4



[PATCH v2 1/3] ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor

2018-09-09 Thread Janusz Krzysztofik
Don't request MODEM IRQ GPIO by its global number in
ams_delta_modem_init().  Instead, obtain its GPIO descriptor
and assign related IRQ to the MODEM.  Do that from
omap_gpio_deps_init(), where the chip is already looked up.  Then, in
ams_delta_modem_init(), just check for the IRQ number having been
already assigned.

Signed-off-by: Janusz Krzysztofik 
Reviewed-by: Linus Walleij 
---
 arch/arm/mach-omap1/board-ams-delta.c | 47 ++-
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 34cb63ff45b3..2b90b543c030 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -630,6 +630,28 @@ static struct gpiod_hog ams_delta_gpio_hogs[] = {
{},
 };
 
+static struct plat_serial8250_port ams_delta_modem_ports[];
+
+/*
+ * Obtain MODEM IRQ GPIO descriptor using its hardware pin
+ * number and assign related IRQ number to the MODEM port.
+ * Keep the GPIO descriptor open so nobody steps in.
+ */
+static void __init modem_assign_irq(struct gpio_chip *chip)
+{
+   struct gpio_desc *gpiod;
+
+   gpiod = gpiochip_request_own_desc(chip, AMS_DELTA_GPIO_PIN_MODEM_IRQ,
+ "modem_irq");
+   if (IS_ERR(gpiod)) {
+   pr_err("%s: modem IRQ GPIO request failed (%ld)\n", __func__,
+  PTR_ERR(gpiod));
+   } else {
+   gpiod_direction_input(gpiod);
+   ams_delta_modem_ports[0].irq = gpiod_to_irq(gpiod);
+   }
+}
+
 /*
  * The purpose of this function is to take care of proper initialization of
  * devices and data structures which depend on GPIO lines provided by OMAP GPIO
@@ -649,7 +671,13 @@ static void __init omap_gpio_deps_init(void)
return;
}
 
+   /*
+* Start with FIQ initialization as it may have to request
+* and release successfully each OMAP GPIO pin in turn.
+*/
ams_delta_init_fiq(chip, _delta_serio_device);
+
+   modem_assign_irq(chip);
 }
 
 static void __init ams_delta_init(void)
@@ -844,20 +872,18 @@ static int __init modem_nreset_init(void)
 }
 
 
+/*
+ * This function expects MODEM IRQ number already assigned to the port
+ * and fails if it's not.
+ */
 static int __init ams_delta_modem_init(void)
 {
int err;
 
-   omap_cfg_reg(M14_1510_GPIO2);
-   ams_delta_modem_ports[0].irq =
-   gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+   if (ams_delta_modem_ports[0].irq < 0)
+   return ams_delta_modem_ports[0].irq;
 
-   err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem");
-   if (err) {
-   pr_err("Couldn't request gpio pin for modem\n");
-   return err;
-   }
-   gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+   omap_cfg_reg(M14_1510_GPIO2);
 
/* Initialize the modem_nreset regulator consumer before use */
modem_priv.regulator = ERR_PTR(-ENODEV);
@@ -866,8 +892,6 @@ static int __init ams_delta_modem_init(void)
AMS_DELTA_LATCH2_MODEM_CODEC);
 
err = platform_device_register(_delta_modem_device);
-   if (err)
-   gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
return err;
 }
@@ -898,7 +922,6 @@ static int __init late_init(void)
 
 unregister:
platform_device_unregister(_delta_modem_device);
-   gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
return err;
 }
 
-- 
2.16.4



Re: [PATCH 1/7] ARM: imx: add mmdc ipg clock operation for mmdc

2018-09-09 Thread Shawn Guo
On Fri, Aug 31, 2018 at 03:53:12PM +0800, Anson Huang wrote:
> i.MX6 SoCs have MMDC ipg clock for registers access, to make
> sure MMDC registers access successfully, add optional clock
> enable for MMDC driver.
> 
> Signed-off-by: Anson Huang 

Applied this one, thanks.


Re: [PATCH 1/7] ARM: imx: add mmdc ipg clock operation for mmdc

2018-09-09 Thread Shawn Guo
On Fri, Aug 31, 2018 at 03:53:12PM +0800, Anson Huang wrote:
> i.MX6 SoCs have MMDC ipg clock for registers access, to make
> sure MMDC registers access successfully, add optional clock
> enable for MMDC driver.
> 
> Signed-off-by: Anson Huang 

Applied this one, thanks.


[PATCH v2 0/3] ARM: OMAP1: ams-delta: Clean up GPIO setup for MODEM

2018-09-09 Thread Janusz Krzysztofik


Convert modem related GPIO setup from integer space to GPIO descriptors.
Also, restore original initialization order of the MODEM device and its
related GPIO pins.

Cleanup of MODEM relaated regulator setup is postponed while waiting for
upcoming conversion of fixed regulator API to GPIO descriptors.


Janusz Krzysztofik (3):
  ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor
  ARM: OMAP1: ams-delta: initialize latch2 pins to safe values
  ARM: OMAP1: ams-delta: register MODEM device earlier


Changelog:
v2:
- rebased on v4.19-rc1
- added Reviewed-by: obtained from Linus Walleij

Please ignore the patch "ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO"
sent alone on 2018-07-17.

Thanks,
Janusz


diffstat:
 board-ams-delta.c |  121 +++---
 board-ams-delta.h |7 ---
 2 files changed, 88 insertions(+), 40 deletions(-)



[PATCH v2 0/3] ARM: OMAP1: ams-delta: Clean up GPIO setup for MODEM

2018-09-09 Thread Janusz Krzysztofik


Convert modem related GPIO setup from integer space to GPIO descriptors.
Also, restore original initialization order of the MODEM device and its
related GPIO pins.

Cleanup of MODEM relaated regulator setup is postponed while waiting for
upcoming conversion of fixed regulator API to GPIO descriptors.


Janusz Krzysztofik (3):
  ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor
  ARM: OMAP1: ams-delta: initialize latch2 pins to safe values
  ARM: OMAP1: ams-delta: register MODEM device earlier


Changelog:
v2:
- rebased on v4.19-rc1
- added Reviewed-by: obtained from Linus Walleij

Please ignore the patch "ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO"
sent alone on 2018-07-17.

Thanks,
Janusz


diffstat:
 board-ams-delta.c |  121 +++---
 board-ams-delta.h |7 ---
 2 files changed, 88 insertions(+), 40 deletions(-)



Re: [patch 01/10] x86/mm/cpa: Split, rename and clean up try_preserve_large_page()

2018-09-09 Thread Yang, Bin
On Fri, 2018-09-07 at 17:01 +0200, Thomas Gleixner wrote:
> Avoid the extra variable and gotos by splitting the function into the
> actual algorithm and a callable function which contains the lock
> protection.
> 
> Rename it to should_split_large_page() while at it so the return values make
> actually sense.
> 
> Clean up the code flow, comments and general whitespace damage while at it. No
> functional change.
> 
> Signed-off-by: Thomas Gleixner 
> ---
>  arch/x86/mm/pageattr.c |  121 
> -
>  1 file changed, 60 insertions(+), 61 deletions(-)
> 
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -421,18 +421,18 @@ pte_t *lookup_address_in_pgd(pgd_t *pgd,
>   */
>  pte_t *lookup_address(unsigned long address, unsigned int *level)
>  {
> -return lookup_address_in_pgd(pgd_offset_k(address), address, level);
> + return lookup_address_in_pgd(pgd_offset_k(address), address, level);
>  }
>  EXPORT_SYMBOL_GPL(lookup_address);
>  
>  static pte_t *_lookup_address_cpa(struct cpa_data *cpa, unsigned long 
> address,
> unsigned int *level)
>  {
> -if (cpa->pgd)
> + if (cpa->pgd)
>   return lookup_address_in_pgd(cpa->pgd + pgd_index(address),
>  address, level);
>  
> -return lookup_address(address, level);
> + return lookup_address(address, level);
>  }
>  
>  /*
> @@ -549,27 +549,22 @@ static pgprot_t pgprot_clear_protnone_bi
>   return prot;
>  }
>  
> -static int
> -try_preserve_large_page(pte_t *kpte, unsigned long address,
> - struct cpa_data *cpa)
> +static int __should_split_large_page(pte_t *kpte, unsigned long address,
> +  struct cpa_data *cpa)
>  {
> - unsigned long nextpage_addr, numpages, pmask, psize, addr, pfn, old_pfn;
> - pte_t new_pte, old_pte, *tmp;
> + unsigned long numpages, pmask, psize, lpaddr, addr, pfn, old_pfn;
>   pgprot_t old_prot, new_prot, req_prot;
> - int i, do_split = 1;
> + pte_t new_pte, old_pte, *tmp;
>   enum pg_level level;
> + int i;
>  
> - if (cpa->force_split)
> - return 1;
> -
> - spin_lock(_lock);
>   /*
>* Check for races, another CPU might have split this page
>* up already:
>*/
>   tmp = _lookup_address_cpa(cpa, address, );
>   if (tmp != kpte)
> - goto out_unlock;
> + return 1;
>  
>   switch (level) {
>   case PG_LEVEL_2M:
> @@ -581,8 +576,7 @@ try_preserve_large_page(pte_t *kpte, uns
>   old_pfn = pud_pfn(*(pud_t *)kpte);
>   break;
>   default:
> - do_split = -EINVAL;
> - goto out_unlock;
> + return -EINVAL;
>   }
>  
>   psize = page_level_size(level);
> @@ -592,8 +586,8 @@ try_preserve_large_page(pte_t *kpte, uns
>* Calculate the number of pages, which fit into this large
>* page starting at address:
>*/
> - nextpage_addr = (address + psize) & pmask;
> - numpages = (nextpage_addr - address) >> PAGE_SHIFT;
> + lpaddr = (address + psize) & pmask;
> + numpages = (lpaddr - address) >> PAGE_SHIFT;
>   if (numpages < cpa->numpages)
>   cpa->numpages = numpages;
>  
> @@ -620,57 +614,62 @@ try_preserve_large_page(pte_t *kpte, uns
>   pgprot_val(req_prot) |= _PAGE_PSE;
>  
>   /*
> -  * old_pfn points to the large page base pfn. So we need
> -  * to add the offset of the virtual address:
> +  * old_pfn points to the large page base pfn. So we need to add the
> +  * offset of the virtual address:
>*/
>   pfn = old_pfn + ((address & (psize - 1)) >> PAGE_SHIFT);
>   cpa->pfn = pfn;
>  
> - new_prot = static_protections(req_prot, address, pfn);
> + /*
> +  * Calculate the large page base address and the number of 4K pages
> +  * in the large page
> +  */
> + lpaddr = address & pmask;
> + numpages = psize >> PAGE_SHIFT;
>  
>   /*
> -  * We need to check the full range, whether
> -  * static_protection() requires a different pgprot for one of
> -  * the pages in the range we try to preserve:
> +  * Make sure that the requested pgprot does not violate the static
> +  * protections. Check the full large page whether one of the pages
> +  * in it results in a different pgprot than the first one of the
> +  * requested range. If yes, then the page needs to be split.
>*/
> - addr = address & pmask;
> + new_prot = static_protections(req_prot, address, pfn, 1);

"npg" is introduced by patch #3. It might be better to keep old API in
this patch.

>   pfn = old_pfn;
> - for (i = 0; i < (psize >> PAGE_SHIFT); i++, addr += PAGE_SIZE, pfn++) {
> + for (i = 0, addr = lpaddr; i < numpages; i++, addr += PAGE_SIZE, pfn++) 
> {
>   pgprot_t chk_prot = 

Re: [patch 01/10] x86/mm/cpa: Split, rename and clean up try_preserve_large_page()

2018-09-09 Thread Yang, Bin
On Fri, 2018-09-07 at 17:01 +0200, Thomas Gleixner wrote:
> Avoid the extra variable and gotos by splitting the function into the
> actual algorithm and a callable function which contains the lock
> protection.
> 
> Rename it to should_split_large_page() while at it so the return values make
> actually sense.
> 
> Clean up the code flow, comments and general whitespace damage while at it. No
> functional change.
> 
> Signed-off-by: Thomas Gleixner 
> ---
>  arch/x86/mm/pageattr.c |  121 
> -
>  1 file changed, 60 insertions(+), 61 deletions(-)
> 
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -421,18 +421,18 @@ pte_t *lookup_address_in_pgd(pgd_t *pgd,
>   */
>  pte_t *lookup_address(unsigned long address, unsigned int *level)
>  {
> -return lookup_address_in_pgd(pgd_offset_k(address), address, level);
> + return lookup_address_in_pgd(pgd_offset_k(address), address, level);
>  }
>  EXPORT_SYMBOL_GPL(lookup_address);
>  
>  static pte_t *_lookup_address_cpa(struct cpa_data *cpa, unsigned long 
> address,
> unsigned int *level)
>  {
> -if (cpa->pgd)
> + if (cpa->pgd)
>   return lookup_address_in_pgd(cpa->pgd + pgd_index(address),
>  address, level);
>  
> -return lookup_address(address, level);
> + return lookup_address(address, level);
>  }
>  
>  /*
> @@ -549,27 +549,22 @@ static pgprot_t pgprot_clear_protnone_bi
>   return prot;
>  }
>  
> -static int
> -try_preserve_large_page(pte_t *kpte, unsigned long address,
> - struct cpa_data *cpa)
> +static int __should_split_large_page(pte_t *kpte, unsigned long address,
> +  struct cpa_data *cpa)
>  {
> - unsigned long nextpage_addr, numpages, pmask, psize, addr, pfn, old_pfn;
> - pte_t new_pte, old_pte, *tmp;
> + unsigned long numpages, pmask, psize, lpaddr, addr, pfn, old_pfn;
>   pgprot_t old_prot, new_prot, req_prot;
> - int i, do_split = 1;
> + pte_t new_pte, old_pte, *tmp;
>   enum pg_level level;
> + int i;
>  
> - if (cpa->force_split)
> - return 1;
> -
> - spin_lock(_lock);
>   /*
>* Check for races, another CPU might have split this page
>* up already:
>*/
>   tmp = _lookup_address_cpa(cpa, address, );
>   if (tmp != kpte)
> - goto out_unlock;
> + return 1;
>  
>   switch (level) {
>   case PG_LEVEL_2M:
> @@ -581,8 +576,7 @@ try_preserve_large_page(pte_t *kpte, uns
>   old_pfn = pud_pfn(*(pud_t *)kpte);
>   break;
>   default:
> - do_split = -EINVAL;
> - goto out_unlock;
> + return -EINVAL;
>   }
>  
>   psize = page_level_size(level);
> @@ -592,8 +586,8 @@ try_preserve_large_page(pte_t *kpte, uns
>* Calculate the number of pages, which fit into this large
>* page starting at address:
>*/
> - nextpage_addr = (address + psize) & pmask;
> - numpages = (nextpage_addr - address) >> PAGE_SHIFT;
> + lpaddr = (address + psize) & pmask;
> + numpages = (lpaddr - address) >> PAGE_SHIFT;
>   if (numpages < cpa->numpages)
>   cpa->numpages = numpages;
>  
> @@ -620,57 +614,62 @@ try_preserve_large_page(pte_t *kpte, uns
>   pgprot_val(req_prot) |= _PAGE_PSE;
>  
>   /*
> -  * old_pfn points to the large page base pfn. So we need
> -  * to add the offset of the virtual address:
> +  * old_pfn points to the large page base pfn. So we need to add the
> +  * offset of the virtual address:
>*/
>   pfn = old_pfn + ((address & (psize - 1)) >> PAGE_SHIFT);
>   cpa->pfn = pfn;
>  
> - new_prot = static_protections(req_prot, address, pfn);
> + /*
> +  * Calculate the large page base address and the number of 4K pages
> +  * in the large page
> +  */
> + lpaddr = address & pmask;
> + numpages = psize >> PAGE_SHIFT;
>  
>   /*
> -  * We need to check the full range, whether
> -  * static_protection() requires a different pgprot for one of
> -  * the pages in the range we try to preserve:
> +  * Make sure that the requested pgprot does not violate the static
> +  * protections. Check the full large page whether one of the pages
> +  * in it results in a different pgprot than the first one of the
> +  * requested range. If yes, then the page needs to be split.
>*/
> - addr = address & pmask;
> + new_prot = static_protections(req_prot, address, pfn, 1);

"npg" is introduced by patch #3. It might be better to keep old API in
this patch.

>   pfn = old_pfn;
> - for (i = 0; i < (psize >> PAGE_SHIFT); i++, addr += PAGE_SIZE, pfn++) {
> + for (i = 0, addr = lpaddr; i < numpages; i++, addr += PAGE_SIZE, pfn++) 
> {
>   pgprot_t chk_prot = 

Re: [PATCH] ARM: dts: imx6q-apalis: mux RESET_MOCI# signal

2018-09-09 Thread Shawn Guo
On Thu, Sep 06, 2018 at 04:46:58PM -0700, Stefan Agner wrote:
> The pinctrl properties on the IOMUXC node get overwritten by the
> carrier board level device tree, hence the pinctrl_reset_moci
> pinctrl does not get applied.
> 
> Associate the pinctrl_reset_moci pinctrl with the PCIe node where
> we also make use of the pin as a reset GPIO.
> 
> Since the pin is muxed as a GPIO by default not muxing it explicitly
> worked fine in practise.
> 
> Signed-off-by: Stefan Agner 

Applied, thanks.


Re: [PATCH] ARM: dts: imx6q-apalis: mux RESET_MOCI# signal

2018-09-09 Thread Shawn Guo
On Thu, Sep 06, 2018 at 04:46:58PM -0700, Stefan Agner wrote:
> The pinctrl properties on the IOMUXC node get overwritten by the
> carrier board level device tree, hence the pinctrl_reset_moci
> pinctrl does not get applied.
> 
> Associate the pinctrl_reset_moci pinctrl with the PCIe node where
> we also make use of the pin as a reset GPIO.
> 
> Since the pin is muxed as a GPIO by default not muxing it explicitly
> worked fine in practise.
> 
> Signed-off-by: Stefan Agner 

Applied, thanks.


Re: [PATCH] bcache: remove unecessary condition check before debugfs_remove_recursive

2018-09-09 Thread Junhui Tang
LGTM

Reviewed-by: tang.junhui.li...@gmail.com
zhong jiang  于2018年9月8日周六 下午9:41写道:
>
> debugfs_remove_recursive has taken IS_ERR_OR_NULL into account. So just
> remove the condition check before debugfs_remove_recursive.
>
> Signed-off-by: zhong jiang 
> ---
>  drivers/md/bcache/debug.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
> index 06da66b..8c53d87 100644
> --- a/drivers/md/bcache/debug.c
> +++ b/drivers/md/bcache/debug.c
> @@ -249,8 +249,7 @@ void bch_debug_init_cache_set(struct cache_set *c)
>
>  void bch_debug_exit(void)
>  {
> -   if (!IS_ERR_OR_NULL(bcache_debug))
> -   debugfs_remove_recursive(bcache_debug);
> +   debugfs_remove_recursive(bcache_debug);
>  }
>
>  void __init bch_debug_init(struct kobject *kobj)
> --
> 1.7.12.4
>


Re: [PATCH] bcache: remove unecessary condition check before debugfs_remove_recursive

2018-09-09 Thread Junhui Tang
LGTM

Reviewed-by: tang.junhui.li...@gmail.com
zhong jiang  于2018年9月8日周六 下午9:41写道:
>
> debugfs_remove_recursive has taken IS_ERR_OR_NULL into account. So just
> remove the condition check before debugfs_remove_recursive.
>
> Signed-off-by: zhong jiang 
> ---
>  drivers/md/bcache/debug.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
> index 06da66b..8c53d87 100644
> --- a/drivers/md/bcache/debug.c
> +++ b/drivers/md/bcache/debug.c
> @@ -249,8 +249,7 @@ void bch_debug_init_cache_set(struct cache_set *c)
>
>  void bch_debug_exit(void)
>  {
> -   if (!IS_ERR_OR_NULL(bcache_debug))
> -   debugfs_remove_recursive(bcache_debug);
> +   debugfs_remove_recursive(bcache_debug);
>  }
>
>  void __init bch_debug_init(struct kobject *kobj)
> --
> 1.7.12.4
>


Re: [PATCH] percpu-refcount: relax limit on percpu_ref_reinit()

2018-09-09 Thread Ming Lei
On Sun, Sep 09, 2018 at 11:46:20AM -0700, Bart Van Assche wrote:
> On Sun, 2018-09-09 at 20:58 +0800, Ming Lei wrote:
> > Now percpu_ref_reinit() can only be done on one percpu refcounter
> > when it drops zero. And the limit shouldn't be so strict, and it
> > is quite straightforward that percpu_ref_reinit() can be done when
> > this counter is at atomic mode.
> > 
> > This patch relaxes the limit, so we may avoid extra change[1] for NVMe
> > timeout's requirement.
> > 
> > [1] https://marc.info/?l=linux-kernel=153612052611020=2
> 
> Is the NVMe driver the only block driver that hangs if it is attempted to
> freeze its request queue when a request times out? If so, can this hang be
> fixed by modifying the NVMe driver instead of by modifying the percpu
> refcount implementation?

IMO, this patch is quite simple and it should be much simpler than
solving this issue in block layer or NVMe, could we focus on the
technical correctness of this patch first?

However if anyone has better/simpler solution for this issue on any
change, I am open to them too.

Thanks,
Ming


Re: [PATCH] percpu-refcount: relax limit on percpu_ref_reinit()

2018-09-09 Thread Ming Lei
On Sun, Sep 09, 2018 at 11:46:20AM -0700, Bart Van Assche wrote:
> On Sun, 2018-09-09 at 20:58 +0800, Ming Lei wrote:
> > Now percpu_ref_reinit() can only be done on one percpu refcounter
> > when it drops zero. And the limit shouldn't be so strict, and it
> > is quite straightforward that percpu_ref_reinit() can be done when
> > this counter is at atomic mode.
> > 
> > This patch relaxes the limit, so we may avoid extra change[1] for NVMe
> > timeout's requirement.
> > 
> > [1] https://marc.info/?l=linux-kernel=153612052611020=2
> 
> Is the NVMe driver the only block driver that hangs if it is attempted to
> freeze its request queue when a request times out? If so, can this hang be
> fixed by modifying the NVMe driver instead of by modifying the percpu
> refcount implementation?

IMO, this patch is quite simple and it should be much simpler than
solving this issue in block layer or NVMe, could we focus on the
technical correctness of this patch first?

However if anyone has better/simpler solution for this issue on any
change, I am open to them too.

Thanks,
Ming


Linux 4.19-rc3

2018-09-09 Thread Linus Torvalds
Another week, another rc.

Things look fairly normal.  The diffstat shows some unusual patterns,
but that's partly due to some late nds32 updates and nilfs2 got the
copyright messages converted to SPDX, and that just shows up like a
sore thumb in the diffstat.

But other than odd details like that, nothing really stands out.
Drivers, networking and arch fixes, with misc random small changes all
over (eg btrfs fixes).

Shortlog appended, in case people want to look at the details.

Linus

---

Alexey Brodkin (3):
  ARC: configs: cleanup
  ARC: [plat-axs*/plat-hsdk]: Allow U-Boot to pass MAC-address to the kernel
  ARC: [plat-axs*]: Enable SWAP

Alexey Khoroshilov (1):
  gpio: dwapb: Fix error handling in dwapb_gpio_probe()

Alexey Kodanev (2):
  vti6: remove !skb->ignore_df check from vti6_xmit()
  ipv6: don't get lwtstate twice in ip6_rt_copy_init()

Amir Goldstein (1):
  fsnotify: fix ignore mask logic in fsnotify()

Anand Jain (1):
  btrfs: btrfs_shrink_device should call commit transaction at the end

Andrew Lunn (1):
  net: phy: sfp: Handle unimplemented hwmon limits and alarms

Andrew Morton (1):
  mm/util.c: improve kvfree() kerneldoc

Andy Shevchenko (1):
  gpiolib: acpi: Switch to cansleep version of GPIO library call

Aneesh Kumar K.V (1):
  mm/hugetlb: filter out hugetlb pages if HUGEPAGE migration is
not supported.

Anthony Wong (1):
  r8169: add support for NCube 8168 network card

Arnd Bergmann (1):
  rfkill-gpio: include linux/mod_devicetable.h

Arunk Khandavalli (1):
  cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE

Azat Khuzhin (1):
  r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices

Bartosz Golaszewski (1):
  memory: ti-aemif: fix a potential NULL-pointer dereference

Baruch Siach (1):
  net: mvpp2: initialize port of_node pointer

Chris Brandt (1):
  sh_eth: Add R7S9210 support

Christian Borntraeger (1):
  timekeeping: Fix declaration of read_persistent_wall_and_boot_offset()

Christoph Hellwig (2):
  kernel/dma/direct: take DMA offset into account in dma_direct_supported
  sparc: set a default 32-bit dma mask for OF devices

Chuanhua Lei (1):
  x86/tsc: Prevent result truncation on 32bit

Colin Ian King (1):
  KVM: SVM: remove unused variable dst_vaddr_end

Colin Xu (2):
  drm/i915/gvt: Make correct handling to vreg BXT_PHY_CTL_FAMILY
  drm/i915/gvt: Handle GEN9_WM_CHICKEN3 with F_CMD_ACCESS.

Cong Wang (3):
  tipc: fix a missing rhashtable_walk_exit()
  tipc: switch to rhashtable iterator
  act_ife: fix a potential use-after-free

Dan Carpenter (3):
  btrfs: use after free in btrfs_quota_enable
  scsi: aacraid: fix a signedness bug
  cfg80211: fix a type issue in ieee80211_chandef_to_operating_class()

Danek Duvall (2):
  mac80211: correct use of IEEE80211_VHT_CAP_RXSTBC_X
  mac80211_hwsim: correct use of IEEE80211_VHT_CAP_RXSTBC_X

Daniel Borkmann (6):
  bpf, sockmap: fix potential use after free in bpf_tcp_close
  bpf, sockmap: fix psock refcount leak in bpf_tcp_recvmsg
  bpf: fix several offset tests in bpf_msg_pull_data
  bpf: fix msg->data/data_end after sg shift repair in bpf_msg_pull_data
  bpf: fix shift upon scatterlist ring wrap-around in bpf_msg_pull_data
  bpf: fix sg shift repair start offset in bpf_msg_pull_data

Dave Jiang (1):
  mm: fix BUG_ON() in vmf_insert_pfn_pud() from VM_MIXEDMAP removal

David Ahern (1):
  net/ipv6: Only update MTU metric if it set

David Howells (1):
  afs: Fix cell specification to permit an empty address list

Davide Caratti (1):
  net/sched: act_pedit: fix dump of extended layered op

Davidlohr Bueso (1):
  ipc/shm: properly return EIDRM in shm_lock()

Dennis Zhou (Facebook) (3):
  Revert "blk-throttle: fix race between blkcg_bio_issue_check()
and cgroup_rmdir()"
  blkcg: delay blkg destruction until after writeback has finished
  blkcg: use tryget logic when associating a blkg with a bio

Dexuan Cui (1):
  hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe()

Dinh Nguyen (1):
  net: stmmac: build the dwmac-socfpga platform driver for Stratix10

Doug Berger (1):
  net: bcmgenet: use MAC link status for fixed phy

Dreyfuss, Haim (1):
  mac80211: fix WMM TXOP calculation

Emmanuel Grumbach (4):
  mac80211: don't update the PM state of a peer upon a multicast frame
  mac80211: fix a race between restart and CSA flows
  mac80211: don't Tx a deauth frame if the AP forbade Tx
  mac80211: shorten the IBSS debug messages

Eric Dumazet (1):
  Revert "packet: switch kvzalloc to allocate memory"

Eugeniy Paltsev (5):
  ARC: cleanup show_faulting_vma()
  ARC: dma [IOC]: mark DMA devices connected as dma-coherent
  ARC: dma [IOC] Enable per device io coherency
  ARC: IOC: panic if both IOC and ZONE_HIGHMEM enabled
  ARC: don't check for 

Linux 4.19-rc3

2018-09-09 Thread Linus Torvalds
Another week, another rc.

Things look fairly normal.  The diffstat shows some unusual patterns,
but that's partly due to some late nds32 updates and nilfs2 got the
copyright messages converted to SPDX, and that just shows up like a
sore thumb in the diffstat.

But other than odd details like that, nothing really stands out.
Drivers, networking and arch fixes, with misc random small changes all
over (eg btrfs fixes).

Shortlog appended, in case people want to look at the details.

Linus

---

Alexey Brodkin (3):
  ARC: configs: cleanup
  ARC: [plat-axs*/plat-hsdk]: Allow U-Boot to pass MAC-address to the kernel
  ARC: [plat-axs*]: Enable SWAP

Alexey Khoroshilov (1):
  gpio: dwapb: Fix error handling in dwapb_gpio_probe()

Alexey Kodanev (2):
  vti6: remove !skb->ignore_df check from vti6_xmit()
  ipv6: don't get lwtstate twice in ip6_rt_copy_init()

Amir Goldstein (1):
  fsnotify: fix ignore mask logic in fsnotify()

Anand Jain (1):
  btrfs: btrfs_shrink_device should call commit transaction at the end

Andrew Lunn (1):
  net: phy: sfp: Handle unimplemented hwmon limits and alarms

Andrew Morton (1):
  mm/util.c: improve kvfree() kerneldoc

Andy Shevchenko (1):
  gpiolib: acpi: Switch to cansleep version of GPIO library call

Aneesh Kumar K.V (1):
  mm/hugetlb: filter out hugetlb pages if HUGEPAGE migration is
not supported.

Anthony Wong (1):
  r8169: add support for NCube 8168 network card

Arnd Bergmann (1):
  rfkill-gpio: include linux/mod_devicetable.h

Arunk Khandavalli (1):
  cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE

Azat Khuzhin (1):
  r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices

Bartosz Golaszewski (1):
  memory: ti-aemif: fix a potential NULL-pointer dereference

Baruch Siach (1):
  net: mvpp2: initialize port of_node pointer

Chris Brandt (1):
  sh_eth: Add R7S9210 support

Christian Borntraeger (1):
  timekeeping: Fix declaration of read_persistent_wall_and_boot_offset()

Christoph Hellwig (2):
  kernel/dma/direct: take DMA offset into account in dma_direct_supported
  sparc: set a default 32-bit dma mask for OF devices

Chuanhua Lei (1):
  x86/tsc: Prevent result truncation on 32bit

Colin Ian King (1):
  KVM: SVM: remove unused variable dst_vaddr_end

Colin Xu (2):
  drm/i915/gvt: Make correct handling to vreg BXT_PHY_CTL_FAMILY
  drm/i915/gvt: Handle GEN9_WM_CHICKEN3 with F_CMD_ACCESS.

Cong Wang (3):
  tipc: fix a missing rhashtable_walk_exit()
  tipc: switch to rhashtable iterator
  act_ife: fix a potential use-after-free

Dan Carpenter (3):
  btrfs: use after free in btrfs_quota_enable
  scsi: aacraid: fix a signedness bug
  cfg80211: fix a type issue in ieee80211_chandef_to_operating_class()

Danek Duvall (2):
  mac80211: correct use of IEEE80211_VHT_CAP_RXSTBC_X
  mac80211_hwsim: correct use of IEEE80211_VHT_CAP_RXSTBC_X

Daniel Borkmann (6):
  bpf, sockmap: fix potential use after free in bpf_tcp_close
  bpf, sockmap: fix psock refcount leak in bpf_tcp_recvmsg
  bpf: fix several offset tests in bpf_msg_pull_data
  bpf: fix msg->data/data_end after sg shift repair in bpf_msg_pull_data
  bpf: fix shift upon scatterlist ring wrap-around in bpf_msg_pull_data
  bpf: fix sg shift repair start offset in bpf_msg_pull_data

Dave Jiang (1):
  mm: fix BUG_ON() in vmf_insert_pfn_pud() from VM_MIXEDMAP removal

David Ahern (1):
  net/ipv6: Only update MTU metric if it set

David Howells (1):
  afs: Fix cell specification to permit an empty address list

Davide Caratti (1):
  net/sched: act_pedit: fix dump of extended layered op

Davidlohr Bueso (1):
  ipc/shm: properly return EIDRM in shm_lock()

Dennis Zhou (Facebook) (3):
  Revert "blk-throttle: fix race between blkcg_bio_issue_check()
and cgroup_rmdir()"
  blkcg: delay blkg destruction until after writeback has finished
  blkcg: use tryget logic when associating a blkg with a bio

Dexuan Cui (1):
  hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe()

Dinh Nguyen (1):
  net: stmmac: build the dwmac-socfpga platform driver for Stratix10

Doug Berger (1):
  net: bcmgenet: use MAC link status for fixed phy

Dreyfuss, Haim (1):
  mac80211: fix WMM TXOP calculation

Emmanuel Grumbach (4):
  mac80211: don't update the PM state of a peer upon a multicast frame
  mac80211: fix a race between restart and CSA flows
  mac80211: don't Tx a deauth frame if the AP forbade Tx
  mac80211: shorten the IBSS debug messages

Eric Dumazet (1):
  Revert "packet: switch kvzalloc to allocate memory"

Eugeniy Paltsev (5):
  ARC: cleanup show_faulting_vma()
  ARC: dma [IOC]: mark DMA devices connected as dma-coherent
  ARC: dma [IOC] Enable per device io coherency
  ARC: IOC: panic if both IOC and ZONE_HIGHMEM enabled
  ARC: don't check for 

[PATCH v2 2/3] ARM: OMAP1: ams-delta: initialize latch2 pins to safe values

2018-09-09 Thread Janusz Krzysztofik
Latch2 pins control a number of on-board devices, namely LCD, NAND,
MODEM and CODEC.  Those pins used to be initialized with safe values
from init_machine before that operation was:
1) moved to late_initcall in preparation for conversion of latch2 to
GPIO device - see commit f7519d8c8290 ("ARM: OMAP1: ams-delta: register
latch dependent devices later"),
2) replaced with non-atomic initialization performed by means of
gpio_request_array() - see commit 937eb4bb0058 ("ARM: OMAP1: ams-delta:
convert latches to basic_mmio_gpio"),
3) made completely asynchronous by delegation of GPIO request
operations performed on subsets of pins to respective device drivers in
subsequent commits.

One visible negative result of that disintegration was corrupt keyboard
data reported by serio driver, recently fixed by commit 41f8fee385a0
("ARM: OMAP1: ams-delta: Hog "keybrd_dataout" GPIO pin").

Moreover, initialization of LATCH2_PIN_MODEM_CODEC still performed with
ams_delta_latch2_write() wrapper from late_init() is now done on not
requested GPIO pin.

Reintroduce atomic initialization of latch2 pins at machine_init to
prevent from random values potentially corrupting NAND data or maybe
even destroing other hardware.  Also take care of MODEM/CODEC related
pins so MODEM device probe succeeds even if latch2 GPIO device or
dependent regulator is not ready and CODEC can be reached over the
MODEM even if audio driver doesn't take control over
LATCH2_PIN_MODEM_CODEC.

Once done, remove the no longer needed GPIO based implementation of
ams_delta_latch_write() and its frontend macro.

Signed-off-by: Janusz Krzysztofik 
Reviewed-by: Linus Walleij 
---
 arch/arm/mach-omap1/board-ams-delta.c | 52 +++
 arch/arm/mach-omap1/board-ams-delta.h |  7 -
 2 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 2b90b543c030..1d451142248c 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -321,20 +321,6 @@ struct modem_private_data {
 
 static struct modem_private_data modem_priv;
 
-void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
-{
-   int bit = 0;
-   u16 bitpos = 1 << bit;
-
-   for (; bit < ngpio; bit++, bitpos = bitpos << 1) {
-   if (!(mask & bitpos))
-   continue;
-   else
-   gpio_set_value(base + bit, (value & bitpos) != 0);
-   }
-}
-EXPORT_SYMBOL(ams_delta_latch_write);
-
 static struct resource ams_delta_nand_resources[] = {
[0] = {
.start  = OMAP1_MPUIO_BASE,
@@ -680,6 +666,40 @@ static void __init omap_gpio_deps_init(void)
modem_assign_irq(chip);
 }
 
+/*
+ * Initialize latch2 pins with values which are safe for dependent on-board
+ * devices or useful for their successull initialization even before GPIO
+ * driver takes control over the latch pins:
+ * - LATCH2_PIN_LCD_VBLEN  = 0
+ * - LATCH2_PIN_LCD_NDISP  = 0 Keep LCD device powered off before its
+ * driver takes control over it.
+ * - LATCH2_PIN_NAND_NCE   = 0
+ * - LATCH2_PIN_NAND_NWP   = 0 Keep NAND device down and write-
+ * protected before its driver takes
+ * control over it.
+ * - LATCH2_PIN_KEYBRD_PWR = 0 Keep keyboard powered off before serio
+ * driver takes control over it.
+ * - LATCH2_PIN_KEYBRD_DATAOUT = 0 Keep low to avoid corruption of first
+ * byte of data received from attached
+ * keyboard when serio device is probed;
+ * the pin is also hogged low by the latch2
+ * GPIO driver as soon as it is ready.
+ * - LATCH2_PIN_MODEM_NRESET   = 1 Enable voice MODEM device, allowing for
+ * its successful probe even before a
+ * regulator it depends on, which in turn
+ * takes control over the pin, is set up.
+ * - LATCH2_PIN_MODEM_CODEC= 1 Attach voice MODEM CODEC data port
+ * to the MODEM so the CODEC is under
+ * control even if audio driver doesn't
+ * take it over.
+ */
+static void __init ams_delta_latch2_init(void)
+{
+   u16 latch2 = 1 << LATCH2_PIN_MODEM_NRESET | 1 << LATCH2_PIN_MODEM_CODEC;
+
+   __raw_writew(latch2, LATCH2_VIRT);
+}
+
 static void __init ams_delta_init(void)
 {
/* mux pins for uarts */
@@ -701,6 +721,7 @@ static void __init ams_delta_init(void)
omap_cfg_reg(J18_1610_CAM_D7);
 
omap_gpio_deps_init();
+   ams_delta_latch2_init();

[PATCH v2 2/3] ARM: OMAP1: ams-delta: initialize latch2 pins to safe values

2018-09-09 Thread Janusz Krzysztofik
Latch2 pins control a number of on-board devices, namely LCD, NAND,
MODEM and CODEC.  Those pins used to be initialized with safe values
from init_machine before that operation was:
1) moved to late_initcall in preparation for conversion of latch2 to
GPIO device - see commit f7519d8c8290 ("ARM: OMAP1: ams-delta: register
latch dependent devices later"),
2) replaced with non-atomic initialization performed by means of
gpio_request_array() - see commit 937eb4bb0058 ("ARM: OMAP1: ams-delta:
convert latches to basic_mmio_gpio"),
3) made completely asynchronous by delegation of GPIO request
operations performed on subsets of pins to respective device drivers in
subsequent commits.

One visible negative result of that disintegration was corrupt keyboard
data reported by serio driver, recently fixed by commit 41f8fee385a0
("ARM: OMAP1: ams-delta: Hog "keybrd_dataout" GPIO pin").

Moreover, initialization of LATCH2_PIN_MODEM_CODEC still performed with
ams_delta_latch2_write() wrapper from late_init() is now done on not
requested GPIO pin.

Reintroduce atomic initialization of latch2 pins at machine_init to
prevent from random values potentially corrupting NAND data or maybe
even destroing other hardware.  Also take care of MODEM/CODEC related
pins so MODEM device probe succeeds even if latch2 GPIO device or
dependent regulator is not ready and CODEC can be reached over the
MODEM even if audio driver doesn't take control over
LATCH2_PIN_MODEM_CODEC.

Once done, remove the no longer needed GPIO based implementation of
ams_delta_latch_write() and its frontend macro.

Signed-off-by: Janusz Krzysztofik 
Reviewed-by: Linus Walleij 
---
 arch/arm/mach-omap1/board-ams-delta.c | 52 +++
 arch/arm/mach-omap1/board-ams-delta.h |  7 -
 2 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 2b90b543c030..1d451142248c 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -321,20 +321,6 @@ struct modem_private_data {
 
 static struct modem_private_data modem_priv;
 
-void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
-{
-   int bit = 0;
-   u16 bitpos = 1 << bit;
-
-   for (; bit < ngpio; bit++, bitpos = bitpos << 1) {
-   if (!(mask & bitpos))
-   continue;
-   else
-   gpio_set_value(base + bit, (value & bitpos) != 0);
-   }
-}
-EXPORT_SYMBOL(ams_delta_latch_write);
-
 static struct resource ams_delta_nand_resources[] = {
[0] = {
.start  = OMAP1_MPUIO_BASE,
@@ -680,6 +666,40 @@ static void __init omap_gpio_deps_init(void)
modem_assign_irq(chip);
 }
 
+/*
+ * Initialize latch2 pins with values which are safe for dependent on-board
+ * devices or useful for their successull initialization even before GPIO
+ * driver takes control over the latch pins:
+ * - LATCH2_PIN_LCD_VBLEN  = 0
+ * - LATCH2_PIN_LCD_NDISP  = 0 Keep LCD device powered off before its
+ * driver takes control over it.
+ * - LATCH2_PIN_NAND_NCE   = 0
+ * - LATCH2_PIN_NAND_NWP   = 0 Keep NAND device down and write-
+ * protected before its driver takes
+ * control over it.
+ * - LATCH2_PIN_KEYBRD_PWR = 0 Keep keyboard powered off before serio
+ * driver takes control over it.
+ * - LATCH2_PIN_KEYBRD_DATAOUT = 0 Keep low to avoid corruption of first
+ * byte of data received from attached
+ * keyboard when serio device is probed;
+ * the pin is also hogged low by the latch2
+ * GPIO driver as soon as it is ready.
+ * - LATCH2_PIN_MODEM_NRESET   = 1 Enable voice MODEM device, allowing for
+ * its successful probe even before a
+ * regulator it depends on, which in turn
+ * takes control over the pin, is set up.
+ * - LATCH2_PIN_MODEM_CODEC= 1 Attach voice MODEM CODEC data port
+ * to the MODEM so the CODEC is under
+ * control even if audio driver doesn't
+ * take it over.
+ */
+static void __init ams_delta_latch2_init(void)
+{
+   u16 latch2 = 1 << LATCH2_PIN_MODEM_NRESET | 1 << LATCH2_PIN_MODEM_CODEC;
+
+   __raw_writew(latch2, LATCH2_VIRT);
+}
+
 static void __init ams_delta_init(void)
 {
/* mux pins for uarts */
@@ -701,6 +721,7 @@ static void __init ams_delta_init(void)
omap_cfg_reg(J18_1610_CAM_D7);
 
omap_gpio_deps_init();
+   ams_delta_latch2_init();

Re: [PATCH 4.4 00/47] 4.4.155-stable review

2018-09-09 Thread Dan Rue
On Sun, Sep 09, 2018 at 11:17:03AM +0200, Greg Kroah-Hartman wrote:
> On Sun, Sep 09, 2018 at 10:22:27AM +0530, Naresh Kamboju wrote:
> > On 8 September 2018 at 02:39, Greg Kroah-Hartman
> >  wrote:
> > > This is the start of the stable review cycle for the 4.4.155 release.
> > > There are 47 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Sun Sep  9 21:08:44 UTC 2018.
> > > Anything received after that time might be too late.
> > >
> > > The whole patch series can be found in one patch at:
> > > 
> > > https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.155-rc1.gz
> > > or in the git tree and branch at:
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > > linux-4.4.y
> > > and the diffstat can be found below.
> > >
> > > thanks,
> > >
> > > greg k-h
> > >
> > > -
> > > Pseudo-Shortlog of commits:
> > >
> > > Jann Horn 
> > > userns: move user access out of the mutex
> > 
> > Results from Linaro’s test farm.
> > Regressions on arm64, arm, x86_64 and i386.
> > LTP containers tests
> > 
> > Test cases: userns02/03/06/07 failed on all devices.
> > 
> > LTP: user_namespace2 1 TBROK : safe_macros.c:452: userns02.c:95:
> > write(6,0x7ffc133113d0,18446744073709551615) failed: errno=EFAULT(14):
> > Bad address
> > 
> > Other bug from kernel selftests,
> > mount_run_tests.sh bugs needs to be investigated.
> > 
> > selftests: mount_run_tests.sh [FAIL]
> > write to /proc/self/uid_map failed: Bad address
> 
> -rc3 is pushed out now with, hopefully, the fix for this.

Looks good. The issues we saw in -rc1 in kselftest/mount_run_tests.sh and
ltp/userns* have been resolved in -rc3. The "regressions" flagged below in the
report are known intermittent failures, unrelated to the content of this
release.

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Summary


kernel: 4.4.155-rc3
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: f4777549b6b8529d14ec8d0735ae16a75a576d0c
git describe: v4.4.154-48-gf4777549b6b8
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.154-48-gf4777549b6b8

Regressions (compared to build v4.4.153-81-gc9eed05cd5dd)


i386:
  ltp-open-posix-tests:
* clock_settime_8-1

* test src: git://github.com/linux-test-project/ltp.git
  ltp-syscalls-tests:
* fcntl36
* runltp_syscalls

* test src: git://github.com/linux-test-project/ltp.git



Ran 16810 total tests in the following environments and test suites.

Environments
--
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64

Test Suites
---
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none

Summary


kernel: 4.4.155-rc3
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.155-rc3-hikey-20180909-278
git commit: 5cfd2cd505263e1e94e7d97e3b348dcd9f5e893b
git describe: 4.4.155-rc3-hikey-20180909-278
Test details: 
https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.155-rc3-hikey-20180909-278


No regressions (compared to build v4.4.153-81-gc9eed05cd5dd)


Ran 2724 total tests in the following environments and test suites.

Environments
--
- hi6220-hikey - arm64
- qemu_arm64

Test Suites
---
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests

-- 
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH 4.4 00/47] 4.4.155-stable review

2018-09-09 Thread Dan Rue
On Sun, Sep 09, 2018 at 11:17:03AM +0200, Greg Kroah-Hartman wrote:
> On Sun, Sep 09, 2018 at 10:22:27AM +0530, Naresh Kamboju wrote:
> > On 8 September 2018 at 02:39, Greg Kroah-Hartman
> >  wrote:
> > > This is the start of the stable review cycle for the 4.4.155 release.
> > > There are 47 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Sun Sep  9 21:08:44 UTC 2018.
> > > Anything received after that time might be too late.
> > >
> > > The whole patch series can be found in one patch at:
> > > 
> > > https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.155-rc1.gz
> > > or in the git tree and branch at:
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > > linux-4.4.y
> > > and the diffstat can be found below.
> > >
> > > thanks,
> > >
> > > greg k-h
> > >
> > > -
> > > Pseudo-Shortlog of commits:
> > >
> > > Jann Horn 
> > > userns: move user access out of the mutex
> > 
> > Results from Linaro’s test farm.
> > Regressions on arm64, arm, x86_64 and i386.
> > LTP containers tests
> > 
> > Test cases: userns02/03/06/07 failed on all devices.
> > 
> > LTP: user_namespace2 1 TBROK : safe_macros.c:452: userns02.c:95:
> > write(6,0x7ffc133113d0,18446744073709551615) failed: errno=EFAULT(14):
> > Bad address
> > 
> > Other bug from kernel selftests,
> > mount_run_tests.sh bugs needs to be investigated.
> > 
> > selftests: mount_run_tests.sh [FAIL]
> > write to /proc/self/uid_map failed: Bad address
> 
> -rc3 is pushed out now with, hopefully, the fix for this.

Looks good. The issues we saw in -rc1 in kselftest/mount_run_tests.sh and
ltp/userns* have been resolved in -rc3. The "regressions" flagged below in the
report are known intermittent failures, unrelated to the content of this
release.

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Summary


kernel: 4.4.155-rc3
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: f4777549b6b8529d14ec8d0735ae16a75a576d0c
git describe: v4.4.154-48-gf4777549b6b8
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.154-48-gf4777549b6b8

Regressions (compared to build v4.4.153-81-gc9eed05cd5dd)


i386:
  ltp-open-posix-tests:
* clock_settime_8-1

* test src: git://github.com/linux-test-project/ltp.git
  ltp-syscalls-tests:
* fcntl36
* runltp_syscalls

* test src: git://github.com/linux-test-project/ltp.git



Ran 16810 total tests in the following environments and test suites.

Environments
--
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64

Test Suites
---
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none

Summary


kernel: 4.4.155-rc3
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.155-rc3-hikey-20180909-278
git commit: 5cfd2cd505263e1e94e7d97e3b348dcd9f5e893b
git describe: 4.4.155-rc3-hikey-20180909-278
Test details: 
https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.155-rc3-hikey-20180909-278


No regressions (compared to build v4.4.153-81-gc9eed05cd5dd)


Ran 2724 total tests in the following environments and test suites.

Environments
--
- hi6220-hikey - arm64
- qemu_arm64

Test Suites
---
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests

-- 
Linaro LKFT
https://lkft.linaro.org


  1   2   3   >