From 33855dc817047725c26e6f188f31bff5871faba9 Mon Sep 17 00:00:00 2001 From: Joanna Rutkowska Date: Wed, 22 Feb 2012 20:08:24 +0100 Subject: [PATCH] Trying to fix resume isse on my T420s... --- ...ioapic-Fix-potential-resume-deadlock.patch | 50 +++++++ ...ze-the-output-registers-after-resume.patch | 126 ++++++++++++++++++ series-xenlinux.conf | 3 + 3 files changed, 179 insertions(+) create mode 100644 patches.arch/0001-x86-ioapic-Fix-potential-resume-deadlock.patch create mode 100644 patches.drivers/0001-drm-i915-Sanitize-the-output-registers-after-resume.patch diff --git a/patches.arch/0001-x86-ioapic-Fix-potential-resume-deadlock.patch b/patches.arch/0001-x86-ioapic-Fix-potential-resume-deadlock.patch new file mode 100644 index 0000000..5ed5133 --- /dev/null +++ b/patches.arch/0001-x86-ioapic-Fix-potential-resume-deadlock.patch @@ -0,0 +1,50 @@ +From b134eac05adf33188616bf53ea38dc6c7ee487e8 Mon Sep 17 00:00:00 2001 +From: Daniel J Blueman +Date: Wed, 18 May 2011 16:31:31 -0700 +Subject: [PATCH] x86, ioapic: Fix potential resume deadlock + +commit b64ce24daffb634b5b3133a2e411bd4de50654e8 upstream. + +Fix a potential deadlock when resuming; here the calling +function has disabled interrupts, so we cannot sleep. + +Change the memory allocation flag from GFP_KERNEL to GFP_ATOMIC. + +TODO: We can do away with this memory allocation during resume + by reusing the ioapic suspend/resume code that uses boot time + allocated buffers, but we want to keep this -stable patch + simple. + +Signed-off-by: Daniel J Blueman +Signed-off-by: Suresh Siddha +Link: http://lkml.kernel.org/r/20110518233157.385970138@sbsiddha-MOBL3.sc.intel.com +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/apic/io_apic.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c +index ca9e2a35..e437778 100644 +--- a/arch/x86/kernel/apic/io_apic.c ++++ b/arch/x86/kernel/apic/io_apic.c +@@ -615,14 +615,14 @@ struct IO_APIC_route_entry **alloc_ioapic_entries(void) + struct IO_APIC_route_entry **ioapic_entries; + + ioapic_entries = kzalloc(sizeof(*ioapic_entries) * nr_ioapics, +- GFP_KERNEL); ++ GFP_ATOMIC); + if (!ioapic_entries) + return 0; + + for (apic = 0; apic < nr_ioapics; apic++) { + ioapic_entries[apic] = + kzalloc(sizeof(struct IO_APIC_route_entry) * +- nr_ioapic_registers[apic], GFP_KERNEL); ++ nr_ioapic_registers[apic], GFP_ATOMIC); + if (!ioapic_entries[apic]) + goto nomem; + } +-- +1.7.6.5 + diff --git a/patches.drivers/0001-drm-i915-Sanitize-the-output-registers-after-resume.patch b/patches.drivers/0001-drm-i915-Sanitize-the-output-registers-after-resume.patch new file mode 100644 index 0000000..2a39ff8 --- /dev/null +++ b/patches.drivers/0001-drm-i915-Sanitize-the-output-registers-after-resume.patch @@ -0,0 +1,126 @@ +From 3cd8c73bebbc64ab13173931012ed4a58717b446 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Tue, 12 Apr 2011 18:06:51 +0100 +Subject: [PATCH 1/2] drm/i915: Sanitize the output registers after resume + +commit f6e5b1603b8bb7131b6778d0d4e2e5dda120a379 upstream. + +Similar to booting, we need to inspect the state left by the BIOS and +remove any conflicting bits before we take over. The example reported by +Seth Forshee is very similar to the bug we encountered with the state left +by grub2, that the crtc pipe<->planning mapping was reversed from our +expectations and so we failed to turn off the outputs when booting or, +in this case, resuming. This may be in fact the same bug, but triggered +at resume time. + +This patch rearranges the code we already have to clear up the +conflicting state upon init and calls it from reset (which is called +after we have lost control of the hardware, i.e. along both the boot and +resume paths) instead. + +Reported-and-tested-by: Seth Forshee +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35796 +Signed-off-by: Chris Wilson +Reviewed-by: Keith Packard +Signed-off-by: Keith Packard +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/intel_display.c | 68 ++++++++++++++++++---------------- + 1 files changed, 36 insertions(+), 32 deletions(-) + +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c +index cef853b..c7403e7 100644 +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -5764,36 +5764,6 @@ cleanup_work: + return ret; + } + +-static void intel_crtc_reset(struct drm_crtc *crtc) +-{ +- struct intel_crtc *intel_crtc = to_intel_crtc(crtc); +- +- /* Reset flags back to the 'unknown' status so that they +- * will be correctly set on the initial modeset. +- */ +- intel_crtc->dpms_mode = -1; +-} +- +-static struct drm_crtc_helper_funcs intel_helper_funcs = { +- .dpms = intel_crtc_dpms, +- .mode_fixup = intel_crtc_mode_fixup, +- .mode_set = intel_crtc_mode_set, +- .mode_set_base = intel_pipe_set_base, +- .mode_set_base_atomic = intel_pipe_set_base_atomic, +- .load_lut = intel_crtc_load_lut, +- .disable = intel_crtc_disable, +-}; +- +-static const struct drm_crtc_funcs intel_crtc_funcs = { +- .reset = intel_crtc_reset, +- .cursor_set = intel_crtc_cursor_set, +- .cursor_move = intel_crtc_cursor_move, +- .gamma_set = intel_crtc_gamma_set, +- .set_config = drm_crtc_helper_set_config, +- .destroy = intel_crtc_destroy, +- .page_flip = intel_crtc_page_flip, +-}; +- + static void intel_sanitize_modesetting(struct drm_device *dev, + int pipe, int plane) + { +@@ -5830,6 +5800,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev, + intel_disable_pipe(dev_priv, pipe); + } + ++static void intel_crtc_reset(struct drm_crtc *crtc) ++{ ++ struct drm_device *dev = crtc->dev; ++ struct intel_crtc *intel_crtc = to_intel_crtc(crtc); ++ ++ /* Reset flags back to the 'unknown' status so that they ++ * will be correctly set on the initial modeset. ++ */ ++ intel_crtc->dpms_mode = -1; ++ ++ /* We need to fix up any BIOS configuration that conflicts with ++ * our expectations. ++ */ ++ intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); ++} ++ ++static struct drm_crtc_helper_funcs intel_helper_funcs = { ++ .dpms = intel_crtc_dpms, ++ .mode_fixup = intel_crtc_mode_fixup, ++ .mode_set = intel_crtc_mode_set, ++ .mode_set_base = intel_pipe_set_base, ++ .mode_set_base_atomic = intel_pipe_set_base_atomic, ++ .load_lut = intel_crtc_load_lut, ++ .disable = intel_crtc_disable, ++}; ++ ++static const struct drm_crtc_funcs intel_crtc_funcs = { ++ .reset = intel_crtc_reset, ++ .cursor_set = intel_crtc_cursor_set, ++ .cursor_move = intel_crtc_cursor_move, ++ .gamma_set = intel_crtc_gamma_set, ++ .set_config = drm_crtc_helper_set_config, ++ .destroy = intel_crtc_destroy, ++ .page_flip = intel_crtc_page_flip, ++}; ++ + static void intel_crtc_init(struct drm_device *dev, int pipe) + { + drm_i915_private_t *dev_priv = dev->dev_private; +@@ -5879,8 +5885,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) + + setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, + (unsigned long)intel_crtc); +- +- intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); + } + + int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, +-- +1.7.6.5 + diff --git a/series-xenlinux.conf b/series-xenlinux.conf index 56de175..809ee75 100644 --- a/series-xenlinux.conf +++ b/series-xenlinux.conf @@ -126,6 +126,8 @@ patches.suse/x86-mark_rodata_rw.patch + patches.arch/0001-x86-ioapic-Fix-potential-resume-deadlock.patch + ######################################################## # x86 MCE/MCA (Machine Check Error/Architecture) extensions ######################################################## @@ -500,6 +502,7 @@ patches.drivers/0001-drm-i915-Use-ACPI-OpRegion-to-determine-lid-status.patch patches.drivers/0002-drm-i915-don-t-enable-plane-pipe-and-PLL-prematurely.patch patches.drivers/0003-drm-i915-add-pipe-plane-enable-disable-functions.patch + patches.drivers/0001-drm-i915-Sanitize-the-output-registers-after-resume.patch ######################################################## # video4linux