From: Mikko Rapeli <mikko.rapeli@iki.fi>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-ide@vger.kernel.org
Subject: [PATCH] ST340823A, HPA and libata
Date: Sun, 5 Aug 2007 22:06:16 +0300 [thread overview]
Message-ID: <20070805190616.GA1932@nalle> (raw)
In-Reply-To: <200708030135.16910.bzolnier@gmail.com>
Hello again,
Had some time to play with libata and this ST340823A drive. I had some
problems with 2.6.23-rc2 setup failing at early boot so I kept on
going with 2.6.22.1.
First, vanilla 2.6.22.1 which works as HPA is not disabled by default:
http://bugzilla.kernel.org/attachment.cgi?id=12251&action=view
$ egrep "Host Prote|current size|native size|sdb" dmesg_ide_bug_26221_pata.txt
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
sd 1:0:1:0: [sdb] 78165360 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
sd 1:0:1:0: [sdb] 78165360 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
sdb: sdb1 sdb2 sdb3
sd 1:0:1:0: [sdb] Attached SCSI disk
Then I went to disabled HPA by default. Actually the
drive and filesystem work altough boot looks nasty:
http://bugzilla.kernel.org/attachment.cgi?id=12252&action=view
$ egrep "Host Prote|current size|native size|sdb"
dmesg_ide_bug_26221_pata_hpa.txt
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdb: sdb1 sdb2 sdb3
sd 1:0:1:0: [sdb] Attached SCSI disk
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
Buffer I/O error on device sdb, logical block 78165360
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: native size increased to 78165361 sectors
sd 1:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 1:0:1:0: [sdb] Sense Key : Aborted Command [current] [descriptor]
sd 1:0:1:0: [sdb] Add. Sense: Recorded entity not found
end_request: I/O error, dev sdb, sector 78165360
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 1:0:1:0: [sdb] 78165361 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Tried to hack a blacklist, which gives the log:
http://bugzilla.kernel.org/attachment.cgi?id=12254&action=view
$ egrep "Host Prote|current size|native size|sdb"
dmesg_ide_bug_26221_pata_hpa_fix.txt
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
ata2.01: Host Protected Area detected:
current size: 78165360 sectors
native size: 78165361 sectors
sd 1:0:1:0: [sdb] 78165360 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
sd 1:0:1:0: [sdb] 78165360 512-byte hardware sectors (40021 MB)
sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
sdb: sdb1 sdb2 sdb3
sd 1:0:1:0: [sdb] Attached SCSI disk
The patch is simply:
diff -X linux-2.6.22.1/Documentation/exception.txt -rup linux-2.6.22.1.orig/drivers/ata/libata-core.c linux-2.6.22.1/drivers/ata/libata-core.c
--- linux-2.6.22.1.orig/drivers/ata/libata-core.c 2007-07-10 21:56:30.000000000 +0300
+++ linux-2.6.22.1/drivers/ata/libata-core.c 2007-08-05 11:38:29.000000000 +0300
@@ -991,7 +991,10 @@ static u64 ata_hpa_resize(struct ata_dev
"\tnative size: %lld sectors\n",
(long long)sectors, (long long)hpa_sectors);
- if (ata_ignore_hpa) {
+ if (ata_device_blacklisted(dev) & ATA_HORKAGE_HPA) {
+ ata_dev_printk(dev, KERN_INFO,
+ "Device blacklisted, ignoring HPA.\n");
+ } else if (ata_ignore_hpa) {
if (ata_id_has_lba48(dev->id))
hpa_sectors = ata_set_native_max_address_ext(dev, hpa_sectors);
else
@@ -3803,6 +3806,10 @@ static const struct ata_blacklist_entry
/* Devices with NCQ limits */
+ /* Devices which fail when HPA is disable, e.g. READ_NATIVE_MAX_ADDRESS
+ returns maximum size instead of maximum addressable sector. */
+ { "ST340823A", NULL, ATA_HORKAGE_HPA },
+
/* End Marker */
{ }
};
diff -X linux-2.6.22.1/Documentation/exception.txt -rup linux-2.6.22.1.orig/include/linux/libata.h linux-2.6.22.1/include/linux/libata.h
--- linux-2.6.22.1.orig/include/linux/libata.h 2007-07-10 21:56:30.000000000 +0300
+++ linux-2.6.22.1/include/linux/libata.h 2007-08-05 00:43:59.000000000 +0300
@@ -298,6 +298,7 @@ enum {
ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
+ ATA_HORKAGE_HPA = (1 << 4), /* Don't disable HPA */
};
enum hsm_task_states {
next prev parent reply other threads:[~2007-08-05 19:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-01 9:29 ST340823A disk size issue Mikko Rapeli
2007-08-01 13:05 ` Alan Cox
2007-08-02 12:35 ` Mikko Rapeli
2007-08-01 20:34 ` Bartlomiej Zolnierkiewicz
2007-08-01 21:50 ` Mikko Rapeli
2007-08-01 22:19 ` Bartlomiej Zolnierkiewicz
2007-08-01 22:32 ` Alan Cox
2007-08-01 23:17 ` Bartlomiej Zolnierkiewicz
2007-08-02 11:33 ` Alan Cox
2007-08-02 12:27 ` Bartlomiej Zolnierkiewicz
2007-08-02 13:09 ` Alan Cox
2007-08-02 20:03 ` Mikko Rapeli
2007-08-02 20:42 ` Alan Cox
2007-08-02 22:34 ` Bartlomiej Zolnierkiewicz
2007-08-02 23:11 ` Mikko Rapeli
2007-08-02 23:35 ` Bartlomiej Zolnierkiewicz
2007-08-05 19:06 ` Mikko Rapeli [this message]
2007-08-05 19:32 ` [PATCH] ST340823A, HPA and libata Alan Cox
2007-08-08 13:25 ` Alan Cox
2007-08-15 13:56 ` Mikko Rapeli
2007-09-20 21:37 ` Jeff Garzik
2007-08-02 0:33 ` ST340823A disk size issue Bartlomiej Zolnierkiewicz
2007-08-02 12:17 ` Sergei Shtylyov
2007-08-02 12:38 ` Sergei Shtylyov
2007-08-01 22:25 ` Alan Cox
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=20070805190616.GA1932@nalle \
--to=mikko.rapeli@iki.fi \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.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;
as well as URLs for NNTP newsgroup(s).