LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 3.12 01/66] Input: serio - add firmware_id sysfs attribute
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 02/66] Input: i8042 - add firmware_id support Jiri Slaby
                   ` (66 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 0456c66f4e905e1ca839318219c770988b47975c upstream.

serio devices exposed via platform firmware interfaces such as ACPI may
provide additional identifying information of use to userspace.

We don't associate the serio devices with the firmware device (we don't
set it as parent), so there's no way for userspace to make use of this
information.

We cannot change the parent for serio devices instantiated though a
firmware interface as that would break suspend / resume ordering.

Therefore this patch adds a new firmware_id sysfs attribute so that
userspace can get a string from there with any additional identifying
information the firmware interface may provide.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/serio/serio.c | 13 +++++++++++++
 include/linux/serio.h       |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index de019ebb7e29..fffc0a69c6ff 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -474,11 +474,19 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
 	return retval;
 }
 
+static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct serio *serio = to_serio_port(dev);
+
+	return sprintf(buf, "%s\n", serio->firmware_id);
+}
+
 static struct device_attribute serio_device_attrs[] = {
 	__ATTR(description, S_IRUGO, serio_show_description, NULL),
 	__ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
 	__ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
 	__ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
+	__ATTR(firmware_id, S_IRUGO, firmware_id_show, NULL),
 	__ATTR_NULL
 };
 
@@ -912,9 +920,14 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
 	SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
 	SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
 	SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
+
 	SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
 				serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
 
+	if (serio->firmware_id[0])
+		SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s",
+				     serio->firmware_id);
+
 	return 0;
 }
 #undef SERIO_ADD_UEVENT_VAR
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 36aac733840a..9f779c7a2da4 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -23,6 +23,7 @@ struct serio {
 
 	char name[32];
 	char phys[32];
+	char firmware_id[128];
 
 	bool manual_bind;
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 02/66] Input: i8042 - add firmware_id support
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 01/66] Input: serio - add firmware_id sysfs attribute Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 03/66] Input: Add INPUT_PROP_TOPBUTTONPAD device property Jiri Slaby
                   ` (65 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit a7c5868c3482127cb308c779b8a6460a3353c17f upstream.

Fill in the new serio firmware_id sysfs attribute for pnp instantiated
8042 serio ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/serio/i8042-x86ia64io.h | 15 +++++++++++++++
 drivers/input/serio/i8042.c           |  6 ++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 2b888f1e6421..a4ac027637b9 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -746,6 +746,17 @@ static int i8042_pnp_aux_irq;
 static char i8042_pnp_kbd_name[32];
 static char i8042_pnp_aux_name[32];
 
+static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
+{
+	strlcpy(dst, "PNP:", dst_size);
+
+	while (id) {
+		strlcat(dst, " ", dst_size);
+		strlcat(dst, id->id, dst_size);
+		id = id->next;
+	}
+}
+
 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
 {
 	if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
@@ -762,6 +773,8 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
 		strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
 		strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
 	}
+	i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
+			       sizeof(i8042_kbd_firmware_id));
 
 	/* Keyboard ports are always supposed to be wakeup-enabled */
 	device_set_wakeup_enable(&dev->dev, true);
@@ -786,6 +799,8 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *
 		strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
 		strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
 	}
+	i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
+			       sizeof(i8042_aux_firmware_id));
 
 	i8042_pnp_aux_devices++;
 	return 0;
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 52c9ebf94729..03ab163857dd 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -87,6 +87,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
 #endif
 
 static bool i8042_bypass_aux_irq_test;
+static char i8042_kbd_firmware_id[128];
+static char i8042_aux_firmware_id[128];
 
 #include "i8042.h"
 
@@ -1218,6 +1220,8 @@ static int __init i8042_create_kbd_port(void)
 	serio->dev.parent	= &i8042_platform_device->dev;
 	strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
 	strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys));
+	strlcpy(serio->firmware_id, i8042_kbd_firmware_id,
+		sizeof(serio->firmware_id));
 
 	port->serio = serio;
 	port->irq = I8042_KBD_IRQ;
@@ -1244,6 +1248,8 @@ static int __init i8042_create_aux_port(int idx)
 	if (idx < 0) {
 		strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name));
 		strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
+		strlcpy(serio->firmware_id, i8042_aux_firmware_id,
+			sizeof(serio->firmware_id));
 		serio->close = i8042_port_close;
 	} else {
 		snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 03/66] Input: Add INPUT_PROP_TOPBUTTONPAD device property
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 01/66] Input: serio - add firmware_id sysfs attribute Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 02/66] Input: i8042 - add firmware_id support Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 04/66] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Jiri Slaby
                   ` (64 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit f37c013409bb78ebb958821aa10d069e707cabac upstream.

On some newer laptops with a trackpoint the physical buttons for the
trackpoint have been removed to allow for a larger touchpad. On these
laptops the buttonpad has clearly marked areas on the top which are to be
used as trackpad buttons.

Users of the event device-node need to know about this, so that they can
properly interpret BTN_LEFT events as being a left / right / middle click
depending on where on the button pad the clicking finger is.

This commits adds a INPUT_PROP_TOPBUTTONPAD device property which drivers
for such buttonpads will use to signal to the user that this buttonpad not
only has the normal bottom button area, but also a top button area.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/uapi/linux/input.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index a3726275876d..f30db096455f 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -164,6 +164,7 @@ struct input_keymap_entry {
 #define INPUT_PROP_DIRECT		0x01	/* direct input devices */
 #define INPUT_PROP_BUTTONPAD		0x02	/* has button(s) under pad */
 #define INPUT_PROP_SEMI_MT		0x03	/* touch rectangle only */
+#define INPUT_PROP_TOPBUTTONPAD		0x04	/* softbuttons at top of pad */
 
 #define INPUT_PROP_MAX			0x1f
 #define INPUT_PROP_CNT			(INPUT_PROP_MAX + 1)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 04/66] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2014-12-06 15:06 ` [PATCH 3.12 03/66] Input: Add INPUT_PROP_TOPBUTTONPAD device property Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 05/66] Input: synaptics - add a matches_pnp_id helper function Jiri Slaby
                   ` (63 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 43e19888b1fe2a3e8a5543030c5b286cde38b3f5 upstream.

Check PNP ID of the PS/2 AUX port and report INPUT_PROP_TOPBUTTONPAD
property for for touchpads with top button areas.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 55 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 4b7996ebd150..f4a5adc17d73 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,6 +117,44 @@ void synaptics_reset(struct psmouse *psmouse)
 }
 
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+/* This list has been kindly provided by Synaptics. */
+static const char * const topbuttonpad_pnp_ids[] = {
+	"LEN0017",
+	"LEN0018",
+	"LEN0019",
+	"LEN0023",
+	"LEN002A",
+	"LEN002B",
+	"LEN002C",
+	"LEN002D",
+	"LEN002E",
+	"LEN0033", /* Helix */
+	"LEN0034", /* T431s, T540, X1 Carbon 2nd */
+	"LEN0035", /* X240 */
+	"LEN0036", /* T440 */
+	"LEN0037",
+	"LEN0038",
+	"LEN0041",
+	"LEN0042", /* Yoga */
+	"LEN0045",
+	"LEN0046",
+	"LEN0047",
+	"LEN0048",
+	"LEN0049",
+	"LEN2000",
+	"LEN2001",
+	"LEN2002",
+	"LEN2003",
+	"LEN2004", /* L440 */
+	"LEN2005",
+	"LEN2006",
+	"LEN2007",
+	"LEN2008",
+	"LEN2009",
+	"LEN200A",
+	"LEN200B",
+	NULL
+};
 
 /*****************************************************************************
  *	Synaptics communications functions
@@ -1291,8 +1329,10 @@ static void set_abs_position_params(struct input_dev *dev,
 	input_abs_set_res(dev, y_code, priv->y_res);
 }
 
-static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
+static void set_input_params(struct psmouse *psmouse,
+			     struct synaptics_data *priv)
 {
+	struct input_dev *dev = psmouse->dev;
 	int i;
 
 	/* Things that apply to both modes */
@@ -1361,6 +1401,17 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
+		/* See if this buttonpad has a top button area */
+		if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) {
+			for (i = 0; topbuttonpad_pnp_ids[i]; i++) {
+				if (strstr(psmouse->ps2dev.serio->firmware_id,
+					   topbuttonpad_pnp_ids[i])) {
+					__set_bit(INPUT_PROP_TOPBUTTONPAD,
+						  dev->propbit);
+					break;
+				}
+			}
+		}
 		/* Clickpads report only left button */
 		__clear_bit(BTN_RIGHT, dev->keybit);
 		__clear_bit(BTN_MIDDLE, dev->keybit);
@@ -1687,7 +1738,7 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
 		     priv->capabilities, priv->ext_cap, priv->ext_cap_0c,
 		     priv->board_id, priv->firmware_id);
 
-	set_input_params(psmouse->dev, priv);
+	set_input_params(psmouse, priv);
 
 	/*
 	 * Encode touchpad model so that it can be used to set
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 05/66] Input: synaptics - add a matches_pnp_id helper function
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2014-12-06 15:06 ` [PATCH 3.12 04/66] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 06/66] Input: synaptics - change min/max quirk table to pnp-id matching Jiri Slaby
                   ` (62 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit e2f611029b370bb7a04236215ad4b36aa8cb98cd upstream.

This is a preparation patch for simplifying the min/max quirk table.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f4a5adc17d73..069c4fd1d0bb 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -156,6 +156,18 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	NULL
 };
 
+static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
+{
+	int i;
+
+	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
+		for (i = 0; ids[i]; i++)
+			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
+				return true;
+
+	return false;
+}
+
 /*****************************************************************************
  *	Synaptics communications functions
  ****************************************************************************/
@@ -1401,17 +1413,8 @@ static void set_input_params(struct psmouse *psmouse,
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
-		/* See if this buttonpad has a top button area */
-		if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) {
-			for (i = 0; topbuttonpad_pnp_ids[i]; i++) {
-				if (strstr(psmouse->ps2dev.serio->firmware_id,
-					   topbuttonpad_pnp_ids[i])) {
-					__set_bit(INPUT_PROP_TOPBUTTONPAD,
-						  dev->propbit);
-					break;
-				}
-			}
-		}
+		if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
+			__set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
 		/* Clickpads report only left button */
 		__clear_bit(BTN_RIGHT, dev->keybit);
 		__clear_bit(BTN_MIDDLE, dev->keybit);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 06/66] Input: synaptics - change min/max quirk table to pnp-id matching
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2014-12-06 15:06 ` [PATCH 3.12 05/66] Input: synaptics - add a matches_pnp_id helper function Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 07/66] Input: synaptics - fix resolution for manually provided min/max Jiri Slaby
                   ` (61 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 0f68f39c393bc06ac5ccc8794f0e2ed841e41c3e upstream.

Most of the affected models share pnp-ids for the touchpad. So switching
to pnp-ids give us 2 advantages:
1) It shrinks the quirk list
2) It will lower the new quirk addition frequency, ie the recently added W540
   quirk would not have been necessary since it uses the same LEN0034 pnp ids
   as other models already added before it

As an added bonus it actually puts the quirk on the actual psmouse, rather
then on the machine, which is technically more correct.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 149 ++++++++++------------------------------
 1 file changed, 36 insertions(+), 113 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 069c4fd1d0bb..87ec0f49ae98 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,6 +117,31 @@ void synaptics_reset(struct psmouse *psmouse)
 }
 
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+struct min_max_quirk {
+	const char * const *pnp_ids;
+	int x_min, x_max, y_min, y_max;
+};
+
+static const struct min_max_quirk min_max_pnpid_table[] = {
+	{
+		(const char * const []){"LEN0033", NULL},
+		1024, 5052, 2258, 4832
+	},
+	{
+		(const char * const []){"LEN0035", "LEN0042", NULL},
+		1232, 5710, 1156, 4696
+	},
+	{
+		(const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL},
+		1024, 5112, 2024, 4832
+	},
+	{
+		(const char * const []){"LEN2001", NULL},
+		1024, 5022, 2508, 4832
+	},
+	{ }
+};
+
 /* This list has been kindly provided by Synaptics. */
 static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0017",
@@ -129,7 +154,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN002D",
 	"LEN002E",
 	"LEN0033", /* Helix */
-	"LEN0034", /* T431s, T540, X1 Carbon 2nd */
+	"LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */
 	"LEN0035", /* X240 */
 	"LEN0036", /* T440 */
 	"LEN0037",
@@ -142,7 +167,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0048",
 	"LEN0049",
 	"LEN2000",
-	"LEN2001",
+	"LEN2001", /* Edge E431 */
 	"LEN2002",
 	"LEN2003",
 	"LEN2004", /* L440 */
@@ -316,20 +341,20 @@ static int synaptics_identify(struct psmouse *psmouse)
  * Resolution is left zero if touchpad does not support the query
  */
 
-static const int *quirk_min_max;
-
 static int synaptics_resolution(struct psmouse *psmouse)
 {
 	struct synaptics_data *priv = psmouse->private;
 	unsigned char resp[3];
+	int i;
 
-	if (quirk_min_max) {
-		priv->x_min = quirk_min_max[0];
-		priv->x_max = quirk_min_max[1];
-		priv->y_min = quirk_min_max[2];
-		priv->y_max = quirk_min_max[3];
-		return 0;
-	}
+	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
+		if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
+			priv->x_min = min_max_pnpid_table[i].x_min;
+			priv->x_max = min_max_pnpid_table[i].x_max;
+			priv->y_min = min_max_pnpid_table[i].y_min;
+			priv->y_max = min_max_pnpid_table[i].y_max;
+			return 0;
+		}
 
 	if (SYN_ID_MAJOR(priv->identity) < 4)
 		return 0;
@@ -1586,112 +1611,10 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = {
 	{ }
 };
 
-static const struct dmi_system_id min_max_dmi_table[] __initconst = {
-#if defined(CONFIG_DMI)
-	{
-		/* Lenovo ThinkPad Helix */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
-		},
-		.driver_data = (int []){1024, 5052, 2258, 4832},
-	},
-	{
-		/* Lenovo ThinkPad X240 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
-		},
-		.driver_data = (int []){1232, 5710, 1156, 4696},
-	},
-	{
-		/* Lenovo ThinkPad Edge E431 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"),
-		},
-		.driver_data = (int []){1024, 5022, 2508, 4832},
-	},
-	{
-		/* Lenovo ThinkPad T431s */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad T440s */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad L440 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad T540p */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad L540 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad W540 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W540"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo Yoga S1 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
-					"ThinkPad S1 Yoga"),
-		},
-		.driver_data = (int []){1232, 5710, 1156, 4696},
-	},
-	{
-		/* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION,
-					"ThinkPad X1 Carbon 2nd"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-#endif
-	{ }
-};
-
 void __init synaptics_module_init(void)
 {
-	const struct dmi_system_id *min_max_dmi;
-
 	impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
 	broken_olpc_ec = dmi_check_system(olpc_dmi_table);
-
-	min_max_dmi = dmi_first_match(min_max_dmi_table);
-	if (min_max_dmi)
-		quirk_min_max = min_max_dmi->driver_data;
 }
 
 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 07/66] Input: synaptics - fix resolution for manually provided min/max
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2014-12-06 15:06 ` [PATCH 3.12 06/66] Input: synaptics - change min/max quirk table to pnp-id matching Jiri Slaby
@ 2014-12-06 15:06 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 08/66] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Jiri Slaby
                   ` (60 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:06 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Tissoires, Dmitry Torokhov, Jiri Slaby

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit d49cb7aeebb974713f9f7ab2991352d3050b095b upstream.

commit 421e08c41fda fixed the reported min/max for the X and Y axis,
but unfortunately, it broke the resolution of those same axis.

On the t540p, the resolution is the same regarding X and Y. It is not
a problem for xf86-input-synaptics because this driver is only interested
in the ratio between X and Y.
Unfortunately, xf86-input-cmt uses directly the resolution, and having a
null resolution leads to some divide by 0 errors, which are translated by
-infinity in the resulting coordinates.

Reported-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 87ec0f49ae98..d4d46d2bbe5d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -347,15 +347,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
 	unsigned char resp[3];
 	int i;
 
-	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
-		if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
-			priv->x_min = min_max_pnpid_table[i].x_min;
-			priv->x_max = min_max_pnpid_table[i].x_max;
-			priv->y_min = min_max_pnpid_table[i].y_min;
-			priv->y_max = min_max_pnpid_table[i].y_max;
-			return 0;
-		}
-
 	if (SYN_ID_MAJOR(priv->identity) < 4)
 		return 0;
 
@@ -366,6 +357,16 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		}
 	}
 
+	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
+		if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
+			priv->x_min = min_max_pnpid_table[i].x_min;
+			priv->x_max = min_max_pnpid_table[i].x_max;
+			priv->y_min = min_max_pnpid_table[i].y_min;
+			priv->y_max = min_max_pnpid_table[i].y_max;
+			return 0;
+		}
+	}
+
 	if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
 	    SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
 		if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 08/66] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531)
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2014-12-06 15:06 ` [PATCH 3.12 07/66] Input: synaptics - fix resolution for manually provided min/max Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 09/66] Input: synaptics - add min/max quirk for Lenovo T440s Jiri Slaby
                   ` (59 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit e76aed9da7189eeb41b9856552ce5721181e8e8d upstream.

https://bugzilla.redhat.com/show_bug.cgi?id=1114768

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index d4d46d2bbe5d..a50a2a7a43f7 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -132,7 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1232, 5710, 1156, 4696
 	},
 	{
-		(const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL},
+		(const char * const []){"LEN0034", "LEN0036", "LEN2002",
+					"LEN2004", NULL},
 		1024, 5112, 2024, 4832
 	},
 	{
@@ -168,7 +169,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0049",
 	"LEN2000",
 	"LEN2001", /* Edge E431 */
-	"LEN2002",
+	"LEN2002", /* Edge E531 */
 	"LEN2003",
 	"LEN2004", /* L440 */
 	"LEN2005",
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 09/66] Input: synaptics - add min/max quirk for Lenovo T440s
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 08/66] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 10/66] PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs() fails Jiri Slaby
                   ` (58 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Dmitry Torokhov, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit e4742b1e786ca386e88e6cfb2801e14e15e365cd upstream.

The new Lenovo T440s laptop has a different PnP ID "LEN0039", and it
needs the similar min/max quirk to make its clickpad working.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=903748
Reported-and-tested-by: Joschi Brauchle <joschibrauchle@gmx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index a50a2a7a43f7..1e76eb8f06c7 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -132,8 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1232, 5710, 1156, 4696
 	},
 	{
-		(const char * const []){"LEN0034", "LEN0036", "LEN2002",
-					"LEN2004", NULL},
+		(const char * const []){"LEN0034", "LEN0036", "LEN0039",
+					"LEN2002", "LEN2004", NULL},
 		1024, 5112, 2024, 4832
 	},
 	{
@@ -160,6 +160,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0036", /* T440 */
 	"LEN0037",
 	"LEN0038",
+	"LEN0039", /* T440s */
 	"LEN0041",
 	"LEN0042", /* Yoga */
 	"LEN0045",
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 10/66] PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs() fails
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 09/66] Input: synaptics - add min/max quirk for Lenovo T440s Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 11/66] MIPS: oprofile: Fix backtrace on 64-bit kernel Jiri Slaby
                   ` (57 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexander Gordeev, Bjorn Helgaas, Jiri Slaby

From: Alexander Gordeev <agordeev@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 2adc7907bac2c72535894732c4b41f9210f9e577 upstream.

If populate_msi_sysfs() function failed msix_capability_init() must return
the error code, but it returns the success instead.  This update fixes the
described misbehaviour.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Tejun Heo <tj@kernel.org>

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/msi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d5f90d6383bc..b43f391dc8b6 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -719,7 +719,7 @@ static int msix_capability_init(struct pci_dev *dev,
 
 	ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
 	if (ret)
-		goto error;
+		goto out_avail;
 
 	/*
 	 * Some devices require MSI-X to be enabled before we can touch the
@@ -732,10 +732,8 @@ static int msix_capability_init(struct pci_dev *dev,
 	msix_program_entries(dev, entries);
 
 	ret = populate_msi_sysfs(dev);
-	if (ret) {
-		ret = 0;
-		goto error;
-	}
+	if (ret)
+		goto out_free;
 
 	/* Set MSI-X enabled bits and unmask the function */
 	pci_intx_for_msi(dev, 0);
@@ -746,7 +744,7 @@ static int msix_capability_init(struct pci_dev *dev,
 
 	return 0;
 
-error:
+out_avail:
 	if (ret < 0) {
 		/*
 		 * If we had some success, report the number of irqs
@@ -763,6 +761,7 @@ error:
 			ret = avail;
 	}
 
+out_free:
 	free_msi_irqs(dev);
 
 	return ret;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 11/66] MIPS: oprofile: Fix backtrace on 64-bit kernel
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 10/66] PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs() fails Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 12/66] MIPS: Loongson: Make platform serial setup always built-in Jiri Slaby
                   ` (56 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Aaro Koskinen, linux-mips, Ralf Baechle, Jiri Slaby

From: Aaro Koskinen <aaro.koskinen@nsn.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit bbaf113a481b6ce32444c125807ad3618643ce57 upstream.

Fix incorrect cast that always results in wrong address for the new
frame on 64-bit kernels.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8110/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/oprofile/backtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c
index 6854ed5097d2..83a1dfd8f0e3 100644
--- a/arch/mips/oprofile/backtrace.c
+++ b/arch/mips/oprofile/backtrace.c
@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame,
 				/* This marks the end of the previous function,
 				   which means we overran. */
 				break;
-			stack_size = (unsigned) stack_adjustment;
+			stack_size = (unsigned long) stack_adjustment;
 		} else if (is_ra_save_ins(&ip)) {
 			int ra_slot = ip.i_format.simmediate;
 			if (ra_slot < 0)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 12/66] MIPS: Loongson: Make platform serial setup always built-in.
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 11/66] MIPS: oprofile: Fix backtrace on 64-bit kernel Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 13/66] x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C Jiri Slaby
                   ` (55 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Aaro Koskinen, linux-mips, Huacai Chen,
	Markos Chandras, Ralf Baechle, Jiri Slaby

From: Aaro Koskinen <aaro.koskinen@iki.fi>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 26927f76499849e095714452b8a4e09350f6a3b9 upstream.

If SERIAL_8250 is compiled as a module, the platform specific setup
for Loongson will be a module too, and it will not work very well.
At least on Loongson 3 it will trigger a build failure,
since loongson_sysconf is not exported to modules.

Fix by making the platform specific serial code always built-in.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Reported-by: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Markos Chandras <Markos.Chandras@imgtec.com>
Patchwork: https://patchwork.linux-mips.org/patch/8533/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/loongson/common/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
index 9e4484ccbb03..9005a8d60969 100644
--- a/arch/mips/loongson/common/Makefile
+++ b/arch/mips/loongson/common/Makefile
@@ -11,7 +11,8 @@ obj-$(CONFIG_PCI) += pci.o
 # Serial port support
 #
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
-obj-$(CONFIG_SERIAL_8250) += serial.o
+loongson-serial-$(CONFIG_SERIAL_8250) := serial.o
+obj-y += $(loongson-serial-m) $(loongson-serial-y)
 obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o
 obj-$(CONFIG_LOONGSON_MC146818) += rtc.o
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 13/66] x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 12/66] MIPS: Loongson: Make platform serial setup always built-in Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS Jiri Slaby
                   ` (54 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andy Lutomirski, Linus Torvalds, Jiri Slaby

From: Andy Lutomirski <luto@amacapital.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit af726f21ed8af2cdaa4e93098dc211521218ae65 upstream.

There's nothing special enough about the espfix64 double fault fixup to
justify writing it in assembly.  Move it to C.

This also fixes a bug: if the double fault came from an IST stack, the
old asm code would return to a partially uninitialized stack frame.

Fixes: 3891a04aafd668686239349ea58f3314ea2af86b
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/entry_64.S | 34 ++--------------------------------
 arch/x86/kernel/traps.c    | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 207da8d92f75..c2ab43484b5d 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1053,6 +1053,7 @@ ENTRY(native_iret)
 	jnz native_irq_return_ldt
 #endif
 
+.global native_irq_return_iret
 native_irq_return_iret:
 	iretq
 	_ASM_EXTABLE(native_irq_return_iret, bad_iret)
@@ -1149,37 +1150,6 @@ ENTRY(retint_kernel)
 	CFI_ENDPROC
 END(common_interrupt)
 
-	/*
-	 * If IRET takes a fault on the espfix stack, then we
-	 * end up promoting it to a doublefault.  In that case,
-	 * modify the stack to make it look like we just entered
-	 * the #GP handler from user space, similar to bad_iret.
-	 */
-#ifdef CONFIG_X86_ESPFIX64
-	ALIGN
-__do_double_fault:
-	XCPT_FRAME 1 RDI+8
-	movq RSP(%rdi),%rax		/* Trap on the espfix stack? */
-	sarq $PGDIR_SHIFT,%rax
-	cmpl $ESPFIX_PGD_ENTRY,%eax
-	jne do_double_fault		/* No, just deliver the fault */
-	cmpl $__KERNEL_CS,CS(%rdi)
-	jne do_double_fault
-	movq RIP(%rdi),%rax
-	cmpq $native_irq_return_iret,%rax
-	jne do_double_fault		/* This shouldn't happen... */
-	movq PER_CPU_VAR(kernel_stack),%rax
-	subq $(6*8-KERNEL_STACK_OFFSET),%rax	/* Reset to original stack */
-	movq %rax,RSP(%rdi)
-	movq $0,(%rax)			/* Missing (lost) #GP error code */
-	movq $general_protection,RIP(%rdi)
-	retq
-	CFI_ENDPROC
-END(__do_double_fault)
-#else
-# define __do_double_fault do_double_fault
-#endif
-
 /*
  * End of kprobes section
  */
@@ -1370,7 +1340,7 @@ zeroentry overflow do_overflow
 zeroentry bounds do_bounds
 zeroentry invalid_op do_invalid_op
 zeroentry device_not_available do_device_not_available
-paranoiderrorentry double_fault __do_double_fault
+paranoiderrorentry double_fault do_double_fault
 zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
 errorentry invalid_TSS do_invalid_TSS
 errorentry segment_not_present do_segment_not_present
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 8c8093b146ca..8a2684f938b9 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -248,6 +248,30 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
 	static const char str[] = "double fault";
 	struct task_struct *tsk = current;
 
+#ifdef CONFIG_X86_ESPFIX64
+	extern unsigned char native_irq_return_iret[];
+
+	/*
+	 * If IRET takes a non-IST fault on the espfix64 stack, then we
+	 * end up promoting it to a doublefault.  In that case, modify
+	 * the stack to make it look like we just entered the #GP
+	 * handler from user space, similar to bad_iret.
+	 */
+	if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY &&
+		regs->cs == __KERNEL_CS &&
+		regs->ip == (unsigned long)native_irq_return_iret)
+	{
+		struct pt_regs *normal_regs = task_pt_regs(current);
+
+		/* Fake a #GP(0) from userspace. */
+		memmove(&normal_regs->ip, (void *)regs->sp, 5*8);
+		normal_regs->orig_ax = 0;  /* Missing (lost) #GP error code */
+		regs->ip = (unsigned long)general_protection;
+		regs->sp = (unsigned long)&normal_regs->orig_ax;
+		return;
+	}
+#endif
+
 	exception_enter();
 	/* Return not checked because double check cannot be ignored */
 	notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 13/66] x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-17 15:56   ` Borislav Petkov
  2014-12-06 15:07 ` [PATCH 3.12 15/66] x86_64, traps: Rework bad_iret Jiri Slaby
                   ` (53 subsequent siblings)
  67 siblings, 1 reply; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andy Lutomirski, Linus Torvalds, Jiri Slaby

From: Andy Lutomirski <luto@amacapital.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 6f442be2fb22be02cafa606f1769fa1e6f894441 upstream.

On a 32-bit kernel, this has no effect, since there are no IST stacks.

On a 64-bit kernel, #SS can only happen in user code, on a failed iret
to user space, a canonical violation on access via RSP or RBP, or a
genuine stack segment violation in 32-bit kernel code.  The first two
cases don't need IST, and the latter two cases are unlikely fatal bugs,
and promoting them to double faults would be fine.

This fixes a bug in which the espfix64 code mishandles a stack segment
violation.

This saves 4k of memory per CPU and a tiny bit of code.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/include/asm/page_32_types.h |  1 -
 arch/x86/include/asm/page_64_types.h | 11 +++++------
 arch/x86/kernel/dumpstack_64.c       |  1 -
 arch/x86/kernel/entry_64.S           |  2 +-
 arch/x86/kernel/traps.c              | 18 +-----------------
 5 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
index f48b17df4224..3a52ee0e726d 100644
--- a/arch/x86/include/asm/page_32_types.h
+++ b/arch/x86/include/asm/page_32_types.h
@@ -20,7 +20,6 @@
 #define THREAD_SIZE_ORDER	1
 #define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
 
-#define STACKFAULT_STACK 0
 #define DOUBLEFAULT_STACK 1
 #define NMI_STACK 0
 #define DEBUG_STACK 0
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 43dcd804ebd5..d1d2972a54db 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -14,12 +14,11 @@
 #define IRQ_STACK_ORDER 2
 #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
 
-#define STACKFAULT_STACK 1
-#define DOUBLEFAULT_STACK 2
-#define NMI_STACK 3
-#define DEBUG_STACK 4
-#define MCE_STACK 5
-#define N_EXCEPTION_STACKS 5  /* hw limit: 7 */
+#define DOUBLEFAULT_STACK 1
+#define NMI_STACK 2
+#define DEBUG_STACK 3
+#define MCE_STACK 4
+#define N_EXCEPTION_STACKS 4  /* hw limit: 7 */
 
 #define PUD_PAGE_SIZE		(_AC(1, UL) << PUD_SHIFT)
 #define PUD_PAGE_MASK		(~(PUD_PAGE_SIZE-1))
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index addb207dab92..66e274a3d968 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
 		[ DEBUG_STACK-1			]	= "#DB",
 		[ NMI_STACK-1			]	= "NMI",
 		[ DOUBLEFAULT_STACK-1		]	= "#DF",
-		[ STACKFAULT_STACK-1		]	= "#SS",
 		[ MCE_STACK-1			]	= "#MC",
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
 		[ N_EXCEPTION_STACKS ...
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index c2ab43484b5d..e310e82de5e6 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1510,7 +1510,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
 
 paranoidzeroentry_ist debug do_debug DEBUG_STACK
 paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
-paranoiderrorentry stack_segment do_stack_segment
+errorentry stack_segment do_stack_segment
 #ifdef CONFIG_XEN
 zeroentry xen_debug do_debug
 zeroentry xen_int3 do_int3
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 8a2684f938b9..b2d6c58b28b0 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -221,28 +221,12 @@ DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",
 		coprocessor_segment_overrun)
 DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
 DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present)
-#ifdef CONFIG_X86_32
 DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment)
-#endif
 DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check,
 		BUS_ADRALN, 0)
 
 #ifdef CONFIG_X86_64
 /* Runs on IST stack */
-dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
-{
-	enum ctx_state prev_state;
-
-	prev_state = exception_enter();
-	if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
-		       X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
-		preempt_conditional_sti(regs);
-		do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL);
-		preempt_conditional_cli(regs);
-	}
-	exception_exit(prev_state);
-}
-
 dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
 {
 	static const char str[] = "double fault";
@@ -776,7 +760,7 @@ void __init trap_init(void)
 	set_intr_gate(X86_TRAP_OLD_MF, &coprocessor_segment_overrun);
 	set_intr_gate(X86_TRAP_TS, &invalid_TSS);
 	set_intr_gate(X86_TRAP_NP, &segment_not_present);
-	set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK);
+	set_intr_gate(X86_TRAP_SS, stack_segment);
 	set_intr_gate(X86_TRAP_GP, &general_protection);
 	set_intr_gate(X86_TRAP_SPURIOUS, &spurious_interrupt_bug);
 	set_intr_gate(X86_TRAP_MF, &coprocessor_error);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 15/66] x86_64, traps: Rework bad_iret
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 16/66] x86: Require exact match for 'noxsave' command line option Jiri Slaby
                   ` (52 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andy Lutomirski, Linus Torvalds, Jiri Slaby

From: Andy Lutomirski <luto@amacapital.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit b645af2d5905c4e32399005b867987919cbfc3ae upstream.

It's possible for iretq to userspace to fail.  This can happen because
of a bad CS, SS, or RIP.

Historically, we've handled it by fixing up an exception from iretq to
land at bad_iret, which pretends that the failed iret frame was really
the hardware part of #GP(0) from userspace.  To make this work, there's
an extra fixup to fudge the gs base into a usable state.

This is suboptimal because it loses the original exception.  It's also
buggy because there's no guarantee that we were on the kernel stack to
begin with.  For example, if the failing iret happened on return from an
NMI, then we'll end up executing general_protection on the NMI stack.
This is bad for several reasons, the most immediate of which is that
general_protection, as a non-paranoid idtentry, will try to deliver
signals and/or schedule from the wrong stack.

This patch throws out bad_iret entirely.  As a replacement, it augments
the existing swapgs fudge into a full-blown iret fixup, mostly written
in C.  It's should be clearer and more correct.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/entry_64.S | 45 +++++++++++++++++++--------------------------
 arch/x86/kernel/traps.c    | 29 +++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 26 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e310e82de5e6..e96560628571 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1055,8 +1055,13 @@ ENTRY(native_iret)
 
 .global native_irq_return_iret
 native_irq_return_iret:
+	/*
+	 * This may fault.  Non-paranoid faults on return to userspace are
+	 * handled by fixup_bad_iret.  These include #SS, #GP, and #NP.
+	 * Double-faults due to espfix64 are handled in do_double_fault.
+	 * Other faults here are fatal.
+	 */
 	iretq
-	_ASM_EXTABLE(native_irq_return_iret, bad_iret)
 
 #ifdef CONFIG_X86_ESPFIX64
 native_irq_return_ldt:
@@ -1084,25 +1089,6 @@ native_irq_return_ldt:
 	jmp native_irq_return_iret
 #endif
 
-	.section .fixup,"ax"
-bad_iret:
-	/*
-	 * The iret traps when the %cs or %ss being restored is bogus.
-	 * We've lost the original trap vector and error code.
-	 * #GPF is the most likely one to get for an invalid selector.
-	 * So pretend we completed the iret and took the #GPF in user mode.
-	 *
-	 * We are now running with the kernel GS after exception recovery.
-	 * But error_entry expects us to have user GS to match the user %cs,
-	 * so swap back.
-	 */
-	pushq $0
-
-	SWAPGS
-	jmp general_protection
-
-	.previous
-
 	/* edi: workmask, edx: work */
 retint_careful:
 	CFI_RESTORE_STATE
@@ -1620,16 +1606,15 @@ error_sti:
 
 /*
  * There are two places in the kernel that can potentially fault with
- * usergs. Handle them here. The exception handlers after iret run with
- * kernel gs again, so don't set the user space flag. B stepping K8s
- * sometimes report an truncated RIP for IRET exceptions returning to
- * compat mode. Check for these here too.
+ * usergs. Handle them here.  B stepping K8s sometimes report a
+ * truncated RIP for IRET exceptions returning to compat mode. Check
+ * for these here too.
  */
 error_kernelspace:
 	incl %ebx
 	leaq native_irq_return_iret(%rip),%rcx
 	cmpq %rcx,RIP+8(%rsp)
-	je error_swapgs
+	je error_bad_iret
 	movl %ecx,%eax	/* zero extend */
 	cmpq %rax,RIP+8(%rsp)
 	je bstep_iret
@@ -1640,7 +1625,15 @@ error_kernelspace:
 bstep_iret:
 	/* Fix truncated RIP */
 	movq %rcx,RIP+8(%rsp)
-	jmp error_swapgs
+	/* fall through */
+
+error_bad_iret:
+	SWAPGS
+	mov %rsp,%rdi
+	call fixup_bad_iret
+	mov %rax,%rsp
+	decl %ebx	/* Return to usergs */
+	jmp error_sti
 	CFI_ENDPROC
 END(error_entry)
 
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index b2d6c58b28b0..5739ab5359a3 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -388,6 +388,35 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
 		*regs = *eregs;
 	return regs;
 }
+
+struct bad_iret_stack {
+	void *error_entry_ret;
+	struct pt_regs regs;
+};
+
+asmlinkage __visible
+struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
+{
+	/*
+	 * This is called from entry_64.S early in handling a fault
+	 * caused by a bad iret to user mode.  To handle the fault
+	 * correctly, we want move our stack frame to task_pt_regs
+	 * and we want to pretend that the exception came from the
+	 * iret target.
+	 */
+	struct bad_iret_stack *new_stack =
+		container_of(task_pt_regs(current),
+			     struct bad_iret_stack, regs);
+
+	/* Copy the IRET target to the new stack. */
+	memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8);
+
+	/* Copy the remainder of the stack from the current stack. */
+	memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip));
+
+	BUG_ON(!user_mode_vm(&new_stack->regs));
+	return new_stack;
+}
 #endif
 
 /*
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 16/66] x86: Require exact match for 'noxsave' command line option
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 15/66] x86_64, traps: Rework bad_iret Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 17/66] x86, mm: Set NX across entire PMD at boot Jiri Slaby
                   ` (51 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Dave Hansen, Dave Hansen, Fenghua Yu, x86,
	Thomas Gleixner, Jiri Slaby

From: Dave Hansen <dave.hansen@linux.intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 2cd3949f702692cf4c5d05b463f19cd706a92dd3 upstream.

We have some very similarly named command-line options:

arch/x86/kernel/cpu/common.c:__setup("noxsave", x86_xsave_setup);
arch/x86/kernel/cpu/common.c:__setup("noxsaveopt", x86_xsaveopt_setup);
arch/x86/kernel/cpu/common.c:__setup("noxsaves", x86_xsaves_setup);

__setup() is designed to match options that take arguments, like
"foo=bar" where you would have:

	__setup("foo", x86_foo_func...);

The problem is that "noxsave" actually _matches_ "noxsaves" in
the same way that "foo" matches "foo=bar".  If you boot an old
kernel that does not know about "noxsaves" with "noxsaves" on the
command line, it will interpret the argument as "noxsave", which
is not what you want at all.

This makes the "noxsave" handler only return success when it finds
an *exact* match.

[ tglx: We really need to make __setup() more robust. ]

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Hansen <dave@sr71.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/20141111220133.FE053984@viggo.jf.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/cpu/common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d5f63dacf030..00cc6f79615d 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -144,6 +144,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
 
 static int __init x86_xsave_setup(char *s)
 {
+	if (strlen(s))
+		return 0;
 	setup_clear_cpu_cap(X86_FEATURE_XSAVE);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
 	setup_clear_cpu_cap(X86_FEATURE_AVX);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 17/66] x86, mm: Set NX across entire PMD at boot
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 16/66] x86: Require exact match for 'noxsave' command line option Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 18/66] uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME Jiri Slaby
                   ` (50 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Kees Cook, Andy Lutomirski, Toshi Kani,
	Yasuaki Ishimatsu, David Vrabel, Wang Nan, Yinghai Lu,
	Thomas Gleixner, Jiri Slaby

From: Kees Cook <keescook@chromium.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 45e2a9d4701d8c624d4a4bcdd1084eae31e92f58 upstream.

When setting up permissions on kernel memory at boot, the end of the
PMD that was split from bss remained executable. It should be NX like
the rest. This performs a PMD alignment instead of a PAGE alignment to
get the correct span of memory.

Before:
---[ High Kernel Mapping ]---
...
0xffffffff8202d000-0xffffffff82200000  1868K     RW       GLB NX pte
0xffffffff82200000-0xffffffff82c00000    10M     RW   PSE GLB NX pmd
0xffffffff82c00000-0xffffffff82df5000  2004K     RW       GLB NX pte
0xffffffff82df5000-0xffffffff82e00000    44K     RW       GLB x  pte
0xffffffff82e00000-0xffffffffc0000000   978M                     pmd

After:
---[ High Kernel Mapping ]---
...
0xffffffff8202d000-0xffffffff82200000  1868K     RW       GLB NX pte
0xffffffff82200000-0xffffffff82e00000    12M     RW   PSE GLB NX pmd
0xffffffff82e00000-0xffffffffc0000000   978M                     pmd

[ tglx: Changed it to roundup(_brk_end, PMD_SIZE) and added a comment.
        We really should unmap the reminder along with the holes
        caused by init,initdata etc. but thats a different issue ]

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/20141114194737.GA3091@www.outflux.net
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/init_64.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 104d56a9245f..b599241aea81 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1110,7 +1110,7 @@ void mark_rodata_ro(void)
 	unsigned long end = (unsigned long) &__end_rodata_hpage_align;
 	unsigned long text_end = PFN_ALIGN(&__stop___ex_table);
 	unsigned long rodata_end = PFN_ALIGN(&__end_rodata);
-	unsigned long all_end = PFN_ALIGN(&_end);
+	unsigned long all_end;
 
 	printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
 	       (end - start) >> 10);
@@ -1121,7 +1121,16 @@ void mark_rodata_ro(void)
 	/*
 	 * The rodata/data/bss/brk section (but not the kernel text!)
 	 * should also be not-executable.
+	 *
+	 * We align all_end to PMD_SIZE because the existing mapping
+	 * is a full PMD. If we would align _brk_end to PAGE_SIZE we
+	 * split the PMD and the reminder between _brk_end and the end
+	 * of the PMD will remain mapped executable.
+	 *
+	 * Any PMD which was setup after the one which covers _brk_end
+	 * has been zapped already via cleanup_highmem().
 	 */
+	all_end = roundup((unsigned long)_brk_end, PMD_SIZE);
 	set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT);
 
 	rodata_test();
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 18/66] uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 17/66] x86, mm: Set NX across entire PMD at boot Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 19/66] PCI/MSI: Add device flag indicating that 64-bit MSIs don't work Jiri Slaby
                   ` (49 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andy Lutomirski, Linus Torvalds, Jiri Slaby

From: Andy Lutomirski <luto@amacapital.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 82975bc6a6df743b9a01810fb32cb65d0ec5d60b upstream.

x86 call do_notify_resume on paranoid returns if TIF_UPROBE is set but
not on non-paranoid returns.  I suspect that this is a mistake and that
the code only works because int3 is paranoid.

Setting _TIF_NOTIFY_RESUME in the uprobe code was probably a workaround
for the x86 bug.  With that bug fixed, we can remove _TIF_NOTIFY_RESUME
from the uprobes code.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/include/asm/thread_info.h | 2 +-
 kernel/events/uprobes.c            | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 27811190cbd7..bbbac9207419 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -145,7 +145,7 @@ struct thread_info {
 /* Only used for 64 bit */
 #define _TIF_DO_NOTIFY_MASK						\
 	(_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME |	\
-	 _TIF_USER_RETURN_NOTIFY)
+	 _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE)
 
 /* flags to check in __switch_to() */
 #define _TIF_WORK_CTXSW							\
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index ad8e1bdca70e..8176caf6efd9 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1511,7 +1511,6 @@ bool uprobe_deny_signal(void)
 		if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) {
 			utask->state = UTASK_SSTEP_TRAPPED;
 			set_tsk_thread_flag(t, TIF_UPROBE);
-			set_tsk_thread_flag(t, TIF_NOTIFY_RESUME);
 		}
 	}
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 19/66] PCI/MSI: Add device flag indicating that 64-bit MSIs don't work
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 18/66] uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 20/66] clockevent: sun4i: Fix race condition in the probe code Jiri Slaby
                   ` (48 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit f144d1496b47e7450f41b767d0d91c724c2198bc upstream.

This can be set by quirks/drivers to be used by the architecture code
that assigns the MSI addresses.

We additionally add verification in the core MSI code that the values
assigned by the architecture do satisfy the limitation in order to fail
gracefully if they don't (ie. the arch hasn't been updated to deal with
that quirk yet).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/msi.c   | 26 ++++++++++++++++++++++++++
 include/linux/pci.h |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b43f391dc8b6..89237c8eab1d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -553,6 +553,20 @@ out_unroll:
 	return ret;
 }
 
+static int msi_verify_entries(struct pci_dev *dev)
+{
+	struct msi_desc *entry;
+
+	list_for_each_entry(entry, &dev->msi_list, list) {
+		if (!dev->no_64bit_msi || !entry->msg.address_hi)
+			continue;
+		dev_err(&dev->dev, "Device has broken 64-bit MSI but arch"
+			" tried to assign one above 4G\n");
+		return -EIO;
+	}
+	return 0;
+}
+
 /**
  * msi_capability_init - configure device's MSI capability structure
  * @dev: pointer to the pci_dev data structure of MSI device function
@@ -606,6 +620,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
 		return ret;
 	}
 
+	ret = msi_verify_entries(dev);
+	if (ret) {
+		msi_mask_irq(entry, mask, ~mask);
+		free_msi_irqs(dev);
+		return ret;
+	}
+
 	ret = populate_msi_sysfs(dev);
 	if (ret) {
 		msi_mask_irq(entry, mask, ~mask);
@@ -721,6 +742,11 @@ static int msix_capability_init(struct pci_dev *dev,
 	if (ret)
 		goto out_avail;
 
+	/* Check if all MSI entries honor device restrictions */
+	ret = msi_verify_entries(dev);
+	if (ret)
+		goto out_free;
+
 	/*
 	 * Some devices require MSI-X to be enabled before we can touch the
 	 * MSI-X registers.  We need to mask all the vectors to prevent
diff --git a/include/linux/pci.h b/include/linux/pci.h
index db4ce115705e..573c04929bd1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -323,6 +323,7 @@ struct pci_dev {
 	unsigned int	is_added:1;
 	unsigned int	is_busmaster:1; /* device is busmaster */
 	unsigned int	no_msi:1;	/* device may not use msi */
+	unsigned int	no_64bit_msi:1; /* device may only use 32-bit MSIs */
 	unsigned int	block_cfg_access:1;	/* config space access is blocked */
 	unsigned int	broken_parity_status:1;	/* Device generates false positive parity */
 	unsigned int	irq_reroute_variant:2;	/* device needs IRQ rerouting variant */
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 20/66] clockevent: sun4i: Fix race condition in the probe code
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 19/66] PCI/MSI: Add device flag indicating that 64-bit MSIs don't work Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 21/66] IB/isert: Adjust CQ size to HW limits Jiri Slaby
                   ` (47 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Maxime Ripard, Daniel Lezcano, Jiri Slaby

From: Maxime Ripard <maxime.ripard@free-electrons.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 6bab4a8a1888729f17f4923cc5867e4674f66333 upstream.

The interrupts were activated and the handler registered before the clockevent
was registered in the probe function.

The interrupt handler, however, was making the assumption that the clockevent
device was registered.

That could cause a null pointer dereference if the timer interrupt was firing
during this narrow window.

Fix that by moving the clockevent registration before the interrupt is enabled.

Reported-by: Roman Byshko <rbyshko@gmail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clocksource/sun4i_timer.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 8ead0258740a..4fe6ac85ea1d 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -177,6 +177,11 @@ static void __init sun4i_timer_init(struct device_node *node)
 	writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
 	       timer_base + TIMER_CTL_REG(0));
 
+	sun4i_clockevent.cpumask = cpumask_of(0);
+
+	clockevents_config_and_register(&sun4i_clockevent, rate, 0x1,
+					0xffffffff);
+
 	ret = setup_irq(irq, &sun4i_timer_irq);
 	if (ret)
 		pr_warn("failed to setup irq %d\n", irq);
@@ -184,11 +189,6 @@ static void __init sun4i_timer_init(struct device_node *node)
 	/* Enable timer0 interrupt */
 	val = readl(timer_base + TIMER_IRQ_EN_REG);
 	writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG);
-
-	sun4i_clockevent.cpumask = cpumask_of(0);
-
-	clockevents_config_and_register(&sun4i_clockevent, rate, 0x1,
-					0xffffffff);
 }
 CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer",
 		       sun4i_timer_init);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 21/66] IB/isert: Adjust CQ size to HW limits
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 20/66] clockevent: sun4i: Fix race condition in the probe code Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 22/66] ib_isert: Add max_send_sge=2 minimum for control PDU responses Jiri Slaby
                   ` (46 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Chris Moore, Chris Moore, Nicholas Bellinger, Jiri Slaby

From: Chris Moore <Chris.Moore@Emulex.Com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit b1a5ad006b34ded9dc7ec64988deba1b3ecad367 upstream.

isert has an issue of trying to create a CQ with more CQEs than are
supported by the hardware, that currently results in failures during
isert_device creation during first session login.

This is the isert version of the patch that Minh Tran submitted for
iser, and is simple a workaround required to function with existing
ocrdma hardware.

Signed-off-by: Chris Moore <chris.moore@emulex.com>
Reviewied-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 4c2b42bf6cde..7db40f85eeff 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -219,12 +219,16 @@ isert_create_device_ib_res(struct isert_device *device)
 	struct isert_cq_desc *cq_desc;
 	struct ib_device_attr *dev_attr;
 	int ret = 0, i, j;
+	int max_rx_cqe, max_tx_cqe;
 
 	dev_attr = &device->dev_attr;
 	ret = isert_query_device(ib_dev, dev_attr);
 	if (ret)
 		return ret;
 
+	max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe);
+	max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe);
+
 	/* asign function handlers */
 	if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
 		device->use_frwr = 1;
@@ -266,7 +270,7 @@ isert_create_device_ib_res(struct isert_device *device)
 						isert_cq_rx_callback,
 						isert_cq_event_callback,
 						(void *)&cq_desc[i],
-						ISER_MAX_RX_CQ_LEN, i);
+						max_rx_cqe, i);
 		if (IS_ERR(device->dev_rx_cq[i])) {
 			ret = PTR_ERR(device->dev_rx_cq[i]);
 			device->dev_rx_cq[i] = NULL;
@@ -278,7 +282,7 @@ isert_create_device_ib_res(struct isert_device *device)
 						isert_cq_tx_callback,
 						isert_cq_event_callback,
 						(void *)&cq_desc[i],
-						ISER_MAX_TX_CQ_LEN, i);
+						max_tx_cqe, i);
 		if (IS_ERR(device->dev_tx_cq[i])) {
 			ret = PTR_ERR(device->dev_tx_cq[i]);
 			device->dev_tx_cq[i] = NULL;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 22/66] ib_isert: Add max_send_sge=2 minimum for control PDU responses
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 21/66] IB/isert: Adjust CQ size to HW limits Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 23/66] ASoC: rsnd: remove unsupported PAUSE flag Jiri Slaby
                   ` (45 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Or Gerlitz, Nicholas Bellinger, Jiri Slaby

From: Or Gerlitz <ogerlitz@mellanox.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit f57915cfa5b2b14c1cffa2e83c034f55e3f0e70d upstream.

This patch adds a max_send_sge=2 minimum in isert_conn_setup_qp()
to ensure outgoing control PDU responses with tx_desc->num_sge=2
are able to function correctly.

This addresses a bug with RDMA hardware using dev_attr.max_sge=3,
that in the original code with the ConnectX-2 work-around would
result in isert_conn->max_sge=1 being negotiated.

Originally reported by Chris with ocrdma driver.

Reported-by: Chris Moore <Chris.Moore@emulex.com>
Tested-by: Chris Moore <Chris.Moore@emulex.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 7db40f85eeff..2c14232447e4 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -111,9 +111,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id)
 	attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS;
 	/*
 	 * FIXME: Use devattr.max_sge - 2 for max_send_sge as
-	 * work-around for RDMA_READ..
+	 * work-around for RDMA_READs with ConnectX-2.
+	 *
+	 * Also, still make sure to have at least two SGEs for
+	 * outgoing control PDU responses.
 	 */
-	attr.cap.max_send_sge = device->dev_attr.max_sge - 2;
+	attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2);
 	isert_conn->max_sge = attr.cap.max_send_sge;
 
 	attr.cap.max_recv_sge = 1;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 23/66] ASoC: rsnd: remove unsupported PAUSE flag
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 22/66] ib_isert: Add max_send_sge=2 minimum for control PDU responses Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 24/66] ASoC: fsi: " Jiri Slaby
                   ` (44 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Kuninori Morimoto, Mark Brown, Jiri Slaby

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 706c66213e5e623e23f521b1acbd8171af7a3549 upstream.

R-Car sound doesn't support PAUSE.
Remove SNDRV_PCM_INFO_PAUSE flags from snd_pcm_hardware info

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/sh/rcar/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index a35706028514..f6e45b1e5533 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -662,8 +662,7 @@ static void rsnd_dai_remove(struct platform_device *pdev,
 static struct snd_pcm_hardware rsnd_pcm_hardware = {
 	.info =		SNDRV_PCM_INFO_INTERLEAVED	|
 			SNDRV_PCM_INFO_MMAP		|
-			SNDRV_PCM_INFO_MMAP_VALID	|
-			SNDRV_PCM_INFO_PAUSE,
+			SNDRV_PCM_INFO_MMAP_VALID,
 	.formats		= RSND_FMTS,
 	.rates			= RSND_RATES,
 	.rate_min		= 8000,
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 24/66] ASoC: fsi: remove unsupported PAUSE flag
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 23/66] ASoC: rsnd: remove unsupported PAUSE flag Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 25/66] ASoC: sgtl5000: Fix SMALL_POP bit definition Jiri Slaby
                   ` (43 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Kuninori Morimoto, Mark Brown, Jiri Slaby

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit c1b9b9b1ad2df6144ca3fbe6989f7bd9ea5c5562 upstream.

FSI doesn't support PAUSE.
Remove SNDRV_PCM_INFO_PAUSE flags from snd_pcm_hardware info

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/sh/fsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index b33ca7cd085b..5dbf49481cae 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1775,8 +1775,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = {
 static struct snd_pcm_hardware fsi_pcm_hardware = {
 	.info =		SNDRV_PCM_INFO_INTERLEAVED	|
 			SNDRV_PCM_INFO_MMAP		|
-			SNDRV_PCM_INFO_MMAP_VALID	|
-			SNDRV_PCM_INFO_PAUSE,
+			SNDRV_PCM_INFO_MMAP_VALID,
 	.formats		= FSI_FMTS,
 	.rates			= FSI_RATES,
 	.rate_min		= 8000,
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 25/66] ASoC: sgtl5000: Fix SMALL_POP bit definition
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 24/66] ASoC: fsi: " Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 26/66] ASoC: wm_adsp: Avoid attempt to free buffers that might still be in use Jiri Slaby
                   ` (42 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Fabio Estevam, Mark Brown, Jiri Slaby

From: Fabio Estevam <fabio.estevam@freescale.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit c251ea7bd7a04f1f2575467e0de76e803cf59149 upstream.

On a mx28evk with a sgtl5000 codec we notice a loud 'click' sound  to happen
5 seconds after the end of a playback.

The SMALL_POP bit should fix this, but its definition is incorrect:
according to the sgtl5000 manual it is bit 0 of CHIP_REF_CTRL register, not
bit 1.

Fix the definition accordingly and enable the bit as intended per the code
comment.

After applying this change, no loud 'click' sound is heard after playback

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/codecs/sgtl5000.c | 3 +--
 sound/soc/codecs/sgtl5000.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 1f4093f3f3a1..b76c6b619227 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1398,8 +1398,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
 
 	/* enable small pop, introduce 400ms delay in turning off */
 	snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL,
-				SGTL5000_SMALL_POP,
-				SGTL5000_SMALL_POP);
+				SGTL5000_SMALL_POP, 1);
 
 	/* disable short cut detector */
 	snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0);
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
index 2f8c88931f69..bd7a344bf8c5 100644
--- a/sound/soc/codecs/sgtl5000.h
+++ b/sound/soc/codecs/sgtl5000.h
@@ -275,7 +275,7 @@
 #define SGTL5000_BIAS_CTRL_MASK			0x000e
 #define SGTL5000_BIAS_CTRL_SHIFT		1
 #define SGTL5000_BIAS_CTRL_WIDTH		3
-#define SGTL5000_SMALL_POP			0x0001
+#define SGTL5000_SMALL_POP			0
 
 /*
  * SGTL5000_CHIP_MIC_CTRL
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 26/66] ASoC: wm_adsp: Avoid attempt to free buffers that might still be in use
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 25/66] ASoC: sgtl5000: Fix SMALL_POP bit definition Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 27/66] ASoC: dpcm: Fix race between FE/BE updates and trigger Jiri Slaby
                   ` (41 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Charles Keepax, Mark Brown, Jiri Slaby

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 9da7a5a9fdeeb76b2243f6b473363a7e6147ab6f upstream.

We should not free any buffers associated with writing out coefficients
to the DSP until all the async writes have completed. This patch updates
the out of memory path when allocating a new buffer to include a call to
regmap_async_complete.

Reported-by: JS Park <aitdark.park@samsung.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/codecs/wm_adsp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 61e871bf63dd..f0e97fcde1bf 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1341,6 +1341,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
 			  file, blocks, pos - firmware->size);
 
 out_fw:
+	regmap_async_complete(regmap);
 	release_firmware(firmware);
 	wm_adsp_buf_free(&buf_list);
 out:
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 27/66] ASoC: dpcm: Fix race between FE/BE updates and trigger
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 26/66] ASoC: wm_adsp: Avoid attempt to free buffers that might still be in use Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 28/66] ath9k: Fix RTC_DERIVED_CLK usage Jiri Slaby
                   ` (40 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Mark Brown, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ea9d0d771fcd32cd56070819749477d511ec9117 upstream.

DPCM can update the FE/BE connection states totally asynchronously
from the FE's PCM state.  Most of FE/BE state changes are protected by
mutex, so that they won't race, but there are still some actions that
are uncovered.  For example, suppose to switch a BE while a FE's
stream is running.  This would call soc_dpcm_runtime_update(), which
sets FE's runtime_update flag, then sets up and starts BEs, and clears
FE's runtime_update flag again.

When a device emits XRUN during this operation, the PCM core triggers
snd_pcm_stop(XRUN).  Since the trigger action is an atomic ops, this
isn't blocked by the mutex, thus it kicks off DPCM's trigger action.
It eventually updates and clears FE's runtime_update flag while
soc_dpcm_runtime_update() is running concurrently, and it results in
confusion.

Usually, for avoiding such a race, we take a lock.  There is a PCM
stream lock for that purpose.  However, as already mentioned, the
trigger action is atomic, and we can't take the lock for the whole
soc_dpcm_runtime_update() or other operations that include the lengthy
jobs like hw_params or prepare.

This patch provides an alternative solution.  This adds a way to defer
the conflicting trigger callback to be executed at the end of FE/BE
state changes.  For doing it, two things are introduced:

- Each runtime_update state change of FEs is protected via PCM stream
  lock.
- The FE's trigger callback checks the runtime_update flag.  If it's
  not set, the trigger action is executed there.  If set, mark the
  pending trigger action and returns immediately.
- At the exit of runtime_update state change, it checks whether the
  pending trigger is present.  If yes, it executes the trigger action
  at this point.

Reported-and-tested-by: Qiao Zhou <zhouqiao@marvell.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/sound/soc-dpcm.h |  2 ++
 sound/soc/soc-pcm.c      | 72 +++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 58 insertions(+), 16 deletions(-)

diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 047d657c331c..3007641f2385 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -101,6 +101,8 @@ struct snd_soc_dpcm_runtime {
 	/* state and update */
 	enum snd_soc_dpcm_update runtime_update;
 	enum snd_soc_dpcm_state state;
+
+	int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
 };
 
 /* can this BE stop and free */
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 875cae86d708..8457ebb7439e 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1129,13 +1129,36 @@ static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
 	}
 }
 
+static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
+
+/* Set FE's runtime_update state; the state is protected via PCM stream lock
+ * for avoiding the race with trigger callback.
+ * If the state is unset and a trigger is pending while the previous operation,
+ * process the pending trigger action here.
+ */
+static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe,
+				     int stream, enum snd_soc_dpcm_update state)
+{
+	struct snd_pcm_substream *substream =
+		snd_soc_dpcm_get_substream(fe, stream);
+
+	snd_pcm_stream_lock_irq(substream);
+	if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) {
+		dpcm_fe_dai_do_trigger(substream,
+				       fe->dpcm[stream].trigger_pending - 1);
+		fe->dpcm[stream].trigger_pending = 0;
+	}
+	fe->dpcm[stream].runtime_update = state;
+	snd_pcm_stream_unlock_irq(substream);
+}
+
 static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
 {
 	struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
 	struct snd_pcm_runtime *runtime = fe_substream->runtime;
 	int stream = fe_substream->stream, ret = 0;
 
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
 
 	ret = dpcm_be_dai_startup(fe, fe_substream->stream);
 	if (ret < 0) {
@@ -1157,13 +1180,13 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
 	dpcm_set_fe_runtime(fe_substream);
 	snd_pcm_limit_hw_rates(runtime);
 
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	return 0;
 
 unwind:
 	dpcm_be_dai_startup_unwind(fe, fe_substream->stream);
 be_err:
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	return ret;
 }
 
@@ -1210,7 +1233,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *fe = substream->private_data;
 	int stream = substream->stream;
 
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
 
 	/* shutdown the BEs */
 	dpcm_be_dai_shutdown(fe, substream->stream);
@@ -1224,7 +1247,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
 	dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
 
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	return 0;
 }
 
@@ -1272,7 +1295,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
 	int err, stream = substream->stream;
 
 	mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
 
 	dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
 
@@ -1287,7 +1310,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
 	err = dpcm_be_dai_hw_free(fe, stream);
 
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 
 	mutex_unlock(&fe->card->mutex);
 	return 0;
@@ -1380,7 +1403,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
 	int ret, stream = substream->stream;
 
 	mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
 
 	memcpy(&fe->dpcm[substream->stream].hw_params, params,
 			sizeof(struct snd_pcm_hw_params));
@@ -1403,7 +1426,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
 		fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
 
 out:
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	mutex_unlock(&fe->card->mutex);
 	return ret;
 }
@@ -1517,7 +1540,7 @@ static int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
 }
 EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
 
-static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
+static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
 {
 	struct snd_soc_pcm_runtime *fe = substream->private_data;
 	int stream = substream->stream, ret;
@@ -1591,6 +1614,23 @@ out:
 	return ret;
 }
 
+static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+	struct snd_soc_pcm_runtime *fe = substream->private_data;
+	int stream = substream->stream;
+
+	/* if FE's runtime_update is already set, we're in race;
+	 * process this trigger later at exit
+	 */
+	if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) {
+		fe->dpcm[stream].trigger_pending = cmd + 1;
+		return 0; /* delayed, assuming it's successful */
+	}
+
+	/* we're alone, let's trigger */
+	return dpcm_fe_dai_do_trigger(substream, cmd);
+}
+
 static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
 {
 	struct snd_soc_dpcm *dpcm;
@@ -1634,7 +1674,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
 
 	dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name);
 
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
 
 	/* there is no point preparing this FE if there are no BEs */
 	if (list_empty(&fe->dpcm[stream].be_clients)) {
@@ -1661,7 +1701,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
 
 out:
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	mutex_unlock(&fe->card->mutex);
 
 	return ret;
@@ -1808,11 +1848,11 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream)
 {
 	int ret;
 
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
 	ret = dpcm_run_update_startup(fe, stream);
 	if (ret < 0)
 		dev_err(fe->dev, "ASoC: failed to startup some BEs\n");
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 
 	return ret;
 }
@@ -1821,11 +1861,11 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
 {
 	int ret;
 
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
 	ret = dpcm_run_update_shutdown(fe, stream);
 	if (ret < 0)
 		dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
-	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 
 	return ret;
 }
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 28/66] ath9k: Fix RTC_DERIVED_CLK usage
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 27/66] ASoC: dpcm: Fix race between FE/BE updates and trigger Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 29/66] of/base: Fix PowerPC address parsing hack Jiri Slaby
                   ` (39 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Miaoqing Pan, Sujith Manoharan, John W. Linville,
	Jiri Slaby

From: Miaoqing Pan <miaoqing@qca.qualcomm.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 4e6ce4dc7ce71d0886908d55129d5d6482a27ff9 upstream.

Based on the reference clock, which could be 25MHz or 40MHz,
AR_RTC_DERIVED_CLK is programmed differently for AR9340 and AR9550.
But, when a chip reset is done, processing the initvals
sets the register back to the default value.

Fix this by moving the code in ath9k_hw_init_pll() to
ar9003_hw_override_ini(). Also, do this override for AR9531.

js: remove AR_SREV_9531 test as 9531 support is not in 3.12 yet

Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c | 13 +++++++++++++
 drivers/net/wireless/ath/ath9k/hw.c         | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index e897648d3233..5092343efd7d 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -648,6 +648,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah)
 		else
 			ah->enabled_cals &= ~TX_CL_CAL;
 	}
+
+	if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
+		if (ah->is_clk_25mhz) {
+			REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
+			REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
+			REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
+		} else {
+			REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
+			REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
+			REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
+		}
+		udelay(100);
+	}
 }
 
 static void ar9003_hw_prog_ini(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 4e0a9429e192..c6f255f1c95e 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -916,19 +916,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
 	udelay(RTC_PLL_SETTLE_DELAY);
 
 	REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK);
-
-	if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
-		if (ah->is_clk_25mhz) {
-			REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
-			REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
-			REG_WRITE(ah,  AR_SLP32_INC, 0x0001e7ae);
-		} else {
-			REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
-			REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
-			REG_WRITE(ah,  AR_SLP32_INC, 0x0001e800);
-		}
-		udelay(100);
-	}
 }
 
 static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 29/66] of/base: Fix PowerPC address parsing hack
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 28/66] ath9k: Fix RTC_DERIVED_CLK usage Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 30/66] powerpc/pseries: Honor the generic "no_64bit_msi" flag Jiri Slaby
                   ` (38 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Rob Herring, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 746c9e9f92dde2789908e51a354ba90a1962a2eb upstream.

We have a historical hack that treats missing ranges properties as the
equivalent of an empty one. This is needed for ancient PowerMac "bad"
device-trees, and shouldn't be enabled for any other PowerPC platform,
otherwise we get some nasty layout of devices in sysfs or even
duplication when a set of otherwise identically named devices is
created multiple times under a different parent node with no ranges
property.

This fix is needed for the PowerNV i2c busses to be exposed properly
and will fix a number of other embedded cases.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/of/address.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 503b4e4cb551..f5582f3a06a4 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -401,6 +401,21 @@ static struct of_bus *of_match_bus(struct device_node *np)
 	return NULL;
 }
 
+static int of_empty_ranges_quirk(void)
+{
+	if (IS_ENABLED(CONFIG_PPC)) {
+		/* To save cycles, we cache the result */
+		static int quirk_state = -1;
+
+		if (quirk_state < 0)
+			quirk_state =
+				of_machine_is_compatible("Power Macintosh") ||
+				of_machine_is_compatible("MacRISC");
+		return quirk_state;
+	}
+	return false;
+}
+
 static int of_translate_one(struct device_node *parent, struct of_bus *bus,
 			    struct of_bus *pbus, __be32 *addr,
 			    int na, int ns, int pna, const char *rprop)
@@ -426,12 +441,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
 	 * This code is only enabled on powerpc. --gcl
 	 */
 	ranges = of_get_property(parent, rprop, &rlen);
-#if !defined(CONFIG_PPC)
-	if (ranges == NULL) {
+	if (ranges == NULL && !of_empty_ranges_quirk()) {
 		pr_err("OF: no ranges; cannot translate\n");
 		return 1;
 	}
-#endif /* !defined(CONFIG_PPC) */
 	if (ranges == NULL || rlen == 0) {
 		offset = of_read_number(addr, na);
 		memset(addr, 0, pna * 4);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 30/66] powerpc/pseries: Honor the generic "no_64bit_msi" flag
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 29/66] of/base: Fix PowerPC address parsing hack Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 31/66] powerpc/pseries: Fix endiannes issue in RTAS call from xmon Jiri Slaby
                   ` (37 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 415072a041bf50dbd6d56934ffc0cbbe14c97be8 upstream.

Instead of the arch specific quirk which we are deprecating

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/platforms/pseries/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 6d2f0abce6fa..3b350fb91285 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -426,7 +426,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
 	 */
 again:
 	if (type == PCI_CAP_ID_MSI) {
-		if (pdn->force_32bit_msi) {
+		if (pdev->no_64bit_msi) {
 			rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec);
 			if (rc < 0) {
 				/*
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 31/66] powerpc/pseries: Fix endiannes issue in RTAS call from xmon
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 30/66] powerpc/pseries: Honor the generic "no_64bit_msi" flag Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 32/66] iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask Jiri Slaby
                   ` (36 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Laurent Dufour, Michael Ellerman, Jiri Slaby

From: Laurent Dufour <ldufour@linux.vnet.ibm.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 3b8a3c01096925a824ed3272601082289d9c23a5 upstream.

On pseries system (LPAR) xmon failed to enter when running in LE mode,
system is hunging. Inititating xmon will lead to such an output on the
console:

SysRq : Entering xmon
cpu 0x15: Vector: 0  at [c0000003f39ffb10]
    pc: c00000000007ed7c: sysrq_handle_xmon+0x5c/0x70
    lr: c00000000007ed7c: sysrq_handle_xmon+0x5c/0x70
    sp: c0000003f39ffc70
   msr: 8000000000009033
  current = 0xc0000003fafa7180
  paca    = 0xc000000007d75e80	 softe: 0	 irq_happened: 0x01
    pid   = 14617, comm = bash
Bad kernel stack pointer fafb4b0 at eca7cc4
cpu 0x15: Vector: 300 (Data Access) at [c000000007f07d40]
    pc: 000000000eca7cc4
    lr: 000000000eca7c44
    sp: fafb4b0
   msr: 8000000000001000
   dar: 10000000
 dsisr: 42000000
  current = 0xc0000003fafa7180
  paca    = 0xc000000007d75e80	 softe: 0	 irq_happened: 0x01
    pid   = 14617, comm = bash
cpu 0x15: Exception 300 (Data Access) in xmon, returning to main loop
xmon: WARNING: bad recursive fault on cpu 0x15

The root cause is that xmon is calling RTAS to turn off the surveillance
when entering xmon, and RTAS is requiring big endian parameters.

This patch is byte swapping the RTAS arguments when running in LE mode.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index af9d3469fb99..489820356f2d 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -288,10 +288,10 @@ static inline void disable_surveillance(void)
 	args.token = rtas_token("set-indicator");
 	if (args.token == RTAS_UNKNOWN_SERVICE)
 		return;
-	args.nargs = 3;
-	args.nret = 1;
+	args.nargs = cpu_to_be32(3);
+	args.nret = cpu_to_be32(1);
 	args.rets = &args.args[3];
-	args.args[0] = SURVEILLANCE_TOKEN;
+	args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN);
 	args.args[1] = 0;
 	args.args[2] = 0;
 	enter_rtas(__pa(&args));
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 32/66] iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 31/66] powerpc/pseries: Fix endiannes issue in RTAS call from xmon Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 33/66] staging: r8188eu: Add new device ID for DLink GO-USB-N150 Jiri Slaby
                   ` (35 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Cristina Ciocan, Jonathan Cameron, Jiri Slaby

From: Cristina Ciocan <cristina.ciocan@intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ccf54555da9a5e91e454b909ca6a5303c7d6b910 upstream.

The direction field is set on 7 bits, thus we need to AND it with 0111 111 mask
in order to retrieve it, that is 0x7F, not 0xCF as it is now.

Fixes: ade7ef7ba (staging:iio: Differential channel handling)
Signed-off-by: Cristina Ciocan <cristina.ciocan@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/iio/events.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 13ce220c7003..593ae7ce07c7 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -90,7 +90,7 @@ enum iio_event_direction {
 
 #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
 
-#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
+#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
 
 #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 33/66] staging: r8188eu: Add new device ID for DLink GO-USB-N150
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 32/66] iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 34/66] USB: ssu100: fix overrun-error reporting Jiri Slaby
                   ` (34 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Larry Finger, Jiri Slaby

From: Larry Finger <Larry.Finger@lwfinger.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 6d4556fc0309608f760f1d329df56d77fdd0c31a upstream.

The DLink GO-USB-N150 with revision B1 uses this driver.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index d1eea2d426bd..6a2c8ab6b638 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -57,6 +57,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
 	{USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
 	{USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
 	{USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */
+	{USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
 	{USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
 	{}	/* Terminating entry */
 };
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 34/66] USB: ssu100: fix overrun-error reporting
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 33/66] staging: r8188eu: Add new device ID for DLink GO-USB-N150 Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 35/66] USB: keyspan: " Jiri Slaby
                   ` (33 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 75bcbf29c284dd0154c3e895a0bd1ef0e796160e upstream.

Fix reporting of overrun errors, which should only be reported once
using the inserted null character.

Fixes: 6b8f1ca5581b ("USB: ssu100: set tty_flags in ssu100_process_packet")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ssu100.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index e5750be49054..d667ff95ade4 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -495,10 +495,9 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr,
 			if (*tty_flag == TTY_NORMAL)
 				*tty_flag = TTY_FRAME;
 		}
-		if (lsr & UART_LSR_OE){
+		if (lsr & UART_LSR_OE) {
 			port->icount.overrun++;
-			if (*tty_flag == TTY_NORMAL)
-				*tty_flag = TTY_OVERRUN;
+			tty_insert_flip_char(&port->port, 0, TTY_OVERRUN);
 		}
 	}
 
@@ -516,12 +515,8 @@ static void ssu100_process_read_urb(struct urb *urb)
 	if ((len >= 4) &&
 	    (packet[0] == 0x1b) && (packet[1] == 0x1b) &&
 	    ((packet[2] == 0x00) || (packet[2] == 0x01))) {
-		if (packet[2] == 0x00) {
+		if (packet[2] == 0x00)
 			ssu100_update_lsr(port, packet[3], &flag);
-			if (flag == TTY_OVERRUN)
-				tty_insert_flip_char(&port->port, 0,
-						TTY_OVERRUN);
-		}
 		if (packet[2] == 0x01)
 			ssu100_update_msr(port, packet[3]);
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 35/66] USB: keyspan: fix overrun-error reporting
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 34/66] USB: ssu100: fix overrun-error reporting Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 36/66] USB: keyspan: fix tty line-status reporting Jiri Slaby
                   ` (32 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 855515a6d3731242d85850a206f2ec084c917338 upstream.

Fix reporting of overrun errors, which are not associated with a
character. Instead insert a null character and report only once.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/keyspan.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index d6960aebe246..7053e0a9bb05 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -312,12 +312,13 @@ static void	usa26_indat_callback(struct urb *urb)
 		if ((data[0] & 0x80) == 0) {
 			/* no errors on individual bytes, only
 			   possible overrun err */
-			if (data[0] & RXERROR_OVERRUN)
-				err = TTY_OVERRUN;
-			else
-				err = 0;
+			if (data[0] & RXERROR_OVERRUN) {
+				tty_insert_flip_char(&port->port, 0,
+								TTY_OVERRUN);
+			}
 			for (i = 1; i < urb->actual_length ; ++i)
-				tty_insert_flip_char(&port->port, data[i], err);
+				tty_insert_flip_char(&port->port, data[i],
+								TTY_NORMAL);
 		} else {
 			/* some bytes had errors, every byte has status */
 			dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
@@ -791,13 +792,13 @@ static void usa90_indat_callback(struct urb *urb)
 			if ((data[0] & 0x80) == 0) {
 				/* no errors on individual bytes, only
 				   possible overrun err*/
-				if (data[0] & RXERROR_OVERRUN)
-					err = TTY_OVERRUN;
-				else
-					err = 0;
+				if (data[0] & RXERROR_OVERRUN) {
+					tty_insert_flip_char(&port->port, 0,
+								TTY_OVERRUN);
+				}
 				for (i = 1; i < urb->actual_length ; ++i)
 					tty_insert_flip_char(&port->port,
-							data[i], err);
+							data[i], TTY_NORMAL);
 			}  else {
 			/* some bytes had errors, every byte has status */
 				dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 36/66] USB: keyspan: fix tty line-status reporting
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 35/66] USB: keyspan: " Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 37/66] USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick Jiri Slaby
                   ` (31 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 5d1678a33c731b56e245e888fdae5e88efce0997 upstream.

Fix handling of TTY error flags, which are not bitmasks and must
specifically not be ORed together as this prevents the line discipline
from recognising them.

Also insert null characters when reporting overrun errors as these are
not associated with the received character.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/keyspan.c | 76 ++++++++++++++++++++++++++++----------------
 1 file changed, 48 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 7053e0a9bb05..dc3a77c8cd83 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -323,14 +323,19 @@ static void	usa26_indat_callback(struct urb *urb)
 			/* some bytes had errors, every byte has status */
 			dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
 			for (i = 0; i + 1 < urb->actual_length; i += 2) {
-				int stat = data[i], flag = 0;
-				if (stat & RXERROR_OVERRUN)
-					flag |= TTY_OVERRUN;
-				if (stat & RXERROR_FRAMING)
-					flag |= TTY_FRAME;
-				if (stat & RXERROR_PARITY)
-					flag |= TTY_PARITY;
+				int stat = data[i];
+				int flag = TTY_NORMAL;
+
+				if (stat & RXERROR_OVERRUN) {
+					tty_insert_flip_char(&port->port, 0,
+								TTY_OVERRUN);
+				}
 				/* XXX should handle break (0x10) */
+				if (stat & RXERROR_PARITY)
+					flag = TTY_PARITY;
+				else if (stat & RXERROR_FRAMING)
+					flag = TTY_FRAME;
+
 				tty_insert_flip_char(&port->port, data[i+1],
 						flag);
 			}
@@ -668,14 +673,19 @@ static void	usa49_indat_callback(struct urb *urb)
 		} else {
 			/* some bytes had errors, every byte has status */
 			for (i = 0; i + 1 < urb->actual_length; i += 2) {
-				int stat = data[i], flag = 0;
-				if (stat & RXERROR_OVERRUN)
-					flag |= TTY_OVERRUN;
-				if (stat & RXERROR_FRAMING)
-					flag |= TTY_FRAME;
-				if (stat & RXERROR_PARITY)
-					flag |= TTY_PARITY;
+				int stat = data[i];
+				int flag = TTY_NORMAL;
+
+				if (stat & RXERROR_OVERRUN) {
+					tty_insert_flip_char(&port->port, 0,
+								TTY_OVERRUN);
+				}
 				/* XXX should handle break (0x10) */
+				if (stat & RXERROR_PARITY)
+					flag = TTY_PARITY;
+				else if (stat & RXERROR_FRAMING)
+					flag = TTY_FRAME;
+
 				tty_insert_flip_char(&port->port, data[i+1],
 						flag);
 			}
@@ -732,15 +742,19 @@ static void usa49wg_indat_callback(struct urb *urb)
 			 */
 			for (x = 0; x + 1 < len &&
 				    i + 1 < urb->actual_length; x += 2) {
-				int stat = data[i], flag = 0;
+				int stat = data[i];
+				int flag = TTY_NORMAL;
 
-				if (stat & RXERROR_OVERRUN)
-					flag |= TTY_OVERRUN;
-				if (stat & RXERROR_FRAMING)
-					flag |= TTY_FRAME;
-				if (stat & RXERROR_PARITY)
-					flag |= TTY_PARITY;
+				if (stat & RXERROR_OVERRUN) {
+					tty_insert_flip_char(&port->port, 0,
+								TTY_OVERRUN);
+				}
 				/* XXX should handle break (0x10) */
+				if (stat & RXERROR_PARITY)
+					flag = TTY_PARITY;
+				else if (stat & RXERROR_FRAMING)
+					flag = TTY_FRAME;
+
 				tty_insert_flip_char(&port->port, data[i+1],
 						     flag);
 				i += 2;
@@ -803,14 +817,20 @@ static void usa90_indat_callback(struct urb *urb)
 			/* some bytes had errors, every byte has status */
 				dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
 				for (i = 0; i + 1 < urb->actual_length; i += 2) {
-					int stat = data[i], flag = 0;
-					if (stat & RXERROR_OVERRUN)
-						flag |= TTY_OVERRUN;
-					if (stat & RXERROR_FRAMING)
-						flag |= TTY_FRAME;
-					if (stat & RXERROR_PARITY)
-						flag |= TTY_PARITY;
+					int stat = data[i];
+					int flag = TTY_NORMAL;
+
+					if (stat & RXERROR_OVERRUN) {
+						tty_insert_flip_char(
+								&port->port, 0,
+								TTY_OVERRUN);
+					}
 					/* XXX should handle break (0x10) */
+					if (stat & RXERROR_PARITY)
+						flag = TTY_PARITY;
+					else if (stat & RXERROR_FRAMING)
+						flag = TTY_FRAME;
+
 					tty_insert_flip_char(&port->port,
 							data[i+1], flag);
 				}
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 37/66] USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 36/66] USB: keyspan: fix tty line-status reporting Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 38/66] usb: serial: ftdi_sio: add PIDs for Matrix Orbital products Jiri Slaby
                   ` (30 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Preston Fick, Johan Hovold, Jiri Slaby

From: Preston Fick <pffick@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ffcfe30ebd8dd703d0fc4324ffe56ea21f5479f4 upstream.

Signed-off-by: Preston Fick <pffick@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 34b16b226f74..59fd7187daff 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
 	{ USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
 	{ USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
+	{ USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */
 	{ USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
 	{ USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
 	{ USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 38/66] usb: serial: ftdi_sio: add PIDs for Matrix Orbital products
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 37/66] USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 39/66] usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000 Jiri Slaby
                   ` (29 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Troy Clark, Johan Hovold, Jiri Slaby

From: Troy Clark <tclark@matrixorbital.ca>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 204ec6e07ea7aff863df0f7c53301f9cbbfbb9d3 upstream.

Add PIDs for new Matrix Orbital GTT series products.

Signed-off-by: Troy Clark <tclark@matrixorbital.ca>
[johan: shorten commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ftdi_sio.c     | 33 +++++++++++++++++++++++++++++++++
 drivers/usb/serial/ftdi_sio_ids.h | 39 +++++++++++++++++++++++++++++++++++----
 2 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 74c20472c25b..00710ff5ebb8 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -484,6 +484,39 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) },
 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) },
 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) },
+	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 6786b705ccf6..e52409c9be99 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -926,8 +926,8 @@
 #define BAYER_CONTOUR_CABLE_PID        0x6001
 
 /*
- * The following are the values for the Matrix Orbital FTDI Range
- * Anything in this range will use an FT232RL.
+ * Matrix Orbital Intelligent USB displays.
+ * http://www.matrixorbital.com
  */
 #define MTXORB_VID			0x1B3D
 #define MTXORB_FTDI_RANGE_0100_PID	0x0100
@@ -1186,8 +1186,39 @@
 #define MTXORB_FTDI_RANGE_01FD_PID	0x01FD
 #define MTXORB_FTDI_RANGE_01FE_PID	0x01FE
 #define MTXORB_FTDI_RANGE_01FF_PID	0x01FF
-
-
+#define MTXORB_FTDI_RANGE_4701_PID	0x4701
+#define MTXORB_FTDI_RANGE_9300_PID	0x9300
+#define MTXORB_FTDI_RANGE_9301_PID	0x9301
+#define MTXORB_FTDI_RANGE_9302_PID	0x9302
+#define MTXORB_FTDI_RANGE_9303_PID	0x9303
+#define MTXORB_FTDI_RANGE_9304_PID	0x9304
+#define MTXORB_FTDI_RANGE_9305_PID	0x9305
+#define MTXORB_FTDI_RANGE_9306_PID	0x9306
+#define MTXORB_FTDI_RANGE_9307_PID	0x9307
+#define MTXORB_FTDI_RANGE_9308_PID	0x9308
+#define MTXORB_FTDI_RANGE_9309_PID	0x9309
+#define MTXORB_FTDI_RANGE_930A_PID	0x930A
+#define MTXORB_FTDI_RANGE_930B_PID	0x930B
+#define MTXORB_FTDI_RANGE_930C_PID	0x930C
+#define MTXORB_FTDI_RANGE_930D_PID	0x930D
+#define MTXORB_FTDI_RANGE_930E_PID	0x930E
+#define MTXORB_FTDI_RANGE_930F_PID	0x930F
+#define MTXORB_FTDI_RANGE_9310_PID	0x9310
+#define MTXORB_FTDI_RANGE_9311_PID	0x9311
+#define MTXORB_FTDI_RANGE_9312_PID	0x9312
+#define MTXORB_FTDI_RANGE_9313_PID	0x9313
+#define MTXORB_FTDI_RANGE_9314_PID	0x9314
+#define MTXORB_FTDI_RANGE_9315_PID	0x9315
+#define MTXORB_FTDI_RANGE_9316_PID	0x9316
+#define MTXORB_FTDI_RANGE_9317_PID	0x9317
+#define MTXORB_FTDI_RANGE_9318_PID	0x9318
+#define MTXORB_FTDI_RANGE_9319_PID	0x9319
+#define MTXORB_FTDI_RANGE_931A_PID	0x931A
+#define MTXORB_FTDI_RANGE_931B_PID	0x931B
+#define MTXORB_FTDI_RANGE_931C_PID	0x931C
+#define MTXORB_FTDI_RANGE_931D_PID	0x931D
+#define MTXORB_FTDI_RANGE_931E_PID	0x931E
+#define MTXORB_FTDI_RANGE_931F_PID	0x931F
 
 /*
  * The Mobility Lab (TML)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 39/66] usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 38/66] usb: serial: ftdi_sio: add PIDs for Matrix Orbital products Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 40/66] USB: xhci: don't start a halted endpoint before its new dequeue is set Jiri Slaby
                   ` (28 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Jiri Slaby

From: Hans de Goede <hdegoede@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 263e80b43559a6103e178a9176938ce171b23872 upstream.

This wireless mouse receiver needs a reset-resume quirk to properly come
out of reset.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1165206
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/quirks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 0d088e9d4ded..aa7759583c73 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -43,6 +43,9 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* Creative SB Audigy 2 NX */
 	{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* Microsoft Wireless Laser Mouse 6000 Receiver */
+	{ USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME },
+
 	/* Microsoft LifeCam-VX700 v2.0 */
 	{ USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 40/66] USB: xhci: don't start a halted endpoint before its new dequeue is set
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 39/66] usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000 Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 41/66] usb: xhci: rework root port wake bits if controller isn't allowed to wakeup Jiri Slaby
                   ` (27 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mathias Nyman, Jiri Slaby

From: Mathias Nyman <mathias.nyman@linux.intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit c3492dbfa1050debf23a5b5cd2bc7514c5b37896 upstream.

A halted endpoint ring must first be reset, then move the ring
dequeue pointer past the problematic TRB. If we start the ring too
early after reset, but before moving the dequeue pointer we
will end up executing the same problematic TRB again.

As we always issue a set transfer dequeue command after a reset
endpoint command we can skip starting endpoint rings at reset endpoint
command completion.

Without this fix we end up trying to handle the same faulty TD for
contol endpoints. causing timeout, and failing testusb ctrl_out write
tests.

Fixes: e9df17e (USB: xhci: Correct assumptions about number of rings per endpoint.)
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci-ring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 46ad9f3f589d..d761c040ee2e 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1206,9 +1206,8 @@ static void handle_reset_ep_completion(struct xhci_hcd *xhci,
 				false);
 		xhci_ring_cmd_db(xhci);
 	} else {
-		/* Clear our internal halted state and restart the ring(s) */
+		/* Clear our internal halted state */
 		xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED;
-		ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
 	}
 }
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 41/66] usb: xhci: rework root port wake bits if controller isn't allowed to wakeup
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 40/66] USB: xhci: don't start a halted endpoint before its new dequeue is set Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 42/66] can: esd_usb2: fix memory leak on disconnect Jiri Slaby
                   ` (26 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lu Baolu, Mathias Nyman, Jiri Slaby

From: Lu Baolu <baolu.lu@linux.intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit a1377e5397ab321e21b793ec8cd2b6f12bd3c718 upstream.

When system is being suspended, if host device is not allowed to do wakeup,
xhci_suspend() needs to clear all root port wake on bits. Otherwise, some
platforms may generate spurious wakeup, even if PCI PME# is disabled.

The initial commit ff8cbf250b44 ("xhci: clear root port wake on bits"),
which also got into stable, turned out to not work correctly and had to
be reverted, and is now rewritten.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[Mathias Nyman: reword commit message]
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci-pci.c  |  2 +-
 drivers/usb/host/xhci-plat.c | 10 +++++++++-
 drivers/usb/host/xhci.c      | 42 +++++++++++++++++++++++++++++++++++++++++-
 drivers/usb/host/xhci.h      |  2 +-
 4 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 1cfe0c743092..7dad9e5ad2f3 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -283,7 +283,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	if (xhci_compliance_mode_recovery_timer_quirk_check())
 		pdev->no_d3cold = true;
 
-	return xhci_suspend(xhci);
+	return xhci_suspend(xhci, do_wakeup);
 }
 
 static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index d9c169f470d3..bb50d309b8e6 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -203,7 +203,15 @@ static int xhci_plat_suspend(struct device *dev)
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
 
-	return xhci_suspend(xhci);
+	/*
+	 * xhci_suspend() needs `do_wakeup` to know whether host is allowed
+	 * to do wakeup during suspend. Since xhci_plat_suspend is currently
+	 * only designed for system suspend, device_may_wakeup() is enough
+	 * to dertermine whether host is allowed to do wakeup. Need to
+	 * reconsider this when xhci_plat_suspend enlarges its scope, e.g.,
+	 * also applies to runtime suspend.
+	 */
+	return xhci_suspend(xhci, device_may_wakeup(dev));
 }
 
 static int xhci_plat_resume(struct device *dev)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index de1901222c00..381965957a67 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -35,6 +35,8 @@
 #define DRIVER_AUTHOR "Sarah Sharp"
 #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"
 
+#define	PORT_WAKE_BITS	(PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
+
 /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */
 static int link_quirk;
 module_param(link_quirk, int, S_IRUGO | S_IWUSR);
@@ -840,13 +842,47 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci)
 	xhci_set_cmd_ring_deq(xhci);
 }
 
+static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
+{
+	int port_index;
+	__le32 __iomem **port_array;
+	unsigned long flags;
+	u32 t1, t2;
+
+	spin_lock_irqsave(&xhci->lock, flags);
+
+	/* disble usb3 ports Wake bits*/
+	port_index = xhci->num_usb3_ports;
+	port_array = xhci->usb3_ports;
+	while (port_index--) {
+		t1 = readl(port_array[port_index]);
+		t1 = xhci_port_state_to_neutral(t1);
+		t2 = t1 & ~PORT_WAKE_BITS;
+		if (t1 != t2)
+			writel(t2, port_array[port_index]);
+	}
+
+	/* disble usb2 ports Wake bits*/
+	port_index = xhci->num_usb2_ports;
+	port_array = xhci->usb2_ports;
+	while (port_index--) {
+		t1 = readl(port_array[port_index]);
+		t1 = xhci_port_state_to_neutral(t1);
+		t2 = t1 & ~PORT_WAKE_BITS;
+		if (t1 != t2)
+			writel(t2, port_array[port_index]);
+	}
+
+	spin_unlock_irqrestore(&xhci->lock, flags);
+}
+
 /*
  * Stop HC (not bus-specific)
  *
  * This is called when the machine transition into S3/S4 mode.
  *
  */
-int xhci_suspend(struct xhci_hcd *xhci)
+int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
 {
 	int			rc = 0;
 	unsigned int		delay = XHCI_MAX_HALT_USEC;
@@ -857,6 +893,10 @@ int xhci_suspend(struct xhci_hcd *xhci)
 			xhci->shared_hcd->state != HC_STATE_SUSPENDED)
 		return -EINVAL;
 
+	/* Clear root port wake on bits if wakeup not allowed. */
+	if (!do_wakeup)
+		xhci_disable_port_wake_on_bits(xhci);
+
 	/* Don't poll the roothubs on bus suspend. */
 	xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
 	clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 75f775c993ee..1703de9f0509 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1767,7 +1767,7 @@ void xhci_shutdown(struct usb_hcd *hcd);
 int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks);
 
 #ifdef	CONFIG_PM
-int xhci_suspend(struct xhci_hcd *xhci);
+int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
 int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
 #else
 #define	xhci_suspend	NULL
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 42/66] can: esd_usb2: fix memory leak on disconnect
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (40 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 41/66] usb: xhci: rework root port wake bits if controller isn't allowed to wakeup Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 43/66] ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices Jiri Slaby
                   ` (25 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexey Khoroshilov, Marc Kleine-Budde, Jiri Slaby

From: Alexey Khoroshilov <khoroshilov@ispras.ru>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit efbd50d2f62fc1f69a3dcd153e63ba28cc8eb27f upstream.

It seems struct esd_usb2 dev is not deallocated on disconnect. The patch adds
the missing deallocation.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/can/usb/esd_usb2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index ac6177d3befc..91654d09275f 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -1142,6 +1142,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf)
 			}
 		}
 		unlink_all_urbs(dev);
+		kfree(dev);
 	}
 }
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 43/66] ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (41 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 42/66] can: esd_usb2: fix memory leak on disconnect Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 44/66] aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer Jiri Slaby
                   ` (24 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jurgen Kramer, Takashi Iwai, Jiri Slaby

From: Jurgen Kramer <gtmkramer@xs4all.nl>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 6e84a8d7ac3ba246ef44e313e92bc16a1da1b04a upstream.

This patch adds a USB control message delay quirk for a few specific Marantz/Denon
devices. Without the delay the DACs will not work properly and produces the
following type of messages:

Nov 15 10:09:21 orwell kernel: [   91.342880] usb 3-13: clock source 41 is not valid, cannot use
Nov 15 10:09:21 orwell kernel: [   91.343775] usb 3-13: clock source 41 is not valid, cannot use

There are likely other Marantz/Denon devices using the same USB module which exhibit the
same problems. But as this cannot be verified I limited the patch to the devices
I could test.

The following two devices are covered by this path:
- Marantz SA-14S1
- Marantz HD-DAC1

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/usb/quirks.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 0df9ede99dfd..3fbb4553ba40 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1127,6 +1127,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
 	if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
 	    (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
 		mdelay(20);
+
+	/* Marantz/Denon devices with USB DAC functionality need a delay
+	 * after each class compliant request
+	 */
+	if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) &&
+	    (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) {
+
+		switch (le16_to_cpu(dev->descriptor.idProduct)) {
+		case 0x3005: /* Marantz HD-DAC1 */
+		case 0x3006: /* Marantz SA-14S1 */
+			mdelay(20);
+			break;
+		}
+	}
 }
 
 /*
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 44/66] aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (42 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 43/66] ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 45/66] ARM: 8216/1: xscale: correct auxiliary register in suspend/resume Jiri Slaby
                   ` (23 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Gu Zheng, Benjamin LaHaise, Jiri Slaby

From: Gu Zheng <guz.fnst@cn.fujitsu.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 835f252c6debd204fcd607c79975089b1ecd3472 upstream.

https://bugzilla.kernel.org/show_bug.cgi?id=86831

Markus reported that when shutting down mysqld (with AIO support,
on a ext3 formatted Harddrive) leads to a negative number of dirty pages
(underrun to the counter). The negative number results in a drastic reduction
of the write performance because the page cache is not used, because the kernel
thinks it is still 2 ^ 32 dirty pages open.

Add a warn trace in __dec_zone_state will catch this easily:

static inline void __dec_zone_state(struct zone *zone, enum
	zone_stat_item item)
{
     atomic_long_dec(&zone->vm_stat[item]);
+    WARN_ON_ONCE(item == NR_FILE_DIRTY &&
	atomic_long_read(&zone->vm_stat[item]) < 0);
     atomic_long_dec(&vm_stat[item]);
}

[   21.341632] ------------[ cut here ]------------
[   21.346294] WARNING: CPU: 0 PID: 309 at include/linux/vmstat.h:242
cancel_dirty_page+0x164/0x224()
[   21.355296] Modules linked in: wutbox_cp sata_mv
[   21.359968] CPU: 0 PID: 309 Comm: kworker/0:1 Not tainted 3.14.21-WuT #80
[   21.366793] Workqueue: events free_ioctx
[   21.370760] [<c0016a64>] (unwind_backtrace) from [<c0012f88>]
(show_stack+0x20/0x24)
[   21.378562] [<c0012f88>] (show_stack) from [<c03f8ccc>]
(dump_stack+0x24/0x28)
[   21.385840] [<c03f8ccc>] (dump_stack) from [<c0023ae4>]
(warn_slowpath_common+0x84/0x9c)
[   21.393976] [<c0023ae4>] (warn_slowpath_common) from [<c0023bb8>]
(warn_slowpath_null+0x2c/0x34)
[   21.402800] [<c0023bb8>] (warn_slowpath_null) from [<c00c0688>]
(cancel_dirty_page+0x164/0x224)
[   21.411524] [<c00c0688>] (cancel_dirty_page) from [<c00c080c>]
(truncate_inode_page+0x8c/0x158)
[   21.420272] [<c00c080c>] (truncate_inode_page) from [<c00c0a94>]
(truncate_inode_pages_range+0x11c/0x53c)
[   21.429890] [<c00c0a94>] (truncate_inode_pages_range) from
[<c00c0f6c>] (truncate_pagecache+0x88/0xac)
[   21.439252] [<c00c0f6c>] (truncate_pagecache) from [<c00c0fec>]
(truncate_setsize+0x5c/0x74)
[   21.447731] [<c00c0fec>] (truncate_setsize) from [<c013b3a8>]
(put_aio_ring_file.isra.14+0x34/0x90)
[   21.456826] [<c013b3a8>] (put_aio_ring_file.isra.14) from
[<c013b424>] (aio_free_ring+0x20/0xcc)
[   21.465660] [<c013b424>] (aio_free_ring) from [<c013b4f4>]
(free_ioctx+0x24/0x44)
[   21.473190] [<c013b4f4>] (free_ioctx) from [<c003d8d8>]
(process_one_work+0x134/0x47c)
[   21.481132] [<c003d8d8>] (process_one_work) from [<c003e988>]
(worker_thread+0x130/0x414)
[   21.489350] [<c003e988>] (worker_thread) from [<c00448ac>]
(kthread+0xd4/0xec)
[   21.496621] [<c00448ac>] (kthread) from [<c000ec18>]
(ret_from_fork+0x14/0x20)
[   21.503884] ---[ end trace 79c4bf42c038c9a1 ]---

The cause is that we set the aio ring file pages as *DIRTY* via SetPageDirty
(bypasses the VFS dirty pages increment) when init, and aio fs uses
*default_backing_dev_info* as the backing dev, which does not disable
the dirty pages accounting capability.
So truncating aio ring file will contribute to accounting dirty pages (VFS
dirty pages decrement), then error occurs.

The original goal is keeping these pages in memory (can not be reclaimed
or swapped) in life-time via marking it dirty. But thinking more, we have
already pinned pages via elevating the page's refcount, which can already
achieve the goal, so the SetPageDirty seems unnecessary.

In order to fix the issue, using the __set_page_dirty_no_writeback instead
of the nop .set_page_dirty, and dropped the SetPageDirty (don't manually
set the dirty flags, don't disable set_page_dirty(), rely on default behaviour).

With the above change, the dirty pages accounting can work well. But as we
known, aio fs is an anonymous one, which should never cause any real write-back,
we can ignore the dirty pages (write back) accounting by disabling the dirty
pages (write back) accounting capability. So we introduce an aio private
backing dev info (disabled the ACCT_DIRTY/WRITEBACK/ACCT_WB capabilities) to
replace the default one.

Reported-by: Markus Königshaus <m.koenigshaus@wut.de>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/aio.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 66bd7e4447ad..307d7708dc00 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -164,6 +164,15 @@ static struct vfsmount *aio_mnt;
 static const struct file_operations aio_ring_fops;
 static const struct address_space_operations aio_ctx_aops;
 
+/* Backing dev info for aio fs.
+ * -no dirty page accounting or writeback happens
+ */
+static struct backing_dev_info aio_fs_backing_dev_info = {
+	.name           = "aiofs",
+	.state          = 0,
+	.capabilities   = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY,
+};
+
 static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
 {
 	struct qstr this = QSTR_INIT("[aio]", 5);
@@ -175,6 +184,7 @@ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
 
 	inode->i_mapping->a_ops = &aio_ctx_aops;
 	inode->i_mapping->private_data = ctx;
+	inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info;
 	inode->i_size = PAGE_SIZE * nr_pages;
 
 	path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this);
@@ -220,6 +230,9 @@ static int __init aio_setup(void)
 	if (IS_ERR(aio_mnt))
 		panic("Failed to create aio fs mount.");
 
+	if (bdi_init(&aio_fs_backing_dev_info))
+		panic("Failed to init aio fs backing dev info.");
+
 	kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
 	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
 
@@ -281,11 +294,6 @@ static const struct file_operations aio_ring_fops = {
 	.mmap = aio_ring_mmap,
 };
 
-static int aio_set_page_dirty(struct page *page)
-{
-	return 0;
-}
-
 #if IS_ENABLED(CONFIG_MIGRATION)
 static int aio_migratepage(struct address_space *mapping, struct page *new,
 			struct page *old, enum migrate_mode mode)
@@ -357,7 +365,7 @@ out:
 #endif
 
 static const struct address_space_operations aio_ctx_aops = {
-	.set_page_dirty = aio_set_page_dirty,
+	.set_page_dirty = __set_page_dirty_no_writeback,
 #if IS_ENABLED(CONFIG_MIGRATION)
 	.migratepage	= aio_migratepage,
 #endif
@@ -412,7 +420,6 @@ static int aio_setup_ring(struct kioctx *ctx)
 		pr_debug("pid(%d) page[%d]->count=%d\n",
 			 current->pid, i, page_count(page));
 		SetPageUptodate(page);
-		SetPageDirty(page);
 		unlock_page(page);
 
 		ctx->ring_pages[i] = page;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 45/66] ARM: 8216/1: xscale: correct auxiliary register in suspend/resume
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (43 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 44/66] aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 46/66] ARM: 8222/1: mvebu: enable strex backoff delay Jiri Slaby
                   ` (22 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dmitry Eremin-Solenikov, Russell King, Jiri Slaby

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ef59a20ba375aeb97b3150a118318884743452a8 upstream.

According to the manuals I have, XScale auxiliary register should be
reached with opc_2 = 1 instead of crn = 1. cpu_xscale_proc_init
correctly uses c1, c0, 1 arguments, but cpu_xscale_do_suspend and
cpu_xscale_do_resume use c1, c1, 0. Correct suspend/resume functions to
also use c1, c0, 1.

The issue was primarily noticed thanks to qemu reporing "unsupported
instruction" on the pxa suspend path. Confirmed in PXA210/250 and PXA255
XScale Core manuals and in PXA270 and PXA320 Developers Guides.

Harware tested by me on tosa (pxa255). Robert confirmed on pxa270 board.

Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mm/proc-xscale.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index d19b1cfcad91..b34b95f45cb3 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -535,7 +535,7 @@ ENTRY(cpu_xscale_do_suspend)
 	mrc	p15, 0, r5, c15, c1, 0	@ CP access reg
 	mrc	p15, 0, r6, c13, c0, 0	@ PID
 	mrc	p15, 0, r7, c3, c0, 0	@ domain ID
-	mrc	p15, 0, r8, c1, c1, 0	@ auxiliary control reg
+	mrc	p15, 0, r8, c1, c0, 1	@ auxiliary control reg
 	mrc	p15, 0, r9, c1, c0, 0	@ control reg
 	bic	r4, r4, #2		@ clear frequency change bit
 	stmia	r0, {r4 - r9}		@ store cp regs
@@ -552,7 +552,7 @@ ENTRY(cpu_xscale_do_resume)
 	mcr	p15, 0, r6, c13, c0, 0	@ PID
 	mcr	p15, 0, r7, c3, c0, 0	@ domain ID
 	mcr	p15, 0, r1, c2, c0, 0	@ translation table base addr
-	mcr	p15, 0, r8, c1, c1, 0	@ auxiliary control reg
+	mcr	p15, 0, r8, c1, c0, 1	@ auxiliary control reg
 	mov	r0, r9			@ control register
 	b	cpu_resume_mmu
 ENDPROC(cpu_xscale_do_resume)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 46/66] ARM: 8222/1: mvebu: enable strex backoff delay
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (44 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 45/66] ARM: 8216/1: xscale: correct auxiliary register in suspend/resume Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 47/66] ARM: 8226/1: cacheflush: get rid of restarting block Jiri Slaby
                   ` (21 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Thomas Petazzoni, Nadav Haklai, Russell King, Jiri Slaby

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 995ab5189d1d7264e79e665dfa032a19b3ac646e upstream.

Under extremely rare conditions, in an MPCore node consisting of at
least 3 CPUs, two CPUs trying to perform a STREX to data on the same
shared cache line can enter a livelock situation.

This patch enables the HW mechanism that overcomes the bug. This fixes
the incorrect setup of the STREX backoff delay bit due to a wrong
description in the specification.

Note that enabling the STREX backoff delay mechanism is done by
leaving the bit *cleared*, while the bit was currently being set by
the proc-v7.S code.

[Thomas: adapt to latest mainline, slightly reword the commit log, add
stable markers.]

Fixes: de4901933f6d ("arm: mm: Add support for PJ4B cpu and init routines")

Signed-off-by: Nadav Haklai <nadavh@marvell.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mm/proc-v7.S | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index ced046d9f825..2e381582ffee 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -204,7 +204,6 @@ __v7_pj4b_setup:
 /* Auxiliary Debug Modes Control 1 Register */
 #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */
 #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */
-#define PJ4B_BCK_OFF_STREX (1 << 5) /* Enable the back off of STREX instr */
 #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */
 
 /* Auxiliary Debug Modes Control 2 Register */
@@ -227,7 +226,6 @@ __v7_pj4b_setup:
 	/* Auxiliary Debug Modes Control 1 Register */
 	mrc	p15, 1,	r0, c15, c1, 1
 	orr     r0, r0, #PJ4B_CLEAN_LINE
-	orr     r0, r0, #PJ4B_BCK_OFF_STREX
 	orr     r0, r0, #PJ4B_INTER_PARITY
 	bic	r0, r0, #PJ4B_STATIC_BP
 	mcr	p15, 1,	r0, c15, c1, 1
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 47/66] ARM: 8226/1: cacheflush: get rid of restarting block
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (45 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 46/66] ARM: 8222/1: mvebu: enable strex backoff delay Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 48/66] Input: synaptics - adjust min/max on Thinkpad E540 Jiri Slaby
                   ` (20 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vladimir Murzin, Russell King, Jiri Slaby

From: Vladimir Murzin <vladimir.murzin@arm.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 3f4aa45ceea5789a4aade536acc27f2e0d3da5e1 upstream.

We cannot restart cacheflush safely if a process provides user-defined
signal handler and signal is pending. In this case -EINTR is returned
and it is expected that process re-invokes syscall. However, there are
a few problems with that:
 * looks like nobody bothers checking return value from cacheflush
 * but if it did, we don't provide the restart address for that, so the
   process has to use the same range again
 * ...and again, what might lead to looping forever

So, remove cacheflush restarting code and terminate cache flushing
as early as fatal signal is pending.

Reported-by: Chanho Min <chanho.min@lge.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/include/asm/thread_info.h | 11 -----------
 arch/arm/kernel/traps.c            | 31 ++-----------------------------
 2 files changed, 2 insertions(+), 40 deletions(-)

diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index df5e13d64f2c..2b8114fcba09 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -43,16 +43,6 @@ struct cpu_context_save {
 	__u32	extra[2];		/* Xscale 'acc' register, etc */
 };
 
-struct arm_restart_block {
-	union {
-		/* For user cache flushing */
-		struct {
-			unsigned long start;
-			unsigned long end;
-		} cache;
-	};
-};
-
 /*
  * low level task data that entry.S needs immediate access to.
  * __switch_to() assumes cpu_context follows immediately after cpu_domain.
@@ -78,7 +68,6 @@ struct thread_info {
 	unsigned long		thumbee_state;	/* ThumbEE Handler Base register */
 #endif
 	struct restart_block	restart_block;
-	struct arm_restart_block	arm_restart_block;
 };
 
 #define INIT_THREAD_INFO(tsk)						\
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index a8dd111ff99a..8e6cd760cc68 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -503,8 +503,6 @@ static int bad_syscall(int n, struct pt_regs *regs)
 	return regs->ARM_r0;
 }
 
-static long do_cache_op_restart(struct restart_block *);
-
 static inline int
 __do_cache_op(unsigned long start, unsigned long end)
 {
@@ -513,24 +511,8 @@ __do_cache_op(unsigned long start, unsigned long end)
 	do {
 		unsigned long chunk = min(PAGE_SIZE, end - start);
 
-		if (signal_pending(current)) {
-			struct thread_info *ti = current_thread_info();
-
-			ti->restart_block = (struct restart_block) {
-				.fn	= do_cache_op_restart,
-			};
-
-			ti->arm_restart_block = (struct arm_restart_block) {
-				{
-					.cache = {
-						.start	= start,
-						.end	= end,
-					},
-				},
-			};
-
-			return -ERESTART_RESTARTBLOCK;
-		}
+		if (fatal_signal_pending(current))
+			return 0;
 
 		ret = flush_cache_user_range(start, start + chunk);
 		if (ret)
@@ -543,15 +525,6 @@ __do_cache_op(unsigned long start, unsigned long end)
 	return 0;
 }
 
-static long do_cache_op_restart(struct restart_block *unused)
-{
-	struct arm_restart_block *restart_block;
-
-	restart_block = &current_thread_info()->arm_restart_block;
-	return __do_cache_op(restart_block->cache.start,
-			     restart_block->cache.end);
-}
-
 static inline int
 do_cache_op(unsigned long start, unsigned long end, int flags)
 {
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 48/66] Input: synaptics - adjust min/max on Thinkpad E540
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (46 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 47/66] ARM: 8226/1: cacheflush: get rid of restarting block Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 49/66] Input: xpad - use proper endpoint type Jiri Slaby
                   ` (19 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ben Sagal, Dmitry Torokhov, Jiri Slaby

From: Ben Sagal <bensagal@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit bce4f9e764c36bc35dd5c9cf9e057c09f422397d upstream.

The LEN2006 Synaptics touchpad (as found in Thinkpad E540) returns wrong
min max values.

touchpad-edge-detector output:
>  Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event6
>  Move one finger around the touchpad to detect the actual edges
>  Kernel says:    x [1472..5674], y [1408..4684]
>  Touchpad sends: x [1264..5675], y [1171..4688]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88211
Signed-off-by: Binyamin Sagal <bensagal@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/synaptics.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 1e76eb8f06c7..a3769cf84381 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -140,6 +140,10 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		(const char * const []){"LEN2001", NULL},
 		1024, 5022, 2508, 4832
 	},
+	{
+		(const char * const []){"LEN2006", NULL},
+		1264, 5675, 1171, 4688
+	},
 	{ }
 };
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 49/66] Input: xpad - use proper endpoint type
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (47 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 48/66] Input: synaptics - adjust min/max on Thinkpad E540 Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 50/66] srp-target: Retry when QP creation fails with ENOMEM Jiri Slaby
                   ` (18 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Greg Kroah-Hartman, Pierre-Loup A. Griffais,
	Jiri Slaby, Dmitry Torokhov

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit a1f9a4072655843fc03186acbad65990cc05dd2d upstream.

The xpad wireless endpoint is not a bulk endpoint on my devices, but
rather an interrupt one, so the USB core complains when it is submitted.
I'm guessing that the author really did mean that this should be an
interrupt urb, but as there are a zillion different xpad devices out
there, let's cover out bases and handle both bulk and interrupt
endpoints just as easily.

Signed-off-by: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/joystick/xpad.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 7b717d8b6897..90c7f97ea0ad 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1039,9 +1039,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 		}
 
 		ep_irq_in = &intf->cur_altsetting->endpoint[1].desc;
-		usb_fill_bulk_urb(xpad->bulk_out, udev,
-				usb_sndbulkpipe(udev, ep_irq_in->bEndpointAddress),
-				xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad);
+		if (usb_endpoint_is_bulk_out(ep_irq_in)) {
+			usb_fill_bulk_urb(xpad->bulk_out, udev,
+					  usb_sndbulkpipe(udev,
+							  ep_irq_in->bEndpointAddress),
+					  xpad->bdata, XPAD_PKT_LEN,
+					  xpad_bulk_out, xpad);
+		} else {
+			usb_fill_int_urb(xpad->bulk_out, udev,
+					 usb_sndintpipe(udev,
+							ep_irq_in->bEndpointAddress),
+					 xpad->bdata, XPAD_PKT_LEN,
+					 xpad_bulk_out, xpad, 0);
+		}
 
 		/*
 		 * Submit the int URB immediately rather than waiting for open
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 00/66] 3.12.35-stable review
@ 2014-12-06 15:07 Jiri Slaby
  2014-12-06 15:06 ` [PATCH 3.12 01/66] Input: serio - add firmware_id sysfs attribute Jiri Slaby
                   ` (67 more replies)
  0 siblings, 68 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux, satoru.takeuchi, shuah.kh, linux-kernel, Jiri Slaby

This is the start of the stable review cycle for the 3.12.35 release.
There are 66 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed Dec 10 16:07:07 CET 2014.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.35-rc1.xz
and the diffstat can be found below.

thanks,
js

===============


Aaro Koskinen (2):
  MIPS: oprofile: Fix backtrace on 64-bit kernel
  MIPS: Loongson: Make platform serial setup always built-in.

Alex Deucher (1):
  drm/radeon: fix endian swapping in vbios fetch for tdp table

Alexander Gordeev (1):
  PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs()
    fails

Alexey Khoroshilov (1):
  can: esd_usb2: fix memory leak on disconnect

Andy Lutomirski (4):
  x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C
  x86_64, traps: Stop using IST for #SS
  x86_64, traps: Rework bad_iret
  uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME

Bart Van Assche (1):
  srp-target: Retry when QP creation fails with ENOMEM

Ben Sagal (1):
  Input: synaptics - adjust min/max on Thinkpad E540

Benjamin Herrenschmidt (5):
  PCI/MSI: Add device flag indicating that 64-bit MSIs don't work
  of/base: Fix PowerPC address parsing hack
  powerpc/pseries: Honor the generic "no_64bit_msi" flag
  gpu/radeon: Set flag to indicate broken 64-bit MSI
  powerpc/powernv: Honor the generic "no_64bit_msi" flag

Benjamin Tissoires (1):
  Input: synaptics - fix resolution for manually provided min/max

Charles Keepax (1):
  ASoC: wm_adsp: Avoid attempt to free buffers that might still be in
    use

Chris Moore (1):
  IB/isert: Adjust CQ size to HW limits

Christian Sünkenberg (1):
  scsi: add Intel Multi-Flex to scsi scan blacklist

Christoph Hellwig (1):
  nfsd: correctly define v4.2 support attributes

Cong Wang (1):
  batman: fix a bogus warning from batadv_is_on_batman_iface()

Cristina Ciocan (1):
  iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask

Dave Hansen (1):
  x86: Require exact match for 'noxsave' command line option

Dmitry Eremin-Solenikov (1):
  ARM: 8216/1: xscale: correct auxiliary register in suspend/resume

Fabio Estevam (1):
  ASoC: sgtl5000: Fix SMALL_POP bit definition

Greg Kroah-Hartman (1):
  Input: xpad - use proper endpoint type

Gu Zheng (1):
  aio: fix uncorrent dirty pages accouting when truncating AIO ring
    buffer

Hans de Goede (8):
  Input: serio - add firmware_id sysfs attribute
  Input: i8042 - add firmware_id support
  Input: Add INPUT_PROP_TOPBUTTONPAD device property
  Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property
  Input: synaptics - add a matches_pnp_id helper function
  Input: synaptics - change min/max quirk table to pnp-id matching
  Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531)
  usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000

Jane Zhou (1):
  net/ping: handle protocol mismatching scenario

Jeff Layton (1):
  locks: eliminate BUG() call when there's an unexpected lock on file
    close

Johan Hovold (3):
  USB: ssu100: fix overrun-error reporting
  USB: keyspan: fix overrun-error reporting
  USB: keyspan: fix tty line-status reporting

Jurgen Kramer (1):
  ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon
    devices

Kees Cook (1):
  x86, mm: Set NX across entire PMD at boot

Kuninori Morimoto (2):
  ASoC: rsnd: remove unsupported PAUSE flag
  ASoC: fsi: remove unsupported PAUSE flag

Larry Finger (1):
  staging: r8188eu: Add new device ID for DLink GO-USB-N150

Laurent Dufour (1):
  powerpc/pseries: Fix endiannes issue in RTAS call from xmon

Lu Baolu (1):
  usb: xhci: rework root port wake bits if controller isn't allowed to
    wakeup

Mathias Nyman (1):
  USB: xhci: don't start a halted endpoint before its new dequeue is set

Maurizio Lombardi (1):
  bnx2fc: do not add shared skbs to the fcoe_rx_list

Maxime Ripard (1):
  clockevent: sun4i: Fix race condition in the probe code

Miaoqing Pan (1):
  ath9k: Fix RTC_DERIVED_CLK usage

Nicholas Bellinger (1):
  vhost-scsi: Take configfs group dependency during
    VHOST_SCSI_SET_ENDPOINT

Or Gerlitz (1):
  ib_isert: Add max_send_sge=2 minimum for control PDU responses

Preston Fick (1):
  USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick

Roland Dreier (1):
  target: Don't call TFO->write_pending if data_length == 0

Sagi Grimberg (1):
  iser-target: Handle DEVICE_REMOVAL event on network portal listener
    correctly

Stanislaw Gruszka (1):
  rt2x00: do not align payload on modern H/W

Takashi Iwai (2):
  Input: synaptics - add min/max quirk for Lenovo T440s
  ASoC: dpcm: Fix race between FE/BE updates and trigger

Thomas Körper (1):
  can: dev: avoid calling kfree_skb() from interrupt context

Thomas Petazzoni (1):
  ARM: 8222/1: mvebu: enable strex backoff delay

Thor Thayer (1):
  spi: dw: Fix dynamic speed change.

Trond Myklebust (1):
  nfsd: Fix slot wake up race in the nfsv4.1 callback code

Troy Clark (1):
  usb: serial: ftdi_sio: add PIDs for Matrix Orbital products

Vladimir Murzin (1):
  ARM: 8226/1: cacheflush: get rid of restarting block

 arch/arm/include/asm/thread_info.h          |  11 --
 arch/arm/kernel/traps.c                     |  31 +---
 arch/arm/mm/proc-v7.S                       |   2 -
 arch/arm/mm/proc-xscale.S                   |   4 +-
 arch/mips/loongson/common/Makefile          |   3 +-
 arch/mips/oprofile/backtrace.c              |   2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c   |   3 +-
 arch/powerpc/platforms/powernv/pci.c        |   4 +-
 arch/powerpc/platforms/pseries/msi.c        |   2 +-
 arch/powerpc/xmon/xmon.c                    |   6 +-
 arch/x86/include/asm/page_32_types.h        |   1 -
 arch/x86/include/asm/page_64_types.h        |  11 +-
 arch/x86/include/asm/thread_info.h          |   2 +-
 arch/x86/kernel/cpu/common.c                |   2 +
 arch/x86/kernel/dumpstack_64.c              |   1 -
 arch/x86/kernel/entry_64.S                  |  81 +++--------
 arch/x86/kernel/traps.c                     |  71 +++++++---
 arch/x86/mm/init_64.c                       |  11 +-
 drivers/clocksource/sun4i_timer.c           |  10 +-
 drivers/gpu/drm/radeon/r600_dpm.c           |   2 +-
 drivers/gpu/drm/radeon/radeon_irq_kms.c     |  10 ++
 drivers/infiniband/ulp/isert/ib_isert.c     |  44 ++++--
 drivers/infiniband/ulp/srpt/ib_srpt.c       |   8 ++
 drivers/input/joystick/xpad.c               |  16 ++-
 drivers/input/mouse/synaptics.c             | 212 +++++++++++++---------------
 drivers/input/serio/i8042-x86ia64io.h       |  15 ++
 drivers/input/serio/i8042.c                 |   6 +
 drivers/input/serio/serio.c                 |  13 ++
 drivers/net/can/dev.c                       |   2 +-
 drivers/net/can/usb/esd_usb2.c              |   1 +
 drivers/net/wireless/ath/ath9k/ar9003_phy.c |  13 ++
 drivers/net/wireless/ath/ath9k/hw.c         |  13 --
 drivers/net/wireless/rt2x00/rt2x00queue.c   |  50 ++-----
 drivers/of/address.c                        |  19 ++-
 drivers/pci/msi.c                           |  37 ++++-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c           |   7 +
 drivers/scsi/scsi_devinfo.c                 |   1 +
 drivers/spi/spi-dw.c                        |   6 +-
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |   1 +
 drivers/target/target_core_transport.c      |   2 +-
 drivers/usb/core/quirks.c                   |   3 +
 drivers/usb/host/xhci-pci.c                 |   2 +-
 drivers/usb/host/xhci-plat.c                |  10 +-
 drivers/usb/host/xhci-ring.c                |   3 +-
 drivers/usb/host/xhci.c                     |  42 +++++-
 drivers/usb/host/xhci.h                     |   2 +-
 drivers/usb/serial/cp210x.c                 |   1 +
 drivers/usb/serial/ftdi_sio.c               |  33 +++++
 drivers/usb/serial/ftdi_sio_ids.h           |  39 ++++-
 drivers/usb/serial/keyspan.c                |  97 ++++++++-----
 drivers/usb/serial/ssu100.c                 |  11 +-
 drivers/vhost/scsi.c                        |  24 ++++
 fs/aio.c                                    |  21 ++-
 fs/locks.c                                  |  24 +++-
 fs/nfsd/nfs4callback.c                      |   8 +-
 fs/nfsd/nfsd.h                              |   9 +-
 include/linux/iio/events.h                  |   2 +-
 include/linux/pci.h                         |   1 +
 include/linux/serio.h                       |   1 +
 include/sound/soc-dpcm.h                    |   2 +
 include/uapi/linux/input.h                  |   1 +
 kernel/events/uprobes.c                     |   1 -
 net/batman-adv/hard-interface.c             |   2 +-
 net/ipv4/ping.c                             |   2 +
 sound/soc/codecs/sgtl5000.c                 |   3 +-
 sound/soc/codecs/sgtl5000.h                 |   2 +-
 sound/soc/codecs/wm_adsp.c                  |   1 +
 sound/soc/sh/fsi.c                          |   3 +-
 sound/soc/sh/rcar/core.c                    |   3 +-
 sound/soc/soc-pcm.c                         |  72 +++++++---
 sound/usb/quirks.c                          |  14 ++
 71 files changed, 731 insertions(+), 444 deletions(-)

-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 50/66] srp-target: Retry when QP creation fails with ENOMEM
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (48 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 49/66] Input: xpad - use proper endpoint type Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 51/66] target: Don't call TFO->write_pending if data_length == 0 Jiri Slaby
                   ` (17 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Bart Van Assche, Sagi Grimberg, Nicholas Bellinger,
	Jiri Slaby

From: Bart Van Assche <bvanassche@acm.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ab477c1ff5e0a744c072404bf7db51bfe1f05b6e upstream.

It is not guaranteed to that srp_sq_size is supported
by the HCA. So if we failed to create the QP with ENOMEM,
try with a smaller srp_sq_size. Keep it up until we hit
MIN_SRPT_SQ_SIZE, then fail the connection.

Reported-by: Mark Lehrer <lehrer@gmail.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 56f2cf790779..1ed08cc2e190 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2101,6 +2101,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
 	if (!qp_init)
 		goto out;
 
+retry:
 	ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
 			      ch->rq_size + srp_sq_size, 0);
 	if (IS_ERR(ch->cq)) {
@@ -2124,6 +2125,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
 	ch->qp = ib_create_qp(sdev->pd, qp_init);
 	if (IS_ERR(ch->qp)) {
 		ret = PTR_ERR(ch->qp);
+		if (ret == -ENOMEM) {
+			srp_sq_size /= 2;
+			if (srp_sq_size >= MIN_SRPT_SQ_SIZE) {
+				ib_destroy_cq(ch->cq);
+				goto retry;
+			}
+		}
 		printk(KERN_ERR "failed to create_qp ret= %d\n", ret);
 		goto err_destroy_cq;
 	}
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 51/66] target: Don't call TFO->write_pending if data_length == 0
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (49 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 50/66] srp-target: Retry when QP creation fails with ENOMEM Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 52/66] iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly Jiri Slaby
                   ` (16 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Roland Dreier, Nicholas Bellinger, Jiri Slaby

From: Roland Dreier <roland@purestorage.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 885e7b0e181c14e4d0ddd26c688bad2b84c1ada9 upstream.

If an initiator sends a zero-length command (e.g. TEST UNIT READY) but
sets the transfer direction in the transport layer to indicate a
data-out phase, we still shouldn't try to transfer data.  At best it's
a NOP, and depending on the transport, we might crash on an
uninitialized sg list.

Reported-by: Craig Watson <craig.watson@vanguard-rugged.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/target_core_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index b37371ee9f95..3931b50eeefd 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2231,7 +2231,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
 	 * and let it call back once the write buffers are ready.
 	 */
 	target_add_to_state_list(cmd);
-	if (cmd->data_direction != DMA_TO_DEVICE) {
+	if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) {
 		target_execute_cmd(cmd);
 		return 0;
 	}
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 52/66] iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (50 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 51/66] target: Don't call TFO->write_pending if data_length == 0 Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 53/66] spi: dw: Fix dynamic speed change Jiri Slaby
                   ` (15 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Sagi Grimberg, Sagi Grimberg, Nicholas Bellinger,
	Jiri Slaby

From: Sagi Grimberg <sagig@dev.mellanox.co.il>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 3b726ae2de02a406cc91903f80132daee37b6f1b upstream.

In this case the cm_id->context is the isert_np, and the cm_id->qp
is NULL, so use that to distinct the cases.

Since we don't expect any other events on this cm_id we can
just return -1 for explicit termination of the cm_id by the
cma layer.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 2c14232447e4..7fb89a46d864 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -708,14 +708,25 @@ wake_up:
 	complete(&isert_conn->conn_wait);
 }
 
-static void
+static int
 isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect)
 {
-	struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context;
+	struct isert_conn *isert_conn;
+
+	if (!cma_id->qp) {
+		struct isert_np *isert_np = cma_id->context;
+
+		isert_np->np_cm_id = NULL;
+		return -1;
+	}
+
+	isert_conn = (struct isert_conn *)cma_id->context;
 
 	isert_conn->disconnect = disconnect;
 	INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work);
 	schedule_work(&isert_conn->conn_logout_work);
+
+	return 0;
 }
 
 static int
@@ -730,6 +741,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 	switch (event->event) {
 	case RDMA_CM_EVENT_CONNECT_REQUEST:
 		ret = isert_connect_request(cma_id, event);
+		if (ret)
+			pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
+				event->event, ret);
 		break;
 	case RDMA_CM_EVENT_ESTABLISHED:
 		isert_connected_handler(cma_id);
@@ -739,7 +753,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 	case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
 		disconnect = true;
 	case RDMA_CM_EVENT_TIMEWAIT_EXIT:  /* FALLTHRU */
-		isert_disconnected_handler(cma_id, disconnect);
+		ret = isert_disconnected_handler(cma_id, disconnect);
 		break;
 	case RDMA_CM_EVENT_CONNECT_ERROR:
 	default:
@@ -747,12 +761,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 		break;
 	}
 
-	if (ret != 0) {
-		pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
-		       event->event, ret);
-		dump_stack();
-	}
-
 	return ret;
 }
 
@@ -2683,7 +2691,8 @@ isert_free_np(struct iscsi_np *np)
 {
 	struct isert_np *isert_np = (struct isert_np *)np->np_context;
 
-	rdma_destroy_id(isert_np->np_cm_id);
+	if (isert_np->np_cm_id)
+		rdma_destroy_id(isert_np->np_cm_id);
 
 	np->np_context = NULL;
 	kfree(isert_np);
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 53/66] spi: dw: Fix dynamic speed change.
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (51 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 52/66] iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 54/66] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT Jiri Slaby
                   ` (14 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thor Thayer, Vlastimil Setka, Mark Brown, Jiri Slaby

From: Thor Thayer <tthayer@opensource.altera.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 0a8727e69778683495058852f783eeda141a754e upstream.

An IOCTL call that calls spi_setup() and then dw_spi_setup() will
overwrite the persisted last transfer speed. On each transfer, the
SPI speed is compared to the last transfer speed to determine if the
clock divider registers need to be updated (did the speed change?).
This bug was observed with the spidev driver using spi-config to
update the max transfer speed.

This fix: Don't overwrite the persisted last transaction clock speed
when updating the SPI parameters in dw_spi_setup(). On the next
transaction, the new speed won't match the persisted last speed
and the hardware registers will be updated.
On initialization, the persisted last transaction clock
speed will be 0 but will be updated after the first SPI
transaction.

Move zeroed clock divider check into clock change test because
chip->clk_div is zero on startup and would cause a divide-by-zero
error. The calculation was wrong as well (can't support odd #).

Reported-by: Vlastimil Setka <setka@vsis.cz>
Signed-off-by: Vlastimil Setka <setka@vsis.cz>
Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/spi/spi-dw.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 79c958e49f61..bb91bd8a21dc 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -394,9 +394,6 @@ static void pump_transfers(unsigned long data)
 	chip = dws->cur_chip;
 	spi = message->spi;
 
-	if (unlikely(!chip->clk_div))
-		chip->clk_div = dws->max_freq / chip->speed_hz;
-
 	if (message->state == ERROR_STATE) {
 		message->status = -EIO;
 		goto early_exit;
@@ -438,7 +435,7 @@ static void pump_transfers(unsigned long data)
 	if (transfer->speed_hz) {
 		speed = chip->speed_hz;
 
-		if (transfer->speed_hz != speed) {
+		if ((transfer->speed_hz != speed) || (!chip->clk_div)) {
 			speed = transfer->speed_hz;
 			if (speed > dws->max_freq) {
 				printk(KERN_ERR "MRST SPI0: unsupported"
@@ -658,7 +655,6 @@ static int dw_spi_setup(struct spi_device *spi)
 		dev_err(&spi->dev, "No max speed HZ parameter\n");
 		return -EINVAL;
 	}
-	chip->speed_hz = spi->max_speed_hz;
 
 	chip->tmode = 0; /* Tx & Rx */
 	/* Default SPI mode is SCPOL = 0, SCPH = 0 */
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 54/66] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (52 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 53/66] spi: dw: Fix dynamic speed change Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 55/66] scsi: add Intel Multi-Flex to scsi scan blacklist Jiri Slaby
                   ` (13 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Nicholas Bellinger, Michael S. Tsirkin,
	Paolo Bonzini, Stefan Hajnoczi, Jiri Slaby

From: Nicholas Bellinger <nab@linux-iscsi.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ab8edab132829b26dd13db6caca3c242cce35dc1 upstream.

This patch addresses a bug where individual vhost-scsi configfs endpoint
groups can be removed from below while active exports to QEMU userspace
still exist, resulting in an OOPs.

It adds a configfs_depend_item() in vhost_scsi_set_endpoint() to obtain
an explicit dependency on se_tpg->tpg_group in order to prevent individual
vhost-scsi WWPN endpoints from being released via normal configfs methods
while an QEMU ioctl reference still exists.

Also, add matching configfs_undepend_item() in vhost_scsi_clear_endpoint()
to release the dependency, once QEMU's reference to the individual group
at /sys/kernel/config/target/vhost/$WWPN/$TPGT is released.

(Fix up vhost_scsi_clear_endpoint() error path - DanC)

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/vhost/scsi.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index d300fd99a2b8..c5b631cceb4c 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1194,6 +1194,7 @@ static int
 vhost_scsi_set_endpoint(struct vhost_scsi *vs,
 			struct vhost_scsi_target *t)
 {
+	struct se_portal_group *se_tpg;
 	struct tcm_vhost_tport *tv_tport;
 	struct tcm_vhost_tpg *tpg;
 	struct tcm_vhost_tpg **vs_tpg;
@@ -1241,6 +1242,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
 				ret = -EEXIST;
 				goto out;
 			}
+			/*
+			 * In order to ensure individual vhost-scsi configfs
+			 * groups cannot be removed while in use by vhost ioctl,
+			 * go ahead and take an explicit se_tpg->tpg_group.cg_item
+			 * dependency now.
+			 */
+			se_tpg = &tpg->se_tpg;
+			ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys,
+						   &se_tpg->tpg_group.cg_item);
+			if (ret) {
+				pr_warn("configfs_depend_item() failed: %d\n", ret);
+				kfree(vs_tpg);
+				mutex_unlock(&tpg->tv_tpg_mutex);
+				goto out;
+			}
 			tpg->tv_tpg_vhost_count++;
 			tpg->vhost_scsi = vs;
 			vs_tpg[tpg->tport_tpgt] = tpg;
@@ -1283,6 +1299,7 @@ static int
 vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
 			  struct vhost_scsi_target *t)
 {
+	struct se_portal_group *se_tpg;
 	struct tcm_vhost_tport *tv_tport;
 	struct tcm_vhost_tpg *tpg;
 	struct vhost_virtqueue *vq;
@@ -1331,6 +1348,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
 		vs->vs_tpg[target] = NULL;
 		match = true;
 		mutex_unlock(&tpg->tv_tpg_mutex);
+		/*
+		 * Release se_tpg->tpg_group.cg_item configfs dependency now
+		 * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur.
+		 */
+		se_tpg = &tpg->se_tpg;
+		configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys,
+				       &se_tpg->tpg_group.cg_item);
 	}
 	if (match) {
 		for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 55/66] scsi: add Intel Multi-Flex to scsi scan blacklist
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (53 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 54/66] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 56/66] can: dev: avoid calling kfree_skb() from interrupt context Jiri Slaby
                   ` (12 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Christian Sünkenberg, Christoph Hellwig, Jiri Slaby

From: Christian Sünkenberg <christian.suenkenberg@hfg-karlsruhe.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 1899045510ff109980d9cc34e330fd8ca3631871 upstream.

Intel Multi-Flex LUNs choke on REPORT SUPPORTED OPERATION CODES
resulting in sd_mod hanging for several minutes on startup.
The issue was introduced with WRITE SAME discovery heuristics.

Fixes: 5db44863b6eb ("[SCSI] sd: Implement support for WRITE SAME")
Signed-off-by: Christian Sünkenberg <christian.suenkenberg@hfg-karlsruhe.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/scsi_devinfo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 49014a143c6a..c1d04d4d3c6c 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -202,6 +202,7 @@ static struct {
 	{"IOMEGA", "Io20S         *F", NULL, BLIST_KEY},
 	{"INSITE", "Floptical   F*8I", NULL, BLIST_KEY},
 	{"INSITE", "I325VM", NULL, BLIST_KEY},
+	{"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC},
 	{"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36},
 	{"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN},
 	{"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 56/66] can: dev: avoid calling kfree_skb() from interrupt context
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (54 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 55/66] scsi: add Intel Multi-Flex to scsi scan blacklist Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 57/66] rt2x00: do not align payload on modern H/W Jiri Slaby
                   ` (11 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Körper, Marc Kleine-Budde, Jiri Slaby

From: Thomas Körper <thomas.koerper@esd.eu>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 5247a589c24022ab34e780039cc8000c48f2035e upstream.

ikfree_skb() is Called in can_free_echo_skb(), which might be called from (TX
Error) interrupt, which triggers the folloing warning:

[ 1153.360705] ------------[ cut here ]------------
[ 1153.360715] WARNING: CPU: 0 PID: 31 at net/core/skbuff.c:563 skb_release_head_state+0xb9/0xd0()
[ 1153.360772] Call Trace:
[ 1153.360778]  [<c167906f>] dump_stack+0x41/0x52
[ 1153.360782]  [<c105bb7e>] warn_slowpath_common+0x7e/0xa0
[ 1153.360784]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
[ 1153.360786]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
[ 1153.360788]  [<c105bc42>] warn_slowpath_null+0x22/0x30
[ 1153.360791]  [<c158b909>] skb_release_head_state+0xb9/0xd0
[ 1153.360793]  [<c158be90>] skb_release_all+0x10/0x30
[ 1153.360795]  [<c158bf06>] kfree_skb+0x36/0x80
[ 1153.360799]  [<f8486938>] ? can_free_echo_skb+0x28/0x40 [can_dev]
[ 1153.360802]  [<f8486938>] can_free_echo_skb+0x28/0x40 [can_dev]
[ 1153.360805]  [<f849a12c>] esd_pci402_interrupt+0x34c/0x57a [esd402]
[ 1153.360809]  [<c10a75b5>] handle_irq_event_percpu+0x35/0x180
[ 1153.360811]  [<c10a7623>] ? handle_irq_event_percpu+0xa3/0x180
[ 1153.360813]  [<c10a7731>] handle_irq_event+0x31/0x50
[ 1153.360816]  [<c10a9c7f>] handle_fasteoi_irq+0x6f/0x120
[ 1153.360818]  [<c10a9c10>] ? handle_edge_irq+0x110/0x110
[ 1153.360822]  [<c1011b61>] handle_irq+0x71/0x90
[ 1153.360823]  <IRQ>  [<c168152c>] do_IRQ+0x3c/0xd0
[ 1153.360829]  [<c1680b6c>] common_interrupt+0x2c/0x34
[ 1153.360834]  [<c107d277>] ? finish_task_switch+0x47/0xf0
[ 1153.360836]  [<c167c27b>] __schedule+0x35b/0x7e0
[ 1153.360839]  [<c10a5334>] ? console_unlock+0x2c4/0x4d0
[ 1153.360842]  [<c13df500>] ? n_tty_receive_buf_common+0x890/0x890
[ 1153.360845]  [<c10707b6>] ? process_one_work+0x196/0x370
[ 1153.360847]  [<c167c723>] schedule+0x23/0x60
[ 1153.360849]  [<c1070de1>] worker_thread+0x161/0x460
[ 1153.360852]  [<c1090fcf>] ? __wake_up_locked+0x1f/0x30
[ 1153.360854]  [<c1070c80>] ? rescuer_thread+0x2f0/0x2f0
[ 1153.360856]  [<c1074f01>] kthread+0xa1/0xc0
[ 1153.360859]  [<c1680401>] ret_from_kernel_thread+0x21/0x30
[ 1153.360861]  [<c1074e60>] ? kthread_create_on_node+0x110/0x110
[ 1153.360863] ---[ end trace 5ff83639cbb74b35 ]---

This patch replaces the kfree_skb() by dev_kfree_skb_any().

Signed-off-by: Thomas Körper <thomas.koerper@esd.eu>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/can/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 539239d8e9ab..9bf47a064cdf 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -385,7 +385,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx)
 	BUG_ON(idx >= priv->echo_skb_max);
 
 	if (priv->echo_skb[idx]) {
-		kfree_skb(priv->echo_skb[idx]);
+		dev_kfree_skb_any(priv->echo_skb[idx]);
 		priv->echo_skb[idx] = NULL;
 	}
 }
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 57/66] rt2x00: do not align payload on modern H/W
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (55 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 56/66] can: dev: avoid calling kfree_skb() from interrupt context Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 58/66] nfsd: correctly define v4.2 support attributes Jiri Slaby
                   ` (10 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Stanislaw Gruszka, John W. Linville, Jiri Slaby

From: Stanislaw Gruszka <sgruszka@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit cfd9167af14eb4ec21517a32911d460083ee3d59 upstream.

RT2800 and newer hardware require padding between header and payload if
header length is not multiple of 4.

For historical reasons we also align payload to to 4 bytes boundary, but
such alignment is not needed on modern H/W.

Patch fixes skb_under_panic problems reported from time to time:

https://bugzilla.kernel.org/show_bug.cgi?id=84911
https://bugzilla.kernel.org/show_bug.cgi?id=72471
http://marc.info/?l=linux-wireless&m=139108549530402&w=2
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1087591

Panic happened because we eat 4 bytes of skb headroom on each
(re)transmission when sending frame without the payload and the header
length not being multiple of 4 (i.e. QoS header has 26 bytes). On such
case because paylad_aling=2 is bigger than header_align=0 we increase
header_align by 4 bytes. To prevent that we could change the check to:

	if (payload_length && payload_align > header_align)
		header_align += 4;

but not aligning payload at all is more effective and alignment is not
really needed by H/W (that has been tested on OpenWrt project for few
years now).

Reported-and-tested-by: Antti S. Lankila <alankila@bel.fi>
Debugged-by: Antti S. Lankila <alankila@bel.fi>
Reported-by: Henrik Asp <solenskiner@gmail.com>
Originally-From: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/rt2x00/rt2x00queue.c | 50 ++++++++-----------------------
 1 file changed, 12 insertions(+), 38 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 66a2db8c260d..e6182170e791 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -160,55 +160,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb)
 	skb_trim(skb, frame_length);
 }
 
-void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
+/*
+ * H/W needs L2 padding between the header and the paylod if header size
+ * is not 4 bytes aligned.
+ */
+void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len)
 {
-	unsigned int payload_length = skb->len - header_length;
-	unsigned int header_align = ALIGN_SIZE(skb, 0);
-	unsigned int payload_align = ALIGN_SIZE(skb, header_length);
-	unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0;
+	unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
 
-	/*
-	 * Adjust the header alignment if the payload needs to be moved more
-	 * than the header.
-	 */
-	if (payload_align > header_align)
-		header_align += 4;
-
-	/* There is nothing to do if no alignment is needed */
-	if (!header_align)
+	if (!l2pad)
 		return;
 
-	/* Reserve the amount of space needed in front of the frame */
-	skb_push(skb, header_align);
-
-	/*
-	 * Move the header.
-	 */
-	memmove(skb->data, skb->data + header_align, header_length);
-
-	/* Move the payload, if present and if required */
-	if (payload_length && payload_align)
-		memmove(skb->data + header_length + l2pad,
-			skb->data + header_length + l2pad + payload_align,
-			payload_length);
-
-	/* Trim the skb to the correct size */
-	skb_trim(skb, header_length + l2pad + payload_length);
+	skb_push(skb, l2pad);
+	memmove(skb->data, skb->data + l2pad, hdr_len);
 }
 
-void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length)
+void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len)
 {
-	/*
-	 * L2 padding is only present if the skb contains more than just the
-	 * IEEE 802.11 header.
-	 */
-	unsigned int l2pad = (skb->len > header_length) ?
-				L2PAD_SIZE(header_length) : 0;
+	unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
 
 	if (!l2pad)
 		return;
 
-	memmove(skb->data + l2pad, skb->data, header_length);
+	memmove(skb->data + l2pad, skb->data, hdr_len);
 	skb_pull(skb, l2pad);
 }
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 58/66] nfsd: correctly define v4.2 support attributes
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (56 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 57/66] rt2x00: do not align payload on modern H/W Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 59/66] nfsd: Fix slot wake up race in the nfsv4.1 callback code Jiri Slaby
                   ` (9 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Christoph Hellwig, J. Bruce Fields, Jiri Slaby

From: Christoph Hellwig <hch@lst.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 6d0ba0432a5e10bc714ba9c5adc460e726e5fbb4 upstream.

Even when security labels are disabled we support at least the same
attributes as v4.1.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfsd/nfsd.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 479eb681c27c..f417fef17118 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -328,12 +328,15 @@ void		nfsd_lockd_shutdown(void);
 	(NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
 
 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
-#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
-	(NFSD4_1_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SECURITY_LABEL)
+#define NFSD4_2_SECURITY_ATTRS		FATTR4_WORD2_SECURITY_LABEL
 #else
-#define NFSD4_2_SUPPORTED_ATTRS_WORD2 0
+#define NFSD4_2_SECURITY_ATTRS		0
 #endif
 
+#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
+	(NFSD4_1_SUPPORTED_ATTRS_WORD2 | \
+	NFSD4_2_SECURITY_ATTRS)
+
 static inline u32 nfsd_suppattrs0(u32 minorversion)
 {
 	return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 59/66] nfsd: Fix slot wake up race in the nfsv4.1 callback code
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (57 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 58/66] nfsd: correctly define v4.2 support attributes Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 60/66] net/ping: handle protocol mismatching scenario Jiri Slaby
                   ` (8 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Trond Myklebust, J. Bruce Fields, Jiri Slaby

From: Trond Myklebust <trond.myklebust@primarydata.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit c6c15e1ed303ffc47e696ea1c9a9df1761c1f603 upstream.

The currect code for nfsd41_cb_get_slot() and nfsd4_cb_done() has no
locking in order to guarantee atomicity, and so allows for races of
the form.

Task 1                                  Task 2
======                                  ======
if (test_and_set_bit(0) != 0) {
                                        clear_bit(0)
                                        rpc_wake_up_next(queue)
        rpc_sleep_on(queue)
        return false;
}

This patch breaks the race condition by adding a retest of the bit
after the call to rpc_sleep_on().

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfsd/nfs4callback.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index cc8c5b32043c..f42bbe5fbc0a 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -784,8 +784,12 @@ static bool nfsd41_cb_get_slot(struct nfs4_client *clp, struct rpc_task *task)
 {
 	if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
 		rpc_sleep_on(&clp->cl_cb_waitq, task, NULL);
-		dprintk("%s slot is busy\n", __func__);
-		return false;
+		/* Race breaker */
+		if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
+			dprintk("%s slot is busy\n", __func__);
+			return false;
+		}
+		rpc_wake_up_queued_task(&clp->cl_cb_waitq, task);
 	}
 	return true;
 }
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 60/66] net/ping: handle protocol mismatching scenario
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (58 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 59/66] nfsd: Fix slot wake up race in the nfsv4.1 callback code Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 61/66] bnx2fc: do not add shared skbs to the fcoe_rx_list Jiri Slaby
                   ` (7 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jane Zhou, David S. Miller, Alexey Kuznetsov,
	James Morris, Hideaki YOSHIFUJI, Patrick McHardy, netdev,
	Yiwei Zhao, Jiri Slaby

From: Jane Zhou <a17711@motorola.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 91a0b603469069cdcce4d572b7525ffc9fd352a6 upstream.

ping_lookup() may return a wrong sock if sk_buff's and sock's protocols
dont' match. For example, sk_buff's protocol is ETH_P_IPV6, but sock's
sk_family is AF_INET, in that case, if sk->sk_bound_dev_if is zero, a wrong
sock will be returned.
the fix is to "continue" the searching, if no matching, return NULL.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Jane Zhou <a17711@motorola.com>
Signed-off-by: Yiwei Zhao <gbjc64@motorola.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/ping.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index c211607b79b3..8bd51f49aa96 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -214,6 +214,8 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident)
 					     &ipv6_hdr(skb)->daddr))
 				continue;
 #endif
+		} else {
+			continue;
 		}
 
 		if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 61/66] bnx2fc: do not add shared skbs to the fcoe_rx_list
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (59 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 60/66] net/ping: handle protocol mismatching scenario Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 62/66] drm/radeon: fix endian swapping in vbios fetch for tdp table Jiri Slaby
                   ` (6 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Maurizio Lombardi, Christoph Hellwig, Jiri Slaby

From: Maurizio Lombardi <mlombard@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 01a4cc4d0cd6a836c7b923760e8eb1cbb6a47258 upstream.

In some cases, the fcoe_rx_list may contains multiple instances
of the same skb (the so called "shared skbs").

the bnx2fc_l2_rcv thread is a loop that extracts a skb from the list,
modifies (and destroys) its content and then proceed to the next one.
The problem is that if the skb is shared, the remaining instances will
be corrupted.

The solution is to use skb_share_check() before adding the skb to the
fcoe_rx_list.

[ 6286.808725] ------------[ cut here ]------------
[ 6286.808729] WARNING: at include/scsi/fc_frame.h:173 bnx2fc_l2_rcv_thread+0x425/0x450 [bnx2fc]()
[ 6286.808748] Modules linked in: bnx2x(-) mdio dm_service_time bnx2fc cnic uio fcoe libfcoe 8021q garp stp mrp libfc llc scsi_transport_fc scsi_tgt sg iTCO_wdt iTCO_vendor_support coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul crc32c_intel e1000e ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper ptp cryptd hpilo serio_raw hpwdt lpc_ich pps_core ipmi_si pcspkr mfd_core ipmi_msghandler shpchp pcc_cpufreq mperf nfsd auth_rpcgss nfs_acl lockd sunrpc dm_multipath xfs libcrc32c ata_generic pata_acpi sd_mod crc_t10dif crct10dif_common mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit ata_piix drm_kms_helper ttm drm libata i2c_core hpsa dm_mirror dm_region_hash dm_log dm_mod [last unloaded: mdio]
[ 6286.808750] CPU: 3 PID: 1304 Comm: bnx2fc_l2_threa Not tainted 3.10.0-121.el7.x86_64 #1
[ 6286.808750] Hardware name: HP ProLiant DL120 G7, BIOS J01 07/01/2013
[ 6286.808752]  0000000000000000 000000000b36e715 ffff8800deba1e00 ffffffff815ec0ba
[ 6286.808753]  ffff8800deba1e38 ffffffff8105dee1 ffffffffa05618c0 ffff8801e4c81888
[ 6286.808754]  ffffe8ffff663868 ffff8801f402b180 ffff8801f56bc000 ffff8800deba1e48
[ 6286.808754] Call Trace:
[ 6286.808759]  [<ffffffff815ec0ba>] dump_stack+0x19/0x1b
[ 6286.808762]  [<ffffffff8105dee1>] warn_slowpath_common+0x61/0x80
[ 6286.808763]  [<ffffffff8105e00a>] warn_slowpath_null+0x1a/0x20
[ 6286.808765]  [<ffffffffa054f415>] bnx2fc_l2_rcv_thread+0x425/0x450 [bnx2fc]
[ 6286.808767]  [<ffffffffa054eff0>] ? bnx2fc_disable+0x90/0x90 [bnx2fc]
[ 6286.808769]  [<ffffffff81085aef>] kthread+0xcf/0xe0
[ 6286.808770]  [<ffffffff81085a20>] ? kthread_create_on_node+0x140/0x140
[ 6286.808772]  [<ffffffff815fc76c>] ret_from_fork+0x7c/0xb0
[ 6286.808773]  [<ffffffff81085a20>] ? kthread_create_on_node+0x140/0x140
[ 6286.808774] ---[ end trace c6cdb939184ccb4e ]---

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 69ac55495c1d..aad5535db782 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -411,6 +411,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
 	struct fc_frame_header *fh;
 	struct fcoe_rcv_info *fr;
 	struct fcoe_percpu_s *bg;
+	struct sk_buff *tmp_skb;
 	unsigned short oxid;
 
 	interface = container_of(ptype, struct bnx2fc_interface,
@@ -423,6 +424,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
 		goto err;
 	}
 
+	tmp_skb = skb_share_check(skb, GFP_ATOMIC);
+	if (!tmp_skb)
+		goto err;
+
+	skb = tmp_skb;
+
 	if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) {
 		printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n");
 		goto err;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 62/66] drm/radeon: fix endian swapping in vbios fetch for tdp table
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (60 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 61/66] bnx2fc: do not add shared skbs to the fcoe_rx_list Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 63/66] gpu/radeon: Set flag to indicate broken 64-bit MSI Jiri Slaby
                   ` (5 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Deucher, Jiri Slaby

From: Alex Deucher <alexander.deucher@amd.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 28731d5818ae25b92d1fb82fe0ac196e97102c1b upstream.

Value needs to be swapped on BE.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/r600_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index 2df683aab9e9..cc4258a853fd 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -1193,7 +1193,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev)
 					(mode_info->atom_context->bios + data_offset +
 					 le16_to_cpu(ext_hdr->usPowerTuneTableOffset));
 				rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit =
-					ppt->usMaximumPowerDeliveryLimit;
+					le16_to_cpu(ppt->usMaximumPowerDeliveryLimit);
 				pt = &ppt->power_tune_table;
 			} else {
 				ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *)
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 63/66] gpu/radeon: Set flag to indicate broken 64-bit MSI
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (61 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 62/66] drm/radeon: fix endian swapping in vbios fetch for tdp table Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 64/66] locks: eliminate BUG() call when there's an unexpected lock on file close Jiri Slaby
                   ` (4 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 91ed6fd2c383bb8f02d66e98b4a4d2f7207249dc upstream.

Some radeon ASICs don't support all 64 address bits of MSIs despite
advertising support for 64-bit MSIs in their configuration space.

This breaks on systems such as IBM POWER7/8, where 64-bit MSIs can
be assigned with some of the high address bits set.

This makes use of the newly introduced "no_64bit_msi" flag in structure
pci_dev to allow the MSI allocation code to fallback to 32-bit MSIs
on those adapters.

Adding Alex's review tag. Patch to the driver is identical to the
reviewed one, I dropped the arch/powerpc hunk rewrote the subject
and cset comment.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/radeon_irq_kms.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index cc9e8482cf30..a1a843058369 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -196,6 +196,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
 	if (rdev->flags & RADEON_IS_AGP)
 		return false;
 
+	/*
+	 * Older chips have a HW limitation, they can only generate 40 bits
+	 * of address for "64-bit" MSIs which breaks on some platforms, notably
+	 * IBM POWER servers, so we limit them
+	 */
+	if (rdev->family < CHIP_BONAIRE) {
+		dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n");
+		rdev->pdev->no_64bit_msi = 1;
+	}
+
 	/* force MSI on */
 	if (radeon_msi == 1)
 		return true;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 64/66] locks: eliminate BUG() call when there's an unexpected lock on file close
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (62 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 63/66] gpu/radeon: Set flag to indicate broken 64-bit MSI Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 65/66] powerpc/powernv: Honor the generic "no_64bit_msi" flag Jiri Slaby
                   ` (3 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jeff Layton, Markus Blank-Burian, Jiri Slaby

From: Jeff Layton <jlayton@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 8c3cac5e6a85f03602ffe09c44f14418699e31ec upstream.

A leftover lock on the list is surely a sign of a problem of some sort,
but it's not necessarily a reason to panic the box. Instead, just log a
warning with some info about the lock, and then delete it like we would
any other lock.

In the event that the filesystem declares a ->lock f_op, we may end up
leaking something, but that's generally preferable to an immediate
panic.

Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Markus Blank-Burian <burian@muenster.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/locks.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index ad95fbd20f8a..0d2b5febc627 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2199,16 +2199,28 @@ void locks_remove_flock(struct file *filp)
 
 	while ((fl = *before) != NULL) {
 		if (fl->fl_file == filp) {
-			if (IS_FLOCK(fl)) {
-				locks_delete_lock(before);
-				continue;
-			}
 			if (IS_LEASE(fl)) {
 				lease_modify(before, F_UNLCK);
 				continue;
 			}
-			/* What? */
-			BUG();
+
+			/*
+			 * There's a leftover lock on the list of a type that
+			 * we didn't expect to see. Most likely a classic
+			 * POSIX lock that ended up not getting released
+			 * properly, or that raced onto the list somehow. Log
+			 * some info about it and then just remove it from
+			 * the list.
+			 */
+			WARN(!IS_FLOCK(fl),
+				"leftover lock: dev=%u:%u ino=%lu type=%hhd flags=0x%x start=%lld end=%lld\n",
+				MAJOR(inode->i_sb->s_dev),
+				MINOR(inode->i_sb->s_dev), inode->i_ino,
+				fl->fl_type, fl->fl_flags,
+				fl->fl_start, fl->fl_end);
+
+			locks_delete_lock(before);
+			continue;
  		}
 		before = &fl->fl_next;
 	}
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 65/66] powerpc/powernv: Honor the generic "no_64bit_msi" flag
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (63 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 64/66] locks: eliminate BUG() call when there's an unexpected lock on file close Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-06 15:07 ` [PATCH 3.12 66/66] batman: fix a bogus warning from batadv_is_on_batman_iface() Jiri Slaby
                   ` (2 subsequent siblings)
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 360743814c4082515581aa23ab1d8e699e1fbe88 upstream.

Instead of the arch specific quirk which we are deprecating
and that drivers don't understand.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 3 +--
 arch/powerpc/platforms/powernv/pci.c      | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 930e1fe78214..f077513bed97 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -792,7 +792,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
 				  unsigned int is_64, struct msi_msg *msg)
 {
 	struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
-	struct pci_dn *pdn = pci_get_pdn(dev);
 	struct irq_data *idata;
 	struct irq_chip *ichip;
 	unsigned int xive_num = hwirq - phb->msi_base;
@@ -809,7 +808,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
 		return -ENXIO;
 
 	/* Force 32-bit MSI on some broken devices */
-	if (pdn && pdn->force_32bit_msi)
+	if (dev->no_64bit_msi)
 		is_64 = 0;
 
 	/* Assign XIVE to PE */
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index a28d3b5e6393..7dcf8628f626 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -1,3 +1,4 @@
+
 /*
  * Support PCI/PCIe on PowerNV platforms
  *
@@ -50,9 +51,8 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
 {
 	struct pci_controller *hose = pci_bus_to_host(pdev->bus);
 	struct pnv_phb *phb = hose->private_data;
-	struct pci_dn *pdn = pci_get_pdn(pdev);
 
-	if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
+	if (pdev->no_64bit_msi && !phb->msi32_support)
 		return -ENODEV;
 
 	return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 3.12 66/66] batman: fix a bogus warning from batadv_is_on_batman_iface()
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (64 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 65/66] powerpc/powernv: Honor the generic "no_64bit_msi" flag Jiri Slaby
@ 2014-12-06 15:07 ` Jiri Slaby
  2014-12-07  0:09 ` [PATCH 3.12 00/66] 3.12.35-stable review Guenter Roeck
  2014-12-08 17:04 ` Shuah Khan
  67 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-06 15:07 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Cong Wang, David S. Miller, Steffen Klassert,
	Antonio Quartulli, Marek Lindner, Cong Wang, Jiri Slaby

From: Cong Wang <cwang@twopensource.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit b6ed5498601df40489606dbc14a9c7011c16630b upstream.

batman tries to search dev->iflink to check if it's a batman interface,
but ->iflink could be 0, which is not a valid ifindex. It should just
avoid iflink == 0 case.

Reported-by: Jet Chen <jet.chen@intel.com>
Tested-by: Jet Chen <jet.chen@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Antonio Quartulli <antonio@open-mesh.com>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/batman-adv/hard-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index c478e6bcf89b..75f8c72a1f8f 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -83,7 +83,7 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
 		return true;
 
 	/* no more parents..stop recursion */
-	if (net_dev->iflink == net_dev->ifindex)
+	if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex)
 		return false;
 
 	/* recurse over the parent device */
-- 
2.1.3


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 3.12 00/66] 3.12.35-stable review
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (65 preceding siblings ...)
  2014-12-06 15:07 ` [PATCH 3.12 66/66] batman: fix a bogus warning from batadv_is_on_batman_iface() Jiri Slaby
@ 2014-12-07  0:09 ` Guenter Roeck
  2014-12-11  9:57   ` Jiri Slaby
  2014-12-08 17:04 ` Shuah Khan
  67 siblings, 1 reply; 71+ messages in thread
From: Guenter Roeck @ 2014-12-07  0:09 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: satoru.takeuchi, shuah.kh, linux-kernel

On 12/06/2014 07:07 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.35 release.
> There are 66 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed Dec 10 16:07:07 CET 2014.
> Anything received after that time might be too late.
>

Build results:
	total: 135 pass: 135 fail: 0
Qemu tests:
	total: 27 pass: 27 fail: 0

Details are available at http://server.roeck-us.net:8010/builders.

Guenter


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 3.12 00/66] 3.12.35-stable review
  2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
                   ` (66 preceding siblings ...)
  2014-12-07  0:09 ` [PATCH 3.12 00/66] 3.12.35-stable review Guenter Roeck
@ 2014-12-08 17:04 ` Shuah Khan
  67 siblings, 0 replies; 71+ messages in thread
From: Shuah Khan @ 2014-12-08 17:04 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, satoru.takeuchi, shuah.kh, linux-kernel

On 12/06/2014 08:07 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.35 release.
> There are 66 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed Dec 10 16:07:07 CET 2014.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.35-rc1.xz
> and the diffstat can be found below.
> 
> thanks,
> js
> 

Compiled and booted on my test system. No dmesg regressions.

-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Open Source Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 3.12 00/66] 3.12.35-stable review
  2014-12-07  0:09 ` [PATCH 3.12 00/66] 3.12.35-stable review Guenter Roeck
@ 2014-12-11  9:57   ` Jiri Slaby
  0 siblings, 0 replies; 71+ messages in thread
From: Jiri Slaby @ 2014-12-11  9:57 UTC (permalink / raw)
  To: Guenter Roeck, stable, shuah.kh; +Cc: satoru.takeuchi, linux-kernel

On 12/07/2014, 01:09 AM, Guenter Roeck wrote:
> On 12/06/2014 07:07 AM, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.35 release.
>> There are 66 patches in this series, all will be posted as a response
>> to this one.  If anyone has any issues with these being applied, please
>> let me know.
>>
>> Responses should be made by Wed Dec 10 16:07:07 CET 2014.
>> Anything received after that time might be too late.
>>
> 
> Build results:
>     total: 135 pass: 135 fail: 0
> Qemu tests:
>     total: 27 pass: 27 fail: 0
> 
> Details are available at http://server.roeck-us.net:8010/builders.


On 12/08/2014, 06:04 PM, Shuah Khan wrote:
> Compiled and booted on my test system. No dmesg regressions.

Thank you both!

-- 
js
suse labs

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS
  2014-12-06 15:07 ` [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS Jiri Slaby
@ 2014-12-17 15:56   ` Borislav Petkov
  0 siblings, 0 replies; 71+ messages in thread
From: Borislav Petkov @ 2014-12-17 15:56 UTC (permalink / raw)
  To: Jiri Slaby, Andy Lutomirski; +Cc: stable, linux-kernel, Linus Torvalds

On Sat, Dec 06, 2014 at 04:07:06PM +0100, Jiri Slaby wrote:
> From: Andy Lutomirski <luto@amacapital.net>
> 
> 3.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ===============
> 
> commit 6f442be2fb22be02cafa606f1769fa1e6f894441 upstream.
> 
> On a 32-bit kernel, this has no effect, since there are no IST stacks.
> 
> On a 64-bit kernel, #SS can only happen in user code, on a failed iret
> to user space, a canonical violation on access via RSP or RBP, or a
> genuine stack segment violation in 32-bit kernel code.  The first two
> cases don't need IST, and the latter two cases are unlikely fatal bugs,
> and promoting them to double faults would be fine.
> 
> This fixes a bug in which the espfix64 code mishandles a stack segment
> violation.
> 
> This saves 4k of memory per CPU and a tiny bit of code.
> 
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  arch/x86/include/asm/page_32_types.h |  1 -
>  arch/x86/include/asm/page_64_types.h | 11 +++++------
>  arch/x86/kernel/dumpstack_64.c       |  1 -
>  arch/x86/kernel/entry_64.S           |  2 +-
>  arch/x86/kernel/traps.c              | 18 +-----------------
>  5 files changed, 7 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
> index f48b17df4224..3a52ee0e726d 100644
> --- a/arch/x86/include/asm/page_32_types.h
> +++ b/arch/x86/include/asm/page_32_types.h
> @@ -20,7 +20,6 @@
>  #define THREAD_SIZE_ORDER	1
>  #define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
>  
> -#define STACKFAULT_STACK 0
>  #define DOUBLEFAULT_STACK 1
>  #define NMI_STACK 0
>  #define DEBUG_STACK 0
> diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
> index 43dcd804ebd5..d1d2972a54db 100644
> --- a/arch/x86/include/asm/page_64_types.h
> +++ b/arch/x86/include/asm/page_64_types.h
> @@ -14,12 +14,11 @@
>  #define IRQ_STACK_ORDER 2
>  #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
>  
> -#define STACKFAULT_STACK 1
> -#define DOUBLEFAULT_STACK 2
> -#define NMI_STACK 3
> -#define DEBUG_STACK 4
> -#define MCE_STACK 5
> -#define N_EXCEPTION_STACKS 5  /* hw limit: 7 */
> +#define DOUBLEFAULT_STACK 1
> +#define NMI_STACK 2
> +#define DEBUG_STACK 3
> +#define MCE_STACK 4
> +#define N_EXCEPTION_STACKS 4  /* hw limit: 7 */
>  
>  #define PUD_PAGE_SIZE		(_AC(1, UL) << PUD_SHIFT)
>  #define PUD_PAGE_MASK		(~(PUD_PAGE_SIZE-1))
> diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
> index addb207dab92..66e274a3d968 100644
> --- a/arch/x86/kernel/dumpstack_64.c
> +++ b/arch/x86/kernel/dumpstack_64.c
> @@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
>  		[ DEBUG_STACK-1			]	= "#DB",
>  		[ NMI_STACK-1			]	= "NMI",
>  		[ DOUBLEFAULT_STACK-1		]	= "#DF",
> -		[ STACKFAULT_STACK-1		]	= "#SS",
>  		[ MCE_STACK-1			]	= "#MC",
>  #if DEBUG_STKSZ > EXCEPTION_STKSZ
>  		[ N_EXCEPTION_STACKS ...
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index c2ab43484b5d..e310e82de5e6 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -1510,7 +1510,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
>  
>  paranoidzeroentry_ist debug do_debug DEBUG_STACK
>  paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
> -paranoiderrorentry stack_segment do_stack_segment
> +errorentry stack_segment do_stack_segment
>  #ifdef CONFIG_XEN
>  zeroentry xen_debug do_debug
>  zeroentry xen_int3 do_int3
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 8a2684f938b9..b2d6c58b28b0 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -221,28 +221,12 @@ DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",
>  		coprocessor_segment_overrun)
>  DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
>  DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present)
> -#ifdef CONFIG_X86_32
>  DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment)
> -#endif
>  DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check,
>  		BUS_ADRALN, 0)
>  
>  #ifdef CONFIG_X86_64
>  /* Runs on IST stack */
> -dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
> -{
> -	enum ctx_state prev_state;
> -
> -	prev_state = exception_enter();
> -	if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
> -		       X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
> -		preempt_conditional_sti(regs);
> -		do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL);
> -		preempt_conditional_cli(regs);
> -	}
> -	exception_exit(prev_state);
> -}
> -
>  dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
>  {
>  	static const char str[] = "double fault";
> @@ -776,7 +760,7 @@ void __init trap_init(void)
>  	set_intr_gate(X86_TRAP_OLD_MF, &coprocessor_segment_overrun);
>  	set_intr_gate(X86_TRAP_TS, &invalid_TSS);
>  	set_intr_gate(X86_TRAP_NP, &segment_not_present);
> -	set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK);
> +	set_intr_gate(X86_TRAP_SS, stack_segment);

I guess this should say "&stack_segment" in order for it to be
consistent with the rest of the set_intr_gate() calls here.

Fortunately, this is not an issue as function designators are
automatically promoted to function pointers, as the identical asm shows:

         .loc 1 792 0
         movq    $stack_segment, %rsi    #,
         movl    $12, %edi       #,
         call    set_intr_gate   #

         .loc 1 792 0
         movq    $stack_segment, %rsi    #,
         movl    $12, %edi       #,
         call    set_intr_gate   #

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2014-12-17 15:56 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 01/66] Input: serio - add firmware_id sysfs attribute Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 02/66] Input: i8042 - add firmware_id support Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 03/66] Input: Add INPUT_PROP_TOPBUTTONPAD device property Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 04/66] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 05/66] Input: synaptics - add a matches_pnp_id helper function Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 06/66] Input: synaptics - change min/max quirk table to pnp-id matching Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 07/66] Input: synaptics - fix resolution for manually provided min/max Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 08/66] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 09/66] Input: synaptics - add min/max quirk for Lenovo T440s Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 10/66] PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs() fails Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 11/66] MIPS: oprofile: Fix backtrace on 64-bit kernel Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 12/66] MIPS: Loongson: Make platform serial setup always built-in Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 13/66] x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS Jiri Slaby
2014-12-17 15:56   ` Borislav Petkov
2014-12-06 15:07 ` [PATCH 3.12 15/66] x86_64, traps: Rework bad_iret Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 16/66] x86: Require exact match for 'noxsave' command line option Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 17/66] x86, mm: Set NX across entire PMD at boot Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 18/66] uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 19/66] PCI/MSI: Add device flag indicating that 64-bit MSIs don't work Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 20/66] clockevent: sun4i: Fix race condition in the probe code Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 21/66] IB/isert: Adjust CQ size to HW limits Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 22/66] ib_isert: Add max_send_sge=2 minimum for control PDU responses Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 23/66] ASoC: rsnd: remove unsupported PAUSE flag Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 24/66] ASoC: fsi: " Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 25/66] ASoC: sgtl5000: Fix SMALL_POP bit definition Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 26/66] ASoC: wm_adsp: Avoid attempt to free buffers that might still be in use Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 27/66] ASoC: dpcm: Fix race between FE/BE updates and trigger Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 28/66] ath9k: Fix RTC_DERIVED_CLK usage Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 29/66] of/base: Fix PowerPC address parsing hack Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 30/66] powerpc/pseries: Honor the generic "no_64bit_msi" flag Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 31/66] powerpc/pseries: Fix endiannes issue in RTAS call from xmon Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 32/66] iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 33/66] staging: r8188eu: Add new device ID for DLink GO-USB-N150 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 34/66] USB: ssu100: fix overrun-error reporting Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 35/66] USB: keyspan: " Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 36/66] USB: keyspan: fix tty line-status reporting Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 37/66] USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 38/66] usb: serial: ftdi_sio: add PIDs for Matrix Orbital products Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 39/66] usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 40/66] USB: xhci: don't start a halted endpoint before its new dequeue is set Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 41/66] usb: xhci: rework root port wake bits if controller isn't allowed to wakeup Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 42/66] can: esd_usb2: fix memory leak on disconnect Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 43/66] ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 44/66] aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 45/66] ARM: 8216/1: xscale: correct auxiliary register in suspend/resume Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 46/66] ARM: 8222/1: mvebu: enable strex backoff delay Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 47/66] ARM: 8226/1: cacheflush: get rid of restarting block Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 48/66] Input: synaptics - adjust min/max on Thinkpad E540 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 49/66] Input: xpad - use proper endpoint type Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 50/66] srp-target: Retry when QP creation fails with ENOMEM Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 51/66] target: Don't call TFO->write_pending if data_length == 0 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 52/66] iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 53/66] spi: dw: Fix dynamic speed change Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 54/66] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 55/66] scsi: add Intel Multi-Flex to scsi scan blacklist Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 56/66] can: dev: avoid calling kfree_skb() from interrupt context Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 57/66] rt2x00: do not align payload on modern H/W Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 58/66] nfsd: correctly define v4.2 support attributes Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 59/66] nfsd: Fix slot wake up race in the nfsv4.1 callback code Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 60/66] net/ping: handle protocol mismatching scenario Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 61/66] bnx2fc: do not add shared skbs to the fcoe_rx_list Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 62/66] drm/radeon: fix endian swapping in vbios fetch for tdp table Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 63/66] gpu/radeon: Set flag to indicate broken 64-bit MSI Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 64/66] locks: eliminate BUG() call when there's an unexpected lock on file close Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 65/66] powerpc/powernv: Honor the generic "no_64bit_msi" flag Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 66/66] batman: fix a bogus warning from batadv_is_on_batman_iface() Jiri Slaby
2014-12-07  0:09 ` [PATCH 3.12 00/66] 3.12.35-stable review Guenter Roeck
2014-12-11  9:57   ` Jiri Slaby
2014-12-08 17:04 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).