Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them

2018-06-02 Thread Byungchul Park
On Sun, Jun 3, 2018 at 12:58 PM, Joel Fernandes  wrote:
> On Fri, Jun 01, 2018 at 11:03:09AM +0900, Byungchul Park wrote:
>> Currently, the range of jiffies_till_{first,next}_fqs are checked and
>> adjusted on and on in the loop of rcu_gp_kthread on runtime.
>>
>> However, it's enough to check them only when setting them, not every
>> time in the loop. So make them handled on a setting time via sysfs.
>>
>> Signed-off-by: Byungchul Park 
>> ---
>>  kernel/rcu/tree.c | 45 -
>>  1 file changed, 32 insertions(+), 13 deletions(-)
>>
>> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
>> index 4e96761..eb54d7d 100644
>> --- a/kernel/rcu/tree.c
>> +++ b/kernel/rcu/tree.c
>> @@ -518,8 +518,38 @@ void rcu_all_qs(void)
>>  static ulong jiffies_till_next_fqs = ULONG_MAX;
>>  static bool rcu_kick_kthreads;
>>
>> -module_param(jiffies_till_first_fqs, ulong, 0644);
>> -module_param(jiffies_till_next_fqs, ulong, 0644);
>> +static int param_set_first_fqs_jiffies(const char *val, const struct 
>> kernel_param *kp)
>> +{
>> + ulong j;
>> + int ret = kstrtoul(val, 0, );
>> +
>> + if (!ret)
>> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
>> + return ret;
>> +}
>> +
>> +static int param_set_next_fqs_jiffies(const char *val, const struct 
>> kernel_param *kp)
>> +{
>> + ulong j;
>> + int ret = kstrtoul(val, 0, );
>> +
>> + if (!ret)
>> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1));
>> + return ret;
>> +}
>
> Reviewed-by: Joel Fernandes (Google) 
>
> Also, can we not combine the 2 param_set_ handlers as well?
>
> Only thing we would be giving up is that jiffies_till_first_fqs = 0 wouldn't
> be allowed (if we go with the param_set_next handler to be the common one)
> but don't think that's a useful/valid usecase since jiffies_till_first_fqs is
> set to a sane non-0 value anyway at boot up because of rcu_init_geometry
> anyway.. Thoughts?

Excuse me. Which code in rcu_init_geometry() makes jiffies_till_first_fqs
be a non-zero in case called with jiffies_till_first_fqs == 0?

Furthermore, what if we want to change the value through sysfs to zero
on runtime?

> If you agree, the below patch could be applied on top of rcu/dev (tested on
> rcu/dev), it saves another 20 lines.
>
> thanks,
>
> - Joel
>
> ---8<---
>
> From: "Joel Fernandes (Google)" 
> Date: Sat, 2 Jun 2018 20:47:06 -0700
> Subject: [PATCH] rcu: Use common handler for setting
>  jiffies_till_{first,next}_fqs
>
> Recently the checking of jiffies_till_{first,next}_fqs during forcing of
> quiescent states was changed to be done whenever the parameters are set.
>
> Looking at how jiffies_till_first_fqs is used on my system, I noticed a
> value of 0 for it doesn't make much sense and is infact set to a non-0
> value at boot up. In this case, we can combine the module_param handlers
> for setting both these and keep code size small. This patch attempts it.
>
> Signed-off-by: Joel Fernandes (Google) 
> ---
>  kernel/rcu/tree.c | 25 +
>  1 file changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index deb2508be923..6550040f8d46 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -498,17 +498,7 @@ static ulong jiffies_till_first_fqs = ULONG_MAX;
>  static ulong jiffies_till_next_fqs = ULONG_MAX;
>  static bool rcu_kick_kthreads;
>
> -static int param_set_first_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> -{
> -   ulong j;
> -   int ret = kstrtoul(val, 0, );
> -
> -   if (!ret)
> -   WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
> -   return ret;
> -}
> -
> -static int param_set_next_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> +static int param_set_fqs_jiffies(const char *val, const struct kernel_param 
> *kp)
>  {
> ulong j;
> int ret = kstrtoul(val, 0, );
> @@ -518,18 +508,13 @@ static int param_set_next_fqs_jiffies(const char *val, 
> const struct kernel_param
> return ret;
>  }
>
> -static struct kernel_param_ops first_fqs_jiffies_ops = {
> -   .set = param_set_first_fqs_jiffies,
> -   .get = param_get_ulong,
> -};
> -
> -static struct kernel_param_ops next_fqs_jiffies_ops = {
> -   .set = param_set_next_fqs_jiffies,
> +static struct kernel_param_ops fqs_jiffies_ops = {
> +   .set = param_set_fqs_jiffies,
> .get = param_get_ulong,
>  };
>
> -module_param_cb(jiffies_till_first_fqs, _fqs_jiffies_ops, 
> _till_first_fqs, 0644);
> -module_param_cb(jiffies_till_next_fqs, _fqs_jiffies_ops, 
> _till_next_fqs, 0644);
> +module_param_cb(jiffies_till_first_fqs, _jiffies_ops, 
> _till_first_fqs, 0644);
> +module_param_cb(jiffies_till_next_fqs, _jiffies_ops, 
> _till_next_fqs, 0644);
>  module_param(rcu_kick_kthreads, bool, 0644);
>
>  /*
> --
> 2.17.1.1185.g55be947832-goog
>



-- 
Thanks,
Byungchul


Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them

2018-06-02 Thread Byungchul Park
On Sun, Jun 3, 2018 at 12:58 PM, Joel Fernandes  wrote:
> On Fri, Jun 01, 2018 at 11:03:09AM +0900, Byungchul Park wrote:
>> Currently, the range of jiffies_till_{first,next}_fqs are checked and
>> adjusted on and on in the loop of rcu_gp_kthread on runtime.
>>
>> However, it's enough to check them only when setting them, not every
>> time in the loop. So make them handled on a setting time via sysfs.
>>
>> Signed-off-by: Byungchul Park 
>> ---
>>  kernel/rcu/tree.c | 45 -
>>  1 file changed, 32 insertions(+), 13 deletions(-)
>>
>> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
>> index 4e96761..eb54d7d 100644
>> --- a/kernel/rcu/tree.c
>> +++ b/kernel/rcu/tree.c
>> @@ -518,8 +518,38 @@ void rcu_all_qs(void)
>>  static ulong jiffies_till_next_fqs = ULONG_MAX;
>>  static bool rcu_kick_kthreads;
>>
>> -module_param(jiffies_till_first_fqs, ulong, 0644);
>> -module_param(jiffies_till_next_fqs, ulong, 0644);
>> +static int param_set_first_fqs_jiffies(const char *val, const struct 
>> kernel_param *kp)
>> +{
>> + ulong j;
>> + int ret = kstrtoul(val, 0, );
>> +
>> + if (!ret)
>> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
>> + return ret;
>> +}
>> +
>> +static int param_set_next_fqs_jiffies(const char *val, const struct 
>> kernel_param *kp)
>> +{
>> + ulong j;
>> + int ret = kstrtoul(val, 0, );
>> +
>> + if (!ret)
>> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1));
>> + return ret;
>> +}
>
> Reviewed-by: Joel Fernandes (Google) 
>
> Also, can we not combine the 2 param_set_ handlers as well?
>
> Only thing we would be giving up is that jiffies_till_first_fqs = 0 wouldn't
> be allowed (if we go with the param_set_next handler to be the common one)
> but don't think that's a useful/valid usecase since jiffies_till_first_fqs is
> set to a sane non-0 value anyway at boot up because of rcu_init_geometry
> anyway.. Thoughts?

Excuse me. Which code in rcu_init_geometry() makes jiffies_till_first_fqs
be a non-zero in case called with jiffies_till_first_fqs == 0?

Furthermore, what if we want to change the value through sysfs to zero
on runtime?

> If you agree, the below patch could be applied on top of rcu/dev (tested on
> rcu/dev), it saves another 20 lines.
>
> thanks,
>
> - Joel
>
> ---8<---
>
> From: "Joel Fernandes (Google)" 
> Date: Sat, 2 Jun 2018 20:47:06 -0700
> Subject: [PATCH] rcu: Use common handler for setting
>  jiffies_till_{first,next}_fqs
>
> Recently the checking of jiffies_till_{first,next}_fqs during forcing of
> quiescent states was changed to be done whenever the parameters are set.
>
> Looking at how jiffies_till_first_fqs is used on my system, I noticed a
> value of 0 for it doesn't make much sense and is infact set to a non-0
> value at boot up. In this case, we can combine the module_param handlers
> for setting both these and keep code size small. This patch attempts it.
>
> Signed-off-by: Joel Fernandes (Google) 
> ---
>  kernel/rcu/tree.c | 25 +
>  1 file changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index deb2508be923..6550040f8d46 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -498,17 +498,7 @@ static ulong jiffies_till_first_fqs = ULONG_MAX;
>  static ulong jiffies_till_next_fqs = ULONG_MAX;
>  static bool rcu_kick_kthreads;
>
> -static int param_set_first_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> -{
> -   ulong j;
> -   int ret = kstrtoul(val, 0, );
> -
> -   if (!ret)
> -   WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
> -   return ret;
> -}
> -
> -static int param_set_next_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> +static int param_set_fqs_jiffies(const char *val, const struct kernel_param 
> *kp)
>  {
> ulong j;
> int ret = kstrtoul(val, 0, );
> @@ -518,18 +508,13 @@ static int param_set_next_fqs_jiffies(const char *val, 
> const struct kernel_param
> return ret;
>  }
>
> -static struct kernel_param_ops first_fqs_jiffies_ops = {
> -   .set = param_set_first_fqs_jiffies,
> -   .get = param_get_ulong,
> -};
> -
> -static struct kernel_param_ops next_fqs_jiffies_ops = {
> -   .set = param_set_next_fqs_jiffies,
> +static struct kernel_param_ops fqs_jiffies_ops = {
> +   .set = param_set_fqs_jiffies,
> .get = param_get_ulong,
>  };
>
> -module_param_cb(jiffies_till_first_fqs, _fqs_jiffies_ops, 
> _till_first_fqs, 0644);
> -module_param_cb(jiffies_till_next_fqs, _fqs_jiffies_ops, 
> _till_next_fqs, 0644);
> +module_param_cb(jiffies_till_first_fqs, _jiffies_ops, 
> _till_first_fqs, 0644);
> +module_param_cb(jiffies_till_next_fqs, _jiffies_ops, 
> _till_next_fqs, 0644);
>  module_param(rcu_kick_kthreads, bool, 0644);
>
>  /*
> --
> 2.17.1.1185.g55be947832-goog
>



-- 
Thanks,
Byungchul


Re: [RESEND, v3, 2/2] sched/deadline: Initialize cp->elements[].cpu to an invalid value

2018-06-02 Thread Byungchul Park
On Sat, Jun 2, 2018 at 12:52 AM, Joel Fernandes  wrote:
> On Fri, Jun 01, 2018 at 04:10:56PM +0900, Byungchul Park wrote:
>> > On Thu, May 31, 2018 at 11:12:55PM -0700, Joel Fernandes wrote:
>> > > On Mon, Jan 08, 2018 at 03:14:41PM +0900, byungchul park wrote:
>> > > > Currently, migrating tasks to cpu0 unconditionally happens when the
>> > > > heap is empty, since cp->elements[].cpu was initialized to 0(=cpu0).
>> > > > We have to distinguish between the empty case and cpu0 to avoid the
>> > > > unnecessary migrations. Therefore, it has to return an invalid value
>> > > > e.i. -1 in that case.
>> > > >
>> > > > Signed-off-by: Byungchul Park 
>> > > > Acked-by: Steven Rostedt (VMware) 
>> > > > Acked-by: Daniel Bristot de Oliveira 
>> > > > ---
>> > > >   kernel/sched/cpudeadline.c | 10 +-
>> > > >   1 file changed, 9 insertions(+), 1 deletion(-)
>> > > >
>> > > > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
>> > > > index 9f02035..bcf903f 100644
>> > > > --- a/kernel/sched/cpudeadline.c
>> > > > +++ b/kernel/sched/cpudeadline.c
>> > > > @@ -138,6 +138,12 @@ int cpudl_find(struct cpudl *cp, struct 
>> > > > task_struct *p,
>> > > > int best_cpu = cpudl_maximum_cpu(cp);
>> > > > WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
>> > > > +   /*
>> > > > +* The heap tree is empty for now, just return.
>> > > > +*/
>> > > > +   if (best_cpu == -1)
>> > > > +   return 0;
>> > > > +
>> > > > if (cpumask_test_cpu(best_cpu, >cpus_allowed) &&
>> > > > dl_time_before(dl_se->deadline, 
>> > > > cpudl_maximum_dl(cp))) {
>> > > > if (later_mask)
>> > > > @@ -265,8 +271,10 @@ int cpudl_init(struct cpudl *cp)
>> > > > return -ENOMEM;
>> > > > }
>> > > > -   for_each_possible_cpu(i)
>> > > > +   for_each_possible_cpu(i) {
>> > > > +   cp->elements[i].cpu = -1;
>> > > > cp->elements[i].idx = IDX_INVALID;
>> > >
>> > > Shouldn't you also set cp->elements[cpu].cpu to -1 in cpudl_clear (when 
>> > > you
>> > > set cp->elements[cpu].cpu to IDX_INVALID there)?
>> >
>> > I messed up my words, I meant : "when setting cp->elements[cpu].idx to
>> > IDX_INVALID there". Which means I need to call it a day :-)
>>
>> Ah.. I agree with you. It might be a problem when removing the last
>> element.. Then I think the following change should also be applied
>> additionally. Right?
>
> Yes.
>
>> ---
>> diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
>> index 8d9562d..44d4c88 100644
>> --- a/kernel/sched/cpudeadline.c
>> +++ b/kernel/sched/cpudeadline.c
>> @@ -172,12 +172,14 @@ void cpudl_clear(struct cpudl *cp, int cpu)
>> } else {
>> new_cpu = cp->elements[cp->size - 1].cpu;
>> cp->elements[old_idx].dl = cp->elements[cp->size - 1].dl;
>> -   cp->elements[old_idx].cpu = new_cpu;
>> +   cp->elements[old_idx].cpu = (new_cpu == cpu) ? -1 : new_cpu;
>> cp->size--;
>> -   cp->elements[new_cpu].idx = old_idx;
>> cp->elements[cpu].idx = IDX_INVALID;
>> -   cpudl_heapify(cp, old_idx);
>>
>> +   if (new_cpu != cpu) {
>> +   cp->elements[new_cpu].idx = old_idx;
>> +   cpudl_heapify(cp, old_idx);
>> +   }
>> cpumask_set_cpu(cpu, cp->free_cpus);
>
> This looks a bit confusing. How about the following? (untested)

Hello,

Whatever. Your code also looks good to me.

I just wanna follow the maintainers' decision. ;)

> thanks,
>
>  - Joel
>
> ---8<---
>
> diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> index 50316455ea66..741a97e58c05 100644
> --- a/kernel/sched/cpudeadline.c
> +++ b/kernel/sched/cpudeadline.c
> @@ -129,6 +129,10 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
> } else {
> int best_cpu = cpudl_maximum(cp);
>
> +   /* The max-heap is empty, just return. */
> +   if (best_cpu == -1)
> +   return 0;
> +
> WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
>
> if (cpumask_test_cpu(best_cpu, >cpus_allowed) &&
> @@ -167,6 +171,12 @@ void cpudl_clear(struct cpudl *cp, int cpu)
>  * This could happen if a rq_offline_dl is
>  * called for a CPU without -dl tasks running.
>  */
> +   } else if (cp->size == 1) {
> +   /* Only one element in max-heap, clear it */
> +   cp->elements[0].cpu = -1;
> +   cp->elements[cpu].idx = IDX_INVALID;
> +   cp->size--;
> +   cpumask_set_cpu(cpu, cp->free_cpus);
> } else {
> new_cpu = cp->elements[cp->size - 1].cpu;
> cp->elements[old_idx].dl 

Re: [RESEND, v3, 2/2] sched/deadline: Initialize cp->elements[].cpu to an invalid value

2018-06-02 Thread Byungchul Park
On Sat, Jun 2, 2018 at 12:52 AM, Joel Fernandes  wrote:
> On Fri, Jun 01, 2018 at 04:10:56PM +0900, Byungchul Park wrote:
>> > On Thu, May 31, 2018 at 11:12:55PM -0700, Joel Fernandes wrote:
>> > > On Mon, Jan 08, 2018 at 03:14:41PM +0900, byungchul park wrote:
>> > > > Currently, migrating tasks to cpu0 unconditionally happens when the
>> > > > heap is empty, since cp->elements[].cpu was initialized to 0(=cpu0).
>> > > > We have to distinguish between the empty case and cpu0 to avoid the
>> > > > unnecessary migrations. Therefore, it has to return an invalid value
>> > > > e.i. -1 in that case.
>> > > >
>> > > > Signed-off-by: Byungchul Park 
>> > > > Acked-by: Steven Rostedt (VMware) 
>> > > > Acked-by: Daniel Bristot de Oliveira 
>> > > > ---
>> > > >   kernel/sched/cpudeadline.c | 10 +-
>> > > >   1 file changed, 9 insertions(+), 1 deletion(-)
>> > > >
>> > > > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
>> > > > index 9f02035..bcf903f 100644
>> > > > --- a/kernel/sched/cpudeadline.c
>> > > > +++ b/kernel/sched/cpudeadline.c
>> > > > @@ -138,6 +138,12 @@ int cpudl_find(struct cpudl *cp, struct 
>> > > > task_struct *p,
>> > > > int best_cpu = cpudl_maximum_cpu(cp);
>> > > > WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
>> > > > +   /*
>> > > > +* The heap tree is empty for now, just return.
>> > > > +*/
>> > > > +   if (best_cpu == -1)
>> > > > +   return 0;
>> > > > +
>> > > > if (cpumask_test_cpu(best_cpu, >cpus_allowed) &&
>> > > > dl_time_before(dl_se->deadline, 
>> > > > cpudl_maximum_dl(cp))) {
>> > > > if (later_mask)
>> > > > @@ -265,8 +271,10 @@ int cpudl_init(struct cpudl *cp)
>> > > > return -ENOMEM;
>> > > > }
>> > > > -   for_each_possible_cpu(i)
>> > > > +   for_each_possible_cpu(i) {
>> > > > +   cp->elements[i].cpu = -1;
>> > > > cp->elements[i].idx = IDX_INVALID;
>> > >
>> > > Shouldn't you also set cp->elements[cpu].cpu to -1 in cpudl_clear (when 
>> > > you
>> > > set cp->elements[cpu].cpu to IDX_INVALID there)?
>> >
>> > I messed up my words, I meant : "when setting cp->elements[cpu].idx to
>> > IDX_INVALID there". Which means I need to call it a day :-)
>>
>> Ah.. I agree with you. It might be a problem when removing the last
>> element.. Then I think the following change should also be applied
>> additionally. Right?
>
> Yes.
>
>> ---
>> diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
>> index 8d9562d..44d4c88 100644
>> --- a/kernel/sched/cpudeadline.c
>> +++ b/kernel/sched/cpudeadline.c
>> @@ -172,12 +172,14 @@ void cpudl_clear(struct cpudl *cp, int cpu)
>> } else {
>> new_cpu = cp->elements[cp->size - 1].cpu;
>> cp->elements[old_idx].dl = cp->elements[cp->size - 1].dl;
>> -   cp->elements[old_idx].cpu = new_cpu;
>> +   cp->elements[old_idx].cpu = (new_cpu == cpu) ? -1 : new_cpu;
>> cp->size--;
>> -   cp->elements[new_cpu].idx = old_idx;
>> cp->elements[cpu].idx = IDX_INVALID;
>> -   cpudl_heapify(cp, old_idx);
>>
>> +   if (new_cpu != cpu) {
>> +   cp->elements[new_cpu].idx = old_idx;
>> +   cpudl_heapify(cp, old_idx);
>> +   }
>> cpumask_set_cpu(cpu, cp->free_cpus);
>
> This looks a bit confusing. How about the following? (untested)

Hello,

Whatever. Your code also looks good to me.

I just wanna follow the maintainers' decision. ;)

> thanks,
>
>  - Joel
>
> ---8<---
>
> diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> index 50316455ea66..741a97e58c05 100644
> --- a/kernel/sched/cpudeadline.c
> +++ b/kernel/sched/cpudeadline.c
> @@ -129,6 +129,10 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
> } else {
> int best_cpu = cpudl_maximum(cp);
>
> +   /* The max-heap is empty, just return. */
> +   if (best_cpu == -1)
> +   return 0;
> +
> WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
>
> if (cpumask_test_cpu(best_cpu, >cpus_allowed) &&
> @@ -167,6 +171,12 @@ void cpudl_clear(struct cpudl *cp, int cpu)
>  * This could happen if a rq_offline_dl is
>  * called for a CPU without -dl tasks running.
>  */
> +   } else if (cp->size == 1) {
> +   /* Only one element in max-heap, clear it */
> +   cp->elements[0].cpu = -1;
> +   cp->elements[cpu].idx = IDX_INVALID;
> +   cp->size--;
> +   cpumask_set_cpu(cpu, cp->free_cpus);
> } else {
> new_cpu = cp->elements[cp->size - 1].cpu;
> cp->elements[old_idx].dl 

Re: [PATCH v2] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread Randy Dunlap
On 06/02/2018 09:49 PM, tom...@gmail.com wrote:
> From: Thomas Anderson 
> 
> Documentation/binfmt_misc.txt was moved to
> Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
> updates a reference to the file.
> 
> Signed-off-by: Thomas Anderson 

Al,
I see a similar patch from Tom Saeger  last Sept-27-2017
and also one from Henning Schild  last Sept-2017.

I also see a reply that Jon Corbet merged one of those (Tom's I think),
but it appears to still be needed...

Jon?

> ---
>  fs/binfmt_misc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> index a41b48f82a70..5ad89b838c79 100644
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -4,7 +4,8 @@
>   * Copyright (C) 1997 Richard Günther
>   *
>   * binfmt_misc detects binaries via a magic or filename extension and invokes
> - * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
> + * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for 
> more
> + * details.
>   */
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 


-- 
~Randy


Re: [PATCH v2] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread Randy Dunlap
On 06/02/2018 09:49 PM, tom...@gmail.com wrote:
> From: Thomas Anderson 
> 
> Documentation/binfmt_misc.txt was moved to
> Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
> updates a reference to the file.
> 
> Signed-off-by: Thomas Anderson 

Al,
I see a similar patch from Tom Saeger  last Sept-27-2017
and also one from Henning Schild  last Sept-2017.

I also see a reply that Jon Corbet merged one of those (Tom's I think),
but it appears to still be needed...

Jon?

> ---
>  fs/binfmt_misc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> index a41b48f82a70..5ad89b838c79 100644
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -4,7 +4,8 @@
>   * Copyright (C) 1997 Richard Günther
>   *
>   * binfmt_misc detects binaries via a magic or filename extension and invokes
> - * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
> + * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for 
> more
> + * details.
>   */
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 


-- 
~Randy


[PATCH v2] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread tomkpz
From: Thomas Anderson 

Documentation/binfmt_misc.txt was moved to
Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
updates a reference to the file.

Signed-off-by: Thomas Anderson 
---
 fs/binfmt_misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a41b48f82a70..5ad89b838c79 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -4,7 +4,8 @@
  * Copyright (C) 1997 Richard Günther
  *
  * binfmt_misc detects binaries via a magic or filename extension and invokes
- * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
+ * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for more
+ * details.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-- 
2.17.1



[PATCH v2] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread tomkpz
From: Thomas Anderson 

Documentation/binfmt_misc.txt was moved to
Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
updates a reference to the file.

Signed-off-by: Thomas Anderson 
---
 fs/binfmt_misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a41b48f82a70..5ad89b838c79 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -4,7 +4,8 @@
  * Copyright (C) 1997 Richard Günther
  *
  * binfmt_misc detects binaries via a magic or filename extension and invokes
- * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
+ * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for more
+ * details.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-- 
2.17.1



Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them

2018-06-02 Thread Joel Fernandes
On Fri, Jun 01, 2018 at 11:03:09AM +0900, Byungchul Park wrote:
> Currently, the range of jiffies_till_{first,next}_fqs are checked and
> adjusted on and on in the loop of rcu_gp_kthread on runtime.
> 
> However, it's enough to check them only when setting them, not every
> time in the loop. So make them handled on a setting time via sysfs.
> 
> Signed-off-by: Byungchul Park 
> ---
>  kernel/rcu/tree.c | 45 -
>  1 file changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 4e96761..eb54d7d 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -518,8 +518,38 @@ void rcu_all_qs(void)
>  static ulong jiffies_till_next_fqs = ULONG_MAX;
>  static bool rcu_kick_kthreads;
>  
> -module_param(jiffies_till_first_fqs, ulong, 0644);
> -module_param(jiffies_till_next_fqs, ulong, 0644);
> +static int param_set_first_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> +{
> + ulong j;
> + int ret = kstrtoul(val, 0, );
> +
> + if (!ret)
> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
> + return ret;
> +}
> +
> +static int param_set_next_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> +{
> + ulong j;
> + int ret = kstrtoul(val, 0, );
> +
> + if (!ret)
> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1));
> + return ret;
> +}

Reviewed-by: Joel Fernandes (Google) 

Also, can we not combine the 2 param_set_ handlers as well?

Only thing we would be giving up is that jiffies_till_first_fqs = 0 wouldn't
be allowed (if we go with the param_set_next handler to be the common one)
but don't think that's a useful/valid usecase since jiffies_till_first_fqs is
set to a sane non-0 value anyway at boot up because of rcu_init_geometry
anyway.. Thoughts?

If you agree, the below patch could be applied on top of rcu/dev (tested on
rcu/dev), it saves another 20 lines.

thanks,

- Joel

---8<---

From: "Joel Fernandes (Google)" 
Date: Sat, 2 Jun 2018 20:47:06 -0700
Subject: [PATCH] rcu: Use common handler for setting
 jiffies_till_{first,next}_fqs

Recently the checking of jiffies_till_{first,next}_fqs during forcing of
quiescent states was changed to be done whenever the parameters are set.

Looking at how jiffies_till_first_fqs is used on my system, I noticed a
value of 0 for it doesn't make much sense and is infact set to a non-0
value at boot up. In this case, we can combine the module_param handlers
for setting both these and keep code size small. This patch attempts it.

Signed-off-by: Joel Fernandes (Google) 
---
 kernel/rcu/tree.c | 25 +
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index deb2508be923..6550040f8d46 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -498,17 +498,7 @@ static ulong jiffies_till_first_fqs = ULONG_MAX;
 static ulong jiffies_till_next_fqs = ULONG_MAX;
 static bool rcu_kick_kthreads;
 
-static int param_set_first_fqs_jiffies(const char *val, const struct 
kernel_param *kp)
-{
-   ulong j;
-   int ret = kstrtoul(val, 0, );
-
-   if (!ret)
-   WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
-   return ret;
-}
-
-static int param_set_next_fqs_jiffies(const char *val, const struct 
kernel_param *kp)
+static int param_set_fqs_jiffies(const char *val, const struct kernel_param 
*kp)
 {
ulong j;
int ret = kstrtoul(val, 0, );
@@ -518,18 +508,13 @@ static int param_set_next_fqs_jiffies(const char *val, 
const struct kernel_param
return ret;
 }
 
-static struct kernel_param_ops first_fqs_jiffies_ops = {
-   .set = param_set_first_fqs_jiffies,
-   .get = param_get_ulong,
-};
-
-static struct kernel_param_ops next_fqs_jiffies_ops = {
-   .set = param_set_next_fqs_jiffies,
+static struct kernel_param_ops fqs_jiffies_ops = {
+   .set = param_set_fqs_jiffies,
.get = param_get_ulong,
 };
 
-module_param_cb(jiffies_till_first_fqs, _fqs_jiffies_ops, 
_till_first_fqs, 0644);
-module_param_cb(jiffies_till_next_fqs, _fqs_jiffies_ops, 
_till_next_fqs, 0644);
+module_param_cb(jiffies_till_first_fqs, _jiffies_ops, 
_till_first_fqs, 0644);
+module_param_cb(jiffies_till_next_fqs, _jiffies_ops, 
_till_next_fqs, 0644);
 module_param(rcu_kick_kthreads, bool, 0644);
 
 /*
-- 
2.17.1.1185.g55be947832-goog



Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them

2018-06-02 Thread Joel Fernandes
On Fri, Jun 01, 2018 at 11:03:09AM +0900, Byungchul Park wrote:
> Currently, the range of jiffies_till_{first,next}_fqs are checked and
> adjusted on and on in the loop of rcu_gp_kthread on runtime.
> 
> However, it's enough to check them only when setting them, not every
> time in the loop. So make them handled on a setting time via sysfs.
> 
> Signed-off-by: Byungchul Park 
> ---
>  kernel/rcu/tree.c | 45 -
>  1 file changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 4e96761..eb54d7d 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -518,8 +518,38 @@ void rcu_all_qs(void)
>  static ulong jiffies_till_next_fqs = ULONG_MAX;
>  static bool rcu_kick_kthreads;
>  
> -module_param(jiffies_till_first_fqs, ulong, 0644);
> -module_param(jiffies_till_next_fqs, ulong, 0644);
> +static int param_set_first_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> +{
> + ulong j;
> + int ret = kstrtoul(val, 0, );
> +
> + if (!ret)
> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
> + return ret;
> +}
> +
> +static int param_set_next_fqs_jiffies(const char *val, const struct 
> kernel_param *kp)
> +{
> + ulong j;
> + int ret = kstrtoul(val, 0, );
> +
> + if (!ret)
> + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1));
> + return ret;
> +}

Reviewed-by: Joel Fernandes (Google) 

Also, can we not combine the 2 param_set_ handlers as well?

Only thing we would be giving up is that jiffies_till_first_fqs = 0 wouldn't
be allowed (if we go with the param_set_next handler to be the common one)
but don't think that's a useful/valid usecase since jiffies_till_first_fqs is
set to a sane non-0 value anyway at boot up because of rcu_init_geometry
anyway.. Thoughts?

If you agree, the below patch could be applied on top of rcu/dev (tested on
rcu/dev), it saves another 20 lines.

thanks,

- Joel

---8<---

From: "Joel Fernandes (Google)" 
Date: Sat, 2 Jun 2018 20:47:06 -0700
Subject: [PATCH] rcu: Use common handler for setting
 jiffies_till_{first,next}_fqs

Recently the checking of jiffies_till_{first,next}_fqs during forcing of
quiescent states was changed to be done whenever the parameters are set.

Looking at how jiffies_till_first_fqs is used on my system, I noticed a
value of 0 for it doesn't make much sense and is infact set to a non-0
value at boot up. In this case, we can combine the module_param handlers
for setting both these and keep code size small. This patch attempts it.

Signed-off-by: Joel Fernandes (Google) 
---
 kernel/rcu/tree.c | 25 +
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index deb2508be923..6550040f8d46 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -498,17 +498,7 @@ static ulong jiffies_till_first_fqs = ULONG_MAX;
 static ulong jiffies_till_next_fqs = ULONG_MAX;
 static bool rcu_kick_kthreads;
 
-static int param_set_first_fqs_jiffies(const char *val, const struct 
kernel_param *kp)
-{
-   ulong j;
-   int ret = kstrtoul(val, 0, );
-
-   if (!ret)
-   WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j);
-   return ret;
-}
-
-static int param_set_next_fqs_jiffies(const char *val, const struct 
kernel_param *kp)
+static int param_set_fqs_jiffies(const char *val, const struct kernel_param 
*kp)
 {
ulong j;
int ret = kstrtoul(val, 0, );
@@ -518,18 +508,13 @@ static int param_set_next_fqs_jiffies(const char *val, 
const struct kernel_param
return ret;
 }
 
-static struct kernel_param_ops first_fqs_jiffies_ops = {
-   .set = param_set_first_fqs_jiffies,
-   .get = param_get_ulong,
-};
-
-static struct kernel_param_ops next_fqs_jiffies_ops = {
-   .set = param_set_next_fqs_jiffies,
+static struct kernel_param_ops fqs_jiffies_ops = {
+   .set = param_set_fqs_jiffies,
.get = param_get_ulong,
 };
 
-module_param_cb(jiffies_till_first_fqs, _fqs_jiffies_ops, 
_till_first_fqs, 0644);
-module_param_cb(jiffies_till_next_fqs, _fqs_jiffies_ops, 
_till_next_fqs, 0644);
+module_param_cb(jiffies_till_first_fqs, _jiffies_ops, 
_till_first_fqs, 0644);
+module_param_cb(jiffies_till_next_fqs, _jiffies_ops, 
_till_next_fqs, 0644);
 module_param(rcu_kick_kthreads, bool, 0644);
 
 /*
-- 
2.17.1.1185.g55be947832-goog



[PATCH] slab: Clean up the code comment in slab kmem_cache struct

2018-06-02 Thread Baoquan He
In commit

  3b0efdfa1e7("mm, sl[aou]b: Extract common fields from struct kmem_cache")

The variable 'obj_size' was moved above, however the related code comment
is not updated accordingly. Do it here.

Signed-off-by: Baoquan He 
---
 include/linux/slab_def.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index d9228e4d0320..3485c58cfd1c 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -67,9 +67,10 @@ struct kmem_cache {
 
/*
 * If debugging is enabled, then the allocator can add additional
-* fields and/or padding to every object. size contains the total
-* object size including these internal fields, the following two
-* variables contain the offset to the user object and its size.
+* fields and/or padding to every object. 'size' contains the total
+* object size including these internal fields, while 'obj_offset'
+* and 'object_size' contain the offset to the user object and its
+* size.
 */
int obj_offset;
 #endif /* CONFIG_DEBUG_SLAB */
-- 
2.13.6



[PATCH] slab: Clean up the code comment in slab kmem_cache struct

2018-06-02 Thread Baoquan He
In commit

  3b0efdfa1e7("mm, sl[aou]b: Extract common fields from struct kmem_cache")

The variable 'obj_size' was moved above, however the related code comment
is not updated accordingly. Do it here.

Signed-off-by: Baoquan He 
---
 include/linux/slab_def.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index d9228e4d0320..3485c58cfd1c 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -67,9 +67,10 @@ struct kmem_cache {
 
/*
 * If debugging is enabled, then the allocator can add additional
-* fields and/or padding to every object. size contains the total
-* object size including these internal fields, the following two
-* variables contain the offset to the user object and its size.
+* fields and/or padding to every object. 'size' contains the total
+* object size including these internal fields, while 'obj_offset'
+* and 'object_size' contain the offset to the user object and its
+* size.
 */
int obj_offset;
 #endif /* CONFIG_DEBUG_SLAB */
-- 
2.13.6



[PATCH] Staging:greybus Fix comparison to NULL

2018-06-02 Thread Janani Sankara Babu
This patch replaces comparison of var to NULL with !var

Signed-off-by: Janani Sankara Babu 
---
 drivers/staging/greybus/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
index dafa430..5d14a4e 100644
--- a/drivers/staging/greybus/core.c
+++ b/drivers/staging/greybus/core.c
@@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
 static const struct greybus_bundle_id *
 greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
 {
-   if (id == NULL)
+   if (!id)
return NULL;

for (; id->vendor || id->product || id->class || id->driver_info;
--
1.9.1


[PATCH] Staging:greybus Fix comparison to NULL

2018-06-02 Thread Janani Sankara Babu
This patch replaces comparison of var to NULL with !var

Signed-off-by: Janani Sankara Babu 
---
 drivers/staging/greybus/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
index dafa430..5d14a4e 100644
--- a/drivers/staging/greybus/core.c
+++ b/drivers/staging/greybus/core.c
@@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
 static const struct greybus_bundle_id *
 greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
 {
-   if (id == NULL)
+   if (!id)
return NULL;

for (; id->vendor || id->product || id->class || id->driver_info;
--
1.9.1


[PATCH 2/4] clk: imx6sl: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx6sl.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c
index 66b1dd1..eb6bcbf 100644
--- a/drivers/clk/imx/clk-imx6sl.c
+++ b/drivers/clk/imx/clk-imx6sl.c
@@ -104,10 +104,6 @@ static struct clk_onecell_data clk_data;
 static void __iomem *ccm_base;
 static void __iomem *anatop_base;
 
-static const u32 clks_init_on[] __initconst = {
-   IMX6SL_CLK_IPG, IMX6SL_CLK_ARM, IMX6SL_CLK_MMDC_ROOT,
-};
-
 /*
  * ERR005311 CCM: After exit from WAIT mode, unwanted interrupt(s) taken
  *   during WAIT mode entry process could cause cache memory
@@ -195,7 +191,6 @@ static void __init imx6sl_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *base;
-   int i;
int ret;
 
clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
@@ -426,13 +421,6 @@ static void __init imx6sl_clocks_init(struct device_node 
*ccm_node)
pr_warn("%s: failed to set AHB clock rate %d!\n",
__func__, ret);
 
-   /*
-* Make sure those always on clocks are enabled to maintain the correct
-* usecount and enabling/disabling of parent PLLs.
-*/
-   for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-   clk_prepare_enable(clks[clks_init_on[i]]);
-
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6SL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]);
-- 
2.7.4



(#662655547) Gmail 转发确认 - 从 yangjz1...@gmail.com 接收邮件

2018-06-02 Thread Gmail 小组敬上
yangjz1...@gmail.com 已请求自动将邮件转发到您的电子邮件地址 linux-kernel@vger.kernel.org。
确认代码:662655547

要让 yangjz1...@gmail.com 自动将邮件转发到您的地址,请点击下面的链接确认请求:

https://mail-settings.google.com/mail/vf-%5BANGjdJ9ivX7ZrRaOC6uRBj-8Mc0GvYpKNyWsM4FV_vXSrV3j_xLprraeYhelfBtQq10rpYecH4SYDBYuub1zJaMZQ7E-5bQYbyRwzGozPw%5D-vMtvH8Cq4LUgA2WkwCnC5bqzJb4

如果您点击此链接后发现它可能已损坏,请复制此链接并将其粘贴到新的浏览器窗口中。如果您无法访问此链接,则您可以将确认代码 662655547
发送至 yangjz1...@gmail.com。

感谢您使用 Gmail!

Gmail 小组敬上

如果您不批准此请求,则不需要执行进一步操作。除非您点击上面的链接确认此请求,否则 yangjz1...@gmail.com
就无法自动将邮件转发到您的电子邮件地址。如果您无意中点击了此链接,但并不想让 yangjz1...@gmail.com
自动将邮件转发到您的地址,请点击以下链接取消此验证:
https://mail-settings.google.com/mail/uf-%5BANGjdJ--34-_AHzJRzMzGVBsVoPjoLSJIkPLm9d2DI0WFNj-yg5q1plXhWWIx8XiwjSNvYbnCAIF2r7kDeifAmsK-ZkGneSxbk12YIxWFQ%5D-vMtvH8Cq4LUgA2WkwCnC5bqzJb4

要详细了解为什么您会收到此邮件,请访问:http://support.google.com/mail/bin/answer.py?answer=184973=zh_CN。

请不要回复此邮件。如果您要与 Google.com 小组联系,请登录您的帐号,点击任何页面顶部的“帮助”,然后点击“帮助中心”底部的“与我们联系”。


[PATCH 3/4] clk: imx6sx: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx6sx.c | 40 ++--
 1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c
index 10c771b..aed4391 100644
--- a/drivers/clk/imx/clk-imx6sx.c
+++ b/drivers/clk/imx/clk-imx6sx.c
@@ -92,14 +92,6 @@ static const char *pll7_bypass_sels[] = { "pll7", 
"pll7_bypass_src", };
 static struct clk *clks[IMX6SX_CLK_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static int const clks_init_on[] __initconst = {
-   IMX6SX_CLK_AIPS_TZ1, IMX6SX_CLK_AIPS_TZ2, IMX6SX_CLK_AIPS_TZ3,
-   IMX6SX_CLK_IPMUX1, IMX6SX_CLK_IPMUX2, IMX6SX_CLK_IPMUX3,
-   IMX6SX_CLK_WAKEUP, IMX6SX_CLK_MMDC_P0_FAST, IMX6SX_CLK_MMDC_P0_IPG,
-   IMX6SX_CLK_ROM, IMX6SX_CLK_ARM, IMX6SX_CLK_IPG, IMX6SX_CLK_OCRAM,
-   IMX6SX_CLK_PER2_MAIN, IMX6SX_CLK_PERCLK, IMX6SX_CLK_TZASC1,
-};
-
 static const struct clk_div_table clk_enet_ref_table[] = {
{ .val = 0, .div = 20, },
{ .val = 1, .div = 10, },
@@ -142,7 +134,6 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *base;
-   int i;
 
clks[IMX6SX_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
 
@@ -332,7 +323,7 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
clks[IMX6SX_CLK_QSPI1_PODF] = imx_clk_divider("qspi1_podf", 
"qspi1_sel", base + 0x1c, 26,   3);
clks[IMX6SX_CLK_EIM_SLOW_PODF]  = imx_clk_divider("eim_slow_podf",  
"eim_slow_sel",  base + 0x1c, 23,   3);
clks[IMX6SX_CLK_LCDIF2_PODF]= imx_clk_divider("lcdif2_podf",
"lcdif2_pred",   base + 0x1c, 20,   3);
-   clks[IMX6SX_CLK_PERCLK] = imx_clk_divider("perclk", 
"perclk_sel",base + 0x1c, 0,6);
+   clks[IMX6SX_CLK_PERCLK] = imx_clk_divider_flags("perclk", 
"perclk_sel", base + 0x1c, 0, 6, CLK_IS_CRITICAL);
clks[IMX6SX_CLK_VID_PODF]   = imx_clk_divider("vid_podf",   
"vid_sel",   base + 0x20, 24,   2);
clks[IMX6SX_CLK_CAN_PODF]   = imx_clk_divider("can_podf",   
"can_sel",   base + 0x20, 2,6);
clks[IMX6SX_CLK_USDHC4_PODF]= imx_clk_divider("usdhc4_podf",
"usdhc4_sel",base + 0x24, 22,   3);
@@ -380,8 +371,8 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
 
/*name 
parent_name  reg shift */
/* CCGR0 */
-   clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2("aips_tz1",  "ahb",   
base + 0x68, 0);
-   clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2("aips_tz2",  "ahb",   
base + 0x68, 2);
+   clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2_flags("aips_tz1", "ahb", 
base + 0x68, 0, CLK_IS_CRITICAL);
+   clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2_flags("aips_tz2", "ahb", 
base + 0x68, 2, CLK_IS_CRITICAL);
clks[IMX6SX_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma",  
"usdhc3",base + 0x68, 4);
clks[IMX6SX_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", 
base + 0x68, 6, _count_asrc);
clks[IMX6SX_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", 
base + 0x68, 6, _count_asrc);
@@ -394,7 +385,7 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
clks[IMX6SX_CLK_CAN2_SERIAL]  = imx_clk_gate2("can2_serial",   
"can_podf",  base + 0x68, 20);
clks[IMX6SX_CLK_DCIC1]= imx_clk_gate2("dcic1", 
"display_podf",  base + 0x68, 24);
clks[IMX6SX_CLK_DCIC2]= imx_clk_gate2("dcic2", 
"display_podf",  base + 0x68, 26);
-   clks[IMX6SX_CLK_AIPS_TZ3] = imx_clk_gate2("aips_tz3",  "ahb",   
base + 0x68, 30);
+   clks[IMX6SX_CLK_AIPS_TZ3] = imx_clk_gate2_flags("aips_tz3", "ahb", 
base + 0x68, 30, CLK_IS_CRITICAL);
 
/* CCGR1 */
clks[IMX6SX_CLK_ECSPI1]   = imx_clk_gate2("ecspi1",
"ecspi_podf",base + 0x6c, 0);
@@ -407,7 +398,7 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
clks[IMX6SX_CLK_ESAI_EXTAL]   = imx_clk_gate2_shared("esai_extal", 
"esai_podf", base + 0x6c, 16, _count_esai);
clks[IMX6SX_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg",   
"ahb",   base + 0x6c, 16, _count_esai);
clks[IMX6SX_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem",   
"ahb",   base + 0x6c, 16, _count_esai);
-   clks[IMX6SX_CLK_WAKEUP]   = imx_clk_gate2("wakeup","ipg",   
base + 0x6c, 18);
+   clks[IMX6SX_CLK_WAKEUP]   = imx_clk_gate2_flags("wakeup", "ipg", 
base + 

[PATCH 4/4] clk: imx6ul: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
This patch is based on "[V2,1/2] clk: imx6ul: add GPIO clock gates".
 drivers/clk/imx/clk-imx6ul.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 3ea2d97..d3f7f4d 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -79,12 +79,6 @@ static const char *cko_sels[] = { "cko1", "cko2", };
 static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
-   IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
-   IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
-};
-
 static const struct clk_div_table clk_enet_ref_table[] = {
{ .val = 0, .div = 20, },
{ .val = 1, .div = 10, },
@@ -129,7 +123,6 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *base;
-   int i;
 
clks[IMX6UL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
 
@@ -336,8 +329,8 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_AHB]= imx_clk_busy_divider("ahb",   
"periph",   base +  0x14, 10, 3,  base + 0x48, 1);
 
/* CCGR0 */
-   clks[IMX6UL_CLK_AIPSTZ1]= imx_clk_gate2("aips_tz1", "ahb",  
base + 0x68,0);
-   clks[IMX6UL_CLK_AIPSTZ2]= imx_clk_gate2("aips_tz2", "ahb",  
base + 0x68,2);
+   clks[IMX6UL_CLK_AIPSTZ1]= imx_clk_gate2_flags("aips_tz1", 
"ahb", base + 0x68, 0, CLK_IS_CRITICAL);
+   clks[IMX6UL_CLK_AIPSTZ2]= imx_clk_gate2_flags("aips_tz2", 
"ahb", base + 0x68, 2, CLK_IS_CRITICAL);
clks[IMX6UL_CLK_APBHDMA]= imx_clk_gate2("apbh_dma", 
"bch_podf", base + 0x68,4);
clks[IMX6UL_CLK_ASRC_IPG]   = imx_clk_gate2_shared("asrc_ipg",  
"ahb",  base + 0x68,6, _count_asrc);
clks[IMX6UL_CLK_ASRC_MEM]   = imx_clk_gate2_shared("asrc_mem",  
"ahb",  base + 0x68,6, _count_asrc);
@@ -412,9 +405,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPIO4]  = imx_clk_gate2("gpio4","ipg",  
base + 0x74,12);
clks[IMX6UL_CLK_QSPI]   = imx_clk_gate2("qspi1",
"qspi1_podf",   base + 0x74,14);
clks[IMX6UL_CLK_WDOG1]  = imx_clk_gate2("wdog1","ipg",  
base + 0x74,16);
-   clks[IMX6UL_CLK_MMDC_P0_FAST]   = imx_clk_gate("mmdc_p0_fast", 
"mmdc_podf", base + 0x74,20);
-   clks[IMX6UL_CLK_MMDC_P0_IPG]= imx_clk_gate2("mmdc_p0_ipg",  "ipg",  
base + 0x74,24);
-   clks[IMX6UL_CLK_AXI]= imx_clk_gate("axi",   "axi_podf", 
base + 0x74,28);
+   clks[IMX6UL_CLK_MMDC_P0_FAST]   = imx_clk_gate_flags("mmdc_p0_fast", 
"mmdc_podf", base + 0x74,  20, CLK_IS_CRITICAL);
+   clks[IMX6UL_CLK_MMDC_P0_IPG]= imx_clk_gate2_flags("mmdc_p0_ipg",
"ipg",  base + 0x74,24, CLK_IS_CRITICAL);
+   clks[IMX6UL_CLK_AXI]= imx_clk_gate_flags("axi", 
"axi_podf", base + 0x74,28, CLK_IS_CRITICAL);
 
/* CCGR4 */
clks[IMX6UL_CLK_PER_BCH]= imx_clk_gate2("per_bch",  
"bch_podf", base + 0x78,12);
@@ -428,7 +421,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPMI_APB]   = imx_clk_gate2("gpmi_apb", 
"bch_podf", base + 0x78,30);
 
/* CCGR5 */
-   clks[IMX6UL_CLK_ROM]= imx_clk_gate2("rom",  "ahb",  
base + 0x7c,0);
+   clks[IMX6UL_CLK_ROM]= imx_clk_gate2_flags("rom","ahb",  
base + 0x7c,0,  CLK_IS_CRITICAL);
clks[IMX6UL_CLK_SDMA]   = imx_clk_gate2("sdma", "ahb",  
base + 0x7c,6);
clks[IMX6UL_CLK_KPP]= imx_clk_gate2("kpp",  "ipg",  
base + 0x7c,8);
clks[IMX6UL_CLK_WDOG2]  = imx_clk_gate2("wdog2","ipg",  
base + 0x7c,10);
@@ -502,10 +495,6 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clk_set_rate(clks[IMX6UL_CLK_ENET2_REF], 5000);
clk_set_rate(clks[IMX6UL_CLK_CSI], 2400);
 
-   /* keep all the clks on just for bringup */
-   for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-   clk_prepare_enable(clks[clks_init_on[i]]);
-
if (clk_on_imx6ull())
clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
 
-- 
2.7.4



[PATCH 2/4] clk: imx6sl: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx6sl.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c
index 66b1dd1..eb6bcbf 100644
--- a/drivers/clk/imx/clk-imx6sl.c
+++ b/drivers/clk/imx/clk-imx6sl.c
@@ -104,10 +104,6 @@ static struct clk_onecell_data clk_data;
 static void __iomem *ccm_base;
 static void __iomem *anatop_base;
 
-static const u32 clks_init_on[] __initconst = {
-   IMX6SL_CLK_IPG, IMX6SL_CLK_ARM, IMX6SL_CLK_MMDC_ROOT,
-};
-
 /*
  * ERR005311 CCM: After exit from WAIT mode, unwanted interrupt(s) taken
  *   during WAIT mode entry process could cause cache memory
@@ -195,7 +191,6 @@ static void __init imx6sl_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *base;
-   int i;
int ret;
 
clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
@@ -426,13 +421,6 @@ static void __init imx6sl_clocks_init(struct device_node 
*ccm_node)
pr_warn("%s: failed to set AHB clock rate %d!\n",
__func__, ret);
 
-   /*
-* Make sure those always on clocks are enabled to maintain the correct
-* usecount and enabling/disabling of parent PLLs.
-*/
-   for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-   clk_prepare_enable(clks[clks_init_on[i]]);
-
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6SL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]);
-- 
2.7.4



(#662655547) Gmail 转发确认 - 从 yangjz1...@gmail.com 接收邮件

2018-06-02 Thread Gmail 小组敬上
yangjz1...@gmail.com 已请求自动将邮件转发到您的电子邮件地址 linux-kernel@vger.kernel.org。
确认代码:662655547

要让 yangjz1...@gmail.com 自动将邮件转发到您的地址,请点击下面的链接确认请求:

https://mail-settings.google.com/mail/vf-%5BANGjdJ9ivX7ZrRaOC6uRBj-8Mc0GvYpKNyWsM4FV_vXSrV3j_xLprraeYhelfBtQq10rpYecH4SYDBYuub1zJaMZQ7E-5bQYbyRwzGozPw%5D-vMtvH8Cq4LUgA2WkwCnC5bqzJb4

如果您点击此链接后发现它可能已损坏,请复制此链接并将其粘贴到新的浏览器窗口中。如果您无法访问此链接,则您可以将确认代码 662655547
发送至 yangjz1...@gmail.com。

感谢您使用 Gmail!

Gmail 小组敬上

如果您不批准此请求,则不需要执行进一步操作。除非您点击上面的链接确认此请求,否则 yangjz1...@gmail.com
就无法自动将邮件转发到您的电子邮件地址。如果您无意中点击了此链接,但并不想让 yangjz1...@gmail.com
自动将邮件转发到您的地址,请点击以下链接取消此验证:
https://mail-settings.google.com/mail/uf-%5BANGjdJ--34-_AHzJRzMzGVBsVoPjoLSJIkPLm9d2DI0WFNj-yg5q1plXhWWIx8XiwjSNvYbnCAIF2r7kDeifAmsK-ZkGneSxbk12YIxWFQ%5D-vMtvH8Cq4LUgA2WkwCnC5bqzJb4

要详细了解为什么您会收到此邮件,请访问:http://support.google.com/mail/bin/answer.py?answer=184973=zh_CN。

请不要回复此邮件。如果您要与 Google.com 小组联系,请登录您的帐号,点击任何页面顶部的“帮助”,然后点击“帮助中心”底部的“与我们联系”。


[PATCH 3/4] clk: imx6sx: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx6sx.c | 40 ++--
 1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c
index 10c771b..aed4391 100644
--- a/drivers/clk/imx/clk-imx6sx.c
+++ b/drivers/clk/imx/clk-imx6sx.c
@@ -92,14 +92,6 @@ static const char *pll7_bypass_sels[] = { "pll7", 
"pll7_bypass_src", };
 static struct clk *clks[IMX6SX_CLK_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static int const clks_init_on[] __initconst = {
-   IMX6SX_CLK_AIPS_TZ1, IMX6SX_CLK_AIPS_TZ2, IMX6SX_CLK_AIPS_TZ3,
-   IMX6SX_CLK_IPMUX1, IMX6SX_CLK_IPMUX2, IMX6SX_CLK_IPMUX3,
-   IMX6SX_CLK_WAKEUP, IMX6SX_CLK_MMDC_P0_FAST, IMX6SX_CLK_MMDC_P0_IPG,
-   IMX6SX_CLK_ROM, IMX6SX_CLK_ARM, IMX6SX_CLK_IPG, IMX6SX_CLK_OCRAM,
-   IMX6SX_CLK_PER2_MAIN, IMX6SX_CLK_PERCLK, IMX6SX_CLK_TZASC1,
-};
-
 static const struct clk_div_table clk_enet_ref_table[] = {
{ .val = 0, .div = 20, },
{ .val = 1, .div = 10, },
@@ -142,7 +134,6 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *base;
-   int i;
 
clks[IMX6SX_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
 
@@ -332,7 +323,7 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
clks[IMX6SX_CLK_QSPI1_PODF] = imx_clk_divider("qspi1_podf", 
"qspi1_sel", base + 0x1c, 26,   3);
clks[IMX6SX_CLK_EIM_SLOW_PODF]  = imx_clk_divider("eim_slow_podf",  
"eim_slow_sel",  base + 0x1c, 23,   3);
clks[IMX6SX_CLK_LCDIF2_PODF]= imx_clk_divider("lcdif2_podf",
"lcdif2_pred",   base + 0x1c, 20,   3);
-   clks[IMX6SX_CLK_PERCLK] = imx_clk_divider("perclk", 
"perclk_sel",base + 0x1c, 0,6);
+   clks[IMX6SX_CLK_PERCLK] = imx_clk_divider_flags("perclk", 
"perclk_sel", base + 0x1c, 0, 6, CLK_IS_CRITICAL);
clks[IMX6SX_CLK_VID_PODF]   = imx_clk_divider("vid_podf",   
"vid_sel",   base + 0x20, 24,   2);
clks[IMX6SX_CLK_CAN_PODF]   = imx_clk_divider("can_podf",   
"can_sel",   base + 0x20, 2,6);
clks[IMX6SX_CLK_USDHC4_PODF]= imx_clk_divider("usdhc4_podf",
"usdhc4_sel",base + 0x24, 22,   3);
@@ -380,8 +371,8 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
 
/*name 
parent_name  reg shift */
/* CCGR0 */
-   clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2("aips_tz1",  "ahb",   
base + 0x68, 0);
-   clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2("aips_tz2",  "ahb",   
base + 0x68, 2);
+   clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2_flags("aips_tz1", "ahb", 
base + 0x68, 0, CLK_IS_CRITICAL);
+   clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2_flags("aips_tz2", "ahb", 
base + 0x68, 2, CLK_IS_CRITICAL);
clks[IMX6SX_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma",  
"usdhc3",base + 0x68, 4);
clks[IMX6SX_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", 
base + 0x68, 6, _count_asrc);
clks[IMX6SX_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", 
base + 0x68, 6, _count_asrc);
@@ -394,7 +385,7 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
clks[IMX6SX_CLK_CAN2_SERIAL]  = imx_clk_gate2("can2_serial",   
"can_podf",  base + 0x68, 20);
clks[IMX6SX_CLK_DCIC1]= imx_clk_gate2("dcic1", 
"display_podf",  base + 0x68, 24);
clks[IMX6SX_CLK_DCIC2]= imx_clk_gate2("dcic2", 
"display_podf",  base + 0x68, 26);
-   clks[IMX6SX_CLK_AIPS_TZ3] = imx_clk_gate2("aips_tz3",  "ahb",   
base + 0x68, 30);
+   clks[IMX6SX_CLK_AIPS_TZ3] = imx_clk_gate2_flags("aips_tz3", "ahb", 
base + 0x68, 30, CLK_IS_CRITICAL);
 
/* CCGR1 */
clks[IMX6SX_CLK_ECSPI1]   = imx_clk_gate2("ecspi1",
"ecspi_podf",base + 0x6c, 0);
@@ -407,7 +398,7 @@ static void __init imx6sx_clocks_init(struct device_node 
*ccm_node)
clks[IMX6SX_CLK_ESAI_EXTAL]   = imx_clk_gate2_shared("esai_extal", 
"esai_podf", base + 0x6c, 16, _count_esai);
clks[IMX6SX_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg",   
"ahb",   base + 0x6c, 16, _count_esai);
clks[IMX6SX_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem",   
"ahb",   base + 0x6c, 16, _count_esai);
-   clks[IMX6SX_CLK_WAKEUP]   = imx_clk_gate2("wakeup","ipg",   
base + 0x6c, 18);
+   clks[IMX6SX_CLK_WAKEUP]   = imx_clk_gate2_flags("wakeup", "ipg", 
base + 

[PATCH 4/4] clk: imx6ul: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
This patch is based on "[V2,1/2] clk: imx6ul: add GPIO clock gates".
 drivers/clk/imx/clk-imx6ul.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 3ea2d97..d3f7f4d 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -79,12 +79,6 @@ static const char *cko_sels[] = { "cko1", "cko2", };
 static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
-   IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
-   IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
-};
-
 static const struct clk_div_table clk_enet_ref_table[] = {
{ .val = 0, .div = 20, },
{ .val = 1, .div = 10, },
@@ -129,7 +123,6 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *base;
-   int i;
 
clks[IMX6UL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
 
@@ -336,8 +329,8 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_AHB]= imx_clk_busy_divider("ahb",   
"periph",   base +  0x14, 10, 3,  base + 0x48, 1);
 
/* CCGR0 */
-   clks[IMX6UL_CLK_AIPSTZ1]= imx_clk_gate2("aips_tz1", "ahb",  
base + 0x68,0);
-   clks[IMX6UL_CLK_AIPSTZ2]= imx_clk_gate2("aips_tz2", "ahb",  
base + 0x68,2);
+   clks[IMX6UL_CLK_AIPSTZ1]= imx_clk_gate2_flags("aips_tz1", 
"ahb", base + 0x68, 0, CLK_IS_CRITICAL);
+   clks[IMX6UL_CLK_AIPSTZ2]= imx_clk_gate2_flags("aips_tz2", 
"ahb", base + 0x68, 2, CLK_IS_CRITICAL);
clks[IMX6UL_CLK_APBHDMA]= imx_clk_gate2("apbh_dma", 
"bch_podf", base + 0x68,4);
clks[IMX6UL_CLK_ASRC_IPG]   = imx_clk_gate2_shared("asrc_ipg",  
"ahb",  base + 0x68,6, _count_asrc);
clks[IMX6UL_CLK_ASRC_MEM]   = imx_clk_gate2_shared("asrc_mem",  
"ahb",  base + 0x68,6, _count_asrc);
@@ -412,9 +405,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPIO4]  = imx_clk_gate2("gpio4","ipg",  
base + 0x74,12);
clks[IMX6UL_CLK_QSPI]   = imx_clk_gate2("qspi1",
"qspi1_podf",   base + 0x74,14);
clks[IMX6UL_CLK_WDOG1]  = imx_clk_gate2("wdog1","ipg",  
base + 0x74,16);
-   clks[IMX6UL_CLK_MMDC_P0_FAST]   = imx_clk_gate("mmdc_p0_fast", 
"mmdc_podf", base + 0x74,20);
-   clks[IMX6UL_CLK_MMDC_P0_IPG]= imx_clk_gate2("mmdc_p0_ipg",  "ipg",  
base + 0x74,24);
-   clks[IMX6UL_CLK_AXI]= imx_clk_gate("axi",   "axi_podf", 
base + 0x74,28);
+   clks[IMX6UL_CLK_MMDC_P0_FAST]   = imx_clk_gate_flags("mmdc_p0_fast", 
"mmdc_podf", base + 0x74,  20, CLK_IS_CRITICAL);
+   clks[IMX6UL_CLK_MMDC_P0_IPG]= imx_clk_gate2_flags("mmdc_p0_ipg",
"ipg",  base + 0x74,24, CLK_IS_CRITICAL);
+   clks[IMX6UL_CLK_AXI]= imx_clk_gate_flags("axi", 
"axi_podf", base + 0x74,28, CLK_IS_CRITICAL);
 
/* CCGR4 */
clks[IMX6UL_CLK_PER_BCH]= imx_clk_gate2("per_bch",  
"bch_podf", base + 0x78,12);
@@ -428,7 +421,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPMI_APB]   = imx_clk_gate2("gpmi_apb", 
"bch_podf", base + 0x78,30);
 
/* CCGR5 */
-   clks[IMX6UL_CLK_ROM]= imx_clk_gate2("rom",  "ahb",  
base + 0x7c,0);
+   clks[IMX6UL_CLK_ROM]= imx_clk_gate2_flags("rom","ahb",  
base + 0x7c,0,  CLK_IS_CRITICAL);
clks[IMX6UL_CLK_SDMA]   = imx_clk_gate2("sdma", "ahb",  
base + 0x7c,6);
clks[IMX6UL_CLK_KPP]= imx_clk_gate2("kpp",  "ipg",  
base + 0x7c,8);
clks[IMX6UL_CLK_WDOG2]  = imx_clk_gate2("wdog2","ipg",  
base + 0x7c,10);
@@ -502,10 +495,6 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clk_set_rate(clks[IMX6UL_CLK_ENET2_REF], 5000);
clk_set_rate(clks[IMX6UL_CLK_CSI], 2400);
 
-   /* keep all the clks on just for bringup */
-   for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-   clk_prepare_enable(clks[clks_init_on[i]]);
-
if (clk_on_imx6ull())
clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
 
-- 
2.7.4



[PATCH 1/4] clk: imx6q: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx6q.c | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index b9ea703..8754c61 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -96,12 +96,6 @@ static const char *pll7_bypass_sels[] = { "pll7", 
"pll7_bypass_src", };
 static struct clk *clk[IMX6QDL_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static unsigned int const clks_init_on[] __initconst = {
-   IMX6QDL_CLK_MMDC_CH0_AXI,
-   IMX6QDL_CLK_ROM,
-   IMX6QDL_CLK_ARM,
-};
-
 static struct clk_div_table clk_enet_ref_table[] = {
{ .val = 0, .div = 20, },
{ .val = 1, .div = 10, },
@@ -417,7 +411,6 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *anatop_base, *base;
-   int i;
int ret;
 
clk[IMX6QDL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
@@ -794,7 +787,7 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb",
"mlb_podf",   base + 0x74, 18);
else
clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb","axi",   
base + 0x74, 18);
-   clk[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_gate2("mmdc_ch0_axi",  
"mmdc_ch0_axi_podf", base + 0x74, 20);
+   clk[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_gate2_flags("mmdc_ch0_axi",  
"mmdc_ch0_axi_podf", base + 0x74, 20, CLK_IS_CRITICAL);
clk[IMX6QDL_CLK_MMDC_CH1_AXI] = imx_clk_gate2("mmdc_ch1_axi",  
"mmdc_ch1_axi_podf", base + 0x74, 22);
clk[IMX6QDL_CLK_OCRAM]= imx_clk_gate2("ocram", "ahb",   
base + 0x74, 28);
clk[IMX6QDL_CLK_OPENVG_AXI]   = imx_clk_gate2("openvg_axi","axi",   
base + 0x74, 30);
@@ -808,7 +801,7 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
clk[IMX6QDL_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch",  
"usdhc4",base + 0x78, 26);
clk[IMX6QDL_CLK_GPMI_IO]  = imx_clk_gate2("gpmi_io",   "enfc",  
base + 0x78, 28);
clk[IMX6QDL_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb",  
"usdhc3",base + 0x78, 30);
-   clk[IMX6QDL_CLK_ROM]  = imx_clk_gate2("rom",   "ahb",   
base + 0x7c, 0);
+   clk[IMX6QDL_CLK_ROM]  = imx_clk_gate2_flags("rom", "ahb",   
base + 0x7c, 0, CLK_IS_CRITICAL);
clk[IMX6QDL_CLK_SATA] = imx_clk_gate2("sata",  "ahb",   
base + 0x7c, 4);
clk[IMX6QDL_CLK_SDMA] = imx_clk_gate2("sdma",  "ahb",   
base + 0x7c, 6);
clk[IMX6QDL_CLK_SPBA] = imx_clk_gate2("spba",  "ipg",   
base + 0x7c, 12);
@@ -878,9 +871,6 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
 */
clk_set_parent(clk[IMX6QDL_CLK_ENFC_SEL], 
clk[IMX6QDL_CLK_PLL2_PFD2_396M]);
 
-   for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-   clk_prepare_enable(clk[clks_init_on[i]]);
-
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]);
-- 
2.7.4



[PATCH 1/4] clk: imx6q: remove clks_init_on array

2018-06-02 Thread Anson Huang
Clock framework will enable those clocks registered
with CLK_IS_CRITICAL flag, so no need to have
clks_init_on array during clock initialization now.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx6q.c | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index b9ea703..8754c61 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -96,12 +96,6 @@ static const char *pll7_bypass_sels[] = { "pll7", 
"pll7_bypass_src", };
 static struct clk *clk[IMX6QDL_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static unsigned int const clks_init_on[] __initconst = {
-   IMX6QDL_CLK_MMDC_CH0_AXI,
-   IMX6QDL_CLK_ROM,
-   IMX6QDL_CLK_ARM,
-};
-
 static struct clk_div_table clk_enet_ref_table[] = {
{ .val = 0, .div = 20, },
{ .val = 1, .div = 10, },
@@ -417,7 +411,6 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
 {
struct device_node *np;
void __iomem *anatop_base, *base;
-   int i;
int ret;
 
clk[IMX6QDL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
@@ -794,7 +787,7 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb",
"mlb_podf",   base + 0x74, 18);
else
clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb","axi",   
base + 0x74, 18);
-   clk[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_gate2("mmdc_ch0_axi",  
"mmdc_ch0_axi_podf", base + 0x74, 20);
+   clk[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_gate2_flags("mmdc_ch0_axi",  
"mmdc_ch0_axi_podf", base + 0x74, 20, CLK_IS_CRITICAL);
clk[IMX6QDL_CLK_MMDC_CH1_AXI] = imx_clk_gate2("mmdc_ch1_axi",  
"mmdc_ch1_axi_podf", base + 0x74, 22);
clk[IMX6QDL_CLK_OCRAM]= imx_clk_gate2("ocram", "ahb",   
base + 0x74, 28);
clk[IMX6QDL_CLK_OPENVG_AXI]   = imx_clk_gate2("openvg_axi","axi",   
base + 0x74, 30);
@@ -808,7 +801,7 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
clk[IMX6QDL_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch",  
"usdhc4",base + 0x78, 26);
clk[IMX6QDL_CLK_GPMI_IO]  = imx_clk_gate2("gpmi_io",   "enfc",  
base + 0x78, 28);
clk[IMX6QDL_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb",  
"usdhc3",base + 0x78, 30);
-   clk[IMX6QDL_CLK_ROM]  = imx_clk_gate2("rom",   "ahb",   
base + 0x7c, 0);
+   clk[IMX6QDL_CLK_ROM]  = imx_clk_gate2_flags("rom", "ahb",   
base + 0x7c, 0, CLK_IS_CRITICAL);
clk[IMX6QDL_CLK_SATA] = imx_clk_gate2("sata",  "ahb",   
base + 0x7c, 4);
clk[IMX6QDL_CLK_SDMA] = imx_clk_gate2("sdma",  "ahb",   
base + 0x7c, 6);
clk[IMX6QDL_CLK_SPBA] = imx_clk_gate2("spba",  "ipg",   
base + 0x7c, 12);
@@ -878,9 +871,6 @@ static void __init imx6q_clocks_init(struct device_node 
*ccm_node)
 */
clk_set_parent(clk[IMX6QDL_CLK_ENFC_SEL], 
clk[IMX6QDL_CLK_PLL2_PFD2_396M]);
 
-   for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-   clk_prepare_enable(clk[clks_init_on[i]]);
-
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]);
-- 
2.7.4



Re: [PATCH 0/7] MIPS: boot: fix various problems in arch/mips/boot/Makefile

2018-06-02 Thread Masahiro Yamada
Hi MIPS maintainers,

2018-04-16 23:47 GMT+09:00 Masahiro Yamada :
>
> When I was trying to fix commit 0f9da844d877 in a more correct way,
> I found various problems in arch/mips/boot/Makefile.
>
> ITS is always rebuilt when you rebuild the kernel without touching
> anything.  Many build rules are wrong.
>
> If you look at the last patch in this series, you may realize
> supporting ITB building in the kernel can cause nasty problems.
> Personally, I do not like it, but I tried my best to fix the problems.
>
> With this series, ITB is rebuilt only when necessary.
>

Is any part of this series applicable?
At least, patch 1-4 look simple to me.


Patch 5-7 should be applied together.
The last one is a bit tricky, so you can ignore 5-7 if you do not like them.
(Only the problem is, ITB files are always rebuilt even if nothing is changed.)

>
> Masahiro Yamada (7):
>   Revert "MIPS: boot: Define __ASSEMBLY__ for its.S build"
>   MIPS: boot: do not include $(cpp_flags) for preprocessing ITS
>   MIPS: boot: fix build rule of vmlinux.its.S
>   MIPS: boot: correct prerequisite image of vmlinux.*.its
>   MIPS: boot: add missing targets for vmlinux.*.its
>   MIPS: boot: merge build rules of vmlinux.*.itb by using pattern rule
>   MIPS: boot: rebuild ITB when contained DTB is updated
>
>  arch/mips/boot/Makefile | 69 
> ++---
>  1 file changed, 37 insertions(+), 32 deletions(-)
>
> --
> 2.7.4
>



-- 
Best Regards
Masahiro Yamada


Re: [PATCH 0/7] MIPS: boot: fix various problems in arch/mips/boot/Makefile

2018-06-02 Thread Masahiro Yamada
Hi MIPS maintainers,

2018-04-16 23:47 GMT+09:00 Masahiro Yamada :
>
> When I was trying to fix commit 0f9da844d877 in a more correct way,
> I found various problems in arch/mips/boot/Makefile.
>
> ITS is always rebuilt when you rebuild the kernel without touching
> anything.  Many build rules are wrong.
>
> If you look at the last patch in this series, you may realize
> supporting ITB building in the kernel can cause nasty problems.
> Personally, I do not like it, but I tried my best to fix the problems.
>
> With this series, ITB is rebuilt only when necessary.
>

Is any part of this series applicable?
At least, patch 1-4 look simple to me.


Patch 5-7 should be applied together.
The last one is a bit tricky, so you can ignore 5-7 if you do not like them.
(Only the problem is, ITB files are always rebuilt even if nothing is changed.)

>
> Masahiro Yamada (7):
>   Revert "MIPS: boot: Define __ASSEMBLY__ for its.S build"
>   MIPS: boot: do not include $(cpp_flags) for preprocessing ITS
>   MIPS: boot: fix build rule of vmlinux.its.S
>   MIPS: boot: correct prerequisite image of vmlinux.*.its
>   MIPS: boot: add missing targets for vmlinux.*.its
>   MIPS: boot: merge build rules of vmlinux.*.itb by using pattern rule
>   MIPS: boot: rebuild ITB when contained DTB is updated
>
>  arch/mips/boot/Makefile | 69 
> ++---
>  1 file changed, 37 insertions(+), 32 deletions(-)
>
> --
> 2.7.4
>



-- 
Best Regards
Masahiro Yamada


[PATCH V2 2/3] ARM: imx: add cpu idle support for i.MX6SLL

2018-06-02 Thread Anson Huang
i.MX6SLL supports cpu idle with ARM power gated,
it can reuse i.MX6SX's cpu idle driver to support
below 3 states of cpu idle:

state0: WFI;
state1: WAIT mode with ARM power on;
state2: WAIT mode with ARM power off.

L2_PGE in GPC_CNTR needs to be cleared to support
state2 cpu idle.

Signed-off-by: Anson Huang 
---
changes since V1:
Fix build error when cpuidle-imx6sx.c is NOT included in Makefile by 
different SoC configuration.
 arch/arm/mach-imx/Makefile | 4 ++--
 arch/arm/mach-imx/cpuidle-imx6sx.c | 1 +
 arch/arm/mach-imx/mach-imx6sl.c| 5 -
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 2327e3e..127fdf3 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -25,8 +25,8 @@ obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
 ifeq ($(CONFIG_CPU_IDLE),y)
 obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
 obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
-obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o
-obj-$(CONFIG_SOC_IMX6SLL) += cpuidle-imx6sl.o
+obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o cpuidle-imx6sx.o
+obj-$(CONFIG_SOC_IMX6SLL) += cpuidle-imx6sl.o cpuidle-imx6sx.o
 obj-$(CONFIG_SOC_IMX6SX) += cpuidle-imx6sx.o
 obj-$(CONFIG_SOC_IMX6UL) += cpuidle-imx6sx.o
 endif
diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c 
b/arch/arm/mach-imx/cpuidle-imx6sx.c
index d0f14b7..243a108 100644
--- a/arch/arm/mach-imx/cpuidle-imx6sx.c
+++ b/arch/arm/mach-imx/cpuidle-imx6sx.c
@@ -103,6 +103,7 @@ int __init imx6sx_cpuidle_init(void)
 {
imx6_set_int_mem_clk_lpm(true);
imx6_enable_rbc(false);
+   imx_gpc_set_l2_mem_power_in_lpm(false);
/*
 * set ARM power up/down timing to the fastest,
 * sw2iso and sw can be set to one 32K cycle = 31us
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index c7a1ef1..183540e 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -42,7 +42,10 @@ static void __init imx6sl_init_late(void)
if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
 
-   imx6sl_cpuidle_init();
+   if (cpu_is_imx6sl())
+   imx6sl_cpuidle_init();
+   else
+   imx6sx_cpuidle_init();
 }
 
 static void __init imx6sl_init_machine(void)
-- 
2.7.4



[PATCH V2 1/3] ARM: imx: add L2 page power control for GPC

2018-06-02 Thread Anson Huang
Some platforms like i.MX6UL/i.MX6SLL have L2
page power control in GPC, it needs to be
disabled if ARM is power gated and L2 is NOT
flushed, add GPC interface to control it.

Signed-off-by: Anson Huang 
---
no change since V1.
 arch/arm/mach-imx/common.h |  1 +
 arch/arm/mach-imx/gpc.c| 14 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index c8d68e9..a2716ec 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -58,6 +58,7 @@ struct device *imx_soc_device_init(void);
 void imx6_enable_rbc(bool enable);
 void imx_gpc_check_dt(void);
 void imx_gpc_set_arm_power_in_lpm(bool power_off);
+void imx_gpc_set_l2_mem_power_in_lpm(bool power_off);
 void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
 void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
 void imx25_pm_init(void);
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index de535cb..e11159d 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -20,6 +20,7 @@
 #include "common.h"
 #include "hardware.h"
 
+#define GPC_CNTR   0x0
 #define GPC_IMR1   0x008
 #define GPC_PGC_CPU_PDN0x2a0
 #define GPC_PGC_CPU_PUPSCR 0x2a4
@@ -27,6 +28,8 @@
 #define GPC_PGC_SW2ISO_SHIFT   0x8
 #define GPC_PGC_SW_SHIFT   0x0
 
+#define GPC_CNTR_L2_PGE_SHIFT  22
+
 #define IMR_NUM4
 #define GPC_MAX_IRQS   (IMR_NUM * 32)
 
@@ -51,6 +54,17 @@ void imx_gpc_set_arm_power_in_lpm(bool power_off)
writel_relaxed(power_off, gpc_base + GPC_PGC_CPU_PDN);
 }
 
+void imx_gpc_set_l2_mem_power_in_lpm(bool power_off)
+{
+   u32 val;
+
+   val = readl_relaxed(gpc_base + GPC_CNTR);
+   val &= ~(1 << GPC_CNTR_L2_PGE_SHIFT);
+   if (power_off)
+   val |= 1 << GPC_CNTR_L2_PGE_SHIFT;
+   writel_relaxed(val, gpc_base + GPC_CNTR);
+}
+
 void imx_gpc_pre_suspend(bool arm_power_off)
 {
void __iomem *reg_imr1 = gpc_base + GPC_IMR1;
-- 
2.7.4



[PATCH V2 3/3] ARM: imx: remove i.MX6SLL support in i.MX6SL cpu idle driver

2018-06-02 Thread Anson Huang
i.MX6SLL supports ARM power off in cpu idle, better to reuse
i.MX6SX cpu idle driver instead of i.MX6SL which does NOT
support ARM power off.

Signed-off-by: Anson Huang 
---
no change since V1.
 arch/arm/mach-imx/cpuidle-imx6sl.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/cpuidle-imx6sl.c 
b/arch/arm/mach-imx/cpuidle-imx6sl.c
index fa8ead1..8d866fb 100644
--- a/arch/arm/mach-imx/cpuidle-imx6sl.c
+++ b/arch/arm/mach-imx/cpuidle-imx6sl.c
@@ -12,7 +12,6 @@
 
 #include "common.h"
 #include "cpuidle.h"
-#include "hardware.h"
 
 static int imx6sl_enter_wait(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
@@ -22,11 +21,9 @@ static int imx6sl_enter_wait(struct cpuidle_device *dev,
 * Software workaround for ERR005311, see function
 * description for details.
 */
-   if (cpu_is_imx6sl())
-   imx6sl_set_wait_clk(true);
+   imx6sl_set_wait_clk(true);
cpu_do_idle();
-   if (cpu_is_imx6sl())
-   imx6sl_set_wait_clk(false);
+   imx6sl_set_wait_clk(false);
imx6_set_lpm(WAIT_CLOCKED);
 
return index;
-- 
2.7.4



[PATCH V2 2/3] ARM: imx: add cpu idle support for i.MX6SLL

2018-06-02 Thread Anson Huang
i.MX6SLL supports cpu idle with ARM power gated,
it can reuse i.MX6SX's cpu idle driver to support
below 3 states of cpu idle:

state0: WFI;
state1: WAIT mode with ARM power on;
state2: WAIT mode with ARM power off.

L2_PGE in GPC_CNTR needs to be cleared to support
state2 cpu idle.

Signed-off-by: Anson Huang 
---
changes since V1:
Fix build error when cpuidle-imx6sx.c is NOT included in Makefile by 
different SoC configuration.
 arch/arm/mach-imx/Makefile | 4 ++--
 arch/arm/mach-imx/cpuidle-imx6sx.c | 1 +
 arch/arm/mach-imx/mach-imx6sl.c| 5 -
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 2327e3e..127fdf3 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -25,8 +25,8 @@ obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
 ifeq ($(CONFIG_CPU_IDLE),y)
 obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
 obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
-obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o
-obj-$(CONFIG_SOC_IMX6SLL) += cpuidle-imx6sl.o
+obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o cpuidle-imx6sx.o
+obj-$(CONFIG_SOC_IMX6SLL) += cpuidle-imx6sl.o cpuidle-imx6sx.o
 obj-$(CONFIG_SOC_IMX6SX) += cpuidle-imx6sx.o
 obj-$(CONFIG_SOC_IMX6UL) += cpuidle-imx6sx.o
 endif
diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c 
b/arch/arm/mach-imx/cpuidle-imx6sx.c
index d0f14b7..243a108 100644
--- a/arch/arm/mach-imx/cpuidle-imx6sx.c
+++ b/arch/arm/mach-imx/cpuidle-imx6sx.c
@@ -103,6 +103,7 @@ int __init imx6sx_cpuidle_init(void)
 {
imx6_set_int_mem_clk_lpm(true);
imx6_enable_rbc(false);
+   imx_gpc_set_l2_mem_power_in_lpm(false);
/*
 * set ARM power up/down timing to the fastest,
 * sw2iso and sw can be set to one 32K cycle = 31us
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index c7a1ef1..183540e 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -42,7 +42,10 @@ static void __init imx6sl_init_late(void)
if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
 
-   imx6sl_cpuidle_init();
+   if (cpu_is_imx6sl())
+   imx6sl_cpuidle_init();
+   else
+   imx6sx_cpuidle_init();
 }
 
 static void __init imx6sl_init_machine(void)
-- 
2.7.4



[PATCH V2 1/3] ARM: imx: add L2 page power control for GPC

2018-06-02 Thread Anson Huang
Some platforms like i.MX6UL/i.MX6SLL have L2
page power control in GPC, it needs to be
disabled if ARM is power gated and L2 is NOT
flushed, add GPC interface to control it.

Signed-off-by: Anson Huang 
---
no change since V1.
 arch/arm/mach-imx/common.h |  1 +
 arch/arm/mach-imx/gpc.c| 14 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index c8d68e9..a2716ec 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -58,6 +58,7 @@ struct device *imx_soc_device_init(void);
 void imx6_enable_rbc(bool enable);
 void imx_gpc_check_dt(void);
 void imx_gpc_set_arm_power_in_lpm(bool power_off);
+void imx_gpc_set_l2_mem_power_in_lpm(bool power_off);
 void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
 void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
 void imx25_pm_init(void);
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index de535cb..e11159d 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -20,6 +20,7 @@
 #include "common.h"
 #include "hardware.h"
 
+#define GPC_CNTR   0x0
 #define GPC_IMR1   0x008
 #define GPC_PGC_CPU_PDN0x2a0
 #define GPC_PGC_CPU_PUPSCR 0x2a4
@@ -27,6 +28,8 @@
 #define GPC_PGC_SW2ISO_SHIFT   0x8
 #define GPC_PGC_SW_SHIFT   0x0
 
+#define GPC_CNTR_L2_PGE_SHIFT  22
+
 #define IMR_NUM4
 #define GPC_MAX_IRQS   (IMR_NUM * 32)
 
@@ -51,6 +54,17 @@ void imx_gpc_set_arm_power_in_lpm(bool power_off)
writel_relaxed(power_off, gpc_base + GPC_PGC_CPU_PDN);
 }
 
+void imx_gpc_set_l2_mem_power_in_lpm(bool power_off)
+{
+   u32 val;
+
+   val = readl_relaxed(gpc_base + GPC_CNTR);
+   val &= ~(1 << GPC_CNTR_L2_PGE_SHIFT);
+   if (power_off)
+   val |= 1 << GPC_CNTR_L2_PGE_SHIFT;
+   writel_relaxed(val, gpc_base + GPC_CNTR);
+}
+
 void imx_gpc_pre_suspend(bool arm_power_off)
 {
void __iomem *reg_imr1 = gpc_base + GPC_IMR1;
-- 
2.7.4



[PATCH V2 3/3] ARM: imx: remove i.MX6SLL support in i.MX6SL cpu idle driver

2018-06-02 Thread Anson Huang
i.MX6SLL supports ARM power off in cpu idle, better to reuse
i.MX6SX cpu idle driver instead of i.MX6SL which does NOT
support ARM power off.

Signed-off-by: Anson Huang 
---
no change since V1.
 arch/arm/mach-imx/cpuidle-imx6sl.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/cpuidle-imx6sl.c 
b/arch/arm/mach-imx/cpuidle-imx6sl.c
index fa8ead1..8d866fb 100644
--- a/arch/arm/mach-imx/cpuidle-imx6sl.c
+++ b/arch/arm/mach-imx/cpuidle-imx6sl.c
@@ -12,7 +12,6 @@
 
 #include "common.h"
 #include "cpuidle.h"
-#include "hardware.h"
 
 static int imx6sl_enter_wait(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
@@ -22,11 +21,9 @@ static int imx6sl_enter_wait(struct cpuidle_device *dev,
 * Software workaround for ERR005311, see function
 * description for details.
 */
-   if (cpu_is_imx6sl())
-   imx6sl_set_wait_clk(true);
+   imx6sl_set_wait_clk(true);
cpu_do_idle();
-   if (cpu_is_imx6sl())
-   imx6sl_set_wait_clk(false);
+   imx6sl_set_wait_clk(false);
imx6_set_lpm(WAIT_CLOCKED);
 
return index;
-- 
2.7.4



Re: [PATCH V2 2/2] ARM: dts: imx6ul: add GPIO clocks

2018-06-02 Thread Fabio Estevam
On Sat, Jun 2, 2018 at 10:44 PM, Anson Huang  wrote:
> i.MX6UL has GPIO clock gates in CCM CCGR, add
> clock property for GPIO driver to make sure all
> GPIO banks work as expected.
>
> Signed-off-by: Anson Huang 

Reviewed-by: Fabio Estevam 


Re: [PATCH V2 1/2] clk: imx6ul: add GPIO clock gates

2018-06-02 Thread Fabio Estevam
On Sat, Jun 2, 2018 at 10:44 PM, Anson Huang  wrote:
> i.MX6UL has GPIO clock gates in CCM CCGR,
> add them into clock tree for clock management.
>
> Signed-off-by: Anson Huang 

Reviewed-by: Fabio Estevam 


Re: [PATCH V2 2/2] ARM: dts: imx6ul: add GPIO clocks

2018-06-02 Thread Fabio Estevam
On Sat, Jun 2, 2018 at 10:44 PM, Anson Huang  wrote:
> i.MX6UL has GPIO clock gates in CCM CCGR, add
> clock property for GPIO driver to make sure all
> GPIO banks work as expected.
>
> Signed-off-by: Anson Huang 

Reviewed-by: Fabio Estevam 


Re: [PATCH V2 1/2] clk: imx6ul: add GPIO clock gates

2018-06-02 Thread Fabio Estevam
On Sat, Jun 2, 2018 at 10:44 PM, Anson Huang  wrote:
> i.MX6UL has GPIO clock gates in CCM CCGR,
> add them into clock tree for clock management.
>
> Signed-off-by: Anson Huang 

Reviewed-by: Fabio Estevam 


[PATCH V2 2/2] ARM: dts: imx6ul: add GPIO clocks

2018-06-02 Thread Anson Huang
i.MX6UL has GPIO clock gates in CCM CCGR, add
clock property for GPIO driver to make sure all
GPIO banks work as expected.

Signed-off-by: Anson Huang 
---
no changes since V1.
 arch/arm/boot/dts/imx6ul.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index 1241972..405e068 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -437,6 +437,7 @@
reg = <0x0209c000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO1>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -450,6 +451,7 @@
reg = <0x020a 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO2>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -462,6 +464,7 @@
reg = <0x020a4000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO3>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -474,6 +477,7 @@
reg = <0x020a8000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO4>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -486,6 +490,7 @@
reg = <0x020ac000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO5>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
-- 
2.7.4



[PATCH V2 2/2] ARM: dts: imx6ul: add GPIO clocks

2018-06-02 Thread Anson Huang
i.MX6UL has GPIO clock gates in CCM CCGR, add
clock property for GPIO driver to make sure all
GPIO banks work as expected.

Signed-off-by: Anson Huang 
---
no changes since V1.
 arch/arm/boot/dts/imx6ul.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index 1241972..405e068 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -437,6 +437,7 @@
reg = <0x0209c000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO1>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -450,6 +451,7 @@
reg = <0x020a 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO2>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -462,6 +464,7 @@
reg = <0x020a4000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO3>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -474,6 +477,7 @@
reg = <0x020a8000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO4>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
@@ -486,6 +490,7 @@
reg = <0x020ac000 0x4000>;
interrupts = ,
 ;
+   clocks = < IMX6UL_CLK_GPIO5>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
-- 
2.7.4



[PATCH V2 1/2] clk: imx6ul: add GPIO clock gates

2018-06-02 Thread Anson Huang
i.MX6UL has GPIO clock gates in CCM CCGR,
add them into clock tree for clock management.

Signed-off-by: Anson Huang 
---
changes since V1:
Move IMX6UL_CLK_GPIOx definition to end of clock table;
Based on Fabio's patch "[v2] dt-bindings: clock: imx6ul: Do not change 
the clock definition order".
 drivers/clk/imx/clk-imx6ul.c | 5 +
 include/dt-bindings/clock/imx6ul-clock.h | 8 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index ba563ba..3ea2d97 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -360,6 +360,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
+   clks[IMX6UL_CLK_GPIO2]  = imx_clk_gate2("gpio2","ipg",  
base + 0x68,30);
 
/* CCGR1 */
clks[IMX6UL_CLK_ECSPI1] = imx_clk_gate2("ecspi1",   
"ecspi_podf",   base + 0x6c,0);
@@ -376,6 +377,8 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT1_SERIAL]= imx_clk_gate2("gpt1_serial",  
"perclk",   base + 0x6c,22);
clks[IMX6UL_CLK_UART4_IPG]  = imx_clk_gate2("uart4_ipg","ipg",  
base + 0x6c,24);
clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serial", 
"uart_podf",base + 0x6c,24);
+   clks[IMX6UL_CLK_GPIO1]  = imx_clk_gate2("gpio1","ipg",  
base + 0x6c,26);
+   clks[IMX6UL_CLK_GPIO5]  = imx_clk_gate2("gpio5","ipg",  
base + 0x6c,30);
 
/* CCGR2 */
if (clk_on_imx6ull()) {
@@ -389,6 +392,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_I2C3]   = imx_clk_gate2("i2c3", 
"perclk",   base + 0x70,10);
clks[IMX6UL_CLK_OCOTP]  = imx_clk_gate2("ocotp","ipg",  
base + 0x70,12);
clks[IMX6UL_CLK_IOMUXC] = imx_clk_gate2("iomuxc",   
"lcdif_podf",   base + 0x70,14);
+   clks[IMX6UL_CLK_GPIO3]  = imx_clk_gate2("gpio3","ipg",  
base + 0x70,26);
clks[IMX6UL_CLK_LCDIF_APB]  = imx_clk_gate2("lcdif_apb","axi",  
base + 0x70,28);
clks[IMX6UL_CLK_PXP]= imx_clk_gate2("pxp",  "axi",  
base + 0x70,30);
 
@@ -405,6 +409,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_UART6_IPG]  = imx_clk_gate2("uart6_ipg","ipg",  
base + 0x74,6);
clks[IMX6UL_CLK_UART6_SERIAL]   = imx_clk_gate2("uart6_serial", 
"uart_podf",base + 0x74,6);
clks[IMX6UL_CLK_LCDIF_PIX]  = imx_clk_gate2("lcdif_pix",
"lcdif_podf",   base + 0x74,10);
+   clks[IMX6UL_CLK_GPIO4]  = imx_clk_gate2("gpio4","ipg",  
base + 0x74,12);
clks[IMX6UL_CLK_QSPI]   = imx_clk_gate2("qspi1",
"qspi1_podf",   base + 0x74,14);
clks[IMX6UL_CLK_WDOG1]  = imx_clk_gate2("wdog1","ipg",  
base + 0x74,16);
clks[IMX6UL_CLK_MMDC_P0_FAST]   = imx_clk_gate("mmdc_p0_fast", 
"mmdc_podf", base + 0x74,20);
diff --git a/include/dt-bindings/clock/imx6ul-clock.h 
b/include/dt-bindings/clock/imx6ul-clock.h
index 0aa1d9c..f8e0476 100644
--- a/include/dt-bindings/clock/imx6ul-clock.h
+++ b/include/dt-bindings/clock/imx6ul-clock.h
@@ -254,6 +254,12 @@
 #define IMX6UL_CLK_CKO2_PODF   241
 #define IMX6UL_CLK_CKO2242
 #define IMX6UL_CLK_CKO 243
-#define IMX6UL_CLK_END 244
+#define IMX6UL_CLK_GPIO1   244
+#define IMX6UL_CLK_GPIO2   245
+#define IMX6UL_CLK_GPIO3   246
+#define IMX6UL_CLK_GPIO4   247
+#define IMX6UL_CLK_GPIO5   248
+
+#define IMX6UL_CLK_END 249
 
 #endif /* __DT_BINDINGS_CLOCK_IMX6UL_H */
-- 
2.7.4



[PATCH V2 1/2] clk: imx6ul: add GPIO clock gates

2018-06-02 Thread Anson Huang
i.MX6UL has GPIO clock gates in CCM CCGR,
add them into clock tree for clock management.

Signed-off-by: Anson Huang 
---
changes since V1:
Move IMX6UL_CLK_GPIOx definition to end of clock table;
Based on Fabio's patch "[v2] dt-bindings: clock: imx6ul: Do not change 
the clock definition order".
 drivers/clk/imx/clk-imx6ul.c | 5 +
 include/dt-bindings/clock/imx6ul-clock.h | 8 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index ba563ba..3ea2d97 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -360,6 +360,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
+   clks[IMX6UL_CLK_GPIO2]  = imx_clk_gate2("gpio2","ipg",  
base + 0x68,30);
 
/* CCGR1 */
clks[IMX6UL_CLK_ECSPI1] = imx_clk_gate2("ecspi1",   
"ecspi_podf",   base + 0x6c,0);
@@ -376,6 +377,8 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT1_SERIAL]= imx_clk_gate2("gpt1_serial",  
"perclk",   base + 0x6c,22);
clks[IMX6UL_CLK_UART4_IPG]  = imx_clk_gate2("uart4_ipg","ipg",  
base + 0x6c,24);
clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serial", 
"uart_podf",base + 0x6c,24);
+   clks[IMX6UL_CLK_GPIO1]  = imx_clk_gate2("gpio1","ipg",  
base + 0x6c,26);
+   clks[IMX6UL_CLK_GPIO5]  = imx_clk_gate2("gpio5","ipg",  
base + 0x6c,30);
 
/* CCGR2 */
if (clk_on_imx6ull()) {
@@ -389,6 +392,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_I2C3]   = imx_clk_gate2("i2c3", 
"perclk",   base + 0x70,10);
clks[IMX6UL_CLK_OCOTP]  = imx_clk_gate2("ocotp","ipg",  
base + 0x70,12);
clks[IMX6UL_CLK_IOMUXC] = imx_clk_gate2("iomuxc",   
"lcdif_podf",   base + 0x70,14);
+   clks[IMX6UL_CLK_GPIO3]  = imx_clk_gate2("gpio3","ipg",  
base + 0x70,26);
clks[IMX6UL_CLK_LCDIF_APB]  = imx_clk_gate2("lcdif_apb","axi",  
base + 0x70,28);
clks[IMX6UL_CLK_PXP]= imx_clk_gate2("pxp",  "axi",  
base + 0x70,30);
 
@@ -405,6 +409,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_UART6_IPG]  = imx_clk_gate2("uart6_ipg","ipg",  
base + 0x74,6);
clks[IMX6UL_CLK_UART6_SERIAL]   = imx_clk_gate2("uart6_serial", 
"uart_podf",base + 0x74,6);
clks[IMX6UL_CLK_LCDIF_PIX]  = imx_clk_gate2("lcdif_pix",
"lcdif_podf",   base + 0x74,10);
+   clks[IMX6UL_CLK_GPIO4]  = imx_clk_gate2("gpio4","ipg",  
base + 0x74,12);
clks[IMX6UL_CLK_QSPI]   = imx_clk_gate2("qspi1",
"qspi1_podf",   base + 0x74,14);
clks[IMX6UL_CLK_WDOG1]  = imx_clk_gate2("wdog1","ipg",  
base + 0x74,16);
clks[IMX6UL_CLK_MMDC_P0_FAST]   = imx_clk_gate("mmdc_p0_fast", 
"mmdc_podf", base + 0x74,20);
diff --git a/include/dt-bindings/clock/imx6ul-clock.h 
b/include/dt-bindings/clock/imx6ul-clock.h
index 0aa1d9c..f8e0476 100644
--- a/include/dt-bindings/clock/imx6ul-clock.h
+++ b/include/dt-bindings/clock/imx6ul-clock.h
@@ -254,6 +254,12 @@
 #define IMX6UL_CLK_CKO2_PODF   241
 #define IMX6UL_CLK_CKO2242
 #define IMX6UL_CLK_CKO 243
-#define IMX6UL_CLK_END 244
+#define IMX6UL_CLK_GPIO1   244
+#define IMX6UL_CLK_GPIO2   245
+#define IMX6UL_CLK_GPIO3   246
+#define IMX6UL_CLK_GPIO4   247
+#define IMX6UL_CLK_GPIO5   248
+
+#define IMX6UL_CLK_END 249
 
 #endif /* __DT_BINDINGS_CLOCK_IMX6UL_H */
-- 
2.7.4



linux-next: Signed-off-by missing for commits in the pci tree

2018-06-02 Thread Stephen Rothwell
Hi Bjorn,

Commits

  aeddc65a043f ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver DT 
bindings")
  c1efa236b42b ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver")
  18eb4158c840 ("PCI: mobiveil: Add MSI support")

are missing a Signed-off-by from their committer.

-- 
Cheers,
Stephen Rothwell


pgpXk88Nfm2cO.pgp
Description: OpenPGP digital signature


linux-next: Signed-off-by missing for commits in the pci tree

2018-06-02 Thread Stephen Rothwell
Hi Bjorn,

Commits

  aeddc65a043f ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver DT 
bindings")
  c1efa236b42b ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver")
  18eb4158c840 ("PCI: mobiveil: Add MSI support")

are missing a Signed-off-by from their committer.

-- 
Cheers,
Stephen Rothwell


pgpXk88Nfm2cO.pgp
Description: OpenPGP digital signature


Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

2018-06-02 Thread Rik van Riel
On Sun, 2018-06-03 at 00:51 +, Song Liu wrote:

> > Just to check: in the workload where you're seeing this problem,
> > are
> > you using an mm with many threads?  I would imagine that, if you
> > only
> > have one or two threads, the bit operations aren't so bad.
> 
> Yes, we are running netperf/netserver with 300 threads. We don't see
> this much overhead in with real workload. 

We may not, but there are some crazy workloads out
there in the world. Think of some Java programs with
thousands of threads, causing a million context
switches a second on a large system.

I like Andy's idea of having one cache line with
a cpumask per node. That seems like it will have
fewer downsides for tasks with fewer threads running
on giant systems.

I'll throw out the code I was working on, and look
into implementing that :)

-- 
All Rights Reversed.

signature.asc
Description: This is a digitally signed message part


Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

2018-06-02 Thread Rik van Riel
On Sun, 2018-06-03 at 00:51 +, Song Liu wrote:

> > Just to check: in the workload where you're seeing this problem,
> > are
> > you using an mm with many threads?  I would imagine that, if you
> > only
> > have one or two threads, the bit operations aren't so bad.
> 
> Yes, we are running netperf/netserver with 300 threads. We don't see
> this much overhead in with real workload. 

We may not, but there are some crazy workloads out
there in the world. Think of some Java programs with
thousands of threads, causing a million context
switches a second on a large system.

I like Andy's idea of having one cache line with
a cpumask per node. That seems like it will have
fewer downsides for tasks with fewer threads running
on giant systems.

I'll throw out the code I was working on, and look
into implementing that :)

-- 
All Rights Reversed.

signature.asc
Description: This is a digitally signed message part


RE: [PATCH 1/2] clk: imx6ul: add GPIO clock gates

2018-06-02 Thread Anson Huang
Hi, Stephen

Anson Huang
Best Regards!


> -Original Message-
> From: Stephen Boyd [mailto:sb...@kernel.org]
> Sent: Saturday, June 2, 2018 2:19 PM
> To: Anson Huang ; Stefan Wahren
> ; Fabio Estevam ;
> ker...@pengutronix.de; mark.rutl...@arm.com; matteo.l...@engicam.com;
> mich...@amarulasolutions.com; mturque...@baylibre.com;
> robh...@kernel.org; shawn...@kernel.org
> Cc: linux-...@vger.kernel.org; dl-linux-imx ;
> devicet...@vger.kernel.org; linux-kernel@vger.kernel.org;
> linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH 1/2] clk: imx6ul: add GPIO clock gates
> 
> Quoting Stefan Wahren (2018-05-22 05:25:35)
> > > +++ b/include/dt-bindings/clock/imx6ul-clock.h
> > > @@ -242,20 +242,25 @@
> > >  #define IMX6UL_CLK_CKO2_PODF 229
> > >  #define IMX6UL_CLK_CKO2  230
> > >  #define IMX6UL_CLK_CKO   231
> > > +#define IMX6UL_CLK_GPIO1 232
> > > +#define IMX6UL_CLK_GPIO2 233
> > > +#define IMX6UL_CLK_GPIO3 234
> > > +#define IMX6UL_CLK_GPIO4 235
> > > +#define IMX6UL_CLK_GPIO5 236
> >
> > this change looks like a breakage of devicetree ABI. You are changing the
> mean of the existing clock IDs on i.MX6ULL, which probably regress the
> combination of older DTBs with newer kernel.
> >
> 
> Agreed. Why can't we just tack on more numbers at the end?
 
Ah, yes, I saw 6ULL are at the end of 6UL, so added them in 6UL, but did NOT 
consider the old dtb support.

Will send out a V2 patch to fix it, and I saw Fabio also sent a patch to fix 
the clko1/2 definition, I will do the
V2 patch based on his patch.

Anson.

> 
> > >
> > >  /* For i.MX6ULL */
> > > -#define IMX6ULL_CLK_ESAI_PRED232


RE: [PATCH 1/2] clk: imx6ul: add GPIO clock gates

2018-06-02 Thread Anson Huang
Hi, Stephen

Anson Huang
Best Regards!


> -Original Message-
> From: Stephen Boyd [mailto:sb...@kernel.org]
> Sent: Saturday, June 2, 2018 2:19 PM
> To: Anson Huang ; Stefan Wahren
> ; Fabio Estevam ;
> ker...@pengutronix.de; mark.rutl...@arm.com; matteo.l...@engicam.com;
> mich...@amarulasolutions.com; mturque...@baylibre.com;
> robh...@kernel.org; shawn...@kernel.org
> Cc: linux-...@vger.kernel.org; dl-linux-imx ;
> devicet...@vger.kernel.org; linux-kernel@vger.kernel.org;
> linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH 1/2] clk: imx6ul: add GPIO clock gates
> 
> Quoting Stefan Wahren (2018-05-22 05:25:35)
> > > +++ b/include/dt-bindings/clock/imx6ul-clock.h
> > > @@ -242,20 +242,25 @@
> > >  #define IMX6UL_CLK_CKO2_PODF 229
> > >  #define IMX6UL_CLK_CKO2  230
> > >  #define IMX6UL_CLK_CKO   231
> > > +#define IMX6UL_CLK_GPIO1 232
> > > +#define IMX6UL_CLK_GPIO2 233
> > > +#define IMX6UL_CLK_GPIO3 234
> > > +#define IMX6UL_CLK_GPIO4 235
> > > +#define IMX6UL_CLK_GPIO5 236
> >
> > this change looks like a breakage of devicetree ABI. You are changing the
> mean of the existing clock IDs on i.MX6ULL, which probably regress the
> combination of older DTBs with newer kernel.
> >
> 
> Agreed. Why can't we just tack on more numbers at the end?
 
Ah, yes, I saw 6ULL are at the end of 6UL, so added them in 6UL, but did NOT 
consider the old dtb support.

Will send out a V2 patch to fix it, and I saw Fabio also sent a patch to fix 
the clko1/2 definition, I will do the
V2 patch based on his patch.

Anson.

> 
> > >
> > >  /* For i.MX6ULL */
> > > -#define IMX6ULL_CLK_ESAI_PRED232


[PATCH][RFC] open_tree(2) (was Re: [PATCH 30/32] vfs: Allow cloning of a mount tree with open(O_PATH|O_CLONE_MOUNT) [ver #8])

2018-06-02 Thread Al Viro
On Sat, Jun 02, 2018 at 06:49:58PM +0100, Al Viro wrote:

> > > Hell, might even add AT_UMOUNT for "open root and detach, to be dissolved 
> > > on
> > > close", incompatible with AT_CLONE.
> > 
> > Cute.  Guess you could do:
> > 
> > fd = open_mount(..., OPEN_TREE_DETACH);
> > mount_setattr(fd, "",
> >   MOUNT_SETATTR_EMPTY_PATH,
> >   MOUNT_SETATTR_NOSUID, NULL);
> > move_mount(fd, "", ...);

Hadn't added that yet, but as for the rest of open_tree() - see
vfs.git#mount-open_tree.  open() and its flags are not touched at all.
Other changes compared to the previous:
* may_mount() is required for OPEN_TREE_CLONE
* sys_ni.c cruft is dropped - those make no sense until and unless
those syscalls become conditional.

Appears to work, combined with move_mount() it yields eqiuvalents of
mount --{move,bind,rbind}.  Combined with mount_setattr(2) (when that
gets added) we'll get mount -o remount,bind,nodev et.al.
(including the currently absent whole-subtree versions) and
mount --make-{r,}{shared,slave,private,unbindable}

It also can be used to get an isolated subtree usable for at()
stuff.

The addition of syscall itself is done by the following and I'd really
like linux-abi folks to comment on that puppy

commit 6cfba4dd99b10278c2156c8d4fced2eddedf167f
Author: Al Viro 
Date:   Sat Jun 2 19:42:22 2018 -0400

new syscall: open_tree(2)

open_tree(dfd, pathname, flags)

Returns an O_PATH-opened file descriptor or an error.
dfd and pathname specify the location to open, in usual
fashion (see e.g. fstatat(2)).  flags should be an OR of
some of the following:
* AT_PATH_EMPTY, AT_NO_AUTOMOUNT, AT_SYMLINK_NOFOLLOW -
same meanings as usual
* OPEN_TREE_CLOEXEC - make the resulting descriptor
close-on-exec
* OPEN_TREE_CLONE or OPEN_TREE_CLONE | AT_RECURSIVE -
instead of opening the location in question, create a detached
mount tree matching the subtree rooted at location specified by
dfd/pathname.  With AT_RECURSIVE the entire subtree is cloned,
without it - only the part within in the mount containing the
location in question.  In other words, the same as mount --rbind
or mount --bind would've taken.  The detached tree will be
dissolved on the final close of obtained file.  Creation of such
detached trees requires the same capabilities as doing mount --bind.

Signed-off-by: Al Viro 

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl 
b/arch/x86/entry/syscalls/syscall_32.tbl
index 14a2f996e543..b2b44ecd2b17 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -397,3 +397,4 @@
 383i386statx   sys_statx   
__ia32_sys_statx
 384i386arch_prctl  sys_arch_prctl  
__ia32_compat_sys_arch_prctl
 385i386io_pgetevents   sys_io_pgetevents   
__ia32_compat_sys_io_pgetevents
+391i386open_tree   sys_open_tree   
__ia32_sys_open_tree
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl 
b/arch/x86/entry/syscalls/syscall_64.tbl
index cd36232ab62f..d6f4949378e7 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -342,6 +342,7 @@
 331common  pkey_free   __x64_sys_pkey_free
 332common  statx   __x64_sys_statx
 333common  io_pgetevents   __x64_sys_io_pgetevents
+339common  open_tree   __x64_sys_open_tree
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/fs/file_table.c b/fs/file_table.c
index 7ec0b3e5f05d..7480271a0d21 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -189,6 +189,7 @@ static void __fput(struct file *file)
struct dentry *dentry = file->f_path.dentry;
struct vfsmount *mnt = file->f_path.mnt;
struct inode *inode = file->f_inode;
+   fmode_t mode = file->f_mode;
 
might_sleep();
 
@@ -209,14 +210,14 @@ static void __fput(struct file *file)
file->f_op->release(inode, file);
security_file_free(file);
if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
-!(file->f_mode & FMODE_PATH))) {
+!(mode & FMODE_PATH))) {
cdev_put(inode->i_cdev);
}
fops_put(file->f_op);
put_pid(file->f_owner.pid);
-   if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
+   if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
i_readcount_dec(inode);
-   if (file->f_mode & FMODE_WRITER) {
+   if (mode & FMODE_WRITER) {
put_write_access(inode);
__mnt_drop_write(mnt);
}
@@ -224,6 +225,8 @@ static void __fput(struct file *file)
file->f_path.mnt = NULL;
file->f_inode = NULL;

[PATCH][RFC] open_tree(2) (was Re: [PATCH 30/32] vfs: Allow cloning of a mount tree with open(O_PATH|O_CLONE_MOUNT) [ver #8])

2018-06-02 Thread Al Viro
On Sat, Jun 02, 2018 at 06:49:58PM +0100, Al Viro wrote:

> > > Hell, might even add AT_UMOUNT for "open root and detach, to be dissolved 
> > > on
> > > close", incompatible with AT_CLONE.
> > 
> > Cute.  Guess you could do:
> > 
> > fd = open_mount(..., OPEN_TREE_DETACH);
> > mount_setattr(fd, "",
> >   MOUNT_SETATTR_EMPTY_PATH,
> >   MOUNT_SETATTR_NOSUID, NULL);
> > move_mount(fd, "", ...);

Hadn't added that yet, but as for the rest of open_tree() - see
vfs.git#mount-open_tree.  open() and its flags are not touched at all.
Other changes compared to the previous:
* may_mount() is required for OPEN_TREE_CLONE
* sys_ni.c cruft is dropped - those make no sense until and unless
those syscalls become conditional.

Appears to work, combined with move_mount() it yields eqiuvalents of
mount --{move,bind,rbind}.  Combined with mount_setattr(2) (when that
gets added) we'll get mount -o remount,bind,nodev et.al.
(including the currently absent whole-subtree versions) and
mount --make-{r,}{shared,slave,private,unbindable}

It also can be used to get an isolated subtree usable for at()
stuff.

The addition of syscall itself is done by the following and I'd really
like linux-abi folks to comment on that puppy

commit 6cfba4dd99b10278c2156c8d4fced2eddedf167f
Author: Al Viro 
Date:   Sat Jun 2 19:42:22 2018 -0400

new syscall: open_tree(2)

open_tree(dfd, pathname, flags)

Returns an O_PATH-opened file descriptor or an error.
dfd and pathname specify the location to open, in usual
fashion (see e.g. fstatat(2)).  flags should be an OR of
some of the following:
* AT_PATH_EMPTY, AT_NO_AUTOMOUNT, AT_SYMLINK_NOFOLLOW -
same meanings as usual
* OPEN_TREE_CLOEXEC - make the resulting descriptor
close-on-exec
* OPEN_TREE_CLONE or OPEN_TREE_CLONE | AT_RECURSIVE -
instead of opening the location in question, create a detached
mount tree matching the subtree rooted at location specified by
dfd/pathname.  With AT_RECURSIVE the entire subtree is cloned,
without it - only the part within in the mount containing the
location in question.  In other words, the same as mount --rbind
or mount --bind would've taken.  The detached tree will be
dissolved on the final close of obtained file.  Creation of such
detached trees requires the same capabilities as doing mount --bind.

Signed-off-by: Al Viro 

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl 
b/arch/x86/entry/syscalls/syscall_32.tbl
index 14a2f996e543..b2b44ecd2b17 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -397,3 +397,4 @@
 383i386statx   sys_statx   
__ia32_sys_statx
 384i386arch_prctl  sys_arch_prctl  
__ia32_compat_sys_arch_prctl
 385i386io_pgetevents   sys_io_pgetevents   
__ia32_compat_sys_io_pgetevents
+391i386open_tree   sys_open_tree   
__ia32_sys_open_tree
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl 
b/arch/x86/entry/syscalls/syscall_64.tbl
index cd36232ab62f..d6f4949378e7 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -342,6 +342,7 @@
 331common  pkey_free   __x64_sys_pkey_free
 332common  statx   __x64_sys_statx
 333common  io_pgetevents   __x64_sys_io_pgetevents
+339common  open_tree   __x64_sys_open_tree
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/fs/file_table.c b/fs/file_table.c
index 7ec0b3e5f05d..7480271a0d21 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -189,6 +189,7 @@ static void __fput(struct file *file)
struct dentry *dentry = file->f_path.dentry;
struct vfsmount *mnt = file->f_path.mnt;
struct inode *inode = file->f_inode;
+   fmode_t mode = file->f_mode;
 
might_sleep();
 
@@ -209,14 +210,14 @@ static void __fput(struct file *file)
file->f_op->release(inode, file);
security_file_free(file);
if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
-!(file->f_mode & FMODE_PATH))) {
+!(mode & FMODE_PATH))) {
cdev_put(inode->i_cdev);
}
fops_put(file->f_op);
put_pid(file->f_owner.pid);
-   if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
+   if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
i_readcount_dec(inode);
-   if (file->f_mode & FMODE_WRITER) {
+   if (mode & FMODE_WRITER) {
put_write_access(inode);
__mnt_drop_write(mnt);
}
@@ -224,6 +225,8 @@ static void __fput(struct file *file)
file->f_path.mnt = NULL;
file->f_inode = NULL;

Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

2018-06-02 Thread Song Liu



> On Jun 2, 2018, at 1:14 PM, Andy Lutomirski  wrote:
> 
> On Fri, Jun 1, 2018 at 10:04 PM Rik van Riel  wrote:
>> 
>> On Fri, 2018-06-01 at 20:35 -0700, Andy Lutomirski wrote:
>>> On Fri, Jun 1, 2018 at 3:13 PM Rik van Riel  wrote:
 
 On Fri, 1 Jun 2018 14:21:58 -0700
 Andy Lutomirski  wrote:
 
> Hmm.  I wonder if there's a more clever data structure than a
> bitmap
> that we could be using here.  Each CPU only ever needs to be in
> one
> mm's cpumask, and each cpu only ever changes its own state in the
> bitmask.  And writes are much less common than reads for most
> workloads.
 
 It would be easy enough to add an mm_struct pointer to the
 per-cpu tlbstate struct, and iterate over those.
 
 However, that would be an orthogonal change to optimizing
 lazy TLB mode.
 
 Does the (untested) patch below make sense as a potential
 improvement to the lazy TLB heuristic?
 
 ---8<---
 Subject: x86,tlb: workload dependent per CPU lazy TLB switch
 
 Lazy TLB mode is a tradeoff between flushing the TLB and touching
 the mm_cpumask(_mm) at context switch time, versus potentially
 incurring a remote TLB flush IPI while in lazy TLB mode.
 
 Whether this pays off is likely to be workload dependent more than
 anything else. However, the current heuristic keys off hardware
 type.
 
 This patch changes the lazy TLB mode heuristic to a dynamic, per-
 CPU
 decision, dependent on whether we recently received a remote TLB
 shootdown while in lazy TLB mode.
 
 This is a very simple heuristic. When a CPU receives a remote TLB
 shootdown IPI while in lazy TLB mode, a counter in the same cache
 line is set to 16. Every time we skip lazy TLB mode, the counter
 is decremented.
 
 While the counter is zero (no recent TLB flush IPIs), allow lazy
 TLB mode.
>>> 
>>> Hmm, cute.  That's not a bad idea at all.  It would be nice to get
>>> some kind of real benchmark on both PCID and !PCID.  If nothing else,
>>> I would expect the threshold (16 in your patch) to want to be lower
>>> on
>>> PCID systems.
>> 
>> That depends on how well we manage to get rid of
>> the cpumask manipulation overhead. On the PCID
>> system we first found this issue, the atomic
>> accesses to the mm_cpumask took about 4x as much
>> CPU time as the TLB invalidation itself.
>> 
>> That kinda limits how much the cost of cheaper
>> TLB flushes actually help :)
>> 
>> I agree this code should get some testing.
>> 
> 
> Just to check: in the workload where you're seeing this problem, are
> you using an mm with many threads?  I would imagine that, if you only
> have one or two threads, the bit operations aren't so bad.

Yes, we are running netperf/netserver with 300 threads. We don't see
this much overhead in with real workload. 

Here are some test results. The tests are on 2-socket system with E5-2678 v3, 
so 48 logical cores with PCID. I tested 3 kernel (and tunes 
flushed_while_lazy):

Baseline: 0512e01345 in upstream
Baseline + lazy-tlb: 0512e01345 + "x86,tlb: workload dependent per CPU lazy TLB 
switch"   
Baseline + both patches: 0512e01345 + "x86,tlb: workload dependent per CPU lazy 
TLB switch" + "x86,switch_mm: skip atomic operations for init_mm"

The tests are wrong with the following options: 

./super_netperf 300 -P 0 -t TCP_RR -p  -H  -l 60 -- -r 100,100 
-o -s 1M,1M -S 1M,1M

There are the results:
   flushed_while_lazyThroughput 
%-cpu-on-switch_mm_irqs_off() 

Baseline  N/A 2.02756e+06 2.82%
(1.54% in ctx of netserver + 1.28% in ctx of swapper)
Baseline + lazy-tlb16 1.92706e+06 1.19%
(only in ctx of swapper, same for all cases below)
Baseline + lazy-tlb4  2.03863e+06 1.12%Good 
option 1
Baseline + lazy-tlb2  1.93847e+06 1.22%
Baseline + both patches64 1.92219e+06 1.09%
Baseline + both patches16 1.93597e+06 1.15%
Baseline + both patches8  1.92175e+06 1.11%
Baseline + both patches4  2.03465e+06 1.09%Good 
option 2
Baseline + both patches2  2.03603e+06 1.10%Good 
option 3
Baseline + both patches1  1.9241e+06  1.06%

I highlighted 3 good options above. They are about the same for this 
test case. 

Thanks,
Song




Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

2018-06-02 Thread Song Liu



> On Jun 2, 2018, at 1:14 PM, Andy Lutomirski  wrote:
> 
> On Fri, Jun 1, 2018 at 10:04 PM Rik van Riel  wrote:
>> 
>> On Fri, 2018-06-01 at 20:35 -0700, Andy Lutomirski wrote:
>>> On Fri, Jun 1, 2018 at 3:13 PM Rik van Riel  wrote:
 
 On Fri, 1 Jun 2018 14:21:58 -0700
 Andy Lutomirski  wrote:
 
> Hmm.  I wonder if there's a more clever data structure than a
> bitmap
> that we could be using here.  Each CPU only ever needs to be in
> one
> mm's cpumask, and each cpu only ever changes its own state in the
> bitmask.  And writes are much less common than reads for most
> workloads.
 
 It would be easy enough to add an mm_struct pointer to the
 per-cpu tlbstate struct, and iterate over those.
 
 However, that would be an orthogonal change to optimizing
 lazy TLB mode.
 
 Does the (untested) patch below make sense as a potential
 improvement to the lazy TLB heuristic?
 
 ---8<---
 Subject: x86,tlb: workload dependent per CPU lazy TLB switch
 
 Lazy TLB mode is a tradeoff between flushing the TLB and touching
 the mm_cpumask(_mm) at context switch time, versus potentially
 incurring a remote TLB flush IPI while in lazy TLB mode.
 
 Whether this pays off is likely to be workload dependent more than
 anything else. However, the current heuristic keys off hardware
 type.
 
 This patch changes the lazy TLB mode heuristic to a dynamic, per-
 CPU
 decision, dependent on whether we recently received a remote TLB
 shootdown while in lazy TLB mode.
 
 This is a very simple heuristic. When a CPU receives a remote TLB
 shootdown IPI while in lazy TLB mode, a counter in the same cache
 line is set to 16. Every time we skip lazy TLB mode, the counter
 is decremented.
 
 While the counter is zero (no recent TLB flush IPIs), allow lazy
 TLB mode.
>>> 
>>> Hmm, cute.  That's not a bad idea at all.  It would be nice to get
>>> some kind of real benchmark on both PCID and !PCID.  If nothing else,
>>> I would expect the threshold (16 in your patch) to want to be lower
>>> on
>>> PCID systems.
>> 
>> That depends on how well we manage to get rid of
>> the cpumask manipulation overhead. On the PCID
>> system we first found this issue, the atomic
>> accesses to the mm_cpumask took about 4x as much
>> CPU time as the TLB invalidation itself.
>> 
>> That kinda limits how much the cost of cheaper
>> TLB flushes actually help :)
>> 
>> I agree this code should get some testing.
>> 
> 
> Just to check: in the workload where you're seeing this problem, are
> you using an mm with many threads?  I would imagine that, if you only
> have one or two threads, the bit operations aren't so bad.

Yes, we are running netperf/netserver with 300 threads. We don't see
this much overhead in with real workload. 

Here are some test results. The tests are on 2-socket system with E5-2678 v3, 
so 48 logical cores with PCID. I tested 3 kernel (and tunes 
flushed_while_lazy):

Baseline: 0512e01345 in upstream
Baseline + lazy-tlb: 0512e01345 + "x86,tlb: workload dependent per CPU lazy TLB 
switch"   
Baseline + both patches: 0512e01345 + "x86,tlb: workload dependent per CPU lazy 
TLB switch" + "x86,switch_mm: skip atomic operations for init_mm"

The tests are wrong with the following options: 

./super_netperf 300 -P 0 -t TCP_RR -p  -H  -l 60 -- -r 100,100 
-o -s 1M,1M -S 1M,1M

There are the results:
   flushed_while_lazyThroughput 
%-cpu-on-switch_mm_irqs_off() 

Baseline  N/A 2.02756e+06 2.82%
(1.54% in ctx of netserver + 1.28% in ctx of swapper)
Baseline + lazy-tlb16 1.92706e+06 1.19%
(only in ctx of swapper, same for all cases below)
Baseline + lazy-tlb4  2.03863e+06 1.12%Good 
option 1
Baseline + lazy-tlb2  1.93847e+06 1.22%
Baseline + both patches64 1.92219e+06 1.09%
Baseline + both patches16 1.93597e+06 1.15%
Baseline + both patches8  1.92175e+06 1.11%
Baseline + both patches4  2.03465e+06 1.09%Good 
option 2
Baseline + both patches2  2.03603e+06 1.10%Good 
option 3
Baseline + both patches1  1.9241e+06  1.06%

I highlighted 3 good options above. They are about the same for this 
test case. 

Thanks,
Song




re1

2018-06-02 Thread Ms. Ella Golan
I am Ms.Ella Golan, I am the Executive Vice President Banking Division with 
FIRST INTERNATIONAL BANK OF ISRAEL LTD (FIBI). I am getting in touch with you 
regarding an extremely important and urgent matter. If you would oblige me the 
opportunity, I shall provide you with details upon your response.

Faithfully,
Ms.Ella Golan


re1

2018-06-02 Thread Ms. Ella Golan
I am Ms.Ella Golan, I am the Executive Vice President Banking Division with 
FIRST INTERNATIONAL BANK OF ISRAEL LTD (FIBI). I am getting in touch with you 
regarding an extremely important and urgent matter. If you would oblige me the 
opportunity, I shall provide you with details upon your response.

Faithfully,
Ms.Ella Golan


Re: [PATCH v8] ASoC: pxa: switch to new ac97 bus support

2018-06-02 Thread Robert Jarzmik
Robert Jarzmik  writes:

> Switch to the new ac97 bus support in sound/ac97 instead of the legacy
> snd_ac97 one.
> + codecs_pdata = pdata ? pdata->codecs_pdata : NULL;

It's a shame my automated build and test system didn't catch that : it should
have been pdata->codec_pdata and not pdata->codecs_pdata.

Given that this slipped in, please don't apply this until I find out why my
builder lives in utopia.

Cheers.

--
Robert


Re: [PATCH v8] ASoC: pxa: switch to new ac97 bus support

2018-06-02 Thread Robert Jarzmik
Robert Jarzmik  writes:

> Switch to the new ac97 bus support in sound/ac97 instead of the legacy
> snd_ac97 one.
> + codecs_pdata = pdata ? pdata->codecs_pdata : NULL;

It's a shame my automated build and test system didn't catch that : it should
have been pdata->codec_pdata and not pdata->codecs_pdata.

Given that this slipped in, please don't apply this until I find out why my
builder lives in utopia.

Cheers.

--
Robert


[PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe()

2018-06-02 Thread Alexey Khoroshilov
zx_reboot_probe() increments refcnt of zx296702-pcu device node by
of_find_compatible_node() and leaves it undecremented on both
successful and error paths.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov 
---
 drivers/power/reset/zx-reboot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/zx-reboot.c b/drivers/power/reset/zx-reboot.c
index c03e96e6a041..186901c96c01 100644
--- a/drivers/power/reset/zx-reboot.c
+++ b/drivers/power/reset/zx-reboot.c
@@ -51,6 +51,7 @@ static int zx_reboot_probe(struct platform_device *pdev)
 
np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu");
pcu_base = of_iomap(np, 0);
+   of_node_put(np);
if (!pcu_base) {
iounmap(base);
WARN(1, "failed to map pcu_base address");
-- 
2.7.4



[PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe()

2018-06-02 Thread Alexey Khoroshilov
zx_reboot_probe() increments refcnt of zx296702-pcu device node by
of_find_compatible_node() and leaves it undecremented on both
successful and error paths.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov 
---
 drivers/power/reset/zx-reboot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/zx-reboot.c b/drivers/power/reset/zx-reboot.c
index c03e96e6a041..186901c96c01 100644
--- a/drivers/power/reset/zx-reboot.c
+++ b/drivers/power/reset/zx-reboot.c
@@ -51,6 +51,7 @@ static int zx_reboot_probe(struct platform_device *pdev)
 
np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu");
pcu_base = of_iomap(np, 0);
+   of_node_put(np);
if (!pcu_base) {
iounmap(base);
WARN(1, "failed to map pcu_base address");
-- 
2.7.4



Re: [PATCH] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread Randy Dunlap
On 06/02/2018 01:11 PM, tom...@gmail.com wrote:
> From: tomKPZ 
> 
> Documentation/binfmt_misc.txt was moved to
> Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
> updates a reference to the file.

Please see Documentation/process/submitting-patches.rst, about Signed-off-by:

then you just add a line saying::

Signed-off-by: Random J Developer 

using your real name (sorry, no pseudonyms or anonymous contributions.)



> ---
>  fs/binfmt_misc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> index a41b48f82a70..5ad89b838c79 100644
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -4,7 +4,8 @@
>   * Copyright (C) 1997 Richard Günther
>   *
>   * binfmt_misc detects binaries via a magic or filename extension and invokes
> - * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
> + * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for 
> more
> + * details.
>   */
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 

thanks,
-- 
~Randy


Re: [PATCH] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread Randy Dunlap
On 06/02/2018 01:11 PM, tom...@gmail.com wrote:
> From: tomKPZ 
> 
> Documentation/binfmt_misc.txt was moved to
> Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
> updates a reference to the file.

Please see Documentation/process/submitting-patches.rst, about Signed-off-by:

then you just add a line saying::

Signed-off-by: Random J Developer 

using your real name (sorry, no pseudonyms or anonymous contributions.)



> ---
>  fs/binfmt_misc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> index a41b48f82a70..5ad89b838c79 100644
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -4,7 +4,8 @@
>   * Copyright (C) 1997 Richard Günther
>   *
>   * binfmt_misc detects binaries via a magic or filename extension and invokes
> - * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
> + * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for 
> more
> + * details.
>   */
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 

thanks,
-- 
~Randy


Re: [PATCH v2] mm: Change return type int to vm_fault_t for fault handlers

2018-06-02 Thread Matthew Wilcox
On Sun, Jun 03, 2018 at 01:34:07AM +0530, Souptick Joarder wrote:
> @@ -3570,9 +3571,8 @@ static int hugetlb_cow(struct mm_struct *mm, struct 
> vm_area_struct *vma,
>   return 0;
>   }
>  
> - ret = (PTR_ERR(new_page) == -ENOMEM) ?
> - VM_FAULT_OOM : VM_FAULT_SIGBUS;
> - goto out_release_old;
> + ret = vmf_error(PTR_ERR(new_page));
> + goto out_release_old;
>   }
>  
>   /*

Something weird happened to the goto here?

> +static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
> + struct vm_area_struct *vma,
> + struct address_space *mapping, pgoff_t idx,
> + unsigned long address, pte_t *ptep, unsigned int flags)
>  {
>   struct hstate *h = hstate_vma(vma);
> - int ret = VM_FAULT_SIGBUS;
> - int anon_rmap = 0;
> + vm_fault_t ret = VM_FAULT_SIGBUS;
> + int anon_rmap = 0, err;
>   unsigned long size;
>   struct page *page;
>   pte_t new_pte;
> @@ -3742,11 +3743,8 @@ static int hugetlb_no_page(struct mm_struct *mm, 
> struct vm_area_struct *vma,
>  
>   page = alloc_huge_page(vma, address, 0);
>   if (IS_ERR(page)) {
> - ret = PTR_ERR(page);
> - if (ret == -ENOMEM)
> - ret = VM_FAULT_OOM;
> - else
> - ret = VM_FAULT_SIGBUS;
> + err = PTR_ERR(page);
> + ret = vmf_error(err);
>   goto out;
>   }
>   clear_huge_page(page, address, pages_per_huge_page(h));

Not sure why you bother with the 'int err' in this function when just
above you were happy to do

ret = vmf_error(PTR_ERR(page));

With those fixed,

Reviewed-by: Matthew Wilcox 


Re: [PATCH v2] mm: Change return type int to vm_fault_t for fault handlers

2018-06-02 Thread Matthew Wilcox
On Sun, Jun 03, 2018 at 01:34:07AM +0530, Souptick Joarder wrote:
> @@ -3570,9 +3571,8 @@ static int hugetlb_cow(struct mm_struct *mm, struct 
> vm_area_struct *vma,
>   return 0;
>   }
>  
> - ret = (PTR_ERR(new_page) == -ENOMEM) ?
> - VM_FAULT_OOM : VM_FAULT_SIGBUS;
> - goto out_release_old;
> + ret = vmf_error(PTR_ERR(new_page));
> + goto out_release_old;
>   }
>  
>   /*

Something weird happened to the goto here?

> +static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
> + struct vm_area_struct *vma,
> + struct address_space *mapping, pgoff_t idx,
> + unsigned long address, pte_t *ptep, unsigned int flags)
>  {
>   struct hstate *h = hstate_vma(vma);
> - int ret = VM_FAULT_SIGBUS;
> - int anon_rmap = 0;
> + vm_fault_t ret = VM_FAULT_SIGBUS;
> + int anon_rmap = 0, err;
>   unsigned long size;
>   struct page *page;
>   pte_t new_pte;
> @@ -3742,11 +3743,8 @@ static int hugetlb_no_page(struct mm_struct *mm, 
> struct vm_area_struct *vma,
>  
>   page = alloc_huge_page(vma, address, 0);
>   if (IS_ERR(page)) {
> - ret = PTR_ERR(page);
> - if (ret == -ENOMEM)
> - ret = VM_FAULT_OOM;
> - else
> - ret = VM_FAULT_SIGBUS;
> + err = PTR_ERR(page);
> + ret = vmf_error(err);
>   goto out;
>   }
>   clear_huge_page(page, address, pages_per_huge_page(h));

Not sure why you bother with the 'int err' in this function when just
above you were happy to do

ret = vmf_error(PTR_ERR(page));

With those fixed,

Reviewed-by: Matthew Wilcox 


Re: [v2,3/3] i2c: at91: added slave mode support

2018-06-02 Thread Wolfram Sang
On Thu, Nov 09, 2017 at 06:22:29PM +0100, Juergen Fitschen wrote:
> Slave mode driver is based on the concept of i2c-designware driver.
> 
> Signed-off-by: Juergen Fitschen 

I lost the original mail where Ludovic said:

"I tested it quickly on a sama5d2 xplained board: I used an i2c-gpio
master and the eeprom driver. It works pretty well. I tried to increase
the size of the eeprom by adding:
+ { "slave-24c64", 65536 / 8 },"

That won't work. The comment at the beginning of the file says:

 * ... It is prepared to simulate bigger EEPROMs with an internal 16 bit
 * pointer, yet implementation is deferred until the need actually arises.

So,  no EEPROMs > 256 byte for now.

BTW maybe I asked already and forgot: is this IP core capable of being
master and slave on the same bus?



signature.asc
Description: PGP signature


Re: [v2,3/3] i2c: at91: added slave mode support

2018-06-02 Thread Wolfram Sang
On Thu, Nov 09, 2017 at 06:22:29PM +0100, Juergen Fitschen wrote:
> Slave mode driver is based on the concept of i2c-designware driver.
> 
> Signed-off-by: Juergen Fitschen 

I lost the original mail where Ludovic said:

"I tested it quickly on a sama5d2 xplained board: I used an i2c-gpio
master and the eeprom driver. It works pretty well. I tried to increase
the size of the eeprom by adding:
+ { "slave-24c64", 65536 / 8 },"

That won't work. The comment at the beginning of the file says:

 * ... It is prepared to simulate bigger EEPROMs with an internal 16 bit
 * pointer, yet implementation is deferred until the need actually arises.

So,  no EEPROMs > 256 byte for now.

BTW maybe I asked already and forgot: is this IP core capable of being
master and slave on the same bus?



signature.asc
Description: PGP signature


[GIT PULL] Thermal SoC management updates for v4.18-rc1 #1

2018-06-02 Thread Eduardo Valentin
Hello Rui,

Please pull the changes for thermal-soc for coming v4.18-rc1.
Changelog:
- imx thermal driver now supports i.MX7 thermal sensor
- exynos thermal driver dropped support for exynos 5440
- rcar_thermal now supports r8a77995
- rcar_gen3_thermal now supports r8a77965
- qcom-spmi-temp-alarm now supports GEN2 PMIC peripherals
- uniphier thermal now supports UniPhier PXs3
- mediatek thermal now supports MT7622 SoC
- considerable refactoring of exynos driver
- Fixes all over the place on different drivers.

Additional KernelCI Testing:
Full Boot Summary: 
https://kernelci.org/boot/all/job/evalenti/branch/for-kernelci/kernel/v4.17-rc3-359-g6d7c70d1cd65/
Full Build Summary: 
https://kernelci.org/build/evalenti/branch/for-kernelci/kernel/v4.17-rc3-359-g6d7c70d1cd65/

BR,

Eduardo

The following changes since commit 701e39d05119229b92ecca4add7b7ed2193622c3:

  Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm 
(2018-05-06 05:46:29 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal linus

for you to fetch changes up to 6d7c70d1cd6526dc79e3d3b3faae1c40c1681168:

  thermal: qcom: tsens: Allow number of sensors to come from DT (2018-06-01 
15:09:15 -0700)


Anson Huang (1):
  thermal: imx: add i.MX7 thermal sensor support

Bartlomiej Zolnierkiewicz (28):
  thermal: exynos: remove unused "type" field from struct 
exynos_tmu_platform_data
  thermal: exynos: remove parsing of samsung, tmu_default_temp_offset 
property
  thermal: exynos: remove parsing of samsung, tmu_[first, 
second]_point_trim properties
  thermal: exynos: remove parsing of samsung, tmu_noise_cancel_mode property
  thermal: exynos: remove parsing of samsung, tmu[_min, _max]_efuse_value 
properties
  thermal: exynos: remove parsing of samsung, tmu_reference_voltage property
  thermal: exynos: remove parsing of samsung,tmu_gain property
  thermal: exynos: remove parsing of samsung, tmu_cal_type property
  thermal: exynos: remove separate exynos_tmu.h header file
  thermal: exynos: fix setting rising_threshold for Exynos5433
  thermal: exynos: always check for trips points existence
  thermal: exynos: always check for critical trip points existence
  thermal: exynos: check STATUS register in exynos_tmu_initialize()
  thermal: exynos: use sanitize_temp_error() in exynos7_tmu_initialize()
  thermal: exynos: fix trips limit checking in get_th_reg()
  thermal: exynos: remove threshold_code checking from 
exynos4210_tmu_initialize()
  thermal: exynos: make ->tmu_initialize method void
  thermal: exynos: clear IRQs later in exynos4412_tmu_initialize()
  thermal: exynos: move IRQs clearing to exynos_tmu_initialize()
  thermal: exynos: add exynos*_tmu_set_[trip,hyst]() helpers
  thermal: exynos: do not use trips structure directly in ->tmu_initialize
  thermal: exynos: set trips in ascending order in exynos7_tmu_initialize()
  thermal: exynos: move trips setting to exynos_tmu_initialize()
  thermal: exynos: check return values of ->get_trip_[temp, hyst] methods
  thermal: exynos: cleanup code for enabling threshold interrupts
  thermal: exynos: remove unused defines for Exynos5433
  thermal: exynos: remove trip reporting to user-space
  thermal: ti-soc-thermal: fix incorrect entry in omap5430_adc_to_temp[]

Bjorn Andersson (1):
  thermal: qcom: tsens: Allow number of sensors to come from DT

David Collins (1):
  thermal: qcom-spmi-temp-alarm: add support for GEN2 PMIC peripherals

Ezequiel Garcia (1):
  thermal: tegra: Nuke clk_{readl,writel} helpers

Fabio Estevam (1):
  thermal: imx: Switch to SPDX identifier

Hien Dang (1):
  thermal: rcar_gen3_thermal: Update calculation formula due to HW 
evaluation

Krzysztof Kozlowski (2):
  thermal: samsung: Remove support for Exynos5440
  thermal: exynos: Reduce severity of too early temperature read

Kunihiko Hayashi (2):
  dt-bindings: thermal: uniphier: add a compatible string for PXs3
  thermal: uniphier: add UniPhier PXs3 support

Maciej Purski (1):
  thermal: exynos: Read soc_type from match data

Marek Szyprowski (2):
  thermal: exynos: Reading temperature makes sense only when TMU is turned 
on
  thermal: exynos: Propagate error value from tmu_read()

Niklas Söderlund (3):
  thermal: rcar_gen3_thermal: update max temperature clamp
  dt-bindings: thermal: rcar-gen3-thermal: add r8a77965
  thermal: rcar_gen3_thermal: add r8a77965 support

Ryder Lee (1):
  thermal: mediatek: use of_device_get_match_data()

Sean Wang (2):
  dt-bindings: thermal: add binding for MT7622 SoC
  thermal: mediatek: add support for MT7622 SoC

Yoshihiro Kaneko (2):
  dt-bindings: thermal: rcar-thermal: add R8A77995 support
  thermal: rcar_thermal: add r8a77995 support

srplinux2008 (1):

[GIT PULL] Thermal SoC management updates for v4.18-rc1 #1

2018-06-02 Thread Eduardo Valentin
Hello Rui,

Please pull the changes for thermal-soc for coming v4.18-rc1.
Changelog:
- imx thermal driver now supports i.MX7 thermal sensor
- exynos thermal driver dropped support for exynos 5440
- rcar_thermal now supports r8a77995
- rcar_gen3_thermal now supports r8a77965
- qcom-spmi-temp-alarm now supports GEN2 PMIC peripherals
- uniphier thermal now supports UniPhier PXs3
- mediatek thermal now supports MT7622 SoC
- considerable refactoring of exynos driver
- Fixes all over the place on different drivers.

Additional KernelCI Testing:
Full Boot Summary: 
https://kernelci.org/boot/all/job/evalenti/branch/for-kernelci/kernel/v4.17-rc3-359-g6d7c70d1cd65/
Full Build Summary: 
https://kernelci.org/build/evalenti/branch/for-kernelci/kernel/v4.17-rc3-359-g6d7c70d1cd65/

BR,

Eduardo

The following changes since commit 701e39d05119229b92ecca4add7b7ed2193622c3:

  Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm 
(2018-05-06 05:46:29 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal linus

for you to fetch changes up to 6d7c70d1cd6526dc79e3d3b3faae1c40c1681168:

  thermal: qcom: tsens: Allow number of sensors to come from DT (2018-06-01 
15:09:15 -0700)


Anson Huang (1):
  thermal: imx: add i.MX7 thermal sensor support

Bartlomiej Zolnierkiewicz (28):
  thermal: exynos: remove unused "type" field from struct 
exynos_tmu_platform_data
  thermal: exynos: remove parsing of samsung, tmu_default_temp_offset 
property
  thermal: exynos: remove parsing of samsung, tmu_[first, 
second]_point_trim properties
  thermal: exynos: remove parsing of samsung, tmu_noise_cancel_mode property
  thermal: exynos: remove parsing of samsung, tmu[_min, _max]_efuse_value 
properties
  thermal: exynos: remove parsing of samsung, tmu_reference_voltage property
  thermal: exynos: remove parsing of samsung,tmu_gain property
  thermal: exynos: remove parsing of samsung, tmu_cal_type property
  thermal: exynos: remove separate exynos_tmu.h header file
  thermal: exynos: fix setting rising_threshold for Exynos5433
  thermal: exynos: always check for trips points existence
  thermal: exynos: always check for critical trip points existence
  thermal: exynos: check STATUS register in exynos_tmu_initialize()
  thermal: exynos: use sanitize_temp_error() in exynos7_tmu_initialize()
  thermal: exynos: fix trips limit checking in get_th_reg()
  thermal: exynos: remove threshold_code checking from 
exynos4210_tmu_initialize()
  thermal: exynos: make ->tmu_initialize method void
  thermal: exynos: clear IRQs later in exynos4412_tmu_initialize()
  thermal: exynos: move IRQs clearing to exynos_tmu_initialize()
  thermal: exynos: add exynos*_tmu_set_[trip,hyst]() helpers
  thermal: exynos: do not use trips structure directly in ->tmu_initialize
  thermal: exynos: set trips in ascending order in exynos7_tmu_initialize()
  thermal: exynos: move trips setting to exynos_tmu_initialize()
  thermal: exynos: check return values of ->get_trip_[temp, hyst] methods
  thermal: exynos: cleanup code for enabling threshold interrupts
  thermal: exynos: remove unused defines for Exynos5433
  thermal: exynos: remove trip reporting to user-space
  thermal: ti-soc-thermal: fix incorrect entry in omap5430_adc_to_temp[]

Bjorn Andersson (1):
  thermal: qcom: tsens: Allow number of sensors to come from DT

David Collins (1):
  thermal: qcom-spmi-temp-alarm: add support for GEN2 PMIC peripherals

Ezequiel Garcia (1):
  thermal: tegra: Nuke clk_{readl,writel} helpers

Fabio Estevam (1):
  thermal: imx: Switch to SPDX identifier

Hien Dang (1):
  thermal: rcar_gen3_thermal: Update calculation formula due to HW 
evaluation

Krzysztof Kozlowski (2):
  thermal: samsung: Remove support for Exynos5440
  thermal: exynos: Reduce severity of too early temperature read

Kunihiko Hayashi (2):
  dt-bindings: thermal: uniphier: add a compatible string for PXs3
  thermal: uniphier: add UniPhier PXs3 support

Maciej Purski (1):
  thermal: exynos: Read soc_type from match data

Marek Szyprowski (2):
  thermal: exynos: Reading temperature makes sense only when TMU is turned 
on
  thermal: exynos: Propagate error value from tmu_read()

Niklas Söderlund (3):
  thermal: rcar_gen3_thermal: update max temperature clamp
  dt-bindings: thermal: rcar-gen3-thermal: add r8a77965
  thermal: rcar_gen3_thermal: add r8a77965 support

Ryder Lee (1):
  thermal: mediatek: use of_device_get_match_data()

Sean Wang (2):
  dt-bindings: thermal: add binding for MT7622 SoC
  thermal: mediatek: add support for MT7622 SoC

Yoshihiro Kaneko (2):
  dt-bindings: thermal: rcar-thermal: add R8A77995 support
  thermal: rcar_thermal: add r8a77995 support

srplinux2008 (1):

Re: linux-next: build warnings after merge of the kbuild tree

2018-06-02 Thread Arnd Bergmann
On Fri, Jun 1, 2018 at 6:01 AM, Kees Cook  wrote:
> On Thu, May 31, 2018 at 6:56 PM, Masahiro Yamada
>  wrote:
>> 2018-05-31 12:53 GMT+09:00 Kees Cook :
>>> On Wed, May 30, 2018 at 6:26 PM, Kees Cook  wrote:
 On Wed, May 30, 2018 at 6:12 PM, Masahiro Yamada

> This has been triggered by the following commit:
>
>
> commit 0e461945f3504e09b8ecf947b6398adce1287a28
> Author: Masahiro Yamada 
> Date:   Mon May 28 18:22:07 2018 +0900
>
> gcc-plugins: allow to enable GCC_PLUGINS for COMPILE_TEST
>
>
>
> CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL was previously disabled
> for COMPILE_TEST, which is now enabled.
>
> For the moment, can you add "depends on !COMPILE_TEST" to
> CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL in your tree and I'll continue
> to figure out what's happening?
>

I ran into the same thing indepently and bisected it (which led me to
arrive at this thread).
One additional bit of information I have is that this happens with all
versions of
gcc-7 for me, but not gcc-6.3 or older.

Another finding was the particular instance I noticed:

fs/ext4/inode.c: In function 'ext4_inode_csum':
fs/ext4/inode.c:83:1: warning: the frame size of 1688 bytes is larger
than 500 bytes [-Wframe-larger-than=]

comes from inlining the same function multiple times; ext4_inode_csum()
repeatedly calls ext4_chksum(), which has a struct on the stack. Apparently
this normally only takes up stack space only once, but when initializing it
to zero, each instance takes an additional two CRYPTO_MINALIGN bytes
of stack space (the size of the locally defined structure).


   Arnd


Re: linux-next: build warnings after merge of the kbuild tree

2018-06-02 Thread Arnd Bergmann
On Fri, Jun 1, 2018 at 6:01 AM, Kees Cook  wrote:
> On Thu, May 31, 2018 at 6:56 PM, Masahiro Yamada
>  wrote:
>> 2018-05-31 12:53 GMT+09:00 Kees Cook :
>>> On Wed, May 30, 2018 at 6:26 PM, Kees Cook  wrote:
 On Wed, May 30, 2018 at 6:12 PM, Masahiro Yamada

> This has been triggered by the following commit:
>
>
> commit 0e461945f3504e09b8ecf947b6398adce1287a28
> Author: Masahiro Yamada 
> Date:   Mon May 28 18:22:07 2018 +0900
>
> gcc-plugins: allow to enable GCC_PLUGINS for COMPILE_TEST
>
>
>
> CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL was previously disabled
> for COMPILE_TEST, which is now enabled.
>
> For the moment, can you add "depends on !COMPILE_TEST" to
> CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL in your tree and I'll continue
> to figure out what's happening?
>

I ran into the same thing indepently and bisected it (which led me to
arrive at this thread).
One additional bit of information I have is that this happens with all
versions of
gcc-7 for me, but not gcc-6.3 or older.

Another finding was the particular instance I noticed:

fs/ext4/inode.c: In function 'ext4_inode_csum':
fs/ext4/inode.c:83:1: warning: the frame size of 1688 bytes is larger
than 500 bytes [-Wframe-larger-than=]

comes from inlining the same function multiple times; ext4_inode_csum()
repeatedly calls ext4_chksum(), which has a struct on the stack. Apparently
this normally only takes up stack space only once, but when initializing it
to zero, each instance takes an additional two CRYPTO_MINALIGN bytes
of stack space (the size of the locally defined structure).


   Arnd


Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

2018-06-02 Thread Andy Lutomirski
On Fri, Jun 1, 2018 at 10:04 PM Rik van Riel  wrote:
>
> On Fri, 2018-06-01 at 20:35 -0700, Andy Lutomirski wrote:
> > On Fri, Jun 1, 2018 at 3:13 PM Rik van Riel  wrote:
> > >
> > > On Fri, 1 Jun 2018 14:21:58 -0700
> > > Andy Lutomirski  wrote:
> > >
> > > > Hmm.  I wonder if there's a more clever data structure than a
> > > > bitmap
> > > > that we could be using here.  Each CPU only ever needs to be in
> > > > one
> > > > mm's cpumask, and each cpu only ever changes its own state in the
> > > > bitmask.  And writes are much less common than reads for most
> > > > workloads.
> > >
> > > It would be easy enough to add an mm_struct pointer to the
> > > per-cpu tlbstate struct, and iterate over those.
> > >
> > > However, that would be an orthogonal change to optimizing
> > > lazy TLB mode.
> > >
> > > Does the (untested) patch below make sense as a potential
> > > improvement to the lazy TLB heuristic?
> > >
> > > ---8<---
> > > Subject: x86,tlb: workload dependent per CPU lazy TLB switch
> > >
> > > Lazy TLB mode is a tradeoff between flushing the TLB and touching
> > > the mm_cpumask(_mm) at context switch time, versus potentially
> > > incurring a remote TLB flush IPI while in lazy TLB mode.
> > >
> > > Whether this pays off is likely to be workload dependent more than
> > > anything else. However, the current heuristic keys off hardware
> > > type.
> > >
> > > This patch changes the lazy TLB mode heuristic to a dynamic, per-
> > > CPU
> > > decision, dependent on whether we recently received a remote TLB
> > > shootdown while in lazy TLB mode.
> > >
> > > This is a very simple heuristic. When a CPU receives a remote TLB
> > > shootdown IPI while in lazy TLB mode, a counter in the same cache
> > > line is set to 16. Every time we skip lazy TLB mode, the counter
> > > is decremented.
> > >
> > > While the counter is zero (no recent TLB flush IPIs), allow lazy
> > > TLB mode.
> >
> > Hmm, cute.  That's not a bad idea at all.  It would be nice to get
> > some kind of real benchmark on both PCID and !PCID.  If nothing else,
> > I would expect the threshold (16 in your patch) to want to be lower
> > on
> > PCID systems.
>
> That depends on how well we manage to get rid of
> the cpumask manipulation overhead. On the PCID
> system we first found this issue, the atomic
> accesses to the mm_cpumask took about 4x as much
> CPU time as the TLB invalidation itself.
>
> That kinda limits how much the cost of cheaper
> TLB flushes actually help :)
>
> I agree this code should get some testing.
>

Just to check: in the workload where you're seeing this problem, are
you using an mm with many threads?  I would imagine that, if you only
have one or two threads, the bit operations aren't so bad.

I wonder if just having a whole cacheline per node for the cpumask
would solve the problem.  I don't love the idea of having every flush
operation scan cpu_tlbstate for every single CPU -- we'll end up with
nasty contention on the cpu_tlbstate cache lines on some workloads.


Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

2018-06-02 Thread Andy Lutomirski
On Fri, Jun 1, 2018 at 10:04 PM Rik van Riel  wrote:
>
> On Fri, 2018-06-01 at 20:35 -0700, Andy Lutomirski wrote:
> > On Fri, Jun 1, 2018 at 3:13 PM Rik van Riel  wrote:
> > >
> > > On Fri, 1 Jun 2018 14:21:58 -0700
> > > Andy Lutomirski  wrote:
> > >
> > > > Hmm.  I wonder if there's a more clever data structure than a
> > > > bitmap
> > > > that we could be using here.  Each CPU only ever needs to be in
> > > > one
> > > > mm's cpumask, and each cpu only ever changes its own state in the
> > > > bitmask.  And writes are much less common than reads for most
> > > > workloads.
> > >
> > > It would be easy enough to add an mm_struct pointer to the
> > > per-cpu tlbstate struct, and iterate over those.
> > >
> > > However, that would be an orthogonal change to optimizing
> > > lazy TLB mode.
> > >
> > > Does the (untested) patch below make sense as a potential
> > > improvement to the lazy TLB heuristic?
> > >
> > > ---8<---
> > > Subject: x86,tlb: workload dependent per CPU lazy TLB switch
> > >
> > > Lazy TLB mode is a tradeoff between flushing the TLB and touching
> > > the mm_cpumask(_mm) at context switch time, versus potentially
> > > incurring a remote TLB flush IPI while in lazy TLB mode.
> > >
> > > Whether this pays off is likely to be workload dependent more than
> > > anything else. However, the current heuristic keys off hardware
> > > type.
> > >
> > > This patch changes the lazy TLB mode heuristic to a dynamic, per-
> > > CPU
> > > decision, dependent on whether we recently received a remote TLB
> > > shootdown while in lazy TLB mode.
> > >
> > > This is a very simple heuristic. When a CPU receives a remote TLB
> > > shootdown IPI while in lazy TLB mode, a counter in the same cache
> > > line is set to 16. Every time we skip lazy TLB mode, the counter
> > > is decremented.
> > >
> > > While the counter is zero (no recent TLB flush IPIs), allow lazy
> > > TLB mode.
> >
> > Hmm, cute.  That's not a bad idea at all.  It would be nice to get
> > some kind of real benchmark on both PCID and !PCID.  If nothing else,
> > I would expect the threshold (16 in your patch) to want to be lower
> > on
> > PCID systems.
>
> That depends on how well we manage to get rid of
> the cpumask manipulation overhead. On the PCID
> system we first found this issue, the atomic
> accesses to the mm_cpumask took about 4x as much
> CPU time as the TLB invalidation itself.
>
> That kinda limits how much the cost of cheaper
> TLB flushes actually help :)
>
> I agree this code should get some testing.
>

Just to check: in the workload where you're seeing this problem, are
you using an mm with many threads?  I would imagine that, if you only
have one or two threads, the bit operations aren't so bad.

I wonder if just having a whole cacheline per node for the cpumask
would solve the problem.  I don't love the idea of having every flush
operation scan cpu_tlbstate for every single CPU -- we'll end up with
nasty contention on the cpu_tlbstate cache lines on some workloads.


[PATCH] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread tomkpz
From: tomKPZ 

Documentation/binfmt_misc.txt was moved to
Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
updates a reference to the file.
---
 fs/binfmt_misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a41b48f82a70..5ad89b838c79 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -4,7 +4,8 @@
  * Copyright (C) 1997 Richard Günther
  *
  * binfmt_misc detects binaries via a magic or filename extension and invokes
- * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
+ * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for more
+ * details.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-- 
2.17.1



Re: dm-crypt: fix warning in shutdown path

2018-06-02 Thread Jens Axboe
On 6/2/18 2:07 PM, Mike Snitzer wrote:
> On Sat, Jun 02 2018 at  4:03pm -0400,
> Jens Axboe  wrote:
> 
>> On 6/2/18 11:45 AM, Kent Overstreet wrote:
>>> The counter for the number of allocated pages includes pages in the
>>> mempool's reserve, so checking that the number of allocated pages is 0
>>> needs to happen after we exit the mempool.
>>
>> Looks good, but needs a fixes line. I'll add one.
> 
> Also needs the subject and header updated to reflect that it fixes the
> crash (Krzysztof please verify):
> 
> Reported-by: Krzysztof Kozlowski 
> Acked-by: Mike Snitzer 

Indeed, I have added that. Thanks Mike.

-- 
Jens Axboe



[PATCH] exec: binfmt_misc: update reference to documentation

2018-06-02 Thread tomkpz
From: tomKPZ 

Documentation/binfmt_misc.txt was moved to
Documentation/admin-guide/binfmt-misc.rst in 9d85025b.  This change
updates a reference to the file.
---
 fs/binfmt_misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a41b48f82a70..5ad89b838c79 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -4,7 +4,8 @@
  * Copyright (C) 1997 Richard Günther
  *
  * binfmt_misc detects binaries via a magic or filename extension and invokes
- * a specified wrapper. See Documentation/binfmt_misc.txt for more details.
+ * a specified wrapper. See Documentation/admin-guide/binfmt-misc.rst for more
+ * details.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-- 
2.17.1



Re: dm-crypt: fix warning in shutdown path

2018-06-02 Thread Jens Axboe
On 6/2/18 2:07 PM, Mike Snitzer wrote:
> On Sat, Jun 02 2018 at  4:03pm -0400,
> Jens Axboe  wrote:
> 
>> On 6/2/18 11:45 AM, Kent Overstreet wrote:
>>> The counter for the number of allocated pages includes pages in the
>>> mempool's reserve, so checking that the number of allocated pages is 0
>>> needs to happen after we exit the mempool.
>>
>> Looks good, but needs a fixes line. I'll add one.
> 
> Also needs the subject and header updated to reflect that it fixes the
> crash (Krzysztof please verify):
> 
> Reported-by: Krzysztof Kozlowski 
> Acked-by: Mike Snitzer 

Indeed, I have added that. Thanks Mike.

-- 
Jens Axboe



[PATCH v2] mm: Change return type int to vm_fault_t for fault handlers

2018-06-02 Thread Souptick Joarder
Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.

Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")

The aim is to change the return type of finish_fault()
and handle_mm_fault() to vm_fault_t type. As part of
that clean up return type of all other recursively called
functions have been changed to vm_fault_t type.

The places from where handle_mm_fault() is getting invoked
will be change to vm_fault_t type but in a separate patch.

vmf_error() is the newly introduce inline function
in 4.17-rc6.

Signed-off-by: Souptick Joarder 
---
v2: Change patch title and fixed sparse warning.

 fs/userfaultfd.c  |  6 +--
 include/linux/huge_mm.h   | 10 +++--
 include/linux/hugetlb.h   |  2 +-
 include/linux/mm.h| 14 +++
 include/linux/oom.h   |  2 +-
 include/linux/swapops.h   |  5 ++-
 include/linux/userfaultfd_k.h |  5 ++-
 kernel/memremap.c |  2 +-
 mm/gup.c  |  4 +-
 mm/huge_memory.c  | 25 ++--
 mm/hugetlb.c  | 34 
 mm/internal.h |  2 +-
 mm/khugepaged.c   |  3 +-
 mm/memory.c   | 90 ++-
 mm/shmem.c| 17 
 15 files changed, 113 insertions(+), 108 deletions(-)

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index cec550c..bf60c6a 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -336,17 +336,15 @@ static inline bool userfaultfd_must_wait(struct 
userfaultfd_ctx *ctx,
  * fatal_signal_pending()s, and the mmap_sem must be released before
  * returning it.
  */
-int handle_userfault(struct vm_fault *vmf, unsigned long reason)
+vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason)
 {
struct mm_struct *mm = vmf->vma->vm_mm;
struct userfaultfd_ctx *ctx;
struct userfaultfd_wait_queue uwq;
-   int ret;
+   vm_fault_t ret = VM_FAULT_SIGBUS;
bool must_wait, return_to_userland;
long blocking_state;
 
-   ret = VM_FAULT_SIGBUS;
-
/*
 * We don't do userfault handling for the final child pid update.
 *
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a8a1262..8c4f0a6 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -3,10 +3,11 @@
 #define _LINUX_HUGE_MM_H
 
 #include 
+#include 
 
 #include  /* only for vma_is_dax() */
 
-extern int do_huge_pmd_anonymous_page(struct vm_fault *vmf);
+extern vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
 extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
 struct vm_area_struct *vma);
@@ -23,7 +24,7 @@ static inline void huge_pud_set_accessed(struct vm_fault 
*vmf, pud_t orig_pud)
 }
 #endif
 
-extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
+extern vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
 extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
  unsigned long addr,
  pmd_t *pmd,
@@ -216,7 +217,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, 
unsigned long addr,
 struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
pud_t *pud, int flags);
 
-extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
+extern vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
 
 extern struct page *huge_zero_page;
 
@@ -321,7 +322,8 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
return NULL;
 }
 
-static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd)
+static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf,
+   pmd_t orig_pmd)
 {
return 0;
 }
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 36fa6a2..c779b2f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -105,7 +105,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct 
vm_area_struct *vma,
 int hugetlb_report_node_meminfo(int, char *);
 void hugetlb_show_meminfo(void);
 unsigned long hugetlb_total_pages(void);
-int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
+vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, unsigned int flags);
 int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte,
struct vm_area_struct *dst_vma,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 02a616e..2971bff 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -694,10 +694,10 

[PATCH v2] mm: Change return type int to vm_fault_t for fault handlers

2018-06-02 Thread Souptick Joarder
Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.

Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")

The aim is to change the return type of finish_fault()
and handle_mm_fault() to vm_fault_t type. As part of
that clean up return type of all other recursively called
functions have been changed to vm_fault_t type.

The places from where handle_mm_fault() is getting invoked
will be change to vm_fault_t type but in a separate patch.

vmf_error() is the newly introduce inline function
in 4.17-rc6.

Signed-off-by: Souptick Joarder 
---
v2: Change patch title and fixed sparse warning.

 fs/userfaultfd.c  |  6 +--
 include/linux/huge_mm.h   | 10 +++--
 include/linux/hugetlb.h   |  2 +-
 include/linux/mm.h| 14 +++
 include/linux/oom.h   |  2 +-
 include/linux/swapops.h   |  5 ++-
 include/linux/userfaultfd_k.h |  5 ++-
 kernel/memremap.c |  2 +-
 mm/gup.c  |  4 +-
 mm/huge_memory.c  | 25 ++--
 mm/hugetlb.c  | 34 
 mm/internal.h |  2 +-
 mm/khugepaged.c   |  3 +-
 mm/memory.c   | 90 ++-
 mm/shmem.c| 17 
 15 files changed, 113 insertions(+), 108 deletions(-)

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index cec550c..bf60c6a 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -336,17 +336,15 @@ static inline bool userfaultfd_must_wait(struct 
userfaultfd_ctx *ctx,
  * fatal_signal_pending()s, and the mmap_sem must be released before
  * returning it.
  */
-int handle_userfault(struct vm_fault *vmf, unsigned long reason)
+vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason)
 {
struct mm_struct *mm = vmf->vma->vm_mm;
struct userfaultfd_ctx *ctx;
struct userfaultfd_wait_queue uwq;
-   int ret;
+   vm_fault_t ret = VM_FAULT_SIGBUS;
bool must_wait, return_to_userland;
long blocking_state;
 
-   ret = VM_FAULT_SIGBUS;
-
/*
 * We don't do userfault handling for the final child pid update.
 *
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a8a1262..8c4f0a6 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -3,10 +3,11 @@
 #define _LINUX_HUGE_MM_H
 
 #include 
+#include 
 
 #include  /* only for vma_is_dax() */
 
-extern int do_huge_pmd_anonymous_page(struct vm_fault *vmf);
+extern vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
 extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
 struct vm_area_struct *vma);
@@ -23,7 +24,7 @@ static inline void huge_pud_set_accessed(struct vm_fault 
*vmf, pud_t orig_pud)
 }
 #endif
 
-extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
+extern vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
 extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
  unsigned long addr,
  pmd_t *pmd,
@@ -216,7 +217,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, 
unsigned long addr,
 struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
pud_t *pud, int flags);
 
-extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
+extern vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
 
 extern struct page *huge_zero_page;
 
@@ -321,7 +322,8 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
return NULL;
 }
 
-static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd)
+static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf,
+   pmd_t orig_pmd)
 {
return 0;
 }
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 36fa6a2..c779b2f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -105,7 +105,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct 
vm_area_struct *vma,
 int hugetlb_report_node_meminfo(int, char *);
 void hugetlb_show_meminfo(void);
 unsigned long hugetlb_total_pages(void);
-int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
+vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, unsigned int flags);
 int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte,
struct vm_area_struct *dst_vma,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 02a616e..2971bff 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -694,10 +694,10 

Re: [PATCH] ARM: dts: imx51-zii-rdu1: add rave-sp subdevices

2018-06-02 Thread Chris Healy
On Thu, May 17, 2018 at 12:19 PM, Nikita Yushchenko
 wrote:
> This adds rave-sp powerbutton and backlight devices to RDU1 device tree.
>
> Signed-off-by: Nikita Yushchenko 
> ---

Tested-by: Chris Healy 

Tested on an 8.9" RDU1.


Re: [PATCH] ARM: dts: imx51-zii-rdu1: add rave-sp subdevices

2018-06-02 Thread Chris Healy
On Thu, May 17, 2018 at 12:19 PM, Nikita Yushchenko
 wrote:
> This adds rave-sp powerbutton and backlight devices to RDU1 device tree.
>
> Signed-off-by: Nikita Yushchenko 
> ---

Tested-by: Chris Healy 

Tested on an 8.9" RDU1.


Proposal

2018-06-02 Thread Miss Victoria Mehmet




--
Hello

I have been trying to contact you. Did you get my business proposal?

Best Regards,
Miss.Victoria Mehmet


Proposal

2018-06-02 Thread Miss Victoria Mehmet




--
Hello

I have been trying to contact you. Did you get my business proposal?

Best Regards,
Miss.Victoria Mehmet


Re: [PATCH v2] thermal: qcom: tsens: Allow number of sensors to come from DT

2018-06-02 Thread Bjorn Andersson
On Sat 02 Jun 12:32 PDT 2018, Bjorn Andersson wrote:

> For platforms that has multiple copies of the TSENS hardware block it's
> convenient to specify the number of sensors per block in DeviceTree.
> 
> Reviewed-by: Amit Kucheria 
> Reviewed-by: Rob Herring  [binding]
> Signed-off-by: Bjorn Andersson 

Please ignore, after sending this I saw that Eduardo picked up v1
yesterday.

Thanks Eduardo,
Bjorn

> ---
> 
> Changes since v1:
> - Added comment as suggested by Amit
> - Picked up Amit and Rob's R-b
> 
>  .../devicetree/bindings/thermal/qcom-tsens.txt  |  1 +
>  drivers/thermal/qcom/tsens.c| 13 ++---
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt 
> b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> index 292ed89d900b..06195e8f35e2 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> @@ -8,6 +8,7 @@ Required properties:
>  
>  - reg: Address range of the thermal registers
>  - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
> +- #qcom,sensors: Number of sensors in tsens block
>  - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to 
> specify
>  nvmem cells
>  
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 3f9fe6aa51cc..b212bebcfc36 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -116,6 +116,7 @@ static int tsens_probe(struct platform_device *pdev)
>   struct tsens_device *tmdev;
>   const struct tsens_data *data;
>   const struct of_device_id *id;
> + u32 num_sensors;
>  
>   if (pdev->dev.of_node)
>   dev = >dev;
> @@ -130,18 +131,24 @@ static int tsens_probe(struct platform_device *pdev)
>   else
>   data = _8960;
>  
> - if (data->num_sensors <= 0) {
> + num_sensors = data->num_sensors;
> +
> + /* Override driver provided num_sensors, if specified in DT */
> + if (np)
> + of_property_read_u32(np, "#qcom,sensors", _sensors);
> +
> + if (num_sensors <= 0) {
>   dev_err(dev, "invalid number of sensors\n");
>   return -EINVAL;
>   }
>  
>   tmdev = devm_kzalloc(dev, sizeof(*tmdev) +
> -  data->num_sensors * sizeof(*s), GFP_KERNEL);
> +  num_sensors * sizeof(*s), GFP_KERNEL);
>   if (!tmdev)
>   return -ENOMEM;
>  
>   tmdev->dev = dev;
> - tmdev->num_sensors = data->num_sensors;
> + tmdev->num_sensors = num_sensors;
>   tmdev->ops = data->ops;
>   for (i = 0;  i < tmdev->num_sensors; i++) {
>   if (data->hw_ids)
> -- 
> 2.17.0
> 


Re: [PATCH v2] thermal: qcom: tsens: Allow number of sensors to come from DT

2018-06-02 Thread Bjorn Andersson
On Sat 02 Jun 12:32 PDT 2018, Bjorn Andersson wrote:

> For platforms that has multiple copies of the TSENS hardware block it's
> convenient to specify the number of sensors per block in DeviceTree.
> 
> Reviewed-by: Amit Kucheria 
> Reviewed-by: Rob Herring  [binding]
> Signed-off-by: Bjorn Andersson 

Please ignore, after sending this I saw that Eduardo picked up v1
yesterday.

Thanks Eduardo,
Bjorn

> ---
> 
> Changes since v1:
> - Added comment as suggested by Amit
> - Picked up Amit and Rob's R-b
> 
>  .../devicetree/bindings/thermal/qcom-tsens.txt  |  1 +
>  drivers/thermal/qcom/tsens.c| 13 ++---
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt 
> b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> index 292ed89d900b..06195e8f35e2 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> @@ -8,6 +8,7 @@ Required properties:
>  
>  - reg: Address range of the thermal registers
>  - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
> +- #qcom,sensors: Number of sensors in tsens block
>  - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to 
> specify
>  nvmem cells
>  
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 3f9fe6aa51cc..b212bebcfc36 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -116,6 +116,7 @@ static int tsens_probe(struct platform_device *pdev)
>   struct tsens_device *tmdev;
>   const struct tsens_data *data;
>   const struct of_device_id *id;
> + u32 num_sensors;
>  
>   if (pdev->dev.of_node)
>   dev = >dev;
> @@ -130,18 +131,24 @@ static int tsens_probe(struct platform_device *pdev)
>   else
>   data = _8960;
>  
> - if (data->num_sensors <= 0) {
> + num_sensors = data->num_sensors;
> +
> + /* Override driver provided num_sensors, if specified in DT */
> + if (np)
> + of_property_read_u32(np, "#qcom,sensors", _sensors);
> +
> + if (num_sensors <= 0) {
>   dev_err(dev, "invalid number of sensors\n");
>   return -EINVAL;
>   }
>  
>   tmdev = devm_kzalloc(dev, sizeof(*tmdev) +
> -  data->num_sensors * sizeof(*s), GFP_KERNEL);
> +  num_sensors * sizeof(*s), GFP_KERNEL);
>   if (!tmdev)
>   return -ENOMEM;
>  
>   tmdev->dev = dev;
> - tmdev->num_sensors = data->num_sensors;
> + tmdev->num_sensors = num_sensors;
>   tmdev->ops = data->ops;
>   for (i = 0;  i < tmdev->num_sensors; i++) {
>   if (data->hw_ids)
> -- 
> 2.17.0
> 


[PATCH v2] thermal: qcom: tsens: Allow number of sensors to come from DT

2018-06-02 Thread Bjorn Andersson
For platforms that has multiple copies of the TSENS hardware block it's
convenient to specify the number of sensors per block in DeviceTree.

Reviewed-by: Amit Kucheria 
Reviewed-by: Rob Herring  [binding]
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Added comment as suggested by Amit
- Picked up Amit and Rob's R-b

 .../devicetree/bindings/thermal/qcom-tsens.txt  |  1 +
 drivers/thermal/qcom/tsens.c| 13 ++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt 
b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
index 292ed89d900b..06195e8f35e2 100644
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
@@ -8,6 +8,7 @@ Required properties:
 
 - reg: Address range of the thermal registers
 - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+- #qcom,sensors: Number of sensors in tsens block
 - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to 
specify
 nvmem cells
 
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 3f9fe6aa51cc..b212bebcfc36 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -116,6 +116,7 @@ static int tsens_probe(struct platform_device *pdev)
struct tsens_device *tmdev;
const struct tsens_data *data;
const struct of_device_id *id;
+   u32 num_sensors;
 
if (pdev->dev.of_node)
dev = >dev;
@@ -130,18 +131,24 @@ static int tsens_probe(struct platform_device *pdev)
else
data = _8960;
 
-   if (data->num_sensors <= 0) {
+   num_sensors = data->num_sensors;
+
+   /* Override driver provided num_sensors, if specified in DT */
+   if (np)
+   of_property_read_u32(np, "#qcom,sensors", _sensors);
+
+   if (num_sensors <= 0) {
dev_err(dev, "invalid number of sensors\n");
return -EINVAL;
}
 
tmdev = devm_kzalloc(dev, sizeof(*tmdev) +
-data->num_sensors * sizeof(*s), GFP_KERNEL);
+num_sensors * sizeof(*s), GFP_KERNEL);
if (!tmdev)
return -ENOMEM;
 
tmdev->dev = dev;
-   tmdev->num_sensors = data->num_sensors;
+   tmdev->num_sensors = num_sensors;
tmdev->ops = data->ops;
for (i = 0;  i < tmdev->num_sensors; i++) {
if (data->hw_ids)
-- 
2.17.0



[PATCH v2] thermal: qcom: tsens: Allow number of sensors to come from DT

2018-06-02 Thread Bjorn Andersson
For platforms that has multiple copies of the TSENS hardware block it's
convenient to specify the number of sensors per block in DeviceTree.

Reviewed-by: Amit Kucheria 
Reviewed-by: Rob Herring  [binding]
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Added comment as suggested by Amit
- Picked up Amit and Rob's R-b

 .../devicetree/bindings/thermal/qcom-tsens.txt  |  1 +
 drivers/thermal/qcom/tsens.c| 13 ++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt 
b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
index 292ed89d900b..06195e8f35e2 100644
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
@@ -8,6 +8,7 @@ Required properties:
 
 - reg: Address range of the thermal registers
 - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+- #qcom,sensors: Number of sensors in tsens block
 - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to 
specify
 nvmem cells
 
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 3f9fe6aa51cc..b212bebcfc36 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -116,6 +116,7 @@ static int tsens_probe(struct platform_device *pdev)
struct tsens_device *tmdev;
const struct tsens_data *data;
const struct of_device_id *id;
+   u32 num_sensors;
 
if (pdev->dev.of_node)
dev = >dev;
@@ -130,18 +131,24 @@ static int tsens_probe(struct platform_device *pdev)
else
data = _8960;
 
-   if (data->num_sensors <= 0) {
+   num_sensors = data->num_sensors;
+
+   /* Override driver provided num_sensors, if specified in DT */
+   if (np)
+   of_property_read_u32(np, "#qcom,sensors", _sensors);
+
+   if (num_sensors <= 0) {
dev_err(dev, "invalid number of sensors\n");
return -EINVAL;
}
 
tmdev = devm_kzalloc(dev, sizeof(*tmdev) +
-data->num_sensors * sizeof(*s), GFP_KERNEL);
+num_sensors * sizeof(*s), GFP_KERNEL);
if (!tmdev)
return -ENOMEM;
 
tmdev->dev = dev;
-   tmdev->num_sensors = data->num_sensors;
+   tmdev->num_sensors = num_sensors;
tmdev->ops = data->ops;
for (i = 0;  i < tmdev->num_sensors; i++) {
if (data->hw_ids)
-- 
2.17.0



[PATCH v8] ASoC: pxa: switch to new ac97 bus support

2018-06-02 Thread Robert Jarzmik
Switch to the new ac97 bus support in sound/ac97 instead of the legacy
snd_ac97 one.

Signed-off-by: Robert Jarzmik 
---
Since v7: added a NULL pointer check
  v7 was in https://patchwork.kernel.org/patch/9951919/
---
 sound/arm/Kconfig   |  1 -
 sound/soc/pxa/Kconfig   |  5 ++---
 sound/soc/pxa/pxa2xx-ac97.c | 48 +++--
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig
index 65171f6657a2..f1f25704fe52 100644
--- a/sound/arm/Kconfig
+++ b/sound/arm/Kconfig
@@ -36,7 +36,6 @@ endif # SND_ARM
 
 config SND_PXA2XX_LIB
tristate
-   select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
select SND_DMAENGINE_PCM
 
 config SND_PXA2XX_LIB_AC97
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 484ab3c2ad67..1a0b55beb282 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -20,13 +20,12 @@ config SND_MMP_SOC
 
 config SND_PXA2XX_AC97
tristate
-   select SND_AC97_CODEC
 
 config SND_PXA2XX_SOC_AC97
tristate
-   select AC97_BUS
+   select AC97_BUS_NEW
select SND_PXA2XX_LIB_AC97
-   select SND_SOC_AC97_BUS
+   select SND_SOC_AC97_BUS_NEW
 
 config SND_PXA2XX_SOC_I2S
tristate
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 1b41c0f2a8fb..91ead9cbbb9d 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -27,43 +28,35 @@
 #include 
 #include 
 
-static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97)
+static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv)
 {
pxa2xx_ac97_try_warm_reset();
 
pxa2xx_ac97_finish_reset();
 }
 
-static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
+static void pxa2xx_ac97_cold_reset(struct ac97_controller *adrv)
 {
pxa2xx_ac97_try_cold_reset();
 
pxa2xx_ac97_finish_reset();
 }
 
-static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97,
- unsigned short reg)
+static int pxa2xx_ac97_read_actrl(struct ac97_controller *adrv, int slot,
+ unsigned short reg)
 {
-   int ret;
-
-   ret = pxa2xx_ac97_read(ac97->num, reg);
-   if (ret < 0)
-   return 0;
-   else
-   return (unsigned short)(ret & 0x);
+   return pxa2xx_ac97_read(slot, reg);
 }
 
-static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97,
-unsigned short reg, unsigned short val)
+static int pxa2xx_ac97_write_actrl(struct ac97_controller *adrv, int slot,
+  unsigned short reg, unsigned short val)
 {
-   int ret;
-
-   ret = pxa2xx_ac97_write(ac97->num, reg, val);
+   return pxa2xx_ac97_write(slot, reg, val);
 }
 
-static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
-   .read   = pxa2xx_ac97_legacy_read,
-   .write  = pxa2xx_ac97_legacy_write,
+static struct ac97_controller_ops pxa2xx_ac97_ops = {
+   .read   = pxa2xx_ac97_read_actrl,
+   .write  = pxa2xx_ac97_write_actrl,
.warm_reset = pxa2xx_ac97_warm_reset,
.reset  = pxa2xx_ac97_cold_reset,
 };
@@ -219,6 +212,9 @@ static const struct snd_soc_component_driver 
pxa_ac97_component = {
 static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
 {
int ret;
+   struct ac97_controller *ctrl;
+   pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
+   void **codecs_pdata;
 
if (pdev->id != -1) {
dev_err(>dev, "PXA2xx has only one AC97 port.\n");
@@ -231,10 +227,14 @@ static int pxa2xx_ac97_dev_probe(struct platform_device 
*pdev)
return ret;
}
 
-   ret = snd_soc_set_ac97_ops(_ac97_ops);
-   if (ret != 0)
-   return ret;
+   codecs_pdata = pdata ? pdata->codecs_pdata : NULL;
+   ctrl = snd_ac97_controller_register(_ac97_ops, >dev,
+   AC97_SLOTS_AVAILABLE_ALL,
+   codecs_pdata);
+   if (IS_ERR(ctrl))
+   return PTR_ERR(ctrl);
 
+   platform_set_drvdata(pdev, ctrl);
/* Punt most of the init to the SoC probe; we may need the machine
 * driver to do interesting things with the clocking to get us up
 * and running.
@@ -245,8 +245,10 @@ static int pxa2xx_ac97_dev_probe(struct platform_device 
*pdev)
 
 static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
 {
+   struct ac97_controller *ctrl = platform_get_drvdata(pdev);
+
snd_soc_unregister_component(>dev);
-   snd_soc_set_ac97_ops(NULL);
+   snd_ac97_controller_unregister(ctrl);
pxa2xx_ac97_hw_remove(pdev);
return 0;
 }
-- 
2.11.0



[PATCH v8] ASoC: pxa: switch to new ac97 bus support

2018-06-02 Thread Robert Jarzmik
Switch to the new ac97 bus support in sound/ac97 instead of the legacy
snd_ac97 one.

Signed-off-by: Robert Jarzmik 
---
Since v7: added a NULL pointer check
  v7 was in https://patchwork.kernel.org/patch/9951919/
---
 sound/arm/Kconfig   |  1 -
 sound/soc/pxa/Kconfig   |  5 ++---
 sound/soc/pxa/pxa2xx-ac97.c | 48 +++--
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig
index 65171f6657a2..f1f25704fe52 100644
--- a/sound/arm/Kconfig
+++ b/sound/arm/Kconfig
@@ -36,7 +36,6 @@ endif # SND_ARM
 
 config SND_PXA2XX_LIB
tristate
-   select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
select SND_DMAENGINE_PCM
 
 config SND_PXA2XX_LIB_AC97
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 484ab3c2ad67..1a0b55beb282 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -20,13 +20,12 @@ config SND_MMP_SOC
 
 config SND_PXA2XX_AC97
tristate
-   select SND_AC97_CODEC
 
 config SND_PXA2XX_SOC_AC97
tristate
-   select AC97_BUS
+   select AC97_BUS_NEW
select SND_PXA2XX_LIB_AC97
-   select SND_SOC_AC97_BUS
+   select SND_SOC_AC97_BUS_NEW
 
 config SND_PXA2XX_SOC_I2S
tristate
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 1b41c0f2a8fb..91ead9cbbb9d 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -27,43 +28,35 @@
 #include 
 #include 
 
-static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97)
+static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv)
 {
pxa2xx_ac97_try_warm_reset();
 
pxa2xx_ac97_finish_reset();
 }
 
-static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
+static void pxa2xx_ac97_cold_reset(struct ac97_controller *adrv)
 {
pxa2xx_ac97_try_cold_reset();
 
pxa2xx_ac97_finish_reset();
 }
 
-static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97,
- unsigned short reg)
+static int pxa2xx_ac97_read_actrl(struct ac97_controller *adrv, int slot,
+ unsigned short reg)
 {
-   int ret;
-
-   ret = pxa2xx_ac97_read(ac97->num, reg);
-   if (ret < 0)
-   return 0;
-   else
-   return (unsigned short)(ret & 0x);
+   return pxa2xx_ac97_read(slot, reg);
 }
 
-static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97,
-unsigned short reg, unsigned short val)
+static int pxa2xx_ac97_write_actrl(struct ac97_controller *adrv, int slot,
+  unsigned short reg, unsigned short val)
 {
-   int ret;
-
-   ret = pxa2xx_ac97_write(ac97->num, reg, val);
+   return pxa2xx_ac97_write(slot, reg, val);
 }
 
-static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
-   .read   = pxa2xx_ac97_legacy_read,
-   .write  = pxa2xx_ac97_legacy_write,
+static struct ac97_controller_ops pxa2xx_ac97_ops = {
+   .read   = pxa2xx_ac97_read_actrl,
+   .write  = pxa2xx_ac97_write_actrl,
.warm_reset = pxa2xx_ac97_warm_reset,
.reset  = pxa2xx_ac97_cold_reset,
 };
@@ -219,6 +212,9 @@ static const struct snd_soc_component_driver 
pxa_ac97_component = {
 static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
 {
int ret;
+   struct ac97_controller *ctrl;
+   pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
+   void **codecs_pdata;
 
if (pdev->id != -1) {
dev_err(>dev, "PXA2xx has only one AC97 port.\n");
@@ -231,10 +227,14 @@ static int pxa2xx_ac97_dev_probe(struct platform_device 
*pdev)
return ret;
}
 
-   ret = snd_soc_set_ac97_ops(_ac97_ops);
-   if (ret != 0)
-   return ret;
+   codecs_pdata = pdata ? pdata->codecs_pdata : NULL;
+   ctrl = snd_ac97_controller_register(_ac97_ops, >dev,
+   AC97_SLOTS_AVAILABLE_ALL,
+   codecs_pdata);
+   if (IS_ERR(ctrl))
+   return PTR_ERR(ctrl);
 
+   platform_set_drvdata(pdev, ctrl);
/* Punt most of the init to the SoC probe; we may need the machine
 * driver to do interesting things with the clocking to get us up
 * and running.
@@ -245,8 +245,10 @@ static int pxa2xx_ac97_dev_probe(struct platform_device 
*pdev)
 
 static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
 {
+   struct ac97_controller *ctrl = platform_get_drvdata(pdev);
+
snd_soc_unregister_component(>dev);
-   snd_soc_set_ac97_ops(NULL);
+   snd_ac97_controller_unregister(ctrl);
pxa2xx_ac97_hw_remove(pdev);
return 0;
 }
-- 
2.11.0



Re: [PATCH v3 4/4] seccomp: add support for passing fds via USER_NOTIF

2018-06-02 Thread Alban Crequy
On Thu, 31 May 2018 at 16:52, Tycho Andersen  wrote:
>
> The idea here is that the userspace handler should be able to pass an fd
> back to the trapped task, for example so it can be returned from socket().
>
> I've proposed one API here, but I'm open to other options. In particular,
> this only lets you return an fd from a syscall, which may not be enough in
> all cases. For example, if an fd is written to an output parameter instead
> of returned, the current API can't handle this. Another case is that
> netlink takes as input fds sometimes (IFLA_NET_NS_FD, e.g.). If netlink
> ever decides to install an fd and output it, we wouldn't be able to handle
> this either.
>
> Still, the vast majority of interesting cases are covered by this API, so
> perhaps it is Enough.
>
> I've left it as a separate commit for two reasons:
>   * It illustrates the way in which we would grow struct seccomp_notif and
> struct seccomp_notif_resp without using netlink
>   * It shows just how little code is needed to accomplish this :)
>
> v2: new in v2
> v3: no changes
>
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 
> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
>  include/uapi/linux/seccomp.h  |   2 +
>  kernel/seccomp.c  |  49 +++-
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 112 ++
>  3 files changed, 161 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h
> index 8160e6cad528..3124427219cb 100644
> --- a/include/uapi/linux/seccomp.h
> +++ b/include/uapi/linux/seccomp.h
> @@ -71,6 +71,8 @@ struct seccomp_notif_resp {
> __u64 id;
> __s32 error;
> __s64 val;
> +   __u8 return_fd;
> +   __u32 fd;
>  };
>
>  #endif /* _UAPI_LINUX_SECCOMP_H */
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 6dc99c65c2f4..2ee958b3efde 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -77,6 +77,8 @@ struct seccomp_knotif {
> /* The return values, only valid when in SECCOMP_NOTIFY_REPLIED */
> int error;
> long val;
> +   struct file *file;
> +   unsigned int flags;
>
> /* Signals when this has entered SECCOMP_NOTIFY_REPLIED */
> struct completion ready;
> @@ -780,10 +782,32 @@ static void seccomp_do_user_notification(int 
> this_syscall,
> goto remove_list;
> }
>
> -   ret = n.val;
> -   err = n.error;
> +   if (n.file) {
> +   int fd;
> +
> +   fd = get_unused_fd_flags(n.flags);
> +   if (fd < 0) {
> +   err = fd;
> +   ret = -1;
> +   goto remove_list;
> +   }
> +
> +   ret = fd;
> +   err = 0;
> +
> +   fd_install(fd, n.file);
> +   /* Don't fput, since fd has a reference now */
> +   n.file = NULL;

Do we want the cgroup classid and netprio to be applied here, before
the fd_install? I am looking at similar code in net/core/scm.c
scm_detach_fds():
sock = sock_from_file(fp[i], );
if (sock) {
sock_update_netprioidx(>sk->sk_cgrp_data);
sock_update_classid(>sk->sk_cgrp_data);
}

The listener process might live in a different cgroup with a different
classid & netprio, so it might not be applied as the app might expect.

Also, should we update the struct sock_cgroup_data of the socket, in
order to make the BPF helper function bpf_skb_under_cgroup() work wrt
the cgroup of the target process instead of the listener process? I am
looking at cgroup_sk_alloc(). I don't know what's the correct
behaviour we want here.

> +   } else {
> +   ret = n.val;
> +   err = n.error;
> +   }
> +
>
>  remove_list:
> +   if (n.file)
> +   fput(n.file);
> +
> list_del();
>  out:
> mutex_unlock(>notify_lock);
> @@ -1598,6 +1622,27 @@ static ssize_t seccomp_notify_write(struct file *file, 
> const char __user *buf,
> knotif->state = SECCOMP_NOTIFY_REPLIED;
> knotif->error = resp.error;
> knotif->val = resp.val;
> +
> +   if (resp.return_fd) {
> +   struct fd fd;
> +
> +   /*
> +* This is a little hokey: we need a real fget() (i.e. not
> +* __fget_light(), which is what fdget does), but we also need
> +* the flags from strcut fd. So, we get it, put it, and get it
> +* again for real.
> +*/
> +   fd = fdget(resp.fd);
> +   knotif->flags = fd.flags;
> +   fdput(fd);
> +
> +   knotif->file = fget(resp.fd);
> +   if (!knotif->file) {
> +   ret = -EBADF;
> +

Re: [PATCH v3 4/4] seccomp: add support for passing fds via USER_NOTIF

2018-06-02 Thread Alban Crequy
On Thu, 31 May 2018 at 16:52, Tycho Andersen  wrote:
>
> The idea here is that the userspace handler should be able to pass an fd
> back to the trapped task, for example so it can be returned from socket().
>
> I've proposed one API here, but I'm open to other options. In particular,
> this only lets you return an fd from a syscall, which may not be enough in
> all cases. For example, if an fd is written to an output parameter instead
> of returned, the current API can't handle this. Another case is that
> netlink takes as input fds sometimes (IFLA_NET_NS_FD, e.g.). If netlink
> ever decides to install an fd and output it, we wouldn't be able to handle
> this either.
>
> Still, the vast majority of interesting cases are covered by this API, so
> perhaps it is Enough.
>
> I've left it as a separate commit for two reasons:
>   * It illustrates the way in which we would grow struct seccomp_notif and
> struct seccomp_notif_resp without using netlink
>   * It shows just how little code is needed to accomplish this :)
>
> v2: new in v2
> v3: no changes
>
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 
> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
>  include/uapi/linux/seccomp.h  |   2 +
>  kernel/seccomp.c  |  49 +++-
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 112 ++
>  3 files changed, 161 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h
> index 8160e6cad528..3124427219cb 100644
> --- a/include/uapi/linux/seccomp.h
> +++ b/include/uapi/linux/seccomp.h
> @@ -71,6 +71,8 @@ struct seccomp_notif_resp {
> __u64 id;
> __s32 error;
> __s64 val;
> +   __u8 return_fd;
> +   __u32 fd;
>  };
>
>  #endif /* _UAPI_LINUX_SECCOMP_H */
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 6dc99c65c2f4..2ee958b3efde 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -77,6 +77,8 @@ struct seccomp_knotif {
> /* The return values, only valid when in SECCOMP_NOTIFY_REPLIED */
> int error;
> long val;
> +   struct file *file;
> +   unsigned int flags;
>
> /* Signals when this has entered SECCOMP_NOTIFY_REPLIED */
> struct completion ready;
> @@ -780,10 +782,32 @@ static void seccomp_do_user_notification(int 
> this_syscall,
> goto remove_list;
> }
>
> -   ret = n.val;
> -   err = n.error;
> +   if (n.file) {
> +   int fd;
> +
> +   fd = get_unused_fd_flags(n.flags);
> +   if (fd < 0) {
> +   err = fd;
> +   ret = -1;
> +   goto remove_list;
> +   }
> +
> +   ret = fd;
> +   err = 0;
> +
> +   fd_install(fd, n.file);
> +   /* Don't fput, since fd has a reference now */
> +   n.file = NULL;

Do we want the cgroup classid and netprio to be applied here, before
the fd_install? I am looking at similar code in net/core/scm.c
scm_detach_fds():
sock = sock_from_file(fp[i], );
if (sock) {
sock_update_netprioidx(>sk->sk_cgrp_data);
sock_update_classid(>sk->sk_cgrp_data);
}

The listener process might live in a different cgroup with a different
classid & netprio, so it might not be applied as the app might expect.

Also, should we update the struct sock_cgroup_data of the socket, in
order to make the BPF helper function bpf_skb_under_cgroup() work wrt
the cgroup of the target process instead of the listener process? I am
looking at cgroup_sk_alloc(). I don't know what's the correct
behaviour we want here.

> +   } else {
> +   ret = n.val;
> +   err = n.error;
> +   }
> +
>
>  remove_list:
> +   if (n.file)
> +   fput(n.file);
> +
> list_del();
>  out:
> mutex_unlock(>notify_lock);
> @@ -1598,6 +1622,27 @@ static ssize_t seccomp_notify_write(struct file *file, 
> const char __user *buf,
> knotif->state = SECCOMP_NOTIFY_REPLIED;
> knotif->error = resp.error;
> knotif->val = resp.val;
> +
> +   if (resp.return_fd) {
> +   struct fd fd;
> +
> +   /*
> +* This is a little hokey: we need a real fget() (i.e. not
> +* __fget_light(), which is what fdget does), but we also need
> +* the flags from strcut fd. So, we get it, put it, and get it
> +* again for real.
> +*/
> +   fd = fdget(resp.fd);
> +   knotif->flags = fd.flags;
> +   fdput(fd);
> +
> +   knotif->file = fget(resp.fd);
> +   if (!knotif->file) {
> +   ret = -EBADF;
> +

Re: [PATCH] power: Print wakeup_count instead of event_count in the sysfs attribute.

2018-06-02 Thread Pavel Machek
On Fri 2018-06-01 19:32:15, Ravi Chandra Sadineni wrote:
> Currently we show event_count instead of wakeup_count as part of per
> device wakeup_count sysfs attribute. Change it to wakeup_count to make
> it more meaningful.
> 
> Signed-off-by: Ravi Chandra Sadineni 

Acked-by: Pavel Machek 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH] power: Print wakeup_count instead of event_count in the sysfs attribute.

2018-06-02 Thread Pavel Machek
On Fri 2018-06-01 19:32:15, Ravi Chandra Sadineni wrote:
> Currently we show event_count instead of wakeup_count as part of per
> device wakeup_count sysfs attribute. Change it to wakeup_count to make
> it more meaningful.
> 
> Signed-off-by: Ravi Chandra Sadineni 

Acked-by: Pavel Machek 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH v1 2/2] PCI: shpchp: Fix AMD POGO identification

2018-06-02 Thread Mika Westerberg
On Sat, Jun 02, 2018 at 12:42:12AM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas 
> 
> The fix for an AMD POGO erratum related to SHPC incorrectly identified the
> device.  The workaround should be applied only for AMD POGO devices, but it
> was instead applied to:
> 
>   - all AMD bridges, and
>   - all devices from any vendor with device ID 0x7458

Good catch.

Reviewed-by: Mika Westerberg 


Re: [PATCH v1 2/2] PCI: shpchp: Fix AMD POGO identification

2018-06-02 Thread Mika Westerberg
On Sat, Jun 02, 2018 at 12:42:12AM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas 
> 
> The fix for an AMD POGO erratum related to SHPC incorrectly identified the
> device.  The workaround should be applied only for AMD POGO devices, but it
> was instead applied to:
> 
>   - all AMD bridges, and
>   - all devices from any vendor with device ID 0x7458

Good catch.

Reviewed-by: Mika Westerberg 


Re: [PATCH v1 1/2] PCI: shpchp: Use dev_printk() for OSHP-related messages

2018-06-02 Thread Mika Westerberg
On Sat, Jun 02, 2018 at 12:42:06AM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas 
> 
> Use dev_printk() for messages related to requesting control of SHPC hotplug
> via the OSHP method.
> 
> Signed-off-by: Bjorn Helgaas 

Reviewed-by: Mika Westerberg 


Re: [PATCH v1 1/2] PCI: shpchp: Use dev_printk() for OSHP-related messages

2018-06-02 Thread Mika Westerberg
On Sat, Jun 02, 2018 at 12:42:06AM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas 
> 
> Use dev_printk() for messages related to requesting control of SHPC hotplug
> via the OSHP method.
> 
> Signed-off-by: Bjorn Helgaas 

Reviewed-by: Mika Westerberg 


[PATCH v3 3/5] staging: mt7621-spi: Use tabs for indentation instead of spaces.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
ERROR : code indent should use tabs where possible

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index 910dbdb8a003..f7620a988a08 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -105,7 +105,7 @@ static void mt7621_spi_set_cs(struct spi_device *spi, int 
enable)
int cs = spi->chip_select;
u32 polar = 0;
 
-mt7621_spi_reset(rs, cs);
+   mt7621_spi_reset(rs, cs);
if (enable)
polar = BIT(cs);
mt7621_spi_write(rs, MT7621_SPI_POLAR, polar);
-- 
2.11.0



[PATCH v3 3/5] staging: mt7621-spi: Use tabs for indentation instead of spaces.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
ERROR : code indent should use tabs where possible

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index 910dbdb8a003..f7620a988a08 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -105,7 +105,7 @@ static void mt7621_spi_set_cs(struct spi_device *spi, int 
enable)
int cs = spi->chip_select;
u32 polar = 0;
 
-mt7621_spi_reset(rs, cs);
+   mt7621_spi_reset(rs, cs);
if (enable)
polar = BIT(cs);
mt7621_spi_write(rs, MT7621_SPI_POLAR, polar);
-- 
2.11.0



[PATCH v3 5/5] staging: mt7621-spi: Remove unnecessary braces {} from single statement if block.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
WARNING : braces {} are not necessary for single statement blocks

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index 472f72479162..cf5b5d7c3cf9 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -165,9 +165,8 @@ static inline int mt7621_spi_wait_till_ready(struct 
spi_device *spi)
u32 status;
 
status = mt7621_spi_read(rs, MT7621_SPI_TRANS);
-   if ((status & SPITRANS_BUSY) == 0) {
+   if ((status & SPITRANS_BUSY) == 0)
return 0;
-   }
cpu_relax();
udelay(1);
}
-- 
2.11.0



[PATCH v3 4/5] staging: mt7621-spi: Add a space before open paranthesis.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
ERROR : space required before the open parenthesis

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index f7620a988a08..472f72479162 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -138,7 +138,7 @@ static int mt7621_spi_prepare(struct spi_device *spi, 
unsigned int speed)
reg |= MT7621_LSB_FIRST;
 
reg &= ~(MT7621_CPHA | MT7621_CPOL);
-   switch(spi->mode & (SPI_CPOL | SPI_CPHA)) {
+   switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
case SPI_MODE_0:
break;
case SPI_MODE_1:
-- 
2.11.0



[PATCH v3 5/5] staging: mt7621-spi: Remove unnecessary braces {} from single statement if block.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
WARNING : braces {} are not necessary for single statement blocks

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index 472f72479162..cf5b5d7c3cf9 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -165,9 +165,8 @@ static inline int mt7621_spi_wait_till_ready(struct 
spi_device *spi)
u32 status;
 
status = mt7621_spi_read(rs, MT7621_SPI_TRANS);
-   if ((status & SPITRANS_BUSY) == 0) {
+   if ((status & SPITRANS_BUSY) == 0)
return 0;
-   }
cpu_relax();
udelay(1);
}
-- 
2.11.0



[PATCH v3 4/5] staging: mt7621-spi: Add a space before open paranthesis.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
ERROR : space required before the open parenthesis

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index f7620a988a08..472f72479162 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -138,7 +138,7 @@ static int mt7621_spi_prepare(struct spi_device *spi, 
unsigned int speed)
reg |= MT7621_LSB_FIRST;
 
reg &= ~(MT7621_CPHA | MT7621_CPOL);
-   switch(spi->mode & (SPI_CPOL | SPI_CPHA)) {
+   switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
case SPI_MODE_0:
break;
case SPI_MODE_1:
-- 
2.11.0



[PATCH v3 2/5] staging: mt7621-spi: Fix line over 80 characters by refactoring.

2018-06-02 Thread Sankalp Negi
The patch fixes following checkpatch.pl issue:
WARNING : line over 80 characters

Signed-off-by: Sankalp Negi 
---
 drivers/staging/mt7621-spi/spi-mt7621.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
index b268084b6cd1..910dbdb8a003 100644
--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -55,7 +55,8 @@
 #define MT7621_CPOLBIT(4)
 #define MT7621_LSB_FIRST   BIT(3)
 
-#define RT2880_SPI_MODE_BITS   (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | 
SPI_CS_HIGH)
+#define RT2880_SPI_MODE_BITS   (SPI_CPOL | SPI_CPHA |  \
+SPI_LSB_FIRST | SPI_CS_HIGH)
 
 struct mt7621_spi;
 
-- 
2.11.0



[PATCH v3 0/5] staging: mt7621-spi: Fix C Coding style issues.

2018-06-02 Thread Sankalp Negi
This patch series lists different changes for coding style fixes
as reported by checkpatch.pl, changes can be broken down as :

1. Indent switch and case labels at the same level.
2. Fix a line over 80 columns by refactoring.
3. Use tabs for indentation instead of spaces.
4. Add a space before open paranthesis in switch.
5. Remove unnecessary braces {} from single statement if block.

version 2 changes
- segregated changes in individual commits as per fix category.

version 3 changes
- added unique subjects for each patch in the series.


Sankalp Negi (5):
  staging: mt7621-spi: Indent case labels and switch at the same level.
  staging: mt7621-spi: Fix line over 80 characters by refactoring.
  staging: mt7621-spi: Use tabs for indentation instead of spaces.
  staging: mt7621-spi: Add a space before open paranthesis.
  staging: mt7621-spi: Remove unnecessary braces {} from single
statement if block.

 drivers/staging/mt7621-spi/spi-mt7621.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

-- 
2.11.0



  1   2   3   4   >