[PATCH v2 07/29] memory: of: Remove unused headers

2020-07-24 Thread Krzysztof Kozlowski
The of_memory.c does not use platform_device nor linked list.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/of_memory.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
index 71f26eac7350..cfcb91eeccfb 100644
--- a/drivers/memory/of_memory.c
+++ b/drivers/memory/of_memory.c
@@ -7,8 +7,6 @@
  */
 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-- 
2.17.1



[RFT v2 01/29] memory: omap-gpmc: Remove unneeded asm/mach-types.h inclusion

2020-07-24 Thread Krzysztof Kozlowski
The driver does not use macros from asm/mach-types.h (neither MACH_TYPE
nor machine_is_xxx()).  Removal of this include allows compile testing
on non-ARM architectures which lack this header.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/omap-gpmc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index eff26c1b1394..fc08b5292932 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -32,8 +32,6 @@
 
 #include 
 
-#include 
-
 #defineDEVICE_NAME "omap-gpmc"
 
 /* GPMC register offsets */
-- 
2.17.1



[RFT v2 02/29] memory: omap-gpmc: Remove unused file-scope phys_base and mem_size

2020-07-24 Thread Krzysztof Kozlowski
The file-scope variables phys_base and mem_size are assigned in
gpmc_probe() but never read.

This fixes build error when compile testing on x86_64 architecture:

drivers/memory/omap-gpmc.c:246:24: error: conflicting types for ‘phys_base’
 static resource_size_t phys_base, mem_size;
In file included from arch/x86/include/asm/page.h:12:0,
 from arch/x86/include/asm/thread_info.h:12,
 from include/linux/thread_info.h:38,
 from arch/x86/include/asm/preempt.h:7,
 from include/linux/preempt.h:78,
 from include/linux/spinlock.h:51,
 from include/linux/irq.h:14,
 from drivers/memory/omap-gpmc.c:12:
arch/x86/include/asm/page_64.h:12:22: note: previous declaration of 
‘phys_base’ was here
 extern unsigned long phys_base;

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/omap-gpmc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index fc08b5292932..8ec2ef2aebdd 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -242,7 +242,6 @@ static DEFINE_SPINLOCK(gpmc_mem_lock);
 /* Define chip-selects as reserved by default until probe completes */
 static unsigned int gpmc_cs_num = GPMC_CS_NUM;
 static unsigned int gpmc_nr_waitpins;
-static resource_size_t phys_base, mem_size;
 static unsigned gpmc_capability;
 static void __iomem *gpmc_base;
 
@@ -2357,9 +2356,6 @@ static int gpmc_probe(struct platform_device *pdev)
if (res == NULL)
return -ENOENT;
 
-   phys_base = res->start;
-   mem_size = resource_size(res);
-
gpmc_base = devm_ioremap_resource(>dev, res);
if (IS_ERR(gpmc_base))
return PTR_ERR(gpmc_base);
-- 
2.17.1



Re: [PATCH] uprobes: change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL

2020-07-24 Thread Srikar Dronamraju
* Oleg Nesterov  [2020-07-23 17:44:20]:

> If a tracee is uprobed and it hits int3 inserted by debugger, handle_swbp()
> does send_sig(SIGTRAP, current, 0) which means si_code == SI_USER. This used
> to work when this code was written, but then GDB started to validate si_code
> and now it simply can't use breakpoints if the tracee has an active uprobe:
> 
> 
> The tracee hits the internal breakpoint inserted by GDB to monitor shared
> library events but GDB misinterprets this SIGTRAP and reports a signal.
> 
> Change handle_swbp() to use force_sig(SIGTRAP), this matches do_int3_user()
> and fixes the problem.
> 
> This is the minimal fix for -stable, arch/x86/kernel/uprobes.c is equally
> wrong; it should use send_sigtrap(TRAP_TRACE) instead of send_sig(SIGTRAP),
> but this doesn't confuse GDB and needs another x86-specific patch.
> 
> Reported-by: Aaron Merey 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Oleg Nesterov 

Looks good to me.

Reviewed-by: Srikar Dronamraju 
> ---
>  kernel/events/uprobes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index bb0862873dba..5f8b0c52fd2e 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -2199,7 +2199,7 @@ static void handle_swbp(struct pt_regs *regs)
>   if (!uprobe) {
>   if (is_swbp > 0) {
>   /* No matching uprobe; signal SIGTRAP. */
> - send_sig(SIGTRAP, current, 0);
> + force_sig(SIGTRAP);
>   } else {
>   /*
>* Either we raced with uprobe_unregister() or we can't
> -- 
> 2.25.1.362.g51ebf55
> 
> 

-- 
Thanks and Regards
Srikar Dronamraju


[PATCH v2 04/29] memory: ti-aemif: Rename SS to SSTROBE to avoid name conflicts

2020-07-24 Thread Krzysztof Kozlowski
SS conflicts with compile test build on i386:

drivers/memory/ti-aemif.c:40:0: warning: "SS" redefined
In file included from arch/x86/include/uapi/asm/ptrace.h:6:0,
 from arch/x86/include/asm/ptrace.h:7,
 from arch/x86/include/asm/math_emu.h:5,
 from arch/x86/include/asm/processor.h:13,
 from include/linux/mutex.h:19,
 from include/linux/notifier.h:14,
 from include/linux/clk.h:14,
 from drivers/memory/ti-aemif.c:12:
arch/x86/include/uapi/asm/ptrace-abi.h:23:0: note: this is the location of 
the previous definition
 #define SS   16

Use more descriptive name (SSTROBE) to avoid the conflict.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/ti-aemif.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index db526dbf71ee..159a16f5e7d6 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -27,7 +27,7 @@
 #define WSTROBE_SHIFT  20
 #define WSETUP_SHIFT   26
 #define EW_SHIFT   30
-#define SS_SHIFT   31
+#define SSTROBE_SHIFT  31
 
 #define TA(x)  ((x) << TA_SHIFT)
 #define RHOLD(x)   ((x) << RHOLD_SHIFT)
@@ -37,7 +37,7 @@
 #define WSTROBE(x) ((x) << WSTROBE_SHIFT)
 #define WSETUP(x)  ((x) << WSETUP_SHIFT)
 #define EW(x)  ((x) << EW_SHIFT)
-#define SS(x)  ((x) << SS_SHIFT)
+#define SSTROBE(x) ((x) << SSTROBE_SHIFT)
 
 #define ASIZE_MAX  0x1
 #define TA_MAX 0x3
@@ -48,7 +48,7 @@
 #define WSTROBE_MAX0x3f
 #define WSETUP_MAX 0xf
 #define EW_MAX 0x1
-#define SS_MAX 0x1
+#define SSTROBE_MAX0x1
 #define NUM_CS 4
 
 #define TA_VAL(x)  (((x) & TA(TA_MAX)) >> TA_SHIFT)
@@ -59,7 +59,7 @@
 #define WSTROBE_VAL(x) (((x) & WSTROBE(WSTROBE_MAX)) >> WSTROBE_SHIFT)
 #define WSETUP_VAL(x)  (((x) & WSETUP(WSETUP_MAX)) >> WSETUP_SHIFT)
 #define EW_VAL(x)  (((x) & EW(EW_MAX)) >> EW_SHIFT)
-#define SS_VAL(x)  (((x) & SS(SS_MAX)) >> SS_SHIFT)
+#define SSTROBE_VAL(x) (((x) & SSTROBE(SSTROBE_MAX)) >> SSTROBE_SHIFT)
 
 #define NRCSR_OFFSET   0x00
 #define AWCCR_OFFSET   0x04
@@ -67,7 +67,7 @@
 
 #define ACR_ASIZE_MASK 0x3
 #define ACR_EW_MASKBIT(30)
-#define ACR_SS_MASKBIT(31)
+#define ACR_SSTROBE_MASK   BIT(31)
 #define ASIZE_16BIT1
 
 #define CONFIG_MASK(TA(TA_MAX) | \
@@ -77,7 +77,7 @@
WHOLD(WHOLD_MAX) | \
WSTROBE(WSTROBE_MAX) | \
WSETUP(WSETUP_MAX) | \
-   EW(EW_MAX) | SS(SS_MAX) | \
+   EW(EW_MAX) | SSTROBE(SSTROBE_MAX) | \
ASIZE_MAX)
 
 /**
@@ -204,7 +204,7 @@ static int aemif_config_abus(struct platform_device *pdev, 
int csnum)
if (data->enable_ew)
set |= ACR_EW_MASK;
if (data->enable_ss)
-   set |= ACR_SS_MASK;
+   set |= ACR_SSTROBE_MASK;
 
val = readl(aemif->base + offset);
val &= ~CONFIG_MASK;
@@ -246,7 +246,7 @@ static void aemif_get_hw_params(struct platform_device 
*pdev, int csnum)
data->wstrobe = aemif_cycles_to_nsec(WSTROBE_VAL(val), clk_rate);
data->wsetup = aemif_cycles_to_nsec(WSETUP_VAL(val), clk_rate);
data->enable_ew = EW_VAL(val);
-   data->enable_ss = SS_VAL(val);
+   data->enable_ss = SSTROBE_VAL(val);
data->asize = val & ASIZE_MAX;
 }
 
-- 
2.17.1



[PATCH v2 03/29] memory: omap-gpmc: Include for SZ_16M

2020-07-24 Thread Krzysztof Kozlowski
The driver uses SZ_16M which is defined in include/linux/sizes.h.  On
ARM it was pulled by other headers but its inclusion is necessary for
compile testing on other architectures.

This fixes build error when compile testing on i386 architecture:

drivers/memory/omap-gpmc.c: In function ‘gpmc_cs_remap’:
drivers/memory/omap-gpmc.c:961:12: error: ‘SZ_16M’ undeclared (first use in 
this function)

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/omap-gpmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 8ec2ef2aebdd..c158b6cae9a9 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
-- 
2.17.1



[PATCH v2 09/29] memory: of: Correct indentation

2020-07-24 Thread Krzysztof Kozlowski
Correct indentation to match open parenthesis.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/of_memory.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
index 8a5b654eca6b..67b811cb2cb9 100644
--- a/drivers/memory/of_memory.c
+++ b/drivers/memory/of_memory.c
@@ -26,7 +26,7 @@
  * default min timings provided by JEDEC.
  */
 const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
-   struct device *dev)
+   struct device *dev)
 {
int ret = 0;
struct lpddr2_min_tck   *min;
@@ -61,7 +61,7 @@ const struct lpddr2_min_tck *of_get_min_tck(struct 
device_node *np,
 EXPORT_SYMBOL(of_get_min_tck);
 
 static int of_do_get_timings(struct device_node *np,
-   struct lpddr2_timings *tim)
+struct lpddr2_timings *tim)
 {
int ret;
 
@@ -83,7 +83,7 @@ static int of_do_get_timings(struct device_node *np,
ret |= of_property_read_u32(np, "tZQinit", >tZQinit);
ret |= of_property_read_u32(np, "tRAS-max-ns", >tRAS_max_ns);
ret |= of_property_read_u32(np, "tDQSCK-max-derated",
-   >tDQSCK_max_derated);
+   >tDQSCK_max_derated);
 
return ret;
 }
@@ -102,7 +102,9 @@ static int of_do_get_timings(struct device_node *np,
  * while populating, returns default timings provided by JEDEC.
  */
 const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
-   struct device *dev, u32 device_type, u32 *nr_frequencies)
+   struct device *dev,
+   u32 device_type,
+   u32 *nr_frequencies)
 {
struct lpddr2_timings   *timings = NULL;
u32 arr_sz = 0, i = 0;
-- 
2.17.1



[PATCH v2 13/29] memory: emif: Fix whitespace coding style violations

2020-07-24 Thread Krzysztof Kozlowski
Make the code and printed messages slightly more readable.  Fixes
checkpatch warnings:

WARNING: quoted string split across lines
ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/emif.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 97bad1588bba..1241a87081f8 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -284,8 +284,7 @@ static void set_lpmode(struct emif_data *emif, u8 lpmode)
if ((emif->plat_data->ip_rev == EMIF_4D) &&
(lpmode == EMIF_LP_MODE_PWR_DN)) {
WARN_ONCE(1,
- "REG_LP_MODE = LP_MODE_PWR_DN(4) is prohibited by"
- "erratum i743 switch to LP_MODE_SELF_REFRESH(2)\n");
+ "REG_LP_MODE = LP_MODE_PWR_DN(4) is prohibited by 
erratum i743 switch to LP_MODE_SELF_REFRESH(2)\n");
/* rollback LP_MODE to Self-refresh mode */
lpmode = EMIF_LP_MODE_SELF_REFRESH;
}
@@ -714,7 +713,7 @@ static u32 get_ext_phy_ctrl_2_intelliphy_4d5(void)
u32 fifo_we_slave_ratio;
 
fifo_we_slave_ratio =  DIV_ROUND_CLOSEST(
-   EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256 , t_ck);
+   EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256, t_ck);
 
return fifo_we_slave_ratio | fifo_we_slave_ratio << 11 |
fifo_we_slave_ratio << 22;
@@ -725,7 +724,7 @@ static u32 get_ext_phy_ctrl_3_intelliphy_4d5(void)
u32 fifo_we_slave_ratio;
 
fifo_we_slave_ratio =  DIV_ROUND_CLOSEST(
-   EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256 , t_ck);
+   EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256, t_ck);
 
return fifo_we_slave_ratio >> 10 | fifo_we_slave_ratio << 1 |
fifo_we_slave_ratio << 12 | fifo_we_slave_ratio << 23;
@@ -736,7 +735,7 @@ static u32 get_ext_phy_ctrl_4_intelliphy_4d5(void)
u32 fifo_we_slave_ratio;
 
fifo_we_slave_ratio =  DIV_ROUND_CLOSEST(
-   EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256 , t_ck);
+   EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256, t_ck);
 
return fifo_we_slave_ratio >> 9 | fifo_we_slave_ratio << 2 |
fifo_we_slave_ratio << 13;
@@ -975,8 +974,7 @@ static irqreturn_t handle_temp_alert(void __iomem *base, 
struct emif_data *emif)
EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART)) {
if (emif->temperature_level >= SDRAM_TEMP_HIGH_DERATE_REFRESH) {
dev_err(emif->dev,
-   "%s:NOT Extended temperature capable memory."
-   "Converting MR4=0x%02x as shutdown event\n",
+   "%s:NOT Extended temperature capable memory. 
Converting MR4=0x%02x as shutdown event\n",
__func__, emif->temperature_level);
/*
 * Temperature far too high - do kernel_power_off()
@@ -1318,9 +1316,9 @@ static void __init_or_module of_get_ddr_info(struct 
device_node *np_emif,
if (of_find_property(np_emif, "cal-resistor-per-cs", ))
dev_info->cal_resistors_per_cs = true;
 
-   if (of_device_is_compatible(np_ddr , "jedec,lpddr2-s4"))
+   if (of_device_is_compatible(np_ddr, "jedec,lpddr2-s4"))
dev_info->type = DDR_TYPE_LPDDR2_S4;
-   else if (of_device_is_compatible(np_ddr , "jedec,lpddr2-s2"))
+   else if (of_device_is_compatible(np_ddr, "jedec,lpddr2-s2"))
dev_info->type = DDR_TYPE_LPDDR2_S2;
 
of_property_read_u32(np_ddr, "density", );
-- 
2.17.1



[PATCH v2 12/29] memory: emif: Put constant in comparison on the right side

2020-07-24 Thread Krzysztof Kozlowski
Fixes checkpatch warning:

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/emif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 58a82eea5850..97bad1588bba 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -282,7 +282,7 @@ static void set_lpmode(struct emif_data *emif, u8 lpmode)
 * the EMIF_PWR_MGMT_CTRL[10:8] REG_LP_MODE bit field to 0x4.
 */
if ((emif->plat_data->ip_rev == EMIF_4D) &&
-   (EMIF_LP_MODE_PWR_DN == lpmode)) {
+   (lpmode == EMIF_LP_MODE_PWR_DN)) {
WARN_ONCE(1,
  "REG_LP_MODE = LP_MODE_PWR_DN(4) is prohibited by"
  "erratum i743 switch to LP_MODE_SELF_REFRESH(2)\n");
-- 
2.17.1



[PATCH v2 05/29] memory: jz4780-nemc: Do not enable by default on every compile test

2020-07-24 Thread Krzysztof Kozlowski
When compile testing, enable the driver by default only on MIPS
architecture.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. New patch
---
 drivers/memory/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index efcb4dfaccc2..5a225ca66c4e 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -141,7 +141,7 @@ config FSL_IFC
 
 config JZ4780_NEMC
bool "Ingenic JZ4780 SoC NEMC driver"
-   default y
+   default y if MIPS
depends on MIPS || COMPILE_TEST
depends on HAS_IOMEM && OF
help
-- 
2.17.1



[PATCH v2 10/29] memory: of: Remove unneeded extern from function declarations

2020-07-24 Thread Krzysztof Kozlowski
Function declarations in headers do not need to come with extern
keyword.  Remove them to make the declaration slightly shorter.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/of_memory.h | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/memory/of_memory.h b/drivers/memory/of_memory.h
index e39ecc4c733d..4a99b232ab0a 100644
--- a/drivers/memory/of_memory.h
+++ b/drivers/memory/of_memory.h
@@ -3,22 +3,23 @@
  * OpenFirmware helpers for memory drivers
  *
  * Copyright (C) 2012 Texas Instruments, Inc.
+ * Copyright (C) 2020 Krzysztof Kozlowski 
  */
 
 #ifndef __LINUX_MEMORY_OF_REG_H
 #define __LINUX_MEMORY_OF_REG_H
 
 #if defined(CONFIG_OF) && defined(CONFIG_DDR)
-extern const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
-   struct device *dev);
-extern const struct lpddr2_timings
-   *of_get_ddr_timings(struct device_node *np_ddr, struct device *dev,
-   u32 device_type, u32 *nr_frequencies);
-extern const struct lpddr3_min_tck
-   *of_lpddr3_get_min_tck(struct device_node *np, struct device *dev);
-extern const struct lpddr3_timings
-   *of_lpddr3_get_ddr_timings(struct device_node *np_ddr,
-   struct device *dev, u32 device_type, u32 *nr_frequencies);
+const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
+   struct device *dev);
+const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
+   struct device *dev,
+   u32 device_type, u32 
*nr_frequencies);
+const struct lpddr3_min_tck *of_lpddr3_get_min_tck(struct device_node *np,
+  struct device *dev);
+const struct lpddr3_timings *
+of_lpddr3_get_ddr_timings(struct device_node *np_ddr,
+ struct device *dev, u32 device_type, u32 
*nr_frequencies);
 #else
 static inline const struct lpddr2_min_tck
*of_get_min_tck(struct device_node *np, struct device *dev)
-- 
2.17.1



[PATCH v2 11/29] memory: emif-asm-offsets: Add GPLv2 SPDX license header

2020-07-24 Thread Krzysztof Kozlowski
Add GPLv2 license header and remove GPL boiler plate text.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. Use "GPL-2.0" instead of "GPL-2.0-only". It's shorter.
---
 drivers/memory/emif-asm-offsets.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/memory/emif-asm-offsets.c 
b/drivers/memory/emif-asm-offsets.c
index db8043019ec6..4b98d1854cd7 100644
--- a/drivers/memory/emif-asm-offsets.c
+++ b/drivers/memory/emif-asm-offsets.c
@@ -1,16 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * TI AM33XX EMIF PM Assembly Offsets
  *
  * Copyright (C) 2016-2017 Texas Instruments Inc.
- *
- * 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 version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 #include 
 
-- 
2.17.1



[PATCH v2 06/29] memory: Enable compile testing for most of the drivers

2020-07-24 Thread Krzysztof Kozlowski
Most of the memory controller drivers do not depend on architecture
specific code so can be compile tested to increase build coverage.

When compile tested, do not enable them by default.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. When compile tested, do not enable them by default.
---
 drivers/memory/Kconfig | 39 ++-
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 5a225ca66c4e..c37752d5f26d 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -26,8 +26,9 @@ config ARM_PL172_MPMC
 
 config ATMEL_SDRAMC
bool "Atmel (Multi-port DDR-)SDRAM Controller"
-   default y
-   depends on ARCH_AT91 && OF
+   default y if ARCH_AT91
+   depends on ARCH_AT91 || COMPILE_TEST
+   depends on OF
help
  This driver is for Atmel SDRAM Controller or Atmel Multi-port
  DDR-SDRAM Controller available on Atmel AT91SAM9 and SAMA5 SoCs.
@@ -36,8 +37,9 @@ config ATMEL_SDRAMC
 
 config ATMEL_EBI
bool "Atmel EBI driver"
-   default y
-   depends on ARCH_AT91 && OF
+   default y if ARCH_AT91
+   depends on ARCH_AT91 || COMPILE_TEST
+   depends on OF
select MFD_SYSCON
select MFD_ATMEL_SMC
help
@@ -59,7 +61,8 @@ config BT1_L2_CTL
 
 config TI_AEMIF
tristate "Texas Instruments AEMIF driver"
-   depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
+   depends on ARCH_DAVINCI || ARCH_KEYSTONE || COMPILE_TEST
+   depends on OF
help
  This driver is for the AEMIF module available in Texas Instruments
  SoCs. AEMIF stands for Asynchronous External Memory Interface and
@@ -70,7 +73,7 @@ config TI_AEMIF
 
 config TI_EMIF
tristate "Texas Instruments EMIF driver"
-   depends on ARCH_OMAP2PLUS
+   depends on ARCH_OMAP2PLUS || COMPILE_TEST
select DDR
help
  This driver is for the EMIF module available in Texas Instruments
@@ -82,7 +85,7 @@ config TI_EMIF
  temperature changes
 
 config OMAP_GPMC
-   bool
+   bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST
select GPIOLIB
help
  This driver is for the General Purpose Memory Controller (GPMC)
@@ -106,7 +109,8 @@ config OMAP_GPMC_DEBUG
 
 config TI_EMIF_SRAM
tristate "Texas Instruments EMIF SRAM driver"
-   depends on (SOC_AM33XX || SOC_AM43XX) && SRAM
+   depends on SOC_AM33XX || SOC_AM43XX || (ARM && COMPILE_TEST)
+   depends on SRAM
help
  This driver is for the EMIF module available on Texas Instruments
  AM33XX and AM43XX SoCs and is required for PM. Certain parts of
@@ -116,8 +120,9 @@ config TI_EMIF_SRAM
 
 config MVEBU_DEVBUS
bool "Marvell EBU Device Bus Controller"
-   default y
-   depends on PLAT_ORION && OF
+   default y if PLAT_ORION
+   depends on PLAT_ORION || COMPILE_TEST
+   depends on OF
help
  This driver is for the Device Bus controller available in some
  Marvell EBU SoCs such as Discovery (mv78xx0), Orion (88f5xxx) and
@@ -126,7 +131,7 @@ config MVEBU_DEVBUS
 
 config FSL_CORENET_CF
tristate "Freescale CoreNet Error Reporting"
-   depends on FSL_SOC_BOOKE
+   depends on FSL_SOC_BOOKE || COMPILE_TEST
help
  Say Y for reporting of errors from the Freescale CoreNet
  Coherency Fabric.  Errors reported include accesses to
@@ -135,7 +140,7 @@ config FSL_CORENET_CF
  represents a coherency violation.
 
 config FSL_IFC
-   bool
+   bool "Freescale IFC driver" if COMPILE_TEST
depends on FSL_SOC || ARCH_LAYERSCAPE || SOC_LS1021A || COMPILE_TEST
depends on HAS_IOMEM
 
@@ -150,7 +155,7 @@ config JZ4780_NEMC
  memory devices such as NAND and SRAM.
 
 config MTK_SMI
-   bool
+   bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
depends on ARCH_MEDIATEK || COMPILE_TEST
help
  This driver is for the Memory Controller module in MediaTek SoCs,
@@ -159,7 +164,7 @@ config MTK_SMI
 
 config DA8XX_DDRCTL
bool "Texas Instruments da8xx DDR2/mDDR driver"
-   depends on ARCH_DAVINCI_DA8XX
+   depends on ARCH_DAVINCI_DA8XX || COMPILE_TEST
help
  This driver is for the DDR2/mDDR Memory Controller present on
  Texas Instruments da8xx SoCs. It's used to tweak various memory
@@ -167,16 +172,16 @@ config DA8XX_DDRCTL
 
 config PL353_SMC
tristate "ARM PL35X Static Memory Controller(SMC) driver"
-   default y
+   default y if ARM
depends on ARM
-   depends on ARM_AMBA
+   depends on ARM_AMBA || COMPILE_TEST
help
  This driver is for the ARM PL351/PL353 Static Memory
  Controller(SMC) module.
 
 config RENESAS_RPCIF
tristate "Renesas RPC-IF driver"
-   depends on ARCH_RENESAS
+   depends on ARCH_RENESAS || 

[PATCH v2 19/29] memory: mtk-smi: Add argument to function pointer definition

2020-07-24 Thread Krzysztof Kozlowski
Fix checkpatch warning:
WARNING: function definition argument 'struct device *' should also have an 
identifier name

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/mtk-smi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index 109c7e51d551..c21262502581 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -60,7 +60,7 @@ struct mtk_smi_common_plat {
 
 struct mtk_smi_larb_gen {
int port_in_larb[MTK_LARB_NR_MAX + 1];
-   void (*config_port)(struct device *);
+   void (*config_port)(struct device *dev);
unsigned intlarb_direct_to_common_mask;
boolhas_gals;
 };
-- 
2.17.1



[PATCH v2 24/29] memory: tegra: tegra210-emc: Fix indentation

2020-07-24 Thread Krzysztof Kozlowski
Use tabs instead of spaces for indentation.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/tegra/tegra210-emc-cc-r21021.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/tegra/tegra210-emc-cc-r21021.c 
b/drivers/memory/tegra/tegra210-emc-cc-r21021.c
index ff55a17896fa..d60bdea3af3f 100644
--- a/drivers/memory/tegra/tegra210-emc-cc-r21021.c
+++ b/drivers/memory/tegra/tegra210-emc-cc-r21021.c
@@ -1044,7 +1044,7 @@ static void tegra210_emc_r21021_set_clock(struct 
tegra210_emc *emc, u32 clksrc)
   !opt_cc_short_zcal && opt_short_zcal) {
value = (value & ~(EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK 
<<
   
EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_SHIFT)) |
-   ((zq_wait_long & 
EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK) <<
+   ((zq_wait_long & 
EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK) <<
 
EMC_MRS_WAIT_CNT_SHORT_WAIT_SHIFT);
} else if (offset == EMC_ZCAL_INTERVAL && opt_zcal_en_cc) {
value = 0; /* EMC_ZCAL_INTERVAL reset value. */
-- 
2.17.1



[RFT v2 20/29] memory: omap-gpmc: Return meaningful error codes in gpmc_cs_set_timings()

2020-07-24 Thread Krzysztof Kozlowski
The callers of gpmc_cs_set_timings() expect to receive -ERRNO on errors
and they pass further what they have received.

However gpmc_cs_set_timings() was returning -1 (equal to -EPERM) which
does not make sense in this context.

Signed-off-by: Krzysztof Kozlowski 

---

Not tested

Changes since v1:
1. New patch
---
 drivers/memory/omap-gpmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index c158b6cae9a9..1e370142dfca 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -638,7 +638,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, 
int end_bit, int max
 #define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd)  \
if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \
t->field, (cd), #field) < 0)   \
-   return -1
+   return -ENXIO
 
 #define GPMC_SET_ONE(reg, st, end, field) \
GPMC_SET_ONE_CD_MAX(reg, st, end, 0, field, GPMC_CD_FCLK)
@@ -708,7 +708,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings 
*t,
 
div = gpmc_calc_divider(t->sync_clk);
if (div < 0)
-   return div;
+   return -EINVAL;
 
/*
 * See if we need to change the divider for waitmonitoringtime.
@@ -733,7 +733,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings 
*t,
   __func__,
   t->wait_monitoring
   );
-   return -1;
+   return -ENXIO;
}
}
 
-- 
2.17.1



[RFT v2 21/29] memory: omap-gpmc: Remove GPMC_SET_ONE_CD_MAX macro for safety

2020-07-24 Thread Krzysztof Kozlowski
The GPMC_SET_ONE_CD_MAX macro uses return statement and variable 'cs'
coming from called scope.  This is not a good practice.  Also
checkpatch complained:

WARNING: Macros with flow control statements should be avoided
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects

Since GPMC_SET_ONE_CD_MAX macro just calls one function, it can be open
coded.  The difference with original code is that function will exit on
error not after every register set, but after a group of sets.

Signed-off-by: Krzysztof Kozlowski 

---

Not tested

Changes since v1:
1. Drop the macro, after comments from Arnd.
---
 drivers/memory/omap-gpmc.c | 137 +
 1 file changed, 93 insertions(+), 44 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 1e370142dfca..2a2d0297e071 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -635,14 +635,6 @@ static int set_gpmc_timing_reg(int cs, int reg, int 
st_bit, int end_bit, int max
return 0;
 }
 
-#define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd)  \
-   if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \
-   t->field, (cd), #field) < 0)   \
-   return -ENXIO
-
-#define GPMC_SET_ONE(reg, st, end, field) \
-   GPMC_SET_ONE_CD_MAX(reg, st, end, 0, field, GPMC_CD_FCLK)
-
 /**
  * gpmc_calc_waitmonitoring_divider - calculate proper GPMCFCLKDIVIDER based 
on WAITMONITORINGTIME
  * WAITMONITORINGTIME will be _at least_ as long as desired, i.e.
@@ -703,7 +695,7 @@ int gpmc_calc_divider(unsigned int sync_clk)
 int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
const struct gpmc_settings *s)
 {
-   int div;
+   int div, ret;
u32 l;
 
div = gpmc_calc_divider(t->sync_clk);
@@ -737,53 +729,110 @@ int gpmc_cs_set_timings(int cs, const struct 
gpmc_timings *t,
}
}
 
-   GPMC_SET_ONE(GPMC_CS_CONFIG2,  0,  3, cs_on);
-   GPMC_SET_ONE(GPMC_CS_CONFIG2,  8, 12, cs_rd_off);
-   GPMC_SET_ONE(GPMC_CS_CONFIG2, 16, 20, cs_wr_off);
+   ret = 0;
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 0, 3, 0, t->cs_on,
+  GPMC_CD_FCLK, "cs_on");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 8, 12, 0, t->cs_rd_off,
+  GPMC_CD_FCLK, "cs_rd_off");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 16, 20, 0, t->cs_wr_off,
+  GPMC_CD_FCLK, "cs_wr_off");
+   if (ret)
+   return -ENXIO;
+
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 0, 3, 0, t->adv_on,
+  GPMC_CD_FCLK, "adv_on");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 8, 12, 0, t->adv_rd_off,
+  GPMC_CD_FCLK, "adv_rd_off");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 16, 20, 0, 
t->adv_wr_off,
+  GPMC_CD_FCLK, "adv_wr_off");
+   if (ret)
+   return -ENXIO;
 
-   GPMC_SET_ONE(GPMC_CS_CONFIG3,  0,  3, adv_on);
-   GPMC_SET_ONE(GPMC_CS_CONFIG3,  8, 12, adv_rd_off);
-   GPMC_SET_ONE(GPMC_CS_CONFIG3, 16, 20, adv_wr_off);
if (gpmc_capability & GPMC_HAS_MUX_AAD) {
-   GPMC_SET_ONE(GPMC_CS_CONFIG3,  4,  6, adv_aad_mux_on);
-   GPMC_SET_ONE(GPMC_CS_CONFIG3, 24, 26, adv_aad_mux_rd_off);
-   GPMC_SET_ONE(GPMC_CS_CONFIG3, 28, 30, adv_aad_mux_wr_off);
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 4, 6, 0,
+  t->adv_aad_mux_on, GPMC_CD_FCLK,
+  "adv_aad_mux_on");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 24, 26, 0,
+  t->adv_aad_mux_rd_off, GPMC_CD_FCLK,
+  "adv_aad_mux_rd_off");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 28, 30, 0,
+  t->adv_aad_mux_wr_off, GPMC_CD_FCLK,
+  "adv_aad_mux_wr_off");
+   if (ret)
+   return -ENXIO;
}
 
-   GPMC_SET_ONE(GPMC_CS_CONFIG4,  0,  3, oe_on);
-   GPMC_SET_ONE(GPMC_CS_CONFIG4,  8, 12, oe_off);
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 0, 3, 0, t->oe_on,
+  GPMC_CD_FCLK, "oe_on");
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 8, 12, 0, t->oe_off,
+  GPMC_CD_FCLK, "oe_off");
if (gpmc_capability & GPMC_HAS_MUX_AAD) {
-   GPMC_SET_ONE(GPMC_CS_CONFIG4,  4,  6, oe_aad_mux_on);
-   GPMC_SET_ONE(GPMC_CS_CONFIG4, 13, 15, oe_aad_mux_off);
+   ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 4, 6, 0,
+  

[PATCH v2 18/29] memory: brcmstb_dpfe: Remove unneeded braces

2020-07-24 Thread Krzysztof Kozlowski
Single statement blocks don't need braces.  Fixes checkpatch warning:

WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Krzysztof Kozlowski 
Acked-by: Florian Fainelli 
Acked-by: Markus Mayer 
---
 drivers/memory/brcmstb_dpfe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c
index 5942380f343b..604f0e3fb112 100644
--- a/drivers/memory/brcmstb_dpfe.c
+++ b/drivers/memory/brcmstb_dpfe.c
@@ -379,9 +379,8 @@ static void __iomem *get_msg_ptr(struct brcmstb_dpfe_priv 
*priv, u32 response,
void __iomem *ptr = NULL;
 
/* There is no need to use this function for API v3 or later. */
-   if (unlikely(priv->dpfe_api->version >= 3)) {
+   if (unlikely(priv->dpfe_api->version >= 3))
return NULL;
-   }
 
msg_type = (response >> DRAM_MSG_TYPE_OFFSET) & DRAM_MSG_TYPE_MASK;
offset = (response >> DRAM_MSG_ADDR_OFFSET) & DRAM_MSG_ADDR_MASK;
-- 
2.17.1



[PATCH v2 16/29] memory: renesas-rpc-if: Simplify with PTR_ERR_OR_ZERO

2020-07-24 Thread Krzysztof Kozlowski
Use PTR_ERR_OR_ZERO to make the code a little bit simpler.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/renesas-rpc-if.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 88f51ec8f1d1..f2a33a1af836 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -199,10 +199,8 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
rpc->dirmap = NULL;
 
rpc->rstc = devm_reset_control_get_exclusive(>dev, NULL);
-   if (IS_ERR(rpc->rstc))
-   return PTR_ERR(rpc->rstc);
 
-   return 0;
+   return PTR_ERR_OR_ZERO(rpc->rstc);
 }
 EXPORT_SYMBOL(rpcif_sw_init);
 
-- 
2.17.1



[PATCH v2 22/29] memory: omap-gpmc: Fix whitespace issue

2020-07-24 Thread Krzysztof Kozlowski
Fix minor whitespace and comment issues.  No functional changes.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. Adjust entire comment, as suggested by Arnd.
---
 drivers/memory/omap-gpmc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 2a2d0297e071..2675ea4e37fe 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -1005,7 +1005,7 @@ static int gpmc_cs_remap(int cs, u32 base)
 * Make sure we ignore any device offsets from the GPMC partition
 * allocated for the chip select and that the new base confirms
 * to the GPMC 16MB minimum granularity.
-*/ 
+*/
base &= ~(SZ_16M - 1);
 
gpmc_cs_get_memconf(cs, _base, );
@@ -1800,10 +1800,11 @@ static int gpmc_calc_common_timings(struct gpmc_timings 
*gpmc_t,
return 0;
 }
 
-/* TODO: remove this function once all peripherals are confirmed to
+/*
+ * TODO: remove this function once all peripherals are confirmed to
  * work with generic timing. Simultaneously gpmc_cs_set_timings()
  * has to be modified to handle timings in ps instead of ns
-*/
+ */
 static void gpmc_convert_ps_to_ns(struct gpmc_timings *t)
 {
t->cs_on /= 1000;
-- 
2.17.1



[PATCH v2 17/29] memory: brcmstb_dpfe: Constify the contents of string

2020-07-24 Thread Krzysztof Kozlowski
The string itself can be made const for safety.

Signed-off-by: Krzysztof Kozlowski 
Acked-by: Florian Fainelli 
Acked-by: Markus Mayer 
---
 drivers/memory/brcmstb_dpfe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c
index 82b415be18d1..5942380f343b 100644
--- a/drivers/memory/brcmstb_dpfe.c
+++ b/drivers/memory/brcmstb_dpfe.c
@@ -188,7 +188,7 @@ struct brcmstb_dpfe_priv {
struct mutex lock;
 };
 
-static const char *error_text[] = {
+static const char * const error_text[] = {
"Success", "Header code incorrect", "Unknown command or argument",
"Incorrect checksum", "Malformed command", "Timed out",
 };
-- 
2.17.1



[PATCH v2 23/29] memory: pl172: Add GPLv2 SPDX license header

2020-07-24 Thread Krzysztof Kozlowski
Add GPLv2 license header and remove GPL boiler plate text.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/pl172.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c
index ff57195b4e37..084891eb29cc 100644
--- a/drivers/memory/pl172.c
+++ b/drivers/memory/pl172.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Memory controller driver for ARM PrimeCell PL172
  * PrimeCell MultiPort Memory Controller (PL172)
@@ -6,10 +7,6 @@
  *
  * Based on:
  * TI AEMIF driver, Copyright (C) 2010 - 2013 Texas Instruments Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
  */
 
 #include 
-- 
2.17.1



[PATCH v2 14/29] memory: emif: Silence platform_get_irq() error in driver

2020-07-24 Thread Krzysztof Kozlowski
The platform_get_irq() already prints error message so there is no need
to do it again in the driver.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/emif.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 1241a87081f8..1bf0656d5e9a 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -1561,11 +1561,8 @@ static int __init_or_module emif_probe(struct 
platform_device *pdev)
goto error;
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(emif->dev, "%s: error getting IRQ resource - %d\n",
-   __func__, irq);
+   if (irq < 0)
goto error;
-   }
 
emif_onetime_settings(emif);
emif_debugfs_init(emif);
-- 
2.17.1



[PATCH v2 15/29] memory: ti-emif-pm: Fix cast to iomem pointer

2020-07-24 Thread Krzysztof Kozlowski
Cast pointer to iomem memory properly to fix sparse warning:

drivers/memory/ti-emif-pm.c:251:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/memory/ti-emif-pm.c:251:38:expected void const volatile 
[noderef] __iomem *addr
drivers/memory/ti-emif-pm.c:251:38:got void *

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/memory/ti-emif-pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
index 9c90f815ad3a..6c747c1e98cb 100644
--- a/drivers/memory/ti-emif-pm.c
+++ b/drivers/memory/ti-emif-pm.c
@@ -248,7 +248,7 @@ MODULE_DEVICE_TABLE(of, ti_emif_of_match);
 static int ti_emif_resume(struct device *dev)
 {
unsigned long tmp =
-   __raw_readl((void *)emif_instance->ti_emif_sram_virt);
+   __raw_readl((void __iomem 
*)emif_instance->ti_emif_sram_virt);
 
/*
 * Check to see if what we are copying is already present in the
-- 
2.17.1



[PATCH 04/10] remoteproc: imx_rproc: make syscon optional

2020-07-24 Thread Peng Fan
Make syscon optional, since i.MX8QM/QXP/7ULP not have SRC to control M4.
But currently i.MX8QM/QXP/7ULP not added, so still check regmap
when start/stop to avoid unhappy things.

Reviewed-by: Richard Zhu 
Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 82594a800a1b..4fad5c0b1c05 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -162,6 +162,9 @@ static int imx_rproc_start(struct rproc *rproc)
struct device *dev = priv->dev;
int ret;
 
+   if (!priv->regmap)
+   return -EOPNOTSUPP;
+
ret = regmap_update_bits(priv->regmap, dcfg->src_reg,
 dcfg->src_mask, dcfg->src_start);
if (ret)
@@ -177,6 +180,9 @@ static int imx_rproc_stop(struct rproc *rproc)
struct device *dev = priv->dev;
int ret;
 
+   if (!priv->regmap)
+   return -EOPNOTSUPP;
+
ret = regmap_update_bits(priv->regmap, dcfg->src_reg,
 dcfg->src_mask, dcfg->src_stop);
if (ret)
@@ -325,9 +331,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
regmap = syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(regmap)) {
dev_err(dev, "failed to find syscon\n");
-   return PTR_ERR(regmap);
+   regmap = NULL;
+   } else {
+   regmap_attach_dev(dev, regmap, );
}
-   regmap_attach_dev(dev, regmap, );
 
/* set some other name then imx */
rproc = rproc_alloc(dev, "imx-rproc", _rproc_ops,
-- 
2.16.4



[PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early boot

2020-07-24 Thread Peng Fan
This patchset is to support i.MX8MQ/M coproc booted before linux.
Since i.MX8MQ/M was not supported, several patches are needed
to first support the platform, then support early boot case.

I intended to included i.MX8QM/QXP, but that would introduce a large
patchset, so not included. But the clk/syscon optional patch for
i.MX8QM/QXP was still kept here to avoid rebase error.

Peng Fan (10):
  dt-bindings: remoteproc: imx_rproc: add i.MX8MQ/M
  remoteproc: imx_rproc: correct err message
  remoteproc: imx: use devm_ioremap
  remoteproc: imx_rproc: make syscon optional
  remoteproc: imx_rproc: make clk optional
  remoteproc: imx_rproc: add load hook
  remoteproc: imx_rproc: add i.MX specific parse fw hook
  remoteproc: imx_rproc: support i.MX8MQ/M
  remoteproc: imx_proc: enable virtio/mailbox
  remoteproc: imx_rproc: support coproc booting before Linux

 .../devicetree/bindings/remoteproc/imx-rproc.txt   |   3 +
 drivers/remoteproc/imx_rproc.c | 409 -
 2 files changed, 401 insertions(+), 11 deletions(-)

-- 
2.16.4



[PATCH 05/10] remoteproc: imx_rproc: make clk optional

2020-07-24 Thread Peng Fan
To i.MX7ULP Dual Boot, M4 is the master to control everything,
so it not need clk from A7.

Reviewed-by: Richard Zhu 
Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 4fad5c0b1c05..aee790efbf7b 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -362,7 +362,7 @@ static int imx_rproc_probe(struct platform_device *pdev)
goto err_put_rproc;
}
 
-   priv->clk = devm_clk_get(dev, NULL);
+   priv->clk = devm_clk_get_optional(dev, NULL);
if (IS_ERR(priv->clk)) {
dev_err(dev, "Failed to get clock\n");
ret = PTR_ERR(priv->clk);
-- 
2.16.4



[PATCH 06/10] remoteproc: imx_rproc: add load hook

2020-07-24 Thread Peng Fan
To i.MX8, we not able to see the correct data written into TCM when
using ioremap_wc, so use ioremap.

However common elf loader using memset.

To arm64, "dc  zva, dst" is used in memset.
Per ARM DDI 0487A.j, chapter C5.3.8 DC ZVA, Data Cache Zero by VA,

"If the memory region being zeroed is any type of Device memory,
this instruction can give an alignment fault which is prioritized
in the same way as other alignment faults that are determined
by the memory type."

On i.MX platforms, when elf is loaded to onchip TCM area, the region
is ioremapped, so "dc zva, dst" will trigger abort.

So add i.MX specific loader to address the TCM write issue.

The change not impact i.MX6/7 function.

Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 76 ++
 1 file changed, 76 insertions(+)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index aee790efbf7b..c23726091228 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -15,6 +16,9 @@
 #include 
 #include 
 
+#include "remoteproc_internal.h"
+#include "remoteproc_elf_helpers.h"
+
 #define IMX7D_SRC_SCR  0x0C
 #define IMX7D_ENABLE_M4BIT(3)
 #define IMX7D_SW_M4P_RST   BIT(2)
@@ -247,10 +251,82 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 
da, size_t len)
return va;
 }
 
+static int imx_rproc_elf_load_segments(struct rproc *rproc, const struct 
firmware *fw)
+{
+   struct device *dev = >dev;
+   const void *ehdr, *phdr;
+   int i, ret = 0;
+   u16 phnum;
+   const u8 *elf_data = fw->data;
+   u8 class = fw_elf_get_class(fw);
+   u32 elf_phdr_get_size = elf_size_of_phdr(class);
+
+   ehdr = elf_data;
+   phnum = elf_hdr_get_e_phnum(class, ehdr);
+   phdr = elf_data + elf_hdr_get_e_phoff(class, ehdr);
+
+   /* go through the available ELF segments */
+   for (i = 0; i < phnum; i++, phdr += elf_phdr_get_size) {
+   u64 da = elf_phdr_get_p_paddr(class, phdr);
+   u64 memsz = elf_phdr_get_p_memsz(class, phdr);
+   u64 filesz = elf_phdr_get_p_filesz(class, phdr);
+   u64 offset = elf_phdr_get_p_offset(class, phdr);
+   u32 type = elf_phdr_get_p_type(class, phdr);
+   void *ptr;
+
+   if (type != PT_LOAD)
+   continue;
+
+   dev_dbg(dev, "phdr: type %d da 0x%llx memsz 0x%llx filesz 
0x%llx\n",
+   type, da, memsz, filesz);
+
+   if (filesz > memsz) {
+   dev_err(dev, "bad phdr filesz 0x%llx memsz 0x%llx\n",
+   filesz, memsz);
+   ret = -EINVAL;
+   break;
+   }
+
+   if (offset + filesz > fw->size) {
+   dev_err(dev, "truncated fw: need 0x%llx avail 0x%zx\n",
+   offset + filesz, fw->size);
+   ret = -EINVAL;
+   break;
+   }
+
+   if (!rproc_u64_fit_in_size_t(memsz)) {
+   dev_err(dev, "size (%llx) does not fit in size_t 
type\n",
+   memsz);
+   ret = -EOVERFLOW;
+   break;
+   }
+
+   /* grab the kernel address for this device address */
+   ptr = rproc_da_to_va(rproc, da, memsz);
+   if (!ptr) {
+   dev_err(dev, "bad phdr da 0x%llx mem 0x%llx\n", da,
+   memsz);
+   ret = -EINVAL;
+   break;
+   }
+
+   /* put the segment where the remote processor expects it */
+   if (filesz)
+   memcpy_toio(ptr, elf_data + offset, filesz);
+   }
+
+   return ret;
+}
+
 static const struct rproc_ops imx_rproc_ops = {
.start  = imx_rproc_start,
.stop   = imx_rproc_stop,
.da_to_va   = imx_rproc_da_to_va,
+   .load   = imx_rproc_elf_load_segments,
+   .parse_fw   = rproc_elf_load_rsc_table,
+   .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
+   .sanity_check   = rproc_elf_sanity_check,
+   .get_boot_addr  = rproc_elf_get_boot_addr,
 };
 
 static int imx_rproc_addr_init(struct imx_rproc *priv,
-- 
2.16.4



[PATCH v2 26/29] memory: fsl_ifc: Fix whitespace issues

2020-07-24 Thread Krzysztof Kozlowski
Fix minor whitespace and comment issues.  Do not break message strings.
No functional changes.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. New patch
---
 drivers/memory/fsl_ifc.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
index a2c971743ffe..89f99b5b6450 100644
--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -53,6 +53,7 @@ int fsl_ifc_find(phys_addr_t addr_base)
 
for (i = 0; i < fsl_ifc_ctrl_dev->banks; i++) {
u32 cspr = ifc_in32(_ifc_ctrl_dev->gregs->cspr_cs[i].cspr);
+
if (cspr & CSPR_V && (cspr & CSPR_BA) ==
convert_ifc_address(addr_base))
return i;
@@ -153,8 +154,8 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
/* read for chip select error */
cs_err = ifc_in32(>cm_evter_stat);
if (cs_err) {
-   dev_err(ctrl->dev, "transaction sent to IFC is not mapped to"
-   "any memory bank 0x%08X\n", cs_err);
+   dev_err(ctrl->dev, "transaction sent to IFC is not mapped to 
any memory bank 0x%08X\n",
+   cs_err);
/* clear the chip select error */
ifc_out32(IFC_CM_EVTER_STAT_CSER, >cm_evter_stat);
 
@@ -163,24 +164,24 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
err_addr = ifc_in32(>cm_erattr1);
 
if (status & IFC_CM_ERATTR0_ERTYP_READ)
-   dev_err(ctrl->dev, "Read transaction error"
-   "CM_ERATTR0 0x%08X\n", status);
+   dev_err(ctrl->dev, "Read transaction error CM_ERATTR0 
0x%08X\n",
+   status);
else
-   dev_err(ctrl->dev, "Write transaction error"
-   "CM_ERATTR0 0x%08X\n", status);
+   dev_err(ctrl->dev, "Write transaction error CM_ERATTR0 
0x%08X\n",
+   status);
 
err_axiid = (status & IFC_CM_ERATTR0_ERAID) >>
IFC_CM_ERATTR0_ERAID_SHIFT;
-   dev_err(ctrl->dev, "AXI ID of the error"
-   "transaction 0x%08X\n", err_axiid);
+   dev_err(ctrl->dev, "AXI ID of the error transaction 0x%08X\n",
+   err_axiid);
 
err_srcid = (status & IFC_CM_ERATTR0_ESRCID) >>
IFC_CM_ERATTR0_ESRCID_SHIFT;
-   dev_err(ctrl->dev, "SRC ID of the error"
-   "transaction 0x%08X\n", err_srcid);
+   dev_err(ctrl->dev, "SRC ID of the error transaction 0x%08X\n",
+   err_srcid);
 
-   dev_err(ctrl->dev, "Transaction Address corresponding to error"
-   "ERADDR 0x%08X\n", err_addr);
+   dev_err(ctrl->dev, "Transaction Address corresponding to error 
ERADDR 0x%08X\n",
+   err_addr);
 
ret = IRQ_HANDLED;
}
@@ -199,7 +200,7 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
  * the resources needed for the controller only.  The
  * resources for the NAND banks themselves are allocated
  * in the chip probe function.
-*/
+ */
 static int fsl_ifc_ctrl_probe(struct platform_device *dev)
 {
int ret = 0;
@@ -250,8 +251,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
/* get the Controller level irq */
fsl_ifc_ctrl_dev->irq = irq_of_parse_and_map(dev->dev.of_node, 0);
if (fsl_ifc_ctrl_dev->irq == 0) {
-   dev_err(>dev, "failed to get irq resource "
-   "for IFC\n");
+   dev_err(>dev, "failed to get irq resource for IFC\n");
ret = -ENODEV;
goto err;
}
-- 
2.17.1



[PATCH v2 29/29] memory: samsung: exynos-srom: Describe the Kconfig entry

2020-07-24 Thread Krzysztof Kozlowski
Write short description about the Exynos SROM controller driver.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. New patch
---
 drivers/memory/samsung/Kconfig | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/memory/samsung/Kconfig b/drivers/memory/samsung/Kconfig
index 20a8406ce786..8e240f078afc 100644
--- a/drivers/memory/samsung/Kconfig
+++ b/drivers/memory/samsung/Kconfig
@@ -23,5 +23,12 @@ config EXYNOS5422_DMC
 config EXYNOS_SROM
bool "Exynos SROM controller driver" if COMPILE_TEST
depends on (ARM && ARCH_EXYNOS) || (COMPILE_TEST && HAS_IOMEM)
+   help
+ This adds driver for Samsung Exynos SoC SROM controller.  The driver
+ in basic operation mode only saves and restores SROM registers
+ during suspend.  If however appropriate device tree configuration
+ is provided, the driver enables support for external memory
+ or external devices.
+ If unsure, say Y on devices with Samsung Exynos SocS.
 
 endif
-- 
2.17.1



[PATCH 02/10] remoteproc: imx_rproc: correct err message

2020-07-24 Thread Peng Fan
It is using devm_ioremap, so not devm_ioremap_resource. Correct
the error message and print out sa/size.

Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 8957ed271d20..3b3904ebac75 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -268,7 +268,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
priv->mem[b].cpu_addr = devm_ioremap(>dev,
 att->sa, att->size);
if (!priv->mem[b].cpu_addr) {
-   dev_err(dev, "devm_ioremap_resource failed\n");
+   dev_err(dev, "devm_ioremap sa:0x%x size:0x%x failed\n", 
att->sa, att->size);
return -ENOMEM;
}
priv->mem[b].sys_addr = att->sa;
-- 
2.16.4



[PATCH v2 28/29] memory: Describe the MEMORY Kconfig entry

2020-07-24 Thread Krzysztof Kozlowski
Write short description about the entire memory controllers section.

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. New patch
---
 drivers/memory/Kconfig | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index c37752d5f26d..ec735794aeaf 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -5,6 +5,12 @@
 
 menuconfig MEMORY
bool "Memory Controller drivers"
+   help
+ This option allows to enable specific memory controller drivers,
+ useful mostly on embedded systems.  These could be controllers
+ for DRAM (SDR, DDR), ROM, SRAM and others.  The drivers features
+ vary from memory tuning and frequency scaling to enabling
+ access to attached peripherals through memory bus.
 
 if MEMORY
 
-- 
2.17.1



[PATCH v2 27/29] memory: da8xx-ddrctl: Remove unused 'node' variable

2020-07-24 Thread Krzysztof Kozlowski
The variable 'node' is not used.  Remove it to silence compile warning:

drivers/memory/da8xx-ddrctl.c: In function 'da8xx_ddrctl_probe':
drivers/memory/da8xx-ddrctl.c:105:22: warning: variable 'node' set but not 
used [-Wunused-but-set-variable]

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. New patch
---
 drivers/memory/da8xx-ddrctl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/memory/da8xx-ddrctl.c b/drivers/memory/da8xx-ddrctl.c
index e8f9b3f461f5..872addd0ec60 100644
--- a/drivers/memory/da8xx-ddrctl.c
+++ b/drivers/memory/da8xx-ddrctl.c
@@ -102,14 +102,12 @@ static int da8xx_ddrctl_probe(struct platform_device 
*pdev)
 {
const struct da8xx_ddrctl_config_knob *knob;
const struct da8xx_ddrctl_setting *setting;
-   struct device_node *node;
struct resource *res;
void __iomem *ddrctl;
struct device *dev;
u32 reg;
 
dev = >dev;
-   node = dev->of_node;
 
setting = da8xx_ddrctl_get_board_settings();
if (!setting) {
-- 
2.17.1



[PATCH 01/10] dt-bindings: remoteproc: imx_rproc: add i.MX8MQ/M

2020-07-24 Thread Peng Fan
Add i.MX8MQ/M compatible string

Signed-off-by: Peng Fan 
---
 Documentation/devicetree/bindings/remoteproc/imx-rproc.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/remoteproc/imx-rproc.txt 
b/Documentation/devicetree/bindings/remoteproc/imx-rproc.txt
index fbcefd965dc4..46f7623512db 100644
--- a/Documentation/devicetree/bindings/remoteproc/imx-rproc.txt
+++ b/Documentation/devicetree/bindings/remoteproc/imx-rproc.txt
@@ -8,6 +8,8 @@ Required properties:
 - compatible   Should be one of:
"fsl,imx7d-cm4"
"fsl,imx6sx-cm4"
+   "fsl,imx8mq-cm4"
+   "fsl,imx8mm-cm4"
 - clocks   Clock for co-processor (See: 
../clock/clock-bindings.txt)
 - syscon   Phandle to syscon block which provide access to
System Reset Controller
@@ -15,6 +17,7 @@ Required properties:
 Optional properties:
 - memory-regionlist of phandels to the reserved memory regions.
(See: ../reserved-memory/reserved-memory.txt)
+- rsc-da   address of resource table
 
 Example:
m4_reserved_sysmem1: cm4@8000 {
-- 
2.16.4



[PATCH v2 25/29] MAINTAINERS: Add Krzysztof Kozlowski as maintainer of memory controllers

2020-07-24 Thread Krzysztof Kozlowski
The generic parts of memory controllers (of_memory.[ch]) lacked any
care.  The memory controller drivers were not abandoned (usually
picked up by architecture maintainers) but in such case I can take care
about them as well.

Signed-off-by: Krzysztof Kozlowski 
Acked-by: Florian Fainelli 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index f4557bc43bd5..cba0ed5b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11158,6 +11158,13 @@ F: Documentation/core-api/boot-time-mm.rst
 F: include/linux/memblock.h
 F: mm/memblock.c
 
+MEMORY CONTROLLER DRIVERS
+M: Krzysztof Kozlowski 
+L: linux-kernel@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/memory-controllers/
+F: drivers/memory/
+
 MEMORY FREQUENCY SCALING DRIVERS FOR NVIDIA TEGRA
 M: Dmitry Osipenko 
 L: linux...@vger.kernel.org
-- 
2.17.1



[PATCH 03/10] remoteproc: imx: use devm_ioremap

2020-07-24 Thread Peng Fan
We might need to map an region multiple times, becaue the region might
be shared between remote processors, such i.MX8QM with dual M4 cores.
So use devm_ioremap, not devm_ioremap_resource.

Reviewed-by: Richard Zhu 
Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 3b3904ebac75..82594a800a1b 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -296,9 +296,10 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
if (b >= IMX7D_RPROC_MEM_MAX)
break;
 
-   priv->mem[b].cpu_addr = devm_ioremap_resource(>dev, );
+   /* Not use resource version, because we might share region*/
+   priv->mem[b].cpu_addr = devm_ioremap(>dev, res.start, 
resource_size());
if (IS_ERR(priv->mem[b].cpu_addr)) {
-   dev_err(dev, "devm_ioremap_resource failed\n");
+   dev_err(dev, "devm_ioremap %pR failed\n", );
err = PTR_ERR(priv->mem[b].cpu_addr);
return err;
}
-- 
2.16.4



[PATCH 08/10] remoteproc: imx_rproc: support i.MX8MQ/M

2020-07-24 Thread Peng Fan
Add i.MX8MQ dev/sys addr map and configuration data structure
i.MX8MM share i.MX8MQ settings.

Reviewed-by: Richard Zhu 
Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 43000a992455..03382290d6a5 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -93,6 +93,34 @@ struct imx_rproc {
void*rsc_va;
 };
 
+static const struct imx_rproc_att imx_rproc_att_imx8mq[] = {
+   /* dev addr , sys addr  , size  , flags */
+   /* TCML - alias */
+   { 0x, 0x007e, 0x0002, 0 },
+   /* OCRAM_S */
+   { 0x0018, 0x0018, 0x8000, 0 },
+   /* OCRAM */
+   { 0x0090, 0x0090, 0x0002, 0 },
+   /* OCRAM */
+   { 0x0092, 0x0092, 0x0002, 0 },
+   /* QSPI Code - alias */
+   { 0x0800, 0x0800, 0x0800, 0 },
+   /* DDR (Code) - alias */
+   { 0x1000, 0x8000, 0x0FFE, 0 },
+   /* TCML */
+   { 0x1FFE, 0x007E, 0x0002, ATT_OWN },
+   /* TCMU */
+   { 0x2000, 0x0080, 0x0002, ATT_OWN },
+   /* OCRAM_S */
+   { 0x2018, 0x0018, 0x8000, ATT_OWN },
+   /* OCRAM */
+   { 0x2020, 0x0090, 0x0002, ATT_OWN },
+   /* OCRAM */
+   { 0x2022, 0x0092, 0x0002, ATT_OWN },
+   /* DDR (Data) */
+   { 0x4000, 0x4000, 0x8000, 0 },
+};
+
 static const struct imx_rproc_att imx_rproc_att_imx7d[] = {
/* dev addr , sys addr  , size  , flags */
/* OCRAM_S (M4 Boot code) - alias */
@@ -143,6 +171,15 @@ static const struct imx_rproc_att imx_rproc_att_imx6sx[] = 
{
{ 0x8000, 0x8000, 0x6000, 0 },
 };
 
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
+   .src_reg= IMX7D_SRC_SCR,
+   .src_mask   = IMX7D_M4_RST_MASK,
+   .src_start  = IMX7D_M4_START,
+   .src_stop   = IMX7D_M4_STOP,
+   .att= imx_rproc_att_imx8mq,
+   .att_size   = ARRAY_SIZE(imx_rproc_att_imx8mq),
+};
+
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
.src_reg= IMX7D_SRC_SCR,
.src_mask   = IMX7D_M4_RST_MASK,
@@ -583,6 +620,8 @@ static int imx_rproc_remove(struct platform_device *pdev)
 static const struct of_device_id imx_rproc_of_match[] = {
{ .compatible = "fsl,imx7d-cm4", .data = _rproc_cfg_imx7d },
{ .compatible = "fsl,imx6sx-cm4", .data = _rproc_cfg_imx6sx },
+   { .compatible = "fsl,imx8mq-cm4", .data = _rproc_cfg_imx8mq },
+   { .compatible = "fsl,imx8mm-cm4", .data = _rproc_cfg_imx8mq },
{},
 };
 MODULE_DEVICE_TABLE(of, imx_rproc_of_match);
-- 
2.16.4



[PATCH 07/10] remoteproc: imx_rproc: add i.MX specific parse fw hook

2020-07-24 Thread Peng Fan
The hook is used to parse memory-regions and load resource table
from the address the remote processor published.

Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 99 +-
 1 file changed, 98 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index c23726091228..43000a992455 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,6 +90,7 @@ struct imx_rproc {
const struct imx_rproc_dcfg *dcfg;
struct imx_rproc_memmem[IMX7D_RPROC_MEM_MAX];
struct clk  *clk;
+   void*rsc_va;
 };
 
 static const struct imx_rproc_att imx_rproc_att_imx7d[] = {
@@ -251,6 +253,101 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 
da, size_t len)
return va;
 }
 
+static int imx_rproc_mem_alloc(struct rproc *rproc,
+  struct rproc_mem_entry *mem)
+{
+   struct device *dev = rproc->dev.parent;
+   void *va;
+
+   dev_dbg(dev, "map memory: %p+%zx\n", >dma, mem->len);
+   va = ioremap_wc(mem->dma, mem->len);
+   if (IS_ERR_OR_NULL(va)) {
+   dev_err(dev, "Unable to map memory region: %p+%zx\n",
+   >dma, mem->len);
+   return -ENOMEM;
+   }
+
+   /* Update memory entry va */
+   mem->va = va;
+
+   return 0;
+}
+
+static int imx_rproc_mem_release(struct rproc *rproc,
+struct rproc_mem_entry *mem)
+{
+   dev_dbg(rproc->dev.parent, "unmap memory: %pa\n", >dma);
+   iounmap(mem->va);
+
+   return 0;
+}
+
+static int imx_rproc_parse_memory_regions(struct rproc *rproc)
+{
+   struct imx_rproc *priv = rproc->priv;
+   struct device_node *np = priv->dev->of_node;
+   struct of_phandle_iterator it;
+   struct rproc_mem_entry *mem;
+   struct reserved_mem *rmem;
+   int index = 0;
+   u32 da;
+
+   /* Register associated reserved memory regions */
+   of_phandle_iterator_init(, np, "memory-region", NULL, 0);
+   while (of_phandle_iterator_next() == 0) {
+   rmem = of_reserved_mem_lookup(it.node);
+   if (!rmem) {
+   dev_err(priv->dev, "unable to acquire memory-region\n");
+   return -EINVAL;
+   }
+
+   /* No need to translate pa to da, i.MX use same map */
+   da = rmem->base;
+
+   if (strcmp(it.node->name, "vdev0buffer")) {
+   /* Register memory region */
+   mem = rproc_mem_entry_init(priv->dev, NULL,
+  (dma_addr_t)rmem->base,
+  rmem->size, da,
+  imx_rproc_mem_alloc,
+  imx_rproc_mem_release,
+  it.node->name);
+
+   if (mem)
+   rproc_coredump_add_segment(rproc, da,
+  rmem->size);
+   } else {
+   /* Register reserved memory for vdev buffer alloc */
+   mem = rproc_of_resm_mem_entry_init(priv->dev, index,
+  rmem->size,
+  rmem->base,
+  it.node->name);
+   }
+
+   if (!mem)
+   return -ENOMEM;
+
+   rproc_add_carveout(rproc, mem);
+   index++;
+   }
+
+   return  0;
+}
+
+static int imx_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
+{
+   int ret = imx_rproc_parse_memory_regions(rproc);
+
+   if (ret)
+   return ret;
+
+   ret = rproc_elf_load_rsc_table(rproc, fw);
+   if (ret)
+   dev_info(>dev, "No resource table in elf\n");
+
+   return 0;
+}
+
 static int imx_rproc_elf_load_segments(struct rproc *rproc, const struct 
firmware *fw)
 {
struct device *dev = >dev;
@@ -323,7 +420,7 @@ static const struct rproc_ops imx_rproc_ops = {
.stop   = imx_rproc_stop,
.da_to_va   = imx_rproc_da_to_va,
.load   = imx_rproc_elf_load_segments,
-   .parse_fw   = rproc_elf_load_rsc_table,
+   .parse_fw   = imx_rproc_parse_fw,
.find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
.sanity_check   = rproc_elf_sanity_check,
.get_boot_addr  = rproc_elf_get_boot_addr,
-- 
2.16.4



[PATCH 09/10] remoteproc: imx_proc: enable virtio/mailbox

2020-07-24 Thread Peng Fan
Use virtio/mailbox to build connection between Remote Proccessors
and Linux. Add delayed work to handle incoming messages.

Reviewed-by: Richard Zhu 
Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 102 +++--
 1 file changed, 99 insertions(+), 3 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 03382290d6a5..a8ce97c04e1e 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -91,6 +92,10 @@ struct imx_rproc {
struct imx_rproc_memmem[IMX7D_RPROC_MEM_MAX];
struct clk  *clk;
void*rsc_va;
+   struct mbox_client  cl;
+   struct mbox_chan*tx_ch;
+   struct mbox_chan*rx_ch;
+   struct delayed_work rproc_work;
 };
 
 static const struct imx_rproc_att imx_rproc_att_imx8mq[] = {
@@ -452,9 +457,25 @@ static int imx_rproc_elf_load_segments(struct rproc 
*rproc, const struct firmwar
return ret;
 }
 
+static void imx_rproc_kick(struct rproc *rproc, int vqid)
+{
+   struct imx_rproc *priv = rproc->priv;
+   int err;
+   __u32 mmsg;
+
+   mmsg = vqid << 16;
+
+   priv->cl.tx_tout = 20;
+   err = mbox_send_message(priv->tx_ch, (void *));
+   if (err < 0)
+   dev_err(priv->dev, "%s: failed (%d, err:%d)\n",
+   __func__, vqid, err);
+}
+
 static const struct rproc_ops imx_rproc_ops = {
.start  = imx_rproc_start,
.stop   = imx_rproc_stop,
+   .kick   = imx_rproc_kick,
.da_to_va   = imx_rproc_da_to_va,
.load   = imx_rproc_elf_load_segments,
.parse_fw   = imx_rproc_parse_fw,
@@ -527,6 +548,67 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
return 0;
 }
 
+static void imx_rproc_vq_work(struct work_struct *work)
+{
+   struct delayed_work *dwork = to_delayed_work(work);
+   struct imx_rproc *priv = container_of(dwork, struct imx_rproc,
+ rproc_work);
+
+   rproc_vq_interrupt(priv->rproc, 0);
+   rproc_vq_interrupt(priv->rproc, 1);
+}
+
+static void imx_rproc_rx_callback(struct mbox_client *cl, void *msg)
+{
+   struct rproc *rproc = dev_get_drvdata(cl->dev);
+   struct imx_rproc *priv = rproc->priv;
+
+   schedule_delayed_work(&(priv->rproc_work), 0);
+}
+
+static int imx_rproc_xtr_mbox_init(struct rproc *rproc)
+{
+   struct imx_rproc *priv = rproc->priv;
+   struct device *dev = priv->dev;
+   struct mbox_client *cl;
+   int ret = 0;
+
+   cl = >cl;
+   cl->dev = dev;
+   cl->tx_block = true;
+   cl->tx_tout = 20;
+   cl->knows_txdone = false;
+   cl->rx_callback = imx_rproc_rx_callback;
+
+   priv->tx_ch = mbox_request_channel_byname(cl, "tx");
+   if (IS_ERR(priv->tx_ch)) {
+   if (PTR_ERR(priv->tx_ch) == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+   ret = PTR_ERR(priv->tx_ch);
+   dev_dbg(cl->dev, "failed to request mbox tx chan, ret %d\n",
+   ret);
+   goto err_out;
+   }
+
+   priv->rx_ch = mbox_request_channel_byname(cl, "rx");
+   if (IS_ERR(priv->rx_ch)) {
+   ret = PTR_ERR(priv->rx_ch);
+   dev_dbg(cl->dev, "failed to request mbox rx chan, ret %d\n",
+   ret);
+   goto err_out;
+   }
+
+   return ret;
+
+err_out:
+   if (!IS_ERR(priv->tx_ch))
+   mbox_free_channel(priv->tx_ch);
+   if (!IS_ERR(priv->rx_ch))
+   mbox_free_channel(priv->rx_ch);
+
+   return ret;
+}
+
 static int imx_rproc_probe(struct platform_device *pdev)
 {
struct device *dev = >dev;
@@ -566,17 +648,24 @@ static int imx_rproc_probe(struct platform_device *pdev)
 
dev_set_drvdata(dev, rproc);
 
+   ret = imx_rproc_xtr_mbox_init(rproc);
+   if (ret) {
+   if (ret == -EPROBE_DEFER)
+   goto err_put_rproc;
+   /* mbox is optional, so not fail here */
+   }
+
ret = imx_rproc_addr_init(priv, pdev);
if (ret) {
dev_err(dev, "failed on imx_rproc_addr_init\n");
-   goto err_put_rproc;
+   goto err_put_mbox;
}
 
priv->clk = devm_clk_get_optional(dev, NULL);
if (IS_ERR(priv->clk)) {
dev_err(dev, "Failed to get clock\n");
ret = PTR_ERR(priv->clk);
-   goto err_put_rproc;
+   goto err_put_mbox;
}
 
/*
@@ -586,9 +675,11 @@ static int imx_rproc_probe(struct platform_device *pdev)
ret = clk_prepare_enable(priv->clk);
if (ret) {
dev_err(>dev, "Failed to enable 

[PATCH 10/10] remoteproc: imx_rproc: support coproc booting before Linux

2020-07-24 Thread Peng Fan
Detect Coproc booted or not and Parse resource table
Set remoteproc state to RPROC_DETACHED when M4 is booted early
Add attach hook

Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c | 75 --
 1 file changed, 73 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index a8ce97c04e1e..0863b3162777 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -91,6 +91,7 @@ struct imx_rproc {
const struct imx_rproc_dcfg *dcfg;
struct imx_rproc_memmem[IMX7D_RPROC_MEM_MAX];
struct clk  *clk;
+   boolearly_boot;
void*rsc_va;
struct mbox_client  cl;
struct mbox_chan*tx_ch;
@@ -235,6 +236,8 @@ static int imx_rproc_stop(struct rproc *rproc)
 dcfg->src_mask, dcfg->src_stop);
if (ret)
dev_err(dev, "Failed to stop M4!\n");
+   else
+   priv->early_boot = false;
 
return ret;
 }
@@ -390,6 +393,32 @@ static int imx_rproc_parse_fw(struct rproc *rproc, const 
struct firmware *fw)
return 0;
 }
 
+static int imx_rproc_get_loaded_rsc_table(struct device *dev,
+ struct rproc *rproc)
+{
+   struct imx_rproc *priv = rproc->priv;
+   struct device_node *np = dev->of_node;
+   u32 da;
+   int ret;
+
+   ret = of_property_read_u32(np, "rsc-da", );
+   if (!ret)
+   priv->rsc_va = rproc_da_to_va(rproc, (u64)da, SZ_1K);
+   else
+   return 0;
+
+   if (!priv->rsc_va) {
+   dev_err(priv->dev, "no map for rsc-da: %x\n", da);
+   return PTR_ERR(priv->rsc_va);
+   }
+
+   rproc->table_ptr = (struct resource_table *)priv->rsc_va;
+   rproc->table_sz = SZ_1K;
+   rproc->cached_table = NULL;
+
+   return 0;
+}
+
 static int imx_rproc_elf_load_segments(struct rproc *rproc, const struct 
firmware *fw)
 {
struct device *dev = >dev;
@@ -472,9 +501,15 @@ static void imx_rproc_kick(struct rproc *rproc, int vqid)
__func__, vqid, err);
 }
 
+static int imx_rproc_attach(struct rproc *rproc)
+{
+   return 0;
+}
+
 static const struct rproc_ops imx_rproc_ops = {
.start  = imx_rproc_start,
.stop   = imx_rproc_stop,
+   .attach = imx_rproc_attach,
.kick   = imx_rproc_kick,
.da_to_va   = imx_rproc_da_to_va,
.load   = imx_rproc_elf_load_segments,
@@ -609,6 +644,36 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc)
return ret;
 }
 
+static int imx_rproc_detect_mode(struct imx_rproc *priv)
+{
+   const struct imx_rproc_dcfg *dcfg = priv->dcfg;
+   struct device *dev = priv->dev;
+   int ret;
+   u32 val;
+
+   ret = regmap_read(priv->regmap, dcfg->src_reg, );
+   if (ret) {
+   dev_err(dev, "Failed to read src\n");
+   return ret;
+   }
+
+   priv->early_boot = !(val & dcfg->src_stop);
+
+   if (priv->early_boot) {
+   priv->rproc->state = RPROC_DETACHED;
+
+   ret = imx_rproc_parse_memory_regions(priv->rproc);
+   if (ret)
+   return ret;
+
+   ret = imx_rproc_get_loaded_rsc_table(dev, priv->rproc);
+   if (ret)
+   return ret;
+   }
+
+   return 0;
+}
+
 static int imx_rproc_probe(struct platform_device *pdev)
 {
struct device *dev = >dev;
@@ -661,6 +726,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
goto err_put_mbox;
}
 
+   ret = imx_rproc_detect_mode(priv);
+   if (ret)
+   goto err_put_mbox;
+
priv->clk = devm_clk_get_optional(dev, NULL);
if (IS_ERR(priv->clk)) {
dev_err(dev, "Failed to get clock\n");
@@ -689,7 +758,8 @@ static int imx_rproc_probe(struct platform_device *pdev)
return 0;
 
 err_put_clk:
-   clk_disable_unprepare(priv->clk);
+   if (!priv->early_boot)
+   clk_disable_unprepare(priv->clk);
 err_put_mbox:
if (!IS_ERR(priv->tx_ch))
mbox_free_channel(priv->tx_ch);
@@ -706,7 +776,8 @@ static int imx_rproc_remove(struct platform_device *pdev)
struct rproc *rproc = platform_get_drvdata(pdev);
struct imx_rproc *priv = rproc->priv;
 
-   clk_disable_unprepare(priv->clk);
+   if (!priv->early_boot)
+   clk_disable_unprepare(priv->clk);
rproc_del(rproc);
rproc_free(rproc);
 
-- 
2.16.4



Re: [PATCH] amdgpu_dm: fix nonblocking atomic commit use-after-free

2020-07-24 Thread Paul Menzel

Dear Kees,


Am 24.07.20 um 00:32 schrieb Kees Cook:

On Thu, Jul 23, 2020 at 09:10:15PM +, Mazin Rezk wrote:

When amdgpu_dm_atomic_commit_tail is running in the workqueue,
drm_atomic_state_put will get called while amdgpu_dm_atomic_commit_tail is
running, causing a race condition where state (and then dm_state) is
sometimes freed while amdgpu_dm_atomic_commit_tail is running. This bug has
occurred since 5.7-rc1 and is well documented among polaris11 users [1].

Prior to 5.7, this was not a noticeable issue since the freelist pointer
was stored at the beginning of dm_state (base), which was unused. After
changing the freelist pointer to be stored in the middle of the struct, the
freelist pointer overwrote the context, causing dc_state to become garbage
data and made the call to dm_enable_per_frame_crtc_master_sync dereference
a freelist pointer.

This patch fixes the aforementioned issue by calling drm_atomic_state_get
in amdgpu_dm_atomic_commit before drm_atomic_helper_commit is called and
drm_atomic_state_put after amdgpu_dm_atomic_commit_tail is complete.

According to my testing on 5.8.0-rc6, this should fix bug 207383 on
Bugzilla [1].

[1] https://bugzilla.kernel.org/show_bug.cgi?id=207383


Nice work tracking this down!


Fixes: 3202fa62f ("slub: relocate freelist pointer to middle of object")


I do, however, object to this Fixes tag. :) The flaw appears to have
been with amdgpu_dm's reference tracking of "state" in the nonblocking
case. (How this reference counting is supposed to work correctly, though,
I'm not sure.) If I look at where the drm helper was split from being
the default callback, it looks like this was what introduced the bug:

da5c47f682ab ("drm/amd/display: Remove acrtc->stream")

? 3202fa62f certainly exposed it much more quickly, but there was a race
even without 3202fa62f where something could have realloced the memory
and written over it.


I understand the Fixes tag mainly a help when backporting commits.

As Linux 5.8-rc7 is going to be released this Sunday, I wonder, if 
commit 3202fa62f ("slub: relocate freelist pointer to middle of object") 
should be reverted for now to fix the regression for the users according 
to Linux’ no regression policy. Once the AMDGPU/DRM driver issue is 
fixed, it can be reapplied. I know it’s not optimal, but as some testing 
is going to be involved for the fix, I’d argue it’s the best option for 
the users.



Kind regards,

Paul


Re: kernel BUG at mm/vmalloc.c:LINE! (2)

2020-07-24 Thread Thomas Gleixner
Stephen Rothwell  writes:
>> All a bit mysterious.  I think it's best that we revert this from
>> linux-next until we hear from Ingo.  I queued a patch - I expect
>> Stephen will see and grab it, thanks.
>
> In the end I actually did the revert (of the revert) in the merge of
> the tip tree (so that -next will bisect better if necessary).  So you
> will not need the revert in your quilt series after today.

Sigh. I have no idea why this was in tip auto-latest. I just
reintegrated that branch and the annoyance should be gone now.

Sorry for not paying attention.

Thanks,

tglx


drivers/tty/serial/msm_serial.c:748:25: sparse: sparse: context imbalance in 'msm_handle_rx_dm' - unexpected unlock

2020-07-24 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f37e99aca03f63aa3f2bd13ceaf769455d12c4b0
commit: 08d5470308ac3598e7709d08b8979ce6e9de8da2 serial: core: fix sysrq 
overhead regression
date:   4 weeks ago
config: arm64-randconfig-s031-20200723 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-93-g4c6cbe55-dirty
git checkout 08d5470308ac3598e7709d08b8979ce6e9de8da2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/tty/serial/msm_serial.c:748:25: sparse: sparse: context imbalance in 
>> 'msm_handle_rx_dm' - unexpected unlock
>> drivers/tty/serial/msm_serial.c:814:28: sparse: sparse: context imbalance in 
>> 'msm_handle_rx' - unexpected unlock

vim +/msm_handle_rx_dm +748 drivers/tty/serial/msm_serial.c

04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22  
697  
558abdb05fe0c7f drivers/tty/serial/msm_serial.c Ivan T. Ivanov  2015-09-30  
698  static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr)
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
699  {
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby  2013-01-03  
700 struct tty_port *tport = >state->port;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
701 unsigned int sr;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
702 int count = 0;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
703 struct msm_port *msm_port = UART_TO_MSM(port);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
704  
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
705 if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
706 port->icount.overrun++;
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby  2013-01-03  
707 tty_insert_flip_char(tport, 0, TTY_OVERRUN);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
708 msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
709 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
710  
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
711 if (misr & UART_IMR_RXSTALE) {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
712 count = msm_read(port, UARTDM_RX_TOTAL_SNAP) -
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
713 msm_port->old_snap_state;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
714 msm_port->old_snap_state = 0;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
715 } else {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
716 count = 4 * (msm_read(port, UART_RFWR));
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
717 msm_port->old_snap_state += count;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
718 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
719  
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
720 /* TODO: Precise error reporting */
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
721  
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
722 port->icount.rx += count;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
723  
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
724 while (count > 0) {
68252424a7c757c drivers/tty/serial/msm_serial.c Stephen Boyd2014-06-30  
725 unsigned char buf[4];
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd2014-10-29  
726 int sysrq, r_count, i;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
727  
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21  
728 sr = msm_read(port, UART_SR);
ec8f29e70edceb9 drivers/serial/msm_serial.c 

Re: [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint

2020-07-24 Thread Christian König

Am 23.07.20 um 15:44 schrieb Paul Menzel:

Dear Linus, dear Christian,


Am 03.07.20 um 17:29 schrieb Christian König:

Am 03.07.20 um 16:29 schrieb Paul Menzel:

The newly added hexint helper is more convenient for bitmasks.

Before:

 $ more /sys/module/amdgpu/parameters/ppfeaturemask
 4294950911

After:

 $ more /sys/module/amdgpu/parameters/ppfeaturemask
 0xbfff

Cc: amd-...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Paul Menzel 


Reviewed-by: Christian König  for this one.

Feel free to add my Acked-by to the other two, but I'm not familiar 
enough with the code to review those.


Thank you. Sorry for being ignorant, but what is the way forward?


Well, that's a very valid question. The general approach is that driver 
changes are pushed upstream through the driver maintainers tree.


Since this driver change depends on a change in the general kernel an rb 
from somebody who feels responsible for the code in the general kernel 
might be a good idea.


But since you already addressed Linus comments and it looks rather clean 
I think I can just push it to drm-misc-next on Monday if nobody objects 
over the weekend.


Thanks for the help,
Christian.




Kind regards,

Paul




Re: PROBLEM: cgroup cost too much memory when transfer small files to tmpfs

2020-07-24 Thread Michal Hocko
On Tue 21-07-20 11:19:52, jingrui wrote:
[...]
> systemd related issue: https://github.com/systemd/systemd/issues/16499

Well, I would be really careful with one-off and short lived cgroups.
Firstly there are charges which cannot be easily reparented and secondly
even if the memory footprint is reduced there would be still memcgs
standing in the way.

[...]
> 1. Do we have any idea to descrease cgroup memory cost in this case?

Others have already commented on this.

> 2. When user remove cgroup directory, does it possible associated file memory 
> to root cgroup?

We used to do that in the past but removed it by b2052564e66d ("mm:
memcontrol: continue cache reclaim from offlined groups"). Please read
through the changelog for the reasoning behind.

> 3. Can we provide an option that do not associate memory with cgroup in tmpfs?

What is the reason to run under !root cgroup in those sessions if you do
not care about accounting anyway? tmpfs is a persistent charge until the
file is removed. So if those outlive the session then you either want
them to be charged to somebody or you do not care about accounting at
all, no? Or could you explain your usecase some more?
-- 
Michal Hocko
SUSE Labs


[tip: x86/cleanups] x86/mm: Drop unused MAX_PHYSADDR_BITS

2020-07-24 Thread tip-bot2 for Arvind Sankar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 0a787b28b7a375ad9d5c77bc3922ae1a8305239e
Gitweb:
https://git.kernel.org/tip/0a787b28b7a375ad9d5c77bc3922ae1a8305239e
Author:Arvind Sankar 
AuthorDate:Thu, 23 Jul 2020 19:15:42 -04:00
Committer: Thomas Gleixner 
CommitterDate: Fri, 24 Jul 2020 09:53:06 +02:00

x86/mm: Drop unused MAX_PHYSADDR_BITS

The macro is not used anywhere, and has an incorrect value (going by the
comment) on x86_64 since commit c898faf91b3e ("x86: 46 bit physical address
support on 64 bits")

To avoid confusion, just remove the definition.

Signed-off-by: Arvind Sankar 
Signed-off-by: Thomas Gleixner 
Link: https://lkml.kernel.org/r/20200723231544.17274-2-nived...@alum.mit.edu

---
 arch/x86/include/asm/sparsemem.h | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/sparsemem.h b/arch/x86/include/asm/sparsemem.h
index 1992187..6bfc878 100644
--- a/arch/x86/include/asm/sparsemem.h
+++ b/arch/x86/include/asm/sparsemem.h
@@ -10,24 +10,20 @@
  *field of the struct page
  *
  * SECTION_SIZE_BITS   2^n: size of each section
- * MAX_PHYSADDR_BITS   2^n: max size of physical address space
- * MAX_PHYSMEM_BITS2^n: how much memory we can have in that space
+ * MAX_PHYSMEM_BITS2^n: max size of physical address space
  *
  */
 
 #ifdef CONFIG_X86_32
 # ifdef CONFIG_X86_PAE
 #  define SECTION_SIZE_BITS29
-#  define MAX_PHYSADDR_BITS36
 #  define MAX_PHYSMEM_BITS 36
 # else
 #  define SECTION_SIZE_BITS26
-#  define MAX_PHYSADDR_BITS32
 #  define MAX_PHYSMEM_BITS 32
 # endif
 #else /* CONFIG_X86_32 */
 # define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */
-# define MAX_PHYSADDR_BITS (pgtable_l5_enabled() ? 52 : 44)
 # define MAX_PHYSMEM_BITS  (pgtable_l5_enabled() ? 52 : 46)
 #endif
 


[tip: x86/entry] x86: Correct noinstr qualifiers

2020-07-24 Thread tip-bot2 for Ira Weiny
The following commit has been merged into the x86/entry branch of tip:

Commit-ID: 7f6fa101dfac8739764e47751d314551f6160c98
Gitweb:
https://git.kernel.org/tip/7f6fa101dfac8739764e47751d314551f6160c98
Author:Ira Weiny 
AuthorDate:Thu, 23 Jul 2020 09:14:05 -07:00
Committer: Thomas Gleixner 
CommitterDate: Fri, 24 Jul 2020 09:54:15 +02:00

x86: Correct noinstr qualifiers

The noinstr qualifier is to be specified before the return type in the
same way inline is used.

These 2 cases were missed by previous patches.

Signed-off-by: Ira Weiny 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Tony Luck 
Link: https://lkml.kernel.org/r/20200723161405.852613-1-ira.we...@intel.com

---
 arch/x86/kernel/alternative.c  | 2 +-
 arch/x86/kernel/cpu/mce/core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 8fd39ff..069e77c 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1044,7 +1044,7 @@ static __always_inline int patch_cmp(const void *key, 
const void *elt)
return 0;
 }
 
-int noinstr poke_int3_handler(struct pt_regs *regs)
+noinstr int poke_int3_handler(struct pt_regs *regs)
 {
struct bp_patching_desc *desc;
struct text_poke_loc *tp;
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 14e4b4d..6d7aa56 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1212,7 +1212,7 @@ static void kill_me_maybe(struct callback_head *cb)
  * backing the user stack, tracing that reads the user stack will cause
  * potentially infinite recursion.
  */
-void noinstr do_machine_check(struct pt_regs *regs)
+noinstr void do_machine_check(struct pt_regs *regs)
 {
DECLARE_BITMAP(valid_banks, MAX_NR_BANKS);
DECLARE_BITMAP(toclear, MAX_NR_BANKS);


Re: [PATCH v2 0/3] ARM: dts: aspeed: fixup wedge40 device tree

2020-07-24 Thread Tao Ren
On Fri, Jul 24, 2020 at 05:32:30AM +, Joel Stanley wrote:
> On Thu, 23 Jul 2020 at 23:05,  wrote:
> >
> > From: Tao Ren 
> >
> > The patch series update several devices' settings in Facebook Wedge40
> > device tree.
> >
> > Patch #1 disables a few i2c controllers as they are not being used at
> > present.
> >
> > Patch #2 enables adc device for voltage monitoring.
> >
> > Patch #3 enables pwm_tacho device for fan control and monitoring.
> >
> > Tao Ren (3):
> >   ARM: dts: aspeed: wedge40: disable a few i2c controllers
> >   ARM: dts: aspeed: wedge40: enable adc device
> >   ARM: dts: aspeed: wedge40: enable pwm_tacho device
> 
> I have merged this series into the aspeed dt-for-5.9 branch.
> 
> Cheers,
> 
> Joel

Thanks a lot Joel. Have a great weekend.


Cheers,

Tao


Re: [PATCH] newport_con: vc_color is now in state

2020-07-24 Thread Greg KH
On Fri, Jul 24, 2020 at 08:27:35AM +0200, Jiri Slaby wrote:
> Since commit 28bc24fc46f9 (vc: separate state), vc->vc_color is known as
> vc->state.color. Somehow both me and 0-day bot missed this driver during
> the conversion.
> 
> So fix the driver now.
> 
> Signed-off-by: Jiri Slaby 
> Cc: Bartlomiej Zolnierkiewicz 
> Cc: dri-de...@lists.freedesktop.org
> Cc: linux-fb...@vger.kernel.org
> Cc: linux-m...@vger.kernel.org
> ---
>  drivers/video/console/newport_con.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)

You forgot the "Reported-by:" line :(

I'll go add it, thanks for the fix.

greg k-h


Re: [PATCH] newport_con: vc_color is now in state

2020-07-24 Thread Jiri Slaby
On 24. 07. 20, 9:58, Greg KH wrote:
> On Fri, Jul 24, 2020 at 08:27:35AM +0200, Jiri Slaby wrote:
>> Since commit 28bc24fc46f9 (vc: separate state), vc->vc_color is known as
>> vc->state.color. Somehow both me and 0-day bot missed this driver during
>> the conversion.
>>
>> So fix the driver now.
>>
>> Signed-off-by: Jiri Slaby 
>> Cc: Bartlomiej Zolnierkiewicz 
>> Cc: dri-de...@lists.freedesktop.org
>> Cc: linux-fb...@vger.kernel.org
>> Cc: linux-m...@vger.kernel.org
>> ---
>>  drivers/video/console/newport_con.c | 10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> You forgot the "Reported-by:" line :(

Ah, I didn't know/notice. Will do next time. Thanks.


-- 
js
suse labs


Re: [PATCH] PM / devfrq: Fix indentaion of devfreq_summary debugfs node

2020-07-24 Thread Chanwoo Choi
Hi,

On 7/18/20 2:08 AM, Sasha Levin wrote:
> Hi
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag
> fixing commit: 66d0e797bf09 ("Revert "PM / devfreq: Modify the device name as 
> devfreq(X) for sysfs"").
> 
> The bot has tested the following trees: v5.7.8, v5.4.51, v4.19.132, v4.14.188.
> 
> v5.7.8: Build OK!
> v5.4.51: Failed to apply! Possible dependencies:
> 490a421bc575d ("PM / devfreq: Add debugfs support with devfreq_summary 
> file")
> 
> v4.19.132: Failed to apply! Possible dependencies:
> 490a421bc575d ("PM / devfreq: Add debugfs support with devfreq_summary 
> file")
> 
> v4.14.188: Failed to apply! Possible dependencies:
> 490a421bc575d ("PM / devfreq: Add debugfs support with devfreq_summary 
> file")
> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?
> 

The fixes commit was merged to v5.6-rc4. As your test result,
it was possible to build above v5.6. It is not problem. Thanks for your testing.
- 66d0e797bf09 ("Revert "PM / devfreq: Modify the device name as devfreq(X) for 
sysfs"").

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


Re: [PATCH v2 0/2] reset: reset-zynqmp: Added Versal platform support

2020-07-24 Thread Philipp Zabel
On Wed, 2020-07-22 at 12:46 +0530, Sai Krishna Potthuri wrote:
> Extended the ZynqMP reset driver to support Versal platform, accordingly
> updated the dt-binding with the Versal platform specific information
> like compatible string and reset indices.
> 
> Changes in v2:
>  - Updated 1/2 patch commit description with some explanation about
> reset indices.
>  - 2/2 patch, Created SOC specific data structure and initialize the
> const data based on of_device_get_match_data.
>  - Defined driver specific of_xlate callback.
> 
> Sai Krishna Potthuri (2):
>   dt-bindings: reset: Updated binding for Versal reset driver
>   reset: reset-zynqmp: Added support for Versal platform
> 
>  .../bindings/reset/xlnx,zynqmp-reset.txt  |  11 +-
>  drivers/reset/reset-zynqmp.c  |  50 -
>  .../dt-bindings/reset/xlnx-versal-resets.h| 105 ++
>  3 files changed, 156 insertions(+), 10 deletions(-)
>  create mode 100644 include/dt-bindings/reset/xlnx-versal-resets.h

Thank you, applied to reset/next.

regards
Philipp


Re: [PATCH V3 1/3] reset: imx7: Support module build

2020-07-24 Thread Philipp Zabel
On Mon, 2020-07-20 at 22:21 +0800, Anson Huang wrote:
> Use module_platform_driver(), add module device table, author,
> description and license to support module build, and
> CONFIG_RESET_IMX7 is changed to default 'y' ONLY for i.MX7D,
> other platforms need to select it in defconfig.
> 
> Signed-off-by: Anson Huang 
> ---
> Changes since V2:
>   - use module_platform_driver() instead of builtin_platform_driver().

Thank you, applied to reset/next.

regards
Philipp


[PATCH] platform/chrome: cros_ec: Fix host command for regulator control.

2020-07-24 Thread Pi-Hsun Shih
Since the host command number 0x012B conflicts with other EC host
command, add one to all regulator control related host command.

Also fix a wrong alignment on struct and sync the comment with the one
in ChromeOS EC codebase.

Fixes: dff08caf35ec ("platform/chrome: cros_ec: Add command for regulator 
control.")
Signed-off-by: Pi-Hsun Shih 
---
The original numbers were chosen before the 0x012B is used in ChromeOS
EC codebase. Since the original kernel patch got accepted before the
corresponding commit in ChromeOS EC codebase got merged, the host
command number was used by other commit first.

Since now the commit in ChromeOS EC codebase
(https://crrev.com/c/2247431) with updated host command numbers got
merged, need this patch to sync up the host command numbers with
ChromeOS EC codebase. Sorry for the confusion.
---
 include/linux/platform_data/cros_ec_commands.h | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/linux/platform_data/cros_ec_commands.h 
b/include/linux/platform_data/cros_ec_commands.h
index a417b51b5764..91e77f53414d 100644
--- a/include/linux/platform_data/cros_ec_commands.h
+++ b/include/linux/platform_data/cros_ec_commands.h
@@ -5438,7 +5438,7 @@ struct ec_response_rollback_info {
  *
  * Returns the regulator name and supported voltage list in mV.
  */
-#define EC_CMD_REGULATOR_GET_INFO 0x012B
+#define EC_CMD_REGULATOR_GET_INFO 0x012C
 
 /* Maximum length of regulator name */
 #define EC_REGULATOR_NAME_MAX_LEN 16
@@ -5454,12 +5454,12 @@ struct ec_response_regulator_get_info {
char name[EC_REGULATOR_NAME_MAX_LEN];
uint16_t num_voltages;
uint16_t voltages_mv[EC_REGULATOR_VOLTAGE_MAX_COUNT];
-} __ec_align1;
+} __ec_align2;
 
 /*
  * Configure the regulator as enabled / disabled.
  */
-#define EC_CMD_REGULATOR_ENABLE 0x012C
+#define EC_CMD_REGULATOR_ENABLE 0x012D
 
 struct ec_params_regulator_enable {
uint32_t index;
@@ -5471,7 +5471,7 @@ struct ec_params_regulator_enable {
  *
  * Returns 1 if the regulator is enabled, 0 if not.
  */
-#define EC_CMD_REGULATOR_IS_ENABLED 0x012D
+#define EC_CMD_REGULATOR_IS_ENABLED 0x012E
 
 struct ec_params_regulator_is_enabled {
uint32_t index;
@@ -5489,7 +5489,7 @@ struct ec_response_regulator_is_enabled {
  * Also note that this might be called before the regulator is enabled, and the
  * setting should be in effect after the regulator is enabled.
  */
-#define EC_CMD_REGULATOR_SET_VOLTAGE 0x012E
+#define EC_CMD_REGULATOR_SET_VOLTAGE 0x012F
 
 struct ec_params_regulator_set_voltage {
uint32_t index;
@@ -5500,9 +5500,10 @@ struct ec_params_regulator_set_voltage {
 /*
  * Get the currently configured voltage for the voltage regulator.
  *
- * Note that this might be called before the regulator is enabled.
+ * Note that this might be called before the regulator is enabled, and this
+ * should return the configured output voltage if the regulator is enabled.
  */
-#define EC_CMD_REGULATOR_GET_VOLTAGE 0x012F
+#define EC_CMD_REGULATOR_GET_VOLTAGE 0x0130
 
 struct ec_params_regulator_get_voltage {
uint32_t index;

base-commit: 8d9f8d57e023893bfa708d83e3a787e77766a378
-- 
2.28.0.rc0.142.g3c755180ce-goog



[PATCH] octeontx2-af: Fix use of uninitialized pointer bmap

2020-07-24 Thread Dinghao Liu
If req->ctype does not match any of NIX_AQ_CTYPE_CQ,
NIX_AQ_CTYPE_SQ or NIX_AQ_CTYPE_RQ, pointer bmap will remain
uninitialized and be accessed in test_bit(), which can lead
to kernal crash.

Fix this by returning an error code if this case is triggered.

Signed-off-by: Dinghao Liu 
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c 
b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index 36953d4f51c7..20a64ed24474 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -869,19 +869,18 @@ static int nix_lf_hwctx_disable(struct rvu *rvu, struct 
hwctx_disable_req *req)
aq_req.cq_mask.bp_ena = 1;
q_cnt = pfvf->cq_ctx->qsize;
bmap = pfvf->cq_bmap;
-   }
-   if (req->ctype == NIX_AQ_CTYPE_SQ) {
+   } else if (req->ctype == NIX_AQ_CTYPE_SQ) {
aq_req.sq.ena = 0;
aq_req.sq_mask.ena = 1;
q_cnt = pfvf->sq_ctx->qsize;
bmap = pfvf->sq_bmap;
-   }
-   if (req->ctype == NIX_AQ_CTYPE_RQ) {
+   } else if (req->ctype == NIX_AQ_CTYPE_RQ) {
aq_req.rq.ena = 0;
aq_req.rq_mask.ena = 1;
q_cnt = pfvf->rq_ctx->qsize;
bmap = pfvf->rq_bmap;
-   }
+   } else
+   return NIX_AF_ERR_AQ_ENQUEUE;
 
aq_req.ctype = req->ctype;
aq_req.op = NIX_AQ_INSTOP_WRITE;
-- 
2.17.1



Re: [PATCH v4 14/16] arm64: allwinner: A100: add the basical Allwinner A100 DTSI file

2020-07-24 Thread Maxime Ripard
On Fri, Jul 24, 2020 at 02:25:33PM +0800, Frank Lee wrote:
> HI,
> 
> On Fri, Jul 24, 2020 at 12:54 AM Maxime Ripard  wrote:
> >
> > Hi,
> >
> > On Tue, Jul 14, 2020 at 03:20:29PM +0800, Frank Lee wrote:
> > > From: Yangtao Li 
> > >
> > > Allwinner A100 is a new SoC with Cortex-A53 cores, this commit adds
> > > the basical DTSI file of it, including the clock, i2c, pins, sid, ths,
> > > nmi, and UART support.
> > >
> > > Signed-off-by: Yangtao Li 
> > > ---
> > >  .../arm64/boot/dts/allwinner/sun50i-a100.dtsi | 364 ++
> > >  1 file changed, 364 insertions(+)
> > >  create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi
> > >
> > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi 
> > > b/arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi
> > > new file mode 100644
> > > index ..3fb2443f2121
> > > --- /dev/null
> > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi
> > > @@ -0,0 +1,364 @@
> > > +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
> > > +/*
> > > + * Copyright (c) 2020 Yangtao Li 
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +/ {
> > > + interrupt-parent = <>;
> > > + #address-cells = <2>;
> > > + #size-cells = <2>;
> > > +
> > > + cpus {
> > > + #address-cells = <1>;
> > > + #size-cells = <0>;
> > > +
> > > + cpu0: cpu@0 {
> > > + compatible = "arm,armv8";
> >
> > You should use the arm,cortex-a53 compatible here, arm,armv8 is for
> > software models.
> >
> > > + sid@3006000 {
> >
> > The node name is supposed to be the class of the device, and the DT spec
> > defines a list of them already. eeprom would be better suited here.
> 
> EFuse is more accurate?

I missed that efuse got added. Yeah, it's definitely better

Thanks!
Maxime


Re: [PATCH] sched/fair: consider sched-idle CPU when selecting idle core

2020-07-24 Thread Jiang Biao
On Fri, 24 Jul 2020 at 15:24, Vincent Guittot
 wrote:
>
> On Fri, 24 Jul 2020 at 01:39, Jiang Biao  wrote:
> >
> > From: Jiang Biao 
> >
> > Sched-idle CPU has been considered in select_idle_cpu and
> > select_idle_smt, it also needs to be considered in select_idle_core to
> > be consistent and keep the same *idle* policy.
>
> In the case of select_idle_core, we are looking for a core that is
> fully idle but if one CPU of the core is running a sched_idle task,
> the core will not be idle and we might end up having  the wakeup task
> on a CPU and a sched_idle task on another CPU of the core which is not
> what we want
Got it. sched_idle task may interfere its sibling, which brings me
another question,
If there's a core with smt1 running sched_idle task and smt2 idle,
selecting smt1
rather than smt2 should be more helpful for wakee task, because wakee task
could suppress the sched_idle task without neighbour interfering.
And there seems to be no consideration about that currently.
Is it worth improving that?

Thanks a lot.

Regards,
Jiang


Re: [PATCH v5 1/4] riscv: Move kernel mapping to vmalloc zone

2020-07-24 Thread Arnd Bergmann
On Fri, Jul 24, 2020 at 12:34 AM Benjamin Herrenschmidt
 wrote:
> On Thu, 2020-07-23 at 01:21 -0400, Alex Ghiti wrote:
> > > works fine with huge pages, what is your problem there ? You rely on
> > > punching small-page size holes in there ?
> > >
> >
> > ARCH_HAS_STRICT_KERNEL_RWX prevents the use of a hugepage for the kernel
> > mapping in the direct mapping as it sets different permissions to
> > different part of the kernel (data, text..etc).
>
> Ah ok, that can be solved in a couple of ways...
>
> One is to use the linker script to ensure those sections are linked
> HUGE_PAGE_SIZE appart and moved appropriately by early boot code. One
> is to selectively degrade just those huge pages.
>
> I'm not familiar with the RiscV MMU (I should probably go have a look)
> but if it's a classic radix tree with huge pages at PUD/PMD level, then
> you could just degrade the one(s) that cross those boundaries.

That would work, but if the system can otherwise use 1GB-sized pages,
that might mean degrading the first gigabyte into a mix of 2MB pages
and 4KB pages.

If the kernel is in vmalloc space and vmap is able to use 2MB pages
for contiguous chunks of the mapping, you get a somewhat better
TLB usage.

However, this also means that a writable mapping exists in the
linear mapping for any executable part of the kernel (.text in
both vmlinux and modules). Do we have that on other architectures
as well, or is this something that ought to be prevented with
STRICT_KERNEL_RWX/STRICT_MODULE_RWX?

 Arnd


Re: [PATCH -next] arm64: Export __cpu_logical_map

2020-07-24 Thread Anshuman Khandual


On 07/24/2020 08:38 AM, Kefeng Wang wrote:
> +maillist

This does not seem to be a correct method of posting any patch.

> 
> On 2020/7/24 11:04, Kefeng Wang wrote:
>> ERROR: modpost: "__cpu_logical_map" [drivers/cpufreq/tegra194-cpufreq.ko] 
>> undefined!


>>
>> ARM64 tegra194-cpufreq driver use cpu_logical_map, export
>> __cpu_logical_map to fix build issue.

Commit 887d5fc82cb4 ("cpufreq: Add Tegra194 cpufreq driver") which adds
this particular driver is present just on linux-next. But as expected,
the driver does not use __cpu_logical_map directly but instead accesses
it via cpu_logical_map() wrapper. Wondering, how did you even trigger
the modpost error ?

>>
>> Reported-by: Hulk Robot 
>> Signed-off-by: Kefeng Wang 
>> ---
>>   arch/arm64/kernel/setup.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
>> index c793276ec7ad9..3aea05fbb9998 100644
>> --- a/arch/arm64/kernel/setup.c
>> +++ b/arch/arm64/kernel/setup.c
>> @@ -275,6 +275,7 @@ static int __init reserve_memblock_reserved_regions(void)
>>   arch_initcall(reserve_memblock_reserved_regions);
>>     u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
>> +EXPORT_SYMBOL(__cpu_logical_map);
>>     void __init setup_arch(char **cmdline_p)
>>   {
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


Re: [PATCH v3 5/6] powerpc/pseries: implement paravirt qspinlocks for SPLPAR

2020-07-24 Thread Will Deacon
On Thu, Jul 23, 2020 at 08:47:59PM +0200, pet...@infradead.org wrote:
> On Thu, Jul 23, 2020 at 02:32:36PM -0400, Waiman Long wrote:
> > BTW, do you have any comment on my v2 lock holder cpu info qspinlock patch?
> > I will have to update the patch to fix the reported 0-day test problem, but
> > I want to collect other feedback before sending out v3.
> 
> I want to say I hate it all, it adds instructions to a path we spend an
> aweful lot of time optimizing without really getting anything back for
> it.
> 
> Will, how do you feel about it?

I can see it potentially being useful for debugging, but I hate the
limitation to 256 CPUs. Even arm64 is hitting that now.

Also, you're talking ~1% gains here. I think our collective time would
be better spent off reviewing the CNA series and trying to make it more
deterministic.

Will


Re: [PATCH v2 1/3] mm/shuffle: don't move pages between zones and don't read garbage memmaps

2020-07-24 Thread David Hildenbrand
On 24.07.20 05:08, Andrew Morton wrote:
> On Tue, 23 Jun 2020 17:30:18 +0800 Wei Yang 
>  wrote:
> 
>> On Tue, Jun 23, 2020 at 09:55:43AM +0200, David Hildenbrand wrote:
>>> On 23.06.20 09:39, David Hildenbrand wrote:
> Hmm.. I thought this is the behavior for early section, while it looks 
> current
> code doesn't work like this:
>
>if (section_is_early && memmap)
>free_map_bootmem(memmap);
>else
>  depopulate_section_memmap(pfn, nr_pages, altmap);
>
> section_is_early is always "true" for early section, while memmap is 
> not-NULL
> only when sub-section map is empty.
>
> If my understanding is correct, when we remove a sub-section in early 
> section,
> the code would call depopulate_section_memmap(), which in turn free 
> related
> memmap. By removing the memmap, the return value from 
> pfn_to_online_page() is
> not a valid one.

 I think you're right, and pfn_valid() would also return true, as it is
 an early section. This looks broken.

>
> Maybe we want to write the code like this:
>
>if (section_is_early)
>if (memmap)
>free_map_bootmem(memmap);
>else
>  depopulate_section_memmap(pfn, nr_pages, altmap);
>

 I guess that should be the way to go

 @Dan, I think what Wei proposes here is correct, right? Or how does it
 work in the VMEMMAP case with early sections?

>>>
>>> Especially, if you would re-hot-add, section_activate() would assume
>>> there is a memmap, it must not be removed.
>>>
>>
>> You are right here. I didn't notice it.
>>
>>> @Wei, can you send a patch?
>>>
>>
>> Sure, let me prepare for it.
> 
> Still awaiting this, and the v3 patch was identical to this v2 patch.
> 
> It's tagged for -stable, so there's some urgency.  Should we just go
> ahead with the decently-tested v2?

This patch (mm/shuffle: don't move pages between zones and don't read
garbage memmaps) is good enough for upstream. While the issue reported
by Wei was valid (and needs to be fixed), the user in this patch is just
one of many affected users. Nothing special.

-- 
Thanks,

David / dhildenb



Re: [PATCH 3/3] sparc: Drop unused MAX_PHYSADDR_BITS

2020-07-24 Thread David Hildenbrand
On 24.07.20 01:15, Arvind Sankar wrote:
> The macro is not used anywhere, so remove the definition.
> 
> Signed-off-by: Arvind Sankar 
> ---
>  arch/sparc/include/asm/sparsemem.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/sparc/include/asm/sparsemem.h 
> b/arch/sparc/include/asm/sparsemem.h
> index 1dd1b61432db..aa9a676bc341 100644
> --- a/arch/sparc/include/asm/sparsemem.h
> +++ b/arch/sparc/include/asm/sparsemem.h
> @@ -7,7 +7,6 @@
>  #include 
>  
>  #define SECTION_SIZE_BITS   30
> -#define MAX_PHYSADDR_BITS   MAX_PHYS_ADDRESS_BITS
>  #define MAX_PHYSMEM_BITSMAX_PHYS_ADDRESS_BITS
>  
>  #endif /* !(__KERNEL__) */
> 

Reviewed-by: David Hildenbrand 

-- 
Thanks,

David / dhildenb



Re: [PATCH 2/3] sh/mm: Drop unused MAX_PHYSADDR_BITS

2020-07-24 Thread David Hildenbrand
On 24.07.20 01:15, Arvind Sankar wrote:
> The macro is not used anywhere, so remove the definition.
> 
> Signed-off-by: Arvind Sankar 
> ---
>  arch/sh/include/asm/sparsemem.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/sh/include/asm/sparsemem.h b/arch/sh/include/asm/sparsemem.h
> index 4eb899751e45..084706bb8cca 100644
> --- a/arch/sh/include/asm/sparsemem.h
> +++ b/arch/sh/include/asm/sparsemem.h
> @@ -5,11 +5,9 @@
>  #ifdef __KERNEL__
>  /*
>   * SECTION_SIZE_BITS 2^N: how big each section will be
> - * MAX_PHYSADDR_BITS 2^N: how much physical address space we have
> - * MAX_PHYSMEM_BITS  2^N: how much memory we can have in that space
> + * MAX_PHYSMEM_BITS  2^N: how much physical address space we have
>   */
>  #define SECTION_SIZE_BITS26
> -#define MAX_PHYSADDR_BITS32
>  #define MAX_PHYSMEM_BITS 32
>  
>  #endif
> 

Reviewed-by: David Hildenbrand 

-- 
Thanks,

David / dhildenb



Re: [PATCH 1/3] x86/mm: Drop unused MAX_PHYSADDR_BITS

2020-07-24 Thread David Hildenbrand
On 24.07.20 01:15, Arvind Sankar wrote:
> The macro is not used anywhere, and has an incorrect value (going by the
> comment) on x86_64 since commit
>   c898faf91b3e ("x86: 46 bit physical address support on 64 bits")
> 
> To avoid confusion, just remove the definition.
> 
> Signed-off-by: Arvind Sankar 
> ---
>  arch/x86/include/asm/sparsemem.h | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/sparsemem.h 
> b/arch/x86/include/asm/sparsemem.h
> index 199218719a86..6bfc878f6771 100644
> --- a/arch/x86/include/asm/sparsemem.h
> +++ b/arch/x86/include/asm/sparsemem.h
> @@ -10,24 +10,20 @@
>   *field of the struct page
>   *
>   * SECTION_SIZE_BITS 2^n: size of each section
> - * MAX_PHYSADDR_BITS 2^n: max size of physical address space
> - * MAX_PHYSMEM_BITS  2^n: how much memory we can have in that space
> + * MAX_PHYSMEM_BITS  2^n: max size of physical address space
>   *
>   */
>  
>  #ifdef CONFIG_X86_32
>  # ifdef CONFIG_X86_PAE
>  #  define SECTION_SIZE_BITS  29
> -#  define MAX_PHYSADDR_BITS  36
>  #  define MAX_PHYSMEM_BITS   36
>  # else
>  #  define SECTION_SIZE_BITS  26
> -#  define MAX_PHYSADDR_BITS  32
>  #  define MAX_PHYSMEM_BITS   32
>  # endif
>  #else /* CONFIG_X86_32 */
>  # define SECTION_SIZE_BITS   27 /* matt - 128 is convenient right now */
> -# define MAX_PHYSADDR_BITS   (pgtable_l5_enabled() ? 52 : 44)
>  # define MAX_PHYSMEM_BITS(pgtable_l5_enabled() ? 52 : 46)
>  #endif
>  
> 

Reviewed-by: David Hildenbrand 

-- 
Thanks,

David / dhildenb



Re: [PATCH v2] fbdev: Detect integer underflow at "struct fbcon_ops"->clear_margins.

2020-07-24 Thread Bartlomiej Zolnierkiewicz


On 7/23/20 4:21 PM, Greg Kroah-Hartman wrote:
> On Wed, Jul 22, 2020 at 10:07:06AM +0200, Daniel Vetter wrote:
>> On Tue, Jul 21, 2020 at 6:08 PM Greg Kroah-Hartman
>>  wrote:
>>>
>>> On Thu, Jul 16, 2020 at 08:27:21PM +0900, Tetsuo Handa wrote:
 On 2020/07/16 19:00, Daniel Vetter wrote:
> On Thu, Jul 16, 2020 at 12:29:00AM +0900, Tetsuo Handa wrote:
>> On 2020/07/16 0:12, Dan Carpenter wrote:
>>> I've complained about integer overflows in fbdev for a long time...
>>>
>>> What I'd like to see is something like the following maybe.  I don't
>>> know how to get the vc_data in fbmem.c so it doesn't include your checks
>>> for negative.
>>
>> Yes. Like I said "Thus, I consider that we need more sanity/constraints 
>> checks." at
>> https://lore.kernel.org/lkml/b1e7dd6a-fc22-bba8-0abb-d3e779329...@i-love.sakura.ne.jp/
>>  ,
>> we want basic checks. That's a task for fbdev people who should be 
>> familiar with
>> necessary constraints.
>
> I think the worldwide supply of people who understand fbdev and willing to
> work on it is roughly 0. So if someone wants to fix this mess properly
> (which likely means adding tons of over/underflow checks at entry points,
> since you're never going to catch the driver bugs, there's too many and
> not enough people who care) they need to fix this themselves.

 But I think we can enforce reasonable constraint which is much stricter 
 than Dan's basic_checks()
 (which used INT_MAX). For example, do we need to accept var->{xres,yres} 
 >= 1048576, for
 "32768 rows or cols" * "32 pixels per character" = 1045876 and 
 vc_do_resize() accepts only
 rows and cols < 32768 ?

>
> Just to avoid confusion here.
>
>> Anyway, my two patches are small and low cost; can we apply these 
>> patches regardless
>> of basic checks?
>
> Which two patches where?

 [PATCH v3] vt: Reject zero-sized screen buffer size.
  from 
 https://lkml.kernel.org/r/20200712111013.11881-1-penguin-ker...@i-love.sakura.ne.jp
>>>
>>> This is now in my tree.
>>>
 [PATCH v2] fbdev: Detect integer underflow at "struct 
 fbcon_ops"->clear_margins.
  from 
 https://lkml.kernel.org/r/20200715015102.3814-1-penguin-ker...@i-love.sakura.ne.jp
>>>
>>> That should be taken by the fbdev maintainer, but I can take it too if
>>> people want.
>>
>> Just missed this weeks pull request train and feeling like not worth
>> making this an exception (it's been broken forever after all), so
>> maybe best if you just add this to vt.
>>
>> Acked-by: Daniel Vetter 
>>
>> Also this avoids the impression I know what's going on in fbdev code,
>> maybe with sufficient abandon from my side someone will pop up who
>> cares an fixes the bazillion of syzkaller issues we seem to have
>> around console/vt and everything related.
> 
> Great, will go queue it up now, thanks!
Fine with me, thanks!

PS I'll later queue the patch from George to drm-misc-next (after
reading both fbdev patches in detail it seems that both are needed).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics


Re: [RFC PATCH] usb: dwc3: fix maximum_speed check for usb2.0-only core

2020-07-24 Thread Chunfeng Yun
On Fri, 2020-07-24 at 03:32 +, Thinh Nguyen wrote:
> Hi,
> 
> Thinh Nguyen wrote:
> > Hi,
> >
> > Chunfeng Yun wrote:
> >> The maximum_speed will be USB_SPEED_SUPER_PLUS, but the
> >> maximum_speed check for usb2.0-only core doesn't consider it,
> >> so fix it, and move the ckeck into dwc3_check_params().
> >>
> >> Signed-off-by: Chunfeng Yun 
> >> ---
> >> Note:
> >>
> >> When I look at the code, find that this may be a problem, but no
> >> platform to test it.
> >> ---
> >>drivers/usb/dwc3/core.c | 14 +++---
> >>1 file changed, 7 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> >> index 25c686a7..ffd5ab3 100644
> >> --- a/drivers/usb/dwc3/core.c
> >> +++ b/drivers/usb/dwc3/core.c
> >> @@ -930,13 +930,6 @@ static int dwc3_core_init(struct dwc3 *dwc)
> >> */
> >>dwc3_writel(dwc->regs, DWC3_GUID, LINUX_VERSION_CODE);
> >>
> >> -  /* Handle USB2.0-only core configuration */
> >> -  if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
> >> -  DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
> >> -  if (dwc->maximum_speed == USB_SPEED_SUPER)
> >> -  dwc->maximum_speed = USB_SPEED_HIGH;
> >> -  }
> >> -
> >>ret = dwc3_phy_setup(dwc);
> >>if (ret)
> >>goto err0;
> >> @@ -1426,6 +1419,13 @@ static void dwc3_check_params(struct dwc3 *dwc)
> >>
> >>break;
> >>}
> >> +
> >> +  /* Handle USB2.0-only core configuration */
> >> +  if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
> >> +  DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
> >> +  if (dwc->maximum_speed > USB_SPEED_HIGH)
> >> +  dwc->maximum_speed = USB_SPEED_HIGH;
> >> +  }
> >>}
> >>
> >>static int dwc3_probe(struct platform_device *pdev)
> > Actually, the dwc->maximum_speed captures the maximum speed device
> > property value. It maybe be set based on the phy's capability if there's
> > no property specifying it (i.e. maximum_speed is USB_SPEED_UNKNOWN).
> >
> > So, this code should be removed. The fix should be in the check of
> > dwc3_check_params(). If maximum_speed = USB_SPEED_UNKNOWN and the phy's
> > capability is only up to highspeed, then set the maximum_speed to
> > highspeed only.
Sorry for the late reply, my outlook lose your email.
> >
> 
> Are you going into update and resend this patch?
I don't know how to check "the phy's capability is only up to highspeed"

>  If not I can create one 
> and add your "Reported-by"
Ok, thanks

> 
> BR,
> Thinh



Re: [PATCH] soundwire: master: enable pm runtime

2020-07-24 Thread Greg KH
On Thu, Jul 23, 2020 at 09:49:02PM +0800, Bard Liao wrote:
> We should enable pm runtime.

Because why?

Please read the documentation about how to write good changelog
comments...

greg k-h


Re: [PATCH] perf: arm-spe: Fix check error when synthesizing events

2020-07-24 Thread Leo Yan
Hi Wei,

On Fri, Jul 24, 2020 at 03:26:28PM +0800, Wei Li wrote:
> In arm_spe_read_record(), when we are processing an events packet,
> 'decoder->packet.index' is the length of payload, which has been
> transformed in payloadlen(). So correct the check of 'idx'.
>
> Signed-off-by: Wei Li 

Good catch.  I checked the ARMv8 ARM and the function payloadlen(),
can confirm the fixing is correct.

Reviewed-by: Leo Yan 

> ---
>  tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c 
> b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> index 302a14d0aca9..93e063f22be5 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> @@ -182,15 +182,15 @@ static int arm_spe_read_record(struct arm_spe_decoder 
> *decoder)
>   if (payload & BIT(EV_TLB_ACCESS))
>   decoder->record.type |= ARM_SPE_TLB_ACCESS;
>  
> - if ((idx == 1 || idx == 2 || idx == 3) &&
> + if ((idx == 2 || idx == 4 || idx == 8) &&
>   (payload & BIT(EV_LLC_MISS)))
>   decoder->record.type |= ARM_SPE_LLC_MISS;
>  
> - if ((idx == 1 || idx == 2 || idx == 3) &&
> + if ((idx == 2 || idx == 4 || idx == 8) &&
>   (payload & BIT(EV_LLC_ACCESS)))
>   decoder->record.type |= ARM_SPE_LLC_ACCESS;
>  
> - if ((idx == 1 || idx == 2 || idx == 3) &&
> + if ((idx == 2 || idx == 4 || idx == 8) &&
>   (payload & BIT(EV_REMOTE_ACCESS)))
>   decoder->record.type |= ARM_SPE_REMOTE_ACCESS;
>  
> -- 
> 2.17.1
> 


[tip: sched/fifo] sched: Remove sched_set_*() return value

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 8b700983de82f79e05b2c1136d6513ea4c9b22c4
Gitweb:
https://git.kernel.org/tip/8b700983de82f79e05b2c1136d6513ea4c9b22c4
Author:Peter Zijlstra 
AuthorDate:Wed, 22 Apr 2020 13:10:04 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:26 +02:00

sched: Remove sched_set_*() return value

Ingo suggested that since the new sched_set_*() functions are
implemented using the 'nocheck' variants, they really shouldn't ever
fail, so remove the return value.

Cc: ax...@kernel.dk
Cc: daniel.lezc...@linaro.org
Cc: sudeep.ho...@arm.com
Cc: airl...@redhat.com
Cc: broo...@kernel.org
Cc: paul...@kernel.org
Suggested-by: Ingo Molnar 
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/block/drbd/drbd_receiver.c|  4 +---
 drivers/firmware/psci/psci_checker.c  |  3 +--
 drivers/gpu/drm/msm/msm_drv.c |  5 +
 drivers/platform/chrome/cros_ec_spi.c |  7 +++
 include/linux/sched.h |  6 +++---
 kernel/rcu/rcutorture.c   |  5 +
 kernel/sched/core.c   | 12 ++--
 7 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 140fd98..280615e 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -6020,9 +6020,7 @@ int drbd_ack_receiver(struct drbd_thread *thi)
int expect   = header_size;
bool ping_timeout_active = false;
 
-   rv = sched_set_fifo_low(current);
-   if (rv < 0)
-   drbd_err(connection, "drbd_ack_receiver: ERROR set priority, 
ret=%d\n", rv);
+   sched_set_fifo_low(current);
 
while (get_t_state(thi) == RUNNING) {
drbd_thread_current_set_cpu(thi);
diff --git a/drivers/firmware/psci/psci_checker.c 
b/drivers/firmware/psci/psci_checker.c
index a5279a4..6fff482 100644
--- a/drivers/firmware/psci/psci_checker.c
+++ b/drivers/firmware/psci/psci_checker.c
@@ -281,8 +281,7 @@ static int suspend_test_thread(void *arg)
wait_for_completion(_threads_started);
 
/* Set maximum priority to preempt all other threads on this CPU. */
-   if (sched_set_fifo(current))
-   pr_warn("Failed to set suspend thread scheduler on CPU %d\n", 
cpu);
+   sched_set_fifo(current);
 
dev = this_cpu_read(cpuidle_devices);
drv = cpuidle_get_cpu_driver(dev);
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 89a8b9c..556cca3 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -509,10 +509,7 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
goto err_msm_uninit;
}
 
-   ret = sched_set_fifo(priv->event_thread[i].thread);
-   if (ret)
-   dev_warn(dev, "event_thread set priority failed:%d\n",
-ret);
+   sched_set_fifo(priv->event_thread[i].thread);
}
 
ret = drm_vblank_init(ddev, priv->num_crtcs);
diff --git a/drivers/platform/chrome/cros_ec_spi.c 
b/drivers/platform/chrome/cros_ec_spi.c
index c20a43a..d092603 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -725,10 +725,9 @@ static int cros_ec_spi_devm_high_pri_alloc(struct device 
*dev,
if (err)
return err;
 
-   err = sched_set_fifo(ec_spi->high_pri_worker->task);
-   if (err)
-   dev_err(dev, "Can't set cros_ec high pri priority: %d\n", err);
-   return err;
+   sched_set_fifo(ec_spi->high_pri_worker->task);
+
+   return 0;
 }
 
 static int cros_ec_spi_probe(struct spi_device *spi)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b792b8f..ae76644 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1653,9 +1653,9 @@ extern int idle_cpu(int cpu);
 extern int available_idle_cpu(int cpu);
 extern int sched_setscheduler(struct task_struct *, int, const struct 
sched_param *);
 extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct 
sched_param *);
-extern int sched_set_fifo(struct task_struct *p);
-extern int sched_set_fifo_low(struct task_struct *p);
-extern int sched_set_normal(struct task_struct *p, int nice);
+extern void sched_set_fifo(struct task_struct *p);
+extern void sched_set_fifo_low(struct task_struct *p);
+extern void sched_set_normal(struct task_struct *p, int nice);
 extern int sched_setattr(struct task_struct *, const struct sched_attr *);
 extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr 
*);
 extern struct task_struct *idle_task(int cpu);
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index bbc3c8a..b4c1146 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -893,10 +893,7 @@ static int 

[tip: sched/fifo] sched: Remove sched_setscheduler*() EXPORTs

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 616d91b68cd56bcb1954b6a5af7d542401fde772
Gitweb:
https://git.kernel.org/tip/616d91b68cd56bcb1954b6a5af7d542401fde772
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:25 +02:00

sched: Remove sched_setscheduler*() EXPORTs

Now that nothing (modular) still uses sched_setscheduler(), remove the
exports.

Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 kernel/sched/core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 40d3939..f882d3d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5135,13 +5135,11 @@ int sched_setscheduler(struct task_struct *p, int 
policy,
 {
return _sched_setscheduler(p, policy, param, true);
 }
-EXPORT_SYMBOL_GPL(sched_setscheduler);
 
 int sched_setattr(struct task_struct *p, const struct sched_attr *attr)
 {
return __sched_setscheduler(p, attr, true, true);
 }
-EXPORT_SYMBOL_GPL(sched_setattr);
 
 int sched_setattr_nocheck(struct task_struct *p, const struct sched_attr *attr)
 {
@@ -5166,7 +5164,6 @@ int sched_setscheduler_nocheck(struct task_struct *p, int 
policy,
 {
return _sched_setscheduler(p, policy, param, false);
 }
-EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
 
 /*
  * SCHED_FIFO is a broken scheduler model; that is, it is fundamentally


[tip: sched/fifo] sched,crypto: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: dbc6d0d5a5467adb6ea5fb25844e471c7bf8fabf
Gitweb:
https://git.kernel.org/tip/dbc6d0d5a5467adb6ea5fb25844e471c7bf8fabf
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:20 +02:00

sched,crypto: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Use sched_set_fifo() to request SCHED_FIFO and delegate
actual priority selection to userspace. Effectively no change in
behaviour.

Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Acked-by: Herbert Xu 
---
 crypto/crypto_engine.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c
index 3655d9d..198a8eb 100644
--- a/crypto/crypto_engine.c
+++ b/crypto/crypto_engine.c
@@ -482,7 +482,6 @@ struct crypto_engine 
*crypto_engine_alloc_init_and_set(struct device *dev,
   int 
(*cbk_do_batch)(struct crypto_engine *engine),
   bool rt, int qlen)
 {
-   struct sched_param param = { .sched_priority = MAX_RT_PRIO / 2 };
struct crypto_engine *engine;
 
if (!dev)
@@ -520,7 +519,7 @@ struct crypto_engine 
*crypto_engine_alloc_init_and_set(struct device *dev,
 
if (engine->rt) {
dev_info(dev, "will run requests pump with realtime 
priority\n");
-   sched_setscheduler(engine->kworker->task, SCHED_FIFO, );
+   sched_set_fifo(engine->kworker->task);
}
 
return engine;


[tip: sched/fifo] sched,powerclamp: Convert to sched_set_fifo()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: a2bee0662f72fcbd248a424a1453dd946dcdaf3d
Gitweb:
https://git.kernel.org/tip/a2bee0662f72fcbd248a424a1453dd946dcdaf3d
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:23 +02:00

sched,powerclamp: Convert to sched_set_fifo()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Cc: rafael.j.wyso...@intel.com
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/thermal/intel/intel_powerclamp.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/thermal/intel/intel_powerclamp.c 
b/drivers/thermal/intel/intel_powerclamp.c
index f74b247..b0eb5ec 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -70,9 +70,6 @@ static unsigned int control_cpu; /* The cpu assigned to 
collect stat and update
  */
 static bool clamping;
 
-static const struct sched_param sparam = {
-   .sched_priority = MAX_USER_RT_PRIO / 2,
-};
 struct powerclamp_worker_data {
struct kthread_worker *worker;
struct kthread_work balancing_work;
@@ -488,7 +485,7 @@ static void start_power_clamp_worker(unsigned long cpu)
w_data->cpu = cpu;
w_data->clamping = true;
set_bit(cpu, cpu_clamping_mask);
-   sched_setscheduler(worker->task, SCHED_FIFO, );
+   sched_set_fifo(worker->task);
kthread_init_work(_data->balancing_work, clamp_balancing_func);
kthread_init_delayed_work(_data->idle_injection_work,
  clamp_idle_injection_func);


[tip: sched/fifo] sched,acpi_pad: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 4ca6c1a060943161c6c2ce09e02ed58a69669cfe
Gitweb:
https://git.kernel.org/tip/4ca6c1a060943161c6c2ce09e02ed58a69669cfe
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:20 +02:00

sched,acpi_pad: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

In this case, use fifo_low, because it only cares about being above
SCHED_NORMAL. Effectively no change in behaviour.

XXX: this driver is still complete crap; why isn't it using proper
idle injection or at the very least play_idle() ?

Cc: rafael.j.wyso...@intel.com
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/acpi/acpi_pad.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index e7dc013..0ad9f20 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -136,12 +136,11 @@ static unsigned int idle_pct = 5; /* percentage */
 static unsigned int round_robin_time = 1; /* second */
 static int power_saving_thread(void *data)
 {
-   struct sched_param param = {.sched_priority = 1};
int do_sleep;
unsigned int tsk_index = (unsigned long)data;
u64 last_jiffies = 0;
 
-   sched_setscheduler(current, SCHED_RR, );
+   sched_set_fifo_low(current);
 
while (!kthread_should_stop()) {
unsigned long expire_time;


[tip: sched/fifo] sched,irq: Convert to sched_set_fifo()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 7a40798c714ff462863352d490b382515daba49e
Gitweb:
https://git.kernel.org/tip/7a40798c714ff462863352d490b382515daba49e
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:24 +02:00

sched,irq: Convert to sched_set_fifo()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Cc: t...@linutronix.de
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 kernel/irq/manage.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 7619111..06b6274 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1271,9 +1271,6 @@ static int
 setup_irq_thread(struct irqaction *new, unsigned int irq, bool secondary)
 {
struct task_struct *t;
-   struct sched_param param = {
-   .sched_priority = MAX_USER_RT_PRIO/2,
-   };
 
if (!secondary) {
t = kthread_create(irq_thread, new, "irq/%d-%s", irq,
@@ -1281,13 +1278,12 @@ setup_irq_thread(struct irqaction *new, unsigned int 
irq, bool secondary)
} else {
t = kthread_create(irq_thread, new, "irq/%d-s-%s", irq,
   new->name);
-   param.sched_priority -= 1;
}
 
if (IS_ERR(t))
return PTR_ERR(t);
 
-   sched_setscheduler_nocheck(t, SCHED_FIFO, );
+   sched_set_fifo(t);
 
/*
 * We keep the reference to the task struct even if


[tip: sched/fifo] sched,msm: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 64419ca67622974f46bf053a7e745d2d0d1c43ef
Gitweb:
https://git.kernel.org/tip/64419ca67622974f46bf053a7e745d2d0d1c43ef
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:21 +02:00

sched,msm: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Use sched_set_fifo(); Effectively changes prio from 16 to 50.

Cc: airl...@redhat.com
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/gpu/drm/msm/msm_drv.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index f6ce40b..89a8b9c 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -389,7 +389,6 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
struct msm_kms *kms;
struct msm_mdss *mdss;
int ret, i;
-   struct sched_param param;
 
ddev = drm_dev_alloc(drv, dev);
if (IS_ERR(ddev)) {
@@ -495,12 +494,6 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
ddev->mode_config.funcs = _config_funcs;
ddev->mode_config.helper_private = _config_helper_funcs;
 
-   /**
-* this priority was found during empiric testing to have appropriate
-* realtime scheduling to process display updates and interact with
-* other real time and normal priority task
-*/
-   param.sched_priority = 16;
for (i = 0; i < priv->num_crtcs; i++) {
/* initialize event thread */
priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
@@ -516,8 +509,7 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
goto err_msm_uninit;
}
 
-   ret = sched_setscheduler(priv->event_thread[i].thread,
-SCHED_FIFO, );
+   ret = sched_set_fifo(priv->event_thread[i].thread);
if (ret)
dev_warn(dev, "event_thread set priority failed:%d\n",
 ret);


[tip: sched/fifo] sched,drbd: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: c9ec0524706e580c78c61e38ef5e7761ed2f8485
Gitweb:
https://git.kernel.org/tip/c9ec0524706e580c78c61e38ef5e7761ed2f8485
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:21 +02:00

sched,drbd: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

In this case, use fifo_low, because it only cares about being above
SCHED_NORMAL. Effectively changes prio from 2 to 1.

Cc: ax...@kernel.dk
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/block/drbd/drbd_receiver.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 3a3f2b6..140fd98 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -6019,9 +6019,8 @@ int drbd_ack_receiver(struct drbd_thread *thi)
unsigned int header_size = drbd_header_size(connection);
int expect   = header_size;
bool ping_timeout_active = false;
-   struct sched_param param = { .sched_priority = 2 };
 
-   rv = sched_setscheduler(current, SCHED_RR, );
+   rv = sched_set_fifo_low(current);
if (rv < 0)
drbd_err(connection, "drbd_ack_receiver: ERROR set priority, 
ret=%d\n", rv);
 


[tip: sched/fifo] sched,drm/scheduler: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 7b31e940b17bc47ca2f5e332c166231f01317469
Gitweb:
https://git.kernel.org/tip/7b31e940b17bc47ca2f5e332c166231f01317469
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:21 +02:00

sched,drm/scheduler: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

In this case, use fifo_low, because it only cares about being above
SCHED_NORMAL. Effectively no change in behaviour.

Cc: alexander.deuc...@amd.com
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/gpu/drm/scheduler/sched_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
b/drivers/gpu/drm/scheduler/sched_main.c
index 2f31910..17cf77e 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -760,11 +760,10 @@ static bool drm_sched_blocked(struct drm_gpu_scheduler 
*sched)
  */
 static int drm_sched_main(void *param)
 {
-   struct sched_param sparam = {.sched_priority = 1};
struct drm_gpu_scheduler *sched = (struct drm_gpu_scheduler *)param;
int r;
 
-   sched_setscheduler(current, SCHED_FIFO, );
+   sched_set_fifo_low(current);
 
while (!kthread_should_stop()) {
struct drm_sched_entity *entity = NULL;


[tip: sched/fifo] sched,bL_switcher: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 0030c1d4a38757fb54a0c96e5e8b59cc0c4f3f28
Gitweb:
https://git.kernel.org/tip/0030c1d4a38757fb54a0c96e5e8b59cc0c4f3f28
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:20 +02:00

sched,bL_switcher: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

In this case, use fifo_low, because it only cares about being above
SCHED_NORMAL. Effectively no change in behaviour.

Cc: rmk+ker...@arm.linux.org.uk
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Acked-by: Nicolas Pitre 
---
 arch/arm/common/bL_switcher.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index 746e1fc..9a9aa53 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -270,12 +270,11 @@ static struct bL_thread bL_threads[NR_CPUS];
 static int bL_switcher_thread(void *arg)
 {
struct bL_thread *t = arg;
-   struct sched_param param = { .sched_priority = 1 };
int cluster;
bL_switch_completion_handler completer;
void *completer_cookie;
 
-   sched_setscheduler_nocheck(current, SCHED_FIFO, );
+   sched_set_fifo_low(current);
complete(>started);
 
do {


[tip: sched/fifo] sched,psci: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 6e6d6efabd2567337f7d97791f7a60aa5fdbcfc2
Gitweb:
https://git.kernel.org/tip/6e6d6efabd2567337f7d97791f7a60aa5fdbcfc2
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:21 +02:00

sched,psci: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively changes prio from 99 to 50.

XXX this thing is horrific, it basically open-codes a stop-machine and
idle.

Cc: daniel.lezc...@linaro.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Acked-by: Valentin Schneider 
Tested-by: Sudeep Holla 
---
 drivers/firmware/psci/psci_checker.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/psci/psci_checker.c 
b/drivers/firmware/psci/psci_checker.c
index 873841a..a5279a4 100644
--- a/drivers/firmware/psci/psci_checker.c
+++ b/drivers/firmware/psci/psci_checker.c
@@ -272,7 +272,6 @@ static int suspend_test_thread(void *arg)
 {
int cpu = (long)arg;
int i, nb_suspend = 0, nb_shallow_sleep = 0, nb_err = 0;
-   struct sched_param sched_priority = { .sched_priority = MAX_RT_PRIO-1 };
struct cpuidle_device *dev;
struct cpuidle_driver *drv;
/* No need for an actual callback, we just want to wake up the CPU. */
@@ -282,9 +281,8 @@ static int suspend_test_thread(void *arg)
wait_for_completion(_threads_started);
 
/* Set maximum priority to preempt all other threads on this CPU. */
-   if (sched_setscheduler_nocheck(current, SCHED_FIFO, _priority))
-   pr_warn("Failed to set suspend thread scheduler on CPU %d\n",
-   cpu);
+   if (sched_set_fifo(current))
+   pr_warn("Failed to set suspend thread scheduler on CPU %d\n", 
cpu);
 
dev = this_cpu_read(cpuidle_devices);
drv = cpuidle_get_cpu_driver(dev);
@@ -349,11 +347,6 @@ static int suspend_test_thread(void *arg)
if (atomic_dec_return_relaxed(_active_threads) == 0)
complete(_threads_done);
 
-   /* Give up on RT scheduling and wait for termination. */
-   sched_priority.sched_priority = 0;
-   if (sched_setscheduler_nocheck(current, SCHED_NORMAL, _priority))
-   pr_warn("Failed to set suspend thread scheduler on CPU %d\n",
-   cpu);
for (;;) {
/* Needs to be set first to avoid missing a wakeup. */
set_current_state(TASK_INTERRUPTIBLE);


[tip: sched/fifo] sched: Provide sched_set_fifo()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 7318d4cc14c8c8a5dde2b0b72ea50fd2545f0b7a
Gitweb:
https://git.kernel.org/tip/7318d4cc14c8c8a5dde2b0b72ea50fd2545f0b7a
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:20 +02:00

sched: Provide sched_set_fifo()

SCHED_FIFO (or any static priority scheduler) is a broken scheduler
model; it is fundamentally incapable of resource management, the one
thing an OS is actually supposed to do.

It is impossible to compose static priority workloads. One cannot take
two well designed and functional static priority workloads and mash
them together and still expect them to work.

Therefore it doesn't make sense to expose the priority field; the
kernel is fundamentally incapable of setting a sensible value, it
needs systems knowledge that it doesn't have.

Take away sched_setschedule() / sched_setattr() from modules and
replace them with:

  - sched_set_fifo(p); create a FIFO task (at prio 50)
  - sched_set_fifo_low(p); create a task higher than NORMAL,
which ends up being a FIFO task at prio 1.
  - sched_set_normal(p, nice); (re)set the task to normal

This stops the proliferation of randomly chosen, and irrelevant, FIFO
priorities that dont't really mean anything anyway.

The system administrator/integrator, whoever has insight into the
actual system design and requirements (userspace) can set-up
appropriate priorities if and when needed.

Cc: airl...@redhat.com
Cc: alexander.deuc...@amd.com
Cc: awa...@md.metrocast.net
Cc: ax...@kernel.dk
Cc: broo...@kernel.org
Cc: daniel.lezc...@linaro.org
Cc: gre...@linuxfoundation.org
Cc: han...@cmpxchg.org
Cc: herb...@gondor.apana.org.au
Cc: hverk...@xs4all.nl
Cc: john.stu...@linaro.org
Cc: n...@fluxnic.net
Cc: paul...@kernel.org
Cc: rafael.j.wyso...@intel.com
Cc: rmk+ker...@arm.linux.org.uk
Cc: sudeep.ho...@arm.com
Cc: t...@linutronix.de
Cc: ulf.hans...@linaro.org
Cc: w...@linux-watchdog.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Tested-by: Paul E. McKenney 
---
 include/linux/sched.h |  3 +++-
 kernel/sched/core.c   | 47 ++-
 2 files changed, 50 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b62e6aa..b792b8f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1653,6 +1653,9 @@ extern int idle_cpu(int cpu);
 extern int available_idle_cpu(int cpu);
 extern int sched_setscheduler(struct task_struct *, int, const struct 
sched_param *);
 extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct 
sched_param *);
+extern int sched_set_fifo(struct task_struct *p);
+extern int sched_set_fifo_low(struct task_struct *p);
+extern int sched_set_normal(struct task_struct *p, int nice);
 extern int sched_setattr(struct task_struct *, const struct sched_attr *);
 extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr 
*);
 extern struct task_struct *idle_task(int cpu);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0208b71..40d3939 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5124,6 +5124,8 @@ static int _sched_setscheduler(struct task_struct *p, int 
policy,
  * @policy: new policy.
  * @param: structure containing the new RT priority.
  *
+ * Use sched_set_fifo(), read its comment.
+ *
  * Return: 0 on success. An error code otherwise.
  *
  * NOTE that the task may be already dead.
@@ -5166,6 +5168,51 @@ int sched_setscheduler_nocheck(struct task_struct *p, 
int policy,
 }
 EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
 
+/*
+ * SCHED_FIFO is a broken scheduler model; that is, it is fundamentally
+ * incapable of resource management, which is the one thing an OS really should
+ * be doing.
+ *
+ * This is of course the reason it is limited to privileged users only.
+ *
+ * Worse still; it is fundamentally impossible to compose static priority
+ * workloads. You cannot take two correctly working static prio workloads
+ * and smash them together and still expect them to work.
+ *
+ * For this reason 'all' FIFO tasks the kernel creates are basically at:
+ *
+ *   MAX_RT_PRIO / 2
+ *
+ * The administrator _MUST_ configure the system, the kernel simply doesn't
+ * know enough information to make a sensible choice.
+ */
+int sched_set_fifo(struct task_struct *p)
+{
+   struct sched_param sp = { .sched_priority = MAX_RT_PRIO / 2 };
+   return sched_setscheduler_nocheck(p, SCHED_FIFO, );
+}
+EXPORT_SYMBOL_GPL(sched_set_fifo);
+
+/*
+ * For when you don't much care about FIFO, but want to be above SCHED_NORMAL.
+ */
+int sched_set_fifo_low(struct task_struct *p)
+{
+   struct sched_param sp = { .sched_priority = 1 };
+   return sched_setscheduler_nocheck(p, SCHED_FIFO, );
+}
+EXPORT_SYMBOL_GPL(sched_set_fifo_low);
+
+int sched_set_normal(struct task_struct *p, int nice)
+{
+   struct 

[tip: sched/fifo] sched,powercap: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: c3f47cf940efacaa8fab50973dc98f369c2066ff
Gitweb:
https://git.kernel.org/tip/c3f47cf940efacaa8fab50973dc98f369c2066ff
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:22 +02:00

sched,powercap: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Cc: daniel.lezc...@linaro.org
Cc: rafael.j.wyso...@intel.com
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/powercap/idle_inject.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/powercap/idle_inject.c b/drivers/powercap/idle_inject.c
index c90f099..bc396a8 100644
--- a/drivers/powercap/idle_inject.c
+++ b/drivers/powercap/idle_inject.c
@@ -268,9 +268,7 @@ void idle_inject_stop(struct idle_inject_device *ii_dev)
  */
 static void idle_inject_setup(unsigned int cpu)
 {
-   struct sched_param param = { .sched_priority = MAX_USER_RT_PRIO / 2 };
-
-   sched_setscheduler(current, SCHED_FIFO, );
+   sched_set_fifo(current);
 }
 
 /**


[tip: sched/fifo] sched,watchdog: Convert to sched_set_fifo()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 94beddacb53cddb78baab6b4597195bb766d70b0
Gitweb:
https://git.kernel.org/tip/94beddacb53cddb78baab6b4597195bb766d70b0
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:24 +02:00

sched,watchdog: Convert to sched_set_fifo()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively changes prio from 99 to 50.

Cc: w...@linux-watchdog.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/watchdog/watchdog_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 7e4cd34..b9dc2c3 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -1144,14 +1144,13 @@ void watchdog_dev_unregister(struct watchdog_device 
*wdd)
 int __init watchdog_dev_init(void)
 {
int err;
-   struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1,};
 
watchdog_kworker = kthread_create_worker(0, "watchdogd");
if (IS_ERR(watchdog_kworker)) {
pr_err("Failed to create watchdog kworker\n");
return PTR_ERR(watchdog_kworker);
}
-   sched_setscheduler(watchdog_kworker->task, SCHED_FIFO, );
+   sched_set_fifo(watchdog_kworker->task);
 
err = class_register(_class);
if (err < 0) {


Re: [PATCH v3 2/5] vfio/pci: Add device denylist

2020-07-24 Thread Giovanni Cabiddu
On Thu, Jul 23, 2020 at 04:41:26PM -0600, Alex Williamson wrote:
> On Thu, 23 Jul 2020 22:47:02 +0100
> Giovanni Cabiddu  wrote:
> 
> > Add denylist of devices that by default are not probed by vfio-pci.
> > Devices in this list may be susceptible to untrusted application, even
> > if the IOMMU is enabled. To be accessed via vfio-pci, the user has to
> > explicitly disable the denylist.
> > 
> > The denylist can be disabled via the module parameter disable_denylist.
> > 
> > Signed-off-by: Giovanni Cabiddu 
> > ---
> >  drivers/vfio/pci/vfio_pci.c | 33 +
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> > index 7c0779018b1b..673f53c4798e 100644
> > --- a/drivers/vfio/pci/vfio_pci.c
> > +++ b/drivers/vfio/pci/vfio_pci.c
> > @@ -60,6 +60,10 @@ module_param(enable_sriov, bool, 0644);
> >  MODULE_PARM_DESC(enable_sriov, "Enable support for SR-IOV configuration.  
> > Enabling SR-IOV on a PF typically requires support of the userspace PF 
> > driver, enabling VFs without such support may result in non-functional VFs 
> > or PF.");
> >  #endif
> >  
> > +static bool disable_denylist;
> > +module_param(disable_denylist, bool, 0444);
> > +MODULE_PARM_DESC(disable_denylist, "Disable use of device denylist. 
> > Disabling the denylist prevents binding to devices with known errata that 
> > may lead to exploitable stability or security issues when accessed by 
> > untrusted users.");
> 
> s/prevents/allows/
> 
> ie. the denylist prevents binding, therefore disabling the denylist
> allows binding
> 
> I can fix this on commit without a new version if you agree.  I also
> see that patch 1/5 didn't change since v2, so I'll transfer Bjorn's
> ack.  If that sounds good I'll queue the first 3 patches in my next
> branch for v5.9.  Thanks,
My bad, apologies! I'm ok also to re-spin adding Bjorn's ack and the fix
above.

Regards,

-- 
Giovanni


[tip: sched/fifo] sched,ion: Convert to sched_set_normal()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 9309de08f14f49a29f6cc8a20653731235692b1f
Gitweb:
https://git.kernel.org/tip/9309de08f14f49a29f6cc8a20653731235692b1f
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:23 +02:00

sched,ion: Convert to sched_set_normal()

In an attempt to take away sched_setscheduler() from modules, change
this into sched_set_normal(.nice = 19).

Cc: john.stu...@linaro.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/staging/android/ion/ion_heap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_heap.c 
b/drivers/staging/android/ion/ion_heap.c
index 0755b11..563b84c 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -244,8 +244,6 @@ static int ion_heap_deferred_free(void *data)
 
 int ion_heap_init_deferred_free(struct ion_heap *heap)
 {
-   struct sched_param param = { .sched_priority = 0 };
-
INIT_LIST_HEAD(>free_list);
init_waitqueue_head(>waitqueue);
heap->task = kthread_run(ion_heap_deferred_free, heap,
@@ -255,7 +253,7 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
   __func__);
return PTR_ERR_OR_ZERO(heap->task);
}
-   sched_setscheduler(heap->task, SCHED_IDLE, );
+   sched_set_normal(heap->task, 19);
 
return 0;
 }


[tip: sched/fifo] sched,locktorture: Convert to sched_set_fifo()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 93db9129fa4beb78e2227554d237e8db04ca514c
Gitweb:
https://git.kernel.org/tip/93db9129fa4beb78e2227554d237e8db04ca514c
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:24 +02:00

sched,locktorture: Convert to sched_set_fifo()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively changes prio from 99 to 50.

Cc: paul...@kernel.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Reviewed-by: Paul E. McKenney 
---
 kernel/locking/locktorture.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 5efbfc6..fca41a7 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -436,8 +436,6 @@ static int torture_rtmutex_lock(void) 
__acquires(torture_rtmutex)
 
 static void torture_rtmutex_boost(struct torture_random_state *trsp)
 {
-   int policy;
-   struct sched_param param;
const unsigned int factor = 5; /* yes, quite arbitrary */
 
if (!rt_task(current)) {
@@ -448,8 +446,7 @@ static void torture_rtmutex_boost(struct 
torture_random_state *trsp)
 */
if (trsp && !(torture_random(trsp) %
  (cxt.nrealwriters_stress * factor))) {
-   policy = SCHED_FIFO;
-   param.sched_priority = MAX_RT_PRIO - 1;
+   sched_set_fifo(current);
} else /* common case, do nothing */
return;
} else {
@@ -462,13 +459,10 @@ static void torture_rtmutex_boost(struct 
torture_random_state *trsp)
 */
if (!trsp || !(torture_random(trsp) %
   (cxt.nrealwriters_stress * factor * 2))) {
-   policy = SCHED_NORMAL;
-   param.sched_priority = 0;
+   sched_set_normal(current, 0);
} else /* common case, do nothing */
return;
}
-
-   sched_setscheduler_nocheck(current, policy, );
 }
 
 static void torture_rtmutex_delay(struct torture_random_state *trsp)


[tip: sched/fifo] sched,ivtv: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 73f73cc2432acf2e1c8a1ce0720eaced7b5dda16
Gitweb:
https://git.kernel.org/tip/73f73cc2432acf2e1c8a1ce0720eaced7b5dda16
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:22 +02:00

sched,ivtv: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively changes from 99 to 50.

Cc: awa...@md.metrocast.net
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Acked-by: Hans Verkuil 
Tested-by: Hans Verkuil 
---
 drivers/media/pci/ivtv/ivtv-driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-driver.c 
b/drivers/media/pci/ivtv/ivtv-driver.c
index b1dde1b..28acb14 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
@@ -737,8 +737,6 @@ done:
  */
 static int ivtv_init_struct1(struct ivtv *itv)
 {
-   struct sched_param param = { .sched_priority = 99 };
-
itv->base_addr = pci_resource_start(itv->pdev, 0);
itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */
itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */
@@ -758,7 +756,7 @@ static int ivtv_init_struct1(struct ivtv *itv)
return -1;
}
/* must use the FIFO scheduler as it is realtime sensitive */
-   sched_setscheduler(itv->irq_worker_task, SCHED_FIFO, );
+   sched_set_fifo(itv->irq_worker_task);
 
kthread_init_work(>irq_work, ivtv_irq_work_handler);
 


[tip: sched/fifo] sched,psi: Convert to sched_set_fifo_low()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 2cca5426b9c108998bc03230cd6ae440f3e205ed
Gitweb:
https://git.kernel.org/tip/2cca5426b9c108998bc03230cd6ae440f3e205ed
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:25 +02:00

sched,psi: Convert to sched_set_fifo_low()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Acked-by: Johannes Weiner 
---
 kernel/sched/psi.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index e53b711..967732c 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -616,11 +616,8 @@ out:
 static int psi_poll_worker(void *data)
 {
struct psi_group *group = (struct psi_group *)data;
-   struct sched_param param = {
-   .sched_priority = 1,
-   };
 
-   sched_setscheduler_nocheck(current, SCHED_FIFO, );
+   sched_set_fifo_low(current);
 
while (true) {
wait_event_interruptible(group->poll_wait,


[tip: sched/fifo] sched,mmc: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: f8ec806be101e9a6482532d19eca4c5be3535b74
Gitweb:
https://git.kernel.org/tip/f8ec806be101e9a6482532d19eca4c5be3535b74
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:22 +02:00

sched,mmc: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

In this case, use fifo_low, because it only cares about being above
SCHED_NORMAL. Effectively no change in behaviour.

Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Acked-by: Ulf Hansson 
---
 drivers/mmc/core/sdio_irq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index 3ffe4ff..4b1f7c9 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -139,11 +139,10 @@ EXPORT_SYMBOL_GPL(sdio_signal_irq);
 static int sdio_irq_thread(void *_host)
 {
struct mmc_host *host = _host;
-   struct sched_param param = { .sched_priority = 1 };
unsigned long period, idle_period;
int ret;
 
-   sched_setscheduler(current, SCHED_FIFO, );
+   sched_set_fifo_low(current);
 
/*
 * We want to allow for SDIO cards to work even on non SDIO


[tip: sched/fifo] sched,rcuperf: Convert to sched_set_fifo_low()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: b1433395c4cc078b4382429e6d7dd1721714094f
Gitweb:
https://git.kernel.org/tip/b1433395c4cc078b4382429e6d7dd1721714094f
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:24 +02:00

sched,rcuperf: Convert to sched_set_fifo_low()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Cc: paul...@kernel.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Reviewed-by: Paul E. McKenney 
---
 kernel/rcu/rcuperf.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 16dd1e6..64249a0 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -354,7 +354,6 @@ rcu_perf_writer(void *arg)
int i_max;
long me = (long)arg;
struct rcu_head *rhp = NULL;
-   struct sched_param sp;
bool started = false, done = false, alldone = false;
u64 t;
u64 *wdp;
@@ -363,8 +362,7 @@ rcu_perf_writer(void *arg)
VERBOSE_PERFOUT_STRING("rcu_perf_writer task started");
WARN_ON(!wdpp);
set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
-   sp.sched_priority = 1;
-   sched_setscheduler_nocheck(current, SCHED_FIFO, );
+   sched_set_fifo_low(current);
 
if (holdoff)
schedule_timeout_uninterruptible(holdoff * HZ);
@@ -420,9 +418,7 @@ retry:
started = true;
if (!done && i >= MIN_MEAS) {
done = true;
-   sp.sched_priority = 0;
-   sched_setscheduler_nocheck(current,
-  SCHED_NORMAL, );
+   sched_set_normal(current, 0);
pr_alert("%s%s rcu_perf_writer %ld has %d 
measurements\n",
 perf_type, PERF_FLAG, me, MIN_MEAS);
if (atomic_inc_return(_rcu_perf_writer_finished) >=


[tip: sched/fifo] sched,serial: Convert to sched_set_fifo()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 28d2f209cd1620afaca6d0a61d1e88a269e9e875
Gitweb:
https://git.kernel.org/tip/28d2f209cd1620afaca6d0a61d1e88a269e9e875
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:23 +02:00

sched,serial: Convert to sched_set_fifo()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
---
 drivers/tty/serial/sc16is7xx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index d2e5c6c..809610b 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1179,7 +1179,6 @@ static int sc16is7xx_probe(struct device *dev,
   const struct sc16is7xx_devtype *devtype,
   struct regmap *regmap, int irq)
 {
-   struct sched_param sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
unsigned long freq = 0, *pfreq = dev_get_platdata(dev);
unsigned int val;
u32 uartclk = 0;
@@ -1239,7 +1238,7 @@ static int sc16is7xx_probe(struct device *dev,
ret = PTR_ERR(s->kworker_task);
goto out_clk;
}
-   sched_setscheduler(s->kworker_task, SCHED_FIFO, _param);
+   sched_set_fifo(s->kworker_task);
 
 #ifdef CONFIG_GPIOLIB
if (devtype->nr_gpio) {


[tip: sched/fifo] sched,rcutorture: Convert to sched_set_fifo_low()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: ce1c8afd3f3119ddaddcdff27579f5723f55c75e
Gitweb:
https://git.kernel.org/tip/ce1c8afd3f3119ddaddcdff27579f5723f55c75e
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:25 +02:00

sched,rcutorture: Convert to sched_set_fifo_low()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

Effectively no change.

Cc: paul...@kernel.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Reviewed-by: Paul E. McKenney 
---
 kernel/rcu/rcutorture.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index efb792e..bbc3c8a 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -889,13 +889,11 @@ static int rcu_torture_boost(void *arg)
unsigned long endtime;
unsigned long oldstarttime;
struct rcu_boost_inflight rbi = { .inflight = 0 };
-   struct sched_param sp;
 
VERBOSE_TOROUT_STRING("rcu_torture_boost started");
 
/* Set real-time priority. */
-   sp.sched_priority = 1;
-   if (sched_setscheduler(current, SCHED_FIFO, ) < 0) {
+   if (sched_set_fifo_low(current) < 0) {
VERBOSE_TOROUT_STRING("rcu_torture_boost RT prio failed!");
n_rcu_torture_boost_rterror++;
}


[tip: sched/fifo] sched,spi: Convert to sched_set_fifo*()

2020-07-24 Thread tip-bot2 for Peter Zijlstra
The following commit has been merged into the sched/fifo branch of tip:

Commit-ID: 3070da33400c18e0454832425a530d2d0e6a6fcf
Gitweb:
https://git.kernel.org/tip/3070da33400c18e0454832425a530d2d0e6a6fcf
Author:Peter Zijlstra 
AuthorDate:Tue, 21 Apr 2020 12:09:13 +02:00
Committer: Peter Zijlstra 
CommitterDate: Mon, 15 Jun 2020 14:10:22 +02:00

sched,spi: Convert to sched_set_fifo*()

Because SCHED_FIFO is a broken scheduler model (see previous patches)
take away the priority field, the kernel can't possibly make an
informed decision.

No effective change.

Cc: broo...@kernel.org
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ingo Molnar 
Reviewed-by: Douglas Anderson 
Reviewed-by: Guenter Roeck 
---
 drivers/platform/chrome/cros_ec_spi.c | 6 +-
 drivers/spi/spi.c | 4 +---
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_spi.c 
b/drivers/platform/chrome/cros_ec_spi.c
index debea5c..c20a43a 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -709,9 +709,6 @@ static void cros_ec_spi_high_pri_release(void *worker)
 static int cros_ec_spi_devm_high_pri_alloc(struct device *dev,
   struct cros_ec_spi *ec_spi)
 {
-   struct sched_param sched_priority = {
-   .sched_priority = MAX_RT_PRIO / 2,
-   };
int err;
 
ec_spi->high_pri_worker =
@@ -728,8 +725,7 @@ static int cros_ec_spi_devm_high_pri_alloc(struct device 
*dev,
if (err)
return err;
 
-   err = sched_setscheduler_nocheck(ec_spi->high_pri_worker->task,
-SCHED_FIFO, _priority);
+   err = sched_set_fifo(ec_spi->high_pri_worker->task);
if (err)
dev_err(dev, "Can't set cros_ec high pri priority: %d\n", err);
return err;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8158e28..5a4f0bf 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1592,11 +1592,9 @@ EXPORT_SYMBOL_GPL(spi_take_timestamp_post);
  */
 static void spi_set_thread_rt(struct spi_controller *ctlr)
 {
-   struct sched_param param = { .sched_priority = MAX_RT_PRIO / 2 };
-
dev_info(>dev,
"will run message pump with realtime priority\n");
-   sched_setscheduler(ctlr->kworker_task, SCHED_FIFO, );
+   sched_set_fifo(ctlr->kworker_task);
 }
 
 static int spi_init_queue(struct spi_controller *ctlr)


Re: [PATCH v9 02/15] s390/vfio-ap: use new AP bus interface to search for queue devices

2020-07-24 Thread Pierre Morel




On 2020-07-20 17:03, Tony Krowiak wrote:

This patch refactor's the vfio_ap device driver to use the AP bus's
ap_get_qdev() function to retrieve the vfio_ap_queue struct containing
information about a queue that is bound to the vfio_ap device driver.
The bus's ap_get_qdev() function retrieves the queue device from a
hashtable keyed by APQN. This is much more efficient than looping over
the list of devices attached to the AP bus by several orders of
magnitude.


The patch does much more than modifying this line. ;)



Signed-off-by: Tony Krowiak 
Reported-by: kernel test robot 
---
  drivers/s390/crypto/vfio_ap_drv.c | 27 ++---
  drivers/s390/crypto/vfio_ap_ops.c | 86 +++
  drivers/s390/crypto/vfio_ap_private.h |  8 ++-
  3 files changed, 59 insertions(+), 62 deletions(-)

diff --git a/drivers/s390/crypto/vfio_ap_drv.c 
b/drivers/s390/crypto/vfio_ap_drv.c
index f4ceb380dd61..24cdef60039a 100644
--- a/drivers/s390/crypto/vfio_ap_drv.c
+++ b/drivers/s390/crypto/vfio_ap_drv.c
@@ -53,15 +53,9 @@ MODULE_DEVICE_TABLE(vfio_ap, ap_queue_ids);
   */
  static int vfio_ap_queue_dev_probe(struct ap_device *apdev)
  {
-   struct vfio_ap_queue *q;
-
-   q = kzalloc(sizeof(*q), GFP_KERNEL);
-   if (!q)
-   return -ENOMEM;
-   dev_set_drvdata(>device, q);
-   q->apqn = to_ap_queue(>device)->qid;
-   q->saved_isc = VFIO_AP_ISC_INVALID;
-   return 0;
+   struct ap_queue *queue = to_ap_queue(>device);
+
+   return vfio_ap_mdev_probe_queue(queue);
  }


You should explain the reason why this function is modified.

  
  /**

@@ -72,18 +66,9 @@ static int vfio_ap_queue_dev_probe(struct ap_device *apdev)
   */
  static void vfio_ap_queue_dev_remove(struct ap_device *apdev)
  {
-   struct vfio_ap_queue *q;
-   int apid, apqi;
-
-   mutex_lock(_dev->lock);
-   q = dev_get_drvdata(>device);
-   dev_set_drvdata(>device, NULL);
-   apid = AP_QID_CARD(q->apqn);
-   apqi = AP_QID_QUEUE(q->apqn);
-   vfio_ap_mdev_reset_queue(apid, apqi, 1);
-   vfio_ap_irq_disable(q);
-   kfree(q);
-   mutex_unlock(_dev->lock);
+   struct ap_queue *queue = to_ap_queue(>device);
+
+   vfio_ap_mdev_remove_queue(queue);
  }


... and this one?

  
  static void vfio_ap_matrix_dev_release(struct device *dev)

diff --git a/drivers/s390/crypto/vfio_ap_ops.c 
b/drivers/s390/crypto/vfio_ap_ops.c
index e0bde8518745..ad3925f04f61 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -26,43 +26,26 @@
  
  static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev);
  
-static int match_apqn(struct device *dev, const void *data)

-{
-   struct vfio_ap_queue *q = dev_get_drvdata(dev);
-
-   return (q->apqn == *(int *)(data)) ? 1 : 0;
-}
-
  /**
- * vfio_ap_get_queue: Retrieve a queue with a specific APQN from a list
- * @matrix_mdev: the associated mediated matrix
+ * vfio_ap_get_queue: Retrieve a queue with a specific APQN.
   * @apqn: The queue APQN
   *
- * Retrieve a queue with a specific APQN from the list of the
- * devices of the vfio_ap_drv.
- * Verify that the APID and the APQI are set in the matrix.
+ * Retrieve a queue with a specific APQN from the AP queue devices attached to
+ * the AP bus.
   *
- * Returns the pointer to the associated vfio_ap_queue
+ * Returns the pointer to the vfio_ap_queue with the specified APQN, or NULL.
   */
-static struct vfio_ap_queue *vfio_ap_get_queue(
-   struct ap_matrix_mdev *matrix_mdev,
-   int apqn)
+static struct vfio_ap_queue *vfio_ap_get_queue(unsigned long apqn)
  {
+   struct ap_queue *queue;
struct vfio_ap_queue *q;
-   struct device *dev;
  
-	if (!test_bit_inv(AP_QID_CARD(apqn), matrix_mdev->matrix.apm))

-   return NULL;
-   if (!test_bit_inv(AP_QID_QUEUE(apqn), matrix_mdev->matrix.aqm))
+   queue = ap_get_qdev(apqn);
+   if (!queue)
return NULL;
  
-	dev = driver_find_device(_dev->vfio_ap_drv->driver, NULL,

-, match_apqn);
-   if (!dev)
-   return NULL;
-   q = dev_get_drvdata(dev);
-   q->matrix_mdev = matrix_mdev;
-   put_device(dev);
+   q = dev_get_drvdata(>ap_dev.device);
+   put_device(>ap_dev.device);
  
  	return q;

  }


this function changed a lot too, you should explain the goal in the 
patch comment.


...snip...

Regards,
Pierre

--
Pierre Morel
IBM Lab Boeblingen


[PATCH v2] openrisc: Fix oops caused when dumping stack

2020-07-24 Thread Stafford Horne
When dumping a stack with 'cat /proc/#/stack' the kernel would oops.
For example:

# cat /proc/690/stack
Unable to handle kernel access
 at virtual address 0x7fc60f58

Oops#: 
CPU #: 0
   PC: c00097fcSR: 807fSP: d6f09b9c
GPR00:  GPR01: d6f09b9c GPR02: d6f09bb8 GPR03: d6f09bc4
GPR04: 7fc60f5c GPR05: c00099b4 GPR06:  GPR07: d6f09ba3
GPR08: ff00 GPR09: c0009804 GPR10: d6f08000 GPR11: 
GPR12: e000 GPR13: dbb86000 GPR14: 0001 GPR15: dbb86250
GPR16: 7fc60f63 GPR17: 0f5c GPR18: d6f09bc4 GPR19: 
GPR20: c00099b4 GPR21: ffc0 GPR22:  GPR23: 
GPR24: 0001 GPR25: 02c6 GPR26: d78b6850 GPR27: 0001
GPR28:  GPR29: dbb86000 GPR30:  GPR31: dbb862fc
  RES:  oGPR11: 
Process cat (pid: 702, stackpage=d79d6000)

Stack:
Call trace:
[<598977f2>] save_stack_trace_tsk+0x40/0x74
[<95063f0e>] stack_trace_save_tsk+0x44/0x58
[] proc_pid_stack+0xd0/0x13c
[] proc_single_show+0x6c/0xf0
[] seq_read+0x1b4/0x688
[<2d6c7480>] do_iter_read+0x208/0x248
[<2182a2fb>] vfs_readv+0x64/0x90

This was caused by the stack trace code in save_stack_trace_tsk using
the wrong stack pointer.  It was using the user stack pointer instead of
the kernel stack pointer.  Fix this by using the right stack.

Also for good measure we add try_get_task_stack/put_task_stack to ensure
the task is not lost while we are walking it's stack.

Fixes: eecac38b0423a ("openrisc: support framepointers and STACKTRACE_SUPPORT")
Signed-off-by: Stafford Horne 
---
Changes since v1:
 - V1 was not properly locating the stack, adjust for redzone and pt_regs.

 arch/openrisc/kernel/stacktrace.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/openrisc/kernel/stacktrace.c 
b/arch/openrisc/kernel/stacktrace.c
index 43f140a28bc7..54d38809e22c 100644
--- a/arch/openrisc/kernel/stacktrace.c
+++ b/arch/openrisc/kernel/stacktrace.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -68,12 +69,25 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct 
stack_trace *trace)
 {
unsigned long *sp = NULL;
 
+   if (!try_get_task_stack(tsk))
+   return;
+
if (tsk == current)
sp = (unsigned long *) 
-   else
-   sp = (unsigned long *) KSTK_ESP(tsk);
+   else {
+   unsigned long ksp;
+
+   /* Locate stack from kernel context */
+   ksp = task_thread_info(tsk)->ksp;
+   ksp += STACK_FRAME_OVERHEAD;/* redzone */
+   ksp += sizeof(struct pt_regs);
+
+   sp = (unsigned long *) ksp;
+   }
 
unwind_stack(trace, sp, save_stack_address_nosched);
+
+   put_task_stack(tsk);
 }
 EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
-- 
2.26.2



[PATCH] ath9k: Fix typo in function name

2020-07-24 Thread Pavel Machek
Typo "destoy" made me wonder if correct patch is wrong; fix it. No
functional change.

Signed-off-by: Pavel Machek (CIP) 


diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 4ed21dad6a8e..1bb55b9532c9 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1373,7 +1373,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface 
*interface)
if (hif_dev->flags & HIF_USB_READY) {
ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged);
ath9k_hif_usb_dev_deinit(hif_dev);
-   ath9k_destoy_wmi(hif_dev->htc_handle->drv_priv);
+   ath9k_destroy_wmi(hif_dev->htc_handle->drv_priv);
ath9k_htc_hw_free(hif_dev->htc_handle);
}
 
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 1d6ad8d46607..ac79dfd5be7a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -973,7 +973,7 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, 
struct device *dev,
ath9k_stop_wmi(priv);
hif_dev = (struct hif_device_usb *)htc_handle->hif_dev;
ath9k_hif_usb_dealloc_urbs(hif_dev);
-   ath9k_destoy_wmi(priv);
+   ath9k_destroy_wmi(priv);
 err_free:
ieee80211_free_hw(hw);
return ret;
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c 
b/drivers/net/wireless/ath/ath9k/wmi.c
index e7a3127395be..9cf5ae3f7298 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -121,7 +121,7 @@ void ath9k_stop_wmi(struct ath9k_htc_priv *priv)
mutex_unlock(>op_mutex);
 }
 
-void ath9k_destoy_wmi(struct ath9k_htc_priv *priv)
+void ath9k_destroy_wmi(struct ath9k_htc_priv *priv)
 {
kfree(priv->wmi);
 }
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h 
b/drivers/net/wireless/ath/ath9k/wmi.h
index d8b912206232..9386b3a9d303 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.h
+++ b/drivers/net/wireless/ath/ath9k/wmi.h
@@ -189,7 +189,7 @@ void ath9k_wmi_event_tasklet(unsigned long data);
 void ath9k_fatal_work(struct work_struct *work);
 void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv);
 void ath9k_stop_wmi(struct ath9k_htc_priv *priv);
-void ath9k_destoy_wmi(struct ath9k_htc_priv *priv);
+void ath9k_destroy_wmi(struct ath9k_htc_priv *priv);
 
 #define WMI_CMD(_wmi_cmd)  \
do {\

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


signature.asc
Description: Digital signature


[PATCH] mtd: rawnand: oxnas: cleanup/simplify code

2020-07-24 Thread Pavel Machek
Simplify oxnas_nand_probe.

Signed-off-by: Pavel Machek (CIP) 

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c 
b/drivers/mtd/nand/raw/oxnas_nand.c
index 8d0d76ad319d..f44947043e5a 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -144,8 +144,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
if (err)
goto err_cleanup_nand;
 
-   oxnas->chips[oxnas->nchips] = chip;
-   ++oxnas->nchips;
+   oxnas->chips[oxnas->nchips++] = chip;
}
 
/* Exit if no chips found */

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


signature.asc
Description: Digital signature


Re: [PATCH v2 0/8] kcsan: Compound read-write instrumentation

2020-07-24 Thread Peter Zijlstra
On Fri, Jul 24, 2020 at 09:00:00AM +0200, Marco Elver wrote:

> Marco Elver (8):
>   kcsan: Support compounded read-write instrumentation
>   objtool, kcsan: Add __tsan_read_write to uaccess whitelist
>   kcsan: Skew delay to be longer for certain access types
>   kcsan: Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks
>   kcsan: Test support for compound instrumentation
>   instrumented.h: Introduce read-write instrumentation hooks
>   asm-generic/bitops: Use instrument_read_write() where appropriate
>   locking/atomics: Use read-write instrumentation for atomic RMWs

Looks good to me,

Acked-by: Peter Zijlstra (Intel) 


[PATCH] Input: fix typo in function name documentation

2020-07-24 Thread Pavel Machek
Fix non-existing constant in documentation.

Signed-off-by: Pavel Machek (CIP) 

diff --git a/Documentation/input/uinput.rst b/Documentation/input/uinput.rst
index b8e90b6a126c..10c62e62a0a6 100644
--- a/Documentation/input/uinput.rst
+++ b/Documentation/input/uinput.rst
@@ -99,7 +99,7 @@ the sake of simplicity.
 
   /*
* Give userspace some time to read the events before we destroy the
-   * device with UI_DEV_DESTOY.
+   * device with UI_DEV_DESTROY.
*/
   sleep(1);
 
@@ -164,7 +164,7 @@ mouse.
 
   /*
* Give userspace some time to read the events before we destroy the
-   * device with UI_DEV_DESTOY.
+   * device with UI_DEV_DESTROY.
*/
   sleep(1);
 
@@ -233,7 +233,7 @@ but interact with uinput via ioctl calls, or use libevdev.
 
   /*
* Give userspace some time to read the events before we destroy the
-   * device with UI_DEV_DESTOY.
+   * device with UI_DEV_DESTROY.
*/
   sleep(1);
 

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


signature.asc
Description: Digital signature


[PATCH] RDMA/mlx5: fix typo in structure name

2020-07-24 Thread Pavel Machek
This is user API, but likely noone uses it...? Fix it before it
becomes problem.

Signed-off-by: Pavel Machek (CIP) 


diff --git a/include/uapi/rdma/mlx5_user_ioctl_cmds.h 
b/include/uapi/rdma/mlx5_user_ioctl_cmds.h
index 8e316ef896b5..2d889df38df6 100644
--- a/include/uapi/rdma/mlx5_user_ioctl_cmds.h
+++ b/include/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -259,7 +259,7 @@ enum mlx5_ib_create_flow_attrs {
MLX5_IB_ATTR_CREATE_FLOW_FLAGS,
 };
 
-enum mlx5_ib_destoy_flow_attrs {
+enum mlx5_ib_destroy_flow_attrs {
MLX5_IB_ATTR_DESTROY_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
 };
 

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


signature.asc
Description: Digital signature


Re: [PATCH V2 3/3] tty: serial: qcom_geni_serial: Fix the UART wakeup issue

2020-07-24 Thread Greg KH
On Fri, Jul 24, 2020 at 09:28:02AM +0530, satya priya wrote:
> As a part of system suspend we call uart_port_suspend from the
> Serial driver, which calls set_mctrl passing mctrl as NULL. This
> makes RFR high(NOT_READY) during suspend.
> 
> Due to this BT SoC is not able to send wakeup bytes to UART during
> suspend. Included if check for non-suspend case to keep RFR low
> during suspend.
> 
> Signed-off-by: satya priya 

Acked-by: Greg Kroah-Hartman 


<    1   2   3   4   5   6   7   8   9   10   >