--- /dev/null
+From b0cf4dfb7cd21556efd9a6a67edcba0840b4d98d Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Wed, 7 Apr 2010 20:55:47 -0700
+Subject: 3c503: Fix IRQ probing
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit b0cf4dfb7cd21556efd9a6a67edcba0840b4d98d upstream.
+
+The driver attempts to select an IRQ for the NIC automatically by
+testing which of the supported IRQs are available and then probing
+each available IRQ with probe_irq_{on,off}(). There are obvious race
+conditions here, besides which:
+1. The test for availability is done by passing a NULL handler, which
+ now always returns -EINVAL, thus the device cannot be opened:
+ <http://bugs.debian.org/566522>
+2. probe_irq_off() will report only the first ISA IRQ handled,
+ potentially leading to a false negative.
+
+There was another bug that meant it ignored all error codes from
+request_irq() except -EBUSY, so it would 'succeed' despite this
+(possibly causing conflicts with other ISA devices). This was fixed
+by ab08999d6029bb2c79c16be5405d63d2bedbdfea 'WARNING: some
+request_irq() failures ignored in el2_open()', which exposed bug 1.
+
+This patch:
+1. Replaces the use of probe_irq_{on,off}() with a real interrupt handler
+2. Adds a delay before checking the interrupt-seen flag
+3. Disables interrupts on all failure paths
+4. Distinguishes error codes from the second request_irq() call,
+ consistently with the first
+
+Compile-tested only.
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/3c503.c | 41 ++++++++++++++++++++++++++++++-----------
+ 1 file changed, 30 insertions(+), 11 deletions(-)
+
+--- a/drivers/net/3c503.c
++++ b/drivers/net/3c503.c
+@@ -380,6 +380,12 @@ out:
+ return retval;
+ }
+
++static irqreturn_t el2_probe_interrupt(int irq, void *seen)
++{
++ *(bool *)seen = true;
++ return IRQ_HANDLED;
++}
++
+ static int
+ el2_open(struct net_device *dev)
+ {
+@@ -391,22 +397,35 @@ el2_open(struct net_device *dev)
+
+ outb(EGACFR_NORM, E33G_GACFR); /* Enable RAM and interrupts. */
+ do {
+- retval = request_irq(*irqp, NULL, 0, "bogus", dev);
+- if (retval >= 0) {
++ bool seen;
++
++ retval = request_irq(*irqp, el2_probe_interrupt, 0,
++ dev->name, &seen);
++ if (retval == -EBUSY)
++ continue;
++ if (retval < 0)
++ goto err_disable;
++
+ /* Twinkle the interrupt, and check if it's seen. */
+- unsigned long cookie = probe_irq_on();
++ seen = false;
++ smp_wmb();
+ outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR);
+ outb_p(0x00, E33G_IDCFR);
+- if (*irqp == probe_irq_off(cookie) /* It's a good IRQ line! */
+- && ((retval = request_irq(dev->irq = *irqp,
+- eip_interrupt, 0, dev->name, dev)) == 0))
+- break;
+- } else {
+- if (retval != -EBUSY)
+- return retval;
+- }
++ msleep(1);
++ free_irq(*irqp, el2_probe_interrupt);
++ if (!seen)
++ continue;
++
++ retval = request_irq(dev->irq = *irqp, eip_interrupt, 0,
++ dev->name, dev);
++ if (retval == -EBUSY)
++ continue;
++ if (retval < 0)
++ goto err_disable;
+ } while (*++irqp);
++
+ if (*irqp == 0) {
++ err_disable:
+ outb(EGACFR_IRQOFF, E33G_GACFR); /* disable interrupts. */
+ return -EAGAIN;
+ }
--- /dev/null
+From 7f29a3baa825725d29db399663790d15c78cddcf Mon Sep 17 00:00:00 2001
+From: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
+Date: Tue, 9 Mar 2010 12:24:38 +0000
+Subject: asix: fix setting mac address for AX88772
+
+From: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
+
+commit 7f29a3baa825725d29db399663790d15c78cddcf upstream.
+
+Setting new MAC address only worked when device was set to promiscuous mode.
+Fix MAC address by writing new address to device using undocumented command
+AX_CMD_READ_NODE_ID+1. Patch is tested with AX88772 device.
+
+Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
+Acked-by: David Hollis <dhollis@davehollis.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/usb/asix.c | 30 ++++++++++++++++++++++++++++--
+ 1 file changed, 28 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/usb/asix.c
++++ b/drivers/net/usb/asix.c
+@@ -54,6 +54,7 @@ static const char driver_name [] = "asix
+ #define AX_CMD_WRITE_IPG0 0x12
+ #define AX_CMD_WRITE_IPG1 0x13
+ #define AX_CMD_READ_NODE_ID 0x13
++#define AX_CMD_WRITE_NODE_ID 0x14
+ #define AX_CMD_WRITE_IPG2 0x14
+ #define AX_CMD_WRITE_MULTI_FILTER 0x16
+ #define AX88172_CMD_READ_NODE_ID 0x17
+@@ -165,6 +166,7 @@ static const char driver_name [] = "asix
+ /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
+ struct asix_data {
+ u8 multi_filter[AX_MCAST_FILTER_SIZE];
++ u8 mac_addr[ETH_ALEN];
+ u8 phymode;
+ u8 ledmode;
+ u8 eeprom_len;
+@@ -728,6 +730,30 @@ static int asix_ioctl (struct net_device
+ return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
+ }
+
++static int asix_set_mac_address(struct net_device *net, void *p)
++{
++ struct usbnet *dev = netdev_priv(net);
++ struct asix_data *data = (struct asix_data *)&dev->data;
++ struct sockaddr *addr = p;
++
++ if (netif_running(net))
++ return -EBUSY;
++ if (!is_valid_ether_addr(addr->sa_data))
++ return -EADDRNOTAVAIL;
++
++ memcpy(net->dev_addr, addr->sa_data, ETH_ALEN);
++
++ /* We use the 20 byte dev->data
++ * for our 6 byte mac buffer
++ * to avoid allocating memory that
++ * is tricky to free later */
++ memcpy(data->mac_addr, addr->sa_data, ETH_ALEN);
++ asix_write_cmd_async(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
++ data->mac_addr);
++
++ return 0;
++}
++
+ /* We need to override some ethtool_ops so we require our
+ own structure so we don't interfere with other usbnet
+ devices that may be connected at the same time. */
+@@ -915,7 +941,7 @@ static const struct net_device_ops ax887
+ .ndo_start_xmit = usbnet_start_xmit,
+ .ndo_tx_timeout = usbnet_tx_timeout,
+ .ndo_change_mtu = usbnet_change_mtu,
+- .ndo_set_mac_address = eth_mac_addr,
++ .ndo_set_mac_address = asix_set_mac_address,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_do_ioctl = asix_ioctl,
+ .ndo_set_multicast_list = asix_set_multicast,
+@@ -1208,7 +1234,7 @@ static const struct net_device_ops ax881
+ .ndo_stop = usbnet_stop,
+ .ndo_start_xmit = usbnet_start_xmit,
+ .ndo_tx_timeout = usbnet_tx_timeout,
+- .ndo_set_mac_address = eth_mac_addr,
++ .ndo_set_mac_address = asix_set_mac_address,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_multicast_list = asix_set_multicast,
+ .ndo_do_ioctl = asix_ioctl,
--- /dev/null
+From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
+Date: Mon, 19 Jul 2010 09:22:35 +0200
+Subject: [S390] dasd: use correct label location for diag fba disks
+
+From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
+
+commit cffab6bc5511cd6f67a60bf16b62de4267b68c4c upstream.
+
+Partition boundary calculation fails for DASD FBA disks under the
+following conditions:
+- disk is formatted with CMS FORMAT with a blocksize of more than
+ 512 bytes
+- all of the disk is reserved to a single CMS file using CMS RESERVE
+- the disk is accessed using the DIAG mode of the DASD driver
+
+Under these circumstances, the partition detection code tries to
+read the CMS label block containing partition-relevant information
+from logical block offset 1, while it is in fact located at physical
+block offset 1.
+
+Fix this problem by using the correct CMS label block location
+depending on the device type as determined by the DASD SENSE ID
+information.
+
+Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+[bwh: Adjust for 2.6.32]
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/partitions/ibm.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+--- a/fs/partitions/ibm.c
++++ b/fs/partitions/ibm.c
+@@ -74,6 +74,7 @@ ibm_partition(struct parsed_partitions *
+ } *label;
+ unsigned char *data;
+ Sector sect;
++ sector_t labelsect;
+
+ res = 0;
+ blocksize = bdev_logical_block_size(bdev);
+@@ -98,9 +99,19 @@ ibm_partition(struct parsed_partitions *
+ goto out_freeall;
+
+ /*
++ * Special case for FBA disks: label sector does not depend on
++ * blocksize.
++ */
++ if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) ||
++ (info->cu_type == 0x3880 && info->dev_type == 0x3370))
++ labelsect = info->label_block;
++ else
++ labelsect = info->label_block * (blocksize >> 9);
++
++ /*
+ * Get volume label, extract name and type.
+ */
+- data = read_dev_sector(bdev, info->label_block*(blocksize/512), §);
++ data = read_dev_sector(bdev, labelsect, §);
+ if (data == NULL)
+ goto out_readerr;
+
--- /dev/null
+From: Aurelien Jarno <aurelien@aurel32.net>
+Date: Mon, 31 May 2010 21:45:48 +0000
+Subject: [PATCH] clocksource: sh_tmu: compute mult and shift before registration
+
+From: Aurelien Jarno <aurelien@aurel32.net>
+
+commit 66f49121ffa41a19c59965b31b046d8368fec3c7 upstream.
+
+Since commit 98962465ed9e6ea99c38e0af63fe1dcb5a79dc25 ("nohz: Prevent
+clocksource wrapping during idle"), the CPU of an R2D board never goes
+to idle. This commit assumes that mult and shift are assigned before
+the clocksource is registered. As a consequence the safe maximum sleep
+time is negative and the CPU never goes into idle.
+
+This patch fixes the problem by moving mult and shift initialization
+from sh_tmu_clocksource_enable() to sh_tmu_register_clocksource().
+
+Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/clocksource/sh_tmu.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+--- a/drivers/clocksource/sh_tmu.c
++++ b/drivers/clocksource/sh_tmu.c
+@@ -199,16 +199,8 @@ static cycle_t sh_tmu_clocksource_read(s
+ static int sh_tmu_clocksource_enable(struct clocksource *cs)
+ {
+ struct sh_tmu_priv *p = cs_to_sh_tmu(cs);
+- int ret;
+
+- ret = sh_tmu_enable(p);
+- if (ret)
+- return ret;
+-
+- /* TODO: calculate good shift from rate and counter bit width */
+- cs->shift = 10;
+- cs->mult = clocksource_hz2mult(p->rate, cs->shift);
+- return 0;
++ return sh_tmu_enable(p);
+ }
+
+ static void sh_tmu_clocksource_disable(struct clocksource *cs)
+@@ -228,6 +220,16 @@ static int sh_tmu_register_clocksource(s
+ cs->disable = sh_tmu_clocksource_disable;
+ cs->mask = CLOCKSOURCE_MASK(32);
+ cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
++
++ /* clk_get_rate() needs an enabled clock */
++ clk_enable(p->clk);
++ /* channel will be configured at parent clock / 4 */
++ p->rate = clk_get_rate(p->clk) / 4;
++ clk_disable(p->clk);
++ /* TODO: calculate good shift from rate and counter bit width */
++ cs->shift = 10;
++ cs->mult = clocksource_hz2mult(p->rate, cs->shift);
++
+ pr_info("sh_tmu: %s used as clock source\n", cs->name);
+ clocksource_register(cs);
+ return 0;
--- /dev/null
+From 622e0ca1cd4d459f5af4f2c65f4dc0dd823cb4c3 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert@gondor.apana.org.au>
+Date: Thu, 20 May 2010 23:07:56 -0700
+Subject: gro: Fix bogus gso_size on the first fraglist entry
+
+From: Herbert Xu <herbert@gondor.apana.org.au>
+
+commit 622e0ca1cd4d459f5af4f2c65f4dc0dd823cb4c3 upstream.
+
+When GRO produces fraglist entries, and the resulting skb hits
+an interface that is incapable of TSO but capable of FRAGLIST,
+we end up producing a bogus packet with gso_size non-zero.
+
+This was reported in the field with older versions of KVM that
+did not set the TSO bits on tuntap.
+
+This patch fixes that.
+
+Reported-by: Igor Zhang <yugzhang@redhat.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ net/core/skbuff.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -2730,6 +2730,7 @@ int skb_gro_receive(struct sk_buff **hea
+ *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p);
+ skb_shinfo(nskb)->frag_list = p;
+ skb_shinfo(nskb)->gso_size = pinfo->gso_size;
++ pinfo->gso_size = 0;
+ skb_header_release(p);
+ nskb->prev = p;
+
--- /dev/null
+From 0f4da2d77e1bf424ac36424081afc22cbfc3ff2b Mon Sep 17 00:00:00 2001
+From: John W. Linville <linville@tuxdriver.com>
+Date: Tue, 13 Jul 2010 14:06:32 -0400
+Subject: hostap_pci: set dev->base_addr during probe
+
+From: John W. Linville <linville@tuxdriver.com>
+
+commit 0f4da2d77e1bf424ac36424081afc22cbfc3ff2b upstream.
+
+"hostap: Protect against initialization interrupt" (which reinstated
+"wireless: hostap, fix oops due to early probing interrupt")
+reintroduced Bug 16111. This is because hostap_pci wasn't setting
+dev->base_addr, which is now checked in prism2_interrupt. As a result,
+initialization was failing for PCI-based hostap devices. This corrects
+that oversight.
+
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/wireless/hostap/hostap_pci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/wireless/hostap/hostap_pci.c
++++ b/drivers/net/wireless/hostap/hostap_pci.c
+@@ -329,6 +329,7 @@ static int prism2_pci_probe(struct pci_d
+
+ dev->irq = pdev->irq;
+ hw_priv->mem_start = mem;
++ dev->base_addr = (unsigned long) mem;
+
+ prism2_pci_cor_sreset(local);
+
--- /dev/null
+From: Eric Paris <eparis@redhat.com>
+Date: Wed, 28 Jul 2010 10:18:37 -0400
+Subject: [PATCH] inotify: fix inotify oneshot support
+
+commit ff311008ab8d2f2cfdbbefd407d1b05acc8164b2 upstream.
+
+During the large inotify rewrite to fsnotify I completely dropped support
+for IN_ONESHOT. Reimplement that support.
+
+Signed-off-by: Eric Paris <eparis@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ fs/notify/inotify/inotify_fsnotify.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/fs/notify/inotify/inotify_fsnotify.c
++++ b/fs/notify/inotify/inotify_fsnotify.c
+@@ -72,6 +72,9 @@ static int inotify_handle_event(struct f
+ ret = 0;
+ }
+
++ if (entry->mask & IN_ONESHOT)
++ fsnotify_destroy_mark_by_entry(entry);
++
+ /*
+ * If we hold the entry until after the event is on the queue
+ * IN_IGNORED won't be able to pass this event in the queue
--- /dev/null
+From 15e184afa83a45cf8bafdb9dc906b97a8fbc974f Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Mon, 11 Jan 2010 00:05:43 -0800
+Subject: Input: add compat support for sysfs and /proc capabilities output
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 15e184afa83a45cf8bafdb9dc906b97a8fbc974f upstream.
+
+Input core displays capabilities bitmasks in form of one or more longs printed
+in hex form and separated by spaces. Unfortunately it does not work well
+for 32-bit applications running on 64-bit kernels since applications expect
+that number is "worth" only 32 bits when kernel advances by 64 bits.
+
+Fix that by ensuring that output produced for compat tasks uses 32-bit units.
+
+Reported-and-tested-by: Michael Tokarev <mjt@tls.msk.ru>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/input/input.c | 84 +++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 70 insertions(+), 14 deletions(-)
+
+--- a/drivers/input/input.c
++++ b/drivers/input/input.c
+@@ -24,6 +24,7 @@
+ #include <linux/mutex.h>
+ #include <linux/rcupdate.h>
+ #include <linux/smp_lock.h>
++#include "input-compat.h"
+
+ MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+ MODULE_DESCRIPTION("Input core");
+@@ -758,6 +759,40 @@ static int input_attach_handler(struct i
+ return error;
+ }
+
++#ifdef CONFIG_COMPAT
++
++static int input_bits_to_string(char *buf, int buf_size,
++ unsigned long bits, bool skip_empty)
++{
++ int len = 0;
++
++ if (INPUT_COMPAT_TEST) {
++ u32 dword = bits >> 32;
++ if (dword || !skip_empty)
++ len += snprintf(buf, buf_size, "%x ", dword);
++
++ dword = bits & 0xffffffffUL;
++ if (dword || !skip_empty || len)
++ len += snprintf(buf + len, max(buf_size - len, 0),
++ "%x", dword);
++ } else {
++ if (bits || !skip_empty)
++ len += snprintf(buf, buf_size, "%lx", bits);
++ }
++
++ return len;
++}
++
++#else /* !CONFIG_COMPAT */
++
++static int input_bits_to_string(char *buf, int buf_size,
++ unsigned long bits, bool skip_empty)
++{
++ return bits || !skip_empty ?
++ snprintf(buf, buf_size, "%lx", bits) : 0;
++}
++
++#endif
+
+ #ifdef CONFIG_PROC_FS
+
+@@ -826,14 +861,25 @@ static void input_seq_print_bitmap(struc
+ unsigned long *bitmap, int max)
+ {
+ int i;
+-
+- for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
+- if (bitmap[i])
+- break;
++ bool skip_empty = true;
++ char buf[18];
+
+ seq_printf(seq, "B: %s=", name);
+- for (; i >= 0; i--)
+- seq_printf(seq, "%lx%s", bitmap[i], i > 0 ? " " : "");
++
++ for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
++ if (input_bits_to_string(buf, sizeof(buf),
++ bitmap[i], skip_empty)) {
++ skip_empty = false;
++ seq_printf(seq, "%s%s", buf, i > 0 ? " " : "");
++ }
++ }
++
++ /*
++ * If no output was produced print a single 0.
++ */
++ if (skip_empty)
++ seq_puts(seq, "0");
++
+ seq_putc(seq, '\n');
+ }
+
+@@ -1122,14 +1168,23 @@ static int input_print_bitmap(char *buf,
+ {
+ int i;
+ int len = 0;
++ bool skip_empty = true;
+
+- for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
+- if (bitmap[i])
+- break;
++ for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
++ len += input_bits_to_string(buf + len, max(buf_size - len, 0),
++ bitmap[i], skip_empty);
++ if (len) {
++ skip_empty = false;
++ if (i > 0)
++ len += snprintf(buf + len, max(buf_size - len, 0), " ");
++ }
++ }
+
+- for (; i >= 0; i--)
+- len += snprintf(buf + len, max(buf_size - len, 0),
+- "%lx%s", bitmap[i], i > 0 ? " " : "");
++ /*
++ * If no output was produced print a single 0.
++ */
++ if (len == 0)
++ len = snprintf(buf, buf_size, "%d", 0);
+
+ if (add_cr)
+ len += snprintf(buf + len, max(buf_size - len, 0), "\n");
+@@ -1144,7 +1199,8 @@ static ssize_t input_dev_show_cap_##bm(s
+ { \
+ struct input_dev *input_dev = to_input_dev(dev); \
+ int len = input_print_bitmap(buf, PAGE_SIZE, \
+- input_dev->bm##bit, ev##_MAX, 1); \
++ input_dev->bm##bit, ev##_MAX, \
++ true); \
+ return min_t(int, len, PAGE_SIZE); \
+ } \
+ static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL)
+@@ -1208,7 +1264,7 @@ static int input_add_uevent_bm_var(struc
+
+ len = input_print_bitmap(&env->buf[env->buflen - 1],
+ sizeof(env->buf) - env->buflen,
+- bitmap, max, 0);
++ bitmap, max, false);
+ if (len >= (sizeof(env->buf) - env->buflen))
+ return -ENOMEM;
+
--- /dev/null
+From f2a68272d799bf4092443357142f63b74f7669a1 Mon Sep 17 00:00:00 2001
+From: David Daney <ddaney@caviumnetworks.com>
+Date: Thu, 22 Jul 2010 11:59:27 -0700
+Subject: MIPS: Quit using undefined behavior of ADDU in 64-bit atomic operations.
+
+From: David Daney <ddaney@caviumnetworks.com>
+
+commit f2a68272d799bf4092443357142f63b74f7669a1 upstream.
+
+For 64-bit, we must use DADDU and DSUBU.
+
+Signed-off-by: David Daney <ddaney@caviumnetworks.com>
+To: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/1483/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/mips/include/asm/atomic.h | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+--- a/arch/mips/include/asm/atomic.h
++++ b/arch/mips/include/asm/atomic.h
+@@ -434,7 +434,7 @@ static __inline__ void atomic64_add(long
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %0, %1 # atomic64_add \n"
+- " addu %0, %2 \n"
++ " daddu %0, %2 \n"
+ " scd %0, %1 \n"
+ " beqzl %0, 1b \n"
+ " .set mips0 \n"
+@@ -446,7 +446,7 @@ static __inline__ void atomic64_add(long
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %0, %1 # atomic64_add \n"
+- " addu %0, %2 \n"
++ " daddu %0, %2 \n"
+ " scd %0, %1 \n"
+ " beqz %0, 2f \n"
+ " .subsection 2 \n"
+@@ -479,7 +479,7 @@ static __inline__ void atomic64_sub(long
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %0, %1 # atomic64_sub \n"
+- " subu %0, %2 \n"
++ " dsubu %0, %2 \n"
+ " scd %0, %1 \n"
+ " beqzl %0, 1b \n"
+ " .set mips0 \n"
+@@ -491,7 +491,7 @@ static __inline__ void atomic64_sub(long
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %0, %1 # atomic64_sub \n"
+- " subu %0, %2 \n"
++ " dsubu %0, %2 \n"
+ " scd %0, %1 \n"
+ " beqz %0, 2f \n"
+ " .subsection 2 \n"
+@@ -524,10 +524,10 @@ static __inline__ long atomic64_add_retu
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %1, %2 # atomic64_add_return \n"
+- " addu %0, %1, %3 \n"
++ " daddu %0, %1, %3 \n"
+ " scd %0, %2 \n"
+ " beqzl %0, 1b \n"
+- " addu %0, %1, %3 \n"
++ " daddu %0, %1, %3 \n"
+ " .set mips0 \n"
+ : "=&r" (result), "=&r" (temp), "=m" (v->counter)
+ : "Ir" (i), "m" (v->counter)
+@@ -538,10 +538,10 @@ static __inline__ long atomic64_add_retu
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %1, %2 # atomic64_add_return \n"
+- " addu %0, %1, %3 \n"
++ " daddu %0, %1, %3 \n"
+ " scd %0, %2 \n"
+ " beqz %0, 2f \n"
+- " addu %0, %1, %3 \n"
++ " daddu %0, %1, %3 \n"
+ " .subsection 2 \n"
+ "2: b 1b \n"
+ " .previous \n"
+@@ -576,10 +576,10 @@ static __inline__ long atomic64_sub_retu
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %1, %2 # atomic64_sub_return \n"
+- " subu %0, %1, %3 \n"
++ " dsubu %0, %1, %3 \n"
+ " scd %0, %2 \n"
+ " beqzl %0, 1b \n"
+- " subu %0, %1, %3 \n"
++ " dsubu %0, %1, %3 \n"
+ " .set mips0 \n"
+ : "=&r" (result), "=&r" (temp), "=m" (v->counter)
+ : "Ir" (i), "m" (v->counter)
+@@ -590,10 +590,10 @@ static __inline__ long atomic64_sub_retu
+ __asm__ __volatile__(
+ " .set mips3 \n"
+ "1: lld %1, %2 # atomic64_sub_return \n"
+- " subu %0, %1, %3 \n"
++ " dsubu %0, %1, %3 \n"
+ " scd %0, %2 \n"
+ " beqz %0, 2f \n"
+- " subu %0, %1, %3 \n"
++ " dsubu %0, %1, %3 \n"
+ " .subsection 2 \n"
+ "2: b 1b \n"
+ " .previous \n"
--- /dev/null
+From 8faf2e6c201d95b780cd3b4674b7a55ede6dcbbb Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Sun, 13 Jun 2010 22:22:59 +0100
+Subject: MIPS: Set io_map_base for several PCI bridges lacking it
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit 8faf2e6c201d95b780cd3b4674b7a55ede6dcbbb upstream.
+
+Several MIPS platforms don't set pci_controller::io_map_base for their
+PCI bridges. This results in a panic in pci_iomap(). (The panic is
+conditional on CONFIG_PCI_DOMAINS, but that is now enabled for all PCI
+MIPS systems.)
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: linux-mips@linux-mips.org
+Cc: Martin Michlmayr <tbm@cyrius.com>
+Cc: Aurelien Jarno <aurelien@aurel32.net>
+Cc: 584784@bugs.debian.org
+Patchwork: https://patchwork.linux-mips.org/patch/1377/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/mips/mti-malta/malta-pci.c | 2 ++
+ arch/mips/nxp/pnx8550/common/pci.c | 1 +
+ arch/mips/nxp/pnx8550/common/setup.c | 2 +-
+ arch/mips/pci/ops-pmcmsp.c | 1 +
+ arch/mips/pci/pci-yosemite.c | 1 +
+ 5 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/arch/mips/mti-malta/malta-pci.c
++++ b/arch/mips/mti-malta/malta-pci.c
+@@ -247,6 +247,8 @@ void __init mips_pcibios_init(void)
+ iomem_resource.end &= 0xfffffffffULL; /* 64 GB */
+ ioport_resource.end = controller->io_resource->end;
+
++ controller->io_map_base = mips_io_port_base;
++
+ register_pci_controller(controller);
+ }
+
+--- a/arch/mips/nxp/pnx8550/common/pci.c
++++ b/arch/mips/nxp/pnx8550/common/pci.c
+@@ -44,6 +44,7 @@ extern struct pci_ops pnx8550_pci_ops;
+
+ static struct pci_controller pnx8550_controller = {
+ .pci_ops = &pnx8550_pci_ops,
++ .io_map_base = PNX8550_PORT_BASE,
+ .io_resource = &pci_io_resource,
+ .mem_resource = &pci_mem_resource,
+ };
+--- a/arch/mips/nxp/pnx8550/common/setup.c
++++ b/arch/mips/nxp/pnx8550/common/setup.c
+@@ -113,7 +113,7 @@ void __init plat_mem_setup(void)
+ PNX8550_GLB2_ENAB_INTA_O = 0;
+
+ /* IO/MEM resources. */
+- set_io_port_base(KSEG1);
++ set_io_port_base(PNX8550_PORT_BASE);
+ ioport_resource.start = 0;
+ ioport_resource.end = ~0;
+ iomem_resource.start = 0;
+--- a/arch/mips/pci/ops-pmcmsp.c
++++ b/arch/mips/pci/ops-pmcmsp.c
+@@ -944,6 +944,7 @@ static struct pci_controller msp_pci_con
+ .pci_ops = &msp_pci_ops,
+ .mem_resource = &pci_mem_resource,
+ .mem_offset = 0,
++ .io_map_base = MSP_PCI_IOSPACE_BASE,
+ .io_resource = &pci_io_resource,
+ .io_offset = 0
+ };
+--- a/arch/mips/pci/pci-yosemite.c
++++ b/arch/mips/pci/pci-yosemite.c
+@@ -54,6 +54,7 @@ static int __init pmc_yosemite_setup(voi
+ panic(ioremap_failed);
+
+ set_io_port_base(io_v_base);
++ py_controller.io_map_base = io_v_base;
+ TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1);
+
+ ioport_resource.end = TITAN_IO_SIZE - 1;
--- /dev/null
+From 3d45285dd1ff4d4a1361b95e2d6508579a4402b5 Mon Sep 17 00:00:00 2001
+From: Ralf Baechle <ralf@linux-mips.org>
+Date: Tue, 23 Mar 2010 17:56:38 +0100
+Subject: MIPS: Sibyte: Fix M3 TLB exception handler workaround.
+
+From: Ralf Baechle <ralf@linux-mips.org>
+
+commit 3d45285dd1ff4d4a1361b95e2d6508579a4402b5 upstream.
+
+The M3 workaround needs to cmpare the region and VPN2 fields only.
+
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/mips/mm/tlbex.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+--- a/arch/mips/mm/tlbex.c
++++ b/arch/mips/mm/tlbex.c
+@@ -725,10 +725,15 @@ static void __cpuinit build_r4000_tlb_re
+ * create the plain linear handler
+ */
+ if (bcm1250_m3_war()) {
+- UASM_i_MFC0(&p, K0, C0_BADVADDR);
+- UASM_i_MFC0(&p, K1, C0_ENTRYHI);
++ unsigned int segbits = 44;
++
++ uasm_i_dmfc0(&p, K0, C0_BADVADDR);
++ uasm_i_dmfc0(&p, K1, C0_ENTRYHI);
+ uasm_i_xor(&p, K0, K0, K1);
+- UASM_i_SRL(&p, K0, K0, PAGE_SHIFT + 1);
++ uasm_i_dsrl32(&p, K1, K0, 62 - 32);
++ uasm_i_dsrl(&p, K0, K0, 12 + 1);
++ uasm_i_dsll32(&p, K0, K0, 64 + 12 + 1 - segbits - 32);
++ uasm_i_or(&p, K0, K0, K1);
+ uasm_il_bnez(&p, &r, K0, label_leave);
+ /* No need for uasm_i_nop */
+ }
+@@ -1242,10 +1247,15 @@ static void __cpuinit build_r4000_tlb_lo
+ memset(relocs, 0, sizeof(relocs));
+
+ if (bcm1250_m3_war()) {
+- UASM_i_MFC0(&p, K0, C0_BADVADDR);
+- UASM_i_MFC0(&p, K1, C0_ENTRYHI);
++ unsigned int segbits = 44;
++
++ uasm_i_dmfc0(&p, K0, C0_BADVADDR);
++ uasm_i_dmfc0(&p, K1, C0_ENTRYHI);
+ uasm_i_xor(&p, K0, K0, K1);
+- UASM_i_SRL(&p, K0, K0, PAGE_SHIFT + 1);
++ uasm_i_dsrl32(&p, K1, K0, 62 - 32);
++ uasm_i_dsrl(&p, K0, K0, 12 + 1);
++ uasm_i_dsll32(&p, K0, K0, 64 + 12 + 1 - segbits - 32);
++ uasm_i_or(&p, K0, K0, K1);
+ uasm_il_bnez(&p, &r, K0, label_leave);
+ /* No need for uasm_i_nop */
+ }
--- /dev/null
+From: Ralf Baechle <ralf@linux-mips.org>
+Date: Tue, 23 Mar 2010 15:54:50 +0100
+Subject: [PATCH] MIPS: uasm: Add OR instruction.
+
+commit 5808184f1b2fe06ef8a54a2b7fb1596d58098acf upstream.
+
+This is needed for the fix of the M3 workaround.
+
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+[Backported by Aurelien Jarno <aurelien@aurel32.net>]
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/mips/mm/uasm.c | 4 +++-
+ arch/mips/mm/uasm.h | 1 +
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/arch/mips/mm/uasm.c
++++ b/arch/mips/mm/uasm.c
+@@ -62,7 +62,7 @@ enum opcode {
+ insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl,
+ insn_dsrl32, insn_dsubu, insn_eret, insn_j, insn_jal, insn_jr,
+ insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0,
+- insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd,
++ insn_mtc0, insn_or, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd,
+ insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw,
+ insn_tlbp, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori
+ };
+@@ -116,6 +116,7 @@ static struct insn insn_table[] __cpuini
+ { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
+ { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET},
+ { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET},
++ { insn_or, M(spec_op, 0, 0, 0, 0, or_op), RS | RT | RD },
+ { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
+ { insn_pref, M(pref_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
+ { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 },
+@@ -362,6 +363,7 @@ I_u2s3u1(_lw)
+ I_u1u2u3(_mfc0)
+ I_u1u2u3(_mtc0)
+ I_u2u1u3(_ori)
++I_u3u1u2(_or)
+ I_u2s3u1(_pref)
+ I_0(_rfe)
+ I_u2s3u1(_sc)
+--- a/arch/mips/mm/uasm.h
++++ b/arch/mips/mm/uasm.h
+@@ -78,6 +78,7 @@ Ip_u2s3u1(_lw);
+ Ip_u1u2u3(_mfc0);
+ Ip_u1u2u3(_mtc0);
+ Ip_u2u1u3(_ori);
++Ip_u3u1u2(_or);
+ Ip_u2s3u1(_pref);
+ Ip_0(_rfe);
+ Ip_u2s3u1(_sc);
--- /dev/null
+From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
+Date: Sat, 13 Feb 2010 17:43:17 -0500
+Subject: [PATCH] pata_pdc202xx_old: fix UDMA mode for PDC2026x chipsets
+
+commit 750e519da7b3f470fe1b5b55c8d8f52d6d6371e4 upstream.
+
+PDC2026x chipsets need the same treatment as PDC20246 one.
+
+This is completely untested but will hopefully fix UDMA issues
+that people have been reporting against pata_pdc202xx_old for
+the last couple of years.
+
+Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/pata_pdc202xx_old.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/ata/pata_pdc202xx_old.c
++++ b/drivers/ata/pata_pdc202xx_old.c
+@@ -35,7 +35,7 @@ static int pdc2026x_cable_detect(struct
+ return ATA_CBL_PATA80;
+ }
+
+-static void pdc20246_exec_command(struct ata_port *ap,
++static void pdc202xx_exec_command(struct ata_port *ap,
+ const struct ata_taskfile *tf)
+ {
+ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
+@@ -281,7 +281,7 @@ static struct ata_port_operations pdc202
+ .set_piomode = pdc202xx_set_piomode,
+ .set_dmamode = pdc202xx_set_dmamode,
+
+- .sff_exec_command = pdc20246_exec_command,
++ .sff_exec_command = pdc202xx_exec_command,
+ };
+
+ static struct ata_port_operations pdc2026x_port_ops = {
+@@ -295,6 +295,8 @@ static struct ata_port_operations pdc202
+ .dev_config = pdc2026x_dev_config,
+
+ .port_start = pdc2026x_port_start,
++
++ .sff_exec_command = pdc202xx_exec_command,
+ };
+
+ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
--- /dev/null
+From a75032e8772d13dab5e3501413d7e14a148281b4 Mon Sep 17 00:00:00 2001
+From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
+Date: Sat, 13 Feb 2010 14:35:53 +0100
+Subject: pata_pdc202xx_old: fix UDMA mode for Promise UDMA33 cards
+
+From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
+
+commit a75032e8772d13dab5e3501413d7e14a148281b4 upstream.
+
+On Monday 04 January 2010 02:30:24 pm Russell King wrote:
+
+> Found the problem - getting rid of the read of the alt status register
+> after the command has been written fixes the UDMA CRC errors on write:
+>
+> @@ -676,7 +676,8 @@ void ata_sff_exec_command(struct ata_port *ap, const struct
+> ata_taskfile *tf)
+> DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
+>
+> iowrite8(tf->command, ap->ioaddr.command_addr);
+> - ata_sff_pause(ap);
+> + ndelay(400);
+> +// ata_sff_pause(ap);
+> }
+> EXPORT_SYMBOL_GPL(ata_sff_exec_command);
+>
+>
+> This rather makes sense. The PDC20247 handles the UDMA part of the
+> protocol. It has no way to tell the PDC20246 to wait while it suspends
+> UDMA, so that a normal register access can take place - the 246 ploughs
+> on with the register access without any regard to the state of the 247.
+>
+> If the drive immediately starts the UDMA protocol after a write to the
+> command register (as it probably will for the DMA WRITE command), then
+> we'll be accessing the taskfile in the middle of the UDMA setup, which
+> can't be good. It's certainly a violation of the ATA specs.
+
+Fix it by adding custom ->sff_exec_command method for UDMA33 chipsets.
+
+Debugged-by: Russell King <rmk@arm.linux.org.uk>
+Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/pata_pdc202xx_old.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+--- a/drivers/ata/pata_pdc202xx_old.c
++++ b/drivers/ata/pata_pdc202xx_old.c
+@@ -2,7 +2,7 @@
+ * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer
+ * (C) 2005 Red Hat Inc
+ * Alan Cox <alan@lxorguk.ukuu.org.uk>
+- * (C) 2007,2009 Bartlomiej Zolnierkiewicz
++ * (C) 2007,2009,2010 Bartlomiej Zolnierkiewicz
+ *
+ * Based in part on linux/drivers/ide/pci/pdc202xx_old.c
+ *
+@@ -35,6 +35,15 @@ static int pdc2026x_cable_detect(struct
+ return ATA_CBL_PATA80;
+ }
+
++static void pdc20246_exec_command(struct ata_port *ap,
++ const struct ata_taskfile *tf)
++{
++ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
++
++ iowrite8(tf->command, ap->ioaddr.command_addr);
++ ndelay(400);
++}
++
+ /**
+ * pdc202xx_configure_piomode - set chip PIO timing
+ * @ap: ATA interface
+@@ -271,6 +280,8 @@ static struct ata_port_operations pdc202
+ .cable_detect = ata_cable_40wire,
+ .set_piomode = pdc202xx_set_piomode,
+ .set_dmamode = pdc202xx_set_dmamode,
++
++ .sff_exec_command = pdc20246_exec_command,
+ };
+
+ static struct ata_port_operations pdc2026x_port_ops = {
guard-page-for-stacks-that-grow-upwards.patch
fix-unprotected-access-to-task-credentials-in-waitid.patch
sctp-do-not-reset-the-packet-during-sctp_packet_config.patch
+3c503-fix-irq-probing.patch
+asix-fix-setting-mac-address-for-ax88772.patch
+dasd-use-correct-label-location-for-diag-fba-disks.patch
+fix-sh_tmu.patch
+gro-fix-bogus-gso_size-on-the-first-fraglist-entry.patch
+hostap_pci-set-dev-base_addr-during-probe.patch
+inotify-fix-inotify-oneshot-support.patch
+input-add-compat-support-for-sysfs-and-proc-capabilities-output.patch
+mips-quit-using-undefined-behavior-of-addu-in-64-bit-atomic-operations.patch
+mips-set-io_map_base-for-several-pci-bridges-lacking-it.patch
+mips-uasm-add-or-instruction.patch
+pata_pdc202xx_old-fix-udma-mode-for-promise-udma33-cards.patch
+pata_pdc202xx_old-fix-UDMA-mode-for-PDC2026x-chipset.patch
+mips-sibyte-fix-m3-tlb-exception-handler-workaround.patch
+sis-agp-remove-sis-760-handled-by-amd64-agp.patch
--- /dev/null
+From d831692a1a8e9ceaaa9bb16bb3fc503b7e372558 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Wed, 24 Mar 2010 03:33:48 +0000
+Subject: sis-agp: Remove SIS 760, handled by amd64-agp
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit d831692a1a8e9ceaaa9bb16bb3fc503b7e372558 upstream.
+
+SIS 760 is listed in the device tables for both amd64-agp and sis-agp.
+amd64-agp is apparently preferable since it has workarounds for some
+BIOS misconfigurations that sis-agp doesn't handle.
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/char/agp/sis-agp.c | 8 --------
+ 1 file changed, 8 deletions(-)
+
+--- a/drivers/char/agp/sis-agp.c
++++ b/drivers/char/agp/sis-agp.c
+@@ -415,14 +415,6 @@ static struct pci_device_id agp_sis_pci_
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ },
+- {
+- .class = (PCI_CLASS_BRIDGE_HOST << 8),
+- .class_mask = ~0,
+- .vendor = PCI_VENDOR_ID_SI,
+- .device = PCI_DEVICE_ID_SI_760,
+- .subvendor = PCI_ANY_ID,
+- .subdevice = PCI_ANY_ID,
+- },
+ { }
+ };
+