From: Greg Kroah-Hartman Date: Fri, 3 Oct 2014 20:19:40 +0000 (-0700) Subject: 3.16-stable patches X-Git-Tag: v3.16.4~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=37b2de1721fc33e19098b2d8630145690ce35368;p=thirdparty%2Fkernel%2Fstable-queue.git 3.16-stable patches added patches: arm-armv7-perf-fix-armv7-ref-cycles-error.patch drm-nouveau-runpm-fix-module-unload.patch drm-radeon-px-fix-module-unload.patch fix-unbalanced-mutex-in-dma_pool_create.patch pci-add-pci_ignore_hotplug-to-ignore-hotplug-events-for-a-device.patch perf-fix-a-race-condition-in-perf_remove_from_context.patch revert-pci-don-t-scan-random-busses-in-pci_scan_bridge.patch spi-dw-don-t-use-devm_kzalloc-in-master-setup-callback.patch spi-fsl-don-t-use-devm_kzalloc-in-master-setup-callback.patch spi-sirf-enable-rx_io_dma_int-interrupt.patch vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch --- diff --git a/queue-3.16/arm-armv7-perf-fix-armv7-ref-cycles-error.patch b/queue-3.16/arm-armv7-perf-fix-armv7-ref-cycles-error.patch new file mode 100644 index 00000000000..c3f7790834b --- /dev/null +++ b/queue-3.16/arm-armv7-perf-fix-armv7-ref-cycles-error.patch @@ -0,0 +1,71 @@ +From zhangzhiqiang.zhang@huawei.com Fri Oct 3 13:04:46 2014 +From: zhangzhiqiang +Date: Fri, 26 Sep 2014 15:44:22 +0800 +Subject: arm: armv7: perf: fix armv7 ref-cycles error +To: , , , , +Message-ID: <54251956.6010407@huawei.com> + + +From: Zhiqiang Zhang + +ref-cycles event is specially to Intel core, but can still used in arm +architecture with the wrong return value with 3.10 stable. this patch fix the +bug and make it return NOT SUPPORTED distinctly. + +In upstream this bug has been fixed by other way, which changes more than one +file and more than 1000 lines. the primary commit is +6b7658ec8a100b608e59e3cde353434db51f5be0. besides we can not simply +cherry-pick. + +Signed-off-by: Zhiqiang Zhang +Cc: Mark Rutland +Cc: Christopher Covington +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/kernel/perf_event_v7.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm/kernel/perf_event_v7.c ++++ b/arch/arm/kernel/perf_event_v7.c +@@ -157,6 +157,7 @@ static const unsigned armv7_a8_perf_map[ + [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED, + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV7_A8_PERFCTR_STALL_ISIDE, + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED, ++ [PERF_COUNT_HW_REF_CPU_CYCLES] = HW_OP_UNSUPPORTED, + }; + + static const unsigned armv7_a8_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] +@@ -281,6 +282,7 @@ static const unsigned armv7_a9_perf_map[ + [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED, + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV7_A9_PERFCTR_STALL_ICACHE, + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV7_A9_PERFCTR_STALL_DISPATCH, ++ [PERF_COUNT_HW_REF_CPU_CYCLES] = HW_OP_UNSUPPORTED, + }; + + static const unsigned armv7_a9_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] +@@ -405,6 +407,7 @@ static const unsigned armv7_a5_perf_map[ + [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED, + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED, + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED, ++ [PERF_COUNT_HW_REF_CPU_CYCLES] = HW_OP_UNSUPPORTED, + }; + + static const unsigned armv7_a5_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] +@@ -527,6 +530,7 @@ static const unsigned armv7_a15_perf_map + [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES, + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED, + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED, ++ [PERF_COUNT_HW_REF_CPU_CYCLES] = HW_OP_UNSUPPORTED, + }; + + static const unsigned armv7_a15_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] +@@ -651,6 +655,7 @@ static const unsigned armv7_a7_perf_map[ + [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES, + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED, + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED, ++ [PERF_COUNT_HW_REF_CPU_CYCLES] = HW_OP_UNSUPPORTED, + }; + + static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] diff --git a/queue-3.16/drm-nouveau-runpm-fix-module-unload.patch b/queue-3.16/drm-nouveau-runpm-fix-module-unload.patch new file mode 100644 index 00000000000..83796564e55 --- /dev/null +++ b/queue-3.16/drm-nouveau-runpm-fix-module-unload.patch @@ -0,0 +1,49 @@ +From 53beaa01e0fe8e4202f43485a03b32fcf5dfea74 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 12 Sep 2014 18:06:56 -0400 +Subject: drm/nouveau/runpm: fix module unload +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 53beaa01e0fe8e4202f43485a03b32fcf5dfea74 upstream. + +Use the new vga_switcheroo_fini_domain_pm_ops function +to unregister the pm ops. + +Based on a patch from: +Pali Rohár + +bug: +https://bugzilla.kernel.org/show_bug.cgi?id=84431 + +Reviewed-by: Ben Skeggs +Signed-off-by: Alex Deucher +Cc: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/nouveau_vga.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/gpu/drm/nouveau/nouveau_vga.c ++++ b/drivers/gpu/drm/nouveau/nouveau_vga.c +@@ -106,7 +106,16 @@ void + nouveau_vga_fini(struct nouveau_drm *drm) + { + struct drm_device *dev = drm->dev; ++ bool runtime = false; ++ ++ if (nouveau_runtime_pm == 1) ++ runtime = true; ++ if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) ++ runtime = true; ++ + vga_switcheroo_unregister_client(dev->pdev); ++ if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) ++ vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); + vga_client_register(dev->pdev, NULL, NULL, NULL); + } + diff --git a/queue-3.16/drm-radeon-px-fix-module-unload.patch b/queue-3.16/drm-radeon-px-fix-module-unload.patch new file mode 100644 index 00000000000..3245868c82d --- /dev/null +++ b/queue-3.16/drm-radeon-px-fix-module-unload.patch @@ -0,0 +1,72 @@ +From 2e97140dd58cab8772bf77d73eabda213e45202d Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 12 Sep 2014 18:00:53 -0400 +Subject: drm/radeon/px: fix module unload +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 2e97140dd58cab8772bf77d73eabda213e45202d upstream. + +Use the new vga_switcheroo_fini_domain_pm_ops function +to unregister the pm ops. + +Based on a patch from: +Pali Rohár + +bug: +https://bugzilla.kernel.org/show_bug.cgi?id=84431 + +Reviewed-by: Ben Skeggs +Signed-off-by: Alex Deucher +Signed-off-by: Pali Rohár +Cc: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon_device.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/radeon/radeon_device.c ++++ b/drivers/gpu/drm/radeon/radeon_device.c +@@ -1350,7 +1350,7 @@ int radeon_device_init(struct radeon_dev + + r = radeon_init(rdev); + if (r) +- return r; ++ goto failed; + + r = radeon_ib_ring_tests(rdev); + if (r) +@@ -1370,7 +1370,7 @@ int radeon_device_init(struct radeon_dev + radeon_agp_disable(rdev); + r = radeon_init(rdev); + if (r) +- return r; ++ goto failed; + } + + if ((radeon_testing & 1)) { +@@ -1392,6 +1392,11 @@ int radeon_device_init(struct radeon_dev + DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); + } + return 0; ++ ++failed: ++ if (runtime) ++ vga_switcheroo_fini_domain_pm_ops(rdev->dev); ++ return r; + } + + static void radeon_debugfs_remove_files(struct radeon_device *rdev); +@@ -1412,6 +1417,8 @@ void radeon_device_fini(struct radeon_de + radeon_bo_evict_vram(rdev); + radeon_fini(rdev); + vga_switcheroo_unregister_client(rdev->pdev); ++ if (rdev->flags & RADEON_IS_PX) ++ vga_switcheroo_fini_domain_pm_ops(rdev->dev); + vga_client_register(rdev->pdev, NULL, NULL, NULL); + if (rdev->rio_mem) + pci_iounmap(rdev->pdev, rdev->rio_mem); diff --git a/queue-3.16/fix-unbalanced-mutex-in-dma_pool_create.patch b/queue-3.16/fix-unbalanced-mutex-in-dma_pool_create.patch new file mode 100644 index 00000000000..d5a1c9c3b67 --- /dev/null +++ b/queue-3.16/fix-unbalanced-mutex-in-dma_pool_create.patch @@ -0,0 +1,35 @@ +From 153a9f131f50420b7ce008c94f1c6374cbc460d7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= +Date: Thu, 18 Sep 2014 15:12:02 +0200 +Subject: Fix unbalanced mutex in dma_pool_create(). +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= + +commit 153a9f131f50420b7ce008c94f1c6374cbc460d7 upstream. + +dma_pool_create() needs to unlock the mutex in error case. The bug was +introduced in the 3.16 by commit cc6b664aa26d ("mm/dmapool.c: remove +redundant NULL check for dev in dma_pool_create()")/ + +Signed-off-by: Krzysztof Hałasa +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/dmapool.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/dmapool.c ++++ b/mm/dmapool.c +@@ -176,7 +176,7 @@ struct dma_pool *dma_pool_create(const c + if (list_empty(&dev->dma_pools) && + device_create_file(dev, &dev_attr_pools)) { + kfree(retval); +- return NULL; ++ retval = NULL; + } else + list_add(&retval->pools, &dev->dma_pools); + mutex_unlock(&pools_lock); diff --git a/queue-3.16/pci-add-pci_ignore_hotplug-to-ignore-hotplug-events-for-a-device.patch b/queue-3.16/pci-add-pci_ignore_hotplug-to-ignore-hotplug-events-for-a-device.patch new file mode 100644 index 00000000000..9d554e5ea9a --- /dev/null +++ b/queue-3.16/pci-add-pci_ignore_hotplug-to-ignore-hotplug-events-for-a-device.patch @@ -0,0 +1,178 @@ +From b440bde74f043c8ec31081cb59c9a53ade954701 Mon Sep 17 00:00:00 2001 +From: Bjorn Helgaas +Date: Wed, 10 Sep 2014 13:45:01 -0600 +Subject: PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device + +From: Bjorn Helgaas + +commit b440bde74f043c8ec31081cb59c9a53ade954701 upstream. + +Powering off a hot-pluggable device, e.g., with pci_set_power_state(D3cold), +normally generates a hot-remove event that unbinds the driver. + +Some drivers expect to remain bound to a device even while they power it +off and back on again. This can be dangerous, because if the device is +removed or replaced while it is powered off, the driver doesn't know that +anything changed. But some drivers accept that risk. + +Add pci_ignore_hotplug() for use by drivers that know their device cannot +be removed. Using pci_ignore_hotplug() tells the PCI core that hot-plug +events for the device should be ignored. + +The radeon and nouveau drivers use this to switch between a low-power, +integrated GPU and a higher-power, higher-performance discrete GPU. They +power off the unused GPU, but they want to remain bound to it. + +This is a reimplementation of f244d8b623da ("ACPIPHP / radeon / nouveau: +Fix VGA switcheroo problem related to hotplug") but extends it to work with +both acpiphp and pciehp. + +This fixes a problem where systems with dual GPUs using the radeon drivers +become unusable, freezing every few seconds (see bugzillas below). The +resume of the radeon device may also fail, e.g., + +This fixes problems on dual GPU systems where the radeon driver becomes +unusable because of problems while suspending the device, as in bug 79701: + + [drm] radeon: finishing device. + radeon 0000:01:00.0: Userspace still has active objects ! + radeon 0000:01:00.0: ffff8800cb4ec288 ffff8800cb4ec000 16384 4294967297 force free + ... + WARNING: CPU: 0 PID: 67 at /home/apw/COD/linux/drivers/gpu/drm/radeon/radeon_gart.c:234 radeon_gart_unbind+0xd2/0xe0 [radeon]() + trying to unbind memory from uninitialized GART ! + +or while resuming it, as in bug 77261: + + radeon 0000:01:00.0: ring 0 stalled for more than 10158msec + radeon 0000:01:00.0: GPU lockup ... + radeon 0000:01:00.0: GPU pci config reset + pciehp 0000:00:01.0:pcie04: Card not present on Slot(1-1) + radeon 0000:01:00.0: GPU reset succeeded, trying to resume + *ERROR* radeon: dpm resume failed + radeon 0000:01:00.0: Wait for MC idle timedout ! + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=77261 +Link: https://bugzilla.kernel.org/show_bug.cgi?id=79701 +Reported-by: Shawn Starr +Reported-by: Jose P. +Signed-off-by: Bjorn Helgaas +Acked-by: Alex Deucher +Acked-by: Rajat Jain +Acked-by: Rafael J. Wysocki +Acked-by: Dave Airlie +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/nouveau_drm.c | 1 + + drivers/gpu/drm/radeon/radeon_drv.c | 1 + + drivers/pci/hotplug/acpiphp_glue.c | 16 ++++++---------- + drivers/pci/hotplug/pciehp_hpc.c | 12 ++++++++++++ + include/linux/pci.h | 6 ++++++ + 5 files changed, 26 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/nouveau/nouveau_drm.c ++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c +@@ -596,6 +596,7 @@ int nouveau_pmops_suspend(struct device + + pci_save_state(pdev); + pci_disable_device(pdev); ++ pci_ignore_hotplug(pdev); + pci_set_power_state(pdev, PCI_D3hot); + return 0; + } +--- a/drivers/gpu/drm/radeon/radeon_drv.c ++++ b/drivers/gpu/drm/radeon/radeon_drv.c +@@ -429,6 +429,7 @@ static int radeon_pmops_runtime_suspend( + ret = radeon_suspend_kms(drm_dev, false, false); + pci_save_state(pdev); + pci_disable_device(pdev); ++ pci_ignore_hotplug(pdev); + pci_set_power_state(pdev, PCI_D3cold); + drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; + +--- a/drivers/pci/hotplug/acpiphp_glue.c ++++ b/drivers/pci/hotplug/acpiphp_glue.c +@@ -573,19 +573,15 @@ static void disable_slot(struct acpiphp_ + slot->flags &= (~SLOT_ENABLED); + } + +-static bool acpiphp_no_hotplug(struct acpi_device *adev) +-{ +- return adev && adev->flags.no_hotplug; +-} +- + static bool slot_no_hotplug(struct acpiphp_slot *slot) + { +- struct acpiphp_func *func; ++ struct pci_bus *bus = slot->bus; ++ struct pci_dev *dev; + +- list_for_each_entry(func, &slot->funcs, sibling) +- if (acpiphp_no_hotplug(func_to_acpi_device(func))) ++ list_for_each_entry(dev, &bus->devices, bus_list) { ++ if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug) + return true; +- ++ } + return false; + } + +@@ -658,7 +654,7 @@ static void trim_stale_devices(struct pc + + status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); + alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) +- || acpiphp_no_hotplug(adev); ++ || dev->ignore_hotplug; + } + if (!alive) + alive = pci_device_is_present(dev); +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -508,6 +508,8 @@ static irqreturn_t pcie_isr(int irq, voi + { + struct controller *ctrl = (struct controller *)dev_id; + struct pci_dev *pdev = ctrl_dev(ctrl); ++ struct pci_bus *subordinate = pdev->subordinate; ++ struct pci_dev *dev; + struct slot *slot = ctrl->slot; + u16 detected, intr_loc; + +@@ -541,6 +543,16 @@ static irqreturn_t pcie_isr(int irq, voi + wake_up(&ctrl->queue); + } + ++ if (subordinate) { ++ list_for_each_entry(dev, &subordinate->devices, bus_list) { ++ if (dev->ignore_hotplug) { ++ ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n", ++ intr_loc, pci_name(dev)); ++ return IRQ_HANDLED; ++ } ++ } ++ } ++ + if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) + return IRQ_HANDLED; + +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -303,6 +303,7 @@ struct pci_dev { + D3cold, not set for devices + powered on/off by the + corresponding bridge */ ++ unsigned int ignore_hotplug:1; /* Ignore hotplug events */ + unsigned int d3_delay; /* D3->D0 transition time in ms */ + unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ + +@@ -1019,6 +1020,11 @@ bool pci_dev_run_wake(struct pci_dev *de + bool pci_check_pme_status(struct pci_dev *dev); + void pci_pme_wakeup_bus(struct pci_bus *bus); + ++static inline void pci_ignore_hotplug(struct pci_dev *dev) ++{ ++ dev->ignore_hotplug = 1; ++} ++ + static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, + bool enable) + { diff --git a/queue-3.16/perf-fix-a-race-condition-in-perf_remove_from_context.patch b/queue-3.16/perf-fix-a-race-condition-in-perf_remove_from_context.patch new file mode 100644 index 00000000000..d8d4d1cb04b --- /dev/null +++ b/queue-3.16/perf-fix-a-race-condition-in-perf_remove_from_context.patch @@ -0,0 +1,63 @@ +From 3577af70a2ce4853d58e57d832e687d739281479 Mon Sep 17 00:00:00 2001 +From: Cong Wang +Date: Tue, 2 Sep 2014 15:27:20 -0700 +Subject: perf: Fix a race condition in perf_remove_from_context() + +From: Cong Wang + +commit 3577af70a2ce4853d58e57d832e687d739281479 upstream. + +We saw a kernel soft lockup in perf_remove_from_context(), +it looks like the `perf` process, when exiting, could not go +out of the retry loop. Meanwhile, the target process was forking +a child. So either the target process should execute the smp +function call to deactive the event (if it was running) or it should +do a context switch which deactives the event. + +It seems we optimize out a context switch in perf_event_context_sched_out(), +and what's more important, we still test an obsolete task pointer when +retrying, so no one actually would deactive that event in this situation. +Fix it directly by reloading the task pointer in perf_remove_from_context(). + +This should cure the above soft lockup. + +Signed-off-by: Cong Wang +Signed-off-by: Cong Wang +Signed-off-by: Peter Zijlstra +Cc: Paul Mackerras +Cc: Arnaldo Carvalho de Melo +Cc: Linus Torvalds +Link: http://lkml.kernel.org/r/1409696840-843-1-git-send-email-xiyou.wangcong@gmail.com +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/events/core.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -1523,6 +1523,11 @@ retry: + */ + if (ctx->is_active) { + raw_spin_unlock_irq(&ctx->lock); ++ /* ++ * Reload the task pointer, it might have been changed by ++ * a concurrent perf_event_context_sched_out(). ++ */ ++ task = ctx->task; + goto retry; + } + +@@ -1966,6 +1971,11 @@ retry: + */ + if (ctx->is_active) { + raw_spin_unlock_irq(&ctx->lock); ++ /* ++ * Reload the task pointer, it might have been changed by ++ * a concurrent perf_event_context_sched_out(). ++ */ ++ task = ctx->task; + goto retry; + } + diff --git a/queue-3.16/revert-pci-don-t-scan-random-busses-in-pci_scan_bridge.patch b/queue-3.16/revert-pci-don-t-scan-random-busses-in-pci_scan_bridge.patch new file mode 100644 index 00000000000..44aff91cd11 --- /dev/null +++ b/queue-3.16/revert-pci-don-t-scan-random-busses-in-pci_scan_bridge.patch @@ -0,0 +1,70 @@ +From 7a0b33d4a45d30b9a838fba4efcd80b7b57d4d16 Mon Sep 17 00:00:00 2001 +From: Bjorn Helgaas +Date: Fri, 19 Sep 2014 10:56:06 -0600 +Subject: Revert "PCI: Don't scan random busses in pci_scan_bridge()" + +From: Bjorn Helgaas + +commit 7a0b33d4a45d30b9a838fba4efcd80b7b57d4d16 upstream. + +This reverts commit fc1b253141b3 ("PCI: Don't scan random busses in +pci_scan_bridge()") because it breaks CardBus on some machines. + +David tested a Dell Latitude D505 that worked like this prior to +fc1b253141b3: + + pci 0000:00:1e.0: PCI bridge to [bus 01] + pci 0000:01:01.0: CardBus bridge to [bus 02-05] + +Note that the 01:01.0 CardBus bridge has a bus number aperture of +[bus 02-05], but those buses are all outside the 00:1e.0 PCI bridge bus +number aperture, so accesses to buses 02-05 never reach CardBus. This is +later patched up by yenta_fixup_parent_bridge(), which changes the +subordinate bus number of the 00:1e.0 PCI bridge: + + pci_bus 0000:01: Raising subordinate bus# of parent bus (#01) from #01 to #05 + +With fc1b253141b3, pci_scan_bridge() fails immediately when it notices that +we can't allocate a valid secondary bus number for the CardBus bridge, and +CardBus doesn't work at all: + + pci 0000:01:01.0: can't allocate child bus 01 from [bus 01] + +I'd prefer to fix this by integrating the yenta_fixup_parent_bridge() logic +into pci_scan_bridge() so we fix the bus number apertures up front. But +I don't think we can do that before v3.17, so I'm going to revert this to +avoid the problem while we're working on the long-term fix. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=83441 +Link: http://lkml.kernel.org/r/1409303414-5196-1-git-send-email-david.henningsson@canonical.com +Reported-by: David Henningsson +Tested-by: David Henningsson +Signed-off-by: Bjorn Helgaas +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/probe.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/drivers/pci/probe.c ++++ b/drivers/pci/probe.c +@@ -838,16 +838,12 @@ int pci_scan_bridge(struct pci_bus *bus, + goto out; + } + +- if (max >= bus->busn_res.end) { +- dev_warn(&dev->dev, "can't allocate child bus %02x from %pR\n", +- max, &bus->busn_res); +- goto out; +- } +- + /* Clear errors */ + pci_write_config_word(dev, PCI_STATUS, 0xffff); + +- /* The bus will already exist if we are rescanning */ ++ /* Prevent assigning a bus number that already exists. ++ * This can happen when a bridge is hot-plugged, so in ++ * this case we only re-scan this bus. */ + child = pci_find_bus(pci_domain_nr(bus), max+1); + if (!child) { + child = pci_add_new_bus(bus, dev, max+1); diff --git a/queue-3.16/series b/queue-3.16/series index 9b21ae53edd..507c5fba7df 100644 --- a/queue-3.16/series +++ b/queue-3.16/series @@ -298,3 +298,14 @@ ib-qib-correct-reference-counting-in-debugfs-qp_stats.patch ib-mlx4-avoid-null-pointer-dereference-in-mlx4_ib_scan_netdevs.patch ib-mlx4-don-t-duplicate-the-default-roce-gid.patch ib-core-when-marshaling-uverbs-path-clear-unused-fields.patch +spi-fsl-don-t-use-devm_kzalloc-in-master-setup-callback.patch +spi-dw-don-t-use-devm_kzalloc-in-master-setup-callback.patch +spi-sirf-enable-rx_io_dma_int-interrupt.patch +fix-unbalanced-mutex-in-dma_pool_create.patch +perf-fix-a-race-condition-in-perf_remove_from_context.patch +arm-armv7-perf-fix-armv7-ref-cycles-error.patch +pci-add-pci_ignore_hotplug-to-ignore-hotplug-events-for-a-device.patch +revert-pci-don-t-scan-random-busses-in-pci_scan_bridge.patch +vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch +drm-nouveau-runpm-fix-module-unload.patch +drm-radeon-px-fix-module-unload.patch diff --git a/queue-3.16/spi-dw-don-t-use-devm_kzalloc-in-master-setup-callback.patch b/queue-3.16/spi-dw-don-t-use-devm_kzalloc-in-master-setup-callback.patch new file mode 100644 index 00000000000..7729aa6fb82 --- /dev/null +++ b/queue-3.16/spi-dw-don-t-use-devm_kzalloc-in-master-setup-callback.patch @@ -0,0 +1,89 @@ +From a97c883a16da7e0691a3be5465926c92a8da4da6 Mon Sep 17 00:00:00 2001 +From: Axel Lin +Date: Sun, 31 Aug 2014 12:47:06 +0800 +Subject: spi: dw: Don't use devm_kzalloc in master->setup callback + +From: Axel Lin + +commit a97c883a16da7e0691a3be5465926c92a8da4da6 upstream. + +device_add() expects that any memory allocated via devm_* API is only +done in the device's probe function. + +Fix below boot warning: +WARNING: CPU: 1 PID: 1 at drivers/base/dd.c:286 driver_probe_device+0x2b4/0x2f4() +Modules linked in: +CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.16.0-10474-g835c90b-dirty #160 +[] (unwind_backtrace) from [] (show_stack+0x20/0x24) +[] (show_stack) from [] (dump_stack+0x7c/0x98) +[] (dump_stack) from [] (warn_slowpath_common+0x78/0x9c) +[] (warn_slowpath_common) from [] (warn_slowpath_null+0x2c/0x34) +[] (warn_slowpath_null) from [] (driver_probe_device+0x2b4/0x2f4) +[] (driver_probe_device) from [] (__device_attach+0x50/0x54) +[] (__device_attach) from [] (bus_for_each_drv+0x54/0x9c) +[] (bus_for_each_drv) from [] (device_attach+0x84/0x90) +[] (device_attach) from [] (bus_probe_device+0x94/0xb8) +[] (bus_probe_device) from [] (device_add+0x434/0x4fc) +[] (device_add) from [] (spi_add_device+0x98/0x164) +[] (spi_add_device) from [] (spi_register_master+0x598/0x768) +[] (spi_register_master) from [] (devm_spi_register_master+0x40/0x80) +[] (devm_spi_register_master) from [] (dw_spi_add_host+0x1a8/0x258) +[] (dw_spi_add_host) from [] (dw_spi_mmio_probe+0x1d4/0x294) +[] (dw_spi_mmio_probe) from [] (platform_drv_probe+0x3c/0x6c) +[] (platform_drv_probe) from [] (driver_probe_device+0xec/0x2f4) +[] (driver_probe_device) from [] (__driver_attach+0x9c/0xa0) +[] (__driver_attach) from [] (bus_for_each_dev+0x64/0x98) +[] (bus_for_each_dev) from [] (driver_attach+0x2c/0x30) +[] (driver_attach) from [] (bus_add_driver+0xdc/0x1f4) +[] (bus_add_driver) from [] (driver_register+0x88/0x104) +[] (driver_register) from [] (__platform_driver_register+0x58/0x6c) +[] (__platform_driver_register) from [] (dw_spi_mmio_driver_init+0x18/0x20) +[] (dw_spi_mmio_driver_init) from [] (do_one_initcall+0x90/0x1d4) +[] (do_one_initcall) from [] (kernel_init_freeable+0x178/0x248) +[] (kernel_init_freeable) from [] (kernel_init+0x18/0xfc) +[] (kernel_init) from [] (ret_from_fork+0x14/0x20) + +Reported-by: Thor Thayer +Signed-off-by: Axel Lin +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-dw.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/spi/spi-dw.c ++++ b/drivers/spi/spi-dw.c +@@ -547,8 +547,7 @@ static int dw_spi_setup(struct spi_devic + /* Only alloc on first setup */ + chip = spi_get_ctldata(spi); + if (!chip) { +- chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), +- GFP_KERNEL); ++ chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); + if (!chip) + return -ENOMEM; + spi_set_ctldata(spi, chip); +@@ -606,6 +605,14 @@ static int dw_spi_setup(struct spi_devic + return 0; + } + ++static void dw_spi_cleanup(struct spi_device *spi) ++{ ++ struct chip_data *chip = spi_get_ctldata(spi); ++ ++ kfree(chip); ++ spi_set_ctldata(spi, NULL); ++} ++ + /* Restart the controller, disable all interrupts, clean rx fifo */ + static void spi_hw_init(struct dw_spi *dws) + { +@@ -661,6 +668,7 @@ int dw_spi_add_host(struct device *dev, + master->bus_num = dws->bus_num; + master->num_chipselect = dws->num_cs; + master->setup = dw_spi_setup; ++ master->cleanup = dw_spi_cleanup; + master->transfer_one_message = dw_spi_transfer_one_message; + master->max_speed_hz = dws->max_freq; + diff --git a/queue-3.16/spi-fsl-don-t-use-devm_kzalloc-in-master-setup-callback.patch b/queue-3.16/spi-fsl-don-t-use-devm_kzalloc-in-master-setup-callback.patch new file mode 100644 index 00000000000..e23b600e97a --- /dev/null +++ b/queue-3.16/spi-fsl-don-t-use-devm_kzalloc-in-master-setup-callback.patch @@ -0,0 +1,143 @@ +From d9f26748128c73ec6bed2846ca52fb1c2edc3ced Mon Sep 17 00:00:00 2001 +From: Axel Lin +Date: Sun, 31 Aug 2014 12:44:09 +0800 +Subject: spi: fsl: Don't use devm_kzalloc in master->setup callback + +From: Axel Lin + +commit d9f26748128c73ec6bed2846ca52fb1c2edc3ced upstream. + +device_add() expects that any memory allocated via devm_* API is only +done in the device's probe function. + +Fix below boot warning: +[ 3.092348] WARNING: at drivers/base/dd.c:286 +[ 3.096637] Modules linked in: +[ 3.099697] CPU: 0 PID: 25 Comm: kworker/u2:1 Tainted: G W 3.16.1-s3k-drv-999-svn5771_knld-999 #158 +[ 3.109610] Workqueue: deferwq deferred_probe_work_func +[ 3.114736] task: c787f020 ti: c790c000 task.ti: c790c000 +[ 3.120062] NIP: c01df158 LR: c01df144 CTR: 00000000 +[ 3.124983] REGS: c790db30 TRAP: 0700 Tainted: G W (3.16.1-s3k-drv-999-svn5771_knld-999) +[ 3.134162] MSR: 00029032 CR: 22002082 XER: 20000000 +[ 3.140703] +[ 3.140703] GPR00: 00000001 c790dbe0 c787f020 00000044 00000054 00000308 c056da0e 20737069 +[ 3.140703] GPR08: 33323736 000ebfe0 00000308 000ebfdf 22002082 00000000 c046c5a0 c046c608 +[ 3.140703] GPR16: c046c614 c046c620 c046c62c c046c638 c046c648 c046c654 c046c68c c046c6c4 +[ 3.140703] GPR24: 00000000 00000000 00000003 c0401aa0 c0596638 c059662c c054e7a8 c7996800 +[ 3.170102] NIP [c01df158] driver_probe_device+0xf8/0x334 +[ 3.175431] LR [c01df144] driver_probe_device+0xe4/0x334 +[ 3.180633] Call Trace: +[ 3.183093] [c790dbe0] [c01df144] driver_probe_device+0xe4/0x334 (unreliable) +[ 3.190147] [c790dc10] [c01dd15c] bus_for_each_drv+0x7c/0xc0 +[ 3.195741] [c790dc40] [c01df5fc] device_attach+0xcc/0xf8 +[ 3.201076] [c790dc60] [c01dd6d4] bus_probe_device+0xb4/0xc4 +[ 3.206666] [c790dc80] [c01db9f8] device_add+0x270/0x564 +[ 3.211923] [c790dcc0] [c0219e84] spi_add_device+0xc0/0x190 +[ 3.217427] [c790dce0] [c021a79c] spi_register_master+0x720/0x834 +[ 3.223455] [c790dd40] [c021cb48] of_fsl_spi_probe+0x55c/0x614 +[ 3.229234] [c790dda0] [c01e0d2c] platform_drv_probe+0x30/0x74 +[ 3.234987] [c790ddb0] [c01df18c] driver_probe_device+0x12c/0x334 +[ 3.241008] [c790dde0] [c01dd15c] bus_for_each_drv+0x7c/0xc0 +[ 3.246602] [c790de10] [c01df5fc] device_attach+0xcc/0xf8 +[ 3.251937] [c790de30] [c01dd6d4] bus_probe_device+0xb4/0xc4 +[ 3.257536] [c790de50] [c01de9d8] deferred_probe_work_func+0x98/0xe0 +[ 3.263816] [c790de70] [c00305b8] process_one_work+0x18c/0x440 +[ 3.269577] [c790dea0] [c0030a00] worker_thread+0x194/0x67c +[ 3.275105] [c790def0] [c0039198] kthread+0xd0/0xe4 +[ 3.279911] [c790df40] [c000c6d0] ret_from_kernel_thread+0x5c/0x64 +[ 3.285970] Instruction dump: +[ 3.288900] 80de0000 419e01d0 3b7b0038 3c60c046 7f65db78 38635264 48211b99 813f00a0 +[ 3.296559] 381f00a0 7d290278 3169ffff 7c0b4910 <0f000000> 93df0044 7fe3fb78 4bfffd4d + +Reported-by: leroy christophe +Signed-off-by: Axel Lin +Tested-by: Christophe Leroy +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-fsl-espi.c | 15 ++++++++++++--- + drivers/spi/spi-fsl-spi.c | 10 +++++++--- + 2 files changed, 19 insertions(+), 6 deletions(-) + +--- a/drivers/spi/spi-fsl-espi.c ++++ b/drivers/spi/spi-fsl-espi.c +@@ -452,16 +452,16 @@ static int fsl_espi_setup(struct spi_dev + int retval; + u32 hw_mode; + u32 loop_mode; +- struct spi_mpc8xxx_cs *cs = spi->controller_state; ++ struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); + + if (!spi->max_speed_hz) + return -EINVAL; + + if (!cs) { +- cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); ++ cs = kzalloc(sizeof(*cs), GFP_KERNEL); + if (!cs) + return -ENOMEM; +- spi->controller_state = cs; ++ spi_set_ctldata(spi, cs); + } + + mpc8xxx_spi = spi_master_get_devdata(spi->master); +@@ -496,6 +496,14 @@ static int fsl_espi_setup(struct spi_dev + return 0; + } + ++static void fsl_espi_cleanup(struct spi_device *spi) ++{ ++ struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); ++ ++ kfree(cs); ++ spi_set_ctldata(spi, NULL); ++} ++ + void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) + { + struct fsl_espi_reg *reg_base = mspi->reg_base; +@@ -605,6 +613,7 @@ static struct spi_master * fsl_espi_prob + + master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); + master->setup = fsl_espi_setup; ++ master->cleanup = fsl_espi_cleanup; + + mpc8xxx_spi = spi_master_get_devdata(master); + mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; +--- a/drivers/spi/spi-fsl-spi.c ++++ b/drivers/spi/spi-fsl-spi.c +@@ -425,16 +425,16 @@ static int fsl_spi_setup(struct spi_devi + struct fsl_spi_reg *reg_base; + int retval; + u32 hw_mode; +- struct spi_mpc8xxx_cs *cs = spi->controller_state; ++ struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); + + if (!spi->max_speed_hz) + return -EINVAL; + + if (!cs) { +- cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); ++ cs = kzalloc(sizeof(*cs), GFP_KERNEL); + if (!cs) + return -ENOMEM; +- spi->controller_state = cs; ++ spi_set_ctldata(spi, cs); + } + mpc8xxx_spi = spi_master_get_devdata(spi->master); + +@@ -496,9 +496,13 @@ static int fsl_spi_setup(struct spi_devi + static void fsl_spi_cleanup(struct spi_device *spi) + { + struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); ++ struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); + + if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) + gpio_free(spi->cs_gpio); ++ ++ kfree(cs); ++ spi_set_ctldata(spi, NULL); + } + + static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) diff --git a/queue-3.16/spi-sirf-enable-rx_io_dma_int-interrupt.patch b/queue-3.16/spi-sirf-enable-rx_io_dma_int-interrupt.patch new file mode 100644 index 00000000000..268c643af49 --- /dev/null +++ b/queue-3.16/spi-sirf-enable-rx_io_dma_int-interrupt.patch @@ -0,0 +1,39 @@ +From f2a08b404691ef3e7be6ce81c185335cfc68b6db Mon Sep 17 00:00:00 2001 +From: Qipan Li +Date: Tue, 2 Sep 2014 17:01:03 +0800 +Subject: spi: sirf: enable RX_IO_DMA_INT interrupt + +From: Qipan Li + +commit f2a08b404691ef3e7be6ce81c185335cfc68b6db upstream. + +in spi interrupt handler, we need check RX_IO_DMA status to ensure +rx fifo have received the specify count data. + +if not set, the while statement in spi isr function will keep loop, +at last, make the kernel hang. + +[The code is actually there in the interrupt handler but apparently it +needs the interrupt unmasking so the handler sees the status -- broonie] + +Signed-off-by: Qipan Li +Signed-off-by: Barry Song +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-sirf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-sirf.c ++++ b/drivers/spi/spi-sirf.c +@@ -438,7 +438,8 @@ static void spi_sirfsoc_pio_transfer(str + sspi->tx_word(sspi); + writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | + SIRFSOC_SPI_TX_UFLOW_INT_EN | +- SIRFSOC_SPI_RX_OFLOW_INT_EN, ++ SIRFSOC_SPI_RX_OFLOW_INT_EN | ++ SIRFSOC_SPI_RX_IO_DMA_INT_EN, + sspi->base + SIRFSOC_SPI_INT_EN); + writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, + sspi->base + SIRFSOC_SPI_TX_RX_EN); diff --git a/queue-3.16/vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch b/queue-3.16/vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch new file mode 100644 index 00000000000..817e111e6ff --- /dev/null +++ b/queue-3.16/vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch @@ -0,0 +1,61 @@ +From 766a53d059d1500c9755c8af017bd411bd8f1b20 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 12 Sep 2014 17:51:29 -0400 +Subject: vgaswitcheroo: add vga_switcheroo_fini_domain_pm_ops +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 766a53d059d1500c9755c8af017bd411bd8f1b20 upstream. + +Drivers should call this on unload to unregister pmops. + +Bug: +https://bugzilla.kernel.org/show_bug.cgi?id=84431 + +Reviewed-by: Ben Skeggs +Signed-off-by: Alex Deucher +Signed-off-by: Pali Rohár +Cc: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/vga/vga_switcheroo.c | 6 ++++++ + include/linux/vga_switcheroo.h | 2 ++ + 2 files changed, 8 insertions(+) + +--- a/drivers/gpu/vga/vga_switcheroo.c ++++ b/drivers/gpu/vga/vga_switcheroo.c +@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(st + } + EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); + ++void vga_switcheroo_fini_domain_pm_ops(struct device *dev) ++{ ++ dev->pm_domain = NULL; ++} ++EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops); ++ + static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) + { + struct pci_dev *pdev = to_pci_dev(dev); +--- a/include/linux/vga_switcheroo.h ++++ b/include/linux/vga_switcheroo.h +@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(stru + void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); + + int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); ++void vga_switcheroo_fini_domain_pm_ops(struct device *dev); + int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); + #else + +@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_cli + static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} + + static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } ++static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {} + static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } + + #endif