From: Greg Kroah-Hartman Date: Fri, 23 Oct 2015 14:32:17 +0000 (-0700) Subject: 4.1-stable patches X-Git-Tag: v3.14.56~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6517707141a1669ec2abf59b8efd7a96009a2f8;p=thirdparty%2Fkernel%2Fstable-queue.git 4.1-stable patches added patches: drm-nouveau-fbcon-take-runpm-reference-when-userspace-has-an-open-fd.patch i2c-designware-do-not-use-parameters-from-acpi-on-dell-inspiron-7348.patch i2c-designware-platdrv-enable-runtimepm-before-registering-to-the-core.patch i2c-rcar-enable-runtimepm-before-registering-to-the-core.patch i2c-s3c2410-enable-runtimepm-before-registering-to-the-core.patch mfd-max77843-fix-max77843_chg_init-return-on-error.patch workqueue-make-sure-delayed-work-run-in-local-cpu.patch --- diff --git a/queue-4.1/drm-nouveau-fbcon-take-runpm-reference-when-userspace-has-an-open-fd.patch b/queue-4.1/drm-nouveau-fbcon-take-runpm-reference-when-userspace-has-an-open-fd.patch new file mode 100644 index 00000000000..b718470d77f --- /dev/null +++ b/queue-4.1/drm-nouveau-fbcon-take-runpm-reference-when-userspace-has-an-open-fd.patch @@ -0,0 +1,65 @@ +From f231976c2e8964ceaa9250e57d27c35ff03825c2 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Fri, 2 Oct 2015 14:03:19 +1000 +Subject: drm/nouveau/fbcon: take runpm reference when userspace has an open fd + +From: Ben Skeggs + +commit f231976c2e8964ceaa9250e57d27c35ff03825c2 upstream. + +We need to do this in order to prevent accesses to the device while it's +powered down. Userspace may have an mmap of the fb, and there's no good +way (that I know of) to prevent it from touching the device otherwise. + +This fixes some nasty races between runpm and plymouth on some systems, +which result in the GPU getting very upset and hanging the boot. + +Signed-off-by: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/nouveau_fbcon.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c ++++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c +@@ -178,8 +178,30 @@ nouveau_fbcon_sync(struct fb_info *info) + return 0; + } + ++static int ++nouveau_fbcon_open(struct fb_info *info, int user) ++{ ++ struct nouveau_fbdev *fbcon = info->par; ++ struct nouveau_drm *drm = nouveau_drm(fbcon->dev); ++ int ret = pm_runtime_get_sync(drm->dev->dev); ++ if (ret < 0 && ret != -EACCES) ++ return ret; ++ return 0; ++} ++ ++static int ++nouveau_fbcon_release(struct fb_info *info, int user) ++{ ++ struct nouveau_fbdev *fbcon = info->par; ++ struct nouveau_drm *drm = nouveau_drm(fbcon->dev); ++ pm_runtime_put(drm->dev->dev); ++ return 0; ++} ++ + static struct fb_ops nouveau_fbcon_ops = { + .owner = THIS_MODULE, ++ .fb_open = nouveau_fbcon_open, ++ .fb_release = nouveau_fbcon_release, + .fb_check_var = drm_fb_helper_check_var, + .fb_set_par = drm_fb_helper_set_par, + .fb_fillrect = nouveau_fbcon_fillrect, +@@ -195,6 +217,8 @@ static struct fb_ops nouveau_fbcon_ops = + + static struct fb_ops nouveau_fbcon_sw_ops = { + .owner = THIS_MODULE, ++ .fb_open = nouveau_fbcon_open, ++ .fb_release = nouveau_fbcon_release, + .fb_check_var = drm_fb_helper_check_var, + .fb_set_par = drm_fb_helper_set_par, + .fb_fillrect = cfb_fillrect, diff --git a/queue-4.1/i2c-designware-do-not-use-parameters-from-acpi-on-dell-inspiron-7348.patch b/queue-4.1/i2c-designware-do-not-use-parameters-from-acpi-on-dell-inspiron-7348.patch new file mode 100644 index 00000000000..04b514ffeee --- /dev/null +++ b/queue-4.1/i2c-designware-do-not-use-parameters-from-acpi-on-dell-inspiron-7348.patch @@ -0,0 +1,108 @@ +From 56d4b8a24cef5d66f0d10ac778a520d3c2c68a48 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Thu, 24 Sep 2015 12:06:54 +0300 +Subject: i2c: designware: Do not use parameters from ACPI on Dell Inspiron 7348 + +From: Mika Westerberg + +commit 56d4b8a24cef5d66f0d10ac778a520d3c2c68a48 upstream. + +ACPI SSCN/FMCN methods were originally added because then the platform can +provide the most accurate HCNT/LCNT values to the driver. However, this +seems not to be true for Dell Inspiron 7348 where using these causes the +touchpad to fail in boot: + + i2c_hid i2c-DLL0675:00: failed to retrieve report from device. + i2c_designware INT3433:00: i2c_dw_handle_tx_abort: lost arbitration + i2c_hid i2c-DLL0675:00: failed to retrieve report from device. + i2c_designware INT3433:00: controller timed out + +The values received from ACPI are (in fast mode): + + HCNT: 72 + LCNT: 160 + +this translates to following timings (input clock is 100MHz on Broadwell): + + tHIGH: 720 ns (spec min 600 ns) + tLOW: 1600 ns (spec min 1300 ns) + Bus period: 2920 ns (assuming 300 ns tf and tr) + Bus speed: 342.5 kHz + +Both tHIGH and tLOW are within the I2C specification. + +The calculated values when ACPI parameters are not used are (in fast mode): + + HCNT: 87 + LCNT: 159 + +which translates to: + + tHIGH: 870 ns (spec min 600 ns) + tLOW: 1590 ns (spec min 1300 ns) + Bus period 3060 ns (assuming 300 ns tf and tr) + Bus speed 326.8 kHz + +These values are also within the I2C specification. + +Since both ACPI and calculated values meet the I2C specification timing +requirements it is hard to say why the touchpad does not function properly +with the ACPI values except that the bus speed is higher in this case (but +still well below the max 400kHz). + +Solve this by adding DMI quirk to the driver that disables using ACPI +parameters on this particulare machine. + +Reported-by: Pavel Roskin +Signed-off-by: Mika Westerberg +Tested-by: Pavel Roskin +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/busses/i2c-designware-platdrv.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/i2c/busses/i2c-designware-platdrv.c ++++ b/drivers/i2c/busses/i2c-designware-platdrv.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -51,6 +52,22 @@ static u32 i2c_dw_get_clk_rate_khz(struc + } + + #ifdef CONFIG_ACPI ++/* ++ * The HCNT/LCNT information coming from ACPI should be the most accurate ++ * for given platform. However, some systems get it wrong. On such systems ++ * we get better results by calculating those based on the input clock. ++ */ ++static const struct dmi_system_id dw_i2c_no_acpi_params[] = { ++ { ++ .ident = "Dell Inspiron 7348", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7348"), ++ }, ++ }, ++ { } ++}; ++ + static void dw_i2c_acpi_params(struct platform_device *pdev, char method[], + u16 *hcnt, u16 *lcnt, u32 *sda_hold) + { +@@ -58,6 +75,9 @@ static void dw_i2c_acpi_params(struct pl + acpi_handle handle = ACPI_HANDLE(&pdev->dev); + union acpi_object *obj; + ++ if (dmi_check_system(dw_i2c_no_acpi_params)) ++ return; ++ + if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf))) + return; + diff --git a/queue-4.1/i2c-designware-platdrv-enable-runtimepm-before-registering-to-the-core.patch b/queue-4.1/i2c-designware-platdrv-enable-runtimepm-before-registering-to-the-core.patch new file mode 100644 index 00000000000..2e6bb173821 --- /dev/null +++ b/queue-4.1/i2c-designware-platdrv-enable-runtimepm-before-registering-to-the-core.patch @@ -0,0 +1,51 @@ +From 36d48fb5766aee9717e429f772046696b215282d Mon Sep 17 00:00:00 2001 +From: Wolfram Sang +Date: Fri, 9 Oct 2015 10:39:24 +0100 +Subject: i2c: designware-platdrv: enable RuntimePM before registering to the core + +From: Wolfram Sang + +commit 36d48fb5766aee9717e429f772046696b215282d upstream. + +The core may register clients attached to this master which may use +funtionality from the master. So, RuntimePM must be enabled before, otherwise +this will fail. + +Signed-off-by: Wolfram Sang +Signed-off-by: Wolfram Sang +Acked-by: Mika Westerberg +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/busses/i2c-designware-platdrv.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/i2c/busses/i2c-designware-platdrv.c ++++ b/drivers/i2c/busses/i2c-designware-platdrv.c +@@ -273,12 +273,6 @@ static int dw_i2c_probe(struct platform_ + adap->dev.parent = &pdev->dev; + adap->dev.of_node = pdev->dev.of_node; + +- r = i2c_add_numbered_adapter(adap); +- if (r) { +- dev_err(&pdev->dev, "failure adding adapter\n"); +- return r; +- } +- + if (dev->pm_runtime_disabled) { + pm_runtime_forbid(&pdev->dev); + } else { +@@ -288,6 +282,13 @@ static int dw_i2c_probe(struct platform_ + pm_runtime_enable(&pdev->dev); + } + ++ r = i2c_add_numbered_adapter(adap); ++ if (r) { ++ dev_err(&pdev->dev, "failure adding adapter\n"); ++ pm_runtime_disable(&pdev->dev); ++ return r; ++ } ++ + return 0; + } + diff --git a/queue-4.1/i2c-rcar-enable-runtimepm-before-registering-to-the-core.patch b/queue-4.1/i2c-rcar-enable-runtimepm-before-registering-to-the-core.patch new file mode 100644 index 00000000000..eb3a4c1d601 --- /dev/null +++ b/queue-4.1/i2c-rcar-enable-runtimepm-before-registering-to-the-core.patch @@ -0,0 +1,44 @@ +From 4f7effddf4549d57114289f273710f077c4c330a Mon Sep 17 00:00:00 2001 +From: Wolfram Sang +Date: Fri, 9 Oct 2015 10:39:25 +0100 +Subject: i2c: rcar: enable RuntimePM before registering to the core + +From: Wolfram Sang + +commit 4f7effddf4549d57114289f273710f077c4c330a upstream. + +The core may register clients attached to this master which may use +funtionality from the master. So, RuntimePM must be enabled before, otherwise +this will fail. While here, move drvdata, too. + +Reported-by: Geert Uytterhoeven +Signed-off-by: Wolfram Sang +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/busses/i2c-rcar.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/i2c/busses/i2c-rcar.c ++++ b/drivers/i2c/busses/i2c-rcar.c +@@ -688,15 +688,16 @@ static int rcar_i2c_probe(struct platfor + return ret; + } + ++ pm_runtime_enable(dev); ++ platform_set_drvdata(pdev, priv); ++ + ret = i2c_add_numbered_adapter(adap); + if (ret < 0) { + dev_err(dev, "reg adap failed: %d\n", ret); ++ pm_runtime_disable(dev); + return ret; + } + +- pm_runtime_enable(dev); +- platform_set_drvdata(pdev, priv); +- + dev_info(dev, "probed\n"); + + return 0; diff --git a/queue-4.1/i2c-s3c2410-enable-runtimepm-before-registering-to-the-core.patch b/queue-4.1/i2c-s3c2410-enable-runtimepm-before-registering-to-the-core.patch new file mode 100644 index 00000000000..dcd4dfabf2f --- /dev/null +++ b/queue-4.1/i2c-s3c2410-enable-runtimepm-before-registering-to-the-core.patch @@ -0,0 +1,48 @@ +From eadd709f5d2e8aebb1b7bf49460e97a68d81a9b0 Mon Sep 17 00:00:00 2001 +From: Wolfram Sang +Date: Sat, 10 Oct 2015 08:24:23 +0100 +Subject: i2c: s3c2410: enable RuntimePM before registering to the core + +From: Wolfram Sang + +commit eadd709f5d2e8aebb1b7bf49460e97a68d81a9b0 upstream. + +The core may register clients attached to this master which may use +funtionality from the master. So, RuntimePM must be enabled before, otherwise +this will fail. While here, move drvdata, too. + +Signed-off-by: Wolfram Sang +Tested-by: Krzysztof Kozlowski +Acked-by: Kukjin Kim +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/busses/i2c-s3c2410.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/i2c/busses/i2c-s3c2410.c ++++ b/drivers/i2c/busses/i2c-s3c2410.c +@@ -1243,17 +1243,19 @@ static int s3c24xx_i2c_probe(struct plat + i2c->adap.nr = i2c->pdata->bus_num; + i2c->adap.dev.of_node = pdev->dev.of_node; + ++ platform_set_drvdata(pdev, i2c); ++ ++ pm_runtime_enable(&pdev->dev); ++ + ret = i2c_add_numbered_adapter(&i2c->adap); + if (ret < 0) { + dev_err(&pdev->dev, "failed to add bus to i2c core\n"); ++ pm_runtime_disable(&pdev->dev); + s3c24xx_i2c_deregister_cpufreq(i2c); + clk_unprepare(i2c->clk); + return ret; + } + +- platform_set_drvdata(pdev, i2c); +- +- pm_runtime_enable(&pdev->dev); + pm_runtime_enable(&i2c->adap.dev); + + dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); diff --git a/queue-4.1/mfd-max77843-fix-max77843_chg_init-return-on-error.patch b/queue-4.1/mfd-max77843-fix-max77843_chg_init-return-on-error.patch new file mode 100644 index 00000000000..0798f6b0dc0 --- /dev/null +++ b/queue-4.1/mfd-max77843-fix-max77843_chg_init-return-on-error.patch @@ -0,0 +1,34 @@ +From 1b52e50f2a402a266f1ba2281f0a57e87637a047 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 21 Sep 2015 14:26:54 +0200 +Subject: mfd: max77843: Fix max77843_chg_init() return on error + +From: Javier Martinez Canillas + +commit 1b52e50f2a402a266f1ba2281f0a57e87637a047 upstream. + +If i2c_new_dummy() fails in max77843_chg_init(), an PTR_ERR(NULL) is +returned which is 0. So the function was wrongly returning a success +value instead of an error code. + +Fixes: c7f585fe46d8 ("mfd: max77843: Add max77843 MFD driver core driver") +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Lee Jones +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mfd/max77843.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mfd/max77843.c ++++ b/drivers/mfd/max77843.c +@@ -79,7 +79,7 @@ static int max77843_chg_init(struct max7 + if (!max77843->i2c_chg) { + dev_err(&max77843->i2c->dev, + "Cannot allocate I2C device for Charger\n"); +- return PTR_ERR(max77843->i2c_chg); ++ return -ENODEV; + } + i2c_set_clientdata(max77843->i2c_chg, max77843); + diff --git a/queue-4.1/series b/queue-4.1/series index 6c532f1e136..27eee1b136d 100644 --- a/queue-4.1/series +++ b/queue-4.1/series @@ -23,3 +23,10 @@ btrfs-check-unsupported-filters-in-balance-arguments.patch btrfs-fix-use-after-free-iterating-extrefs.patch arm64-errata-use-kbuild_cflags_module-for-erratum-843419.patch nfsd-blocklayout-accept-any-minlength.patch +mfd-max77843-fix-max77843_chg_init-return-on-error.patch +i2c-rcar-enable-runtimepm-before-registering-to-the-core.patch +i2c-s3c2410-enable-runtimepm-before-registering-to-the-core.patch +i2c-designware-do-not-use-parameters-from-acpi-on-dell-inspiron-7348.patch +i2c-designware-platdrv-enable-runtimepm-before-registering-to-the-core.patch +workqueue-make-sure-delayed-work-run-in-local-cpu.patch +drm-nouveau-fbcon-take-runpm-reference-when-userspace-has-an-open-fd.patch diff --git a/queue-4.1/workqueue-make-sure-delayed-work-run-in-local-cpu.patch b/queue-4.1/workqueue-make-sure-delayed-work-run-in-local-cpu.patch new file mode 100644 index 00000000000..64eb8b25719 --- /dev/null +++ b/queue-4.1/workqueue-make-sure-delayed-work-run-in-local-cpu.patch @@ -0,0 +1,78 @@ +From 874bbfe600a660cba9c776b3957b1ce393151b76 Mon Sep 17 00:00:00 2001 +From: Shaohua Li +Date: Wed, 30 Sep 2015 09:05:30 -0700 +Subject: workqueue: make sure delayed work run in local cpu + +From: Shaohua Li + +commit 874bbfe600a660cba9c776b3957b1ce393151b76 upstream. + +My system keeps crashing with below message. vmstat_update() schedules a delayed +work in current cpu and expects the work runs in the cpu. +schedule_delayed_work() is expected to make delayed work run in local cpu. The +problem is timer can be migrated with NO_HZ. __queue_work() queues work in +timer handler, which could run in a different cpu other than where the delayed +work is scheduled. The end result is the delayed work runs in different cpu. +The patch makes __queue_delayed_work records local cpu earlier. Where the timer +runs doesn't change where the work runs with the change. + +[ 28.010131] ------------[ cut here ]------------ +[ 28.010609] kernel BUG at ../mm/vmstat.c:1392! +[ 28.011099] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN +[ 28.011860] Modules linked in: +[ 28.012245] CPU: 0 PID: 289 Comm: kworker/0:3 Tainted: G W4.3.0-rc3+ #634 +[ 28.013065] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140709_153802- 04/01/2014 +[ 28.014160] Workqueue: events vmstat_update +[ 28.014571] task: ffff880117682580 ti: ffff8800ba428000 task.ti: ffff8800ba428000 +[ 28.015445] RIP: 0010:[] []vmstat_update+0x31/0x80 +[ 28.016282] RSP: 0018:ffff8800ba42fd80 EFLAGS: 00010297 +[ 28.016812] RAX: 0000000000000000 RBX: ffff88011a858dc0 RCX:0000000000000000 +[ 28.017585] RDX: ffff880117682580 RSI: ffffffff81f14d8c RDI:ffffffff81f4df8d +[ 28.018366] RBP: ffff8800ba42fd90 R08: 0000000000000001 R09:0000000000000000 +[ 28.019169] R10: 0000000000000000 R11: 0000000000000121 R12:ffff8800baa9f640 +[ 28.019947] R13: ffff88011a81e340 R14: ffff88011a823700 R15:0000000000000000 +[ 28.020071] FS: 0000000000000000(0000) GS:ffff88011a800000(0000)knlGS:0000000000000000 +[ 28.020071] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b +[ 28.020071] CR2: 00007ff6144b01d0 CR3: 00000000b8e93000 CR4:00000000000006f0 +[ 28.020071] Stack: +[ 28.020071] ffff88011a858dc0 ffff8800baa9f640 ffff8800ba42fe00ffffffff8106bd88 +[ 28.020071] ffffffff8106bd0b 0000000000000096 0000000000000000ffffffff82f9b1e8 +[ 28.020071] ffffffff829f0b10 0000000000000000 ffffffff81f18460ffff88011a81e340 +[ 28.020071] Call Trace: +[ 28.020071] [] process_one_work+0x1c8/0x540 +[ 28.020071] [] ? process_one_work+0x14b/0x540 +[ 28.020071] [] worker_thread+0x114/0x460 +[ 28.020071] [] ? process_one_work+0x540/0x540 +[ 28.020071] [] kthread+0xf8/0x110 +[ 28.020071] [] ?kthread_create_on_node+0x200/0x200 +[ 28.020071] [] ret_from_fork+0x3f/0x70 +[ 28.020071] [] ?kthread_create_on_node+0x200/0x200 + +Signed-off-by: Shaohua Li +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/workqueue.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -1451,13 +1451,13 @@ static void __queue_delayed_work(int cpu + timer_stats_timer_set_start_info(&dwork->timer); + + dwork->wq = wq; ++ /* timer isn't guaranteed to run in this cpu, record earlier */ ++ if (cpu == WORK_CPU_UNBOUND) ++ cpu = raw_smp_processor_id(); + dwork->cpu = cpu; + timer->expires = jiffies + delay; + +- if (unlikely(cpu != WORK_CPU_UNBOUND)) +- add_timer_on(timer, cpu); +- else +- add_timer(timer); ++ add_timer_on(timer, cpu); + } + + /**