libata fixes
PATCH 1/1 libata fixes
Notes:
1) 1.5TB drive fix from Roland
2) Tejun's sata_via brings a non-working via configuration thanks to a new facility also being used in recent (ICH9/10) ata_piix.
Change is longer than one might like, but it accurately describes the hardware now, the previous stuff wasn't working, and the newly added support code shouldn't touch non-broken VIA controllers.
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus
to receive the following updates:
drivers/ata/ata_piix.c | 1 - drivers/ata/libata-core.c | 11 +++- drivers/ata/sata_via.c | 155 +++++++++++++++++++++++++++++++++++++++++---- include/linux/libata.h | 1 + 4 files changed, 152 insertions(+), 16 deletions(-)
Jens Axboe (1):
libata: add whitelist for devices with known good pata-sata bridges
Randy Dunlap (1):
ATA: remove excess kernel-doc notation
Roland Dreier (1):
libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127
Tejun Heo (1):
sata_via: fix support for 5287
drivers/ata/ata_piix.c +0 -1
@@ -738,7 +738,6 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev)* do_pata_set_dmamode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Drive in question -* @udma: udma mode, 0 - 6 * @isich: set if the chip is an ICH device * * Set UDMA mode for device, in host controller PCI config space.
drivers/ata/libata-core.c +8 -3
@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) sectors |= ((u64)(tf->hob_lbah &0xff )) <<40 ; sectors |= ((u64)(tf->hob_lbam &0xff )) <<32 ; - sectors |= (tf->hob_lbal &0xff ) <<24 ; + sectors |= ((u64)(tf->hob_lbal &0xff )) <<24 ; sectors |= (tf->lbah &0xff ) <<16 ; sectors |= (tf->lbam &0xff ) <<8 ; sectors |= (tf->lbal &0xff );
@@ -1602,7 +1602,6 @@ unsigned long ata_id_xfermask(const u16 *id)/** * ata_pio_queue_task - Queue port_task * @ap: The ata_port to queue port_task for -* @fn: workqueue function to be scheduled * @data: data for @fn to use * @delay: delay time in msecs for workqueue function *
@@ -2159,6 +2158,10 @@ retry:static inline u8 ata_dev_knobble (struct ata_device *dev) {struct ata_port *ap = dev->link->ap; + +if (ata_dev_blacklisted (dev) &ATA_HORKAGE_BRIDGE_OK ) +return 0 ; +return ((ap->cbl ==ATA_CBL_SATA ) && (!ata_id_is_sata (dev->id))); }
@@ -4063,6 +4066,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, }, { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, }, + /* Devices that do not need bridging limits applied */ + { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, + /* End Marker */ { } };
@@ -4648,7 +4654,6 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc)/** * ata_qc_complete - Complete an active ATA command * @qc: Command to complete -* @err_mask: ATA Status register contents * * Indicate to the mid and upper layers that an ATA * command has completed, with either an ok or not-ok status.
drivers/ata/sata_via.c +143 -12
218 lines not on this page · raw message
include/linux/libata.h +1 -0
@@ -372,6 +372,7 @@ enum {ATA_HORKAGE_IPM = (1 <<7 ),/* Link PM problems */ ATA_HORKAGE_IVB = (1 <<8 ),/* cbl det validity bit bugs */ ATA_HORKAGE_STUCK_ERR = (1 <<9 ),/* stuck ERR on next PACKET */ + ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits *//* DMA mask for user DMA control: User visible values; DO NOT renumber */
Quoted 36 lines · Jeff Garzik
Notes:
1) 1.5TB drive fix from Roland
2) Tejun's
sata_viabrings a non-working via configuration thanks to a new facility also being used in recent (ICH9/10)ata_piix.Change is longer than one might like, but it accurately describes the hardware now, the previous stuff wasn't working, and the newly added support code shouldn't touch non-broken VIA controllers.
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus
to receive the following updates:
drivers/ata/ata_piix.c | 1 - drivers/ata/libata-core.c | 11 +++- drivers/ata/sata_via.c | 155 +++++++++++++++++++++++++++++++++++++++++---- include/linux/libata.h | 1 + 4 files changed, 152 insertions(+), 16 deletions(-)Jens Axboe (1):
libata: add whitelist for devices with known good pata-sata bridgesRandy Dunlap (1):
ATA: remove excess kernel-doc notationRoland Dreier (1):
libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127Tejun Heo (1):
sata_via: fix support for 5287
<snip>
drivers/ata/libata-core.c u64 ata_tf_to_lba48(const struct ata_taskfile *tf) · line 1274
Quoted 13 lines
drivers/ata/libata-core.c +1
-1@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) sectors |= ((u64)(tf->hob_lbah &0xff )) <<40 ; sectors |= ((u64)(tf->hob_lbam &0xff )) <<32 ; - sectors |= (tf->hob_lbal &0xff ) <<24 ; + sectors |= ((u64)(tf->hob_lbal &0xff )) <<24 ; sectors |= (tf->lbah &0xff ) <<16 ; sectors |= (tf->lbam &0xff ) <<8 ; sectors |= (tf->lbal &0xff );
<snip>
That looks really serious.
What happens with all previous / stable kernels when connecting up a 1.5TB drive and the user tries to use the last portion of the drive?
Greg
Signature · 9 lines
Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com
Quoted 53 lines · Greg Freemyer
Quoted 35 lines · Jeff Garzik
Notes:
1) 1.5TB drive fix from Roland
2) Tejun's
sata_viabrings a non-working via configuration thanks to a new facility also being used in recent (ICH9/10)ata_piix.Change is longer than one might like, but it accurately describes the hardware now, the previous stuff wasn't working, and the newly added support code shouldn't touch non-broken VIA controllers.
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus
to receive the following updates:
drivers/ata/ata_piix.c | 1 - drivers/ata/libata-core.c | 11 +++- drivers/ata/sata_via.c | 155 +++++++++++++++++++++++++++++++++++++++++---- include/linux/libata.h | 1 + 4 files changed, 152 insertions(+), 16 deletions(-)Jens Axboe (1):
libata: add whitelist for devices with known good pata-sata bridgesRandy Dunlap (1):
ATA: remove excess kernel-doc notationRoland Dreier (1):
libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127Tejun Heo (1):
sata_via: fix support for 5287<snip>
Quoted 13 lines
drivers/ata/libata-core.c +1
-1@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) sectors |= ((u64)(tf->hob_lbah &0xff )) <<40 ; sectors |= ((u64)(tf->hob_lbam &0xff )) <<32 ; - sectors |= (tf->hob_lbal &0xff ) <<24 ; + sectors |= ((u64)(tf->hob_lbal &0xff )) <<24 ; sectors |= (tf->lbah &0xff ) <<16 ; sectors |= (tf->lbam &0xff ) <<8 ; sectors |= (tf->lbal &0xff );<snip>
Quoted 4 lines
That looks really serious.
What happens with all previous / stable kernels when connecting up a 1.5TB drive and the user tries to use the last portion of the drive?
tf-to-lba48 is a far less common operation, generally used for error reporting (and in Host-Protected Area code as well, it appears).
Jeff
Quoted 62 lines · Jeff Garzik
Quoted 61 lines · Greg Freemyer
Quoted 38 lines · Jeff Garzik
Notes:
1) 1.5TB drive fix from Roland
2) Tejun's
sata_viabrings a non-working via configuration thanks to a new facility also being used in recent (ICH9/10)ata_piix.Change is longer than one might like, but it accurately describes the hardware now, the previous stuff wasn't working, and the newly added support code shouldn't touch non-broken VIA controllers.
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus
to receive the following updates:
drivers/ata/ata_piix.c | 1 - drivers/ata/libata-core.c | 11 +++- drivers/ata/sata_via.c | 155 +++++++++++++++++++++++++++++++++++++++++---- include/linux/libata.h | 1 + 4 files changed, 152 insertions(+), 16 deletions(-)Jens Axboe (1):
libata: add whitelist for devices with known good pata-sata bridgesRandy Dunlap (1):
ATA: remove excess kernel-doc notationRoland Dreier (1):
libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127Tejun Heo (1):
sata_via: fix support for 5287<snip>
drivers/ata/libata-core.c u64 ata_tf_to_lba48(const struct ata_taskfile *tf) · line 1274
Quoted 13 lines
drivers/ata/libata-core.c +1
-1@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) sectors |= ((u64)(tf->hob_lbah &0xff )) <<40 ; sectors |= ((u64)(tf->hob_lbam &0xff )) <<32 ; - sectors |= (tf->hob_lbal &0xff ) <<24 ; + sectors |= ((u64)(tf->hob_lbal &0xff )) <<24 ; sectors |= (tf->lbah &0xff ) <<16 ; sectors |= (tf->lbam &0xff ) <<8 ; sectors |= (tf->lbal &0xff );<snip>
That looks really serious.
Quoted 7 lines
Quoted 2 lines
What happens with all previous / stable kernels when connecting up a 1.5TB drive and the user tries to use the last portion of the drive?
tf-to-lba48 is a far less common operation, generally used for error reporting (and in Host-Protected Area code as well, it appears).
Jeff
So are you saying it is not on any data read / write paths?
Or that it is only on rarely used data read/write paths?
Because if this is on a data read/write path at all, it looks like it could cause major data corruption with 1.5 TB drives (or larger).
Greg
Signature · 9 lines
Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com
Quoted 64 lines · Greg Freemyer
Quoted 63 lines · Jeff Garzik
Quoted 55 lines · Greg Freemyer
Quoted 37 lines · Jeff Garzik
Notes:
1) 1.5TB drive fix from Roland
2) Tejun's
sata_viabrings a non-working via configuration thanks to a new facility also being used in recent (ICH9/10)ata_piix.Change is longer than one might like, but it accurately describes the hardware now, the previous stuff wasn't working, and the newly added support code shouldn't touch non-broken VIA controllers.
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus
to receive the following updates:
drivers/ata/ata_piix.c | 1 - drivers/ata/libata-core.c | 11 +++- drivers/ata/sata_via.c | 155 +++++++++++++++++++++++++++++++++++++++++---- include/linux/libata.h | 1 + 4 files changed, 152 insertions(+), 16 deletions(-)Jens Axboe (1):
libata: add whitelist for devices with known good pata-sata bridgesRandy Dunlap (1):
ATA: remove excess kernel-doc notationRoland Dreier (1):
libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127Tejun Heo (1):
sata_via: fix support for 5287<snip>
Quoted 13 lines
drivers/ata/libata-core.c +1
-1@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) sectors |= ((u64)(tf->hob_lbah &0xff )) <<40 ; sectors |= ((u64)(tf->hob_lbam &0xff )) <<32 ; - sectors |= (tf->hob_lbal &0xff ) <<24 ; + sectors |= ((u64)(tf->hob_lbal &0xff )) <<24 ; sectors |= (tf->lbah &0xff ) <<16 ; sectors |= (tf->lbam &0xff ) <<8 ; sectors |= (tf->lbal &0xff );<snip>
Quoted 4 lines
That looks really serious.
What happens with all previous / stable kernels when connecting up a 1.5TB drive and the user tries to use the last portion of the drive?
tf-to-lba48 is a far less common operation, generally used for error reporting (and in Host-Protected Area code as well, it appears).
Quoted 8 lines
Quoted 1 line
Jeff
So are you saying it is not on any data read / write paths?
Or that it is only on rarely used data read/write paths?
Because if this is on a data read/write path at all, it looks like it could cause major data corruption with 1.5 TB drives (or larger).
..
It's on the initialization path for all lba48 devices which have a configured HPA (Host Protected Area, mostly seen in brand-name consumer-level systems).
The data it generates is then used on subsequent R/W commands. I recommend the fix be backported for earlier kernels.
Cheers