Re: [RFC PATCH 4/7] kconfig: support new special property shell=

2018-02-09 Thread Ulf Magnusson
On Sat, Feb 10, 2018 at 04:12:13PM +0900, Masahiro Yamada wrote:
> 2018-02-10 14:48 GMT+09:00 Ulf Magnusson :
> > On Fri, Feb 09, 2018 at 12:46:54PM -0800, Kees Cook wrote:
> >> On Fri, Feb 9, 2018 at 4:46 AM, Ulf Magnusson  wrote:
> >> > One thing that makes Kconfig confusing (though it works well enough in
> >> > practice) is that .config files both record user selections (the saved
> >> > configuration) and serve as a configuration output format for make.
> >> >
> >> > It becomes easier to think about .config files once you realize that
> >> > assignments to promptless symbols never have an effect on Kconfig
> >> > itself: They're just configuration output, intermixed with the saved
> >> > user selections.
> >> >
> >> > Assume 'option env' symbols got written out for example:
> >> >
> >> > - For a non-user-assignable symbol, the entry in the .config
> >> >   file is just configuration output and ignored by Kconfig,
> >> >   which will fetch the value from the environment instead.
> >> >
> >> > - For an assignable 'option env' symbol, the entry in the
> >> >   .config file is a saved user selection (as well as
> >> >   configuration output), and will be respected by Kconfig.
> >>
> >> In the stack-protector case, this becomes quite important, since the
> >> goal is to record the user's selection regardless of compiler
> >> capability. For example, if someone selects _REGULAR, it shouldn't
> >> "upgrade" to _STRONG. (Similarly for _NONE.) Having _AUTO provides a
> >> way to pick "best possible for this compiler", though. If a user had
> >> previously selected _STRONG but they're doing builds with an older
> >> compiler (or a misconfigured newer compiler) without support, the goal
> >> is to _fail_ to build, not silently select _REGULAR.
> >>
> >> So, in this case, what's gained is the logic for _AUTO, and the logic
> >> to not show, say, _STRONG when it's not available in the compiler. But
> >> we must still fail to build if _STRONG was in the .config. It can't
> >> silently rewrite it to _REGULAR because the compiler support for
> >> _STRONG regressed.
> >>
> >> -Kees
> >>
> >> --
> >> Kees Cook
> >> Pixel Security
> >
> > Provided that would be the desired behavior:
> >
> > What about changing the meaning of the choice symbols from e.g. "select
> > -fstack-protector-strong" to "want -fstack-protector-strong"? Then the
> > user preference would always be remembered, regardless of what's
> > available.
> >
> > Here's a proof-of-concept. I realized that the fancy new 'imply' keyword
> > fits pretty well here, since it works like a dependency-respecting
> > select.
> >
> > config CC_HAS_STACKPROTECTOR_STRONG
> > bool
> > option shell="$CC -Werror -fstack-protector-strong -c -x c 
> > /dev/null"
> >
> > config CC_HAS_STACKPROTECTOR
> > bool
> > option shell="$CC -Werror -fstack-protector -c -x c 
> > /dev/null"
> >
> >
> > choice
> > prompt "Stack Protector buffer overflow detection"
> > default WANT_CC_STACKPROTECTOR_STRONG
> >
> > config WANT_CC_STACKPROTECTOR_STRONG
> > bool "Strong"
> > imply CC_STACKPROTECTOR_STRONG
> >
> > config WANT_CC_STACKPROTECTOR_REGULAR
> > bool "Regular"
> > imply CC_STACKPROTECTOR_REGULAR
> >
> > config WANT_CC_STACKPROTECTOR_NONE
> > bool "None"
> > imply CC_STACKPROTECTOR_NONE
> >
> > endchoice
> >
> >
> > config CC_STACKPROTECTOR_STRONG
> > bool
> > depends on CC_HAS_STACKPROTECTOR_STRONG
> 
> 
> Do you mean
> 
>  config CC_STACKPROTECTOR_STRONG
>  bool
>  depends on CC_HAS_STACKPROTECTOR_STRONG && \
> WANT_CC_STACKPROTECTOR_STRONG
> 
> or, maybe
> 
> 
>  config CC_STACKPROTECTOR_STRONG
>  bool
>  depends on CC_HAS_STACKPROTECTOR_STRONG
>  default WANT_CC_STACKPROTECTOR_STRONG
> 
> ?

With the 'imply', it should work with just the 'depends on'. I had your
last version earlier though, and it works too.

'imply' kinda makes sense, as in "turn on the strong stack protector if
its dependencies are satisfied".

> 
> 
> 
> 
> 
> > config CC_STACKPROTECTOR_REGULAR
> > bool
> > depends on CC_HAS_STACKPROTECTOR_REGULAR
> >
> > config CC_STACKPROTECTOR_NONE
> > bool
> >
> > This version has the drawback of always showing all the options, even if
> > some they wouldn't be available. Kconfig comments could be added to warn
> > if an option isn't available at least:
> >
> > comment "Warning: Your compiler does not support 
> > -fstack-protector-strong"
> > depends on !CC_HAS_STACKPROTECTOR_STRONG
> >
> > config WANT_CC_STACKPROTECTOR_STRONG

[PATCH v5] Documentation/ABI: update infiniband sysfs interfaces

2018-02-09 Thread Aishwarya Pant
Add documentation for core and hardware specific infiniband interfaces.
The descriptions have been collected from git commit logs, reading
through code and data sheets. Some drivers have incomplete doc and are
annotated with the comment '[to be documented]'.

Signed-off-by: Aishwarya Pant 
Reviewed-by: Hal Rosenstock 
---
Sorry, there were no changes in v4!

Changes in v5:
- Typo GODs -> GIDs
v3:
-  outbound -> inbound in description of port_rcv_constraint_errors
v2:
- Move infiniband interface from testing to stable
- Fix typos
- Update description of cap_mask, port_xmit_constraint_errors and
  port_rcv_constraint_errors
- Add doc for hw_counters
- Remove old documentation

 Documentation/ABI/stable/sysfs-class-infiniband  | 818 +++
 Documentation/ABI/testing/sysfs-class-infiniband |  16 -
 Documentation/infiniband/sysfs.txt   | 129 +---
 3 files changed, 820 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-class-infiniband
 delete mode 100644 Documentation/ABI/testing/sysfs-class-infiniband

diff --git a/Documentation/ABI/stable/sysfs-class-infiniband 
b/Documentation/ABI/stable/sysfs-class-infiniband
new file mode 100644
index ..17211ceb9bf4
--- /dev/null
+++ b/Documentation/ABI/stable/sysfs-class-infiniband
@@ -0,0 +1,818 @@
+sysfs interface common for all infiniband devices
+-
+
+What:  /sys/class/infiniband//node_type
+What:  /sys/class/infiniband//node_guid
+What:  /sys/class/infiniband//sys_image_guid
+Date:  Apr, 2005
+KernelVersion: v2.6.12
+Contact:   linux-r...@vger.kernel.org
+Description:
+   node_type:  (RO) Node type (CA, RNIC, usNIC, usNIC UDP,
+   switch or router)
+
+   node_guid:  (RO) Node GUID
+
+   sys_image_guid: (RO) System image GUID
+
+
+What:  /sys/class/infiniband//node_desc
+Date:  Feb, 2006
+KernelVersion: v2.6.17
+Contact:   linux-r...@vger.kernel.org
+Description:
+   (RW) Update the node description with information such as the
+   node's hostname, so that IB network management software can tie
+   its view to the real world.
+
+
+What:  /sys/class/infiniband//fw_ver
+Date:  Jun, 2016
+KernelVersion: v4.10
+Contact:   linux-r...@vger.kernel.org
+Description:
+   (RO) Display firmware version
+
+
+What:  /sys/class/infiniband//ports//lid
+What:  /sys/class/infiniband//ports//rate
+What:  /sys/class/infiniband//ports//lid_mask_count
+What:  /sys/class/infiniband//ports//sm_sl
+What:  /sys/class/infiniband//ports//sm_lid
+What:  /sys/class/infiniband//ports//state
+What:  /sys/class/infiniband//ports//phys_state
+What:  /sys/class/infiniband//ports//cap_mask
+Date:  Apr, 2005
+KernelVersion: v2.6.12
+Contact:   linux-r...@vger.kernel.org
+Description:
+
+   lid:(RO) Port LID
+
+   rate:   (RO) Port data rate (active width * active
+   speed)
+
+   lid_mask_count: (RO) Port LID mask count
+
+   sm_sl:  (RO) Subnet manager SL for port's subnet
+
+   sm_lid: (RO) Subnet manager LID for port's subnet
+
+   state:  (RO) Port state (DOWN, INIT, ARMED, ACTIVE or
+   ACTIVE_DEFER)
+
+   phys_state: (RO) Port physical state (Sleep, Polling,
+   LinkUp, etc)
+
+   cap_mask:   (RO) Port capability mask. 2 bits here are
+   settable- IsCommunicationManagementSupported
+   (set when CM module is loaded) and IsSM (set via
+   open of issmN file).
+
+
+What:  /sys/class/infiniband//ports//link_layer
+Date:  Oct, 2010
+KernelVersion: v2.6.37
+Contact:   linux-r...@vger.kernel.org
+Description:
+   (RO) Link layer type information (Infiniband or Ethernet type)
+
+
+What:  
/sys/class/infiniband//ports//counters/symbol_error
+What:  
/sys/class/infiniband//ports//counters/port_rcv_errors
+What:  
/sys/class/infiniband//ports//counters/port_rcv_remote_physical_errors
+What:  
/sys/class/infiniband//ports//counters/port_rcv_switch_relay_errors
+What:  
/sys/class/infiniband//ports//counters/link_error_recovery
+What:  
/sys/class/infiniband//ports//counters/port_xmit_constraint_errors
+What:  
/sys/class/infiniband//ports//counters/port_rcv_contraint_errors
+What:  
/sys/class/infiniband//ports//counters/local_link_integrity_errors
+What:  
/sys/class/infiniband//ports//counters/excessive_buffer_overrun_errors
+What:  
/sys/class/infiniband//ports//counters/port_xmit_data
+What:   

Re: [PATCH v3 01/11] dt-bindings: clock: Add Actions S900 clock bindings

2018-02-09 Thread Philippe Ombredanne
Dear Manivannan,

On Sat, Feb 10, 2018 at 3:41 AM, Manivannan Sadhasivam
 wrote:
> Add Actions Semi S900 clock bindings.
>
> Signed-off-by: Manivannan Sadhasivam 
> Acked-by: Rob Herring 



> diff --git a/include/dt-bindings/clock/actions,s900-cmu.h 
> b/include/dt-bindings/clock/actions,s900-cmu.h
> new file mode 100644
> index ..2fa94e19922b
> --- /dev/null
> +++ b/include/dt-bindings/clock/actions,s900-cmu.h
> @@ -0,0 +1,139 @@
> +/*
> + * Device Tree binding constants for Actions S900 Clock Management Unit
> + *
> + * Copyright (c) 2014 Actions Semi Inc.
> + * Copyright (c) 2017 Linaro Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */

Would you consider using the new SPDX license ids rather that this
time-tested but rather boring legalese?

The (still new and fresh) license documentation contributed by tglx
--the only maintainer that I know that understands both the innards of
Spectre and Meltdown and the beauty of reStructuredText -- is in:
Documentation/process/license-rules.rst

Practically this means replacing the above by a simple single line and
getting rid of a whopping 8 comment lines!

SPDX-License-Identifier: GPL-2.0+

You get to save a few tree as a bonus if you also do the same for all
Linaro-copyrighted files. Yes this is saving trees because I will use
less paper each time I print a listing of the kernel source code.
Which is something that I rarely if ever do: but somebody must do it
somewhere for sure.

If I do the math: we have ~60K files in the kernel, and say we can
remove roughly 5 lines of legalese per file on average. Each printed
source code page is roughly 60 lines : this will mean a saving of
about 6000 paper sheets saved on each printout! A letter-size paper
ream is 500 pages, about 2.5 Kg and costs about ~$8.  You can extract
about 10K to 20k sheets of paper per tree [1].
Therefore my Fermi estimate is that using shorter legalese in the
kernel will eventually save roughly ONE FULL smaller tree (6K pages)
each time someone prints the kernel code: incredible, right?

Thank  you for helping make the kernel a mostly legalese-free codebase
and saving trees at the same time!

[1] 
https://www.sierraclub.org/sierra/2014-4-july-august/green-life/how-much-paper-does-one-tree-produce
-- 
Cordially
Philippe Ombredanne


[PATCH v4] Documentation/ABI: update infiniband sysfs interfaces

2018-02-09 Thread Aishwarya Pant
Add documentation for core and hardware specific infiniband interfaces.
The descriptions have been collected from git commit logs, reading
through code and data sheets. Some drivers have incomplete doc and are
annotated with the comment '[to be documented]'.

Signed-off-by: Aishwarya Pant 
Reviewed-by: Hal Rosenstock 
---
Changes in v4:
- Typo GODs -> GIDs
v3:
-  outbound -> inbound in description of port_rcv_constraint_errors
v2:
- Move infiniband interface from testing to stable
- Fix typos
- Update description of cap_mask, port_xmit_constraint_errors and
  port_rcv_constraint_errors
- Add doc for hw_counters
- Remove old documentation

 Documentation/ABI/stable/sysfs-class-infiniband  | 818 +++
 Documentation/ABI/testing/sysfs-class-infiniband |  16 -
 Documentation/infiniband/sysfs.txt   | 129 +---
 3 files changed, 820 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-class-infiniband
 delete mode 100644 Documentation/ABI/testing/sysfs-class-infiniband

diff --git a/Documentation/ABI/stable/sysfs-class-infiniband 
b/Documentation/ABI/stable/sysfs-class-infiniband
new file mode 100644
index ..f3acf3713a91
--- /dev/null
+++ b/Documentation/ABI/stable/sysfs-class-infiniband
@@ -0,0 +1,818 @@
+sysfs interface common for all infiniband devices
+-
+
+What:  /sys/class/infiniband//node_type
+What:  /sys/class/infiniband//node_guid
+What:  /sys/class/infiniband//sys_image_guid
+Date:  Apr, 2005
+KernelVersion: v2.6.12
+Contact:   linux-r...@vger.kernel.org
+Description:
+   node_type:  (RO) Node type (CA, RNIC, usNIC, usNIC UDP,
+   switch or router)
+
+   node_guid:  (RO) Node GUID
+
+   sys_image_guid: (RO) System image GUID
+
+
+What:  /sys/class/infiniband//node_desc
+Date:  Feb, 2006
+KernelVersion: v2.6.17
+Contact:   linux-r...@vger.kernel.org
+Description:
+   (RW) Update the node description with information such as the
+   node's hostname, so that IB network management software can tie
+   its view to the real world.
+
+
+What:  /sys/class/infiniband//fw_ver
+Date:  Jun, 2016
+KernelVersion: v4.10
+Contact:   linux-r...@vger.kernel.org
+Description:
+   (RO) Display firmware version
+
+
+What:  /sys/class/infiniband//ports//lid
+What:  /sys/class/infiniband//ports//rate
+What:  /sys/class/infiniband//ports//lid_mask_count
+What:  /sys/class/infiniband//ports//sm_sl
+What:  /sys/class/infiniband//ports//sm_lid
+What:  /sys/class/infiniband//ports//state
+What:  /sys/class/infiniband//ports//phys_state
+What:  /sys/class/infiniband//ports//cap_mask
+Date:  Apr, 2005
+KernelVersion: v2.6.12
+Contact:   linux-r...@vger.kernel.org
+Description:
+
+   lid:(RO) Port LID
+
+   rate:   (RO) Port data rate (active width * active
+   speed)
+
+   lid_mask_count: (RO) Port LID mask count
+
+   sm_sl:  (RO) Subnet manager SL for port's subnet
+
+   sm_lid: (RO) Subnet manager LID for port's subnet
+
+   state:  (RO) Port state (DOWN, INIT, ARMED, ACTIVE or
+   ACTIVE_DEFER)
+
+   phys_state: (RO) Port physical state (Sleep, Polling,
+   LinkUp, etc)
+
+   cap_mask:   (RO) Port capability mask. 2 bits here are
+   settable- IsCommunicationManagementSupported
+   (set when CM module is loaded) and IsSM (set via
+   open of issmN file).
+
+
+What:  /sys/class/infiniband//ports//link_layer
+Date:  Oct, 2010
+KernelVersion: v2.6.37
+Contact:   linux-r...@vger.kernel.org
+Description:
+   (RO) Link layer type information (Infiniband or Ethernet type)
+
+
+What:  
/sys/class/infiniband//ports//counters/symbol_error
+What:  
/sys/class/infiniband//ports//counters/port_rcv_errors
+What:  
/sys/class/infiniband//ports//counters/port_rcv_remote_physical_errors
+What:  
/sys/class/infiniband//ports//counters/port_rcv_switch_relay_errors
+What:  
/sys/class/infiniband//ports//counters/link_error_recovery
+What:  
/sys/class/infiniband//ports//counters/port_xmit_constraint_errors
+What:  
/sys/class/infiniband//ports//counters/port_rcv_contraint_errors
+What:  
/sys/class/infiniband//ports//counters/local_link_integrity_errors
+What:  
/sys/class/infiniband//ports//counters/excessive_buffer_overrun_errors
+What:  
/sys/class/infiniband//ports//counters/port_xmit_data
+What:  
/sys/class/infiniband//ports//cou

Re: [PATCH v2] printk: Relocate wake_klogd check close to the end of console_unlock()

2018-02-09 Thread Sergey Senozhatsky
Hello,

On (02/09/18 11:39), Petr Mladek wrote:
> On Fri 2018-02-09 12:28:30, Sergey Senozhatsky wrote:
> > On (02/08/18 17:48), Petr Mladek wrote:
> > By postponing klogd wakeup we don't really address logbuf_lock
> > contention. We have no guarantees that no new printk will come
> > while klogd is active. Besides, consoles don't really delay
> > klogd - I tend to ignore the impact of msg_print_text(), it should
> > be fast. We call console drivers outside of logbuf_lock scope, so
> > everything should fine (tm).
> 
> First, I am all for waking klogd earlier.
> 
> Second, sigh, I do not have much experience with kernel performace issues.
> It is very likely that we really do not need to mind about it.

I really don't think we need to bother.
klogd loggers are as important as consoles, we need to run them anyway.

> > Basically,
> > - if consoles are suspended, we also "suspend" user space klogd.
> >   Does it really make sense?
> > 
> > - if console_lock is acquired by a preemptible task and that task
> >   is getting scheduled out for a long time (OOM, etc) then we postpone
> >   user space logging for unknown period of time. First the console_lock
> >   will have to flush pending messages and only afterwards it will wakeup
> >   klogd. Does it really make sense?
> > 
> > - If current console_lock owner jumps to retry (new pending messages
> >   were appended to the logbuf) label, user space klogd wakeup is getting
> >   postponed even further.
> > 
> > So, the final question is - since there in only one legitimate way
> > (modulo user space writes to kmsg) to append new messages to the
> > logbuf, shall we put klogd wakeup there? IOW, to vprintk_emit().
> 
> Good points! In fact, if we wakeup klogd before calling consoles,
> we would need to do it for every new message. Otherwise, klogd
> processes might miss new messages that are added in parallel
> when console_lock is taken.
[..]
> Then klogd might start sleeping while new messages are still comming

Loggers sleep when `user->seq == log_next_seq' or when
`syslog_seq == log_next_seq'. We need to just wakeup them.
Once woken up they will check the condition again, if there
are no new messages, they will schedule.

> Now, your proposed solution looked fine. Just note that we do not need
> seen_seq. vprintk_emit() knows when log_next_seq is increased.
> It would always wake klogd in this case.

Probably can wake_up_klogd() unconditionally.

> Anyway, I think about slightly different way that would prevent
> scheduling klogd intead of the vprintk_emit() caller. The trick
> is to do the wakeup with preemtion disabled. I mean something like:
[..]
> @@ -1899,9 +1899,13 @@ asmlinkage int vprintk_emit(int facility, int level,
>*/
>   preempt_disable();
>   /*
> +  * Wake klogd with disabled preemtion so that they can run
> +  * in parallel but they could not delay console_handling.
> +  */
> + wake_up_klogd();
> + /*
>* Try to acquire and then immediately release the console
> -  * semaphore.  The release will print out buffers and wake up
> -  * /dev/kmsg and syslog() users.
> +  * semaphore.  The release will print out buffers.
>*/
>   if (console_trylock_spinning())
>   console_unlock();
[..]

It doesn't wakeup loggers for printk_deferred() output this way.
I want to wakeup them for every new logbuf message.

If logger preempts current printk() that it's for 1 message only.
printk() will return back and finish printing. If there will be another
printk()-s from other CPUs, then one of those CPUs will print messages
to the consoles - CPU that woke up logger had not acquired console_sem
before it was preempted by logger.

-ss


Re: [PATCH 4.9 46/92] x86/alternative: Print unadorned pointers

2018-02-09 Thread Greg Kroah-Hartman
On Fri, Feb 09, 2018 at 02:01:32PM -0800, Kees Cook wrote:
> On Fri, Feb 9, 2018 at 5:39 AM, Greg Kroah-Hartman
>  wrote:
> > 4.9-stable review patch.  If anyone has any objections, please let me know.
> >
> > --
> >
> > From: Borislav Petkov 
> >
> > (cherry picked from commit 0e6c16c652cadaffd25a6bb326ec10da5bcec6b4)
> >
> > After commit ad67b74d2469 ("printk: hash addresses printed with %p")
> > pointers are being hashed when printed. However, this makes the alternative
> > debug output completely useless. Switch to %px in order to see the
> > unadorned kernel pointers.
> 
> This missed a "Fixes:" tag so probably missed automated checking on
> how far back to port this. It shouldn't go back beyond 4.15 (where
> ad67b74d2469 first appeared).

Good point.  Should we instead be using %pK for this change instead?  Or
should we just backport commit ad67b74d2469 to 4.14?  :)

Thanks for letting me know this.

greg k-h


Re: [PATCH 4.15 00/23] 4.15.3-stable review

2018-02-09 Thread Greg Kroah-Hartman
On Fri, Feb 09, 2018 at 01:20:26PM -0700, Shuah Khan wrote:
> On 02/09/2018 06:39 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.15.3 release.
> > There are 23 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 Feb 11 13:39:20 UTC 2018.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.15.3-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.15.y
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> 
> Compiled and booted on my test system. No dmesg regressions.

Thanks for testing all 3 of these and letting me know.

greg k-h


Re: [PATCH 4.15 00/23] 4.15.3-stable review

2018-02-09 Thread Greg Kroah-Hartman
On Fri, Feb 09, 2018 at 02:40:41PM -0600, Dan Rue wrote:
> On Fri, Feb 09, 2018 at 02:39:58PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.15.3 release.
> > There are 23 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 Feb 11 13:39:20 UTC 2018.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.15.3-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.15.y
> > and the diffstat can be found below.
> 
> Results from Linaro’s test farm.
> No regressions on arm64, arm and x86_64.
> 
> Since the last RC, we have upgraded LTP from release version 20170929 to
> release version 20180118. The fanotify06 (and "runltp_syscalls")
> regressions listed below are due to a problem in LTP itself (see
> http://lists.linux.it/pipermail/ltp/2018-January/006915.html). We will
> either carry a patch to fix fanotify06, or skip it until the next LTP
> release. You'll see this noise in the other branches as well.

Ah, nice you upgraded LTP, lots of fixes are getting merged into there
lately.

And thanks for testing all of these and letting me know.

greg k-h


Re: [RFC PATCH 4/7] kconfig: support new special property shell=

2018-02-09 Thread Masahiro Yamada
2018-02-10 14:48 GMT+09:00 Ulf Magnusson :
> On Fri, Feb 09, 2018 at 12:46:54PM -0800, Kees Cook wrote:
>> On Fri, Feb 9, 2018 at 4:46 AM, Ulf Magnusson  wrote:
>> > One thing that makes Kconfig confusing (though it works well enough in
>> > practice) is that .config files both record user selections (the saved
>> > configuration) and serve as a configuration output format for make.
>> >
>> > It becomes easier to think about .config files once you realize that
>> > assignments to promptless symbols never have an effect on Kconfig
>> > itself: They're just configuration output, intermixed with the saved
>> > user selections.
>> >
>> > Assume 'option env' symbols got written out for example:
>> >
>> > - For a non-user-assignable symbol, the entry in the .config
>> >   file is just configuration output and ignored by Kconfig,
>> >   which will fetch the value from the environment instead.
>> >
>> > - For an assignable 'option env' symbol, the entry in the
>> >   .config file is a saved user selection (as well as
>> >   configuration output), and will be respected by Kconfig.
>>
>> In the stack-protector case, this becomes quite important, since the
>> goal is to record the user's selection regardless of compiler
>> capability. For example, if someone selects _REGULAR, it shouldn't
>> "upgrade" to _STRONG. (Similarly for _NONE.) Having _AUTO provides a
>> way to pick "best possible for this compiler", though. If a user had
>> previously selected _STRONG but they're doing builds with an older
>> compiler (or a misconfigured newer compiler) without support, the goal
>> is to _fail_ to build, not silently select _REGULAR.
>>
>> So, in this case, what's gained is the logic for _AUTO, and the logic
>> to not show, say, _STRONG when it's not available in the compiler. But
>> we must still fail to build if _STRONG was in the .config. It can't
>> silently rewrite it to _REGULAR because the compiler support for
>> _STRONG regressed.
>>
>> -Kees
>>
>> --
>> Kees Cook
>> Pixel Security
>
> Provided that would be the desired behavior:
>
> What about changing the meaning of the choice symbols from e.g. "select
> -fstack-protector-strong" to "want -fstack-protector-strong"? Then the
> user preference would always be remembered, regardless of what's
> available.
>
> Here's a proof-of-concept. I realized that the fancy new 'imply' keyword
> fits pretty well here, since it works like a dependency-respecting
> select.
>
> config CC_HAS_STACKPROTECTOR_STRONG
> bool
> option shell="$CC -Werror -fstack-protector-strong -c -x c 
> /dev/null"
>
> config CC_HAS_STACKPROTECTOR
> bool
> option shell="$CC -Werror -fstack-protector -c -x c /dev/null"
>
>
> choice
> prompt "Stack Protector buffer overflow detection"
> default WANT_CC_STACKPROTECTOR_STRONG
>
> config WANT_CC_STACKPROTECTOR_STRONG
> bool "Strong"
> imply CC_STACKPROTECTOR_STRONG
>
> config WANT_CC_STACKPROTECTOR_REGULAR
> bool "Regular"
> imply CC_STACKPROTECTOR_REGULAR
>
> config WANT_CC_STACKPROTECTOR_NONE
> bool "None"
> imply CC_STACKPROTECTOR_NONE
>
> endchoice
>
>
> config CC_STACKPROTECTOR_STRONG
> bool
> depends on CC_HAS_STACKPROTECTOR_STRONG


Do you mean

 config CC_STACKPROTECTOR_STRONG
 bool
 depends on CC_HAS_STACKPROTECTOR_STRONG && \
WANT_CC_STACKPROTECTOR_STRONG

or, maybe


 config CC_STACKPROTECTOR_STRONG
 bool
 depends on CC_HAS_STACKPROTECTOR_STRONG
 default WANT_CC_STACKPROTECTOR_STRONG

?





> config CC_STACKPROTECTOR_REGULAR
> bool
> depends on CC_HAS_STACKPROTECTOR_REGULAR
>
> config CC_STACKPROTECTOR_NONE
> bool
>
> This version has the drawback of always showing all the options, even if
> some they wouldn't be available. Kconfig comments could be added to warn
> if an option isn't available at least:
>
> comment "Warning: Your compiler does not support 
> -fstack-protector-strong"
> depends on !CC_HAS_STACKPROTECTOR_STRONG
>
> config WANT_CC_STACKPROTECTOR_STRONG
> ...
>
>
> comment "Warning: Your compiler does not support -fstack-protector"
> depends on !CC_HAS_STACKPROTECTOR_REGULAR
>
> config WANT_CC_STACKPROTECTOR_REGULAR
> ...
>
> This final comment might be nice to have too:
>
> comment "Warning: Selected stack protector not available"
> depends on !(CC_STACKPROTECTOR_STRONG ||
>  CC_STACKPROTECTOR_REGULAR ||
>  CC_STACKPROTECTOR_NONE)
>
> Should probab

[GIT PULL] chrome-platform updates for v4.16

2018-02-09 Thread Benson Leung
Hi Linus,

The following changes since commit 50c4c4e268a2d7a3e58ebb698ac74da0de40ae36:

  Linux 4.15-rc3 (2017-12-10 17:56:26 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git 
tags/chrome-platform-for-linus-4.16

for you to fetch changes up to d48b8c58c57f6edbe2965f0a5f62c5cf9593ca96:

  platform/chrome: Use proper protocol transfer function (2017-12-17 14:04:21 
-0800)


chrome-platform-for-linus-4.16

Moving cros_ec_dev to drivers/mfd.
Other small maintenance fixes.


Arnd Bergmann (1):
  cros_ec: fix nul-termination for firmware build info

Benson Leung (1):
  Merge branch 'ibs-for-chrome-platform-merged' into working-branch-for-4.16

Bhumika Goyal (1):
  platform/chrome: chromeos_laptop: make chromeos_laptop const

Colin Ian King (1):
  platform/chrome: cros_ec_lpc: remove redundant pointer request

Enric Balletbo i Serra (1):
  platform/chrome: cros_ec_lpc: Register the driver if ACPI entry is 
missing.

Shawn Nematbakhsh (1):
  platform/chrome: Use proper protocol transfer function

Thierry Escande (3):
  cros_ec: Split cros_ec_devs module
  cros_ec: Move cros_ec_dev module to drivers/mfd
  platform/chrome: cros_ec_lpc: Add support for Google Glimmer

 drivers/mfd/Kconfig| 10 ++
 drivers/mfd/Makefile   |  1 +
 drivers/mfd/cros_ec.c  |  4 +--
 drivers/{platform/chrome => mfd}/cros_ec_dev.c |  8 +++--
 drivers/{platform/chrome => mfd}/cros_ec_dev.h |  0
 drivers/platform/chrome/Kconfig| 10 ++
 drivers/platform/chrome/Makefile   |  7 ++--
 drivers/platform/chrome/chromeos_laptop.c  | 22 ++---
 drivers/platform/chrome/cros_ec_debugfs.c  |  5 ++-
 drivers/platform/chrome/cros_ec_debugfs.h  | 27 
 drivers/platform/chrome/cros_ec_lightbar.c |  6 ++--
 drivers/platform/chrome/cros_ec_lpc.c  | 44 +++---
 drivers/platform/chrome/cros_ec_proto.c|  8 +++--
 drivers/platform/chrome/cros_ec_sysfs.c|  7 ++--
 drivers/platform/chrome/cros_ec_vbc.c  |  1 +
 include/linux/mfd/cros_ec.h|  4 +++
 16 files changed, 94 insertions(+), 70 deletions(-)
 rename drivers/{platform/chrome => mfd}/cros_ec_dev.c (99%)
 rename drivers/{platform/chrome => mfd}/cros_ec_dev.h (100%)
 delete mode 100644 drivers/platform/chrome/cros_ec_debugfs.h

Thanks,
Benson

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
ble...@google.com
Chromium OS Project
ble...@chromium.org


signature.asc
Description: PGP signature


Re: [PATCH 5/6] ARM: dts: tegra: apalis-tk1: copyright period, spurious newlines

2018-02-09 Thread Philippe Ombredanne
Marcel,

On Sat, Feb 10, 2018 at 2:38 AM, Marcel Ziswiler  wrote:
> From: Marcel Ziswiler 
>
> Update the copyright period and get rid of some spurious newlines.
>
> Signed-off-by: Marcel Ziswiler 
>
> ---
>
>  arch/arm/boot/dts/tegra124-apalis-eval.dts |  6 ++
>  arch/arm/boot/dts/tegra124-apalis.dtsi | 11 +--
>  2 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts 
> b/arch/arm/boot/dts/tegra124-apalis-eval.dts
> index f1010cefb993..a6ad759dddb4 100644
> --- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
> +++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright 2016 Toradex AG
> + * Copyright 2016-2018 Toradex AG
>   *
>   * This file is dual-licensed: you can use it either under the terms
>   * of the GPL or the X11 license, at your option. Note that this dual

Since you are fixing copyrights, would you consider also fixing the
license to use a proper SPDX Id instead?

It would be super gentle of you!

And you will get extra good karma point if you feel like doing the
same for every Toradex-copyrighted files ;)

The (still new and fresh) license documentation contributed by tglx
--the only real-time docu-mentalist-- is in:
Documentation/process/license-rules.rst

Thanks!
-- 
Cordially
Philippe Ombredanne


Re: [PATCH 4.15 00/23] 4.15.3-stable review

2018-02-09 Thread Greg KH
On Sat, Feb 10, 2018 at 09:47:30AM +0300, Ozkan Sezer wrote:
> On 02/09/2018 06:39 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.15.3 release.
> > There are 23 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 Feb 11 13:39:20 UTC 2018.
> > Anything received after that time might be too late.
> 
> I hope it's not too late for reverting 
> 5b54eddd3920e9f6f1a6d972454baf350cbae77e
> to fix the i915 "no reboot/no poweroff" regression:
> https://bugs.freedesktop.org/show_bug.cgi?id=104805
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20180209&id=b5a756a722286af9702d565501e1f690d075d16b

You seem to have dropped the stable@ address :(

No one asked me to apply that patch that I recall, I need some sort of
email from the maintainer/developer please.

thanks,

greg k-h


Re: [PATCH 4.15 00/23] 4.15.3-stable review

2018-02-09 Thread Ozkan Sezer
On 02/09/2018 06:39 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.15.3 release.
> There are 23 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 Feb 11 13:39:20 UTC 2018.
> Anything received after that time might be too late.

I hope it's not too late for reverting 5b54eddd3920e9f6f1a6d972454baf350cbae77e
to fix the i915 "no reboot/no poweroff" regression:
https://bugs.freedesktop.org/show_bug.cgi?id=104805
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20180209&id=b5a756a722286af9702d565501e1f690d075d16b

--
O.S.


[PATCH] ARM: dts: armada: netgear-rn*: fix rtc node name

2018-02-09 Thread Alexandre Belloni
The node name should be generic and must not contain the part number.

Signed-off-by: Alexandre Belloni 
---
 arch/arm/boot/dts/armada-370-netgear-rn102.dts | 2 +-
 arch/arm/boot/dts/armada-370-netgear-rn104.dts | 2 +-
 arch/arm/boot/dts/armada-xp-netgear-rn2120.dts | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts 
b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
index b1a96e95e921..d2225bd4a76f 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
@@ -103,7 +103,7 @@
 
status = "okay";
 
-   isl12057: isl12057@68 {
+   isl12057: rtc@68 {
compatible = "isil,isl12057";
reg = <0x68>;
wakeup-source;
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts 
b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
index d67e7aa42b54..b73cae836bc1 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
@@ -105,7 +105,7 @@
 
status = "okay";
 
-   isl12057: isl12057@68 {
+   isl12057: rtc@68 {
compatible = "isil,isl12057";
reg = <0x68>;
wakeup-source;
diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts 
b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
index 40c6fe21e720..e66fe80cf279 100644
--- a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
+++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
@@ -115,7 +115,7 @@
reg = <0x4c>;
};
 
-   isl12057: isl12057@68 {
+   isl12057: rtc@68 {
compatible = "isil,isl12057";
reg = <0x68>;
wakeup-source;
-- 
2.16.1



Re: [RFC 1/2] sched: reduce migration cost between faster caches for idle_balance

2018-02-09 Thread Mike Galbraith
On Fri, 2018-02-09 at 11:08 -0500, Steven Sistare wrote:
> >> @@ -8804,7 +8803,8 @@ static int idle_balance(struct rq *this_rq, struct 
> >> rq_flags *rf)
> >>if (!(sd->flags & SD_LOAD_BALANCE))
> >>continue;
> >>  
> >> -  if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
> >> +  if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost +
> >> +  sd->sched_migration_cost) {
> >>update_next_balance(sd, &next_balance);
> >>break;
> >>}
> > 
> > Ditto.
> 
> The old code did not migrate if the expected costs exceeded the expected idle
> time.  The new code just adds the sd-specific penalty (essentially loss of 
> cache 
> footprint) to the costs.  The for_each_domain loop visit smallest to largest
> sd's, hence visiting smallest to largest migration costs (though the tunables 
> do 
> not enforce an ordering), and bails at the first sd where the total cost is a 
> lose.

Hrm..

You're now adding a hypothetical cost to the measured cost of running
the LB machinery, which implies that the measurement is insufficient,
but you still don't say why it is insufficient.  What happens if you
don't do that?  I ask, because when I removed the...

   this_rq->avg_idle < sysctl_sched_migration_cost

...bits to check removal effect for Peter, the original reason for it
being added did not re-materialize, making me wonder why you need to
make this cutoff more aggressive.

-Mike


[PATCH] staging: android: ion: Restrict cache maintenance to dma mapped memory

2018-02-09 Thread Liam Mark
The ION begin_cpu_access and end_cpu_access functions use the
dma_sync_sg_for_cpu and dma_sync_sg_for_device APIs to perform cache
maintenance.

Currently it is possible to apply cache maintenance, via the
begin_cpu_access and end_cpu_access APIs, to ION buffers which are not
dma mapped.

The dma sync sg APIs should not be called on sg lists which have not been
dma mapped as this can result in cache maintenance being applied to the
wrong address. If an sg list has not been dma mapped then its dma_address
field has not been populated, some dma ops such as the swiotlb_dma_ops ops
use the dma_address field to calculate the address onto which to apply
cache maintenance.

Fix the ION begin_cpu_access and end_cpu_access functions to only apply
cache maintenance to buffers which have been dma mapped.

Fixes: 2a55e7b5e544 ("staging: android: ion: Call dma_map_sg for syncing and 
mapping")
Signed-off-by: Liam Mark 
---
 drivers/staging/android/ion/ion.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index f480885e346b..e5df5272823d 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -214,6 +214,7 @@ struct ion_dma_buf_attachment {
struct device *dev;
struct sg_table *table;
struct list_head list;
+   bool dma_mapped;
 };
 
 static int ion_dma_buf_attach(struct dma_buf *dmabuf, struct device *dev,
@@ -235,6 +236,7 @@ static int ion_dma_buf_attach(struct dma_buf *dmabuf, 
struct device *dev,
 
a->table = table;
a->dev = dev;
+   a->dma_mapped = false;
INIT_LIST_HEAD(&a->list);
 
attachment->priv = a;
@@ -272,6 +274,7 @@ static struct sg_table *ion_map_dma_buf(struct 
dma_buf_attachment *attachment,
direction))
return ERR_PTR(-ENOMEM);
 
+   a->dma_mapped = true;
return table;
 }
 
@@ -279,7 +282,10 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment 
*attachment,
  struct sg_table *table,
  enum dma_data_direction direction)
 {
+   struct ion_dma_buf_attachment *a = attachment->priv;
+
dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction);
+   a->dma_mapped = false;
 }
 
 static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
@@ -345,8 +351,9 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
 
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
-   dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
-   direction);
+   if (a->dma_mapped)
+   dma_sync_sg_for_cpu(a->dev, a->table->sgl,
+   a->table->nents, direction);
}
mutex_unlock(&buffer->lock);
 
@@ -367,8 +374,9 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf 
*dmabuf,
 
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
-   dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents,
-  direction);
+   if (a->dma_mapped)
+   dma_sync_sg_for_device(a->dev, a->table->sgl,
+  a->table->nents, direction);
}
mutex_unlock(&buffer->lock);
 
-- 
1.8.5.2


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


[PATCH] staging: android: ion: Initialize dma_address of new sg list

2018-02-09 Thread Liam Mark
Fix the dup_sg_table function to initialize the dma_address of the new
sg list entries instead of the source dma_address entries.

Fixes: 17fd283f3870 ("staging: android: ion: Duplicate sg_table")
Signed-off-by: Liam Mark 
---
 drivers/staging/android/ion/ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index f480885e346b..3ace3a0d9210 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -197,7 +197,7 @@ static struct sg_table *dup_sg_table(struct sg_table *table)
new_sg = new_table->sgl;
for_each_sg(table->sgl, sg, table->nents, i) {
memcpy(new_sg, sg, sizeof(*sg));
-   sg->dma_address = 0;
+   new_sg->dma_address = 0;
new_sg = sg_next(new_sg);
}
 
-- 
1.8.5.2


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


Re: [RFC PATCH 4/7] kconfig: support new special property shell=

2018-02-09 Thread Ulf Magnusson
On Fri, Feb 09, 2018 at 12:46:54PM -0800, Kees Cook wrote:
> On Fri, Feb 9, 2018 at 4:46 AM, Ulf Magnusson  wrote:
> > One thing that makes Kconfig confusing (though it works well enough in
> > practice) is that .config files both record user selections (the saved
> > configuration) and serve as a configuration output format for make.
> >
> > It becomes easier to think about .config files once you realize that
> > assignments to promptless symbols never have an effect on Kconfig
> > itself: They're just configuration output, intermixed with the saved
> > user selections.
> >
> > Assume 'option env' symbols got written out for example:
> >
> > - For a non-user-assignable symbol, the entry in the .config
> >   file is just configuration output and ignored by Kconfig,
> >   which will fetch the value from the environment instead.
> >
> > - For an assignable 'option env' symbol, the entry in the
> >   .config file is a saved user selection (as well as
> >   configuration output), and will be respected by Kconfig.
> 
> In the stack-protector case, this becomes quite important, since the
> goal is to record the user's selection regardless of compiler
> capability. For example, if someone selects _REGULAR, it shouldn't
> "upgrade" to _STRONG. (Similarly for _NONE.) Having _AUTO provides a
> way to pick "best possible for this compiler", though. If a user had
> previously selected _STRONG but they're doing builds with an older
> compiler (or a misconfigured newer compiler) without support, the goal
> is to _fail_ to build, not silently select _REGULAR.
> 
> So, in this case, what's gained is the logic for _AUTO, and the logic
> to not show, say, _STRONG when it's not available in the compiler. But
> we must still fail to build if _STRONG was in the .config. It can't
> silently rewrite it to _REGULAR because the compiler support for
> _STRONG regressed.
> 
> -Kees
> 
> -- 
> Kees Cook
> Pixel Security

Provided that would be the desired behavior:

What about changing the meaning of the choice symbols from e.g. "select
-fstack-protector-strong" to "want -fstack-protector-strong"? Then the
user preference would always be remembered, regardless of what's
available.

Here's a proof-of-concept. I realized that the fancy new 'imply' keyword
fits pretty well here, since it works like a dependency-respecting
select.

config CC_HAS_STACKPROTECTOR_STRONG
bool
option shell="$CC -Werror -fstack-protector-strong -c -x c 
/dev/null"

config CC_HAS_STACKPROTECTOR
bool
option shell="$CC -Werror -fstack-protector -c -x c /dev/null"


choice
prompt "Stack Protector buffer overflow detection"
default WANT_CC_STACKPROTECTOR_STRONG

config WANT_CC_STACKPROTECTOR_STRONG
bool "Strong"
imply CC_STACKPROTECTOR_STRONG

config WANT_CC_STACKPROTECTOR_REGULAR
bool "Regular"
imply CC_STACKPROTECTOR_REGULAR

config WANT_CC_STACKPROTECTOR_NONE
bool "None"
imply CC_STACKPROTECTOR_NONE

endchoice


config CC_STACKPROTECTOR_STRONG
bool
depends on CC_HAS_STACKPROTECTOR_STRONG

config CC_STACKPROTECTOR_REGULAR
bool
depends on CC_HAS_STACKPROTECTOR_REGULAR

config CC_STACKPROTECTOR_NONE
bool

This version has the drawback of always showing all the options, even if
some they wouldn't be available. Kconfig comments could be added to warn
if an option isn't available at least:

comment "Warning: Your compiler does not support 
-fstack-protector-strong"
depends on !CC_HAS_STACKPROTECTOR_STRONG

config WANT_CC_STACKPROTECTOR_STRONG
...


comment "Warning: Your compiler does not support -fstack-protector"
depends on !CC_HAS_STACKPROTECTOR_REGULAR

config WANT_CC_STACKPROTECTOR_REGULAR
...

This final comment might be nice to have too:

comment "Warning: Selected stack protector not available"
depends on !(CC_STACKPROTECTOR_STRONG ||
 CC_STACKPROTECTOR_REGULAR ||
 CC_STACKPROTECTOR_NONE)

Should probably introduce a clear warning that tells the user what they
need to change in Kconfig if they build with a broken selection too.


CC_STACKPROTECTOR_AUTO could be added to the choice in a slightly kludgy
way too. Maybe there's something neater.

config CC_STACKPROTECTOR_AUTO
bool "Automatic"
imply CC_STACKPROTECTOR_STRONG
imply CC_STACKPROTECTOR_REGULAR if !CC_HAS_STACKPROTECTOR_STRONG
imply CC_STACKPROTECTOR_NONEif 
!CC_HAS_STACKPROTECTOR_STRON

Re: [PATCH v2 1/1] mm: initialize pages on demand during boot

2018-02-09 Thread kbuild test robot
Hi Pavel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mmotm/master]
[also build test WARNING on next-20180209]
[cannot apply to v4.15]
[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/Pavel-Tatashin/mm-initialize-pages-on-demand-during-boot/20180210-125104
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-x018-201805 (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 warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:18:0,
from arch/x86/include/asm/bug.h:82,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:9,
from mm/page_alloc.c:18:
   mm/page_alloc.c: In function 'free_area_init_node':
   include/linux/kernel.h:792:16: warning: comparison of distinct pointer types 
lacks a cast
 (void) (&min1 == &min2);   \
   ^
   include/linux/kernel.h:801:2: note: in expansion of macro '__min'
 __min(typeof(x), typeof(y),   \
 ^
>> mm/page_alloc.c:6357:29: note: in expansion of macro 'min'
 pgdat->static_init_pgcnt = min(PAGES_PER_SECTION,
^~~

vim +/min +6357 mm/page_alloc.c

  6325  
  6326  void __paginginit free_area_init_node(int nid, unsigned long 
*zones_size,
  6327  unsigned long node_start_pfn, unsigned long 
*zholes_size)
  6328  {
  6329  pg_data_t *pgdat = NODE_DATA(nid);
  6330  unsigned long start_pfn = 0;
  6331  unsigned long end_pfn = 0;
  6332  
  6333  /* pg_data_t should be reset to zero when it's allocated */
  6334  WARN_ON(pgdat->nr_zones || pgdat->kswapd_classzone_idx);
  6335  
  6336  pgdat->node_id = nid;
  6337  pgdat->node_start_pfn = node_start_pfn;
  6338  pgdat->per_cpu_nodestats = NULL;
  6339  #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
  6340  get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
  6341  pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
  6342  (u64)start_pfn << PAGE_SHIFT,
  6343  end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);
  6344  #else
  6345  start_pfn = node_start_pfn;
  6346  #endif
  6347  calculate_node_totalpages(pgdat, start_pfn, end_pfn,
  6348zones_size, zholes_size);
  6349  
  6350  alloc_node_mem_map(pgdat);
  6351  
  6352  #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
  6353  /*
  6354   * We start only with one section of pages, more pages are 
added as
  6355   * needed until the rest of deferred pages are initialized.
  6356   */
> 6357  pgdat->static_init_pgcnt = min(PAGES_PER_SECTION,
  6358 pgdat->node_spanned_pages);
  6359  pgdat->first_deferred_pfn = ULONG_MAX;
  6360  #endif
  6361  free_area_init_core(pgdat);
  6362  }
  6363  

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


.config.gz
Description: application/gzip


Re: [PATCH v2 1/1] mm: initialize pages on demand during boot

2018-02-09 Thread kbuild test robot
Hi Pavel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[also build test ERROR on next-20180209]
[cannot apply to v4.15]
[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/Pavel-Tatashin/mm-initialize-pages-on-demand-during-boot/20180210-125104
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x017-201805 (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=x86_64 

All errors (new ones prefixed by >>):

   mm/page_alloc.c: In function 'deferred_grow_zone':
>> mm/page_alloc.c:1590:18: error: 'struct zone' has no member named 'node'; 
>> did you mean 'name'?
 int nid = zone->node;
 ^~~~
 name

vim +1590 mm/page_alloc.c

  1578  
  1579  /*
  1580   * If this zone has deferred pages, try to grow it by initializing 
enough
  1581   * deferred pages to satisfy the allocation specified by order, rounded 
up to
  1582   * the nearest PAGES_PER_SECTION boundary.  So we're adding memory in 
increments
  1583   * of SECTION_SIZE bytes by initializing struct pages in increments of
  1584   * PAGES_PER_SECTION * sizeof(struct page) bytes.
  1585   */
  1586  static noinline bool __init
  1587  deferred_grow_zone(struct zone *zone, unsigned int order)
  1588  {
  1589  int zid = zone_idx(zone);
> 1590  int nid = zone->node;
  1591  pg_data_t *pgdat = NODE_DATA(nid);
  1592  unsigned long nr_pages_needed = ALIGN(1 << order, 
PAGES_PER_SECTION);
  1593  unsigned long nr_pages = 0;
  1594  unsigned long first_init_pfn, first_deferred_pfn, spfn, epfn, t;
  1595  phys_addr_t spa, epa;
  1596  u64 i;
  1597  
  1598  /* Only the last zone may have deferred pages */
  1599  if (zone_end_pfn(zone) != pgdat_end_pfn(pgdat))
  1600  return false;
  1601  
  1602  first_deferred_pfn = READ_ONCE(pgdat->first_deferred_pfn);
  1603  first_init_pfn = max(zone->zone_start_pfn, first_deferred_pfn);
  1604  
  1605  if (first_init_pfn >= pgdat_end_pfn(pgdat))
  1606  return false;
  1607  
  1608  spin_lock(&deferred_zone_grow_lock);
  1609  /*
  1610   * Bail if we raced with another thread that disabled on demand
  1611   * initialization.
  1612   */
  1613  if (!static_branch_unlikely(&deferred_pages)) {
  1614  spin_unlock(&deferred_zone_grow_lock);
  1615  return false;
  1616  }
  1617  
  1618  for_each_free_mem_range(i, nid, MEMBLOCK_NONE, &spa, &epa, 
NULL) {
  1619  spfn = max_t(unsigned long, first_init_pfn, 
PFN_UP(spa));
  1620  epfn = min_t(unsigned long, zone_end_pfn(zone), 
PFN_DOWN(epa));
  1621  
  1622  while (spfn < epfn && nr_pages < nr_pages_needed) {
  1623  t = ALIGN(spfn + PAGES_PER_SECTION, 
PAGES_PER_SECTION);
  1624  first_deferred_pfn = min(t, epfn);
  1625  nr_pages += deferred_init_pages(nid, zid, spfn,
  1626  
first_deferred_pfn);
  1627  spfn = first_deferred_pfn;
  1628  }
  1629  
  1630  if (nr_pages >= nr_pages_needed)
  1631  break;
  1632  }
  1633  
  1634  for_each_free_mem_range(i, nid, MEMBLOCK_NONE, &spa, &epa, 
NULL) {
  1635  spfn = max_t(unsigned long, first_init_pfn, 
PFN_UP(spa));
  1636  epfn = min_t(unsigned long, first_deferred_pfn, 
PFN_DOWN(epa));
  1637  deferred_free_pages(nid, zid, spfn, epfn);
  1638  
  1639  if (first_deferred_pfn == epfn)
  1640  break;
  1641  }
  1642  WRITE_ONCE(pgdat->first_deferred_pfn, first_deferred_pfn);
  1643  spin_unlock(&deferred_zone_grow_lock);
  1644  
  1645  return nr_pages >= nr_pages_needed;
  1646  }
  1647  

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


.config.gz
Description: application/gzip


[PATCH RFC v5] f2fs: flush cp pack except cp pack 2 page at first

2018-02-09 Thread Gao Xiang
Previously, we attempt to flush the whole cp pack in a single bio,
however, when suddenly powering off at this time, we could get into
an extreme scenario that cp pack 1 page and cp pack 2 page are updated
and latest, but payload or current summaries are still partially
outdated. (see reliable write in the UFS specification)

This patch submits the whole cp pack except cp pack 2 page at first,
and then writes the cp pack 2 page with an extra independent
bio with pre-io barrier.

Signed-off-by: Gao Xiang 
Reviewed-by: Chao Yu 
---
Change log from v4:
  - remove redundant "filemap_fdatawait_range"
  - filemap_fdatawait_range(NODE_MAPPING(sbi), 0, LLONG_MAX);
  - filemap_fdatawait_range(META_MAPPING(sbi), 0, LLONG_MAX);
  - move f2fs_flush_device_cache to a more suitable position
  - wait_on_all_pages_writeback after commit_checkpoint
  - since we remove lots of redundant code, I think it's acceptable
  - and it will ensure one checkpoint safety.
Change log from v3:
  - further review comments are applied from Jaegeuk and Chao
  - Tested on this patch (without multiple-device): mount, boot Android with 
f2fs userdata and make fragment
  - If any problem with this patch or I miss something, please kindly share 
your comments, thanks :)
Change log from v2:
  - Apply the review comments from Chao
Change log from v1:
  - Apply the review comments from Chao
  - time data from "finish block_ops" to " finish checkpoint" (tested on ARM64 
with TOSHIBA 128GB UFS):
 Before patch: 0.002273  0.001973  0.002789  0.005159  0.002050
 After patch: 0.002502  0.001624  0.002487  0.003049  0.002696

 fs/f2fs/checkpoint.c | 69 ++--
 1 file changed, 46 insertions(+), 23 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 512dca8..4e352cf 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1162,6 +1162,39 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, 
struct cp_control *cpc)
spin_unlock_irqrestore(&sbi->cp_lock, flags);
 }
 
+static void commit_checkpoint(struct f2fs_sb_info *sbi,
+   void *src, block_t blk_addr)
+{
+   struct writeback_control wbc = {
+   .for_reclaim = 0,
+   };
+
+   /*
+* pagevec_lookup_tag and lock_page again will take
+* some extra time. Therefore, update_meta_pages and
+* sync_meta_pages are combined in this function.
+*/
+   struct page *page = grab_meta_page(sbi, blk_addr);
+   int err;
+
+   memcpy(page_address(page), src, PAGE_SIZE);
+   set_page_dirty(page);
+
+   f2fs_wait_on_page_writeback(page, META, true);
+   f2fs_bug_on(sbi, PageWriteback(page));
+   if (unlikely(!clear_page_dirty_for_io(page)))
+   f2fs_bug_on(sbi, 1);
+
+   /* writeout cp pack 2 page */
+   err = __f2fs_write_meta_page(page, &wbc, FS_CP_META_IO);
+   f2fs_bug_on(sbi, err);
+
+   f2fs_put_page(page, 0);
+
+   /* submit checkpoint (with barrier if NOBARRIER is not set) */
+   f2fs_submit_merged_write(sbi, META_FLUSH);
+}
+
 static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 {
struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
@@ -1264,16 +1297,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, 
struct cp_control *cpc)
}
}
 
-   /* need to wait for end_io results */
-   wait_on_all_pages_writeback(sbi);
-   if (unlikely(f2fs_cp_error(sbi)))
-   return -EIO;
-
-   /* flush all device cache */
-   err = f2fs_flush_device_cache(sbi);
-   if (err)
-   return err;
-
/* write out checkpoint buffer at block 0 */
update_meta_page(sbi, ckpt, start_blk++);
 
@@ -1301,26 +1324,26 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, 
struct cp_control *cpc)
start_blk += NR_CURSEG_NODE_TYPE;
}
 
-   /* writeout checkpoint block */
-   update_meta_page(sbi, ckpt, start_blk);
+   /* update user_block_counts */
+   sbi->last_valid_block_count = sbi->total_valid_block_count;
+   percpu_counter_set(&sbi->alloc_valid_block_count, 0);
 
-   /* wait for previous submitted node/meta pages writeback */
+   /* Here, we have one bio having CP pack except cp pack 2 page */
+   sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);
+
+   /* wait for previous submitted meta pages writeback */
wait_on_all_pages_writeback(sbi);
 
if (unlikely(f2fs_cp_error(sbi)))
return -EIO;
 
-   filemap_fdatawait_range(NODE_MAPPING(sbi), 0, LLONG_MAX);
-   filemap_fdatawait_range(META_MAPPING(sbi), 0, LLONG_MAX);
-
-   /* update user_block_counts */
-   sbi->last_valid_block_count = sbi->total_valid_block_count;
-   percpu_counter_set(&sbi->alloc_valid_block_count, 0);
-
-   /* Here, we only have one bio having CP pack */
-   sync_meta_pages(sbi, META_FLUSH, LONG_MAX, FS_CP_META_IO);
+  

[PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured

2018-02-09 Thread Sukadev Bhattiprolu
When VAS is not configured in the system, make sure to remove
the VAS debugfs directory and unregister the platform driver.

Signed-off-by: Sukadev Bhattiprolu 
---
 arch/powerpc/platforms/powernv/vas-debug.c | 5 +
 arch/powerpc/platforms/powernv/vas.c   | 5 -
 arch/powerpc/platforms/powernv/vas.h   | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/vas-debug.c 
b/arch/powerpc/platforms/powernv/vas-debug.c
index b4de4c6..e6e4067 100644
--- a/arch/powerpc/platforms/powernv/vas-debug.c
+++ b/arch/powerpc/platforms/powernv/vas-debug.c
@@ -207,3 +207,8 @@ void vas_init_dbgdir(void)
if (IS_ERR(vas_debugfs))
vas_debugfs = NULL;
 }
+
+void vas_cleanup_dbgdir(void)
+{
+   debugfs_remove_recursive(vas_debugfs);
+}
diff --git a/arch/powerpc/platforms/powernv/vas.c 
b/arch/powerpc/platforms/powernv/vas.c
index aebbe95..f83e27d8 100644
--- a/arch/powerpc/platforms/powernv/vas.c
+++ b/arch/powerpc/platforms/powernv/vas.c
@@ -169,8 +169,11 @@ static int __init vas_init(void)
found++;
}
 
-   if (!found)
+   if (!found) {
+   platform_driver_unregister(&vas_driver);
+   vas_cleanup_dbgdir();
return -ENODEV;
+   }
 
pr_devel("Found %d instances\n", found);
 
diff --git a/arch/powerpc/platforms/powernv/vas.h 
b/arch/powerpc/platforms/powernv/vas.h
index ae0100f..2645613 100644
--- a/arch/powerpc/platforms/powernv/vas.h
+++ b/arch/powerpc/platforms/powernv/vas.h
@@ -406,6 +406,7 @@ extern struct mutex vas_mutex;
 
 extern struct vas_instance *find_vas_instance(int vasid);
 extern void vas_init_dbgdir(void);
+extern void vas_cleanup_dbgdir(void);
 extern void vas_instance_init_dbgdir(struct vas_instance *vinst);
 extern void vas_window_init_dbgdir(struct vas_window *win);
 extern void vas_window_free_dbgdir(struct vas_window *win);
-- 
2.7.4



[PATCH 4/4] powerpc/vas: Add a couple of trace points

2018-02-09 Thread Sukadev Bhattiprolu
Add a couple of trace points in the VAS driver

Signed-off-by: Sukadev Bhattiprolu 
---
Changelog [v2]
- Make TRACE_INCLUDE_PATH relative to 
---
 arch/powerpc/platforms/powernv/vas-trace.h  | 112 
 arch/powerpc/platforms/powernv/vas-window.c |   9 +++
 2 files changed, 121 insertions(+)
 create mode 100644 arch/powerpc/platforms/powernv/vas-trace.h

diff --git a/arch/powerpc/platforms/powernv/vas-trace.h 
b/arch/powerpc/platforms/powernv/vas-trace.h
new file mode 100644
index 000..939d85d
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/vas-trace.h
@@ -0,0 +1,112 @@
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM   vas
+
+#if !defined(_VAS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+
+#define _VAS_TRACE_H
+#include 
+#include 
+#include 
+
+TRACE_EVENT(   vas_rx_win_open,
+
+   TP_PROTO(struct task_struct *tsk,
+int vasid,
+int cop,
+struct vas_rx_win_attr *rxattr),
+
+   TP_ARGS(tsk, vasid, cop, rxattr),
+
+   TP_STRUCT__entry(
+   __field(struct task_struct *, tsk)
+   __field(int, pid)
+   __field(int, cop)
+   __field(int, vasid)
+   __field(struct vas_rx_win_attr *, rxattr)
+   __field(int, lnotify_lpid)
+   __field(int, lnotify_pid)
+   __field(int, lnotify_tid)
+   ),
+
+   TP_fast_assign(
+   __entry->pid = tsk->pid;
+   __entry->vasid = vasid;
+   __entry->cop = cop;
+   __entry->lnotify_lpid = rxattr->lnotify_lpid;
+   __entry->lnotify_pid = rxattr->lnotify_pid;
+   __entry->lnotify_tid = rxattr->lnotify_tid;
+   ),
+
+   TP_printk("pid=%d, vasid=%d, cop=%d, lpid=%d, pid=%d, tid=%d",
+   __entry->pid, __entry->vasid, __entry->cop,
+   __entry->lnotify_lpid, __entry->lnotify_pid,
+   __entry->lnotify_tid)
+);
+
+TRACE_EVENT(   vas_tx_win_open,
+
+   TP_PROTO(struct task_struct *tsk,
+int vasid,
+int cop,
+struct vas_tx_win_attr *txattr),
+
+   TP_ARGS(tsk, vasid, cop, txattr),
+
+   TP_STRUCT__entry(
+   __field(struct task_struct *, tsk)
+   __field(int, pid)
+   __field(int, cop)
+   __field(int, vasid)
+   __field(struct vas_tx_win_attr *, txattr)
+   __field(int, lpid)
+   __field(int, pidr)
+   ),
+
+   TP_fast_assign(
+   __entry->pid = tsk->pid;
+   __entry->vasid = vasid;
+   __entry->cop = cop;
+   __entry->lpid = txattr->lpid;
+   __entry->pidr = txattr->pidr;
+   ),
+
+   TP_printk("pid=%d, vasid=%d, cop=%d, lpid=%d, pidr=%d",
+   __entry->pid, __entry->vasid, __entry->cop,
+   __entry->lpid, __entry->pidr)
+);
+
+TRACE_EVENT(   vas_paste_crb,
+
+   TP_PROTO(struct task_struct *tsk,
+   struct vas_window *win),
+
+   TP_ARGS(tsk, win),
+
+   TP_STRUCT__entry(
+   __field(struct task_struct *, tsk)
+   __field(struct vas_window *, win)
+   __field(int, pid)
+   __field(int, vasid)
+   __field(int, winid)
+   __field(unsigned long, paste_kaddr)
+   ),
+
+   TP_fast_assign(
+   __entry->pid = tsk->pid;
+   __entry->vasid = win->vinst->vas_id;
+   __entry->winid = win->winid;
+   __entry->paste_kaddr = (unsigned long)win->paste_kaddr
+   ),
+
+   TP_printk("pid=%d, vasid=%d, winid=%d, paste_kaddr=0x%016lx\n",
+   __entry->pid, __entry->vasid, __entry->winid,
+   __entry->paste_kaddr)
+);
+
+#endif /* _VAS_TRACE_H */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH ../../arch/powerpc/platforms/powernv
+#define TRACE_INCLUDE_FILE vas-trace
+#include 
diff --git a/arch/powerpc/platforms/powernv/vas-window.c 
b/arch/powerpc/platforms/powernv/vas-window.c
index 2b3eb01..6b2de9e 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -21,6 +21,9 @@
 #include "vas.h"
 #include "copy-paste.h"
 
+#define CREATE_TRACE_POINTS
+#include "vas-trace.h"
+
 /*
  * Compute the paste address region for the window @window using the
  * ->paste_base_addr an

[PATCH RESEND 3/4] powerpc/vas: Remove a stray line in Makefile

2018-02-09 Thread Sukadev Bhattiprolu
Remove a bogus line from arch/powerpc/platforms/powernv/Makefile that
was added by commit ece4e51 ("powerpc/vas: Export HVWC to debugfs").

Signed-off-by: Sukadev Bhattiprolu 
---
 arch/powerpc/platforms/powernv/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/Makefile 
b/arch/powerpc/platforms/powernv/Makefile
index 6c9d519..703a350 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -16,5 +16,4 @@ obj-$(CONFIG_OPAL_PRD)+= opal-prd.o
 obj-$(CONFIG_PERF_EVENTS) += opal-imc.o
 obj-$(CONFIG_PPC_MEMTRACE) += memtrace.o
 obj-$(CONFIG_PPC_VAS)  += vas.o vas-window.o vas-debug.o
-obj-$(CONFIG_PPC_FTW)  += nx-ftw.o
 obj-$(CONFIG_OCXL_BASE)+= ocxl.o
-- 
2.7.4



[PATCH RESEND 1/4] powerpc/vas: Fix order of cleanup in debugfs dir

2018-02-09 Thread Sukadev Bhattiprolu
Fix the order of cleanup to ensure we free the name buffer in case
of an error creating 'hvwc' or 'info' files.

Signed-off-by: Sukadev Bhattiprolu 
---
 arch/powerpc/platforms/powernv/vas-debug.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/vas-debug.c 
b/arch/powerpc/platforms/powernv/vas-debug.c
index ca22f1e..b4de4c6 100644
--- a/arch/powerpc/platforms/powernv/vas-debug.c
+++ b/arch/powerpc/platforms/powernv/vas-debug.c
@@ -166,13 +166,13 @@ void vas_window_init_dbgdir(struct vas_window *window)
 
return;
 
-free_name:
-   kfree(window->dbgname);
-   window->dbgname = NULL;
-
 remove_dir:
debugfs_remove_recursive(window->dbgdir);
window->dbgdir = NULL;
+
+free_name:
+   kfree(window->dbgname);
+   window->dbgname = NULL;
 }
 
 void vas_instance_init_dbgdir(struct vas_instance *vinst)
-- 
2.7.4



Re: [PATCH 5/6] Documentation for Pmalloc

2018-02-09 Thread Matthew Wilcox
On Fri, Feb 02, 2018 at 05:56:29PM +0200, Igor Stoppa wrote:
> But what is the license for the documentation? It's not code, so GPL
> seems wrong. Creative commons?

I've done this as the first line of my new documentation files:

.. SPDX-License-Identifier: CC-BY-SA-4.0

I think this is the CC license that's closest in spirit to the GPL without
the unintended consequences of the GPL when used on documentation.  The
GFDL seems to be out of favour these days.


Re: possible deadlock in get_user_pages_unlocked

2018-02-09 Thread Eric Biggers
Hi Al,

On Sat, Feb 10, 2018 at 01:36:40AM +, Al Viro wrote:
> On Fri, Feb 02, 2018 at 09:57:27AM +0100, Dmitry Vyukov wrote:
> 
> > syzbot tests for up to 5 minutes. However, if there is a race involved
> > then you may need more time because the crash is probabilistic.
> > But from what I see most of the time, if one can't reproduce it
> > easily, it's usually due to some differences in setup that just don't
> > allow the crash to happen at all.
> > FWIW syzbot re-runs each reproducer on a freshly booted dedicated VM
> > and what it provided is the kernel output it got during run of the
> > provided program. So we have reasonably high assurance that this
> > reproducer worked in at least one setup.
> 
> Could you guys check if the following fixes the reproducer?
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index 61015793f952..058a9a8e4e2e 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -861,6 +861,9 @@ static __always_inline long 
> __get_user_pages_locked(struct task_struct *tsk,
>   BUG_ON(*locked != 1);
>   }
>  
> + if (flags & FOLL_NOWAIT)
> + locked = NULL;
> +
>   if (pages)
>   flags |= FOLL_GET;
>  

Yes that fixes the reproducer for me.

- Eric


Re: [PATCH V2 0/6]nvme-pci: fixes on nvme_timeout and nvme_dev_disable

2018-02-09 Thread jianchao.wang
Hi Keith

On 02/10/2018 10:32 AM, jianchao.wang wrote:
> Hi Keith
> 
> Thanks for your kindly response here.
> That's really appreciated.
> 
> On 02/10/2018 01:12 AM, Keith Busch wrote:
>> On Fri, Feb 09, 2018 at 09:50:58AM +0800, jianchao.wang wrote:
>>>
>>> if we set NVME_REQ_CANCELLED and return BLK_EH_HANDLED as the RESETTING 
>>> case,
>>> nvme_reset_work will hang forever, because no one could complete the 
>>> entered requests.
>>
>> Except it's no longer in the "RESETTING" case since you added the
>> "CONNECTING" state, so that's already broken for other reasons...
>>
> 
> Yes, but as your patch, we have to fail the IOs and even kill the controller.
> In fact, up to nvme_wait_freeze in nvme_reset_work, the RECONNECTING state 
> has been completed.
> We even could say it is in LIVE state. Maybe we should recover the controller 
> again instead
> of fail the IOs and kill the controller.
> 
> On the other hand, can you share with me why we cannot use 
> blk_set_preempt_only to replace
> blk_freeze_queue ? we just want to gate the new bios out of 
> generic_make_request and we 
> needn't use the preempt requests.
> 
> Looking forward your advice and directive.

Avoid wait_freeze in nvme_reset_work should be a better way to fix this defect.

> 
> Thanks
> Jianchao


[GIT PULL] Kbuild updates for v4.16 (2nd round)

2018-02-09 Thread Masahiro Yamada
Hi Linus,

Here are a little more Kbuild updates (including Kconfig changes).
Please pull!


The following changes since commit 4bf772b14675411a69b3c807f73006de0fe4b649:

  Merge tag 'drm-for-v4.16' of
git://people.freedesktop.org/~airlied/linux (2018-02-01 17:48:47
-0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
tags/kbuild-v4.16-2

for you to fetch changes up to 523ca58b7db2e30e3c185a7927dd80a30c1bc743:

  kconfig: remove const qualifier from sym_expand_string_value()
(2018-02-10 11:31:49 +0900)


Kbuild updates for v4.16 (2nd)

Makefile changes:
- enable unused-variable warning that was wrongly disabled for clang

Kconfig changes:
- warn blank 'help' and fix existing instances
- fix 'choice' behavior to not write out invisible symbols
- fix misc weirdness

Coccinell changes:
- fix false positive of free after managed memory alloc detection
- improve performance of NULL dereference detection


Julia Lawall (2):
  coccinelle: devm_free: reduce false positives
  coccinelle: deref_null: avoid useless computation

Masahiro Yamada (8):
  kconfig: do not write choice values when their dependency becomes n
  kconfig: show '?' prompt even if no help text is available
  kconfig: remove 'config*' pattern from .gitignnore
  kconfig: remove check_stdin()
  kconfig: echo stdin to stdout if either is redirected
  kconfig: send error messages to stderr
  kconfig: add xrealloc() helper
  kconfig: remove const qualifier from sym_expand_string_value()

Sodagudi Prasad (1):
  kbuild: clang: disable unused variable warnings only when constant

Ulf Magnusson (10):
  video: fbdev: kconfig: Remove blank help text
  mmc: kconfig: Remove blank help text
  Staging: rtl8192u: kconfig: Remove blank help text
  Staging: rtl8192e: kconfig: Remove blank help text
  lib/Kconfig.debug: Remove blank help text
  MIPS: BCM63XX: kconfig: Remove blank help text
  MIPS: kconfig: Remove blank help text
  arm: vt8500: kconfig: Remove blank help text
  nios2: kconfig: Remove blank help text
  kconfig: Warn if help text is blank

 Makefile  |  3 +-
 arch/arm/mach-vt8500/Kconfig  |  1 -
 arch/mips/Kconfig |  1 -
 arch/mips/bcm63xx/boards/Kconfig  |  1 -
 arch/nios2/Kconfig|  1 -
 drivers/mmc/host/Kconfig  |  1 -
 drivers/staging/rtl8192e/rtl8192e/Kconfig |  1 -
 drivers/staging/rtl8192u/Kconfig  |  1 -
 drivers/video/fbdev/Kconfig   |  1 -
 lib/Kconfig.debug |  1 -
 scripts/coccinelle/free/devm_free.cocci   | 55
+-
 scripts/coccinelle/null/deref_null.cocci  |  6 ++--
 scripts/kconfig/.gitignore|  1 -
 scripts/kconfig/conf.c| 40 -
 scripts/kconfig/confdata.c|  2 +-
 scripts/kconfig/expr.c|  4 +--
 scripts/kconfig/lkc.h |  1 +
 scripts/kconfig/lkc_proto.h   |  2 +-
 scripts/kconfig/nconf.gui.c   |  3 +-
 scripts/kconfig/symbol.c  | 22 +++---
 scripts/kconfig/util.c| 15 --
 scripts/kconfig/zconf.l   | 29 ++
 scripts/kconfig/zconf.y   |  6 
 23 files changed, 121 insertions(+), 77 deletions(-)


-- 
Best Regards
Masahiro Yamada


Re: [PATCH v2] tools/memory-model: Make compat with herd7 7.47 ("-" -> "_")

2018-02-09 Thread Akira Yokosawa
On 2018/02/10 10:07, Paul E. McKenney wrote:
> On Sat, Feb 10, 2018 at 08:46:25AM +0900, Akira Yokosawa wrote:
>> >From 7c1f497a9a51e8db1a94c8a7ef0b74b235aaab88 Mon Sep 17 00:00:00 2001
>> From: Akira Yokosawa 
>> Date: Fri, 9 Feb 2018 04:51:05 -0800
>> Subject: [PATCH v2] tools/memory-model: Make compat with herd7 7.47 ("-" -> 
>> "_")
>>
>> As of herd7 7.47, these '-'s are not permitted and end up in
>> errors such as:
>>
>> File "./linux-kernel.def", line 44, characters 29-30:
>> unexpected '-' (in macros)
>>
>> Partial revert of commit 2d5fba7782d6 ("linux-kernel*: Make RCU
>> identifiers match ASPLOS paper") in the repository at
>> https://github.com/aparri/memory-model can restore the compatibility
>> with herd7 7.47.
>>
>> Reported-by: Patrick Bellasi 
>> Suggested-by: Andrea Parri 
>> Signed-off-by: Akira Yokosawa 
>> ---
>> Paul,
>>
>> FWIW, this is a squashed version relative to patch 07/10 in the RFC series.
> 
> Thank you, Akira!
> 
> I am going to hold off on this for a bit to see if we can instead get
> a new release of herd7, but if we can't. this might well be a very good
> way to go.

Fair enough.

   Thanks, Akira

> 
>   Thanx, Paul
> 
>> Thanks, Akira
>> --
>>  tools/memory-model/linux-kernel.bell | 14 +++---
>>  tools/memory-model/linux-kernel.cat  |  2 +-
>>  tools/memory-model/linux-kernel.def  |  8 
>>  3 files changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/tools/memory-model/linux-kernel.bell 
>> b/tools/memory-model/linux-kernel.bell
>> index b984bbd..436791b 100644
>> --- a/tools/memory-model/linux-kernel.bell
>> +++ b/tools/memory-model/linux-kernel.bell
>> @@ -25,9 +25,9 @@ enum Barriers = 'wmb (*smp_wmb*) ||
>>  'rmb (*smp_rmb*) ||
>>  'mb (*smp_mb*) ||
>>  'rb_dep (*smp_read_barrier_depends*) ||
>> -'rcu-lock (*rcu_read_lock*)  ||
>> -'rcu-unlock (*rcu_read_unlock*) ||
>> -'sync-rcu (*synchronize_rcu*) ||
>> +'rcu_lock (*rcu_read_lock*)  ||
>> +'rcu_unlock (*rcu_read_unlock*) ||
>> +'sync_rcu (*synchronize_rcu*) ||
>>  'before_atomic (*smp_mb__before_atomic*) ||
>>  'after_atomic (*smp_mb__after_atomic*) ||
>>  'after_spinlock (*smp_mb__after_spinlock*)
>> @@ -35,8 +35,8 @@ instructions F[Barriers]
>>
>>  (* Compute matching pairs of nested Rcu-lock and Rcu-unlock *)
>>  let matched = let rec
>> -unmatched-locks = Rcu-lock \ domain(matched)
>> -and unmatched-unlocks = Rcu-unlock \ range(matched)
>> +unmatched-locks = Rcu_lock \ domain(matched)
>> +and unmatched-unlocks = Rcu_unlock \ range(matched)
>>  and unmatched = unmatched-locks | unmatched-unlocks
>>  and unmatched-po = [unmatched] ; po ; [unmatched]
>>  and unmatched-locks-to-unlocks =
>> @@ -46,8 +46,8 @@ let matched = let rec
>>  in matched
>>
>>  (* Validate nesting *)
>> -flag ~empty Rcu-lock \ domain(matched) as unbalanced-rcu-locking
>> -flag ~empty Rcu-unlock \ range(matched) as unbalanced-rcu-locking
>> +flag ~empty Rcu_lock \ domain(matched) as unbalanced-rcu-locking
>> +flag ~empty Rcu_unlock \ range(matched) as unbalanced-rcu-locking
>>
>>  (* Outermost level of nesting only *)
>>  let crit = matched \ (po^-1 ; matched ; po^-1)
>> diff --git a/tools/memory-model/linux-kernel.cat 
>> b/tools/memory-model/linux-kernel.cat
>> index babe2b3..d0085d5 100644
>> --- a/tools/memory-model/linux-kernel.cat
>> +++ b/tools/memory-model/linux-kernel.cat
>> @@ -32,7 +32,7 @@ let mb = ([M] ; fencerel(Mb) ; [M]) |
>>  ([M] ; fencerel(Before_atomic) ; [RMW] ; po? ; [M]) |
>>  ([M] ; po? ; [RMW] ; fencerel(After_atomic) ; [M]) |
>>  ([M] ; po? ; [LKW] ; fencerel(After_spinlock) ; [M])
>> -let gp = po ; [Sync-rcu] ; po?
>> +let gp = po ; [Sync_rcu] ; po?
>>
>>  let strong-fence = mb | gp
>>
>> diff --git a/tools/memory-model/linux-kernel.def 
>> b/tools/memory-model/linux-kernel.def
>> index a397387..fc08371 100644
>> --- a/tools/memory-model/linux-kernel.def
>> +++ b/tools/memory-model/linux-kernel.def
>> @@ -41,10 +41,10 @@ spin_unlock(X) { __unlock(X) ; }
>>  spin_trylock(X) __trylock(X)
>>
>>  // RCU
>> -rcu_read_lock() { __fence{rcu-lock}; }
>> -rcu_read_unlock() { __fence{rcu-unlock};}
>> -synchronize_rcu() { __fence{sync-rcu}; }
>> -synchronize_rcu_expedited() { __fence{sync-rcu}; }
>> +rcu_read_lock() { __fence{rcu_lock}; }
>> +rcu_read_unlock() { __fence{rcu_unlock};}
>> +synchronize_rcu() { __fence{sync_rcu}; }
>> +synchronize_rcu_expedited() { __fence{sync_rcu}; }
>>
>>  // Atomic
>>  atomic_read(X) READ_ONCE(*X)
>> -- 
>> 2.7.4
>>
>>
> 



Re: [PATCH 2/2] f2fs: support {d,id,did,x}node checksum

2018-02-09 Thread Chao Yu
On 2018/2/10 9:41, Jaegeuk Kim wrote:
> On 02/01, Chao Yu wrote:
>>
>>
>> On 2018/2/1 6:15, Jaegeuk Kim wrote:
>>> On 01/31, Chao Yu wrote:
 On 2018/1/31 10:02, Jaegeuk Kim wrote:
> What if we want to add more entries in addition to node_checksum? Do we 
> have
> to add a new feature flag at every time? How about adding a layout value 
> instead

 Hmm.. for previous implementation, IMO, we'd better add a new feature flag 
 at
 every time, otherwise, w/ extra_nsize only, in current image, we can know a
 valid range of extended area in node block, but we don't know which
 fields/features are valid/enabled or not.

 One more thing is that if we can add one feature flag for each field, we 
 got one
 more chance to disable it dynamically.

> of extra_nsize? For example, layout #1 means node_checksum with 
> extra_nsize=X?
>
>
> What does 1017 mean? We need to make this structure more flexibly for new

 Yes, using raw 1017 is not appropriate here.

> entries. Like this?
>   union {
>   struct node_v1;
>   struct node_v2;
>   struct node_v3;
>   ...
>   struct direct_node dn;
>   struct indirect_node in;
>   };
>   };
>
>   struct node_v1 {
>   __le32 data[DEF_ADDRS_PER_BLOCK - V1_NSIZE=1];
>   __le32 node_checksum;
>   }
>
>   struct node_v2 {
>   __le32 data[DEF_ADDRS_PER_BLOCK - V2_NSIZE=500];

 Hmm.. If we only need to add one more 4 bytes field in struct node_v2, but
 V2_NSIZE is defined as fixed 500, there must be 492 bytes wasted.

 Or we can define V2_NSIZE as 8, but if there comes more and more extended
 fields, node version count can be a large number, it results in complicated
 version recognization and handling.

 One more question is how can we control which fields are valid or not in
 comp[Vx_NSIZE]?


 Anyway, what I'm thinking is maybe we can restructure layout of node block 
 like
 the one used by f2fs_inode:

 struct f2fs_node {
union {
struct f2fs_inode i;
union {
struct {
__le32 node_checksum;
__le32 feature_field_1;
__le32 feature_field_2;

__le32 addr[];

};
struct direct_node dn;
struct indirect_node in;
};
};
struct node_footer footer;
 } __packed;

 Moving all extended fields to the head of f2fs_node, so we don't have to 
 use
 macro to indicate actual size of addr.
>>>
>>> Thinking what'd be the best way. My concern is, once getting more entries, 
>>> we
>>
>> OK, I think we need more discussion.. ;)
>>
>>> can't set each of features individually. Like the second entry should have
>>
>> Oh, that will be hard. If we have to avoid that, we have to tag in somewhere
>> e.g. f2fs_inode::i_flags2 to indicate which new field in f2fs_node is valid, 
>> for
>> example:
>>
>> #define F2FS_NODE_CHECKSUM   0x0001
>> #define F2FS_NODE_FIELD1 0x0002
>> #define F2FS_NODE_FIELD2 0x0004
>>
>>  union {
>>  struct {
>>  __le32 node_checksum;
>>  __le32 field_1;
>>  __le32 field_2;
>>  
>>  __le32 addr[];
>>  };
>>  struct direct_node dn;
>>  struct indirect_node in;
>>  };
>>
>> f2fs_inode::i_flags2 = F2FS_NODE_CHECKSUM | F2FS_NODE_FIELD1
>> indicates that f2fs_node::node_checksum and f2fs_node::field_1 are valid;
>>
>> f2fs_inode::i_flags2 = F2FS_NODE_FIELD1 | F2FS_NODE_FIELD2
>> indicates that f2fs_node::field_1 and f2fs_node::field_2 are valid.
> 
> So, that's why I thought we may need a sort of each formats.

Hmm.. if we have two new added fields, there are (2 << 2) combinations
of all formats, as:

struct original {
__le32 data[DEF_ADDRS_PER_BLOCK];
}

struct node_v1 {
__le32 data[DEF_ADDRS_PER_BLOCK - V1_NSIZE=1];
__le32 field_1;
}

struct node_v2 {
__le32 data[DEF_ADDRS_PER_BLOCK - V2_NSIZE=1];
__le32 field_2;
}

struct node_v2 {
__le32 data[DEF_ADDRS_PER_BLOCK - V3_NSIZE=2];
__le32 field_1;
__le32 field_2;
}

If we add more new fields, the node version will increase sharply due
to there is (n << 2) combination with n fields. Right? Any thoughts to
reduce maintaining overhead on those node versions structures?

Thanks,

> 
>>
>> Any thoughts?
>>
>> Thanks,
>>
>>> enabled node_checksum, which we may not want to do.
>>>

 Th

[PATCH V2 0/3] audit: speed up audit syscall entry

2018-02-09 Thread Richard Guy Briggs
These fixes should speed up audit syscall entry by doing away with the
audit entry filter check, moving up the valid connection check before
filling in the context and not caring if there is a bug when audit is
disabled.

Richard Guy Briggs (3):
  audit: deprecate the AUDIT_FILTER_ENTRY filter
  audit: bail ASAP on syscall entry
  audit: bail before bug check if audit disabled

 kernel/auditfilter.c |  4 ++--
 kernel/auditsc.c | 22 ++
 2 files changed, 12 insertions(+), 14 deletions(-)

-- 
1.8.3.1



[PATCH V2 1/3] audit: deprecate the AUDIT_FILTER_ENTRY filter

2018-02-09 Thread Richard Guy Briggs
The audit entry filter has been long deprecated with userspace support
finally removed in audit-v2.6.7 and plans to remove kernel support have
existed since kernel-v2.6.31.
Remove it.

Passes audit-testsuite.

See: https://github.com/linux-audit/audit-kernel/issues/6
Signed-off-by: Richard Guy Briggs 
---
 kernel/auditfilter.c | 4 ++--
 kernel/auditsc.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 4a1758a..1bbf5de 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -258,8 +258,8 @@ static inline struct audit_entry 
*audit_to_entry_common(struct audit_rule_data *
goto exit_err;
 #ifdef CONFIG_AUDITSYSCALL
case AUDIT_FILTER_ENTRY:
-   if (rule->action == AUDIT_ALWAYS)
-   goto exit_err;
+   pr_err("AUDIT_FILTER_ENTRY is deprecated\n");
+   goto exit_err;
case AUDIT_FILTER_EXIT:
case AUDIT_FILTER_TASK:
 #endif
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index e80459f..9348302 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1530,7 +1530,8 @@ void __audit_syscall_entry(int major, unsigned long a1, 
unsigned long a2,
context->dummy = !audit_n_rules;
if (!context->dummy && state == AUDIT_BUILD_CONTEXT) {
context->prio = 0;
-   state = audit_filter_syscall(tsk, context, 
&audit_filter_list[AUDIT_FILTER_ENTRY]);
+   if (auditd_test_task(tsk))
+   return;
}
if (state == AUDIT_DISABLED)
return;
-- 
1.8.3.1



[PATCH V2 3/3] audit: bail before bug check if audit disabled

2018-02-09 Thread Richard Guy Briggs
If audit is disabled, who cares if there is a bug indicating syscall in
process or names already recorded.  Bail immediately on audit disabled.

Signed-off-by: Richard Guy Briggs 
---
 kernel/auditsc.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index bc534bf..4e0a4ac 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1511,14 +1511,11 @@ void __audit_syscall_entry(int major, unsigned long a1, 
unsigned long a2,
struct audit_context *context = tsk->audit_context;
enum audit_state state;
 
-   if (!context)
+   if (!audit_enabled || !context)
return;
 
BUG_ON(context->in_syscall || context->name_count);
 
-   if (!audit_enabled)
-   return;
-
state = context->state;
if (state == AUDIT_DISABLED)
return;
-- 
1.8.3.1



[PATCH V2 2/3] audit: bail ASAP on syscall entry

2018-02-09 Thread Richard Guy Briggs
Since removing the audit entry filter, test for early return before
setting up any context state.

Signed-off-by: Richard Guy Briggs 
---
 kernel/auditsc.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 9348302..bc534bf 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1519,23 +1519,23 @@ void __audit_syscall_entry(int major, unsigned long a1, 
unsigned long a2,
if (!audit_enabled)
return;
 
-   context->arch   = syscall_get_arch();
-   context->major  = major;
-   context->argv[0]= a1;
-   context->argv[1]= a2;
-   context->argv[2]= a3;
-   context->argv[3]= a4;
-
state = context->state;
+   if (state == AUDIT_DISABLED)
+   return;
+
context->dummy = !audit_n_rules;
if (!context->dummy && state == AUDIT_BUILD_CONTEXT) {
context->prio = 0;
if (auditd_test_task(tsk))
return;
}
-   if (state == AUDIT_DISABLED)
-   return;
 
+   context->arch   = syscall_get_arch();
+   context->major  = major;
+   context->argv[0]= a1;
+   context->argv[1]= a2;
+   context->argv[2]= a3;
+   context->argv[3]= a4;
context->serial = 0;
context->ctime = current_kernel_time64();
context->in_syscall = 1;
-- 
1.8.3.1



Re: [PATCH] tracing/power: Don't share template for cpu_idle and cpu_frequency

2018-02-09 Thread Steven Rostedt
On Sat, 10 Feb 2018 09:37:04 +0800
changbin...@intel.com wrote:

> From: Changbin Du 
> 
> The type of state is signed int, convert it to unsigned int looks weird.
> (-1 become 4294967295)
>932.123 power:cpu_idle:state=1 cpu_id=0)
>932.125 power:cpu_idle:state=4294967295 cpu_id=0)
>932.132 power:cpu_idle:state=1 cpu_id=0)
>932.133 power:cpu_idle:state=4294967295 cpu_id=0)
> 
> Similarly for cpu_frequency as "state=%lu cpu_id=%lu". User need to read
> the code to understand what 'state' means.
> 
> No functional change in this patch.

That's not true. You split a class into two TRACE_EVENTS. Each
TRACE_EVENT adds approximately 5k of code and data. A DEFINE_EVENT()
adds around 300 bytes. There's better ways to do this,

Please don't add this patch.

-- Steve

> 
> Signed-off-by: Changbin Du 
> ---
>  include/trace/events/power.h | 32 +++-
>  1 file changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/include/trace/events/power.h b/include/trace/events/power.h
> index 908977d..39bd6de 100644
> --- a/include/trace/events/power.h
> +++ b/include/trace/events/power.h
> @@ -12,14 +12,14 @@
>  
>  #define TPS(x)  tracepoint_string(x)
>  
> -DECLARE_EVENT_CLASS(cpu,
> +TRACE_EVENT(cpu_idle,
>  
> - TP_PROTO(unsigned int state, unsigned int cpu_id),
> + TP_PROTO(int state, unsigned int cpu_id),
>  
>   TP_ARGS(state, cpu_id),
>  
>   TP_STRUCT__entry(
> - __field(u32,state   )
> + __field(int,state   )
>   __field(u32,cpu_id  )
>   ),
>  
> @@ -28,17 +28,10 @@ DECLARE_EVENT_CLASS(cpu,
>   __entry->cpu_id = cpu_id;
>   ),
>  
> - TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
> + TP_printk("state=%d cpu_id=%lu", __entry->state,
> (unsigned long)__entry->cpu_id)
>  );
>  
> -DEFINE_EVENT(cpu, cpu_idle,
> -
> - TP_PROTO(unsigned int state, unsigned int cpu_id),
> -
> - TP_ARGS(state, cpu_id)
> -);
> -
>  TRACE_EVENT(powernv_throttle,
>  
>   TP_PROTO(int chip_id, const char *reason, int pmax),
> @@ -141,11 +134,24 @@ TRACE_EVENT(pstate_sample,
>   { PM_EVENT_RESTORE, "restore" }, \
>   { PM_EVENT_RECOVER, "recover" })
>  
> -DEFINE_EVENT(cpu, cpu_frequency,
> +TRACE_EVENT(cpu_frequency,
>  
>   TP_PROTO(unsigned int frequency, unsigned int cpu_id),
>  
> - TP_ARGS(frequency, cpu_id)
> + TP_ARGS(frequency, cpu_id),
> +
> + TP_STRUCT__entry(
> + __field(u32,frequency   )
> + __field(u32,cpu_id  )
> + ),
> +
> + TP_fast_assign(
> + __entry->frequency = frequency;
> + __entry->cpu_id = cpu_id;
> + ),
> +
> + TP_printk("frequency=%lu cpu_id=%lu", __entry->frequency,
> +   (unsigned long)__entry->cpu_id)
>  );
>  
>  TRACE_EVENT(device_pm_callback_start,



[PATCH v3 11/11] clk: actions: Add S900 SoC clock support

2018-02-09 Thread Manivannan Sadhasivam
Add Actions Semi S900 SoC clock support.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Kconfig|  10 +
 drivers/clk/actions/Makefile   |   3 +
 drivers/clk/actions/owl-s900.c | 666 +
 drivers/clk/actions/owl-s900.h |  61 
 4 files changed, 740 insertions(+)
 create mode 100644 drivers/clk/actions/owl-s900.c
 create mode 100644 drivers/clk/actions/owl-s900.h

diff --git a/drivers/clk/actions/Kconfig b/drivers/clk/actions/Kconfig
index 13a3e5083d43..7924a7f54229 100644
--- a/drivers/clk/actions/Kconfig
+++ b/drivers/clk/actions/Kconfig
@@ -2,3 +2,13 @@ config CLK_ACTIONS
bool "Clock driver for Actions Semi SoCs"
depends on ARCH_ACTIONS || COMPILE_TEST
default ARCH_ACTIONS
+
+if CLK_ACTIONS
+
+# SoC Drivers
+
+config CLK_OWL_S900
+   tristate "Support for the Actions Semi OWL S900 clocks"
+   depends on (ARM64 && ARCH_ACTIONS) || COMPILE_TEST
+   default ARM64 && ARCH_ACTIONS
+endif
diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 31b68eab9309..76e431434d10 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -7,3 +7,6 @@ clk-owl-y   += owl-divider.o
 clk-owl-y  += owl-factor.o
 clk-owl-y  += owl-composite.o
 clk-owl-y  += owl-pll.o
+
+# SoC support
+obj-$(CONFIG_CLK_OWL_S900) += owl-s900.o
diff --git a/drivers/clk/actions/owl-s900.c b/drivers/clk/actions/owl-s900.c
new file mode 100644
index ..d5b0fbf7fe7d
--- /dev/null
+++ b/drivers/clk/actions/owl-s900.c
@@ -0,0 +1,666 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL S900 SoC clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+#include 
+
+#include "owl-common.h"
+#include "owl-composite.h"
+#include "owl-divider.h"
+#include "owl-factor.h"
+#include "owl-gate.h"
+#include "owl-mux.h"
+#include "owl-pll.h"
+#include "owl-s900.h"
+
+#include 
+
+static struct clk_pll_table clk_audio_pll_table[] = {
+   {0, 45158400}, {1, 49152000},
+   {0, 0},
+};
+
+static struct clk_pll_table clk_edp_pll_table[] = {
+   {0, 81000}, {1, 135000}, {2, 27},
+   {0, 0},
+};
+
+/* pll clocks */
+static OWL_PLL_NO_PARENT(core_pll_clk, "core_pll_clk", CMU_COREPLL, 2400, 
9, 0, 8, 5, 107, NULL, CLK_IGNORE_UNUSED);
+static OWL_PLL_NO_PARENT(dev_pll_clk, "dev_pll_clk", CMU_DEVPLL, 600, 8, 
0, 8, 20, 180, NULL, CLK_IGNORE_UNUSED);
+static OWL_PLL_NO_PARENT(ddr_pll_clk, "ddr_pll_clk", CMU_DDRPLL, 2400, 8, 
0, 8, 5, 45, NULL, CLK_IGNORE_UNUSED);
+static OWL_PLL_NO_PARENT(nand_pll_clk, "nand_pll_clk", CMU_NANDPLL, 600, 
8, 0, 8, 4, 100, NULL, CLK_IGNORE_UNUSED);
+static OWL_PLL_NO_PARENT(display_pll_clk, "display_pll_clk", CMU_DISPLAYPLL, 
600, 8, 0, 8, 20, 180, NULL, CLK_IGNORE_UNUSED);
+static OWL_PLL_NO_PARENT(assist_pll_clk, "assist_pll_clk", CMU_ASSISTPLL, 
5, 0, 0, 0, 0, 0, NULL, CLK_IGNORE_UNUSED);
+static OWL_PLL_NO_PARENT(audio_pll_clk, "audio_pll_clk", CMU_AUDIOPLL, 0, 4, 
0, 1, 0, 0, clk_audio_pll_table, CLK_IGNORE_UNUSED);
+static OWL_PLL(edp_pll_clk, "edp_pll_clk", "edp24M_clk", CMU_EDPCLK, 0, 9, 0, 
2, 0, 0, clk_edp_pll_table, CLK_IGNORE_UNUSED);
+
+static const char *cpu_clk_mux_p[] = { "losc", "hosc", "core_pll", };
+static const char *dev_clk_p[] = { "hosc", "dev_pll", };
+static const char *noc_clk_mux_p[] = { "dev_clk", "assist_pll", };
+static const char *dmm_clk_mux_p[] = { "dev_clk", "nand_pll", "assist_pll", 
"ddr_clk_src", };
+static const char *bisp_clk_mux_p[] = { "assist_pll", "dev_clk", };
+static const char *csi_clk_mux_p[] = { "display_pll", "dev_clk", };
+static const char *de_clk_mux_p[] = { "assist_pll", "dev_clk", };
+static const char *gpu_clk_mux_p[] = { "dev_clk", "display_pll", "", 
"ddr_clk_src", };
+static const char *hde_clk_mux_p[] = { "dev_clk", "display_pll", "", 
"ddr_clk_src", };
+static const char *imx_clk_mux_p[] = { "assist_pll", "dev_clk", };
+static const char *lcd_clk_mux_p[] = { "display_pll", "nand_pll", };
+static const char *nand_clk_mux_p[] = { "dev_clk", "nand_pll", };
+static const char *sd_clk_mux_p[] = { "dev_clk", "nand_pll", };
+static const char *sensor_clk_mux_p[] = { "hosc", "bisp", };
+static const char *uart_clk_mux_p[] = { "hosc", "dev_pll", };
+static const char *vce_clk_mux_p[] = { "dev_clk", "display_pll", "assist_pll", 
"ddr_clk_src", };
+static const char *i2s_clk_mux_p[] = { "audio_pll", };
+static const char *edp_clk_mux_p[] = { "assist_pll", "display_pll", };
+
+/* mux clocks */
+static OWL_MUX(cpu_clk, "cpu_clk", cpu_clk_mux_p, CMU_BUSCLK, 0, 2, 
CLK_SET_RATE_PARENT);
+static OWL_MUX(dev_clk, "dev_clk", dev_clk_p, CMU_DEVPLL, 12, 1, 
CLK_SET_RATE_PARENT);
+static OWL_MUX(noc_clk_mux, "noc_clk_mux", noc_clk_mux_p, CMU_BUSCLK, 7, 1, 
CLK_SET_RATE_PARENT);
+
+static struct cl

[PATCH v3 08/11] clk: actions: Add factor clock support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi factor clock together with
helper functions to be used in composite clock.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Makefile |   1 +
 drivers/clk/actions/owl-factor.c | 222 +++
 drivers/clk/actions/owl-factor.h |  83 +++
 3 files changed, 306 insertions(+)
 create mode 100644 drivers/clk/actions/owl-factor.c
 create mode 100644 drivers/clk/actions/owl-factor.h

diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 5ce75df57e1a..994357fa560b 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -4,3 +4,4 @@ clk-owl-y   += owl-common.o
 clk-owl-y  += owl-gate.o
 clk-owl-y  += owl-mux.o
 clk-owl-y  += owl-divider.o
+clk-owl-y  += owl-factor.o
diff --git a/drivers/clk/actions/owl-factor.c b/drivers/clk/actions/owl-factor.c
new file mode 100644
index ..c48a2c8b479e
--- /dev/null
+++ b/drivers/clk/actions/owl-factor.c
@@ -0,0 +1,222 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL factor clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+#include 
+
+#include "owl-factor.h"
+
+static unsigned int _get_table_maxval(const struct clk_factor_table *table)
+{
+   unsigned int maxval = 0;
+   const struct clk_factor_table *clkt;
+
+   for (clkt = table; clkt->div; clkt++)
+   if (clkt->val > maxval)
+   maxval = clkt->val;
+   return maxval;
+}
+
+static int _get_table_div_mul(const struct clk_factor_table *table,
+   unsigned int val, unsigned int *mul, unsigned int *div)
+{
+   const struct clk_factor_table *clkt;
+
+   for (clkt = table; clkt->div; clkt++) {
+   if (clkt->val == val) {
+   *mul = clkt->mul;
+   *div = clkt->div;
+   return 1;
+   }
+   }
+
+   return 0;
+}
+
+static unsigned int _get_table_val(const struct clk_factor_table *table,
+   unsigned long rate, unsigned long parent_rate)
+{
+   const struct clk_factor_table *clkt;
+   int val = -1;
+   u64 calc_rate;
+
+   for (clkt = table; clkt->div; clkt++) {
+   calc_rate = parent_rate * clkt->mul;
+   do_div(calc_rate, clkt->div);
+
+   if ((unsigned long)calc_rate <= rate) {
+   val = clkt->val;
+   break;
+   }
+   }
+
+   if (val == -1)
+   val = _get_table_maxval(table);
+
+   return val;
+}
+
+static int clk_val_best(struct clk_hw *hw, unsigned long rate,
+   unsigned long *best_parent_rate)
+{
+   struct owl_factor *factor = hw_to_owl_factor(hw);
+   struct owl_factor_hw *factor_hw = &factor->factor_hw;
+   const struct clk_factor_table *clkt = factor_hw->table;
+   unsigned long parent_rate, try_parent_rate, best = 0, cur_rate;
+   unsigned long parent_rate_saved = *best_parent_rate;
+   int bestval = 0;
+
+   if (!rate)
+   rate = 1;
+
+   if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) {
+   parent_rate = *best_parent_rate;
+   bestval = _get_table_val(clkt, rate, parent_rate);
+   return bestval;
+   }
+
+   for (clkt = factor_hw->table; clkt->div; clkt++) {
+   try_parent_rate = rate * clkt->div / clkt->mul;
+
+   if (try_parent_rate == parent_rate_saved) {
+   pr_debug("%s: [%d %d %d] found try_parent_rate %ld\n",
+   __func__, clkt->val, clkt->mul, clkt->div,
+   try_parent_rate);
+   /*
+* It's the most ideal case if the requested rate can be
+* divided from parent clock without any need to change
+* parent rate, so return the divider immediately.
+*/
+   *best_parent_rate = parent_rate_saved;
+   return clkt->val;
+   }
+
+   parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw),
+   try_parent_rate);
+   cur_rate = DIV_ROUND_UP(parent_rate, clkt->div) * clkt->mul;
+   if (cur_rate <= rate && cur_rate > best) {
+   bestval = clkt->val;
+   best = cur_rate;
+   *best_parent_rate = parent_rate;
+   }
+   }
+
+   if (!bestval) {
+   bestval = _get_table_maxval(clkt);
+   *best_parent_rate = clk_hw_round_rate(
+   clk_hw_get_parent(hw), 1);
+   }
+
+   return bestva

[PATCH v3 10/11] clk: actions: Add pll clock support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi PLL clock

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Makefile  |   1 +
 drivers/clk/actions/owl-pll.c | 194 ++
 drivers/clk/actions/owl-pll.h |  92 
 3 files changed, 287 insertions(+)
 create mode 100644 drivers/clk/actions/owl-pll.c
 create mode 100644 drivers/clk/actions/owl-pll.h

diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 53431aef6e9c..31b68eab9309 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -6,3 +6,4 @@ clk-owl-y   += owl-mux.o
 clk-owl-y  += owl-divider.o
 clk-owl-y  += owl-factor.o
 clk-owl-y  += owl-composite.o
+clk-owl-y  += owl-pll.o
diff --git a/drivers/clk/actions/owl-pll.c b/drivers/clk/actions/owl-pll.c
new file mode 100644
index ..3560c7324f9c
--- /dev/null
+++ b/drivers/clk/actions/owl-pll.c
@@ -0,0 +1,194 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL pll clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "owl-pll.h"
+
+static u32 owl_pll_calculate_mul(struct owl_pll_hw *pll_hw, unsigned long rate)
+{
+   u32 mul;
+
+   mul = DIV_ROUND_CLOSEST(rate, pll_hw->bfreq);
+   if (mul < pll_hw->min_mul)
+   mul = pll_hw->min_mul;
+   else if (mul > pll_hw->max_mul)
+   mul = pll_hw->max_mul;
+
+   return mul &= mul_mask(pll_hw);
+}
+
+static unsigned int _get_table_rate(const struct clk_pll_table *table,
+   unsigned int val)
+{
+   const struct clk_pll_table *clkt;
+
+   for (clkt = table; clkt->rate; clkt++)
+   if (clkt->val == val)
+   return clkt->rate;
+
+   return 0;
+}
+
+static const struct clk_pll_table *_get_pll_table(
+   const struct clk_pll_table *table, unsigned long rate)
+{
+   const struct clk_pll_table *clkt;
+
+   for (clkt = table; clkt->rate; clkt++) {
+   if (clkt->rate == rate) {
+   table = clkt;
+   break;
+   } else if (clkt->rate < rate)
+   table = clkt;
+   }
+
+   return table;
+}
+
+static long owl_pll_round_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long *parent_rate)
+{
+   struct owl_pll *pll = hw_to_owl_pll(hw);
+   struct owl_pll_hw *pll_hw = &pll->pll_hw;
+   const struct clk_pll_table *clkt;
+   u32 mul;
+
+   if (pll_hw->table) {
+   clkt = _get_pll_table(pll_hw->table, rate);
+   return clkt->rate;
+   }
+
+   /* fixed frequency */
+   if (pll_hw->width == 0)
+   return pll_hw->bfreq;
+
+   mul = owl_pll_calculate_mul(pll_hw, rate);
+
+   return pll_hw->bfreq * mul;
+}
+
+static unsigned long owl_pll_recalc_rate(struct clk_hw *hw,
+   unsigned long parent_rate)
+{
+   struct owl_pll *pll = hw_to_owl_pll(hw);
+   struct owl_pll_hw *pll_hw = &pll->pll_hw;
+   const struct owl_clk_common *common = &pll->common;
+   u32 val;
+
+   if (pll_hw->table) {
+   regmap_read(common->regmap, pll_hw->reg, &val);
+
+   val = val >> pll_hw->shift;
+   val &= mul_mask(pll_hw);
+
+   return _get_table_rate(pll_hw->table, val);
+   }
+
+   /* fixed frequency */
+   if (pll_hw->width == 0)
+   return pll_hw->bfreq;
+
+   regmap_read(common->regmap, pll_hw->reg, &val);
+
+   val = val >> pll_hw->shift;
+   val &= mul_mask(pll_hw);
+
+   return pll_hw->bfreq * val;
+}
+
+static int owl_pll_is_enabled(struct clk_hw *hw)
+{
+   struct owl_pll *pll = hw_to_owl_pll(hw);
+   struct owl_pll_hw *pll_hw = &pll->pll_hw;
+   const struct owl_clk_common *common = &pll->common;
+   u32 reg;
+
+   regmap_read(common->regmap, pll_hw->reg, ®);
+
+   return !!(reg & BIT(pll_hw->bit_idx));
+}
+
+static void owl_pll_set(const struct owl_clk_common *common,
+  const struct owl_pll_hw *pll_hw, bool enable)
+{
+   u32 reg;
+
+   regmap_read(common->regmap, pll_hw->reg, ®);
+
+   if (enable)
+   reg |= BIT(pll_hw->bit_idx);
+   else
+   reg &= ~BIT(pll_hw->bit_idx);
+
+   regmap_write(common->regmap, pll_hw->reg, reg);
+}
+
+static int owl_pll_enable(struct clk_hw *hw)
+{
+   struct owl_pll *pll = hw_to_owl_pll(hw);
+   const struct owl_clk_common *common = &pll->common;
+
+   owl_pll_set(common, &pll->pll_hw, true);
+
+   return 0;
+}
+
+static void owl_pll_disable(struct clk_hw *hw)
+{
+   struct owl_pll *pll = hw_to_owl_pll(hw);
+   const struct owl_clk_common *common = &pll->common;
+
+   owl_pll_set(co

[PATCH v3 09/11] clk: actions: Add composite clock support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi composite clock. This clock
consists of gate, mux, divider and factor clocks.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Makefile|   1 +
 drivers/clk/actions/owl-composite.c | 155 
 drivers/clk/actions/owl-composite.h | 101 +++
 3 files changed, 257 insertions(+)
 create mode 100644 drivers/clk/actions/owl-composite.c
 create mode 100644 drivers/clk/actions/owl-composite.h

diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 994357fa560b..53431aef6e9c 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -5,3 +5,4 @@ clk-owl-y   += owl-gate.o
 clk-owl-y  += owl-mux.o
 clk-owl-y  += owl-divider.o
 clk-owl-y  += owl-factor.o
+clk-owl-y  += owl-composite.o
diff --git a/drivers/clk/actions/owl-composite.c 
b/drivers/clk/actions/owl-composite.c
new file mode 100644
index ..04fe1645a60d
--- /dev/null
+++ b/drivers/clk/actions/owl-composite.c
@@ -0,0 +1,155 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL composite clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+
+#include "owl-composite.h"
+
+static u8 owl_comp_get_parent(struct clk_hw *hw)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_mux_helper_get_parent(&comp->common, &comp->mux_hw);
+}
+
+static int owl_comp_set_parent(struct clk_hw *hw, u8 index)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_mux_helper_set_parent(&comp->common, &comp->mux_hw, index);
+}
+
+static void owl_comp_disable(struct clk_hw *hw)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+   struct owl_clk_common *common = &comp->common;
+
+   clk_gate_set(common, &comp->gate_hw, false);
+}
+
+static int owl_comp_enable(struct clk_hw *hw)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+   struct owl_clk_common *common = &comp->common;
+
+   clk_gate_set(common, &comp->gate_hw, true);
+
+   return 0;
+}
+
+static int owl_comp_is_enabled(struct clk_hw *hw)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+   struct owl_clk_common *common = &comp->common;
+
+   return clk_is_enabled(common, &comp->gate_hw);
+}
+
+static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long *parent_rate)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
+   rate, parent_rate);
+}
+
+static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_divider_helper_recalc_rate(&comp->common, &comp->rate.div_hw,
+   parent_rate);
+}
+
+static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long parent_rate)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_divider_helper_set_rate(&comp->common, &comp->rate.div_hw,
+   rate, parent_rate);
+}
+
+static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long *parent_rate)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_factor_helper_round_rate(&comp->common,
+   &comp->rate.factor_hw,
+   rate, parent_rate);
+}
+
+static unsigned long owl_comp_fact_recalc_rate(struct clk_hw *hw,
+   unsigned long parent_rate)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_factor_helper_recalc_rate(&comp->common,
+   &comp->rate.factor_hw,
+   parent_rate);
+}
+
+static int owl_comp_fact_set_rate(struct clk_hw *hw, unsigned long rate,
+  unsigned long parent_rate)
+{
+   struct owl_composite *comp = hw_to_owl_comp(hw);
+
+   return owl_factor_helper_set_rate(&comp->common,
+   &comp->rate.factor_hw,
+   rate, parent_rate);
+}
+
+const struct clk_ops owl_comp_div_ops = {
+   /* mux_ops */
+   .get_parent = owl_comp_get_parent,
+   .set_parent = owl_comp_set_parent,
+
+   /* gate_ops */
+   .disable= owl_comp_disable,
+   .enable = owl_comp_enable,
+   .is_enabled = owl_comp_is_enabled,
+
+   /* div_ops */
+   .round_r

[PATCH v3 06/11] clk: actions: Add mux clock support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi mux clock together with helper
functions to be used in composite clock.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Makefile  |  1 +
 drivers/clk/actions/owl-mux.c | 60 ++
 drivers/clk/actions/owl-mux.h | 61 +++
 3 files changed, 122 insertions(+)
 create mode 100644 drivers/clk/actions/owl-mux.c
 create mode 100644 drivers/clk/actions/owl-mux.h

diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 1f0917872c9d..2d4aa8f35d90 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_CLK_ACTIONS)   += clk-owl.o
 
 clk-owl-y  += owl-common.o
 clk-owl-y  += owl-gate.o
+clk-owl-y  += owl-mux.o
diff --git a/drivers/clk/actions/owl-mux.c b/drivers/clk/actions/owl-mux.c
new file mode 100644
index ..f9c6cf2540e4
--- /dev/null
+++ b/drivers/clk/actions/owl-mux.c
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL mux clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+
+#include "owl-mux.h"
+
+u8 owl_mux_helper_get_parent(const struct owl_clk_common *common,
+const struct owl_mux_hw *mux_hw)
+{
+   u32 reg;
+   u8 parent;
+
+   regmap_read(common->regmap, mux_hw->reg, ®);
+   parent = reg >> mux_hw->shift;
+   parent &= BIT(mux_hw->width) - 1;
+
+   return parent;
+}
+
+static u8 owl_mux_get_parent(struct clk_hw *hw)
+{
+   struct owl_mux *mux = hw_to_owl_mux(hw);
+
+   return owl_mux_helper_get_parent(&mux->common, &mux->mux_hw);
+}
+
+int owl_mux_helper_set_parent(const struct owl_clk_common *common,
+ struct owl_mux_hw *mux_hw, u8 index)
+{
+   u32 reg;
+
+   regmap_read(common->regmap, mux_hw->reg, ®);
+   reg &= ~GENMASK(mux_hw->width + mux_hw->shift - 1, mux_hw->shift);
+   regmap_write(common->regmap, mux_hw->reg,
+   reg | (index << mux_hw->shift));
+
+   return 0;
+}
+
+static int owl_mux_set_parent(struct clk_hw *hw, u8 index)
+{
+   struct owl_mux *mux = hw_to_owl_mux(hw);
+
+   return owl_mux_helper_set_parent(&mux->common, &mux->mux_hw, index);
+}
+
+const struct clk_ops owl_mux_ops = {
+   .get_parent = owl_mux_get_parent,
+   .set_parent = owl_mux_set_parent,
+   .determine_rate = __clk_mux_determine_rate,
+};
diff --git a/drivers/clk/actions/owl-mux.h b/drivers/clk/actions/owl-mux.h
new file mode 100644
index ..834284c8c3ae
--- /dev/null
+++ b/drivers/clk/actions/owl-mux.h
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL mux clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#ifndef _OWL_MUX_H_
+#define _OWL_MUX_H_
+
+#include "owl-common.h"
+
+struct owl_mux_hw {
+   u32 reg;
+   u8  shift;
+   u8  width;
+};
+
+struct owl_mux {
+   struct owl_mux_hw   mux_hw;
+   struct owl_clk_common   common;
+};
+
+#define OWL_MUX_HW(_reg, _shift, _width)   \
+   {   \
+   .reg= _reg, \
+   .shift  = _shift,   \
+   .width  = _width,   \
+   }
+
+#define OWL_MUX(_struct, _name, _parents, _reg,
\
+   _shift, _width, _flags) \
+   struct owl_mux _struct = {  \
+   .mux_hw = OWL_MUX_HW(_reg, _shift, _width), \
+   .common = { \
+   .regmap = NULL, \
+   .hw.init = CLK_HW_INIT_PARENTS(_name,   \
+  _parents,\
+  &owl_mux_ops,\
+  _flags), \
+   },  \
+   }
+
+static inline struct owl_mux *hw_to_owl_mux(const struct clk_hw *hw)
+{
+   struct owl_clk_common *common = hw_to_owl_clk_common(hw);
+
+   return container_of(common, struct owl_mux, common);
+}
+
+u8 owl_mux_helper_get_parent(const struct owl_clk_common *common,
+const struct owl_mux_hw *mux_hw);
+int owl_mux_helper_set_parent(const struct owl_clk_common *common,
+ struct owl_mux_hw *mux_hw, u8 index);
+
+extern const struct clk_ops owl_mux_ops;

[PATCH v3 07/11] clk: actions: Add divider clock support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi divider clock together with
helper functions to be used in composite clock.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Makefile  |  1 +
 drivers/clk/actions/owl-divider.c | 94 +++
 drivers/clk/actions/owl-divider.h | 75 +++
 3 files changed, 170 insertions(+)
 create mode 100644 drivers/clk/actions/owl-divider.c
 create mode 100644 drivers/clk/actions/owl-divider.h

diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 2d4aa8f35d90..5ce75df57e1a 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_CLK_ACTIONS)   += clk-owl.o
 clk-owl-y  += owl-common.o
 clk-owl-y  += owl-gate.o
 clk-owl-y  += owl-mux.o
+clk-owl-y  += owl-divider.o
diff --git a/drivers/clk/actions/owl-divider.c 
b/drivers/clk/actions/owl-divider.c
new file mode 100644
index ..cddac00fe324
--- /dev/null
+++ b/drivers/clk/actions/owl-divider.c
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL divider clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+
+#include "owl-divider.h"
+
+long owl_divider_helper_round_rate(struct owl_clk_common *common,
+   const struct owl_divider_hw *div_hw,
+   unsigned long rate,
+   unsigned long *parent_rate)
+{
+   return divider_round_rate(&common->hw, rate, parent_rate,
+ div_hw->table, div_hw->width,
+ div_hw->div_flags);
+}
+
+static long owl_divider_round_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long *parent_rate)
+{
+   struct owl_divider *div = hw_to_owl_divider(hw);
+
+   return owl_divider_helper_round_rate(&div->common, &div->div_hw,
+rate, parent_rate);
+}
+
+unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
+const struct owl_divider_hw *div_hw,
+unsigned long parent_rate)
+{
+   unsigned long val;
+   unsigned int reg;
+
+   regmap_read(common->regmap, div_hw->reg, ®);
+   val = reg >> div_hw->shift;
+   val &= (1 << div_hw->width) - 1;
+
+   return divider_recalc_rate(&common->hw, parent_rate,
+  val, div_hw->table,
+  div_hw->div_flags,
+  div_hw->width);
+}
+
+static unsigned long owl_divider_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+   struct owl_divider *div = hw_to_owl_divider(hw);
+
+   return owl_divider_helper_recalc_rate(&div->common,
+ &div->div_hw, parent_rate);
+}
+
+int owl_divider_helper_set_rate(const struct owl_clk_common *common,
+   const struct owl_divider_hw *div_hw,
+   unsigned long rate,
+   unsigned long parent_rate)
+{
+   unsigned long val;
+   unsigned int reg;
+
+   val = divider_get_val(rate, parent_rate, div_hw->table,
+ div_hw->width, 0);
+
+   regmap_read(common->regmap, div_hw->reg, ®);
+   reg &= ~GENMASK(div_hw->width + div_hw->shift - 1, div_hw->shift);
+
+   regmap_write(common->regmap, div_hw->reg,
+ reg | (val << div_hw->shift));
+
+   return 0;
+}
+
+static int owl_divider_set_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long parent_rate)
+{
+   struct owl_divider *div = hw_to_owl_divider(hw);
+
+   return owl_divider_helper_set_rate(&div->common, &div->div_hw,
+   rate, parent_rate);
+}
+
+const struct clk_ops owl_divider_ops = {
+   .recalc_rate = owl_divider_recalc_rate,
+   .round_rate = owl_divider_round_rate,
+   .set_rate = owl_divider_set_rate,
+};
diff --git a/drivers/clk/actions/owl-divider.h 
b/drivers/clk/actions/owl-divider.h
new file mode 100644
index ..92d3e3d23967
--- /dev/null
+++ b/drivers/clk/actions/owl-divider.h
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL divider clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#ifndef _OWL_DIVIDER_H_
+#define _OWL_DIVIDER_H_
+
+#include "owl-common.h"
+
+struct owl_divider_hw {
+   u32 reg;
+   u8  shift;
+   u8  width;
+   u8 

[PATCH v3 00/11] Add clock driver for Actions S900 SoC

2018-02-09 Thread Manivannan Sadhasivam
This patchset adds clock support for Actions Semi OWL series
S900 SoC with relevant clock bindings and device tree data.

Driver has been validated on Bubblegum-96 board.

Thanks,
Mani

Changes in V3:

* Completely refactored the clock driver based on sunxi-ng
  clock structure
* Removed all owl_ prefixed functions for registering the
  clock driver and used the registration functions directly
* Moved to SPDX based license tag
* Removed module dependencies from the driver
* Made I2C clocks as simple gate clocks due to the lack of
  information about factor rates
* Added Ack from Rob for DT bindings
* Sourced CMU clock for UART5

Changes in V2: (https://lkml.org/lkml/2017/11/6/840)

* Changed the directory structure to actions/ and used owl- prefix
  for sources.
* Fixed MAINTAINERS and added Andreas as Designated Reviewer (R:).
* Introduced new Kconfig for S900 code part (CONFIG_CLK_OWL_S900).
* Changed the license from GPLv2 to GPLv2+.
* Moved fixed clock sources to DT
* Changed clock-controller node name to cmu in DT
* Added clocks property to cmu node in DT
* Changed compatible property value to "actions,s900-cmu"
* Fixed example UART controller node in documentation
* Fixed tab vs space issue

Changes in V1: (https://lkml.org/lkml/2017/10/31/808)

* Addressed last year's review comments from Stephen
- https://patchwork.kernel.org/patch/9254471/

Manivannan Sadhasivam (11):
  dt-bindings: clock: Add Actions S900 clock bindings
  arm64: dts: actions: Add S900 clock management unit nodes
  arm64: dts: actions: Source CMU clock for UART5
  clk: actions: Add common clock driver support
  clk: actions: Add gate clock support
  clk: actions: Add mux clock support
  clk: actions: Add divider clock support
  clk: actions: Add factor clock support
  clk: actions: Add composite clock support
  clk: actions: Add pll clock support
  clk: actions: Add S900 SoC clock support

 .../devicetree/bindings/clock/actions,s900-cmu.txt |  47 ++
 arch/arm64/boot/dts/actions/s900-bubblegum-96.dts  |   8 +-
 arch/arm64/boot/dts/actions/s900.dtsi  |  20 +
 drivers/clk/Kconfig|   1 +
 drivers/clk/Makefile   |   1 +
 drivers/clk/actions/Kconfig|  14 +
 drivers/clk/actions/Makefile   |  12 +
 drivers/clk/actions/owl-common.c   |  84 +++
 drivers/clk/actions/owl-common.h   |  40 ++
 drivers/clk/actions/owl-composite.c| 155 +
 drivers/clk/actions/owl-composite.h| 101 
 drivers/clk/actions/owl-divider.c  |  94 +++
 drivers/clk/actions/owl-divider.h  |  75 +++
 drivers/clk/actions/owl-factor.c   | 222 +++
 drivers/clk/actions/owl-factor.h   |  83 +++
 drivers/clk/actions/owl-gate.c |  77 +++
 drivers/clk/actions/owl-gate.h |  73 +++
 drivers/clk/actions/owl-mux.c  |  60 ++
 drivers/clk/actions/owl-mux.h  |  61 ++
 drivers/clk/actions/owl-pll.c  | 194 ++
 drivers/clk/actions/owl-pll.h  |  92 +++
 drivers/clk/actions/owl-s900.c | 666 +
 drivers/clk/actions/owl-s900.h |  61 ++
 include/dt-bindings/clock/actions,s900-cmu.h   | 139 +
 24 files changed, 2373 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/actions,s900-cmu.txt
 create mode 100644 drivers/clk/actions/Kconfig
 create mode 100644 drivers/clk/actions/Makefile
 create mode 100644 drivers/clk/actions/owl-common.c
 create mode 100644 drivers/clk/actions/owl-common.h
 create mode 100644 drivers/clk/actions/owl-composite.c
 create mode 100644 drivers/clk/actions/owl-composite.h
 create mode 100644 drivers/clk/actions/owl-divider.c
 create mode 100644 drivers/clk/actions/owl-divider.h
 create mode 100644 drivers/clk/actions/owl-factor.c
 create mode 100644 drivers/clk/actions/owl-factor.h
 create mode 100644 drivers/clk/actions/owl-gate.c
 create mode 100644 drivers/clk/actions/owl-gate.h
 create mode 100644 drivers/clk/actions/owl-mux.c
 create mode 100644 drivers/clk/actions/owl-mux.h
 create mode 100644 drivers/clk/actions/owl-pll.c
 create mode 100644 drivers/clk/actions/owl-pll.h
 create mode 100644 drivers/clk/actions/owl-s900.c
 create mode 100644 drivers/clk/actions/owl-s900.h
 create mode 100644 include/dt-bindings/clock/actions,s900-cmu.h

-- 
2.14.1



[PATCH v3 02/11] arm64: dts: actions: Add S900 clock management unit nodes

2018-02-09 Thread Manivannan Sadhasivam
Add Actions Semi S900 Clock Management Unit (CMU) nodes

Signed-off-by: Manivannan Sadhasivam 
---
 arch/arm64/boot/dts/actions/s900.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/actions/s900.dtsi 
b/arch/arm64/boot/dts/actions/s900.dtsi
index 11406f6d3a6d..fee0c9557656 100644
--- a/arch/arm64/boot/dts/actions/s900.dtsi
+++ b/arch/arm64/boot/dts/actions/s900.dtsi
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  */
 
+#include 
 #include 
 
 / {
@@ -88,6 +89,18 @@
#clock-cells = <0>;
};
 
+   losc: losc {
+   compatible = "fixed-clock";
+   clock-frequency = <32768>;
+   #clock-cells = <0>;
+   };
+
+   diff24M: diff24M {
+   compatible = "fixed-clock";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
soc {
compatible = "simple-bus";
#address-cells = <2>;
@@ -154,6 +167,13 @@
status = "disabled";
};
 
+   cmu: clock-controller@e016 {
+   compatible = "actions,s900-cmu";
+   reg = <0x0 0xe016 0x0 0x1000>;
+   clocks = <&hosc>, <&losc>;
+   #clock-cells = <1>;
+   };
+
timer: timer@e0228000 {
compatible = "actions,s900-timer";
reg = <0x0 0xe0228000 0x0 0x8000>;
-- 
2.14.1



[PATCH v3 04/11] clk: actions: Add common clock driver support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi common clock driver with generic structures
and interface functions.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/Kconfig  |  1 +
 drivers/clk/Makefile |  1 +
 drivers/clk/actions/Kconfig  |  4 ++
 drivers/clk/actions/Makefile |  3 ++
 drivers/clk/actions/owl-common.c | 84 
 drivers/clk/actions/owl-common.h | 40 +++
 6 files changed, 133 insertions(+)
 create mode 100644 drivers/clk/actions/Kconfig
 create mode 100644 drivers/clk/actions/Makefile
 create mode 100644 drivers/clk/actions/owl-common.c
 create mode 100644 drivers/clk/actions/owl-common.h

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 98ce9fc6e6c0..6313a4f4327a 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -238,6 +238,7 @@ config COMMON_CLK_VC5
  This driver supports the IDT VersaClock 5 and VersaClock 6
  programmable clock generators.
 
+source "drivers/clk/actions/Kconfig"
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
 source "drivers/clk/imgtec/Kconfig"
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 71ec41e6364f..554b67e4d0c6 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_COMMON_CLK_WM831X)   += clk-wm831x.o
 obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o
 
 # please keep this section sorted lexicographically by directory path name
+obj-$(CONFIG_ARCH_ACTIONS) += actions/
 obj-$(CONFIG_COMMON_CLK_AT91)  += at91/
 obj-$(CONFIG_ARCH_ARTPEC)  += axis/
 obj-$(CONFIG_ARC_PLAT_AXS10X)  += axs10x/
diff --git a/drivers/clk/actions/Kconfig b/drivers/clk/actions/Kconfig
new file mode 100644
index ..13a3e5083d43
--- /dev/null
+++ b/drivers/clk/actions/Kconfig
@@ -0,0 +1,4 @@
+config CLK_ACTIONS
+   bool "Clock driver for Actions Semi SoCs"
+   depends on ARCH_ACTIONS || COMPILE_TEST
+   default ARCH_ACTIONS
diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
new file mode 100644
index ..64a50fc2d335
--- /dev/null
+++ b/drivers/clk/actions/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_CLK_ACTIONS)  += clk-owl.o
+
+clk-owl-y  += owl-common.o
diff --git a/drivers/clk/actions/owl-common.c b/drivers/clk/actions/owl-common.c
new file mode 100644
index ..a7cb698fdc86
--- /dev/null
+++ b/drivers/clk/actions/owl-common.c
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL common clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+#include 
+
+#include "owl-common.h"
+
+static const struct regmap_config owl_regmap_config = {
+   .reg_bits   = 32,
+   .reg_stride = 4,
+   .val_bits   = 32,
+   .max_register   = 0x,
+   .fast_io= true,
+};
+
+static void owl_clk_set_regmap(const struct owl_clk_desc *desc,
+struct regmap *regmap)
+{
+   int i;
+   struct owl_clk_common *clks;
+
+   for (i = 0; i < desc->num_clks; i++) {
+   clks = desc->clks[i];
+   if (!clks)
+   continue;
+
+   clks->regmap = regmap;
+   }
+}
+
+int owl_clk_regmap_init(struct platform_device *pdev,
+const struct owl_clk_desc *desc)
+{
+   void __iomem *base;
+   struct device_node *node = pdev->dev.of_node;
+   struct regmap *regmap;
+
+   base = of_iomap(node, 0);
+   regmap = devm_regmap_init_mmio(&pdev->dev, base, &owl_regmap_config);
+   if (IS_ERR_OR_NULL(regmap)) {
+   pr_err("failed to init regmap\n");
+   return PTR_ERR(regmap);
+   }
+
+   owl_clk_set_regmap(desc, regmap);
+
+   return 0;
+}
+
+int owl_clk_probe(struct device *dev, struct clk_hw_onecell_data *hw_clks)
+{
+   int i, ret;
+   struct clk_hw *hw;
+
+   for (i = 0; i < hw_clks->num; i++) {
+
+   hw = hw_clks->hws[i];
+
+   if (!hw)
+   continue;
+
+   ret = devm_clk_hw_register(dev, hw);
+   if (ret) {
+   dev_err(dev, "Couldn't register clock %d - %s\n",
+   i, hw->init->name);
+   return ret;
+   }
+   }
+
+   ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, hw_clks);
+   if (ret)
+   dev_err(dev, "Failed to add clock provider\n");
+
+   return ret;
+}
diff --git a/drivers/clk/actions/owl-common.h b/drivers/clk/actions/owl-common.h
new file mode 100644
index ..e7ea23a6c8f1
--- /dev/null
+++ b/drivers/clk/actions/owl-common.h
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL common clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.

[PATCH v3 01/11] dt-bindings: clock: Add Actions S900 clock bindings

2018-02-09 Thread Manivannan Sadhasivam
Add Actions Semi S900 clock bindings.

Signed-off-by: Manivannan Sadhasivam 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/clock/actions,s900-cmu.txt |  47 +++
 include/dt-bindings/clock/actions,s900-cmu.h   | 139 +
 2 files changed, 186 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/actions,s900-cmu.txt
 create mode 100644 include/dt-bindings/clock/actions,s900-cmu.h

diff --git a/Documentation/devicetree/bindings/clock/actions,s900-cmu.txt 
b/Documentation/devicetree/bindings/clock/actions,s900-cmu.txt
new file mode 100644
index ..93e4fb827cd6
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/actions,s900-cmu.txt
@@ -0,0 +1,47 @@
+* Actions S900 Clock Management Unit (CMU)
+
+The Actions S900 clock management unit generates and supplies clock to various
+controllers within the SoC. The clock binding described here is applicable to
+S900 SoC.
+
+Required Properties:
+
+- compatible: should be "actions,s900-cmu"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- clocks: Reference to the parent clocks ("hosc", "losc")
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier, and client nodes can use this identifier
+to specify the clock which they consume.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/actions,s900-cmu.h header and can be used in device
+tree sources.
+
+External clocks:
+
+The hosc clock used as input for the plls is generated outside the SoC. It is
+expected that it is defined using standard clock bindings as "hosc".
+
+Actions S900 CMU also requires one more clock:
+ - "losc" - internal low frequency oscillator
+
+Example: Clock Management Unit node:
+
+cmu: clock-controller@e016 {
+compatible = "actions,s900-cmu";
+reg = <0x0 0xe016 0x0 0x1000>;
+clocks = <&hosc>, <&losc>;
+#clock-cells = <1>;
+};
+
+Example: UART controller node that consumes clock generated by the clock
+management unit:
+
+uart: serial@e012a000 {
+compatible = "actions,s900-uart", "actions,owl-uart";
+reg = <0x0 0xe012a000 0x0 0x2000>;
+interrupts = ;
+clocks = <&cmu CLK_UART5>;
+};
diff --git a/include/dt-bindings/clock/actions,s900-cmu.h 
b/include/dt-bindings/clock/actions,s900-cmu.h
new file mode 100644
index ..2fa94e19922b
--- /dev/null
+++ b/include/dt-bindings/clock/actions,s900-cmu.h
@@ -0,0 +1,139 @@
+/*
+ * Device Tree binding constants for Actions S900 Clock Management Unit
+ *
+ * Copyright (c) 2014 Actions Semi Inc.
+ * Copyright (c) 2017 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_S900_CMU_H
+#define __DT_BINDINGS_CLOCK_S900_CMU_H
+
+#define CLK_NONE   0
+
+/* fixed rate clocks */
+#define CLK_LOSC   1
+#define CLK_HOSC   2
+
+/* pll clocks */
+#define CLK_CORE_PLL   3
+#define CLK_DEV_PLL4
+#define CLK_DDR_PLL5
+#define CLK_NAND_PLL   6
+#define CLK_DISPLAY_PLL7
+#define CLK_DSI_PLL8
+#define CLK_ASSIST_PLL 9
+#define CLK_AUDIO_PLL  10
+
+/* system clock */
+#define CLK_CPU15
+#define CLK_DEV16
+#define CLK_NOC17
+#define CLK_NOC_MUX18
+#define CLK_NOC_DIV19
+#define CLK_AHB20
+#define CLK_APB21
+#define CLK_DMAC   22
+
+/* peripheral device clock */
+#define CLK_GPIO   23
+
+#define CLK_BISP   24
+#define CLK_CSI0   25
+#define CLK_CSI1   26
+
+#define CLK_DE027
+#define CLK_DE128
+#define CLK_DE229
+#define CLK_DE330
+#define CLK_DSI32
+
+#define CLK_GPU33
+#define CLK_GPU_CORE   34
+#define CLK_GPU_MEM35
+#define CLK_GPU_SYS36
+
+#define CLK_HDE37
+#define CLK_I2C0 

[PATCH v3 05/11] clk: actions: Add gate clock support

2018-02-09 Thread Manivannan Sadhasivam
Add support for Actions Semi gate clock together with helper
functions to be used in composite clock.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/clk/actions/Makefile   |  1 +
 drivers/clk/actions/owl-gate.c | 77 ++
 drivers/clk/actions/owl-gate.h | 73 +++
 3 files changed, 151 insertions(+)
 create mode 100644 drivers/clk/actions/owl-gate.c
 create mode 100644 drivers/clk/actions/owl-gate.h

diff --git a/drivers/clk/actions/Makefile b/drivers/clk/actions/Makefile
index 64a50fc2d335..1f0917872c9d 100644
--- a/drivers/clk/actions/Makefile
+++ b/drivers/clk/actions/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_CLK_ACTIONS)  += clk-owl.o
 
 clk-owl-y  += owl-common.o
+clk-owl-y  += owl-gate.o
diff --git a/drivers/clk/actions/owl-gate.c b/drivers/clk/actions/owl-gate.c
new file mode 100644
index ..25dd94ac0f35
--- /dev/null
+++ b/drivers/clk/actions/owl-gate.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL gate clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#include 
+#include 
+
+#include "owl-gate.h"
+
+void clk_gate_set(const struct owl_clk_common *common,
+const struct owl_gate_hw *gate_hw, bool enable)
+{
+   int set = gate_hw->gate_flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0;
+   u32 reg;
+
+   set ^= enable;
+
+   regmap_read(common->regmap, gate_hw->reg, ®);
+
+   if (set)
+   reg |= BIT(gate_hw->bit_idx);
+   else
+   reg &= ~BIT(gate_hw->bit_idx);
+
+   regmap_write(common->regmap, gate_hw->reg, reg);
+}
+
+static void owl_gate_disable(struct clk_hw *hw)
+{
+   struct owl_gate *gate = hw_to_owl_gate(hw);
+   struct owl_clk_common *common = &gate->common;
+
+   clk_gate_set(common, &gate->gate_hw, false);
+}
+
+static int owl_gate_enable(struct clk_hw *hw)
+{
+   struct owl_gate *gate = hw_to_owl_gate(hw);
+   struct owl_clk_common *common = &gate->common;
+
+   clk_gate_set(common, &gate->gate_hw, true);
+
+   return 0;
+}
+
+int clk_is_enabled(const struct owl_clk_common *common,
+  const struct owl_gate_hw *gate_hw)
+{
+   u32 reg;
+
+   regmap_read(common->regmap, gate_hw->reg, ®);
+
+   if (gate_hw->gate_flags & CLK_GATE_SET_TO_DISABLE)
+   reg ^= BIT(gate_hw->bit_idx);
+
+   return !!(reg & BIT(gate_hw->bit_idx));
+}
+
+static int owl_gate_is_enabled(struct clk_hw *hw)
+{
+   struct owl_gate *gate = hw_to_owl_gate(hw);
+   struct owl_clk_common *common = &gate->common;
+
+   return clk_is_enabled(common, &gate->gate_hw);
+}
+
+const struct clk_ops owl_gate_ops = {
+   .disable= owl_gate_disable,
+   .enable = owl_gate_enable,
+   .is_enabled = owl_gate_is_enabled,
+};
diff --git a/drivers/clk/actions/owl-gate.h b/drivers/clk/actions/owl-gate.h
new file mode 100644
index ..4fc609647ae4
--- /dev/null
+++ b/drivers/clk/actions/owl-gate.h
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// OWL gate clock driver
+//
+// Copyright (c) 2014 Actions Semi Inc.
+// Author: David Liu 
+//
+// Copyright (c) 2018 Linaro Ltd.
+// Author: Manivannan Sadhasivam 
+
+#ifndef _OWL_GATE_H_
+#define _OWL_GATE_H_
+
+#include "owl-common.h"
+
+struct owl_gate_hw {
+   u32 reg;
+   u8  bit_idx;
+   u8  gate_flags;
+};
+
+struct owl_gate {
+   struct owl_gate_hw  gate_hw;
+   struct owl_clk_common   common;
+};
+
+#define OWL_GATE_HW(_reg, _bit_idx, _gate_flags)   \
+   {   \
+   .reg= _reg, \
+   .bit_idx= _bit_idx, \
+   .gate_flags = _gate_flags,  \
+   }
+
+#define OWL_GATE(_struct, _name, _parent, _reg,
\
+   _bit_idx, _gate_flags, _flags)  \
+   struct owl_gate _struct = { \
+   .gate_hw = OWL_GATE_HW(_reg, _bit_idx, _gate_flags),\
+   .common = { \
+   .regmap = NULL, \
+   .hw.init= CLK_HW_INIT(_name,\
+ _parent,  \
+ &owl_gate_ops,\
+ _flags),  \
+   }   \
+   }   \
+
+#define OWL_GATE_NO_PARENT(_struct, _name, _reg,   \
+   

[PATCH v3 03/11] arm64: dts: actions: Source CMU clock for UART5

2018-02-09 Thread Manivannan Sadhasivam
Remove fixed clock and source CMU (Clock Management Unit) clock for
UART5 driver in Actions Semi S900 SoC.

Signed-off-by: Manivannan Sadhasivam 
---
 arch/arm64/boot/dts/actions/s900-bubblegum-96.dts | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts 
b/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts
index 21ca80f9941c..ff043c961d75 100644
--- a/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts
+++ b/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts
@@ -24,12 +24,6 @@
device_type = "memory";
reg = <0x0 0x0 0x0 0x8000>;
};
-
-   uart5_clk: uart5-clk {
-   compatible = "fixed-clock";
-   clock-frequency = <921600>;
-   #clock-cells = <0>;
-   };
 };
 
 &timer {
@@ -38,5 +32,5 @@
 
 &uart5 {
status = "okay";
-   clocks = <&uart5_clk>;
+   clocks = <&cmu CLK_UART5>;
 };
-- 
2.14.1



Re: [PATCH V2 0/6]nvme-pci: fixes on nvme_timeout and nvme_dev_disable

2018-02-09 Thread jianchao.wang
Hi Keith

Thanks for your kindly response here.
That's really appreciated.

On 02/10/2018 01:12 AM, Keith Busch wrote:
> On Fri, Feb 09, 2018 at 09:50:58AM +0800, jianchao.wang wrote:
>>
>> if we set NVME_REQ_CANCELLED and return BLK_EH_HANDLED as the RESETTING case,
>> nvme_reset_work will hang forever, because no one could complete the entered 
>> requests.
> 
> Except it's no longer in the "RESETTING" case since you added the
> "CONNECTING" state, so that's already broken for other reasons...
> 

Yes, but as your patch, we have to fail the IOs and even kill the controller.
In fact, up to nvme_wait_freeze in nvme_reset_work, the RECONNECTING state has 
been completed.
We even could say it is in LIVE state. Maybe we should recover the controller 
again instead
of fail the IOs and kill the controller.

On the other hand, can you share with me why we cannot use blk_set_preempt_only 
to replace
blk_freeze_queue ? we just want to gate the new bios out of 
generic_make_request and we 
needn't use the preempt requests.

Looking forward your advice and directive.

Thanks
Jianchao


> ___
> Linux-nvme mailing list
> linux-n...@lists.infradead.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-2Dnvme&d=DwICAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=7WdAxUBeiTUTCy8v-7zXyr4qk7sx26ATvfo6QSTvZyQ&m=UqKQMB3A2ppfm2sN7PyisX0xTtXKsHlTBwjsS18qVx8&s=A2VMSm9IjQQXxM7foB6VUiRHLs-nIREF2_kMstwxlgw&e=
> 


[PATCH] f2fs: handle quota for orphan inodes

2018-02-09 Thread Jaegeuk Kim
This is to fix missing dquot_initialize for orphan inodes.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 8b0945ba284d..e3bf753a47be 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, 
nid_t ino)
struct node_info ni;
int err = acquire_orphan_inode(sbi);
 
-   if (err) {
-   set_sbi_flag(sbi, SBI_NEED_FSCK);
-   f2fs_msg(sbi->sb, KERN_WARNING,
-   "%s: orphan failed (ino=%x), run fsck to fix.",
-   __func__, ino);
-   return err;
-   }
+   if (err)
+   goto err_out;
 
__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
 
@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, 
nid_t ino)
return PTR_ERR(inode);
}
 
+   err = dquot_initialize(inode);
+   if (err)
+   goto err_out;
+
+   dquot_initialize(inode);
clear_nlink(inode);
 
/* truncate all the data during iput */
@@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, 
nid_t ino)
 
/* ENOMEM was fully retried in f2fs_evict_inode. */
if (ni.blk_addr != NULL_ADDR) {
-   set_sbi_flag(sbi, SBI_NEED_FSCK);
-   f2fs_msg(sbi->sb, KERN_WARNING,
-   "%s: orphan failed (ino=%x) by kernel, retry mount.",
-   __func__, ino);
-   return -EIO;
+   err = -EIO;
+   goto err_out;
}
__remove_ino_entry(sbi, ino, ORPHAN_INO);
return 0;
+
+err_out:
+   set_sbi_flag(sbi, SBI_NEED_FSCK);
+   f2fs_msg(sbi->sb, KERN_WARNING,
+   "%s: orphan failed (ino=%x), run fsck to fix.",
+   __func__, ino);
+   return err;
 }
 
 int recover_orphan_inodes(struct f2fs_sb_info *sbi)
-- 
2.15.0.531.g2ccb3012c9-goog



Re: [PATCH] x86/kvm/vmx: Don't halt vcpu when L1 is injecting events to L2

2018-02-09 Thread Liran Alon

- pbonz...@redhat.com wrote:

> On 08/02/2018 13:09, Liran Alon wrote:
> > - pbonz...@redhat.com wrote:
> >> On 08/02/2018 06:13, Chao Gao wrote:
> > 
> > A possible patch to fix this is to change vmx_hwapic_irr_update()
> such that
> > if is_guest_mode(vcpu)==true, we should return max(max_irr, rvi) and
> return
> > that value into apic_has_interrupt_for_ppr().
> > Need to verify that it doesn't break other flows but I think it
> makes sense.
> > What do you think?
> 
> Yeah, I think it makes sense though I'd need to look a lot more at
> arch/x86/kvm/lapic.c and arch/x86/kvm/vmx.c to turn that into a
> patch!
> 
> Paolo

After thinking about this a bit more, I don't like my previous suggestion.
As we don't semantically want to change the value returned from 
kvm_apic_has_interrupt().
Instead, it makes more sense to change kvm_cpu_has_interrupt() to check for 
RVI>PPR
in case is_guest_mode(vcpu)==true.

Something like (partial theoretical patch):

@@ -97,6 +97,14 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v)
if (kvm_cpu_has_extint(v))
return 1;
 
+   /*
+* When running L2, L1 controls vmcs02 RVI via vmcs12.
+* Therefore, it is possible RVI indicates pending interrupt
+* for vCPU while LAPIC IRR is empty.
+*/
+   if (is_guest_mode(v) &&
+   (kvm_x86_ops->hwapic_has_interrupt(v) != -1))
+   return 1;
+
return kvm_apic_has_interrupt(v) != -1; /* LAPIC */
 }

Where:

+static int vmx_get_rvi(void)
+{
+   return ((u8)vmcs_read16(GUEST_INTR_STATUS) & 0xff);
+}

+static int vmx_hwapic_has_interrupt(struct kvm_vcpu *vcpu)
+{
+   int vector = vmx_get_rvi(vcpu);
+   return kvm_apic_has_interrupt_for_vector(vector);
+}

+int kvm_apic_has_interrupt_for_vector(struct kvm_vcpu *vcpu, int vector)
+{
+   struct kvm_lapic *apic = vcpu->arch.apic;
+   u32 ppr;
+
+   if (!apic_enabled(apic))
+   return -1;
+
+   __apic_update_ppr(apic, &ppr);
+   return (((vector & 0xF0) > ppr) ? (vector) : (-1));
+}
+EXPORT_SYMBOL_GPL(kvm_apic_has_interrupt_for_vector);

Regards,
-Liran


Re: [PATCH] irqchip: Use %px to print pointer value

2018-02-09 Thread Jaedon Shin


> On 10 Feb 2018, at 1:04 AM, Marc Zyngier  wrote:
> 
> On 09/02/18 15:54, Florian Fainelli wrote:
>> On February 9, 2018 12:51:33 AM PST, Marc Zyngier  
>> wrote:
>>> On 09/02/18 02:10, Jaedon Shin wrote:
 Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
 pointers printed with %p are hashed. Use %px instead of %p to print
 pointer value.
 
 Signed-off-by: Jaedon Shin 
 ---
 drivers/irqchip/irq-bcm7038-l1.c | 2 +-
 drivers/irqchip/irq-bcm7120-l2.c | 2 +-
 drivers/irqchip/irq-brcmstb-l2.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/irqchip/irq-bcm7038-l1.c
>>> b/drivers/irqchip/irq-bcm7038-l1.c
 index 55cfb986225b..f604c1d89b3b 100644
 --- a/drivers/irqchip/irq-bcm7038-l1.c
 +++ b/drivers/irqchip/irq-bcm7038-l1.c
 @@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node
>>> *dn,
goto out_unmap;
}
 
 -  pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
 +  pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
return 0;
 diff --git a/drivers/irqchip/irq-bcm7120-l2.c
>>> b/drivers/irqchip/irq-bcm7120-l2.c
 index 983640eba418..1cc4dd1d584a 100644
 --- a/drivers/irqchip/irq-bcm7120-l2.c
 +++ b/drivers/irqchip/irq-bcm7120-l2.c
 @@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct
>>> device_node *dn,
}
}
 
 -  pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
 +  pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
intc_name, data->map_base[0], data->num_parent_irqs);
 
return 0;
 diff --git a/drivers/irqchip/irq-brcmstb-l2.c
>>> b/drivers/irqchip/irq-brcmstb-l2.c
 index 691d20eb0bec..6760edeeb666 100644
 --- a/drivers/irqchip/irq-brcmstb-l2.c
 +++ b/drivers/irqchip/irq-brcmstb-l2.c
 @@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct
>>> device_node *np,
ct->chip.irq_set_wake = irq_gc_set_wake;
}
 
 -  pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
 +  pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
base, parent_irq);
 
return 0;
 
>>> 
>>> Why is that something useful to do? This just tells you where the
>>> device
>>> is mapped in the VA space, and I doubt that's a useful information,
>>> hashed pointers or not. Am I missing something obvious?
>> 
>> No you are right there is not much value in printing the register
>> virtual address (sometimes there is e.g: on MIPS) either we fix the
>> prints to show the physical address of the base register or we could
>> possibly drop the prints entirely.
> 
> Displaying the PA can be useful if you have several identical blocks in
> your system and you want to be able to identify them. Given that there
> is probably only one of these controllers per system, the address is
> pretty pointless.
> 
> If you send me a patch removing the prints, I'll queue it.
> 
> Thanks,
> 
>   M.
> -- 
> Jazz is not dead. It just smells funny...

I'll submit a new one to drop the entire print.

Thanks,
Jaedon

[PATCH] tracing/power: Don't share template for cpu_idle and cpu_frequency

2018-02-09 Thread changbin . du
From: Changbin Du 

The type of state is signed int, convert it to unsigned int looks weird.
(-1 become 4294967295)
   932.123 power:cpu_idle:state=1 cpu_id=0)
   932.125 power:cpu_idle:state=4294967295 cpu_id=0)
   932.132 power:cpu_idle:state=1 cpu_id=0)
   932.133 power:cpu_idle:state=4294967295 cpu_id=0)

Similarly for cpu_frequency as "state=%lu cpu_id=%lu". User need to read
the code to understand what 'state' means.

No functional change in this patch.

Signed-off-by: Changbin Du 
---
 include/trace/events/power.h | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 908977d..39bd6de 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -12,14 +12,14 @@
 
 #define TPS(x)  tracepoint_string(x)
 
-DECLARE_EVENT_CLASS(cpu,
+TRACE_EVENT(cpu_idle,
 
-   TP_PROTO(unsigned int state, unsigned int cpu_id),
+   TP_PROTO(int state, unsigned int cpu_id),
 
TP_ARGS(state, cpu_id),
 
TP_STRUCT__entry(
-   __field(u32,state   )
+   __field(int,state   )
__field(u32,cpu_id  )
),
 
@@ -28,17 +28,10 @@ DECLARE_EVENT_CLASS(cpu,
__entry->cpu_id = cpu_id;
),
 
-   TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
+   TP_printk("state=%d cpu_id=%lu", __entry->state,
  (unsigned long)__entry->cpu_id)
 );
 
-DEFINE_EVENT(cpu, cpu_idle,
-
-   TP_PROTO(unsigned int state, unsigned int cpu_id),
-
-   TP_ARGS(state, cpu_id)
-);
-
 TRACE_EVENT(powernv_throttle,
 
TP_PROTO(int chip_id, const char *reason, int pmax),
@@ -141,11 +134,24 @@ TRACE_EVENT(pstate_sample,
{ PM_EVENT_RESTORE, "restore" }, \
{ PM_EVENT_RECOVER, "recover" })
 
-DEFINE_EVENT(cpu, cpu_frequency,
+TRACE_EVENT(cpu_frequency,
 
TP_PROTO(unsigned int frequency, unsigned int cpu_id),
 
-   TP_ARGS(frequency, cpu_id)
+   TP_ARGS(frequency, cpu_id),
+
+   TP_STRUCT__entry(
+   __field(u32,frequency   )
+   __field(u32,cpu_id  )
+   ),
+
+   TP_fast_assign(
+   __entry->frequency = frequency;
+   __entry->cpu_id = cpu_id;
+   ),
+
+   TP_printk("frequency=%lu cpu_id=%lu", __entry->frequency,
+ (unsigned long)__entry->cpu_id)
 );
 
 TRACE_EVENT(device_pm_callback_start,
-- 
2.7.4



[PATCH 6/6] ARM: dts: tegra: apalis-tk1: support v1.2 hardware revision

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Support the V1.2 hardware revision with the following pin muxing
changes:

Ddc_scl_pv4 and ddc_sda_pv5 previously used as Apalis GPIO3 and GPIO4
are now used as DDC pins.

Gen2_i2c_scl_pt5 and gen2_i2c_sda_pt6 previously used as DDC pins are
now used as USB power enable signals.

Usb_vbus_en0_pn4 and usb_vbus_en1_pn5 previously used as USB power
enable signals are now used as GPIO3 and GPIO4.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/Makefile  |1 +
 arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts |  250 +++
 arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 2052 +++
 3 files changed, 2303 insertions(+)
 create mode 100644 arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
 create mode 100644 arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ade7a38543dc..9d882741f0da 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1022,6 +1022,7 @@ dtb-$(CONFIG_ARCH_TEGRA_114_SOC) += \
tegra114-tn7.dtb
 dtb-$(CONFIG_ARCH_TEGRA_124_SOC) += \
tegra124-apalis-eval.dtb \
+   tegra124-apalis-v1.2-eval.dtb \
tegra124-jetson-tk1.dtb \
tegra124-nyan-big.dtb \
tegra124-nyan-blaze.dtb \
diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts 
b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
new file mode 100644
index ..8a8d5fa0ecd1
--- /dev/null
+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
@@ -0,0 +1,250 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright 2016-2018 Toradex AG
+ */
+
+/dts-v1/;
+
+#include 
+#include "tegra124-apalis-v1.2.dtsi"
+
+/ {
+   model = "Toradex Apalis TK1 on Apalis Evaluation Board";
+   compatible = "toradex,apalis-tk1-v1.2-eval", "toradex,apalis-tk1-eval",
+"toradex,apalis-tk1", "nvidia,tegra124";
+
+   aliases {
+   rtc0 = "/i2c@7000c000/rtc@68";
+   rtc1 = "/i2c@7000d000/pmic@40";
+   rtc2 = "/rtc@7000e000";
+   serial0 = &uarta;
+   serial1 = &uartb;
+   serial2 = &uartc;
+   serial3 = &uartd;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   pcie@1003000 {
+   pci@1,0 {
+   status = "okay";
+   };
+   };
+
+   host1x@5000 {
+   hdmi@5428 {
+   status = "okay";
+   };
+   };
+
+   /* Apalis UART1 */
+   serial@70006000 {
+   status = "okay";
+   };
+
+   /* Apalis UART2 */
+   serial@70006040 {
+   status = "okay";
+   };
+
+   /* Apalis UART3 */
+   serial@70006200 {
+   status = "okay";
+   };
+
+   /* Apalis UART4 */
+   serial@70006300 {
+   status = "okay";
+   };
+
+   pwm@7000a000 {
+   status = "okay";
+   };
+
+   /*
+* GEN1_I2C: I2C1_SDA/SCL on MXM3 pin 209/211 (e.g. RTC on carrier
+* board)
+*/
+   i2c@7000c000 {
+   status = "okay";
+   clock-frequency = <40>;
+
+   pcie-switch@58 {
+   compatible = "plx,pex8605";
+   reg = <0x58>;
+   };
+
+   /* M41T0M6 real time clock on carrier board */
+   rtc@68 {
+   compatible = "st,m41t0";
+   reg = <0x68>;
+   };
+   };
+
+   /* GEN2_I2C: unused */
+
+   /*
+* CAM_I2C: I2C3_SDA/SCL (CAM) on MXM3 pin 201/203 (e.g. camera sensor
+* on carrier board)
+*/
+   i2c@7000c500 {
+   status = "okay";
+   clock-frequency = <40>;
+   };
+
+   /*
+* I2C4 (DDC): I2C4_SDA/SCL (DDC) on MXM3 pin 205/207
+* (e.g. display EDID)
+*/
+   hdmi_ddc: i2c@7000c700 {
+   status = "okay";
+   };
+
+   /* SPI1: Apalis SPI1 */
+   spi@7000d400 {
+   status = "okay";
+   spi-max-frequency = <5000>;
+
+   spidev0: spidev@0 {
+   compatible = "spidev";
+   reg = <0>;
+   spi-max-frequency = <5000>;
+   };
+   };
+
+   /* SPI4: Apalis SPI2 */
+   spi@7000da00 {
+   status = "okay";
+   spi-max-frequency = <5000>;
+
+   spidev1: spidev@0 {
+   compatible = "spidev";
+   reg = <0>;
+   spi-max-frequency = <5000>;
+   };
+   };
+
+   /* Apalis Serial ATA */
+   sata@7002 {
+   status = "okay";
+   };
+
+   hda@7003 {
+   status = "okay";
+   };
+
+   usb@7009 {
+   status = "okay";
+   };
+
+  

[PATCH 3/6] ARM: dts: tegra: apalis-tk1: add missing as3722 gpio0 configuration

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

As the AS3722 GPIO0 is also a not connected on our Apalis TK1 module
explicitly configure it to high-impedance as well.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi 
b/arch/arm/boot/dts/tegra124-apalis.dtsi
index 7fbaaf221029..44c31176ce90 100644
--- a/arch/arm/boot/dts/tegra124-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
@@ -1620,9 +1620,9 @@
bias-pull-up;
};
 
-   gpio1_3_4_5_6 {
-   pins = "gpio1", "gpio3", "gpio4",
-  "gpio5", "gpio6";
+   gpio0_1_3_4_5_6 {
+   pins = "gpio0", "gpio1", "gpio3",
+  "gpio4", "gpio5", "gpio6";
bias-high-impedance;
};
};
-- 
2.14.3



[PATCH 1/6] arm: tegra: apalis-tk1: set critical trips

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Set "critical" trip temperatures for cpu, gpu, mem and pllx
thermal zones. These trips can trigger shut down or reset.

Similar to commit 40823f8e267f ("arm: tegra: set critical
trips for Tegra124").

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis.dtsi | 27 +++
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi 
b/arch/arm/boot/dts/tegra124-apalis.dtsi
index 7aef8928e115..be45b6753916 100644
--- a/arch/arm/boot/dts/tegra124-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
@@ -2041,53 +2041,32 @@
thermal-zones {
cpu {
trips {
-   trip@0 {
+   cpu-shutdown-trip {
temperature = <101000>;
hysteresis = <0>;
type = "critical";
};
};
-
-   cooling-maps {
-   /*
-* There are currently no cooling maps because
-* there are no cooling devices
-*/
-   };
};
 
mem {
trips {
-   trip@0 {
+   mem-shutdown-trip {
temperature = <101000>;
hysteresis = <0>;
type = "critical";
};
};
-
-   cooling-maps {
-   /*
-* There are currently no cooling maps because
-* there are no cooling devices
-*/
-   };
};
 
gpu {
trips {
-   trip@0 {
+   gpu-shutdown-trip {
temperature = <101000>;
hysteresis = <0>;
type = "critical";
};
};
-
-   cooling-maps {
-   /*
-* There are currently no cooling maps because
-* there are no cooling devices
-*/
-   };
};
};
 };
-- 
2.14.3



[PATCH 2/6] ARM: dts: tegra: apalis-tk1: activate pwm pin muxing for pwm3

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Activate PWM pin muxing for Apalis PWM3. Note that the same PWM3 is
already active on pu6 being Apalis BKL1_PWM as well. Therefore exporting
that one for raw sysfs access will fail and one has to revert to using
the pwm backlight.

Downstream commit 668ddb921800 ("apalis-tk1: activate pwm pin muxing for
pwm3").

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis.dtsi | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi 
b/arch/arm/boot/dts/tegra124-apalis.dtsi
index be45b6753916..7fbaaf221029 100644
--- a/arch/arm/boot/dts/tegra124-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
@@ -453,12 +453,12 @@
nvidia,tristate = ;
nvidia,enable-input = ;
};
-   /* PWM3 active on pu6 being Apalis BKL1_PWM */
+   /* PWM3 active on pu6 being Apalis BKL1_PWM as well */
ph3 {
nvidia,pins = "ph3";
-   nvidia,function = "gmi";
-   nvidia,pull = ;
-   nvidia,tristate = ;
+   nvidia,function = "pwm3";
+   nvidia,pull = ;
+   nvidia,tristate = ;
nvidia,enable-input = ;
};
 
-- 
2.14.3



[PATCH 5/6] ARM: dts: tegra: apalis-tk1: copyright period, spurious newlines

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Update the copyright period and get rid of some spurious newlines.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis-eval.dts |  6 ++
 arch/arm/boot/dts/tegra124-apalis.dtsi | 11 +--
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts 
b/arch/arm/boot/dts/tegra124-apalis-eval.dts
index f1010cefb993..a6ad759dddb4 100644
--- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Toradex AG
+ * Copyright 2016-2018 Toradex AG
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPL or the X11 license, at your option. Note that this dual
@@ -225,9 +225,7 @@
 
backlight: backlight {
compatible = "pwm-backlight";
-
-   /* BKL1_PWM */
-   pwms = <&pwm 3 500>;
+   pwms = <&pwm 3 500>; /* BKL1_PWM */
brightness-levels = <255 231 223 207 191 159 127 0>;
default-brightness-level = <6>;
/* BKL1_ON */
diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi 
b/arch/arm/boot/dts/tegra124-apalis.dtsi
index b7648ce4565d..65a2161b9b8e 100644
--- a/arch/arm/boot/dts/tegra124-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Toradex AG
+ * Copyright 2016-2018 Toradex AG
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPL or the X11 license, at your option. Note that this dual
@@ -56,7 +56,6 @@
 
pcie@1003000 {
status = "okay";
-
avddio-pex-supply = <&vdd_1v05>;
avdd-pex-pll-supply = <&vdd_1v05>;
avdd-pll-erefe-supply = <&avdd_1v05>;
@@ -85,7 +84,6 @@
hdmi@5428 {
pll-supply = <®_1v05_avdd_hdmi_pll>;
vdd-supply = <®_3v3_avdd_hdmi>;
-
nvidia,ddc-i2c-bus = <&hdmi_ddc>;
nvidia,hpd-gpio =
<&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
@@ -1600,15 +1598,11 @@
compatible = "ams,as3722";
reg = <0x40>;
interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
-
ams,system-power-controller;
-
#interrupt-cells = <2>;
interrupt-controller;
-
gpio-controller;
#gpio-cells = <2>;
-
pinctrl-names = "default";
pinctrl-0 = <&as3722_default>;
 
@@ -1783,7 +1777,6 @@
reg = <0x4c>;
interrupt-parent = <&gpio>;
interrupts = ;
-
#thermal-sensor-cells = <1>;
};
};
@@ -1816,7 +1809,6 @@
sata@7002 {
phys = <&{/padctl@7009f000/pads/sata/lanes/sata-0}>;
phy-names = "sata-0";
-
avdd-supply = <&vdd_1v05>;
hvdd-supply = <®_3v3>;
vddio-supply = <&vdd_1v05>;
@@ -1830,7 +1822,6 @@
   <&{/padctl@7009f000/pads/usb2/lanes/usb2-2}>,
   <&{/padctl@7009f000/pads/pcie/lanes/pcie-0}>;
phy-names = "usb2-0", "usb3-1", "usb2-1", "usb2-2", "usb3-0";
-
avddio-pex-supply = <&vdd_1v05>;
avdd-pll-erefe-supply = <&avdd_1v05>;
avdd-pll-utmip-supply = <&vddio_1v8>;
-- 
2.14.3



[PATCH 4/6] ARM: dts: tegra: apalis-tk1: hog group for ethernet, pcie, reset gpios

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

The Apalis TK1 module uses some dedicated GPIOs as I210 gigabit Ethernet
controller reset and to control RESET_MOCI aka reset module output
carrier input on MXM3 pin 26. The Apalis Evaluation Board furthermore
uses Apalis GPIO7 on MXM3 pin 15 as reset signal for its PLX PEX 8605
PCIe Switch.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis-eval.dts | 10 ++
 arch/arm/boot/dts/tegra124-apalis.dtsi | 18 ++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts 
b/arch/arm/boot/dts/tegra124-apalis-eval.dts
index af6c566e8ac4..f1010cefb993 100644
--- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
@@ -275,3 +275,13 @@
vin-supply = <®_5v0>;
};
 };
+
+&gpio {
+   /* Apalis GPIO7 MXM3 pin 15 PLX PEX 8605 PCIe Switch Reset */
+   pex_perst_n {
+   gpio-hog;
+   gpios = ;
+   output-high;
+   line-name = "PEX_PERST_N";
+   };
+};
diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi 
b/arch/arm/boot/dts/tegra124-apalis.dtsi
index 44c31176ce90..b7648ce4565d 100644
--- a/arch/arm/boot/dts/tegra124-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
@@ -2070,3 +2070,21 @@
};
};
 };
+
+&gpio {
+   /* I210 Gigabit Ethernet Controller Reset */
+   lan_reset_n {
+   gpio-hog;
+   gpios = ;
+   output-high;
+   line-name = "LAN_RESET_N";
+   };
+
+   /* Control MXM3 pin 26 Reset Module Output Carrier Input */
+   reset_moci_ctrl {
+   gpio-hog;
+   gpios = ;
+   output-high;
+   line-name = "RESET_MOCI_CTRL";
+   };
+};
-- 
2.14.3



[PATCH 0/6] ARM: dts: tegra: apalis-tk1: updates incl. v1.2 hardware support

2018-02-09 Thread Marcel Ziswiler

This series sets critical trips, activates PWM pin muxing for PWM3,
adds a missing AS3722 GPIO0 configuration, adds a hog group for
Ethernet, PCIe, reset GPIOs, updates the copyright period, removes
spurious newlines and adds support for the V1.2 hardware revision of
the Toradex Apalis TK1 system on module.


Marcel Ziswiler (6):
  arm: tegra: apalis-tk1: set critical trips
  ARM: dts: tegra: apalis-tk1: activate pwm pin muxing for pwm3
  ARM: dts: tegra: apalis-tk1: add missing as3722 gpio0 configuration
  ARM: dts: tegra: apalis-tk1: hog group for ethernet, pcie, reset gpios
  ARM: dts: tegra: apalis-tk1: copyright period, spurious newlines
  ARM: dts: tegra: apalis-tk1: support v1.2 hardware revision

 arch/arm/boot/dts/Makefile  |1 +
 arch/arm/boot/dts/tegra124-apalis-eval.dts  |   16 +-
 arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts |  250 +++
 arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 2052 +++
 arch/arm/boot/dts/tegra124-apalis.dtsi  |   70 +-
 5 files changed, 2344 insertions(+), 45 deletions(-)
 create mode 100644 arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
 create mode 100644 arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi

-- 
2.14.3



[PATCH 2/3] ARM: dts: tegra: apalis/colibri: use correct compatible for rtc

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

All Toradex Carrier Boards use a st,m41t0 compatible RTC. Compared to a
st,m41t00 this RTC has also an oscillator fail bit which allows to
detect when the RTC lost track of time.

Similar to commit c53bec16b150 ("ARM: dts: colibri/apalis: use correct
compatible for RTC") covering our NXP i.MX and Vybrid based modules.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis-eval.dts| 2 +-
 arch/arm/boot/dts/tegra30-apalis-eval.dts | 2 +-
 arch/arm/boot/dts/tegra30-colibri-eval-v3.dts | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts 
b/arch/arm/boot/dts/tegra124-apalis-eval.dts
index 66b6c45ee865..af6c566e8ac4 100644
--- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
@@ -114,7 +114,7 @@
 
/* M41T0M6 real time clock on carrier board */
rtc@68 {
-   compatible = "st,m41t00";
+   compatible = "st,m41t0";
reg = <0x68>;
};
};
diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts 
b/arch/arm/boot/dts/tegra30-apalis-eval.dts
index fdca527a2248..0dc85a20bd45 100644
--- a/arch/arm/boot/dts/tegra30-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts
@@ -88,7 +88,7 @@
 
/* M41T0M6 real time clock on carrier board */
rtc@68 {
-   compatible = "st,m41t00";
+   compatible = "st,m41t0";
reg = <0x68>;
};
};
diff --git a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts 
b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
index 8c62833197e5..16e1f387aa6d 100644
--- a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
@@ -60,7 +60,7 @@
 
/* M41T0M6 real time clock on carrier board */
rtc@68 {
-   compatible = "st,m41t00";
+   compatible = "st,m41t0";
reg = <0x68>;
};
};
-- 
2.14.3



[PATCH 0/3] ARM: dts: tegra: apalis/colibri updates

2018-02-09 Thread Marcel Ziswiler

This series fixes the I2C bus frequencies, uses the correct compatible
for the RTC and removes an unneeded reg property for Tegra based
Toradex Apalis and Colibri modules.


Marcel Ziswiler (3):
  apalis_t30/tk1, colibri_t20/t30: fix i2c bus frequencies
  ARM: dts: tegra: apalis/colibri: use correct compatible for rtc
  ARM: dts: tegra: apalis/colibri: remove unneeded reg property

 arch/arm/boot/dts/tegra124-apalis-eval.dts|  7 +++
 arch/arm/boot/dts/tegra124-apalis.dtsi|  2 +-
 arch/arm/boot/dts/tegra20-colibri-512.dtsi| 16 +++-
 arch/arm/boot/dts/tegra30-apalis-eval.dts |  4 ++--
 arch/arm/boot/dts/tegra30-apalis.dtsi |  3 +--
 arch/arm/boot/dts/tegra30-colibri-eval-v3.dts |  4 ++--
 arch/arm/boot/dts/tegra30-colibri.dtsi|  3 +--
 7 files changed, 21 insertions(+), 18 deletions(-)

-- 
2.14.3



[PATCH 1/3] apalis_t30/tk1, colibri_t20/t30: fix i2c bus frequencies

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Use a faster speed of 400 kbit/s for regular I2C busses.

Use a slower speed of 10 kbit/s for DDC/EDID to improve reliability.

Use a slower speed of 100 kbit/s for power I2C to be within specs of
the LM95245 temperature sensor.

While at it further annotate I2C pin usage.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-apalis-eval.dts|  5 ++---
 arch/arm/boot/dts/tegra124-apalis.dtsi|  2 +-
 arch/arm/boot/dts/tegra20-colibri-512.dtsi| 16 +++-
 arch/arm/boot/dts/tegra30-apalis-eval.dts |  2 +-
 arch/arm/boot/dts/tegra30-apalis.dtsi |  2 +-
 arch/arm/boot/dts/tegra30-colibri-eval-v3.dts |  2 +-
 arch/arm/boot/dts/tegra30-colibri.dtsi|  2 +-
 7 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts 
b/arch/arm/boot/dts/tegra124-apalis-eval.dts
index ecffcd115fa7..66b6c45ee865 100644
--- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
@@ -105,7 +105,7 @@
 */
i2c@7000c000 {
status = "okay";
-   clock-frequency = <10>;
+   clock-frequency = <40>;
 
pcie-switch@58 {
compatible = "plx,pex8605";
@@ -124,7 +124,6 @@
 */
hdmi_ddc: i2c@7000c400 {
status = "okay";
-   clock-frequency = <10>;
};
 
/*
@@ -133,7 +132,7 @@
 */
i2c@7000c500 {
status = "okay";
-   clock-frequency = <10>;
+   clock-frequency = <40>;
};
 
/* I2C4 (DDC): unused */
diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi 
b/arch/arm/boot/dts/tegra124-apalis.dtsi
index 5d9b18ef5af6..7aef8928e115 100644
--- a/arch/arm/boot/dts/tegra124-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
@@ -1579,7 +1579,7 @@
};
 
hdmi_ddc: i2c@7000c400 {
-   clock-frequency = <10>;
+   clock-frequency = <1>;
};
 
/* PWR_I2C: power I2C to audio codec, PMIC and temperature sensor */
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi 
b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
index 813ae34edd6a..5c202b3e3bb1 100644
--- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi
+++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
@@ -213,21 +213,27 @@
GPIO_ACTIVE_HIGH>;
};
 
+   /*
+* GEN1_I2C: I2C_SDA/SCL on SODIMM pin 194/196 (e.g. RTC on carrier
+* board)
+*/
i2c@7000c000 {
clock-frequency = <40>;
};
 
+   /* DDC_SCL/SDA on X3 pin 15/16 (e.g. display EDID) */
i2c_ddc: i2c@7000c400 {
-   clock-frequency = <10>;
+   clock-frequency = <1>;
};
 
-   i2c@7000c500 {
-   clock-frequency = <40>;
-   };
+   /* GEN2_I2C: unused */
 
+   /* CAM/GEN3_I2C: used as EXT_IO1/2 GPIOs on SODIMM pin 133/127 */
+
+   /* PWR_I2C: power I2C to PMIC and temperature sensor (On-module) */
i2c@7000d000 {
status = "okay";
-   clock-frequency = <40>;
+   clock-frequency = <10>;
 
pmic: tps6586x@34 {
compatible = "ti,tps6586x";
diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts 
b/arch/arm/boot/dts/tegra30-apalis-eval.dts
index 07b945b0391a..fdca527a2248 100644
--- a/arch/arm/boot/dts/tegra30-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts
@@ -79,7 +79,7 @@
 */
i2c@7000c000 {
status = "okay";
-   clock-frequency = <10>;
+   clock-frequency = <40>;
 
pcie-switch@58 {
compatible = "plx,pex8605";
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi 
b/arch/arm/boot/dts/tegra30-apalis.dtsi
index bfb7913c0657..676a4c4b1512 100644
--- a/arch/arm/boot/dts/tegra30-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -437,7 +437,7 @@
};
 
hdmiddc: i2c@7000c700 {
-   clock-frequency = <10>;
+   clock-frequency = <1>;
};
 
/*
diff --git a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts 
b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
index b307feb7c330..8c62833197e5 100644
--- a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
@@ -56,7 +56,7 @@
 */
i2c@7000c000 {
status = "okay";
-   clock-frequency = <10>;
+   clock-frequency = <40>;
 
/* M41T0M6 real time clock on carrier board */
rtc@68 {
diff --git a/arch/arm/boot/dts/tegra30-colibri.dtsi 
b/arch/arm/boot/dts/tegra30-colibri.dtsi
index 139bfa028b04..1f77273521bf 100644
--- a/arch/arm/boot/dts/tegra30-colibri.dtsi
+++ b/arch/arm/boot/dts/tegra30-colibri.dtsi
@@ -215,

Re: [PATCH] sunrpc: Add task's xid to 'not responding' messages on call_timeout

2018-02-09 Thread Trond Myklebust
On Fri, 2018-02-09 at 23:06 -0200, Thiago Rafael Becker wrote:
> When investigating reasons for nfs failures, packet dumps arei
> eventually used.
> Finding the rpc that generated the failure is done by comparing all
> sent
> rpc calls and all received rpc replies for those which are
> unanswered,
> which is prone to errors like
> - Slow server responses
> - Incomplete and uncaptured packets in the packet dump
> - The heuristics used to inspect packets failing to interpret one
> 
> This patch adds the xid of rpc_tasks to the 'not responding' messages
> in call_timeout to make these analysis more precise.
> 
> Signed-off-by: Thiago Rafael Becker 
> ---
>  net/sunrpc/clnt.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index e2a4184f3c5d..83c8aca951f4 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -2214,9 +2214,10 @@ call_timeout(struct rpc_task *task)
>   }
>   if (RPC_IS_SOFT(task)) {
>   if (clnt->cl_chatty) {
> - printk(KERN_NOTICE "%s: server %s not
> responding, timed out\n",
> + printk(KERN_NOTICE "%s: server %s not
> responding, timed out (xid: %x)\n",
>   clnt->cl_program->name,
> - task->tk_xprt->servername);
> + task->tk_xprt->servername,
> + be32_to_cpu(task->tk_rqstp-
> >rq_xid));
>   }
>   if (task->tk_flags & RPC_TASK_TIMEOUT)
>   rpc_exit(task, -ETIMEDOUT);
> @@ -2228,9 +2229,10 @@ call_timeout(struct rpc_task *task)
>   if (!(task->tk_flags & RPC_CALL_MAJORSEEN)) {
>   task->tk_flags |= RPC_CALL_MAJORSEEN;
>   if (clnt->cl_chatty) {
> - printk(KERN_NOTICE "%s: server %s not
> responding, still trying\n",
> + printk(KERN_NOTICE "%s: server %s not
> responding, still trying (xid: %x)\n",
>   clnt->cl_program->name,
> - task->tk_xprt->servername);
> + task->tk_xprt->servername,
> + be32_to_cpu(task->tk_rqstp->rq_xid));
>   }
>   }
>   rpc_force_rebind(clnt);

NACK. We should not be logging internal information such as XIDs as
KERN_NOTICE messages. If you want this information, you can extract it
yourself; there are already plenty of ways to do so as a privileged
user.

-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.mykleb...@primarydata.com


[PATCH 3/3] ARM: dts: tegra: apalis/colibri: remove unneeded reg property

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

As described in
Documentation/devicetree/bindings/input/touchscreen/stmpe.txt there is
no 'reg' property under stmpe_touchscreen, so remove it to fix the
following build warning with W=1:

arch/arm/boot/dts/tegra30-apalis-eval.dtb:
Warning (unit_address_vs_reg): Node
/i2c@7000d000/stmpe811@41/stmpe_touchscreen has a reg or ranges
property, but no unit name

Similar to commit 89277e8e2679 ("ARM: dts: imx6qdl-apalis: Remove
unneeded reg property").

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra30-apalis.dtsi  | 1 -
 arch/arm/boot/dts/tegra30-colibri.dtsi | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi 
b/arch/arm/boot/dts/tegra30-apalis.dtsi
index 676a4c4b1512..d1d21ec2a844 100644
--- a/arch/arm/boot/dts/tegra30-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -597,7 +597,6 @@
 
stmpe_touchscreen@0 {
compatible = "st,stmpe-ts";
-   reg = <0>;
/* 3.25 MHz ADC clock speed */
st,adc-freq = <1>;
/* 8 sample average control */
diff --git a/arch/arm/boot/dts/tegra30-colibri.dtsi 
b/arch/arm/boot/dts/tegra30-colibri.dtsi
index 1f77273521bf..c44d8c40c410 100644
--- a/arch/arm/boot/dts/tegra30-colibri.dtsi
+++ b/arch/arm/boot/dts/tegra30-colibri.dtsi
@@ -363,7 +363,6 @@
 
stmpe_touchscreen {
compatible = "st,stmpe-ts";
-   reg = <0>;
/* 3.25 MHz ADC clock speed */
st,adc-freq = <1>;
/* 8 sample average control */
-- 
2.14.3



Re: [PATCH 2/2] f2fs: support {d,id,did,x}node checksum

2018-02-09 Thread Jaegeuk Kim
On 02/01, Chao Yu wrote:
> 
> 
> On 2018/2/1 6:15, Jaegeuk Kim wrote:
> > On 01/31, Chao Yu wrote:
> >> On 2018/1/31 10:02, Jaegeuk Kim wrote:
> >>> What if we want to add more entries in addition to node_checksum? Do we 
> >>> have
> >>> to add a new feature flag at every time? How about adding a layout value 
> >>> instead
> >>
> >> Hmm.. for previous implementation, IMO, we'd better add a new feature flag 
> >> at
> >> every time, otherwise, w/ extra_nsize only, in current image, we can know a
> >> valid range of extended area in node block, but we don't know which
> >> fields/features are valid/enabled or not.
> >>
> >> One more thing is that if we can add one feature flag for each field, we 
> >> got one
> >> more chance to disable it dynamically.
> >>
> >>> of extra_nsize? For example, layout #1 means node_checksum with 
> >>> extra_nsize=X?
> >>>
> >>>
> >>> What does 1017 mean? We need to make this structure more flexibly for new
> >>
> >> Yes, using raw 1017 is not appropriate here.
> >>
> >>> entries. Like this?
> >>>   union {
> >>>   struct node_v1;
> >>>   struct node_v2;
> >>>   struct node_v3;
> >>>   ...
> >>>   struct direct_node dn;
> >>>   struct indirect_node in;
> >>>   };
> >>>   };
> >>>
> >>>   struct node_v1 {
> >>>   __le32 data[DEF_ADDRS_PER_BLOCK - V1_NSIZE=1];
> >>>   __le32 node_checksum;
> >>>   }
> >>>
> >>>   struct node_v2 {
> >>>   __le32 data[DEF_ADDRS_PER_BLOCK - V2_NSIZE=500];
> >>
> >> Hmm.. If we only need to add one more 4 bytes field in struct node_v2, but
> >> V2_NSIZE is defined as fixed 500, there must be 492 bytes wasted.
> >>
> >> Or we can define V2_NSIZE as 8, but if there comes more and more extended
> >> fields, node version count can be a large number, it results in complicated
> >> version recognization and handling.
> >>
> >> One more question is how can we control which fields are valid or not in
> >> comp[Vx_NSIZE]?
> >>
> >>
> >> Anyway, what I'm thinking is maybe we can restructure layout of node block 
> >> like
> >> the one used by f2fs_inode:
> >>
> >> struct f2fs_node {
> >>union {
> >>struct f2fs_inode i;
> >>union {
> >>struct {
> >>__le32 node_checksum;
> >>__le32 feature_field_1;
> >>__le32 feature_field_2;
> >>
> >>__le32 addr[];
> >>
> >>};
> >>struct direct_node dn;
> >>struct indirect_node in;
> >>};
> >>};
> >>struct node_footer footer;
> >> } __packed;
> >>
> >> Moving all extended fields to the head of f2fs_node, so we don't have to 
> >> use
> >> macro to indicate actual size of addr.
> > 
> > Thinking what'd be the best way. My concern is, once getting more entries, 
> > we
> 
> OK, I think we need more discussion.. ;)
> 
> > can't set each of features individually. Like the second entry should have
> 
> Oh, that will be hard. If we have to avoid that, we have to tag in somewhere
> e.g. f2fs_inode::i_flags2 to indicate which new field in f2fs_node is valid, 
> for
> example:
> 
> #define F2FS_NODE_CHECKSUM0x0001
> #define F2FS_NODE_FIELD1  0x0002
> #define F2FS_NODE_FIELD2  0x0004
> 
>   union {
>   struct {
>   __le32 node_checksum;
>   __le32 field_1;
>   __le32 field_2;
>   
>   __le32 addr[];
>   };
>   struct direct_node dn;
>   struct indirect_node in;
>   };
> 
> f2fs_inode::i_flags2 = F2FS_NODE_CHECKSUM | F2FS_NODE_FIELD1
> indicates that f2fs_node::node_checksum and f2fs_node::field_1 are valid;
> 
> f2fs_inode::i_flags2 = F2FS_NODE_FIELD1 | F2FS_NODE_FIELD2
> indicates that f2fs_node::field_1 and f2fs_node::field_2 are valid.

So, that's why I thought we may need a sort of each formats.

> 
> Any thoughts?
> 
> Thanks,
> 
> > enabled node_checksum, which we may not want to do.
> > 
> >>
> >> Thanks,
> >>
> >>>   __le32 comp[V2_NSIZE];
> >>>   }
> >>>   ...
> >>>
>  +};
>  +struct direct_node dn;
>  +struct indirect_node in;
>  +};
>   };
>   struct node_footer footer;
>   } __packed;
>  -- 
>  2.15.0.55.gc2ece9dc4de6
> >>>
> >>> .
> >>>


[PATCH 4/4] ARM: dts: tegra: venice2: remove duplicate pcie-1 node

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Get rid of duplicate pcie-1 node.

Signed-off-by: Marcel Ziswiler 

---

 arch/arm/boot/dts/tegra124-venice2.dts | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/boot/dts/tegra124-venice2.dts 
b/arch/arm/boot/dts/tegra124-venice2.dts
index c0469ea149d2..89bcc178994d 100644
--- a/arch/arm/boot/dts/tegra124-venice2.dts
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -956,11 +956,6 @@
nvidia,function = "usb3-ss";
status = "okay";
};
-
-   pcie-1 {
-   nvidia,function = "usb3-ss";
-   status = "okay";
-   };
};
};
};
-- 
2.14.3



[PATCH 0/4] dt/bindings & ARM: dts: tegra: updates

2018-02-09 Thread Marcel Ziswiler

This series fixes the Tegra GMI controller DT/bindings example, a few
IRQ type definitions, removes some invalid uses of rsvd1 pin muxes on
Beaver and removes a duplicate pcie-1 node on Venice2.


Marcel Ziswiler (4):
  dt/bindings: fix binding examples for tegra gmi controller
  ARM: dts: tegra: use proper irq type definitions
  ARM: dts: tegra: beaver: remove invalid uses of rsvd1
  ARM: dts: tegra: venice2: remove duplicate pcie-1 node

 .../devicetree/bindings/bus/nvidia,tegra20-gmi.txt |  6 ++--
 arch/arm/boot/dts/tegra114-dalmore.dts |  2 +-
 arch/arm/boot/dts/tegra124-jetson-tk1.dts  |  2 +-
 arch/arm/boot/dts/tegra124-venice2.dts |  9 ++
 arch/arm/boot/dts/tegra30-apalis.dtsi  |  4 +--
 arch/arm/boot/dts/tegra30-beaver.dts   | 32 +++---
 arch/arm/boot/dts/tegra30-colibri-eval-v3.dts  |  2 +-
 7 files changed, 25 insertions(+), 32 deletions(-)

-- 
2.14.3



[PATCH 3/4] ARM: dts: tegra: beaver: remove invalid uses of rsvd1

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Remove invalid uses of rsvd1 from beaver device tree. Replace by actual
function names of pinmux option 1.

Taken from https://github.com/NVIDIA/tegra-pinmux-scripts commit
b0aceda108c0 ("remove invalid uses of rsvd1 from beaver config").

Signed-off-by: Marcel Ziswiler 
---

 arch/arm/boot/dts/tegra30-beaver.dts | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/arm/boot/dts/tegra30-beaver.dts 
b/arch/arm/boot/dts/tegra30-beaver.dts
index 36b85a0ab0eb..ae52a5039506 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -260,14 +260,14 @@
};
sdmmc3_dat6_pd3 {
nvidia,pins = "sdmmc3_dat6_pd3";
-   nvidia,function = "rsvd1";
+   nvidia,function = "spdif";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
};
sdmmc3_dat7_pd4 {
nvidia,pins = "sdmmc3_dat7_pd4";
-   nvidia,function = "rsvd1";
+   nvidia,function = "spdif";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
@@ -281,14 +281,14 @@
};
vi_vsync_pd6 {
nvidia,pins = "vi_vsync_pd6";
-   nvidia,function = "rsvd1";
+   nvidia,function = "ddr";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
};
vi_hsync_pd7 {
nvidia,pins = "vi_hsync_pd7";
-   nvidia,function = "rsvd1";
+   nvidia,function = "ddr";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
@@ -806,7 +806,7 @@
};
hdmi_int_pn7 {
nvidia,pins = "hdmi_int_pn7";
-   nvidia,function = "rsvd1";
+   nvidia,function = "hdmi";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
@@ -841,7 +841,7 @@
};
ulpi_data3_po4 {
nvidia,pins = "ulpi_data3_po4";
-   nvidia,function = "rsvd1";
+   nvidia,function = "uarta";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
@@ -1107,21 +1107,21 @@
};
vi_d10_pt2 {
nvidia,pins = "vi_d10_pt2";
-   nvidia,function = "rsvd1";
+   nvidia,function = "ddr";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
};
vi_d11_pt3 {
nvidia,pins = "vi_d11_pt3";
-   nvidia,function = "rsvd1";
+   nvidia,function = "ddr";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
};
vi_d0_pt4 {
nvidia,pins = "vi_d0_pt4";
-   nvidia,function = "rsvd1";
+   nvidia,function = "ddr";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
@@ -1151,7 +1151,7 @@
};
pu0 {
nvidia,pins = "pu0";
-   nvidia,function = "rsvd1";
+   nvidia,function = "owr";
nvidia,pull = ;
nvidia,tristate = ;
nvidia,enable-input = ;
@@ -1172,7 +1172,7 @@
};
pu3 {
nvidia,pins = "pu3";
-   nvidia,function = "rsvd1";
+   nvidia,funct

[PATCH 2/4] ARM: dts: tegra: use proper irq type definitions

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

This switches a few interrupt definitions that were using either
GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW as IRQ type, which is invalid.

This is mostly a cosmetic change, that doesn't affect any driver.

Analogous to Paul's commit 38333641b6dd ("ARM: tegra: nyan: Use proper
IRQ type definitions").

Signed-off-by: Marcel Ziswiler 
---

 arch/arm/boot/dts/tegra114-dalmore.dts| 2 +-
 arch/arm/boot/dts/tegra124-jetson-tk1.dts | 2 +-
 arch/arm/boot/dts/tegra124-venice2.dts| 4 ++--
 arch/arm/boot/dts/tegra30-apalis.dtsi | 4 ++--
 arch/arm/boot/dts/tegra30-beaver.dts  | 2 +-
 arch/arm/boot/dts/tegra30-colibri-eval-v3.dts | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts 
b/arch/arm/boot/dts/tegra114-dalmore.dts
index acd6cf51b15b..eafff16765b4 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -780,7 +780,7 @@
compatible = "realtek,rt5640";
reg = <0x1c>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
realtek,ldo1-en-gpios =
<&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
};
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts 
b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
index d112f85e66ed..6dbcf84dafbc 100644
--- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
@@ -1418,7 +1418,7 @@
compatible = "realtek,rt5639";
reg = <0x1c>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
realtek,ldo1-en-gpios =
<&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_HIGH>;
};
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts 
b/arch/arm/boot/dts/tegra124-venice2.dts
index 32d9079f025b..c0469ea149d2 100644
--- a/arch/arm/boot/dts/tegra124-venice2.dts
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -613,7 +613,7 @@
compatible = "maxim,max98090";
reg = <0x10>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
};
};
 
@@ -859,7 +859,7 @@
reg = <0x9>;
interrupt-parent = <&gpio>;
interrupts = ;
+   IRQ_TYPE_EDGE_BOTH>;
ti,ac-detect-gpios = <&gpio
TEGRA_GPIO(J, 0)
GPIO_ACTIVE_HIGH>;
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi 
b/arch/arm/boot/dts/tegra30-apalis.dtsi
index faa8cd2914e8..bfb7913c0657 100644
--- a/arch/arm/boot/dts/tegra30-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -657,7 +657,7 @@
reg = <1>;
clocks = <&clk16m>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
spi-max-frequency = <1000>;
};
};
@@ -672,7 +672,7 @@
reg = <0>;
clocks = <&clk16m>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
spi-max-frequency = <1000>;
};
};
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts 
b/arch/arm/boot/dts/tegra30-beaver.dts
index 5331a8f7dcf8..36b85a0ab0eb 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -1762,7 +1762,7 @@
compatible = "realtek,rt5640";
reg = <0x1c>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
realtek,ldo1-en-gpios =
<&gpio TEGRA_GPIO(X, 2) GPIO_ACTIVE_HIGH>;
};
diff --git a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts 
b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
index 3c5fb2430212..b307feb7c330 100644
--- a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
@@ -79,7 +79,7 @@
reg = <0>;
clocks = <&clk16m>;
interrupt-parent = <&gpio>;
-   interrupts = ;
+   interrupts = ;
spi-max-frequency = <1000>;
};
spidev0: spi@1 {
-- 

[PATCH 1/4] dt/bindings: fix binding examples for tegra gmi controller

2018-02-09 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Fix devicetree binding examples for the Generic Memory Interface (GMI)
bus driver found on Tegra SOCs.

While at it also remove double new lines as a left over from Rob's
commit 4da722ca19f3 ("dt-bindings: Remove "status" from examples").

Signed-off-by: Marcel Ziswiler 
---

 Documentation/devicetree/bindings/bus/nvidia,tegra20-gmi.txt | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/bus/nvidia,tegra20-gmi.txt 
b/Documentation/devicetree/bindings/bus/nvidia,tegra20-gmi.txt
index 3e21eb822811..c1e70621799b 100644
--- a/Documentation/devicetree/bindings/bus/nvidia,tegra20-gmi.txt
+++ b/Documentation/devicetree/bindings/bus/nvidia,tegra20-gmi.txt
@@ -73,7 +73,7 @@ Example with two SJA1000 CAN controllers connected to the GMI 
bus. We wrap the
 controllers with a simple-bus node since they are all connected to the same
 chip-select (CS4), in this example external address decoding is provided:
 
-gmi@7009 {
+gmi@70009000 {
compatible = "nvidia,tegra20-gmi";
reg = <0x70009000 0x1000>;
#address-cells = <2>;
@@ -84,7 +84,6 @@ gmi@7009 {
reset-names = "gmi";
ranges = <4 0 0xd000 0xfff>;
 
-
bus@4,0 {
compatible = "simple-bus";
#address-cells = <1>;
@@ -109,7 +108,7 @@ gmi@7009 {
 Example with one SJA1000 CAN controller connected to the GMI bus
 on CS4:
 
-gmi@7009 {
+gmi@70009000 {
compatible = "nvidia,tegra20-gmi";
reg = <0x70009000 0x1000>;
#address-cells = <2>;
@@ -120,7 +119,6 @@ gmi@7009 {
reset-names = "gmi";
ranges = <4 0 0xd000 0xfff>;
 
-
can@4,0 {
reg = <4 0 0x100>;
nvidia,snor-mux-mode;
-- 
2.14.3



Re: possible deadlock in get_user_pages_unlocked

2018-02-09 Thread Al Viro
On Fri, Feb 02, 2018 at 09:57:27AM +0100, Dmitry Vyukov wrote:

> syzbot tests for up to 5 minutes. However, if there is a race involved
> then you may need more time because the crash is probabilistic.
> But from what I see most of the time, if one can't reproduce it
> easily, it's usually due to some differences in setup that just don't
> allow the crash to happen at all.
> FWIW syzbot re-runs each reproducer on a freshly booted dedicated VM
> and what it provided is the kernel output it got during run of the
> provided program. So we have reasonably high assurance that this
> reproducer worked in at least one setup.

Could you guys check if the following fixes the reproducer?

diff --git a/mm/gup.c b/mm/gup.c
index 61015793f952..058a9a8e4e2e 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -861,6 +861,9 @@ static __always_inline long __get_user_pages_locked(struct 
task_struct *tsk,
BUG_ON(*locked != 1);
}
 
+   if (flags & FOLL_NOWAIT)
+   locked = NULL;
+
if (pages)
flags |= FOLL_GET;
 


Re: [patch v2 1/3] platform/x86: mlx-platform: Add support for new msn274x system type

2018-02-09 Thread Darren Hart
On Fri, Feb 09, 2018 at 11:59:30PM +, Vadim Pasternak wrote:
> It adds support for new Mellanox system types of basic class msn274x,
> containing system MSN2740 (32x100GbE Ethernet switch with cost reduction)
> and its derivatives. These are the Top of the Rack system, equipped with
> Mellanox Small Form Factor carrier board and switch board with Mellanox
> Spectrum device, which supports Ethernet switching with 32X100G ports line
> rate of up to EDR speed.
> 
> Signed-off-by: Vadim Pasternak 

Hi Vadim,

For timing reasons, I've queued these for review - thanks. A few comments to
make this more smooth in the future:

> v1->v2
>   Comments pointed out by Darren:
>   - Break the patch into series of patches per system type.

Patch changelogs go below the --- line...

> ---

Here. This makes it so the intermediate patch changelog (Since v1... stuff) is
dropped automatically from the commit when using git am to apply the patch. As
these are coming in, I have to apply and then "git rebase -i" to (r)eword each
one individually to prune out the v1->v2 stuff.

For the official description of this process, please see:
Documentation/process/submitting-patches.rst
14) The canonical patch format

>  drivers/platform/x86/mlx-platform.c | 124 
> 
>  1 file changed, 124 insertions(+)
> 
> diff --git a/drivers/platform/x86/mlx-platform.c 
> b/drivers/platform/x86/mlx-platform.c
> index e87fe34..3a13285 100644
> --- a/drivers/platform/x86/mlx-platform.c
> +++ b/drivers/platform/x86/mlx-platform.c
> @@ -94,6 +94,7 @@
>  /* Hotplug devices adapter numbers */
>  #define MLXPLAT_CPLD_NR_NONE -1
>  #define MLXPLAT_CPLD_PSU_DEFAULT_NR  10
> +#define MLXPLAT_CPLD_PSU_MSN_NR  4
>  #define MLXPLAT_CPLD_FAN1_DEFAULT_NR 11
>  #define MLXPLAT_CPLD_FAN2_DEFAULT_NR 12
>  #define MLXPLAT_CPLD_FAN3_DEFAULT_NR 13
> @@ -335,6 +336,108 @@ struct mlxreg_core_hotplug_platform_data 
> mlxplat_mlxcpld_msn21xx_data = {
>   .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW,
>  };
>  
> +/* Platform hotplug msn274x system family data */
> +static struct mlxreg_core_data mlxplat_mlxcpld_msn274x_psu_items_data[] = {
> + {
> + .label = "psu1",
> + .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET,
> + .mask = BIT(0),
> + .hpdev.brdinfo = &mlxplat_mlxcpld_psu[0],
> + .hpdev.nr = MLXPLAT_CPLD_PSU_MSN_NR,
> + },
> + {
> + .label = "psu2",
> + .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET,
> + .mask = BIT(1),
> + .hpdev.brdinfo = &mlxplat_mlxcpld_psu[1],
> + .hpdev.nr = MLXPLAT_CPLD_PSU_MSN_NR,
> + },
> +};
> +
> +static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_pwr_items_data[] = 
> {

This is OK as is, but in terms of helping articulate what I'm looking for with
respect to breaking up patches into atomic functional patches, the
"*default_ng*" structs are something that may have been better off in their own
patch. Here's why.

Let's say something turned out to be bad with this (1/3) patch. If I were to
revert it, I would break everything that was dependent on the
...default_ng_pwr... struct. The idea is to remove as many interdependencies as
possible and to make each patch as self contained as possible. This makes them
easier to review as well as easier to use in a patch-granular way for stable,
distro, and future mainline debug and maintenance work.

No need to resend, the risk is minimal here and these are highly contained to
just the one file. Something to apply to future work.

Thanks!
-- 
Darren Hart
VMware Open Source Technology Center


Re: [Resend] Question: kselftests: bpf/test_maps failed

2018-02-09 Thread Alexei Starovoitov
On Fri, Feb 09, 2018 at 03:01:57PM +0100, Daniel Borkmann wrote:
> On 02/09/2018 06:14 AM, Li Zhijian wrote:
> > Hi
> > 
> > INTEL 0-Day noticed that bpf/test_maps has different results at different 
> > platforms.
> > when it fails, the details are like
> 
> Sorry for the late reply and thanks for reporting! More below:
> 
> > --
> >   880 Failed to create hashmap key=16 value=131072 'Cannot allocate memory'
> >   881 Failed to create hashmap key=8 value=32768 'Cannot allocate memory'
> >   882 Failed to create hashmap key=8 value=131072 'Cannot allocate memory'
> >   883 Failed to create hashmap key=16 value=32768 'Cannot allocate memory'
> >   884 Failed to create hashmap key=8 value=16384 'Cannot allocate memory'
> >   885 Failed to create hashmap key=16 value=16384 'Cannot allocate memory'
> >   886 Failed to create hashmap key=8 value=65536 'Cannot allocate memory'
> >   887 Failed to create hashmap key=16 value=131072 'Cannot allocate memory'
> >   888 Failed to create hashmap key=16 value=32768 'Cannot allocate memory'
> >   889 Failed to create hashmap key=16 value=65536 'Cannot allocate memory'
> >   890 Failed to create hashmap key=8 value=65536 'Cannot allocate memory'
> >   891 Failed to create hashmap key=8 value=131072 'Cannot allocate memory'
> >   892 Failed to create hashmap key=8 value=131072 'Cannot allocate memory'
> >   893 Failed to create hashmap key=16 value=32768 'Cannot allocate memory'
> >   894 Failed to create hashmap key=8 value=16384 'Cannot allocate memory'
> >   895 Failed to create hashmap key=8 value=131072 'Cannot allocate memory'
> >   896 Failed to create hashmap key=16 value=8192 'Cannot allocate memory'
> >   897 Failed to create hashmap key=8 value=32768 'Cannot allocate memory'
> >   898 Failed to create hashmap key=16 value=8192 'Cannot allocate memory'
> >   899 Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
> >   900 Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
> >   901 Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
> >   902 Failed to create hashmap key=16 value=262144 'Cannot allocate memory'
> >   903 Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
> >   904 Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
> >   905 test_maps: test_maps.c:955: run_parallel: Assertion `status == 0' 
> > failed.
> >   906 Aborted
> >   907 not ok 1..3 selftests:  test_maps [FAIL]
> > --
> > 
> > After a simply looking at the code, looks it's related to the cpu number 
> > and system memory.
> > 
> > below are the result under different platform
> > 1. Good
> > model: Sandy Bridge
> > nr_node: 1
> > nr_cpu: 4
> > memory: 6G
> > 
> > 2. Good
> > model: qemu-system-x86_64 -enable-kvm
> > nr_cpu: 2
> > memory: 4G
> > 
> > 3. Bad
> > model: Ivytown Ivy Bridge-EP
> > nr_cpu: 48
> > memory: 64G
> > 
> > 4. Bad
> > model: Skylake
> > nr_cpu: 104
> > memory: 64G
> > 
> > I try to change the process number to 10 from 100, so it can pass at above 
> > Skylake(4) machine.
> > 
> > lizhijian@haswell-OptiPlex-9020:~/lkp/linux/tools/testing/selftests/bpf$ 
> > git diff
> > diff --git a/tools/testing/selftests/bpf/test_maps.c 
> > b/tools/testing/selftests/bpf/test_maps.c
> > index 040356e..b788ca1 100644
> > --- a/tools/testing/selftests/bpf/test_maps.c
> > +++ b/tools/testing/selftests/bpf/test_maps.c
> > @@ -960,7 +960,7 @@ static void test_map_stress(void)
> >  {
> >     run_parallel(100, test_hashmap, NULL);
> >     run_parallel(100, test_hashmap_percpu, NULL);
> > -   run_parallel(100, test_hashmap_sizes, NULL);
> > +   run_parallel(10, test_hashmap_sizes, NULL);
> >     run_parallel(100, test_hashmap_walk, NULL);
> >  
> >     run_parallel(100, test_arraymap, NULL);
> 
> Unless Alexei has some better idea, I think if the bpf_create_map() error in
> the stress test is about ENOMEM, then we shouldn't fail hard via exit(), for
> all other cases we should however. So probably makes sense to just check for
> errno == ENOMEM in case of fd < 0 in test_hashmap_sizes() and then continue
> to keep trying under stress. Feel free to send a patch, Li.

that's probably good path for now.
I also see that test_maps fails on freshly booted kernel with such assert,
but then restarting test_maps again works and repeated runs succeed too.
I suspect there is a deeper issue here related to memory allocation.
Either slab or percpu allocator are behaving funky.
It needs to be further debugged.



[PATCH] mconsole_proc(): don't mess with file->f_pos

2018-02-09 Thread Al Viro
mconsole_proc(): don't mess with file->f_pos

Signed-off-by: Al Viro 
---
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index c4d162a94be9..d5f9a2d1da1b 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -130,6 +130,7 @@ void mconsole_proc(struct mc_request *req)
struct file *file;
int first_chunk = 1;
char *ptr = req->request.data;
+   loff_t pos = 0;
 
ptr += strlen("proc");
ptr = skip_spaces(ptr);
@@ -148,7 +149,7 @@ void mconsole_proc(struct mc_request *req)
}
 
do {
-   len = kernel_read(file, buf, PAGE_SIZE - 1, &file->f_pos);
+   len = kernel_read(file, buf, PAGE_SIZE - 1, &pos);
if (len < 0) {
mconsole_reply(req, "Read of file failed", 1, 0);
goto out_free;


[git pull] a couple of fixes

2018-02-09 Thread Al Viro

The following changes since commit ce4bb04cae8924792ed92f4af2793b77fc986f0e:

  Fix a leak in socket(2) when we fail to allocate a file descriptor. 
(2018-01-10 18:47:05 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus

for you to fetch changes up to cf5eebae2cd28d37581507668605f4d23cd7218d:

  seq_file: fix incomplete reset on read from zero offset (2018-01-20 02:31:15 
-0500)


Ivan Vecera (1):
  kernfs: fix regression in kernfs_fop_write caused by wrong type

Miklos Szeredi (1):
  seq_file: fix incomplete reset on read from zero offset

 fs/kernfs/file.c | 2 +-
 fs/seq_file.c| 5 -
 2 files changed, 5 insertions(+), 2 deletions(-)


Re: [PATCH v2] tools/memory-model: Make compat with herd7 7.47 ("-" -> "_")

2018-02-09 Thread Paul E. McKenney
On Sat, Feb 10, 2018 at 08:46:25AM +0900, Akira Yokosawa wrote:
> >From 7c1f497a9a51e8db1a94c8a7ef0b74b235aaab88 Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa 
> Date: Fri, 9 Feb 2018 04:51:05 -0800
> Subject: [PATCH v2] tools/memory-model: Make compat with herd7 7.47 ("-" -> 
> "_")
> 
> As of herd7 7.47, these '-'s are not permitted and end up in
> errors such as:
> 
> File "./linux-kernel.def", line 44, characters 29-30:
> unexpected '-' (in macros)
> 
> Partial revert of commit 2d5fba7782d6 ("linux-kernel*: Make RCU
> identifiers match ASPLOS paper") in the repository at
> https://github.com/aparri/memory-model can restore the compatibility
> with herd7 7.47.
> 
> Reported-by: Patrick Bellasi 
> Suggested-by: Andrea Parri 
> Signed-off-by: Akira Yokosawa 
> ---
> Paul,
> 
> FWIW, this is a squashed version relative to patch 07/10 in the RFC series.

Thank you, Akira!

I am going to hold off on this for a bit to see if we can instead get
a new release of herd7, but if we can't. this might well be a very good
way to go.

Thanx, Paul

> Thanks, Akira
> --
>  tools/memory-model/linux-kernel.bell | 14 +++---
>  tools/memory-model/linux-kernel.cat  |  2 +-
>  tools/memory-model/linux-kernel.def  |  8 
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/memory-model/linux-kernel.bell 
> b/tools/memory-model/linux-kernel.bell
> index b984bbd..436791b 100644
> --- a/tools/memory-model/linux-kernel.bell
> +++ b/tools/memory-model/linux-kernel.bell
> @@ -25,9 +25,9 @@ enum Barriers = 'wmb (*smp_wmb*) ||
>   'rmb (*smp_rmb*) ||
>   'mb (*smp_mb*) ||
>   'rb_dep (*smp_read_barrier_depends*) ||
> - 'rcu-lock (*rcu_read_lock*)  ||
> - 'rcu-unlock (*rcu_read_unlock*) ||
> - 'sync-rcu (*synchronize_rcu*) ||
> + 'rcu_lock (*rcu_read_lock*)  ||
> + 'rcu_unlock (*rcu_read_unlock*) ||
> + 'sync_rcu (*synchronize_rcu*) ||
>   'before_atomic (*smp_mb__before_atomic*) ||
>   'after_atomic (*smp_mb__after_atomic*) ||
>   'after_spinlock (*smp_mb__after_spinlock*)
> @@ -35,8 +35,8 @@ instructions F[Barriers]
> 
>  (* Compute matching pairs of nested Rcu-lock and Rcu-unlock *)
>  let matched = let rec
> - unmatched-locks = Rcu-lock \ domain(matched)
> - and unmatched-unlocks = Rcu-unlock \ range(matched)
> + unmatched-locks = Rcu_lock \ domain(matched)
> + and unmatched-unlocks = Rcu_unlock \ range(matched)
>   and unmatched = unmatched-locks | unmatched-unlocks
>   and unmatched-po = [unmatched] ; po ; [unmatched]
>   and unmatched-locks-to-unlocks =
> @@ -46,8 +46,8 @@ let matched = let rec
>   in matched
> 
>  (* Validate nesting *)
> -flag ~empty Rcu-lock \ domain(matched) as unbalanced-rcu-locking
> -flag ~empty Rcu-unlock \ range(matched) as unbalanced-rcu-locking
> +flag ~empty Rcu_lock \ domain(matched) as unbalanced-rcu-locking
> +flag ~empty Rcu_unlock \ range(matched) as unbalanced-rcu-locking
> 
>  (* Outermost level of nesting only *)
>  let crit = matched \ (po^-1 ; matched ; po^-1)
> diff --git a/tools/memory-model/linux-kernel.cat 
> b/tools/memory-model/linux-kernel.cat
> index babe2b3..d0085d5 100644
> --- a/tools/memory-model/linux-kernel.cat
> +++ b/tools/memory-model/linux-kernel.cat
> @@ -32,7 +32,7 @@ let mb = ([M] ; fencerel(Mb) ; [M]) |
>   ([M] ; fencerel(Before_atomic) ; [RMW] ; po? ; [M]) |
>   ([M] ; po? ; [RMW] ; fencerel(After_atomic) ; [M]) |
>   ([M] ; po? ; [LKW] ; fencerel(After_spinlock) ; [M])
> -let gp = po ; [Sync-rcu] ; po?
> +let gp = po ; [Sync_rcu] ; po?
> 
>  let strong-fence = mb | gp
> 
> diff --git a/tools/memory-model/linux-kernel.def 
> b/tools/memory-model/linux-kernel.def
> index a397387..fc08371 100644
> --- a/tools/memory-model/linux-kernel.def
> +++ b/tools/memory-model/linux-kernel.def
> @@ -41,10 +41,10 @@ spin_unlock(X) { __unlock(X) ; }
>  spin_trylock(X) __trylock(X)
> 
>  // RCU
> -rcu_read_lock() { __fence{rcu-lock}; }
> -rcu_read_unlock() { __fence{rcu-unlock};}
> -synchronize_rcu() { __fence{sync-rcu}; }
> -synchronize_rcu_expedited() { __fence{sync-rcu}; }
> +rcu_read_lock() { __fence{rcu_lock}; }
> +rcu_read_unlock() { __fence{rcu_unlock};}
> +synchronize_rcu() { __fence{sync_rcu}; }
> +synchronize_rcu_expedited() { __fence{sync_rcu}; }
> 
>  // Atomic
>  atomic_read(X) READ_ONCE(*X)
> -- 
> 2.7.4
> 
> 



[PATCH] sunrpc: Add task's xid to 'not responding' messages on call_timeout

2018-02-09 Thread Thiago Rafael Becker
When investigating reasons for nfs failures, packet dumps arei eventually used.
Finding the rpc that generated the failure is done by comparing all sent
rpc calls and all received rpc replies for those which are unanswered,
which is prone to errors like
- Slow server responses
- Incomplete and uncaptured packets in the packet dump
- The heuristics used to inspect packets failing to interpret one

This patch adds the xid of rpc_tasks to the 'not responding' messages
in call_timeout to make these analysis more precise.

Signed-off-by: Thiago Rafael Becker 
---
 net/sunrpc/clnt.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index e2a4184f3c5d..83c8aca951f4 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2214,9 +2214,10 @@ call_timeout(struct rpc_task *task)
}
if (RPC_IS_SOFT(task)) {
if (clnt->cl_chatty) {
-   printk(KERN_NOTICE "%s: server %s not responding, timed 
out\n",
+   printk(KERN_NOTICE "%s: server %s not responding, timed 
out (xid: %x)\n",
clnt->cl_program->name,
-   task->tk_xprt->servername);
+   task->tk_xprt->servername,
+   be32_to_cpu(task->tk_rqstp->rq_xid));
}
if (task->tk_flags & RPC_TASK_TIMEOUT)
rpc_exit(task, -ETIMEDOUT);
@@ -2228,9 +2229,10 @@ call_timeout(struct rpc_task *task)
if (!(task->tk_flags & RPC_CALL_MAJORSEEN)) {
task->tk_flags |= RPC_CALL_MAJORSEEN;
if (clnt->cl_chatty) {
-   printk(KERN_NOTICE "%s: server %s not responding, still 
trying\n",
+   printk(KERN_NOTICE "%s: server %s not responding, still 
trying (xid: %x)\n",
clnt->cl_program->name,
-   task->tk_xprt->servername);
+   task->tk_xprt->servername,
+   be32_to_cpu(task->tk_rqstp->rq_xid));
}
}
rpc_force_rebind(clnt);
-- 
2.14.3



Re: [PATCH RFC tip/lkmm 04/10] EXP litmus_tests: Add comments explaining tests' purposes

2018-02-09 Thread Paul E. McKenney
On Fri, Feb 09, 2018 at 01:46:30PM -0500, Alan Stern wrote:
> On Fri, 9 Feb 2018, Paul E. McKenney wrote:
> 
> > This commit adds comments to the litmus tests summarizing what these
> > tests are intended to demonstrate.
> > 
> > Suggested-by: Ingo Molnar 
> > Signed-off-by: Paul E. McKenney 
> > [ paulmck: Apply Andrea's and Alan's feedback. ]
> > ---
> 
> > --- a/tools/memory-model/litmus-tests/IRIW+poonceonces+OnceOnce.litmus
> > +++ b/tools/memory-model/litmus-tests/IRIW+poonceonces+OnceOnce.litmus
> > @@ -1,5 +1,15 @@
> >  C IRIW+poonceonces+OnceOnce
> >  
> > +(*
> > + * Result: Never
> > + *
> > + * Test of independent reads from independent writes with nothing
> > + * between each pairs of reads.  In other words, is anything at all
> > + * needed to cause two different reading processes to agree on the order
> > + * of a pair of writes, where each write is to a different variable by a
> > + * different process?
> > + *)
> 
> The result should be Sometimes.

Right you are, and better yet, the memory model agrees with you.

I have fixed this, thank you for the careful review!

Thanx, Paul



Re: [PATCH 1/2] Documentation/memory-barriers.txt: cross-reference "tools/memory-model/"

2018-02-09 Thread Paul E. McKenney
On Fri, Feb 09, 2018 at 04:00:53PM +0100, Andrea Parri wrote:
> On Fri, Feb 09, 2018 at 06:29:23AM -0800, Paul E. McKenney wrote:
> > On Fri, Feb 09, 2018 at 01:50:51PM +0100, Andrea Parri wrote:
> > > On Fri, Feb 09, 2018 at 04:31:00AM -0800, Paul E. McKenney wrote:
> > > > On Sun, Feb 04, 2018 at 07:37:08PM +0100, Andrea Parri wrote:
> > > > > Hi Akira,
> > > > > 
> > > > > On Mon, Feb 05, 2018 at 01:14:10AM +0900, Akira Yokosawa wrote:
> > > > > > Hi Paul,
> > > > > > CC: Andrea
> > > > > > 
> > > > > > This is intentionally off the list, as I was not cc'd in the thread.
> > > > > > If you think it is worthwhile, could you help me join the thread by
> > > > > > forwarding the following part as a reply to your message, plus CC: 
> > > > > > to me.
> > > > > 
> > > > > [CCing lists and other people]
> > > > > 
> > > > > 
> > > > > > 
> > > > > > On Fri, Feb 02, 2018 at 17:21:03AM -0800, Paul E. McKenney wrote:
> > > > > > > On Fri, Feb 02, 2018 at 10:12:48AM +0100, Andrea Parri wrote:
> > > > > > >> Recent efforts led to the specification of a memory consistency 
> > > > > > >> model
> > > > > > >> for the Linux kernel [1], which "can (roughly speaking) be 
> > > > > > >> thought of
> > > > > > >> as an automated version of memory-barriers.txt" and which is (in 
> > > > > > >> turn)
> > > > > > >> "accompanied by extensive documentation on its use and its 
> > > > > > >> design".
> > > > > > >> 
> > > > > > >> Make sure that the (occasional) reader of memory-barriers.txt 
> > > > > > >> will be
> > > > > > >> aware of these developments.
> > > > > > >> 
> > > > > > >> [1] https://marc.info/?l=linux-kernel&m=151687290114799&w=2
> > > > > > >> 
> > > > > > >> Signed-off-by: Andrea Parri 
> > > > > > > 
> > > > > > > I am inclined to pull in something along these lines, but would 
> > > > > > > like
> > > > > > > some feedback on the wording, especially how "official" we want to
> > > > > > > make the memory model to be.
> > > > > > > 
> > > > > > > Thoughts?
> > > > > > 
> > > > > > The change log of commit e7720af5f9ac ("locking/Documentation: Add 
> > > > > > disclaimer") says:
> > > > > > 
> > > > > > It appears people are reading this document as a requirements 
> > > > > > list for
> > > > > > building hardware. This is not the intent of this document. Nor 
> > > > > > is it
> > > > > > particularly suited for this purpose.
> > > > > > 
> > > > > > The primary purpose of this document is our collective attempt 
> > > > > > to define
> > > > > > a set of primitives that (hopefully) allow us to write correct 
> > > > > > code on
> > > > > > the myriad of SMP platforms Linux supports.
> > > > > > 
> > > > > > Its a definite work in progress as our understanding of these 
> > > > > > platforms,
> > > > > > and memory ordering in general, progresses.
> > > > > > 
> > > > > > Nor does being mentioned in this document mean we think its a
> > > > > > particularly good idea; the data dependency barrier required by 
> > > > > > Alpha
> > > > > > being a prime example. Yes we have it, no you're insane to 
> > > > > > require it
> > > > > > when building new hardware.
> > > > > > 
> > > > > > My take on the Linux Kernel memory-consistency model is a 
> > > > > > supplement of
> > > > > > memory-barriers.txt and the disclaimer also applies to the memory 
> > > > > > model.
> > > > > > 
> > > > > > > 
> > > > > > > If I don't hear otherwise in a couple of days, I will pull this 
> > > > > > > as is.
> > > > > > > 
> > > > > > >   Thanx, Paul
> > > > > > > 
> > > > > > >> ---
> > > > > > >>  Documentation/memory-barriers.txt | 4 +++-
> > > > > > >>  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > > >> 
> > > > > > >> diff --git a/Documentation/memory-barriers.txt 
> > > > > > >> b/Documentation/memory-barriers.txt
> > > > > > >> index a863009849a3b..8cc3f098f4a7d 100644
> > > > > > >> --- a/Documentation/memory-barriers.txt
> > > > > > >> +++ b/Documentation/memory-barriers.txt
> > > > > > >> @@ -17,7 +17,9 @@ meant as a guide to using the various memory 
> > > > > > >> barriers provided by Linux, but
> > > > > > >>  in case of any doubt (and there are many) please ask.
> > > > > > >> 
> > > > > > >>  To repeat, this document is not a specification of what Linux 
> > > > > > >> expects from
> > > > > > >> -hardware.
> > > > > > >> +hardware.  For such a specification, in the form of a memory 
> > > > > > >> consistency
> > > > > > >> +model, and for documentation about its usage and its design, 
> > > > > > >> the reader is
> > > > > > >> +referred to "tools/memory-model/".
> > > > > > >> 
> > > > > > 
> > > > > > Adding cross-reference in this way can _weaken_ the message of the 
> > > > > > disclaimer.
> > > > > 
> > > > > Thank you for your remarks; I do share the same concern.
> > > > > 
> > > > > > What about adding it in the previous sentence as the patch appended 
> > > > > > bellow?
> > > >

[PATCH v2] x86: simplify NR_CPUS config

2018-02-09 Thread Randy Dunlap
From: Randy Dunlap 

Clean up and simplify the X86 NR_CPUS Kconfig symbol/option by
introducing RANGE_BEGIN_CPUS, RANGE_END_CPUS, and DEF_CONFIG_CPUS.
Then combine some default values when their conditionals can be
reduced.

Also move the X86_BIGSMP kconfig option inside an "if X86_32"/"endif"
config block and drop its explicit "depends on X86_32".

Combine the max. 8192 cases of RANGE_END_CPUS (X86_64 only).
Split RANGE_END_CPUS and DEF_CONFIG_CPUS into separate cases for
X86_32 and X86_64.

Suggested-by: Linus Torvalds 
Link: 
lkml.kernel.org/r/ca+55afzod3j6zuskewtdk85qtt1jywotm3zab-qavt8_hj6...@mail.gmail.com
Signed-off-by: Randy Dunlap 
Cc: x...@kernel.org
---
 arch/x86/Kconfig |   57 +
 1 file changed, 42 insertions(+), 15 deletions(-)

v2: more simplification as suggested by Linus; also separate the
X86_32 and X86_64 configs.

--- linux-next-20180209.orig/arch/x86/Kconfig
+++ linux-next-20180209/arch/x86/Kconfig
@@ -423,12 +423,6 @@ config X86_MPPARSE
  For old smp systems that do not have proper acpi support. Newer 
systems
  (esp with 64bit cpus) with acpi support, MADT and DSDT will override 
it
 
-config X86_BIGSMP
-   bool "Support for big SMP systems with more than 8 CPUs"
-   depends on X86_32 && SMP
-   ---help---
- This option is needed for the systems that have more than 8 CPUs
-
 config GOLDFISH
def_bool y
depends on X86_GOLDFISH
@@ -460,6 +454,12 @@ config INTEL_RDT
  Say N if unsure.
 
 if X86_32
+config X86_BIGSMP
+   bool "Support for big SMP systems with more than 8 CPUs"
+   depends on SMP
+   ---help---
+ This option is needed for the systems that have more than 8 CPUs
+
 config X86_EXTENDED_PLATFORM
bool "Support for extended (non-PC) x86 platforms"
default y
@@ -949,17 +949,44 @@ config MAXSMP
  Enable maximum number of CPUS and NUMA Nodes for this architecture.
  If unsure, say N.
 
+config RANGE_END_CPUS
+   int
+   depends on X86_32
+   default 8 if SMP && !X86_BIGSMP
+   default 64 if SMP && X86_BIGSMP
+   default 1 if !SMP
+
+config RANGE_END_CPUS
+   int
+   depends on X86_64
+   default 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK
+   default 8192 if SMP && (MAXSMP || CPUMASK_OFFSTACK)
+   default 1 if !SMP
+
+config RANGE_BEGIN_CPUS
+   int
+   default 1 if !SMP
+   default RANGE_END_CPUS if MAXSMP
+   default 2
+
+config DEF_CONFIG_CPUS
+   int
+   depends on X86_32
+   default 1 if !SMP
+   default 32 if X86_BIGSMP
+   default 8 if SMP
+
+config DEF_CONFIG_CPUS
+   int
+   depends on X86_64
+   default 1 if !SMP
+   default 8192 if MAXSMP
+   default 64 if SMP
+
 config NR_CPUS
int "Maximum number of CPUs" if SMP && !MAXSMP
-   range 2 8 if SMP && X86_32 && !X86_BIGSMP
-   range 2 64 if SMP && X86_32 && X86_BIGSMP
-   range 2 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK && X86_64
-   range 2 8192 if SMP && !MAXSMP && CPUMASK_OFFSTACK && X86_64
-   default "1" if !SMP
-   default "8192" if MAXSMP
-   default "32" if SMP && X86_BIGSMP
-   default "8" if SMP && X86_32
-   default "64" if SMP
+   range RANGE_BEGIN_CPUS RANGE_END_CPUS
+   default DEF_CONFIG_CPUS
---help---
  This allows you to specify the maximum number of CPUs which this
  kernel will support.  If CPUMASK_OFFSTACK is enabled, the maximum




[PATCH v2 0/2] mm, smaps: MMUPageSize for device-dax

2018-02-09 Thread Dave Jiang
Andrew,

>From Dan Williams:
Here is another occasion where we want special-case hugetlbfs enabling
to also apply to device-dax. I started to wonder what other hstate
conversions we might do beyond ->split() and ->pagesize(), but this
appears to be the last of the usages of hstate_vma() in
generic/non-hugetlbfs specific code paths.

v2:
I fixed up the powerpc build issue that Michal reported by restoring the
original location of the function and making the symbol weak.

---

Dan Williams (2):
  mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct
  device-dax: implement ->pagesize() for smaps to report MMUPageSize


 arch/powerpc/mm/hugetlbpage.c |5 +
 drivers/dax/device.c  |   10 ++
 include/linux/mm.h|1 +
 mm/hugetlb.c  |   23 ---
 4 files changed, 24 insertions(+), 15 deletions(-)

--


[PATCH v2 1/2] mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct

2018-02-09 Thread Dave Jiang
From: Dan Williams 

When device-dax is operating in huge-page mode we want it to behave like
hugetlbfs and report the MMU page mapping size that is being enforced by
the vma. Similar to commit 31383c6865a5 "mm, hugetlbfs: introduce
->split() to vm_operations_struct" it would be messy to teach
vma_mmu_pagesize() about device-dax page mapping sizes in the same
(hstate) way that hugetlbfs communicates this attribute.  Instead, these
patches introduce a new ->pagesize() vm operation.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Reported-by: Jane Chu 
Signed-off-by: Dan Williams 
Signed-off-by: Dave Jiang 
---
 arch/powerpc/mm/hugetlbpage.c |5 +
 include/linux/mm.h|1 +
 mm/hugetlb.c  |   23 ---
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index a9b9083c5e49..c6a2e577e842 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -568,10 +568,7 @@ unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
if (!radix_enabled())
return 1UL << mmu_psize_to_shift(psize);
 #endif
-   if (!is_vm_hugetlb_page(vma))
-   return PAGE_SIZE;
-
-   return huge_page_size(hstate_vma(vma));
+   return vma_kernel_pagesize(vma);
 }
 
 static inline bool is_power_of_4(unsigned long x)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ea818ff739cd..37b9aef91ec7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -383,6 +383,7 @@ struct vm_operations_struct {
int (*huge_fault)(struct vm_fault *vmf, enum page_entry_size pe_size);
void (*map_pages)(struct vm_fault *vmf,
pgoff_t start_pgoff, pgoff_t end_pgoff);
+   unsigned long (*pagesize)(struct vm_area_struct * area);
 
/* notification that a previously read-only page is about to become
 * writable, if an error is returned it will cause a SIGBUS */
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 9a334f5fb730..8fa069b5cb4d 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -637,14 +637,9 @@ EXPORT_SYMBOL_GPL(linear_hugepage_index);
  */
 unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
 {
-   struct hstate *hstate;
-
-   if (!is_vm_hugetlb_page(vma))
-   return PAGE_SIZE;
-
-   hstate = hstate_vma(vma);
-
-   return 1UL << huge_page_shift(hstate);
+   if (vma->vm_ops && vma->vm_ops->pagesize)
+   return vma->vm_ops->pagesize(vma);
+   return PAGE_SIZE;
 }
 EXPORT_SYMBOL_GPL(vma_kernel_pagesize);
 
@@ -654,12 +649,10 @@ EXPORT_SYMBOL_GPL(vma_kernel_pagesize);
  * architectures where it differs, an architecture-specific version of this
  * function is required.
  */
-#ifndef vma_mmu_pagesize
-unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
+__weak unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
 {
return vma_kernel_pagesize(vma);
 }
-#endif
 
 /*
  * Flags for MAP_PRIVATE reservations.  These are stored in the bottom
@@ -3132,6 +3125,13 @@ static int hugetlb_vm_op_split(struct vm_area_struct 
*vma, unsigned long addr)
return 0;
 }
 
+static unsigned long hugetlb_vm_op_pagesize(struct vm_area_struct *vma)
+{
+   struct hstate *hstate = hstate_vma(vma);
+
+   return 1UL << huge_page_shift(hstate);
+}
+
 /*
  * We cannot handle pagefaults against hugetlb pages at all.  They cause
  * handle_mm_fault() to try to instantiate regular-sized pages in the
@@ -3149,6 +3149,7 @@ const struct vm_operations_struct hugetlb_vm_ops = {
.open = hugetlb_vm_op_open,
.close = hugetlb_vm_op_close,
.split = hugetlb_vm_op_split,
+   .pagesize = hugetlb_vm_op_pagesize,
 };
 
 static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,



[PATCH v2 2/2] device-dax: implement ->pagesize() for smaps to report MMUPageSize

2018-02-09 Thread Dave Jiang
From: Dan Williams 

Given that device-dax is making similar page mapping size guarantees as
hugetlbfs, emit the size in smaps and any other kernel path that
requests the mapping size of a vma.

Reported-by: Jane Chu 
Signed-off-by: Dan Williams 
---
 drivers/dax/device.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index 7b0bf825c4e7..b57cd5a7b0bd 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -439,10 +439,20 @@ static int dev_dax_split(struct vm_area_struct *vma, 
unsigned long addr)
return 0;
 }
 
+static unsigned long dev_dax_pagesize(struct vm_area_struct *vma)
+{
+   struct file *filp = vma->vm_file;
+   struct dev_dax *dev_dax = filp->private_data;
+   struct dax_region *dax_region = dev_dax->region;
+
+   return dax_region->align;
+}
+
 static const struct vm_operations_struct dax_vm_ops = {
.fault = dev_dax_fault,
.huge_fault = dev_dax_huge_fault,
.split = dev_dax_split,
+   .pagesize = dev_dax_pagesize,
 };
 
 static int dax_mmap(struct file *filp, struct vm_area_struct *vma)



Re: [PATCH v2] x86/kvm/vmx: Don't halt vcpu when L1 is injecting events to L2

2018-02-09 Thread Liran Alon

- chao@intel.com wrote:

> Although L2 is in halt state, it will be in the active state after
> VM entry if the VM entry is vectoring according to SDM 26.6.2
> Activity
> State. Halting the vcpu here means the event won't be injected to L2
> and this decision isn't reported to L1. Thus L0 drops an event that
> should be injected to L2.
> 
> Cc: Liran Alon 
> Signed-off-by: Chao Gao 
> ---
> Changes in v2:
>  - Remove VID stuff. Only handle event injection in this patch.
> ---
>  arch/x86/kvm/vmx.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index bb5b488..42f39d9 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -10985,7 +10985,12 @@ static int nested_vmx_run(struct kvm_vcpu
> *vcpu, bool launch)
>   if (ret)
>   return ret;
>  
> - if (vmcs12->guest_activity_state == GUEST_ACTIVITY_HLT)
> + /*
> +  * If we're entering a halted L2 vcpu and the L2 vcpu won't be
> woken
> +  * by event injection, halt vcpu for optimization.

I would remove the "for optimization." from the comment.

> +  */
> + if ((vmcs12->guest_activity_state == GUEST_ACTIVITY_HLT) &&
> + !(vmcs12->vm_entry_intr_info_field &
> VECTORING_INFO_VALID_MASK))

VECTORING_INFO_VALID_MASK is used in KVM code against 
vmcs12->idt_vectoring_info_field.
I think you should use INTR_INFO_VALID_MASK to be consistent with rest of code.

>   return kvm_vcpu_halt(vcpu);
>  
>   vmx->nested.nested_run_pending = 1;
> -- 
> 1.9.1

In addition, commit title should be written in format of:
"KVM: VMX: Don't halt vcpu when L1 is injecting events to L2"
(Makes it easier to grep in git log).

Other than that, seems good to me. :)

Reviewed-by: Liran Alon 

Thanks,
-Liran


Re: [PATCH 3/3] X86/nVMX: Update the MSR_BITMAP field with the L02 MSR BITMAP

2018-02-09 Thread KarimAllah Ahmed

On 02/10/2018 12:57 AM, Jim Mattson wrote:

On Fri, Feb 9, 2018 at 3:41 PM, KarimAllah Ahmed  wrote:


I assume you are referring to this:

https://patchwork.kernel.org/patch/10194819/

.. which is now:

commit 904e14fb7cb9 ("KVM: VMX: make MSR bitmaps per-VCPU")

right?

If this is the case, then I do not see where the MSR_BITMAP is being
updated here. In fact, would not this be the commit that actually broke
it?


I'm referring to
<1517938181-15317-6-git-send-email-d...@amazon.co.uk>, which has:

@@ -10043,6 +9954,9 @@ static void prepare_vmcs02(struct kvm_vcpu
*vcpu, struct vmcs12 *vmcs12)
 if (kvm_has_tsc_control)
 decache_tsc_multiplier(vmx);

+   if (cpu_has_vmx_msr_bitmap())
+   vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap));
+
 if (enable_vpid) {
 /*
  * There is no direct mapping between vpid02 and vpid12, the



Ooops, My bad! I must have ingested and old version of this commit that
did not have this hunk! Now actually looking at the upstream commit and
the backports from David, it is indeed there.

Sorry for the noise, please ignore this patch :)
Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B


[PATCH] x86: Fix PTI comment in entry_SYSCALL_64

2018-02-09 Thread Nadav Amit
The comment is confusing since the path is taken when
PAGE_TABLE_ISOLATION is disabled (while the comment says it is not
taken).

Signed-off-by: Nadav Amit 
---
 arch/x86/entry/entry_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 4a9bef6aca34..f4d4107a93b3 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -213,7 +213,7 @@ ENTRY(entry_SYSCALL_64)
 
swapgs
/*
-* This path is not taken when PAGE_TABLE_ISOLATION is disabled so it
+* This path is only taken when PAGE_TABLE_ISOLATION is disabled so it
 * is not required to switch CR3.
 */
movq%rsp, PER_CPU_VAR(rsp_scratch)
-- 
2.14.1



Re: [PATCH 2/3] Input: gpio-keys - allow setting wakeup interrupt trigger type in DT

2018-02-09 Thread JeffyChen

Hi Brian,

Thanks for your reply.

On 02/10/2018 07:42 AM, Brian Norris wrote:

Hi Jeffy,

On Fri, Feb 09, 2018 at 07:55:09PM +0800, Jeffy Chen wrote:

Allow specifying a different interrupt trigger type for wakeup when
using the gpio-keys input device as a wakeup source.

Signed-off-by: Jeffy Chen 
---

  Documentation/devicetree/bindings/input/gpio-keys.txt | 9 +
  1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt 
b/Documentation/devicetree/bindings/input/gpio-keys.txt
index a94940481e55..61926cef708f 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys.txt
+++ b/Documentation/devicetree/bindings/input/gpio-keys.txt
@@ -26,6 +26,15 @@ Optional subnode-properties:
  If not specified defaults to 5.
- wakeup-source: Boolean, button can wake-up the system.
 (Legacy property supported: "gpio-key,wakeup")
+   - wakeup-trigger-type: Specifies the interrupt trigger type for wakeup.
+The value is defined in 



Do you really want to codify interrupt triggers here? It seems like most
of the information about edge vs. level is already codified elsewhere,
so this becomes a little redundant. And in fact, some bindings may be
specifying a "gpio", not technically an interrupt (at least not
directly), so it feels weird to apply IRQ_* flags to them right here.
Anyway, I think he only piece you really want to describe here is, do we
wake on "event asserted", "event deasserted", or both. (The "none" case
would just mean you shouldn't have the "wakeup-source" property.)

So maybe:

wakeup-trigger-type: Specifies whether the key should wake the
system when asserted, when deasserted, or both. This property is
only valid for keys that wake up the system (e.g., when the
"wakeup-source" property is also provided). Supported values
are:
  1: asserted
  2: deasserted
  3: both asserted and deasserted

? We could still make macros out of those, if we want
(input/linux-event-codes.h?). And then leave it up to the driver to
determine how to translate that into the appropriate edge or level
triggers.

make sense, will do it in the next version.


Brian


+Only the following flags are supported:
+   IRQ_TYPE_NONE
+   IRQ_TYPE_EDGE_RISING
+   IRQ_TYPE_EDGE_FALLING
+   IRQ_TYPE_EDGE_BOTH
+   IRQ_TYPE_LEVEL_HIGH
+   IRQ_TYPE_LEVEL_LOW
- linux,can-disable: Boolean, indicates that button is connected
  to dedicated (not shared) interrupt which can be disabled to
  suppress events from the button.
--
2.11.0











Re: [PATCH] amdgpu/dc: Remove unnecessary initialization in dc_link_handle_hpd_rx_irq()

2018-02-09 Thread Guenter Roeck
On Fri, Feb 9, 2018 at 3:12 PM, Matthias Kaehlcke  wrote:
> The initialization of 'result' is unnecessary, the variable is assigned
> unconditionally a few lines below. Removing the initialization also fixes
> the following warning when building with clang:
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:1931:26:
>   error: implicit conversion from enumeration type 'enum ddc_result'
>   to different enumeration type 'enum dc_status' [-Werror,-Wenum-conversion]
> enum dc_status result = DDC_RESULT_UNKNOWN;
>
> Signed-off-by: Matthias Kaehlcke 

Reviewed-by: Guenter Roeck 

> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
> b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> index 4ee4c03a6724..8e3a8c1395a3 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> @@ -1926,7 +1926,7 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, 
> union hpd_irq_data *out_hpd
>  {
> union hpd_irq_data hpd_irq_dpcd_data = 0;
> union device_service_irq device_service_clear = { { 0 } };
> -   enum dc_status result = DDC_RESULT_UNKNOWN;
> +   enum dc_status result;
> bool status = false;
> /* For use cases related to down stream connection status change,
>  * PSR and device auto test, refer to function handle_sst_hpd_irq
> --
> 2.16.0.rc1.238.g530d649a79-goog
>


Re: [PATCH 6/7] watchdog: meson: allow setting timeout in devicetree

2018-02-09 Thread Guenter Roeck
On Sat, Feb 10, 2018 at 12:19:10AM +0100, Alexandre Belloni wrote:
> Hi Guenter,
> 
> On 09/02/2018 at 14:48:49 -0800, Guenter Roeck wrote:
> > On Fri, Feb 09, 2018 at 08:27:23PM +0100, Marcus Folkesson wrote:
> > > watchdog_init_timeout() will allways pick timeout_param since it
> > > defaults to a valid timeout.
> > > 
> > > By following best practice described in
> > > Documentation/watchdog/watchdog-kernel-api.txt, it also
> > > let us to set timout-sec property in devicetree.
> > > 
> > > Signed-off-by: Marcus Folkesson 
> > 
> > Reviewed-by: Guenetr Roeck 
>   ^
> A small typo in your name
> 

Mr. Fat Fingers At Work :-)

Guenter


[PATCH 3/3] auxdisplay: charlcd: replace octal literal with form-feed escape sequence

2018-02-09 Thread Robert Abel
There is no need to resort to octal escape sequence for the form feed character 
when an established escape sequence exists.

Signed-off-by: Robert Abel 
---
 drivers/auxdisplay/charlcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 92549c8344a4..a3486db03d81 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -555,7 +555,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
/* back one char again */
lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT);
break;
-   case '\014':
+   case '\f':
/* quickly clear the display */
charlcd_clear_fast(lcd);
break;
-- 
2.11.0



Re: [PATCH] scsi: pmcraid: remove redundant initializations of pointer 'ioadl'

2018-02-09 Thread Martin K. Petersen

Colin,

> There are several occurrances where pointer ioadl is initialized with a
> value that is never read and where it is re-assigned a new value later
> on, hence the initialization is redundant and can be removed.

Applied to 4.17/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering


[PATCH 2/3] auxdisplay: charlcd: use null character instead of zero literal to terminate strings

2018-02-09 Thread Robert Abel
Using '\0' instead of plain 0 makes the intent clearer that this is indeed a 
string and not a series of integers.

Signed-off-by: Robert Abel 
---
 drivers/auxdisplay/charlcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 324d02f9f1c5..92549c8344a4 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -527,7 +527,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
if ((c != '\n') && priv->esc_seq.len >= 0) {
/* yes, let's add this char to the buffer */
priv->esc_seq.buf[priv->esc_seq.len++] = c;
-   priv->esc_seq.buf[priv->esc_seq.len] = 0;
+   priv->esc_seq.buf[priv->esc_seq.len] = '\0';
} else {
/* aborts any previous escape sequence */
priv->esc_seq.len = -1;
@@ -536,7 +536,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
case LCD_ESCAPE_CHAR:
/* start of an escape sequence */
priv->esc_seq.len = 0;
-   priv->esc_seq.buf[priv->esc_seq.len] = 0;
+   priv->esc_seq.buf[priv->esc_seq.len] = '\0';
break;
case '\b':
/* go back one char and clear it */
-- 
2.11.0



[PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command

2018-02-09 Thread Robert Abel
The graphics command expects 16 hexadecimal literals, but would allow 
characters in range [0-9a-zA-Z] instead of [0-9a-fA-F].

Signed-off-by: Robert Abel 
---
 drivers/auxdisplay/charlcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 642afd88870b..324d02f9f1c5 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -441,9 +441,9 @@ static inline int handle_lcd_special_code(struct charlcd 
*lcd)
shift ^= 4;
if (*esc >= '0' && *esc <= '9') {
value |= (*esc - '0') << shift;
-   } else if (*esc >= 'A' && *esc <= 'Z') {
+   } else if (*esc >= 'A' && *esc <= 'F') {
value |= (*esc - 'A' + 10) << shift;
-   } else if (*esc >= 'a' && *esc <= 'z') {
+   } else if (*esc >= 'a' && *esc <= 'f') {
value |= (*esc - 'a' + 10) << shift;
} else {
esc++;
-- 
2.11.0



[PATCH 0/3] auxdisplay: charlcd: miscellaneous patches

2018-02-09 Thread Robert Abel
While looking at charlcd I noticed some little bits here and there that might
be corrected or improved.

Robert Abel (3):
  auxdisplay: charlcd: fix hex literal ranges for graphics command
  auxdisplay: charlcd: use null character instead of zero literal to
terminate strings
  auxdisplay: charlcd: replace octal literal with form-feed escape
sequence

 drivers/auxdisplay/charlcd.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.11.0



Re: [PATCH 3/6] scsi: sym53c416: avoid section mismatch with LTO

2018-02-09 Thread Martin K. Petersen

Arnd,

> Building with link time optimizations produces a false-postive section
> mismatch warning:

Applied to 4.17/scsi-queue, thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 3/3] X86/nVMX: Update the MSR_BITMAP field with the L02 MSR BITMAP

2018-02-09 Thread Jim Mattson
On Fri, Feb 9, 2018 at 3:41 PM, KarimAllah Ahmed  wrote:

> I assume you are referring to this:
>
> https://patchwork.kernel.org/patch/10194819/
>
> .. which is now:
>
> commit 904e14fb7cb9 ("KVM: VMX: make MSR bitmaps per-VCPU")
>
> right?
>
> If this is the case, then I do not see where the MSR_BITMAP is being
> updated here. In fact, would not this be the commit that actually broke
> it?

I'm referring to
<1517938181-15317-6-git-send-email-d...@amazon.co.uk>, which has:

@@ -10043,6 +9954,9 @@ static void prepare_vmcs02(struct kvm_vcpu
*vcpu, struct vmcs12 *vmcs12)
if (kvm_has_tsc_control)
decache_tsc_multiplier(vmx);

+   if (cpu_has_vmx_msr_bitmap())
+   vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap));
+
if (enable_vpid) {
/*
 * There is no direct mapping between vpid02 and vpid12, the


Re: [PATCH][V2] CIFS: SMBD: fix spelling mistake: "faield" and "legnth"

2018-02-09 Thread Steve French
merged into cifs-2.6.git for-next

On Fri, Feb 9, 2018 at 6:14 AM, Colin King  wrote:
> From: Colin Ian King 
>
> Trivial fix to spelling mistake in log_rdma_send and log_rdma_mr
> message text.
>
> Signed-off-by: Colin Ian King 
> ---
>  fs/cifs/smbdirect.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
> index 91710eb571fb..5aa0b54b32ce 100644
> --- a/fs/cifs/smbdirect.c
> +++ b/fs/cifs/smbdirect.c
> @@ -1025,7 +1025,7 @@ static int smbd_post_send(struct smbd_connection *info,
>
> for (i = 0; i < request->num_sge; i++) {
> log_rdma_send(INFO,
> -   "rdma_request sge[%d] addr=%llu legnth=%u\n",
> +   "rdma_request sge[%d] addr=%llu length=%u\n",
> i, request->sge[0].addr, request->sge[0].length);
> ib_dma_sync_single_for_device(
> info->id->device,
> @@ -2295,7 +2295,7 @@ static void smbd_mr_recovery_work(struct work_struct 
> *work)
> rc = ib_dereg_mr(smbdirect_mr->mr);
> if (rc) {
> log_rdma_mr(ERR,
> -   "ib_dereg_mr faield rc=%x\n",
> +   "ib_dereg_mr failed rc=%x\n",
> rc);
> smbd_disconnect_rdma_connection(info);
> }
> --
> 2.15.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve


Re: [PATCH] scsi: isci: remove redundant initialization to 'bit'

2018-02-09 Thread Martin K. Petersen

Colin,

> Variable bit is initialized with a value that is never read and is
> being updated immediately after the initialization, hence the
> initialization is redundant and can be removed.

Applied to 4.17/scsi-queue. Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO

2018-02-09 Thread Martin K. Petersen

Arnd,

> Building with link time optimizations produces a false-postive section
> mismatch warning:

Applied to 4.17/scsi-queue, thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering


  1   2   3   4   5   6   7   8   9   >