--- /dev/null
+From fca8c90d519dedd4f4b19901d005c243f7f0bf2e Mon Sep 17 00:00:00 2001
+From: "Chew, Chiau Ee" <chiau.ee.chew@intel.com>
+Date: Thu, 16 May 2013 15:33:29 +0800
+Subject: ata_piix: add PCI IDs for Intel BayTail
+
+From: "Chew, Chiau Ee" <chiau.ee.chew@intel.com>
+
+commit fca8c90d519dedd4f4b19901d005c243f7f0bf2e upstream.
+
+Adds IDE-mode SATA Device IDs for the Intel BayTrail platform.
+
+Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ata_piix.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+--- a/drivers/ata/ata_piix.c
++++ b/drivers/ata/ata_piix.c
+@@ -151,6 +151,7 @@ enum piix_controller_ids {
+ piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */
+ ich8_sata_snb,
+ ich8_2port_sata_snb,
++ ich8_2port_sata_byt,
+ };
+
+ struct piix_map_db {
+@@ -334,6 +335,9 @@ static const struct pci_device_id piix_p
+ { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
+ /* SATA Controller IDE (Wellsburg) */
+ { 0x8086, 0x8d68, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
++ /* SATA Controller IDE (BayTrail) */
++ { 0x8086, 0x0F20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },
++ { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },
+
+ { } /* terminate list */
+ };
+@@ -441,6 +445,7 @@ static const struct piix_map_db *piix_ma
+ [tolapai_sata] = &tolapai_map_db,
+ [ich8_sata_snb] = &ich8_map_db,
+ [ich8_2port_sata_snb] = &ich8_2port_map_db,
++ [ich8_2port_sata_byt] = &ich8_2port_map_db,
+ };
+
+ static struct pci_bits piix_enable_bits[] = {
+@@ -1254,6 +1259,16 @@ static struct ata_port_info piix_port_in
+ .udma_mask = ATA_UDMA6,
+ .port_ops = &piix_sata_ops,
+ },
++
++ [ich8_2port_sata_byt] =
++ {
++ .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR | PIIX_FLAG_PIO16,
++ .pio_mask = ATA_PIO4,
++ .mwdma_mask = ATA_MWDMA2,
++ .udma_mask = ATA_UDMA6,
++ .port_ops = &piix_sata_ops,
++ },
++
+ };
+
+ #define AHCI_PCI_BAR 5
--- /dev/null
+From 7805d000db30a3787a4c969bab6ae4d8a5fd8ce6 Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Fri, 24 May 2013 10:50:24 +0900
+Subject: cgroup: fix a subtle bug in descendant pre-order walk
+
+From: Tejun Heo <tj@kernel.org>
+
+commit 7805d000db30a3787a4c969bab6ae4d8a5fd8ce6 upstream.
+
+When cgroup_next_descendant_pre() initiates a walk, it checks whether
+the subtree root doesn't have any children and if not returns NULL.
+Later code assumes that the subtree isn't empty. This is broken
+because the subtree may become empty inbetween, which can lead to the
+traversal escaping the subtree by walking to the sibling of the
+subtree root.
+
+There's no reason to have the early exit path. Remove it along with
+the later assumption that the subtree isn't empty. This simplifies
+the code a bit and fixes the subtle bug.
+
+While at it, fix the comment of cgroup_for_each_descendant_pre() which
+was incorrectly referring to ->css_offline() instead of
+->css_online().
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Reviewed-by: Michal Hocko <mhocko@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/cgroup.h | 2 +-
+ kernel/cgroup.c | 9 +++------
+ 2 files changed, 4 insertions(+), 7 deletions(-)
+
+--- a/include/linux/cgroup.h
++++ b/include/linux/cgroup.h
+@@ -570,7 +570,7 @@ struct cgroup *cgroup_rightmost_descenda
+ *
+ * If a subsystem synchronizes against the parent in its ->css_online() and
+ * before starting iterating, and synchronizes against @pos on each
+- * iteration, any descendant cgroup which finished ->css_offline() is
++ * iteration, any descendant cgroup which finished ->css_online() is
+ * guaranteed to be visible in the future iterations.
+ *
+ * In other words, the following guarantees that a descendant can't escape
+--- a/kernel/cgroup.c
++++ b/kernel/cgroup.c
+@@ -3000,11 +3000,8 @@ struct cgroup *cgroup_next_descendant_pr
+ WARN_ON_ONCE(!rcu_read_lock_held());
+
+ /* if first iteration, pretend we just visited @cgroup */
+- if (!pos) {
+- if (list_empty(&cgroup->children))
+- return NULL;
++ if (!pos)
+ pos = cgroup;
+- }
+
+ /* visit the first child if exists */
+ next = list_first_or_null_rcu(&pos->children, struct cgroup, sibling);
+@@ -3012,14 +3009,14 @@ struct cgroup *cgroup_next_descendant_pr
+ return next;
+
+ /* no child, visit my or the closest ancestor's next sibling */
+- do {
++ while (pos != cgroup) {
+ next = list_entry_rcu(pos->sibling.next, struct cgroup,
+ sibling);
+ if (&next->sibling != &pos->parent->children)
+ return next;
+
+ pos = pos->parent;
+- } while (pos != cgroup);
++ }
+
+ return NULL;
+ }
--- /dev/null
+From d6cbf35dac8a3dadb9103379820c96d7c85df3d9 Mon Sep 17 00:00:00 2001
+From: Li Zefan <lizefan@huawei.com>
+Date: Tue, 14 May 2013 19:44:20 +0800
+Subject: cgroup: initialize xattr before calling d_instantiate()
+
+From: Li Zefan <lizefan@huawei.com>
+
+commit d6cbf35dac8a3dadb9103379820c96d7c85df3d9 upstream.
+
+cgroup_create_file() calls d_instantiate(), which may decide to look
+at the xattrs on the file. Smack always does this and SELinux can be
+configured to do so.
+
+But cgroup_add_file() didn't initialize xattrs before calling
+cgroup_create_file(), which finally leads to dereferencing NULL
+dentry->d_fsdata.
+
+This bug has been there since cgroup xattr was introduced.
+
+Reported-by: Ivan Bulatovic <combuster@archlinux.us>
+Reported-by: Casey Schaufler <casey@schaufler-ca.com>
+Signed-off-by: Li Zefan <lizefan@huawei.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/cgroup.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/kernel/cgroup.c
++++ b/kernel/cgroup.c
+@@ -2747,13 +2747,14 @@ static int cgroup_add_file(struct cgroup
+ goto out;
+ }
+
++ cfe->type = (void *)cft;
++ cfe->dentry = dentry;
++ dentry->d_fsdata = cfe;
++ simple_xattrs_init(&cfe->xattrs);
++
+ mode = cgroup_file_mode(cft);
+ error = cgroup_create_file(dentry, mode | S_IFREG, cgrp->root->sb);
+ if (!error) {
+- cfe->type = (void *)cft;
+- cfe->dentry = dentry;
+- dentry->d_fsdata = cfe;
+- simple_xattrs_init(&cfe->xattrs);
+ list_add_tail(&cfe->node, &parent->files);
+ cfe = NULL;
+ }
--- /dev/null
+From e771451c0a831d96a7c14b0ca8a8ec671d98567b Mon Sep 17 00:00:00 2001
+From: Vincent Pelletier <plr.vincent@gmail.com>
+Date: Sat, 18 May 2013 18:44:04 +0200
+Subject: libata: make ata_exec_internal_sg honor DMADIR
+
+From: Vincent Pelletier <plr.vincent@gmail.com>
+
+commit e771451c0a831d96a7c14b0ca8a8ec671d98567b upstream.
+
+libata honors DMADIR for regular commands, but not for internal commands
+used (among other) during device initialisation.
+
+This makes SATA-host-to-PATA-device bridges based on Silicon Image SiL3611
+(such as "Abit Serillel 2") end up disabled when used with an ATAPI device
+after a few tries.
+
+Log output of the bridge being hot-plugged with an ATAPI drive:
+
+ [ 9631.212901] ata1: exception Emask 0x10 SAct 0x0 SErr 0x40c0000 action 0xe frozen
+ [ 9631.212913] ata1: irq_stat 0x00000040, connection status changed
+ [ 9631.212923] ata1: SError: { CommWake 10B8B DevExch }
+ [ 9631.212939] ata1: hard resetting link
+ [ 9632.104962] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
+ [ 9632.106393] ata1.00: ATAPI: PIONEER DVD-RW DVR-115, 1.06, max UDMA/33
+ [ 9632.106407] ata1.00: applying bridge limits
+ [ 9632.108151] ata1.00: configured for UDMA/33
+ [ 9637.105303] ata1.00: qc timeout (cmd 0xa0)
+ [ 9637.105324] ata1.00: failed to clear UNIT ATTENTION (err_mask=0x5)
+ [ 9637.105335] ata1: hard resetting link
+ [ 9638.044599] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
+ [ 9638.047878] ata1.00: configured for UDMA/33
+ [ 9643.044933] ata1.00: qc timeout (cmd 0xa0)
+ [ 9643.044953] ata1.00: failed to clear UNIT ATTENTION (err_mask=0x5)
+ [ 9643.044963] ata1: limiting SATA link speed to 1.5 Gbps
+ [ 9643.044971] ata1.00: limiting speed to UDMA/33:PIO3
+ [ 9643.044979] ata1: hard resetting link
+ [ 9643.984225] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
+ [ 9643.987471] ata1.00: configured for UDMA/33
+ [ 9648.984591] ata1.00: qc timeout (cmd 0xa0)
+ [ 9648.984612] ata1.00: failed to clear UNIT ATTENTION (err_mask=0x5)
+ [ 9648.984619] ata1.00: disabled
+ [ 9649.000593] ata1: hard resetting link
+ [ 9649.939902] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
+ [ 9649.955864] ata1: EH complete
+
+With this patch, the drive enumerates correctly when libata is loaded with
+atapi_dmadir=1:
+
+ [ 9891.810863] ata1: exception Emask 0x10 SAct 0x0 SErr 0x40c0000 action 0xe frozen
+ [ 9891.810874] ata1: irq_stat 0x00000040, connection status changed
+ [ 9891.810884] ata1: SError: { CommWake 10B8B DevExch }
+ [ 9891.810900] ata1: hard resetting link
+ [ 9892.762105] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
+ [ 9892.763544] ata1.00: ATAPI: PIONEER DVD-RW DVR-115, 1.06, max UDMA/33, DMADIR
+ [ 9892.763558] ata1.00: applying bridge limits
+ [ 9892.765393] ata1.00: configured for UDMA/33
+ [ 9892.786063] ata1: EH complete
+ [ 9892.792062] scsi 0:0:0:0: CD-ROM PIONEER DVD-RW DVR-115 1.06 PQ: 0 ANSI: 5
+ [ 9892.798455] sr2: scsi3-mmc drive: 12x/12x writer dvd-ram cd/rw xa/form2 cdda tray
+ [ 9892.798837] sr 0:0:0:0: Attached scsi CD-ROM sr2
+ [ 9892.799109] sr 0:0:0:0: Attached scsi generic sg6 type 5
+
+Based on a patch by Csaba Halász <csaba.halasz@gmail.com> on linux-ide:
+http://marc.info/?l=linux-ide&m=136121147832295&w=2
+
+tj: minor formatting changes.
+
+Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/libata-core.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -1602,6 +1602,12 @@ unsigned ata_exec_internal_sg(struct ata
+ qc->tf = *tf;
+ if (cdb)
+ memcpy(qc->cdb, cdb, ATAPI_CDB_LEN);
++
++ /* some SATA bridges need us to indicate data xfer direction */
++ if (tf->protocol == ATAPI_PROT_DMA && (dev->flags & ATA_DFLAG_DMADIR) &&
++ dma_dir == DMA_FROM_DEVICE)
++ qc->tf.feature |= ATAPI_DMADIR;
++
+ qc->flags |= ATA_QCFLAG_RESULT_TF;
+ qc->dma_dir = dma_dir;
+ if (dma_dir != DMA_NONE) {
--- /dev/null
+From df66834a43c461de2565c45d815288ba1c0def37 Mon Sep 17 00:00:00 2001
+From: Finn Thain <fthain@telegraphics.com.au>
+Date: Wed, 29 May 2013 12:37:17 +1000
+Subject: m68k/mac: Fix unexpected interrupt with CONFIG_EARLY_PRINTK
+
+From: Finn Thain <fthain@telegraphics.com.au>
+
+commit df66834a43c461de2565c45d815288ba1c0def37 upstream.
+
+The present code does not wait for the SCC to finish resetting itself
+before trying to initialise the device. The result is that the SCC
+interrupt sources become enabled (if they weren't already). This leads to
+an early boot crash (unexpected interrupt) given CONFIG_EARLY_PRINTK. Fix
+this by adding a delay. A successful reset disables the interrupt sources.
+
+Also, after the reset for channel A setup, the SCC then gets a second
+reset for channel B setup which leaves channel A uninitialised again. Fix
+this by performing the reset only once.
+
+Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/m68k/kernel/head.S | 29 +++++++++++++++++++----------
+ 1 file changed, 19 insertions(+), 10 deletions(-)
+
+--- a/arch/m68k/kernel/head.S
++++ b/arch/m68k/kernel/head.S
+@@ -2752,11 +2752,9 @@ func_return get_new_page
+ #ifdef CONFIG_MAC
+
+ L(scc_initable_mac):
+- .byte 9,12 /* Reset */
+ .byte 4,0x44 /* x16, 1 stopbit, no parity */
+ .byte 3,0xc0 /* receiver: 8 bpc */
+ .byte 5,0xe2 /* transmitter: 8 bpc, assert dtr/rts */
+- .byte 9,0 /* no interrupts */
+ .byte 10,0 /* NRZ */
+ .byte 11,0x50 /* use baud rate generator */
+ .byte 12,1,13,0 /* 38400 baud */
+@@ -2899,6 +2897,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
+ is_not_mac(L(serial_init_not_mac))
+
+ #ifdef SERIAL_DEBUG
++
+ /* You may define either or both of these. */
+ #define MAC_USE_SCC_A /* Modem port */
+ #define MAC_USE_SCC_B /* Printer port */
+@@ -2908,9 +2907,21 @@ func_start serial_init,%d0/%d1/%a0/%a1
+ #define mac_scc_cha_b_data_offset 0x4
+ #define mac_scc_cha_a_data_offset 0x6
+
++#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
++ movel %pc@(L(mac_sccbase)),%a0
++ /* Reset SCC device */
++ moveb #9,%a0@(mac_scc_cha_a_ctrl_offset)
++ moveb #0xc0,%a0@(mac_scc_cha_a_ctrl_offset)
++ /* Wait for 5 PCLK cycles, which is about 68 CPU cycles */
++ /* 5 / 3.6864 MHz = approx. 1.36 us = 68 / 50 MHz */
++ movel #35,%d0
++5:
++ subq #1,%d0
++ jne 5b
++#endif
++
+ #ifdef MAC_USE_SCC_A
+ /* Initialize channel A */
+- movel %pc@(L(mac_sccbase)),%a0
+ lea %pc@(L(scc_initable_mac)),%a1
+ 5: moveb %a1@+,%d0
+ jmi 6f
+@@ -2922,9 +2933,6 @@ func_start serial_init,%d0/%d1/%a0/%a1
+
+ #ifdef MAC_USE_SCC_B
+ /* Initialize channel B */
+-#ifndef MAC_USE_SCC_A /* Load mac_sccbase only if needed */
+- movel %pc@(L(mac_sccbase)),%a0
+-#endif /* MAC_USE_SCC_A */
+ lea %pc@(L(scc_initable_mac)),%a1
+ 7: moveb %a1@+,%d0
+ jmi 8f
+@@ -2933,6 +2941,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
+ jra 7b
+ 8:
+ #endif /* MAC_USE_SCC_B */
++
+ #endif /* SERIAL_DEBUG */
+
+ jra L(serial_init_done)
+@@ -3006,17 +3015,17 @@ func_start serial_putc,%d0/%d1/%a0/%a1
+
+ #ifdef SERIAL_DEBUG
+
+-#ifdef MAC_USE_SCC_A
++#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
+ movel %pc@(L(mac_sccbase)),%a1
++#endif
++
++#ifdef MAC_USE_SCC_A
+ 3: btst #2,%a1@(mac_scc_cha_a_ctrl_offset)
+ jeq 3b
+ moveb %d0,%a1@(mac_scc_cha_a_data_offset)
+ #endif /* MAC_USE_SCC_A */
+
+ #ifdef MAC_USE_SCC_B
+-#ifndef MAC_USE_SCC_A /* Load mac_sccbase only if needed */
+- movel %pc@(L(mac_sccbase)),%a1
+-#endif /* MAC_USE_SCC_A */
+ 4: btst #2,%a1@(mac_scc_cha_b_ctrl_offset)
+ jeq 4b
+ moveb %d0,%a1@(mac_scc_cha_b_data_offset)
--- /dev/null
+From b56433cb782d1cc7e44fc46d2ce3917fa75d2236 Mon Sep 17 00:00:00 2001
+From: Christian Borntraeger <borntraeger@de.ibm.com>
+Date: Mon, 27 May 2013 16:19:55 +0200
+Subject: s390/pgtable: Fix check for pgste/storage key handling
+
+From: Christian Borntraeger <borntraeger@de.ibm.com>
+
+commit b56433cb782d1cc7e44fc46d2ce3917fa75d2236 upstream.
+
+pte_present might return true on PAGE_TYPE_NONE, even if
+the invalid bit is on. Modify the existing check of the
+pgste functions to avoid crashes.
+
+[ Martin Schwidefsky: added ptep_modify_prot_[start|commit] bits ]
+
+Reported-by: Martin Schwidefky <schwidefsky@de.ibm.com>
+Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/s390/include/asm/pgtable.h | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+--- a/arch/s390/include/asm/pgtable.h
++++ b/arch/s390/include/asm/pgtable.h
+@@ -637,7 +637,7 @@ static inline pgste_t pgste_update_all(p
+ unsigned long address, bits;
+ unsigned char skey;
+
+- if (!pte_present(*ptep))
++ if (pte_val(*ptep) & _PAGE_INVALID)
+ return pgste;
+ address = pte_val(*ptep) & PAGE_MASK;
+ skey = page_get_storage_key(address);
+@@ -671,7 +671,7 @@ static inline pgste_t pgste_update_young
+ #ifdef CONFIG_PGSTE
+ int young;
+
+- if (!pte_present(*ptep))
++ if (pte_val(*ptep) & _PAGE_INVALID)
+ return pgste;
+ /* Get referenced bit from storage key */
+ young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK);
+@@ -697,7 +697,7 @@ static inline void pgste_set_key(pte_t *
+ unsigned long address;
+ unsigned long okey, nkey;
+
+- if (!pte_present(entry))
++ if (pte_val(entry) & _PAGE_INVALID)
+ return;
+ address = pte_val(entry) & PAGE_MASK;
+ okey = nkey = page_get_storage_key(address);
+@@ -1072,6 +1072,9 @@ static inline pte_t ptep_modify_prot_sta
+ pte = *ptep;
+ if (!mm_exclusive(mm))
+ __ptep_ipte(address, ptep);
++
++ if (mm_has_pgste(mm))
++ pgste = pgste_update_all(&pte, pgste);
+ return pte;
+ }
+
+@@ -1079,9 +1082,13 @@ static inline void ptep_modify_prot_comm
+ unsigned long address,
+ pte_t *ptep, pte_t pte)
+ {
++ pgste_t pgste;
++
+ if (mm_has_pgste(mm)) {
++ pgste = *(pgste_t *)(ptep + PTRS_PER_PTE);
++ pgste_set_key(ptep, pgste, pte);
+ pgste_set_pte(ptep, pte);
+- pgste_set_unlock(ptep, *(pgste_t *)(ptep + PTRS_PER_PTE));
++ pgste_set_unlock(ptep, pgste);
+ } else
+ *ptep = pte;
+ }
--- /dev/null
+From df7e131f6359f20ed8f0a37db039c4f6420a18c2 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 21 May 2013 23:07:54 +0400
+Subject: sata_rcar: clear STOP bit in bmdma_start() method
+
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+
+commit df7e131f6359f20ed8f0a37db039c4f6420a18c2 upstream.
+
+Iff bmdma_setup() has to stop a DMA transfer before starting a new
+one, then the STOP bit in the ATAPI_CONTROL1 register will remain set
+(it's only cleared when setting the START bit to 1) and then
+bmdma_start() method will set both START and STOP bits simultaneously
+which should abort the transfer being just started. Avoid that by
+explicitly clearing the STOP bit in bmdma_start() method (in this case
+it will be ignored on write).
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/sata_rcar.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/ata/sata_rcar.c
++++ b/drivers/ata/sata_rcar.c
+@@ -548,6 +548,7 @@ static void sata_rcar_bmdma_start(struct
+
+ /* start host DMA transaction */
+ dmactl = ioread32(priv->base + ATAPI_CONTROL1_REG);
++ dmactl &= ~ATAPI_CONTROL1_STOP;
+ dmactl |= ATAPI_CONTROL1_START;
+ iowrite32(dmactl, priv->base + ATAPI_CONTROL1_REG);
+ }
--- /dev/null
+From 52a2a1087b5924de00484f35ef5e2a73f61dbd22 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Sat, 1 Jun 2013 02:38:35 +0400
+Subject: sata_rcar: fix interrupt handling
+
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+
+commit 52a2a1087b5924de00484f35ef5e2a73f61dbd22 upstream.
+
+The driver's interrupt handling code is too picky in deciding whether it should
+handle an interrupt or not which causes completely unneeded spurious interrupts.
+Thus make sata_rcar_{ata|serr}_interrupt() *void*; add ATA status register read
+to sata_rcar_ata_interrupt() to clear an unexpected ATA interrupt -- it doesn't
+get cleared by writing to the SATAINTSTAT register in the interrupt mode we use.
+
+Also, in sata_rcar_ata_interrupt() we should check SATAINTSTAT register only for
+enabled interrupts and we should clear only those interrupts that we have read
+as active first time around, because else we have a race and risk clearing an
+interrupt that can occur between read and write of the SATAINTSTAT register
+and never registering it...
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/sata_rcar.c | 23 +++++++++++------------
+ 1 file changed, 11 insertions(+), 12 deletions(-)
+
+--- a/drivers/ata/sata_rcar.c
++++ b/drivers/ata/sata_rcar.c
+@@ -618,17 +618,16 @@ static struct ata_port_operations sata_r
+ .bmdma_status = sata_rcar_bmdma_status,
+ };
+
+-static int sata_rcar_serr_interrupt(struct ata_port *ap)
++static void sata_rcar_serr_interrupt(struct ata_port *ap)
+ {
+ struct sata_rcar_priv *priv = ap->host->private_data;
+ struct ata_eh_info *ehi = &ap->link.eh_info;
+ int freeze = 0;
+- int handled = 0;
+ u32 serror;
+
+ serror = ioread32(priv->base + SCRSERR_REG);
+ if (!serror)
+- return 0;
++ return;
+
+ DPRINTK("SError @host_intr: 0x%x\n", serror);
+
+@@ -641,7 +640,6 @@ static int sata_rcar_serr_interrupt(stru
+ ata_ehi_push_desc(ehi, "%s", "hotplug");
+
+ freeze = serror & SERR_COMM_WAKE ? 0 : 1;
+- handled = 1;
+ }
+
+ /* freeze or abort */
+@@ -649,11 +647,9 @@ static int sata_rcar_serr_interrupt(stru
+ ata_port_freeze(ap);
+ else
+ ata_port_abort(ap);
+-
+- return handled;
+ }
+
+-static int sata_rcar_ata_interrupt(struct ata_port *ap)
++static void sata_rcar_ata_interrupt(struct ata_port *ap)
+ {
+ struct ata_queued_cmd *qc;
+ int handled = 0;
+@@ -662,7 +658,9 @@ static int sata_rcar_ata_interrupt(struc
+ if (qc)
+ handled |= ata_bmdma_port_intr(ap, qc);
+
+- return handled;
++ /* be sure to clear ATA interrupt */
++ if (!handled)
++ sata_rcar_check_status(ap);
+ }
+
+ static irqreturn_t sata_rcar_interrupt(int irq, void *dev_instance)
+@@ -677,20 +675,21 @@ static irqreturn_t sata_rcar_interrupt(i
+ spin_lock_irqsave(&host->lock, flags);
+
+ sataintstat = ioread32(priv->base + SATAINTSTAT_REG);
++ sataintstat &= SATA_RCAR_INT_MASK;
+ if (!sataintstat)
+ goto done;
+ /* ack */
+- iowrite32(sataintstat & ~SATA_RCAR_INT_MASK,
+- priv->base + SATAINTSTAT_REG);
++ iowrite32(~sataintstat & 0x7ff, priv->base + SATAINTSTAT_REG);
+
+ ap = host->ports[0];
+
+ if (sataintstat & SATAINTSTAT_ATA)
+- handled |= sata_rcar_ata_interrupt(ap);
++ sata_rcar_ata_interrupt(ap);
+
+ if (sataintstat & SATAINTSTAT_SERR)
+- handled |= sata_rcar_serr_interrupt(ap);
++ sata_rcar_serr_interrupt(ap);
+
++ handled = 1;
+ done:
+ spin_unlock_irqrestore(&host->lock, flags);
+
drm-radeon-fix-card_posted-check-for-newer-asics.patch
crypto-caam-fix-inconsistent-assoc-dma-mapping-direction.patch
cifs-fix-potential-buffer-overrun-when-composing-a-new-options-string.patch
+sata_rcar-clear-stop-bit-in-bmdma_start-method.patch
+sata_rcar-fix-interrupt-handling.patch
+ata_piix-add-pci-ids-for-intel-baytail.patch
+libata-make-ata_exec_internal_sg-honor-dmadir.patch
+m68k-mac-fix-unexpected-interrupt-with-config_early_printk.patch
+s390-pgtable-fix-check-for-pgste-storage-key-handling.patch
+cgroup-initialize-xattr-before-calling-d_instantiate.patch
+cgroup-fix-a-subtle-bug-in-descendant-pre-order-walk.patch