[PATCH v4 2/4] ACPICA: Tables: Add mechanism to allow to balance late stage acpi_get_table() independently

2017-05-08 Thread Lv Zheng
For all frequent late stage acpi_get_table() clone invocations, we should
only change them altogether, otherwise, excessive acpi_put_table() could
unexpectedly unmap the table used by the other users. Thus the current plan
is to change all acpi_get_table() clones together or to change none of
them. However in practical, this is not convenient as this can prevent
kernel developers' efforts of improving the late stage code quality before
waiting for the ACPICA upstream to improve first.

This patch adds a validation count threashold, when it is reached, the
validation count can no longer be incremented/decremented to invalidate the
table descriptor (means preventing table unmappings) so that acpi_put_table()
balance changes can be done independently to each others. Lv Zheng.

Cc: Dan Williams 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/tbutils.c | 24 +++-
 include/acpi/actbl.h  |  9 +
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 7abe665..04beafc 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -416,9 +416,13 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc,
}
}
 
-   table_desc->validation_count++;
-   if (table_desc->validation_count == 0) {
-   table_desc->validation_count--;
+   if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
+   table_desc->validation_count++;
+   if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) 
{
+   ACPI_WARNING((AE_INFO,
+ "Table %p, Validation count overflows\n",
+ table_desc));
+   }
}
 
*out_table = table_desc->pointer;
@@ -445,13 +449,15 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc)
 
ACPI_FUNCTION_TRACE(acpi_tb_put_table);
 
-   if (table_desc->validation_count == 0) {
-   ACPI_WARNING((AE_INFO,
- "Table %p, Validation count is zero before 
decrement\n",
- table_desc));
-   return_VOID;
+   if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
+   table_desc->validation_count--;
+   if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) 
{
+   ACPI_WARNING((AE_INFO,
+ "Table %p, Validation count underflows\n",
+ table_desc));
+   return_VOID;
+   }
}
-   table_desc->validation_count--;
 
if (table_desc->validation_count == 0) {
 
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index d92543f..8e1bff8 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -374,6 +374,15 @@ struct acpi_table_desc {
u16 validation_count;
 };
 
+/*
+ * Maximum validation count, when it is reached, validation count can no
+ * longer be changed. Which means, the table can no longer be invalidated.
+ * This mechanism is implemented for backward compatibility, where in OS
+ * late stage, old drivers are not facilitated with paired validations and
+ * invalidations.
+ */
+#define ACPI_MAX_TABLE_VALIDATIONS  5
+
 /* Masks for Flags field above */
 
 #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL  (0)/* Virtual address, 
external maintained */
-- 
2.7.4



[PATCH v4 2/4] ACPICA: Tables: Add mechanism to allow to balance late stage acpi_get_table() independently

2017-05-08 Thread Lv Zheng
For all frequent late stage acpi_get_table() clone invocations, we should
only change them altogether, otherwise, excessive acpi_put_table() could
unexpectedly unmap the table used by the other users. Thus the current plan
is to change all acpi_get_table() clones together or to change none of
them. However in practical, this is not convenient as this can prevent
kernel developers' efforts of improving the late stage code quality before
waiting for the ACPICA upstream to improve first.

This patch adds a validation count threashold, when it is reached, the
validation count can no longer be incremented/decremented to invalidate the
table descriptor (means preventing table unmappings) so that acpi_put_table()
balance changes can be done independently to each others. Lv Zheng.

Cc: Dan Williams 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/tbutils.c | 24 +++-
 include/acpi/actbl.h  |  9 +
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 7abe665..04beafc 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -416,9 +416,13 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc,
}
}
 
-   table_desc->validation_count++;
-   if (table_desc->validation_count == 0) {
-   table_desc->validation_count--;
+   if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
+   table_desc->validation_count++;
+   if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) 
{
+   ACPI_WARNING((AE_INFO,
+ "Table %p, Validation count overflows\n",
+ table_desc));
+   }
}
 
*out_table = table_desc->pointer;
@@ -445,13 +449,15 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc)
 
ACPI_FUNCTION_TRACE(acpi_tb_put_table);
 
-   if (table_desc->validation_count == 0) {
-   ACPI_WARNING((AE_INFO,
- "Table %p, Validation count is zero before 
decrement\n",
- table_desc));
-   return_VOID;
+   if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
+   table_desc->validation_count--;
+   if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) 
{
+   ACPI_WARNING((AE_INFO,
+ "Table %p, Validation count underflows\n",
+ table_desc));
+   return_VOID;
+   }
}
-   table_desc->validation_count--;
 
if (table_desc->validation_count == 0) {
 
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index d92543f..8e1bff8 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -374,6 +374,15 @@ struct acpi_table_desc {
u16 validation_count;
 };
 
+/*
+ * Maximum validation count, when it is reached, validation count can no
+ * longer be changed. Which means, the table can no longer be invalidated.
+ * This mechanism is implemented for backward compatibility, where in OS
+ * late stage, old drivers are not facilitated with paired validations and
+ * invalidations.
+ */
+#define ACPI_MAX_TABLE_VALIDATIONS  5
+
 /* Masks for Flags field above */
 
 #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL  (0)/* Virtual address, 
external maintained */
-- 
2.7.4



[PATCH v4 1/3] KASLR: Parse all memmap entries in cmdline

2017-05-08 Thread Baoquan He
In commit:

  f28442497b5c ("x86/boot: Fix KASLR and memmap= collision")

... the memmap= option is parsed so that KASLR can avoid those reserved
regions. It uses cmdline_find_option() to get the value if memmap=
is specified, however the problem is that cmdline_find_option() can only
find the last entry if multiple memmap entries are provided. This
is not correct.

In this patch, the whole cmdline will be scanned to search each
memmap, all of them will be parsed and handled.

Signed-off-by: Baoquan He 
---
 arch/x86/boot/compressed/cmdline.c |   2 +-
 arch/x86/boot/compressed/kaslr.c   | 136 ++---
 arch/x86/boot/string.c |   8 +++
 3 files changed, 91 insertions(+), 55 deletions(-)

diff --git a/arch/x86/boot/compressed/cmdline.c 
b/arch/x86/boot/compressed/cmdline.c
index 73ccf63..9dc1ce6 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -13,7 +13,7 @@ static inline char rdfs8(addr_t addr)
return *((char *)(fs + addr));
 }
 #include "../cmdline.c"
-static unsigned long get_cmd_line_ptr(void)
+unsigned long get_cmd_line_ptr(void)
 {
unsigned long cmd_line_ptr = boot_params->hdr.cmd_line_ptr;
 
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 54c24f0..106e13b 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -9,16 +9,41 @@
  * contain the entire properly aligned running kernel image.
  *
  */
+
+/*
+ * isspace() in linux/ctype.h is expected by next_args() to filter
+ * out "space/lf/tab". While boot/ctype.h conflicts with linux/ctype.h,
+ * since isdigit() is implemented in both of them. Hence disable it
+ * here.
+ */
+#define BOOT_CTYPE_H
+
+/*
+ * _ctype[] in lib/ctype.c is needed by isspace() of linux/ctype.h.
+ * While both lib/ctype.c and lib/cmdline.c will bring EXPORT_SYMBOL
+ * which is meaningless and will cause compiling error in some cases.
+ * So do not include linux/export.h and define EXPORT_SYMBOL(sym)
+ * as empty.
+ */
+#define _LINUX_EXPORT_H
+#define EXPORT_SYMBOL(sym)
+
 #include "misc.h"
 #include "error.h"
-#include "../boot.h"
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
+/* Macros used by the included decompressor code below. */
+#define STATIC
+#include 
+
+extern unsigned long get_cmd_line_ptr(void);
+
 /* Simplified build-specific string for starting entropy. */
 static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
@@ -62,6 +87,7 @@ struct mem_vector {
 
 static bool memmap_too_large;
 
+
 enum mem_avoid_index {
MEM_AVOID_ZO_RANGE = 0,
MEM_AVOID_INITRD,
@@ -85,49 +111,14 @@ static bool mem_overlaps(struct mem_vector *one, struct 
mem_vector *two)
return true;
 }
 
-/**
- * _memparse - Parse a string with mem suffixes into a number
- * @ptr: Where parse begins
- * @retptr: (output) Optional pointer to next char after parse completes
- *
- * Parses a string into a number.  The number stored at @ptr is
- * potentially suffixed with K, M, G, T, P, E.
- */
-static unsigned long long _memparse(const char *ptr, char **retptr)
+char *skip_spaces(const char *str)
 {
-   char *endptr;   /* Local pointer to end of parsed string */
-
-   unsigned long long ret = simple_strtoull(ptr, , 0);
-
-   switch (*endptr) {
-   case 'E':
-   case 'e':
-   ret <<= 10;
-   case 'P':
-   case 'p':
-   ret <<= 10;
-   case 'T':
-   case 't':
-   ret <<= 10;
-   case 'G':
-   case 'g':
-   ret <<= 10;
-   case 'M':
-   case 'm':
-   ret <<= 10;
-   case 'K':
-   case 'k':
-   ret <<= 10;
-   endptr++;
-   default:
-   break;
-   }
-
-   if (retptr)
-   *retptr = endptr;
-
-   return ret;
+   while (isspace(*str))
+   ++str;
+   return (char *)str;
 }
+#include "../../../../lib/ctype.c"
+#include "../../../../lib/cmdline.c"
 
 static int
 parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
@@ -142,7 +133,7 @@ parse_memmap(char *p, unsigned long long *start, unsigned 
long long *size)
return -EINVAL;
 
oldp = p;
-   *size = _memparse(p, );
+   *size = memparse(p, );
if (p == oldp)
return -EINVAL;
 
@@ -155,27 +146,21 @@ parse_memmap(char *p, unsigned long long *start, unsigned 
long long *size)
case '#':
case '$':
case '!':
-   *start = _memparse(p + 1, );
+   *start = memparse(p + 1, );
return 0;
}
 
return -EINVAL;
 }
 
-static void mem_avoid_memmap(void)
+static void mem_avoid_memmap(char *str)
 {
-   char arg[128];
+   static int i;
int rc;
-   int i;
-   char *str;
 
-   

[PATCH v4 3/4] ACPI: sysfs: Fix acpi_get_table() leak

2017-05-08 Thread Lv Zheng
From: Dan Williams 

Reading an ACPI table through the /sys/firmware/acpi/tables interface
more than 65,536 times leads to the following log message:

 ACPI Error: Table 88033595eaa8, Validation count is zero after
increment
  (20170119/tbutils-423)

Add the missing acpi_put_table() so the table ->validation_count is
decremented after each read.

Reported-by: Anush Seetharaman 
Signed-off-by: Dan Williams 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/sysfs.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 1b5ee1e..2bbf722 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -333,14 +333,17 @@ static ssize_t acpi_table_show(struct file *filp, struct 
kobject *kobj,
container_of(bin_attr, struct acpi_table_attr, attr);
struct acpi_table_header *table_header = NULL;
acpi_status status;
+   ssize_t len;
 
status = acpi_get_table(table_attr->name, table_attr->instance,
_header);
if (ACPI_FAILURE(status))
return -ENODEV;
 
-   return memory_read_from_buffer(buf, count, ,
-  table_header, table_header->length);
+   len = memory_read_from_buffer(buf, count, ,
+ table_header, table_header->length);
+   acpi_put_table(table_header);
+   return len;
 }
 
 static int acpi_table_attr_init(struct kobject *tables_obj,
-- 
2.7.4



[PATCH v4 1/3] KASLR: Parse all memmap entries in cmdline

2017-05-08 Thread Baoquan He
In commit:

  f28442497b5c ("x86/boot: Fix KASLR and memmap= collision")

... the memmap= option is parsed so that KASLR can avoid those reserved
regions. It uses cmdline_find_option() to get the value if memmap=
is specified, however the problem is that cmdline_find_option() can only
find the last entry if multiple memmap entries are provided. This
is not correct.

In this patch, the whole cmdline will be scanned to search each
memmap, all of them will be parsed and handled.

Signed-off-by: Baoquan He 
---
 arch/x86/boot/compressed/cmdline.c |   2 +-
 arch/x86/boot/compressed/kaslr.c   | 136 ++---
 arch/x86/boot/string.c |   8 +++
 3 files changed, 91 insertions(+), 55 deletions(-)

diff --git a/arch/x86/boot/compressed/cmdline.c 
b/arch/x86/boot/compressed/cmdline.c
index 73ccf63..9dc1ce6 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -13,7 +13,7 @@ static inline char rdfs8(addr_t addr)
return *((char *)(fs + addr));
 }
 #include "../cmdline.c"
-static unsigned long get_cmd_line_ptr(void)
+unsigned long get_cmd_line_ptr(void)
 {
unsigned long cmd_line_ptr = boot_params->hdr.cmd_line_ptr;
 
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 54c24f0..106e13b 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -9,16 +9,41 @@
  * contain the entire properly aligned running kernel image.
  *
  */
+
+/*
+ * isspace() in linux/ctype.h is expected by next_args() to filter
+ * out "space/lf/tab". While boot/ctype.h conflicts with linux/ctype.h,
+ * since isdigit() is implemented in both of them. Hence disable it
+ * here.
+ */
+#define BOOT_CTYPE_H
+
+/*
+ * _ctype[] in lib/ctype.c is needed by isspace() of linux/ctype.h.
+ * While both lib/ctype.c and lib/cmdline.c will bring EXPORT_SYMBOL
+ * which is meaningless and will cause compiling error in some cases.
+ * So do not include linux/export.h and define EXPORT_SYMBOL(sym)
+ * as empty.
+ */
+#define _LINUX_EXPORT_H
+#define EXPORT_SYMBOL(sym)
+
 #include "misc.h"
 #include "error.h"
-#include "../boot.h"
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
+/* Macros used by the included decompressor code below. */
+#define STATIC
+#include 
+
+extern unsigned long get_cmd_line_ptr(void);
+
 /* Simplified build-specific string for starting entropy. */
 static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
@@ -62,6 +87,7 @@ struct mem_vector {
 
 static bool memmap_too_large;
 
+
 enum mem_avoid_index {
MEM_AVOID_ZO_RANGE = 0,
MEM_AVOID_INITRD,
@@ -85,49 +111,14 @@ static bool mem_overlaps(struct mem_vector *one, struct 
mem_vector *two)
return true;
 }
 
-/**
- * _memparse - Parse a string with mem suffixes into a number
- * @ptr: Where parse begins
- * @retptr: (output) Optional pointer to next char after parse completes
- *
- * Parses a string into a number.  The number stored at @ptr is
- * potentially suffixed with K, M, G, T, P, E.
- */
-static unsigned long long _memparse(const char *ptr, char **retptr)
+char *skip_spaces(const char *str)
 {
-   char *endptr;   /* Local pointer to end of parsed string */
-
-   unsigned long long ret = simple_strtoull(ptr, , 0);
-
-   switch (*endptr) {
-   case 'E':
-   case 'e':
-   ret <<= 10;
-   case 'P':
-   case 'p':
-   ret <<= 10;
-   case 'T':
-   case 't':
-   ret <<= 10;
-   case 'G':
-   case 'g':
-   ret <<= 10;
-   case 'M':
-   case 'm':
-   ret <<= 10;
-   case 'K':
-   case 'k':
-   ret <<= 10;
-   endptr++;
-   default:
-   break;
-   }
-
-   if (retptr)
-   *retptr = endptr;
-
-   return ret;
+   while (isspace(*str))
+   ++str;
+   return (char *)str;
 }
+#include "../../../../lib/ctype.c"
+#include "../../../../lib/cmdline.c"
 
 static int
 parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
@@ -142,7 +133,7 @@ parse_memmap(char *p, unsigned long long *start, unsigned 
long long *size)
return -EINVAL;
 
oldp = p;
-   *size = _memparse(p, );
+   *size = memparse(p, );
if (p == oldp)
return -EINVAL;
 
@@ -155,27 +146,21 @@ parse_memmap(char *p, unsigned long long *start, unsigned 
long long *size)
case '#':
case '$':
case '!':
-   *start = _memparse(p + 1, );
+   *start = memparse(p + 1, );
return 0;
}
 
return -EINVAL;
 }
 
-static void mem_avoid_memmap(void)
+static void mem_avoid_memmap(char *str)
 {
-   char arg[128];
+   static int i;
int rc;
-   int i;
-   char *str;
 
-   /* See if we 

[PATCH v4 3/4] ACPI: sysfs: Fix acpi_get_table() leak

2017-05-08 Thread Lv Zheng
From: Dan Williams 

Reading an ACPI table through the /sys/firmware/acpi/tables interface
more than 65,536 times leads to the following log message:

 ACPI Error: Table 88033595eaa8, Validation count is zero after
increment
  (20170119/tbutils-423)

Add the missing acpi_put_table() so the table ->validation_count is
decremented after each read.

Reported-by: Anush Seetharaman 
Signed-off-by: Dan Williams 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/sysfs.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 1b5ee1e..2bbf722 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -333,14 +333,17 @@ static ssize_t acpi_table_show(struct file *filp, struct 
kobject *kobj,
container_of(bin_attr, struct acpi_table_attr, attr);
struct acpi_table_header *table_header = NULL;
acpi_status status;
+   ssize_t len;
 
status = acpi_get_table(table_attr->name, table_attr->instance,
_header);
if (ACPI_FAILURE(status))
return -ENODEV;
 
-   return memory_read_from_buffer(buf, count, ,
-  table_header, table_header->length);
+   len = memory_read_from_buffer(buf, count, ,
+ table_header, table_header->length);
+   acpi_put_table(table_header);
+   return len;
 }
 
 static int acpi_table_attr_init(struct kobject *tables_obj,
-- 
2.7.4



[PATCH v4 2/3] KASLR: Handle memory limit specified by memmap and mem option

2017-05-08 Thread Baoquan He
Option mem= will limit the max address a system can use and any memory
region above the limit will be removed.

Furthermore, memmap=nn[KMG] which has no offset specified has the same
behaviour as mem=.

KASLR needs to consider this when choosing the random position for
decompressing the kernel.

This patch implements that.

Signed-off-by: Baoquan He 
---
 arch/x86/boot/compressed/kaslr.c | 69 +---
 1 file changed, 51 insertions(+), 18 deletions(-)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 106e13b..0637e85 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -88,6 +88,10 @@ struct mem_vector {
 static bool memmap_too_large;
 
 
+/* Store memory limit specified by "mem=nn[KMG]" or "memmap=nn[KMG]" */
+unsigned long long mem_limit = ULLONG_MAX;
+
+
 enum mem_avoid_index {
MEM_AVOID_ZO_RANGE = 0,
MEM_AVOID_INITRD,
@@ -138,16 +142,24 @@ parse_memmap(char *p, unsigned long long *start, unsigned 
long long *size)
return -EINVAL;
 
switch (*p) {
-   case '@':
-   /* Skip this region, usable */
-   *start = 0;
-   *size = 0;
-   return 0;
case '#':
case '$':
case '!':
*start = memparse(p + 1, );
return 0;
+   case '@':   /* Fall through: */
+   /*
+* memmap=nn@ss specifies usable region, should be skipped
+*/
+   *size = 0;
+   default:
+   /*
+* If w/o offset, only size specified, memmap=nn[KMG] has the
+* same behaviour as mem=nn[KMG]. It limits the max address
+* system can use. Region above the limit should be avoided.
+*/
+   *start = 0;
+   return 0;
}
 
return -EINVAL;
@@ -173,9 +185,14 @@ static void mem_avoid_memmap(char *str)
if (rc < 0)
break;
str = k;
-   /* A usable region that should not be skipped */
-   if (size == 0)
+
+   if (start == 0) {
+   /* Store the specified memory limit if size > 0 */
+   if (size > 0)
+   mem_limit = size;
+
continue;
+   }
 
mem_avoid[MEM_AVOID_MEMMAP_BEGIN + i].start = start;
mem_avoid[MEM_AVOID_MEMMAP_BEGIN + i].size = size;
@@ -187,19 +204,15 @@ static void mem_avoid_memmap(char *str)
memmap_too_large = true;
 }
 
-
-/*
- * handle_mem_memmap will also cover 'mem=' issue in next patch. Will remove
- * this note later.
- */
 static int handle_mem_memmap(void)
 {
char *args = (char *)get_cmd_line_ptr();
size_t len = strlen((char *)args);
char *tmp_cmdline;
char *param, *val;
+   u64 mem_size;
 
-   if (!strstr(args, "memmap="))
+   if (!strstr(args, "memmap=") && !strstr(args, "mem="))
return 0;
 
tmp_cmdline = malloc(len + 1);
@@ -222,8 +235,20 @@ static int handle_mem_memmap(void)
return -1;
}
 
-   if (!strcmp(param, "memmap"))
+   if (!strcmp(param, "memmap")) {
mem_avoid_memmap(val);
+   } else if (!strcmp(param, "mem")) {
+   char *p = val;
+
+   if (!strcmp(p, "nopentium"))
+   continue;
+   mem_size = memparse(p, );
+   if (mem_size == 0) {
+   free(tmp_cmdline);
+   return -EINVAL;
+   }
+   mem_limit = mem_size;
+   }
}
 
free(tmp_cmdline);
@@ -460,7 +485,8 @@ static void process_e820_entry(struct boot_e820_entry 
*entry,
 {
struct mem_vector region, overlap;
struct slot_area slot_area;
-   unsigned long start_orig;
+   unsigned long start_orig, end;
+   struct boot_e820_entry cur_entry;
 
/* Skip non-RAM entries. */
if (entry->type != E820_TYPE_RAM)
@@ -474,8 +500,15 @@ static void process_e820_entry(struct boot_e820_entry 
*entry,
if (entry->addr + entry->size < minimum)
return;
 
-   region.start = entry->addr;
-   region.size = entry->size;
+   /* Ignore entries above memory limit */
+   end = min(entry->size + entry->addr, mem_limit);
+   if (entry->addr >= end)
+   return;
+   cur_entry.addr = entry->addr;
+   cur_entry.size = end - entry->addr;
+
+   region.start = cur_entry.addr;
+   region.size = cur_entry.size;
 
/* Give up if slot area array is full. */
while (slot_area_index < MAX_SLOT_AREA) {
@@ -489,7 +522,7 @@ static void 

[PATCH v4 3/3] Documentation/kernel-parameters.txt: Update 'memmap=' option description

2017-05-08 Thread Baoquan He
In commit:

  9710f581bb4c ("x86, mm: Let "memmap=" take more entries one time")

... 'memmap=' was changed to adopt multiple, comma delimited values in a
single entry, so update the related description.

In the special case of only specifying size value without an offset,
like memmap=nn[KMG], memmap behaves similarly to mem=nn[KMG], so update
it too here.

Furthermore, for memmap=nn[KMG]$ss[KMG], an escape character needs be added
before '$' for some bootloaders. E.g in grub2, if we specify memmap=100M$5G
as suggested by the documentation, "memmap=100MG" gets passed to the kernel.

Clarify all this.

Signed-off-by: Baoquan He 
---
 Documentation/admin-guide/kernel-parameters.txt | 9 +
 1 file changed, 9 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index e4c9e0e..8d37f26 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2112,6 +2112,12 @@
memmap=nn[KMG]@ss[KMG]
[KNL] Force usage of a specific region of memory.
Region of memory to be used is from ss to ss+nn.
+   If @ss[KMG] is omitted, it equals to mem=nn[KMG]
+   which limits max address as nn[KMG].
+   Multiple different options can be put into one entry
+   with comma delimited to save space:
+   Example:
+   memmap=100M@2G,100M#3G,1G!1024G
 
memmap=nn[KMG]#ss[KMG]
[KNL,ACPI] Mark specific memory as ACPI data.
@@ -2124,6 +2130,9 @@
 memmap=64K$0x1869
 or
 memmap=0x1$0x1869
+   Some bootloaders may need escape character before '$',
+   like in grub2, otherwise '$' and the following number
+   will be eaten.
 
memmap=nn[KMG]!ss[KMG]
[KNL,X86] Mark specific memory as protected.
-- 
2.5.5



[PATCH v4 2/3] KASLR: Handle memory limit specified by memmap and mem option

2017-05-08 Thread Baoquan He
Option mem= will limit the max address a system can use and any memory
region above the limit will be removed.

Furthermore, memmap=nn[KMG] which has no offset specified has the same
behaviour as mem=.

KASLR needs to consider this when choosing the random position for
decompressing the kernel.

This patch implements that.

Signed-off-by: Baoquan He 
---
 arch/x86/boot/compressed/kaslr.c | 69 +---
 1 file changed, 51 insertions(+), 18 deletions(-)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 106e13b..0637e85 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -88,6 +88,10 @@ struct mem_vector {
 static bool memmap_too_large;
 
 
+/* Store memory limit specified by "mem=nn[KMG]" or "memmap=nn[KMG]" */
+unsigned long long mem_limit = ULLONG_MAX;
+
+
 enum mem_avoid_index {
MEM_AVOID_ZO_RANGE = 0,
MEM_AVOID_INITRD,
@@ -138,16 +142,24 @@ parse_memmap(char *p, unsigned long long *start, unsigned 
long long *size)
return -EINVAL;
 
switch (*p) {
-   case '@':
-   /* Skip this region, usable */
-   *start = 0;
-   *size = 0;
-   return 0;
case '#':
case '$':
case '!':
*start = memparse(p + 1, );
return 0;
+   case '@':   /* Fall through: */
+   /*
+* memmap=nn@ss specifies usable region, should be skipped
+*/
+   *size = 0;
+   default:
+   /*
+* If w/o offset, only size specified, memmap=nn[KMG] has the
+* same behaviour as mem=nn[KMG]. It limits the max address
+* system can use. Region above the limit should be avoided.
+*/
+   *start = 0;
+   return 0;
}
 
return -EINVAL;
@@ -173,9 +185,14 @@ static void mem_avoid_memmap(char *str)
if (rc < 0)
break;
str = k;
-   /* A usable region that should not be skipped */
-   if (size == 0)
+
+   if (start == 0) {
+   /* Store the specified memory limit if size > 0 */
+   if (size > 0)
+   mem_limit = size;
+
continue;
+   }
 
mem_avoid[MEM_AVOID_MEMMAP_BEGIN + i].start = start;
mem_avoid[MEM_AVOID_MEMMAP_BEGIN + i].size = size;
@@ -187,19 +204,15 @@ static void mem_avoid_memmap(char *str)
memmap_too_large = true;
 }
 
-
-/*
- * handle_mem_memmap will also cover 'mem=' issue in next patch. Will remove
- * this note later.
- */
 static int handle_mem_memmap(void)
 {
char *args = (char *)get_cmd_line_ptr();
size_t len = strlen((char *)args);
char *tmp_cmdline;
char *param, *val;
+   u64 mem_size;
 
-   if (!strstr(args, "memmap="))
+   if (!strstr(args, "memmap=") && !strstr(args, "mem="))
return 0;
 
tmp_cmdline = malloc(len + 1);
@@ -222,8 +235,20 @@ static int handle_mem_memmap(void)
return -1;
}
 
-   if (!strcmp(param, "memmap"))
+   if (!strcmp(param, "memmap")) {
mem_avoid_memmap(val);
+   } else if (!strcmp(param, "mem")) {
+   char *p = val;
+
+   if (!strcmp(p, "nopentium"))
+   continue;
+   mem_size = memparse(p, );
+   if (mem_size == 0) {
+   free(tmp_cmdline);
+   return -EINVAL;
+   }
+   mem_limit = mem_size;
+   }
}
 
free(tmp_cmdline);
@@ -460,7 +485,8 @@ static void process_e820_entry(struct boot_e820_entry 
*entry,
 {
struct mem_vector region, overlap;
struct slot_area slot_area;
-   unsigned long start_orig;
+   unsigned long start_orig, end;
+   struct boot_e820_entry cur_entry;
 
/* Skip non-RAM entries. */
if (entry->type != E820_TYPE_RAM)
@@ -474,8 +500,15 @@ static void process_e820_entry(struct boot_e820_entry 
*entry,
if (entry->addr + entry->size < minimum)
return;
 
-   region.start = entry->addr;
-   region.size = entry->size;
+   /* Ignore entries above memory limit */
+   end = min(entry->size + entry->addr, mem_limit);
+   if (entry->addr >= end)
+   return;
+   cur_entry.addr = entry->addr;
+   cur_entry.size = end - entry->addr;
+
+   region.start = cur_entry.addr;
+   region.size = cur_entry.size;
 
/* Give up if slot area array is full. */
while (slot_area_index < MAX_SLOT_AREA) {
@@ -489,7 +522,7 @@ static void 

[PATCH v4 3/3] Documentation/kernel-parameters.txt: Update 'memmap=' option description

2017-05-08 Thread Baoquan He
In commit:

  9710f581bb4c ("x86, mm: Let "memmap=" take more entries one time")

... 'memmap=' was changed to adopt multiple, comma delimited values in a
single entry, so update the related description.

In the special case of only specifying size value without an offset,
like memmap=nn[KMG], memmap behaves similarly to mem=nn[KMG], so update
it too here.

Furthermore, for memmap=nn[KMG]$ss[KMG], an escape character needs be added
before '$' for some bootloaders. E.g in grub2, if we specify memmap=100M$5G
as suggested by the documentation, "memmap=100MG" gets passed to the kernel.

Clarify all this.

Signed-off-by: Baoquan He 
---
 Documentation/admin-guide/kernel-parameters.txt | 9 +
 1 file changed, 9 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index e4c9e0e..8d37f26 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2112,6 +2112,12 @@
memmap=nn[KMG]@ss[KMG]
[KNL] Force usage of a specific region of memory.
Region of memory to be used is from ss to ss+nn.
+   If @ss[KMG] is omitted, it equals to mem=nn[KMG]
+   which limits max address as nn[KMG].
+   Multiple different options can be put into one entry
+   with comma delimited to save space:
+   Example:
+   memmap=100M@2G,100M#3G,1G!1024G
 
memmap=nn[KMG]#ss[KMG]
[KNL,ACPI] Mark specific memory as ACPI data.
@@ -2124,6 +2130,9 @@
 memmap=64K$0x1869
 or
 memmap=0x1$0x1869
+   Some bootloaders may need escape character before '$',
+   like in grub2, otherwise '$' and the following number
+   will be eaten.
 
memmap=nn[KMG]!ss[KMG]
[KNL,X86] Mark specific memory as protected.
-- 
2.5.5



[PATCH v4 4/4] ACPI: Fix memory mapping leaks in current sysfs dumpable ACPI tables support

2017-05-08 Thread Lv Zheng
This patch adds acpi_put_table() to make all acpi_get_table() clone
invocations balanced for sysfs ACPI table dump code.

Since Linux does not use all of the tables, this can help to reduce some
usless memory mappings.

While originally, all tables will be remained to be mapped after a
userspace acpidump execution, potentially causing problem on server
platforms. With the new APIs, it is possible to release such useless table
mappings.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/sysfs.c | 41 +++--
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 2bbf722..14425dc 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -346,11 +346,22 @@ static ssize_t acpi_table_show(struct file *filp, struct 
kobject *kobj,
return len;
 }
 
+static bool acpi_table_has_multiple_instances(char *signature)
+{
+   acpi_status status;
+   struct acpi_table_header *header;
+
+   status = acpi_get_table(signature, 2, );
+   if (ACPI_FAILURE(status))
+   return false;
+   acpi_put_table(header);
+   return true;
+}
+
 static int acpi_table_attr_init(struct kobject *tables_obj,
struct acpi_table_attr *table_attr,
struct acpi_table_header *table_header)
 {
-   struct acpi_table_header *header = NULL;
struct acpi_table_attr *attr = NULL;
char instance_str[ACPI_INST_SIZE];
 
@@ -371,9 +382,9 @@ static int acpi_table_attr_init(struct kobject *tables_obj,
 
ACPI_MOVE_NAME(table_attr->filename, table_header->signature);
table_attr->filename[ACPI_NAME_SIZE] = '\0';
-   if (table_attr->instance > 1 || (table_attr->instance == 1 &&
-!acpi_get_table
-(table_header->signature, 2, 
))) {
+   if (table_attr->instance > 1 ||
+   (table_attr->instance == 1 &&
+acpi_table_has_multiple_instances(table_header->signature))) {
snprintf(instance_str, sizeof(instance_str), "%u",
 table_attr->instance);
strcat(table_attr->filename, instance_str);
@@ -422,11 +433,11 @@ acpi_status acpi_sysfs_table_handler(u32 event, void 
*table, void *context)
 
 static int acpi_tables_sysfs_init(void)
 {
-   struct acpi_table_attr *table_attr;
+   struct acpi_table_attr *table_attr = NULL;
struct acpi_table_header *table_header = NULL;
int table_index;
acpi_status status;
-   int ret;
+   int ret = 0;
 
tables_kobj = kobject_create_and_add("tables", acpi_kobj);
if (!tables_kobj)
@@ -446,16 +457,26 @@ static int acpi_tables_sysfs_init(void)
continue;
 
table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
-   if (!table_attr)
-   return -ENOMEM;
+   if (!table_attr) {
+   ret = -ENOMEM;
+   goto next_table;
+   }
 
ret = acpi_table_attr_init(tables_kobj,
   table_attr, table_header);
+   if (ret)
+   goto next_table;
+   list_add_tail(_attr->node, _table_attr_list);
+
+next_table:
+   acpi_put_table(table_header);
if (ret) {
-   kfree(table_attr);
+   if (table_attr) {
+   kfree(table_attr);
+   table_attr = NULL;
+   }
return ret;
}
-   list_add_tail(_attr->node, _table_attr_list);
}
 
kobject_uevent(tables_kobj, KOBJ_ADD);
-- 
2.7.4



[PATCH v4 4/4] ACPI: Fix memory mapping leaks in current sysfs dumpable ACPI tables support

2017-05-08 Thread Lv Zheng
This patch adds acpi_put_table() to make all acpi_get_table() clone
invocations balanced for sysfs ACPI table dump code.

Since Linux does not use all of the tables, this can help to reduce some
usless memory mappings.

While originally, all tables will be remained to be mapped after a
userspace acpidump execution, potentially causing problem on server
platforms. With the new APIs, it is possible to release such useless table
mappings.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/sysfs.c | 41 +++--
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 2bbf722..14425dc 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -346,11 +346,22 @@ static ssize_t acpi_table_show(struct file *filp, struct 
kobject *kobj,
return len;
 }
 
+static bool acpi_table_has_multiple_instances(char *signature)
+{
+   acpi_status status;
+   struct acpi_table_header *header;
+
+   status = acpi_get_table(signature, 2, );
+   if (ACPI_FAILURE(status))
+   return false;
+   acpi_put_table(header);
+   return true;
+}
+
 static int acpi_table_attr_init(struct kobject *tables_obj,
struct acpi_table_attr *table_attr,
struct acpi_table_header *table_header)
 {
-   struct acpi_table_header *header = NULL;
struct acpi_table_attr *attr = NULL;
char instance_str[ACPI_INST_SIZE];
 
@@ -371,9 +382,9 @@ static int acpi_table_attr_init(struct kobject *tables_obj,
 
ACPI_MOVE_NAME(table_attr->filename, table_header->signature);
table_attr->filename[ACPI_NAME_SIZE] = '\0';
-   if (table_attr->instance > 1 || (table_attr->instance == 1 &&
-!acpi_get_table
-(table_header->signature, 2, 
))) {
+   if (table_attr->instance > 1 ||
+   (table_attr->instance == 1 &&
+acpi_table_has_multiple_instances(table_header->signature))) {
snprintf(instance_str, sizeof(instance_str), "%u",
 table_attr->instance);
strcat(table_attr->filename, instance_str);
@@ -422,11 +433,11 @@ acpi_status acpi_sysfs_table_handler(u32 event, void 
*table, void *context)
 
 static int acpi_tables_sysfs_init(void)
 {
-   struct acpi_table_attr *table_attr;
+   struct acpi_table_attr *table_attr = NULL;
struct acpi_table_header *table_header = NULL;
int table_index;
acpi_status status;
-   int ret;
+   int ret = 0;
 
tables_kobj = kobject_create_and_add("tables", acpi_kobj);
if (!tables_kobj)
@@ -446,16 +457,26 @@ static int acpi_tables_sysfs_init(void)
continue;
 
table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
-   if (!table_attr)
-   return -ENOMEM;
+   if (!table_attr) {
+   ret = -ENOMEM;
+   goto next_table;
+   }
 
ret = acpi_table_attr_init(tables_kobj,
   table_attr, table_header);
+   if (ret)
+   goto next_table;
+   list_add_tail(_attr->node, _table_attr_list);
+
+next_table:
+   acpi_put_table(table_header);
if (ret) {
-   kfree(table_attr);
+   if (table_attr) {
+   kfree(table_attr);
+   table_attr = NULL;
+   }
return ret;
}
-   list_add_tail(_attr->node, _table_attr_list);
}
 
kobject_uevent(tables_kobj, KOBJ_ADD);
-- 
2.7.4



[PATCH v4 0/3] Handle memmap and mem kernel options in boot stage kaslr

2017-05-08 Thread Baoquan He
People reported kernel panic occurs during system boots up with mem boot option.
After checking code, several problems are found about memmap= and mem= in boot 
stage
kaslr.

*) In commit f28442497b5c ("x86/boot: Fix KASLR and memmap= collision"), only 
one memmap
   entry is considered and only the last one if multiple memmap entries are 
specified.

*) mem= and memmap=nn[KMG] are not considered yet. They are used to limit max 
address
   of system. Kernel can't be randomized to be above the limit.

*) kernel-parameters.txt doesn't tell the updated behaviour of memmap=.

This patchset tries to solve above issues, and it sits on top of
tip:x86/boot branch.

Changelog

v3->v4:
 *Code improved patch 1/3 according to Kees's suggestion.

 *Add 'Fall through' in switch case of parse_memmap() which
  is suggestd by Kees.

v2->v3:
  No functionality change in this round.
 *Use local static variable insted of global variable
  mem_avoid_memmap_index in patch 1/3.

 *Fix a typo in patch 3/3.

v1->v2:
 *The original patch 1/4 has been put in tip:x86/boot and no update,
  so it's not included in this post.

 *Use patch log Ingo reorganized.

 *lib/ctype.c and lib/cmdline.c are needed for kaslr.c, while those
  EXPORT_SYMBOL(x) contained caused failure of build on 32-bit allmodconfig:
  ..
  ld: -r and -shared may not be used together
  scripts/Makefile.build:294: recipe for target 
'arch/x86/boot/compressed/kaslr.o' failed
  ..
  Disabling the symbol exporting removes the build failure.

 *Use dynamic allocation to allocate memory to contain copied kernel cmdline
  buffer, it's implemented in include/linux/decompress/mm.h.

Baoquan He (3):
  KASLR: Parse all memmap entries in cmdline
  KASLR: Handle memory limit specified by memmap and mem option
  Documentation/kernel-parameters.txt: Update 'memmap=' option
description

 Documentation/admin-guide/kernel-parameters.txt |   9 ++
 arch/x86/boot/compressed/cmdline.c  |   2 +-
 arch/x86/boot/compressed/kaslr.c| 191 
 arch/x86/boot/string.c  |   8 +
 4 files changed, 144 insertions(+), 66 deletions(-)

-- 
2.5.5



[PATCH v4 0/3] Handle memmap and mem kernel options in boot stage kaslr

2017-05-08 Thread Baoquan He
People reported kernel panic occurs during system boots up with mem boot option.
After checking code, several problems are found about memmap= and mem= in boot 
stage
kaslr.

*) In commit f28442497b5c ("x86/boot: Fix KASLR and memmap= collision"), only 
one memmap
   entry is considered and only the last one if multiple memmap entries are 
specified.

*) mem= and memmap=nn[KMG] are not considered yet. They are used to limit max 
address
   of system. Kernel can't be randomized to be above the limit.

*) kernel-parameters.txt doesn't tell the updated behaviour of memmap=.

This patchset tries to solve above issues, and it sits on top of
tip:x86/boot branch.

Changelog

v3->v4:
 *Code improved patch 1/3 according to Kees's suggestion.

 *Add 'Fall through' in switch case of parse_memmap() which
  is suggestd by Kees.

v2->v3:
  No functionality change in this round.
 *Use local static variable insted of global variable
  mem_avoid_memmap_index in patch 1/3.

 *Fix a typo in patch 3/3.

v1->v2:
 *The original patch 1/4 has been put in tip:x86/boot and no update,
  so it's not included in this post.

 *Use patch log Ingo reorganized.

 *lib/ctype.c and lib/cmdline.c are needed for kaslr.c, while those
  EXPORT_SYMBOL(x) contained caused failure of build on 32-bit allmodconfig:
  ..
  ld: -r and -shared may not be used together
  scripts/Makefile.build:294: recipe for target 
'arch/x86/boot/compressed/kaslr.o' failed
  ..
  Disabling the symbol exporting removes the build failure.

 *Use dynamic allocation to allocate memory to contain copied kernel cmdline
  buffer, it's implemented in include/linux/decompress/mm.h.

Baoquan He (3):
  KASLR: Parse all memmap entries in cmdline
  KASLR: Handle memory limit specified by memmap and mem option
  Documentation/kernel-parameters.txt: Update 'memmap=' option
description

 Documentation/admin-guide/kernel-parameters.txt |   9 ++
 arch/x86/boot/compressed/cmdline.c  |   2 +-
 arch/x86/boot/compressed/kaslr.c| 191 
 arch/x86/boot/string.c  |   8 +
 4 files changed, 144 insertions(+), 66 deletions(-)

-- 
2.5.5



[PATCH v4 1/4] ACPICA: Tables: Fix regression introduced by a too early mechanism enabling

2017-05-08 Thread Lv Zheng
In the Linux kernel side, acpi_get_table() clones haven't been fully
balanced by acpi_put_table() invocations. In ACPICA side, due to the design
change, there are also unbalanced acpi_get_table_by_index() invocations
requiring special care.

So it is not a good timing to report acpi_get_table() counting errors. The
strict balanced validation count check should only be enabled after
confirming that all invocations are safe and compliant to their designed
purposes.

Thus this patch removes the fatal error along with the error report to
fix this issue. Reported by Dan Williams, fixed by Lv Zheng.

Fixes: 174cc7187e6f ("ACPICA: Tables: Back port acpi_get_table_with_size() and 
early_acpi_os_unmap_memory() from Linux kernel")
Cc: 
Reported-by: Anush Seetharaman 
Reported-by: Dan Williams 
Cc: Anush Seetharaman 
Cc: Dan Williams 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/tbutils.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 5a968a7..7abe665 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -418,11 +418,7 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc,
 
table_desc->validation_count++;
if (table_desc->validation_count == 0) {
-   ACPI_ERROR((AE_INFO,
-   "Table %p, Validation count is zero after 
increment\n",
-   table_desc));
table_desc->validation_count--;
-   return_ACPI_STATUS(AE_LIMIT);
}
 
*out_table = table_desc->pointer;
-- 
2.7.4




[PATCH v4 1/4] ACPICA: Tables: Fix regression introduced by a too early mechanism enabling

2017-05-08 Thread Lv Zheng
In the Linux kernel side, acpi_get_table() clones haven't been fully
balanced by acpi_put_table() invocations. In ACPICA side, due to the design
change, there are also unbalanced acpi_get_table_by_index() invocations
requiring special care.

So it is not a good timing to report acpi_get_table() counting errors. The
strict balanced validation count check should only be enabled after
confirming that all invocations are safe and compliant to their designed
purposes.

Thus this patch removes the fatal error along with the error report to
fix this issue. Reported by Dan Williams, fixed by Lv Zheng.

Fixes: 174cc7187e6f ("ACPICA: Tables: Back port acpi_get_table_with_size() and 
early_acpi_os_unmap_memory() from Linux kernel")
Cc: 
Reported-by: Anush Seetharaman 
Reported-by: Dan Williams 
Cc: Anush Seetharaman 
Cc: Dan Williams 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/tbutils.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 5a968a7..7abe665 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -418,11 +418,7 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc,
 
table_desc->validation_count++;
if (table_desc->validation_count == 0) {
-   ACPI_ERROR((AE_INFO,
-   "Table %p, Validation count is zero after 
increment\n",
-   table_desc));
table_desc->validation_count--;
-   return_ACPI_STATUS(AE_LIMIT);
}
 
*out_table = table_desc->pointer;
-- 
2.7.4




Re: [PATCH] mfd: cros-ec: Add cros_ec_readmem() helpers for I2C/SPI based ECs

2017-05-08 Thread kbuild test robot
Hi Moritz,

[auto build test WARNING on ljones-mfd/for-mfd-next]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Moritz-Fischer/mfd-cros-ec-Add-cros_ec_readmem-helpers-for-I2C-SPI-based-ECs/20170509-040606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: tile-allmodconfig
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
make.cross ARCH=tile  allmodconfig
make.cross ARCH=tile 

All warnings (new ones prefixed by >>):


vim +279 drivers/mfd/cros_ec.c

   263  return 0;
   264  }
   265  EXPORT_SYMBOL(cros_ec_resume);
   266  
   267  #endif
   268  
   269  int cros_ec_readmem(struct cros_ec_device *ec, unsigned int offset,
   270 unsigned int bytes, void *dest)
   271  {
   272  int ret;
   273  struct ec_params_read_memmap *params;
   274  struct cros_ec_command *msg;
   275  
   276  if (offset >= EC_MEMMAP_SIZE - bytes)
   277  return -EINVAL;
   278  
 > 279  msg = kzalloc(sizeof(*msg) + max(sizeof(*params), bytes), 
 > GFP_KERNEL);
   280  if (!msg)
   281  return -ENOMEM;
   282  
   283  msg->version = 0;
   284  msg->command = EC_CMD_READ_MEMMAP;
   285  msg->insize = bytes;
   286  msg->outsize = sizeof(*params);
   287  

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


Re: [PATCH] mfd: cros-ec: Add cros_ec_readmem() helpers for I2C/SPI based ECs

2017-05-08 Thread kbuild test robot
Hi Moritz,

[auto build test WARNING on ljones-mfd/for-mfd-next]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Moritz-Fischer/mfd-cros-ec-Add-cros_ec_readmem-helpers-for-I2C-SPI-based-ECs/20170509-040606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: tile-allmodconfig
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
make.cross ARCH=tile  allmodconfig
make.cross ARCH=tile 

All warnings (new ones prefixed by >>):


vim +279 drivers/mfd/cros_ec.c

   263  return 0;
   264  }
   265  EXPORT_SYMBOL(cros_ec_resume);
   266  
   267  #endif
   268  
   269  int cros_ec_readmem(struct cros_ec_device *ec, unsigned int offset,
   270 unsigned int bytes, void *dest)
   271  {
   272  int ret;
   273  struct ec_params_read_memmap *params;
   274  struct cros_ec_command *msg;
   275  
   276  if (offset >= EC_MEMMAP_SIZE - bytes)
   277  return -EINVAL;
   278  
 > 279  msg = kzalloc(sizeof(*msg) + max(sizeof(*params), bytes), 
 > GFP_KERNEL);
   280  if (!msg)
   281  return -ENOMEM;
   282  
   283  msg->version = 0;
   284  msg->command = EC_CMD_READ_MEMMAP;
   285  msg->insize = bytes;
   286  msg->outsize = sizeof(*params);
   287  

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


Re: [PATCH v2 3/3] fs: ubifs: set s_uuid in super block

2017-05-08 Thread Oleksij Rempel



On 05/09/2017 07:37 AM, Amir Goldstein wrote:



On Tue, May 9, 2017 at 7:13 AM, Oleksij Rempel > wrote:



On 05/02/2017 09:37 AM, Richard Weinberger wrote:

Amir,

Am 02.05.2017 um 09:19 schrieb Amir Goldstein:

On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger
> wrote:

Am 24.04.2017 um 17:47 schrieb Richard Weinberger:

So, if some flag should be implemented, who
should do it? :)


I'll not do it for you. ;)


Please also see
http://marc.info/?l=linux-fsdevel=149327990608749=2



Richard,

Considering the facts that:
1. I proposed the said flag and Al didn't think it was
needed [1]
2. ext4 already sets s_uuid without any flag for a long time now
3. A similar patch was queued for v4.12 to set s_uuid for
xfs without any flag

I think it would be right to take Oleksij's patch as is.

FYI, my current work on 'constant inode numbers for
overlayfs' requires that
underlying filesystem had set a non-zero s_uuid. Not sure if
that matters for
ubifs+overlayfs users.


If VFS maintainers are fine with that, I'll take it.
From UBIFS' POV it does not matter much. :-)


Ping to VFS maintainers?


What ping? Al made it clear that a flag is not needed.
BTW, xfs s_uuid patch was merged to master.



I'm talking about ubifs patch.


Re: [PATCH v2 3/3] fs: ubifs: set s_uuid in super block

2017-05-08 Thread Oleksij Rempel



On 05/09/2017 07:37 AM, Amir Goldstein wrote:



On Tue, May 9, 2017 at 7:13 AM, Oleksij Rempel mailto:o...@pengutronix.de>> wrote:



On 05/02/2017 09:37 AM, Richard Weinberger wrote:

Amir,

Am 02.05.2017 um 09:19 schrieb Amir Goldstein:

On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger
mailto:rich...@nod.at>> wrote:

Am 24.04.2017 um 17:47 schrieb Richard Weinberger:

So, if some flag should be implemented, who
should do it? :)


I'll not do it for you. ;)


Please also see
http://marc.info/?l=linux-fsdevel=149327990608749=2



Richard,

Considering the facts that:
1. I proposed the said flag and Al didn't think it was
needed [1]
2. ext4 already sets s_uuid without any flag for a long time now
3. A similar patch was queued for v4.12 to set s_uuid for
xfs without any flag

I think it would be right to take Oleksij's patch as is.

FYI, my current work on 'constant inode numbers for
overlayfs' requires that
underlying filesystem had set a non-zero s_uuid. Not sure if
that matters for
ubifs+overlayfs users.


If VFS maintainers are fine with that, I'll take it.
From UBIFS' POV it does not matter much. :-)


Ping to VFS maintainers?


What ping? Al made it clear that a flag is not needed.
BTW, xfs s_uuid patch was merged to master.



I'm talking about ubifs patch.


lening bieden

2017-05-08 Thread SAFETY NET CREDIT


Goede dag,

 Dit is het beveiligingsnetwerk van de kredietverstrekking.

  SAFETY NET CREDIT biedt flexibele en betaalbare leningen voor elk doel om u 
te helpen uw doelen te bereiken. We lenen tegen een lage rente van 3%. Hier 
zijn enkele belangrijke kenmerken van de persoonlijke lening aangeboden door 
SAFETY NET CREDIT. Hier zijn de Lening Factoren die we samenwerken met de 
toonaangevende Britse makelaars die toegang hebben tot topleners en kunnen de 
beste financiële oplossing tegen een betaalbare prijs vinden. Als u 
geïnteresseerd bent, neem dan contact met ons op via deze e-mail: 
safetynetcredi...@gmail.com

Na de reactie ontvangt u een aanvraag voor leningsvulling. Geen sociale 
zekerheid en geen credit check, 100% gegarandeerd.

Het zal onze eer zijn als u ons toelaat om tot uw dienst te zijn.


INFORMATIE NODIG

Jullie namen
Adres: ...
Telefoon: ...
Bedrag nodig: 
Looptijd: ...
Beroep: ...
Maandelijks Inkomen Niveau: 
Geslacht: ...
Geboortedatum: 
Staat: ..
Land: ..
Doel: .

Het voldoen aan uw financiële behoeften is onze trots.


Dr.John Mahama.


lening bieden

2017-05-08 Thread SAFETY NET CREDIT


Goede dag,

 Dit is het beveiligingsnetwerk van de kredietverstrekking.

  SAFETY NET CREDIT biedt flexibele en betaalbare leningen voor elk doel om u 
te helpen uw doelen te bereiken. We lenen tegen een lage rente van 3%. Hier 
zijn enkele belangrijke kenmerken van de persoonlijke lening aangeboden door 
SAFETY NET CREDIT. Hier zijn de Lening Factoren die we samenwerken met de 
toonaangevende Britse makelaars die toegang hebben tot topleners en kunnen de 
beste financiële oplossing tegen een betaalbare prijs vinden. Als u 
geïnteresseerd bent, neem dan contact met ons op via deze e-mail: 
safetynetcredi...@gmail.com

Na de reactie ontvangt u een aanvraag voor leningsvulling. Geen sociale 
zekerheid en geen credit check, 100% gegarandeerd.

Het zal onze eer zijn als u ons toelaat om tot uw dienst te zijn.


INFORMATIE NODIG

Jullie namen
Adres: ...
Telefoon: ...
Bedrag nodig: 
Looptijd: ...
Beroep: ...
Maandelijks Inkomen Niveau: 
Geslacht: ...
Geboortedatum: 
Staat: ..
Land: ..
Doel: .

Het voldoen aan uw financiële behoeften is onze trots.


Dr.John Mahama.


Re: sky2: Use seq_putc() in sky2_debug_show()

2017-05-08 Thread Stephen Hemminger
On Mon, 8 May 2017 19:42:46 +0200
SF Markus Elfring  wrote:

> > Which issue do you mean? I dont see any issue you fix here.  
> 
> Are the run time characteristics a bit nicer for the function “seq_putc”
> in comparison to the function “seq_puts” for printing a single line break 
> here?
> 
> Regards,
> Markus

I would put this in why bother category. seq_puts is correct and this is only
in diagnostic output useful to developer and disabled on most distro kernels


Re: sky2: Use seq_putc() in sky2_debug_show()

2017-05-08 Thread Stephen Hemminger
On Mon, 8 May 2017 19:42:46 +0200
SF Markus Elfring  wrote:

> > Which issue do you mean? I dont see any issue you fix here.  
> 
> Are the run time characteristics a bit nicer for the function “seq_putc”
> in comparison to the function “seq_puts” for printing a single line break 
> here?
> 
> Regards,
> Markus

I would put this in why bother category. seq_puts is correct and this is only
in diagnostic output useful to developer and disabled on most distro kernels


Re: [PATCH] dt-bindings: power: New bindings for ltc3651-charger

2017-05-08 Thread Mike Looijmans

On 08-05-17 19:12, Rob Herring wrote:

On Fri, May 05, 2017 at 08:38:35AM +0200, Mike Looijmans wrote:

This adds the devicetree bindings documentation for the LTC3651 battery charger.

Signed-off-by: Mike Looijmans 
---
 .../bindings/power/supply/ltc3651-charger.txt  | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt 
b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
new file mode 100644
index 000..a7dd80f
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
@@ -0,0 +1,26 @@
+ltc3651-charger
+
+Required properties:
+ - compatible: "lltc,ltc3651-charger"
+ - acpr-gpios: Connect to ACPR output. See remark below.
+
+Optional properties:
+ - fault-gpios: Connect to FAULT output. See remark below.
+ - chrg-gpios: Connect to CHRG output. See remark below.


All the gpios need vendor prefix.


Will prefix "lltc," adjust the driver and submit new patches.




+
+The ltc3651 outputs are open-drain type and active low. The driver assumes the
+GPIO reports "active" when the output is asserted, so if the pins have been
+connected directly, the GPIO flags should be set to active low also.
+
+The driver will attempt to aquire interrupts for all GPIOs. If the system is
+not capabale of providing that, the driver cannot report changes and userspace
+will need to periodically read the sysfs attributes to detect changes.


If these are interrupts, then you should use the interrupt binding
instead (most GPIO controllers are also interrupt controllers).


They're GPIO (the driver needs the current state), the use of interrupts is 
just to detect changes. Similar to gpio-charger for example. Interrupt 
bindings cannot provide the current state of the line.






+
+Example:
+
+   charger: battery-charger {
+   compatible = "lltc,ltc3651-charger";
+   acpr-gpios = < 68 GPIO_ACTIVE_LOW>;
+   fault-gpios = < 64 GPIO_ACTIVE_LOW>;
+   chrg-gpios = < 63 GPIO_ACTIVE_LOW>;
+   };
--
1.9.1





Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijm...@topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail







Re: [PATCH] dt-bindings: power: New bindings for ltc3651-charger

2017-05-08 Thread Mike Looijmans

On 08-05-17 19:12, Rob Herring wrote:

On Fri, May 05, 2017 at 08:38:35AM +0200, Mike Looijmans wrote:

This adds the devicetree bindings documentation for the LTC3651 battery charger.

Signed-off-by: Mike Looijmans 
---
 .../bindings/power/supply/ltc3651-charger.txt  | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt 
b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
new file mode 100644
index 000..a7dd80f
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
@@ -0,0 +1,26 @@
+ltc3651-charger
+
+Required properties:
+ - compatible: "lltc,ltc3651-charger"
+ - acpr-gpios: Connect to ACPR output. See remark below.
+
+Optional properties:
+ - fault-gpios: Connect to FAULT output. See remark below.
+ - chrg-gpios: Connect to CHRG output. See remark below.


All the gpios need vendor prefix.


Will prefix "lltc," adjust the driver and submit new patches.




+
+The ltc3651 outputs are open-drain type and active low. The driver assumes the
+GPIO reports "active" when the output is asserted, so if the pins have been
+connected directly, the GPIO flags should be set to active low also.
+
+The driver will attempt to aquire interrupts for all GPIOs. If the system is
+not capabale of providing that, the driver cannot report changes and userspace
+will need to periodically read the sysfs attributes to detect changes.


If these are interrupts, then you should use the interrupt binding
instead (most GPIO controllers are also interrupt controllers).


They're GPIO (the driver needs the current state), the use of interrupts is 
just to detect changes. Similar to gpio-charger for example. Interrupt 
bindings cannot provide the current state of the line.






+
+Example:
+
+   charger: battery-charger {
+   compatible = "lltc,ltc3651-charger";
+   acpr-gpios = < 68 GPIO_ACTIVE_LOW>;
+   fault-gpios = < 64 GPIO_ACTIVE_LOW>;
+   chrg-gpios = < 63 GPIO_ACTIVE_LOW>;
+   };
--
1.9.1





Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijm...@topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail







[PATCH v3] power: Add ltc3651-charger driver

2017-05-08 Thread Mike Looijmans
The LTC3651 reports its status via GPIO lines. This driver translates
the GPIO levels to battery charger status information via sysfs.
It relies on devicetree to supply the IO configuration.

Signed-off-by: Mike Looijmans 
---
v3: Add "lltc" vendor prefix to DT gpios properties
v2: Remove unused include
Remove last part of license text
Use devm_power_supply_register
Use "lltc" vendor prefix
 drivers/power/supply/Kconfig   |   7 ++
 drivers/power/supply/Makefile  |   1 +
 drivers/power/supply/ltc3651-charger.c | 210 +
 3 files changed, 218 insertions(+)
 create mode 100644 drivers/power/supply/ltc3651-charger.c

diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index da92275..77b34e7 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -388,6 +388,13 @@ config CHARGER_MANAGER
   runtime and in suspend-to-RAM by waking up the system periodically
   with help of suspend_again support.
 
+config CHARGER_LTC3651
+   tristate "LTC3651 charger"
+   depends on GPIOLIB
+   help
+ Say Y to include support for the LTC3651 battery charger which reports
+ its status via GPIO lines.
+
 config CHARGER_MAX14577
tristate "Maxim MAX14577/77836 battery charger driver"
depends on MFD_MAX14577
diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
index 39fc733..973c386 100644
--- a/drivers/power/supply/Makefile
+++ b/drivers/power/supply/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_CHARGER_LP8727)  += lp8727_charger.o
 obj-$(CONFIG_CHARGER_LP8788)   += lp8788-charger.o
 obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
 obj-$(CONFIG_CHARGER_MANAGER)  += charger-manager.o
+obj-$(CONFIG_CHARGER_LTC3651)  += ltc3651-charger.o
 obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o
 obj-$(CONFIG_CHARGER_DETECTOR_MAX14656)+= max14656_charger_detector.o
 obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
diff --git a/drivers/power/supply/ltc3651-charger.c 
b/drivers/power/supply/ltc3651-charger.c
new file mode 100644
index 000..5f8d5c0
--- /dev/null
+++ b/drivers/power/supply/ltc3651-charger.c
@@ -0,0 +1,210 @@
+/*
+ *  Copyright (C) 2017, Topic Embedded Products
+ *  Driver for LTC3651 charger IC.
+ *
+ *  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 
+
+struct ltc3651_charger {
+   struct power_supply *charger;
+   struct power_supply_desc charger_desc;
+   struct gpio_desc *acpr_gpio;
+   struct gpio_desc *fault_gpio;
+   struct gpio_desc *chrg_gpio;
+};
+
+static irqreturn_t ltc3651_charger_irq(int irq, void *devid)
+{
+   struct power_supply *charger = devid;
+
+   power_supply_changed(charger);
+
+   return IRQ_HANDLED;
+}
+
+static inline struct ltc3651_charger *psy_to_ltc3651_charger(
+   struct power_supply *psy)
+{
+   return power_supply_get_drvdata(psy);
+}
+
+static int ltc3651_charger_get_property(struct power_supply *psy,
+   enum power_supply_property psp, union power_supply_propval *val)
+{
+   struct ltc3651_charger *ltc3651_charger = psy_to_ltc3651_charger(psy);
+
+   switch (psp) {
+   case POWER_SUPPLY_PROP_STATUS:
+   if (!ltc3651_charger->chrg_gpio) {
+   val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
+   break;
+   }
+   if (gpiod_get_value(ltc3651_charger->chrg_gpio))
+   val->intval = POWER_SUPPLY_STATUS_CHARGING;
+   else
+   val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
+   break;
+   case POWER_SUPPLY_PROP_ONLINE:
+   val->intval = gpiod_get_value(ltc3651_charger->acpr_gpio);
+   break;
+   case POWER_SUPPLY_PROP_HEALTH:
+   if (!ltc3651_charger->fault_gpio) {
+   val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
+   break;
+   }
+   if (!gpiod_get_value(ltc3651_charger->fault_gpio)) {
+   val->intval = POWER_SUPPLY_HEALTH_GOOD;
+   break;
+   }
+   /*
+* If the fault pin is active, the chrg pin explains the type
+* of failure.
+*/
+   if (!ltc3651_charger->chrg_gpio) {
+   val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
+   break;
+   }
+   val->intval = gpiod_get_value(ltc3651_charger->chrg_gpio) ?
+   POWER_SUPPLY_HEALTH_OVERHEAT :
+ 

[PATCH v3] power: Add ltc3651-charger driver

2017-05-08 Thread Mike Looijmans
The LTC3651 reports its status via GPIO lines. This driver translates
the GPIO levels to battery charger status information via sysfs.
It relies on devicetree to supply the IO configuration.

Signed-off-by: Mike Looijmans 
---
v3: Add "lltc" vendor prefix to DT gpios properties
v2: Remove unused include
Remove last part of license text
Use devm_power_supply_register
Use "lltc" vendor prefix
 drivers/power/supply/Kconfig   |   7 ++
 drivers/power/supply/Makefile  |   1 +
 drivers/power/supply/ltc3651-charger.c | 210 +
 3 files changed, 218 insertions(+)
 create mode 100644 drivers/power/supply/ltc3651-charger.c

diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index da92275..77b34e7 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -388,6 +388,13 @@ config CHARGER_MANAGER
   runtime and in suspend-to-RAM by waking up the system periodically
   with help of suspend_again support.
 
+config CHARGER_LTC3651
+   tristate "LTC3651 charger"
+   depends on GPIOLIB
+   help
+ Say Y to include support for the LTC3651 battery charger which reports
+ its status via GPIO lines.
+
 config CHARGER_MAX14577
tristate "Maxim MAX14577/77836 battery charger driver"
depends on MFD_MAX14577
diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
index 39fc733..973c386 100644
--- a/drivers/power/supply/Makefile
+++ b/drivers/power/supply/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_CHARGER_LP8727)  += lp8727_charger.o
 obj-$(CONFIG_CHARGER_LP8788)   += lp8788-charger.o
 obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
 obj-$(CONFIG_CHARGER_MANAGER)  += charger-manager.o
+obj-$(CONFIG_CHARGER_LTC3651)  += ltc3651-charger.o
 obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o
 obj-$(CONFIG_CHARGER_DETECTOR_MAX14656)+= max14656_charger_detector.o
 obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
diff --git a/drivers/power/supply/ltc3651-charger.c 
b/drivers/power/supply/ltc3651-charger.c
new file mode 100644
index 000..5f8d5c0
--- /dev/null
+++ b/drivers/power/supply/ltc3651-charger.c
@@ -0,0 +1,210 @@
+/*
+ *  Copyright (C) 2017, Topic Embedded Products
+ *  Driver for LTC3651 charger IC.
+ *
+ *  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 
+
+struct ltc3651_charger {
+   struct power_supply *charger;
+   struct power_supply_desc charger_desc;
+   struct gpio_desc *acpr_gpio;
+   struct gpio_desc *fault_gpio;
+   struct gpio_desc *chrg_gpio;
+};
+
+static irqreturn_t ltc3651_charger_irq(int irq, void *devid)
+{
+   struct power_supply *charger = devid;
+
+   power_supply_changed(charger);
+
+   return IRQ_HANDLED;
+}
+
+static inline struct ltc3651_charger *psy_to_ltc3651_charger(
+   struct power_supply *psy)
+{
+   return power_supply_get_drvdata(psy);
+}
+
+static int ltc3651_charger_get_property(struct power_supply *psy,
+   enum power_supply_property psp, union power_supply_propval *val)
+{
+   struct ltc3651_charger *ltc3651_charger = psy_to_ltc3651_charger(psy);
+
+   switch (psp) {
+   case POWER_SUPPLY_PROP_STATUS:
+   if (!ltc3651_charger->chrg_gpio) {
+   val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
+   break;
+   }
+   if (gpiod_get_value(ltc3651_charger->chrg_gpio))
+   val->intval = POWER_SUPPLY_STATUS_CHARGING;
+   else
+   val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
+   break;
+   case POWER_SUPPLY_PROP_ONLINE:
+   val->intval = gpiod_get_value(ltc3651_charger->acpr_gpio);
+   break;
+   case POWER_SUPPLY_PROP_HEALTH:
+   if (!ltc3651_charger->fault_gpio) {
+   val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
+   break;
+   }
+   if (!gpiod_get_value(ltc3651_charger->fault_gpio)) {
+   val->intval = POWER_SUPPLY_HEALTH_GOOD;
+   break;
+   }
+   /*
+* If the fault pin is active, the chrg pin explains the type
+* of failure.
+*/
+   if (!ltc3651_charger->chrg_gpio) {
+   val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
+   break;
+   }
+   val->intval = gpiod_get_value(ltc3651_charger->chrg_gpio) ?
+   POWER_SUPPLY_HEALTH_OVERHEAT :
+   

Re: CFP: KVM Forum 2017

2017-05-08 Thread Jon Masters
On 05/02/2017 06:41 AM, Paolo Bonzini wrote:
> 
> KVM Forum 2017: Call For Participation
> October 25-27, 2017 - Hilton Prague - Prague, Czech Republic
> 
> (All submissions must be received before midnight June 15, 2017)
> =

(please provide a timezone for the deadline - not including one in the
podcast, just saying "midnight", but it would be nice next time)




Re: CFP: KVM Forum 2017

2017-05-08 Thread Jon Masters
On 05/02/2017 06:41 AM, Paolo Bonzini wrote:
> 
> KVM Forum 2017: Call For Participation
> October 25-27, 2017 - Hilton Prague - Prague, Czech Republic
> 
> (All submissions must be received before midnight June 15, 2017)
> =

(please provide a timezone for the deadline - not including one in the
podcast, just saying "midnight", but it would be nice next time)




Re: [PATCH] driver core: platform: Add ability to find resource by name or index

2017-05-08 Thread Greg Kroah-Hartman
On Mon, May 08, 2017 at 05:59:48PM -0400, Jon Mason wrote:
> It is not always possible to find a resource via the name.  This may be
> due to using previous versions of device tree without the names or using
> ACPI.  To allow for resources to be discovered by either the name or the
> index, a wrapper was created.  It attempts to find the resource via
> name, and if unable to find the resource, will then attempt to find the
> resource via index.
> 
> Suggested-by: Florian Fainelli 
> Signed-off-by: Jon Mason 
> ---
>  include/linux/platform_device.h | 15 +++
>  1 file changed, 15 insertions(+)

Do you have any users for this new function?  We don't like adding apis
without them...

thanks,

greg k-h


Re: [PATCH] driver core: platform: Add ability to find resource by name or index

2017-05-08 Thread Greg Kroah-Hartman
On Mon, May 08, 2017 at 05:59:48PM -0400, Jon Mason wrote:
> It is not always possible to find a resource via the name.  This may be
> due to using previous versions of device tree without the names or using
> ACPI.  To allow for resources to be discovered by either the name or the
> index, a wrapper was created.  It attempts to find the resource via
> name, and if unable to find the resource, will then attempt to find the
> resource via index.
> 
> Suggested-by: Florian Fainelli 
> Signed-off-by: Jon Mason 
> ---
>  include/linux/platform_device.h | 15 +++
>  1 file changed, 15 insertions(+)

Do you have any users for this new function?  We don't like adding apis
without them...

thanks,

greg k-h


Re: [PATCH] misc: Implement devm_misc_register

2017-05-08 Thread Greg Kroah-Hartman
On Tue, May 09, 2017 at 02:27:48AM +, Gregory Fong wrote:
> Add device managed devm_misc_register() to allow simplifying some
> miscdevice code.
> 
> Signed-off-by: Gregory Fong 
> ---
> This seemed like it would be handy for removing a large chunk of the cleanup
> code in various miscdevice users.  Let me know whether you think it'd be worth
> going ahead changing this throughout the codebase where appropriate.

I'd like to see how this is actually used before accepting it, as we
don't like adding apis that do not have any users.  So care to make this
a patch series, first one with this change, and the rest converting some
drivers to use it?

thanks,

greg k-h


Re: [PATCH] misc: Implement devm_misc_register

2017-05-08 Thread Greg Kroah-Hartman
On Tue, May 09, 2017 at 02:27:48AM +, Gregory Fong wrote:
> Add device managed devm_misc_register() to allow simplifying some
> miscdevice code.
> 
> Signed-off-by: Gregory Fong 
> ---
> This seemed like it would be handy for removing a large chunk of the cleanup
> code in various miscdevice users.  Let me know whether you think it'd be worth
> going ahead changing this throughout the codebase where appropriate.

I'd like to see how this is actually used before accepting it, as we
don't like adding apis that do not have any users.  So care to make this
a patch series, first one with this change, and the rest converting some
drivers to use it?

thanks,

greg k-h


[PATCH] net: fec: select queue depending on VLAN priority

2017-05-08 Thread Stefan Agner
Since the addition of the multi queue code with commit 59d0f7465644
("net: fec: init multi queue date structure") the queue selection
has been handelt by the default transmit queue selection
implementation which tries to evenly distribute the traffic across
all available queues. This selection presumes that the queues are
using an equal priority, however, the queues 1 and 2 are actually
of higher priority (the classification of the queues is enabled in
fec_enet_enable_ring).

This can lead to net scheduler warnings and continuous TX ring
dumps when exercising the system with iperf.

Use only queue 0 for all common traffic (no VLAN and P802.1p
priority 0 and 1) and route level 2-7 through queue 1 and 2.

Signed-off-by: Fugang Duan 
Fixes: 59d0f7465644 ("net: fec: init multi queue date structure")
---
This patch solves the issue documented in this thread:
https://www.spinics.net/lists/netdev/msg430679.html

 drivers/net/ethernet/freescale/fec_main.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index 91a16641e851..72343cbfddc9 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -72,6 +72,7 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
 #define DRIVER_NAME"fec"
 
 #define FEC_ENET_GET_QUQUE(_x) ((_x == 0) ? 1 : ((_x == 1) ? 2 : 0))
+static const u16 fec_enet_vlan_pri_to_queue[8] = {0, 0, 1, 1, 1, 2, 2, 2};
 
 /* Pause frame feild and FIFO threshold */
 #define FEC_ENET_FCE   (1 << 5)
@@ -3052,10 +3053,28 @@ static int fec_set_features(struct net_device *netdev,
return 0;
 }
 
+u16 fec_enet_select_queue(struct net_device *ndev, struct sk_buff *skb,
+ void *accel_priv, select_queue_fallback_t fallback)
+{
+   struct fec_enet_private *fep = netdev_priv(ndev);
+   u16 vlan_tci, vlan_pcp;
+
+   if (!(fep->quirks & FEC_QUIRK_HAS_AVB))
+   return fallback(ndev, skb);
+
+   /* Assign queue 0 if no VLAN tag present */
+   if (vlan_get_tag(skb, _tci) < 0)
+   return 0;
+
+   vlan_pcp = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
+   return fec_enet_vlan_pri_to_queue[vlan_pcp];
+}
+
 static const struct net_device_ops fec_netdev_ops = {
.ndo_open   = fec_enet_open,
.ndo_stop   = fec_enet_close,
.ndo_start_xmit = fec_enet_start_xmit,
+   .ndo_select_queue   = fec_enet_select_queue,
.ndo_set_rx_mode= set_multicast_list,
.ndo_validate_addr  = eth_validate_addr,
.ndo_tx_timeout = fec_timeout,
-- 
2.12.2



[PATCH] net: fec: select queue depending on VLAN priority

2017-05-08 Thread Stefan Agner
Since the addition of the multi queue code with commit 59d0f7465644
("net: fec: init multi queue date structure") the queue selection
has been handelt by the default transmit queue selection
implementation which tries to evenly distribute the traffic across
all available queues. This selection presumes that the queues are
using an equal priority, however, the queues 1 and 2 are actually
of higher priority (the classification of the queues is enabled in
fec_enet_enable_ring).

This can lead to net scheduler warnings and continuous TX ring
dumps when exercising the system with iperf.

Use only queue 0 for all common traffic (no VLAN and P802.1p
priority 0 and 1) and route level 2-7 through queue 1 and 2.

Signed-off-by: Fugang Duan 
Fixes: 59d0f7465644 ("net: fec: init multi queue date structure")
---
This patch solves the issue documented in this thread:
https://www.spinics.net/lists/netdev/msg430679.html

 drivers/net/ethernet/freescale/fec_main.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index 91a16641e851..72343cbfddc9 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -72,6 +72,7 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
 #define DRIVER_NAME"fec"
 
 #define FEC_ENET_GET_QUQUE(_x) ((_x == 0) ? 1 : ((_x == 1) ? 2 : 0))
+static const u16 fec_enet_vlan_pri_to_queue[8] = {0, 0, 1, 1, 1, 2, 2, 2};
 
 /* Pause frame feild and FIFO threshold */
 #define FEC_ENET_FCE   (1 << 5)
@@ -3052,10 +3053,28 @@ static int fec_set_features(struct net_device *netdev,
return 0;
 }
 
+u16 fec_enet_select_queue(struct net_device *ndev, struct sk_buff *skb,
+ void *accel_priv, select_queue_fallback_t fallback)
+{
+   struct fec_enet_private *fep = netdev_priv(ndev);
+   u16 vlan_tci, vlan_pcp;
+
+   if (!(fep->quirks & FEC_QUIRK_HAS_AVB))
+   return fallback(ndev, skb);
+
+   /* Assign queue 0 if no VLAN tag present */
+   if (vlan_get_tag(skb, _tci) < 0)
+   return 0;
+
+   vlan_pcp = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
+   return fec_enet_vlan_pri_to_queue[vlan_pcp];
+}
+
 static const struct net_device_ops fec_netdev_ops = {
.ndo_open   = fec_enet_open,
.ndo_stop   = fec_enet_close,
.ndo_start_xmit = fec_enet_start_xmit,
+   .ndo_select_queue   = fec_enet_select_queue,
.ndo_set_rx_mode= set_multicast_list,
.ndo_validate_addr  = eth_validate_addr,
.ndo_tx_timeout = fec_timeout,
-- 
2.12.2



[PATCH v2] dt-bindings: power: New bindings for ltc3651-charger

2017-05-08 Thread Mike Looijmans
This adds the devicetree bindings documentation for the LTC3651 battery charger.

Signed-off-by: Mike Looijmans 
---
v2: Add "lltc," vendor prefix to gpios
Expand irq paragraph

 .../bindings/power/supply/ltc3651-charger.txt  | 27 ++
 1 file changed, 27 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt 
b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
new file mode 100644
index 000..71f2840
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
@@ -0,0 +1,27 @@
+ltc3651-charger
+
+Required properties:
+ - compatible: "lltc,ltc3651-charger"
+ - lltc,acpr-gpios: Connect to ACPR output. See remark below.
+
+Optional properties:
+ - lltc,fault-gpios: Connect to FAULT output. See remark below.
+ - lltc,chrg-gpios: Connect to CHRG output. See remark below.
+
+The ltc3651 outputs are open-drain type and active low. The driver assumes the
+GPIO reports "active" when the output is asserted, so if the pins have been
+connected directly, the GPIO flags should be set to active low also.
+
+The driver will attempt to aquire interrupts for all GPIOs to detect changes in
+line state. If the system is not capabale of providing interrupts, the driver
+cannot report changes and userspace will need to periodically read the sysfs
+attributes to detect changes.
+
+Example:
+
+   charger: battery-charger {
+   compatible = "lltc,ltc3651-charger";
+   lltc,acpr-gpios = < 68 GPIO_ACTIVE_LOW>;
+   lltc,fault-gpios = < 64 GPIO_ACTIVE_LOW>;
+   lltc,chrg-gpios = < 63 GPIO_ACTIVE_LOW>;
+   };
-- 
1.9.1



[PATCH v2] dt-bindings: power: New bindings for ltc3651-charger

2017-05-08 Thread Mike Looijmans
This adds the devicetree bindings documentation for the LTC3651 battery charger.

Signed-off-by: Mike Looijmans 
---
v2: Add "lltc," vendor prefix to gpios
Expand irq paragraph

 .../bindings/power/supply/ltc3651-charger.txt  | 27 ++
 1 file changed, 27 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt 
b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
new file mode 100644
index 000..71f2840
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt
@@ -0,0 +1,27 @@
+ltc3651-charger
+
+Required properties:
+ - compatible: "lltc,ltc3651-charger"
+ - lltc,acpr-gpios: Connect to ACPR output. See remark below.
+
+Optional properties:
+ - lltc,fault-gpios: Connect to FAULT output. See remark below.
+ - lltc,chrg-gpios: Connect to CHRG output. See remark below.
+
+The ltc3651 outputs are open-drain type and active low. The driver assumes the
+GPIO reports "active" when the output is asserted, so if the pins have been
+connected directly, the GPIO flags should be set to active low also.
+
+The driver will attempt to aquire interrupts for all GPIOs to detect changes in
+line state. If the system is not capabale of providing interrupts, the driver
+cannot report changes and userspace will need to periodically read the sysfs
+attributes to detect changes.
+
+Example:
+
+   charger: battery-charger {
+   compatible = "lltc,ltc3651-charger";
+   lltc,acpr-gpios = < 68 GPIO_ACTIVE_LOW>;
+   lltc,fault-gpios = < 64 GPIO_ACTIVE_LOW>;
+   lltc,chrg-gpios = < 63 GPIO_ACTIVE_LOW>;
+   };
-- 
1.9.1



[git pull] vfs.git misc stuff

2017-05-08 Thread Al Viro
Assorted bits and pieces from various people.  No common topic in
that pile, sorry.

The following changes since commit 4f7d029b9bf009fbee76bb10c0c4351a1870d2f3:

  Linux 4.11-rc7 (2017-04-16 13:00:18 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc

for you to fetch changes up to 6b4657667ba06cd2e07206c65e630acdf248bfd1:

  fs/affs: add rename exchange (2017-05-05 15:24:52 -0400)


Al Viro (1):
  remove pointless extern of atime_need_update_rcu()

Christoph Hellwig (2):
  fs: add a VALID_OPEN_FLAGS
  fs: completely ignore unknown open flags

David Howells (1):
  Make stat/lstat/fstatat pass AT_NO_AUTOMOUNT to vfs_statx()

Eric Biggers (2):
  fs: constify tree_descr arrays passed to simple_fill_super()
  fs: remove _submit_bh()

Fabian Frederick (7):
  fs/affs: bugfix: make symbolic links work again
  fs/affs: import amigaffs.h
  fs/affs: remove node generation check
  fs/affs: bugfix: enable writes on OFS disks
  fs/affs: bugfix: Write files greater than page size on OFS
  fs/affs: add rename2 to prepare multiple methods
  fs/affs: add rename exchange

Geliang Tang (1):
  fs: drop duplicate header percpu-rwsem.h

Josef Bacik (1):
  fs: don't set *REFERENCED on single use objects

Mark Charlebois (1):
  fs: compat: Remove warning from COMPATIBLE_IOCTL

 drivers/infiniband/hw/qib/qib_fs.c|  2 +-
 drivers/xen/xenfs/super.c |  4 +-
 fs/affs/affs.h|  4 +-
 {include/linux => fs/affs}/amigaffs.h |  0
 fs/affs/dir.c |  2 +-
 fs/affs/file.c| 10 ++--
 fs/affs/inode.c   |  1 +
 fs/affs/namei.c   | 87 +--
 fs/binfmt_misc.c  |  2 +-
 fs/buffer.c   | 19 ++--
 fs/compat_ioctl.c |  2 +-
 fs/dcache.c   |  4 +-
 fs/debugfs/inode.c|  2 +-
 fs/fcntl.c| 14 ++
 fs/fuse/control.c |  2 +-
 fs/inode.c|  3 +-
 fs/internal.h |  2 -
 fs/libfs.c|  2 +-
 fs/nfsd/nfsctl.c  |  2 +-
 fs/open.c |  6 +++
 fs/tracefs/inode.c|  2 +-
 include/linux/buffer_head.h   |  2 -
 include/linux/fcntl.h |  6 +++
 include/linux/fs.h| 14 +++---
 kernel/bpf/inode.c|  2 +-
 security/inode.c  |  2 +-
 security/selinux/selinuxfs.c  |  4 +-
 security/smack/smackfs.c  |  2 +-
 28 files changed, 130 insertions(+), 74 deletions(-)
 rename {include/linux => fs/affs}/amigaffs.h (100%)


[git pull] vfs.git misc stuff

2017-05-08 Thread Al Viro
Assorted bits and pieces from various people.  No common topic in
that pile, sorry.

The following changes since commit 4f7d029b9bf009fbee76bb10c0c4351a1870d2f3:

  Linux 4.11-rc7 (2017-04-16 13:00:18 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc

for you to fetch changes up to 6b4657667ba06cd2e07206c65e630acdf248bfd1:

  fs/affs: add rename exchange (2017-05-05 15:24:52 -0400)


Al Viro (1):
  remove pointless extern of atime_need_update_rcu()

Christoph Hellwig (2):
  fs: add a VALID_OPEN_FLAGS
  fs: completely ignore unknown open flags

David Howells (1):
  Make stat/lstat/fstatat pass AT_NO_AUTOMOUNT to vfs_statx()

Eric Biggers (2):
  fs: constify tree_descr arrays passed to simple_fill_super()
  fs: remove _submit_bh()

Fabian Frederick (7):
  fs/affs: bugfix: make symbolic links work again
  fs/affs: import amigaffs.h
  fs/affs: remove node generation check
  fs/affs: bugfix: enable writes on OFS disks
  fs/affs: bugfix: Write files greater than page size on OFS
  fs/affs: add rename2 to prepare multiple methods
  fs/affs: add rename exchange

Geliang Tang (1):
  fs: drop duplicate header percpu-rwsem.h

Josef Bacik (1):
  fs: don't set *REFERENCED on single use objects

Mark Charlebois (1):
  fs: compat: Remove warning from COMPATIBLE_IOCTL

 drivers/infiniband/hw/qib/qib_fs.c|  2 +-
 drivers/xen/xenfs/super.c |  4 +-
 fs/affs/affs.h|  4 +-
 {include/linux => fs/affs}/amigaffs.h |  0
 fs/affs/dir.c |  2 +-
 fs/affs/file.c| 10 ++--
 fs/affs/inode.c   |  1 +
 fs/affs/namei.c   | 87 +--
 fs/binfmt_misc.c  |  2 +-
 fs/buffer.c   | 19 ++--
 fs/compat_ioctl.c |  2 +-
 fs/dcache.c   |  4 +-
 fs/debugfs/inode.c|  2 +-
 fs/fcntl.c| 14 ++
 fs/fuse/control.c |  2 +-
 fs/inode.c|  3 +-
 fs/internal.h |  2 -
 fs/libfs.c|  2 +-
 fs/nfsd/nfsctl.c  |  2 +-
 fs/open.c |  6 +++
 fs/tracefs/inode.c|  2 +-
 include/linux/buffer_head.h   |  2 -
 include/linux/fcntl.h |  6 +++
 include/linux/fs.h| 14 +++---
 kernel/bpf/inode.c|  2 +-
 security/inode.c  |  2 +-
 security/selinux/selinuxfs.c  |  4 +-
 security/smack/smackfs.c  |  2 +-
 28 files changed, 130 insertions(+), 74 deletions(-)
 rename {include/linux => fs/affs}/amigaffs.h (100%)


Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

2017-05-08 Thread Kalle Valo
"Gustavo A. R. Silva"  writes:

> The name of an array used by itself will always return the array's address.
> So these tests will always evaluate as false and therefore the _return_
> will never be executed.
>
> Signed-off-by: Gustavo A. R. Silva 

I don't understand the commit log, especially what does "The name of an
array used by itself" mean?

-- 
Kalle Valo

Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

2017-05-08 Thread Kalle Valo
"Gustavo A. R. Silva"  writes:

> The name of an array used by itself will always return the array's address.
> So these tests will always evaluate as false and therefore the _return_
> will never be executed.
>
> Signed-off-by: Gustavo A. R. Silva 

I don't understand the commit log, especially what does "The name of an
array used by itself" mean?

-- 
Kalle Valo

[git pull] vfs.git fix

2017-05-08 Thread Al Viro
Braino fix for iov_iter_revert() misuse

The following changes since commit a6a5993243550b09f620941dea741b7421fdf79c:

  iov_iter: don't revert iov buffer if csum error (2017-05-01 14:49:53 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.iov_iter

for you to fetch changes up to 5b47d59af68a8735e4637bacedcb4baf6f47c73f:

  fix braino in generic_file_read_iter() (2017-05-08 13:54:47 -0400)


Al Viro (1):
  fix braino in generic_file_read_iter()

 lib/iov_iter.c | 2 ++
 mm/filemap.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)


Re: [greybus-dev] [PATCH v2] Staging: greybus: light: Prefer kcalloc over kzalloc

2017-05-08 Thread Viresh Kumar
On 08-05-17, 18:05, kart...@techveda.org wrote:
> From: Karthik Tummala 
> 
> Fixed following checkpatch.pl warning:
>  * WARNING: Prefer kcalloc over kzalloc with multiply
> 
> Instead of specifying no.of bytes * size as argument
> in kzalloc, prefer kcalloc.
> 
> Signed-off-by: Karthik Tummala 
> Reviewed-by: Rui Miguel Silva 
> ---
> Changes for v2:
> - Changed subject line & fixed typo as suggested by
>   Rui Miguel Silva
> ---
>  drivers/staging/greybus/light.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index 1681362..861a249 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -1030,7 +1030,7 @@ static int gb_lights_light_config(struct gb_lights 
> *glights, u8 id)
>   light->channels_count = conf.channel_count;
>   light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL);
>  
> - light->channels = kzalloc(light->channels_count *
> + light->channels = kcalloc(light->channels_count,
> sizeof(struct gb_channel), GFP_KERNEL);
>   if (!light->channels)
>   return -ENOMEM;
> @@ -1167,7 +1167,7 @@ static int gb_lights_create_all(struct gb_lights 
> *glights)
>   if (ret < 0)
>   goto out;
>  
> - glights->lights = kzalloc(glights->lights_count *
> + glights->lights = kcalloc(glights->lights_count,
> sizeof(struct gb_light), GFP_KERNEL);
>   if (!glights->lights) {
>   ret = -ENOMEM;

Acked-by: Viresh Kumar 

-- 
viresh


[git pull] vfs.git fix

2017-05-08 Thread Al Viro
Braino fix for iov_iter_revert() misuse

The following changes since commit a6a5993243550b09f620941dea741b7421fdf79c:

  iov_iter: don't revert iov buffer if csum error (2017-05-01 14:49:53 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.iov_iter

for you to fetch changes up to 5b47d59af68a8735e4637bacedcb4baf6f47c73f:

  fix braino in generic_file_read_iter() (2017-05-08 13:54:47 -0400)


Al Viro (1):
  fix braino in generic_file_read_iter()

 lib/iov_iter.c | 2 ++
 mm/filemap.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)


Re: [greybus-dev] [PATCH v2] Staging: greybus: light: Prefer kcalloc over kzalloc

2017-05-08 Thread Viresh Kumar
On 08-05-17, 18:05, kart...@techveda.org wrote:
> From: Karthik Tummala 
> 
> Fixed following checkpatch.pl warning:
>  * WARNING: Prefer kcalloc over kzalloc with multiply
> 
> Instead of specifying no.of bytes * size as argument
> in kzalloc, prefer kcalloc.
> 
> Signed-off-by: Karthik Tummala 
> Reviewed-by: Rui Miguel Silva 
> ---
> Changes for v2:
> - Changed subject line & fixed typo as suggested by
>   Rui Miguel Silva
> ---
>  drivers/staging/greybus/light.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index 1681362..861a249 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -1030,7 +1030,7 @@ static int gb_lights_light_config(struct gb_lights 
> *glights, u8 id)
>   light->channels_count = conf.channel_count;
>   light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL);
>  
> - light->channels = kzalloc(light->channels_count *
> + light->channels = kcalloc(light->channels_count,
> sizeof(struct gb_channel), GFP_KERNEL);
>   if (!light->channels)
>   return -ENOMEM;
> @@ -1167,7 +1167,7 @@ static int gb_lights_create_all(struct gb_lights 
> *glights)
>   if (ret < 0)
>   goto out;
>  
> - glights->lights = kzalloc(glights->lights_count *
> + glights->lights = kcalloc(glights->lights_count,
> sizeof(struct gb_light), GFP_KERNEL);
>   if (!glights->lights) {
>   ret = -ENOMEM;

Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property

2017-05-08 Thread Viresh Kumar
On 08-05-17, 14:57, Sudeep Holla wrote:
> Yes, I followed the thread and figured that out. But Rajendra also
> raised "What if the microcontroller firmware maps the performance-index
> to voltage but expects linux to scale the frequency? There is no way to
> specify a performance-index *and* a frequency for a OPP now I guess? So
> this needs to be addressd now IIUC.

No, he misunderstood it. He was saying that the domain needs a performance-index
and the device needs freq-scaling, how do we do that? He thought that there will
be just one OPP table for the device here, but we will actually have two and
that would work.

> So as Kevin pointed out, we need to experiment and look at all
> possibilities before finalizing the bindings. Better to have examples
> for all these and describe how bindings are be used including how to
> distinguish between these use-case from the bindings if it's not implicit.

Yeah, I have some doubts on how we are going to implement that and looking for
more input from him.

-- 
viresh


Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property

2017-05-08 Thread Viresh Kumar
On 08-05-17, 14:57, Sudeep Holla wrote:
> Yes, I followed the thread and figured that out. But Rajendra also
> raised "What if the microcontroller firmware maps the performance-index
> to voltage but expects linux to scale the frequency? There is no way to
> specify a performance-index *and* a frequency for a OPP now I guess? So
> this needs to be addressd now IIUC.

No, he misunderstood it. He was saying that the domain needs a performance-index
and the device needs freq-scaling, how do we do that? He thought that there will
be just one OPP table for the device here, but we will actually have two and
that would work.

> So as Kevin pointed out, we need to experiment and look at all
> possibilities before finalizing the bindings. Better to have examples
> for all these and describe how bindings are be used including how to
> distinguish between these use-case from the bindings if it's not implicit.

Yeah, I have some doubts on how we are going to implement that and looking for
more input from him.

-- 
viresh


sound/core/hwdep_compat.c:43:31: sparse: incorrect type in argument 2 (different address spaces)

2017-05-08 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   bf5f89463f5b3109a72ed13ca62b57e90213387d
commit: beba3a20bf90ce1b93e24592c3ebf0d0bb581bbe x86: switch to RAW_COPY_USER
date:   6 weeks ago
reproduce:
# apt-get install sparse
git checkout beba3a20bf90ce1b93e24592c3ebf0d0bb581bbe
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
>> sound/core/hwdep_compat.c:43:31: sparse: incorrect type in argument 2 
>> (different address spaces)
   sound/core/hwdep_compat.c:43:31:expected void const *from
   sound/core/hwdep_compat.c:43:31:got struct snd_hwdep_dsp_image32 
[noderef] *src
   include/linux/uaccess.h:194:47: sparse: incorrect type in argument 1 
(different address spaces)
   include/linux/uaccess.h:194:47:expected void const volatile [noderef] 
*
   include/linux/uaccess.h:194:47:got void const *from
   include/linux/uaccess.h:195:42: sparse: incorrect type in argument 2 
(different address spaces)
   include/linux/uaccess.h:195:42:expected void const [noderef] *src
   include/linux/uaccess.h:195:42:got void const *from
--
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   sound/core/control.c:1299:17: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1299:26: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1300:17: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1300:26: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1306:48: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1310:40: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
>> sound/core/control_compat.c:45:32: sparse: incorrect type in argument 2 
>> (different address spaces)
   sound/core/control_compat.c:45:32:expected void const *from
   sound/core/control_compat.c:45:32:got struct snd_ctl_elem_list32 
[noderef] *data32
   include/linux/uaccess.h:194:47: sparse: incorrect type in argument 1 
(different address spaces)
   include/linux/uaccess.h:194:47:expected void const volatile [noderef] 
*
   include/linux/uaccess.h:194:47:got void const *from
   include/linux/uaccess.h:195:42: sparse: incorrect type in argument 2 
(different address spaces)
   include/linux/uaccess.h:195:42:expected void const [noderef] *src
   include/linux/uaccess.h:195:42:got void const *from
>> 

sound/core/hwdep_compat.c:43:31: sparse: incorrect type in argument 2 (different address spaces)

2017-05-08 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   bf5f89463f5b3109a72ed13ca62b57e90213387d
commit: beba3a20bf90ce1b93e24592c3ebf0d0bb581bbe x86: switch to RAW_COPY_USER
date:   6 weeks ago
reproduce:
# apt-get install sparse
git checkout beba3a20bf90ce1b93e24592c3ebf0d0bb581bbe
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
>> sound/core/hwdep_compat.c:43:31: sparse: incorrect type in argument 2 
>> (different address spaces)
   sound/core/hwdep_compat.c:43:31:expected void const *from
   sound/core/hwdep_compat.c:43:31:got struct snd_hwdep_dsp_image32 
[noderef] *src
   include/linux/uaccess.h:194:47: sparse: incorrect type in argument 1 
(different address spaces)
   include/linux/uaccess.h:194:47:expected void const volatile [noderef] 
*
   include/linux/uaccess.h:194:47:got void const *from
   include/linux/uaccess.h:195:42: sparse: incorrect type in argument 2 
(different address spaces)
   include/linux/uaccess.h:195:42:expected void const [noderef] *src
   include/linux/uaccess.h:195:42:got void const *from
--
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   sound/core/control.c:1299:17: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1299:26: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1300:17: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1300:26: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1306:48: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   sound/core/control.c:1310:40: sparse: restricted snd_ctl_elem_type_t 
degrades to integer
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
   include/linux/uaccess.h:168:18: sparse: incorrect type in argument 1 
(different modifiers)
   include/linux/uaccess.h:168:18:expected void *
   include/linux/uaccess.h:168:18:got void const *from
>> sound/core/control_compat.c:45:32: sparse: incorrect type in argument 2 
>> (different address spaces)
   sound/core/control_compat.c:45:32:expected void const *from
   sound/core/control_compat.c:45:32:got struct snd_ctl_elem_list32 
[noderef] *data32
   include/linux/uaccess.h:194:47: sparse: incorrect type in argument 1 
(different address spaces)
   include/linux/uaccess.h:194:47:expected void const volatile [noderef] 
*
   include/linux/uaccess.h:194:47:got void const *from
   include/linux/uaccess.h:195:42: sparse: incorrect type in argument 2 
(different address spaces)
   include/linux/uaccess.h:195:42:expected void const [noderef] *src
   include/linux/uaccess.h:195:42:got void const *from
>> 

[PATCH] rpmsg: Make rpmsg_create_ept() propagate error

2017-05-08 Thread Bjorn Andersson
Make the rpmsg_create_ept() return an ERR_PTR() rather than NULL, as
this is common practice throughout the kernel and I got the first two
clients of this API wrong.

Signed-off-by: Bjorn Andersson 
---
 drivers/rpmsg/qcom_smd.c | 8 
 drivers/rpmsg/rpmsg_char.c   | 4 ++--
 drivers/rpmsg/rpmsg_core.c   | 6 +++---
 drivers/rpmsg/virtio_rpmsg_bus.c | 4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index a0a39a8821a3..cbc20ebba0a3 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -860,16 +860,16 @@ static struct rpmsg_endpoint *qcom_smd_create_ept(struct 
rpmsg_device *rpdev,
(channel = qcom_smd_find_channel(edge, name)) != NULL,
HZ);
if (!ret)
-   return NULL;
+   return ERR_PTR(-ETIMEDOUT);
 
if (channel->state != SMD_CHANNEL_CLOSED) {
dev_err(>dev, "channel %s is busy\n", channel->name);
-   return NULL;
+   return ERR_PTR(-EBUSY);
}
 
qsept = kzalloc(sizeof(*qsept), GFP_KERNEL);
if (!qsept)
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 
ept = >ept;
 
@@ -892,7 +892,7 @@ static struct rpmsg_endpoint *qcom_smd_create_ept(struct 
rpmsg_device *rpdev,
 free_ept:
channel->qsept = NULL;
kref_put(>refcount, __ept_release);
-   return NULL;
+   return ERR_PTR(ret);
 }
 
 static void qcom_smd_destroy_ept(struct rpmsg_endpoint *ept)
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 0ca2ccc09ca6..35918866d3fa 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -138,10 +138,10 @@ static int rpmsg_eptdev_open(struct inode *inode, struct 
file *filp)
get_device(dev);
 
ept = rpmsg_create_ept(rpdev, rpmsg_ept_cb, eptdev, eptdev->chinfo);
-   if (!ept) {
+   if (IS_ERR(ept)) {
dev_err(dev, "failed to open %s\n", eptdev->chinfo.name);
put_device(dev);
-   return -EINVAL;
+   return PTR_ERR(ept);
}
 
eptdev->ept = ept;
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 600f5f9f7431..91dc76f250fa 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -65,7 +65,7 @@
  * dynamically assign them an available rpmsg address (drivers should have
  * a very good reason why not to always use RPMSG_ADDR_ANY here).
  *
- * Returns a pointer to the endpoint on success, or NULL on error.
+ * Returns a pointer to the endpoint on success, or ERR_PTR() on error.
  */
 struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev,
rpmsg_rx_cb_t cb, void *priv,
@@ -411,9 +411,9 @@ static int rpmsg_dev_probe(struct device *dev)
chinfo.dst = RPMSG_ADDR_ANY;
 
ept = rpmsg_create_ept(rpdev, rpdrv->callback, NULL, chinfo);
-   if (!ept) {
+   if (IS_ERR(ept)) {
dev_err(dev, "failed to create endpoint\n");
-   err = -ENOMEM;
+   err = PTR_ERR(ept);
goto out;
}
 
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 4848da89431f..7fd49ed4847a 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -224,7 +224,7 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct 
virtproc_info *vrp,
 
ept = kzalloc(sizeof(*ept), GFP_KERNEL);
if (!ept)
-   return NULL;
+   return PTR_ERR(-ENOMEM);
 
kref_init(>refcount);
mutex_init(>cb_lock);
@@ -260,7 +260,7 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct 
virtproc_info *vrp,
 free_ept:
mutex_unlock(>endpoints_lock);
kref_put(>refcount, __ept_release);
-   return NULL;
+   return ERR_PTR(id);
 }
 
 static struct rpmsg_endpoint *virtio_rpmsg_create_ept(struct rpmsg_device 
*rpdev,
-- 
2.12.0



[PATCH] rpmsg: Make rpmsg_create_ept() propagate error

2017-05-08 Thread Bjorn Andersson
Make the rpmsg_create_ept() return an ERR_PTR() rather than NULL, as
this is common practice throughout the kernel and I got the first two
clients of this API wrong.

Signed-off-by: Bjorn Andersson 
---
 drivers/rpmsg/qcom_smd.c | 8 
 drivers/rpmsg/rpmsg_char.c   | 4 ++--
 drivers/rpmsg/rpmsg_core.c   | 6 +++---
 drivers/rpmsg/virtio_rpmsg_bus.c | 4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index a0a39a8821a3..cbc20ebba0a3 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -860,16 +860,16 @@ static struct rpmsg_endpoint *qcom_smd_create_ept(struct 
rpmsg_device *rpdev,
(channel = qcom_smd_find_channel(edge, name)) != NULL,
HZ);
if (!ret)
-   return NULL;
+   return ERR_PTR(-ETIMEDOUT);
 
if (channel->state != SMD_CHANNEL_CLOSED) {
dev_err(>dev, "channel %s is busy\n", channel->name);
-   return NULL;
+   return ERR_PTR(-EBUSY);
}
 
qsept = kzalloc(sizeof(*qsept), GFP_KERNEL);
if (!qsept)
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 
ept = >ept;
 
@@ -892,7 +892,7 @@ static struct rpmsg_endpoint *qcom_smd_create_ept(struct 
rpmsg_device *rpdev,
 free_ept:
channel->qsept = NULL;
kref_put(>refcount, __ept_release);
-   return NULL;
+   return ERR_PTR(ret);
 }
 
 static void qcom_smd_destroy_ept(struct rpmsg_endpoint *ept)
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 0ca2ccc09ca6..35918866d3fa 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -138,10 +138,10 @@ static int rpmsg_eptdev_open(struct inode *inode, struct 
file *filp)
get_device(dev);
 
ept = rpmsg_create_ept(rpdev, rpmsg_ept_cb, eptdev, eptdev->chinfo);
-   if (!ept) {
+   if (IS_ERR(ept)) {
dev_err(dev, "failed to open %s\n", eptdev->chinfo.name);
put_device(dev);
-   return -EINVAL;
+   return PTR_ERR(ept);
}
 
eptdev->ept = ept;
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 600f5f9f7431..91dc76f250fa 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -65,7 +65,7 @@
  * dynamically assign them an available rpmsg address (drivers should have
  * a very good reason why not to always use RPMSG_ADDR_ANY here).
  *
- * Returns a pointer to the endpoint on success, or NULL on error.
+ * Returns a pointer to the endpoint on success, or ERR_PTR() on error.
  */
 struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev,
rpmsg_rx_cb_t cb, void *priv,
@@ -411,9 +411,9 @@ static int rpmsg_dev_probe(struct device *dev)
chinfo.dst = RPMSG_ADDR_ANY;
 
ept = rpmsg_create_ept(rpdev, rpdrv->callback, NULL, chinfo);
-   if (!ept) {
+   if (IS_ERR(ept)) {
dev_err(dev, "failed to create endpoint\n");
-   err = -ENOMEM;
+   err = PTR_ERR(ept);
goto out;
}
 
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 4848da89431f..7fd49ed4847a 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -224,7 +224,7 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct 
virtproc_info *vrp,
 
ept = kzalloc(sizeof(*ept), GFP_KERNEL);
if (!ept)
-   return NULL;
+   return PTR_ERR(-ENOMEM);
 
kref_init(>refcount);
mutex_init(>cb_lock);
@@ -260,7 +260,7 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct 
virtproc_info *vrp,
 free_ept:
mutex_unlock(>endpoints_lock);
kref_put(>refcount, __ept_release);
-   return NULL;
+   return ERR_PTR(id);
 }
 
 static struct rpmsg_endpoint *virtio_rpmsg_create_ept(struct rpmsg_device 
*rpdev,
-- 
2.12.0



Re: [PATCH 3/3] arm64/locking: qspinlocks and qrwlocks support

2017-05-08 Thread Boqun Feng
On Wed, May 03, 2017 at 05:51:41PM +0300, Yury Norov wrote:
> From: Jan Glauber 
> 
> Ported from x86_64 with paravirtualization support removed.
> 
> Signed-off-by: Jan Glauber 
> 
> Note. This patch removes protection from direct inclusion of
> arch/arm64/include/asm/spinlock_types.h. It's done because
> kernel/locking/qrwlock.c file does it thru the header
> include/asm-generic/qrwlock_types.h. Until now the only user
> of qrwlock.c was x86, and there's no such protection too.
> 
> I'm not happy to remove the protection, but if it's OK for x86,
> it should be also OK for arm64. If not, I think we'd fix it
> for x86, and add the protection there too.
> 
> Yury
> 
> Signed-off-by: Yury Norov 
> ---
>  arch/arm64/Kconfig  | 24 +++
>  arch/arm64/include/asm/qrwlock.h|  7 ++
>  arch/arm64/include/asm/qspinlock.h  | 42 
> +
>  arch/arm64/include/asm/spinlock.h   | 12 ++
>  arch/arm64/include/asm/spinlock_types.h | 14 ---
>  arch/arm64/kernel/Makefile  |  1 +
>  arch/arm64/kernel/qspinlock.c   | 34 ++
>  7 files changed, 131 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm64/include/asm/qrwlock.h
>  create mode 100644 arch/arm64/include/asm/qspinlock.h
>  create mode 100644 arch/arm64/kernel/qspinlock.c
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 22dbde97eefa..db24b3b3f3c6 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -25,6 +25,8 @@ config ARM64
>   select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
>   select ARCH_WANT_FRAME_POINTERS
>   select ARCH_HAS_UBSAN_SANITIZE_ALL
> + select ARCH_USE_QUEUED_RWLOCKS if QUEUED_LOCKS
> + select ARCH_USE_QUEUED_SPINLOCKS if QUEUED_LOCKS
>   select ARM_AMBA
>   select ARM_ARCH_TIMER
>   select ARM_GIC
> @@ -692,6 +694,28 @@ config ARCH_WANT_HUGE_PMD_SHARE
>  config ARCH_HAS_CACHE_LINE_SIZE
>   def_bool y
>  
> +choice
> + prompt "Locking type"
> + default TICKET_LOCKS
> + help
> +   Choose between traditional ticked-based locking mechanism and
> +   queued-based mechanism.
> +
> +config TICKET_LOCKS
> + bool "Ticket locks"
> + help
> +   Ticked-based locking implementation for ARM64
> +
> +config QUEUED_LOCKS
> + bool "Queued locks"
> + help
> +   Queue-based locking mechanism. This option improves
> +   locking performance in case of high-contended locking
> +   on many-cpu machines. On low-cpu machines there is no
> +   difference comparing to ticked-based locking.
> +
> +endchoice
> +
>  source "mm/Kconfig"
>  
>  config SECCOMP
> diff --git a/arch/arm64/include/asm/qrwlock.h 
> b/arch/arm64/include/asm/qrwlock.h
> new file mode 100644
> index ..626f6ebfb52d
> --- /dev/null
> +++ b/arch/arm64/include/asm/qrwlock.h
> @@ -0,0 +1,7 @@
> +#ifndef _ASM_ARM64_QRWLOCK_H
> +#define _ASM_ARM64_QRWLOCK_H
> +
> +#include 
> +#include 
> +
> +#endif /* _ASM_ARM64_QRWLOCK_H */
> diff --git a/arch/arm64/include/asm/qspinlock.h 
> b/arch/arm64/include/asm/qspinlock.h
> new file mode 100644
> index ..09ef4f13f549
> --- /dev/null
> +++ b/arch/arm64/include/asm/qspinlock.h
> @@ -0,0 +1,42 @@
> +#ifndef _ASM_ARM64_QSPINLOCK_H
> +#define _ASM_ARM64_QSPINLOCK_H
> +
> +#include 
> +#include 
> +
> +extern void queued_spin_unlock_wait(struct qspinlock *lock);
> +#define queued_spin_unlock_wait queued_spin_unlock_wait
> +
> +#define  queued_spin_unlock queued_spin_unlock
> +/**
> + * queued_spin_unlock - release a queued spinlock
> + * @lock : Pointer to queued spinlock structure
> + *
> + * A smp_store_release() on the least-significant byte.
> + */
> +static inline void queued_spin_unlock(struct qspinlock *lock)
> +{
> + smp_store_release((u8 *)lock, 0);

I think this part will cause endian issues, maybe you want something
like what we do in queued_write_lock().

Have you tested this on an BE environment?

Regards,
Boqun

> +}
> +
> +#define queued_spin_is_locked queued_spin_is_locked
> +/**
> + * queued_spin_is_locked - is the spinlock locked?
> + * @lock: Pointer to queued spinlock structure
> + * Return: 1 if it is locked, 0 otherwise
> + */
> +static __always_inline int queued_spin_is_locked(struct qspinlock *lock)
> +{
> + /*
> +  * See queued_spin_unlock_wait().
> +  *
> +  * Any !0 state indicates it is locked, even if _Q_LOCKED_VAL
> +  * isn't immediately observable.
> +  */
> + smp_mb();
> + return atomic_read(>val);
> +}
> +
> +#include 
> +
> +#endif /* _ASM_ARM64_QSPINLOCK_H */
> diff --git a/arch/arm64/include/asm/spinlock.h 
> b/arch/arm64/include/asm/spinlock.h
> index cae331d553f8..37713397e0c5 100644
> --- a/arch/arm64/include/asm/spinlock.h
> +++ b/arch/arm64/include/asm/spinlock.h
> @@ -20,6 +20,10 @@
>  #include 
>  #include 
>  
> +#ifdef 

Re: [PATCH 3/3] arm64/locking: qspinlocks and qrwlocks support

2017-05-08 Thread Boqun Feng
On Wed, May 03, 2017 at 05:51:41PM +0300, Yury Norov wrote:
> From: Jan Glauber 
> 
> Ported from x86_64 with paravirtualization support removed.
> 
> Signed-off-by: Jan Glauber 
> 
> Note. This patch removes protection from direct inclusion of
> arch/arm64/include/asm/spinlock_types.h. It's done because
> kernel/locking/qrwlock.c file does it thru the header
> include/asm-generic/qrwlock_types.h. Until now the only user
> of qrwlock.c was x86, and there's no such protection too.
> 
> I'm not happy to remove the protection, but if it's OK for x86,
> it should be also OK for arm64. If not, I think we'd fix it
> for x86, and add the protection there too.
> 
> Yury
> 
> Signed-off-by: Yury Norov 
> ---
>  arch/arm64/Kconfig  | 24 +++
>  arch/arm64/include/asm/qrwlock.h|  7 ++
>  arch/arm64/include/asm/qspinlock.h  | 42 
> +
>  arch/arm64/include/asm/spinlock.h   | 12 ++
>  arch/arm64/include/asm/spinlock_types.h | 14 ---
>  arch/arm64/kernel/Makefile  |  1 +
>  arch/arm64/kernel/qspinlock.c   | 34 ++
>  7 files changed, 131 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm64/include/asm/qrwlock.h
>  create mode 100644 arch/arm64/include/asm/qspinlock.h
>  create mode 100644 arch/arm64/kernel/qspinlock.c
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 22dbde97eefa..db24b3b3f3c6 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -25,6 +25,8 @@ config ARM64
>   select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
>   select ARCH_WANT_FRAME_POINTERS
>   select ARCH_HAS_UBSAN_SANITIZE_ALL
> + select ARCH_USE_QUEUED_RWLOCKS if QUEUED_LOCKS
> + select ARCH_USE_QUEUED_SPINLOCKS if QUEUED_LOCKS
>   select ARM_AMBA
>   select ARM_ARCH_TIMER
>   select ARM_GIC
> @@ -692,6 +694,28 @@ config ARCH_WANT_HUGE_PMD_SHARE
>  config ARCH_HAS_CACHE_LINE_SIZE
>   def_bool y
>  
> +choice
> + prompt "Locking type"
> + default TICKET_LOCKS
> + help
> +   Choose between traditional ticked-based locking mechanism and
> +   queued-based mechanism.
> +
> +config TICKET_LOCKS
> + bool "Ticket locks"
> + help
> +   Ticked-based locking implementation for ARM64
> +
> +config QUEUED_LOCKS
> + bool "Queued locks"
> + help
> +   Queue-based locking mechanism. This option improves
> +   locking performance in case of high-contended locking
> +   on many-cpu machines. On low-cpu machines there is no
> +   difference comparing to ticked-based locking.
> +
> +endchoice
> +
>  source "mm/Kconfig"
>  
>  config SECCOMP
> diff --git a/arch/arm64/include/asm/qrwlock.h 
> b/arch/arm64/include/asm/qrwlock.h
> new file mode 100644
> index ..626f6ebfb52d
> --- /dev/null
> +++ b/arch/arm64/include/asm/qrwlock.h
> @@ -0,0 +1,7 @@
> +#ifndef _ASM_ARM64_QRWLOCK_H
> +#define _ASM_ARM64_QRWLOCK_H
> +
> +#include 
> +#include 
> +
> +#endif /* _ASM_ARM64_QRWLOCK_H */
> diff --git a/arch/arm64/include/asm/qspinlock.h 
> b/arch/arm64/include/asm/qspinlock.h
> new file mode 100644
> index ..09ef4f13f549
> --- /dev/null
> +++ b/arch/arm64/include/asm/qspinlock.h
> @@ -0,0 +1,42 @@
> +#ifndef _ASM_ARM64_QSPINLOCK_H
> +#define _ASM_ARM64_QSPINLOCK_H
> +
> +#include 
> +#include 
> +
> +extern void queued_spin_unlock_wait(struct qspinlock *lock);
> +#define queued_spin_unlock_wait queued_spin_unlock_wait
> +
> +#define  queued_spin_unlock queued_spin_unlock
> +/**
> + * queued_spin_unlock - release a queued spinlock
> + * @lock : Pointer to queued spinlock structure
> + *
> + * A smp_store_release() on the least-significant byte.
> + */
> +static inline void queued_spin_unlock(struct qspinlock *lock)
> +{
> + smp_store_release((u8 *)lock, 0);

I think this part will cause endian issues, maybe you want something
like what we do in queued_write_lock().

Have you tested this on an BE environment?

Regards,
Boqun

> +}
> +
> +#define queued_spin_is_locked queued_spin_is_locked
> +/**
> + * queued_spin_is_locked - is the spinlock locked?
> + * @lock: Pointer to queued spinlock structure
> + * Return: 1 if it is locked, 0 otherwise
> + */
> +static __always_inline int queued_spin_is_locked(struct qspinlock *lock)
> +{
> + /*
> +  * See queued_spin_unlock_wait().
> +  *
> +  * Any !0 state indicates it is locked, even if _Q_LOCKED_VAL
> +  * isn't immediately observable.
> +  */
> + smp_mb();
> + return atomic_read(>val);
> +}
> +
> +#include 
> +
> +#endif /* _ASM_ARM64_QSPINLOCK_H */
> diff --git a/arch/arm64/include/asm/spinlock.h 
> b/arch/arm64/include/asm/spinlock.h
> index cae331d553f8..37713397e0c5 100644
> --- a/arch/arm64/include/asm/spinlock.h
> +++ b/arch/arm64/include/asm/spinlock.h
> @@ -20,6 +20,10 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_QUEUED_SPINLOCKS
> +#include 
> +#else
> +
>  /*
>   * Spinlock implementation.
>  

[PATCH] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform

2017-05-08 Thread Jan Kiszka
The SIMATIC IOT2000 is derived from the Galileo Gen2 board and shares
its I2C frequency.

Signed-off-by: Jan Kiszka 
Signed-off-by: Sascha Weisenberger 

---
 drivers/mfd/intel_quark_i2c_gpio.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/intel_quark_i2c_gpio.c 
b/drivers/mfd/intel_quark_i2c_gpio.c
index 7946d6e38b87..98dddf2831ad 100644
--- a/drivers/mfd/intel_quark_i2c_gpio.c
+++ b/drivers/mfd/intel_quark_i2c_gpio.c
@@ -72,6 +72,10 @@ static const struct i2c_mode_info platform_i2c_mode_info[] = 
{
.name = "GalileoGen2",
.i2c_scl_freq = 40,
},
+   {
+   .name = "SIMATIC IOT2000",
+   .i2c_scl_freq = 40,
+   },
{}
 };
 
-- 
2.12.0


[PATCH] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform

2017-05-08 Thread Jan Kiszka
The SIMATIC IOT2000 is derived from the Galileo Gen2 board and shares
its I2C frequency.

Signed-off-by: Jan Kiszka 
Signed-off-by: Sascha Weisenberger 

---
 drivers/mfd/intel_quark_i2c_gpio.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/intel_quark_i2c_gpio.c 
b/drivers/mfd/intel_quark_i2c_gpio.c
index 7946d6e38b87..98dddf2831ad 100644
--- a/drivers/mfd/intel_quark_i2c_gpio.c
+++ b/drivers/mfd/intel_quark_i2c_gpio.c
@@ -72,6 +72,10 @@ static const struct i2c_mode_info platform_i2c_mode_info[] = 
{
.name = "GalileoGen2",
.i2c_scl_freq = 40,
},
+   {
+   .name = "SIMATIC IOT2000",
+   .i2c_scl_freq = 40,
+   },
{}
 };
 
-- 
2.12.0


[PATCH] wcn36xx: Close SMD channel on device removal

2017-05-08 Thread Bjorn Andersson
The SMD channel is not the primary WCNSS channel and must explicitly be
closed as the device is removed, or the channel will already by open on
a subsequent probe call in e.g. the case of reloading the kernel module.

This issue was introduced because I simplified the underlying SMD
implementation while the SMD adaptions of the driver sat on the mailing
list, but missed to update these patches. The patch does however only
apply back to the transition to rpmsg, hence the limited Fixes.

Fixes: 5052de8deff5 ("soc: qcom: smd: Transition client drivers from smd to 
rpmsg")
Reported-by: Eyal Ilsar 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index d5e993dc9b23..517a315e259b 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1271,6 +1271,8 @@ static int wcn36xx_remove(struct platform_device *pdev)
qcom_smem_state_put(wcn->tx_enable_state);
qcom_smem_state_put(wcn->tx_rings_empty_state);
 
+   rpmsg_destroy_ept(wcn->smd_channel);
+
iounmap(wcn->dxe_base);
iounmap(wcn->ccu_base);
 
-- 
2.12.0



[PATCH] wcn36xx: Close SMD channel on device removal

2017-05-08 Thread Bjorn Andersson
The SMD channel is not the primary WCNSS channel and must explicitly be
closed as the device is removed, or the channel will already by open on
a subsequent probe call in e.g. the case of reloading the kernel module.

This issue was introduced because I simplified the underlying SMD
implementation while the SMD adaptions of the driver sat on the mailing
list, but missed to update these patches. The patch does however only
apply back to the transition to rpmsg, hence the limited Fixes.

Fixes: 5052de8deff5 ("soc: qcom: smd: Transition client drivers from smd to 
rpmsg")
Reported-by: Eyal Ilsar 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index d5e993dc9b23..517a315e259b 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1271,6 +1271,8 @@ static int wcn36xx_remove(struct platform_device *pdev)
qcom_smem_state_put(wcn->tx_enable_state);
qcom_smem_state_put(wcn->tx_rings_empty_state);
 
+   rpmsg_destroy_ept(wcn->smd_channel);
+
iounmap(wcn->dxe_base);
iounmap(wcn->ccu_base);
 
-- 
2.12.0



[PATCH] net: wireless: ath: ath10k: remove unnecessary code

2017-05-08 Thread Gustavo A. R. Silva
The name of an array used by itself will always return the array's address.
So these tests will always evaluate as false and therefore the _return_
will never be executed.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/net/wireless/ath/ath10k/wmi.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 2f1743e..135cf83 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5933,15 +5933,6 @@ static struct sk_buff 
*ath10k_wmi_10_4_op_gen_init(struct ath10k *ar)
 
 int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg)
 {
-   if (arg->ie_len && !arg->ie)
-   return -EINVAL;
-   if (arg->n_channels && !arg->channels)
-   return -EINVAL;
-   if (arg->n_ssids && !arg->ssids)
-   return -EINVAL;
-   if (arg->n_bssids && !arg->bssids)
-   return -EINVAL;
-
if (arg->ie_len > WLAN_SCAN_PARAMS_MAX_IE_LEN)
return -EINVAL;
if (arg->n_channels > ARRAY_SIZE(arg->channels))
-- 
2.5.0



[PATCH] net: wireless: ath: ath10k: remove unnecessary code

2017-05-08 Thread Gustavo A. R. Silva
The name of an array used by itself will always return the array's address.
So these tests will always evaluate as false and therefore the _return_
will never be executed.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/net/wireless/ath/ath10k/wmi.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 2f1743e..135cf83 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5933,15 +5933,6 @@ static struct sk_buff 
*ath10k_wmi_10_4_op_gen_init(struct ath10k *ar)
 
 int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg)
 {
-   if (arg->ie_len && !arg->ie)
-   return -EINVAL;
-   if (arg->n_channels && !arg->channels)
-   return -EINVAL;
-   if (arg->n_ssids && !arg->ssids)
-   return -EINVAL;
-   if (arg->n_bssids && !arg->bssids)
-   return -EINVAL;
-
if (arg->ie_len > WLAN_SCAN_PARAMS_MAX_IE_LEN)
return -EINVAL;
if (arg->n_channels > ARRAY_SIZE(arg->channels))
-- 
2.5.0



Re: [PATCH 0/4] DMA-buf: Fine-tuning for four function implementations

2017-05-08 Thread Sumit Semwal
Hello Markus,

On 8 May 2017 at 14:40, SF Markus Elfring  wrote:
> From: Markus Elfring 
> Date: Mon, 8 May 2017 11:05:05 +0200
>
> A few update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (4):
>   Combine two function calls into one in dma_buf_debug_show()
>   Improve a size determination in dma_buf_attach()
>   Adjust a null pointer check in dma_buf_attach()
>   Use seq_putc() in two functions

All queued up in drm-misc-next now. Thanks!
>
>  drivers/dma-buf/dma-buf.c| 8 +++-
>  drivers/dma-buf/sync_debug.c | 6 +++---
>  2 files changed, 6 insertions(+), 8 deletions(-)
>
> --
> 2.12.2
>

Best regards,
Sumit.


Re: [PATCH 0/4] DMA-buf: Fine-tuning for four function implementations

2017-05-08 Thread Sumit Semwal
Hello Markus,

On 8 May 2017 at 14:40, SF Markus Elfring  wrote:
> From: Markus Elfring 
> Date: Mon, 8 May 2017 11:05:05 +0200
>
> A few update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (4):
>   Combine two function calls into one in dma_buf_debug_show()
>   Improve a size determination in dma_buf_attach()
>   Adjust a null pointer check in dma_buf_attach()
>   Use seq_putc() in two functions

All queued up in drm-misc-next now. Thanks!
>
>  drivers/dma-buf/dma-buf.c| 8 +++-
>  drivers/dma-buf/sync_debug.c | 6 +++---
>  2 files changed, 6 insertions(+), 8 deletions(-)
>
> --
> 2.12.2
>

Best regards,
Sumit.


[regression, bisected] 4.11+ imx uarts broken

2017-05-08 Thread Mika Penttilä
Hi,

The following commit e61c38d85b7 makes the uarts on i.MX6 nonfunctional (no 
data transmitted or received). 
With e61c38d85b7 reverted the uarts work ok.

---
commit e61c38d85b7392e033ee03bca46f1d6006156175
Author: Uwe Kleine-König 
Date:   Tue Apr 4 11:18:51 2017 +0200

serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off
 



--Mika


[regression, bisected] 4.11+ imx uarts broken

2017-05-08 Thread Mika Penttilä
Hi,

The following commit e61c38d85b7 makes the uarts on i.MX6 nonfunctional (no 
data transmitted or received). 
With e61c38d85b7 reverted the uarts work ok.

---
commit e61c38d85b7392e033ee03bca46f1d6006156175
Author: Uwe Kleine-König 
Date:   Tue Apr 4 11:18:51 2017 +0200

serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off
 



--Mika


Re: [PATCH v2 3/3] fs: ubifs: set s_uuid in super block

2017-05-08 Thread Oleksij Rempel



On 05/02/2017 09:37 AM, Richard Weinberger wrote:

Amir,

Am 02.05.2017 um 09:19 schrieb Amir Goldstein:

On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger  wrote:

Am 24.04.2017 um 17:47 schrieb Richard Weinberger:

So, if some flag should be implemented, who should do it? :)


I'll not do it for you. ;)


Please also see http://marc.info/?l=linux-fsdevel=149327990608749=2



Richard,

Considering the facts that:
1. I proposed the said flag and Al didn't think it was needed [1]
2. ext4 already sets s_uuid without any flag for a long time now
3. A similar patch was queued for v4.12 to set s_uuid for xfs without any flag

I think it would be right to take Oleksij's patch as is.

FYI, my current work on 'constant inode numbers for overlayfs' requires that
underlying filesystem had set a non-zero s_uuid. Not sure if that matters for
ubifs+overlayfs users.


If VFS maintainers are fine with that, I'll take it.
From UBIFS' POV it does not matter much. :-)


Ping to VFS maintainers?


Re: [PATCH v2 3/3] fs: ubifs: set s_uuid in super block

2017-05-08 Thread Oleksij Rempel



On 05/02/2017 09:37 AM, Richard Weinberger wrote:

Amir,

Am 02.05.2017 um 09:19 schrieb Amir Goldstein:

On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger  wrote:

Am 24.04.2017 um 17:47 schrieb Richard Weinberger:

So, if some flag should be implemented, who should do it? :)


I'll not do it for you. ;)


Please also see http://marc.info/?l=linux-fsdevel=149327990608749=2



Richard,

Considering the facts that:
1. I proposed the said flag and Al didn't think it was needed [1]
2. ext4 already sets s_uuid without any flag for a long time now
3. A similar patch was queued for v4.12 to set s_uuid for xfs without any flag

I think it would be right to take Oleksij's patch as is.

FYI, my current work on 'constant inode numbers for overlayfs' requires that
underlying filesystem had set a non-zero s_uuid. Not sure if that matters for
ubifs+overlayfs users.


If VFS maintainers are fine with that, I'll take it.
From UBIFS' POV it does not matter much. :-)


Ping to VFS maintainers?


[PATCH] net: wireless: ath: ath9k: remove unnecessary code

2017-05-08 Thread Gustavo A. R. Silva
The name of an array used by itself will always return the array's address.
So this test will always evaluate as true.

Addresses-Coverity-ID: 1364903
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/net/wireless/ath/ath9k/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c 
b/drivers/net/wireless/ath/ath9k/eeprom.c
index fb80ec8..5c3bc28 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -143,7 +143,7 @@ bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 
*data)
 
if (ah->eeprom_blob)
ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data);
-   else if (pdata && !pdata->use_eeprom && pdata->eeprom_data)
+   else if (pdata && !pdata->use_eeprom)
ret = ath9k_hw_nvram_read_pdata(pdata, off, data);
else
ret = common->bus_ops->eeprom_read(common, off, data);
-- 
2.5.0



[PATCH] net: wireless: ath: ath9k: remove unnecessary code

2017-05-08 Thread Gustavo A. R. Silva
The name of an array used by itself will always return the array's address.
So this test will always evaluate as true.

Addresses-Coverity-ID: 1364903
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/net/wireless/ath/ath9k/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c 
b/drivers/net/wireless/ath/ath9k/eeprom.c
index fb80ec8..5c3bc28 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -143,7 +143,7 @@ bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 
*data)
 
if (ah->eeprom_blob)
ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data);
-   else if (pdata && !pdata->use_eeprom && pdata->eeprom_data)
+   else if (pdata && !pdata->use_eeprom)
ret = ath9k_hw_nvram_read_pdata(pdata, off, data);
else
ret = common->bus_ops->eeprom_read(common, off, data);
-- 
2.5.0



linux-next: Tree for May 9

2017-05-08 Thread Stephen Rothwell
Hi all,

Please do not add any v4.13 destined material in your linux-next
included branches until after v4.12-rc1 has been released.

Changes since 20170508:

Non-merge commits (relative to Linus' tree): 2374
 2523 files changed, 83999 insertions(+), 42709 deletions(-)



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

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

Below is a summary of the state of the merge.

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

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

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

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

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (2d3e4866dea9 Merge tag 'for-linus' of 
git://git.kernel.org/pub/scm/virt/kvm/kvm)
Merging fixes/master (97da3854c526 Linux 4.11-rc3)
Merging kbuild-current/fixes (9be3213b14d4 gconfig: remove misleading 
parentheses around a condition)
Merging arc-current/for-curr (cf4100d1cddc Revert "ARCv2: Allow enabling PAE40 
w/o HIGHMEM")
Merging arm-current/fixes (6d8059493691 ARM: 8670/1: V7M: Do not corrupt vector 
table around v7m_invalidate_l1 call)
Merging m68k-current/for-linus (f6ab4d59a5fe nubus: Add MVC and VSC video card 
definitions)
Merging metag-fixes/fixes (b884a190afce metag/usercopy: Add missing fixups)
Merging powerpc-fixes/fixes (be5c5e843c4a powerpc/64: Fix HMI exception on LE 
with CONFIG_RELOCATABLE=y)
Merging sparc/master (8c64415cc1f5 sparc: Remove redundant tests in 
boot_flags_init().)
Merging fscrypt-current/for-stable (42d97eb0ade3 fscrypt: fix renaming and 
linking special files)
Merging net/master (922c60e89d52 net: mdio-mux: bcm-iproc: call mdiobus_free() 
in error path)
Merging ipsec/master (2c1497bbc8fd xfrm: Fix NETDEV_DOWN with IPSec offload)
Merging netfilter/master (f411af682218 Merge branch 
'ibmvnic-Updated-reset-handler-andcode-fixes')
Merging ipvs/master (3c5ab3f395d6 ipvs: SNAT packet replies only for NATed 
connections)
Merging wireless-drivers/master (d77facb88448 brcmfmac: use local iftype 
avoiding use-after-free of virtual interface)
Merging mac80211/master (29cee56c0be4 Merge tag 'mac80211-for-davem-2017-05-08' 
of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211)
Merging sound-current/for-linus (a5c3b32a1146 Merge tag 'asoc-v4.12' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus)
Merging pci-current/for-linus (b9c1153f7a9c PCI: hisi: Fix DT binding 
(hisi-pcie-almost-ecam))
Merging driver-core.current/driver-core-linus (af82455f7dbd Merge tag 
'char-misc-4.12-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc)
Merging tty.current/tty-linus (4f7d029b9bf0 Linux 4.11-rc7)
Merging usb.current/usb-linus (a71c9a1c779f Linux 4.11-rc5)
Merging usb-gadget-fixes/fixes (25cd9721c2b1 usb: gadget: f_hid: fix: Don't 
access hidg->req without spinlock held)
Merging usb-serial-fixes/usb-linus (c02ed2e75ef4 Linux 4.11-rc4)
Merging usb-chipidea-fixes/ci-for-usb-stable (c7fbb09b2ea1 usb: chipidea: move 
the lock initialization to core file)
Merging phy/fixes (1a09b6a7c10e phy: qcom-usb-hs: Add depends on EXTCON)
Merging staging.current/staging-linus (13e098814037 docs: complete bumping 
minimal GNU Make version to 3.81)
Merging char-misc.current/char-misc-linus (af82455f7dbd Merge tag 
'char-misc-4.12-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc)
Merging input-current/for-linus (4706aa075662 Input: xpad - add USB IDs for Mad 
Catz Brawlstick and Razer Sabertooth)
Merging crypto-current/master (929562b14478 crypto: stm32 - Fix OF module alias 
information)
Merging id

linux-next: Tree for May 9

2017-05-08 Thread Stephen Rothwell
Hi all,

Please do not add any v4.13 destined material in your linux-next
included branches until after v4.12-rc1 has been released.

Changes since 20170508:

Non-merge commits (relative to Linus' tree): 2374
 2523 files changed, 83999 insertions(+), 42709 deletions(-)



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

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

Below is a summary of the state of the merge.

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

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

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

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

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (2d3e4866dea9 Merge tag 'for-linus' of 
git://git.kernel.org/pub/scm/virt/kvm/kvm)
Merging fixes/master (97da3854c526 Linux 4.11-rc3)
Merging kbuild-current/fixes (9be3213b14d4 gconfig: remove misleading 
parentheses around a condition)
Merging arc-current/for-curr (cf4100d1cddc Revert "ARCv2: Allow enabling PAE40 
w/o HIGHMEM")
Merging arm-current/fixes (6d8059493691 ARM: 8670/1: V7M: Do not corrupt vector 
table around v7m_invalidate_l1 call)
Merging m68k-current/for-linus (f6ab4d59a5fe nubus: Add MVC and VSC video card 
definitions)
Merging metag-fixes/fixes (b884a190afce metag/usercopy: Add missing fixups)
Merging powerpc-fixes/fixes (be5c5e843c4a powerpc/64: Fix HMI exception on LE 
with CONFIG_RELOCATABLE=y)
Merging sparc/master (8c64415cc1f5 sparc: Remove redundant tests in 
boot_flags_init().)
Merging fscrypt-current/for-stable (42d97eb0ade3 fscrypt: fix renaming and 
linking special files)
Merging net/master (922c60e89d52 net: mdio-mux: bcm-iproc: call mdiobus_free() 
in error path)
Merging ipsec/master (2c1497bbc8fd xfrm: Fix NETDEV_DOWN with IPSec offload)
Merging netfilter/master (f411af682218 Merge branch 
'ibmvnic-Updated-reset-handler-andcode-fixes')
Merging ipvs/master (3c5ab3f395d6 ipvs: SNAT packet replies only for NATed 
connections)
Merging wireless-drivers/master (d77facb88448 brcmfmac: use local iftype 
avoiding use-after-free of virtual interface)
Merging mac80211/master (29cee56c0be4 Merge tag 'mac80211-for-davem-2017-05-08' 
of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211)
Merging sound-current/for-linus (a5c3b32a1146 Merge tag 'asoc-v4.12' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus)
Merging pci-current/for-linus (b9c1153f7a9c PCI: hisi: Fix DT binding 
(hisi-pcie-almost-ecam))
Merging driver-core.current/driver-core-linus (af82455f7dbd Merge tag 
'char-misc-4.12-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc)
Merging tty.current/tty-linus (4f7d029b9bf0 Linux 4.11-rc7)
Merging usb.current/usb-linus (a71c9a1c779f Linux 4.11-rc5)
Merging usb-gadget-fixes/fixes (25cd9721c2b1 usb: gadget: f_hid: fix: Don't 
access hidg->req without spinlock held)
Merging usb-serial-fixes/usb-linus (c02ed2e75ef4 Linux 4.11-rc4)
Merging usb-chipidea-fixes/ci-for-usb-stable (c7fbb09b2ea1 usb: chipidea: move 
the lock initialization to core file)
Merging phy/fixes (1a09b6a7c10e phy: qcom-usb-hs: Add depends on EXTCON)
Merging staging.current/staging-linus (13e098814037 docs: complete bumping 
minimal GNU Make version to 3.81)
Merging char-misc.current/char-misc-linus (af82455f7dbd Merge tag 
'char-misc-4.12-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc)
Merging input-current/for-linus (4706aa075662 Input: xpad - add USB IDs for Mad 
Catz Brawlstick and Razer Sabertooth)
Merging crypto-current/master (929562b14478 crypto: stm32 - Fix OF module alias 
information)
Merging id

Re: [PATCH 40/40] media: imx: set and propagate empty field, colorimetry params

2017-05-08 Thread Steve Longerbeam



On 05/08/2017 02:41 AM, Philipp Zabel wrote:

Hi Steve,

On Wed, 2017-04-12 at 17:45 -0700, Steve Longerbeam wrote:

This patch adds a call to imx_media_fill_empty_mbus_fields() in the
*_try_fmt() functions at the sink pads, to set empty field order and
colorimetry parameters.

If the field order is set to ANY, choose the currently set field order
at the sink pad. If the colorspace is set to DEFAULT, choose the
current colorspace at the sink pad.  If any of xfer_func, ycbcr_enc
or quantization are set to DEFAULT, either choose the current sink pad
setting, or the default setting for the new colorspace, if non-DEFAULT
colorspace was given.

Colorimetry is also propagated from sink to source pads anywhere
this has not already been done. The exception is ic-prpencvf at the
source pad, since the Image Converter outputs fixed quantization and
Y`CbCr encoding.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/imx-ic-prp.c  |  5 ++-
 drivers/staging/media/imx/imx-ic-prpencvf.c | 25 +++---
 drivers/staging/media/imx/imx-media-csi.c   | 12 +--
 drivers/staging/media/imx/imx-media-utils.c | 53 +
 drivers/staging/media/imx/imx-media-vdic.c  |  7 ++--
 drivers/staging/media/imx/imx-media.h   |  3 +-
 6 files changed, 95 insertions(+), 10 deletions(-)


[...]

diff --git a/drivers/staging/media/imx/imx-media-utils.c 
b/drivers/staging/media/imx/imx-media-utils.c
index 7b2f92d..b07d0ae 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -464,6 +464,59 @@ int imx_media_init_mbus_fmt(struct v4l2_mbus_framefmt 
*mbus,
 }
 EXPORT_SYMBOL_GPL(imx_media_init_mbus_fmt);

+/*
+ * Check whether the field or colorimetry params in tryfmt are
+ * uninitialized, and if so fill them with the values from fmt.
+ * The exception is when tryfmt->colorspace has been initialized,
+ * if so all the further default colorimetry params can be derived
+ * from tryfmt->colorspace.
+ */
+void imx_media_fill_empty_mbus_fields(struct v4l2_mbus_framefmt *tryfmt,
+ struct v4l2_mbus_framefmt *fmt)
+{
+   /* fill field if necessary */
+   if (tryfmt->field == V4L2_FIELD_ANY)
+   tryfmt->field = fmt->field;
+
+   /* fill colorimetry if necessary */
+   if (tryfmt->colorspace == V4L2_COLORSPACE_DEFAULT) {
+   tryfmt->colorspace = fmt->colorspace;
+   if (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT)
+   tryfmt->xfer_func = fmt->xfer_func;
+   if (tryfmt->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT)
+   tryfmt->ycbcr_enc = fmt->ycbcr_enc;
+   if (tryfmt->quantization == V4L2_QUANTIZATION_DEFAULT)
+   tryfmt->quantization = fmt->quantization;


According to Hans' latest comments, this could be changed to:

--8<--
From cca3cda9effcaca0891eb8044a79137023fed1c2 Mon Sep 17 00:00:00 2001
From: Philipp Zabel 
Date: Mon, 8 May 2017 11:38:05 +0200
Subject: [PATCH] fixup! media: imx: set and propagate default field,
 colorimetry

Signed-off-by: Philipp Zabel 
---
 drivers/staging/media/imx/imx-media-utils.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c 
b/drivers/staging/media/imx/imx-media-utils.c
index a8766489e8a18..ec2abd618cc44 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -497,12 +497,9 @@ void imx_media_fill_default_mbus_fields(struct 
v4l2_mbus_framefmt *tryfmt,
/* fill colorimetry if necessary */
if (tryfmt->colorspace == V4L2_COLORSPACE_DEFAULT) {
tryfmt->colorspace = fmt->colorspace;
-   if (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT)
-   tryfmt->xfer_func = fmt->xfer_func;
-   if (tryfmt->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT)
-   tryfmt->ycbcr_enc = fmt->ycbcr_enc;
-   if (tryfmt->quantization == V4L2_QUANTIZATION_DEFAULT)
-   tryfmt->quantization = fmt->quantization;
+   tryfmt->xfer_func = fmt->xfer_func;
+   tryfmt->ycbcr_enc = fmt->ycbcr_enc;
+   tryfmt->quantization = fmt->quantization;
} else {
if (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT) {
tryfmt->xfer_func =



Hi Philipp, makes sense to me, I'll make the change in next revision.

Steve


Re: [PATCH 40/40] media: imx: set and propagate empty field, colorimetry params

2017-05-08 Thread Steve Longerbeam



On 05/08/2017 02:41 AM, Philipp Zabel wrote:

Hi Steve,

On Wed, 2017-04-12 at 17:45 -0700, Steve Longerbeam wrote:

This patch adds a call to imx_media_fill_empty_mbus_fields() in the
*_try_fmt() functions at the sink pads, to set empty field order and
colorimetry parameters.

If the field order is set to ANY, choose the currently set field order
at the sink pad. If the colorspace is set to DEFAULT, choose the
current colorspace at the sink pad.  If any of xfer_func, ycbcr_enc
or quantization are set to DEFAULT, either choose the current sink pad
setting, or the default setting for the new colorspace, if non-DEFAULT
colorspace was given.

Colorimetry is also propagated from sink to source pads anywhere
this has not already been done. The exception is ic-prpencvf at the
source pad, since the Image Converter outputs fixed quantization and
Y`CbCr encoding.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/imx-ic-prp.c  |  5 ++-
 drivers/staging/media/imx/imx-ic-prpencvf.c | 25 +++---
 drivers/staging/media/imx/imx-media-csi.c   | 12 +--
 drivers/staging/media/imx/imx-media-utils.c | 53 +
 drivers/staging/media/imx/imx-media-vdic.c  |  7 ++--
 drivers/staging/media/imx/imx-media.h   |  3 +-
 6 files changed, 95 insertions(+), 10 deletions(-)


[...]

diff --git a/drivers/staging/media/imx/imx-media-utils.c 
b/drivers/staging/media/imx/imx-media-utils.c
index 7b2f92d..b07d0ae 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -464,6 +464,59 @@ int imx_media_init_mbus_fmt(struct v4l2_mbus_framefmt 
*mbus,
 }
 EXPORT_SYMBOL_GPL(imx_media_init_mbus_fmt);

+/*
+ * Check whether the field or colorimetry params in tryfmt are
+ * uninitialized, and if so fill them with the values from fmt.
+ * The exception is when tryfmt->colorspace has been initialized,
+ * if so all the further default colorimetry params can be derived
+ * from tryfmt->colorspace.
+ */
+void imx_media_fill_empty_mbus_fields(struct v4l2_mbus_framefmt *tryfmt,
+ struct v4l2_mbus_framefmt *fmt)
+{
+   /* fill field if necessary */
+   if (tryfmt->field == V4L2_FIELD_ANY)
+   tryfmt->field = fmt->field;
+
+   /* fill colorimetry if necessary */
+   if (tryfmt->colorspace == V4L2_COLORSPACE_DEFAULT) {
+   tryfmt->colorspace = fmt->colorspace;
+   if (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT)
+   tryfmt->xfer_func = fmt->xfer_func;
+   if (tryfmt->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT)
+   tryfmt->ycbcr_enc = fmt->ycbcr_enc;
+   if (tryfmt->quantization == V4L2_QUANTIZATION_DEFAULT)
+   tryfmt->quantization = fmt->quantization;


According to Hans' latest comments, this could be changed to:

--8<--
From cca3cda9effcaca0891eb8044a79137023fed1c2 Mon Sep 17 00:00:00 2001
From: Philipp Zabel 
Date: Mon, 8 May 2017 11:38:05 +0200
Subject: [PATCH] fixup! media: imx: set and propagate default field,
 colorimetry

Signed-off-by: Philipp Zabel 
---
 drivers/staging/media/imx/imx-media-utils.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c 
b/drivers/staging/media/imx/imx-media-utils.c
index a8766489e8a18..ec2abd618cc44 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -497,12 +497,9 @@ void imx_media_fill_default_mbus_fields(struct 
v4l2_mbus_framefmt *tryfmt,
/* fill colorimetry if necessary */
if (tryfmt->colorspace == V4L2_COLORSPACE_DEFAULT) {
tryfmt->colorspace = fmt->colorspace;
-   if (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT)
-   tryfmt->xfer_func = fmt->xfer_func;
-   if (tryfmt->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT)
-   tryfmt->ycbcr_enc = fmt->ycbcr_enc;
-   if (tryfmt->quantization == V4L2_QUANTIZATION_DEFAULT)
-   tryfmt->quantization = fmt->quantization;
+   tryfmt->xfer_func = fmt->xfer_func;
+   tryfmt->ycbcr_enc = fmt->ycbcr_enc;
+   tryfmt->quantization = fmt->quantization;
} else {
if (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT) {
tryfmt->xfer_func =



Hi Philipp, makes sense to me, I'll make the change in next revision.

Steve


Re: [Patch v4] x86/build: don't add -maccumulate-outgoing-args w/o compiler support

2017-05-08 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 08:29:46PM -0700, Nick Desaulniers wrote:
> Clang does not support this machine dependent option.
> 
> Older versions of GCC (pre 3.0) may not support this option, added in
> 2000, but it's unlikely they can still compile the kernel.
> 
> Signed-off-by: Nick Desaulniers 
> ---
>  arch/x86/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 4430dd489620..8c4dcba9a6a7 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -179,7 +179,8 @@ ifdef CONFIG_JUMP_LABEL
>  endif
>  
>  ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
> - KBUILD_CFLAGS += -maccumulate-outgoing-args
> + # Unsupported by Clang.
> + KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
>  endif
>  
>  # Stackpointer is addressed different for 32 bit and 64 bit x86

Looks good to me, thanks for the iterations.

Reviewed-by: Josh Poimboeuf 

-- 
Josh


Re: [Patch v4] x86/build: don't add -maccumulate-outgoing-args w/o compiler support

2017-05-08 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 08:29:46PM -0700, Nick Desaulniers wrote:
> Clang does not support this machine dependent option.
> 
> Older versions of GCC (pre 3.0) may not support this option, added in
> 2000, but it's unlikely they can still compile the kernel.
> 
> Signed-off-by: Nick Desaulniers 
> ---
>  arch/x86/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 4430dd489620..8c4dcba9a6a7 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -179,7 +179,8 @@ ifdef CONFIG_JUMP_LABEL
>  endif
>  
>  ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
> - KBUILD_CFLAGS += -maccumulate-outgoing-args
> + # Unsupported by Clang.
> + KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
>  endif
>  
>  # Stackpointer is addressed different for 32 bit and 64 bit x86

Looks good to me, thanks for the iterations.

Reviewed-by: Josh Poimboeuf 

-- 
Josh


Re: [PATCH 7/7] DWARF: add the config option

2017-05-08 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 07:31:50PM -0700, Andy Lutomirski wrote:
> On Mon, May 8, 2017 at 6:38 PM, Josh Poimboeuf  wrote:
> >> Also, don't you need some indication of which reg is the base from
> >> which you find previous frame?  After all, sometimes GCC will emit a
> >> frame pointer even in an otherwise frame-pointer-omitting kernel.
> >
> > I don't think we *need* to do that.  I believe the base reg can just
> > always[*] be the stack pointer, even with frame pointers.
> 
> What if there are functions that use alloca or variable length arrays
> on the stack?  Functions using AHASH_REQUEST_ON_STACK come to mind.

Wow, mind blown.  This is why I added you to CC!

Ok, I guess we'll need to be able to use the frame pointer as a base
reg.  It should be easy anyway.

-- 
Josh


Re: [PATCH 7/7] DWARF: add the config option

2017-05-08 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 07:31:50PM -0700, Andy Lutomirski wrote:
> On Mon, May 8, 2017 at 6:38 PM, Josh Poimboeuf  wrote:
> >> Also, don't you need some indication of which reg is the base from
> >> which you find previous frame?  After all, sometimes GCC will emit a
> >> frame pointer even in an otherwise frame-pointer-omitting kernel.
> >
> > I don't think we *need* to do that.  I believe the base reg can just
> > always[*] be the stack pointer, even with frame pointers.
> 
> What if there are functions that use alloca or variable length arrays
> on the stack?  Functions using AHASH_REQUEST_ON_STACK come to mind.

Wow, mind blown.  This is why I added you to CC!

Ok, I guess we'll need to be able to use the frame pointer as a base
reg.  It should be easy anyway.

-- 
Josh


Re: [PATCH] thermal: core: make thermal_emergency_poweroff static

2017-05-08 Thread Keerthy


On Monday 08 May 2017 04:06 PM, Colin King wrote:
> From: Colin Ian King 
> 
> Making thermal_emergency_poweroff static fixes sparse warning:
> 
>   drivers/thermal/thermal_core.c:6: warning: symbol
>   'thermal_emergency_poweroff' was not declared. Should it be static?

Acked-by: Keerthy 

> 
> Fixes: ef1d87e06ab4 ("thermal: core: Add a back up thermal shutdown 
> mechanism")
> Signed-off-by: Colin Ian King 
> ---
>  drivers/thermal/thermal_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index b21b9cc2c8d6..5a51c740e372 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -359,7 +359,7 @@ static 
> DECLARE_DELAYED_WORK(thermal_emergency_poweroff_work,
>   * This may be called from any critical situation to trigger a system 
> shutdown
>   * after a known period of time. By default this is not scheduled.
>   */
> -void thermal_emergency_poweroff(void)
> +static void thermal_emergency_poweroff(void)
>  {
>   int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS;
>   /*
> 


Re: [PATCH] thermal: core: make thermal_emergency_poweroff static

2017-05-08 Thread Keerthy


On Monday 08 May 2017 04:06 PM, Colin King wrote:
> From: Colin Ian King 
> 
> Making thermal_emergency_poweroff static fixes sparse warning:
> 
>   drivers/thermal/thermal_core.c:6: warning: symbol
>   'thermal_emergency_poweroff' was not declared. Should it be static?

Acked-by: Keerthy 

> 
> Fixes: ef1d87e06ab4 ("thermal: core: Add a back up thermal shutdown 
> mechanism")
> Signed-off-by: Colin Ian King 
> ---
>  drivers/thermal/thermal_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index b21b9cc2c8d6..5a51c740e372 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -359,7 +359,7 @@ static 
> DECLARE_DELAYED_WORK(thermal_emergency_poweroff_work,
>   * This may be called from any critical situation to trigger a system 
> shutdown
>   * after a known period of time. By default this is not scheduled.
>   */
> -void thermal_emergency_poweroff(void)
> +static void thermal_emergency_poweroff(void)
>  {
>   int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS;
>   /*
> 


Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-08 Thread Baoquan He
On 05/08/17 at 05:25pm, Borislav Petkov wrote:
> On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote:
> > Thanks for explaining, Bhupesh. 
> > 
> > BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to
> > use efi old map:
> > 
> > void __init efi_apply_memmap_quirks(void)
> > {
> > ...
> > ...
> > /* UV2+ BIOS has a fix for this issue.  UV1 still needs the quirk. 
> > */
> > if (dmi_check_system(sgi_uv1_dmi))
> > set_bit(EFI_OLD_MEMMAP, );
> > }
> > 
> > And because of some reasons, redhat also need efi old_map now.
> > 
> > Hi Matt,
> > 
> > This v2 patch works on my kvm guest, however there's still problem on
> > SGI system. I will post v3 later after it's handled. So nack this v2
> > patch.
> 
> Please do not top-post, you should know better.
> 
> Can you apply this debug patch and upload full dmesg?

Please check the attachment.

> 
> ---
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index c488625c9712..ca9df6283040 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -88,9 +88,18 @@ pgd_t * __init efi_call_phys_prolog(void)
>   n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
>   save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
>  
> + pr_info("%s: PAGE_OFFSET: 0x%lx\n", __func__, PAGE_OFFSET);
> +
>   for (pgd = 0; pgd < n_pgds; pgd++) {
>   save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
>   vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
> +
> + pr_info("%s: pgd: 0x%x: va: 0x%lx, 0x%lx -> 0x%lx\n",
> + __func__, pgd,
> + vaddress,
> + pgd_val(*pgd_offset_k(pgd * PGDIR_SIZE)),
> + pgd_val(*pgd_offset_k(vaddress)));
> +
>   set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), 
> *pgd_offset_k(vaddress));
>   }
>  out:
> ---
> 
> Thanks.
> 
> -- 
> Regards/Gruss,
> Boris.
> 
> Good mailing practices for 400: avoid top-posting and trim the reply.
[0.00] microcode: microcode updated early to revision 0xb1d, date = 
2016-06-06
[0.00] Linux version 4.11.0+ 
(r...@sgi-uv300-03.rhts.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red 
Hat 4.8.5-14) (GCC) ) #8 SMP Mon May 8 20:59:49 EDT 2017
[0.00] Command line: BOOT_IMAGE=/vmlinuz-4.11.0+ 
root=/dev/mapper/rhel_sgi--uv300--03-root ro add_efi_memmap 
earlyprintk=ttyS0,115200n8 intel_idle.max_cstate=1 loglevel=9 nmi_watchdog=0 
nobau processor.max_cstate=1 crashkernel=auto rd.lvm.lv=rhel_sgi-uv300-03/root 
rd.lvm.lv=rhel_sgi-uv300-03/swap console=ttyS0,115200n8 LANG=en_US.UTF-8 
efi=old_map efi=debug
[0.00] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point 
registers'
[0.00] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[0.00] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[0.00] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[0.00] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, 
using 'standard' format.
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x00051fff] usable
[0.00] BIOS-e820: [mem 0x00052000-0x0005afff] reserved
[0.00] BIOS-e820: [mem 0x0005b000-0x0009] usable
[0.00] BIOS-e820: [mem 0x0010-0x72829fff] usable
[0.00] BIOS-e820: [mem 0x7282a000-0x7282afff] reserved
[0.00] BIOS-e820: [mem 0x7282b000-0x72837fff] usable
[0.00] BIOS-e820: [mem 0x72838000-0x72a77fff] reserved
[0.00] BIOS-e820: [mem 0x72a78000-0x751fefff] usable
[0.00] BIOS-e820: [mem 0x751ff000-0x75efefff] reserved
[0.00] BIOS-e820: [mem 0x75eff000-0x76efefff] ACPI NVS
[0.00] BIOS-e820: [mem 0x76eff000-0x76ffefff] ACPI data
[0.00] BIOS-e820: [mem 0x76fff000-0x7eff] usable
[0.00] BIOS-e820: [mem 0x8000-0x8fff] reserved
[0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
[0.00] BIOS-e820: [mem 0x0001-0x001e] usable
[0.00] BIOS-e820: [mem 0x0020-0x00207fff] usable
[0.00] BIOS-e820: [mem 0x0040-0x005efeff] usable
[0.00] BIOS-e820: [mem 0x0080-0x009efeff] usable
[0.00] BIOS-e820: [mem 0x00c0-0x00defeff] usable
[0.00] BIOS-e820: [mem 0x0ff8-0x0ff803df] reserved
[0.00] BIOS-e820: [mem 0x0ff803f0-0x0ff803ff] reserved
[0.00] BIOS-e820: [mem 0x0ff807f0-0x0ff807ff] reserved
[0.00] BIOS-e820: [mem 0x0ff80bf0-0x0ff80bff] reserved
[0.00] 

Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-08 Thread Baoquan He
On 05/08/17 at 05:25pm, Borislav Petkov wrote:
> On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote:
> > Thanks for explaining, Bhupesh. 
> > 
> > BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to
> > use efi old map:
> > 
> > void __init efi_apply_memmap_quirks(void)
> > {
> > ...
> > ...
> > /* UV2+ BIOS has a fix for this issue.  UV1 still needs the quirk. 
> > */
> > if (dmi_check_system(sgi_uv1_dmi))
> > set_bit(EFI_OLD_MEMMAP, );
> > }
> > 
> > And because of some reasons, redhat also need efi old_map now.
> > 
> > Hi Matt,
> > 
> > This v2 patch works on my kvm guest, however there's still problem on
> > SGI system. I will post v3 later after it's handled. So nack this v2
> > patch.
> 
> Please do not top-post, you should know better.
> 
> Can you apply this debug patch and upload full dmesg?

Please check the attachment.

> 
> ---
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index c488625c9712..ca9df6283040 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -88,9 +88,18 @@ pgd_t * __init efi_call_phys_prolog(void)
>   n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
>   save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
>  
> + pr_info("%s: PAGE_OFFSET: 0x%lx\n", __func__, PAGE_OFFSET);
> +
>   for (pgd = 0; pgd < n_pgds; pgd++) {
>   save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
>   vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
> +
> + pr_info("%s: pgd: 0x%x: va: 0x%lx, 0x%lx -> 0x%lx\n",
> + __func__, pgd,
> + vaddress,
> + pgd_val(*pgd_offset_k(pgd * PGDIR_SIZE)),
> + pgd_val(*pgd_offset_k(vaddress)));
> +
>   set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), 
> *pgd_offset_k(vaddress));
>   }
>  out:
> ---
> 
> Thanks.
> 
> -- 
> Regards/Gruss,
> Boris.
> 
> Good mailing practices for 400: avoid top-posting and trim the reply.
[0.00] microcode: microcode updated early to revision 0xb1d, date = 
2016-06-06
[0.00] Linux version 4.11.0+ 
(r...@sgi-uv300-03.rhts.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red 
Hat 4.8.5-14) (GCC) ) #8 SMP Mon May 8 20:59:49 EDT 2017
[0.00] Command line: BOOT_IMAGE=/vmlinuz-4.11.0+ 
root=/dev/mapper/rhel_sgi--uv300--03-root ro add_efi_memmap 
earlyprintk=ttyS0,115200n8 intel_idle.max_cstate=1 loglevel=9 nmi_watchdog=0 
nobau processor.max_cstate=1 crashkernel=auto rd.lvm.lv=rhel_sgi-uv300-03/root 
rd.lvm.lv=rhel_sgi-uv300-03/swap console=ttyS0,115200n8 LANG=en_US.UTF-8 
efi=old_map efi=debug
[0.00] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point 
registers'
[0.00] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[0.00] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[0.00] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[0.00] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, 
using 'standard' format.
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x00051fff] usable
[0.00] BIOS-e820: [mem 0x00052000-0x0005afff] reserved
[0.00] BIOS-e820: [mem 0x0005b000-0x0009] usable
[0.00] BIOS-e820: [mem 0x0010-0x72829fff] usable
[0.00] BIOS-e820: [mem 0x7282a000-0x7282afff] reserved
[0.00] BIOS-e820: [mem 0x7282b000-0x72837fff] usable
[0.00] BIOS-e820: [mem 0x72838000-0x72a77fff] reserved
[0.00] BIOS-e820: [mem 0x72a78000-0x751fefff] usable
[0.00] BIOS-e820: [mem 0x751ff000-0x75efefff] reserved
[0.00] BIOS-e820: [mem 0x75eff000-0x76efefff] ACPI NVS
[0.00] BIOS-e820: [mem 0x76eff000-0x76ffefff] ACPI data
[0.00] BIOS-e820: [mem 0x76fff000-0x7eff] usable
[0.00] BIOS-e820: [mem 0x8000-0x8fff] reserved
[0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
[0.00] BIOS-e820: [mem 0x0001-0x001e] usable
[0.00] BIOS-e820: [mem 0x0020-0x00207fff] usable
[0.00] BIOS-e820: [mem 0x0040-0x005efeff] usable
[0.00] BIOS-e820: [mem 0x0080-0x009efeff] usable
[0.00] BIOS-e820: [mem 0x00c0-0x00defeff] usable
[0.00] BIOS-e820: [mem 0x0ff8-0x0ff803df] reserved
[0.00] BIOS-e820: [mem 0x0ff803f0-0x0ff803ff] reserved
[0.00] BIOS-e820: [mem 0x0ff807f0-0x0ff807ff] reserved
[0.00] BIOS-e820: [mem 0x0ff80bf0-0x0ff80bff] reserved
[0.00] 

[Patch v4] x86/build: don't add -maccumulate-outgoing-args w/o compiler support

2017-05-08 Thread Nick Desaulniers
Clang does not support this machine dependent option.

Older versions of GCC (pre 3.0) may not support this option, added in
2000, but it's unlikely they can still compile the kernel.

Signed-off-by: Nick Desaulniers 
---
 arch/x86/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 4430dd489620..8c4dcba9a6a7 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -179,7 +179,8 @@ ifdef CONFIG_JUMP_LABEL
 endif
 
 ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
-   KBUILD_CFLAGS += -maccumulate-outgoing-args
+   # Unsupported by Clang.
+   KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
 endif
 
 # Stackpointer is addressed different for 32 bit and 64 bit x86
-- 
2.11.0



[Patch v4] x86/build: don't add -maccumulate-outgoing-args w/o compiler support

2017-05-08 Thread Nick Desaulniers
Clang does not support this machine dependent option.

Older versions of GCC (pre 3.0) may not support this option, added in
2000, but it's unlikely they can still compile the kernel.

Signed-off-by: Nick Desaulniers 
---
 arch/x86/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 4430dd489620..8c4dcba9a6a7 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -179,7 +179,8 @@ ifdef CONFIG_JUMP_LABEL
 endif
 
 ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
-   KBUILD_CFLAGS += -maccumulate-outgoing-args
+   # Unsupported by Clang.
+   KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
 endif
 
 # Stackpointer is addressed different for 32 bit and 64 bit x86
-- 
2.11.0



net/xfrm/xfrm_input.c:84:9: sparse: context imbalance in 'xfrm_rcv_cb' - unexpected unlock

2017-05-08 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   bf5f89463f5b3109a72ed13ca62b57e90213387d
commit: 960fdfdeb9e85a67bed136bc945c541ba61c2bdd xfrm: input: constify 
xfrm_input_afinfo
date:   3 months ago
reproduce:
# apt-get install sparse
git checkout 960fdfdeb9e85a67bed136bc945c541ba61c2bdd
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   net/xfrm/xfrm_input.c:61:39: sparse: context imbalance in 
'xfrm_input_get_afinfo' - different lock contexts for basic block
>> net/xfrm/xfrm_input.c:84:9: sparse: context imbalance in 'xfrm_rcv_cb' - 
>> unexpected unlock

vim +/xfrm_rcv_cb +84 net/xfrm/xfrm_input.c

2f32b51b Steffen Klassert 2014-03-14  55
spin_unlock_bh(_input_afinfo_lock);
2f32b51b Steffen Klassert 2014-03-14  56synchronize_rcu();
2f32b51b Steffen Klassert 2014-03-14  57return err;
2f32b51b Steffen Klassert 2014-03-14  58  }
2f32b51b Steffen Klassert 2014-03-14  59  
EXPORT_SYMBOL(xfrm_input_unregister_afinfo);
2f32b51b Steffen Klassert 2014-03-14  60  
960fdfde Florian Westphal 2017-02-07 @61  static const struct xfrm_input_afinfo 
*xfrm_input_get_afinfo(unsigned int family)
2f32b51b Steffen Klassert 2014-03-14  62  {
960fdfde Florian Westphal 2017-02-07  63const struct xfrm_input_afinfo 
*afinfo;
2f32b51b Steffen Klassert 2014-03-14  64  
960fdfde Florian Westphal 2017-02-07  65if (WARN_ON_ONCE(family >= 
ARRAY_SIZE(xfrm_input_afinfo)))
2f32b51b Steffen Klassert 2014-03-14  66return NULL;
960fdfde Florian Westphal 2017-02-07  67  
2f32b51b Steffen Klassert 2014-03-14  68rcu_read_lock();
2f32b51b Steffen Klassert 2014-03-14  69afinfo = 
rcu_dereference(xfrm_input_afinfo[family]);
2f32b51b Steffen Klassert 2014-03-14  70if (unlikely(!afinfo))
2f32b51b Steffen Klassert 2014-03-14  71rcu_read_unlock();
2f32b51b Steffen Klassert 2014-03-14  72return afinfo;
2f32b51b Steffen Klassert 2014-03-14  73  }
2f32b51b Steffen Klassert 2014-03-14  74  
2f32b51b Steffen Klassert 2014-03-14  75  static int xfrm_rcv_cb(struct sk_buff 
*skb, unsigned int family, u8 protocol,
2f32b51b Steffen Klassert 2014-03-14  76   int err)
2f32b51b Steffen Klassert 2014-03-14  77  {
2f32b51b Steffen Klassert 2014-03-14  78int ret;
960fdfde Florian Westphal 2017-02-07  79const struct xfrm_input_afinfo 
*afinfo = xfrm_input_get_afinfo(family);
2f32b51b Steffen Klassert 2014-03-14  80  
2f32b51b Steffen Klassert 2014-03-14  81if (!afinfo)
2f32b51b Steffen Klassert 2014-03-14  82return -EAFNOSUPPORT;
2f32b51b Steffen Klassert 2014-03-14  83  
2f32b51b Steffen Klassert 2014-03-14 @84ret = afinfo->callback(skb, 
protocol, err);
960fdfde Florian Westphal 2017-02-07  85rcu_read_unlock();
2f32b51b Steffen Klassert 2014-03-14  86  
2f32b51b Steffen Klassert 2014-03-14  87return ret;

:: The code at line 84 was first introduced by commit
:: 2f32b51b609faea1e40bb8c5bd305f1351740936 xfrm: Introduce 
xfrm_input_afinfo to access the the callbacks properly

:: TO: Steffen Klassert 
:: CC: Steffen Klassert 

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


net/xfrm/xfrm_input.c:84:9: sparse: context imbalance in 'xfrm_rcv_cb' - unexpected unlock

2017-05-08 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   bf5f89463f5b3109a72ed13ca62b57e90213387d
commit: 960fdfdeb9e85a67bed136bc945c541ba61c2bdd xfrm: input: constify 
xfrm_input_afinfo
date:   3 months ago
reproduce:
# apt-get install sparse
git checkout 960fdfdeb9e85a67bed136bc945c541ba61c2bdd
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   net/xfrm/xfrm_input.c:61:39: sparse: context imbalance in 
'xfrm_input_get_afinfo' - different lock contexts for basic block
>> net/xfrm/xfrm_input.c:84:9: sparse: context imbalance in 'xfrm_rcv_cb' - 
>> unexpected unlock

vim +/xfrm_rcv_cb +84 net/xfrm/xfrm_input.c

2f32b51b Steffen Klassert 2014-03-14  55
spin_unlock_bh(_input_afinfo_lock);
2f32b51b Steffen Klassert 2014-03-14  56synchronize_rcu();
2f32b51b Steffen Klassert 2014-03-14  57return err;
2f32b51b Steffen Klassert 2014-03-14  58  }
2f32b51b Steffen Klassert 2014-03-14  59  
EXPORT_SYMBOL(xfrm_input_unregister_afinfo);
2f32b51b Steffen Klassert 2014-03-14  60  
960fdfde Florian Westphal 2017-02-07 @61  static const struct xfrm_input_afinfo 
*xfrm_input_get_afinfo(unsigned int family)
2f32b51b Steffen Klassert 2014-03-14  62  {
960fdfde Florian Westphal 2017-02-07  63const struct xfrm_input_afinfo 
*afinfo;
2f32b51b Steffen Klassert 2014-03-14  64  
960fdfde Florian Westphal 2017-02-07  65if (WARN_ON_ONCE(family >= 
ARRAY_SIZE(xfrm_input_afinfo)))
2f32b51b Steffen Klassert 2014-03-14  66return NULL;
960fdfde Florian Westphal 2017-02-07  67  
2f32b51b Steffen Klassert 2014-03-14  68rcu_read_lock();
2f32b51b Steffen Klassert 2014-03-14  69afinfo = 
rcu_dereference(xfrm_input_afinfo[family]);
2f32b51b Steffen Klassert 2014-03-14  70if (unlikely(!afinfo))
2f32b51b Steffen Klassert 2014-03-14  71rcu_read_unlock();
2f32b51b Steffen Klassert 2014-03-14  72return afinfo;
2f32b51b Steffen Klassert 2014-03-14  73  }
2f32b51b Steffen Klassert 2014-03-14  74  
2f32b51b Steffen Klassert 2014-03-14  75  static int xfrm_rcv_cb(struct sk_buff 
*skb, unsigned int family, u8 protocol,
2f32b51b Steffen Klassert 2014-03-14  76   int err)
2f32b51b Steffen Klassert 2014-03-14  77  {
2f32b51b Steffen Klassert 2014-03-14  78int ret;
960fdfde Florian Westphal 2017-02-07  79const struct xfrm_input_afinfo 
*afinfo = xfrm_input_get_afinfo(family);
2f32b51b Steffen Klassert 2014-03-14  80  
2f32b51b Steffen Klassert 2014-03-14  81if (!afinfo)
2f32b51b Steffen Klassert 2014-03-14  82return -EAFNOSUPPORT;
2f32b51b Steffen Klassert 2014-03-14  83  
2f32b51b Steffen Klassert 2014-03-14 @84ret = afinfo->callback(skb, 
protocol, err);
960fdfde Florian Westphal 2017-02-07  85rcu_read_unlock();
2f32b51b Steffen Klassert 2014-03-14  86  
2f32b51b Steffen Klassert 2014-03-14  87return ret;

:: The code at line 84 was first introduced by commit
:: 2f32b51b609faea1e40bb8c5bd305f1351740936 xfrm: Introduce 
xfrm_input_afinfo to access the the callbacks properly

:: TO: Steffen Klassert 
:: CC: Steffen Klassert 

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


Re: [PATCH] scsi: qedf: properly update arguments position in function call

2017-05-08 Thread Gustavo A. R. Silva

Hi Martin,

Quoting "Martin K. Petersen" :


Gustavo A.,


Properly update the position of the arguments in function call.


Applied to 4.12/scsi-fixes, thank you!



Awesome, glad to help. :)
--
Gustavo A. R. Silva







Re: [PATCH] scsi: qedf: properly update arguments position in function call

2017-05-08 Thread Gustavo A. R. Silva

Hi Martin,

Quoting "Martin K. Petersen" :


Gustavo A.,


Properly update the position of the arguments in function call.


Applied to 4.12/scsi-fixes, thank you!



Awesome, glad to help. :)
--
Gustavo A. R. Silva







Re: [PATCH v8 2/7] doc: Add documentation for Coresight CPU debug

2017-05-08 Thread Leo Yan
Hi Mathieu,

On Wed, May 03, 2017 at 04:29:37PM -0600, Mathieu Poirier wrote:
> On Tue, May 02, 2017 at 06:08:32PM +0800, Leo Yan wrote:
> > Update kernel-parameters.txt to add new parameter:
> > coresight_cpu_debug.enable is a knob to enable debugging at boot time.
> > 
> > Add detailed documentation, which contains the implementation, Mike
> > Leach excellent summary for "clock and power domain". At the end some
> > examples on how to enable the debugging functionality are provided.
> > 
> > Suggested-by: Mike Leach 
> > Signed-off-by: Leo Yan 
> > ---
> >  Documentation/admin-guide/kernel-parameters.txt |   7 +
> >  Documentation/trace/coresight-cpu-debug.txt | 174 
> > 
> 
> Please add coresight-cpu-debug.txt to the list of maintained files in
> MAINTAINERS.  Moreover I'm pretty sure John will want you to split this patch 
> in
> two, i.e one patch for kernel-parameters.txt and another for
> coresight-cpu-debug.txt

Thanks for the suggestion. Have splited doc related patches and
refined debug module related code as you suggested in another
email and sent out v9 patch set for reviewing.

[...]

Thanks,
Leo Yan


Re: [PATCH v8 2/7] doc: Add documentation for Coresight CPU debug

2017-05-08 Thread Leo Yan
Hi Mathieu,

On Wed, May 03, 2017 at 04:29:37PM -0600, Mathieu Poirier wrote:
> On Tue, May 02, 2017 at 06:08:32PM +0800, Leo Yan wrote:
> > Update kernel-parameters.txt to add new parameter:
> > coresight_cpu_debug.enable is a knob to enable debugging at boot time.
> > 
> > Add detailed documentation, which contains the implementation, Mike
> > Leach excellent summary for "clock and power domain". At the end some
> > examples on how to enable the debugging functionality are provided.
> > 
> > Suggested-by: Mike Leach 
> > Signed-off-by: Leo Yan 
> > ---
> >  Documentation/admin-guide/kernel-parameters.txt |   7 +
> >  Documentation/trace/coresight-cpu-debug.txt | 174 
> > 
> 
> Please add coresight-cpu-debug.txt to the list of maintained files in
> MAINTAINERS.  Moreover I'm pretty sure John will want you to split this patch 
> in
> two, i.e one patch for kernel-parameters.txt and another for
> coresight-cpu-debug.txt

Thanks for the suggestion. Have splited doc related patches and
refined debug module related code as you suggested in another
email and sent out v9 patch set for reviewing.

[...]

Thanks,
Leo Yan


[PATCH v9 5/9] coresight: of_get_coresight_platform_data: Add missing of_node_put

2017-05-08 Thread Leo Yan
From: Suzuki K Poulose 

The of_get_coresight_platform_data iterates over the possible CPU nodes
to find a given cpu phandle. However it does not drop the reference
to the node pointer returned by the of_get_coresight_platform_data.

This patch also introduces another minor fix is to use
of_cpu_device_node_get() to replace of_get_cpu_node().

Cc: Mathieu Poirier 
Reviewed-by: Suzuki K Poulose 
Signed-off-by: Suzuki K Poulose 
[Leo: minor tweaks for of_get_coresight_platform_data]
Signed-off-by: Leo Yan 
---
 drivers/hwtracing/coresight/of_coresight.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/hwtracing/coresight/of_coresight.c 
b/drivers/hwtracing/coresight/of_coresight.c
index 2749853..225b2dd 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
@@ -109,7 +109,8 @@ of_get_coresight_platform_data(struct device *dev,
struct coresight_platform_data *pdata;
struct of_endpoint endpoint, rendpoint;
struct device *rdev;
-   struct device_node *dn;
+   bool found;
+   struct device_node *dn, *np;
struct device_node *ep = NULL;
struct device_node *rparent = NULL;
struct device_node *rport = NULL;
@@ -176,17 +177,19 @@ of_get_coresight_platform_data(struct device *dev,
} while (ep);
}
 
-   /* Affinity defaults to CPU0 */
-   pdata->cpu = 0;
dn = of_parse_phandle(node, "cpu", 0);
-   for (cpu = 0; dn && cpu < nr_cpu_ids; cpu++) {
-   if (dn == of_get_cpu_node(cpu, NULL)) {
-   pdata->cpu = cpu;
+   for_each_possible_cpu(cpu) {
+   np = of_cpu_device_node_get(cpu);
+   found = (dn == np);
+   of_node_put(np);
+   if (found)
break;
-   }
}
of_node_put(dn);
 
+   /* Affinity to CPU0 if no cpu nodes are found */
+   pdata->cpu = found ? cpu : 0;
+
return pdata;
 }
 EXPORT_SYMBOL_GPL(of_get_coresight_platform_data);
-- 
2.7.4



[PATCH v9 5/9] coresight: of_get_coresight_platform_data: Add missing of_node_put

2017-05-08 Thread Leo Yan
From: Suzuki K Poulose 

The of_get_coresight_platform_data iterates over the possible CPU nodes
to find a given cpu phandle. However it does not drop the reference
to the node pointer returned by the of_get_coresight_platform_data.

This patch also introduces another minor fix is to use
of_cpu_device_node_get() to replace of_get_cpu_node().

Cc: Mathieu Poirier 
Reviewed-by: Suzuki K Poulose 
Signed-off-by: Suzuki K Poulose 
[Leo: minor tweaks for of_get_coresight_platform_data]
Signed-off-by: Leo Yan 
---
 drivers/hwtracing/coresight/of_coresight.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/hwtracing/coresight/of_coresight.c 
b/drivers/hwtracing/coresight/of_coresight.c
index 2749853..225b2dd 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
@@ -109,7 +109,8 @@ of_get_coresight_platform_data(struct device *dev,
struct coresight_platform_data *pdata;
struct of_endpoint endpoint, rendpoint;
struct device *rdev;
-   struct device_node *dn;
+   bool found;
+   struct device_node *dn, *np;
struct device_node *ep = NULL;
struct device_node *rparent = NULL;
struct device_node *rport = NULL;
@@ -176,17 +177,19 @@ of_get_coresight_platform_data(struct device *dev,
} while (ep);
}
 
-   /* Affinity defaults to CPU0 */
-   pdata->cpu = 0;
dn = of_parse_phandle(node, "cpu", 0);
-   for (cpu = 0; dn && cpu < nr_cpu_ids; cpu++) {
-   if (dn == of_get_cpu_node(cpu, NULL)) {
-   pdata->cpu = cpu;
+   for_each_possible_cpu(cpu) {
+   np = of_cpu_device_node_get(cpu);
+   found = (dn == np);
+   of_node_put(np);
+   if (found)
break;
-   }
}
of_node_put(dn);
 
+   /* Affinity to CPU0 if no cpu nodes are found */
+   pdata->cpu = found ? cpu : 0;
+
return pdata;
 }
 EXPORT_SYMBOL_GPL(of_get_coresight_platform_data);
-- 
2.7.4



[PATCH v9 9/9] arm64: dts: qcom: msm8916: Add debug unit

2017-05-08 Thread Leo Yan
Add debug unit on Qualcomm msm8916 based platforms, including the
DragonBoard 410c board.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 32 
 1 file changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi 
b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index 68a8e67..3af814b 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -1104,6 +1104,38 @@
};
};
 
+   debug@85 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x85 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@852000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x852000 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@854000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x854000 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@856000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x856000 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
etm@85c000 {
compatible = "arm,coresight-etm4x", "arm,primecell";
reg = <0x85c000 0x1000>;
-- 
2.7.4



[PATCH v9 9/9] arm64: dts: qcom: msm8916: Add debug unit

2017-05-08 Thread Leo Yan
Add debug unit on Qualcomm msm8916 based platforms, including the
DragonBoard 410c board.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 32 
 1 file changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi 
b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index 68a8e67..3af814b 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -1104,6 +1104,38 @@
};
};
 
+   debug@85 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x85 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@852000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x852000 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@854000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x854000 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@856000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0x856000 0x1000>;
+   clocks = < RPM_QDSS_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
etm@85c000 {
compatible = "arm,coresight-etm4x", "arm,primecell";
reg = <0x85c000 0x1000>;
-- 
2.7.4



[PATCH v9 8/9] arm64: dts: hi6220: register debug module

2017-05-08 Thread Leo Yan
Bind debug module driver for Hi6220.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 64 +++
 1 file changed, 64 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 470461d..467aa15 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -913,5 +913,69 @@
};
};
};
+
+   debug@f659 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf659 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f6592000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf6592000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f6594000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf6594000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f6596000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf6596000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d2000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d2000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d4000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d4000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d6000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d6000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
};
 };
-- 
2.7.4



[PATCH v9 7/9] coresight: add support for CPU debug module

2017-05-08 Thread Leo Yan
Coresight includes debug module and usually the module connects with CPU
debug logic. ARMv8 architecture reference manual (ARM DDI 0487A.k) has
description for related info in "Part H: External Debug".

Chapter H7 "The Sample-based Profiling Extension" introduces several
sampling registers, e.g. we can check program counter value with
combined CPU exception level, secure state, etc. So this is helpful for
analysis CPU lockup scenarios, e.g. if one CPU has run into infinite
loop with IRQ disabled. In this case the CPU cannot switch context and
handle any interrupt (including IPIs), as the result it cannot handle
SMP call for stack dump.

This patch is to enable coresight debug module, so firstly this driver
is to bind apb clock for debug module and this is to ensure the debug
module can be accessed from program or external debugger. And the driver
uses sample-based registers for debug purpose, e.g. when system triggers
panic, the driver will dump program counter and combined context
registers (EDCIDSR, EDVIDSR); by parsing context registers so can
quickly get to know CPU secure state, exception level, etc.

Some of the debug module registers are located in CPU power domain, so
this requires the CPU power domain stays on when access related debug
registers, but the power management for CPU power domain is quite
dependent on SoC integration for power management. For the platforms
which with sane power controller implementations, this driver follows
the method to set EDPRCR to try to pull the CPU out of low power state
and then set 'no power down request' bit so the CPU has no chance to
lose power.

If the SoC has not followed up this design well for power management
controller, the user should use the command line parameter or sysfs
to constrain all or partial idle states to ensure the CPU power
domain is enabled and access coresight CPU debug component safely.

Signed-off-by: Leo Yan 
---
 drivers/hwtracing/coresight/Kconfig   |  14 +
 drivers/hwtracing/coresight/Makefile  |   1 +
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 693 ++
 3 files changed, 708 insertions(+)
 create mode 100644 drivers/hwtracing/coresight/coresight-cpu-debug.c

diff --git a/drivers/hwtracing/coresight/Kconfig 
b/drivers/hwtracing/coresight/Kconfig
index 130cb21..8d55d6d 100644
--- a/drivers/hwtracing/coresight/Kconfig
+++ b/drivers/hwtracing/coresight/Kconfig
@@ -89,4 +89,18 @@ config CORESIGHT_STM
  logging useful software events or data coming from various entities
  in the system, possibly running different OSs
 
+config CORESIGHT_CPU_DEBUG
+   tristate "CoreSight CPU Debug driver"
+   depends on ARM || ARM64
+   depends on DEBUG_FS
+   help
+ This driver provides support for coresight debugging module. This
+ is primarily used to dump sample-based profiling registers when
+ system triggers panic, the driver will parse context registers so
+ can quickly get to know program counter (PC), secure state,
+ exception level, etc. Before use debugging functionality, platform
+ needs to ensure the clock domain and power domain are enabled
+ properly, please refer Documentation/trace/coresight-cpu-debug.txt
+ for detailed description and the example for usage.
+
 endif
diff --git a/drivers/hwtracing/coresight/Makefile 
b/drivers/hwtracing/coresight/Makefile
index af480d9..433d590 100644
--- a/drivers/hwtracing/coresight/Makefile
+++ b/drivers/hwtracing/coresight/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o \
coresight-etm4x-sysfs.o
 obj-$(CONFIG_CORESIGHT_QCOM_REPLICATOR) += coresight-replicator-qcom.o
 obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o
+obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c 
b/drivers/hwtracing/coresight/coresight-cpu-debug.c
new file mode 100644
index 000..ab12ec1
--- /dev/null
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -0,0 +1,693 @@
+/*
+ * Copyright (c) 2017 Linaro Limited. All rights reserved.
+ *
+ * Author: Leo Yan 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 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.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see .
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 

[PATCH v9 6/9] coresight: refactor with function of_coresight_get_cpu

2017-05-08 Thread Leo Yan
This is refactor to add function of_coresight_get_cpu(), so it's used to
retrieve CPU id for coresight component. Finally can use it as a common
function for multiple places.

Suggested-by: Mathieu Poirier 
Reviewed-by: Suzuki K Poulose 
Signed-off-by: Leo Yan 
---
 drivers/hwtracing/coresight/of_coresight.c | 43 +++---
 include/linux/coresight.h  |  3 +++
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/drivers/hwtracing/coresight/of_coresight.c 
b/drivers/hwtracing/coresight/of_coresight.c
index 225b2dd..a187941 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
@@ -101,16 +101,40 @@ static int of_coresight_alloc_memory(struct device *dev,
return 0;
 }
 
+int of_coresight_get_cpu(const struct device_node *node)
+{
+   int cpu;
+   bool found;
+   struct device_node *dn, *np;
+
+   dn = of_parse_phandle(node, "cpu", 0);
+
+   /* Affinity defaults to CPU0 */
+   if (!dn)
+   return 0;
+
+   for_each_possible_cpu(cpu) {
+   np = of_cpu_device_node_get(cpu);
+   found = (dn == np);
+   of_node_put(np);
+   if (found)
+   break;
+   }
+   of_node_put(dn);
+
+   /* Affinity to CPU0 if no cpu nodes are found */
+   return found ? cpu : 0;
+}
+EXPORT_SYMBOL_GPL(of_coresight_get_cpu);
+
 struct coresight_platform_data *
 of_get_coresight_platform_data(struct device *dev,
   const struct device_node *node)
 {
-   int i = 0, ret = 0, cpu;
+   int i = 0, ret = 0;
struct coresight_platform_data *pdata;
struct of_endpoint endpoint, rendpoint;
struct device *rdev;
-   bool found;
-   struct device_node *dn, *np;
struct device_node *ep = NULL;
struct device_node *rparent = NULL;
struct device_node *rport = NULL;
@@ -177,18 +201,7 @@ of_get_coresight_platform_data(struct device *dev,
} while (ep);
}
 
-   dn = of_parse_phandle(node, "cpu", 0);
-   for_each_possible_cpu(cpu) {
-   np = of_cpu_device_node_get(cpu);
-   found = (dn == np);
-   of_node_put(np);
-   if (found)
-   break;
-   }
-   of_node_put(dn);
-
-   /* Affinity to CPU0 if no cpu nodes are found */
-   pdata->cpu = found ? cpu : 0;
+   pdata->cpu = of_coresight_get_cpu(node);
 
return pdata;
 }
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index bf0aa50..d950dad 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -263,10 +263,13 @@ static inline int coresight_timeout(void __iomem *addr, 
u32 offset,
 #endif
 
 #ifdef CONFIG_OF
+extern int of_coresight_get_cpu(const struct device_node *node);
 extern struct coresight_platform_data *
 of_get_coresight_platform_data(struct device *dev,
   const struct device_node *node);
 #else
+static inline int of_coresight_get_cpu(const struct device_node *node)
+{ return 0; }
 static inline struct coresight_platform_data *of_get_coresight_platform_data(
struct device *dev, const struct device_node *node) { return NULL; }
 #endif
-- 
2.7.4



[PATCH v9 8/9] arm64: dts: hi6220: register debug module

2017-05-08 Thread Leo Yan
Bind debug module driver for Hi6220.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 64 +++
 1 file changed, 64 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 470461d..467aa15 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -913,5 +913,69 @@
};
};
};
+
+   debug@f659 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf659 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f6592000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf6592000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f6594000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf6594000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f6596000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf6596000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d2000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d2000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d4000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d4000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
+
+   debug@f65d6000 {
+   compatible = "arm,coresight-cpu-debug","arm,primecell";
+   reg = <0 0xf65d6000 0 0x1000>;
+   clocks = <_ctrl HI6220_DAPB_CLK>;
+   clock-names = "apb_pclk";
+   cpu = <>;
+   };
};
 };
-- 
2.7.4



[PATCH v9 7/9] coresight: add support for CPU debug module

2017-05-08 Thread Leo Yan
Coresight includes debug module and usually the module connects with CPU
debug logic. ARMv8 architecture reference manual (ARM DDI 0487A.k) has
description for related info in "Part H: External Debug".

Chapter H7 "The Sample-based Profiling Extension" introduces several
sampling registers, e.g. we can check program counter value with
combined CPU exception level, secure state, etc. So this is helpful for
analysis CPU lockup scenarios, e.g. if one CPU has run into infinite
loop with IRQ disabled. In this case the CPU cannot switch context and
handle any interrupt (including IPIs), as the result it cannot handle
SMP call for stack dump.

This patch is to enable coresight debug module, so firstly this driver
is to bind apb clock for debug module and this is to ensure the debug
module can be accessed from program or external debugger. And the driver
uses sample-based registers for debug purpose, e.g. when system triggers
panic, the driver will dump program counter and combined context
registers (EDCIDSR, EDVIDSR); by parsing context registers so can
quickly get to know CPU secure state, exception level, etc.

Some of the debug module registers are located in CPU power domain, so
this requires the CPU power domain stays on when access related debug
registers, but the power management for CPU power domain is quite
dependent on SoC integration for power management. For the platforms
which with sane power controller implementations, this driver follows
the method to set EDPRCR to try to pull the CPU out of low power state
and then set 'no power down request' bit so the CPU has no chance to
lose power.

If the SoC has not followed up this design well for power management
controller, the user should use the command line parameter or sysfs
to constrain all or partial idle states to ensure the CPU power
domain is enabled and access coresight CPU debug component safely.

Signed-off-by: Leo Yan 
---
 drivers/hwtracing/coresight/Kconfig   |  14 +
 drivers/hwtracing/coresight/Makefile  |   1 +
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 693 ++
 3 files changed, 708 insertions(+)
 create mode 100644 drivers/hwtracing/coresight/coresight-cpu-debug.c

diff --git a/drivers/hwtracing/coresight/Kconfig 
b/drivers/hwtracing/coresight/Kconfig
index 130cb21..8d55d6d 100644
--- a/drivers/hwtracing/coresight/Kconfig
+++ b/drivers/hwtracing/coresight/Kconfig
@@ -89,4 +89,18 @@ config CORESIGHT_STM
  logging useful software events or data coming from various entities
  in the system, possibly running different OSs
 
+config CORESIGHT_CPU_DEBUG
+   tristate "CoreSight CPU Debug driver"
+   depends on ARM || ARM64
+   depends on DEBUG_FS
+   help
+ This driver provides support for coresight debugging module. This
+ is primarily used to dump sample-based profiling registers when
+ system triggers panic, the driver will parse context registers so
+ can quickly get to know program counter (PC), secure state,
+ exception level, etc. Before use debugging functionality, platform
+ needs to ensure the clock domain and power domain are enabled
+ properly, please refer Documentation/trace/coresight-cpu-debug.txt
+ for detailed description and the example for usage.
+
 endif
diff --git a/drivers/hwtracing/coresight/Makefile 
b/drivers/hwtracing/coresight/Makefile
index af480d9..433d590 100644
--- a/drivers/hwtracing/coresight/Makefile
+++ b/drivers/hwtracing/coresight/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o \
coresight-etm4x-sysfs.o
 obj-$(CONFIG_CORESIGHT_QCOM_REPLICATOR) += coresight-replicator-qcom.o
 obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o
+obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c 
b/drivers/hwtracing/coresight/coresight-cpu-debug.c
new file mode 100644
index 000..ab12ec1
--- /dev/null
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -0,0 +1,693 @@
+/*
+ * Copyright (c) 2017 Linaro Limited. All rights reserved.
+ *
+ * Author: Leo Yan 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 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.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see .
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 

[PATCH v9 6/9] coresight: refactor with function of_coresight_get_cpu

2017-05-08 Thread Leo Yan
This is refactor to add function of_coresight_get_cpu(), so it's used to
retrieve CPU id for coresight component. Finally can use it as a common
function for multiple places.

Suggested-by: Mathieu Poirier 
Reviewed-by: Suzuki K Poulose 
Signed-off-by: Leo Yan 
---
 drivers/hwtracing/coresight/of_coresight.c | 43 +++---
 include/linux/coresight.h  |  3 +++
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/drivers/hwtracing/coresight/of_coresight.c 
b/drivers/hwtracing/coresight/of_coresight.c
index 225b2dd..a187941 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
@@ -101,16 +101,40 @@ static int of_coresight_alloc_memory(struct device *dev,
return 0;
 }
 
+int of_coresight_get_cpu(const struct device_node *node)
+{
+   int cpu;
+   bool found;
+   struct device_node *dn, *np;
+
+   dn = of_parse_phandle(node, "cpu", 0);
+
+   /* Affinity defaults to CPU0 */
+   if (!dn)
+   return 0;
+
+   for_each_possible_cpu(cpu) {
+   np = of_cpu_device_node_get(cpu);
+   found = (dn == np);
+   of_node_put(np);
+   if (found)
+   break;
+   }
+   of_node_put(dn);
+
+   /* Affinity to CPU0 if no cpu nodes are found */
+   return found ? cpu : 0;
+}
+EXPORT_SYMBOL_GPL(of_coresight_get_cpu);
+
 struct coresight_platform_data *
 of_get_coresight_platform_data(struct device *dev,
   const struct device_node *node)
 {
-   int i = 0, ret = 0, cpu;
+   int i = 0, ret = 0;
struct coresight_platform_data *pdata;
struct of_endpoint endpoint, rendpoint;
struct device *rdev;
-   bool found;
-   struct device_node *dn, *np;
struct device_node *ep = NULL;
struct device_node *rparent = NULL;
struct device_node *rport = NULL;
@@ -177,18 +201,7 @@ of_get_coresight_platform_data(struct device *dev,
} while (ep);
}
 
-   dn = of_parse_phandle(node, "cpu", 0);
-   for_each_possible_cpu(cpu) {
-   np = of_cpu_device_node_get(cpu);
-   found = (dn == np);
-   of_node_put(np);
-   if (found)
-   break;
-   }
-   of_node_put(dn);
-
-   /* Affinity to CPU0 if no cpu nodes are found */
-   pdata->cpu = found ? cpu : 0;
+   pdata->cpu = of_coresight_get_cpu(node);
 
return pdata;
 }
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index bf0aa50..d950dad 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -263,10 +263,13 @@ static inline int coresight_timeout(void __iomem *addr, 
u32 offset,
 #endif
 
 #ifdef CONFIG_OF
+extern int of_coresight_get_cpu(const struct device_node *node);
 extern struct coresight_platform_data *
 of_get_coresight_platform_data(struct device *dev,
   const struct device_node *node);
 #else
+static inline int of_coresight_get_cpu(const struct device_node *node)
+{ return 0; }
 static inline struct coresight_platform_data *of_get_coresight_platform_data(
struct device *dev, const struct device_node *node) { return NULL; }
 #endif
-- 
2.7.4



[PATCH v9 4/9] MAINTAINERS: update file entries for Coresight subsystem

2017-05-08 Thread Leo Yan
Update document file entries for Coresight debug module.

Signed-off-by: Leo Yan 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b948dfa..a4b1f60 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1191,7 +1191,9 @@ L:linux-arm-ker...@lists.infradead.org (moderated 
for non-subscribers)
 S: Maintained
 F: drivers/hwtracing/coresight/*
 F: Documentation/trace/coresight.txt
+F: Documentation/trace/coresight-cpu-debug.txt
 F: Documentation/devicetree/bindings/arm/coresight.txt
+F: Documentation/devicetree/bindings/arm/coresight-cpu-debug.txt
 F: Documentation/ABI/testing/sysfs-bus-coresight-devices-*
 F: tools/perf/arch/arm/util/pmu.c
 F: tools/perf/arch/arm/util/auxtrace.c
-- 
2.7.4



[PATCH v9 3/9] doc: Add coresight_cpu_debug.enable to kernel-parameters.txt

2017-05-08 Thread Leo Yan
Add coresight_cpu_debug.enable to kernel-parameters.txt, this flag is
used to enable/disable the CPU sampling based debugging.

Signed-off-by: Leo Yan 
---
 Documentation/admin-guide/kernel-parameters.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index e4c9e0e..010ae02 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -649,6 +649,13 @@
/proc//coredump_filter.
See also Documentation/filesystems/proc.txt.
 
+   coresight_cpu_debug.enable
+   [ARM,ARM64]
+   Format: 
+   Enable/disable the CPU sampling based debugging.
+   0: default value, disable debugging
+   1: enable debugging at boot time
+
cpuidle.off=1   [CPU_IDLE]
disable the cpuidle sub-system
 
-- 
2.7.4



  1   2   3   4   5   6   7   8   9   10   >