[PATCH] Staging: lusture: Remove an open coded simple_open() function

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch removes an open coded simple_open() function and replace file
operations references to the function with simple_open() instead

Signed-off-by: Abdul Hussain 
---
 drivers/staging/lustre/lustre/fld/lproc_fld.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c 
b/drivers/staging/lustre/lustre/fld/lproc_fld.c
index b35ff28..d19b724 100644
--- a/drivers/staging/lustre/lustre/fld/lproc_fld.c
+++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c
@@ -143,13 +143,6 @@ fld_debugfs_cache_flush_write(struct file *file, const 
char __user *buffer,
 }
 
 static int
-fld_debugfs_cache_flush_open(struct inode *inode, struct file *file)
-{
-   file->private_data = inode->i_private;
-   return 0;
-}
-
-static int
 fld_debugfs_cache_flush_release(struct inode *inode, struct file *file)
 {
file->private_data = NULL;
@@ -158,7 +151,7 @@ fld_debugfs_cache_flush_release(struct inode *inode, struct 
file *file)
 
 static struct file_operations fld_debugfs_cache_flush_fops = {
.owner  = THIS_MODULE,
-   .open   = fld_debugfs_cache_flush_open,
+   .open = simple_open,
.write  = fld_debugfs_cache_flush_write,
.release= fld_debugfs_cache_flush_release,
 };
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[BUG] perf report: fails to symbolize when vaddr is non zero for shared objects

2015-06-16 Thread Stephane Eranian
Hi,

It has been brought to my attention that on systems where the text
of shared libs is not loaded with a zero virtual address, perf report
fails to symbolize
correctly samples. This is true of older versions of perf and also the latest
in tip.git.

I looked at symbol-elf.c and I did not see a place where the vaddr was taken
into account from the program headers in the case of ET_DYN. I see it for
ET_EXE, though.

$ readelf -e lib.so
  Type:  DYN (Shared object file)
  
  Type  Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
 LOAD   0x00 0xd000 0xd000 0x73657c 0x73657c R E 0x1000

If you get samples in the shared lib, they will be off, possibly
attributed to the wrong
functions.

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


[PATCH] Staging: lustre: Use memdup_user rather than duplicating its implementation

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch uses memdup_user rather than duplicating its implementation

Signed-off-by: Abdul Hussain 
---
 drivers/staging/lustre/lustre/llite/dir.c | 32 +--
 1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index c2eb4f2..3d746a9 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1747,15 +1747,9 @@ out_quotactl:
struct hsm_user_request *hur;
ssize_t  totalsize;
 
-   hur = kzalloc(sizeof(*hur), GFP_NOFS);
-   if (!hur)
-   return -ENOMEM;
-
-   /* We don't know the true size yet; copy the fixed-size part */
-   if (copy_from_user(hur, (void *)arg, sizeof(*hur))) {
-   kfree(hur);
-   return -EFAULT;
-   }
+   hur = memdup_user((void *)arg, sizeof(*hur));
+   if (IS_ERR(hur))
+   return PTR_ERR(hur);
 
/* Compute the whole struct size */
totalsize = hur_len(hur);
@@ -1833,13 +1827,9 @@ out_quotactl:
struct hsm_copy *copy;
int  rc;
 
-   copy = kzalloc(sizeof(*copy), GFP_NOFS);
-   if (!copy)
-   return -ENOMEM;
-   if (copy_from_user(copy, (char *)arg, sizeof(*copy))) {
-   kfree(copy);
-   return -EFAULT;
-   }
+   copy = memdup_user((char *)arg, sizeof(*copy));
+   if (IS_ERR(copy))
+   return PTR_ERR(copy);
 
rc = ll_ioc_copy_start(inode->i_sb, copy);
if (copy_to_user((char *)arg, copy, sizeof(*copy)))
@@ -1852,13 +1842,9 @@ out_quotactl:
struct hsm_copy *copy;
int  rc;
 
-   copy = kzalloc(sizeof(*copy), GFP_NOFS);
-   if (!copy)
-   return -ENOMEM;
-   if (copy_from_user(copy, (char *)arg, sizeof(*copy))) {
-   kfree(copy);
-   return -EFAULT;
-   }
+   copy = memdup_user((char *)arg, sizeof(*copy));
+   if (IS_ERR(copy))
+   return PTR_ERR(copy);
 
rc = ll_ioc_copy_end(inode->i_sb, copy);
if (copy_to_user((char *)arg, copy, sizeof(*copy)))
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Staging: lustre: Use memdup_user rather than duplicating its implementation

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch uses memdup_user rather than duplicating its implementation

Signed-off-by: Abdul Hussain 
---
 drivers/staging/lustre/lustre/llite/file.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 4f9b1c7..3075db2 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2361,14 +2361,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
struct hsm_state_set*hss;
int  rc;
 
-   hss = kzalloc(sizeof(*hss), GFP_NOFS);
-   if (!hss)
-   return -ENOMEM;
-
-   if (copy_from_user(hss, (char *)arg, sizeof(*hss))) {
-   kfree(hss);
-   return -EFAULT;
-   }
+   hss = memdup_user((char *)arg, sizeof(*hss));
+   if (IS_ERR(hss))
+   return PTR_ERR(hss);
 
rc = ll_hsm_state_set(inode, hss);
 
@@ -2488,14 +2483,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
case LL_IOC_HSM_IMPORT: {
struct hsm_user_import *hui;
 
-   hui = kzalloc(sizeof(*hui), GFP_NOFS);
-   if (!hui)
-   return -ENOMEM;
-
-   if (copy_from_user(hui, (void *)arg, sizeof(*hui))) {
-   kfree(hui);
-   return -EFAULT;
-   }
+   hui = memdup_user((void *)arg, sizeof(*hui));
+   if (IS_ERR(hui))
+   return PTR_ERR(hui);
 
rc = ll_hsm_import(inode, file, hui);
 
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH v2 1/3] STM trace event: Adding generic buffer interface driver

2015-06-16 Thread Chunyan Zhang
From: Mathieu Poirier 

This patch adds a driver that models itself as an stm_source and
who's sole purpose is to export an interface to the rest of the
kernel.  Once the stm and stm_source have been linked via sysfs,
everything that is passed to the interface will endup in the STM
trace engine.

Signed-off-by: Mathieu Poirier 
Signed-off-by: Chunyan Zhang 
---
 drivers/stm/Kconfig   | 11 +++
 drivers/stm/Makefile  |  2 ++
 drivers/stm/stm_trace_event.c | 46 +++
 3 files changed, 59 insertions(+)
 create mode 100644 drivers/stm/stm_trace_event.c

diff --git a/drivers/stm/Kconfig b/drivers/stm/Kconfig
index 6f2db70..8ead418 100644
--- a/drivers/stm/Kconfig
+++ b/drivers/stm/Kconfig
@@ -25,3 +25,14 @@ config STM_SOURCE_CONSOLE
 
  If you want to send kernel console messages over STM devices,
  say Y.
+
+config STM_TRACE_EVENT
+   tristate "Redirect/copy the output from kernel trace event to STM 
engine"
+   depends on STM
+   help
+ This option can be used to redirect or copy the output from kernel 
trace
+ event to STM engine. Enabling this option will introduce a slight
+ timing effect.
+
+ If you want to send kernel trace event messages over STM devices,
+ say Y.
diff --git a/drivers/stm/Makefile b/drivers/stm/Makefile
index 74baf59..55b152c 100644
--- a/drivers/stm/Makefile
+++ b/drivers/stm/Makefile
@@ -5,3 +5,5 @@ stm_core-y  := core.o policy.o
 obj-$(CONFIG_STM_DUMMY)+= dummy_stm.o
 
 obj-$(CONFIG_STM_SOURCE_CONSOLE)   += console.o
+
+obj-$(CONFIG_STM_TRACE_EVENT)  += stm_trace_event.o
diff --git a/drivers/stm/stm_trace_event.c b/drivers/stm/stm_trace_event.c
new file mode 100644
index 000..bc77dae
--- /dev/null
+++ b/drivers/stm/stm_trace_event.c
@@ -0,0 +1,46 @@
+/*
+ * Simple kernel driver to link kernel trace event and an STM device
+ * Copyright (c) 2015, Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct stm_source_data stm_trace_event_data = {
+   .name   = "stm_trace_event",
+   .nr_chans   = 1,
+};
+
+void stm_trace_event_write(const char *buf, unsigned len)
+{
+   stm_source_write(&stm_trace_event_data, 0, buf, len);
+}
+
+static int __init stm_trace_event_init(void)
+{
+   return stm_source_register_device(NULL, &stm_trace_event_data);
+}
+
+static void __exit stm_trace_event_exit(void)
+{
+   stm_source_unregister_device(&stm_trace_event_data);
+}
+
+module_init(stm_trace_event_init);
+module_exit(stm_trace_event_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("stm_trace_event driver");
+MODULE_AUTHOR("Mathieu Poirier ");
-- 
1.9.1

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


[RFC PATCH v2 0/3] Integration of trace events with System Trace IP blocks

2015-06-16 Thread Chunyan Zhang
IP blocks allowing a variety of trace sources to log debugging
information to a pre-defined area have been introduced on a couple of
architecture [1][2]. These system trace blocks (also known as STM)
typically follow the MIPI STPv2 protocol [3] and provide a system wide
logging facility to any device, running a kernel or not, with access
to the block's log entry port(s).  Since each trace message has a
timestamp is it possible to correlate events happening in the entire
system rather than being confined to the logging facility of a single
entity.

This patch is using a very simple "stm_source" introduced in [2] to
duplicate the output of the trace event subsystem to an STM, in this
case coresight STM.  That way logging information generated by the
trace event subsystem and gathered in the coresight sink can be used
in conjunction with trace data from other board components, also
collected in the same trace sink.  This example is using coresight but
the same would apply to any architecture wishing to do the same.

The goal of this RFC is to solicit comments on the method used to
connect trace event logging with STMs (using the generic STM API)
rather than function "stm_ftrace_write()" itself, which was provided
for completeness of the proof of concept only.

I'm eager to see your comments on this, and if you have some good
ideas that can slow down the overhead, please let me know. Any
questions are also welcome.

Thanks,
Chunyan


[1]. https://lkml.org/lkml/2015/2/4/729
[2]. http://comments.gmane.org/gmane.linux.kernel/1914526
[3]. http://mipi.org/specifications/debug#STP

Changes from RFC v1:
- Marked module init/exit functions with __init/__exit key word
  according to the comments from Paul Bolle

Chunyan Zhang (2):
  Trace log handler for logging into STM blocks
  Introduce trace log output function for STM

Mathieu Poirier (1):
  STM trace event: Adding generic buffer interface driver

 drivers/stm/Kconfig | 11 +
 drivers/stm/Makefile|  2 +
 drivers/stm/stm_trace_event.c   | 46 +++
 include/linux/ftrace_event.h| 15 +++
 include/trace/ftrace.h  | 47 +++
 kernel/trace/Makefile   |  1 +
 kernel/trace/trace_output_stm.c | 99 +
 7 files changed, 221 insertions(+)
 create mode 100644 drivers/stm/stm_trace_event.c
 create mode 100644 kernel/trace/trace_output_stm.c

-- 
1.9.1

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


[RFC PATCH v2 2/3] Trace log handler for logging into STM blocks

2015-06-16 Thread Chunyan Zhang
Adding the function 'trace_event_stm_output_##call' for printing events
trace log into STM blocks.

This patch also added a function call at where the events have been
committed to ring buffer to export the trace event information to
STM blocks.

Signed-off-by: Chunyan Zhang 
---
 include/linux/ftrace_event.h | 15 ++
 include/trace/ftrace.h   | 47 
 2 files changed, 62 insertions(+)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 46e83c2..f0c7426 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -14,6 +14,7 @@ struct trace_buffer;
 struct tracer;
 struct dentry;
 struct bpf_prog;
+struct trace_buffer_stm;
 
 struct trace_print_flags {
unsigned long   mask;
@@ -304,6 +305,9 @@ struct ftrace_event_call {
 */
int flags; /* static flags of different events */
 
+   void (*output_stm)(struct trace_seq *tmp_seq, void *entry,
+  struct trace_buffer_stm *tb);
+
 #ifdef CONFIG_PERF_EVENTS
int perf_refcount;
struct hlist_head __percpu  *perf_events;
@@ -423,6 +427,17 @@ enum event_trigger_type {
ETT_EVENT_ENABLE= (1 << 3),
 };
 
+#ifdef CONFIG_STM_TRACE_EVENT
+extern void trace_event_stm_log(struct ftrace_event_buffer *fbuffer);
+extern void trace_event_buf_vprintf(struct trace_buffer_stm *tb,
+   const char *fmt, ...) __attribute__ ((weak));
+extern void stm_trace_event_write(const char *buf, unsigned len);
+#else
+static inline void trace_event_stm_log(struct ftrace_event_buffer *fbuffer) {}
+static inline void trace_event_buf_vprintf(struct trace_buffer_stm *tb,
+   const char *fmt, ...) {}
+#endif
+
 extern int filter_match_preds(struct event_filter *filter, void *rec);
 
 extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 37d4b10..20c7228 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -303,6 +303,50 @@ TRACE_MAKE_SYSTEM_STR();
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
+static notrace void\
+trace_event_stm_output_##call(struct trace_seq *tmp_seq,   \
+void *entry,   \
+struct trace_buffer_stm *trace_buf)\
+{  \
+   struct ftrace_raw_##call *field = entry;\
+   struct trace_seq *p = tmp_seq;  \
+   \
+   trace_seq_init(p);  \
+   \
+   trace_event_buf_vprintf(trace_buf, print);  \
+   \
+   return; \
+}
+
+#undef DEFINE_EVENT_PRINT
+#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
+static notrace void\
+trace_event_stm_output_##call(struct trace_seq *tmp_seq,   \
+void *entry,   \
+struct trace_buffer_stm *trace_buf)\
+{  \
+   struct trace_seq *p = tmp_seq;  \
+   struct trace_entry *ent = entry;\
+   struct ftrace_raw_##template *field;\
+   \
+   if (ent->type != event_##call.event.type) { \
+   WARN_ON_ONCE(1);\
+   return; \
+   }   \
+   \
+   field = (typeof(field))entry;   \
+   \
+   trace_seq_init(p);  \
+   \
+   trace_event_buf_vprintf(trace_buf, print);  \
+   \
+   return; \
+}
+
+#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+
+#undef DECLARE_EVENT_CLASS
+#define DECLARE

[RFC PATCH v2 3/3] Introduce trace log output function for STM

2015-06-16 Thread Chunyan Zhang
This patch introduced a few functions to print the event trace log to
STM buffer when the trace event happen and the event information
would be committed to ring buffer.

Before outputting the trace log to STM, we have to get the human readable
trace log content and print it into a local buffer in the format of a
string, the function 'trace_event_buf_vprintf()' is just for this purpose.

Signed-off-by: Chunyan Zhang 
---
 kernel/trace/Makefile   |  1 +
 kernel/trace/trace_output_stm.c | 99 +
 2 files changed, 100 insertions(+)
 create mode 100644 kernel/trace/trace_output_stm.c

diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index 9b1044e..002de34 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -67,4 +67,5 @@ obj-$(CONFIG_UPROBE_EVENT) += trace_uprobe.o
 
 obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o
 
+obj-$(CONFIG_STM_TRACE_EVENT) += trace_output_stm.o
 libftrace-y := ftrace.o
diff --git a/kernel/trace/trace_output_stm.c b/kernel/trace/trace_output_stm.c
new file mode 100644
index 000..1cf6d87
--- /dev/null
+++ b/kernel/trace/trace_output_stm.c
@@ -0,0 +1,99 @@
+#include 
+#include 
+#include 
+#include "trace.h"
+
+#define STM_OUTPUT_STRLEN 128
+
+/* store the event trace log for STM */
+struct trace_buffer_stm {
+   char buffer[STM_OUTPUT_STRLEN];
+   unsigned int used_len;
+   unsigned int size;
+};
+
+static struct trace_buffer_stm *trace_event_stm_buffer;
+static struct trace_seq *stm_tmp_seq;
+static int stm_buffers_allocated;
+
+void trace_event_buf_vprintf(struct trace_buffer_stm *tb, const char *fmt, ...)
+{
+   va_list ap;
+   char *buffer = tb->buffer + tb->used_len;
+   unsigned int size = tb->size - tb->used_len;
+
+   va_start(ap, fmt);
+   tb->used_len += vsnprintf(buffer, size, fmt, ap);
+   va_end(ap);
+}
+EXPORT_SYMBOL_GPL(trace_event_buf_vprintf);
+
+static inline void stm_buf_reset(struct trace_buffer_stm *tb)
+{
+   tb->used_len = 0;
+}
+
+void trace_event_stm_log(struct ftrace_event_buffer *fbuffer)
+{
+
+   struct trace_seq *p = stm_tmp_seq;
+   struct trace_buffer_stm *tb;
+   struct ftrace_event_call *event_call = fbuffer->ftrace_file->event_call;
+   struct trace_entry *entry = (struct trace_entry *)fbuffer->entry;
+
+   if (!stm_buffers_allocated)
+   return;
+
+   tb = trace_event_stm_buffer;
+
+   if (event_call->output_stm)
+   event_call->output_stm(p, entry, tb);
+
+   stm_trace_event_write(tb->buffer, tb->used_len);
+
+   stm_buf_reset(tb);
+}
+EXPORT_SYMBOL_GPL(trace_event_stm_log);
+
+static int alloc_stm_tmp_seq(void)
+{
+   struct trace_seq *seq;
+
+   seq = kzalloc(sizeof(struct trace_seq), GFP_KERNEL);
+   if (!seq)
+   return -ENOMEM;
+
+   stm_tmp_seq = seq;
+
+   return 0;
+}
+
+static int alloc_stm_trace_buffer(void)
+{
+   struct trace_buffer_stm *buffer;
+
+   buffer = kzalloc(sizeof(struct trace_buffer_stm), GFP_KERNEL);
+   if (!buffer)
+   return -ENOMEM;
+
+   buffer->used_len = 0;
+   buffer->size = ARRAY_SIZE(buffer->buffer);
+
+   trace_event_stm_buffer = buffer;
+
+   return 0;
+}
+
+static __init int trace_stm_init_buffers(void)
+{
+   if (alloc_stm_trace_buffer())
+   return -ENOMEM;
+
+   if (alloc_stm_tmp_seq())
+   return -ENOMEM;
+
+   stm_buffers_allocated = 1;
+
+   return 0;
+}
+fs_initcall(trace_stm_init_buffers);
-- 
1.9.1

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


Re: [PATCH] Staging: lusture: Remove an open coded simple_open() function

2015-06-16 Thread Drokin, Oleg

On Jun 16, 2015, at 3:03 AM, Abdul, Hussain (H.) wrote:

> From: Abdul Hussain 
> 
> This patch removes an open coded simple_open() function and replace file
> operations references to the function with simple_open() instead
> 
> Signed-off-by: Abdul Hussain 
> ---
> drivers/staging/lustre/lustre/fld/lproc_fld.c | 9 +
> 1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c 
> b/drivers/staging/lustre/lustre/fld/lproc_fld.c
> index b35ff28..d19b724 100644
> --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c
> +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c
> @@ -143,13 +143,6 @@ fld_debugfs_cache_flush_write(struct file *file, const 
> char __user *buffer,
> }
> 
> static int
> -fld_debugfs_cache_flush_open(struct inode *inode, struct file *file)
> -{
> - file->private_data = inode->i_private;
> - return 0;
> -}
> -
> -static int
> fld_debugfs_cache_flush_release(struct inode *inode, struct file *file)
> {
>   file->private_data = NULL;
> @@ -158,7 +151,7 @@ fld_debugfs_cache_flush_release(struct inode *inode, 
> struct file *file)
> 
> static struct file_operations fld_debugfs_cache_flush_fops = {
>   .owner  = THIS_MODULE,
> - .open   = fld_debugfs_cache_flush_open,
> + .open = simple_open,

Could you please save the indenting to match the rest of this structure 
assignment?

>   .write  = fld_debugfs_cache_flush_write,
>   .release= fld_debugfs_cache_flush_release,
> };
> -- 
> 1.9.1

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


[PATCH] Staging: wilc1000: Remove casting the values returned by kmalloc()

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch removes casting the values returned by memory allocation functions.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/wilc1000/linux_mon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index d5860ce..8cba13c 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -247,7 +247,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
nic = netdev_priv(dev);
 
netif_stop_queue(dev);
-   mgmt_tx = (struct tx_complete_mon_data *)kmalloc(sizeof(struct 
tx_complete_mon_data), GFP_ATOMIC);
+   mgmt_tx = kmalloc(sizeof(struct tx_complete_mon_data), GFP_ATOMIC);
if (mgmt_tx == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
return WILC_FAIL;
@@ -258,7 +258,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
len += sizeof(struct tx_complete_mon_data *);
#endif
 
-   mgmt_tx->buff = (char *)kmalloc(len, GFP_ATOMIC);
+   mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
return WILC_FAIL;
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Staging: wilc1000: Remove casting the values returned by kmalloc()

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch removes casting the values returned by memory allocation functions.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/wilc1000/linux_wlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5f87148..c1e9272 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -580,7 +580,7 @@ static void linux_wlan_dbg(uint8_t *buff)
 static void *linux_wlan_malloc_atomic(uint32_t sz)
 {
char *pntr = NULL;
-   pntr = (char *)kmalloc(sz, GFP_ATOMIC);
+   pntr = kmalloc(sz, GFP_ATOMIC);
PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", sz, pntr);
return (void *)pntr;
 
@@ -588,7 +588,7 @@ static void *linux_wlan_malloc_atomic(uint32_t sz)
 static void *linux_wlan_malloc(uint32_t sz)
 {
char *pntr = NULL;
-   pntr = (char *)kmalloc(sz, GFP_KERNEL);
+   pntr = kmalloc(sz, GFP_KERNEL);
PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", sz, pntr);
return (void *)pntr;
 }
@@ -605,7 +605,7 @@ void linux_wlan_free(void *vp)
 static void *internal_alloc(uint32_t size, uint32_t flag)
 {
char *pntr = NULL;
-   pntr = (char *)kmalloc(size, flag);
+   pntr = kmalloc(size, flag);
PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", size, pntr);
return (void *)pntr;
 }
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [uClinux-dev] m68k compile issue with 4.0.5

2015-06-16 Thread Greg Ungerer
Hi Waldemar,

On 16/06/15 16:24, Geert Uytterhoeven wrote:
> Hi Waldemar,
> 
> On Mon, Jun 15, 2015 at 10:23 PM, Waldemar Brodkorb  wrote:
>> I am trying to build a M68K (Coldfire no-MMU) kernel for Qemu-system-m68k.
>>
>> With 4.0.4 everything is fine. With 4.0.5 I get following compile
>> error:
>>   adk-uclinux-gcc -Wp,-MD,mm/.nommu.o.d  -nostdinc -isystem
>> /home/wbx/m68k/toolchain_qemu-m68k_uclibc-ng_m68k_nommu/usr/lib/gcc/m68k-openadk-uclinux-uclibc/4.9.2/include
>> -I./arch/m68k/include -Iarch/m68k/include/generated/uapi
>> -Iarch/m68k/include/generated  -Iinclude -I./arch/m68k/include/uapi
>> -Iarch/m68k/include/generated/uapi -I./include/uapi
>> -Iinclude/generated/uapi -include ./include/linux/kconfig.h
>> -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
>> -fno-strict-aliasing -fno-common
>> -Werror-implicit-function-declaration -Wno-format-security
>> -std=gnu89 -mcpu=5208 -pipe -DUTS_SYSNAME=\"uClinux\" -D__uClinux__
>> -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized
>> --param=allow-store-data-races=0 -Wframe-larger-than=1024
>> -fno-stack-protector -Wno-unused-but-set-variable
>> -fomit-frame-pointer -fno-var-tracking-assignments
>> -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
>> -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes
>> -Werror=date-time -DCC_HAVE_ASM_GOTO-D"KBUILD_STR(s)=#s"
>> -D"KBUILD_BASENAME=KBUILD_STR(nommu)"
>> -D"KBUILD_MODNAME=KBUILD_STR(nommu)" -c -o mm/nommu.o mm/nommu.c
>> mm/nommu.c: In function 'delete_vma':
>> mm/nommu.c:861:3: error: implicit declaration of function 'vma_fput'
>> [-Werror=implicit-function-declaration]
>>vma_fput(vma);
>>^
>> cc1: some warnings being treated as errors
>>
>> Any idea what change breaks the compile?
> 
> I tried a few m68knommu defconfigs, but can't reproduce it.
> 
> Is this a plain v4.0.5? I can't find the offending call to vma_fput().
> "git grep vma_fput" tells me there's no "vma_fput" in the kernel sources?

I don't have any compile (or runtime) problems with m5208evb_defconfig
on linux-4.0.5 either. That is close to what most people use with qemu.
What .config are you using?

Regards
Greg


> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
> ___
> uClinux-dev mailing list
> uclinux-...@uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-...@uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
> 

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


Re: [PATCH 4/5] clk: qcom: Add A53 clock driver

2015-06-16 Thread Paul Bolle
On Mon, 2015-06-15 at 18:36 +0300, Georgi Djakov wrote:
> In general, it is not expected to unload it as this is for the
> main CPU clock, but i will add a module_exit() call to make it
> correct.

It's not incorrect to not have a module_exit() call. But not having it
means you can't (easily and cleanly) unload this module. Which is
uncommon enough for me to inquire whether that was by design.

Thanks,


Paul Bolle

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


Re: Possible broken MM code in dell-laptop.c?

2015-06-16 Thread Pali Rohár
On Tuesday 16 June 2015 08:33:46 Michal Hocko wrote:
> On Mon 15-06-15 23:27:59, Pali Rohár wrote:
> > On Monday 15 June 2015 23:18:16 Michal Hocko wrote:
> > > On Sun 14-06-15 11:05:07, Pali Rohár wrote:
> > > > Hello,
> > > > 
> > > > in drivers/platform/x86/dell-laptop.c is this part of code:
> > > > 
> > > > static int __init dell_init(void)
> > > > {
> > > > ...
> > > > 
> > > > /*
> > > > 
> > > >  * Allocate buffer below 4GB for SMI data--only 32-bit physical
> > > >  addr * is passed to SMI handler.
> > > >  */
> > > > 
> > > > bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32);
> > > 
> > > [...]
> > > 
> > > > buffer = page_address(bufferpage);
> > > 
> > > [...]
> > > 
> > > > fail_rfkill:
> > > > free_page((unsigned long)bufferpage);
> > > 
> > > This one should be __free_page because it consumes struct page* and
> > > it is the proper counter part for alloc_page. free_page, just to
> > > make it confusing, consumes an address which has to be translated to
> > > a struct page.
> > > 
> > > I have no idea why the API has been done this way and yeah, it is
> > > really confusing.
> > > 
> > > [...]
> > > 
> > > > static void __exit dell_exit(void)
> > > > {
> > > > ...
> > > > 
> > > > free_page((unsigned long)buffer);
> > 
> > So both, either:
> > 
> >  free_page((unsigned long)buffer);
> > 
> > or
> > 
> >  __free_page(bufferpage);
> > 
> > is correct?
> 
> Yes. Although I would use __free_page variant as both seem to be
> globally visible.
> 

Michal, thank you for explaining this situation!

Darren, I will prepare patch which will fix code and use __free_page().

(Btw, execution on fail_rfkill label caused kernel panic)

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


[PATCH v2] Staging: lusture: Remove an open coded simple_open() function

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch removes an open coded simple_open() function and replace file
operations references to the function with simple_open() instead

Signed-off-by: Abdul Hussain 
---
 drivers/staging/lustre/lustre/fld/lproc_fld.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c 
b/drivers/staging/lustre/lustre/fld/lproc_fld.c
index b35ff28..da82210 100644
--- a/drivers/staging/lustre/lustre/fld/lproc_fld.c
+++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c
@@ -143,13 +143,6 @@ fld_debugfs_cache_flush_write(struct file *file, const 
char __user *buffer,
 }
 
 static int
-fld_debugfs_cache_flush_open(struct inode *inode, struct file *file)
-{
-   file->private_data = inode->i_private;
-   return 0;
-}
-
-static int
 fld_debugfs_cache_flush_release(struct inode *inode, struct file *file)
 {
file->private_data = NULL;
@@ -158,7 +151,7 @@ fld_debugfs_cache_flush_release(struct inode *inode, struct 
file *file)
 
 static struct file_operations fld_debugfs_cache_flush_fops = {
.owner  = THIS_MODULE,
-   .open   = fld_debugfs_cache_flush_open,
+   .open   = simple_open,
.write  = fld_debugfs_cache_flush_write,
.release= fld_debugfs_cache_flush_release,
 };
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] Staging: rtl8192e: Timer setup using macro rather assignment

2015-06-16 Thread DHANAPAL, GNANACHANDRAN (G.)
From: Gnanachandran Dhanapal 

This patch shall replaces user defined timer setup function with
standard timer setup macro. Also removes init_timer, because timer can
be initialized in setup_timer macro as well.

Signed-off-by: Gnanachandran Dhanapal 
---
v3: From name and Signed-Off-by were not matching. so
Resending with valid From field added

v2: setup_timer also subsumes init_timer.
Probably delete this function completely (_setup_timer)
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |2 --
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c   |1 -
 drivers/staging/rtl8192e/rtl819x_TS.h|1 -
 drivers/staging/rtl8192e/rtl819x_TSProc.c|   18 +-
 drivers/staging/rtl8192e/rtllib_module.c |6 --
 drivers/staging/rtl8192e/rtllib_softmac.c|4 ++--
 6 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4c53c87..5584b86 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1275,12 +1275,10 @@ static short rtl8192_init(struct net_device *dev)
 
init_hal_dm(dev);
 
-   init_timer(&priv->watch_dog_timer);
setup_timer(&priv->watch_dog_timer,
watch_dog_timer_callback,
(unsigned long) dev);
 
-   init_timer(&priv->gpio_polling_timer);
setup_timer(&priv->gpio_polling_timer,
check_rfctrl_gpio_timer,
(unsigned long)dev);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index 8532e0c..502a699 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -2180,7 +2180,6 @@ static void dm_init_fsync(struct net_device *dev)
priv->rtllib->fsync_state = Default_Fsync;
priv->framesyncMonitor = 1;
 
-   init_timer(&priv->fsync_timer);
setup_timer(&priv->fsync_timer, dm_fsync_timer_callback,
   (unsigned long) dev);
 }
diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h 
b/drivers/staging/rtl8192e/rtl819x_TS.h
index b3e721b..b8fed55 100644
--- a/drivers/staging/rtl8192e/rtl819x_TS.h
+++ b/drivers/staging/rtl8192e/rtl819x_TS.h
@@ -67,7 +67,6 @@ struct rx_ts_record {
u8  num;
 };
 
-void _setup_timer(struct timer_list *, void *, unsigned long);
 
 
 #endif
diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c 
b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index 8a5dd6e..05aea43 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -154,22 +154,22 @@ void TSInitialize(struct rtllib_device *ieee)
 
for (count = 0; count < TOTAL_TS_NUM; count++) {
pTxTS->num = count;
-   _setup_timer(&pTxTS->TsCommonInfo.SetupTimer,
+   setup_timer(&pTxTS->TsCommonInfo.SetupTimer,
TsSetupTimeOut,
(unsigned long) pTxTS);
 
-   _setup_timer(&pTxTS->TsCommonInfo.InactTimer,
+   setup_timer(&pTxTS->TsCommonInfo.InactTimer,
TsInactTimeout,
(unsigned long) pTxTS);
 
-   _setup_timer(&pTxTS->TsAddBaTimer,
+   setup_timer(&pTxTS->TsAddBaTimer,
TsAddBaProcess,
(unsigned long) pTxTS);
 
-   _setup_timer(&pTxTS->TxPendingBARecord.Timer,
+   setup_timer(&pTxTS->TxPendingBARecord.Timer,
BaSetupTimeOut,
(unsigned long) pTxTS);
-   _setup_timer(&pTxTS->TxAdmittedBARecord.Timer,
+   setup_timer(&pTxTS->TxAdmittedBARecord.Timer,
TxBaInactTimeout,
(unsigned long) pTxTS);
 
@@ -186,19 +186,19 @@ void TSInitialize(struct rtllib_device *ieee)
pRxTS->num = count;
INIT_LIST_HEAD(&pRxTS->RxPendingPktList);
 
-   _setup_timer(&pRxTS->TsCommonInfo.SetupTimer,
+   setup_timer(&pRxTS->TsCommonInfo.SetupTimer,
TsSetupTimeOut,
(unsigned long) pRxTS);
 
-   _setup_timer(&pRxTS->TsCommonInfo.InactTimer,
+   setup_timer(&pRxTS->TsCommonInfo.InactTimer,
TsInactTimeout,
(unsigned long) pRxTS);
 
-   _setup_timer(&pRxTS->RxAdmittedBARecord.Timer,
+   setup_timer(&pRxTS->RxAdmittedBARecord.Timer,
RxBaInactTimeout,
(unsigned long) pRxTS);
 
-   _setup_timer(&pRxTS->RxPktPendingTimer,
+   setup_timer(&pRxTS->RxPktPendingTimer,
RxPktPendingTimeout,
 

[PATCH v2 0/3] Add the efuse driver on rockchip platform

2015-06-16 Thread Caesar Wang
The original driver is uploaded by Jianqun.
Here is his patchs:
https://patchwork.kernel.org/patch/5410341/
https://patchwork.kernel.org/patch/5410351/

Jianqun, nevermind!
I check-pick it and re-upload the driver for the upstream.
e.g.:
Tested by on minnie board.(kernel-4.1-rc8)
cd /sys/devices/platform/ffb4.efuse
localhost ffb4.efuse # cat cpu_leakage_show
cpu_version_show
The results:
19
2

Changes in v2:
- Change the document decription.
- Move the efuse driver into driver/soc/vendor.
- update the efuse driver.
- Add the dts node on RK3288.

Caesar Wang (3):
  soc/rockchip: Add efuse bindings for Rockchip SoC efuse driver
  soc/rockchip: efuse: Add Rockchip SoC efuse support
  ARM: dts: Add RK3288 efuse node

 .../bindings/fuse/rockchip,rockchip-efuse.txt  |  14 ++
 arch/arm/boot/dts/rk3288.dtsi  |   5 +
 drivers/soc/Makefile   |   1 +
 drivers/soc/rockchip/Makefile  |   4 +
 drivers/soc/rockchip/efuse.c   | 212 +
 5 files changed, 236 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/fuse/rockchip,rockchip-efuse.txt
 create mode 100644 drivers/soc/rockchip/Makefile
 create mode 100644 drivers/soc/rockchip/efuse.c

-- 
1.9.1

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


[PATCH v2 1/3] soc/rockchip: Add efuse bindings for Rockchip SoC efuse driver

2015-06-16 Thread Caesar Wang
Add efuse bindings for RK3066, RK3188, RK3288 and RK3368.

Signed-off-by: Jianqun Xu 
Signed-off-by: Caesar Wang 

---

Changes in v2:
- Change the document decription.

 .../devicetree/bindings/fuse/rockchip,rockchip-efuse.txt   | 14 ++
 1 file changed, 14 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/fuse/rockchip,rockchip-efuse.txt

diff --git a/Documentation/devicetree/bindings/fuse/rockchip,rockchip-efuse.txt 
b/Documentation/devicetree/bindings/fuse/rockchip,rockchip-efuse.txt
new file mode 100644
index 000..f1f338e
--- /dev/null
+++ b/Documentation/devicetree/bindings/fuse/rockchip,rockchip-efuse.txt
@@ -0,0 +1,14 @@
+ROCKCHIP RK3066/RK3188/RK3288/RK3368 efuse block.
+
+Required properties:
+- compatible : should be: "rockchip,-efuse"
+  "rockchip,rk3066-efuse": found on RK3066,RK3188,RK3288 and RK3368.
+- reg: Should contain 1 entry: the entry gives the physical address and length
+   of the fuse registers.
+
+Example:
+
+   efuse: efuse@ffb4 {
+   compatible = "rockchip,rk3066-efuse";
+   reg = <0xffb4 0x1>;
+   };
-- 
1.9.1

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


[PATCH v2 3/3] ARM: dts: Add RK3288 efuse node

2015-06-16 Thread Caesar Wang
Add the efuse node on RK3288, we can get some information
when enable the efuse driver.
e.g.: the CPU version, leakage.

Signed-off-by: Caesar Wang 

---

Changes in v2:
- Add the dts node on RK3288.

 arch/arm/boot/dts/rk3288.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 165968d..423355e 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -691,6 +691,11 @@
};
};
 
+   efuse: efuse@ffb4 {
+   compatible = "rockchip,rk3066-efuse";
+   reg = <0xffb4 0x1>;
+   };
+
gic: interrupt-controller@ffc01000 {
compatible = "arm,gic-400";
interrupt-controller;
-- 
1.9.1

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


[PATCH v2 2/3] soc/rockchip: efuse: Add Rockchip SoC efuse support

2015-06-16 Thread Caesar Wang
Add driver for efuse found on Rockchip RK3066,RK3188,RK3288 and
RK3368 SoCs.

eFuse is organized as 32bits by 8 one-time programmable
electrical fuses with random access interface.

Signed-off-by: Jianqun Xu 
Signed-off-by: Caesar Wang 

---

Changes in v2:
- Move the efuse driver into driver/soc/vendor.
- update the efuse driver.

 drivers/soc/Makefile  |   1 +
 drivers/soc/rockchip/Makefile |   4 +
 drivers/soc/rockchip/efuse.c  | 212 ++
 3 files changed, 217 insertions(+)
 create mode 100644 drivers/soc/rockchip/Makefile
 create mode 100644 drivers/soc/rockchip/efuse.c

diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 70042b2..91f7f18 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_ARCH_MEDIATEK)+= mediatek/
 obj-$(CONFIG_ARCH_QCOM)+= qcom/
+obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/
 obj-$(CONFIG_ARCH_TEGRA)   += tegra/
 obj-$(CONFIG_SOC_TI)   += ti/
 obj-$(CONFIG_PLAT_VERSATILE)   += versatile/
diff --git a/drivers/soc/rockchip/Makefile b/drivers/soc/rockchip/Makefile
new file mode 100644
index 000..4f5f9bd
--- /dev/null
+++ b/drivers/soc/rockchip/Makefile
@@ -0,0 +1,4 @@
+#
+# Rockchip Soc drivers
+#
+obj-$(CONFIG_ARCH_ROCKCHIP) += efuse.o
diff --git a/drivers/soc/rockchip/efuse.c b/drivers/soc/rockchip/efuse.c
new file mode 100644
index 000..1125320
--- /dev/null
+++ b/drivers/soc/rockchip/efuse.c
@@ -0,0 +1,212 @@
+/*
+ * Rockchip eFuse Driver
+ *
+ * Copyright (c) 2015 Rockchip Electronics Co. Ltd.
+ * Author: Jianqun Xu 
+ * Author: Caesar Wang 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define EFUSE_A_SHIFT  6
+#define EFUSE_A_MASK   0x3ff
+#define EFUSE_PGENBBIT(3)
+#define EFUSE_LOAD BIT(2)
+#define EFUSE_STROBE   BIT(1)
+#define EFUSE_CSB  BIT(0)
+
+#define REG_EFUSE_CTRL 0x
+#define REG_EFUSE_DOUT 0x0004
+
+#define EFUSE_BUF_SIZE 32
+#define EFUSE_CHIP_VERSION_OFFSET  6
+#define EFUSE_CHIP_VERSION_MASK0xf
+#define EFUSE_BUF_LKG_CPU  23
+
+struct rockchip_efuse_info {
+   struct device *dev;
+   void __iomem *regs;
+   u32 buf[EFUSE_BUF_SIZE];
+};
+
+static void efuse_writel(struct rockchip_efuse_info *efuse,
+unsigned int value,
+unsigned int offset)
+{
+   writel_relaxed(value, efuse->regs + offset);
+}
+
+static unsigned int efuse_readl(struct rockchip_efuse_info *efuse,
+   unsigned int offset)
+{
+   return readl_relaxed(efuse->regs + offset);
+}
+
+int rockchip_efuse_get_cpuleakage(struct platform_device *pdev,
+ unsigned int *value)
+{
+   struct rockchip_efuse_info *efuse;
+
+   efuse = platform_get_drvdata(pdev);
+   if (!efuse)
+   return -EAGAIN;
+
+   *value = efuse->buf[EFUSE_BUF_LKG_CPU];
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(rockchip_efuse_get_cpuleakage);
+
+int rockchip_efuse_get_chip_version(struct platform_device *pdev,
+   unsigned int *value)
+{
+   struct rockchip_efuse_info *efuse;
+
+   efuse = platform_get_drvdata(pdev);
+   if (!efuse)
+   return -EAGAIN;
+
+   *value = efuse->buf[EFUSE_CHIP_VERSION_OFFSET] &
+   EFUSE_CHIP_VERSION_MASK;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(rockchip_efuse_get_chip_version);
+
+static ssize_t cpu_leakage_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int leakage;
+   int ret;
+   struct platform_device *pdev = to_platform_device(dev);
+
+   ret = rockchip_efuse_get_cpuleakage(pdev, &leakage);
+   if (ret)
+   return ret;
+
+   return sprintf(buf, "%d\n", leakage);
+}
+
+static ssize_t cpu_version_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int version;
+   int ret;
+   struct platform_device *pdev = to_platform_device(dev);
+
+   ret = rockchip_efuse_get_chip_version(pdev, &version);
+   if (ret)
+   return ret;
+
+   return sprintf(buf, "%d\n", version);
+}
+
+static void rockchip_efuse_init(struct rockchip_efuse_info *efuse)
+{
+   unsigned int start;
+
+   efuse_writel(efuse, EF

[tip:x86/apic] genirq: Prevent crash in irq_move_irq()

2015-06-16 Thread tip-bot for Jiang Liu
Commit-ID:  458526ec81d755dfaa17f3d863302afe6fbefca0
Gitweb: http://git.kernel.org/tip/458526ec81d755dfaa17f3d863302afe6fbefca0
Author: Jiang Liu 
AuthorDate: Mon, 1 Jun 2015 16:05:11 +0800
Committer:  Thomas Gleixner 
CommitDate: Tue, 16 Jun 2015 09:23:28 +0200

genirq: Prevent crash in irq_move_irq()

The functions irq_move_irq() and irq_move_masked_irq() expect that the
caller passes the top-level irq_data to them when hierarchical
irqdomains are enabled. But that's not true when called from
apic_ack_edge(), which results in a null pointer dereference by
idata->chip->irq_mask(idata).

Instead of fixing callers to passing top-level irq_data, we rather
change irq_move_irq()/irq_move_masked_irq() to accept any irq_data.

Fixes: 52f518a3a7c 'x86/MSI: Use hierarchical irqdomains to manage MSI 
interrupts'
Reported-by: Huang Ying 
Signed-off-by: Jiang Liu 
Cc: Konrad Rzeszutek Wilk 
Cc: Tony Luck 
Cc: Bjorn Helgaas 
Cc: Benjamin Herrenschmidt 
Cc: Randy Dunlap 
Cc: Yinghai Lu 
Cc: Borislav Petkov 
Link: 
http://lkml.kernel.org/r/1433145945-789-3-git-send-email-jiang@linux.intel.com
Signed-off-by: Thomas Gleixner 
---
 kernel/irq/migration.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index ca3f4aa..dd203e2 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -7,7 +7,7 @@
 void irq_move_masked_irq(struct irq_data *idata)
 {
struct irq_desc *desc = irq_data_to_desc(idata);
-   struct irq_chip *chip = idata->chip;
+   struct irq_chip *chip = desc->irq_data.chip;
 
if (likely(!irqd_is_setaffinity_pending(&desc->irq_data)))
return;
@@ -52,6 +52,13 @@ void irq_move_irq(struct irq_data *idata)
 {
bool masked;
 
+   /*
+* Get top level irq_data when CONFIG_IRQ_DOMAIN_HIERARCHY is enabled,
+* and it should be optimized away when CONFIG_IRQ_DOMAIN_HIERARCHY is
+* disabled. So we avoid an "#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY" here.
+*/
+   idata = irq_desc_get_irq_data(irq_data_to_desc(idata));
+
if (likely(!irqd_is_setaffinity_pending(idata)))
return;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Staging: wilc1000: Boolean tests don't need comparisons

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch removes unwanted true and false from boolean tests.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/wilc1000/coreconfigurator.c   | 8 
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_mon.c  | 2 +-
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c  | 4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 9abc73d..616cf6d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1717,7 +1717,7 @@ s32 ParseResponse(u8 *resp, tstrWID *pstrWIDcfgResult)
idx++;
}
idx += 3;
-   if ((u16WIDid == g_wid_num) && (num_wid_processed == false)) {
+   if ((u16WIDid == g_wid_num) && (!num_wid_processed)) {
num_wid_processed = true;
 
if (-2 == further_process_response(&resp[idx], 
u16WIDid, cfg_len, true, 0, &pstrWIDcfgResult[ResCnt])) {
@@ -1923,7 +1923,7 @@ s32 ConfigWaitResponse(WILC_Char *pcRespBuffer, s32 
s32MaxRespBuffLen, s32 *ps32
 * gstrConfigPktInfo.bRespRequired = bRespRequired;*/
 
 
-   if (gstrConfigPktInfo.bRespRequired == true) {
+   if (gstrConfigPktInfo.bRespRequired) {
down(&SemHandlePktResp);
 
*ps32BytesRead = gstrConfigPktInfo.s32BytesRead;
@@ -1984,7 +1984,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
ConfigWaitResponse(gps8ConfigPacket, MAX_PACKET_BUFF_SIZE, 
&s32RcvdRespLen, bRespRequired);
 
 
-   if (bRespRequired == true)  {
+   if (bRespRequired)  {
/* If the operating Mode is GET, then we expect a response 
frame from */
/* the driver. Hence start listening to the port for response   
  */
if (g_oper_mode == GET_CFG) {
@@ -2021,7 +2021,7 @@ s32 ConfigProvideResponse(WILC_Char *pcRespBuffer, s32 
s32RespLen)
 {
s32 s32Error = WILC_SUCCESS;
 
-   if (gstrConfigPktInfo.bRespRequired == true) {
+   if (gstrConfigPktInfo.bRespRequired) {
if (s32RespLen <= gstrConfigPktInfo.s32MaxRespBuffLen) {
WILC_memcpy(gstrConfigPktInfo.pcRespBuffer, 
pcRespBuffer, s32RespLen);
gstrConfigPktInfo.s32BytesRead = s32RespLen;
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 17ab5cd..be1f6bf 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -7816,7 +7816,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
pNewJoinBssParam->rsn_cap[1] = 
pu8IEs[rsnIndex + 1];
rsnIndex += 2;
}
-   pNewJoinBssParam->rsn_found = 1;
+   pNewJoinBssParam->rsn_found = true;
index += pu8IEs[index + 1] + 2; /* ID,Length 
bytes and IE body */
continue;
} else
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 8cba13c..30d1c76 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -452,7 +452,7 @@ void WILC_mgm_HOSTAPD_ACK(void *priv, bool bStatus)
cb_hdr->rate = 5; /* txrate->bitrate / 5; */
 
 
-   if (true == bStatus) {
+   if (bStatus) {
/* success */
cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_RTS;
} else {
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index c1e9272..c1cf5be 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -309,7 +309,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
 
 
 
-   if (bEnablePS== true)
+   if (bEnablePS)
host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 
1, 0);
 
PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 9861476..db0b782 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -624,7 +624,7 @@ static void CfgConnectResult(tenuConnDisconnEvent 
enuConnDisconnEvent,
}
}
 
-   if (bNeedScanRefresh == true) {
+   if (bNeedScan

Re: [PATCH linux-next 2/2] mfd: flexcom: add a driver for Atmel Flexible Serial Communication Unit

2015-06-16 Thread Paul Bolle
Just a nit: a license mismatch.

On Mon, 2015-06-15 at 18:38 +0200, Cyrille Pitchen wrote:
> --- /dev/null
> +++ b/drivers/mfd/atmel-flexcom.c

> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.

This states the license is GPL v2 (or later)

> +MODULE_LICENSE("GPL v2");

According to include/linux/module.h this states the license is (just)
GPL v2. So I think that either the comment at the top of this file or
the ident used in the MODULE_LICENSE() macro needs to change.

Thanks,


Paul Bolle 

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


Re: [PATCH] ipc: Modify message queue accounting to reflect both total user data and auxiliary kernel data

2015-06-16 Thread Michael Kerrisk (man-pages)
[Added a couple of people into CC that I know are interested/participated
in past discussions that were related. Also added linux-...@vger.kernel.org]

Background for those new to the topic:

The pseudofiles in the mqueue filesystem (usually mounted at
/dev/mqueue) expose fields with metadata describing a message
queue. One of these fields, QSIZE, as originally implemented,
showed the total number of bytes of user data in all messages in
the message queue, and this feature was documented from the 
beginning in the mq_overview(7) page. In 3.5, some other (useful)
work happened to break the user-space API in a couple of places,
including the value exposed via QSIZE, which now includes a measure 
of kernel overhead bytes for the queue, a figure that renders QSIZE
useless for its original purpose, since there's no way to deduce
the number of overhead bytes consumed by the implementation.
(The other user-space breakage was subsequently fixed.)


Hi Marcus,

On 06/13/2015 09:40 PM, Marcus Gelderie wrote:
> A while back, the message queue implementation in the kernel was
> improved to use btrees to speed up retrieval of messages (commit
> d6629859b36). The patch introducing the improved kernel handling of
> message queues has, as a by-product, changed the meaning of the 
> QSIZE field in the pseudo-file created for the queue. Before, this 
> field reflected the size of the user-data in the queue. Since, it 
> now also takes kernel data structures into account, this is no no longer
> true. For example, if 13 bytes of user data are in the queue, on my 
> machine the file reports a size of 61 bytes.

Thanks for taking a look at this. This user-space breakage been one of 
those nagging things I've wanted to see fixed for a while now, and since
the earlier discussion, I've heard from one or two people who were 
unpleasantly surprised by this API change.

> There was some discussion on this topic before (for example
> https://lkml.org/lkml/2014/10/1/115). Reporting the size of the
> message queue in kernel has its merits, but doing so in the QSIZE
> field of the pseudo file corresponding to the queue is a breaking
> change. This patch therefore returns the QSIZE field to its original
> meaning. At the same time, it introduces a new field QKERSIZE that
> reflects the size of the queue in kernel (user data + kernel data).
> 
> If the accounting should be improved, I'd be happy to take a look at 
> that, too. I would propose to do that in terms of the newly introduced
> field.

The general approach seems good to me. Making the new QKERSIZE the last
field, as you have done, so that any applications that were parsing
an mqueue file in a really dumb fashion (by ordinal position, rather 
than checking field names) seems good to me.

Acked-by: Michael Kerrisk 

Assuming this approach is acceptable, this patch should eventually go 
to stable@ so it is backported to older stable kernels. In the event
that you need to resubmit the patch, I suggest including some of the
background detail I give above in the commit message.

Cheers,

Michael

> Signed-off-by: Marcus Gelderie 
> ---
>  ipc/mqueue.c | 20 ++--
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index 3aaea7f..7d4c464 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -41,7 +41,7 @@
>  
>  #define MQUEUE_MAGIC 0x19800202
>  #define DIRENT_SIZE  20
> -#define FILENT_SIZE  80
> +#define FILENT_SIZE  90
>  
>  #define SEND 0
>  #define RECV 1
> @@ -82,8 +82,12 @@ struct mqueue_inode_info {
>   /* for tasks waiting for free space and messages, respectively */
>   struct ext_wait_queue e_wait_q[2];
>  
> - unsigned long qsize; /* size of queue in memory (sum of all msgs) */
> -};
> + /* size of queue in memory (sum of all msgs plus kernel
> +  * data structures) */
> + unsigned long qsize;
> +
> + /* size of user data in the queue (sum of all msgs) */
> + unsigned long q_usersize; };
>  
>  static const struct inode_operations mqueue_dir_inode_operations;
>  static const struct file_operations mqueue_file_operations;
> @@ -151,6 +155,7 @@ static int msg_insert(struct msg_msg *msg, struct 
> mqueue_inode_info *info)
>  insert_msg:
>   info->attr.mq_curmsgs++;
>   info->qsize += msg->m_ts;
> + info->q_usersize += msg->m_ts;
>   list_add_tail(&msg->m_list, &leaf->msg_list);
>   return 0;
>  }
> @@ -210,6 +215,7 @@ try_again:
>   }
>   info->attr.mq_curmsgs--;
>   info->qsize -= msg->m_ts;
> + info->q_usersize -= msg->m_ts;
>   return msg;
>  }
>  
> @@ -246,6 +252,7 @@ static struct inode *mqueue_get_inode(struct super_block 
> *sb,
>   info->notify_owner = NULL;
>   info->notify_user_ns = NULL;
>   info->qsize = 0;
> + info->q_usersize = 0;
>   info->user = NULL;  /* set when all is ok */
>   info->msg

[PATCH] KVM: Avoid warning "user requested TSC rate below hardware speed" when create VM.

2015-06-16 Thread Lan Tianyu
KVM populates max_tsc_khz with tsc_khz at arch init stage on the
constant tsc machine and creates VM with max_tsc_khz as tsc. However,
tsc_khz maybe changed during tsc clocksource driver refines calibration.
This will cause to create VM with slow tsc and produce the following
warning. To fix the issue, compare max_tsc_khz with tsc_khz and
update max_tsc_khz with new value of tsc_khz if it has been changed
when create a VM.

[   94.916906] [ cut here ]
[   94.922127] WARNING: CPU: 0 PID: 824 at arch/x86/kvm/vmx.c:2272 
vmx_set_tsc_khz+0x3e/0x50()
[   94.931503] user requested TSC rate below hardware speed
[   94.937470] Modules linked in:
[   94.940923] CPU: 0 PID: 824 Comm: qemu-system-x86 Tainted: G  D W   
4.1.0-rc3+ #4
[   94.960350]  81f453f8 88027e9f3bc8 81b5eb8a 

[   94.968721]  88027e9f3c18 88027e9f3c08 810e6f8a 
8802
[   94.977103]  001d3300 88027e98 0001 
88027e98
[   94.985476] Call Trace:
[   94.988242]  [] dump_stack+0x45/0x57
[   94.994020]  [] warn_slowpath_common+0x8a/0xc0
[   95.000772]  [] warn_slowpath_fmt+0x46/0x50
[   95.007222]  [] vmx_set_tsc_khz+0x3e/0x50
[   95.013488]  [] kvm_set_tsc_khz.part.106+0xa7/0xe0
[   95.020618]  [] kvm_arch_vcpu_init+0x208/0x230
[   95.027373]  [] kvm_vcpu_init+0xc9/0x110
[   95.033540]  [] vmx_create_vcpu+0x70/0xc30
[   95.039911]  [] ? vmx_create_vcpu+0x20/0xc30
[   95.046476]  [] kvm_arch_vcpu_create+0x3e/0x60
[   95.053233]  [] kvm_vm_ioctl+0x1a0/0x770
[   95.059400]  [] ? __fget+0x5/0x200
[   95.064991]  [] ? rcu_irq_exit+0x7f/0xd0
[   95.071157]  [] do_vfs_ioctl+0x308/0x540
[   95.077323]  [] ? expand_files+0x1f1/0x280
[   95.083684]  [] ? selinux_file_ioctl+0x5b/0x100
[   95.090538]  [] SyS_ioctl+0x81/0xa0
[   95.096218]  [] system_call_fastpath+0x12/0x76
[   95.102974] ---[ end trace 08ade884081d9dd7 ]---

Link: https://bugzilla.kernel.org/show_bug.cgi?id=99861
Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/x86.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 43f0df7..6c7fefe 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7814,6 +7814,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 {
struct page *page;
struct kvm *kvm;
+   int cpu;
int r;
 
BUG_ON(vcpu->kvm == NULL);
@@ -7833,6 +7834,21 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
}
vcpu->arch.pio_data = page_address(page);
 
+   /*
+* max_tsc_khz records tsc_khz at arch init stage on the constant tsc
+* machine. However, tsc_khz maybe changed during tsc clocksource driver
+* refines calibration. This will cause to create VM with slow tsc
+* and produce warning. To avoid such case, check whether tsc_khz
+* has been changed here and update max_tsc_khz with new value of
+* tsc_khz if changed.
+*/
+   if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && max_tsc_khz != tsc_khz) {
+   max_tsc_khz = tsc_khz;
+   pr_debug("kvm: max_tsc_khz is changed to %ld\n", max_tsc_khz);
+   for_each_online_cpu(cpu)
+   smp_call_function_single(cpu, tsc_khz_changed, NULL, 1);
+   }
+
kvm_set_tsc_khz(vcpu, max_tsc_khz);
 
r = kvm_mmu_create(vcpu);
-- 
1.8.4.rc0.1.g8f6a3e5.dirty

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


Re: Possible broken MM code in dell-laptop.c?

2015-06-16 Thread Michal Hocko
On Tue 16-06-15 09:15:23, Pali Rohár wrote:
[...]
> Michal, thank you for explaining this situation!
> 
> Darren, I will prepare patch which will fix code and use __free_page().
> 
> (Btw, execution on fail_rfkill label caused kernel panic)

I am sorry, I could have made it more clear in the very first email.
A panic is to be expected because free_page will translate the given
address to a struct page* but this is what the code gave it. So an
unrelated struct page would be freed (or maybe an invalid one).

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


Re: [PATCH] m68k: Use vsprintf %pM extension

2015-06-16 Thread Greg Ungerer
Hi Joe,

On 15/06/15 12:01, Joe Perches wrote:
> Format mac addresses with the normal kernel extension.
> 
> Signed-off-by: Joe Perches 

Thanks. I have pushed this into the m68knommu git tree
(for-next branch) on kernel.org.

Regards
Greg


> ---
>  arch/m68k/68000/m68EZ328.c | 3 +--
>  arch/m68k/68000/m68VZ328.c | 3 +--
>  arch/m68k/68360/config.c   | 3 +--
>  3 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/m68k/68000/m68EZ328.c b/arch/m68k/68000/m68EZ328.c
> index 2195290..e6ab321 100644
> --- a/arch/m68k/68000/m68EZ328.c
> +++ b/arch/m68k/68000/m68EZ328.c
> @@ -62,8 +62,7 @@ void __init config_BSP(char *command, int len)
>  #ifdef CONFIG_UCSIMM
>printk(KERN_INFO "uCsimm serial string [%s]\n",getserialnum());
>p = cs8900a_hwaddr = gethwaddr(0);
> -  printk(KERN_INFO "uCsimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
> - p[0], p[1], p[2], p[3], p[4], p[5]);
> +  printk(KERN_INFO "uCsimm hwaddr %pM\n", p);
>  
>p = getbenv("APPEND");
>if (p) strcpy(p,command);
> diff --git a/arch/m68k/68000/m68VZ328.c b/arch/m68k/68000/m68VZ328.c
> index 0e5e5a1..1154bdb 100644
> --- a/arch/m68k/68000/m68VZ328.c
> +++ b/arch/m68k/68000/m68VZ328.c
> @@ -152,8 +152,7 @@ static void __init init_hardware(char *command, int size)
>  
>   printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum());
>   p = cs8900a_hwaddr = gethwaddr(0);
> - printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
> - p[0], p[1], p[2], p[3], p[4], p[5]);
> + printk(KERN_INFO "uCdimm hwaddr %pM\n", p);
>   p = getbenv("APPEND");
>   if (p)
>   strcpy(p, command);
> diff --git a/arch/m68k/68360/config.c b/arch/m68k/68360/config.c
> index fd1f948c..b65fe4e 100644
> --- a/arch/m68k/68360/config.c
> +++ b/arch/m68k/68360/config.c
> @@ -154,8 +154,7 @@ void __init config_BSP(char *command, int len)
>  #if defined(CONFIG_UCQUICC) && 0
>printk(KERN_INFO "uCquicc serial string [%s]\n",getserialnum());
>p = scc1_hwaddr = gethwaddr(0);
> -  printk(KERN_INFO "uCquicc hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
> - p[0], p[1], p[2], p[3], p[4], p[5]);
> +  printk(KERN_INFO "uCquicc hwaddr %pM\n", p);
>  
>p = getbenv("APPEND");
>if (p)
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [BUG?] crypto: caam: little/big endianness on ARM vs PPC

2015-06-16 Thread Steffen Trumtrar
Hi!

On Mon, Jun 15, 2015 at 05:28:16PM +0100, Russell King - ARM Linux wrote:
> On Mon, Jun 15, 2015 at 05:59:07PM +0200, Steffen Trumtrar wrote:
> > I'm working on CAAM support for the ARM-based i.MX6 SoCs. The current
> > drivers/crypto/caam driver only works for PowerPC AFAIK.
> > Actually, there isn't that much to do, to get support for the i.MX6 but
> > one patch breaks the driver severely:
> > 
> > commit ef94b1d834aace7101de77c3a7c2631b9ae9c5f6
> > crypto: caam - Add definition of rd/wr_reg64 for little endian platform
> 
> You're not the only one who's hitting problems with this - Jon Nettleton
> has been working on it recently.
> 
> The way this has been done is fairly yucky to start with: several things
> about it are particularly horrid.  The first is the repetitive code
> for the BE and LE cases, when all that's actually different is the
> register order between the two code cases.
> 
> The second thing is the excessive use of masking - I'm pretty sure the
> compiler won't complain with the below.
> 
> diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
> index 378ddc17f60e..ba0fa630a25d 100644
> --- a/drivers/crypto/caam/regs.h
> +++ b/drivers/crypto/caam/regs.h
> @@ -84,34 +84,28 @@
>  #endif
>  
>  #ifndef CONFIG_64BIT
> -#ifdef __BIG_ENDIAN
> -static inline void wr_reg64(u64 __iomem *reg, u64 data)
> -{
> - wr_reg32((u32 __iomem *)reg, (data & 0xull) >> 32);
> - wr_reg32((u32 __iomem *)reg + 1, data & 0xull);
> -}
> -
> -static inline u64 rd_reg64(u64 __iomem *reg)
> -{
> - return (((u64)rd_reg32((u32 __iomem *)reg)) << 32) |
> - ((u64)rd_reg32((u32 __iomem *)reg + 1));
> -}
> +#if defined(__BIG_ENDIAN)
> +#define REG64_HI32(reg) ((u32 __iomem *)(reg))
> +#define REG64_LO32(reg) ((u32 __iomem *)(reg) + 1)
> +#elif defined(__LITTLE_ENDIAN)
> +#define REG64_HI32(reg) ((u32 __iomem *)(reg) + 1)
> +#define REG64_LO32(reg) ((u32 __iomem *)(reg))
>  #else
> -#ifdef __LITTLE_ENDIAN
> +#error Broken endian?
> +#endif
> +
>  static inline void wr_reg64(u64 __iomem *reg, u64 data)
>  {
> - wr_reg32((u32 __iomem *)reg + 1, (data & 0xull) >> 32);
> - wr_reg32((u32 __iomem *)reg, data & 0xull);
> + wr_reg32(REG64_HI32(reg), data >> 32);
> + wr_reg32(REG64_LO32(reg), data);
>  }
>  
>  static inline u64 rd_reg64(u64 __iomem *reg)
>  {
> - return (((u64)rd_reg32((u32 __iomem *)reg + 1)) << 32) |
> - ((u64)rd_reg32((u32 __iomem *)reg));
> + return ((u64)rd_reg32(REG64_HI32(reg))) << 32 |
> + rd_reg32(REG64_LO32(reg));
>  }
>  #endif
> -#endif
> -#endif
>  
>  /*
>   * jr_outentry
> 
> The second issue is that apparently, the register order doesn't actually
> change for LE devices - in other words, the byte order within each register
> does change, but they aren't a 64-bit register, they're two separate 32-bit
> registers.  So, they should always be written as such.
> 
> So, I'd get rid of the #if defined(__BIG_ENDIAN) stuff and instead have:
> 
> +/*
> + * The DMA address register is a pair of 32-bit registers, and should
> + * always be accessed as such.
> + */
> +#define REG64_HI32(reg) ((u32 __iomem *)(reg))
> +#define REG64_LO32(reg) ((u32 __iomem *)(reg) + 1)
> 

Thanks for all your explanations (in the other mail, too).
I, personally, like this approach the best; at least in the current state
of the driver.

Thanks,
Steffen

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


[PATCH] x86/Kconfig.debug: hide X86_VERBOSE_BOOTUP if EARLY_PRINTK is not set

2015-06-16 Thread Alexander Kuleshov
The X86_VERBOSE_BOOTUP enables informational output from the decompression
stage with the earlyprintk. If CONFIG_EARLY_PRINTK is not set, there are
no reasons to make CONFIG_X86_VERBOSE_BOOTUP possible for the configuration.

Signed-off-by: Alexander Kuleshov 
---
 arch/x86/Kconfig.debug | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 72484a6..53d096b 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -22,14 +22,6 @@ config STRICT_DEVMEM
 
  If in doubt, say Y.
 
-config X86_VERBOSE_BOOTUP
-   bool "Enable verbose x86 bootup info messages"
-   default y
-   ---help---
- Enables the informational output from the decompression stage
- (e.g. bzImage) of the boot. If you disable this you will still
- see errors. Disable this if you want silent bootup.
-
 config EARLY_PRINTK
bool "Early printk" if EXPERT
default y
@@ -65,6 +57,15 @@ config EARLY_PRINTK_EFI
  This is useful for kernel debugging when your machine crashes very
  early before the console code is initialized.
 
+config X86_VERBOSE_BOOTUP
+   bool "Enable verbose x86 bootup info messages"
+   depends on EARLY_PRINTK
+   default y
+   ---help---
+ Enables the informational output from the decompression stage
+ (e.g. bzImage) of the boot. If you disable this you will still
+ see errors. Disable this if you want silent bootup.
+
 config X86_PTDUMP
bool "Export kernel pagetable layout to userspace via debugfs"
depends on DEBUG_KERNEL
-- 
2.4.0.596.ga5fe668

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


Re: [tip:x86/apic] genirq: Prevent crash in irq_move_irq()

2015-06-16 Thread Jiang Liu
On 2015/6/16 15:31, tip-bot for Jiang Liu wrote:
> Commit-ID:  458526ec81d755dfaa17f3d863302afe6fbefca0
> Gitweb: http://git.kernel.org/tip/458526ec81d755dfaa17f3d863302afe6fbefca0
> Author: Jiang Liu 
> AuthorDate: Mon, 1 Jun 2015 16:05:11 +0800
> Committer:  Thomas Gleixner 
> CommitDate: Tue, 16 Jun 2015 09:23:28 +0200
> 
> genirq: Prevent crash in irq_move_irq()
> 
> The functions irq_move_irq() and irq_move_masked_irq() expect that the
> caller passes the top-level irq_data to them when hierarchical
> irqdomains are enabled. But that's not true when called from
> apic_ack_edge(), which results in a null pointer dereference by
> idata->chip->irq_mask(idata).
> 
> Instead of fixing callers to passing top-level irq_data, we rather
> change irq_move_irq()/irq_move_masked_irq() to accept any irq_data.
> 
> Fixes: 52f518a3a7c 'x86/MSI: Use hierarchical irqdomains to manage MSI 
> interrupts'
Hi Thomas,
This patch has dependency on patch "[Patch v3 01/36] genirq:
Enhance irq_data_to_desc() to support hierarchy irqdomain" in the
same patch set, otherwise irq_data_to_desc(idata) may return invalid
irq_desc and may cause memory crash.
Thanks!
Gerry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel][PATCH 2/4] ASoC: wm8960: support configure headphone jack detect pin and polarity from device tree

2015-06-16 Thread Zidan Wang
On Fri, Jun 12, 2015 at 01:50:05PM +0100, Charles Keepax wrote:
> On Thu, Jun 11, 2015 at 07:14:34PM +0800, Zidan Wang wrote:
> > The ADCLRC/GPIO1, LINPUT3/JD2 and RINPUT3/JD3 pins can be selected as
> > headphone jack detect inputs to automatically disable the speaker output
> > and enable the headphone.
> > 
> > Signed-off-by: Zidan Wang 
> > ---
> 
> This feels like this is missing some iteraction with DAPM, there
> are DAPM widgets that represent both the Speaker and the
> Headphone, in the case this feature is in use the power state
> DAPM shows may no longer accurately reflects the actual power
> state of the device.
> 
> That said I have no idea if the registers update on the chip to
> reflect this change (my guess is that they don't). I am not
> really sure what the correct way to handle this sort of hardware
> output switching would be in DAPM.
> 
> Thanks,
> Charles
Yes, there are no registers represent that it is playback from headphone
or speaker. So the hardware should connect the headphone detect output 
to CPU GPIO pin instead of the codec headphone detect pin?

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


Re: [PATCH 1/4] mfd: 88pm800: add device tree support

2015-06-16 Thread Vaibhav Hiremath



On Monday 01 June 2015 02:08 PM, Lee Jones wrote:

On Sat, 30 May 2015, Vaibhav Hiremath wrote:



Thanks for your review. and sorry for delayed response.


Add DT support to the 88pm800 driver along with below properties
- marvell,88pm800-irq-write-clear :
  Idicates whether interrupt status is cleared by write

Also, creates the DT binding text file,
Documentation/devicetree/bindings/mfd/88pm800.txt

Signed-off-by: Chao Xie 
Signed-off-by: Vaibhav Hiremath 
---
  Documentation/devicetree/bindings/mfd/88pm800.txt | 57 +++
  drivers/mfd/88pm800.c | 39 


These should be submitted separately.




Ok, will separate it in next version.



  2 files changed, 96 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/mfd/88pm800.txt

diff --git a/Documentation/devicetree/bindings/mfd/88pm800.txt 
b/Documentation/devicetree/bindings/mfd/88pm800.txt
new file mode 100644
index 000..094951b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/88pm800.txt
@@ -0,0 +1,57 @@
+* Marvell 88PM800 Power Management IC
+
+Required parent device properties:
+- compatible : "marvell,88pm800"
+- reg : the I2C slave address for the 88pm800 chip
+- interrupts : IRQ line for the 88pm800 chip
+- interrupt-controller: describes the 88pm800 as an interrupt controller
+- #interrupt-cells : should be 1.
+   - The cell is the 88pm800 local IRQ number
+
+Optional parent device properties:
+- marvell,88pm800-irq-write-clr: indicates whether interrupt status is cleared 
by write


Drop the device name.  These bindings should be as generic as possible.



OK, how about simply

"mfd-irq_clr_on_write"


Also describe what the absence of the property means.



Ok.


+88pm800 consists of a large and varied group of sub-devices:


3?



I have explicitly mentioned in note that more device list will follow.
I just wanted to add entries as and when we add/enable driver support.


+Device  Supply NamesDescription
+--  ---
+88pm80x-onkey  :   : On key
+88pm80x-rtc:   : RTC
+88pm80x:   : Regulators


Surely regulators is 88pm80x-regulator, no?



did not understand what change is expected here.


+Note: More device list will follow
+
+Example:
+
+   pmic: 88pm800@30 {
+   compatible = "marvell,88pm800";
+   reg = <0x30>;
+   interrupts = <0 77 0x4>;


Please use the #defines in include/dt-bindings/



Ok.


+   interrupt-parent = <&gic>;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   marvell,88pm800-irq-write-clr;
+
+   regulators {
+   compatible = "marvell,88pm80x-regulator";
+
+   buck1a: BUCK1A {
+   regulator-compatible = "88PM800-BUCK1A";
+   regulator-min-microvolt = <60>;
+   regulator-max-microvolt = <180>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+   ldo1: LDO1 {
+   regulator-compatible = "88PM800-LDO1";
+   regulator-min-microvolt = <170>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+   };


'\n' here.


+   rtc {
+   compatible = "marvell,88pm80x-rtc";
+   };
+   };
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
index 841717a..06ee058 100644
--- a/drivers/mfd/88pm800.c
+++ b/drivers/mfd/88pm800.c
@@ -27,6 +27,7 @@
  #include 
  #include 
  #include 
+#include 

  /* Interrupt Registers */
  #define PM800_INT_STATUS1 (0x05)
@@ -121,6 +122,11 @@ static const struct i2c_device_id pm80x_id_table[] = {
  };
  MODULE_DEVICE_TABLE(i2c, pm80x_id_table);

+static const struct of_device_id pm80x_of_match_table[] = {
+   { .compatible = "marvell,88pm800", },
+   {},
+};
+
  static struct resource rtc_resources[] = {
{
 .name = "88pm80x-rtc",
@@ -133,6 +139,7 @@ static struct resource rtc_resources[] = {
  static struct mfd_cell rtc_devs[] = {
{
 .name = "88pm80x-rtc",
+.of_compatible = "marvell,88pm80x-rtc",
 .num_resources = ARRAY_SIZE(rtc_resources),
 .resources = &rtc_resources[0],
 .id = -1,
@@ -151,6 +158,7 @@ static struct resource onkey_resources[] = {
  static const struct mfd_cell onkey_devs[] = {
{
 .name = "88pm80x-onkey",
+.of_compatible = "marvell,88pm80x-onkey",
 .num_resources = 1,
 .resources = &onkey_resources[0],
 

Re: [PATCH 02/21] ARM: tegra: Add gpio-ranges property

2015-06-16 Thread Tomeu Vizoso
On 28 May 2015 at 17:50, Stephen Warren  wrote:
> On 05/28/2015 02:26 AM, Tomeu Vizoso wrote:
>>
>> On 27 May 2015 at 16:49, Stephen Warren  wrote:
>>>
>>> On 05/27/2015 08:18 AM, Tomeu Vizoso wrote:


 On 26 May 2015 at 21:41, Stephen Warren  wrote:
>
>
> On 05/25/2015 08:53 AM, Tomeu Vizoso wrote:
>>
>>
>>
>> Specify how the GPIOs map to the pins in T124, so the dependency is
>> explicit.
>>
>> Signed-off-by: Tomeu Vizoso 
>> ---
>> arch/arm/boot/dts/tegra124.dtsi | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm/boot/dts/tegra124.dtsi
>> b/arch/arm/boot/dts/tegra124.dtsi
>> index 13cc7ca..5d1d35f 100644
>> --- a/arch/arm/boot/dts/tegra124.dtsi
>> +++ b/arch/arm/boot/dts/tegra124.dtsi
>> @@ -254,6 +254,7 @@
>>   gpio-controller;
>>   #interrupt-cells = <2>;
>>   interrupt-controller;
>> +   gpio-ranges = <&pinmux 0 0 250>;
>
>
>
>
> We should be consistent between SoCs. Why not make the same change for
> all
> Tegra SoCs?
>
> I think this change will cause the GPIO subsystem to call into the
> pinctrl
> subsystem and create/add/register a new GPIO<->pinctrl range structure.
> The
> pinctrl driver already does this, so I think we'll end up with two
> duplicate
> entries in the pinctrl device's gpio_ranges list. This probably won't
> cause
> a problem, but I wanted to make sure you'd thought about it to make
> sure.



 Actually, I have checked and see that gpio-tegra.c registers 256
 gpios, but pinctrl-tegra124.c adds a range of only 251. I don't really
 remember where I got the 250 value from, sorry :(

 I don't see how that would cause any concrete problems, but maybe we
 should have a single authoritative source (not sure we can do so
 without breaking DT ABI though).

> Right now, I think we get lucky and pinctrl ends up probing first (or
> at
> least very early) anyway. Somewhat related to this series, I wonder if
> we
> shouldn't add pinctrl client properties to every node in the Tegra DT
> that
> describes a controller that makes use of external pins that are
> affected
> by
> the pinmux. Such a change would guarantee this desired probing order.
> In
> order to preserve the "program the entire pinmux at once" semantics,
> these
> new pinctrl client properties would all need to reference empty states,
> yet
> would still need to exist to represent the dependency.



 I think so, but aren't almost all those pins used as gpios? If so,
 then such a controller's driver will request the gpio it wants which
 will cause the gpio driver to be registered (and hopefully probed) if
 needed, which in turn will check that the corresponding pinctrl device
 has been registered. Or am I missing something?
>>>
>>>
>>>
>>> As you say this probably works out fine for pins that are used as GPIOs.
>>> I
>>> was thinking more about SFIOs. Take an I2C controller, which doesn't use
>>> any
>>> GPIOs itself. The pinctrl device should be probed before the I2C device,
>>> so
>>> that the I2C driver can initiate transactions on the I2C bus during its
>>> probe if it wanted to (or at least, clients could initiate transactions
>>> at
>>> any completely arbitrary time as soon as probe was complete).
>>
>>
>> What is using the SFIO in this case, the I2C master or the I2C client?
>
>
> The I2C controller a/k/a the I2C master.
>
>> In any case, is the problem you are referring to that ICs may rely on
>
>
> s/ICs/drivers/ I think.
>
>> a specific pinmux configuration but that's not currently reflected on
>> the DT because pinmux configuration happened so early that things just
>> worked?
>
>
> Yes; the dependency of some nodes on pinctrl isn't explicitly called out in
> the DT. It's probably not a good idea to have such implicit dependencies,
> although I suppose for something so central as pinmux, maybe it's not
> terrible, since almost everything depends on it and it's pretty obvious.

Yup, agreed.

Thanks,

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


Re: [RFC PATCH 00/12] mm: mirrored memory support for page buddy allocations

2015-06-16 Thread Vlastimil Babka
On 06/04/2015 02:54 PM, Xishi Qiu wrote:
> Intel Xeon processor E7 v3 product family-based platforms introduces support
> for partial memory mirroring called as 'Address Range Mirroring'. This feature
> allows BIOS to specify a subset of total available memory to be mirrored (and
> optionally also specify whether to mirror the range 0-4 GB). This capability
> allows user to make an appropriate tradeoff between non-mirrored memory range
> and mirrored memory range thus optimizing total available memory and still
> achieving highly reliable memory range for mission critical workloads and/or
> kernel space.
> 
> Tony has already send a patchset to supprot this feature at boot time.
> https://lkml.org/lkml/2015/5/8/521
> 
> This patchset can support the feature after boot time. It introduces 
> mirror_info
> to save the mirrored memory range. Then use __GFP_MIRROR to allocate mirrored 
> pages. 
> 
> I think add a new migratetype is btter and easier than a new zone, so I use

If the mirrored memory is in a single reasonably compact (no large holes) range
(per NUMA node) and won't dynamically change its size, then zone might be a
better option. For one thing, it will still allow distinguishing movable and
unmovable allocations within the mirrored memory.

We had enough fun with MIGRATE_CMA and all kinds of checks it added to allocator
hot paths, and even CMA is now considering moving to a separate zone.

> MIGRATE_MIRROR to manage the mirrored pages. However it changed some code in 
> the
> core file, please review and comment, thanks.
> 
> TBD: 
> 1) call add_mirror_info() to fill mirrored memory info.
> 2) add compatibility with memory online/offline.
> 3) add more interface? others?
> 
> Xishi Qiu (12):
>   mm: add a new config to manage the code
>   mm: introduce mirror_info
>   mm: introduce MIGRATE_MIRROR to manage the mirrored pages
>   mm: add mirrored pages to buddy system
>   mm: introduce a new zone_stat_item NR_FREE_MIRROR_PAGES
>   mm: add free mirrored pages info
>   mm: introduce __GFP_MIRROR to allocate mirrored pages
>   mm: use mirrorable to switch allocate mirrored memory
>   mm: enable allocate mirrored memory at boot time
>   mm: add the buddy system interface
>   mm: add the PCP interface
>   mm: let slab/slub/slob use mirrored memory
> 
>  arch/x86/mm/numa.c |   3 ++
>  drivers/base/node.c|  17 ---
>  fs/proc/meminfo.c  |   6 +++
>  include/linux/gfp.h|   5 +-
>  include/linux/mmzone.h |  23 +
>  include/linux/vmstat.h |   2 +
>  kernel/sysctl.c|   9 
>  mm/Kconfig |   8 +++
>  mm/page_alloc.c| 134 
> ++---
>  mm/slab.c  |   3 +-
>  mm/slob.c  |   2 +-
>  mm/slub.c  |   2 +-
>  mm/vmstat.c|   4 ++
>  13 files changed, 202 insertions(+), 16 deletions(-)
> 

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


Re: [RFC PATCH 06/18] signal/kthread: Initial implementation of kthread signal handling

2015-06-16 Thread Petr Mladek
On Mon 2015-06-15 21:14:29, Oleg Nesterov wrote:
> Ah, understand. You think that we need to take ->siglock in advance
> to avoid the race with SIGCONT?

exactly

> No, we don't. Let me show you the code I suggested again:
> 
>   void kthread_do_signal_stop(void)
>   {
>   spin_lock_irq(&curtent->sighand->siglock);
>   if (current->jobctl & JOBCTL_STOP_DEQUEUED)
>   __set_current_state(TASK_STOPPED);
>   spin_unlock_irq(¤t->sighand->siglock);
> 
>   schedule();
>   }
>   
> so you can dequeue_signal() and call kthread_do_signal_stop() without
> holding ->siglock. We can rely on JOBCTL_STOP_DEQUEUED bit. SIGCONT
> clears it, so kthread_do_signal_stop() can't race.

Heureka, I have got it. I have previously missed the meaning of the
JOBCTL_STOP_DEQUEUED bit. Thanks for explanation.

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


Linux 3.12.44

2015-06-16 Thread Jiri Slaby
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

I'm announcing the release of the 3.12.44 kernel.

All users of the 3.12 kernel series must upgrade.

The updated 3.12.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.12.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

- 
Al Viro (1):
  d_walk() might skip too much

Alex Deucher (1):
  drm/radeon: add new bonaire pci id

Alexander Stein (1):
  W1: ds2490: Increase timeout when waiting for status

Alexei Starovoitov (1):
  x86: bpf_jit: fix compilation of large bpf programs

Alexey Khoroshilov (1):
  EDAC: Properly unwind on failure path in edac_init()

Andrew Morton (1):
  fs/binfmt_elf.c:load_elf_binary(): return -EINVAL on zero-length mappings

Andy Grover (1):
  target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST

Anton Blanchard (1):
  powerpc: Align TOC to 256 bytes

Aravind Gopalakrishnan (4):
  amd64_edac: Add support for newer F16h models
  hwmon: (k10temp) Add support for AMD F16 M30h processor
  hwmon: (k10temp) Add support for F15h M60h
  perf/x86/amd/ibs: Update IBS MSRs and feature definitions

Arnd Bergmann (1):
  staging: rtl8712, rtl8712: avoid lots of build warnings

Axel Lin (1):
  ASoC: mc13783: Fix wrong mask value used in mc13xxx_reg_rmw() calls

Behan Webster (2):
  staging, rtl8192e, LLVMLinux: Change extern inline to static inline
  staging, rtl8192e, LLVMLinux: Remove unused inline prototype

Benjamin Tissoires (1):
  Input: elantech - fix semi-mt protocol for v3 HW

Cass May (1):
  dgnc: Move DG_PART definition from Makefile to dgnc_driver.h

Chen Gang (3):
  qla2xxx: remove redundant declaration in 'qla_gbl.h'
  drivers: staging: dgap: move DG_NAME and DG_PART from "Makefile" to 
"dgap_driver.h"
  drivers: staging: rtl8188eu: use 'ccflags-y' instead of EXTRA_CFLAGS in 
Makefile

Chris Lesiak (1):
  hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGE

Christian König (2):
  drm/radeon: fix VM_CONTEXT*_PAGE_TABLE_END_ADDR handling
  drm/radeon: partially revert "fix VM_CONTEXT*_PAGE_TABLE_END_ADDR 
handling"

Dan Carpenter (2):
  vhost/scsi: potential memory corruption
  isdn: icn: use strlcpy() when parsing setup options

Darrick J. Wong (1):
  jbd2: fix r_count overflows leading to buffer overflow in journal recovery

David Fries (1):
  cn: verify msg->len before making callback

David Henningsson (1):
  ALSA: hda - Add Conexant codecs CX20721, CX20722, CX20723 and CX20724

David Vrabel (1):
  xen/events: don't bind non-percpu VIRQs with percpu chip

Eric Dumazet (1):
  udp: fix behavior of wrong checksums

Eric W. Biederman (2):
  mnt: Fail collect_mounts when applied to unmounted mounts
  ipv4: Avoid crashing in ip_error

Eryu Guan (1):
  ext4: check for zero length extent explicitly

Finn Thain (1):
  m68k/mac: Fix out-of-bounds array index in OSS IRQ source initialization

Gabriele Mazzotta (2):
  libata: Add helper to determine when PHY events should be ignored
  libata: Ignore spurious PHY event on LPM policy change

Greg Kroah-Hartman (1):
  staging: wlags49_h2: fix extern inline functions

Guenter Roeck (1):
  hwmon: (nct6775) Add missing sysfs attribute initialization

Hans de Goede (1):
  usb-storage: Add NO_WP_DETECT quirk for Lacie 059f:0651 devices

Harald Freudenberger (1):
  crypto: s390/ghash - Fix incorrect ghash icv buffer handling.

Heinrich Schuchardt (1):
  usb: chipidea: debug: avoid out of bound read

Ian Campbell (1):
  xen: netback: read hotplug script once at start of day.

Ian Wilson (1):
  netfilter: Zero the tuple in nfnl_cthelper_parse_tuple()

Ilya Dryomov (1):
  libceph: request a new osdmap if lingering request maps to no osd

Jan Kara (1):
  lib: Fix strnlen_user() to not touch memory after specified maximum

Janusz Dziedzic (1):
  mac80211: move WEP tailroom size check

Jason A. Donenfeld (2):
  USB: visor: Match I330 phone more precisely
  USB: pl2303: Remove support for Samsung I330

Jean Delvare (1):
  thermal: step_wise: Revert optimization

Jens Axboe (1):
  aio: fix serial draining in exit_aio()

Jiri Kosina (1):
  HID: debug: fix error handling in hid_debug_events_read()

Jiri Slaby (1):
  Linux 3.12.44

Joe Lawrence (1):
  xhci: gracefully handle xhci_irq dead device

Joerg Roedel (5):
  iommu/amd: Return the pte page-size in fetch_pte
  iommu/amd: Optimize iommu_unmap_page for new fetch_pte interface
  iommu/amd: Optimize alloc_new_range for new fetch_pte interface
  iommu/amd: Optimize amd_iommu_iova_to_phys for new fetch_pte interface
  iommu/amd: Correctly encode huge pages in iommu page tables

Julia Lawall

[PATCH] Staging: comedi: Simplify a trivial if-return sequence

2015-06-16 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with 
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/dac02.c| 6 +-
 drivers/staging/comedi/drivers/daqboard2000.c | 6 +-
 drivers/staging/comedi/drivers/dmm32at.c  | 6 +-
 drivers/staging/comedi/drivers/fl512.c| 6 +-
 drivers/staging/comedi/drivers/ni_daq_dio24.c | 6 +-
 drivers/staging/comedi/drivers/s626.c | 6 +-
 6 files changed, 6 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dac02.c 
b/drivers/staging/comedi/drivers/dac02.c
index a6798ad..a562df4 100644
--- a/drivers/staging/comedi/drivers/dac02.c
+++ b/drivers/staging/comedi/drivers/dac02.c
@@ -130,11 +130,7 @@ static int dac02_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
s->range_table  = &das02_ao_ranges;
s->insn_write   = dac02_ao_insn_write;
 
-   ret = comedi_alloc_subdev_readback(s);
-   if (ret)
-   return ret;
-
-   return 0;
+   return comedi_alloc_subdev_readback(s);
 }
 
 static struct comedi_driver dac02_driver = {
diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 611b0a3..0fe40c2 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -713,12 +713,8 @@ static int daqboard2000_auto_attach(struct comedi_device 
*dev,
return result;
 
s = &dev->subdevices[2];
-   result = subdev_8255_init(dev, s, daqboard2000_8255_cb,
+   return subdev_8255_init(dev, s, daqboard2000_8255_cb,
  dioP2ExpansionIO8Bit);
-   if (result)
-   return result;
-
-   return 0;
 }
 
 static void daqboard2000_detach(struct comedi_device *dev)
diff --git a/drivers/staging/comedi/drivers/dmm32at.c 
b/drivers/staging/comedi/drivers/dmm32at.c
index bb2883c..958c0d4 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -607,11 +607,7 @@ static int dmm32at_attach(struct comedi_device *dev,
 
/* Digital I/O subdevice */
s = &dev->subdevices[2];
-   ret = subdev_8255_init(dev, s, dmm32at_8255_io, DMM32AT_8255_IOBASE);
-   if (ret)
-   return ret;
-
-   return 0;
+   return subdev_8255_init(dev, s, dmm32at_8255_io, DMM32AT_8255_IOBASE);
 }
 
 static struct comedi_driver dmm32at_driver = {
diff --git a/drivers/staging/comedi/drivers/fl512.c 
b/drivers/staging/comedi/drivers/fl512.c
index e1f4932..55cae61 100644
--- a/drivers/staging/comedi/drivers/fl512.c
+++ b/drivers/staging/comedi/drivers/fl512.c
@@ -136,11 +136,7 @@ static int fl512_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
s->range_table  = &range_fl512;
s->insn_write   = fl512_ao_insn_write;
 
-   ret = comedi_alloc_subdev_readback(s);
-   if (ret)
-   return ret;
-
-   return 0;
+   return comedi_alloc_subdev_readback(s);
 }
 
 static struct comedi_driver fl512_driver = {
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c 
b/drivers/staging/comedi/drivers/ni_daq_dio24.c
index a208cb3..d9de83a 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -55,11 +55,7 @@ static int dio24_auto_attach(struct comedi_device *dev,
 
/* 8255 dio */
s = &dev->subdevices[0];
-   ret = subdev_8255_init(dev, s, NULL, 0x00);
-   if (ret)
-   return ret;
-
-   return 0;
+   return subdev_8255_init(dev, s, NULL, 0x00);
 }
 
 static struct comedi_driver driver_dio24 = {
diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 781918d..35f0f67 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2852,11 +2852,7 @@ static int s626_auto_attach(struct comedi_device *dev,
s->insn_read= s626_enc_insn_read;
s->insn_write   = s626_enc_insn_write;
 
-   ret = s626_initialize(dev);
-   if (ret)
-   return ret;
-
-   return 0;
+   return s626_initialize(dev);
 }
 
 static void s626_detach(struct comedi_device *dev)
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] drivercore: Fix unregistration path of platform devices

2015-06-16 Thread Tony Lindgren
* Rob Herring  [150610 07:06]:
> 
> I've looked at some of the failures. Armada 370 looks normal AFAICT,
> but the network device evidently does not probe. i.MX6 has no log, but
> IIRC it is what failed previously on Grant's last attempt. For OMAP4,
> I found the overlapping region here:
> 
> omap4_padconf_core: scm@10 {
> compatible = "ti,omap4-scm-padconf-core",
>  "simple-bus";
> #address-cells = <1>;
> #size-cells = <1>;
> ranges = <0 0x10 0x1000>;
> 
> omap4_pmx_core: pinmux@40 {
> compatible = "ti,omap4-padconf",
>  "pinctrl-single";
> reg = <0x40 0x0196>;
> #address-cells = <1>;
> #size-cells = <0>;
> #interrupt-cells = <1>;
> interrupt-controller;
> pinctrl-single,register-width = <16>;
> pinctrl-single,function-mask = 
> <0x7fff>;
> };
> 
> omap4_padconf_global: 
> omap4_padconf_global@5a0 {
> compatible = "syscon";
> reg = <0x5a0 0x170>;
> #address-cells = <1>;
> #size-cells = <1>;
> 
> pbias_regulator: pbias_regulator {
> compatible = "ti,pbias-omap";
> reg = <0x60 0x4>;
> 
> 0x60 is within the pinmux range of 0x40-0x1d6.
> 
> But why is the regulator a sub node here instead of omap4_pmx_core?

I don't think the reg entry is in use here as the pbias_regulator uses
syscon_regmap_lookup_by_phandle via syscon.
 
> syscon =
> <&omap4_padconf_global>;
> 
> This seems to indicate that 0x60 is supposed to be an offset from
> 0x5a0. That would require a ranges property in the parent. Is this an
> error?

Yeah we should add ranges to padconf_global so drivers not using syscon
can just do of_ioremap for a dedicated range of registers within the
padconf_global. That area has things like PHYs, regulators and clocks.

Regards,

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


[PATCH] x86/earlyprintk: fix typo in a comment

2015-06-16 Thread Alexander Kuleshov
Signed-off-by: Alexander Kuleshov 
---
 arch/x86/kernel/early_printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 89427d8..1374adf 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -285,7 +285,7 @@ static __init void early_pci_serial_init(char *s)
}
 
/*
-* Lastly, initalize the hardware
+* Lastly, initialize the hardware
 */
if (*s) {
if (strcmp(s, "nocfg") == 0)
-- 
2.4.0.596.ga5fe668

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


[PATCH RFC v6 0/3] crypto: Introduce Public Key Encryption API

2015-06-16 Thread Tadeusz Struk
This patch set introduces a Public Key Encryption API.
What is proposed is a new crypto type called crypto_akcipher_type,
plus new struct akcipher_alg and struct crypto_akcipher, together with number
of helper functions to register akcipher type algorithms and allocate
tfm instances. This is to make it similar to how the existing crypto
API works for the ablkcipher, ahash, and aead types.
The operations the new interface will allow to provide are:

int (*sign)(struct akcipher_request *req);
int (*verify)(struct akcipher_request *req);
int (*encrypt)(struct akcipher_request *req);
int (*decrypt)(struct akcipher_request *req);

The benefits it gives interface are:
- drivers can add many implementations of RSA or DSA
  algorithms and user will allocate instances (tfms) of these, base on
  algorithm priority, in the same way as it is with the symmetric ciphers.
- the new interface allows for asynchronous implementations that
  can use crypto hardware to offload the calculations to.
- integrating it with linux crypto api allows using all its benefits
  i.e. managing algorithms using NETLINK_CRYPTO, monitoring implementations
  using /proc/crypto. etc

New helper functions have been added to allocate crypto_akcipher instances
and invoke the operations to make it easier to use.
For instance to verify a public_signature against a public_key using
the RSA algorithm a user would do:

struct crypto_akcipher *tfm = crypto_alloc_akcipher("rsa", 0, 0);
struct akcipher_request *req = akcipher_request_alloc(tfm, GFP_KERNEL);
akcipher_request_set_crypt(req, pub_key, signature);
int ret = crypto_akcipher_verify(src, dst, src_len, dst_len, &res_len);
akcipher_request_free(req);
crypto_free_akcipher(tfm);
return ret;

Changes in v6:
 - in FIPS mode only allow key sizes 2K & 3K
 - remove result_len and use dst_len as in/out param
 - remove subtype from akcipher reports
 - store rsa_key in tfm ctx and change ras_parse_key to take struct rsa_key
   instead of tfm. 
 - export rsa_free_key, which free memory allocated by ras_parse_key.
 - split akcipher.h into public and internal with public key specific helpers
 - remove maxsize() and set the required size in enc/dec/sign/verify instead
 - add public key vector
 - split AKCIPHER into AKCIPHER and AKCIPHER2 in Kconfig
 - remove MPI patch from the series - already applied

Changes in v5:
 - make mpi_get_size() function inline.
 - add a setkey function to the algorithm and rsa_parse_key() helper to
   parse rsa keys from BER encoded to MPI. The helper will also validate
   the given key if it is strong enough in case FIPS mode is enabled.
 - change the format of the key from struct public_key * to void * BER encoded
   buffer.
 - change the format of the rsa keys in testmgr to BER encoded form.
 - change mpi_free to use kzfree instead of kfree because it is used to free
   crypto keys

Changes in v4:
 - add an rsa generic implementation
 - don't convert the existing public_key implementation to the new interface.
   This will be done after the new interface is accepted.
 - add new mpi_get_buf(), mpi_copy() and mpi_get_size() mpi helpers 
 - on set key the ftm now will clone the key instead of just setting a ptr
 - add a check on enc/dec/sign/veryfi to make sure a valid (public or private)
   key is setup
 - add maxsize fn into algorith that will be used to query implementation
   what is the max size of a result for a give public key that the user needs
   to allocate
 - removed private ctx from crypto_akcipher as the crypto_tfm base has one
   already
 - add 2K bit RSA test vectors
 - add cipher text validation in crypto test mgr as (required for FIPS)

Changes in v3:
 - changed input and output parameters type from sgl to void *
   and added separate src_len & dst_len - requested by Herbert Xu
 - separated rsa implementation into cryptographic primitives and
   left encryption scheme details outside of the algorithm implementation
 - added SW implementation for RSA encrypt, decrypt and sign operation
 - added RSA test vectors 
   
Changes in v2:
 - remodeled not to use obsolete cra_u and crt_u unions
 - changed type/funct names from pke_* to pkey_*
 - retained the enum pkey_algo type for it is external to the kernel
 - added documentation

---
Tadeusz Struk (3):
  crypto: add PKE API
  crypto: rsa: add a new rsa generic implementation
  crypto: add tests vectors for RSA


 crypto/Kconfig |   19 ++
 crypto/Makefile|9 +
 crypto/akcipher.c  |  100 +++
 crypto/crypto_user.c   |   22 ++
 crypto/rsa.c   |  313 +++
 crypto/rsa_helper.c|  124 ++
 crypto/rsakey.asn1 |5 +
 crypto/testmgr.c   |  161 ++
 crypto/testmgr.h   |  187 +
 include/crypto/akc

[PATCH RFC v6 1/3] crypto: add PKE API

2015-06-16 Thread Tadeusz Struk
Add Public Key Encryption API.

Signed-off-by: Tadeusz Struk 
---
 crypto/Kconfig |   11 +
 crypto/Makefile|1 
 crypto/akcipher.c  |  100 +++
 crypto/crypto_user.c   |   22 ++
 include/crypto/akcipher.h  |  323 
 include/crypto/internal/akcipher.h |   66 +++
 include/linux/crypto.h |1 
 include/linux/cryptouser.h |5 +
 8 files changed, 529 insertions(+)
 create mode 100644 crypto/akcipher.c
 create mode 100644 include/crypto/akcipher.h
 create mode 100644 include/crypto/internal/akcipher.h

diff --git a/crypto/Kconfig b/crypto/Kconfig
index f6fc054..264dadb 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -91,6 +91,17 @@ config CRYPTO_PCOMP2
tristate
select CRYPTO_ALGAPI2
 
+config CRYPTO_AKCIPHER2
+   tristate
+   select CRYPTO_ALGAPI2
+
+config CRYPTO_AKCIPHER
+   tristate "Public Key Algorithms API"
+   select CRYPTO_AKCIPHER2
+   select CRYPTO_ALGAPI
+   help
+ Crypto API interface for public key algorithms.
+
 config CRYPTO_MANAGER
tristate "Cryptographic algorithm manager"
select CRYPTO_MANAGER2
diff --git a/crypto/Makefile b/crypto/Makefile
index c842035..6f2940a 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -28,6 +28,7 @@ crypto_hash-y += shash.o
 obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
 
 obj-$(CONFIG_CRYPTO_PCOMP2) += pcompress.o
+obj-$(CONFIG_CRYPTO_AKCIPHER) += akcipher.o
 
 cryptomgr-y := algboss.o testmgr.o
 
diff --git a/crypto/akcipher.c b/crypto/akcipher.c
new file mode 100644
index 000..eefcc49
--- /dev/null
+++ b/crypto/akcipher.c
@@ -0,0 +1,100 @@
+/*
+ * Public Key Encryption
+ *
+ * Copyright (c) 2015, Intel Corporation
+ * Authors: Tadeusz Struk 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "internal.h"
+
+#ifdef CONFIG_NET
+static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
+{
+   struct crypto_report_akcipher rakcipher;
+
+   strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type));
+
+   if (nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER,
+   sizeof(struct crypto_report_akcipher), &rakcipher))
+   goto nla_put_failure;
+   return 0;
+
+nla_put_failure:
+   return -EMSGSIZE;
+}
+#else
+static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
+{
+   return -ENOSYS;
+}
+#endif
+
+static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg)
+   __attribute__ ((unused));
+
+static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg)
+{
+   seq_puts(m, "type : akcipher\n");
+}
+
+static int crypto_akcipher_init_tfm(struct crypto_tfm *tfm)
+{
+   return 0;
+}
+
+static const struct crypto_type crypto_akcipher_type = {
+   .extsize = crypto_alg_extsize,
+   .init_tfm = crypto_akcipher_init_tfm,
+#ifdef CONFIG_PROC_FS
+   .show = crypto_akcipher_show,
+#endif
+   .report = crypto_akcipher_report,
+   .maskclear = ~CRYPTO_ALG_TYPE_MASK,
+   .maskset = CRYPTO_ALG_TYPE_MASK,
+   .type = CRYPTO_ALG_TYPE_AKCIPHER,
+   .tfmsize = offsetof(struct crypto_akcipher, base),
+};
+
+struct crypto_akcipher *crypto_alloc_akcipher(const char *alg_name, u32 type,
+ u32 mask)
+{
+   return crypto_alloc_tfm(alg_name, &crypto_akcipher_type, type, mask);
+}
+EXPORT_SYMBOL_GPL(crypto_alloc_akcipher);
+
+int crypto_register_akcipher(struct akcipher_alg *alg)
+{
+   struct crypto_alg *base = &alg->base;
+
+   base->cra_type = &crypto_akcipher_type;
+   base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
+   base->cra_flags |= CRYPTO_ALG_TYPE_AKCIPHER;
+   return crypto_register_alg(base);
+}
+EXPORT_SYMBOL_GPL(crypto_register_akcipher);
+
+void crypto_unregister_akcipher(struct akcipher_alg *alg)
+{
+   crypto_unregister_alg(&alg->base);
+}
+EXPORT_SYMBOL_GPL(crypto_unregister_akcipher);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Generic public key cihper type");
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index 41dfe76..11dbd5a 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "internal.h"
 
@@ -110,6 +111,21 @@ nla_put_failure:
return -EMSGSIZE;
 }
 
+static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg)
+{
+   struct crypto_report_akcipher rakcipher;
+
+   strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type));
+
+   if (nla_pu

[PATCH RFC v6 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
Add a new rsa generic SW implementation.
This implements only cryptographic primitives.

Signed-off-by: Tadeusz Struk 
---
 crypto/Kconfig|7 +
 crypto/Makefile   |8 +
 crypto/rsa.c  |  313 +
 crypto/rsa_helper.c   |  124 
 crypto/rsakey.asn1|5 +
 include/crypto/internal/rsa.h |   28 
 6 files changed, 485 insertions(+)
 create mode 100644 crypto/rsa.c
 create mode 100644 crypto/rsa_helper.c
 create mode 100644 crypto/rsakey.asn1
 create mode 100644 include/crypto/internal/rsa.h

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 264dadb..52467cf 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -102,6 +102,13 @@ config CRYPTO_AKCIPHER
help
  Crypto API interface for public key algorithms.
 
+config CRYPTO_RSA
+   tristate "RSA algorithm"
+   select AKCIPHER
+   select MPILIB
+   help
+ Generic implementation of the RSA public key algorithm.
+
 config CRYPTO_MANAGER
tristate "Cryptographic algorithm manager"
select CRYPTO_MANAGER2
diff --git a/crypto/Makefile b/crypto/Makefile
index 6f2940a..c6217ea 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -30,6 +30,14 @@ obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
 obj-$(CONFIG_CRYPTO_PCOMP2) += pcompress.o
 obj-$(CONFIG_CRYPTO_AKCIPHER) += akcipher.o
 
+$(obj)/rsakey-asn1.o: $(obj)/rsakey-asn1.c $(obj)/rsakey-asn1.h
+clean-files += rsakey-asn1.c rsakey-asn1.h
+
+rsa_generic-y := rsakey-asn1.o
+rsa_generic-y += rsa.o
+rsa_generic-y += rsa_helper.o
+obj-$(CONFIG_CRYPTO_RSA) += rsa_generic.o
+
 cryptomgr-y := algboss.o testmgr.o
 
 obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
diff --git a/crypto/rsa.c b/crypto/rsa.c
new file mode 100644
index 000..33bb7f0
--- /dev/null
+++ b/crypto/rsa.c
@@ -0,0 +1,313 @@
+/* RSA asymmetric public-key algorithm [RFC3447]
+ *
+ * Copyright (c) 2015, Intel Corporation
+ * Authors: Tadeusz Struk 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * RSAEP function [RFC3447 sec 5.1.1]
+ * c = m^e mod n;
+ */
+static int _rsa_enc(const struct rsa_key *key, MPI c, MPI m)
+{
+   /* (1) Validate 0 <= m < n */
+   if (mpi_cmp_ui(m, 0) < 0 || mpi_cmp(m, key->n) >= 0)
+   return -EINVAL;
+
+   /* (2) c = m^e mod n */
+   return mpi_powm(c, m, key->e, key->n);
+}
+
+/*
+ * RSADP function [RFC3447 sec 5.1.2]
+ * m = c^d mod n;
+ */
+static int _rsa_dec(const struct rsa_key *key, MPI m, MPI c)
+{
+   /* (1) Validate 0 <= c < n */
+   if (mpi_cmp_ui(c, 0) < 0 || mpi_cmp(c, key->n) >= 0)
+   return -EINVAL;
+
+   /* (2) m = c^d mod n */
+   return mpi_powm(m, c, key->d, key->n);
+}
+
+/*
+ * RSASP1 function [RFC3447 sec 5.2.1]
+ * s = m^d mod n
+ */
+static int _rsa_sign(const struct rsa_key *key, MPI s, MPI m)
+{
+   /* (1) Validate 0 <= m < n */
+   if (mpi_cmp_ui(m, 0) < 0 || mpi_cmp(m, key->n) >= 0)
+   return -EINVAL;
+
+   /* (2) s = m^d mod n */
+   return mpi_powm(s, m, key->d, key->n);
+}
+
+/*
+ * RSAVP1 function [RFC3447 sec 5.2.2]
+ * m = s^e mod n;
+ */
+static int _rsa_verify(const struct rsa_key *key, MPI m, MPI s)
+{
+   /* (1) Validate 0 <= s < n */
+   if (mpi_cmp_ui(s, 0) < 0 || mpi_cmp(s, key->n) >= 0)
+   return -EINVAL;
+
+   /* (2) m = s^e mod n */
+   return mpi_powm(m, s, key->e, key->n);
+}
+
+static struct rsa_key *rsa_get_key(struct crypto_akcipher *tfm)
+{
+   return akcipher_tfm_ctx(tfm);
+}
+
+static int rsa_enc(struct akcipher_request *req)
+{
+   struct crypto_akcipher *tfm = akcipher_request_get_tfm(req);
+   const struct rsa_key *pkey = rsa_get_key(tfm);
+   MPI m, c = mpi_alloc(0);
+   int ret = 0;
+   int sign;
+
+   if (!c)
+   return -ENOMEM;
+
+   if (!pkey->n || !pkey->e || !req->dst_len)
+   return -EINVAL;
+
+   if (*req->dst_len < mpi_get_size(pkey->n)) {
+   *req->dst_len = mpi_get_size(pkey->n);
+   return -EINVAL;
+   }
+
+   m = mpi_read_raw_data(req->src, req->src_len);
+   if (!m) {
+   ret = -ENOMEM;
+   goto err_free_c;
+   }
+
+   ret = _rsa_enc(pkey, c, m);
+   if (ret)
+   goto err_free_m;
+
+   ret = mpi_read_buffer(c, req->dst, *req->dst_len, req->dst_len, &sign);
+   if (ret)
+   goto err_free_m;
+
+   if (sign < 0) {
+   ret = -EBADMSG;
+   goto err_free_m;
+   }
+
+err_free_m:
+   mpi_free(m);
+err_free_c:
+   mpi_free(c);
+   return ret;
+}
+
+static int rsa_dec(struct akcipher_request *req)
+{
+   struct crypt

[PATCH RFC v6 3/3] crypto: add tests vectors for RSA

2015-06-16 Thread Tadeusz Struk
New test vectors for RSA algorithm.

Signed-off-by: Tadeusz Struk 
---
 crypto/Kconfig   |1 
 crypto/testmgr.c |  161 ++
 crypto/testmgr.h |  187 ++
 3 files changed, 349 insertions(+)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 52467cf..9471ac8 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -122,6 +122,7 @@ config CRYPTO_MANAGER2
select CRYPTO_HASH2
select CRYPTO_BLKCIPHER2
select CRYPTO_PCOMP2
+   select CRYPTO_AKCIPHER2
 
 config CRYPTO_USER
tristate "Userspace cryptographic algorithm configuration"
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ccd19cf..c773424 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "internal.h"
 
@@ -116,6 +117,11 @@ struct drbg_test_suite {
unsigned int count;
 };
 
+struct akcipher_test_suite {
+   struct akcipher_testvec *vecs;
+   unsigned int count;
+};
+
 struct alg_test_desc {
const char *alg;
int (*test)(const struct alg_test_desc *desc, const char *driver,
@@ -130,6 +136,7 @@ struct alg_test_desc {
struct hash_test_suite hash;
struct cprng_test_suite cprng;
struct drbg_test_suite drbg;
+   struct akcipher_test_suite akcipher;
} suite;
 };
 
@@ -1825,6 +1832,150 @@ static int alg_test_drbg(const struct alg_test_desc 
*desc, const char *driver,
 
 }
 
+static int do_test_rsa(struct crypto_akcipher *tfm,
+  struct akcipher_testvec *vecs)
+{
+   struct akcipher_request *req;
+   void *outbuf_enc = NULL;
+   void *outbuf_dec = NULL;
+   struct tcrypt_result result;
+   unsigned int out_len_max, out_len = 0;
+   int err = -ENOMEM;
+
+   req = akcipher_request_alloc(tfm, GFP_KERNEL);
+   if (!req)
+   return err;
+
+   init_completion(&result.completion);
+   err = crypto_akcipher_setkey(tfm, vecs->key, vecs->key_len);
+   if (err)
+   goto free_req;
+
+   akcipher_request_set_crypt(req, vecs->m, outbuf_enc, vecs->m_size,
+  &out_len);
+   /* expect this to fail, and update the required buf len */
+   crypto_akcipher_encrypt(req);
+   if (!out_len) {
+   err = -EINVAL;
+   goto free_req;
+   }
+
+   out_len_max = out_len;
+
+   err = -ENOMEM;
+   outbuf_enc = kzalloc(out_len_max, GFP_KERNEL);
+   if (!outbuf_enc)
+   goto free_req;
+
+   akcipher_request_set_crypt(req, vecs->m, outbuf_enc, vecs->m_size,
+  &out_len);
+   akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+ tcrypt_complete, &result);
+
+   /* Run RSA encrypt - c = m^e mod n;*/
+   err = wait_async_op(&result, crypto_akcipher_encrypt(req));
+   if (err) {
+   pr_err("alg: rsa: encrypt test failed. err %d\n", err);
+   goto free_all;
+   }
+
+   if (out_len != vecs->c_size) {
+   err = -EINVAL;
+   goto free_all;
+   }
+   /* verify that encrypted message is equal to expected */
+   if (memcmp(vecs->c, outbuf_enc, vecs->c_size)) {
+   pr_err("alg: rsa: encrypt test failed. Invalid output\n");
+   err = -EINVAL;
+   goto free_all;
+   }
+
+   /* Don't invoke decrypt for vectors with public key */
+   if (vecs->public_key_test) {
+   err = 0;
+   goto free_all;
+   }
+
+   outbuf_dec = kzalloc(out_len_max, GFP_KERNEL);
+   if (!outbuf_dec) {
+   err = -ENOMEM;
+   goto free_all;
+   }
+
+   init_completion(&result.completion);
+   akcipher_request_set_crypt(req, outbuf_enc, outbuf_dec, vecs->c_size,
+  &out_len);
+
+   /* Run RSA decrypt - m = c^d mod n;*/
+   err = wait_async_op(&result, crypto_akcipher_decrypt(req));
+   if (err) {
+   pr_err("alg: rsa: decrypt test failed. err %d\n", err);
+   goto free_all;
+   }
+
+   if (out_len != vecs->m_size) {
+   err = -EINVAL;
+   goto free_all;
+   }
+
+   /* verify that decrypted message is equal to the original msg */
+   if (memcmp(vecs->m, outbuf_dec, vecs->m_size)) {
+   pr_err("alg: rsa: encrypt test failed. Invalid output\n");
+   err = -EINVAL;
+   }
+free_all:
+   kfree(outbuf_dec);
+   kfree(outbuf_enc);
+free_req:
+   akcipher_request_free(req);
+   return err;
+}
+
+static int test_rsa(struct crypto_akcipher *tfm, struct akcipher_testvec *vecs,
+   unsigned int tcount)
+{
+   int ret, i;
+
+   for (i = 0; i < tcount; i++) {
+   ret = do_test_rsa(tfm, vecs++);
+ 

Re: [PATCH v6 0/7] Add Mediatek MMC driver

2015-06-16 Thread Ulf Hansson
On 15 June 2015 at 13:20, Chaotian Jing  wrote:
> This series enables MMC support on the MT8135/MT8173 platform.
> MT8135 has 5 MMC controllers and MT8173 has 4 MMC controllers.
>
> Changes base on Ulf's comments
> Make hclk mandatory in the driver code
> Change host->hclk to host->src_clk_freq
> Add linux/pm.h
>
> Chaotian Jing (3):
>   mmc: dt-bindings: add Mediatek MMC bindings
>   mmc: mediatek: Add Mediatek MMC driver
>   mmc: mediatek: Add PM support for MMC driver
>
> Eddie Huang (2):
>   arm64: dts: mediatek: Add MT8173 MMC dts
>   arm64: mediatek: Add Mediatek MMC support in defconfig
>
> Yingjoe Chen (2):
>   ARM: mediatek: dts: Add emmc support to mt8135
>   ARM: multi_v7_defconfig: Enable Mediatek MMC support multi-v7
>
>  Documentation/devicetree/bindings/mmc/mtk-sd.txt |   32 +
>  arch/arm/boot/dts/mt8135-evbp1.dts   |  158 +++
>  arch/arm/boot/dts/mt8135.dtsi|   55 +
>  arch/arm/configs/multi_v7_defconfig  |1 +
>  arch/arm64/boot/dts/mediatek/mt8173-evb.dts  |  126 ++
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi |   45 +-
>  arch/arm64/configs/defconfig |1 +
>  drivers/mmc/host/Kconfig |8 +
>  drivers/mmc/host/Makefile|1 +
>  drivers/mmc/host/mtk-sd.c| 1461 
> ++
>  include/linux/mmc/core.h |1 +
>  11 files changed, 1888 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/mmc/mtk-sd.txt
>  create mode 100644 drivers/mmc/host/mtk-sd.c
>
> --
> 1.8.1.1.dirty
>

Hi Chaotian,

I have applied patch 1->3 for my next branch, which thus includes the
mmc driver parts. I could potentially also pick the ARM patches, but
then those needs to be acked from the ARM SoC folks.

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


Re: [PATCH] mmc: queue: prevent soft lockups on PREEMPT=n

2015-06-16 Thread Ulf Hansson
On 14 June 2015 at 19:26, Rabin Vincent  wrote:
> On systems with CONFIG_PREEMPT=n, under certain circumstances, mmcqd
> can continuously process requests for several seconds without blocking,
> triggering the soft lockup watchdog.  For example, this can happen if
> mmcqd runs on the CPU which services the controller's interrupt, and
> a process on a different CPU continuously writes to the MMC block
> device.
>
>  NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [mmcqd/0:664]
>  CPU: 0 PID: 664 Comm: mmcqd/0 Not tainted 4.1.0-rc7+ #4
>  PC is at _raw_spin_unlock_irqrestore+0x24/0x28
>  LR is at mmc_start_request+0x104/0x134
>  ...
>  [<805112a8>] (_raw_spin_unlock_irqrestore) from [<803db664>] 
> (mmc_start_request+0x104/0x134)
>  [<803db664>] (mmc_start_request) from [<803dc008>] 
> (mmc_start_req+0x274/0x394)
>  [<803dc008>] (mmc_start_req) from [<803eb2c4>] 
> (mmc_blk_issue_rw_rq+0xd0/0xb98)
>  [<803eb2c4>] (mmc_blk_issue_rw_rq) from [<803ebe8c>] 
> (mmc_blk_issue_rq+0x100/0x470)
>  [<803ebe8c>] (mmc_blk_issue_rq) from [<803ecab8>] 
> (mmc_queue_thread+0xd0/0x170)
>  [<803ecab8>] (mmc_queue_thread) from [<8003fd14>] (kthread+0xe0/0xfc)
>  [<8003fd14>] (kthread) from [<8000f768>] (ret_from_fork+0x14/0x2c)
>
> Fix it by adding a cond_resched() in the request handling loop so that
> other processes get a chance to run.
>
> Signed-off-by: Rabin Vincent 

Thanks, applied!

Kind regards
Uffe

> ---
>  drivers/mmc/card/queue.c |1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
> index 8efa368..e78ae97 100644
> --- a/drivers/mmc/card/queue.c
> +++ b/drivers/mmc/card/queue.c
> @@ -69,6 +69,7 @@ static int mmc_queue_thread(void *d)
> set_current_state(TASK_RUNNING);
> cmd_flags = req ? req->cmd_flags : 0;
> mq->issue_fn(mq, req);
> +   cond_resched();
> if (mq->flags & MMC_QUEUE_NEW_REQUEST) {
> mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
> continue; /* fetch again */
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Staging: wilc1000: Boolean tests don't need comparisons

2015-06-16 Thread Sudip Mukherjee
On Tue, Jun 16, 2015 at 07:33:42AM +, Abdul, Hussain (H.) wrote:
> From: Abdul Hussain 
> 
> This patch removes unwanted true and false from boolean tests.
> 
> Signed-off-by: Abdul Hussain 
> ---

> diff --git a/drivers/staging/wilc1000/host_interface.c 
> b/drivers/staging/wilc1000/host_interface.c
> index 17ab5cd..be1f6bf 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -7816,7 +7816,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
> *ptstrNetworkInfo)
>   pNewJoinBssParam->rsn_cap[1] = 
> pu8IEs[rsnIndex + 1];
>   rsnIndex += 2;
>   }
> - pNewJoinBssParam->rsn_found = 1;
> + pNewJoinBssParam->rsn_found = true;
But this is not a boolean test, this is an assignement.

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


Re: [BUG?] crypto: caam: little/big endianness on ARM vs PPC

2015-06-16 Thread Jon Nettleton
Victoria,

I was hoping you would join the conversation.  I know you have a
series of patches in Freescale's 3.14 git repository.  Have you
updated those for mainline and published them for review and inclusion
in the upstream kernel?  If yes to any could you post a link?

-Jon

On Tue, Jun 16, 2015 at 5:27 AM, Victoria Milhoan
 wrote:
> All,
>
> Freescale has been adding i.MX6 support to the CAAM driver and testing on 
> both i.MX6 and QorIQ platforms. The patch series is now available for review. 
> Your feedback for the provided patches is appreciated.
>
> Thanks,
> Victoria
>
> -Original Message-
> From: linux-crypto-ow...@vger.kernel.org 
> [mailto:linux-crypto-ow...@vger.kernel.org] On Behalf Of Herbert Xu
> Sent: Monday, June 15, 2015 3:05 PM
> To: Steffen Trumtrar
> Cc: linux-kernel@vger.kernel.org; linux-arm-ker...@lists.infradead.org; 
> linux-cry...@vger.kernel.org; Gupta Ruchika-R66431; ker...@pengutronix.de; 
> Geanta Neag Horia Ioan-B05471; Kim Phillips
> Subject: Re: [BUG?] crypto: caam: little/big endianness on ARM vs PPC
>
> On Mon, Jun 15, 2015 at 05:59:07PM +0200, Steffen Trumtrar wrote:
>> Hi!
>>
>> I'm working on CAAM support for the ARM-based i.MX6 SoCs. The current
>> drivers/crypto/caam driver only works for PowerPC AFAIK.
>> Actually, there isn't that much to do, to get support for the i.MX6
>> but one patch breaks the driver severely:
>>
>>   commit ef94b1d834aace7101de77c3a7c2631b9ae9c5f6
>>   crypto: caam - Add definition of rd/wr_reg64 for little endian
>> platform
>>
>> This patch adds
>>
>> +#ifdef __LITTLE_ENDIAN
>> +static inline void wr_reg64(u64 __iomem *reg, u64 data) {
>> + wr_reg32((u32 __iomem *)reg + 1, (data & 0xull) >> 32);
>> + wr_reg32((u32 __iomem *)reg, data & 0xull); }
>>
>> The wr_reg64 function is only used in one place in the
>> drivers/crypto/caam/jr.c
>> driver: to write the dma_addr_t to the register. Without that patch
>> everything works fine on ARM (little endian, 32bit), with that patch
>> the driver will write 0's into the register that holds the DMA address (the 
>> numerically-higher) -> kernel hangs.
>> Also, from my understanding, the comment above the defines, stating
>> that you have to first write the numerically-lower and then the
>> numerically-higher address on 32bit systems doesn't match with the 
>> implementation.
>>
>> What I don't know/understand is if this makes any sense for any PowerPC 
>> implementation.
>>
>> So, the question is, how to fix this? I'd prefer to do it directly in
>> the jr driver instead of the ifdef-ery.
>>
>> Something like
>>   if (sizeof(dma_addr_t) == sizeof(u32))
>>   wr_reg32(&jrp->rregs->inpring_base + 1, inpbusaddr);
>>   else if (sizeof(dma_addr_t) == sizeof(u64))
>>   wr_reg64(...)
>>
>> or just go by DT compatible and then remove the inline function definitions.
>>
>> As far as I can tell, the compatible wouldn't be needed for anything
>> else in the jr driver, so maybe that is not optimal. On the other hand
>> the sizeof(..) solution would only catch little endian on 32bit and
>> not big endian (?!) I however don't know what combinations actually
>> *have* to be caught, as I don't know, which exist.
>>
>> So, what do you think people?
>
> I'm adding a couple of CCs.
>
> Thanks,
> --
> Email: Herbert Xu  Home Page: 
> http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in 
> the body of a message to majord...@vger.kernel.org More majordomo info at  
> http://vger.kernel.org/majordomo-info.html
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [tip:x86/apic] genirq: Prevent crash in irq_move_irq()

2015-06-16 Thread Thomas Gleixner


On Tue, 16 Jun 2015, Jiang Liu wrote:

> On 2015/6/16 15:31, tip-bot for Jiang Liu wrote:
> > Commit-ID:  458526ec81d755dfaa17f3d863302afe6fbefca0
> > Gitweb: 
> > http://git.kernel.org/tip/458526ec81d755dfaa17f3d863302afe6fbefca0
> > Author: Jiang Liu 
> > AuthorDate: Mon, 1 Jun 2015 16:05:11 +0800
> > Committer:  Thomas Gleixner 
> > CommitDate: Tue, 16 Jun 2015 09:23:28 +0200
> > 
> > genirq: Prevent crash in irq_move_irq()
> > 
> > The functions irq_move_irq() and irq_move_masked_irq() expect that the
> > caller passes the top-level irq_data to them when hierarchical
> > irqdomains are enabled. But that's not true when called from
> > apic_ack_edge(), which results in a null pointer dereference by
> > idata->chip->irq_mask(idata).
> > 
> > Instead of fixing callers to passing top-level irq_data, we rather
> > change irq_move_irq()/irq_move_masked_irq() to accept any irq_data.
> > 
> > Fixes: 52f518a3a7c 'x86/MSI: Use hierarchical irqdomains to manage MSI 
> > interrupts'
> Hi Thomas,
>   This patch has dependency on patch "[Patch v3 01/36] genirq:
> Enhance irq_data_to_desc() to support hierarchy irqdomain" in the
> same patch set, otherwise irq_data_to_desc(idata) may return invalid
> irq_desc and may cause memory crash.

That's why you should not mix bug fixes with performance improvement series.

Thanks,

tglx

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


Re: [PATCH 0/2] Consolidate redundant register/stack access code

2015-06-16 Thread Martin Schwidefsky
On Mon, 15 Jun 2015 12:42:57 -0400
David Long  wrote:

> From: "David A. Long" 
> 
> Move duplicate and functionally equivalent code for accessing registers
> and stack (CONFIG_HAVE_REGS_AND_STACK_ACCESS_API) from arch subdirs into
> common kernel files.
> 
> Note: Help regression testing s390, hexagon, and sh would be appreciated.
>   Powerpc builds but I have not verified the functionality.
> 
> David A. Long (2):
>   Move the pt_regs_offset struct definition from arch to common include
> file
>   Consolidate redundant register/stack access code

Compiles & boots on a s390 box. The code for regs_query_register_offset
and regs_query_register_name is a bit more complex for s390 compared
to the current state of things. Should be equivalent though.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

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


[tip:x86/apic] genirq: Enhance irq_data_to_desc() to support hierarchy irqdomain

2015-06-16 Thread tip-bot for Jiang Liu
Commit-ID:  c7cfc94096db28d3072b402c224eb50349926e24
Gitweb: http://git.kernel.org/tip/c7cfc94096db28d3072b402c224eb50349926e24
Author: Jiang Liu 
AuthorDate: Mon, 1 Jun 2015 16:05:10 +0800
Committer:  Thomas Gleixner 
CommitDate: Tue, 16 Jun 2015 10:10:16 +0200

genirq: Enhance irq_data_to_desc() to support hierarchy irqdomain

For irq associated with hierarchy irqdomains, there will be multiple
irq_datas for one irq_desc. So enhance irq_data_to_desc() to support
hierarchy irqdomain. Also export irq_data_to_desc() as an inline
function for later reuse.

Signed-off-by: Jiang Liu 
Cc: Konrad Rzeszutek Wilk 
Cc: Tony Luck 
Cc: Bjorn Helgaas 
Cc: Benjamin Herrenschmidt 
Cc: Randy Dunlap 
Cc: Yinghai Lu 
Cc: Borislav Petkov 
Cc: Marc Zyngier 
Link: 
http://lkml.kernel.org/r/1433145945-789-2-git-send-email-jiang@linux.intel.com
Signed-off-by: Thomas Gleixner 
---
 include/linux/irqdesc.h | 9 +
 kernel/irq/internals.h  | 2 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index dd1109f..a113a8d 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -93,6 +93,15 @@ struct irq_desc {
 extern struct irq_desc irq_desc[NR_IRQS];
 #endif
 
+static inline struct irq_desc *irq_data_to_desc(struct irq_data *data)
+{
+#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
+   return irq_to_desc(data->irq);
+#else
+   return container_of(data, struct irq_desc, irq_data);
+#endif
+}
+
 static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
 {
return &desc->irq_data;
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index df553b0..b93d434 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -59,8 +59,6 @@ enum {
 #include "debug.h"
 #include "settings.h"
 
-#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
-
 extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
unsigned long flags);
 extern void __disable_irq(struct irq_desc *desc, unsigned int irq);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/apic] genirq: Prevent crash in irq_move_irq()

2015-06-16 Thread tip-bot for Jiang Liu
Commit-ID:  f6b1464f647424bbeb609ec832428e4079940701
Gitweb: http://git.kernel.org/tip/f6b1464f647424bbeb609ec832428e4079940701
Author: Jiang Liu 
AuthorDate: Mon, 1 Jun 2015 16:05:11 +0800
Committer:  Thomas Gleixner 
CommitDate: Tue, 16 Jun 2015 10:10:20 +0200

genirq: Prevent crash in irq_move_irq()

The functions irq_move_irq() and irq_move_masked_irq() expect that the
caller passes the top-level irq_data to them when hierarchical
irqdomains are enabled. But that's not true when called from
apic_ack_edge(), which results in a null pointer dereference by
idata->chip->irq_mask(idata).

Instead of fixing callers to passing top-level irq_data, we rather
change irq_move_irq()/irq_move_masked_irq() to accept any irq_data.

Fixes: 52f518a3a7c 'x86/MSI: Use hierarchical irqdomains to manage MSI 
interrupts'
Reported-by: Huang Ying 
Signed-off-by: Jiang Liu 
Cc: Konrad Rzeszutek Wilk 
Cc: Tony Luck 
Cc: Bjorn Helgaas 
Cc: Benjamin Herrenschmidt 
Cc: Randy Dunlap 
Cc: Yinghai Lu 
Cc: Borislav Petkov 
Link: 
http://lkml.kernel.org/r/1433145945-789-3-git-send-email-jiang@linux.intel.com
Signed-off-by: Thomas Gleixner 
---
 kernel/irq/migration.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index ca3f4aa..dd203e2 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -7,7 +7,7 @@
 void irq_move_masked_irq(struct irq_data *idata)
 {
struct irq_desc *desc = irq_data_to_desc(idata);
-   struct irq_chip *chip = idata->chip;
+   struct irq_chip *chip = desc->irq_data.chip;
 
if (likely(!irqd_is_setaffinity_pending(&desc->irq_data)))
return;
@@ -52,6 +52,13 @@ void irq_move_irq(struct irq_data *idata)
 {
bool masked;
 
+   /*
+* Get top level irq_data when CONFIG_IRQ_DOMAIN_HIERARCHY is enabled,
+* and it should be optimized away when CONFIG_IRQ_DOMAIN_HIERARCHY is
+* disabled. So we avoid an "#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY" here.
+*/
+   idata = irq_desc_get_irq_data(irq_data_to_desc(idata));
+
if (likely(!irqd_is_setaffinity_pending(idata)))
return;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 00/12] mm: mirrored memory support for page buddy allocations

2015-06-16 Thread Xishi Qiu
On 2015/6/16 15:53, Vlastimil Babka wrote:

> On 06/04/2015 02:54 PM, Xishi Qiu wrote:
>> Intel Xeon processor E7 v3 product family-based platforms introduces support
>> for partial memory mirroring called as 'Address Range Mirroring'. This 
>> feature
>> allows BIOS to specify a subset of total available memory to be mirrored (and
>> optionally also specify whether to mirror the range 0-4 GB). This capability
>> allows user to make an appropriate tradeoff between non-mirrored memory range
>> and mirrored memory range thus optimizing total available memory and still
>> achieving highly reliable memory range for mission critical workloads and/or
>> kernel space.
>>
>> Tony has already send a patchset to supprot this feature at boot time.
>> https://lkml.org/lkml/2015/5/8/521
>>
>> This patchset can support the feature after boot time. It introduces 
>> mirror_info
>> to save the mirrored memory range. Then use __GFP_MIRROR to allocate 
>> mirrored 
>> pages. 
>>
>> I think add a new migratetype is btter and easier than a new zone, so I use
> 
> If the mirrored memory is in a single reasonably compact (no large holes) 
> range
> (per NUMA node) and won't dynamically change its size, then zone might be a
> better option. For one thing, it will still allow distinguishing movable and
> unmovable allocations within the mirrored memory.
> 
> We had enough fun with MIGRATE_CMA and all kinds of checks it added to 
> allocator
> hot paths, and even CMA is now considering moving to a separate zone.
> 

Hi, how about the problem of this case:
e.g. node 0: 0-4G(dma and dma32)
 node 1: 4G-8G(normal), 8-12G(mirror), 12-16G(normal),
so more than one normal zone in a node? or normal zone just span the mirror 
zone?

Thanks,
Xishi Qiu

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


Re: [PATCH RFC v6 1/3] crypto: add PKE API

2015-06-16 Thread Herbert Xu
On Tue, Jun 16, 2015 at 01:01:59AM -0700, Tadeusz Struk wrote:
>
> @@ -28,6 +28,7 @@ crypto_hash-y += shash.o
>  obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
>  
>  obj-$(CONFIG_CRYPTO_PCOMP2) += pcompress.o
> +obj-$(CONFIG_CRYPTO_AKCIPHER) += akcipher.o

s/AKCIPHER/AKCIPHER2/

> +/**
> + * struct akcipher_request - public key request
> + *
> + * @base:Common attributes for async crypto requests
> + * @src: Pointer to memory containing the input parameters
> + *   The format of the parameter(s) is expeted to be Octet String
> + * @dst: Pointer to memory whare the result will be stored
> + * @src_len: Size of the input parameter
> + * @dst_len: Size of the output buffer. It needs to be at leaset
> + *   as big as the expected result depending on the operation
> + *   After operation it will be updated with the acctual size of the
> + *   result. In case of error, where the dst_len was insufficient,
> + *   it will be updated to the size required for the operation.
> + * @result_len: If not NULL this will be updated by the implementation to
> + *   reflect the acctual size of the result

result_len is still here.

> + * @__ctx:   Start of private context data
> + */
> +struct akcipher_request {
> + struct crypto_async_request base;
> + void *src;
> + void *dst;
> + unsigned int src_len;
> + unsigned int *dst_len;

dst_len doesn't need to be a pointer.  A simple int will do.

> +static inline int crypto_akcipher_encrypt(struct akcipher_request *req)
> +{
> + struct crypto_akcipher *tfm = __crypto_akcipher_tfm(req->base.tfm);

You should add a reqtfm helper like crypto_aead_reqtfm so that
implementors don't need to do this ugly __crypto_akcipher_tfm.

In fact you already have that helper so you just need to use it.

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


Re: [PATCH 01/10] cpumask: Introduce cpumask_any_online_but

2015-06-16 Thread Thomas Gleixner
On Mon, 15 Jun 2015, Vikas Shivappa wrote:
> On Mon, 15 Jun 2015, Peter Zijlstra wrote:
> > On Fri, Jun 12, 2015 at 11:17:08AM -0700, Vikas Shivappa wrote:
> > > + cpumask_and(&tmp, cpu_online_mask, mask);
> > > + cpumask_clear_cpu(cpu, &tmp);
> > > + return cpumask_any(&tmp);
> > > +}
> > 
> > You had a good example in cpumask_any_but() copy that.
> 
> I saw the cpumask_any_but but wanted to avoid the for loop in the
> cpumask_any_but , but now i see why from your previous comment. Without the
> cpumask_t I will have to use the cpumask_any_but .. the two were related.

It can be done w/o a loop. Hint, you need a static cpumask in your
code anyway.

Thanks

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


Re: [Patch v2] driver/clk/clk-si5338: Add common clock framework driver for si5338

2015-06-16 Thread Paul Bolle
One question and a few nits follow.

On Mon, 2015-06-15 at 10:07 -0700, York Sun wrote:
> SI5338 is a programmable clock generator. It has 4 sets of inputs,
> PLL, multisynth and dividers to make 4 outputs. This driver splits
> them into multiple clocks to comply with common clock framework.
> 
> See Documentation/devicetree/bindings/clock/silabs,si5338.txt for
> details.
> 
> Signed-off-by: York Sun 
> CC: Mike Turquette 

Apparently that's now mturque...@baylibre.com .

> CC: Sebastian Hesselbarth 
> CC: Guenter Roeck 
> CC: Andrey Filippov 

> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig

>  config COMMON_CLK
> - bool
> + tristate "Common Clock"
>   select HAVE_CLK_PREPARE
>   select CLKDEV_LOOKUP
>   select SRCU

Why? The commit explanation doesn't mention this. Did you use an unclean
tree? If not, you just created over a dozen of new modules:
$ git grep -nw CONFIG_COMMON_CLK -- "*Makefile*"
arch/arm/mach-mmp/Makefile:13:ifeq ($(CONFIG_COMMON_CLK), )
arch/arm/mach-shmobile/Makefile:21:ifndef CONFIG_COMMON_CLK
arch/powerpc/platforms/512x/Makefile:4:obj-$(CONFIG_COMMON_CLK) += 
clock-commonclk.o
drivers/clk/Makefile:4:obj-$(CONFIG_COMMON_CLK) += clk.o
drivers/clk/Makefile:5:obj-$(CONFIG_COMMON_CLK) += clk-divider.o
drivers/clk/Makefile:6:obj-$(CONFIG_COMMON_CLK) += clk-fixed-factor.o
drivers/clk/Makefile:7:obj-$(CONFIG_COMMON_CLK) += clk-fixed-rate.o
drivers/clk/Makefile:8:obj-$(CONFIG_COMMON_CLK) += clk-gate.o
drivers/clk/Makefile:9:obj-$(CONFIG_COMMON_CLK) += clk-mux.o
drivers/clk/Makefile:10:obj-$(CONFIG_COMMON_CLK)+= clk-composite.o
drivers/clk/Makefile:11:obj-$(CONFIG_COMMON_CLK)+= 
clk-fractional-divider.o
drivers/clk/Makefile:12:obj-$(CONFIG_COMMON_CLK)+= clk-gpio-gate.o
drivers/clk/Makefile:14:obj-$(CONFIG_COMMON_CLK)+= clk-conf.o
drivers/clk/Makefile:59:ifeq ($(CONFIG_COMMON_CLK), y)
drivers/clk/samsung/Makefile:5:obj-$(CONFIG_COMMON_CLK) += clk.o clk-pll.o
drivers/gpu/drm/msm/Makefile:53:msm-$(CONFIG_COMMON_CLK) += 
mdp/mdp4/mdp4_lvds_pll.o
drivers/sh/Makefile:5:ifneq ($(CONFIG_COMMON_CLK),y)

> +config COMMON_CLK_SI5338
> + tristate "Clock driver for SiLabs 5338"
> + depends on I2C
> + select REGMAP_I2C
> + select RATIONAL
> + ---help---
> +   This driver supports Silicon Labs 5338 programmable clock generators,
> +   using common clock framework. It needs parent clock as input(s).
> +   Internal clocks are registered with unique names in case multiple
> +   devices exist. See devicetree/bindings/clock/silabs,si5338.txt
> +   under Documentation for details.

> --- /dev/null
> +++ b/drivers/clk/clk-si5338.c

> +unsigned long si5338_divrefclk_recalc_rate(struct clk_hw *hw,
> +unsigned long parent_rate)
> +{
> + [...]
> +}

Can't this be made static? It compiles cleanly with static too. Is there
some subtle issue I'm missing?

> +static const struct clk_ops si5338_divrefclk_ops = {
> + .recalc_rate = si5338_divrefclk_recalc_rate,
> +};

> +unsigned long si5338_divfbclk_recalc_rate(struct clk_hw *hw,
> +unsigned long parent_rate)
> +{
> + [...]
> +}

Ditto.

> +static const struct clk_ops si5338_divfbclk_ops = {
> + .recalc_rate = si5338_divfbclk_recalc_rate,
> +};

> --- /dev/null
> +++ b/include/dt-bindings/clock/clk-si5338.h

> +#ifndef _DT_BINDINGS_CLK_DSI5338_H
> +#define _DT_BINDINGS_CLK_DSI5338_H

(I spotted a D that looks odd here.)

And git am whines:
new blank line at EOF.

Thanks,


Paul Bolle

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


spoluprace

2015-06-16 Thread Chn email



Mam vzajemne mit prospech podnik pro nas oba. pokud mate zajem, muzete mi
dostat na e-mailovou adresu a pro detaily a vysvetlení.

E-mail: jgg.c...@gmail.com

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


Re: [PATCH v2 1/1] irqchip: exynos-combiner: Save IRQ enable set on suspend

2015-06-16 Thread Thomas Gleixner
On Tue, 16 Jun 2015, Krzysztof Kozlowski wrote:

> On 16.06.2015 00:23, Javier Martinez Canillas wrote:
> (...)
> >>> To do a more intrusive change, I should better understand the interactions
> >>> between the Exynos pinctrl / GPIO, interrupt combiner and the GIC and in 
> >>> the
> >>> meantime S2R will continue to be broken on these platforms unless someone
> >>> more familiar with all this could point me in the right direction.
> >>>
> >>
> >> As I said I am fine with this patch for now and I don't want to block it.
> >>
> > 
> > Thanks a lot, Krzysztof who is one of the Exynos maintainers has also agreed
> > with the patch so hopefully this can land sooner rather than later.
> 
> I assume this will go through irqchip tree, right?

yes, picking it up now

Thanks,

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


Re: [PATCH] drivers/leds: don't use module_init in non-modular leds-cobalt-raq.c

2015-06-16 Thread Jacek Anaszewski

Hi Paul,

On 06/16/2015 12:12 AM, Paul Gortmaker wrote:

This file is built for a bool Kconfig variable, and hence this
code is either present or absent.  It currently can never be
modular, so using module_init as an alias for __initcall can be
somewhat misleading.

Fix this up now, so that we can relocate module_init from
init.h into module.h in the future.  If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing.

Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups.  As __initcall gets
mapped onto device_initcall, our use of device_initcall
directly in this change means that the runtime impact is
zero -- it will remain at level 6 in initcall ordering.

And since it can't be modular, we remove all the __exitcall
stuff related to module_exit() -- it is dead code that won't
ever be executed.

Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: Jacek Anaszewski 
Cc: linux-l...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
[
  To be appended to the branch content originally sent as:
  "Replace module_init with device_initcall in non modules"
  
https://lkml.kernel.org/r/1432860493-23831-1-git-send-email-paul.gortma...@windriver.com
]

  drivers/leds/leds-cobalt-raq.c | 15 +--
  1 file changed, 1 insertion(+), 14 deletions(-)


Acked-by: Jacek Anaszewski 

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


Re: [PATCH 10/10] x86/intel_rdt: Intel haswell Cache Allocation enumeration

2015-06-16 Thread Thomas Gleixner
On Mon, 15 Jun 2015, Vikas Shivappa wrote:
> On Mon, 15 Jun 2015, Peter Zijlstra wrote:
> 
> > On Fri, Jun 12, 2015 at 11:17:17AM -0700, Vikas Shivappa wrote:
> > > + /*
> > > +  * Probe test for Haswell CPUs.
> > > +  */
> > > + if (c->x86 == 0x6 && c->x86_model == 0x3f)
> > > + return hsw_probetest();
> > 
> > Firstly, isn't a probe already a test?
> 
> Will fix the name to hsw_probe
> 
> > 
> > Secondly, there's more HSW models:
> > 
> >case 60: /* 22nm Haswell Core */
> >case 63: /* 22nm Haswell Server */
> >case 69: /* 22nm Haswell ULT */
> >case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */
> > 
> > Is this really only HSW server,
> 
> Yes , this probe is only targeted at HSW servers as of now.
> 
> or should they all be listed?

you should know, whether they support that feature and need that quirk,

Thanks

tglx

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


Re: [tip:x86/apic] genirq: Prevent crash in irq_move_irq()

2015-06-16 Thread Jiang Liu
On 2015/6/16 16:12, Thomas Gleixner wrote:
> 
> 
> On Tue, 16 Jun 2015, Jiang Liu wrote:
> 
>> On 2015/6/16 15:31, tip-bot for Jiang Liu wrote:
>>> Commit-ID:  458526ec81d755dfaa17f3d863302afe6fbefca0
>>> Gitweb: 
>>> http://git.kernel.org/tip/458526ec81d755dfaa17f3d863302afe6fbefca0
>>> Author: Jiang Liu 
>>> AuthorDate: Mon, 1 Jun 2015 16:05:11 +0800
>>> Committer:  Thomas Gleixner 
>>> CommitDate: Tue, 16 Jun 2015 09:23:28 +0200
>>>
>>> genirq: Prevent crash in irq_move_irq()
>>>
>>> The functions irq_move_irq() and irq_move_masked_irq() expect that the
>>> caller passes the top-level irq_data to them when hierarchical
>>> irqdomains are enabled. But that's not true when called from
>>> apic_ack_edge(), which results in a null pointer dereference by
>>> idata->chip->irq_mask(idata).
>>>
>>> Instead of fixing callers to passing top-level irq_data, we rather
>>> change irq_move_irq()/irq_move_masked_irq() to accept any irq_data.
>>>
>>> Fixes: 52f518a3a7c 'x86/MSI: Use hierarchical irqdomains to manage MSI 
>>> interrupts'
>> Hi Thomas,
>>  This patch has dependency on patch "[Patch v3 01/36] genirq:
>> Enhance irq_data_to_desc() to support hierarchy irqdomain" in the
>> same patch set, otherwise irq_data_to_desc(idata) may return invalid
>> irq_desc and may cause memory crash.
> 
> That's why you should not mix bug fixes with performance improvement series.
Yes, it's a lesson. I always fall into troubles when managing several
inter-dependent patch sets at the same time.
Thanks!
Gerry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] drivers/staging/comedi/drivers/pcl816.c: style fix

2015-06-16 Thread Guillermo O. Freschi
Removed some spaces before a tab character.
---
 drivers/staging/comedi/drivers/pcl816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/pcl816.c 
b/drivers/staging/comedi/drivers/pcl816.c
index 1ccb2f1..781b321 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -323,7 +323,7 @@ static int check_channel_list(struct comedi_device *dev,
 
/*  check whole chanlist */
for (i = 0, segpos = 0; i < chanlen; i++) {
-   if (chanlist[i] != chansegment[i % seglen]) {
+   if (chanlist[i] != chansegment[i % seglen]) {
dev_dbg(dev->class_dev,
"bad channel or range number! 
chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
i, CR_CHAN(chansegment[i]),
-- 
2.1.4

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


[PATCH 3.4 000/172] 3.4.108-rc1 review

2015-06-16 Thread lizf
From: Zefan Li 

This is the start of the stable review cycle for the 3.4.108 release.
There are 172 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu Jun 18 08:30:58 UTC 2015.
Anything received after that time might be too late.

A combined patch relative to 3.4.107 will be posted as an additional
response to this.  A shortlog and diffstat can be found below.

thanks,

Zefan Li



Adrian Knoth (1):
  ALSA: hdspm - Constrain periods to 2 on older cards

Al Viro (6):
  debugfs: leave freeing a symlink body until inode eviction
  autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for
allocation
  sunrpc: fix braino in ->poll()
  gadgetfs: use-after-free in ->aio_read()
  ocfs2: _really_ sync the right range
  don't bugger nd->seq on set_root_rcu() from follow_dotdot_rcu()

Alan Stern (3):
  USB: add flag for HCDs that can't receive wakeup requests
(isp1760-hcd)
  USB: fix use-after-free bug in usb_hcd_unlink_urb()
  USB: usbfs: don't leak kernel data in siginfo

Aleksander Morgado (1):
  xhci: fix reporting of 0-sized URBs in control endpoint

Alex Deucher (6):
  drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary
  drm/radeon: do a posting read in r100_set_irq
  drm/radeon: do a posting read in rs600_set_irq
  drm/radeon: do a posting read in r600_set_irq
  drm/radeon: do a posting read in evergreen_set_irq
  drm/radeon: do a posting read in si_set_irq

Alexandre Belloni (1):
  ARM: at91: pm: fix at91rm9200 standby

Andrey Ryabinin (1):
  smack: fix possible use after frees in task_security() callers

Andy Lutomirski (2):
  x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization
  x86/asm/entry/32: Fix user_mode() misuses

Arik Nemtsov (1):
  mac80211: set only VO as a U-APSD enabled AC

Bart Van Assche (1):
  Defer processing of REQ_PREEMPT requests for blocked devices

Ben Greear (1):
  Fix lockup related to stop_machine being stuck in __do_softirq.

Ben Hutchings (2):
  splice: Apply generic position and size checks to each write
  xen-pciback: Add name prefix to global 'permissive' variable

Benjamin Tissoires (1):
  Input: synaptics - handle spurious release of trackstick buttons

Bob Copeland (1):
  mac80211: drop unencrypted frames in mesh fwding

Brian King (1):
  bnx2x: Force fundamental reset for EEH recovery

Brian Silverman (1):
  sched: Fix RLIMIT_RTTIME when PI-boosting to RT

Chen Jie (1):
  jffs2: fix handling of corrupted summary length

Chris Wilson (1):
  ACPI / video: Load the module even if ACPI is disabled

Chuck Lever (1):
  xprtrdma: Free the pd if ib_query_qp() fails

Dan Carpenter (3):
  ALSA: off by one bug in snd_riptide_joystick_probe()
  tcm_fc: missing curly braces in ft_invl_hw_context()
  ipvs: uninitialized data with IP_VS_IPV6

Daniel Borkmann (1):
  rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY

Daniel Mack (1):
  ALSA: snd-usb: add quirks for Roland UA-22

Daniel Martin (1):
  Input: synaptics - query min dimensions for fw v8.1

Darrick J. Wong (2):
  dm io: reject unsupported DISCARD requests with EOPNOTSUPP
  dm io: deal with wandering queue limits when handling REQ_DISCARD and
REQ_WRITE_SAME

David Disseldorp (1):
  cifs: fix use-after-free bug in find_writable_file

David Hildenbrand (1):
  KVM: s390: base hrtimer on a monotonic clock

David Miller (1):
  radeon: Do not directly dereference pointers to BIOS area.

Dmitry Eremin-Solenikov (4):
  ARM: pxa: add regulator_has_full_constraints to corgi board file
  ARM: pxa: add regulator_has_full_constraints to poodle board file
  ARM: pxa: add regulator_has_full_constraints to spitz board file
  ARM: 8284/1: sa1100: clear RCSR_SMR on resume

Dmitry M. Fedin (1):
  ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support

Dmitry Torokhov (1):
  Input: synaptics - fix middle button on Lenovo 2015 products

Dmitry Tunin (1):
  Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device

Doug Goldstein (2):
  USB: ftdi_sio: Added custom PID for Synapse Wireless product
  USB: ftdi_sio: Use jtag quirk for SNAP Connect E10

Eli Cohen (1):
  IB/core: Avoid leakage from kernel to user space

Eric Dumazet (2):
  netfilter: xt_socket: fix a stack corruption bug
  softirq: reduce latencies

Eric Nelson (1):
  ASoC: sgtl5000: remove useless register write clearing
CHRGPUMP_POWERUP

Feng Tang (1):
  x86/reboot: Fix a warning message triggered by stop_other_cpus()

Florian Westphal (1):
  net: make skb_gso_segment error handling more robust

Grazvydas Ignotas (1):
  mm/memory.c: actually remap enough memory

Hui Wang (1):
  ALSA: hda - Add one more node in the EAPD supporting candidate list

Ian Abbott (2):
  staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back
  spi: spidev: fix possible arithmetic overflow for multi-transfer
message

James Bottomley (1):
  libsas: Fix Kernel Crash in smp_execute_task

Jan Beul

[PATCH 3.4 006/172] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN

2015-06-16 Thread lizf
From: Sebastian Andrzej Siewior 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 5efd2ea8c9f4f12916ffc8ba636792ce052f6911 upstream.

the following error pops up during "testusb -a -t 10"
| musb-hdrc musb-hdrc.1.auto: dma_pool_free buffer-128, f134e000/be842000 (bad 
dma)
hcd_buffer_create() creates a few buffers, the smallest has 32 bytes of
size. ARCH_KMALLOC_MINALIGN is set to 64 bytes. This combo results in
hcd_buffer_alloc() returning memory which is 32 bytes aligned and it
might by identified by buffer_offset() as another buffer. This means the
buffer which is on a 32 byte boundary will not get freed, instead it
tries to free another buffer with the error message.

This patch fixes the issue by creating the smallest DMA buffer with the
size of ARCH_KMALLOC_MINALIGN (or 32 in case ARCH_KMALLOC_MINALIGN is
smaller). This might be 32, 64 or even 128 bytes. The next three pools
will have the size 128, 512 and 2048.
In case the smallest pool is 128 bytes then we have only three pools
instead of four (and zero the first entry in the array).
The last pool size is always 2048 bytes which is the assumed PAGE_SIZE /
2 of 4096. I doubt it makes sense to continue using PAGE_SIZE / 2 where
we would end up with 8KiB buffer in case we have 16KiB pages.
Instead I think it makes sense to have a common size(s) and extend them
if there is need to.
There is a BUILD_BUG_ON() now in case someone has a minalign of more than
128 bytes.

Signed-off-by: Sebastian Andrzej Siewior 
Acked-by: Alan Stern 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Zefan Li 
---
 drivers/usb/core/buffer.c | 26 +-
 drivers/usb/core/usb.c|  1 +
 include/linux/usb/hcd.h   |  1 +
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index b0585e6..19fa68a 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -22,17 +22,25 @@
  */
 
 /* FIXME tune these based on pool statistics ... */
-static const size_tpool_max[HCD_BUFFER_POOLS] = {
-   /* platforms without dma-friendly caches might need to
-* prevent cacheline sharing...
-*/
-   32,
-   128,
-   512,
-   PAGE_SIZE / 2
-   /* bigger --> allocate pages */
+static size_t pool_max[HCD_BUFFER_POOLS] = {
+   32, 128, 512, 2048,
 };
 
+void __init usb_init_pool_max(void)
+{
+   /*
+* The pool_max values must never be smaller than
+* ARCH_KMALLOC_MINALIGN.
+*/
+   if (ARCH_KMALLOC_MINALIGN <= 32)
+   ;   /* Original value is okay */
+   else if (ARCH_KMALLOC_MINALIGN <= 64)
+   pool_max[0] = 64;
+   else if (ARCH_KMALLOC_MINALIGN <= 128)
+   pool_max[0] = 0;/* Don't use this pool */
+   else
+   BUILD_BUG();/* We don't allow this */
+}
 
 /* SETUP primitives */
 
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c74ba7b..8966960 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1010,6 +1010,7 @@ static int __init usb_init(void)
pr_info("%s: USB support disabled\n", usbcore_name);
return 0;
}
+   usb_init_pool_max();
 
retval = usb_debugfs_init();
if (retval)
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 815cc4b..6674ec0 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -399,6 +399,7 @@ extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
 #endif /* CONFIG_PCI */
 
 /* pci-ish (pdev null is ok) buffer alloc/mapping support */
+void usb_init_pool_max(void);
 int hcd_buffer_create(struct usb_hcd *hcd);
 void hcd_buffer_destroy(struct usb_hcd *hcd);
 
-- 
1.9.1

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


[PATCH 3.4 001/172] ARM: pxa: add regulator_has_full_constraints to corgi board file

2015-06-16 Thread lizf
From: Dmitry Eremin-Solenikov 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 271e80176aae4e5b481f4bb92df9768c6075bbca upstream.

Add regulator_has_full_constraints() call to corgi board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on corgi if
regulators are enabled:

ads7846 spi1.0: unable to get regulator: -517
spi spi1.0: Driver ads7846 requests probe deferral
wm8731 0-001b: Failed to get supply 'AVDD': -517
wm8731 0-001b: Failed to request supplies: -517
wm8731 0-001b: ASoC: failed to probe component -517
corgi-audio corgi-audio: ASoC: failed to instantiate card -517

Signed-off-by: Dmitry Eremin-Solenikov 
Acked-by: Mark Brown 
Signed-off-by: Robert Jarzmik 
Signed-off-by: Zefan Li 
---
 arch/arm/mach-pxa/corgi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index c1fe32d..f801fe8 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -711,6 +712,8 @@ static void __init corgi_init(void)
sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
 
platform_add_devices(devices, ARRAY_SIZE(devices));
+
+   regulator_has_full_constraints();
 }
 
 static void __init fixup_corgi(struct tag *tags, char **cmdline,
-- 
1.9.1

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


[PATCH 3.4 008/172] Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device

2015-06-16 Thread lizf
From: Dmitry Tunin 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 033efa920a7f22a8caf7a38d851a2f451781bbf7 upstream.

Add support of 13d3:3423 device.

BugLink: https://bugs.launchpad.net/bugs/1411193

T: Bus=01 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=13d3 ProdID=3423 Rev= 0.01
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms

Signed-off-by: Dmitry Tunin 
Signed-off-by: Marcel Holtmann 
Signed-off-by: Zefan Li 
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 02fbbf7..8a084bf 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -101,6 +101,7 @@ static struct usb_device_id ath3k_table[] = {
{ USB_DEVICE(0x13d3, 0x3393) },
{ USB_DEVICE(0x13d3, 0x3402) },
{ USB_DEVICE(0x13d3, 0x3408) },
+   { USB_DEVICE(0x13d3, 0x3423) },
{ USB_DEVICE(0x13d3, 0x3432) },
 
/* Atheros AR5BBU12 with sflash firmware */
@@ -149,6 +150,7 @@ static struct usb_device_id ath3k_blist_tbl[] = {
{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU22 with sflash firmware */
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ddb2b87..7c0b21e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -179,6 +179,7 @@ static struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU12 with sflash firmware */
-- 
1.9.1

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


[PATCH 3.4 002/172] ARM: pxa: add regulator_has_full_constraints to poodle board file

2015-06-16 Thread lizf
From: Dmitry Eremin-Solenikov 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 9bc78f32c2e430aebf6def965b316aa95e37a20c upstream.

Add regulator_has_full_constraints() call to poodle board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on poodle if
regulators are enabled:

ads7846 spi1.0: unable to get regulator: -517
spi spi1.0: Driver ads7846 requests probe deferral
wm8731 0-001b: Failed to get supply 'AVDD': -517
wm8731 0-001b: Failed to request supplies: -517
wm8731 0-001b: ASoC: failed to probe component -517

Signed-off-by: Dmitry Eremin-Solenikov 
Acked-by: Mark Brown 
Signed-off-by: Robert Jarzmik 
Signed-off-by: Zefan Li 
---
 arch/arm/mach-pxa/poodle.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 89d98c8..39d1068 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -452,6 +453,7 @@ static void __init poodle_init(void)
pxa_set_i2c_info(NULL);
i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices));
poodle_init_spi();
+   regulator_has_full_constraints();
 }
 
 static void __init fixup_poodle(struct tag *tags, char **cmdline,
-- 
1.9.1

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


[PATCH 3.4 003/172] ARM: pxa: add regulator_has_full_constraints to spitz board file

2015-06-16 Thread lizf
From: Dmitry Eremin-Solenikov 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit baad2dc49c5d970ea881d92981a1b76c94a7b7a1 upstream.

Add regulator_has_full_constraints() call to spitz board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on spitz if
regulators are enabled:

ads7846 spi2.0: unable to get regulator: -517
spi spi2.0: Driver ads7846 requests probe deferral

Signed-off-by: Dmitry Eremin-Solenikov 
Acked-by: Mark Brown 
Signed-off-by: Robert Jarzmik 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 arch/arm/mach-pxa/spitz.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index df2ab0f..a1647d0 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -968,6 +968,8 @@ static void __init spitz_init(void)
spitz_nor_init();
spitz_nand_init();
spitz_i2c_init();
+
+   regulator_has_full_constraints();
 }
 
 static void __init spitz_fixup(struct tag *tags, char **cmdline,
-- 
1.9.1

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


[PATCH 3.4 012/172] USB: cp210x: add ID for RUGGEDCOM USB Serial Console

2015-06-16 Thread lizf
From: Lennart Sorensen 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit a6f0331236fa75afba14bbcf6668d42cebb55c43 upstream.

Added the USB serial console device ID for Siemens Ruggedcom devices
which have a USB port for their serial console.

Signed-off-by: Len Sorensen 
Signed-off-by: Johan Hovold 
Signed-off-by: Zefan Li 
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 8137937..a455343 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -63,6 +63,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, 
M5300 series, M7100 series */
{ USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless 
smartcard reader */
{ USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC 
Device */
+   { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console 
*/
{ USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher 
Acceptor */
{ USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
{ USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
-- 
1.9.1

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


[PATCH 3.4 019/172] vt: provide notifications on selection changes

2015-06-16 Thread lizf
From: Nicolas Pitre 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 19e3ae6b4f07a87822c1c9e7ed99d31860e701af upstream.

The vcs device's poll/fasync support relies on the vt notifier to signal
changes to the screen content.  Notifier invocations were missing for
changes that comes through the selection interface though.  Fix that.

Tested with BRLTTY 5.2.

Signed-off-by: Nicolas Pitre 
Cc: Dave Mielke 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Zefan Li 
---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 268294c..334a7b2 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -498,6 +498,7 @@ void invert_screen(struct vc_data *vc, int offset, int 
count, int viewed)
 #endif
if (DO_UPDATE(vc))
do_update_region(vc, (unsigned long) p, count);
+   notify_update(vc);
 }
 
 /* used by selection: complement pointer position */
@@ -514,6 +515,7 @@ void complement_pos(struct vc_data *vc, int offset)
scr_writew(old, screenpos(vc, old_offset, 1));
if (DO_UPDATE(vc))
vc->vc_sw->con_putc(vc, old, oldy, oldx);
+   notify_update(vc);
}
 
old_offset = offset;
@@ -531,8 +533,8 @@ void complement_pos(struct vc_data *vc, int offset)
oldy = (offset >> 1) / vc->vc_cols;
vc->vc_sw->con_putc(vc, new, oldy, oldx);
}
+   notify_update(vc);
}
-
 }
 
 static void insert_char(struct vc_data *vc, unsigned int nr)
-- 
1.9.1

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


[PATCH 3.4 014/172] ARM: 8284/1: sa1100: clear RCSR_SMR on resume

2015-06-16 Thread lizf
From: Dmitry Eremin-Solenikov 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit e461894dc2ce7778ccde1c3483c9b15a85a7fc5f upstream.

StrongARM core uses RCSR SMR bit to tell to bootloader that it was reset
by entering the sleep mode. After we have resumed, there is little point
in having that bit enabled. Moreover, if this bit is set before reboot,
the bootloader can become confused. Thus clear the SMR bit on resume
just before clearing the scratchpad (resume address) register.

Signed-off-by: Dmitry Eremin-Solenikov 
Signed-off-by: Russell King 
Signed-off-by: Zefan Li 
---
 arch/arm/mach-sa1100/pm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 2fa499e..69bbe4e 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -80,6 +80,7 @@ static int sa11x0_pm_enter(suspend_state_t state)
/*
 * Ensure not to come back here if it wasn't intended
 */
+   RCSR = RCSR_SMR;
PSPR = 0;
 
/*
-- 
1.9.1

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


[PATCH 3.4 013/172] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-06-16 Thread lizf
From: Ian Abbott 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 42b8ce6f55facfa101462e694d33fc6bca471138 upstream.

`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott 
Reviewed-by: H Hartley Sweeten 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Zefan Li 
---
 drivers/staging/comedi/comedi_compat32.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 41a7a62..a8a0c0f 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -271,7 +271,7 @@ static int compat_cmd(struct file *file, unsigned long arg)
 {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
-   int rc;
+   int rc, err;
 
cmd32 = compat_ptr(arg);
cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -280,7 +280,15 @@ static int compat_cmd(struct file *file, unsigned long arg)
if (rc)
return rc;
 
-   return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   if (rc == -EAGAIN) {
+   /* Special case: copy cmd back to user. */
+   err = put_compat_cmd(cmd32, cmd);
+   if (err)
+   rc = err;
+   }
+
+   return rc;
 }
 
 /* Handle 32-bit COMEDI_CMDTEST ioctl. */
-- 
1.9.1

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


[PATCH v2] media: i2c: ADV7604: Migrate to regmap

2015-06-16 Thread Pablo Anton
This is a preliminary patch in order to add support for ALSA.
It replaces all current i2c access with regmap.

Signed-off-by: Pablo Anton 
Signed-off-by: Jean-Michel Hautbois 
---
v2: Rebase after renaming

 drivers/media/i2c/adv7604.c | 337 
 1 file changed, 244 insertions(+), 93 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 60ffcf0..38ae454 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -166,6 +167,9 @@ struct adv76xx_state {
/* i2c clients */
struct i2c_client *i2c_clients[ADV76XX_PAGE_MAX];
 
+   /* Regmaps */
+   struct regmap *regmap[ADV76XX_PAGE_MAX];
+
/* controls */
struct v4l2_ctrl *detect_tx_5v_ctrl;
struct v4l2_ctrl *analog_sampling_phase_ctrl;
@@ -346,66 +350,39 @@ static inline unsigned vtotal(const struct 
v4l2_bt_timings *t)
 
 /* --- */
 
-static s32 adv_smbus_read_byte_data_check(struct i2c_client *client,
-   u8 command, bool check)
-{
-   union i2c_smbus_data data;
-
-   if (!i2c_smbus_xfer(client->adapter, client->addr, client->flags,
-   I2C_SMBUS_READ, command,
-   I2C_SMBUS_BYTE_DATA, &data))
-   return data.byte;
-   if (check)
-   v4l_err(client, "error reading %02x, %02x\n",
-   client->addr, command);
-   return -EIO;
-}
-
-static s32 adv_smbus_read_byte_data(struct adv76xx_state *state,
-   enum adv76xx_page page, u8 command)
+static int adv76xx_read_check(struct adv76xx_state *state,
+int client_page, u8 reg)
 {
-   return adv_smbus_read_byte_data_check(state->i2c_clients[page],
- command, true);
-}
-
-static s32 adv_smbus_write_byte_data(struct adv76xx_state *state,
-enum adv76xx_page page, u8 command,
-u8 value)
-{
-   struct i2c_client *client = state->i2c_clients[page];
-   union i2c_smbus_data data;
+   struct i2c_client *client = state->i2c_clients[client_page];
int err;
-   int i;
+   unsigned int val;
 
-   data.byte = value;
-   for (i = 0; i < 3; i++) {
-   err = i2c_smbus_xfer(client->adapter, client->addr,
-   client->flags,
-   I2C_SMBUS_WRITE, command,
-   I2C_SMBUS_BYTE_DATA, &data);
-   if (!err)
-   break;
+   err = regmap_read(state->regmap[client_page], reg, &val);
+
+   if (err) {
+   v4l_err(client, "error reading %02x, %02x\n",
+   client->addr, reg);
+   return err;
}
-   if (err < 0)
-   v4l_err(client, "error writing %02x, %02x, %02x\n",
-   client->addr, command, value);
-   return err;
+   return val;
 }
 
-static s32 adv_smbus_write_i2c_block_data(struct adv76xx_state *state,
- enum adv76xx_page page, u8 command,
- unsigned length, const u8 *values)
+/* adv76xx_write_block(): Write raw data with a maximum of I2C_SMBUS_BLOCK_MAX
+ * size to one or more registers.
+ *
+ * A value of zero will be returned on success, a negative errno will
+ * be returned in error cases.
+ */
+static int adv76xx_write_block(struct adv76xx_state *state, int client_page,
+ unsigned int init_reg, const void *val,
+ size_t val_len)
 {
-   struct i2c_client *client = state->i2c_clients[page];
-   union i2c_smbus_data data;
+   struct regmap *regmap = state->regmap[client_page];
+
+   if (val_len > I2C_SMBUS_BLOCK_MAX)
+   val_len = I2C_SMBUS_BLOCK_MAX;
 
-   if (length > I2C_SMBUS_BLOCK_MAX)
-   length = I2C_SMBUS_BLOCK_MAX;
-   data.block[0] = length;
-   memcpy(data.block + 1, values, length);
-   return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
- I2C_SMBUS_WRITE, command,
- I2C_SMBUS_I2C_BLOCK_DATA, &data);
+   return regmap_raw_write(regmap, init_reg, val, val_len);
 }
 
 /* --- */
@@ -414,14 +391,14 @@ static inline int io_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv76xx_state *state = to_state(sd);
 
-   return adv_smbus_read_byte_data(state, ADV76XX_PAGE_IO, reg);
+   return adv76xx_read_check(state, ADV76XX_PAGE_IO, reg);
 }
 
 static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
struct adv76xx_state

[PATCH 3.4 020/172] tty: Prevent untrappable signals from malicious program

2015-06-16 Thread lizf
From: Peter Hurley 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 37480a05685ed5b8e1b9bf5e5c53b5810258b149 upstream.

Commit 26df6d13406d1a5 ("tty: Add EXTPROC support for LINEMODE")
allows a process which has opened a pty master to send _any_ signal
to the process group of the pty slave. Although potentially
exploitable by a malicious program running a setuid program on
a pty slave, it's unknown if this exploit currently exists.

Limit to signals actually used.

Cc: Theodore Ts'o 
Cc: Howard Chu 
Cc: One Thousand Gnomes 
Cc: Jiri Slaby 
Signed-off-by: Peter Hurley 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Zefan Li 
---
 drivers/tty/pty.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index cf9a191..bc955d7 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -173,6 +173,9 @@ static int pty_signal(struct tty_struct *tty, int sig)
unsigned long flags;
struct pid *pgrp;
 
+   if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP)
+   return -EINVAL;
+
if (tty->link) {
spin_lock_irqsave(&tty->link->ctrl_lock, flags);
pgrp = get_pid(tty->link->pgrp);
-- 
1.9.1

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


[PATCH 3.4 018/172] USB: fix use-after-free bug in usb_hcd_unlink_urb()

2015-06-16 Thread lizf
From: Alan Stern 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit c99197902da284b4b723451c1471c45b18537cde upstream.

The usb_hcd_unlink_urb() routine in hcd.c contains two possible
use-after-free errors.  The dev_dbg() statement at the end of the
routine dereferences urb and urb->dev even though both structures may
have been deallocated.

This patch fixes the problem by storing urb->dev in a local variable
(avoiding the dereference of urb) and moving the dev_dbg() up before
the usb_put_dev() call.

Signed-off-by: Alan Stern 
Reported-by: Joe Lawrence 
Tested-by: Joe Lawrence 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Zefan Li 
---
 drivers/usb/core/hcd.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 6baeada..f1d0e3c 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1528,6 +1528,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, 
int status)
 int usb_hcd_unlink_urb (struct urb *urb, int status)
 {
struct usb_hcd  *hcd;
+   struct usb_device   *udev = urb->dev;
int retval = -EIDRM;
unsigned long   flags;
 
@@ -1539,20 +1540,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
spin_lock_irqsave(&hcd_urb_unlink_lock, flags);
if (atomic_read(&urb->use_count) > 0) {
retval = 0;
-   usb_get_dev(urb->dev);
+   usb_get_dev(udev);
}
spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags);
if (retval == 0) {
hcd = bus_to_hcd(urb->dev->bus);
retval = unlink1(hcd, urb, status);
-   usb_put_dev(urb->dev);
+   if (retval == 0)
+   retval = -EINPROGRESS;
+   else if (retval != -EIDRM && retval != -EBUSY)
+   dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n",
+   urb, retval);
+   usb_put_dev(udev);
}
-
-   if (retval == 0)
-   retval = -EINPROGRESS;
-   else if (retval != -EIDRM && retval != -EBUSY)
-   dev_dbg(&urb->dev->dev, "hcd_unlink_urb %p fail %d\n",
-   urb, retval);
return retval;
 }
 
-- 
1.9.1

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


[PATCH 3.4 017/172] USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)

2015-06-16 Thread lizf
From: Alan Stern 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 074f9dd55f9cab1b82690ed7e44bcf38b9616ce0 upstream.

Currently the USB stack assumes that all host controller drivers are
capable of receiving wakeup requests from downstream devices.
However, this isn't true for the isp1760-hcd driver, which means that
it isn't safe to do a runtime suspend of any device attached to a
root-hub port if the device requires wakeup.

This patch adds a "cant_recv_wakeups" flag to the usb_hcd structure
and sets the flag in isp1760-hcd.  The core is modified to prevent a
direct child of the root hub from being put into runtime suspend with
wakeup enabled if the flag is set.

Signed-off-by: Alan Stern 
Tested-by: Nicolas Pitre 
Signed-off-by: Greg Kroah-Hartman 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 drivers/usb/core/driver.c  | 12 
 drivers/usb/host/isp1760-hcd.c |  3 +++
 include/linux/usb/hcd.h|  1 +
 3 files changed, 16 insertions(+)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 35bc3ba..621ea00 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1686,6 +1686,18 @@ static int autosuspend_check(struct usb_device *udev)
dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n");
return -EOPNOTSUPP;
}
+
+   /*
+* If the device is a direct child of the root hub and the HCD
+* doesn't handle wakeup requests, don't allow autosuspend when
+* wakeup is needed.
+*/
+   if (w && udev->parent == udev->bus->root_hub &&
+   bus_to_hcd(udev->bus)->cant_recv_wakeups) {
+   dev_dbg(&udev->dev, "HCD doesn't handle wakeup requests\n");
+   return -EOPNOTSUPP;
+   }
+
udev->do_remote_wakeup = w;
return 0;
 }
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index fc72d44..949303f 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -2242,6 +2242,9 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, 
resource_size_t res_len,
hcd->rsrc_start = res_start;
hcd->rsrc_len = res_len;
 
+   /* This driver doesn't support wakeup requests */
+   hcd->cant_recv_wakeups = 1;
+
ret = usb_add_hcd(hcd, irq, irqflags);
if (ret)
goto err_unmap;
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 6674ec0..feb77716 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -126,6 +126,7 @@ struct usb_hcd {
unsignedwireless:1; /* Wireless USB HCD */
unsignedauthorized_default:1;
unsignedhas_tt:1;   /* Integrated TT in root hub */
+   unsignedcant_recv_wakeups:1;
 
unsigned intirq;/* irq allocated */
void __iomem*regs;  /* device memory/io */
-- 
1.9.1

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


[PATCH 3.4 015/172] xprtrdma: Free the pd if ib_query_qp() fails

2015-06-16 Thread lizf
From: Chuck Lever 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 5ae711a24601257f395c1f8746ac95be0cbd75e5 upstream.

If ib_query_qp() fails or the memory registration mode isn't
supported, don't leak the PD. An orphaned IB/core resource will
cause IB module removal to hang.

Fixes: bd7ed1d13304 ("RPC/RDMA: check selected memory registration ...")
Signed-off-by: Chuck Lever 
Reviewed-by: Steve Wise 
Signed-off-by: Anna Schumaker 
[lizf: Backported to 3.4: only two goto statements need to be changed]
Signed-off-by: Zefan Li 
---
 net/sunrpc/xprtrdma/verbs.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 745973b..5547bd8 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -485,7 +485,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr 
*addr, int memreg)
if (rc) {
dprintk("RPC:   %s: ib_query_device failed %d\n",
__func__, rc);
-   goto out2;
+   goto out3;
}
 
if (devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) {
@@ -587,7 +587,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr 
*addr, int memreg)
printk(KERN_ERR "%s: invalid memory registration mode %d\n",
__func__, memreg);
rc = -EINVAL;
-   goto out2;
+   goto out3;
}
dprintk("RPC:   %s: memory registration strategy is %d\n",
__func__, memreg);
@@ -596,6 +596,10 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr 
*addr, int memreg)
ia->ri_memreg_strategy = memreg;
 
return 0;
+
+out3:
+   ib_dealloc_pd(ia->ri_pd);
+   ia->ri_pd = NULL;
 out2:
rdma_destroy_id(ia->ri_id);
ia->ri_id = NULL;
-- 
1.9.1

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


[PATCH v3 0/5] serial/8250_fintek Support any configuration

2015-06-16 Thread Ricardo Ribalda Delgado
The original driver only supported the default configuration of the chip.

This patchset add supports for all the possible configurations:
-Different io address
-Multiple chips
-Different chip_ids

Patchset can be viewed online at
https://github.com/ribalda/linux/tree/8250_fintek_try3

v3: Error found by Peter Hong 

Fix memset after initialization.


v2: Fix comments by Alan Cox 

Replace blah foo[] = { 1,2,3,4 }; with
static const blah foo[] = { 1,2,3,4 };

Reported-by: Peter Hong 

Ricardo Ribalda Delgado (5):
  serial/8250_fintek: Use private data structure
  serial/8250_fintek: Support for multiple base_ports
  serial/8250_fintek: Support for chip_ip 0x0501
  serial/8250_fintek: Support keys different than default
  serial/8250_fintek: Support for any io address.

 drivers/tty/serial/8250/8250_fintek.c | 172 +-
 1 file changed, 107 insertions(+), 65 deletions(-)

-- 
2.1.4

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


[PATCH 3.4 016/172] cdc-acm: add sanity checks

2015-06-16 Thread lizf
From: Oliver Neukum 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 7e860a6e7aa62b337a61110430cd633db5b0d2dd upstream.

Check the special CDC headers for a plausible minimum length.
Another big operating systems ignores such garbage.

Signed-off-by: Oliver Neukum 
Reviewed-by: Adam Lee 
Tested-by: Adam Lee 
Signed-off-by: Greg Kroah-Hartman 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 drivers/usb/class/cdc-acm.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 0532577..57877a9 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1008,6 +1008,7 @@ static int acm_probe(struct usb_interface *intf,
unsigned long quirks;
int num_rx_buf;
int i;
+   unsigned int elength = 0;
int combined_interfaces = 0;
 
/* normal quirks */
@@ -1047,9 +1048,12 @@ static int acm_probe(struct usb_interface *intf,
dev_err(&intf->dev, "skipping garbage\n");
goto next_desc;
}
+   elength = buffer[0];
 
switch (buffer[2]) {
case USB_CDC_UNION_TYPE: /* we've found it */
+   if (elength < sizeof(struct usb_cdc_union_desc))
+   goto next_desc;
if (union_header) {
dev_err(&intf->dev, "More than one "
"union descriptor, skipping ...\n");
@@ -1058,31 +1062,38 @@ static int acm_probe(struct usb_interface *intf,
union_header = (struct usb_cdc_union_desc *)buffer;
break;
case USB_CDC_COUNTRY_TYPE: /* export through sysfs*/
+   if (elength < sizeof(struct 
usb_cdc_country_functional_desc))
+   goto next_desc;
cfd = (struct usb_cdc_country_functional_desc *)buffer;
break;
case USB_CDC_HEADER_TYPE: /* maybe check version */
break; /* for now we ignore it */
case USB_CDC_ACM_TYPE:
+   if (elength < 4)
+   goto next_desc;
ac_management_function = buffer[3];
break;
case USB_CDC_CALL_MANAGEMENT_TYPE:
+   if (elength < 5)
+   goto next_desc;
call_management_function = buffer[3];
call_interface_num = buffer[4];
if ( (quirks & NOT_A_MODEM) == 0 && 
(call_management_function & 3) != 3)
dev_err(&intf->dev, "This device cannot do 
calls on its own. It is not a modem.\n");
break;
default:
-   /* there are LOTS more CDC descriptors that
+   /*
+* there are LOTS more CDC descriptors that
 * could legitimately be found here.
 */
dev_dbg(&intf->dev, "Ignoring descriptor: "
-   "type %02x, length %d\n",
-   buffer[2], buffer[0]);
+   "type %02x, length %ud\n",
+   buffer[2], elength);
break;
}
 next_desc:
-   buflen -= buffer[0];
-   buffer += buffer[0];
+   buflen -= elength;
+   buffer += elength;
}
 
if (!union_header) {
-- 
1.9.1

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


[PATCH 3.4 026/172] cpufreq: speedstep-smi: enable interrupts when waiting

2015-06-16 Thread lizf
From: Mikulas Patocka 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit d4d4eda23794c701442e55129dd4f8f2fefd5e4d upstream.

On Dell Latitude C600 laptop with Pentium 3 850MHz processor, the
speedstep-smi driver sometimes loads and sometimes doesn't load with
"change to state X failed" message.

The hardware sometimes refuses to change frequency and in this case, we
need to retry later. I found out that we need to enable interrupts while
waiting. When we enable interrupts, the hardware blockage that prevents
frequency transition resolves and the transition is possible. With
disabled interrupts, the blockage doesn't resolve (no matter how long do
we wait). The exact reasons for this hardware behavior are unknown.

This patch enables interrupts in the function speedstep_set_state that can
be called with disabled interrupts. However, this function is called with
disabled interrupts only from speedstep_get_freqs, so it shouldn't cause
any problem.

Signed-off-by: Mikulas Patocka 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Zefan Li 
---
 drivers/cpufreq/speedstep-lib.c |  3 +++
 drivers/cpufreq/speedstep-smi.c | 12 
 2 files changed, 15 insertions(+)

diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
index 7047821..4ab7a21 100644
--- a/drivers/cpufreq/speedstep-lib.c
+++ b/drivers/cpufreq/speedstep-lib.c
@@ -400,6 +400,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor 
processor,
 
pr_debug("previous speed is %u\n", prev_speed);
 
+   preempt_disable();
local_irq_save(flags);
 
/* switch to low state */
@@ -464,6 +465,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor 
processor,
 
 out:
local_irq_restore(flags);
+   preempt_enable();
+
return ret;
 }
 EXPORT_SYMBOL_GPL(speedstep_get_freqs);
diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c
index 6a457fc..b01926d 100644
--- a/drivers/cpufreq/speedstep-smi.c
+++ b/drivers/cpufreq/speedstep-smi.c
@@ -188,6 +188,7 @@ static void speedstep_set_state(unsigned int state)
return;
 
/* Disable IRQs */
+   preempt_disable();
local_irq_save(flags);
 
command = (smi_sig & 0xff00) | (smi_cmd & 0xff);
@@ -198,9 +199,19 @@ static void speedstep_set_state(unsigned int state)
 
do {
if (retry) {
+   /*
+* We need to enable interrupts, otherwise the blockage
+* won't resolve.
+*
+* We disable preemption so that other processes don't
+* run. If other processes were running, they could
+* submit more DMA requests, making the blockage worse.
+*/
pr_debug("retry %u, previous result %u, waiting...\n",
retry, result);
+   local_irq_enable();
mdelay(retry * 50);
+   local_irq_disable();
}
retry++;
__asm__ __volatile__(
@@ -217,6 +228,7 @@ static void speedstep_set_state(unsigned int state)
 
/* enable IRQs */
local_irq_restore(flags);
+   preempt_enable();
 
if (new_state == state)
pr_debug("change to %u MHz succeeded after %u tries "
-- 
1.9.1

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


[PATCH v3 1/5] serial/8250_fintek: Use private data structure

2015-06-16 Thread Ricardo Ribalda Delgado
Save the port index and the line id in a private structure.

Reported-by: Peter Hong 
Reviewed-by: Alan Cox 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/tty/serial/8250/8250_fintek.c | 48 ++-
 1 file changed, 31 insertions(+), 17 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_fintek.c 
b/drivers/tty/serial/8250/8250_fintek.c
index 5815e81b5fc6..76d739bb5d1f 100644
--- a/drivers/tty/serial/8250/8250_fintek.c
+++ b/drivers/tty/serial/8250/8250_fintek.c
@@ -39,6 +39,11 @@
 
 #define DRIVER_NAME "8250_fintek"
 
+struct fintek_8250 {
+   u8 index;
+   long line;
+};
+
 static int fintek_8250_enter_key(void){
 
if (!request_muxed_region(ADDR_PORT, 2, DRIVER_NAME))
@@ -93,9 +98,9 @@ static int fintek_8250_rs485_config(struct uart_port *port,
  struct serial_rs485 *rs485)
 {
uint8_t config = 0;
-   int index = fintek_8250_get_index(port->iobase);
+   struct fintek_8250 *pdata = port->private_data;
 
-   if (index < 0)
+   if (!pdata)
return -EINVAL;
 
if (rs485->flags & SER_RS485_ENABLED)
@@ -129,7 +134,7 @@ static int fintek_8250_rs485_config(struct uart_port *port,
return -EBUSY;
 
outb(LDN, ADDR_PORT);
-   outb(index, DATA_PORT);
+   outb(pdata->index, DATA_PORT);
outb(RS485, ADDR_PORT);
outb(config, DATA_PORT);
fintek_8250_exit_key();
@@ -142,14 +147,16 @@ static int fintek_8250_rs485_config(struct uart_port 
*port,
 static int
 fintek_8250_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 {
-   int line;
struct uart_8250_port uart;
+   struct fintek_8250 *pdata;
int ret;
+   int index;
 
if (!pnp_port_valid(dev, 0))
return -ENODEV;
 
-   if (fintek_8250_get_index(pnp_port_start(dev, 0)) < 0)
+   index = fintek_8250_get_index(pnp_port_start(dev, 0));
+   if (index < 0)
return -ENODEV;
 
/* Enable configuration registers*/
@@ -163,6 +170,12 @@ fintek_8250_probe(struct pnp_dev *dev, const struct 
pnp_device_id *dev_id)
return ret;
 
memset(&uart, 0, sizeof(uart));
+
+   pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return -ENOMEM;
+   uart.port.private_data = pdata;
+
if (!pnp_irq_valid(dev, 0))
return -ENODEV;
uart.port.irq = pnp_irq(dev, 0);
@@ -176,40 +189,41 @@ fintek_8250_probe(struct pnp_dev *dev, const struct 
pnp_device_id *dev_id)
uart.port.uartclk = 1843200;
uart.port.dev = &dev->dev;
 
-   line = serial8250_register_8250_port(&uart);
-   if (line < 0)
+   pdata->index = index;
+   pdata->line = serial8250_register_8250_port(&uart);
+   if (pdata->line < 0)
return -ENODEV;
 
-   pnp_set_drvdata(dev, (void *)((long)line + 1));
+   pnp_set_drvdata(dev, pdata);
return 0;
 }
 
 static void fintek_8250_remove(struct pnp_dev *dev)
 {
-   long line = (long)pnp_get_drvdata(dev);
+   struct fintek_8250 *pdata = pnp_get_drvdata(dev);
 
-   if (line)
-   serial8250_unregister_port(line - 1);
+   if (pdata)
+   serial8250_unregister_port(pdata->line);
 }
 
 #ifdef CONFIG_PM
 static int fintek_8250_suspend(struct pnp_dev *dev, pm_message_t state)
 {
-   long line = (long)pnp_get_drvdata(dev);
+   struct fintek_8250 *pdata = pnp_get_drvdata(dev);
 
-   if (!line)
+   if (!pdata)
return -ENODEV;
-   serial8250_suspend_port(line - 1);
+   serial8250_suspend_port(pdata->line);
return 0;
 }
 
 static int fintek_8250_resume(struct pnp_dev *dev)
 {
-   long line = (long)pnp_get_drvdata(dev);
+   struct fintek_8250 *pdata = pnp_get_drvdata(dev);
 
-   if (!line)
+   if (!pdata)
return -ENODEV;
-   serial8250_resume_port(line - 1);
+   serial8250_resume_port(pdata->line);
return 0;
 }
 #else
-- 
2.1.4

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


[PATCH 3.4 045/172] kdb: fix incorrect counts in KDB summary command output

2015-06-16 Thread lizf
From: Jay Lan 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 146755923262037fc4c54abc28c04b1103f3cc51 upstream.

The output of KDB 'summary' command should report MemTotal, MemFree
and Buffers output in kB. Current codes report in unit of pages.

A define of K(x) as
is defined in the code, but not used.

This patch would apply the define to convert the values to kB.
Please include me on Cc on replies. I do not subscribe to linux-kernel.

Signed-off-by: Jay Lan 
Signed-off-by: Jason Wessel 
Signed-off-by: Zefan Li 
---
 kernel/debug/kdb/kdb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 67b847d..d1342c2 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2598,7 +2598,7 @@ static int kdb_summary(int argc, const char **argv)
 #define K(x) ((x) << (PAGE_SHIFT - 10))
kdb_printf("\nMemTotal:   %8lu kB\nMemFree:%8lu kB\n"
   "Buffers:%8lu kB\n",
-  val.totalram, val.freeram, val.bufferram);
+  K(val.totalram), K(val.freeram), K(val.bufferram));
return 0;
 }
 
-- 
1.9.1

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


[PATCH 3.4 027/172] mm/hugetlb: fix getting refcount 0 page in hugetlb_fault()

2015-06-16 Thread lizf
From: Naoya Horiguchi 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 0f792cf949a0be506c2aa8bfac0605746b146dda upstream.

When running the test which causes the race as shown in the previous patch,
we can hit the BUG "get_page() on refcount 0 page" in hugetlb_fault().

This race happens when pte turns into migration entry just after the first
check of is_hugetlb_entry_migration() in hugetlb_fault() passed with false.
To fix this, we need to check pte_present() again after huge_ptep_get().

This patch also reorders taking ptl and doing pte_page(), because
pte_page() should be done in ptl.  Due to this reordering, we need use
trylock_page() in page != pagecache_page case to respect locking order.

Fixes: 66aebce747ea ("hugetlb: fix race condition in hugetlb_fault()")
Signed-off-by: Naoya Horiguchi 
Cc: Hugh Dickins 
Cc: James Hogan 
Cc: David Rientjes 
Cc: Mel Gorman 
Cc: Johannes Weiner 
Cc: Michal Hocko 
Cc: Rik van Riel 
Cc: Andrea Arcangeli 
Cc: Luiz Capitulino 
Cc: Nishanth Aravamudan 
Cc: Lee Schermerhorn 
Cc: Steve Capper 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
[lizf: Backported to 3.4:
 - adjust context
 - there's no huge_pte_lock, so lock mm->page_table_lock directly
 - the lable should be out_page_table_lock instead of out_ptl]
Signed-off-by: Zefan Li 
---
 mm/hugetlb.c | 36 +++-
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index efd6820..d02fbbc 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2813,6 +2813,7 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
struct page *pagecache_page = NULL;
static DEFINE_MUTEX(hugetlb_instantiation_mutex);
struct hstate *h = hstate_vma(vma);
+   int need_wait_lock = 0;
 
address &= huge_page_mask(h);
 
@@ -2846,6 +2847,16 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
ret = 0;
 
/*
+* entry could be a migration/hwpoison entry at this point, so this
+* check prevents the kernel from going below assuming that we have
+* a active hugepage in pagecache. This goto expects the 2nd page fault,
+* and is_hugetlb_entry_(migration|hwpoisoned) check will properly
+* handle it.
+*/
+   if (!pte_present(entry))
+   goto out_mutex;
+
+   /*
 * If we are going to COW the mapping later, we examine the pending
 * reservations for this page now. This will ensure that any
 * allocations necessary to record that reservation occur outside the
@@ -2864,29 +2875,32 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
vma, address);
}
 
+   spin_lock(&mm->page_table_lock);
+
+   /* Check for a racing update before calling hugetlb_cow */
+   if (unlikely(!pte_same(entry, huge_ptep_get(ptep
+   goto out_page_table_lock;
+
/*
 * hugetlb_cow() requires page locks of pte_page(entry) and
 * pagecache_page, so here we need take the former one
 * when page != pagecache_page or !pagecache_page.
-* Note that locking order is always pagecache_page -> page,
-* so no worry about deadlock.
 */
page = pte_page(entry);
-   get_page(page);
if (page != pagecache_page)
-   lock_page(page);
+   if (!trylock_page(page)) {
+   need_wait_lock = 1;
+   goto out_page_table_lock;
+   }
 
-   spin_lock(&mm->page_table_lock);
-   /* Check for a racing update before calling hugetlb_cow */
-   if (unlikely(!pte_same(entry, huge_ptep_get(ptep
-   goto out_page_table_lock;
+   get_page(page);
 
 
if (flags & FAULT_FLAG_WRITE) {
if (!pte_write(entry)) {
ret = hugetlb_cow(mm, vma, address, ptep, entry,
pagecache_page);
-   goto out_page_table_lock;
+   goto out_put_page;
}
entry = pte_mkdirty(entry);
}
@@ -2895,6 +2909,10 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
flags & FAULT_FLAG_WRITE))
update_mmu_cache(vma, address, ptep);
 
+out_put_page:
+   if (page != pagecache_page)
+   unlock_page(page);
+   put_page(page);
 out_page_table_lock:
spin_unlock(&mm->page_table_lock);
 
-- 
1.9.1

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


[PATCH 3.4 030/172] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory()

2015-06-16 Thread lizf
From: Roman Gushchin 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 5703b087dc8eaf47bfb399d6cf512d471beff405 upstream.

I noticed, that "allowed" can easily overflow by falling below 0,
because (total_vm / 32) can be larger than "allowed".  The problem
occurs in OVERCOMMIT_NONE mode.

In this case, a huge allocation can success and overcommit the system
(despite OVERCOMMIT_NONE mode).  All subsequent allocations will fall
(system-wide), so system become unusable.

The problem was masked out by commit c9b1d0981fcc
("mm: limit growth of 3% hardcoded other user reserve"),
but it's easy to reproduce it on older kernels:
1) set overcommit_memory sysctl to 2
2) mmap() large file multiple times (with VM_SHARED flag)
3) try to malloc() large amount of memory

It also can be reproduced on newer kernels, but miss-configured
sysctl_user_reserve_kbytes is required.

Fix this issue by switching to signed arithmetic here.

[a...@linux-foundation.org: use min_t]
Signed-off-by: Roman Gushchin 
Cc: Andrew Shewmaker 
Cc: Rik van Riel 
Cc: Konstantin Khlebnikov 
Reviewed-by: Michal Hocko 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
[lizf: Backported to 3.4:
 - adjust context
 - there's no variable reserve]
Signed-off-by: Zefan Li 
---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 208e70f..cb6456d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -112,7 +112,7 @@ struct percpu_counter vm_committed_as 
cacheline_aligned_in_smp;
  */
 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 {
-   unsigned long free, allowed;
+   long free, allowed;
 
vm_acct_memory(pages);
 
-- 
1.9.1

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


[PATCH 3.4 032/172] iscsi-target: Drop problematic active_ts_list usage

2015-06-16 Thread lizf
From: Nicholas Bellinger 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 3fd7b60f2c7418239d586e359e0c6d8503e10646 upstream.

This patch drops legacy active_ts_list usage within iscsi_target_tq.c
code.  It was originally used to track the active thread sets during
iscsi-target shutdown, and is no longer used by modern upstream code.

Two people have reported list corruption using traditional iscsi-target
and iser-target with the following backtrace, that appears to be related
to iscsi_thread_set->ts_list being used across both active_ts_list and
inactive_ts_list.

[   60.782534] [ cut here ]
[   60.782543] WARNING: CPU: 0 PID: 9430 at lib/list_debug.c:53 
__list_del_entry+0x63/0xd0()
[   60.782545] list_del corruption, 88045b00d180->next is LIST_POISON1 
(dead00100100)
[   60.782546] Modules linked in: ib_srpt tcm_qla2xxx qla2xxx tcm_loop tcm_fc 
libfc scsi_transport_fc scsi_tgt ib_isert rdma_cm iw_cm ib_addr 
iscsi_target_mod target_core_pscsi target_core_file target_core_iblock 
target_core_mod configfs ebtable_nat ebtables ipt_MASQUERADE iptable_nat 
nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 ipt_REJECT xt_CHECKSUM 
iptable_mangle iptable_filter ip_tables bridge stp llc autofs4 sunrpc 
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack 
ip6table_filter ip6_tables ipv6 ib_ipoib ib_cm ib_uverbs ib_umad mlx4_en 
mlx4_ib ib_sa ib_mad ib_core mlx4_core dm_mirror dm_region_hash dm_log dm_mod 
vhost_net macvtap macvlan vhost tun kvm_intel kvm uinput iTCO_wdt 
iTCO_vendor_support microcode serio_raw pcspkr sb_edac edac_core sg i2c_i801 
lpc_ich mfd_core mtip32xx igb i2c_algo_bit i2c_core ptp pps_core ioatdma dca 
wmi ext3(F) jbd(F) mbcache(F) sd_mod(F) crc_t10dif(F) crct10dif_common(F) 
ahci(F) libahci(F) isci(F) libsas(F) scsi_trans
 port_sas(F) [last unloaded: speedstep_lib]
[   60.782597] CPU: 0 PID: 9430 Comm: iscsi_ttx Tainted: GF 3.12.19+ #2
[   60.782598] Hardware name: Supermicro X9DRX+-F/X9DRX+-F, BIOS 3.00 07/09/2013
[   60.782599]  0035 88044de31d08 81553ae7 
0035
[   60.782602]  88044de31d58 88044de31d48 8104d1cc 
0002
[   60.782605]  88045b00d180 88045b00d0c0 88045b00d0c0 
88044de31e58
[   60.782607] Call Trace:
[   60.782611]  [] dump_stack+0x49/0x62
[   60.782615]  [] warn_slowpath_common+0x8c/0xc0
[   60.782618]  [] warn_slowpath_fmt+0x46/0x50
[   60.782620]  [] __list_del_entry+0x63/0xd0
[   60.782622]  [] list_del+0x11/0x40
[   60.782630]  [] iscsi_del_ts_from_active_list+0x29/0x50 
[iscsi_target_mod]
[   60.782635]  [] iscsi_tx_thread_pre_handler+0xa1/0x180 
[iscsi_target_mod]
[   60.782642]  [] iscsi_target_tx_thread+0x4e/0x220 
[iscsi_target_mod]
[   60.782647]  [] ? iscsit_handle_snack+0x190/0x190 
[iscsi_target_mod]
[   60.782652]  [] ? iscsit_handle_snack+0x190/0x190 
[iscsi_target_mod]
[   60.782655]  [] kthread+0xce/0xe0
[   60.782657]  [] ? kthread_freezable_should_stop+0x70/0x70
[   60.782660]  [] ret_from_fork+0x7c/0xb0
[   60.782662]  [] ? kthread_freezable_should_stop+0x70/0x70
[   60.782663] ---[ end trace 9662f4a661d33965 ]---

Since this code is no longer used, go ahead and drop the problematic usage
all-together.

Reported-by: Gavin Guo 
Reported-by: Moussa Ba 
Signed-off-by: Nicholas Bellinger 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 drivers/target/iscsi/iscsi_target_tq.c | 28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_tq.c 
b/drivers/target/iscsi/iscsi_target_tq.c
index 977e1cf..4f447fd 100644
--- a/drivers/target/iscsi/iscsi_target_tq.c
+++ b/drivers/target/iscsi/iscsi_target_tq.c
@@ -26,36 +26,22 @@
 #include "iscsi_target_tq.h"
 #include "iscsi_target.h"
 
-static LIST_HEAD(active_ts_list);
 static LIST_HEAD(inactive_ts_list);
-static DEFINE_SPINLOCK(active_ts_lock);
 static DEFINE_SPINLOCK(inactive_ts_lock);
 static DEFINE_SPINLOCK(ts_bitmap_lock);
 
-static void iscsi_add_ts_to_active_list(struct iscsi_thread_set *ts)
-{
-   spin_lock(&active_ts_lock);
-   list_add_tail(&ts->ts_list, &active_ts_list);
-   iscsit_global->active_ts++;
-   spin_unlock(&active_ts_lock);
-}
-
 extern void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts)
 {
+   if (!list_empty(&ts->ts_list)) {
+   WARN_ON(1);
+   return;
+   }
spin_lock(&inactive_ts_lock);
list_add_tail(&ts->ts_list, &inactive_ts_list);
iscsit_global->inactive_ts++;
spin_unlock(&inactive_ts_lock);
 }
 
-static void iscsi_del_ts_from_active_list(struct iscsi_thread_set *ts)
-{
-   spin_lock(&active_ts_lock);
-   list_del(&ts->ts_list);
-   iscsit_global->active_ts--;
-   spin_unlock(&active_ts_lock);
-}
-
 static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
 {
struct iscsi_thread_set *ts;
@@

[PATCH 3.4 031/172] mm/nommu.c: fix arithmetic overflow in __vm_enough_memory()

2015-06-16 Thread lizf
From: Roman Gushchin 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 8138a67a5557ffea3a21dfd6f037842d4e748513 upstream.

I noticed that "allowed" can easily overflow by falling below 0, because
(total_vm / 32) can be larger than "allowed".  The problem occurs in
OVERCOMMIT_NONE mode.

In this case, a huge allocation can success and overcommit the system
(despite OVERCOMMIT_NONE mode).  All subsequent allocations will fall
(system-wide), so system become unusable.

The problem was masked out by commit c9b1d0981fcc
("mm: limit growth of 3% hardcoded other user reserve"),
but it's easy to reproduce it on older kernels:
1) set overcommit_memory sysctl to 2
2) mmap() large file multiple times (with VM_SHARED flag)
3) try to malloc() large amount of memory

It also can be reproduced on newer kernels, but miss-configured
sysctl_user_reserve_kbytes is required.

Fix this issue by switching to signed arithmetic here.

Signed-off-by: Roman Gushchin 
Cc: Andrew Shewmaker 
Cc: Rik van Riel 
Cc: Konstantin Khlebnikov 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
[lizf: Backported to 3.4:
 - adjust context
 - there's no variable reserve]
Signed-off-by: Zefan Li 
---
 mm/nommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index d3afb47..3f282f9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1916,7 +1916,7 @@ EXPORT_SYMBOL(unmap_mapping_range);
  */
 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 {
-   unsigned long free, allowed;
+   long free, allowed;
 
vm_acct_memory(pages);
 
-- 
1.9.1

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


[PATCH 3.4 046/172] debugfs: leave freeing a symlink body until inode eviction

2015-06-16 Thread lizf
From: Al Viro 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 0db59e59299f0b67450c5db21f7f316c8fb04e84 upstream.

As it is, we have debugfs_remove() racing with symlink traversals.
Supply ->evict_inode() and do freeing there - inode will remain
pinned until we are done with the symlink body.

And rip the idiocy with checking if dentry is positive right after
we'd verified debugfs_positive(), which is a stronger check...

Signed-off-by: Al Viro 
[lizf: Backported to 3.4:
 - call end_writeback() instead of clear_inode()
 - call truncate_inode_pages() instead of truncate_inode_pages_final()]
Signed-off-by: Zefan Li 
---
 fs/debugfs/inode.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 47d64e9..7b65755 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -238,10 +238,19 @@ static int debugfs_show_options(struct seq_file *m, 
struct dentry *root)
return 0;
 }
 
+static void debugfs_evict_inode(struct inode *inode)
+{
+   truncate_inode_pages(&inode->i_data, 0);
+   end_writeback(inode);
+   if (S_ISLNK(inode->i_mode))
+   kfree(inode->i_private);
+}
+
 static const struct super_operations debugfs_super_operations = {
.statfs = simple_statfs,
.remount_fs = debugfs_remount,
.show_options   = debugfs_show_options,
+   .evict_inode= debugfs_evict_inode,
 };
 
 static int debug_fill_super(struct super_block *sb, void *data, int silent)
@@ -459,23 +468,14 @@ static int __debugfs_remove(struct dentry *dentry, struct 
dentry *parent)
int ret = 0;
 
if (debugfs_positive(dentry)) {
-   if (dentry->d_inode) {
-   dget(dentry);
-   switch (dentry->d_inode->i_mode & S_IFMT) {
-   case S_IFDIR:
-   ret = simple_rmdir(parent->d_inode, dentry);
-   break;
-   case S_IFLNK:
-   kfree(dentry->d_inode->i_private);
-   /* fall through */
-   default:
-   simple_unlink(parent->d_inode, dentry);
-   break;
-   }
-   if (!ret)
-   d_delete(dentry);
-   dput(dentry);
-   }
+   dget(dentry);
+   if (S_ISDIR(dentry->d_inode->i_mode))
+   ret = simple_rmdir(parent->d_inode, dentry);
+   else
+   simple_unlink(parent->d_inode, dentry);
+   if (!ret)
+   d_delete(dentry);
+   dput(dentry);
}
return ret;
 }
-- 
1.9.1

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


[PATCH 3.4 047/172] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation

2015-06-16 Thread lizf
From: Al Viro 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 0a280962dc6e117e0e4baa668453f753579265d9 upstream.

X-Coverup: just ask spender
Signed-off-by: Al Viro 
Signed-off-by: Zefan Li 
---
 fs/autofs4/dev-ioctl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index aa9103f..fbaa428 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct 
autofs_dev_ioctl *param)
  */
 static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user 
*in)
 {
-   struct autofs_dev_ioctl tmp;
+   struct autofs_dev_ioctl tmp, *res;
 
if (copy_from_user(&tmp, in, sizeof(tmp)))
return ERR_PTR(-EFAULT);
@@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct 
autofs_dev_ioctl __user *i
if (tmp.size < sizeof(tmp))
return ERR_PTR(-EINVAL);
 
-   return memdup_user(in, tmp.size);
+   res = memdup_user(in, tmp.size);
+   if (!IS_ERR(res))
+   res->size = tmp.size;
+
+   return res;
 }
 
 static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)
-- 
1.9.1

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


[PATCH 3.4 033/172] mm/memory.c: actually remap enough memory

2015-06-16 Thread lizf
From: Grazvydas Ignotas 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 9cb12d7b4ccaa976f97ce0c5fd0f1b6a83bc2a75 upstream.

For whatever reason, generic_access_phys() only remaps one page, but
actually allows to access arbitrary size.  It's quite easy to trigger
large reads, like printing out large structure with gdb, which leads to a
crash.  Fix it by remapping correct size.

Fixes: 28b2ee20c7cb ("access_process_vm device memory infrastructure")
Signed-off-by: Grazvydas Ignotas 
Cc: Rik van Riel 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Zefan Li 
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index 45cd14f..02aef93 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3845,7 +3845,7 @@ int generic_access_phys(struct vm_area_struct *vma, 
unsigned long addr,
if (follow_phys(vma, addr, write, &prot, &phys_addr))
return -EINVAL;
 
-   maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot);
+   maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
if (write)
memcpy_toio(maddr + offset, buf, len);
else
-- 
1.9.1

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


[PATCH 3.4 041/172] sg: fix read() error reporting

2015-06-16 Thread lizf
From: Tony Battersby 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 3b524a683af8991b4eab4182b947c65f0ce1421b upstream.

Fix SCSI generic read() incorrectly returning success after detecting an
error.

Signed-off-by: Tony Battersby 
Acked-by: Douglas Gilbert 
Signed-off-by: James Bottomley 
Signed-off-by: Zefan Li 
---
 drivers/scsi/sg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index eacd46b..fb119ce 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -498,7 +498,7 @@ static ssize_t
 sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 {
sg_io_hdr_t *hp = &srp->header;
-   int err = 0;
+   int err = 0, err2;
int len;
 
if (count < SZ_SG_IO_HDR) {
@@ -527,8 +527,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, 
Sg_request * srp)
goto err_out;
}
 err_out:
-   err = sg_finish_rem_req(srp);
-   return (0 == err) ? count : err;
+   err2 = sg_finish_rem_req(srp);
+   return err ? : err2 ? : count;
 }
 
 static ssize_t
-- 
1.9.1

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


[PATCH 3.4 058/172] USB: serial: fix tty-device error handling at probe

2015-06-16 Thread lizf
From: Johan Hovold 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit ca4383a3947a83286bc9b9c598a1f55e867871d7 upstream.

Add missing error handling when registering the tty device at port
probe. This avoids trying to remove an uninitialised character device
when the port device is removed.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Takashi Iwai 
Signed-off-by: Johan Hovold 
Acked-by: Greg Kroah-Hartman 
[lizf: Backported to 3.4:
 - adjust context
 - s/goto exit_with_autopm/goto exit]
Signed-off-by: Zefan Li 
---
 drivers/usb/serial/bus.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 1b59665..358d2d6 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -52,6 +52,7 @@ static int usb_serial_device_probe(struct device *dev)
 {
struct usb_serial_driver *driver;
struct usb_serial_port *port;
+   struct device *tty_dev;
int retval = 0;
int minor;
 
@@ -76,7 +77,15 @@ static int usb_serial_device_probe(struct device *dev)
}
 
minor = port->number;
-   tty_register_device(usb_serial_tty_driver, minor, dev);
+   tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev);
+   if (IS_ERR(tty_dev)) {
+   retval = PTR_ERR(tty_dev);
+   device_remove_file(dev, &dev_attr_port_number);
+   if (driver->port_remove)
+   driver->port_remove(port);
+   goto exit;
+   }
+
dev_info(&port->serial->dev->dev,
 "%s converter now attached to ttyUSB%d\n",
 driver->description, minor);
-- 
1.9.1

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


[PATCH 3.4 059/172] mac80211: Send EAPOL frames at lowest rate

2015-06-16 Thread lizf
From: Jouni Malinen 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 9c1c98a3bb7b7593b60264b9a07e001e68b46697 upstream.

The current minstrel_ht rate control behavior is somewhat optimistic in
trying to find optimum TX rate. While this is usually fine for normal
Data frames, there are cases where a more conservative set of retry
parameters would be beneficial to make the connection more robust.

EAPOL frames are critical to the authentication and especially the
EAPOL-Key message 4/4 (the last message in the 4-way handshake) is
important to get through to the AP. If that message is lost, the only
recovery mechanism in many cases is to reassociate with the AP and start
from scratch. This can often be avoided by trying to send the frame with
more conservative rate and/or with more link layer retries.

In most cases, minstrel_ht is currently using the initial EAPOL-Key
frames for probing higher rates and this results in only five link layer
transmission attempts (one at high(ish) MCS and four at MCS0). While
this works with most APs, it looks like there are some deployed APs that
may have issues with the EAPOL frames using HT MCS immediately after
association. Similarly, there may be issues in cases where the signal
strength or radio environment is not good enough to be able to get
frames through even at couple of MCS 0 tries.

The best approach for this would likely to be to reduce the TX rate for
the last rate (3rd rate parameter in the set) to a low basic rate (say,
6 Mbps on 5 GHz and 2 or 5.5 Mbps on 2.4 GHz), but doing that cleanly
requires some more effort. For now, we can start with a simple one-liner
that forces the minimum rate to be used for EAPOL frames similarly how
the TX rate is selected for the IEEE 802.11 Management frames. This does
result in a small extra latency added to the cases where the AP would be
able to receive the higher rate, but taken into account how small number
of EAPOL frames are used, this is likely to be insignificant. A future
optimization in the minstrel_ht design can also allow this patch to be
reverted to get back to the more optimized initial TX rate.

It should also be noted that many drivers that do not use minstrel as
the rate control algorithm are already doing similar workarounds by
forcing the lowest TX rate to be used for EAPOL frames.

Reported-by: Linus Torvalds 
Tested-by: Linus Torvalds 
Signed-off-by: Jouni Malinen 
Signed-off-by: Johannes Berg 
[lizf: Backported to 3.4: adjust the if statement]
Signed-off-by: Zefan Li 
---
 net/mac80211/tx.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index b7fc3dd..f4f24be 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -544,9 +544,11 @@ ieee80211_tx_h_check_control_port_protocol(struct 
ieee80211_tx_data *tx)
 {
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
 
-   if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol &&
-tx->sdata->control_port_no_encrypt))
-   info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
+   if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol)) {
+   if (tx->sdata->control_port_no_encrypt)
+   info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
+   info->flags |= IEEE80211_TX_CTL_USE_MINRATE;
+   }
 
return TX_CONTINUE;
 }
-- 
1.9.1

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


[PATCH] small update for strlen, strnlen, use less cpu instructions

2015-06-16 Thread Orestes Leal Rodriguez
very small update to strlen and strnlen that now use less cpu 
instructions by using a counter to avoid the memory addresses 
substraction to find the length of the string.


Orestes Leal Rodriguez.

--- lib/string.c.orig   2015-06-15 23:59:32.768346193 -0400
+++ lib/string.c2015-06-16 00:11:45.791381539 -0400
@@ -17,6 +17,10 @@
  * * Sat Feb 09 2002, Jason Thomas ,
  *Matthew Hawkins 
  * -  Kissed strtok() goodbye
+ *
+ * * Tuesday June 16 2015, Orestes Leal Rodriguez 
+ * - strlen, strnlen: by using a single counter we use less cpu instructions
+ *   by avoiding substracting the memory addresses before return
  */
 
 #include 
@@ -401,11 +405,11 @@ EXPORT_SYMBOL(strim);
  */
 size_t strlen(const char *s)
 {
-   const char *sc;
+   size_t sz = 0;
 
-   for (sc = s; *sc != '\0'; ++sc)
-   /* nothing */;
-   return sc - s;
+   for (; *s++ != '\0'; sz++)
+   /*empty */;
+   return sz;
 }
 EXPORT_SYMBOL(strlen);
 #endif
@@ -418,12 +422,13 @@ EXPORT_SYMBOL(strlen);
  */
 size_t strnlen(const char *s, size_t count)
 {
-   const char *sc;
+   size_t sz = 0;
 
-   for (sc = s; count-- && *sc != '\0'; ++sc)
-   /* nothing */;
-   return sc - s;
+   for (; count-- && *s++ != '\0'; sz++)
+   /* empty */;
+   return sz;
 }
+
 EXPORT_SYMBOL(strnlen);
 #endif
 


[PATCH 3.4 057/172] USB: serial: fix potential use-after-free after failed probe

2015-06-16 Thread lizf
From: Johan Hovold 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 07fdfc5e9f1c966be8722e8fa927e5ea140df5ce upstream.

Fix return value in probe error path, which could end up returning
success (0) on errors. This could in turn lead to use-after-free or
double free (e.g. in port_remove) when the port device is removed.

Fixes: c706ebdfc895 ("USB: usb-serial: call port_probe and port_remove
at the right times")
Signed-off-by: Johan Hovold 
Acked-by: Greg Kroah-Hartman 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 drivers/usb/serial/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index ed8adb0..1b59665 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -71,7 +71,7 @@ static int usb_serial_device_probe(struct device *dev)
retval = device_create_file(dev, &dev_attr_port_number);
if (retval) {
if (driver->port_remove)
-   retval = driver->port_remove(port);
+   driver->port_remove(port);
goto exit;
}
 
-- 
1.9.1

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


[PATCH 3.4 089/172] xen-pciback: limit guest control of command register

2015-06-16 Thread lizf
From: Jan Beulich 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit af6fc858a35b90e89ea7a7ee58e66628c55c776b upstream.

Otherwise the guest can abuse that control to cause e.g. PCIe
Unsupported Request responses by disabling memory and/or I/O decoding
and subsequently causing (CPU side) accesses to the respective address
ranges, which (depending on system configuration) may be fatal to the
host.

Note that to alter any of the bits collected together as
PCI_COMMAND_GUEST permissive mode is now required to be enabled
globally or on the specific device.

This is CVE-2015-2150 / XSA-120.

Signed-off-by: Jan Beulich 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: David Vrabel 
Signed-off-by: Zefan Li 
---
 drivers/xen/xen-pciback/conf_space.c|  2 +-
 drivers/xen/xen-pciback/conf_space.h|  2 +
 drivers/xen/xen-pciback/conf_space_header.c | 61 +++--
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/drivers/xen/xen-pciback/conf_space.c 
b/drivers/xen/xen-pciback/conf_space.c
index 30d7be0..82ab1c3 100644
--- a/drivers/xen/xen-pciback/conf_space.c
+++ b/drivers/xen/xen-pciback/conf_space.c
@@ -16,7 +16,7 @@
 #include "conf_space.h"
 #include "conf_space_quirks.h"
 
-static bool permissive;
+bool permissive;
 module_param(permissive, bool, 0644);
 
 /* This is where xen_pcibk_read_config_byte, xen_pcibk_read_config_word,
diff --git a/drivers/xen/xen-pciback/conf_space.h 
b/drivers/xen/xen-pciback/conf_space.h
index e56c934..2e1d73d 100644
--- a/drivers/xen/xen-pciback/conf_space.h
+++ b/drivers/xen/xen-pciback/conf_space.h
@@ -64,6 +64,8 @@ struct config_field_entry {
void *data;
 };
 
+extern bool permissive;
+
 #define OFFSET(cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset)
 
 /* Add fields to a device - the add_fields macro expects to get a pointer to
diff --git a/drivers/xen/xen-pciback/conf_space_header.c 
b/drivers/xen/xen-pciback/conf_space_header.c
index 3daf862..a5bb81a 100644
--- a/drivers/xen/xen-pciback/conf_space_header.c
+++ b/drivers/xen/xen-pciback/conf_space_header.c
@@ -9,6 +9,10 @@
 #include "pciback.h"
 #include "conf_space.h"
 
+struct pci_cmd_info {
+   u16 val;
+};
+
 struct pci_bar_info {
u32 val;
u32 len_val;
@@ -18,22 +22,36 @@ struct pci_bar_info {
 #define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO))
 #define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER)
 
-static int command_read(struct pci_dev *dev, int offset, u16 *value, void 
*data)
+/* Bits guests are allowed to control in permissive mode. */
+#define PCI_COMMAND_GUEST (PCI_COMMAND_MASTER|PCI_COMMAND_SPECIAL| \
+  PCI_COMMAND_INVALIDATE|PCI_COMMAND_VGA_PALETTE| \
+  PCI_COMMAND_WAIT|PCI_COMMAND_FAST_BACK)
+
+static void *command_init(struct pci_dev *dev, int offset)
 {
-   int i;
-   int ret;
-
-   ret = xen_pcibk_read_config_word(dev, offset, value, data);
-   if (!pci_is_enabled(dev))
-   return ret;
-
-   for (i = 0; i < PCI_ROM_RESOURCE; i++) {
-   if (dev->resource[i].flags & IORESOURCE_IO)
-   *value |= PCI_COMMAND_IO;
-   if (dev->resource[i].flags & IORESOURCE_MEM)
-   *value |= PCI_COMMAND_MEMORY;
+   struct pci_cmd_info *cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
+   int err;
+
+   if (!cmd)
+   return ERR_PTR(-ENOMEM);
+
+   err = pci_read_config_word(dev, PCI_COMMAND, &cmd->val);
+   if (err) {
+   kfree(cmd);
+   return ERR_PTR(err);
}
 
+   return cmd;
+}
+
+static int command_read(struct pci_dev *dev, int offset, u16 *value, void 
*data)
+{
+   int ret = pci_read_config_word(dev, offset, value);
+   const struct pci_cmd_info *cmd = data;
+
+   *value &= PCI_COMMAND_GUEST;
+   *value |= cmd->val & ~PCI_COMMAND_GUEST;
+
return ret;
 }
 
@@ -41,6 +59,8 @@ static int command_write(struct pci_dev *dev, int offset, u16 
value, void *data)
 {
struct xen_pcibk_dev_data *dev_data;
int err;
+   u16 val;
+   struct pci_cmd_info *cmd = data;
 
dev_data = pci_get_drvdata(dev);
if (!pci_is_enabled(dev) && is_enable_cmd(value)) {
@@ -83,6 +103,19 @@ static int command_write(struct pci_dev *dev, int offset, 
u16 value, void *data)
}
}
 
+   cmd->val = value;
+
+   if (!permissive && (!dev_data || !dev_data->permissive))
+   return 0;
+
+   /* Only allow the guest to control certain bits. */
+   err = pci_read_config_word(dev, offset, &val);
+   if (err || val == value)
+   return err;
+
+   value &= PCI_COMMAND_GUEST;
+   value |= val & ~PCI_COMMAND_GUEST;
+
return pci_write_config_word(dev, offset, value);
 }
 
@@ -282,6 +315,8 @@ static const struct config_field header_common[] = {
{

[PATCH 3.4 068/172] drm/radeon: do a posting read in si_set_irq

2015-06-16 Thread lizf
From: Alex Deucher 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 0586915ec10d0ae60de5cd3381ad25a704760402 upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher 
Signed-off-by: Zefan Li 
---
 drivers/gpu/drm/radeon/si.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index e710073..068b21f 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -4126,6 +4126,9 @@ int si_init(struct radeon_device *rdev)
return -EINVAL;
}
 
+   /* posting read */
+   RREG32(SRBM_STATUS);
+
return 0;
 }
 
-- 
1.9.1

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


[PATCH 3.4 065/172] drm/radeon: do a posting read in rs600_set_irq

2015-06-16 Thread lizf
From: Alex Deucher 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 54acf107e4e66d1f4a697e08a7f60dba9fcf07c3 upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 drivers/gpu/drm/radeon/rs600.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 739eb0d..07b6dbf 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -585,6 +585,10 @@ int rs600_irq_set(struct radeon_device *rdev)
WREG32(R_006540_DxMODE_INT_MASK, mode_int);
WREG32(R_007D08_DC_HOT_PLUG_DETECT1_INT_CONTROL, hpd1);
WREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL, hpd2);
+
+   /* posting read */
+   RREG32(R_40_GEN_INT_CNTL);
+
return 0;
 }
 
-- 
1.9.1

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


[PATCH 3.4 074/172] xhci: Workaround for PME stuck issues in Intel xhci

2015-06-16 Thread lizf
From: Mathias Nyman 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit b8cb91e058cd0c0f02059c1207293c5b31d350fa upstream.

The xhci in Intel Sunrisepoint and Cherryview platforms need a driver
workaround for a Stuck PME that might either block PME events in suspend,
or create spurious PME events preventing runtime suspend.

Workaround is to clear a internal PME flag, BIT(28) in a vendor specific
PMCTRL register at offset 0x80a4, in both suspend resume callbacks

Without this, xhci connected usb devices might never be able to wake up the
system from suspend, or prevent device from going to suspend (xhci d3)

Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Zefan Li 
---
 drivers/usb/host/xhci-pci.c | 30 ++
 drivers/usb/host/xhci.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index c9e39d4..037185d 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -36,6 +36,9 @@
 
 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31
 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI  0x9c31
+#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI0x22b5
+#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI0xa12f
+#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI   0x9d2f
 
 static const char hcd_name[] = "xhci_hcd";
 
@@ -118,6 +121,12 @@ static void xhci_pci_quirks(struct device *dev, struct 
xhci_hcd *xhci)
xhci->quirks |= XHCI_SPURIOUS_REBOOT;
xhci->quirks |= XHCI_AVOID_BEI;
}
+   if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
+   (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
+pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
+pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI)) {
+   xhci->quirks |= XHCI_PME_STUCK_QUIRK;
+   }
if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
xhci->quirks |= XHCI_RESET_ON_RESUME;
@@ -131,6 +140,21 @@ static void xhci_pci_quirks(struct device *dev, struct 
xhci_hcd *xhci)
xhci->quirks |= XHCI_RESET_ON_RESUME;
 }
 
+/*
+ * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
+ * the Internal PME flag bit in vendor specific PMCTRL register at offset 
0x80a4
+ */
+static void xhci_pme_quirk(struct xhci_hcd *xhci)
+{
+   u32 val;
+   void __iomem *reg;
+
+   reg = (void __iomem *) xhci->cap_regs + 0x80a4;
+   val = readl(reg);
+   writel(val | BIT(28), reg);
+   readl(reg);
+}
+
 /* called during probe() after chip reset completes */
 static int xhci_pci_setup(struct usb_hcd *hcd)
 {
@@ -238,6 +262,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool 
do_wakeup)
xhci->shared_hcd->state != HC_STATE_SUSPENDED)
return -EINVAL;
 
+   if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
+   xhci_pme_quirk(xhci);
+
retval = xhci_suspend(xhci, do_wakeup);
 
return retval;
@@ -268,6 +295,9 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool 
hibernated)
if (usb_is_intel_switchable_xhci(pdev))
usb_enable_xhci_ports(pdev);
 
+   if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
+   xhci_pme_quirk(xhci);
+
retval = xhci_resume(xhci, hibernated);
return retval;
 }
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 5d294ac..80b3d85 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1515,6 +1515,7 @@ struct xhci_hcd {
 #define XHCI_PLAT  (1 << 16)
 #define XHCI_SLOW_SUSPEND  (1 << 17)
 #define XHCI_SPURIOUS_WAKEUP   (1 << 18)
+#define XHCI_PME_STUCK_QUIRK   (1 << 20)
unsigned intnum_active_eps;
unsigned intlimit_active_eps;
/* There are two roothubs to keep track of bus suspend info for */
-- 
1.9.1

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


[PATCH 3.4 086/172] can: add missing initialisations in CAN related skbuffs

2015-06-16 Thread lizf
From: Oliver Hartkopp 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit 969439016d2cf61fef53a973d7e6d2061c3793b1 upstream.

When accessing CAN network interfaces with AF_PACKET sockets e.g. by dhclient
this can lead to a skb_under_panic due to missing skb initialisations.

Add the missing initialisations at the CAN skbuff creation times on driver
level (rx path) and in the network layer (tx path).

Reported-by: Austin Schuh 
Reported-by: Daniel Steer 
Signed-off-by: Oliver Hartkopp 
Signed-off-by: Marc Kleine-Budde 
[lizf: Backported to 3.4:
 - adjust context
 - drop changes to alloc_canfd_skb(), as there's no such function]
Signed-off-by: Zefan Li 
---
 drivers/net/can/dev.c | 5 +
 net/can/af_can.c  | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 88c39e4..81a00e4 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -475,6 +475,11 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, 
struct can_frame **cf)
skb->protocol = htons(ETH_P_CAN);
skb->pkt_type = PACKET_BROADCAST;
skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+   skb_reset_mac_header(skb);
+   skb_reset_network_header(skb);
+   skb_reset_transport_header(skb);
+
*cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(*cf, 0, sizeof(struct can_frame));
 
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 0ce2ad0..7d9dff222 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -244,6 +244,9 @@ int can_send(struct sk_buff *skb, int loop)
}
 
skb->protocol = htons(ETH_P_CAN);
+   skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+   skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
 
-- 
1.9.1

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


[PATCH 3.4 056/172] USB: ftdi_sio: add PIDs for Actisense USB devices

2015-06-16 Thread lizf
From: Mark Glover 

3.4.108-rc1 review patch.  If anyone has any objections, please let me know.

--


commit f6950344d3cf4a1e231b5828b50c4ac168db3886 upstream.

These product identifiers (PID) all deal with marine NMEA format data
used on motor boats and yachts. We supply the programmed devices to
Chetco, for use inside their equipment. The PIDs are a direct copy of
our Windows device drivers (FTDI drivers with altered PIDs).

Signed-off-by: Mark Glover 
[johan: edit commit message slightly ]
Signed-off-by: Johan Hovold 
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li 
---
 drivers/usb/serial/ftdi_sio.c | 17 +
 drivers/usb/serial/ftdi_sio_ids.h | 20 
 2 files changed, 37 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 4bfcfa7..8441cec 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1000,6 +1000,23 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) },
/* GE Healthcare devices */
{ USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) },
+   /* Active Research (Actisense) devices */
+   { USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) },
+   { USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) },
+   { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) },
{ },/* Optional parameter entry */
{ } /* Terminating entry */
 };
diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
index ecb4dee..eba7360 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1432,3 +1432,23 @@
  */
 #define GE_HEALTHCARE_VID  0x1901
 #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015
+
+/*
+ * Active Research (Actisense) devices
+ */
+#define ACTISENSE_NDC_PID  0xD9A8 /* NDC USB Serial Adapter */
+#define ACTISENSE_USG_PID  0xD9A9 /* USG USB Serial Adapter */
+#define ACTISENSE_NGT_PID  0xD9AA /* NGT NMEA2000 Interface */
+#define ACTISENSE_NGW_PID  0xD9AB /* NGW NMEA2000 Gateway */
+#define ACTISENSE_D9AC_PID 0xD9AC /* Actisense Reserved */
+#define ACTISENSE_D9AD_PID 0xD9AD /* Actisense Reserved */
+#define ACTISENSE_D9AE_PID 0xD9AE /* Actisense Reserved */
+#define ACTISENSE_D9AF_PID 0xD9AF /* Actisense Reserved */
+#define CHETCO_SEAGAUGE_PID0xA548 /* SeaGauge USB Adapter */
+#define CHETCO_SEASWITCH_PID   0xA549 /* SeaSwitch USB Adapter */
+#define CHETCO_SEASMART_NMEA2000_PID   0xA54A /* SeaSmart NMEA2000 Gateway */
+#define CHETCO_SEASMART_ETHERNET_PID   0xA54B /* SeaSmart Ethernet Gateway */
+#define CHETCO_SEASMART_WIFI_PID   0xA5AC /* SeaSmart Wifi Gateway */
+#define CHETCO_SEASMART_DISPLAY_PID0xA5AD /* SeaSmart NMEA2000 Display */
+#define CHETCO_SEASMART_LITE_PID   0xA5AE /* SeaSmart Lite USB Adapter */
+#define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */
-- 
1.9.1

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


Re: [PATCH 02/21] ARM: tegra: Add gpio-ranges property

2015-06-16 Thread Tomeu Vizoso
On 2 June 2015 at 17:40, Stephen Warren  wrote:
> On 06/02/2015 05:28 AM, Linus Walleij wrote:
>>
>> On Tue, May 26, 2015 at 9:41 PM, Stephen Warren 
>> wrote:
>>>
>>> On 05/25/2015 08:53 AM, Tomeu Vizoso wrote:


 Specify how the GPIOs map to the pins in T124, so the dependency is
 explicit.

 Signed-off-by: Tomeu Vizoso 
 ---
arch/arm/boot/dts/tegra124.dtsi | 1 +
1 file changed, 1 insertion(+)

 diff --git a/arch/arm/boot/dts/tegra124.dtsi
 b/arch/arm/boot/dts/tegra124.dtsi
 index 13cc7ca..5d1d35f 100644
 --- a/arch/arm/boot/dts/tegra124.dtsi
 +++ b/arch/arm/boot/dts/tegra124.dtsi
 @@ -254,6 +254,7 @@
  gpio-controller;
  #interrupt-cells = <2>;
  interrupt-controller;
 +   gpio-ranges = <&pinmux 0 0 250>;
>>>
>>>
>>>
>>> We should be consistent between SoCs. Why not make the same change for
>>> all
>>> Tegra SoCs?
>>
>>
>> Agreed.
>>
>>> I think this change will cause the GPIO subsystem to call into the
>>> pinctrl
>>> subsystem and create/add/register a new GPIO<->pinctrl range structure.
>>> The
>>> pinctrl driver already does this, so I think we'll end up with two
>>> duplicate
>>> entries in the pinctrl device's gpio_ranges list. This probably won't
>>> cause
>>> a problem, but I wanted to make sure you'd thought about it to make sure.
>>
>>
>> That sounds like duplication indeed, I would expect that first a patch
>> adds the ranges to the dts[i] files and then a second patch delete the
>> same ranges from the pinctrl driver then, if these shall come in from
>> the device tree.
>
>
> We can't delete the gpio-range-registration code from the Tegra pinmux
> driver, or old DTs won't work correctly. We could make it conditional based
> upon whether the DT contains the property or not.

I've been looking at this and haven't found a good solution. From what
I see, the pinctrl driver doesn't have a reference to the gpio device
node so cannot tell if it needs to add the range or not.

The gpio driver can tell whether it should add the range or not, but
if it has to because the gpio-ranges property isn't there, then it
doesn't have the reference to the pinctrl device to set the range to.

So, given that pinctrl_add_gpio_range is deprecated already, wonder if
the lesser evil isn't leaving the duplicated entries for now. On newer
SoC revisions such as T210 we can stop calling pinctrl_add_gpio_range
at all.

Or, we can accept that nobody is going to boot a newer kernel with an
older DT on the affected boards and just rely on the presence of the
gpio-ranges property :)

Regards,

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


  1   2   3   4   5   6   7   8   9   10   >