Bug#769135: linux-image-3.2.0-4-amd64: Backport of fix for JMicron USB->SATA bridges
Package: linux-image-3.2.0-4-amd64
Version: 3.2.0
Severity: normal
Tags: patch
Please apply a backport of the JMicron USB->SATA quirk fix to 3.2.0 (wheezy).
Without this fix certain JMicron USB->SATA bridges are not usable in Debian
Wheezy.
The fix already is upstream (git b14bf2d0c0358140041d1c1805a674376964d0e0)
and in Debian's 3.16.0 kernel (Sid/Jessie).
A proposed backport of the fix is attached to this report.
Index: linux-3.2.60/drivers/scsi/sd.c
===================================================================
--- linux-3.2.60.orig/drivers/scsi/sd.c 2014-06-09 14:29:18.000000000 +0200
+++ linux-3.2.60/drivers/scsi/sd.c 2014-08-29 20:25:58.000000000 +0200
@@ -2149,7 +2149,10 @@
}
sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
- if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
+ if (sdp->broken_fua) {
+ sd_printk(KERN_NOTICE, sdkp, "Disabling FUA\n");
+ sdkp->DPOFUA = 0;
+ } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
sd_printk(KERN_NOTICE, sdkp,
"Uses READ/WRITE(6), disabling FUA\n");
sdkp->DPOFUA = 0;
Index: linux-3.2.60/drivers/usb/storage/scsiglue.c
===================================================================
--- linux-3.2.60.orig/drivers/usb/storage/scsiglue.c 2014-06-09 14:29:18.000000000 +0200
+++ linux-3.2.60/drivers/usb/storage/scsiglue.c 2014-08-29 20:33:40.000000000 +0200
@@ -255,6 +255,10 @@
US_FL_SCM_MULT_TARG)) &&
us->protocol == USB_PR_BULK)
us->use_last_sector_hacks = 1;
+
+ /* A few buggy USB-ATA bridges don't understand FUA */
+ if (us->fflags & US_FL_BROKEN_FUA)
+ sdev->broken_fua = 1;
} else {
/* Non-disk-type devices don't need to blacklist any pages
Index: linux-3.2.60/drivers/usb/storage/unusual_devs.h
===================================================================
--- linux-3.2.60.orig/drivers/usb/storage/unusual_devs.h 2014-06-09 14:29:18.000000000 +0200
+++ linux-3.2.60/drivers/usb/storage/unusual_devs.h 2014-08-29 20:25:58.000000000 +0200
@@ -1916,6 +1916,13 @@
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),
+/* Reported by Michael Büsch <m@bues.ch> */
+UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114,
+ "JMicron",
+ "USB to ATA/ATAPI Bridge",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_BROKEN_FUA ),
+
/* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* JMicron responds to USN and several other SCSI ioctls with a
* residue that causes subsequent I/O requests to fail. */
Index: linux-3.2.60/include/linux/usb_usual.h
===================================================================
--- linux-3.2.60.orig/include/linux/usb_usual.h 2014-06-09 14:29:18.000000000 +0200
+++ linux-3.2.60/include/linux/usb_usual.h 2014-08-29 20:28:18.000000000 +0200
@@ -64,7 +64,9 @@
US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
/* cannot handle READ_CAPACITY_16 */ \
US_FLAG(INITIAL_READ10, 0x00100000) \
- /* Initial READ(10) (and others) must be retried */
+ /* Initial READ(10) (and others) must be retried */ \
+ US_FLAG(BROKEN_FUA, 0x01000000) \
+ /* Cannot handle FUA in WRITE or READ CDBs */ \
#define US_FLAG(name, value) US_FL_##name = value ,
enum { US_DO_ALL_FLAGS };
Index: linux-3.2.60/include/scsi/scsi_device.h
===================================================================
--- linux-3.2.60.orig/include/scsi/scsi_device.h 2014-06-09 14:29:18.000000000 +0200
+++ linux-3.2.60/include/scsi/scsi_device.h 2014-08-29 20:32:53.000000000 +0200
@@ -151,6 +151,7 @@
unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
unsigned is_visible:1; /* is the device visible in sysfs */
+ unsigned broken_fua:1; /* Don't set FUA bit */
DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
struct list_head event_list; /* asserted events */
Reply to: