From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Mark Lord <mlord@pobox.com>, Jeff Garzik <jgarzik@redhat.com>
Subject: [011/129] sata_mv: fix broken DSM/TRIM support (v2)
Date: Sat, 18 Sep 2010 12:11:49 -0700 [thread overview]
Message-ID: <20100918191258.211958493@clark.site> (raw)
In-Reply-To: <20100918191317.GA11386@kroah.com>
2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mark Lord <kernel@teksavvy.com>
commit 44b733809a5aba7f6b15a548d31a56d25bf3851c upstream.
Fix DSM/TRIM commands in sata_mv (v2).
These need to be issued using old-school "BM DMA",
rather than via the EDMA host queue.
Since the chips don't have proper BM DMA status,
we need to be more careful with setting the ATA_DMA_INTR bit,
since DSM/TRIM often has a long delay between "DMA complete"
and "command complete".
GEN_I chips don't have BM DMA, so no TRIM for them.
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/ata/sata_mv.c | 44 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 37 insertions(+), 7 deletions(-)
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1898,19 +1898,25 @@ static void mv_bmdma_start(struct ata_qu
* LOCKING:
* Inherited from caller.
*/
-static void mv_bmdma_stop(struct ata_queued_cmd *qc)
+static void mv_bmdma_stop_ap(struct ata_port *ap)
{
- struct ata_port *ap = qc->ap;
void __iomem *port_mmio = mv_ap_base(ap);
u32 cmd;
/* clear start/stop bit */
cmd = readl(port_mmio + BMDMA_CMD);
- cmd &= ~ATA_DMA_START;
- writelfl(cmd, port_mmio + BMDMA_CMD);
+ if (cmd & ATA_DMA_START) {
+ cmd &= ~ATA_DMA_START;
+ writelfl(cmd, port_mmio + BMDMA_CMD);
- /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
- ata_sff_dma_pause(ap);
+ /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
+ ata_sff_dma_pause(ap);
+ }
+}
+
+static void mv_bmdma_stop(struct ata_queued_cmd *qc)
+{
+ mv_bmdma_stop_ap(qc->ap);
}
/**
@@ -1934,8 +1940,21 @@ static u8 mv_bmdma_status(struct ata_por
reg = readl(port_mmio + BMDMA_STATUS);
if (reg & ATA_DMA_ACTIVE)
status = ATA_DMA_ACTIVE;
- else
+ else if (reg & ATA_DMA_ERR)
status = (reg & ATA_DMA_ERR) | ATA_DMA_INTR;
+ else {
+ /*
+ * Just because DMA_ACTIVE is 0 (DMA completed),
+ * this does _not_ mean the device is "done".
+ * So we should not yet be signalling ATA_DMA_INTR
+ * in some cases. Eg. DSM/TRIM, and perhaps others.
+ */
+ mv_bmdma_stop_ap(ap);
+ if (ioread8(ap->ioaddr.altstatus_addr) & ATA_BUSY)
+ status = 0;
+ else
+ status = ATA_DMA_INTR;
+ }
return status;
}
@@ -1995,6 +2014,9 @@ static void mv_qc_prep(struct ata_queued
switch (tf->protocol) {
case ATA_PROT_DMA:
+ if (tf->command == ATA_CMD_DSM)
+ return;
+ /* fall-thru */
case ATA_PROT_NCQ:
break; /* continue below */
case ATA_PROT_PIO:
@@ -2094,6 +2116,8 @@ static void mv_qc_prep_iie(struct ata_qu
if ((tf->protocol != ATA_PROT_DMA) &&
(tf->protocol != ATA_PROT_NCQ))
return;
+ if (tf->command == ATA_CMD_DSM)
+ return; /* use bmdma for this */
/* Fill in Gen IIE command request block */
if (!(tf->flags & ATA_TFLAG_WRITE))
@@ -2289,6 +2313,12 @@ static unsigned int mv_qc_issue(struct a
switch (qc->tf.protocol) {
case ATA_PROT_DMA:
+ if (qc->tf.command == ATA_CMD_DSM) {
+ if (!ap->ops->bmdma_setup) /* no bmdma on GEN_I */
+ return AC_ERR_OTHER;
+ break; /* use bmdma for this */
+ }
+ /* fall thru */
case ATA_PROT_NCQ:
mv_start_edma(ap, port_mmio, pp, qc->tf.protocol);
pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK;
next prev parent reply other threads:[~2010-09-18 19:39 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 19:13 [000/129] 2.6.35.5 -stable review Greg KH
2010-09-18 19:11 ` [001/129] hwmon: (ads7871) Fix ads7871_probe error paths Greg KH
2010-09-18 19:11 ` [002/129] hwmon: (k8temp) Differentiate between AM2 and ASB1 Greg KH
2010-09-18 19:11 ` [003/129] xen: handle events as edge-triggered Greg KH
2010-09-18 19:11 ` [004/129] xen: use percpu interrupts for IPIs and VIRQs Greg KH
2010-09-18 19:11 ` [005/129] xfs: fix untrusted inode number lookup Greg KH
2010-09-18 19:11 ` [006/129] xfs: ensure we mark all inodes in a freed cluster XFS_ISTALE Greg KH
2010-09-18 19:11 ` [007/129] ALSA: hda - Add Sony VAIO quirk for ALC269 Greg KH
2010-09-18 19:11 ` [008/129] ALSA: HDA: Use model=auto for LG R510 Greg KH
2010-09-18 19:11 ` [009/129] ALSA: hda - Rename iMic to Int Mic on Lenovo NB0763 Greg KH
2010-09-18 19:11 ` [010/129] libata-sff: remove harmful BUG_ON from ata_bmdma_qc_issue Greg KH
2010-09-18 19:11 ` Greg KH [this message]
2010-09-18 19:11 ` [012/129] pata_cmd64x: revert commit d62f5576 Greg KH
2010-09-18 19:11 ` [013/129] writeback: write_cache_pages doesnt terminate at nr_to_write <= 0 Greg KH
2010-09-18 19:11 ` [014/129] x86, tsc, sched: Recompute cyc2ns_offsets during resume from sleep states Greg KH
2010-09-18 19:11 ` [015/129] perf, x86, Pentium4: Clear the P4_CCCR_FORCE_OVF flag Greg KH
2010-09-18 19:11 ` [016/129] netfilter: fix CONFIG_COMPAT support Greg KH
2010-09-18 19:11 ` [017/129] PCI: MSI: Remove unsafe and unnecessary hardware access Greg KH
2010-09-18 19:11 ` [018/129] PCI: MSI: Restore read_msi_msg_desc(); add get_cached_msi_msg_desc() Greg KH
2010-09-18 19:11 ` [019/129] direct-io: move aio_complete into ->end_io Greg KH
2010-09-18 19:11 ` [020/129] ext4: move aio completion after unwritten extent conversion Greg KH
2010-09-18 19:11 ` [021/129] xfs: " Greg KH
2010-09-18 19:12 ` [022/129] Revert "Input: appletouch - fix integer overflow issue" Greg KH
2010-09-18 19:12 ` [023/129] ALSA: hda - Handle missing NID 0x1b on ALC259 codec Greg KH
2010-09-18 19:12 ` [024/129] ALSA: hda - Handle pin NID 0x1a on ALC259/269 Greg KH
2010-09-18 19:12 ` [025/129] Staging: rt2870sta: Add more device IDs from vendor drivers Greg KH
2010-09-18 19:12 ` [026/129] staging: hv: Fix missing functions for net_device_ops Greg KH
2010-09-18 19:12 ` [027/129] staging: hv: Fixed bounce kmap problem by using correct index Greg KH
2010-09-18 19:12 ` [028/129] staging: hv: Fixed the value of the 64bit-hole inside ring buffer Greg KH
2010-09-18 19:12 ` [029/129] staging: hv: Increased storvsc ringbuffer and max_io_requests Greg KH
2010-09-18 19:12 ` [030/129] staging: hv: Fixed lockup problem with bounce_buffer scatter list Greg KH
2010-09-18 19:12 ` [031/129] fuse: flush background queue on connection close Greg KH
2010-09-18 19:12 ` [032/129] mac80211: delete work timer Greg KH
2010-09-18 19:12 ` [033/129] ath9k_htc: Fix disconnect issue in HT40 mode Greg KH
2010-09-18 19:12 ` [034/129] ath9k_hw: Fix EEPROM uncompress block reading on AR9003 Greg KH
2010-09-18 19:12 ` [035/129] ath9k_hw: fix parsing of HT40 5 GHz CTLs Greg KH
2010-09-18 19:12 ` [036/129] ocfs2: Fix incorrect checksum validation error Greg KH
2010-09-18 19:12 ` [037/129] serial: bfin_sport_uart: restore transmit frame sync fix Greg KH
2010-09-18 19:12 ` [038/129] USB: ehci-ppc-of: problems in unwind Greg KH
2010-09-18 19:12 ` [039/129] USB: Fix kernel oops with g_ether and Windows Greg KH
2010-09-18 19:12 ` [040/129] USB: CP210x Add new device ID Greg KH
2010-09-18 19:12 ` [041/129] USB: cp210x: Add B&G H3000 link cable ID Greg KH
2010-09-18 19:12 ` [042/129] usb: allow drivers to use allocated bandwidth until unbound Greg KH
2010-09-18 19:12 ` [043/129] USB: ftdi_sio: Added custom PIDs for ChamSys products Greg KH
2010-09-18 19:12 ` [044/129] usb: serial: mos7840: Add USB ID to support the B&B Electronics USOPTL4-2P Greg KH
2010-09-18 19:12 ` [045/129] usb: serial: mos7840: Add USB IDs to support more B&B USB/RS485 converters Greg KH
2010-09-18 19:12 ` [046/129] ima: always maintain counters Greg KH
2010-09-18 19:12 ` [047/129] USB: cxacru: Use a bulk/int URB to access the command endpoint Greg KH
2010-09-18 19:12 ` [048/129] USB: cdc-acm: Adding second ACM channel support for various Nokia and one Samsung phones Greg KH
2010-09-18 19:12 ` [049/129] USB: cdc-acm: Add pseudo modem without AT command capabilities Greg KH
2010-09-18 19:12 ` [050/129] USB: cdc-acm: Fixing crash when ACM probing interfaces with no endpoint descriptors Greg KH
2010-09-18 19:12 ` [051/129] ALSA: hda - Add a new hp-laptop model for Conexant 5066, tested on HP G60 Greg KH
2010-09-18 19:12 ` [052/129] ALSA: usb-audio: fix detection of vendor-specific device protocol settings Greg KH
2010-09-18 19:12 ` [053/129] ALSA: virtuoso: work around missing reset in the Xonar DS Windows driver Greg KH
2010-09-18 19:12 ` [054/129] ALSA: virtuoso: fix setting of Xonar DS line-in/mic-in controls Greg KH
2010-09-18 19:12 ` [055/129] ALSA: seq/oss - Fix double-free at error path of snd_seq_oss_open() Greg KH
2010-09-18 19:12 ` [056/129] ALSA: usb - Release capture substream URBs properly Greg KH
2010-09-18 19:12 ` [057/129] ALSA: hda - Add quirk for Lenovo T400s Greg KH
2010-09-18 19:12 ` [058/129] ALSA: hda - Add errata initverb sequence for CS42xx codecs Greg KH
2010-09-18 19:12 ` [059/129] ALSA: hda - Fix wrong HP pin detection in snd_hda_parse_pin_def_config() Greg KH
2010-09-18 19:12 ` [060/129] ALSA: usb-audio: Assume first control interface is for audio Greg KH
2010-09-18 19:12 ` [061/129] ALSA: hda - patch_nvhdmi.c: Add missing codec IDs, unify names Greg KH
2010-09-18 19:12 ` [062/129] swap: prevent reuse during hibernation Greg KH
2010-09-18 19:12 ` [063/129] swap: discard while swapping only if SWAP_FLAG_DISCARD Greg KH
2010-09-18 19:12 ` [064/129] swap: do not send discards as barriers Greg KH
2010-09-18 19:12 ` [065/129] sysfs: checking for NULL instead of ERR_PTR Greg KH
2010-09-18 19:12 ` [066/129] oprofile: fix crash when accessing freed task structs Greg KH
2010-09-18 19:12 ` [067/129] oprofile, x86: fix init_sysfs error handling Greg KH
2010-09-18 19:12 ` [068/129] oprofile, x86: fix init_sysfs() function stub Greg KH
2010-09-18 19:12 ` [069/129] HID: Set Report ID properly for Output reports on the Control endpoint Greg KH
2010-09-18 19:12 ` [070/129] libata: skip EH autopsy and recovery during suspend Greg KH
2010-09-18 19:12 ` [071/129] libata,pata_via: revert ata_wait_idle() removal from ata_sff/via_tf_load() Greg KH
2010-09-18 19:12 ` [072/129] ahci: fix hang on failed softreset Greg KH
2010-09-18 19:12 ` [073/129] O_DIRECT: fix the splitting up of contiguous I/O Greg KH
2010-09-18 19:12 ` [074/129] tracing: Fix a race in function profile Greg KH
2010-09-18 19:12 ` [075/129] tracing: Do not allow llseek to set_ftrace_filter Greg KH
2010-09-18 19:12 ` [076/129] tracing: t_start: reset FTRACE_ITER_HASH in case of seek/pread Greg KH
2010-09-18 19:12 ` [077/129] irda: off by one Greg KH
2010-09-18 19:12 ` [078/129] hp_accel: add quirks for HP ProBook 532x and HP Mini 5102 Greg KH
2010-09-18 19:12 ` [079/129] gcov: fix null-pointer dereference for certain module types Greg KH
2010-09-18 19:12 ` [080/129] tmio_mmc: dont clear unhandled pending interrupts Greg KH
2010-09-18 19:12 ` [081/129] mmc: fix the use of kunmap_atomic() in tmio_mmc.h Greg KH
2010-09-18 19:13 ` [082/129] mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume Greg KH
2010-09-18 19:13 ` [083/129] mmc: build fix: mmc_pm_notify is only available with CONFIG_PM=y Greg KH
2010-09-18 19:13 ` [084/129] statfs() gives ESTALE error Greg KH
2010-09-18 19:13 ` [085/129] minix: fix regression in minix_mkdir() Greg KH
2010-09-18 19:13 ` [086/129] bounce: call flush_dcache_page() after bounce_copy_vec() Greg KH
2010-09-18 19:13 ` [087/129] mm: compaction: handle active and inactive fairly in too_many_isolated Greg KH
2010-09-18 19:13 ` [088/129] kernel/groups.c: fix integer overflow in groups_search Greg KH
2010-09-18 19:13 ` [089/129] binfmt_misc: fix binfmt_misc priority Greg KH
2010-09-18 19:13 ` [090/129] Input: i8042 - fix device removal on unload Greg KH
2010-09-18 19:13 ` [091/129] Input: i8042 - reset keyboard controller wehen resuming from S2R Greg KH
2010-09-18 19:13 ` [092/129] memory hotplug: fix next block calculation in is_removable Greg KH
2010-09-18 19:13 ` [093/129] perf: Initialize callchains rootss childen hits Greg KH
2010-09-18 19:13 ` [094/129] powerpc/perf_event: Reduce latency of calling perf_event_do_pending Greg KH
2010-09-18 19:13 ` [095/129] p54: fix tx feedback status flag check Greg KH
2010-09-18 19:13 ` [096/129] ath5k: check return value of ieee80211_get_tx_rate Greg KH
2010-09-18 19:13 ` [097/129] wireless extensions: fix kernel heap content leak Greg KH
2010-09-18 19:13 ` [098/129] RDMA/cxgb3: Dont exceed the max HW CQ depth Greg KH
2010-09-18 19:13 ` [099/129] x86, tsc: Fix a preemption leak in restore_sched_clock_state() Greg KH
2010-09-18 19:13 ` [100/129] x86-64, compat: Test %rax for the syscall number, not %eax Greg KH
2010-09-18 19:13 ` [101/129] compat: Make compat_alloc_user_space() incorporate the access_ok() Greg KH
2010-09-18 19:13 ` [102/129] x86-64, compat: Retruncate rax after ia32 syscall entry tracing Greg KH
2010-09-18 19:13 ` [103/129] ALSA: HDA: Enable internal speaker on Dell M101z Greg KH
2010-09-18 19:13 ` [104/129] x86: hpet: Work around hardware stupidity Greg KH
2010-09-18 19:13 ` [105/129] arm: fix really nasty sigreturn bug Greg KH
2010-09-18 19:13 ` [106/129] hwmon: (emc1403) Remove unnecessary hwmon_device_unregister Greg KH
2010-09-18 19:13 ` [107/129] hwmon: (f75375s) Shift control mode to the correct bit position Greg KH
2010-09-18 19:13 ` [108/129] hwmon: (f75375s) Do not overwrite values read from registers Greg KH
2010-09-18 19:13 ` [109/129] apm_power: Add missing break statement Greg KH
2010-09-18 19:13 ` [110/129] cifs: fix potential double put of TCP session reference Greg KH
2010-09-18 19:13 ` [111/129] NFS: Fix a typo in nfs_sockaddr_match_ipaddr6 Greg KH
2010-09-18 19:13 ` [112/129] SUNRPC: Fix race corrupting rpc upcall Greg KH
2010-09-18 19:13 ` [113/129] agp/intel: Promote warning about failure to setup flush to error Greg KH
2010-09-18 19:13 ` [114/129] drm/radeon/kms: fix a regression on r7xx AGP due to the HDP flush fix Greg KH
2010-09-18 19:13 ` [115/129] drm/i915: Enable MI_FLUSH on Sandybridge Greg KH
2010-09-18 19:13 ` [116/129] drm/radeon/kms: force legacy pll algo for RV515 LVDS Greg KH
2010-09-18 19:13 ` [117/129] drm/radeon/kms: force legacy pll algo for RV620 LVDS Greg KH
2010-09-18 19:13 ` [118/129] drm/radeon/kms: properly set crtc high base on r7xx Greg KH
2010-09-18 19:13 ` [119/129] drm/radeon/kms/evergreen: fix gpu hangs in userspace accel code Greg KH
2010-09-18 19:13 ` [120/129] drm/radeon/kms/evergreen: fix backend setup Greg KH
2010-09-18 19:13 ` [121/129] i915: return -EFAULT if copy_to_user fails Greg KH
2010-09-18 19:13 ` [122/129] i915_gem: " Greg KH
2010-09-18 19:13 ` [123/129] drm/i915/dp: Really try 5 times before giving up Greg KH
2010-09-18 19:13 ` [124/129] drm/i915: Allocate the PCI resource for the MCHBAR Greg KH
2010-09-18 19:13 ` [125/129] drm/i915: overlay on gen2 cant address above 1G Greg KH
2010-09-18 19:13 ` [126/129] drm/i915: Prevent double dpms on Greg KH
2010-09-18 19:13 ` [127/129] drm/i915: dont enable self-refresh on Ironlake Greg KH
2010-09-18 19:13 ` [128/129] Revert "drm/i915: Allow LVDS on pipe A on gen4+" Greg KH
2010-09-18 19:13 ` [129/129] drm: Only decouple the old_fb from the crtc is we call mode_set* Greg KH
2010-09-18 21:08 ` [000/129] 2.6.35.5 -stable review Marcin Slusarz
2010-09-19 4:04 ` Greg KH
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=20100918191258.211958493@clark.site \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jgarzik@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mlord@pobox.com \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®