public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Vincent Pelletier <plr.vincent@gmail.com>,
	Tejun Heo <tj@kernel.org>
Subject: [ 077/127] libata: make ata_exec_internal_sg honor DMADIR
Date: Wed,  5 Jun 2013 14:34:04 -0700	[thread overview]
Message-ID: <20130605213226.687151918@linuxfoundation.org> (raw)
In-Reply-To: <20130605213217.966891866@linuxfoundation.org>

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

------------------

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) {



  parent reply	other threads:[~2013-06-05 21:51 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 21:32 [ 000/127] 3.9.5-stable review Greg Kroah-Hartman
2013-06-05 21:32 ` [ 001/127] avr32: fix relocation check for signed 18-bit offset Greg Kroah-Hartman
2013-06-05 21:32 ` [ 002/127] USB: OHCI: fix logic for scheduling isochronous URBs Greg Kroah-Hartman
2013-06-05 21:32 ` [ 003/127] USB: fix latency in uhci-hcd and ohci-hcd Greg Kroah-Hartman
2013-06-05 21:32 ` [ 004/127] ARM: plat-orion: Fix num_resources and id for ge10 and ge11 Greg Kroah-Hartman
2013-06-05 21:32 ` [ 005/127] ARM: OMAP: fix __init section mismatch for _enable_preprogram Greg Kroah-Hartman
2013-06-05 21:32 ` [ 006/127] ARM: AM33XX: Add missing .clkdm_name to clkdiv32k_ick clock Greg Kroah-Hartman
2013-06-05 21:32 ` [ 007/127] ARM: 7723/1: crypto: sha1-armv4-large.S: fix SP handling Greg Kroah-Hartman
2013-06-05 21:32 ` [ 008/127] ARM: at91/trivial: fix model name for SAM9X25-EK Greg Kroah-Hartman
2013-06-05 21:32 ` [ 009/127] ARM: at91: rm9200 fix time support Greg Kroah-Hartman
2013-06-05 21:32 ` [ 010/127] ARM: at91/dt: fix macb pinctrl_macb_rmii_mii_alt definition Greg Kroah-Hartman
2013-06-05 21:32 ` [ 011/127] cfg80211: fix WoWLAN wakeup tracing Greg Kroah-Hartman
2013-06-05 21:32 ` [ 012/127] cfg80211: fix wiphy_register error path Greg Kroah-Hartman
2013-06-05 21:33 ` [ 013/127] cfg80211: fix sending WoWLAN TCP wakeup settings Greg Kroah-Hartman
2013-06-05 21:33 ` [ 014/127] mac80211: use just spin_lock() in ieee80211_get_tkip_p2k() Greg Kroah-Hartman
2013-06-05 21:33 ` [ 015/127] mac80211: fix AP-mode frame matching Greg Kroah-Hartman
2013-06-05 21:33 ` [ 016/127] iwlwifi: mvm: Always use SCAN_TYPE_FORCED Greg Kroah-Hartman
2013-06-05 21:33 ` [ 017/127] iwlwifi: mvm: Prevent setting assoc flag in MAC_CONTEXT_CMD Greg Kroah-Hartman
2013-06-05 21:33 ` [ 018/127] staging: vt6656: [bug] Fix missing spin lock in iwctl_siwpower Greg Kroah-Hartman
2013-06-05 21:33 ` [ 019/127] staging: vt6656: use free_netdev instead of kfree Greg Kroah-Hartman
2013-06-05 21:33 ` [ 020/127] usb, chipidea: fix link error when USB_EHCI_HCD is a module Greg Kroah-Hartman
2013-06-05 21:33 ` [ 021/127] usb: option: Add Telewell TW-LTE 4G Greg Kroah-Hartman
2013-06-05 21:33 ` [ 022/127] USB: option: add device IDs for Dell 5804 (Novatel E371) WWAN card Greg Kroah-Hartman
2013-06-05 21:33 ` [ 023/127] USB: ftdi_sio: Add support for Newport CONEX motor drivers Greg Kroah-Hartman
2013-06-05 21:33 ` [ 024/127] USB: cxacru: potential underflow in cxacru_cm_get_array() Greg Kroah-Hartman
2013-06-05 21:33 ` [ 025/127] TTY: Fix tty miss restart after we turn off flow-control Greg Kroah-Hartman
2013-06-05 21:33 ` [ 026/127] USB: Blacklisted Cinterions PLxx WWAN Interface Greg Kroah-Hartman
2013-06-05 21:33 ` [ 027/127] USB: reset resume quirk needed by a hub Greg Kroah-Hartman
2013-06-05 21:33 ` [ 028/127] USB: xHCI: override bogus bulk wMaxPacketSize values Greg Kroah-Hartman
2013-06-05 21:33 ` [ 029/127] USB: UHCI: fix for suspend of virtual HP controller Greg Kroah-Hartman
2013-06-05 21:33 ` [ 030/127] Input: egalax_ts - ABS_MT_POSITION_Y not reported well Greg Kroah-Hartman
2013-06-05 21:33 ` [ 031/127] Drivers: hv: Fix a bug in get_vp_index() Greg Kroah-Hartman
2013-06-05 21:33 ` [ 032/127] cifs: only set ops for inodes in I_NEW state Greg Kroah-Hartman
2013-06-05 21:33 ` [ 033/127] ARC: copy_(to|from)_user() to honor usermode-access permissions Greg Kroah-Hartman
2013-06-05 21:33 ` [ 034/127] drivers/char/random.c: fix priming of last_data Greg Kroah-Hartman
2013-06-05 21:33 ` [ 035/127] random: fix accounting race condition with lockless irq entropy_count update Greg Kroah-Hartman
2013-06-05 21:33 ` [ 036/127] fat: fix possible overflow for fat_clusters Greg Kroah-Hartman
2013-06-05 21:33 ` [ 037/127] tg3: Skip powering down function 0 on certain serdes devices Greg Kroah-Hartman
2013-06-05 21:33 ` [ 038/127] tg3: Fix data corruption on 5725 with TSO Greg Kroah-Hartman
2013-06-05 21:33 ` [ 039/127] perf: net_dropmonitor: Fix trace parameter order Greg Kroah-Hartman
2013-06-05 21:33 ` [ 040/127] perf: net_dropmonitor: Fix symbol-relative addresses Greg Kroah-Hartman
2013-06-05 21:33 ` [ 041/127] ath9k: Fix crash on module unload Greg Kroah-Hartman
2013-06-05 21:33 ` [ 042/127] ath9k_hw: Enable manual peak calibration for AR9485 Greg Kroah-Hartman
2013-06-05 21:33 ` [ 043/127] ocfs2: goto out_unlock if ocfs2_get_clusters_nocache() failed in ocfs2_fiemap() Greg Kroah-Hartman
2013-06-05 21:33 ` [ 044/127] Kirkwood: Enable PCIe port 1 on QNAP TS-11x/TS-21x Greg Kroah-Hartman
2013-06-05 21:33 ` [ 045/127] drivers/leds/leds-ot200.c: fix error caused by shifted mask Greg Kroah-Hartman
2013-06-05 21:33 ` [ 046/127] rapidio/tsi721: fix bug in MSI interrupt handling Greg Kroah-Hartman
2013-06-05 21:33 ` [ 047/127] mm compaction: fix of improper cache flush in migration code Greg Kroah-Hartman
2013-06-05 21:33 ` [ 048/127] klist: del waiter from klist_remove_waiters before wakeup waitting process Greg Kroah-Hartman
2013-06-05 21:33 ` [ 049/127] wait: fix false timeouts when using wait_event_timeout() Greg Kroah-Hartman
2013-06-05 21:33 ` [ 050/127] nilfs2: fix issue of nilfs_set_page_dirty() for page at EOF boundary Greg Kroah-Hartman
2013-06-05 21:33 ` [ 051/127] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU Greg Kroah-Hartman
2013-06-05 21:33 ` [ 052/127] mm: memcg: remove incorrect VM_BUG_ON for swap cache pages in uncharge Greg Kroah-Hartman
2013-06-05 21:33 ` [ 053/127] drivers/block/brd.c: fix brd_lookup_page() race Greg Kroah-Hartman
2013-06-05 21:33 ` [ 054/127] mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas Greg Kroah-Hartman
2013-06-05 21:33 ` [ 055/127] mm/THP: use pmd_populate() to update the pmd with pgtable_t pointer Greg Kroah-Hartman
2013-06-05 21:33 ` [ 056/127] SCSI: ipr: Need to reset adapter after the 6th EEH error Greg Kroah-Hartman
2013-06-05 21:33 ` [ 057/127] x86: Allow FPU to be used at interrupt time even with eagerfpu Greg Kroah-Hartman
2013-06-05 21:33 ` [ 058/127] x86-64, init: Fix a possible wraparound bug in switchover in head_64.S Greg Kroah-Hartman
2013-06-05 21:33 ` [ 059/127] x86, range: fix missing merge during add range Greg Kroah-Hartman
2013-06-05 21:33 ` [ 060/127] x86, crc32-pclmul: Fix build with older binutils Greg Kroah-Hartman
2013-06-05 21:33 ` [ 061/127] module: dont unlink the module until weve removed all exposure Greg Kroah-Hartman
2013-06-05 21:33 ` [ 062/127] xfs: kill suid/sgid through the truncate path Greg Kroah-Hartman
2013-06-05 21:33 ` [ 063/127] arm64: dont kill the kernel on a bad esr from el0 Greg Kroah-Hartman
2013-06-05 21:33 ` [ 064/127] ARM: SAMSUNG: Export MIPI CSIS/DSIM PHY control functions Greg Kroah-Hartman
2013-06-05 21:33 ` [ 065/127] SUNRPC: Prevent an rpc_task wakeup race Greg Kroah-Hartman
2013-06-05 21:33 ` [ 066/127] svcrpc: fix failures to handle -1 uids and gids Greg Kroah-Hartman
2013-06-05 21:33 ` [ 067/127] ASoC: cs42l52: fix default value for MASTERA_VOL Greg Kroah-Hartman
2013-06-05 21:33 ` [ 068/127] ASoC: wm5110: Correct DSP4R Mixer control name Greg Kroah-Hartman
2013-06-05 21:33 ` [ 069/127] drm/i915: Adding more reserved PCI IDs for Haswell Greg Kroah-Hartman
2013-06-05 21:33 ` [ 070/127] drm/radeon: fix typo in cu_per_sh on verde Greg Kroah-Hartman
2013-06-05 21:33 ` [ 071/127] drm/radeon: fix card_posted check for newer asics Greg Kroah-Hartman
2013-06-05 21:33 ` [ 072/127] crypto: caam - fix inconsistent assoc dma mapping direction Greg Kroah-Hartman
2013-06-05 21:34 ` [ 073/127] cifs: fix potential buffer overrun when composing a new options string Greg Kroah-Hartman
2013-06-05 21:34 ` [ 074/127] sata_rcar: clear STOP bit in bmdma_start() method Greg Kroah-Hartman
2013-06-05 21:34 ` [ 075/127] sata_rcar: fix interrupt handling Greg Kroah-Hartman
2013-06-05 21:34 ` [ 076/127] ata_piix: add PCI IDs for Intel BayTail Greg Kroah-Hartman
2013-06-05 21:34 ` Greg Kroah-Hartman [this message]
2013-06-05 21:34 ` [ 078/127] m68k/mac: Fix unexpected interrupt with CONFIG_EARLY_PRINTK Greg Kroah-Hartman
2013-06-05 21:34 ` [ 079/127] s390/pgtable: Fix check for pgste/storage key handling Greg Kroah-Hartman
2013-06-05 21:34 ` [ 080/127] cgroup: initialize xattr before calling d_instantiate() Greg Kroah-Hartman
2013-06-05 21:34 ` [ 081/127] cgroup: fix a subtle bug in descendant pre-order walk Greg Kroah-Hartman
2013-06-05 21:34 ` [ 082/127] powerpc/32bit:Store temporary result in r0 instead of r8 Greg Kroah-Hartman
2013-06-05 21:34 ` [ 083/127] powerpc/tm: Make room for hypervisor in abort cause codes Greg Kroah-Hartman
2013-06-05 21:34 ` [ 084/127] powerpc/tm: Update cause codes documentation Greg Kroah-Hartman
2013-06-05 21:34 ` [ 085/127] powerpc/tm: Fix userspace stack corruption on signal delivery for active transactions Greg Kroah-Hartman
2013-06-05 21:34 ` [ 086/127] powerpc/tm: Abort on emulation and alignment faults Greg Kroah-Hartman
2013-06-05 21:34 ` [ 087/127] powerpc/tm: Move TM abort cause codes to uapi Greg Kroah-Hartman
2013-06-05 21:34 ` [ 088/127] iscsi-target: fix heap buffer overflow on error Greg Kroah-Hartman
2013-06-05 21:34 ` [ 089/127] ib_srpt: Call target_sess_cmd_list_set_waiting during shutdown_session Greg Kroah-Hartman
2013-06-05 21:34 ` [ 090/127] NFSv4: Fix a thinko in nfs4_try_open_cached Greg Kroah-Hartman
2013-06-05 21:34 ` [ 091/127] KVM: Emulate multibyte NOP Greg Kroah-Hartman
2013-06-05 21:34 ` [ 092/127] KVM: fix sil/dil/bpl/spl in the mod/rm fields Greg Kroah-Hartman
2013-06-05 21:34 ` [ 093/127] regulator: palmas: Fix "enable_reg" to point to the correct reg for SMPS10 Greg Kroah-Hartman
2013-06-05 21:34 ` [ 094/127] powerpc/pseries: Always enable CONFIG_HOTPLUG_CPU on PSERIES SMP Greg Kroah-Hartman
2013-06-05 21:34 ` [ 095/127] reiserfs: fix deadlock with nfs racing on create/lookup Greg Kroah-Hartman
2013-06-05 21:34 ` [ 096/127] reiserfs: fix problems with chowning setuid file w/ xattrs Greg Kroah-Hartman
2013-06-05 21:34 ` [ 097/127] reiserfs: fix spurious multiple-fill in reiserfs_readdir_dentry Greg Kroah-Hartman
2013-06-05 21:34 ` [ 098/127] jfs: fix a couple races Greg Kroah-Hartman
2013-06-05 21:34 ` [ 099/127] xen-netback: remove skb in xen_netbk_alloc_page Greg Kroah-Hartman
2013-06-05 21:34 ` [ 100/127] iwlwifi: mvm: fix aggregation drain flow Greg Kroah-Hartman
2013-06-05 21:34 ` [ 101/127] iommu/amd: Re-enable IOMMU event log interrupt after handling Greg Kroah-Hartman
2013-06-05 21:34 ` [ 102/127] iommu/amd: Workaround for ERBT1312 Greg Kroah-Hartman
2013-06-05 21:34 ` [ 103/127] ACPI / PM: Allow device power states to be used for CONFIG_PM unset Greg Kroah-Hartman
2013-06-05 21:34 ` [ 104/127] ACPI / video: Add "Asus UL30A" to ACPI video detect blacklist Greg Kroah-Hartman
2013-06-05 21:34 ` [ 105/127] drm/nvc0/ce: disable ce1 on a number of chipsets Greg Kroah-Hartman
2013-06-05 21:34 ` [ 106/127] mac80211: fix direct probe auth Greg Kroah-Hartman
2013-06-05 21:34 ` [ 107/127] mac80211: close AP_VLAN interfaces before unregistering all Greg Kroah-Hartman
2013-06-05 21:34 ` [ 108/127] iwlwifi: dvm: fix zero LQ CMD sending avoidance Greg Kroah-Hartman
2013-06-05 21:34 ` [ 109/127] iwlwifi: mvm: tell firmware to let multicast frames in Greg Kroah-Hartman
2013-06-05 21:34 ` [ 110/127] cfg80211: check wdev->netdev in connection work Greg Kroah-Hartman
2013-06-05 21:34 ` [ 111/127] ath9k: use correct OTP register offsets for AR9550 Greg Kroah-Hartman
2013-06-05 21:34 ` [ 112/127] tg3: Add read dma workaround for 5720 Greg Kroah-Hartman
2013-06-05 21:34 ` [ 113/127] net: can: kvaser_usb: fix reception on "USBcan Pro" and "USBcan R" type hardware Greg Kroah-Hartman
2013-06-05 21:34 ` [ 114/127] IB/iser: Return error to upper layers on EAGAIN registration failures Greg Kroah-Hartman
2013-06-05 21:34 ` [ 115/127] ASoC: davinci: fix sample rotation Greg Kroah-Hartman
2013-06-05 21:34 ` [ 116/127] fuse: fix readdirplus Oops in fuse_dentry_revalidate Greg Kroah-Hartman
2013-06-05 21:34 ` [ 117/127] target: Re-instate sess_wait_list for target_wait_for_sess_cmds Greg Kroah-Hartman
2013-06-05 21:34 ` [ 118/127] target/file: Fix off-by-one READ_CAPACITY bug for !S_ISBLK export Greg Kroah-Hartman
2013-06-05 21:34 ` [ 119/127] leds: leds-gpio: reserve gpio before using it Greg Kroah-Hartman
2013-06-05 21:34 ` [ 120/127] xen-netback: coalesce slots in TX path and fix regressions Greg Kroah-Hartman
2013-06-05 21:34 ` [ 121/127] xen-netback: dont disconnect frontend when seeing oversize packet Greg Kroah-Hartman
2013-06-05 21:34 ` [ 122/127] xen-netback: remove redundent parameter in netbk_count_requests Greg Kroah-Hartman
2013-06-05 21:34 ` [ 123/127] xen-netback: avoid allocating variable size array on stack Greg Kroah-Hartman
2013-06-05 21:34 ` [ 124/127] xen-netfront: reduce gso_max_size to account for max TCP header Greg Kroah-Hartman
2013-06-05 21:34 ` [ 125/127] iwlwifi: mvm: remove P2P_DEVICE support Greg Kroah-Hartman
2013-06-05 21:34 ` [ 126/127] mac80211_hwsim: " Greg Kroah-Hartman
2013-06-05 21:34 ` [ 127/127] xen-netback: better names for thresholds Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130605213226.687151918@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=plr.vincent@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox