]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Mar 2014 02:04:15 +0000 (18:04 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Mar 2014 02:04:15 +0000 (18:04 -0800)
added patches:
acpi-processor-rework-processor-throttling-with-work_on_cpu.patch
acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch
i7core_edac-fix-pci-device-reference-count.patch
pci-enable-intx-if-bios-left-them-disabled.patch

queue-3.4/acpi-processor-rework-processor-throttling-with-work_on_cpu.patch [new file with mode: 0644]
queue-3.4/acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch [new file with mode: 0644]
queue-3.4/i7core_edac-fix-pci-device-reference-count.patch [new file with mode: 0644]
queue-3.4/pci-enable-intx-if-bios-left-them-disabled.patch [new file with mode: 0644]
queue-3.4/series

diff --git a/queue-3.4/acpi-processor-rework-processor-throttling-with-work_on_cpu.patch b/queue-3.4/acpi-processor-rework-processor-throttling-with-work_on_cpu.patch
new file mode 100644 (file)
index 0000000..a3c9b83
--- /dev/null
@@ -0,0 +1,173 @@
+From f3ca4164529b875374c410193bbbac0ee960895f Mon Sep 17 00:00:00 2001
+From: Lan Tianyu <tianyu.lan@intel.com>
+Date: Wed, 26 Feb 2014 21:03:05 +0800
+Subject: ACPI / processor: Rework processor throttling with work_on_cpu()
+
+From: Lan Tianyu <tianyu.lan@intel.com>
+
+commit f3ca4164529b875374c410193bbbac0ee960895f upstream.
+
+acpi_processor_set_throttling() uses set_cpus_allowed_ptr() to make
+sure that the (struct acpi_processor)->acpi_processor_set_throttling()
+callback will run on the right CPU.  However, the function may be
+called from a worker thread already bound to a different CPU in which
+case that won't work.
+
+Make acpi_processor_set_throttling() use work_on_cpu() as appropriate
+instead of abusing set_cpus_allowed_ptr().
+
+Reported-and-tested-by: Jiri Olsa <jolsa@redhat.com>
+Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
+[rjw: Changelog]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/processor_throttling.c |   69 ++++++++++++++++--------------------
+ 1 file changed, 32 insertions(+), 37 deletions(-)
+
+--- a/drivers/acpi/processor_throttling.c
++++ b/drivers/acpi/processor_throttling.c
+@@ -59,6 +59,12 @@ struct throttling_tstate {
+       int target_state;               /* target T-state */
+ };
++struct acpi_processor_throttling_arg {
++      struct acpi_processor *pr;
++      int target_state;
++      bool force;
++};
++
+ #define THROTTLING_PRECHANGE       (1)
+ #define THROTTLING_POSTCHANGE      (2)
+@@ -1062,16 +1068,24 @@ static int acpi_processor_set_throttling
+       return 0;
+ }
++static long acpi_processor_throttling_fn(void *data)
++{
++      struct acpi_processor_throttling_arg *arg = data;
++      struct acpi_processor *pr = arg->pr;
++
++      return pr->throttling.acpi_processor_set_throttling(pr,
++                      arg->target_state, arg->force);
++}
++
+ int acpi_processor_set_throttling(struct acpi_processor *pr,
+                                               int state, bool force)
+ {
+-      cpumask_var_t saved_mask;
+       int ret = 0;
+       unsigned int i;
+       struct acpi_processor *match_pr;
+       struct acpi_processor_throttling *p_throttling;
++      struct acpi_processor_throttling_arg arg;
+       struct throttling_tstate t_state;
+-      cpumask_var_t online_throttling_cpus;
+       if (!pr)
+               return -EINVAL;
+@@ -1082,14 +1096,6 @@ int acpi_processor_set_throttling(struct
+       if ((state < 0) || (state > (pr->throttling.state_count - 1)))
+               return -EINVAL;
+-      if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
+-              return -ENOMEM;
+-
+-      if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) {
+-              free_cpumask_var(saved_mask);
+-              return -ENOMEM;
+-      }
+-
+       if (cpu_is_offline(pr->id)) {
+               /*
+                * the cpu pointed by pr->id is offline. Unnecessary to change
+@@ -1098,17 +1104,15 @@ int acpi_processor_set_throttling(struct
+               return -ENODEV;
+       }
+-      cpumask_copy(saved_mask, &current->cpus_allowed);
+       t_state.target_state = state;
+       p_throttling = &(pr->throttling);
+-      cpumask_and(online_throttling_cpus, cpu_online_mask,
+-                  p_throttling->shared_cpu_map);
++
+       /*
+        * The throttling notifier will be called for every
+        * affected cpu in order to get one proper T-state.
+        * The notifier event is THROTTLING_PRECHANGE.
+        */
+-      for_each_cpu(i, online_throttling_cpus) {
++      for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {
+               t_state.cpu = i;
+               acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,
+                                                       &t_state);
+@@ -1120,21 +1124,18 @@ int acpi_processor_set_throttling(struct
+        * it can be called only for the cpu pointed by pr.
+        */
+       if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
+-              /* FIXME: use work_on_cpu() */
+-              if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) {
+-                      /* Can't migrate to the pr->id CPU. Exit */
+-                      ret = -ENODEV;
+-                      goto exit;
+-              }
+-              ret = p_throttling->acpi_processor_set_throttling(pr,
+-                                              t_state.target_state, force);
++              arg.pr = pr;
++              arg.target_state = state;
++              arg.force = force;
++              ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg);
+       } else {
+               /*
+                * When the T-state coordination is SW_ALL or HW_ALL,
+                * it is necessary to set T-state for every affected
+                * cpus.
+                */
+-              for_each_cpu(i, online_throttling_cpus) {
++              for_each_cpu_and(i, cpu_online_mask,
++                  p_throttling->shared_cpu_map) {
+                       match_pr = per_cpu(processors, i);
+                       /*
+                        * If the pointer is invalid, we will report the
+@@ -1155,13 +1156,12 @@ int acpi_processor_set_throttling(struct
+                                       "on CPU %d\n", i));
+                               continue;
+                       }
+-                      t_state.cpu = i;
+-                      /* FIXME: use work_on_cpu() */
+-                      if (set_cpus_allowed_ptr(current, cpumask_of(i)))
+-                              continue;
+-                      ret = match_pr->throttling.
+-                              acpi_processor_set_throttling(
+-                              match_pr, t_state.target_state, force);
++
++                      arg.pr = match_pr;
++                      arg.target_state = state;
++                      arg.force = force;
++                      ret = work_on_cpu(pr->id, acpi_processor_throttling_fn,
++                              &arg);
+               }
+       }
+       /*
+@@ -1170,17 +1170,12 @@ int acpi_processor_set_throttling(struct
+        * affected cpu to update the T-states.
+        * The notifier event is THROTTLING_POSTCHANGE
+        */
+-      for_each_cpu(i, online_throttling_cpus) {
++      for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {
+               t_state.cpu = i;
+               acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE,
+                                                       &t_state);
+       }
+-      /* restore the previous state */
+-      /* FIXME: use work_on_cpu() */
+-      set_cpus_allowed_ptr(current, saved_mask);
+-exit:
+-      free_cpumask_var(online_throttling_cpus);
+-      free_cpumask_var(saved_mask);
++
+       return ret;
+ }
diff --git a/queue-3.4/acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch b/queue-3.4/acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch
new file mode 100644 (file)
index 0000000..2c6b8be
--- /dev/null
@@ -0,0 +1,74 @@
+From bd8ba20597f0cfef3ef65c3fd2aa92ab23d4c8e1 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Thu, 13 Feb 2014 16:32:51 +0100
+Subject: ACPI / video: Filter the _BCL table for duplicate brightness values
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit bd8ba20597f0cfef3ef65c3fd2aa92ab23d4c8e1 upstream.
+
+Some devices have duplicate entries in there brightness levels table, ie
+on my Dell Latitude E6430 the table looks like this:
+
+[    3.686060] acpi backlight index   0, val 80
+[    3.686095] acpi backlight index   1, val 50
+[    3.686122] acpi backlight index   2, val 5
+[    3.686147] acpi backlight index   3, val 5
+[    3.686172] acpi backlight index   4, val 5
+[    3.686197] acpi backlight index   5, val 5
+[    3.686223] acpi backlight index   6, val 5
+[    3.686248] acpi backlight index   7, val 5
+[    3.686273] acpi backlight index   8, val 6
+[    3.686332] acpi backlight index   9, val 7
+[    3.686356] acpi backlight index  10, val 8
+[    3.686380] acpi backlight index  11, val 9
+etc.
+
+Notice that brightness values 0-5 are all mapped to 5. This means that
+if userspace writes any value between 0 and 5 to the brightness sysfs attribute
+and then reads it, it will always return 0, which is somewhat unexpected.
+
+This is a problem for ie gnome-settings-daemon, which uses read-modify-write
+logic when the users presses the brightness up or down keys. This is done
+this way to take brightness changes from other sources into account.
+
+On this specific laptop what happens once the brightness has been set to 0,
+is that gsd reads 0, adds 5, writes 5, and on the next brightness up key press
+again reads 0, so things get stuck at the lowest brightness setting.
+
+Filtering out the duplicate table entries, makes any write to brightness
+read back as the written value as one would expect, fixing this.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Aaron Lu <aaron.lu@intel.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/video.c |    8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/drivers/acpi/video.c
++++ b/drivers/acpi/video.c
+@@ -632,6 +632,7 @@ acpi_video_init_brightness(struct acpi_v
+       union acpi_object *o;
+       struct acpi_video_device_brightness *br = NULL;
+       int result = -EINVAL;
++      u32 value;
+       if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
+@@ -662,7 +663,12 @@ acpi_video_init_brightness(struct acpi_v
+                       printk(KERN_ERR PREFIX "Invalid data\n");
+                       continue;
+               }
+-              br->levels[count] = (u32) o->integer.value;
++              value = (u32) o->integer.value;
++              /* Skip duplicate entries */
++              if (count > 2 && br->levels[count - 1] == value)
++                      continue;
++
++              br->levels[count] = value;
+               if (br->levels[count] > max_level)
+                       max_level = br->levels[count];
diff --git a/queue-3.4/i7core_edac-fix-pci-device-reference-count.patch b/queue-3.4/i7core_edac-fix-pci-device-reference-count.patch
new file mode 100644 (file)
index 0000000..d6a7c54
--- /dev/null
@@ -0,0 +1,60 @@
+From c0f5eeed0f4cef4f05b74883a7160e7edde58b6a Mon Sep 17 00:00:00 2001
+From: Jean Delvare <jdelvare@suse.de>
+Date: Mon, 24 Feb 2014 09:39:27 +0100
+Subject: i7core_edac: Fix PCI device reference count
+
+From: Jean Delvare <jdelvare@suse.de>
+
+commit c0f5eeed0f4cef4f05b74883a7160e7edde58b6a upstream.
+
+The reference count changes done by pci_get_device can be a little
+misleading when the usage diverges from the most common scheme. The
+reference count of the device passed as the last parameter is always
+decreased, even if the function returns no new device. So if we are
+going to try alternative device IDs, we must manually increment the
+device reference count before each retry. If we don't, we end up
+decreasing the reference count, and after a few modprobe/rmmod cycles
+the PCI devices will vanish.
+
+In other words and as Alan put it: without this fix the EDAC code
+corrupts the PCI device list.
+
+This fixes kernel bug #50491:
+https://bugzilla.kernel.org/show_bug.cgi?id=50491
+
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+Link: http://lkml.kernel.org/r/20140224093927.7659dd9d@endymion.delvare
+Reviewed-by: Alan Cox <alan@linux.intel.com>
+Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Cc: Doug Thompson <dougthompson@xmission.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/edac/i7core_edac.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/edac/i7core_edac.c
++++ b/drivers/edac/i7core_edac.c
+@@ -1365,14 +1365,19 @@ static int i7core_get_onedevice(struct p
+        * is at addr 8086:2c40, instead of 8086:2c41. So, we need
+        * to probe for the alternate address in case of failure
+        */
+-      if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev)
++      if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) {
++              pci_dev_get(*prev);     /* pci_get_device will put it */
+               pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
+                                     PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev);
++      }
+-      if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev)
++      if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE &&
++          !pdev) {
++              pci_dev_get(*prev);     /* pci_get_device will put it */
+               pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
+                                     PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT,
+                                     *prev);
++      }
+       if (!pdev) {
+               if (*prev) {
diff --git a/queue-3.4/pci-enable-intx-if-bios-left-them-disabled.patch b/queue-3.4/pci-enable-intx-if-bios-left-them-disabled.patch
new file mode 100644 (file)
index 0000000..145bdb7
--- /dev/null
@@ -0,0 +1,54 @@
+From 1f42db786b14a31bf807fc41ee5583a00c08fcb1 Mon Sep 17 00:00:00 2001
+From: Bjorn Helgaas <bhelgaas@google.com>
+Date: Fri, 14 Feb 2014 13:48:16 -0700
+Subject: PCI: Enable INTx if BIOS left them disabled
+
+From: Bjorn Helgaas <bhelgaas@google.com>
+
+commit 1f42db786b14a31bf807fc41ee5583a00c08fcb1 upstream.
+
+Some firmware leaves the Interrupt Disable bit set even if the device uses
+INTx interrupts.  Clear Interrupt Disable so we get those interrupts.
+
+Based on the report mentioned below, if the user selects the "EHCI only"
+option in the Intel Baytrail BIOS, the EHCI device is handed off to the OS
+with the PCI_COMMAND_INTX_DISABLE bit set.
+
+Link: http://lkml.kernel.org/r/20140114181721.GC12126@xanatos
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=70601
+Reported-by: Chris Cheng <chris.cheng@atrustcorp.com>
+Reported-and-tested-by: Jamie Chen <jamie.chen@intel.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pci/pci.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -1133,6 +1133,8 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_save
+ static int do_pci_enable_device(struct pci_dev *dev, int bars)
+ {
+       int err;
++      u16 cmd;
++      u8 pin;
+       err = pci_set_power_state(dev, PCI_D0);
+       if (err < 0 && err != -EIO)
+@@ -1142,6 +1144,14 @@ static int do_pci_enable_device(struct p
+               return err;
+       pci_fixup_device(pci_fixup_enable, dev);
++      pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
++      if (pin) {
++              pci_read_config_word(dev, PCI_COMMAND, &cmd);
++              if (cmd & PCI_COMMAND_INTX_DISABLE)
++                      pci_write_config_word(dev, PCI_COMMAND,
++                                            cmd & ~PCI_COMMAND_INTX_DISABLE);
++      }
++
+       return 0;
+ }
index ddc0e2e57be6620766a57b46c170f0f6ace026d8..e0602c747bafdce1c292b0a998951a3901516158 100644 (file)
@@ -27,3 +27,7 @@ powerpc-crashdump-fix-page-frame-number-check-in-copy_oldmem_page.patch
 perf-x86-fix-event-scheduling.patch
 ata-enable-quirk-from-jmicron-jmb350-for-jmb394.patch
 sata_sil-apply-mod15write-quirk-to-toshiba-mk2561gsyn.patch
+pci-enable-intx-if-bios-left-them-disabled.patch
+i7core_edac-fix-pci-device-reference-count.patch
+acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch
+acpi-processor-rework-processor-throttling-with-work_on_cpu.patch