[RFC PATCH 2/6] sched/dl: Capacity-aware migrations

2019-05-05 Thread Luca Abeni
From: luca abeni 

Currently, the SCHED_DEADLINE scheduler uses a global EDF scheduling
algorithm, migrating tasks to CPU cores without considering the core
capacity and the task utilization. This works well on homogeneous
systems (SCHED_DEADLINE tasks are guaranteed to have a bounded
tardiness), but presents some issues on heterogeneous systems. For
example, a SCHED_DEADLINE task might be migrated on a core that has not
enough processing capacity to correctly serve the task (think about a
task with runtime 70ms and period 100ms migrated to a core with
processing capacity 0.5)

This commit is a first step to address the issue: When a task wakes
up or migrates away from a CPU core, the scheduler tries to find an
idle core having enough processing capacity to serve the task.

Signed-off-by: luca abeni 
---
 kernel/sched/cpudeadline.c | 31 +--
 kernel/sched/deadline.c|  8 ++--
 kernel/sched/sched.h   |  7 ++-
 3 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 50316455ea66..d21f7905b9c1 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -110,6 +110,22 @@ static inline int cpudl_maximum(struct cpudl *cp)
return cp->elements[0].cpu;
 }
 
+static inline int dl_task_fit(const struct sched_dl_entity *dl_se,
+ int cpu, u64 *c)
+{
+   u64 cap = (arch_scale_cpu_capacity(NULL, cpu) * 
arch_scale_freq_capacity(cpu)) >> SCHED_CAPACITY_SHIFT;
+   s64 rel_deadline = dl_se->dl_deadline;
+   u64 rem_runtime  = dl_se->dl_runtime;
+
+   if (c)
+   *c = cap;
+
+   if ((rel_deadline * cap) >> SCHED_CAPACITY_SHIFT < rem_runtime)
+   return 0;
+
+   return 1;
+}
+
 /*
  * cpudl_find - find the best (later-dl) CPU in the system
  * @cp: the cpudl max-heap context
@@ -125,8 +141,19 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
 
if (later_mask &&
cpumask_and(later_mask, cp->free_cpus, >cpus_allowed)) {
-   return 1;
-   } else {
+   int cpu;
+
+   for_each_cpu(cpu, later_mask) {
+   u64 cap;
+
+   if (!dl_task_fit(>dl, cpu, ))
+   cpumask_clear_cpu(cpu, later_mask);
+   }
+
+   if (!cpumask_empty(later_mask))
+   return 1;
+   }
+   {
int best_cpu = cpudl_maximum(cp);
 
WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 5b981eeeb944..3436f3d8fa8f 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1584,6 +1584,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int 
sd_flag, int flags)
if (sd_flag != SD_BALANCE_WAKE)
goto out;
 
+   if (dl_entity_is_special(>dl))
+   goto out;
+
rq = cpu_rq(cpu);
 
rcu_read_lock();
@@ -1598,10 +1601,11 @@ select_task_rq_dl(struct task_struct *p, int cpu, int 
sd_flag, int flags)
 * other hand, if it has a shorter deadline, we
 * try to make it stay here, it might be important.
 */
-   if (unlikely(dl_task(curr)) &&
+   if ((unlikely(dl_task(curr)) &&
(curr->nr_cpus_allowed < 2 ||
 !dl_entity_preempt(>dl, >dl)) &&
-   (p->nr_cpus_allowed > 1)) {
+   (p->nr_cpus_allowed > 1)) ||
+   static_branch_unlikely(_asym_cpucapacity)) {
int target = find_later_rq(p);
 
if (target != -1 &&
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 32d242694863..e5f9fd3aee80 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2367,7 +2367,12 @@ unsigned long schedutil_cpu_util(int cpu, unsigned long 
util_cfs,
 
 static inline unsigned long cpu_bw_dl(struct rq *rq)
 {
-   return (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT;
+   unsigned long res;
+
+   res = (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT;
+
+   return (res << SCHED_CAPACITY_SHIFT) /
+  arch_scale_cpu_capacity(NULL, rq->cpu);
 }
 
 static inline unsigned long cpu_util_dl(struct rq *rq)
-- 
2.20.1



[RFC PATCH 5/6] sched/dl: If the task does not fit anywhere, select the fastest core

2019-05-05 Thread Luca Abeni
From: luca abeni 

When a task has a remaining runtime that cannot be served within the
scheduling deadline by anyone of the idle cores, the task is doomed
to miss its deadline (this can happen, because the admission control
only guarantees a bounded tardiness, not the hard respect of all
deadlines). In this case, try to select the fastest idle core, to
minimize the tardiness.

Signed-off-by: luca abeni 
---
 kernel/sched/cpudeadline.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 111dd9ac837b..2a4ac7b529b7 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -123,7 +123,7 @@ static inline int dl_task_fit(const struct sched_dl_entity 
*dl_se,
}
 
if (c)
-   *c = cap;
+   *c = arch_scale_cpu_capacity(NULL, cpu);
 
if ((rel_deadline * cap) >> SCHED_CAPACITY_SHIFT < rem_runtime)
return 0;
@@ -146,14 +146,22 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
 
if (later_mask &&
cpumask_and(later_mask, cp->free_cpus, >cpus_allowed)) {
-   int cpu;
+   int cpu, max_cpu = -1;
+   u64 max_cap = 0;
 
for_each_cpu(cpu, later_mask) {
u64 cap;
 
if (!dl_task_fit(>dl, cpu, ))
cpumask_clear_cpu(cpu, later_mask);
+
+   if (cap > max_cap) {
+   max_cap = cap;
+   max_cpu = cpu;
+   }
}
+   if (cpumask_empty(later_mask) && max_cap)
+   cpumask_set_cpu(max_cpu, later_mask);
 
if (!cpumask_empty(later_mask))
return 1;
-- 
2.20.1



[RFC PATCH 6/6] sched/dl: Try not to select a too fast core

2019-05-05 Thread Luca Abeni
From: luca abeni 

When a task can fit on multiple CPU cores, try to select the slowest
core that is able to properly serve the task. This avoids useless
future migrations, leaving the "fast cores" idle for more heavyweight
tasks.

Signed-off-by: luca abeni 
---
 kernel/sched/cpudeadline.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 2a4ac7b529b7..897ed71af515 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -143,17 +143,24 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
   struct cpumask *later_mask)
 {
const struct sched_dl_entity *dl_se = >dl;
+   struct cpumask tmp_mask;
 
if (later_mask &&
-   cpumask_and(later_mask, cp->free_cpus, >cpus_allowed)) {
+   cpumask_and(_mask, cp->free_cpus, >cpus_allowed)) {
int cpu, max_cpu = -1;
-   u64 max_cap = 0;
+   u64 max_cap = 0, min_cap = SCHED_CAPACITY_SCALE * 
SCHED_CAPACITY_SCALE;
 
-   for_each_cpu(cpu, later_mask) {
+   cpumask_clear(later_mask);
+   for_each_cpu(cpu, _mask) {
u64 cap;
 
-   if (!dl_task_fit(>dl, cpu, ))
-   cpumask_clear_cpu(cpu, later_mask);
+   if (dl_task_fit(>dl, cpu, ) && (cap <= min_cap)) 
{
+   if (cap < min_cap) {
+   min_cap = cap;
+   cpumask_clear(later_mask);
+   }
+   cpumask_set_cpu(cpu, later_mask);
+   }
 
if (cap > max_cap) {
max_cap = cap;
-- 
2.20.1



[RFC PATCH 4/6] sched/dl: Improve capacity-aware wakeup

2019-05-05 Thread Luca Abeni
From: luca abeni 

Instead of considering the "static CPU bandwidth" allocated to
a SCHED_DEADLINE task (ratio between its maximum runtime and
reservation period), try to use the remaining runtime and time
to scheduling deadline.

Signed-off-by: luca abeni 
---
 kernel/sched/cpudeadline.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index d21f7905b9c1..111dd9ac837b 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -114,8 +114,13 @@ static inline int dl_task_fit(const struct sched_dl_entity 
*dl_se,
  int cpu, u64 *c)
 {
u64 cap = (arch_scale_cpu_capacity(NULL, cpu) * 
arch_scale_freq_capacity(cpu)) >> SCHED_CAPACITY_SHIFT;
-   s64 rel_deadline = dl_se->dl_deadline;
-   u64 rem_runtime  = dl_se->dl_runtime;
+   s64 rel_deadline = dl_se->deadline - 
sched_clock_cpu(smp_processor_id());
+   u64 rem_runtime  = dl_se->runtime;
+
+   if ((rel_deadline < 0) || (rel_deadline * dl_se->dl_runtime < 
dl_se->dl_deadline * rem_runtime)) {
+   rel_deadline = dl_se->dl_deadline;
+   rem_runtime  = dl_se->dl_runtime;
+   }
 
if (c)
*c = cap;
-- 
2.20.1



[RFC PATCH 1/6] sched/dl: Improve deadline admission control for asymmetric CPU capacities

2019-05-05 Thread Luca Abeni
From: luca abeni 

Currently, the SCHED_DEADLINE admission control ensures that the
sum of reserved CPU bandwidths is smaller than x * M, where the
reserved CPU bandwidth of a SCHED_DEADLINE task is defined as the
ratio between its runtime and its period, x is a user-definable
percentage (95% by default, can be controlled through
/proc/sys/kernel/sched_rt_{runtime,period}_us) and M is the number
of CPU cores.

This admission control works well (guaranteeing bounded tardiness
for SCHED_DEADLINE tasks and non-starvation of non SCHED_DEADLINE
tasks) for homogeneous systems (where all the CPU cores have the
same computing capacity), but ends up over-allocating the CPU time
in presence of less-powerful CPU cores.

It can be easily shown how on asymmetric CPU capacity architectures
(such as ARM big.LITTLE) SCHED_DEADLINE tasks can easily starve all the
other tasks, making the system unusable.

This commit fixes the issue by explicitly considering the cores'
capacities in the admission test (where "M" is replaced by the sum
of all the capacities of cores in the root domain).

Signed-off-by: luca abeni 
---
 drivers/base/arch_topology.c   |  1 +
 include/linux/sched/topology.h |  3 +++
 kernel/sched/core.c|  2 ++
 kernel/sched/deadline.c| 19 +--
 kernel/sched/sched.h   |  7 +--
 kernel/sched/topology.c|  9 +
 6 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index edfcf8d982e4..646d6d349d53 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -36,6 +36,7 @@ DEFINE_PER_CPU(unsigned long, cpu_scale) = 
SCHED_CAPACITY_SCALE;
 
 void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
 {
+   topology_update_cpu_capacity(cpu, per_cpu(cpu_scale, cpu), capacity);
per_cpu(cpu_scale, cpu) = capacity;
 }
 
diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 2bf680b42f3c..a4898e42f368 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -233,4 +233,7 @@ static inline int task_node(const struct task_struct *p)
return cpu_to_node(task_cpu(p));
 }
 
+void topology_update_cpu_capacity(unsigned int cpu, unsigned long old,
+ unsigned long new);
+
 #endif /* _LINUX_SCHED_TOPOLOGY_H */
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d8456801caa3..a37bbb246802 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6271,6 +6271,7 @@ void set_rq_online(struct rq *rq)
if (class->rq_online)
class->rq_online(rq);
}
+   rq->rd->rd_capacity += arch_scale_cpu_capacity(NULL, 
cpu_of(rq));
}
 }
 
@@ -6286,6 +6287,7 @@ void set_rq_offline(struct rq *rq)
 
cpumask_clear_cpu(rq->cpu, rq->rd->online);
rq->online = 0;
+   rq->rd->rd_capacity -= arch_scale_cpu_capacity(NULL, 
cpu_of(rq));
}
 }
 
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 6a73e41a2016..5b981eeeb944 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -63,6 +63,10 @@ static inline int dl_bw_cpus(int i)
 
return cpus;
 }
+static inline unsigned long rd_capacity(struct rq *rq)
+{
+   return rq->rd->rd_capacity;
+}
 #else
 static inline struct dl_bw *dl_bw_of(int i)
 {
@@ -73,6 +77,11 @@ static inline int dl_bw_cpus(int i)
 {
return 1;
 }
+
+static inline unsigned long rd_capacity(struct rq *rq)
+{
+   return SCHED_CAPACITY_SCALE;
+}
 #endif
 
 static inline
@@ -2535,13 +2544,13 @@ int sched_dl_overflow(struct task_struct *p, int policy,
raw_spin_lock(_b->lock);
cpus = dl_bw_cpus(task_cpu(p));
if (dl_policy(policy) && !task_has_dl_policy(p) &&
-   !__dl_overflow(dl_b, cpus, 0, new_bw)) {
+   !__dl_overflow(dl_b, rd_capacity(task_rq(p)), 0, new_bw)) {
if (hrtimer_active(>dl.inactive_timer))
__dl_sub(dl_b, p->dl.dl_bw, cpus);
__dl_add(dl_b, new_bw, cpus);
err = 0;
} else if (dl_policy(policy) && task_has_dl_policy(p) &&
-  !__dl_overflow(dl_b, cpus, p->dl.dl_bw, new_bw)) {
+  !__dl_overflow(dl_b, rd_capacity(task_rq(p)), p->dl.dl_bw, 
new_bw)) {
/*
 * XXX this is slightly incorrect: when the task
 * utilization decreases, we should delay the total
@@ -2689,7 +2698,7 @@ int dl_task_can_attach(struct task_struct *p, const 
struct cpumask *cs_cpus_allo
dl_b = dl_bw_of(dest_cpu);
raw_spin_lock_irqsave(_b->lock, flags);
cpus = dl_bw_cpus(dest_cpu);
-   overflow = __dl_overflow(dl_b, cpus, 0, p->dl.dl_bw);
+   overflow = __dl_overflow(dl_b, rd_capacity(cpu_rq(dest_cpu)), 0, 
p->dl.dl_bw);
if (overflow) {
ret = -EBUSY;
} 

[RFC PATCH 3/6] sched/dl: Try better placement even for deadline tasks that do not block

2019-05-05 Thread Luca Abeni
From: luca abeni 

Currently, the scheduler tries to find a proper placement for
SCHED_DEADLINE tasks when they are pushed out of a core or when
they wake up. Hence, if there is a single SCHED_DEADLINE task
that never blocks and wakes up, such a task is never migrated to
an appropriate CPU core, but continues to execute on its original
core.

This commit addresses the issue by trying to migrate a SCHED_DEADLINE
task (searching for an appropriate CPU core) the first time it is
throttled.

Signed-off-by: luca abeni 
---
 include/linux/sched.h   |  1 +
 kernel/sched/deadline.c | 53 -
 kernel/sched/sched.h|  2 ++
 3 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 863f70843875..5e322c8a94e0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -560,6 +560,7 @@ struct sched_dl_entity {
unsigned intdl_yielded: 1;
unsigned intdl_non_contending : 1;
unsigned intdl_overrun: 1;
+   unsigned intdl_adjust : 1;
 
/*
 * Bandwidth enforcement timer. Each -deadline task has its
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 3436f3d8fa8f..db471889196b 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -515,6 +515,7 @@ static inline bool need_pull_dl_task(struct rq *rq, struct 
task_struct *prev)
return dl_task(prev);
 }
 
+static DEFINE_PER_CPU(struct callback_head, dl_migrate_head);
 static DEFINE_PER_CPU(struct callback_head, dl_push_head);
 static DEFINE_PER_CPU(struct callback_head, dl_pull_head);
 
@@ -1149,6 +1150,32 @@ static u64 grub_reclaim(u64 delta, struct rq *rq, struct 
sched_dl_entity *dl_se)
return (delta * u_act) >> BW_SHIFT;
 }
 
+#ifdef CONFIG_SMP
+static int find_later_rq(struct task_struct *task);
+
+static void migrate_dl_task(struct rq *rq)
+{
+   struct task_struct *t = rq->migrating_task;
+   struct sched_dl_entity *dl_se = >dl;
+   int cpu = find_later_rq(t);
+
+   if ((cpu != -1) && (cpu != rq->cpu)) {
+   struct rq *later_rq;
+
+   later_rq = cpu_rq(cpu);
+
+   double_lock_balance(rq, later_rq);
+   sub_running_bw(>dl, >dl);
+   sub_rq_bw(>dl, >dl);
+   set_task_cpu(t, later_rq->cpu);
+   add_rq_bw(>dl, _rq->dl);
+   add_running_bw(>dl, _rq->dl);
+   double_unlock_balance(rq, later_rq);
+   }
+   rq->migrating_task = NULL;
+   dl_se->dl_adjust = 0;
+}
+#endif
 /*
  * Update the current task's runtime statistics (provided it is still
  * a -deadline task and has not been removed from the dl_rq).
@@ -1223,8 +1250,17 @@ static void update_curr_dl(struct rq *rq)
dl_se->dl_overrun = 1;
 
__dequeue_task_dl(rq, curr, 0);
-   if (unlikely(dl_se->dl_boosted || !start_dl_timer(curr)))
+   if (unlikely(dl_se->dl_boosted || !start_dl_timer(curr))) {
enqueue_task_dl(rq, curr, ENQUEUE_REPLENISH);
+#ifdef CONFIG_SMP
+   } else if (dl_se->dl_adjust) {
+   if (rq->migrating_task == NULL) {
+   queue_balance_callback(rq, 
_cpu(dl_migrate_head, rq->cpu), migrate_dl_task);
+   rq->migrating_task = current;
+   } else
+   printk_deferred("Throttled task before migratin 
g the previous one???\n");
+#endif
+   }
 
if (!is_leftmost(curr, >dl))
resched_curr(rq);
@@ -1573,13 +1609,12 @@ static void yield_task_dl(struct rq *rq)
 
 #ifdef CONFIG_SMP
 
-static int find_later_rq(struct task_struct *task);
-
 static int
 select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
 {
struct task_struct *curr;
struct rq *rq;
+   bool het;
 
if (sd_flag != SD_BALANCE_WAKE)
goto out;
@@ -1591,6 +1626,7 @@ select_task_rq_dl(struct task_struct *p, int cpu, int 
sd_flag, int flags)
 
rcu_read_lock();
curr = READ_ONCE(rq->curr); /* unlocked access */
+   het = static_branch_unlikely(_asym_cpucapacity);
 
/*
 * If we are dealing with a -deadline task, we must
@@ -1604,15 +1640,17 @@ select_task_rq_dl(struct task_struct *p, int cpu, int 
sd_flag, int flags)
if ((unlikely(dl_task(curr)) &&
(curr->nr_cpus_allowed < 2 ||
 !dl_entity_preempt(>dl, >dl)) &&
-   (p->nr_cpus_allowed > 1)) ||
-   static_branch_unlikely(_asym_cpucapacity)) {
+   (p->nr_cpus_allowed > 1)) || het) {
int target = find_later_rq(p);
 
if (target != -1 &&
(dl_time_before(p->dl.deadline,

[RFC PATCH 0/6] Capacity awareness for SCHED_DEADLINE

2019-05-05 Thread Luca Abeni
From: luca abeni 

The SCHED_DEADLINE scheduling policy currently has some issues with
asymmetric CPU capacity architectures (such as ARM big.LITTLE).
In particular, the admission control mechanism does not work correctly
(because it considers all cores to have the same speed of the fastest
core), and the scheduler does not consider the cores' speed when
migrating tasks. 

This patchset fixes the issues by explicitly considering the cores'
capacities in the admission control mechanism and in tasks' migration.

In particular, the scheduler is improved so that "heavyweight tasks"
(processes or threads having a runtime that on LITTLE cores becomes
larger than the relative deadline) are scheduled on big cores. This
allows respecting deadlines that are missed by the current scheduler.

Moreover, the migration logic is modified so that "lightweight tasks"
(processes or threads having a runtime that on LITTLE cores is still
smaller than the relative deadline) are scheduled on LITTLE cores
when possible. This allows saving some energy without missing deadlines. 
 

luca abeni (6):
  sched/dl: Improve deadline admission control for asymmetric CPU
capacities
  sched/dl: Capacity-aware migrations
  sched/dl: Try better placement even for deadline tasks that do not
block
  sched/dl: Improve capacity-aware wakeup
  sched/dl: If the task does not fit anywhere, select the fastest core
  sched/dl: Try not to select a too fast core

 drivers/base/arch_topology.c   |  1 +
 include/linux/sched.h  |  1 +
 include/linux/sched/topology.h |  3 ++
 kernel/sched/core.c|  2 +
 kernel/sched/cpudeadline.c | 53 ++--
 kernel/sched/deadline.c| 76 --
 kernel/sched/sched.h   | 16 +--
 kernel/sched/topology.c|  9 
 8 files changed, 143 insertions(+), 18 deletions(-)

-- 
2.20.1



Re: [PATCH v3] drivers: core: Remove glue dirs early only when refcount is 1

2019-05-05 Thread Prateek Sood
On 5/1/19 5:29 PM, Prateek Sood wrote:
> While loading firmware blobs parallely in different threads, it is possible
> to free sysfs node of glue_dirs in device_del() from a thread while another
> thread is trying to add subdir from device_add() in glue_dirs sysfs node.
> 
> CPU1   CPU2
> fw_load_sysfs_fallback()
>   device_add()
> get_device_parent()
>   class_dir_create_and_add()
> kobject_add_internal()
>   create_dir() // glue_dir
> 
>fw_load_sysfs_fallback()
>  device_add()
>get_device_parent()
>  kobject_get() //glue_dir
> 
>   device_del()
> cleanup_glue_dir()
>   kobject_del()
> 
>kobject_add()
>  kobject_add_internal()
>create_dir() // in glue_dir
>  kernfs_create_dir_ns()
> 
>sysfs_remove_dir() //glue_dir->sd=NULL
>sysfs_put() // free glue_dir->sd
> 
>kernfs_new_node()
>  kernfs_get(glue_dir)
> 
> Fix this race by making sure that kernfs_node for glue_dir is released only
> when refcount for glue_dir kobj is 1.
> 
> Signed-off-by: Prateek Sood 
> 
> ---
> 
> Changes from v2->v3:
>  - Added patch version change related comments.
> 
> Changes from v1->v2:
>  - Updated callstack from _request_firmware_load() to 
> fw_load_sysfs_fallback().
> 
> 
>  drivers/base/core.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 4aeaa0c..3955d07 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1820,12 +1820,15 @@ static inline struct kobject *get_glue_dir(struct 
> device *dev)
>   */
>  static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
>  {
> + unsigned int refcount;
> +
>   /* see if we live in a "glue" directory */
>   if (!live_in_glue_dir(glue_dir, dev))
>   return;
>  
>   mutex_lock(_mutex);
> - if (!kobject_has_children(glue_dir))
> + refcount = kref_read(_dir->kref);
> + if (!kobject_has_children(glue_dir) && !--refcount)
>   kobject_del(glue_dir);
>   kobject_put(glue_dir);
>   mutex_unlock(_mutex);
> 

Folks,

Please share feedback on the race condition and the patch to
fix it.

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation
Center, Inc., is a member of Code Aurora Forum, a Linux Foundation
Collaborative Project


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

2019-05-05 Thread Stephen Rothwell
Hi Jens,

After merging the block tree, today's linux-next build (x86_64
allmodconfig) failed like this:

fs/gfs2/lops.c: In function 'gfs2_end_log_read':
fs/gfs2/lops.c:394:49: error: macro "bio_for_each_segment_all" passed 4 
arguments, but takes just 3
  bio_for_each_segment_all(bvec, bio, i, iter_all) {
 ^
fs/gfs2/lops.c:394:2: error: 'bio_for_each_segment_all' undeclared (first use 
in this function); did you mean 'bio_first_page_all'?
  bio_for_each_segment_all(bvec, bio, i, iter_all) {
  ^~~~
  bio_first_page_all
fs/gfs2/lops.c:394:2: note: each undeclared identifier is reported only once 
for each function it appears in
fs/gfs2/lops.c:394:26: error: expected ';' before '{' token
  bio_for_each_segment_all(bvec, bio, i, iter_all) {
  ^~
  ;

Caused by commit

  2b070cfe582b ("block: remove the i argument to bio_for_each_segment_all")

interacting with commit

  e21e191994af ("gfs2: read journal in large chunks")

from the gfs2 tree.

I have applied the following patch for today:

From: Stephen Rothwell 
Date: Mon, 6 May 2019 14:57:42 +1000
Subject: [PATCH] gfs2: fix for "block: remove the i argument to 
bio_for_each_segment_all"

Signed-off-by: Stephen Rothwell 
---
 fs/gfs2/lops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 3b3dd2ef53f7..33ab662c9aac 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -388,10 +388,9 @@ static void gfs2_end_log_read(struct bio *bio)
 {
struct page *page;
struct bio_vec *bvec;
-   int i;
struct bvec_iter_all iter_all;
 
-   bio_for_each_segment_all(bvec, bio, i, iter_all) {
+   bio_for_each_segment_all(bvec, bio, iter_all) {
page = bvec->bv_page;
if (bio->bi_status) {
int err = blk_status_to_errno(bio->bi_status);
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell


pgp1xWzqhJKnW.pgp
Description: OpenPGP digital signature


Re: [PATCH] md: properly lock and unlock in rdev_attr_store()

2019-05-05 Thread Lukas Bulwahn



On Mon, 29 Apr 2019, NeilBrown wrote:

> On Sun, Apr 28 2019, Lukas Bulwahn wrote:
> 
> > rdev_attr_store() should lock and unlock mddev->reconfig_mutex in a
> > balanced way with mddev_lock() and mddev_unlock().
> 
> It does.
> 
> >
> > But when rdev->mddev is NULL, rdev_attr_store() would try to unlock
> > without locking before. Resolve this locking issue..
> 
> This is incorrect.
> 
> >
> > This locking issue was detected with Clang Thread Safety Analyser:
> 
> Either the Clang Thread Safety Analyser is broken, or you used it
> incorrectly.
>

Please ignore this patch.

Clang Thread Safety Analyser cannot handle the original code, but can
handle my semantically equivalent code. I did not get that at first, and
thought I fixed an issue, but I did not.

Sorry for the noise.

Lukas
 
> >
> > drivers/md/md.c:3393:3: warning: releasing mutex 'mddev->reconfig_mutex' 
> > that was not held [-Wthread-safety-analysis]
> > mddev_unlock(mddev);
> > ^
> >
> > This warning was reported after annotating mutex functions and
> > mddev_lock() and mddev_unlock().
> >
> > Fixes: 27c529bb8e90 ("md: lock access to rdev attributes properly")
> > Link: 
> > https://groups.google.com/d/topic/clang-built-linux/CvBiiQLB0H4/discussion
> > Signed-off-by: Lukas Bulwahn 
> > ---
> > Arnd, Neil, here a proposal to fix lock and unlocking asymmetry.
> >
> > I quite sure that if mddev is NULL, it should just return.
> 
> If mddev is NULL, the code does return (with -EBUSY).  All you've done
> is change things so it returns from a different part of the code.  You
> haven't changed the behaviour at all.
> 
> >
> > I am still puzzled if the return value from mddev_lock() should be really
> > return by rdev_attr_store() when it is not 0. But that was the behaviour
> > before, so I will keep it that way.
> 
> Certainly it should. mddev_lock() either returns 0 to indicate success
> or -EINTR if it received a signal.
> If it was interrupted by a signal, then rdev_attr_store() should return
> -EINTR as well.
> 
> As Arnd tried to explain, the only possible problem here is that the C
> compiler is allowed to assume that rdev->mddev never changes value, so
> in
>rv = mddev ? mddev_lock(mddev) : =EBUSY
> 
> it could load rdev->mddev, test if it is NULL, then load it again and
> pass that value to mddev_lock() - the new value might be NULL which
> would cause problems.
> 
> This could be fixed by changing
> 
>   struct mddev *mddev = rdev->mddev;
> to
>   struct mddev *mddev = READ_ONCE(rdev->mddev);
> 
> That is the only change that might be useful here.
> 
> NeilBrown
> 
> 
> >
> >  drivers/md/md.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/md/md.c b/drivers/md/md.c
> > index 05b8b769..a9735d8f1e70 100644
> > --- a/drivers/md/md.c
> > +++ b/drivers/md/md.c
> > @@ -3384,7 +3384,9 @@ rdev_attr_store(struct kobject *kobj, struct 
> > attribute *attr,
> > return -EIO;
> > if (!capable(CAP_SYS_ADMIN))
> > return -EACCES;
> > -   rv = mddev ? mddev_lock(mddev): -EBUSY;
> > +   if (!mddev)
> > +   return -EBUSY;
> > +   rv = mddev_lock(mddev);
> > if (!rv) {
> > if (rdev->mddev == NULL)
> > rv = -EBUSY;
> > -- 
> > 2.17.1
> 


Re: [PATCH 4/7] dmaengine: sprd: Add device validation to support multiple controllers

2019-05-05 Thread Baolin Wang
Hi Vinod,

On Thu, 2 May 2019 at 14:01, Vinod Koul  wrote:
>
> On 30-04-19, 16:53, Baolin Wang wrote:
> > Hi Vinod,
> >
> > On Tue, 30 Apr 2019 at 16:34, Baolin Wang  wrote:
> > >
> > > On Tue, 30 Apr 2019 at 16:30, Vinod Koul  wrote:
> > > >
> > > > On 30-04-19, 13:30, Baolin Wang wrote:
> > > > > On Mon, 29 Apr 2019 at 22:05, Vinod Koul  wrote:
> > > > > >
> > > > > > On 29-04-19, 20:20, Baolin Wang wrote:
> > > > > > > On Mon, 29 Apr 2019 at 19:57, Vinod Koul  wrote:
> > > > > > > >
> > > > > > > > On 15-04-19, 20:14, Baolin Wang wrote:
> > > > > > > > > From: Eric Long 
> > > > > > > > >
> > > > > > > > > Since we can support multiple DMA engine controllers, we 
> > > > > > > > > should add
> > > > > > > > > device validation in filter function to check if the correct 
> > > > > > > > > controller
> > > > > > > > > to be requested.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Eric Long 
> > > > > > > > > Signed-off-by: Baolin Wang 
> > > > > > > > > ---
> > > > > > > > >  drivers/dma/sprd-dma.c |5 +
> > > > > > > > >  1 file changed, 5 insertions(+)
> > > > > > > > >
> > > > > > > > > diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> > > > > > > > > index 0f92e60..9f99d4b 100644
> > > > > > > > > --- a/drivers/dma/sprd-dma.c
> > > > > > > > > +++ b/drivers/dma/sprd-dma.c
> > > > > > > > > @@ -1020,8 +1020,13 @@ static void sprd_dma_free_desc(struct 
> > > > > > > > > virt_dma_desc *vd)
> > > > > > > > >  static bool sprd_dma_filter_fn(struct dma_chan *chan, void 
> > > > > > > > > *param)
> > > > > > > > >  {
> > > > > > > > >   struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
> > > > > > > > > + struct of_phandle_args *dma_spec =
> > > > > > > > > + container_of(param, struct of_phandle_args, 
> > > > > > > > > args[0]);
> > > > > > > > >   u32 slave_id = *(u32 *)param;
> > > > > > > > >
> > > > > > > > > + if (chan->device->dev->of_node != dma_spec->np)
> > > > > > > >
> > > > > > > > Are you not using of_dma_find_controller() that does this, so 
> > > > > > > > this would
> > > > > > > > be useless!
> > > > > > >
> > > > > > > Yes, we can use of_dma_find_controller(), but that will be a 
> > > > > > > little
> > > > > > > complicated than current solution. Since we need introduce one
> > > > > > > structure to save the node to validate in the filter function like
> > > > > > > below, which seems make things complicated. But if you still like 
> > > > > > > to
> > > > > > > use of_dma_find_controller(), I can change to use it in next 
> > > > > > > version.
> > > > > >
> > > > > > Sorry I should have clarified more..
> > > > > >
> > > > > > of_dma_find_controller() is called by xlate, so you already run this
> > > > > > check, so why use this :)
> > > > >
> > > > > The of_dma_find_controller() can save the requested device node into
> > > > > dma_spec, and in the of_dma_simple_xlate() function, it will call
> > > > > dma_request_channel() to request one channel, but it did not validate
> > > > > the device node to find the corresponding dma device in
> > > > > dma_request_channel(). So we should in our filter function to validate
> > > > > the device node with the device node specified by the dma_spec. Hope I
> > > > > make things clear.
> > > >
> > > > But dma_request_channel() calls of_dma_request_slave_channel() which
> > > > invokes of_dma_find_controller() why is it broken for you if that is the
> > > > case..
> > >
> > > No,the calling process should be:
> > > dma_request_slave_channel()
> > > --->dma_request_chan()--->of_dma_request_slave_channel()>of_dma_simple_xlate()
> > > > dma_request_channel().
>
> The thing is that this is a generic issue, so fix should be in the core
> and not in the driver. Agree in you case of_dma_find_controller() is not
> invoked, so we should fix that in core
>
> >
> > You can check other drivers, they also will save the device node to
> > validate in their filter function.
> > For example the imx-sdma driver:
> > https://elixir.bootlin.com/linux/v5.1-rc6/source/drivers/dma/imx-sdma.c#L1931
>
> Exactly, more the reason this should be in core :)

Sorry for late reply due to my holiday.

OK, I can move the fix into the core. So I think I will drop this
patch from my patchset, and I will create another patch set to fix the
device node validation issue with converting other drivers which did
the similar things. Thanks.

-- 
Baolin Wang
Best Regards


Re: [PATCH v2] misc: aspeed-lpc-ctrl: Correct return values

2019-05-05 Thread Andrew Jeffery



On Sat, 4 May 2019, at 03:43, Vijay Khemka wrote:
> Corrected some of return values with appropriate meanings and reported
> relevant messages as debug information.
> 
> Signed-off-by: Vijay Khemka 

Thanks for the fixes, this looks okay now. However, was there a reason for
not squashing change into your previous patch that introduced the issues
this fixes? That hasn't been applied yet either as far as I'm aware. I'd prefer
we do that and submit a single, good patch if we can.

Andrew

> ---
>  drivers/misc/aspeed-lpc-ctrl.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/misc/aspeed-lpc-ctrl.c 
> b/drivers/misc/aspeed-lpc-ctrl.c
> index 332210e06e98..aca13779764a 100644
> --- a/drivers/misc/aspeed-lpc-ctrl.c
> +++ b/drivers/misc/aspeed-lpc-ctrl.c
> @@ -93,8 +93,8 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, 
> unsigned int cmd,
>  
>   /* If memory-region is not described in device tree */
>   if (!lpc_ctrl->mem_size) {
> - dev_err(dev, "Didn't find reserved memory\n");
> - return -EINVAL;
> + dev_dbg(dev, "Didn't find reserved memory\n");
> + return -ENXIO;
>   }
>  
>   map.size = lpc_ctrl->mem_size;
> @@ -134,16 +134,16 @@ static long aspeed_lpc_ctrl_ioctl(struct file 
> *file, unsigned int cmd,
>  
>   if (map.window_type == ASPEED_LPC_CTRL_WINDOW_FLASH) {
>   if (!lpc_ctrl->pnor_size) {
> - dev_err(dev, "Didn't find host pnor flash\n");
> - return -EINVAL;
> + dev_dbg(dev, "Didn't find host pnor flash\n");
> + return -ENXIO;
>   }
>   addr = lpc_ctrl->pnor_base;
>   size = lpc_ctrl->pnor_size;
>   } else if (map.window_type == ASPEED_LPC_CTRL_WINDOW_MEMORY) {
>   /* If memory-region is not described in device tree */
>   if (!lpc_ctrl->mem_size) {
> - dev_err(dev, "Didn't find reserved memory\n");
> - return -EINVAL;
> + dev_dbg(dev, "Didn't find reserved memory\n");
> + return -ENXIO;
>   }
>   addr = lpc_ctrl->mem_base;
>   size = lpc_ctrl->mem_size;
> @@ -239,7 +239,7 @@ static int aspeed_lpc_ctrl_probe(struct 
> platform_device *pdev)
>   of_node_put(node);
>   if (rc) {
>   dev_err(dev, "Couldn't address to resource for reserved 
> memory\n");
> - return -ENOMEM;
> + return -ENXIO;
>   }
>  
>   lpc_ctrl->mem_size = resource_size();
> -- 
> 2.17.1
> 
>


Re: [PATCH 19/28] locking/lockdep: Optimize irq usage check when marking lock usage bit

2019-05-05 Thread Yuyang Du
On Mon, 6 May 2019 at 11:05, Yuyang Du  wrote:
>
> On Tue, 30 Apr 2019 at 20:12, Peter Zijlstra  wrote:
> > > > IOW he's going to massively explode this storage.
> > >
> > > If I understand correctly, he is not going to.
> > >
> > > First of all, we can divide the whole usage thing into tracking and 
> > > checking.
> > >
> > > Frederic's fine-grained soft vector state is applied to usage
> > > tracking, i.e., which specific vectors a lock is used or enabled.
> > >
> > > But for usage checking, which vectors are does not really matter. So,
> > > the current size of the arrays and bitmaps are good enough. Right?
> >
> > Frederic? My understanding was that he really was going to split the
> > whole thing. The moment you allow masking individual soft vectors, you
> > get per-vector dependency chains.
>
> It seems so. What I understand is: for IRQ usage, the difference is:
>
> Each lock has a new usage mask:
>
> softirq10, ..., softirq1, hardirq
>
> where softirq1 | softirq2 | ... | softirq10 = softirq
>
> where softirq, exactly what was, virtually is used in the checking.
> This is mainly because, any irq vector has any usage, the lock has
> that usage, be it hard or soft.
>
> If that is right, hardirq can be split too (why not if softirq does
> :)). So, maybe a bitmap to do them all for tracking, and optionally
> maintain aggregate softirq and hardirq for checking as before.
> Regardless, may irq-safe reachability thing is not affected.
>
> And for the chain, which is mainly for caching does not really matter
> split or not (either way, the outcome will be the same?), because
> there will be a hash for a chain anyway, which is the same. Right?

Oh, another look at the patch, I was wrong, it can be very different
if consider: used in vector X vs. enabled on vector Y (which is ok),
when enablement can be so fine-grained as well, which is actually the
point of the patch, though no difference for now :(


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

2019-05-05 Thread Paul Gortmaker
[Fwd: linux-next: build failure after merge of the kbuild tree] On 06/05/2019 
(Mon 11:19) Masahiro Yamada wrote:

> Hi Paul,
> 
> In today's linux-next build testing,
> more "make ... explicitly non-modular"
> candidates showed up.
> 

Hi Masahiro,

I am not 100% clear on what you are asking me.  There are lots and lots
of these in the kernel many fixed, and many remain unfortunately.

> arch/arm/plat-omap/dma.c
> drivers/clocksource/timer-ti-dm.c
> drivers/mfd/omap-usb-host.c
> drivers/mfd/omap-usb-tll.c

None of these are "new".  I just checked, and I have had patches for all
these for a long time, in my personal queue, found by my audits.

> Would you send patches?

It isn't that simple.  I wish it was.  Some subsystem maintainers are
glad to take the patches, and some think they are a waste of time and
reject them immediately.  Some I've sent just simply get "crickets".

What that means is, that I need to look at each maintainer's
requirements, and ensure the patch and commit log are matching
expectatins - I will not just spam out hundreds of patches across all
subsystems.  Anyone who has spent considerable time in linux development
knows that is a recipe for failure.

So I need to work across each subsystem - one at a time, with their
individual maintainer requirements in mind, and if you look at git
history, you will see that has been what I've tried to do when I had
free time to work on fixing these across the whole linux tree.

But fortunately, none of these represent a CVE/security issue, so I've
never had a reason to try and pretend there was any reason for an
immediate fix/merge - they just represent a better attention to detail
in the code we merge and support that I'd like to see happen tree-wide.

I appreciate that you are also interested in seeing all these fixed, and
I also wish they could all be solved in one version, but unfortunately I
don't think that is pragmatic.  So in the meantime, I will continue to
chip away at things when we are early in the dev cycle and not starting
the two week merge window, as we are just now.

Thanks,
Paul.
--

> 
> I think EXPORT_SYMBOL_GPL() in omap-usb-tll.c
> are also unnecessary.
> 
> Thanks.
> 
> 
> 
> -- Forwarded message -
> From: Stephen Rothwell 
> Date: Mon, May 6, 2019 at 8:51 AM
> Subject: linux-next: build failure after merge of the kbuild tree
> To: Masahiro Yamada 
> Cc: Linux Next Mailing List , Linux Kernel
> Mailing List , Alexey Gladkov
> , Keshava Munegowda ,
> Samuel Ortiz 
> 
> 
> Hi Masahiro,
> 
> After merging the kbuild tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> In file included from include/linux/module.h:18,
>  from drivers/mfd/omap-usb-tll.c:21:
> drivers/mfd/omap-usb-tll.c:462:26: error: expected ',' or ';' before
> 'USBHS_DRIVER_NAME'
>  MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
>   ^
> include/linux/moduleparam.h:26:47: note: in definition of macro 
> '__MODULE_INFO'
>= __MODULE_INFO_PREFIX __stringify(tag) "=" info
>^~~~
> include/linux/module.h:164:30: note: in expansion of macro 'MODULE_INFO'
>  #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
>   ^~~
> drivers/mfd/omap-usb-tll.c:462:1: note: in expansion of macro 'MODULE_ALIAS'
>  MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
>  ^~~~
> 
> Caused by commit
> 
>   6a26793a7891 ("moduleparam: Save information about built-in modules
> in separate file")
> 
> USBHS_DRIVER_NAME is not defined and this kbuild tree change has
> exposed it. It has been this way since commit
> 
>   16fa3dc75c22 ("mfd: omap-usb-tll: HOST TLL platform driver")
> 
> From v3.7-rc1 in 2012.
> 
> I have applied the following patch for today.
> 
> From: Stephen Rothwell 
> Date: Mon, 6 May 2019 09:39:14 +1000
> Subject: [PATCH] mfd: omap: remove unused MODULE_ALIAS from omap-usb-tll.c
> 
> USBHS_DRIVER_NAME has never been defined, so this cannot have ever
> been used.
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/mfd/omap-usb-tll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
> index 446713dbee27..1cc8937e8bec 100644
> --- a/drivers/mfd/omap-usb-tll.c
> +++ b/drivers/mfd/omap-usb-tll.c
> @@ -459,7 +459,7 @@ EXPORT_SYMBOL_GPL(omap_tll_disable);
> 
>  MODULE_AUTHOR("Keshava Munegowda ");
>  MODULE_AUTHOR("Roger Quadros ");
> -MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
> +// MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
>  MODULE_LICENSE("GPL v2");
>  MODULE_DESCRIPTION("usb tll driver for TI OMAP EHCI and OHCI controllers");
> 
> --
> 2.20.1
> 
> --
> Cheers,
> Stephen Rothwell
> 
> 
> -- 
> Best Regards
> Masahiro Yamada




[GIT PULL] Hyper-V commits for 5.2

2019-05-05 Thread Sasha Levin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

The following changes since commit 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b:

  Linux 5.1-rc1 (2019-03-17 14:22:26 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git 
tags/hyperv-next-signed

for you to fetch changes up to a3fb7bf369efa296c1fc68aead1b6fb3c735573b:

  drivers: input: serio: Add a module desription to the hyperv_keyboard driver 
(2019-04-23 15:41:40 -0400)

- 
Adding module description to various hyper-v modules

- 
Joseph Salisbury (3):
  drivers: hid: Add a module description line to the hid_hyperv driver
  drivers: hv: Add a module description line to the hv_vmbus driver
  drivers: input: serio: Add a module desription to the hyperv_keyboard 
driver

 drivers/hid/hid-hyperv.c  | 2 ++
 drivers/hv/vmbus_drv.c| 1 +
 drivers/input/serio/hyperv-keyboard.c | 2 ++
 3 files changed, 5 insertions(+)
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAlzPqkQACgkQ3qZv95d3
LNwABg//b9MataFZTizTER4WnV5+PWOeK+gEh5nlpM63vgzkx9G3WYT7XydhdoT4
vaw77zNEMHChyxIEn6s4BLpOk8nAP3L8VyvgxUDSemmjV9/FCDz4D98IoFMeWuWO
97HER2DUC9r/RejYz7qb2lGMesIkAFZkYAFdcg8coswP1WWS5dM0CnyTFb7wjvFu
MVRHCH3W6i55sZVid2YE2qm2gmza8wIJYkggoTUwKeRcOWyz1s9VNknpTi/8BaeK
0dsnrvfw7jdYL89QKkU4J4n8EycyNopibK2d35kj/6KiMrUs91YXTlncdS68WZ+t
8OhLs7Vk4XV5yxT+LApX0teON7NI5irVzrLNBPkNUcBRwRWD0oJhHCfy4p5ulEQ2
yKWEHJ4noZNGeJvrjEuhEn+mGKxjk8zvxY39qXUddWT2MXyjVyUtyxykDlYFLd+H
b3a3qDIrR/QM5jTmA/xoxjwFoqJnjcMakdz2kZAVqeNVHEi20lQrZJFa1RBw4dD/
hw1SOZUI6thDn4QCTPVJiva4w+zEqCocm1+qwoFevMig0LSH7+IymBde5S7heha6
Hj0BTKKsQndhD/utA8HWpBebfmZSqA0vK8SSfIcPLlAxU9QVeiYU/0qgLEpqFN5/
LCmbe0THf4RdryqJWjZbLe8qRzrhNEetSQibEPY+QuiiOeZJBjw=
=vWC7
-END PGP SIGNATURE-


[PATCH 1/2] ARM: dts: imx6sl: Assign corresponding clocks instead of dummy clock

2019-05-05 Thread Anson Huang
i.MX6SL's KPP and WDOG use IMX6SL_CLK_IPG as clock root,
assign IMX6SL_CLK_IPG to them instead of IMX6SL_CLK_DUMMY.

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx6sl.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 9ddbeea..9393f03 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -495,7 +495,7 @@
compatible = "fsl,imx6sl-kpp", "fsl,imx21-kpp";
reg = <0x020b8000 0x4000>;
interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6SL_CLK_DUMMY>;
+   clocks = < IMX6SL_CLK_IPG>;
status = "disabled";
};
 
@@ -503,14 +503,14 @@
compatible = "fsl,imx6sl-wdt", "fsl,imx21-wdt";
reg = <0x020bc000 0x4000>;
interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6SL_CLK_DUMMY>;
+   clocks = < IMX6SL_CLK_IPG>;
};
 
wdog2: wdog@20c {
compatible = "fsl,imx6sl-wdt", "fsl,imx21-wdt";
reg = <0x020c 0x4000>;
interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6SL_CLK_DUMMY>;
+   clocks = < IMX6SL_CLK_IPG>;
status = "disabled";
};
 
-- 
2.7.4



[PATCH 2/2] ARM: dts: imx6qdl: Assign corresponding clocks instead of dummy clock

2019-05-05 Thread Anson Huang
i.MX6Q/DL's WDOGs use IMX6QDL_CLK_IPG as clock root, assign
IMX6QDL_CLK_IPG to them instead of IMX6QDL_CLK_DUMMY.

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index b3a77bc..664f7b5 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -675,14 +675,14 @@
compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
reg = <0x020bc000 0x4000>;
interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6QDL_CLK_DUMMY>;
+   clocks = < IMX6QDL_CLK_IPG>;
};
 
wdog2: wdog@20c {
compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
reg = <0x020c 0x4000>;
interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6QDL_CLK_DUMMY>;
+   clocks = < IMX6QDL_CLK_IPG>;
status = "disabled";
};
 
-- 
2.7.4



Re: [PATCH v6] ARM: dts: aspeed: Adding Lenovo Hr630 BMC

2019-05-05 Thread Andrew Jeffery



On Sun, 5 May 2019, at 15:38, Andrew Peng wrote:
> Initial introduction of Lenovo Hr630 family equipped with
> Aspeed 2500 BMC SoC. Hr630 is a x86 server development kit
> with a ASPEED ast2500 BMC manufactured by Lenovo.
> Specifically, This adds the Hr630 platform device tree file
> used by the Hr630 BMC machines.
> 
> This also adds an entry of Hr630 device tree file in Makefile
> 
> Signed-off-by: Andrew Peng 
> Signed-off-by: Yonghui Liu 
> Signed-off-by: Lisa Liu 

Reviewed-by: Andrew Jeffery 

> ---
> Changes in v6:
>  - add appropriate pinctrl property for uar1, uart2, uart3 and adc.
>  - remove vhub definition and comment.
>  - remove some GPIO definitions.
>  - revise Makefile according to sort alphabetically.
> Changes in v5:
>  - revise pca9545 and pca9546 switch aliases name.
> Changes in v4:
>  - add pca9546 switch aliases name.
> Changes in v3:
>  - revise i2c switch aliases name.
> Changes in v2:
>  - add i2c switch aliases name.
>  - remove the unused eeprom device from DT file.
>  - remove "Licensed under..." sentence.
> 
>  arch/arm/boot/dts/Makefile|   1 +
>  arch/arm/boot/dts/aspeed-bmc-lenovo-hr630.dts | 566 
> ++
>  2 files changed, 567 insertions(+)
>  create mode 100644 arch/arm/boot/dts/aspeed-bmc-lenovo-hr630.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index f4f5aea..1276167 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -1255,6 +1255,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \
>   aspeed-bmc-facebook-cmm.dtb \
>   aspeed-bmc-facebook-tiogapass.dtb \
>   aspeed-bmc-intel-s2600wf.dtb \
> + aspeed-bmc-lenovo-hr630.dtb \
>   aspeed-bmc-opp-lanyang.dtb \
>   aspeed-bmc-opp-palmetto.dtb \
>   aspeed-bmc-opp-romulus.dtb \
> diff --git a/arch/arm/boot/dts/aspeed-bmc-lenovo-hr630.dts 
> b/arch/arm/boot/dts/aspeed-bmc-lenovo-hr630.dts
> new file mode 100644
> index 000..d3695a3
> --- /dev/null
> +++ b/arch/arm/boot/dts/aspeed-bmc-lenovo-hr630.dts
> @@ -0,0 +1,566 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Device Tree file for Lenovo Hr630 platform
> + *
> + * Copyright (C) 2019-present Lenovo
> + */
> +
> +/dts-v1/;
> +
> +#include "aspeed-g5.dtsi"
> +#include 
> +
> +/ {
> + model = "HR630 BMC";
> + compatible = "lenovo,hr630-bmc", "aspeed,ast2500";
> +
> + aliases {
> + i2c14 = _rbp;
> + i2c15 = _fbp1;
> + i2c16 = _fbp2;
> + i2c17 = _fbp3;
> + i2c18 = _riser2;
> + i2c19 = _pcie4;
> + i2c20 = _riser1;
> + i2c21 = _ocp;
> + };
> +
> + chosen {
> + stdout-path = 
> + bootargs = "console=tty0 console=ttyS4,115200 earlyprintk";
> + };
> +
> + memory@8000 {
> + device_type = "memory";
> + reg = <0x8000 0x2000>;
> + };
> +
> + reserved-memory {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + flash_memory: region@9800 {
> + no-map;
> + reg = <0x9800 0x0010>; /* 1M */
> + };
> +
> + gfx_memory: framebuffer {
> + size = <0x0100>;
> + alignment = <0x0100>;
> + compatible = "shared-dma-pool";
> + reusable;
> + };
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> +
> + heartbeat {
> + gpios = < ASPEED_GPIO(J, 1) GPIO_ACTIVE_LOW>;
> + };
> +
> + fault {
> + gpios = < ASPEED_GPIO(J, 0) GPIO_ACTIVE_LOW>;
> + };
> + };
> +
> + iio-hwmon {
> + compatible = "iio-hwmon";
> + io-channels = < 0>, < 1>, < 2>, < 3>,
> + < 4>, < 5>, < 6>, < 7>,
> + < 8>, < 9>, < 10>,
> + < 12>, < 13>, < 14>;
> + };
> +
> +};
> +
> + {
> + status = "okay";
> + flash@0 {
> + status = "okay";
> + m25p,fast-read;
> + label = "bmc";
> + spi-max-frequency = <5000>;
> +#include "openbmc-flash-layout.dtsi"
> + };
> +};
> +
> +_ctrl {
> + status = "okay";
> + memory-region = <_memory>;
> + flash = <>;
> +};
> +
> + {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <_txd1_default
> + _rxd1_default>;
> +};
> +
> + {
> + /* Rear RS-232 connector */
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <_txd2_default
> + _rxd2_default
> + _nrts2_default
> + _ndtr2_default
> + _ndsr2_default
> + _ncts2_default
> + _ndcd2_default
> + _nri2_default>;
> +};
> +
> + {
> + status = "okay";

Re: [patch 0/3] do not raise timer softirq unconditionally (spinlockless version)

2019-05-05 Thread Marcelo Tosatti
On Mon, Apr 15, 2019 at 05:12:13PM -0300, Marcelo Tosatti wrote:
> For isolated CPUs, we'd like to skip awakening ktimersoftd
> (the switch to and then back from ktimersoftd takes 10us in
> virtualized environments, in addition to other OS overhead,
> which exceeds telco requirements for packet forwarding for
> 5G) from the sched tick.
> 
> The patch "timers: do not raise softirq unconditionally" from Thomas
> attempts to address that by checking, in the sched tick, whether its
> necessary to raise the timer softirq. Unfortunately, it attempts to grab
> the tvec base spinlock which generates the issue described in the patch
> "Revert "timers: do not raise softirq unconditionally"".
> 
> tvec_base->lock protects addition of timers to the wheel versus
> timer interrupt execution.
> 
> This patch does not grab the tvec base spinlock from irq context,
> but rather performs a lockless access to base->pending_map.
> 
> It handles the the race between timer addition and timer interrupt
> execution by unconditionally (in case of isolated CPUs) raising the
> timer softirq after making sure the updated bitmap is visible
> on remote CPUs.
> 
> This patchset reduces cyclictest latency from 25us to 14us
> on my testbox. 
> 
> 

Ping?


Re: [PATCH 19/28] locking/lockdep: Optimize irq usage check when marking lock usage bit

2019-05-05 Thread Yuyang Du
On Tue, 30 Apr 2019 at 20:12, Peter Zijlstra  wrote:
> > > IOW he's going to massively explode this storage.
> >
> > If I understand correctly, he is not going to.
> >
> > First of all, we can divide the whole usage thing into tracking and 
> > checking.
> >
> > Frederic's fine-grained soft vector state is applied to usage
> > tracking, i.e., which specific vectors a lock is used or enabled.
> >
> > But for usage checking, which vectors are does not really matter. So,
> > the current size of the arrays and bitmaps are good enough. Right?
>
> Frederic? My understanding was that he really was going to split the
> whole thing. The moment you allow masking individual soft vectors, you
> get per-vector dependency chains.

It seems so. What I understand is: for IRQ usage, the difference is:

Each lock has a new usage mask:

softirq10, ..., softirq1, hardirq

where softirq1 | softirq2 | ... | softirq10 = softirq

where softirq, exactly what was, virtually is used in the checking.
This is mainly because, any irq vector has any usage, the lock has
that usage, be it hard or soft.

If that is right, hardirq can be split too (why not if softirq does
:)). So, maybe a bitmap to do them all for tracking, and optionally
maintain aggregate softirq and hardirq for checking as before.
Regardless, may irq-safe reachability thing is not affected.

And for the chain, which is mainly for caching does not really matter
split or not (either way, the outcome will be the same?), because
there will be a hash for a chain anyway, which is the same. Right?


Re: [PATCH 1/2] Use list.h instead of file_system_type next

2019-05-05 Thread Matthew Wilcox
On Sun, May 05, 2019 at 09:25:21PM +0300, Tamir Carmeli wrote:
> I just found it weird that there is a proprietary implementation of a
> linked list while surely the kernel already offers well established
> data structures.

It's a singly linked list rather than a doubly linked list.

> IMO, the current code is a bit hard to understand, especially the
> addition of a new struct to the list in the line "*p = fs" after
> find_filesystem returned the last member.
> Correct, I'm not familiar with all the use cases of the code.

It looks like a fairly standard implementation of a singly-linked 
list in C to me.

> I'm not sure that XArray is a good choice since there is no notion of
> an index attached to the pointer, it's really just a linked list of
> pointers.

You don't need to attach an index to the pointer; you can just use
xa_alloc() to store it at the first available index.



[V2 2/2] dmaengine: fsl-qdma: Add improvement

2019-05-05 Thread Peng Ma
When an error occurs we should clean the error register then to return

Signed-off-by: Peng Ma 
---
changed for V2:
- Separate one patch to two patchs

 drivers/dma/fsl-qdma.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c
index 2e8b46b..542765a 100644
--- a/drivers/dma/fsl-qdma.c
+++ b/drivers/dma/fsl-qdma.c
@@ -710,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int irq, void 
*dev_id)
 
intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR);
 
-   if (intr) {
+   if (intr)
dev_err(fsl_qdma->dma_dev.dev, "DMA transaction error!\n");
-   return IRQ_NONE;
-   }
 
qdma_writel(fsl_qdma, FSL_QDMA_DEDR_CLEAR, status + FSL_QDMA_DEDR);
return IRQ_HANDLED;
-- 
1.7.1



[V2 1/2] dmaengine: fsl-qdma: fixed the source/destination descriptor format

2019-05-05 Thread Peng Ma
CMD of Source/Destination descriptor format should be lower of
struct fsl_qdma_engine number data address.

Signed-off-by: Peng Ma 
---
changed for V2:
- Fix descriptor spelling

 drivers/dma/fsl-qdma.c |   25 +
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c
index aa1d0ae..2e8b46b 100644
--- a/drivers/dma/fsl-qdma.c
+++ b/drivers/dma/fsl-qdma.c
@@ -113,6 +113,7 @@
 /* Field definition for Descriptor offset */
 #define QDMA_CCDF_STATUS   20
 #define QDMA_CCDF_OFFSET   20
+#define QDMA_SDDF_CMD(x)   (((u64)(x)) << 32)
 
 /* Field definition for safe loop count*/
 #define FSL_QDMA_HALT_COUNT1500
@@ -214,6 +215,12 @@ struct fsl_qdma_engine {
 
 };
 
+static inline void
+qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val)
+{
+   sddf->data = QDMA_SDDF_CMD(val);
+}
+
 static inline u64
 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)
 {
@@ -341,6 +348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan 
*chan)
 static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
  dma_addr_t dst, dma_addr_t src, u32 len)
 {
+   u32 cmd;
struct fsl_qdma_format *sdf, *ddf;
struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest;
 
@@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp 
*fsl_comp,
 
memset(fsl_comp->virt_addr, 0, FSL_QDMA_COMMAND_BUFFER_SIZE);
memset(fsl_comp->desc_virt_addr, 0, FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
+
/* Head Command Descriptor(Frame Descriptor) */
qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16);
qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf));
@@ -369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct 
fsl_qdma_comp *fsl_comp,
/* This entry is the last entry. */
qdma_csgf_set_f(csgf_dest, len);
/* Descriptor Buffer */
-   sdf->data =
-   cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-   FSL_QDMA_CMD_RWTTYPE_OFFSET);
-   ddf->data =
-   cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-   FSL_QDMA_CMD_RWTTYPE_OFFSET);
-   ddf->data |=
-   cpu_to_le64(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
+   cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+ FSL_QDMA_CMD_RWTTYPE_OFFSET);
+   qdma_sddf_set_cmd(sdf, cmd);
+
+   cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+ FSL_QDMA_CMD_RWTTYPE_OFFSET);
+   cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
+   qdma_sddf_set_cmd(ddf, cmd);
 }
 
 /*
-- 
1.7.1



Fwd: linux-next: build failure after merge of the kbuild tree

2019-05-05 Thread Masahiro Yamada
Hi Paul,

In today's linux-next build testing,
more "make ... explicitly non-modular"
candidates showed up.


arch/arm/plat-omap/dma.c
drivers/clocksource/timer-ti-dm.c
drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c

Would you send patches?

I think EXPORT_SYMBOL_GPL() in omap-usb-tll.c
are also unnecessary.

Thanks.



-- Forwarded message -
From: Stephen Rothwell 
Date: Mon, May 6, 2019 at 8:51 AM
Subject: linux-next: build failure after merge of the kbuild tree
To: Masahiro Yamada 
Cc: Linux Next Mailing List , Linux Kernel
Mailing List , Alexey Gladkov
, Keshava Munegowda ,
Samuel Ortiz 


Hi Masahiro,

After merging the kbuild tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

In file included from include/linux/module.h:18,
 from drivers/mfd/omap-usb-tll.c:21:
drivers/mfd/omap-usb-tll.c:462:26: error: expected ',' or ';' before
'USBHS_DRIVER_NAME'
 MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
  ^
include/linux/moduleparam.h:26:47: note: in definition of macro '__MODULE_INFO'
   = __MODULE_INFO_PREFIX __stringify(tag) "=" info
   ^~~~
include/linux/module.h:164:30: note: in expansion of macro 'MODULE_INFO'
 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
  ^~~
drivers/mfd/omap-usb-tll.c:462:1: note: in expansion of macro 'MODULE_ALIAS'
 MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
 ^~~~

Caused by commit

  6a26793a7891 ("moduleparam: Save information about built-in modules
in separate file")

USBHS_DRIVER_NAME is not defined and this kbuild tree change has
exposed it. It has been this way since commit

  16fa3dc75c22 ("mfd: omap-usb-tll: HOST TLL platform driver")

>From v3.7-rc1 in 2012.

I have applied the following patch for today.

From: Stephen Rothwell 
Date: Mon, 6 May 2019 09:39:14 +1000
Subject: [PATCH] mfd: omap: remove unused MODULE_ALIAS from omap-usb-tll.c

USBHS_DRIVER_NAME has never been defined, so this cannot have ever
been used.

Signed-off-by: Stephen Rothwell 
---
 drivers/mfd/omap-usb-tll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 446713dbee27..1cc8937e8bec 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -459,7 +459,7 @@ EXPORT_SYMBOL_GPL(omap_tll_disable);

 MODULE_AUTHOR("Keshava Munegowda ");
 MODULE_AUTHOR("Roger Quadros ");
-MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
+// MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("usb tll driver for TI OMAP EHCI and OHCI controllers");

--
2.20.1

--
Cheers,
Stephen Rothwell


-- 
Best Regards
Masahiro Yamada


noname
Description: PGP signature


Dear Friend (Assalamu Alaikum),

2019-05-05 Thread AISHA GADDAFI
-- 
Dear Friend (Assalamu Alaikum),

I came across your e-mail contact prior a private search while in need of
your assistance. My name is Aisha  Al-Qaddafi a single Mother and a Widow
with three Children. I am the only biological Daughter of late Libyan
President (Late Colonel Muammar Gaddafi).

I have investment funds worth Twenty Seven Million Five Hundred Thousand
United State Dollar ($27.500.000.00 ) and i need a trusted investment
Manager/Partner because of my current refugee status, however, I am
interested in you for investment project assistance in your country, may be
from there, we can build business relationship in the nearest future.

I am willing to negotiate investment/business profit sharing ratio with you
base on the future investment earning profits.

If you are willing to handle this project on my behalf kindly reply urgent
to enable me provide you more information about the investment funds.

Your Urgent Reply Will Be Appreciated. write me at this email address(
ayishagdda...@mail.com ) for further discussion.

Best Regards
Mrs Aisha Al-Qaddafi
Reply to: ayishagdda...@mail.com


Re: Linux 5.1

2019-05-05 Thread Bhaskar Chowdhury


Thanks, a bunch Linus!

On 18:07 Sun 05 May , Linus Torvalds wrote:

So it's a bit later in the day than I usually do this, just because I
was waffling about the release. Partly because I got some small pull
requests today, but mostly just because I wasn't looking forward to
the timing of this upcoming 5.2 merge window.

But the last-minute pull requests really weren't big enough to justify
delaying things over, and hopefully the merge window timing won't be
all that painful either. I just happen to have the college graduation
of my oldest happen right smack dab in the middle of the upcoming
merge window, so I might be effectively offline for a few days there.
If worst comes to worst, I'll extend it to make it all work, but I
don't think it will be needed.

Anyway, on to 5.1 itself. The past week has been pretty calm, and the
final patch from rc6 is not all that big. The shortlog is appended,
but it's small changes all over. Networking, filesystem code, drivers,
tooling, arch updates. Nothing particularly odd stands out.

Of course, the shortlog below is just for that final calm week. On the
whole, 5.1 looks very normal with just over 13k commits (plus another
1k+ if you count merges). Which is pretty much our normal size these
days. No way to boil that down to a sane shortlog, with work all over.

Go out and test,

   Linus

---

Al Viro (4):
 securityfs: fix use-after-free on symlink traversal
 apparmorfs: fix use-after-free on symlink traversal
 [fix] get rid of checking for absent device name in vfs_get_tree()
 ufs: fix braino in ufs_get_inode_gid() for solaris UFS flavour

Alan Stern (5):
 USB: core: Fix unterminated string returned by usb_string()
 USB: dummy-hcd: Fix failure to give back unlinked URBs
 USB: core: Fix bug caused by duplicate interface PM usage counter
 USB: yurex: Fix protection fault after device removal
 USB: w1 ds2490: Fix bug caused by improper use of altsetting array

Alban Crequy (1):
 tools: bpftool: fix infinite loop in map create

Alex Williamson (1):
 PCI/portdrv: Use shared MSI/MSI-X vector for Bandwidth Management

Alexander Lochmann (1):
 Abort file_remove_privs() for non-reg. files

Alexander Shishkin (2):
 perf/ring_buffer: Fix AUX software double buffering
 perf/x86/intel/pt: Remove software double buffering PMU capability

Alexey Kardashevskiy (1):
 KVM: PPC: Book3S: Protect memslots while validating user address

Andrew Jones (2):
 KVM: arm/arm64: Ensure vcpu target is unset on reset failure
 Documentation: kvm: fix dirty log ioctl arch lists

Andrew Lunn (1):
 net: phy: marvell: Fix buffer overrun with stats counters

Andrey Smirnov (1):
 power: supply: sysfs: prevent endless uevent loop with
CONFIG_POWER_SUPPLY_DEBUG

Anson Huang (1):
 i2c: imx: correct the method of getting private data in notifier_call

Ard Biesheuvel (1):
 i2c: synquacer: fix enumeration of slave devices

Arnaldo Carvalho de Melo (5):
 tools uapi x86: Sync vmx.h with the kernel
 perf bench numa: Add define for RUSAGE_THREAD if not present
 tools build: Add -ldl to the disassembler-four-args feature test
 tools arch uapi: Copy missing unistd.h headers for arc, hexagon and riscv
 perf tools: Remove needless asm/unistd.h include fixing build in
some places

Bhagavathi Perumal S (1):
 mac80211: Fix kernel panic due to use of txq after free

Bjørn Mork (1):
 qmi_wwan: new Wistron, ZTE and D-Link devices

Bo YU (1):
 perf bpf: Return value with unlocking in perf_env__find_btf()

Brian Norris (1):
 ath10k: perform crash dump collection in workqueue

Christoffer Dall (1):
 KVM: arm/arm64: Don't emulate virtual timers on userspace ioctls

Christophe Leroy (1):
 powerpc/32s: Fix BATs setting with CONFIG_STRICT_KERNEL_RWX

Cong Wang (1):
 xfrm: clean up xfrm protocol checks

Dan Carpenter (1):
 net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc

David Ahern (1):
 selftests: fib_rule_tests: Fix icmp proto with ipv6

David Howells (1):
 rxrpc: Fix net namespace cleanup

Dmitry Osipenko (1):
 clk: Add missing stubs for a few functions

Douglas Anderson (1):
 mwifiex: Make resume actually do something useful again on SDIO cards

Emmanuel Grumbach (1):
 iwlwifi: fix driver operation for 5350

Eric Dumazet (6):
 l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv()
 tcp: add sanity tests in tcp_add_backlog()
 ipv6/flowlabel: wait rcu grace period before put_pid()
 l2ip: fix possible use-after-free
 ipv6: fix races in ip6_dst_destroy()
 udp: fix GRO packet of death

Eugeniy Paltsev (1):
 ARC: memset: fix build with L1_CACHE_SHIFT != 6

Fabien Dessenne (1):
 net: ethernet: stmmac: manage the get_irq probe defer case

Gary Hook (1):
 x86/mm/mem_encrypt: Disable all instrumentation for early SME setup

Gerd Hoffmann (1):
 Revert "drm/qxl: drop prime import/export callbacks"

Greg 

[PATCH] quota: add dqi_dirty_list description to comment of Dquot List Management

2019-05-05 Thread Chengguang Xu
Actually there are four lists for dquot management, so add
the description of dqui_dirty_list to comment.

Signed-off-by: Chengguang Xu 
---
 fs/quota/dquot.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba..6a236bdaef89 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -223,9 +223,9 @@ static void put_quota_format(struct quota_format_type *fmt)
 
 /*
  * Dquot List Management:
- * The quota code uses three lists for dquot management: the inuse_list,
- * free_dquots, and dquot_hash[] array. A single dquot structure may be
- * on all three lists, depending on its current state.
+ * The quota code uses four lists for dquot management: the inuse_list,
+ * free_dquots, dqi_dirty_list, and dquot_hash[] array. A single dquot
+ * structure may be on some of those lists, depending on its current state.
  *
  * All dquots are placed to the end of inuse_list when first created, and this
  * list is used for invalidate operation, which must look at every dquot.
@@ -236,6 +236,10 @@ static void put_quota_format(struct quota_format_type *fmt)
  * dqstats.free_dquots gives the number of dquots on the list. When
  * dquot is invalidated it's completely released from memory.
  *
+ * Dirty dquots are added to the dqi_dirty_list of quota_info when mark
+ * dirtied, and this list is searched when writeback diry dquots to
+ * quota file.
+ *
  * Dquots with a specific identity (device, type and id) are placed on
  * one of the dquot_hash[] hash chains. The provides an efficient search
  * mechanism to locate a specific dquot.
-- 
2.17.2



Linux 5.1

2019-05-05 Thread Linus Torvalds
So it's a bit later in the day than I usually do this, just because I
was waffling about the release. Partly because I got some small pull
requests today, but mostly just because I wasn't looking forward to
the timing of this upcoming 5.2 merge window.

But the last-minute pull requests really weren't big enough to justify
delaying things over, and hopefully the merge window timing won't be
all that painful either. I just happen to have the college graduation
of my oldest happen right smack dab in the middle of the upcoming
merge window, so I might be effectively offline for a few days there.
If worst comes to worst, I'll extend it to make it all work, but I
don't think it will be needed.

Anyway, on to 5.1 itself. The past week has been pretty calm, and the
final patch from rc6 is not all that big. The shortlog is appended,
but it's small changes all over. Networking, filesystem code, drivers,
tooling, arch updates. Nothing particularly odd stands out.

Of course, the shortlog below is just for that final calm week. On the
whole, 5.1 looks very normal with just over 13k commits (plus another
1k+ if you count merges). Which is pretty much our normal size these
days. No way to boil that down to a sane shortlog, with work all over.

Go out and test,

Linus

---

Al Viro (4):
  securityfs: fix use-after-free on symlink traversal
  apparmorfs: fix use-after-free on symlink traversal
  [fix] get rid of checking for absent device name in vfs_get_tree()
  ufs: fix braino in ufs_get_inode_gid() for solaris UFS flavour

Alan Stern (5):
  USB: core: Fix unterminated string returned by usb_string()
  USB: dummy-hcd: Fix failure to give back unlinked URBs
  USB: core: Fix bug caused by duplicate interface PM usage counter
  USB: yurex: Fix protection fault after device removal
  USB: w1 ds2490: Fix bug caused by improper use of altsetting array

Alban Crequy (1):
  tools: bpftool: fix infinite loop in map create

Alex Williamson (1):
  PCI/portdrv: Use shared MSI/MSI-X vector for Bandwidth Management

Alexander Lochmann (1):
  Abort file_remove_privs() for non-reg. files

Alexander Shishkin (2):
  perf/ring_buffer: Fix AUX software double buffering
  perf/x86/intel/pt: Remove software double buffering PMU capability

Alexey Kardashevskiy (1):
  KVM: PPC: Book3S: Protect memslots while validating user address

Andrew Jones (2):
  KVM: arm/arm64: Ensure vcpu target is unset on reset failure
  Documentation: kvm: fix dirty log ioctl arch lists

Andrew Lunn (1):
  net: phy: marvell: Fix buffer overrun with stats counters

Andrey Smirnov (1):
  power: supply: sysfs: prevent endless uevent loop with
CONFIG_POWER_SUPPLY_DEBUG

Anson Huang (1):
  i2c: imx: correct the method of getting private data in notifier_call

Ard Biesheuvel (1):
  i2c: synquacer: fix enumeration of slave devices

Arnaldo Carvalho de Melo (5):
  tools uapi x86: Sync vmx.h with the kernel
  perf bench numa: Add define for RUSAGE_THREAD if not present
  tools build: Add -ldl to the disassembler-four-args feature test
  tools arch uapi: Copy missing unistd.h headers for arc, hexagon and riscv
  perf tools: Remove needless asm/unistd.h include fixing build in
some places

Bhagavathi Perumal S (1):
  mac80211: Fix kernel panic due to use of txq after free

Bjørn Mork (1):
  qmi_wwan: new Wistron, ZTE and D-Link devices

Bo YU (1):
  perf bpf: Return value with unlocking in perf_env__find_btf()

Brian Norris (1):
  ath10k: perform crash dump collection in workqueue

Christoffer Dall (1):
  KVM: arm/arm64: Don't emulate virtual timers on userspace ioctls

Christophe Leroy (1):
  powerpc/32s: Fix BATs setting with CONFIG_STRICT_KERNEL_RWX

Cong Wang (1):
  xfrm: clean up xfrm protocol checks

Dan Carpenter (1):
  net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc

David Ahern (1):
  selftests: fib_rule_tests: Fix icmp proto with ipv6

David Howells (1):
  rxrpc: Fix net namespace cleanup

Dmitry Osipenko (1):
  clk: Add missing stubs for a few functions

Douglas Anderson (1):
  mwifiex: Make resume actually do something useful again on SDIO cards

Emmanuel Grumbach (1):
  iwlwifi: fix driver operation for 5350

Eric Dumazet (6):
  l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv()
  tcp: add sanity tests in tcp_add_backlog()
  ipv6/flowlabel: wait rcu grace period before put_pid()
  l2ip: fix possible use-after-free
  ipv6: fix races in ip6_dst_destroy()
  udp: fix GRO packet of death

Eugeniy Paltsev (1):
  ARC: memset: fix build with L1_CACHE_SHIFT != 6

Fabien Dessenne (1):
  net: ethernet: stmmac: manage the get_irq probe defer case

Gary Hook (1):
  x86/mm/mem_encrypt: Disable all instrumentation for early SME setup

Gerd Hoffmann (1):
  Revert "drm/qxl: drop prime import/export callbacks"

Greg Kroah-Hartman (2):
  iwlwifi: 

[PATCH] ARM: dts: Introduce the NXP LS1021A-TSN board

2019-05-05 Thread Vladimir Oltean
The LS1021A-TSN is a development board built by VVDN/Argonboards in
partnership with NXP.

It features the LS1021A SoC and the first-generation SJA1105T Ethernet
switch for prototyping implementations of a subset of IEEE 802.1 TSN
standards.

It has two regular Ethernet ports and four switched, TSN-capable ports.

It also features:
- One Arduino header
- One expansion header
- Two USB 3.0 ports
- One mini PCIe slot
- One SATA interface
- Accelerometer, gyroscope, temperature sensors

Signed-off-by: Vladimir Oltean 
---
 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/ls1021a-tsn.dts | 238 ++
 2 files changed, 240 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/ls1021a-tsn.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index f4f5aeaf3298..529f0150f6b4 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -593,7 +593,8 @@ dtb-$(CONFIG_SOC_IMX7ULP) += \
 dtb-$(CONFIG_SOC_LS1021A) += \
ls1021a-moxa-uc-8410a.dtb \
ls1021a-qds.dtb \
-   ls1021a-twr.dtb
+   ls1021a-twr.dtb \
+   ls1021a-tsn.dtb
 dtb-$(CONFIG_SOC_VF610) += \
vf500-colibri-eval-v3.dtb \
vf610-bk4.dtb \
diff --git a/arch/arm/boot/dts/ls1021a-tsn.dts 
b/arch/arm/boot/dts/ls1021a-tsn.dts
new file mode 100644
index ..5269486699bd
--- /dev/null
+++ b/arch/arm/boot/dts/ls1021a-tsn.dts
@@ -0,0 +1,238 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright 2016-2018 NXP Semiconductors
+ * Copyright 2019 Vladimir Oltean 
+ */
+
+/dts-v1/;
+#include "ls1021a.dtsi"
+
+/ {
+   model = "NXP LS1021A-TSN Board";
+
+   sys_mclk: clock-mclk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <24576000>;
+   };
+
+   regulators {
+   compatible = "simple-bus";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   reg_3p3v: regulator@0 {
+   compatible = "regulator-fixed";
+   reg = <0>;
+   regulator-name = "3P3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-always-on;
+   };
+   reg_2p5v: regulator@1 {
+   compatible = "regulator-fixed";
+   reg = <1>;
+   regulator-name = "2P5V";
+   regulator-min-microvolt = <250>;
+   regulator-max-microvolt = <250>;
+   regulator-always-on;
+   };
+   };
+};
+
+ {
+   tbi-handle = <>;
+   phy-handle = <_phy2>;
+   phy-mode = "sgmii";
+   status = "ok";
+};
+
+ {
+   tbi-handle = <>;
+   phy-handle = <_phy1>;
+   phy-mode = "sgmii";
+   status = "ok";
+};
+
+/* RGMII delays added via PCB traces */
+ {
+   phy-mode = "rgmii";
+   status = "ok";
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+};
+
+ {
+   bus-num = <0>;
+   status = "ok";
+
+   /* ADG704BRMZ 1:4 mux/demux */
+   tsn_switch: sja1105@1 {
+   reg = <0x1>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "nxp,sja1105t";
+   /* 12 MHz */
+   spi-max-frequency = <1200>;
+   /* Sample data on trailing clock edge */
+   spi-cpha;
+   fsl,spi-cs-sck-delay = <1000>;
+   fsl,spi-sck-cs-delay = <1000>;
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   /* ETH5 written on chassis */
+   label = "swp5";
+   phy-handle = <_phy6>;
+   phy-mode = "rgmii-id";
+   reg = <0>;
+   };
+   port@1 {
+   /* ETH2 written on chassis */
+   label = "swp2";
+   phy-handle = <_phy3>;
+   phy-mode = "rgmii-id";
+   reg = <1>;
+   };
+   port@2 {
+   /* ETH3 written on chassis */
+   label = "swp3";
+   phy-handle = <_phy4>;
+   phy-mode = "rgmii-id";
+   reg = <2>;
+   };
+   port@3 {
+   /* ETH4 written on chassis */
+   phy-handle = <_phy5>;
+   label = "swp4";
+   phy-mode = "rgmii-id";
+

linux-next: manual merge of the imx-mxs tree with the arm-soc tree

2019-05-05 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the imx-mxs tree got a conflict in:

  arch/arm64/configs/defconfig

between commit:

  7b0d021fbe41 ("arm64: defconfig: enable PCIE_ALTERA")

from the arm-soc tree and commit:

  a9aa2a812255 ("arm64: defconfig: Enable CONFIG_SPI_IMX")

from the imx-mxs tree.

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

-- 
Cheers,
Stephen Rothwell

diff --cc arch/arm64/configs/defconfig
index 5392c12ef3b7,979a95c915b6..
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@@ -357,7 -365,7 +358,8 @@@ CONFIG_SPI=
  CONFIG_SPI_ARMADA_3700=y
  CONFIG_SPI_BCM2835=m
  CONFIG_SPI_BCM2835AUX=m
+ CONFIG_SPI_IMX=m
 +CONFIG_SPI_NXP_FLEXSPI=y
  CONFIG_SPI_MESON_SPICC=m
  CONFIG_SPI_MESON_SPIFC=m
  CONFIG_SPI_ORION=y


pgph5NDFS8zED.pgp
Description: OpenPGP digital signature


[rcutorture] ba26c41d98: WARNING:at_kernel/rcu/rcutorture.c:#rcu_torture_writer[rcutorture]

2019-05-05 Thread kernel test robot
FYI, we noticed the following commit (built with gcc-7):

commit: ba26c41d985d7c66c6198e0e22cd287434d83a3e ("rcutorture: Fix 
stutter_wait() return value and freelist checks")
https://git.kernel.org/cgit/linux/kernel/git/paulmck/linux-rcu.git 
dev.2019.04.28a

in testcase: rcutorture
with following parameters:

runtime: 300s
test: default
torture_type: srcu

test-description: rcutorture is rcutorture kernel module load/unload test.
test-url: https://www.kernel.org/doc/Documentation/RCU/torture.txt


on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 4G

caused below changes (please refer to attached dmesg/kmsg for entire 
log/backtrace):


++++
|| 
fe661764bc | ba26c41d98 |
++++
| boot_successes | 314  
  | 278|
| boot_failures  | 18   
  | 38 |
| BUG:kernel_reboot-without-warning_in_test_stage| 5
  | 12 |
| WARNING:at_net/sched/sch_generic.c:#dev_watchdog   | 13   
  | 12 |
| RIP:dev_watchdog   | 13   
  | 12 |
| RIP:ring_buffer_lock_reserve   | 1
  ||
| WARNING:at_kernel/rcu/rcutorture.c:#rcu_torture_writer[rcutorture] | 0
  | 14 |
| RIP:rcu_torture_writer[rcutorture] | 0
  | 14 |
| calltrace:irq_exit | 0
  | 8  |
| calltrace:rcu_torture_free | 0
  | 1  |
| RIP:__rb_reserve_next  | 0
  | 1  |
| RIP:lock_release   | 0
  | 1  |
++++


If you fix the issue, kindly add following tag
Reported-by: kernel test robot 


[  348.855994] WARNING: CPU: 1 PID: 605 at kernel/rcu/rcutorture.c:1019 
rcu_torture_writer+0x5e5/0x820 [rcutorture]
[  348.858990] Modules linked in: rcutorture(-) torture ppdev parport_pc 
crct10dif_pclmul crc32c_intel parport rtc_cmos qemu_fw_cfg
[  348.862052] CPU: 1 PID: 605 Comm: rcu_torture_wri Not tainted 
5.1.0-rc1-00106-gba26c41 #1
[  348.864209] RIP: 0010:rcu_torture_writer+0x5e5/0x820 [rcutorture]
[  348.866629] Code: 08 a0 49 8b 06 49 39 c6 75 22 48 8b 55 00 49 8d 46 e8 48 
39 c2 74 15 41 8b 56 f8 4c 89 ee 48 c7 c7 d1 83 05 a0 e8 cb 11 0c e1 <0f> 0b 49 
83 c6 30 4c 39 f3 75 cd e8 9b 68 ff ff 84 c0 0f 84 97 fc
[  348.871198] RSP: 0018:8881185c3eb8 EFLAGS: 00010296
[  348.872442] RAX: 0027 RBX: a0085f78 RCX: 0006
[  348.874957] RDX: 0007 RSI: 0006 RDI: 88813bbd1880
[  348.876675] RBP: a0085f68 R08: 005dd95e1368 R09: 
[  348.878449] R10:  R11:  R12: a005a670
[  348.880333] R13: a0058800 R14: a0084dd8 R15: a0085750
[  348.882924] FS:  () GS:88813ba0() 
knlGS:
[  348.885859] CS:  0010 DS:  ES:  CR0: 80050033
[  348.887797] CR2: 7f89476dc030 CR3: 00011d91e000 CR4: 000406a0
[  348.889811] Call Trace:
[  348.890529]  ? rcu_torture_pipe_update+0x100/0x100 [rcutorture]
[  348.892393]  kthread+0x11c/0x130
[  348.893012]  ? kthread_stop+0x210/0x210
[  348.893792]  ret_from_fork+0x24/0x30
[  348.894627] irq event stamp: 570574
[  348.895346] hardirqs last  enabled at (570573): [] 
console_unlock+0x533/0x5c0
[  348.897770] hardirqs last disabled at (570574): [] 
trace_hardirqs_off_thunk+0x1a/0x1c
[  348.900200] softirqs last  enabled at (570562): [] 
__do_softirq+0x414/0x450
[  348.902187] softirqs last disabled at (570549): [] 
irq_exit+0x67/0xd0
[  348.904076] ---[ end trace 497e668e1ed2342a ]---


To reproduce:

# build kernel
cd linux
cp config-5.1.0-rc1-00106-gba26c41 .config
make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 olddefconfig
make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 prepare
make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 modules_prepare
make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 SHELL=/bin/bash
make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 bzImage


git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
bin/lkp qemu -k  job-script # job-script is attached in this 
email



Thanks,
Rong Chen

#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 5.1.0-rc1 Kernel Configuration
#

#
# Compiler: 

Re: [PATCH v2 1/4] ftrace: Implement fs notification for preempt/irqsoff tracers

2019-05-05 Thread Viktor Rosendahl

On 5/6/19 1:01 AM, Steven Rostedt wrote:
> On Mon,  6 May 2019 00:39:15 +0200
> Viktor Rosendahl  wrote:
>
>> Can you explain more precisely what you agree with?
>>
>> The general idea of being able to trace bursts of latencies?
>
> One thing I have an issue with the current approach is the use of the
> trace file for this.

You mean that using fsnotify is kind of okayish but that it's confusing 
for the

user because only a subset of tracers would send the fsnotify event when the
trace file is updated?

>
> Hmm, what about adding a notifier to tracing_max_latency instead? And
> do it not as a config option, but have it always enabled. It would send a
> notification when it changes, and that only happens when there's a new
> max latency. Would that work for you?


Yes, it seems to be OK since the tracing_max_latency is updated also
with the latest latency that exceeds the threshold when we are using
tracing_thresh. I will try to send a new version of the patch series
soon, with the modifications that have been discussed so far.

best regards,

Viktor


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

2019-05-05 Thread Stephen Rothwell
Hi Masahiro,

After merging the kbuild tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

In file included from include/linux/module.h:18,
 from drivers/mfd/omap-usb-tll.c:21:
drivers/mfd/omap-usb-tll.c:462:26: error: expected ',' or ';' before 
'USBHS_DRIVER_NAME'
 MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
  ^
include/linux/moduleparam.h:26:47: note: in definition of macro '__MODULE_INFO'
   = __MODULE_INFO_PREFIX __stringify(tag) "=" info
   ^~~~
include/linux/module.h:164:30: note: in expansion of macro 'MODULE_INFO'
 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
  ^~~
drivers/mfd/omap-usb-tll.c:462:1: note: in expansion of macro 'MODULE_ALIAS'
 MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
 ^~~~

Caused by commit

  6a26793a7891 ("moduleparam: Save information about built-in modules in 
separate file")

USBHS_DRIVER_NAME is not defined and this kbuild tree change has
exposed it. It has been this way since commit

  16fa3dc75c22 ("mfd: omap-usb-tll: HOST TLL platform driver")

From v3.7-rc1 in 2012.

I have applied the following patch for today.

From: Stephen Rothwell 
Date: Mon, 6 May 2019 09:39:14 +1000
Subject: [PATCH] mfd: omap: remove unused MODULE_ALIAS from omap-usb-tll.c

USBHS_DRIVER_NAME has never been defined, so this cannot have ever
been used.

Signed-off-by: Stephen Rothwell 
---
 drivers/mfd/omap-usb-tll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 446713dbee27..1cc8937e8bec 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -459,7 +459,7 @@ EXPORT_SYMBOL_GPL(omap_tll_disable);
 
 MODULE_AUTHOR("Keshava Munegowda ");
 MODULE_AUTHOR("Roger Quadros ");
-MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
+// MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("usb tll driver for TI OMAP EHCI and OHCI controllers");
 
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell


pgpQ3I18Zg5LI.pgp
Description: OpenPGP digital signature


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

2019-05-05 Thread Stephen Rothwell
Hi Masahiro,

After merging the kbuild tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

In file included from include/linux/module.h:18,
 from drivers/clocksource/timer-ti-dm.c:40:
drivers/clocksource/timer-ti-dm.c:973:26: error: expected ',' or ';' before 
'DRIVER_NAME'
 MODULE_ALIAS("platform:" DRIVER_NAME);
  ^~~
include/linux/moduleparam.h:26:47: note: in definition of macro '__MODULE_INFO'
   = __MODULE_INFO_PREFIX __stringify(tag) "=" info
   ^~~~
include/linux/module.h:164:30: note: in expansion of macro 'MODULE_INFO'
 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
  ^~~
drivers/clocksource/timer-ti-dm.c:973:1: note: in expansion of macro 
'MODULE_ALIAS'
 MODULE_ALIAS("platform:" DRIVER_NAME);
 ^~~~

Caused by commit

  6a26793a7891 ("moduleparam: Save information about built-in modules in 
separate file")

DRIVER_NAME is not defined and this kbuild tree change has exposed it.
It has been this way since commit

  df28472a1b28 ("ARM: OMAP: dmtimer: platform driver")

From v3.2-rc1 in 2011.

I have applied the following patch for today.

From: Stephen Rothwell 
Date: Mon, 6 May 2019 09:26:24 +1000
Subject: [PATCH] arm: omap: remove unused MODULE_ALIAS from timer-ti-dm.c

DRIVER_NAME has never been defined, so this cannot have ever been used.

Signed-off-by: Stephen Rothwell 
---
 drivers/clocksource/timer-ti-dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-ti-dm.c 
b/drivers/clocksource/timer-ti-dm.c
index ee8ec5a8cb16..b357bd56ba63 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -970,5 +970,5 @@ module_platform_driver(omap_dm_timer_driver);
 
 MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:" DRIVER_NAME);
+// MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_AUTHOR("Texas Instruments Inc");
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell


pgpnsnwgkJ6cu.pgp
Description: OpenPGP digital signature


Re: [PATCH v2 1/4] ftrace: Implement fs notification for preempt/irqsoff tracers

2019-05-05 Thread Steven Rostedt
On Mon,  6 May 2019 00:39:15 +0200
Viktor Rosendahl  wrote:

> Can you explain more precisely what you agree with?
> 
> The general idea of being able to trace bursts of latencies?

One thing I have an issue with the current approach is the use of the
trace file for this.

> 
> Or the slightly more specific idea of notifying user space when
> /sys/kernel/debug/tracing/trace has new data, and let user space do the rest?
> 
> > We do have a notification mechanism already in the form of trace_pipe. Can 
> > we
> > not improve that in some way to be notified of a new trace data? In theory,
> > the trace_pipe does fit into the description in the documentation: "Reads
> > from this file will block until new data is retrieved"
> >  
> 
> I am not quite sure what kind of solution you are after here. Could you be 
> more
> specific?
> 
> I think that it would be weird if we used trace_pipe to send a message with
> the meaning "new data is available in the trace file". To me this would seem
> like (re)inventing a special purpose alternative to inotify.
> 
> Another option would be to allow the user to consume the the latency traces
> directly from trace_pipe, without using the trace file. This would make sense
> to me and would indeed be a much better solution. If somebody is able to make
> such an implementation I am all for it.
> 
> However, I do not know how to do this. I believe that it would lead towards a
> significant rewrite of the latency tracers, probably also how the ftrace
> buffering works.
> 

Hmm, what about adding a notifier to tracing_max_latency instead? And
do it not as a config option, but have it always enabled. It would send a
notification when it changes, and that only happens when there's a new
max latency. Would that work for you?

-- Steve



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

2019-05-05 Thread Stephen Rothwell
Hi Masahiro,

After merging the kbuild tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

In file included from include/linux/module.h:18,
 from arch/arm/plat-omap/dma.c:28:
arch/arm/plat-omap/dma.c:1452:26: error: expected ',' or ';' before 
'DRIVER_NAME'
 MODULE_ALIAS("platform:" DRIVER_NAME);
  ^~~
include/linux/moduleparam.h:26:47: note: in definition of macro '__MODULE_INFO'
   = __MODULE_INFO_PREFIX __stringify(tag) "=" info
   ^~~~
include/linux/module.h:164:30: note: in expansion of macro 'MODULE_INFO'
 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
  ^~~
arch/arm/plat-omap/dma.c:1452:1: note: in expansion of macro 'MODULE_ALIAS'
 MODULE_ALIAS("platform:" DRIVER_NAME);
 ^~~~

Presumably caused by commit

  6a26793a7891 ("moduleparam: Save information about built-in modules in 
separate file")

(since that is the only change from Friday, I thnk)

DRIVER_NAME is not defined and this kbuild tree change has exposed it.  It has 
been this way since commit

  f31cc9622d75 ("OMAP: DMA: Convert DMA library into platform driver")

From v2.6.38-rc1 in 2012.

I have applied the following patch for today.

From: Stephen Rothwell 
Date: Mon, 6 May 2019 08:35:02 +1000
Subject: [PATCH] arm: omap: remove unused MODULE_ALIAS from dma.c

DRIVER_NAME has nevern been defined, so this cannot have ever been used.

Signed-off-by: Stephen Rothwell 
---
 arch/arm/plat-omap/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index d4012d6c0dcb..4c6d9f4b43b7 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1449,7 +1449,7 @@ static void __exit omap_system_dma_exit(void)
 
 MODULE_DESCRIPTION("OMAP SYSTEM DMA DRIVER");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:" DRIVER_NAME);
+// MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_AUTHOR("Texas Instruments Inc");
 
 /*
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell


pgpbfmyLrZasM.pgp
Description: OpenPGP digital signature


Re: [PATCH v2 1/4] ftrace: Implement fs notification for preempt/irqsoff tracers

2019-05-05 Thread Viktor Rosendahl
On 5/4/19 6:47 PM, Joel Fernandes wrote:
> On Wed, May 01, 2019 at 10:36:47PM +0200, Viktor Rosendahl wrote:
>> immediately after each other in spite of the fact that the
>> preempt/irqsoff tracers operate in overwrite mode.
>>
>> Signed-off-by: Viktor Rosendahl 
>
> I agree with the general idea, but I don't really like how it is done in the
> patch.
>

Can you explain more precisely what you agree with?

The general idea of being able to trace bursts of latencies?

Or the slightly more specific idea of notifying user space when
/sys/kernel/debug/tracing/trace has new data, and let user space do the rest?

> We do have a notification mechanism already in the form of trace_pipe. Can we
> not improve that in some way to be notified of a new trace data? In theory,
> the trace_pipe does fit into the description in the documentation: "Reads
> from this file will block until new data is retrieved"
>

I am not quite sure what kind of solution you are after here. Could you be more
specific?

I think that it would be weird if we used trace_pipe to send a message with
the meaning "new data is available in the trace file". To me this would seem
like (re)inventing a special purpose alternative to inotify.

Another option would be to allow the user to consume the the latency traces
directly from trace_pipe, without using the trace file. This would make sense
to me and would indeed be a much better solution. If somebody is able to make
such an implementation I am all for it.

However, I do not know how to do this. I believe that it would lead towards a
significant rewrite of the latency tracers, probably also how the ftrace
buffering works.

My solution is clearly a hack but it has the benefits of requiring quite
small and straightforward changes to the kernel and the really ugly things are
then done in user space.

>>
>> +config PREEMPTIRQ_FSNOTIFY

> Does this have to be a CONFIG option? If prefer if the code automatically
> does the notification and it is always enabled. I don't see any drawbacks of
> that.
>

I was just thinking that sending fsnotify events to a sysfs file is a bit off
the beaten track and I figured that some people would like to opt out.

It can of course be changed so that it is always enabled when a tracer that
requires it is enabled, if there is general agreement on this point.

>> +
>>  config SCHED_TRACER
>>  bool "Scheduling Latency Tracer"
>>  select GENERIC_TRACER
>> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
>> index ca1ee656d6d8..ebefb8d4e072 100644
>> --- a/kernel/trace/trace.c
>> +++ b/kernel/trace/trace.c
>> @@ -44,6 +44,8 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>
>>  #include "trace.h"
>>  #include "trace_output.h"
>> @@ -8191,6 +8193,32 @@ static __init void create_trace_instances(struct 
>> dentry *d_tracer)
>>  return;
>>  }
>>
>> +#ifdef CONFIG_PREEMPTIRQ_FSNOTIFY
>> +
>> +static void trace_notify_workfn(struct work_struct *work)
> [snip]
>
> I prefer if this facility is available to other tracers as well such as
> the wakeup tracer which is similar in output (check
> Documentation/trace/ftrace.txt). I believe this should be a generic trace
> facility, and not tracer specific.
>

This should be possible.

If we stick with the fsnotify idea, it's possible to move the functions for it
to trace.c and to use it also from other tracers.

It is also possible to do a few small adjustments to the latency-collector and
to rename it the trace-collector, so that it can work for the wakeup case also.
The random sleep games probably don't make sense for the wakeup case but it's
already now a command line option.

Below is a suggestion for how to make the facility more generic and usable by
by both preempt/irqsoff and wakeup.

best regards,

Viktor
---
 kernel/trace/Kconfig  | 11 +++
 kernel/trace/trace.c  | 50 +--
 kernel/trace/trace.h  | 15 ++
 kernel/trace/trace_irqsoff.c  |  5 
 kernel/trace/trace_sched_wakeup.c |  7 -
 5 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 8bd1d6d001d7..ca6a63004adf 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -244,6 +244,17 @@ config SCHED_TRACER
  This tracer tracks the latency of the highest priority task
  to be scheduled in, starting from the point it has woken up.
 
+config TRACE_FSNOTIFY
+   bool "Generate fsnotify events for the trace file"
+   default n
+   depends on (IRQSOFF_TRACER || PREEMPT_TRACER || SCHED_TRACER)
+   depends on FSNOTIFY
+   help
+ This option will enable the generation of fsnotify events for the
+ trace file. This makes it possible for userspace to be notified about
+ modification of /sys/kernel/debug/tracing/trace through the inotify
+ interface.
+
 config HWLAT_TRACER
bool "Tracer to detect hardware latencies 

Re: [GIT PULL] x86 fix

2019-05-05 Thread pr-tracker-bot
The pull request you sent on Sun, 5 May 2019 13:00:29 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/13369e831173251e2bc3bc2a78f67c387e8d9609

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


Re: [GIT PULL] perf fixes

2019-05-05 Thread pr-tracker-bot
The pull request you sent on Sun, 5 May 2019 14:47:46 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
> perf-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/7178fb0b239d1c037876301c116fc9a6c1bd2ac0

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


Re: [GIT PULL] scheduler fix

2019-05-05 Thread pr-tracker-bot
The pull request you sent on Sun, 5 May 2019 13:02:37 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
> sched-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/70c9fb570b7c1c3edb03cbe745cf81ceeef5d484

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


Re: [git pull] vfs.git fixes

2019-05-05 Thread pr-tracker-bot
The pull request you sent on Sun, 5 May 2019 03:18:46 +0100:

> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git fixes

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/51987affd626b8e4ce9f4c65e1950cb9159f0f58

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


[PATCH 1/2] i2c: acpi: export i2c_acpi_find_adapter_by_handle

2019-05-05 Thread Ruslan Babayev
This allows drivers to lookup i2c adapters on ACPI based systems similar to
of_get_i2c_adapter_by_node() with DT based systems.

Signed-off-by: Ruslan Babayev 
Cc: xe-linux-exter...@cisco.com
---
 drivers/i2c/i2c-core-acpi.c | 3 ++-
 include/linux/i2c.h | 6 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 272800692088..964687534754 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -337,7 +337,7 @@ static int i2c_acpi_find_match_device(struct device *dev, 
void *data)
return ACPI_COMPANION(dev) == data;
 }
 
-static struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
+struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
 {
struct device *dev;
 
@@ -345,6 +345,7 @@ static struct i2c_adapter 
*i2c_acpi_find_adapter_by_handle(acpi_handle handle)
  i2c_acpi_find_match_adapter);
return dev ? i2c_verify_adapter(dev) : NULL;
 }
+EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle);
 
 static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device 
*adev)
 {
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 383510b4f083..24859a26f167 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -33,6 +33,7 @@
 #include 
 #include/* for Host Notify IRQ */
 #include   /* for struct device_node */
+#include /* for acpi_handle */
 #include /* for swab16 */
 #include 
 
@@ -977,6 +978,7 @@ bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
 u32 i2c_acpi_find_bus_speed(struct device *dev);
 struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
   struct i2c_board_info *info);
+struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle);
 #else
 static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
 struct acpi_resource_i2c_serialbus 
**i2c)
@@ -992,6 +994,10 @@ static inline struct i2c_client 
*i2c_acpi_new_device(struct device *dev,
 {
return NULL;
 }
+struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
+{
+   return NULL;
+}
 #endif /* CONFIG_ACPI */
 
 #endif /* _LINUX_I2C_H */
-- 
2.17.1



Re: [PATCH v2 2/7] y2038: Introduce __ASSUME_64BIT_TIME define

2019-05-05 Thread Lukasz Majewski
On Sun, 5 May 2019 18:10:54 +0400
Stepan Golosunov  wrote:

> 02.05.2019 в 15:04:18 + Joseph Myers написал:
> > On Tue, 30 Apr 2019, Lukasz Majewski wrote:
> >   
> > >  - The need for explicit clearing padding when calling syscalls
> > > (as to be better safe than sorry in the future - there was related
> > >discussion started by Stepan).  
> > 
> > This really isn't a difficult question.  What it comes down to is
> > whether the Linux kernel, in the first release version with these
> > syscalls (we don't care about old -rc versions; what matters is the
> > actual 5.1 release), ignores the padding.
> > 
> > If 5.1 *release* ignores the padding, that is part of the
> > kernel/userspace ABI, in accordance with the kernel principle of
> > not breaking userspace. Thus, it is something userspace can rely
> > on, now and in the future.
> > 
> > If 5.1 release does not ignore the padding, syscall presence does
> > not mean the padding is ignored by the kernel and so glibc needs to
> > clear padding. Of course, it needs to clear padding in a *copy* of
> > the value provided by the user unless the glibc API in question
> > requires the timespec value in question to be in writable memory.
> > 
> > So, which is (or will be) the case in 5.1 release?  Padding ignored
> > or not?  If more complicated (ignored for some architectures / ABIs
> > but not for others, or depending on whether compat syscalls are in
> > use), then say so - give a precise description of the exact
> > circumstances under which the padding around a 32-bit tv_nsec will
> > or will not be ignored by the kernel on input from userspace.  
> 
> In current linux git it looks like padding is correctly ignored in
> 32-bit kernels (because kernel itself has 32-bit tv_nsec there) but
> the code to clear it on compat syscalls in 64-bit kernels seems to be
> broken.
> 
> The patch to fix this is at
> 
> https://lore.kernel.org/lkml/20190429131951.471701-1-a...@arndb.de/
> 
> but it doesn't seem like it has reached Linus yet.
> 

I hope that this patch will be pulled soon (before final cut) - for that
reason we can assume that the padding is ignored by the kernel and
hence do not explicitly clear it in glibc (as it was done in sent
patches)

> 
> (Hmm.  I think that old ipc and socketcall syscalls in 32-bit kernels
> are broken without that patch too.  They would try to read
> __kernel_timespec when callers are passing old_timespec32.)

Please correct me if I'm wrong, but this problem is related to x32
machines (and not to ARM 32 bit ones with Y2038).


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lu...@denx.de


pgpyXRi351Znq.pgp
Description: OpenPGP digital signature


שלום

2019-05-05 Thread Steven Utonbury
היי,

שלחתי לך דוא"ל קודם לכן היה מצפה לשמוע ממך לגבי ההפקדה שנעשו בבנק כאן
על ידי אנגר M. אנא נסה לחזור אלי.

שלך
סטיבן


Re: [PATCH v2 1/4] ftrace: Implement fs notification for preempt/irqsoff tracers

2019-05-05 Thread Steven Rostedt
On Sat, 4 May 2019 12:47:10 -0400
Joel Fernandes  wrote:

 
> I agree with the general idea, but I don't really like how it is done in the
> patch.

+1

> 
> We do have a notification mechanism already in the form of trace_pipe. Can we
> not improve that in some way to be notified of a new trace data? In theory,
> the trace_pipe does fit into the description in the documentation: "Reads
> from this file will block until new data is retrieved"
> 
> More comment below:
> 
> 

> > +   config PREEMPTIRQ_FSNOTIFY
> > +   bool "Generate fsnotify events for the latency tracers"
> > +   default n
> > +   depends on (IRQSOFF_TRACER || PREEMPT_TRACER) && FSNOTIFY
> > +   help
> > + This option will enable the generation of fsnotify events for the
> > + trace file. This makes it possible for userspace to be notified about
> > + modification of /sys/kernel/debug/tracing/trace through the inotify
> > + interface.  
> 
> Does this have to be a CONFIG option? If prefer if the code automatically
> does the notification and it is always enabled. I don't see any drawbacks of
> that.

I mentioned that anything it needs to be an option.


> > +#ifdef CONFIG_PREEMPTIRQ_FSNOTIFY
> > +
> > +static void trace_notify_workfn(struct work_struct *work)  
> [snip]
> 
> I prefer if this facility is available to other tracers as well such as
> the wakeup tracer which is similar in output (check
> Documentation/trace/ftrace.txt). I believe this should be a generic trace
> facility, and not tracer specific.


For what it's worth, I agree with everything Joel just stated.

Thanks,

-- Steve


Re: [PATCH] ftrace: enable trampoline when rec count decrement to one

2019-05-05 Thread Steven Rostedt
On Sat, 4 May 2019 19:39:39 +0800
Cheng Jian  wrote:

> Trampoline can only be enabled if there is only a single ops
> attached to it. If there's only a single callback registered
> to a function, and the ops has a trampoline registered for it,
> then we can call the trampoline directly. This is very useful
> for improving the performance of ftrace and livepatch.
> 
> But we always disable trampoline when unregister ftrace. So if
> you have registered multiple ftrace_ops at the same location,
> even if the other ones have been unregistered, you will no longer
> be able to use trampoline.
> 
> To fix it, set FTRACE_FL_TRAMP flag if rec count is decremented
> to one, and the ops that left has a trampoline.
> 
> Testing After this patch :
> 
> insmod livepatch_unshare_files.ko
> cat /sys/kernel/debug/tracing/enabled_functions
> 
>   unshare_files (1) R I   tramp: 
> 0xc000(klp_ftrace_handler+0x0/0xa0) 
> ->ftrace_ops_assist_func+0x0/0xf0
> 
> echo unshare_files > /sys/kernel/debug/tracing/set_ftrace_filter
> echo function > /sys/kernel/debug/tracing/current_tracer
> cat /sys/kernel/debug/tracing/enabled_functions
> 
>   unshare_files (2) R I ->ftrace_ops_list_func+0x0/0x150
> 
> echo nop > /sys/kernel/debug/tracing/current_tracer
> cat /sys/kernel/debug/tracing/enabled_functions
> 
>   unshare_files (1) R I   tramp: 
> 0xc000(klp_ftrace_handler+0x0/0xa0) 
> ->ftrace_ops_assist_func+0x0/0xf0

Thanks for the patch. There was some race condition that prevented me
from doing this in the first place, but unfortunately, I don't remember
what that was :-/

I'll have to think about this before applying this patch.

Maybe there isn't a race condition, and I was just playing it safe, as
there was a race condition between switching from regs caller back to
non regs caller.

-- Steve


> 
> Signed-off-by: Cheng Jian 
> ---
>  kernel/trace/ftrace.c | 28 +++-
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index b920358..bdc29c2 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1626,6 +1626,11 @@ static bool test_rec_ops_needs_regs(struct
> dyn_ftrace *rec) return  keep_regs;
>  }
>  
> +static struct ftrace_ops *
> +ftrace_find_tramp_ops_any(struct dyn_ftrace *rec);
> +static struct ftrace_ops *
> +ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops
> *ops); +
>  static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
>int filter_hash,
>bool inc)
> @@ -1754,15 +1759,17 @@ static bool __ftrace_hash_rec_update(struct
> ftrace_ops *ops, }
>  
>   /*
> -  * If the rec had TRAMP enabled, then it
> needs to
> -  * be cleared. As TRAMP can only be enabled
> iff
> -  * there is only a single ops attached to it.
> -  * In otherwords, always disable it on
> decrementing.
> -  * In the future, we may set it if rec count
> is
> -  * decremented to one, and the ops that is
> left
> -  * has a trampoline.
> +  * The TRAMP needs to be set only if rec
> count
> +  * is decremented to one, and the ops that is
> +  * left has a trampoline. As TRAMP can only
> be
> +  * enabled if there is only a single ops
> attached
> +  * to it.
>*/
> - rec->flags &= ~FTRACE_FL_TRAMP;
> + if (ftrace_rec_count(rec) == 1 &&
> + ftrace_find_tramp_ops_any(rec))
> + rec->flags |= FTRACE_FL_TRAMP;
> + else
> + rec->flags &= ~FTRACE_FL_TRAMP;
>  
>   /*
>* flags will be cleared in
> ftrace_check_record() @@ -1955,11 +1962,6 @@ static void
> print_ip_ins(const char *fmt, const unsigned char *p)
> printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]); }
>  
> -static struct ftrace_ops *
> -ftrace_find_tramp_ops_any(struct dyn_ftrace *rec);
> -static struct ftrace_ops *
> -ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops
> *ops); -
>  enum ftrace_bug_type ftrace_bug_type;
>  const void *ftrace_expected;
>  



[PATCH 1/2] iio: dac: ds4422/ds4424 drop of_node check

2019-05-05 Thread Ruslan Babayev
The driver doesn't actually rely on any DT properties. Removing this
check makes it usable on ACPI based platforms.

Signed-off-by: Ruslan Babayev 
Cc: xe-linux-exter...@cisco.com
---
 drivers/iio/dac/ds4424.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index 883a47562055..2b3ba1a66fe8 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -236,12 +236,6 @@ static int ds4424_probe(struct i2c_client *client,
indio_dev->dev.of_node = client->dev.of_node;
indio_dev->dev.parent = >dev;
 
-   if (!client->dev.of_node) {
-   dev_err(>dev,
-   "Not found DT.\n");
-   return -ENODEV;
-   }
-
data->vcc_reg = devm_regulator_get(>dev, "vcc");
if (IS_ERR(data->vcc_reg)) {
dev_err(>dev,
-- 
2.17.1



[PATCH 2/2] iio: dac: ds4422/ds4424 fix chip verification

2019-05-05 Thread Ruslan Babayev
The ds4424_get_value function takes channel number as it's 3rd
argument and translates it internally into I2C address using
DS4424_DAC_ADDR macro. The caller ds4424_verify_chip was passing an
already translated I2C address as its last argument.

Signed-off-by: Ruslan Babayev 
Cc: xe-linux-exter...@cisco.com
---
 drivers/iio/dac/ds4424.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index 2b3ba1a66fe8..ae9be792693b 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -166,7 +166,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev)
 {
int ret, val;
 
-   ret = ds4424_get_value(indio_dev, , DS4424_DAC_ADDR(0));
+   ret = ds4424_get_value(indio_dev, , 0);
if (ret < 0)
dev_err(_dev->dev,
"%s failed. ret: %d\n", __func__, ret);
-- 
2.17.1



Re: [PATCH] x86/fpu: Remove the _GPL from the kernel_fpu_begin/end() export

2019-05-05 Thread Jiri Kosina
On Sun, 5 May 2019, Rik van Riel wrote:

> > Using fpu code in kernel space in a kernel module is a derived work of 
> > the kernel itself? dont get me wrong, but this is absurd. i mean you 
> > limit the use of cpu instructions. the use of cpu instructions should 
> > be free of any licensing issue. i would even argument you are 
> > violating the license of the cpu ower given to the kernel by executing 
> > it, by restricting its use for no reason
> 
> Using FPU code in kernel space in a kernel module does not require the 
> use of kernel_fpu_begin/end().
> 
> The kernel module could simply disable preemption, save the FPU 
> registers, use the FPU, restore the FPU registers, and reenable 
> preemption.

That means the module basically reimplemented kernel_fpu_begin/end() in 
its whole (not getting the further optimizations implemented by the 
kernel, sure). And therefore I sort of don't see the point of "hiding" it.

Thanks,

-- 
Jiri Kosina
SUSE Labs



[PATCH] Staging: kpc2000: Cleanup in kpc_dma_transfer()

2019-05-05 Thread Madhumitha Prabakaran
Remove unnecessary typecast in kzalloc function. In addition to that
replace kzalloc(sizeof(*acd)) over kzalloc(sizeof(struct aio_cb_data))
to maintain Linux kernel style.

Issue suggested by Coccinelle.

Signed-off-by: Madhumitha Prabakaran 
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index 5741d2b49a7d..c24329affd3a 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -57,7 +57,7 @@ int  kpc_dma_transfer(struct dev_private_data *priv, struct 
kiocb *kcb, unsigned

dev_dbg(>ldev->pldev->dev, "kpc_dma_transfer(priv = [%p], kcb = 
[%p], iov_base = [%p], iov_len = %ld) ldev = [%p]\n", priv, kcb, 
(void*)iov_base, iov_len, ldev);

-   acd = (struct aio_cb_data *) kzalloc(sizeof(struct aio_cb_data), 
GFP_KERNEL);
+   acd = kzalloc(sizeof(*acd), GFP_KERNEL);
if (!acd){
dev_err(>ldev->pldev->dev, "Couldn't kmalloc space for 
for the aio data\n");
return -ENOMEM;
-- 
2.17.1



Re: [PATCH 1/2] Use list.h instead of file_system_type next

2019-05-05 Thread Tamir Carmeli
I just found it weird that there is a proprietary implementation of a
linked list while surely the kernel already offers well established
data structures.
IMO, the current code is a bit hard to understand, especially the
addition of a new struct to the list in the line "*p = fs" after
find_filesystem returned the last member.
Correct, I'm not familiar with all the use cases of the code.

I'm not sure that XArray is a good choice since there is no notion of
an index attached to the pointer, it's really just a linked list of
pointers.
Tell me if you think there is any way to improve my suggestion.
Thanks for you attention.


On Sat, May 4, 2019 at 4:45 PM Matthew Wilcox  wrote:
>
> On Sat, May 04, 2019 at 05:45:48AM -0400, Carmeli Tamir wrote:
> > Changed file_system_type next field to list_head and refactored
> > the code to use list.h functions.
>
> What might be interesting is getting rid of this list and using an XArray
> instead.  This would be a more in-depth change; getting rid of the rwlock
> in favour of using RCU accesses for the read-side and the xa_lock for
> write accesses to the filesystem list.


[PATCH v1] dmaengine: tegra-apb: Handle DMA_PREP_INTERRUPT flag properly

2019-05-05 Thread Dmitry Osipenko
The DMA_PREP_INTERRUPT flag means that descriptor's callback should be
invoked upon transfer completion and that's it. For some reason driver
completely disables the hardware interrupt handling, leaving channel in
unusable state if transfer is issued with the flag being unset. Note
that there are no occurrences in the relevant drivers that do not set
the flag, hence this patch doesn't fix any actual bug and merely fixes
potential problem.

Signed-off-by: Dmitry Osipenko 
---
 drivers/dma/tegra20-apb-dma.c | 41 ---
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index cf462b1abc0b..29d972b7546f 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -561,6 +561,9 @@ static void tegra_dma_abort_all(struct tegra_dma_channel 
*tdc)
dma_desc->dma_status = DMA_ERROR;
list_add_tail(_desc->node, >free_dma_desc);
 
+   if (dma_desc->cb_count < 0)
+   continue;
+
/* Add in cb list if it is not there. */
if (!dma_desc->cb_count)
list_add_tail(_desc->cb_node,
@@ -616,9 +619,13 @@ static void handle_once_dma_done(struct tegra_dma_channel 
*tdc,
if (sgreq->last_sg) {
dma_desc->dma_status = DMA_COMPLETE;
dma_cookie_complete(_desc->txd);
-   if (!dma_desc->cb_count)
-   list_add_tail(_desc->cb_node, >cb_desc);
-   dma_desc->cb_count++;
+   if (dma_desc->cb_count >= 0) {
+   if (!dma_desc->cb_count)
+   list_add_tail(_desc->cb_node,
+ >cb_desc);
+
+   dma_desc->cb_count++;
+   }
list_add_tail(_desc->node, >free_dma_desc);
}
list_add_tail(>node, >free_sg_req);
@@ -645,9 +652,11 @@ static void handle_cont_sngl_cycle_dma_done(struct 
tegra_dma_channel *tdc,
dma_desc->bytes_requested;
 
/* Callback need to be call */
-   if (!dma_desc->cb_count)
-   list_add_tail(_desc->cb_node, >cb_desc);
-   dma_desc->cb_count++;
+   if (dma_desc->cb_count >= 0) {
+   if (!dma_desc->cb_count)
+   list_add_tail(_desc->cb_node, >cb_desc);
+   dma_desc->cb_count++;
+   }
 
/* If not last req then put at end of pending list */
if (!list_is_last(>node, >pending_sg_req)) {
@@ -802,7 +811,7 @@ static int tegra_dma_terminate_all(struct dma_chan *dc)
dma_desc  = list_first_entry(>cb_desc,
typeof(*dma_desc), cb_node);
list_del(_desc->cb_node);
-   dma_desc->cb_count = 0;
+   dma_desc->cb_count = -1;
}
spin_unlock_irqrestore(>lock, flags);
return 0;
@@ -988,8 +997,7 @@ static struct dma_async_tx_descriptor 
*tegra_dma_prep_slave_sg(
csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
}
 
-   if (flags & DMA_PREP_INTERRUPT)
-   csr |= TEGRA_APBDMA_CSR_IE_EOC;
+   csr |= TEGRA_APBDMA_CSR_IE_EOC;
 
apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
 
@@ -1000,11 +1008,15 @@ static struct dma_async_tx_descriptor 
*tegra_dma_prep_slave_sg(
}
INIT_LIST_HEAD(_desc->tx_list);
INIT_LIST_HEAD(_desc->cb_node);
-   dma_desc->cb_count = 0;
dma_desc->bytes_requested = 0;
dma_desc->bytes_transferred = 0;
dma_desc->dma_status = DMA_IN_PROGRESS;
 
+   if (flags & DMA_PREP_INTERRUPT)
+   dma_desc->cb_count = 0;
+   else
+   dma_desc->cb_count = -1;
+
/* Make transfer requests */
for_each_sg(sgl, sg, sg_len, i) {
u32 len, mem;
@@ -1131,8 +1143,7 @@ static struct dma_async_tx_descriptor 
*tegra_dma_prep_dma_cyclic(
csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
}
 
-   if (flags & DMA_PREP_INTERRUPT)
-   csr |= TEGRA_APBDMA_CSR_IE_EOC;
+   csr |= TEGRA_APBDMA_CSR_IE_EOC;
 
apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
 
@@ -1144,7 +1155,11 @@ static struct dma_async_tx_descriptor 
*tegra_dma_prep_dma_cyclic(
 
INIT_LIST_HEAD(_desc->tx_list);
INIT_LIST_HEAD(_desc->cb_node);
-   dma_desc->cb_count = 0;
+
+   if (flags & DMA_PREP_INTERRUPT)
+   dma_desc->cb_count = 0;
+   else
+   dma_desc->cb_count = -1;
 
dma_desc->bytes_transferred = 0;
dma_desc->bytes_requested = buf_len;
-- 
2.21.0



[PATCH v2 2/2] spi: at91-usart: add DMA support

2019-05-05 Thread Radu Pirea
This patch adds support for DMA. Transfers are done with dma only if
they are longer than 16 bytes in order to achieve a better performance.
DMA setup introduces a little overhead and for transfers shorter than 16
bytes there is no performance improvement.

Signed-off-by: Radu Pirea 
---
 drivers/spi/spi-at91-usart.c | 221 ++-
 1 file changed, 219 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c
index a694d702e574..f3583bdd475b 100644
--- a/drivers/spi/spi-at91-usart.c
+++ b/drivers/spi/spi-at91-usart.c
@@ -8,9 +8,12 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -59,6 +62,8 @@
 
 #define US_INIT \
(US_MR_SPI_MASTER | US_MR_CHRL | US_MR_CLKO | US_MR_WRDBT)
+#define US_DMA_MIN_BYTES   16
+#define US_DMA_TIMEOUT (msecs_to_jiffies(1000))
 
 /* Register access macros */
 #define at91_usart_spi_readl(port, reg) \
@@ -72,14 +77,19 @@
writeb_relaxed((value), (port)->regs + US_##reg)
 
 struct at91_usart_spi {
+   struct platform_device  *mpdev;
struct spi_transfer *current_transfer;
void __iomem*regs;
struct device   *dev;
struct clk  *clk;
 
+   struct completion   xfer_completion;
+
/*used in interrupt to protect data reading*/
spinlock_t  lock;
 
+   phys_addr_t phybase;
+
int irq;
unsigned intcurrent_tx_remaining_bytes;
unsigned intcurrent_rx_remaining_bytes;
@@ -88,8 +98,182 @@ struct at91_usart_spi {
u32 status;
 
boolxfer_failed;
+   booluse_dma;
 };
 
+static void dma_callback(void *data)
+{
+   struct spi_controller   *ctlr = data;
+   struct at91_usart_spi   *aus = spi_master_get_devdata(ctlr);
+
+   at91_usart_spi_writel(aus, IER, US_IR_RXRDY);
+   aus->current_rx_remaining_bytes = 0;
+   complete(>xfer_completion);
+}
+
+static bool at91_usart_spi_can_dma(struct spi_controller *ctrl,
+  struct spi_device *spi,
+  struct spi_transfer *xfer)
+{
+   struct at91_usart_spi *aus = spi_master_get_devdata(ctrl);
+
+   return aus->use_dma && xfer->len >= US_DMA_MIN_BYTES;
+}
+
+static int at91_usart_spi_configure_dma(struct spi_controller *ctlr,
+   struct at91_usart_spi *aus)
+{
+   struct dma_slave_config slave_config;
+   struct device *dev = >mpdev->dev;
+   phys_addr_t phybase = aus->phybase;
+   dma_cap_mask_t mask;
+   int err = 0;
+
+   dma_cap_zero(mask);
+   dma_cap_set(DMA_SLAVE, mask);
+
+   ctlr->dma_tx = dma_request_slave_channel_reason(dev, "tx");
+   if (IS_ERR_OR_NULL(ctlr->dma_tx)) {
+   if (IS_ERR(ctlr->dma_tx)) {
+   err = PTR_ERR(ctlr->dma_tx);
+   goto at91_usart_spi_error_clear;
+   }
+
+   dev_dbg(dev,
+   "DMA TX channel not available, SPI unable to use 
DMA\n");
+   err = -EBUSY;
+   goto at91_usart_spi_error_clear;
+   }
+
+   ctlr->dma_rx = dma_request_slave_channel_reason(dev, "rx");
+   if (IS_ERR_OR_NULL(ctlr->dma_rx)) {
+   if (IS_ERR(ctlr->dma_rx)) {
+   err = PTR_ERR(ctlr->dma_rx);
+   goto at91_usart_spi_error;
+   }
+
+   dev_dbg(dev,
+   "DMA RX channel not available, SPI unable to use 
DMA\n");
+   err = -EBUSY;
+   goto at91_usart_spi_error;
+   }
+
+   slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
+   slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
+   slave_config.dst_addr = (dma_addr_t)phybase + US_THR;
+   slave_config.src_addr = (dma_addr_t)phybase + US_RHR;
+   slave_config.src_maxburst = 1;
+   slave_config.dst_maxburst = 1;
+   slave_config.device_fc = false;
+
+   slave_config.direction = DMA_DEV_TO_MEM;
+   if (dmaengine_slave_config(ctlr->dma_rx, _config)) {
+   dev_err(>dev,
+   "failed to configure rx dma channel\n");
+   err = -EINVAL;
+   goto at91_usart_spi_error;
+   }
+
+   slave_config.direction = DMA_MEM_TO_DEV;
+   if (dmaengine_slave_config(ctlr->dma_tx, _config)) {
+   dev_err(>dev,
+   "failed to configure tx dma channel\n");
+   err = -EINVAL;
+   goto at91_usart_spi_error;
+   }
+
+   aus->use_dma = true;
+   return 0;
+
+at91_usart_spi_error:
+   if (!IS_ERR_OR_NULL(ctlr->dma_tx))
+   dma_release_channel(ctlr->dma_tx);
+   if (!IS_ERR_OR_NULL(ctlr->dma_rx))
+   

[PATCH v2 1/2] dt-bindings: mfd: atmel-usart: add DMA bindings for USART in SPI mode

2019-05-05 Thread Radu Pirea
The bindings for DMA are now common for both drivers of the USART
IP.

The node given as an example for USART in SPI mode has been updated in
order to include DMA bindings.

Signed-off-by: Radu Pirea 
---
 .../devicetree/bindings/mfd/atmel-usart.txt   | 20 ++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/atmel-usart.txt 
b/Documentation/devicetree/bindings/mfd/atmel-usart.txt
index 7f0cd72f47d2..699fd3c9ace8 100644
--- a/Documentation/devicetree/bindings/mfd/atmel-usart.txt
+++ b/Documentation/devicetree/bindings/mfd/atmel-usart.txt
@@ -17,17 +17,24 @@ Required properties for USART in SPI mode:
 - cs-gpios: chipselects (internal cs not supported)
 - atmel,usart-mode : Must be  (found in 
dt-bindings/mfd/at91-usart.h)
 
+Optional properties in serial and SPI mode:
+- dma bindings for dma transfer:
+   - dmas: DMA specifier, consisting of a phandle to DMA controller node,
+   memory peripheral interface and USART DMA channel ID, FIFO 
configuration.
+   The order of DMA channels is fixed. The first DMA channel must 
be TX
+   associated channel and the second one must be RX associated 
channel.
+   Refer to dma.txt and atmel-dma.txt for details.
+   - dma-names: "tx" for TX channel.
+"rx" for RX channel.
+The order of dma-names is also fixed. The first name must 
be "tx"
+and the second one must be "rx" as in the examples below.
+
 Optional properties in serial mode:
 - atmel,use-dma-rx: use of PDC or DMA for receiving data
 - atmel,use-dma-tx: use of PDC or DMA for transmitting data
 - {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD 
line respectively.
   It will use specified PIO instead of the peripheral function pin for the 
USART feature.
   If unsure, don't specify this property.
-- add dma bindings for dma transfer:
-   - dmas: DMA specifier, consisting of a phandle to DMA controller node,
-   memory peripheral interface and USART DMA channel ID, FIFO 
configuration.
-   Refer to dma.txt and atmel-dma.txt for details.
-   - dma-names: "rx" for RX channel, "tx" for TX channel.
 - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for 
FIFO
   capable USARTs.
 - rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see 
rs485.txt
@@ -81,5 +88,8 @@ Example:
interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
clocks = <_clk>;
clock-names = "usart";
+   dmas = < 2 AT91_DMA_CFG_PER_ID(3)>,
+  < 2 (AT91_DMA_CFG_PER_ID(4) | 
AT91_DMA_CFG_FIFOCFG_ASAP)>;
+   dma-names = "tx", "rx";
cs-gpios = < 3 0>;
};
-- 
2.21.0



[PATCH v2 0/2] DMA support for AT91 USART in SPI mode

2019-05-05 Thread Radu Pirea
Hi,

This is the version two of the patches with DMA support for
spi-at91-usart driver. 

Changes in v2:
- specified in bindings order of dmas and dma-names
- changed DMA_FROM_DEVICE to DMA_DEV_TO_MEM and DMA_TO_DEVICE to
DMA_MEM_TO_DEV when dmaengine_prep_slave_sg is called

Changes in v1:
- added DMA support


Radu Pirea (2):
  dt-bindings: mfd: atmel-usart: add DMA bindings for USART in SPI mode
  spi: at91-usart: add DMA support

 .../devicetree/bindings/mfd/atmel-usart.txt   |  20 +-
 drivers/spi/spi-at91-usart.c  | 221 +-
 2 files changed, 234 insertions(+), 7 deletions(-)

-- 
2.21.0



Re: [PATCH v3 1/2] Bluetooth: hci_qca: Rename STATE_ to QCA_

2019-05-05 Thread Marcel Holtmann
Hi Matthias,

> Rename STATE_IN_BAND_SLEEP_ENABLED to QCA_IBS_ENABLED. The constant
> represents a flag (multiple flags can be set at once), not a unique
> state of the controller or driver.
> 
> Also make the flag an enum value instead of a pre-processor constant
> (more flags will be added to the enum group by another patch).
> 
> Signed-off-by: Matthias Kaehlcke 
> ---
> Changes in v3:
> - rename STATE_IN_BAND_SLEEP_ENABLED to QCA_IBS_ENABLED
> 
> Changes in v2:
> - don't use BIT()
> - change to enum type
> - updated commit message
> ---
> drivers/bluetooth/hci_qca.c | 15 ---
> 1 file changed, 8 insertions(+), 7 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel



Re: [tip:x86/mm 36/36] init/main.c:540:2: error: implicit declaration of function 'pgd_cache_init'

2019-05-05 Thread Nadav Amit
> On May 5, 2019, at 6:06 AM, kbuild test robot  wrote:
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
> head:   ef5f22b4e5caf7e5ac12b28d4c9566c95d709ba5
> commit: ef5f22b4e5caf7e5ac12b28d4c9566c95d709ba5 [36/36] x86/mm: Initialize 
> PGD cache during mm initialization
> config: openrisc-or1ksim_defconfig (attached as .config)
> compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)
> reproduce:
>wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
>chmod +x ~/bin/make.cross
>git checkout ef5f22b4e5caf7e5ac12b28d4c9566c95d709ba5
># save the attached .config to linux build tree
>make.cross ARCH=openrisc 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot 
> 
> All errors (new ones prefixed by >>):
> 
>   init/main.c: In function 'mm_init':
>>> init/main.c:540:2: error: implicit declaration of function 'pgd_cache_init' 
>>> [-Werror=implicit-function-declaration]
> pgd_cache_init();
> ^~
>   cc1: some warnings being treated as errors
> 
> vim +/pgd_cache_init +540 init/main.c
> 
>   519 
>   520 /*
>   521  * Set up kernel memory allocators
>   522  */
>   523 static void __init mm_init(void)
>   524 {
>   525 /*
>   526  * page_ext requires contiguous pages,
>   527  * bigger than MAX_ORDER unless SPARSEMEM.
>   528  */
>   529 page_ext_init_flatmem();
>   530 mem_init();
>   531 kmem_cache_init();
>   532 pgtable_init();
>   533 debug_objects_mem_init();
>   534 vmalloc_init();
>   535 ioremap_huge_init();
>   536 /* Should be run before the first non-init thread is created */
>   537 init_espfix_bsp();
>   538 /* Should be run after espfix64 is set up. */
>   539 pti_init();
>> 540  pgd_cache_init();
>   541 }
>   542 
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> https://lists.01.org/pipermail/kbuild-all   Intel Corporation
> <.config.gz>

Sorry for that - I got confused and forgot this is not arch-specific code. I
don’t see the latest commit in the x86/mm tree, so I assume you can squash
the following on top?

-- >8 --

Subject: [PATCH] x86/mm: Fix breakage due to missing pgd_cache_init()

Set pgd_cache_init() as a weak symbol.

Signed-off-by: Nadav Amit 
---
 arch/x86/include/asm/pgtable.h | 1 -
 include/asm-generic/pgtable.h  | 2 ++
 init/main.c| 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 9635662e1163..6b6bfdfe83aa 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -1027,7 +1027,6 @@ static inline int pgd_none(pgd_t pgd)
 
 extern int direct_gbpages;
 void init_mem_mapping(void);
-void pgd_cache_init(void);
 void early_alloc_pgt_buf(void);
 extern void memblock_find_dma_reserve(void);
 
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index fa782fba51ee..75d9d68a6de7 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -1126,6 +1126,8 @@ int phys_mem_access_prot_allowed(struct file *file, 
unsigned long pfn,
 static inline void init_espfix_bsp(void) { }
 #endif
 
+extern void __init pgd_cache_init(void);
+
 #ifndef __HAVE_ARCH_PFN_MODIFY_ALLOWED
 static inline bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot)
 {
diff --git a/init/main.c b/init/main.c
index 7fac4ac2fede..2f99b3f40aaa 100644
--- a/init/main.c
+++ b/init/main.c
@@ -506,6 +506,8 @@ void __init __weak mem_encrypt_init(void) { }
 
 void __init __weak poking_init(void) { }
 
+void __init __weak pgd_cache_init(void) { }
+
 bool initcall_debug;
 core_param(initcall_debug, initcall_debug, bool, 0644);
 
-- 
2.17.1

[PATCH v2 2/7] clocksource/drivers/tegra: Unify timer code

2019-05-05 Thread Dmitry Osipenko
Tegra132 is 64bit platform and it has the tegra20-timer hardware unit.
Right now the corresponding timer code isn't compiled for ARM64, remove
ifdef'iness from the code and compile tegra20-timer for both 32 and 64 bit
platforms. Also note that like the older generations, Tegra210 has the
microseconds counter. Hence the delay timer and timer_us clocksource are
now made available for Tegra210 as well.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 107 +++-
 1 file changed, 56 insertions(+), 51 deletions(-)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index 58e8bb6deac9..42a19a4019a9 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -30,10 +30,6 @@
 
 #include "timer-of.h"
 
-#ifdef CONFIG_ARM
-#include 
-#endif
-
 #define RTC_SECONDS0x08
 #define RTC_SHADOW_SECONDS 0x0c
 #define RTC_MILLISECONDS   0x10
@@ -48,25 +44,17 @@
 #define TIMER_PCR  0x4
 #define TIMER_PCR_INTR_CLR BIT(30)
 
-#ifdef CONFIG_ARM
-#define TIMER_CPU0 0x00 /* TIMER1 */
-#define TIMER_CPU2 0x50 /* TIMER3 */
+#define TIMER1_BASE0x00
+#define TIMER2_BASE0x08
+#define TIMER3_BASE0x50
+#define TIMER4_BASE0x58
+#define TIMER10_BASE   0x90
+
 #define TIMER1_IRQ_IDX 0
-#define IRQ_IDX_FOR_CPU(cpu)   (TIMER1_IRQ_IDX + cpu)
-#define TIMER_BASE_FOR_CPU(cpu)\
-   (((cpu) & 1) * 8 + ((cpu) < 2 ? TIMER_CPU0 : TIMER_CPU2))
-#else
-#define TIMER_CPU0 0x90 /* TIMER10 */
 #define TIMER10_IRQ_IDX10
-#define IRQ_IDX_FOR_CPU(cpu)   (TIMER10_IRQ_IDX + cpu)
-#define TIMER_BASE_FOR_CPU(cpu) (TIMER_CPU0 + (cpu) * 8)
-#endif
 
 static u32 usec_config;
 static void __iomem *timer_reg_base;
-#ifdef CONFIG_ARM
-static struct delay_timer tegra_delay_timer;
-#endif
 
 static int tegra_timer_set_next_event(unsigned long cycles,
 struct clock_event_device *evt)
@@ -164,7 +152,6 @@ static int tegra_timer_stop(unsigned int cpu)
return 0;
 }
 
-#ifdef CONFIG_ARM
 static u64 notrace tegra_read_sched_clock(void)
 {
return readl(timer_reg_base + TIMERUS_CNTR_1US);
@@ -175,6 +162,11 @@ static unsigned long 
tegra_delay_timer_read_counter_long(void)
return readl(timer_reg_base + TIMERUS_CNTR_1US);
 }
 
+static struct delay_timer tegra_delay_timer = {
+   .read_current_timer = tegra_delay_timer_read_counter_long,
+   .freq = 100,
+};
+
 static struct timer_of suspend_rtc_to = {
.flags = TIMER_OF_BASE | TIMER_OF_CLOCK,
 };
@@ -199,9 +191,34 @@ static struct clocksource suspend_rtc_clocksource = {
.mask   = CLOCKSOURCE_MASK(32),
.flags  = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP,
 };
-#endif
 
-static int tegra_init_timer(struct device_node *np, bool tegra20)
+static inline unsigned int tegra_base_for_cpu(int cpu, bool tegra20)
+{
+   if (tegra20) {
+   switch (cpu) {
+   case 0:
+   return TIMER1_BASE;
+   case 1:
+   return TIMER2_BASE;
+   case 2:
+   return TIMER3_BASE;
+   default:
+   return TIMER4_BASE;
+   }
+   }
+
+   return TIMER10_BASE + cpu * 8;
+}
+
+static inline unsigned int tegra_irq_idx_for_cpu(int cpu, bool tegra20)
+{
+   if (tegra20)
+   return TIMER1_IRQ_IDX + cpu;
+
+   return TIMER10_IRQ_IDX + cpu;
+}
+
+static int __init tegra_init_timer(struct device_node *np, bool tegra20)
 {
struct timer_of *to;
int cpu, ret;
@@ -252,6 +269,8 @@ static int tegra_init_timer(struct device_node *np, bool 
tegra20)
 
for_each_possible_cpu(cpu) {
struct timer_of *cpu_to = per_cpu_ptr(_to, cpu);
+   unsigned int base = tegra_base_for_cpu(cpu, tegra20);
+   unsigned int idx = tegra_irq_idx_for_cpu(cpu, tegra20);
 
/*
 * TIMER1-9 are fixed to 1MHz, TIMER10-13 are running off the
@@ -260,10 +279,10 @@ static int tegra_init_timer(struct device_node *np, bool 
tegra20)
if (tegra20)
cpu_to->of_clk.rate = 100;
 
-   cpu_to->of_base.base = timer_reg_base + TIMER_BASE_FOR_CPU(cpu);
+   cpu_to = per_cpu_ptr(_to, cpu);
+   cpu_to->of_base.base = timer_reg_base + base;
cpu_to->clkevt.cpumask = cpumask_of(cpu);
-   cpu_to->clkevt.irq =
-   irq_of_parse_and_map(np, IRQ_IDX_FOR_CPU(cpu));
+   cpu_to->clkevt.irq = irq_of_parse_and_map(np, idx);
if (!cpu_to->clkevt.irq) {
pr_err("%s: can't map IRQ for CPU%d\n",
   __func__, cpu);
@@ -283,6 +302,16 @@ static int tegra_init_timer(struct device_node 

[PATCH v2 3/7] clocksource/drivers/tegra: Reset hardware state on init

2019-05-05 Thread Dmitry Osipenko
Reset timer's hardware state to ensure that initially it is in a
predictable state.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index 42a19a4019a9..b7d1e6221348 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -132,6 +132,9 @@ static int tegra_timer_setup(unsigned int cpu)
 {
struct timer_of *to = per_cpu_ptr(_to, cpu);
 
+   writel(0, timer_of_base(to) + TIMER_PTV);
+   writel(TIMER_PCR_INTR_CLR, timer_of_base(to) + TIMER_PCR);
+
irq_force_affinity(to->clkevt.irq, cpumask_of(cpu));
enable_irq(to->clkevt.irq);
 
-- 
2.21.0



[PATCH v2 5/7] clocksource/drivers/tegra: Release all IRQ's on request_irq() error

2019-05-05 Thread Dmitry Osipenko
Release all requested IRQ's on the request error to properly clean up
allocated resources.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index cdac9e240714..7c06c0335fe3 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -291,7 +291,7 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
pr_err("%s: can't map IRQ for CPU%d\n",
   __func__, cpu);
ret = -EINVAL;
-   goto out;
+   goto out_irq;
}
 
irq_set_status_flags(cpu_to->clkevt.irq, IRQ_NOAUTOEN);
@@ -301,7 +301,8 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
if (ret) {
pr_err("%s: cannot setup irq %d for CPU%d\n",
__func__, cpu_to->clkevt.irq, cpu);
-   ret = -EINVAL;
+   irq_dispose_mapping(cpu_to->clkevt.irq);
+   cpu_to->clkevt.irq = 0;
goto out_irq;
}
}
-- 
2.21.0



[PATCH v2 4/7] clocksource/drivers/tegra: Replace readl/writel with relaxed versions

2019-05-05 Thread Dmitry Osipenko
The readl/writel functions are inserting memory barrier to ensure that
outstanding memory writes are completed, this results in L2 cache syncing
being done on Tegra20 and Tegra30 which isn't a very cheap operation.
Replace all readl/writel occurrences in the code with the relaxed versions
since there is no need for the memory-access syncing.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 35 +++--
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index b7d1e6221348..cdac9e240714 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -61,9 +61,9 @@ static int tegra_timer_set_next_event(unsigned long cycles,
 {
void __iomem *reg_base = timer_of_base(to_timer_of(evt));
 
-   writel(TIMER_PTV_EN |
-  ((cycles > 1) ? (cycles - 1) : 0), /* n+1 scheme */
-  reg_base + TIMER_PTV);
+   writel_relaxed(TIMER_PTV_EN |
+  ((cycles > 1) ? (cycles - 1) : 0), /* n+1 scheme */
+  reg_base + TIMER_PTV);
 
return 0;
 }
@@ -72,7 +72,7 @@ static int tegra_timer_shutdown(struct clock_event_device 
*evt)
 {
void __iomem *reg_base = timer_of_base(to_timer_of(evt));
 
-   writel(0, reg_base + TIMER_PTV);
+   writel_relaxed(0, reg_base + TIMER_PTV);
 
return 0;
 }
@@ -81,9 +81,9 @@ static int tegra_timer_set_periodic(struct clock_event_device 
*evt)
 {
void __iomem *reg_base = timer_of_base(to_timer_of(evt));
 
-   writel(TIMER_PTV_EN | TIMER_PTV_PER |
-  ((timer_of_rate(to_timer_of(evt)) / HZ) - 1),
-  reg_base + TIMER_PTV);
+   writel_relaxed(TIMER_PTV_EN | TIMER_PTV_PER |
+  ((timer_of_rate(to_timer_of(evt)) / HZ) - 1),
+  reg_base + TIMER_PTV);
 
return 0;
 }
@@ -93,7 +93,7 @@ static irqreturn_t tegra_timer_isr(int irq, void *dev_id)
struct clock_event_device *evt = (struct clock_event_device *)dev_id;
void __iomem *reg_base = timer_of_base(to_timer_of(evt));
 
-   writel(TIMER_PCR_INTR_CLR, reg_base + TIMER_PCR);
+   writel_relaxed(TIMER_PCR_INTR_CLR, reg_base + TIMER_PCR);
evt->event_handler(evt);
 
return IRQ_HANDLED;
@@ -103,12 +103,12 @@ static void tegra_timer_suspend(struct clock_event_device 
*evt)
 {
void __iomem *reg_base = timer_of_base(to_timer_of(evt));
 
-   writel(TIMER_PCR_INTR_CLR, reg_base + TIMER_PCR);
+   writel_relaxed(TIMER_PCR_INTR_CLR, reg_base + TIMER_PCR);
 }
 
 static void tegra_timer_resume(struct clock_event_device *evt)
 {
-   writel(usec_config, timer_reg_base + TIMERUS_USEC_CFG);
+   writel_relaxed(usec_config, timer_reg_base + TIMERUS_USEC_CFG);
 }
 
 static DEFINE_PER_CPU(struct timer_of, tegra_to) = {
@@ -132,8 +132,8 @@ static int tegra_timer_setup(unsigned int cpu)
 {
struct timer_of *to = per_cpu_ptr(_to, cpu);
 
-   writel(0, timer_of_base(to) + TIMER_PTV);
-   writel(TIMER_PCR_INTR_CLR, timer_of_base(to) + TIMER_PCR);
+   writel_relaxed(0, timer_of_base(to) + TIMER_PTV);
+   writel_relaxed(TIMER_PCR_INTR_CLR, timer_of_base(to) + TIMER_PCR);
 
irq_force_affinity(to->clkevt.irq, cpumask_of(cpu));
enable_irq(to->clkevt.irq);
@@ -157,12 +157,12 @@ static int tegra_timer_stop(unsigned int cpu)
 
 static u64 notrace tegra_read_sched_clock(void)
 {
-   return readl(timer_reg_base + TIMERUS_CNTR_1US);
+   return readl_relaxed(timer_reg_base + TIMERUS_CNTR_1US);
 }
 
 static unsigned long tegra_delay_timer_read_counter_long(void)
 {
-   return readl(timer_reg_base + TIMERUS_CNTR_1US);
+   return readl_relaxed(timer_reg_base + TIMERUS_CNTR_1US);
 }
 
 static struct delay_timer tegra_delay_timer = {
@@ -182,8 +182,9 @@ static struct timer_of suspend_rtc_to = {
  */
 static u64 tegra_rtc_read_ms(struct clocksource *cs)
 {
-   u32 ms = readl(timer_of_base(_rtc_to) + RTC_MILLISECONDS);
-   u32 s = readl(timer_of_base(_rtc_to) + RTC_SHADOW_SECONDS);
+   void __iomem *reg_base = timer_of_base(_rtc_to);
+   u32 ms = readl_relaxed(reg_base + RTC_MILLISECONDS);
+   u32 s = readl_relaxed(reg_base + RTC_SHADOW_SECONDS);
return (u64)s * MSEC_PER_SEC + ms;
 }
 
@@ -268,7 +269,7 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
goto out;
}
 
-   writel(usec_config, timer_reg_base + TIMERUS_USEC_CFG);
+   writel_relaxed(usec_config, timer_reg_base + TIMERUS_USEC_CFG);
 
for_each_possible_cpu(cpu) {
struct timer_of *cpu_to = per_cpu_ptr(_to, cpu);
-- 
2.21.0



[PATCH v2 7/7] clocksource/drivers/tegra: Use SPDX identifier

2019-05-05 Thread Dmitry Osipenko
Use SPDX tag for the license identification instead of a free form text
to aid license-checking automation and for brevity.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index 47ef8c9aa0ba..40d9b27d30a3 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2010 Google, Inc.
- *
- * Author:
- * Colin Cross 
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
+ * Author: Colin Cross 
  */
 
 #define pr_fmt(fmt)"tegra-timer: " fmt
-- 
2.21.0



[PATCH v2 6/7] clocksource/drivers/tegra: Minor code clean up

2019-05-05 Thread Dmitry Osipenko
Correct typo and use proper upper casing for acronyms in the comments,
use common style for error messages, prepend error messages with
"tegra-timer:", add error message for cpuhp_setup_state() failure and
clean up whitespaces in the code to fix checkpatch warnings.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 43 -
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index 7c06c0335fe3..47ef8c9aa0ba 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -15,6 +15,8 @@
  *
  */
 
+#define pr_fmt(fmt)"tegra-timer: " fmt
+
 #include 
 #include 
 #include 
@@ -30,13 +32,13 @@
 
 #include "timer-of.h"
 
-#define RTC_SECONDS0x08
-#define RTC_SHADOW_SECONDS 0x0c
-#define RTC_MILLISECONDS   0x10
+#define RTC_SECONDS0x08
+#define RTC_SHADOW_SECONDS 0x0c
+#define RTC_MILLISECONDS   0x10
 
-#define TIMERUS_CNTR_1US 0x10
-#define TIMERUS_USEC_CFG 0x14
-#define TIMERUS_CNTR_FREEZE 0x4c
+#define TIMERUS_CNTR_1US   0x10
+#define TIMERUS_USEC_CFG   0x14
+#define TIMERUS_CNTR_FREEZE0x4c
 
 #define TIMER_PTV  0x0
 #define TIMER_PTV_EN   BIT(31)
@@ -57,7 +59,7 @@ static u32 usec_config;
 static void __iomem *timer_reg_base;
 
 static int tegra_timer_set_next_event(unsigned long cycles,
-struct clock_event_device *evt)
+ struct clock_event_device *evt)
 {
void __iomem *reg_base = timer_of_base(to_timer_of(evt));
 
@@ -176,15 +178,17 @@ static struct timer_of suspend_rtc_to = {
 
 /*
  * tegra_rtc_read - Reads the Tegra RTC registers
- * Care must be taken that this funciton is not called while the
+ * Care must be taken that this function is not called while the
  * tegra_rtc driver could be executing to avoid race conditions
  * on the RTC shadow register
  */
 static u64 tegra_rtc_read_ms(struct clocksource *cs)
 {
void __iomem *reg_base = timer_of_base(_rtc_to);
+
u32 ms = readl_relaxed(reg_base + RTC_MILLISECONDS);
u32 s = readl_relaxed(reg_base + RTC_SHADOW_SECONDS);
+
return (u64)s * MSEC_PER_SEC + ms;
 }
 
@@ -229,7 +233,7 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
 
to = this_cpu_ptr(_to);
ret = timer_of_init(np, to);
-   if (ret < 0)
+   if (ret)
goto out;
 
timer_reg_base = timer_of_base(to);
@@ -288,8 +292,7 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
cpu_to->clkevt.cpumask = cpumask_of(cpu);
cpu_to->clkevt.irq = irq_of_parse_and_map(np, idx);
if (!cpu_to->clkevt.irq) {
-   pr_err("%s: can't map IRQ for CPU%d\n",
-  __func__, cpu);
+   pr_err("failed to map irq for cpu%d\n", cpu);
ret = -EINVAL;
goto out_irq;
}
@@ -299,8 +302,8 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
  IRQF_TIMER | IRQF_NOBALANCING,
  cpu_to->clkevt.name, _to->clkevt);
if (ret) {
-   pr_err("%s: cannot setup irq %d for CPU%d\n",
-   __func__, cpu_to->clkevt.irq, cpu);
+   pr_err("failed to set up irq for cpu%d: %d\n",
+  cpu, ret);
irq_dispose_mapping(cpu_to->clkevt.irq);
cpu_to->clkevt.irq = 0;
goto out_irq;
@@ -317,11 +320,14 @@ static int __init tegra_init_timer(struct device_node 
*np, bool tegra20)
 
register_current_timer_delay(_delay_timer);
 
-   cpuhp_setup_state(CPUHP_AP_TEGRA_TIMER_STARTING,
- "AP_TEGRA_TIMER_STARTING", tegra_timer_setup,
- tegra_timer_stop);
+   ret = cpuhp_setup_state(CPUHP_AP_TEGRA_TIMER_STARTING,
+   "AP_TEGRA_TIMER_STARTING", tegra_timer_setup,
+   tegra_timer_stop);
+   if (ret)
+   pr_err("failed to set up cpu hp state: %d\n", ret);
 
return ret;
+
 out_irq:
for_each_possible_cpu(cpu) {
struct timer_of *cpu_to;
@@ -334,6 +340,7 @@ static int __init tegra_init_timer(struct device_node *np, 
bool tegra20)
}
 out:
timer_of_cleanup(to);
+
return ret;
 }
 
@@ -357,8 +364,6 @@ static int __init tegra20_init_rtc(struct device_node *np)
if (ret)
return ret;
 
-   clocksource_register_hz(_rtc_clocksource, 1000);
-
-   return 0;
+   return clocksource_register_hz(_rtc_clocksource, 1000);
 }
 TIMER_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);

[PATCH v2 1/7] clocksource/drivers/tegra: Support per-CPU timers on all Tegra's

2019-05-05 Thread Dmitry Osipenko
Assign TMR1-4 per-CPU core on 32bit Tegra's in a way it is done for
Tegra210. In a result each core can handle its own timer events, less
code is unique to ARM64 and Tegra's clock events driver now has higher
rating on all Tegra's, replacing the ARM's TWD timer which isn't very
accurate due to the clock rate jitter caused by CPU frequency scaling.

Signed-off-by: Dmitry Osipenko 
---
 drivers/clocksource/timer-tegra20.c | 120 ++--
 1 file changed, 43 insertions(+), 77 deletions(-)

diff --git a/drivers/clocksource/timer-tegra20.c 
b/drivers/clocksource/timer-tegra20.c
index 919b3568c495..58e8bb6deac9 100644
--- a/drivers/clocksource/timer-tegra20.c
+++ b/drivers/clocksource/timer-tegra20.c
@@ -49,13 +49,18 @@
 #define TIMER_PCR_INTR_CLR BIT(30)
 
 #ifdef CONFIG_ARM
-#define TIMER_CPU0 0x50 /* TIMER3 */
+#define TIMER_CPU0 0x00 /* TIMER1 */
+#define TIMER_CPU2 0x50 /* TIMER3 */
+#define TIMER1_IRQ_IDX 0
+#define IRQ_IDX_FOR_CPU(cpu)   (TIMER1_IRQ_IDX + cpu)
+#define TIMER_BASE_FOR_CPU(cpu)\
+   (((cpu) & 1) * 8 + ((cpu) < 2 ? TIMER_CPU0 : TIMER_CPU2))
 #else
 #define TIMER_CPU0 0x90 /* TIMER10 */
 #define TIMER10_IRQ_IDX10
 #define IRQ_IDX_FOR_CPU(cpu)   (TIMER10_IRQ_IDX + cpu)
-#endif
 #define TIMER_BASE_FOR_CPU(cpu) (TIMER_CPU0 + (cpu) * 8)
+#endif
 
 static u32 usec_config;
 static void __iomem *timer_reg_base;
@@ -118,7 +123,6 @@ static void tegra_timer_resume(struct clock_event_device 
*evt)
writel(usec_config, timer_reg_base + TIMERUS_USEC_CFG);
 }
 
-#ifdef CONFIG_ARM64
 static DEFINE_PER_CPU(struct timer_of, tegra_to) = {
.flags = TIMER_OF_CLOCK | TIMER_OF_BASE,
 
@@ -159,33 +163,8 @@ static int tegra_timer_stop(unsigned int cpu)
 
return 0;
 }
-#else /* CONFIG_ARM */
-static struct timer_of tegra_to = {
-   .flags = TIMER_OF_CLOCK | TIMER_OF_BASE | TIMER_OF_IRQ,
-
-   .clkevt = {
-   .name = "tegra_timer",
-   .rating = 300,
-   .features = CLOCK_EVT_FEAT_ONESHOT |
-   CLOCK_EVT_FEAT_PERIODIC |
-   CLOCK_EVT_FEAT_DYNIRQ,
-   .set_next_event = tegra_timer_set_next_event,
-   .set_state_shutdown = tegra_timer_shutdown,
-   .set_state_periodic = tegra_timer_set_periodic,
-   .set_state_oneshot = tegra_timer_shutdown,
-   .tick_resume = tegra_timer_shutdown,
-   .suspend = tegra_timer_suspend,
-   .resume = tegra_timer_resume,
-   .cpumask = cpu_possible_mask,
-   },
-
-   .of_irq = {
-   .index = 2,
-   .flags = IRQF_TIMER | IRQF_TRIGGER_HIGH,
-   .handler = tegra_timer_isr,
-   },
-};
 
+#ifdef CONFIG_ARM
 static u64 notrace tegra_read_sched_clock(void)
 {
return readl(timer_reg_base + TIMERUS_CNTR_1US);
@@ -222,10 +201,12 @@ static struct clocksource suspend_rtc_clocksource = {
 };
 #endif
 
-static int tegra_timer_common_init(struct device_node *np, struct timer_of *to)
+static int tegra_init_timer(struct device_node *np, bool tegra20)
 {
-   int ret = 0;
+   struct timer_of *to;
+   int cpu, ret;
 
+   to = this_cpu_ptr(_to);
ret = timer_of_init(np, to);
if (ret < 0)
goto out;
@@ -267,29 +248,19 @@ static int tegra_timer_common_init(struct device_node 
*np, struct timer_of *to)
goto out;
}
 
-   writel(usec_config, timer_of_base(to) + TIMERUS_USEC_CFG);
-
-out:
-   return ret;
-}
-
-#ifdef CONFIG_ARM64
-static int __init tegra_init_timer(struct device_node *np)
-{
-   int cpu, ret = 0;
-   struct timer_of *to;
-
-   to = this_cpu_ptr(_to);
-   ret = tegra_timer_common_init(np, to);
-   if (ret < 0)
-   goto out;
+   writel(usec_config, timer_reg_base + TIMERUS_USEC_CFG);
 
for_each_possible_cpu(cpu) {
-   struct timer_of *cpu_to;
+   struct timer_of *cpu_to = per_cpu_ptr(_to, cpu);
+
+   /*
+* TIMER1-9 are fixed to 1MHz, TIMER10-13 are running off the
+* parent clock.
+*/
+   if (tegra20)
+   cpu_to->of_clk.rate = 100;
 
-   cpu_to = per_cpu_ptr(_to, cpu);
cpu_to->of_base.base = timer_reg_base + TIMER_BASE_FOR_CPU(cpu);
-   cpu_to->of_clk.rate = timer_of_rate(to);
cpu_to->clkevt.cpumask = cpumask_of(cpu);
cpu_to->clkevt.irq =
irq_of_parse_and_map(np, IRQ_IDX_FOR_CPU(cpu));
@@ -331,43 +302,39 @@ static int __init tegra_init_timer(struct device_node *np)
timer_of_cleanup(to);
return ret;
 }
+
+#ifdef CONFIG_ARM64
+static int __init tegra210_init_timer(struct device_node *np)
+{
+   return tegra_init_timer(np, false);
+}
+TIMER_OF_DECLARE(tegra210_timer, 

[PATCH v2 0/7] NVIDIA Tegra clocksource improvements and clean up

2019-05-05 Thread Dmitry Osipenko
Hello,

This series primarily unifies the driver code across all Tegra SoC
generations. In a result the clocksources are allocated per-CPU on
older Tegra's and have a higher rating than the arch-timer, the newer
Tegra210 is getting support for microsecond clocksource / delay-timer
and the driver's code is getting much cleaner. Note that arch-timer usage
is discouraged on all Tegra's due to the time jitter caused by the CPU
frequency scaling.

The series was extensively tested on Tegra20 and Tegra30.

Changelog:

v2: Rebased on recent linux-next. Now all of #ifdef's are removed from the
code due to the recent patch that generalized persistent clocksource.

Couple other minor cosmetic changes.

Dmitry Osipenko (7):
  clocksource/drivers/tegra: Support per-CPU timers on all Tegra's
  clocksource/drivers/tegra: Unify timer code
  clocksource/drivers/tegra: Reset hardware state on init
  clocksource/drivers/tegra: Replace readl/writel with relaxed versions
  clocksource/drivers/tegra: Release all IRQ's on request_irq() error
  clocksource/drivers/tegra: Minor code clean up
  clocksource/drivers/tegra: Use SPDX identifier

 drivers/clocksource/timer-tegra20.c | 272 +---
 1 file changed, 121 insertions(+), 151 deletions(-)

-- 
2.21.0



Re: [PATCH] x86/fpu: Remove the _GPL from the kernel_fpu_begin/end() export

2019-05-05 Thread Rik van Riel
On Sat, 2019-05-04 at 04:28 +0200, Sebastian Gottschall wrote:

> Using fpu code in kernel space in a kernel module is a derived work
> of 
> the kernel itself?
> dont get me wrong, but this is absurd. i mean you limit the use of
> cpu 
> instructions. the use
> of cpu instructions should be free of any licensing issue. i would
> even 
> argument you are violating
> the license of the cpu ower given to the kernel by executing it, by 
> restricting its use for no reason

Using FPU code in kernel space in a kernel module
does not require the use of kernel_fpu_begin/end().

The kernel module could simply disable preemption,
save the FPU registers, use the FPU, restore the
FPU registers, and reenable preemption.

However, using kernel_fpu_begin/end() does get that
module some nice optimizations that are specific to
Linux.

-- 
All Rights Reversed.


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


Re: [PATCH V2] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP

2019-05-05 Thread Alexandre Belloni
On 30/04/2019 01:07:08+, Anson Huang wrote:
> Use __maybe_unused for power management related functions
> instead of #if CONFIG_PM_SLEEP to simply the code.
> 
> Signed-off-by: Anson Huang 
> Reviewed-by: Dong Aisheng 
> ---
> Changes since V1:
>   - use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() to make sure snvs_rtc_pm_ops is 
> empty when PM is off.
> ---
>  drivers/rtc/rtc-snvs.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH v4 2/6] dt-bindings: mfd: max77620: Add system-power-controller property

2019-05-05 Thread Dmitry Osipenko
Document new generic property that designates the PMIC as the system's
power controller.

Signed-off-by: Dmitry Osipenko 
---
 Documentation/devicetree/bindings/mfd/max77620.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77620.txt 
b/Documentation/devicetree/bindings/mfd/max77620.txt
index b75283787ba1..5a642a51d58e 100644
--- a/Documentation/devicetree/bindings/mfd/max77620.txt
+++ b/Documentation/devicetree/bindings/mfd/max77620.txt
@@ -18,6 +18,11 @@ Optional properties:
IRQ numbers for different interrupt source of MAX77620
are defined at dt-bindings/mfd/max77620.h.
 
+- system-power-controller: Indicates that this PMIC is controlling the
+  system power, see [1] for more details.
+
+[1] Documentation/devicetree/bindings/power/power-controller.txt
+
 Optional subnodes and their properties:
 ===
 
-- 
2.21.0



[PATCH v4 6/6] regulator: max77620: Support Maxim 77663

2019-05-05 Thread Dmitry Osipenko
Add support for Maxim 77663.

Acked-by: Mark Brown 
Signed-off-by: Dmitry Osipenko 
---
 drivers/regulator/max77620-regulator.c | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77620-regulator.c 
b/drivers/regulator/max77620-regulator.c
index 0ad91a7f9cb9..0ec9f81fe74a 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -761,6 +761,24 @@ static struct max77620_regulator_info 
max20024_regs_info[MAX77620_NUM_REGS] = {
RAIL_LDO(LDO8, ldo8, "in-ldo7-8", N, 80, 395, 5),
 };
 
+static struct max77620_regulator_info max77663_regs_info[MAX77620_NUM_REGS] = {
+   RAIL_SD(SD0, sd0, "in-sd0", SD0, 60, 3387500, 12500, 0xFF, NONE),
+   RAIL_SD(SD1, sd1, "in-sd1", SD1, 80, 1587500, 12500, 0xFF, NONE),
+   RAIL_SD(SD2, sd2, "in-sd2", SDX, 60, 3787500, 12500, 0xFF, NONE),
+   RAIL_SD(SD3, sd3, "in-sd3", SDX, 60, 3787500, 12500, 0xFF, NONE),
+   RAIL_SD(SD4, sd4, "in-sd4", SDX, 60, 3787500, 12500, 0xFF, NONE),
+
+   RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 80, 2375000, 25000),
+   RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 80, 2375000, 25000),
+   RAIL_LDO(LDO2, ldo2, "in-ldo2",   P, 80, 395, 5),
+   RAIL_LDO(LDO3, ldo3, "in-ldo3-5", P, 80, 395, 5),
+   RAIL_LDO(LDO4, ldo4, "in-ldo4-6", P, 80, 1587500, 12500),
+   RAIL_LDO(LDO5, ldo5, "in-ldo3-5", P, 80, 395, 5),
+   RAIL_LDO(LDO6, ldo6, "in-ldo4-6", P, 80, 395, 5),
+   RAIL_LDO(LDO7, ldo7, "in-ldo7-8", N, 80, 395, 5),
+   RAIL_LDO(LDO8, ldo8, "in-ldo7-8", N, 80, 395, 5),
+};
+
 static int max77620_regulator_probe(struct platform_device *pdev)
 {
struct max77620_chip *max77620_chip = dev_get_drvdata(pdev->dev.parent);
@@ -785,9 +803,14 @@ static int max77620_regulator_probe(struct platform_device 
*pdev)
case MAX77620:
rinfo = max77620_regs_info;
break;
-   default:
+   case MAX20024:
rinfo = max20024_regs_info;
break;
+   case MAX77663:
+   rinfo = max77663_regs_info;
+   break;
+   default:
+   return -EINVAL;
}
 
config.regmap = pmic->rmap;
@@ -881,6 +904,7 @@ static const struct dev_pm_ops max77620_regulator_pm_ops = {
 static const struct platform_device_id max77620_regulator_devtype[] = {
{ .name = "max77620-pmic", },
{ .name = "max20024-pmic", },
+   { .name = "max77663-pmic", },
{},
 };
 MODULE_DEVICE_TABLE(platform, max77620_regulator_devtype);
-- 
2.21.0



[PATCH v4 3/6] mfd: max77620: Fix swapped FPS_PERIOD_MAX_US values

2019-05-05 Thread Dmitry Osipenko
The FPS_PERIOD_MAX_US definitions are swapped for MAX20024 and MAX77620,
fix it.

Cc: stable 
Signed-off-by: Dmitry Osipenko 
---
 include/linux/mfd/max77620.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mfd/max77620.h b/include/linux/mfd/max77620.h
index ad2a9a852aea..b4fd5a7c2aaa 100644
--- a/include/linux/mfd/max77620.h
+++ b/include/linux/mfd/max77620.h
@@ -136,8 +136,8 @@
 #define MAX77620_FPS_PERIOD_MIN_US 40
 #define MAX20024_FPS_PERIOD_MIN_US 20
 
-#define MAX77620_FPS_PERIOD_MAX_US 2560
-#define MAX20024_FPS_PERIOD_MAX_US 5120
+#define MAX20024_FPS_PERIOD_MAX_US 2560
+#define MAX77620_FPS_PERIOD_MAX_US 5120
 
 #define MAX77620_REG_FPS_GPIO1 0x54
 #define MAX77620_REG_FPS_GPIO2 0x55
-- 
2.21.0



[PATCH v4 5/6] mfd: max77620: Provide system power-off functionality

2019-05-05 Thread Dmitry Osipenko
Provide system power-off functionality that allows to turn off machine
gracefully.

Signed-off-by: Dmitry Osipenko 
---
 drivers/mfd/max77620.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
index c2d88a5eca7a..436361ce3737 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -37,6 +37,8 @@
 #include 
 #include 
 
+static struct max77620_chip *max77620_scratch;
+
 static const struct resource gpio_resources[] = {
DEFINE_RES_IRQ(MAX77620_IRQ_TOP_GPIO),
 };
@@ -481,6 +483,15 @@ static int max77620_read_es_version(struct max77620_chip 
*chip)
return ret;
 }
 
+static void max77620_pm_power_off(void)
+{
+   struct max77620_chip *chip = max77620_scratch;
+
+   regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG1,
+  MAX77620_ONOFFCNFG1_SFT_RST,
+  MAX77620_ONOFFCNFG1_SFT_RST);
+}
+
 static int max77620_probe(struct i2c_client *client,
  const struct i2c_device_id *id)
 {
@@ -488,6 +499,7 @@ static int max77620_probe(struct i2c_client *client,
struct max77620_chip *chip;
const struct mfd_cell *mfd_cells;
int n_mfd_cells;
+   bool pm_off;
int ret;
 
chip = devm_kzalloc(>dev, sizeof(*chip), GFP_KERNEL);
@@ -554,6 +566,12 @@ static int max77620_probe(struct i2c_client *client,
return ret;
}
 
+   pm_off = of_device_is_system_power_controller(client->dev.of_node);
+   if (pm_off && !pm_power_off) {
+   max77620_scratch = chip;
+   pm_power_off = max77620_pm_power_off;
+   }
+
return 0;
 }
 
-- 
2.21.0



[PATCH v4 1/6] dt-bindings: mfd: max77620: Add compatible for Maxim 77663

2019-05-05 Thread Dmitry Osipenko
Maxim 77663 has a few minor differences in regards to hardware interface
and available capabilities by comparing it with 77620 and 20024 models,
hence re-use 77620 device-tree binding for the 77663.

Reviewed-by: Rob Herring 
Signed-off-by: Dmitry Osipenko 
---
 Documentation/devicetree/bindings/mfd/max77620.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mfd/max77620.txt 
b/Documentation/devicetree/bindings/mfd/max77620.txt
index 9c16d51cc15b..b75283787ba1 100644
--- a/Documentation/devicetree/bindings/mfd/max77620.txt
+++ b/Documentation/devicetree/bindings/mfd/max77620.txt
@@ -4,7 +4,8 @@ Required properties:
 ---
 - compatible: Must be one of
"maxim,max77620"
-   "maxim,max20024".
+   "maxim,max20024"
+   "maxim,max77663"
 - reg: I2C device address.
 
 Optional properties:
@@ -105,6 +106,7 @@ Optional properties:
 Here supported time periods by device in microseconds are as follows:
 MAX77620 supports 40, 80, 160, 320, 640, 1280, 2560 and 5120 microseconds.
 MAX20024 supports 20, 40, 80, 160, 320, 640, 1280 and 2540 microseconds.
+MAX77663 supports 20, 40, 80, 160, 320, 640, 1280 and 2540 microseconds.
 
 -maxim,power-ok-control: configure map power ok bit
1: Enables POK(Power OK) to control nRST_IO and GPIO1
-- 
2.21.0



[PATCH v4 4/6] mfd: max77620: Support Maxim 77663

2019-05-05 Thread Dmitry Osipenko
Add support for Maxim 77663 using the Max77620 driver. The hardware
is very similar to Max77663/20024, although there are couple minor
differences.

Signed-off-by: Dmitry Osipenko 
---
 drivers/mfd/max77620.c   | 69 +++-
 include/linux/mfd/max77620.h |  1 +
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
index d8ddd1a6f304..c2d88a5eca7a 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -111,6 +111,26 @@ static const struct mfd_cell max20024_children[] = {
},
 };
 
+static const struct mfd_cell max77663_children[] = {
+   { .name = "max77620-pinctrl", },
+   { .name = "max77620-clock", },
+   { .name = "max77663-pmic", },
+   { .name = "max77620-watchdog", },
+   {
+   .name = "max77620-gpio",
+   .resources = gpio_resources,
+   .num_resources = ARRAY_SIZE(gpio_resources),
+   }, {
+   .name = "max77620-rtc",
+   .resources = rtc_resources,
+   .num_resources = ARRAY_SIZE(rtc_resources),
+   }, {
+   .name = "max77663-power",
+   .resources = power_resources,
+   .num_resources = ARRAY_SIZE(power_resources),
+   },
+};
+
 static const struct regmap_range max77620_readable_ranges[] = {
regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_DVSSD4),
 };
@@ -171,6 +191,35 @@ static const struct regmap_config max20024_regmap_config = 
{
.volatile_table = _volatile_table,
 };
 
+static const struct regmap_range max77663_readable_ranges[] = {
+   regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_CID5),
+};
+
+static const struct regmap_access_table max77663_readable_table = {
+   .yes_ranges = max77663_readable_ranges,
+   .n_yes_ranges = ARRAY_SIZE(max77663_readable_ranges),
+};
+
+static const struct regmap_range max77663_writable_ranges[] = {
+   regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_CID5),
+};
+
+static const struct regmap_access_table max77663_writable_table = {
+   .yes_ranges = max77663_writable_ranges,
+   .n_yes_ranges = ARRAY_SIZE(max77663_writable_ranges),
+};
+
+static const struct regmap_config max77663_regmap_config = {
+   .name = "power-slave",
+   .reg_bits = 8,
+   .val_bits = 8,
+   .max_register = MAX77620_REG_CID5 + 1,
+   .cache_type = REGCACHE_RBTREE,
+   .rd_table = _readable_table,
+   .wr_table = _writable_table,
+   .volatile_table = _volatile_table,
+};
+
 /*
  * MAX77620 and MAX20024 has the following steps of the interrupt handling
  * for TOP interrupts:
@@ -240,6 +289,9 @@ static int max77620_get_fps_period_reg_value(struct 
max77620_chip *chip,
case MAX77620:
fps_min_period = MAX77620_FPS_PERIOD_MIN_US;
break;
+   case MAX77663:
+   fps_min_period = MAX20024_FPS_PERIOD_MIN_US;
+   break;
default:
return -EINVAL;
}
@@ -274,6 +326,9 @@ static int max77620_config_fps(struct max77620_chip *chip,
case MAX77620:
fps_max_period = MAX77620_FPS_PERIOD_MAX_US;
break;
+   case MAX77663:
+   fps_max_period = MAX20024_FPS_PERIOD_MAX_US;
+   break;
default:
return -EINVAL;
}
@@ -375,6 +430,9 @@ static int max77620_initialise_fps(struct max77620_chip 
*chip)
}
 
 skip_fps:
+   if (chip->chip_id == MAX77663)
+   return 0;
+
/* Enable wake on EN0 pin */
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
 MAX77620_ONOFFCNFG2_WK_EN0,
@@ -453,6 +511,11 @@ static int max77620_probe(struct i2c_client *client,
n_mfd_cells = ARRAY_SIZE(max20024_children);
rmap_config = _regmap_config;
break;
+   case MAX77663:
+   mfd_cells = max77663_children;
+   n_mfd_cells = ARRAY_SIZE(max77663_children);
+   rmap_config = _regmap_config;
+   break;
default:
dev_err(chip->dev, "ChipID is invalid %d\n", chip->chip_id);
return -EINVAL;
@@ -546,6 +609,9 @@ static int max77620_i2c_suspend(struct device *dev)
return ret;
}
 
+   if (chip->chip_id == MAX77663)
+   goto out;
+
/* Disable WK_EN0 */
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
 MAX77620_ONOFFCNFG2_WK_EN0, 0);
@@ -581,7 +647,7 @@ static int max77620_i2c_resume(struct device *dev)
 * For MAX20024: No need to configure WKEN0 on resume as
 * it is configured on Init.
 */
-   if (chip->chip_id == MAX20024)
+   if (chip->chip_id == MAX20024 || chip->chip_id == MAX77663)
goto out;
 
/* Enable WK_EN0 */
@@ -603,6 +669,7 @@ static int 

[PATCH v4 0/6] Add support for Maxim 77663 MFD

2019-05-05 Thread Dmitry Osipenko
Hello,

This series adds support for the Maxim 77663 chip that provides PMIC, RTC,
GPIO and watchdog timer functionality. The hardware is very similar to the
Maxim 77620/20024 hardware units that are already supported by the kernel,
hence we will reuse the existing drivers for 77663. The GPIO, regulator,
RTC and watchdog timer functionality was tested on a Nexus 7 tablet that
has the Max77663 chip, everything is working perfectly fine. I'm looking
at upstreaming support for that tablet device and Max77663 is one of the
core components that are currently missing in the upstream kernel.

Changelog:

v4: Addressed review comments from Rob Herring to v3 by making use of
generic "system-power-controller" property and making couple other
minor cosmetic changes. Added Mark's Brown a-b to the regulator-patch.

v3: Dropped "Support device-tree properly" patch since turned out that
I2C core takes care of the device-tree matching and I wasn't aware of
it.

v2: Added PINCTRL sub-device to Max77663 MFD as it looks compatible with
77620.

Added new "maxim,system-power-controller" OF property.

Patch "Support device-tree properly" now doesn't remove driver's
"id_table" since potentially it could have some use in the downstream
kernel forks and it doesn't hurt to keep it around.

Dmitry Osipenko (6):
  dt-bindings: mfd: max77620: Add compatible for Maxim 77663
  dt-bindings: mfd: max77620: Add system-power-controller property
  mfd: max77620: Fix swapped FPS_PERIOD_MAX_US values
  mfd: max77620: Support Maxim 77663
  mfd: max77620: Provide system power-off functionality
  regulator: max77620: Support Maxim 77663

 .../devicetree/bindings/mfd/max77620.txt  |  9 +-
 drivers/mfd/max77620.c| 87 ++-
 drivers/regulator/max77620-regulator.c| 26 +-
 include/linux/mfd/max77620.h  |  5 +-
 4 files changed, 122 insertions(+), 5 deletions(-)

-- 
2.21.0



Re: [PATCH 3/3] iio: stmpe-adc: Enable all stmpe-adc interrupts just once

2019-05-05 Thread Jonathan Cameron
On Fri,  3 May 2019 15:57:25 +0200
Philippe Schenker  wrote:

> From: Philippe Schenker 
> 
> This commit will enable the interrupts of all channels handled by this
> driver only once in the probe function.
> 
> This will improve performance because one byte less has to be written over
> i2c on each read out of the adc. On the fastest ADC mode this will improve
> read out speed by 15%.
> 
> Signed-off-by: Philippe Schenker 
Makes sense. I'll pick this up once patch 2 discussion is sorted.

Jonathan

> 
> ---
> 
>  drivers/iio/adc/stmpe-adc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> index baa41ffc0d76..427c890c6e7d 100644
> --- a/drivers/iio/adc/stmpe-adc.c
> +++ b/drivers/iio/adc/stmpe-adc.c
> @@ -72,9 +72,6 @@ static int stmpe_read_voltage(struct stmpe_adc *info,
>   return -EINVAL;
>   }
>  
> - stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN,
> - STMPE_ADC_CH(info->channel));
> -
>   stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT,
>   STMPE_ADC_CH(info->channel));
>  
> @@ -328,6 +325,9 @@ static int stmpe_adc_probe(struct platform_device *pdev)
>   if (ret)
>   return ret;
>  
> + stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN,
> + ~(norequest_mask & 0xFF));
> +
>   return devm_iio_device_register(>dev, indio_dev);
>  }
>  



Re: [PATCH 1/3] iio: stmpe-adc: Remove unnecessary assignment

2019-05-05 Thread Jonathan Cameron
On Fri,  3 May 2019 15:57:23 +0200
Philippe Schenker  wrote:

> From: Philippe Schenker 
> 
> Remove unnecessary assignment. This could potentially cause an issue, if
> the wait function runs into a timeout. Furthermore is this assignment also
> not there in stmpe_read_temp()
> 
> Signed-off-by: Philippe Schenker 
This would probably have benefited from a statement that *val is set
twice currently. Good find.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> ---
> 
>  drivers/iio/adc/stmpe-adc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> index 37f4b74a5d32..87141177fbda 100644
> --- a/drivers/iio/adc/stmpe-adc.c
> +++ b/drivers/iio/adc/stmpe-adc.c
> @@ -78,8 +78,6 @@ static int stmpe_read_voltage(struct stmpe_adc *info,
>   stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT,
>   STMPE_ADC_CH(info->channel));
>  
> - *val = info->value;
> -
>   ret = wait_for_completion_interruptible_timeout
>   (>completion, STMPE_ADC_TIMEOUT);
>  



Re: [PATCH 6/7] iio: adc: sun4i-gpadc-iio: add support for H6 thermal sensor

2019-05-05 Thread Jonathan Cameron
On Fri,  3 May 2019 03:28:12 -0400
Yangtao Li  wrote:

> This patch adds support for the H6 ths sensor.
> 
> TODO: calibrate thermal sensor by using information from sid.
> 
> Signed-off-by: Yangtao Li 
This and the patches before it that I haven't comment on look fine to me.

thanks,

Jonathan
> ---
>  drivers/iio/adc/sun4i-gpadc-iio.c | 65 +++
>  include/linux/mfd/sun4i-gpadc.h   |  9 +
>  2 files changed, 74 insertions(+)
> 
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
> b/drivers/iio/adc/sun4i-gpadc-iio.c
> index f24eb76d65c0..9b6fc592f54c 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -120,6 +120,20 @@ static const struct gpadc_data sun8i_a33_gpadc_data = {
>   .temp_data_base = SUN4I_GPADC_TEMP_DATA,
>  };
>  
> +static int sun50i_gpadc_disable(struct sun4i_gpadc_iio *info);
> +static int sun50i_gpadc_enable(struct sun4i_gpadc_iio *info);
> +
> +static const struct gpadc_data sun50i_h6_gpadc_data = {
> + .temp_offset = -2809,
> + .temp_scale = -67,
> + .has_bus_clk = true,
> + .has_bus_rst = true,
> + .gpadc_enable = sun50i_gpadc_enable,
> + .gpadc_disable = sun50i_gpadc_disable,
> + .sensor_count = 2,
> + .temp_data_base = SUN50I_H6_GPADC_TEMP_DATA,
> +};
> +
>  struct sun4i_sensor_tzd {
>   struct sun4i_gpadc_iio  *info;
>   struct thermal_zone_device  *tzd;
> @@ -452,6 +466,53 @@ static int sun4i_gpadc_enable(struct sun4i_gpadc_iio 
> *info)
>   return 0;
>  }
>  
> +static int sun50i_gpadc_enable(struct sun4i_gpadc_iio *info)
> +{
> + int ret, val;
> +
> + ret = reset_control_deassert(info->reset);
> + if (ret)
> + return ret;
> +
> + ret = clk_prepare_enable(info->bus_clk);
> + if (ret)
> + goto assert_reset;
> +
> + /*
> +  * clkin = 24MHz
> +  * T acquire = clkin / (SUN50I_GPADC_CTRL0_T_ACQ + 1)
> +  *   = 20us
> +  */
> + regmap_write(info->regmap, SUN4I_GPADC_CTRL0,
> +  SUN50I_GPADC_CTRL0_T_ACQ(479));
> + /* average over 4 samples */
> + regmap_write(info->regmap, SUN50I_H6_GPADC_CTRL3,
> +  SUN4I_GPADC_CTRL3_FILTER_EN |
> +  SUN4I_GPADC_CTRL3_FILTER_TYPE(1));
> + /* period = (SUN50I_GPADC_TPR_TEMP_PERIOD + 1) * 4096 / clkin; ~10ms */
> + regmap_write(info->regmap, SUN50I_GPADC_TPR,
> +  SUN50I_GPADC_TPR_TEMP_PERIOD(58));
> + /* TODO: calibrate ths */
> + /* enable sensor */
> + val = GENMASK(info->data->sensor_count - 1, 0);
> + regmap_write(info->regmap, SUN4I_GPADC_CTRL1, val);
> +
> + return 0;
> +
> +assert_reset:
> + reset_control_assert(info->reset);
> +
> + return ret;
> +}
> +
> +static int sun50i_gpadc_disable(struct sun4i_gpadc_iio *info)
> +{
> + clk_disable_unprepare(info->bus_clk);
> + reset_control_assert(info->reset);
> +
> + return 0;
> +}
> +
>  static int sun4i_gpadc_runtime_suspend(struct device *dev)
>  {
>   struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
> @@ -546,6 +607,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = {
>   .compatible = "allwinner,sun8i-a33-ths",
>   .data = _a33_gpadc_data,
>   },
> + {
> + .compatible = "allwinner,sun50i-h6-ths",
> + .data = _h6_gpadc_data,
> + },
>   { /* sentinel */ }
>  };
>  
> diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
> index 139872c2e0fe..f505013e9c0d 100644
> --- a/include/linux/mfd/sun4i-gpadc.h
> +++ b/include/linux/mfd/sun4i-gpadc.h
> @@ -19,6 +19,9 @@
>  #define SUN4I_GPADC_CTRL0_FS_DIV(x)  ((GENMASK(3, 0) & (x)) 
> << 16)
>  #define SUN4I_GPADC_CTRL0_T_ACQ(x)   (GENMASK(15, 0) & (x))
>  
> +/* TP_CTRL0 bits for sun50i SOCs */
> +#define SUN50I_GPADC_CTRL0_T_ACQ(x)  ((GENMASK(15, 0) & (x)) 
> << 16)
> +
>  #define SUN4I_GPADC_CTRL10x04
>  
>  #define SUN4I_GPADC_CTRL1_STYLUS_UP_DEBOUNCE(x)  ((GENMASK(7, 0) 
> & (x)) << 12)
> @@ -49,6 +52,9 @@
>  #define SUN4I_GPADC_CTRL2_PRE_MEA_EN BIT(24)
>  #define SUN4I_GPADC_CTRL2_PRE_MEA_THRE_CNT(x)(GENMASK(23, 0) 
> & (x))
>  
> +#define SUN50I_GPADC_TPR 0x08
> +#define SUN50I_GPADC_TPR_TEMP_PERIOD(x)  ((GENMASK(19, 
> 0) & (x)) << 12)
> +
>  #define SUN4I_GPADC_CTRL30x0c
>  
>  #define SUN4I_GPADC_CTRL3_FILTER_EN  BIT(2)
> @@ -84,6 +90,9 @@
>  #define SUN4I_GPADC_TEMP_DATA0x20
>  #define SUN4I_GPADC_DATA 0x24
>  
> +#define SUN50I_H6_GPADC_CTRL30x30
> +#define SUN50I_H6_GPADC_TEMP_DATA0xc0
> +
>  #define SUN4I_GPADC_IRQ_FIFO_DATA0
>  #define SUN4I_GPADC_IRQ_TEMP_DATA   

Re: [PATCH 1/7] iio: adc: sun4i-gpadc: rework for support multiple thermal sensor

2019-05-05 Thread Jonathan Cameron
On Fri,  3 May 2019 03:28:07 -0400
Yangtao Li  wrote:

> For some SOCs, there are more than one thermal sensor, and there are
> currently four sensors on the A80. So we need to do some work in order
> to support multiple thermal sensors:
> 
>   1) add sensor_count in gpadc_data.
>   2) introduce sun4i_sensor_tzd in sun4i_gpadc_iio, to support multiple
>  thermal_zone_device and distinguish between different sensors.
>   3) modify read temperature and initialization function.
This comment doesn't mention the devm change. If it had it would have
raised immediate alarm bells.

I'm also not keen on the web of pointers that this driver is steadily
evolving.  I can't immediately see how to reduce that complexity however.

Jonathan

> 
> Signed-off-by: Yangtao Li 
> ---
>  drivers/iio/adc/sun4i-gpadc-iio.c | 61 +++
>  1 file changed, 45 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
> b/drivers/iio/adc/sun4i-gpadc-iio.c
> index 04d7147e0110..844fd52bd22f 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -56,6 +56,7 @@ struct gpadc_data {
>   unsigned inttp_adc_select;
>   unsigned int(*adc_chan_select)(unsigned int chan);
>   unsigned intadc_chan_mask;
> + unsigned intsensor_count;
>  };
>  
>  static const struct gpadc_data sun4i_gpadc_data = {
> @@ -65,6 +66,7 @@ static const struct gpadc_data sun4i_gpadc_data = {
>   .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
>   .adc_chan_select = _gpadc_chan_select,
>   .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
> + .sensor_count = 1,
>  };
>  
>  static const struct gpadc_data sun5i_gpadc_data = {
> @@ -74,6 +76,7 @@ static const struct gpadc_data sun5i_gpadc_data = {
>   .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
>   .adc_chan_select = _gpadc_chan_select,
>   .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
> + .sensor_count = 1,
>  };
>  
>  static const struct gpadc_data sun6i_gpadc_data = {
> @@ -83,14 +86,24 @@ static const struct gpadc_data sun6i_gpadc_data = {
>   .tp_adc_select = SUN6I_GPADC_CTRL1_TP_ADC_SELECT,
>   .adc_chan_select = _gpadc_chan_select,
>   .adc_chan_mask = SUN6I_GPADC_CTRL1_ADC_CHAN_MASK,
> + .sensor_count = 1,
>  };
>  
>  static const struct gpadc_data sun8i_a33_gpadc_data = {
>   .temp_offset = -1662,
>   .temp_scale = 162,
>   .tp_mode_en = SUN8I_GPADC_CTRL1_CHOP_TEMP_EN,
> + .sensor_count = 1,
>  };
>  
> +struct sun4i_sensor_tzd {
> + struct sun4i_gpadc_iio  *info;
> + struct thermal_zone_device  *tzd;
> + unsigned intsensor_id;
> +};
> +
> +#define MAX_SENSOR_COUNT 4
> +
>  struct sun4i_gpadc_iio {
>   struct iio_dev  *indio_dev;
>   struct completion   completion;
> @@ -105,7 +118,7 @@ struct sun4i_gpadc_iio {
>   boolno_irq;
>   /* prevents concurrent reads of temperature and ADC */
>   struct mutexmutex;
> - struct thermal_zone_device  *tzd;
> + struct sun4i_sensor_tzd tzds[MAX_SENSOR_COUNT];
>   struct device   *sensor_device;
>  };
>  
> @@ -270,7 +283,8 @@ static int sun4i_gpadc_adc_read(struct iio_dev 
> *indio_dev, int channel,
>   return sun4i_gpadc_read(indio_dev, channel, val, info->fifo_data_irq);
>  }
>  
> -static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val)
> +static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val,
> +  unsigned int sensor)
>  {
>   struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
>  
> @@ -324,7 +338,7 @@ static int sun4i_gpadc_read_raw(struct iio_dev *indio_dev,
>   ret = sun4i_gpadc_adc_read(indio_dev, chan->channel,
>  val);
>   else
> - ret = sun4i_gpadc_temp_read(indio_dev, val);
> + ret = sun4i_gpadc_temp_read(indio_dev, val, 0);
>  
>   if (ret)
>   return ret;
> @@ -417,10 +431,11 @@ static int sun4i_gpadc_runtime_resume(struct device 
> *dev)
>  
>  static int sun4i_gpadc_get_temp(void *data, int *temp)
>  {
> - struct sun4i_gpadc_iio *info = data;
> + struct sun4i_sensor_tzd *tzd = data;
> + struct sun4i_gpadc_iio *info = tzd->info;
>   int val, scale, offset;
>  
> - if (sun4i_gpadc_temp_read(info->indio_dev, ))
> + if (sun4i_gpadc_temp_read(info->indio_dev, , tzd->sensor_id))
>   return -ETIMEDOUT;
>  
>   sun4i_gpadc_temp_scale(info->indio_dev, );
> @@ -609,6 +624,28 @@ static int sun4i_gpadc_probe_mfd(struct platform_device 
> *pdev,
>   return 0;
>  }
>  
> +static int sun4i_sensor_init(struct sun4i_gpadc_iio *info)
> +{
> + int i = 0;
> +
> + for (; i < info->data->sensor_count; i++) {
> + 

Re: [RFC PATCH v1 0/6] Introduce machine-specific regulators coupling API

2019-05-05 Thread Dmitry Osipenko
14.04.2019 20:59, Dmitry Osipenko пишет:
> Hello,
> 
> I was looking into how to properly implement regulators coupling for
> NVIDIA Tegra SoC's and ended up with this patchset that introduces
> machine-specific regulators coupling. Upstream kernel now has support
> for a simple variants of regulators coupling in a form of limiting
> maximum voltage spreading between two regulators, but that's not enough
> for the case of Tegra SoC's. It's a bit difficult to support universally
> all possible coupling restrictions in a form of device-tree description,
> so here comes the machine-specific coupling API which allow platforms
> to customize coupling algorithms.

Hello people,

I want to point out that the CPUFreq patches are currently blocked
because of the missing support for a regulators coupling on Tegra and we
want to switch to a proper-generic OPP voltage/freq API.

The other thing that I also forgot to mention that we will need a way to
keep on hold CORE voltage changes until all relevant peripheral drivers
are loaded and claimed the required voltage level. That is needed
because some of the critical peripherals are left in a running state
after bootloader. Currently, in this patchset, we are not allowing CORE
voltage to go lower than the level left after bootloader and once all
the relevant drivers will get support for the voltage management, we
should be able to unhold the lower CORE voltages around late_init().

Will be great if you could take a look at this series and tell your
opinion on the approach, I'll be happy to put more effort into it all if
will be needed. There is now a bit more advanced version of the series
that adds more error-checking and makes use of max-spread and max-step
values from the regular constraints (i.e. values defined in device-tree)
instead of hardcoding them in the code.


[PATCH v5 0/5] PCI: Patch series to support Thunderbolt without any BIOS support

2019-05-05 Thread Nicholas Johnson
Since PATCH v4:

I have added some of the evidence and bug reports into the applicable
patches.

Users of pci=hpmemsize should not notice any changes in functionality
with this patch series when upgrading the kernel. I realised I could
make the variable to achieve this reside in pci_setup, rather than
globally.

Please let me know if anything else needs changing.

Nicholas Johnson (5):
  PCI: Consider alignment of hot-added bridges when distributing
resources
  PCI: Modify extend_bridge_window() to set resource size directly
  PCI: Fix bug resulting in double hpmemsize being assigned to MMIO
window
  PCI: Add pci=hpmemprefsize parameter to set MMIO_PREF size
independently
  PCI: Cleanup block comments in setup-bus.c to match kernel style

 .../admin-guide/kernel-parameters.txt |   7 +-
 drivers/pci/pci.c |  18 +-
 drivers/pci/setup-bus.c   | 568 +-
 include/linux/pci.h   |   3 +-
 4 files changed, 317 insertions(+), 279 deletions(-)

-- 
2.19.1



Re: [PATCH 0/3] block: sed-opal: add support for shadow MBR done flag and write

2019-05-05 Thread Scott Bauer
On Fri, May 03, 2019 at 10:32:19PM +0200, David Kozub wrote:
> On Wed, 1 May 2019, Christoph Hellwig wrote:
> 
> > > I successfully tested toggling the MBR done flag and writing the shadow 
> > > MBR
> > > using some tools I hacked together[4] with a Samsung SSD 850 EVO drive.
> > 
> > Can you submit the tool to util-linux so that we get it into distros?
> 
> There is already Scott's sed-opal-temp[1] and a fork by Jonas that adds
> support for older version of these new IOCTLs[2]. There was already some
> discussion of getting that to util-linux.[3]
> 
> While I like my hack, sed-opal-temp can do much more (my tool supports just
> the few things I actually use). But there are two things which sed-opal-temp
> currently lacks which my hack has:
> 
> * It can use a PBKDF2 hash (salted by disk serial number) of the password
>   rather than the password directly. This makes it compatible with sedutil
>   and I think it's also better practice (as firmware can contain many
>   surprises).
> 
> * It contains a 'PBA' (pre-boot authorization) tool. A tool intended to be
>   run from shadow mbr that asks for a password and uses it to unlock all
>   disks and set shadow mbr done flag, so after restart the computer boots
>   into the real OS.
> 
> @Scott: What are your plans with sed-opal-temp? If you want I can update
> Jonas' patches to the adapted IOCTLs. What are your thoughts on PW hashing
> and a PBA tool?

I will accept any and all patches to sed opal tooling, I am not picky. I will
also give up maintainership of it is someone else feels they can (rightfully
so) do a better job.

Jon sent me a patch for the tool that will deal with writing to the shadow MBR,
so once we know these patches are going in i'll pull that patch into the tool.

Then I guess that leaves PBKDF2 which I don't think will be too hard to pull in.

With regard to your PBA tool, is that actually being run post-uefi/pre-linux?
IE are we writing your tool into the SMBR and that's what is being run on 
bootup?

Jon, if you think it's a good idea can you ask David if Revanth or you wants
to take over the tooling? Or if anyone else here wants to own it then let me 
know.



[PATCH v5 2/5] PCI: Modify extend_bridge_window() to set resource size directly

2019-05-05 Thread Nicholas Johnson
Background
==

In the current state, the PCI allocation could fail with Thunderbolt
under certain unusual circumstances, because add_list resources are
"optional". Guaranteed allocation requires guaranteed resource sizes.

It is difficult to give examples of these failures - because without the
previous patch in the series, the symptoms of the problem are hidden by
larger problems. This patch has been split from the previous patch and
makes little sense on its own - as it is almost impossible to see the
effect of this patch without first fixing the problems addressed by the
previous patch. So the evidence I put forward for making this change is
that because add_list resources are "optional", there could be any
number of unforeseen bugs that are yet to be encountered if the kernel
decides not to assign all of the optional size. In kernel development,
we should not play around with chance.

Moving away from add_size also allows for use of pci=hpmemsize to assign
resources. Previously, when using add_size and not allowing the add_size
to shrink, it made it impossible to distribute resources. If a hotplug
bridge has size X, and below it is some devices with non-zero size Y and
a nested hotplug bridge of same size X, fitting X+Y into size X is
mathematically impossible.

This patch solves this by dropping add_size and giving each bridge the
maximum size possible without failing resource assignment. Using
pci=hpmemsize still works as pci_assign_unassigned_root_bus_resources()
does not call pci_bus_distribute_available_resources(). At boot,
pci_assign_unassigned_root_bus_resources() is used, instead of
pci_bridge_distribute_available_resources().

By allowing to use pci=hpmemsize, it removes the reliance on the
firmware to declare the window resources under the root port, and could
pay off in the future with USB4 (which is backward-compatible to
Thunderbolt devices, and not specific to Intel systems). Users of
Thunderbolt hardware on unsupported systems will be able to specify the
resources in the kernel parameters. Users of official systems will be
able to override the default firmware window sizes to allocate much
larger resource sizes, potentially enabling Thunderbolt support for
devices with massive BARs (with a few other problems solved by later
patches in this series).

Patch notes
==

Modify extend_bridge_window() to remove the resource from add_list and
change the resource size directly.

Modify extend_bridge_window() to reset resources that are being assigned
zero size. This is required to prevent the bridge not being enabled due
to resources with zero size. This is a direct requirement to prevent the
change away from using add_list from introducing a regression - because
before, it was not possible to end up with zero size.

Signed-off-by: Nicholas Johnson 
---
 drivers/pci/setup-bus.c | 41 +++--
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index dae4bae12..5214815c7 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1815,27 +1815,40 @@ void __init pci_assign_unassigned_resources(void)
 }
 
 static void extend_bridge_window(struct pci_dev *bridge, struct resource *res,
-   struct list_head *add_list, resource_size_t available)
+   struct list_head *add_list, resource_size_t new_size)
 {
-   struct pci_dev_resource *dev_res;
+   resource_size_t add_size;
 
if (res->parent)
return;
 
-   if (resource_size(res) >= available)
-   return;
-
-   dev_res = res_to_dev_res(add_list, res);
-   if (!dev_res)
-   return;
+   if (new_size >= resource_size(res)) {
+   add_size = new_size - resource_size(res);
+   pci_dbg(bridge, "bridge window %pR extended by %pa\n", res,
+   _size);
+   } else {
+   add_size = resource_size(res) - new_size;
+   pci_dbg(bridge, "bridge window %pR shrunken by %pa\n", res,
+   _size);
+   }
 
-   /* Is there room to extend the window? */
-   if (available - resource_size(res) <= dev_res->add_size)
-   return;
+   /*
+* Resources requested using add_size in additional resource lists are
+* considered optional when allocated. Guaranteed size of allocation
+* is required to guarantee successful resource distribution. Hence,
+* the size of the actual resource must be adjusted, and the resource
+* removed from add_list to prevent any additional size interfering.
+*/
+   res->end = res->start + new_size - 1;
+   remove_from_list(add_list, res);
 
-   dev_res->add_size = available - resource_size(res);
-   pci_dbg(bridge, "bridge window 

[PATCH v5 3/5] PCI: Fix bug resulting in double hpmemsize being assigned to MMIO window

2019-05-05 Thread Nicholas Johnson
Background
==

Solve bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=203243

Currently, the kernel can sometimes assign the MMIO_PREF window
additional size into the MMIO window, resulting in double the MMIO
additional size, even if the MMIO_PREF window was successful.

This happens if in the first pass, the MMIO_PREF succeeds but the MMIO
fails. In the next pass, because MMIO_PREF is already assigned, the
attempt to assign MMIO_PREF returns an error code instead of success
(nothing more to do, already allocated).

Example of problem (more context can be found in the bug report URL):

Mainline kernel:
pci :06:01.0: BAR 14: assigned [mem 0x9010-0xa00f] = 256M
pci :06:04.0: BAR 14: assigned [mem 0xa020-0xb01f] = 256M

Patched kernel:
pci :06:01.0: BAR 14: assigned [mem 0x9010-0x980f] = 128M
pci :06:04.0: BAR 14: assigned [mem 0x9820-0xa01f] = 128M

This was using pci=realloc,hpmemsize=128M,nocrs - on the same machine
with the same configuration, with a Ubuntu mainline kernel and a kernel
patched with this patch series.

This patch is vital for the next patch in the series. The next patch
allows the user to specify MMIO and MMIO_PREF independently. If the
MMIO_PREF is set to be very large, this bug will end up more than
doubling the MMIO size. The bug results in the MMIO_PREF being added to
the MMIO window, which means doubling if MMIO_PREF size == MMIO size.
With a large MMIO_PREF, without this patch, the MMIO window will likely
fail to be assigned altogether due to lack of 32-bit address space.

Patch notes
==

Change find_free_bus_resource() to not skip assigned resources with
non-null parent.

Add checks in pbus_size_io() and pbus_size_mem() to return success if
resource returned from find_free_bus_resource() is already allocated.

This avoids pbus_size_io() and pbus_size_mem() returning error code to
__pci_bus_size_bridges() when a resource has been successfully assigned
in a previous pass. This fixes the existing behaviour where space for a
resource could be reserved multiple times in different parent bridge
windows. This also greatly reduces the number of failed BAR messages in
dmesg when Linux assigns resources.

Signed-off-by: Nicholas Johnson 
---
 drivers/pci/setup-bus.c | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 5214815c7..e7126cc0e 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -752,11 +752,17 @@ static void pci_bridge_check_ranges(struct pci_bus *bus)
}
 }
 
-/* Helper function for sizing routines: find first available
-   bus resource of a given type. Note: we intentionally skip
-   the bus resources which have already been assigned (that is,
-   have non-NULL parent resource). */
-static struct resource *find_free_bus_resource(struct pci_bus *bus,
+/*
+ * Helper function for sizing routines: find first bus resource of a given
+ * type. Note: we do not skip the bus resources which have already been
+ * assigned (r->parent != NULL). This is because a resource that is already
+ * assigned (nothing more to be done) will be indistinguishable from one that
+ * failed due to lack of space if we skip assigned resources. If the caller
+ * function cannot tell the difference then it might try to place the
+ * resources in a different window, doubling up on resources or causing
+ * unforeseeable issues.
+ */
+static struct resource *find_bus_resource_of_type(struct pci_bus *bus,
 unsigned long type_mask, unsigned long type)
 {
int i;
@@ -765,7 +771,7 @@ static struct resource *find_free_bus_resource(struct 
pci_bus *bus,
pci_bus_for_each_resource(bus, r, i) {
if (r == _resource || r == _resource)
continue;
-   if (r && (r->flags & type_mask) == type && !r->parent)
+   if (r && (r->flags & type_mask) == type)
return r;
}
return NULL;
@@ -863,14 +869,16 @@ static void pbus_size_io(struct pci_bus *bus, 
resource_size_t min_size,
resource_size_t add_size, struct list_head *realloc_head)
 {
struct pci_dev *dev;
-   struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO,
-   IORESOURCE_IO);
+   struct resource *b_res = find_bus_resource_of_type(bus, IORESOURCE_IO,
+   IORESOURCE_IO);
resource_size_t size = 0, size0 = 0, size1 = 0;
resource_size_t children_add_size = 0;
resource_size_t min_align, align;
 
if (!b_res)
return;
+   if (b_res->parent)
+   return;
 
min_align = window_alignment(bus, IORESOURCE_IO);

[PATCH v5 4/5] PCI: Add pci=hpmemprefsize parameter to set MMIO_PREF size independently

2019-05-05 Thread Nicholas Johnson
Add kernel parameter pci=hpmemprefsize=nn[KMG] to control MMIO_PREF size
for PCI hotplug bridges.

Change behaviour of pci=hpmemsize=nn[KMG] to not set MMIO_PREF size if
hpmempref has been specified, rather than controlling both MMIO and
MMIO_PREF sizes unconditionally.

Update kernel-parameters documentation to reflect the above changes.

The effect of the above changes is to allow for MMIO and MMIO_PREF to be
specified independently, whilst ensuring no changes in functionality are
noticed by the user if updating kernel version with hpmemsize specified.

Signed-off-by: Nicholas Johnson 
---
 .../admin-guide/kernel-parameters.txt |  7 +-
 drivers/pci/pci.c | 18 ++---
 drivers/pci/setup-bus.c   | 25 +++
 include/linux/pci.h   |  3 ++-
 4 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 2b8ee90bb..400407c27 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3361,7 +3361,12 @@
reserved for hotplug bridge's IO window.
Default size is 256 bytes.
hpmemsize=nn[KMG]   The fixed amount of bus space which is
-   reserved for hotplug bridge's memory window.
+   reserved for hotplug bridge's MMIO window. If
+   hpmemprefsize is not specified, then the same
+   size is applied to hotplug bridge's MMIO_PREF
+   window. Default size is 2 megabytes.
+   hpmemprefsize=nn[KMG]   The fixed amount of bus space which is
+   reserved for hotplug bridge's MMIO_PREF window.
Default size is 2 megabytes.
hpbussize=nnThe minimum amount of additional bus numbers
reserved for buses below a hotplug bridge.
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7c1b362f5..7c7b95aab 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -85,10 +85,12 @@ unsigned long pci_cardbus_io_size = DEFAULT_CARDBUS_IO_SIZE;
 unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;
 
 #define DEFAULT_HOTPLUG_IO_SIZE(256)
-#define DEFAULT_HOTPLUG_MEM_SIZE   (2*1024*1024)
+#define DEFAULT_HOTPLUG_MMIO_SIZE  (2*1024*1024)
+#define DEFAULT_HOTPLUG_MMIO_PREF_SIZE (2*1024*1024)
 /* pci=hpmemsize=nnM,hpiosize=nn can override this */
 unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
-unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
+unsigned long pci_hotplug_mmio_size = DEFAULT_HOTPLUG_MMIO_SIZE;
+unsigned long pci_hotplug_mmio_pref_size = DEFAULT_HOTPLUG_MMIO_PREF_SIZE;
 
 #define DEFAULT_HOTPLUG_BUS_SIZE   1
 unsigned long pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
@@ -6211,6 +6213,8 @@ EXPORT_SYMBOL(pci_fixup_cardbus);
 
 static int __init pci_setup(char *str)
 {
+   bool mmio_pref_specified = false;
+
while (str) {
char *k = strchr(str, ',');
if (k)
@@ -6245,7 +6249,15 @@ static int __init pci_setup(char *str)
} else if (!strncmp(str, "hpiosize=", 9)) {
pci_hotplug_io_size = memparse(str + 9, );
} else if (!strncmp(str, "hpmemsize=", 10)) {
-   pci_hotplug_mem_size = memparse(str + 10, );
+   pci_hotplug_mmio_size =
+   memparse(str + 10, );
+   if (!mmio_pref_specified)
+   pci_hotplug_mmio_pref_size =
+   pci_hotplug_mmio_size;
+   } else if (!strncmp(str, "hpmemprefsize=", 14)) {
+   mmio_pref_specified = true;
+   pci_hotplug_mmio_pref_size =
+   memparse(str + 14, );
} else if (!strncmp(str, "hpbussize=", 10)) {
pci_hotplug_bus_size =
simple_strtoul(str + 10, , 0);
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index e7126cc0e..4386ca941 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1187,7 +1187,8 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct 
list_head *realloc_head)
 {
struct pci_dev *dev;
unsigned long mask, prefmask, type2 = 0, type3 = 0;
-   resource_size_t additional_mem_size = 0, additional_io_size = 0;
+   resource_size_t additional_io_size = 0, additional_mmio_size = 0,
+   additional_mmio_pref_size = 0;
struct resource 

[PATCH v5 5/5] PCI: Cleanup block comments in setup-bus.c to match kernel style

2019-05-05 Thread Nicholas Johnson
Change block comments to accepted style with asterisks on each line.

Justify block comments to 80-character limit to reduce the number of
lines where possible.

Change beginnings of sentences to have capital letter.

Place periods at the ends of sentences that are only separated by
newlines.

Signed-off-by: Nicholas Johnson 
---
 drivers/pci/setup-bus.c | 310 +++-
 1 file changed, 151 insertions(+), 159 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 4386ca941..400cf616c 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -51,11 +51,9 @@ static void free_list(struct list_head *head)
 /**
  * add_to_list() - add a new resource tracker to the list
  * @head:  Head of the list
- * @dev:   device corresponding to which the resource
- * belongs
+ * @dev:   device corresponding to which the resource belongs
  * @res:   The resource to be tracked
- * @add_size:  additional size to be optionally added
- *  to the resource
+ * @add_size:  additional size to be optionally added to the resource
  */
 static int add_to_list(struct list_head *head,
 struct pci_dev *dev, struct resource *res,
@@ -158,7 +156,7 @@ static void pdev_sort_resources(struct pci_dev *dev, struct 
list_head *head)
tmp->res = r;
tmp->dev = dev;
 
-   /* fallback is smallest one or list is empty*/
+   /* fallback is smallest one or list is empty */
n = head;
list_for_each_entry(dev_res, head, list) {
resource_size_t align;
@@ -171,7 +169,7 @@ static void pdev_sort_resources(struct pci_dev *dev, struct 
list_head *head)
break;
}
}
-   /* Insert it just before n*/
+   /* Insert it just before n */
list_add_tail(>list, n);
}
 }
@@ -181,7 +179,7 @@ static void __dev_sort_resources(struct pci_dev *dev,
 {
u16 class = dev->class >> 8;
 
-   /* Don't touch classless devices or host bridges or ioapics.  */
+   /* Don't touch classless devices or host bridges or ioapics */
if (class == PCI_CLASS_NOT_DEFINED || class == PCI_CLASS_BRIDGE_HOST)
return;
 
@@ -208,12 +206,10 @@ static inline void reset_resource(struct resource *res)
  *
  * @realloc_head : head of the list tracking requests requiring additional
  * resources
- * @head : head of the list tracking requests with allocated
- * resources
+ * @head : head of the list tracking requests with allocated resources
  *
- * Walk through each element of the realloc_head and try to procure
- * additional resources for the element, provided the element
- * is in the head list.
+ * Walk through each element of the realloc_head and try to procure additional
+ * resources for the element, provided the element is in the head list.
  */
 static void reassign_resources_sorted(struct list_head *realloc_head,
struct list_head *head)
@@ -239,7 +235,7 @@ static void reassign_resources_sorted(struct list_head 
*realloc_head,
break;
}
}
-   if (!found_match)/* just skip */
+   if (!found_match) /* just skip */
continue;
 
idx = res - _res->dev->resource[0];
@@ -310,15 +306,14 @@ static unsigned long pci_fail_res_type_mask(struct 
list_head *fail_head)
struct pci_dev_resource *fail_res;
unsigned long mask = 0;
 
-   /* check failed type */
+   /* Check failed type */
list_for_each_entry(fail_res, fail_head, list)
mask |= fail_res->flags;
 
/*
-* one pref failed resource will set IORESOURCE_MEM,
-* as we can allocate pref in non-pref range.
-* Will release all assigned non-pref sibling resources
-* according to that bit.
+* One pref failed resource will set IORESOURCE_MEM, as we can allocate
+* pref in non-pref range. Will release all assigned non-pref sibling
+* resources according to that bit.
 */
return mask & (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH);
 }
@@ -328,11 +323,11 @@ static bool pci_need_to_release(unsigned long mask, 
struct resource *res)
if (res->flags & IORESOURCE_IO)
return !!(mask & IORESOURCE_IO);
 
-   /* check pref at first */
+   /* Check pref at first */
if (res->flags & IORESOURCE_PREFETCH) {
if (mask & IORESOURCE_PREFETCH)
return true;
-   /* count pref if its parent is non-pref */
+   /* Count pref if its parent is non-pref */
else if ((mask & IORESOURCE_MEM) &&
 !(res->parent->flags & IORESOURCE_PREFETCH))

[PATCH v5 1/5] PCI: Consider alignment of hot-added bridges when distributing resources

2019-05-05 Thread Nicholas Johnson
This patch solves the following bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=199581

An excerpt from the bug report:

==

Here is what happens when an Intel Gigabit ET2 quad port server adapter
is hot-added:

  pci :39:00.0: BAR 14: assigned [mem 0x5330-0x6a0f]
  ^^
  pci :3a:01.0: BAR 14: assigned [mem 0x5340-0x547f]
  ^^
The above shows that the downstream bridge (3a:01.0) window is aligned
to 2 MB instead of 1 MB as is the upstream bridge (39:00.0) window. The
remaining MMIO space (0x15a0) is assigned to the hotplug bridge
(3a:04.0) but it fails:

  pci :3a:04.0: BAR 14: no space for [mem size 0x15a0]
  pci :3a:04.0: BAR 14: failed to assign [mem size 0x15a0]

==

Rewrite pci_bus_distribute_available_resources() to better handle
bridges with different resource alignment requirements. Pass more
details arguments recursively to track the resource start and end
addresses relative to the initial hotplug bridge. This is especially
useful for Thunderbolt with native PCI enumeration, enabling external
graphics cards and other devices with bridge alignment higher than
0x10 bytes.

Signed-off-by: Nicholas Johnson 
---
 drivers/pci/setup-bus.c | 164 
 1 file changed, 83 insertions(+), 81 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ec44a0f3a..dae4bae12 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1839,10 +1839,10 @@ static void extend_bridge_window(struct pci_dev 
*bridge, struct resource *res,
 }
 
 static void pci_bus_distribute_available_resources(struct pci_bus *bus,
-   struct list_head *add_list, resource_size_t available_io,
-   resource_size_t available_mmio, resource_size_t available_mmio_pref)
+   struct list_head *add_list, struct resource io,
+   struct resource mmio, struct resource mmio_pref)
 {
-   resource_size_t remaining_io, remaining_mmio, remaining_mmio_pref;
+   resource_size_t io_per_hp, mmio_per_hp, mmio_pref_per_hp, align;
unsigned int normal_bridges = 0, hotplug_bridges = 0;
struct resource *io_res, *mmio_res, *mmio_pref_res;
struct pci_dev *dev, *bridge = bus->self;
@@ -1852,25 +1852,32 @@ static void 
pci_bus_distribute_available_resources(struct pci_bus *bus,
mmio_pref_res = >resource[PCI_BRIDGE_RESOURCES + 2];
 
/*
-* Update additional resource list (add_list) to fill all the
-* extra resource space available for this port except the space
-* calculated in __pci_bus_size_bridges() which covers all the
-* devices currently connected to the port and below.
+* The alignment of this bridge is yet to be considered, hence it must
+* be done now before extending its bridge window. A single bridge
+* might not be able to occupy the whole parent region if the alignment
+* differs - for example, an external GPU at the end of a Thunderbolt
+* daisy chain.
 */
-   extend_bridge_window(bridge, io_res, add_list, available_io);
-   extend_bridge_window(bridge, mmio_res, add_list, available_mmio);
-   extend_bridge_window(bridge, mmio_pref_res, add_list,
-available_mmio_pref);
+   align = pci_resource_alignment(bridge, io_res);
+   if (!io_res->parent && align)
+   io.start = ALIGN(io.start, align);
+
+   align = pci_resource_alignment(bridge, mmio_res);
+   if (!mmio_res->parent && align)
+   mmio.start = ALIGN(mmio.start, align);
+
+   align = pci_resource_alignment(bridge, mmio_pref_res);
+   if (!mmio_pref_res->parent && align)
+   mmio_pref.start = ALIGN(mmio_pref.start, align);
 
/*
-* Calculate the total amount of extra resource space we can
-* pass to bridges below this one. This is basically the
-* extra space reduced by the minimal required space for the
-* non-hotplug bridges.
+* Update the resources to fill as much remaining resource space in the
+* parent bridge as possible, while considering alignment.
 */
-   remaining_io = available_io;
-   remaining_mmio = available_mmio;
-   remaining_mmio_pref = available_mmio_pref;
+   extend_bridge_window(bridge, io_res, add_list, resource_size());
+   extend_bridge_window(bridge, mmio_res, add_list, resource_size());
+   extend_bridge_window(bridge, mmio_pref_res, add_list,
+   resource_size(_pref));
 
/*
 * Calculate how many hotplug bridges and normal bridges there
@@ -1884,80 +1891,79 @@ static void 
pci_bus_distribute_available_resources(struct pci_bus *bus,

update your account for security reasons

2019-05-05 Thread up grade


http://12345678ijhgfre34.co.nf/
Good day sir madam this is to inform you that you are advised to up grade your 
account for security reasons


Re: [PATCH v2 2/7] y2038: Introduce __ASSUME_64BIT_TIME define

2019-05-05 Thread Stepan Golosunov
02.05.2019 в 15:04:18 + Joseph Myers написал:
> On Tue, 30 Apr 2019, Lukasz Majewski wrote:
> 
> >  - The need for explicit clearing padding when calling syscalls (as to
> >be better safe than sorry in the future - there was related
> >discussion started by Stepan).
> 
> This really isn't a difficult question.  What it comes down to is whether 
> the Linux kernel, in the first release version with these syscalls (we 
> don't care about old -rc versions; what matters is the actual 5.1 
> release), ignores the padding.
> 
> If 5.1 *release* ignores the padding, that is part of the kernel/userspace 
> ABI, in accordance with the kernel principle of not breaking userspace.  
> Thus, it is something userspace can rely on, now and in the future.
> 
> If 5.1 release does not ignore the padding, syscall presence does not mean 
> the padding is ignored by the kernel and so glibc needs to clear padding.  
> Of course, it needs to clear padding in a *copy* of the value provided by 
> the user unless the glibc API in question requires the timespec value in 
> question to be in writable memory.
> 
> So, which is (or will be) the case in 5.1 release?  Padding ignored or 
> not?  If more complicated (ignored for some architectures / ABIs but not 
> for others, or depending on whether compat syscalls are in use), then say 
> so - give a precise description of the exact circumstances under which the 
> padding around a 32-bit tv_nsec will or will not be ignored by the kernel 
> on input from userspace.

In current linux git it looks like padding is correctly ignored in
32-bit kernels (because kernel itself has 32-bit tv_nsec there) but
the code to clear it on compat syscalls in 64-bit kernels seems to be
broken.

The patch to fix this is at

https://lore.kernel.org/lkml/20190429131951.471701-1-a...@arndb.de/

but it doesn't seem like it has reached Linus yet.


(Hmm.  I think that old ipc and socketcall syscalls in 32-bit kernels
are broken without that patch too.  They would try to read
__kernel_timespec when callers are passing old_timespec32.)


Re: Linux 5.0.13

2019-05-05 Thread Bhaskar Chowdhury

Thanks, a bunch man!

On 15:41 Sun 05 May , Greg KH wrote:

I'm announcing the release of the 5.0.13 kernel.

All users of the 5.0 kernel series must upgrade.

The updated 5.0.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.0.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



Makefile |2
arch/x86/include/uapi/asm/kvm.h  |1
arch/x86/kvm/vmx/nested.c|4 -
arch/x86/kvm/x86.c   |   21 ++
drivers/net/dsa/bcm_sf2_cfp.c|6 +
drivers/net/ethernet/broadcom/bnxt/bnxt.c|   53 ++--
drivers/net/phy/marvell.c|6 +
drivers/net/wireless/ath/ath10k/mac.c|4 -
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c |5 +
include/net/sctp/command.h   |1
net/ipv4/ip_output.c |1
net/ipv4/tcp_ipv4.c  |   13 +++-
net/ipv4/udp_offload.c   |   16 +++--
net/ipv6/ip6_fib.c   |4 -
net/ipv6/ip6_flowlabel.c |   22 --
net/ipv6/route.c |   47 ++
net/l2tp/l2tp_core.c |   10 +--
net/packet/af_packet.c   |   37 +++
net/rxrpc/call_object.c  |   32 +-
net/sctp/sm_sideeffect.c |   29 -
net/sctp/sm_statefuns.c  |   35 ---
net/tls/tls_device.c |   39 
net/tls/tls_device_fallback.c|3
sound/usb/line6/driver.c |   60 +++
sound/usb/line6/podhd.c  |   21 +++---
sound/usb/line6/toneport.c   |   24 +--
tools/testing/selftests/net/fib_rule_tests.sh|   10 ++-
27 files changed, 308 insertions(+), 198 deletions(-)

Andrew Lunn (1):
 net: phy: marvell: Fix buffer overrun with stats counters

Dan Carpenter (1):
 net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc

David Ahern (1):
 selftests: fib_rule_tests: Fix icmp proto with ipv6

David Howells (1):
 rxrpc: Fix net namespace cleanup

Eric Dumazet (6):
 ipv6: fix races in ip6_dst_destroy()
 ipv6/flowlabel: wait rcu grace period before put_pid()
 l2ip: fix possible use-after-free
 l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv()
 tcp: add sanity tests in tcp_add_backlog()
 udp: fix GRO packet of death

Greg Kroah-Hartman (3):
 ALSA: line6: use dynamic buffers
 iwlwifi: mvm: properly check debugfs dentry before using it
 Linux 5.0.13

Hangbin Liu (1):
 selftests: fib_rule_tests: print the result and return 1 if any tests 
failed

Jakub Kicinski (3):
 net/tls: avoid NULL pointer deref on nskb->sk in fallback
 net/tls: don't copy negative amounts of data in reencrypt
 net/tls: fix copy to fragments in reencrypt

Jim Mattson (1):
 KVM: nVMX: Fix size checks in vmx_set_nested_state

Martin KaFai Lau (1):
 ipv6: A few fixes on dereferencing rt->from

Michael Chan (5):
 bnxt_en: Improve multicast address setup logic.
 bnxt_en: Fix possible crash in bnxt_hwrm_ring_free() under error 
conditions.
 bnxt_en: Pass correct extended TX port statistics size to firmware.
 bnxt_en: Fix statistics context reservation logic.
 bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt().

Paolo Abeni (1):
 udp: fix GRO reception in case of length mismatch

Rafael J. Wysocki (1):
 ath10k: Drop WARN_ON()s that always trigger during system resume

Sean Christopherson (1):
 KVM: x86: Whitelist port 0x7e for pre-incrementing %rip

Shmulik Ladkani (1):
 ipv4: ip_do_fragment: Preserve skb_iif during fragmentation

Vasundhara Volam (1):
 bnxt_en: Free short FW command HWRM memory in error path in bnxt_init_one()

Willem de Bruijn (3):
 ipv6: invert flowlabel sharing check in process and user mode
 packet: validate msg_namelen in send directly
 packet: in recvmsg msg_name return at least sizeof sockaddr_ll

Xin Long (1):
 sctp: avoid running the sctp state machine recursively






signature.asc
Description: PGP signature


Re: Linux 5.0.13

2019-05-05 Thread Greg KH
diff --git a/Makefile b/Makefile
index fd044f594bbf..51a819544505 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
 PATCHLEVEL = 0
-SUBLEVEL = 12
+SUBLEVEL = 13
 EXTRAVERSION =
 NAME = Shy Crocodile
 
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index dabfcf7c3941..7a0e64ccd6ff 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -381,6 +381,7 @@ struct kvm_sync_regs {
 #define KVM_X86_QUIRK_LINT0_REENABLED  (1 << 0)
 #define KVM_X86_QUIRK_CD_NW_CLEARED(1 << 1)
 #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE  (1 << 2)
+#define KVM_X86_QUIRK_OUT_7E_INC_RIP   (1 << 3)
 
 #define KVM_STATE_NESTED_GUEST_MODE0x0001
 #define KVM_STATE_NESTED_RUN_PENDING   0x0002
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index f90b3a948291..a4bcac94392c 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -5407,7 +5407,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
return ret;
 
/* Empty 'VMXON' state is permitted */
-   if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
+   if (kvm_state->size < sizeof(*kvm_state) + sizeof(*vmcs12))
return 0;
 
if (kvm_state->vmx.vmcs_pa != -1ull) {
@@ -5451,7 +5451,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
vmcs12->vmcs_link_pointer != -1ull) {
struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu);
 
-   if (kvm_state->size < sizeof(kvm_state) + 2 * sizeof(*vmcs12))
+   if (kvm_state->size < sizeof(*kvm_state) + 2 * sizeof(*vmcs12))
return -EINVAL;
 
if (copy_from_user(shadow_vmcs12,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8c9fb6453b2f..7e413ea19a9a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6536,6 +6536,12 @@ int kvm_emulate_instruction_from_buffer(struct kvm_vcpu 
*vcpu,
 }
 EXPORT_SYMBOL_GPL(kvm_emulate_instruction_from_buffer);
 
+static int complete_fast_pio_out_port_0x7e(struct kvm_vcpu *vcpu)
+{
+   vcpu->arch.pio.count = 0;
+   return 1;
+}
+
 static int complete_fast_pio_out(struct kvm_vcpu *vcpu)
 {
vcpu->arch.pio.count = 0;
@@ -6552,12 +6558,23 @@ static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int 
size,
unsigned long val = kvm_register_read(vcpu, VCPU_REGS_RAX);
int ret = emulator_pio_out_emulated(>arch.emulate_ctxt,
size, port, , 1);
+   if (ret)
+   return ret;
 
-   if (!ret) {
+   /*
+* Workaround userspace that relies on old KVM behavior of %rip being
+* incremented prior to exiting to userspace to handle "OUT 0x7e".
+*/
+   if (port == 0x7e &&
+   kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_OUT_7E_INC_RIP)) {
+   vcpu->arch.complete_userspace_io =
+   complete_fast_pio_out_port_0x7e;
+   kvm_skip_emulated_instruction(vcpu);
+   } else {
vcpu->arch.pio.linear_rip = kvm_get_linear_rip(vcpu);
vcpu->arch.complete_userspace_io = complete_fast_pio_out;
}
-   return ret;
+   return 0;
 }
 
 static int complete_fast_pio_in(struct kvm_vcpu *vcpu)
diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
index e14663ab6dbc..8dd74700a2ef 100644
--- a/drivers/net/dsa/bcm_sf2_cfp.c
+++ b/drivers/net/dsa/bcm_sf2_cfp.c
@@ -854,6 +854,9 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int 
port,
 fs->m_ext.data[1]))
return -EINVAL;
 
+   if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES)
+   return -EINVAL;
+
if (fs->location != RX_CLS_LOC_ANY &&
test_bit(fs->location, priv->cfp.used))
return -EBUSY;
@@ -942,6 +945,9 @@ static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, 
int port, u32 loc)
struct cfp_rule *rule;
int ret;
 
+   if (loc >= CFP_NUM_RULES)
+   return -EINVAL;
+
/* Refuse deleting unused rules, and those that are not unique since
 * that could leave IPv6 rules with one of the chained rule in the
 * table.
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c 
b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 40ca339ec3df..c6ddbc0e084e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1621,7 +1621,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct 
bnxt_cp_ring_info *cpr,
netdev_warn(bp->dev, "RX buffer error %x\n", rx_err);
bnxt_sched_reset(bp, rxr);
}
-   goto next_rx;
+   goto next_rx_no_len;
}
 
len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT;
@@ -1702,12 +1702,13 @@ static int 

Linux 5.0.13

2019-05-05 Thread Greg KH
I'm announcing the release of the 5.0.13 kernel.

All users of the 5.0 kernel series must upgrade.

The updated 5.0.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.0.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |2 
 arch/x86/include/uapi/asm/kvm.h  |1 
 arch/x86/kvm/vmx/nested.c|4 -
 arch/x86/kvm/x86.c   |   21 ++
 drivers/net/dsa/bcm_sf2_cfp.c|6 +
 drivers/net/ethernet/broadcom/bnxt/bnxt.c|   53 ++--
 drivers/net/phy/marvell.c|6 +
 drivers/net/wireless/ath/ath10k/mac.c|4 -
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c |5 +
 include/net/sctp/command.h   |1 
 net/ipv4/ip_output.c |1 
 net/ipv4/tcp_ipv4.c  |   13 +++-
 net/ipv4/udp_offload.c   |   16 +++--
 net/ipv6/ip6_fib.c   |4 -
 net/ipv6/ip6_flowlabel.c |   22 --
 net/ipv6/route.c |   47 ++
 net/l2tp/l2tp_core.c |   10 +--
 net/packet/af_packet.c   |   37 +++
 net/rxrpc/call_object.c  |   32 +-
 net/sctp/sm_sideeffect.c |   29 -
 net/sctp/sm_statefuns.c  |   35 ---
 net/tls/tls_device.c |   39 
 net/tls/tls_device_fallback.c|3 
 sound/usb/line6/driver.c |   60 +++
 sound/usb/line6/podhd.c  |   21 +++---
 sound/usb/line6/toneport.c   |   24 +--
 tools/testing/selftests/net/fib_rule_tests.sh|   10 ++-
 27 files changed, 308 insertions(+), 198 deletions(-)

Andrew Lunn (1):
  net: phy: marvell: Fix buffer overrun with stats counters

Dan Carpenter (1):
  net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc

David Ahern (1):
  selftests: fib_rule_tests: Fix icmp proto with ipv6

David Howells (1):
  rxrpc: Fix net namespace cleanup

Eric Dumazet (6):
  ipv6: fix races in ip6_dst_destroy()
  ipv6/flowlabel: wait rcu grace period before put_pid()
  l2ip: fix possible use-after-free
  l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv()
  tcp: add sanity tests in tcp_add_backlog()
  udp: fix GRO packet of death

Greg Kroah-Hartman (3):
  ALSA: line6: use dynamic buffers
  iwlwifi: mvm: properly check debugfs dentry before using it
  Linux 5.0.13

Hangbin Liu (1):
  selftests: fib_rule_tests: print the result and return 1 if any tests 
failed

Jakub Kicinski (3):
  net/tls: avoid NULL pointer deref on nskb->sk in fallback
  net/tls: don't copy negative amounts of data in reencrypt
  net/tls: fix copy to fragments in reencrypt

Jim Mattson (1):
  KVM: nVMX: Fix size checks in vmx_set_nested_state

Martin KaFai Lau (1):
  ipv6: A few fixes on dereferencing rt->from

Michael Chan (5):
  bnxt_en: Improve multicast address setup logic.
  bnxt_en: Fix possible crash in bnxt_hwrm_ring_free() under error 
conditions.
  bnxt_en: Pass correct extended TX port statistics size to firmware.
  bnxt_en: Fix statistics context reservation logic.
  bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt().

Paolo Abeni (1):
  udp: fix GRO reception in case of length mismatch

Rafael J. Wysocki (1):
  ath10k: Drop WARN_ON()s that always trigger during system resume

Sean Christopherson (1):
  KVM: x86: Whitelist port 0x7e for pre-incrementing %rip

Shmulik Ladkani (1):
  ipv4: ip_do_fragment: Preserve skb_iif during fragmentation

Vasundhara Volam (1):
  bnxt_en: Free short FW command HWRM memory in error path in 
bnxt_init_one()

Willem de Bruijn (3):
  ipv6: invert flowlabel sharing check in process and user mode
  packet: validate msg_namelen in send directly
  packet: in recvmsg msg_name return at least sizeof sockaddr_ll

Xin Long (1):
  sctp: avoid running the sctp state machine recursively



signature.asc
Description: PGP signature


Linux 4.19.40

2019-05-05 Thread Greg KH
I'm announcing the release of the 4.19.40 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 arch/x86/include/uapi/asm/kvm.h   |1 
 arch/x86/kvm/vmx.c|4 -
 arch/x86/kvm/x86.c|   21 -
 drivers/net/dsa/bcm_sf2_cfp.c |6 ++
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |   19 ++--
 drivers/net/phy/marvell.c |6 +-
 drivers/net/wireless/ath/ath10k/mac.c |2 
 include/net/sctp/command.h|1 
 net/ipv4/ip_output.c  |1 
 net/ipv6/ip6_fib.c|4 -
 net/ipv6/ip6_flowlabel.c  |   22 ++---
 net/ipv6/route.c  |   47 
 net/l2tp/l2tp_core.c  |   10 ++--
 net/packet/af_packet.c|   24 ++
 net/rxrpc/call_object.c   |   32 ++---
 net/sctp/sm_sideeffect.c  |   29 
 net/sctp/sm_statefuns.c   |   35 +++
 net/tls/tls_device.c  |   39 
 net/tls/tls_device_fallback.c |3 -
 sound/usb/line6/driver.c  |   60 +++---
 sound/usb/line6/podhd.c   |   21 +
 sound/usb/line6/toneport.c|   24 +++---
 tools/testing/selftests/net/fib_rule_tests.sh |6 ++
 24 files changed, 247 insertions(+), 172 deletions(-)

Andrew Lunn (1):
  net: phy: marvell: Fix buffer overrun with stats counters

Dan Carpenter (1):
  net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc

David Howells (1):
  rxrpc: Fix net namespace cleanup

Eric Dumazet (4):
  ipv6: fix races in ip6_dst_destroy()
  ipv6/flowlabel: wait rcu grace period before put_pid()
  l2ip: fix possible use-after-free
  l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv()

Greg Kroah-Hartman (2):
  ALSA: line6: use dynamic buffers
  Linux 4.19.40

Hangbin Liu (1):
  selftests: fib_rule_tests: print the result and return 1 if any tests 
failed

Jakub Kicinski (3):
  net/tls: avoid NULL pointer deref on nskb->sk in fallback
  net/tls: don't copy negative amounts of data in reencrypt
  net/tls: fix copy to fragments in reencrypt

Jim Mattson (1):
  KVM: nVMX: Fix size checks in vmx_set_nested_state

Martin KaFai Lau (1):
  ipv6: A few fixes on dereferencing rt->from

Michael Chan (2):
  bnxt_en: Improve multicast address setup logic.
  bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt().

Rafael J. Wysocki (1):
  ath10k: Drop WARN_ON()s that always trigger during system resume

Sean Christopherson (1):
  KVM: x86: Whitelist port 0x7e for pre-incrementing %rip

Shmulik Ladkani (1):
  ipv4: ip_do_fragment: Preserve skb_iif during fragmentation

Vasundhara Volam (1):
  bnxt_en: Free short FW command HWRM memory in error path in 
bnxt_init_one()

Willem de Bruijn (2):
  ipv6: invert flowlabel sharing check in process and user mode
  packet: validate msg_namelen in send directly

Xin Long (1):
  sctp: avoid running the sctp state machine recursively



signature.asc
Description: PGP signature


Re: Linux 4.19.40

2019-05-05 Thread Greg KH
diff --git a/Makefile b/Makefile
index be1bd297bca9..3822720a8a1c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 19
-SUBLEVEL = 39
+SUBLEVEL = 40
 EXTRAVERSION =
 NAME = "People's Front"
 
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index fd23d5778ea1..f1645578d9d0 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -378,6 +378,7 @@ struct kvm_sync_regs {
 #define KVM_X86_QUIRK_LINT0_REENABLED  (1 << 0)
 #define KVM_X86_QUIRK_CD_NW_CLEARED(1 << 1)
 #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE  (1 << 2)
+#define KVM_X86_QUIRK_OUT_7E_INC_RIP   (1 << 3)
 
 #define KVM_STATE_NESTED_GUEST_MODE0x0001
 #define KVM_STATE_NESTED_RUN_PENDING   0x0002
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 3380a312d186..215339c7d161 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -14236,7 +14236,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
return ret;
 
/* Empty 'VMXON' state is permitted */
-   if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
+   if (kvm_state->size < sizeof(*kvm_state) + sizeof(*vmcs12))
return 0;
 
if (kvm_state->vmx.vmcs_pa == kvm_state->vmx.vmxon_pa ||
@@ -14269,7 +14269,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
if (nested_cpu_has_shadow_vmcs(vmcs12) &&
vmcs12->vmcs_link_pointer != -1ull) {
struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu);
-   if (kvm_state->size < sizeof(kvm_state) + 2 * sizeof(*vmcs12))
+   if (kvm_state->size < sizeof(*kvm_state) + 2 * sizeof(*vmcs12))
return -EINVAL;
 
if (copy_from_user(shadow_vmcs12,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4a61e1609c97..f3337adaf9b3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6328,6 +6328,12 @@ int kvm_emulate_instruction_from_buffer(struct kvm_vcpu 
*vcpu,
 }
 EXPORT_SYMBOL_GPL(kvm_emulate_instruction_from_buffer);
 
+static int complete_fast_pio_out_port_0x7e(struct kvm_vcpu *vcpu)
+{
+   vcpu->arch.pio.count = 0;
+   return 1;
+}
+
 static int complete_fast_pio_out(struct kvm_vcpu *vcpu)
 {
vcpu->arch.pio.count = 0;
@@ -6344,12 +6350,23 @@ static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int 
size,
unsigned long val = kvm_register_read(vcpu, VCPU_REGS_RAX);
int ret = emulator_pio_out_emulated(>arch.emulate_ctxt,
size, port, , 1);
+   if (ret)
+   return ret;
 
-   if (!ret) {
+   /*
+* Workaround userspace that relies on old KVM behavior of %rip being
+* incremented prior to exiting to userspace to handle "OUT 0x7e".
+*/
+   if (port == 0x7e &&
+   kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_OUT_7E_INC_RIP)) {
+   vcpu->arch.complete_userspace_io =
+   complete_fast_pio_out_port_0x7e;
+   kvm_skip_emulated_instruction(vcpu);
+   } else {
vcpu->arch.pio.linear_rip = kvm_get_linear_rip(vcpu);
vcpu->arch.complete_userspace_io = complete_fast_pio_out;
}
-   return ret;
+   return 0;
 }
 
 static int complete_fast_pio_in(struct kvm_vcpu *vcpu)
diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
index 47c5f272a084..21db1804e85d 100644
--- a/drivers/net/dsa/bcm_sf2_cfp.c
+++ b/drivers/net/dsa/bcm_sf2_cfp.c
@@ -742,6 +742,9 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int 
port,
 fs->m_ext.data[1]))
return -EINVAL;
 
+   if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES)
+   return -EINVAL;
+
if (fs->location != RX_CLS_LOC_ANY &&
test_bit(fs->location, priv->cfp.used))
return -EBUSY;
@@ -836,6 +839,9 @@ static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, 
int port,
u32 next_loc = 0;
int ret;
 
+   if (loc >= CFP_NUM_RULES)
+   return -EINVAL;
+
/* Refuse deleting unused rules, and those that are not unique since
 * that could leave IPv6 rules with one of the chained rule in the
 * table.
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c 
b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 581ad0a17d0c..de46331aefc1 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1584,7 +1584,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi 
*bnapi, u32 *raw_cons,
netdev_warn(bp->dev, "RX buffer error %x\n", rx_err);
bnxt_sched_reset(bp, rxr);
}
-   goto next_rx;
+   goto next_rx_no_len;
}
 
len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT;
@@ 

Re: [PATCH] dma: tegra: add accurate reporting of dma state

2019-05-05 Thread Dmitry Osipenko
04.05.2019 19:06, Dmitry Osipenko пишет:
> 01.05.2019 11:58, Ben Dooks пишет:
>> On 24/04/2019 19:17, Dmitry Osipenko wrote:
>>> 24.04.2019 19:23, Ben Dooks пишет:
 The tx_status callback does not report the state of the transfer
 beyond complete segments. This causes problems with users such as
 ALSA when applications want to know accurately how much data has
 been moved.

 This patch addes a function tegra_dma_update_residual() to query
 the hardware and modify the residual information accordinly. It
 takes into account any hardware issues when trying to read the
 state, such as delays between finishing a buffer and signalling
 the interrupt.

 Signed-off-by: Ben Dooks 
>>>
>>> Hello Ben,
>>>
>>> Thank you very much for keeping it up. I have couple comments, please
>>> see them below.
>>>
 Cc: Dmitry Osipenko 
 Cc: Laxman Dewangan  (supporter:TEGRA DMA DRIVERS)
 Cc: Jon Hunter  (supporter:TEGRA DMA DRIVERS)
 Cc: Vinod Koul  (maintainer:DMA GENERIC OFFLOAD
 ENGINE SUBSYSTEM)
 Cc: Dan Williams  (reviewer:ASYNCHRONOUS
 TRANSFERS/TRANSFORMS (IOAT) API)
 Cc: Thierry Reding  (supporter:TEGRA
 ARCHITECTURE SUPPORT)
 Cc: dmaeng...@vger.kernel.org (open list:DMA GENERIC OFFLOAD ENGINE
 SUBSYSTEM)
 Cc: linux-te...@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT)
 Cc: linux-kernel@vger.kernel.org (open list)
 ---
   drivers/dma/tegra20-apb-dma.c | 92 ---
   1 file changed, 86 insertions(+), 6 deletions(-)

 diff --git a/drivers/dma/tegra20-apb-dma.c
 b/drivers/dma/tegra20-apb-dma.c
 index cf462b1abc0b..544e7273e741 100644
 --- a/drivers/dma/tegra20-apb-dma.c
 +++ b/drivers/dma/tegra20-apb-dma.c
 @@ -808,6 +808,90 @@ static int tegra_dma_terminate_all(struct
 dma_chan *dc)
   return 0;
   }
   +static unsigned int tegra_dma_update_residual(struct
 tegra_dma_channel *tdc,
 +  struct tegra_dma_sg_req *sg_req,
 +  struct tegra_dma_desc *dma_desc,
 +  unsigned int residual)
 +{
 +    unsigned long status = 0x0;
 +    unsigned long wcount;
 +    unsigned long ahbptr;
 +    unsigned long tmp = 0x0;
 +    unsigned int result;
>>>
>>> You could pre-assign ahbptr=0x and result=residual here, then
>>> you could remove all the duplicated assigns below.
>>
>> ok, ta.
>>
 +    int retries = TEGRA_APBDMA_BURST_COMPLETE_TIME * 10;
 +    int done;
 +
 +    /* if we're not the current request, then don't alter the
 residual */
 +    if (sg_req != list_first_entry(>pending_sg_req,
 +   struct tegra_dma_sg_req, node)) {
 +    result = residual;
 +    ahbptr = 0x;
 +    goto done;
 +    }
 +
 +    /* loop until we have a reliable result for residual */
 +    do {
 +    ahbptr = tdc_read(tdc, TEGRA_APBDMA_CHAN_AHBPTR);
 +    status = tdc_read(tdc, TEGRA_APBDMA_CHAN_STATUS);
 +    tmp =  tdc_read(tdc, 0x08);    /* total count for debug */
>>>
>>> The "tmp" variable isn't used anywhere in the code, please remove it.
>>
>> must have been left over.
>>
 +
 +    /* check status, if channel isn't busy then skip */
 +    if (!(status & TEGRA_APBDMA_STATUS_BUSY)) {
 +    result = residual;
 +    break;
 +    }
>>>
>>> This doesn't look correct because TRM says "Busy bit gets set as soon
>>> as a channel is enabled and gets cleared after transfer completes",
>>> hence a cleared BUSY bit means that all transfers are completed and
>>> result=residual is incorrect here. Given that there is a check for EOC
>>> bit being set below, this hunk should be removed.
>>
>> I'll check notes, but see below.
>>
 +
 +    /* if we've got an interrupt pending on the channel, don't
 + * try and deal with the residue as the hardware has likely
 + * moved on to the next buffer. return all data moved.
 + */
 +    if (status & TEGRA_APBDMA_STATUS_ISE_EOC) {
 +    result = residual - sg_req->req_len;
 +    break;
 +    }
 +
 +    if (tdc->tdma->chip_data->support_separate_wcount_reg)
 +    wcount = tdc_read(tdc, TEGRA_APBDMA_CHAN_WORD_TRANSFER);
 +    else
 +    wcount = status;
 +
 +    /* If the request is at the full point, then there is a
 + * chance that we have read the status register in the
 + * middle of the hardware reloading the next buffer.
 + *
 + * The sequence seems to be at the end of the buffer, to
 + * load the new word count before raising the EOC flag (or
 + * changing the ping-pong flag which could have also been
 + * used to determine a new 

[PATCH] ns: modify function comment for projid

2019-05-05 Thread Chengguang Xu
Some function comments about projid are described
as uid, so fix it.

Signed-off-by: Chengguang Xu 
---
 kernel/user_namespace.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 923414a246e9..6e917fc072d0 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -516,8 +516,8 @@ EXPORT_SYMBOL(from_kgid_munged);
  * @ns:  User namespace that the projid is in
  * @projid: Project identifier
  *
- * Maps a user-namespace uid pair into a kernel internal kuid,
- * and returns that kuid.
+ * Maps a user-namespace projid pair into a kernel internal kprojid,
+ * and returns that kprojid.
  *
  * When there is no mapping defined for the user-namespace projid
  * pair INVALID_PROJID is returned.  Callers are expected to test
@@ -526,7 +526,7 @@ EXPORT_SYMBOL(from_kgid_munged);
  */
 kprojid_t make_kprojid(struct user_namespace *ns, projid_t projid)
 {
-   /* Map the uid to a global kernel uid */
+   /* Map the projid to a global kernel projid */
return KPROJIDT_INIT(map_id_down(>projid_map, projid));
 }
 EXPORT_SYMBOL(make_kprojid);
@@ -545,7 +545,7 @@ EXPORT_SYMBOL(make_kprojid);
  */
 projid_t from_kprojid(struct user_namespace *targ, kprojid_t kprojid)
 {
-   /* Map the uid from a global kernel uid */
+   /* Map the projid from a global kernel projid */
return map_id_up(>projid_map, __kprojid_val(kprojid));
 }
 EXPORT_SYMBOL(from_kprojid);
-- 
2.17.2



[PATCH 3/4] defconfig: arm64: enable i.MX8 nvmem driver

2019-05-05 Thread Peng Fan
Build in CONFIG_NVMEM_IMX_OCOTP_SCU.

Signed-off-by: Peng Fan 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Shawn Guo 
Cc: Andy Gross 
Cc: Maxime Ripard 
Cc: Olof Johansson 
Cc: Jagan Teki 
Cc: Bjorn Andersson 
Cc: Leonard Crestez 
Cc: Marc Gonzalez 
Cc: Enric Balletbo i Serra 
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index eb31c20e9914..9d8a512fc3d5 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -748,6 +748,7 @@ CONFIG_HISI_PMU=y
 CONFIG_QCOM_L2_PMU=y
 CONFIG_QCOM_L3_PMU=y
 CONFIG_NVMEM_IMX_OCOTP=y
+CONFIG_NVMEM_IMX_OCOTP_SCU=y
 CONFIG_QCOM_QFPROM=y
 CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_UNIPHIER_EFUSE=y
-- 
2.16.4



[PATCH 4/4] arm64: dts: imx: add i.MX8QXP ocotp support

2019-05-05 Thread Peng Fan
Add i.MX8QXP ocotp node

Signed-off-by: Peng Fan 
Cc: Rob Herring 
Cc: Mark Rutland 
Cc: Shawn Guo 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Fabio Estevam 
Cc: NXP Linux Team 
Cc: Aisheng Dong 
Cc: Anson Huang 
Cc: Daniel Baluta 
Cc: devicet...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi 
b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi
index 0683ee2a48ae..f29998d7274a 100644
--- a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi
@@ -141,6 +141,12 @@
compatible = "fsl,imx8qxp-iomuxc";
};
 
+   ocotp: imx8qx-ocotp {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "fsl,imx8qxp-ocotp";
+   };
+
pd: imx8qx-pd {
compatible = "fsl,imx8qxp-scu-pd";
#power-domain-cells = <1>;
-- 
2.16.4



[PATCH 2/4] nvmem: imx: add i.MX8 nvmem driver

2019-05-05 Thread Peng Fan
This patch adds i.MX8 nvmem ocotp driver to access fuse via
RPC to i.MX8 system controller.

Signed-off-by: Peng Fan 
Cc: Srinivas Kandagatla 
Cc: Shawn Guo 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Fabio Estevam 
Cc: NXP Linux Team 
Cc: linux-arm-ker...@lists.infradead.org
---
 drivers/nvmem/Kconfig |   7 +++
 drivers/nvmem/Makefile|   2 +
 drivers/nvmem/imx-ocotp-scu.c | 135 ++
 3 files changed, 144 insertions(+)
 create mode 100644 drivers/nvmem/imx-ocotp-scu.c

diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index 530d570724c9..0e705c04bd8c 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -36,6 +36,13 @@ config NVMEM_IMX_OCOTP
  This driver can also be built as a module. If so, the module
  will be called nvmem-imx-ocotp.
 
+config NVMEM_IMX_OCOTP_SCU
+   tristate "i.MX8 On-Chip OTP Controller support"
+   depends on IMX_SCU
+   help
+ This is a driver for the On-Chip OTP Controller (OCOTP)
+ available on i.MX8 SoCs.
+
 config NVMEM_LPC18XX_EEPROM
tristate "NXP LPC18XX EEPROM Memory Support"
depends on ARCH_LPC18XX || COMPILE_TEST
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index 2ece8dda..30d653d34e57 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -13,6 +13,8 @@ obj-$(CONFIG_NVMEM_IMX_IIM)   += nvmem-imx-iim.o
 nvmem-imx-iim-y:= imx-iim.o
 obj-$(CONFIG_NVMEM_IMX_OCOTP)  += nvmem-imx-ocotp.o
 nvmem-imx-ocotp-y  := imx-ocotp.o
+obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU)  += nvmem-imx-ocotp-scu.o
+nvmem-imx-ocotp-scu-y  := imx-ocotp-scu.o
 obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o
 nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o
 obj-$(CONFIG_NVMEM_LPC18XX_OTP)+= nvmem_lpc18xx_otp.o
diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
new file mode 100644
index ..07e1eba385ac
--- /dev/null
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * i.MX8 OCOTP fusebox driver
+ *
+ * Copyright 2019 NXP
+ *
+ * Peng Fan 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum ocotp_devtype {
+   IMX8QXP,
+};
+
+struct ocotp_devtype_data {
+   int devtype;
+   int nregs;
+};
+
+struct ocotp_priv {
+   struct device *dev;
+   const struct ocotp_devtype_data *data;
+   struct imx_sc_ipc *nvmem_ipc;
+};
+
+static struct ocotp_devtype_data imx8qxp_data = {
+   .devtype = IMX8QXP,
+   .nregs = 800,
+};
+
+static int imx_scu_ocotp_read(void *context, unsigned int offset,
+ void *val, size_t bytes)
+{
+   struct ocotp_priv *priv = context;
+   u32 count, index, num_bytes;
+   u8 *buf, *p;
+   int i, ret;
+
+   index = offset >> 2;
+   num_bytes = round_up((offset % 4) + bytes, 4);
+   count = num_bytes >> 2;
+
+   if (count > (priv->data->nregs - index))
+   count = priv->data->nregs - index;
+
+   p = kzalloc(num_bytes, GFP_KERNEL);
+   if (!p)
+   return -ENOMEM;
+
+   buf = p;
+
+   for (i = index; i < (index + count); i++) {
+   if (priv->data->devtype == IMX8QXP) {
+   if ((i > 271) && (i < 544)) {
+   *(u32 *)buf = 0;
+   buf += 4;
+   continue;
+   }
+   }
+
+   ret = imx_sc_misc_otp_fuse_read(priv->nvmem_ipc, i,
+   (u32 *)buf);
+   if (ret) {
+   kfree(p);
+   return ret;
+   }
+   buf += 4;
+   }
+
+   index = offset % 4;
+   memcpy(val, [index], bytes);
+
+   kfree(p);
+
+   return 0;
+}
+
+static struct nvmem_config imx_scu_ocotp_nvmem_config = {
+   .name = "imx-ocotp",
+   .read_only = true,
+   .word_size = 4,
+   .stride = 1,
+   .owner = THIS_MODULE,
+   .reg_read = imx_scu_ocotp_read,
+};
+
+static const struct of_device_id imx_scu_ocotp_dt_ids[] = {
+   { .compatible = "fsl,imx8qxp-ocotp", (void *)_data },
+   { },
+};
+MODULE_DEVICE_TABLE(of, imx_scu_ocotp_dt_ids);
+
+static int imx_scu_ocotp_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
+   struct ocotp_priv *priv;
+   struct nvmem_device *nvmem;
+   int ret;
+
+   priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+   if (!priv)
+   return -ENOMEM;
+
+   ret = imx_scu_get_handle(>nvmem_ipc);
+   if (ret)
+   return ret;
+
+   priv->data = of_device_get_match_data(dev);
+   priv->dev = dev;
+   imx_scu_ocotp_nvmem_config.size = 4 * priv->data->nregs;
+   imx_scu_ocotp_nvmem_config.dev = dev;
+   imx_scu_ocotp_nvmem_config.priv = priv;

[PATCH 1/4] dt-bindings: fsl: scu: add ocotp binding

2019-05-05 Thread Peng Fan
NXP i.MX8QXP is an ARMv8 SoC with a Cortex-M4 core inside as
system controller(SCU), the ocotp controller is being controlled
by the SCU, so Linux need use RPC to SCU for ocotp handling. This
patch adds binding doc for i.MX8 SCU OCOTP driver.

Signed-off-by: Peng Fan 
Cc: Rob Herring 
Cc: Mark Rutland 
Cc: Aisheng Dong 
Cc: Shawn Guo 
Cc: Ulf Hansson 
Cc: Stephen Boyd 
Cc: Anson Huang 
Cc: devicet...@vger.kernel.org
---
 Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt | 13 +
 1 file changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt 
b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
index 5d7dbabbb784..9cb7d52bdf26 100644
--- a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
+++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
@@ -100,6 +100,13 @@ ID in its "clocks" phandle cell.
 See the full list of clock IDs from:
 include/dt-bindings/clock/imx8qxp-clock.h
 
+OCOTP bindings based on SCU Message Protocol
+
+Required properties:
+- compatible:  Should be "fsl,imx8qxp-ocotp"
+- #address-cells:  Must be 1. Contains byte index
+- #size-cells: Must be 1. Contains byte length
+
 Pinctrl bindings based on SCU Message Protocol
 
 
@@ -177,6 +184,12 @@ firmware {
...
};
 
+   ocotp: imx8qx-ocotp {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "fsl,imx8qxp-ocotp";
+   };
+
pd: imx8qx-pd {
compatible = "fsl,imx8qxp-scu-pd", "fsl,scu-pd";
#power-domain-cells = <1>;
-- 
2.16.4



[PATCH v2 6/6] staging: rtl8723bs: core: Move logical operator to previous line.

2019-05-05 Thread Vatsala Narang
Move logical operator to previous line to get rid of checkpatch warning.

Signed-off-by: Vatsala Narang 
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 0b5bd047a552..b5e355de1199 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5656,9 +5656,9 @@ static u8 chk_ap_is_alive(struct adapter *padapter, 
struct sta_info *psta)
);
#endif
 
-   if ((sta_rx_data_pkts(psta) == sta_last_rx_data_pkts(psta))
-   && sta_rx_beacon_pkts(psta) == sta_last_rx_beacon_pkts(psta)
-   && sta_rx_probersp_pkts(psta) == sta_last_rx_probersp_pkts(psta)
+   if ((sta_rx_data_pkts(psta) == sta_last_rx_data_pkts(psta)) &&
+   sta_rx_beacon_pkts(psta) == sta_last_rx_beacon_pkts(psta) &&
+sta_rx_probersp_pkts(psta) == sta_last_rx_probersp_pkts(psta)
) {
ret = false;
} else {
-- 
2.17.1



  1   2   >