Skip to contentSkip to conversation

ATIIXP and libata

DISCUSSION Bruno Harbulot 4 participants 15 messages Nov 3, 2005 – Jun 20, 2006 libata

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to make a SATA drive work (fast) on an Asus Pundit-R (P4R8L motherboard). I have tried the patch posted on linux-ide by Erwan Velu on 10/10/05. It works and hdparm indicates about 55MB/s (thanks Erwan).

However, Erwan's patch relies on testing the name of the pci device, in drivers/ide/pci/atiixp.c:
if (strncmp(drive->name,"hdc",strlen("hdc")) == 0)

This solution is obviously not very generic. (Perhaps I should say that, at least in my case, hda is a DVD drive on the IDE connector and hdc is the SATA drive). As Bartlomiej Zolnierkiewicz replied to Erwan's message, using libata's ata_id_is_sata would probably be a better route.

I have tried to have a look at this (in kernel 2.6.14), but I think
there is a major problem: atiixp is under ide/pci and doesn't seem to have anything to do with libata and the sata modules under the scsi directory. (Please feel free to correct me, linux-ide something very new to me.) I have added some "printk"s in libata-core.c, in "ata_dev_config", where
it seems that the "ata_dev_knobble" test is made, but it is never called
(even when I make sure that ata_xiip and libata are loaded first in my
initrd image). Would this mean that this IDE/SATA(/PATA?) controller is
not handled my libata at all? Should it be?
(I don't know much about the subject, but I presume that workarounds to
get ata_id_is_sata "to work somehow" from atiixp.c would not be the
right thing to do, even if feasible.)

I have also got another similar problem with this controller, which may or may not be related. This problem is more or less point number 3 of:
<http://www.debian.org/devel/debian-installer/errata>
("SATA driver can block access to CD drive in installations from CD").
When installing this machine, the hard drive and the DVD drive were
"conflicting", so I had to load a much as I could from the install CD
before loading the modules for the disk and subsequently proceeding with a network installation.
Moreover, once the system installed and running, I have not managed to mount a CD after booting from the hard drive. Even after using "hdparm -d 0 /dev/hda", I get errors such as this:
hda: DMA disabled
hda: DMA timeout retry
hda: timeout waiting for DMA
hda: status error: status=0x58 { DriveReady SeekComplete DataRequest }
ide: failed opcode was: unknown
hda: drive not ready for command

Regards,

Bruno.

In case it may help, here are the relevant lines from dmesg:

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
ATIIXP: IDE controller at PCI slot 0000:00:14.1
ACPI: PCI Interrupt 0000:00:14.1[A] -> GSI 16 (level, low) -> IRQ 177
ATIIXP: chipset revision 0
ATIIXP: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0xff00-0xff07, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0xff08-0xff0f, BIOS settings: hdc:DMA, hdd:pio

Probing IDE interface ide0...
hda: HL-DT-ST DVDRAM GSA-4167B, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1...
hdc: Maxtor 6L200S0, ATA DISK drive
ATIIXP: SATA drive detected (hdc) on a IXP200 IDE controller,
skipping cable detection, using ATA-100 transfert rate
ATIIXP: SATA drive detected (hdc) on a IXP200 IDE controller,
skipping cable detection, using ATA-100 transfert rate
ide1 at 0x170-0x177,0x376 on irq 15
Probing IDE interface ide2...
Probing IDE interface ide3...
Probing IDE interface ide4...
Probing IDE interface ide5...
hdc: max request size: 1024KiB
hdc: 398297088 sectors (203928 MB) w/16384KiB Cache, CHS=24792/255/63
hdc: cache flushes supported
/dev/ide/host0/bus1/target0/lun0: p1 p2 p3 p4 < p5 >
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
Adding 1951888k swap on /dev/hdc2. Priority:-1 extents:1 EXT3 FS on hdc3, internal journal
hda: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33) Uniform CD-ROM driver Revision: 3.20

#1 lore raw
Quoted 7 lines · Bruno Harbulot

Hello,

I am trying to make a SATA drive work (fast) on an Asus Pundit-R (P4R8L motherboard). I have tried the patch posted on linux-ide by Erwan Velu on 10/10/05. It works and hdparm indicates about 55MB/s (thanks Erwan).

Glad to see my patch usefull to someone else :b

Quoted 9 lines

However, Erwan's patch relies on testing the name of the pci device, in drivers/ide/pci/atiixp.c:
if (strncmp(drive->name,"hdc",strlen("hdc")) == 0)

This solution is obviously not very generic. (Perhaps I should say that, at least in my case, hda is a DVD drive on the IDE connector and hdc is the SATA drive). As Bartlomiej Zolnierkiewicz replied to Erwan's message, using libata's ata_id_is_sata would probably be a better route.

I've asked the guy from ati about this issue but still no answer.
My main question was "Does the sata port of the atiixp 200 chipset always assigned to hdc or not ?" If yes, my patch is good and generic to this chipset because I'm checking first the pci id of the chipset. If no, we must found a better way isn't it ?

[...]

Quoted 8 lines

I have also got another similar problem with this controller, which may or may not be related. This problem is more or less point number 3 of:
<http://www.debian.org/devel/debian-installer/errata>
("SATA driver can block access to CD drive in installations from CD").
When installing this machine, the hard drive and the DVD drive were
"conflicting", so I had to load a much as I could from the install CD

[...]

Could you please try putting your dvd drive as slave by setting up the jumper on it ? It will be then detected has hdb (my configuration) and should works.

#2 lore raw
Quoted 16 lines · Velu Erwan
Quoted 8 lines · Bruno Harbulot

Hello,

I am trying to make a SATA drive work (fast) on an Asus Pundit-R (P4R8L motherboard).
I have tried the patch posted on linux-ide by Erwan Velu on 10/10/05. It works and hdparm indicates about 55MB/s (thanks Erwan).

Glad to see my patch usefull to someone else :b

Quoted 4 lines

However, Erwan's patch relies on testing the name of the pci device, in drivers/ide/pci/atiixp.c:
if (strncmp(drive->name,"hdc",strlen("hdc")) == 0)

Quoted 8 lines
Quoted 5 lines

This solution is obviously not very generic. (Perhaps I should say that, at least in my case, hda is a DVD drive on the IDE connector and hdc is the SATA drive). As Bartlomiej Zolnierkiewicz replied to Erwan's message, using libata's ata_id_is_sata would probably be a better route.

I've asked the guy from ati about this issue but still no answer. My main question was "Does the sata port of the atiixp 200 chipset always assigned to hdc or not ?"

If the controller is using I/O ports other than legacy ISA ones (0x170 and 0x1f0) and you have other controllers naming will be dependent on order in which you load IDE host drivers. Plus we don't want naming to be hard-coded in the kernel.

Bartlomiej

#4 lore raw
In reply to Bruno Harbulot
Quoted 17 lines · Bruno Harbulot

Hello,

I am trying to make a SATA drive work (fast) on an Asus Pundit-R (P4R8L motherboard).
I have tried the patch posted on linux-ide by Erwan Velu on 10/10/05. It works and hdparm indicates about 55MB/s (thanks Erwan).

However, Erwan's patch relies on testing the name of the pci device, in drivers/ide/pci/atiixp.c:
if (strncmp(drive->name,"hdc",strlen("hdc")) == 0)

This solution is obviously not very generic. (Perhaps I should say that, at least in my case, hda is a DVD drive on the IDE connector and hdc is the SATA drive). As Bartlomiej Zolnierkiewicz replied to Erwan's message, using libata's ata_id_is_sata would probably be a better route.

Quoted 10 lines

I have tried to have a look at this (in kernel 2.6.14), but I think there is a major problem: atiixp is under ide/pci and doesn't seem to have anything to do with libata and the sata modules under the scsi directory. (Please feel free to correct me, linux-ide something very new to me.)
I have added some "printk"s in libata-core.c, in "ata_dev_config", where it seems that the "ata_dev_knobble" test is made, but it is never called (even when I make sure that ata_xiip and libata are loaded first in my initrd image). Would this mean that this IDE/SATA(/PATA?) controller is not handled my libata at all? Should it be?

It is PATA controller and should be handled by IDE driver.

Quoted 3 lines

(I don't know much about the subject, but I presume that workarounds to get ata_id_is_sata "to work somehow" from atiixp.c would not be the right thing to do, even if feasible.)

<linux/ata.h> include is used by both IDE and libata driver, however ata_id_is_sata() shouldn't be used directly in atiixp.c but similar check should be added to eighty_ninty_three() from ide-iops.c.

Bartlomiej

#5 lore raw

Hi,

Quoted 10 lines · --- Bartlomiej Zolnierkiewicz
Quoted 1 line

(I don't know much about the subject, but I presume that

workarounds to

Quoted 2 lines

get ata_id_is_sata "to work somehow" from atiixp.c would not be the right thing to do, even if feasible.)

<linux/ata.h> include is used by both IDE and libata driver, however ata_id_is_sata() shouldn't be used directly in atiixp.c but similar check should be added to eighty_ninty_three() from ide-iops.c.

I had a closer look at the problem, and I've written the patch for ide-iops.c attached to this message. I wasn't sure about using hw_config or ata_id_is_sata to read word 93.
Should other checks be performed? I'm not sure whether there should be a test similar to "(ap->cbl == ATA_CBL_SATA)" mentionned in the patch posted on this list in "[PATCH] libata ATA vs SATA detection and workaround." on 30/09/04.

It seems that using this, checking that the PCI device is an IXP200 (as in Erwan's patch) is not necessary.

Regards,

Bruno.

___________________________________________________________
Does your mail provider give you FREE antivirus protection? Get Yahoo! Mail http://uk.mail.yahoo.com

drivers/ide/ide-iops.c +12 -0
@@ -1,6 +1,10 @@
 /*
+ * linux/drivers/ide/ide-iops.c	Version 0.38	Nov 05, 2005
  * linux/drivers/ide/ide-iops.c	Version 0.37	Mar 05, 2003
  *
+ *  Version 0.38		80pin cable detection for SATA drive
+ *  				([email protected])
+ *  
  *  Copyright (C) 2000-2002	Andre Hedrick <[email protected]>
  *  Copyright (C) 2003		Red Hat <[email protected]>
  *
@@ -601,6 +605,14 @@
  */
 u8 eighty_ninty_three (ide_drive_t *drive)
 {
+	/* On SATA drives, word 93 (i.e. hw_config) should be 0.
+	 * This can be tested with the hw_config or this:
+	   if (ata_id_is_sata((u16*)(drive->id)))
+		return 1;
+	 * (remember to include <linux/ata.h>)
+	 */
+	if (drive->id->hw_config == 0)
+		return 1;
 	if(HWIF(drive)->udma_four == 0)
 		return 0;
 	if (!(drive->id->hw_config & 0x6000))
#3 lore raw
In reply to Velu Erwan
Quoted 3 lines · --- Velu Erwan
Quoted 3 lines

I am trying to make a SATA drive work (fast) on an Asus Pundit-R (P4R8L motherboard).

[...]

Quoted 13 lines
Quoted 4 lines

I have also got another similar problem with this controller, which

may or may not be related. This problem is more or less point

number 3

Quoted 3 lines

of:
<http://www.debian.org/devel/debian-installer/errata>
("SATA driver can block access to CD drive in installations from

CD").

Quoted 2 lines

When installing this machine, the hard drive and the DVD drive were "conflicting", so I had to load a much as I could from the install

CD

Quoted 7 lines

[...]

Could you please try putting your dvd drive as slave by setting up the
jumper on it ? It will be then detected has hdb (my configuration) and
should works.

Indeed, when the DVD drive is configured as slave, it works fine. Cheers!

Bruno.

___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

#14 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines

(I don't know much about the subject, but I presume that workarounds to get ata_id_is_sata "to work somehow" from atiixp.c would not be the right thing to do, even if feasible.)

Quoted 6 lines

<linux/ata.h> include is used by both IDE and libata driver, however ata_id_is_sata() shouldn't be used directly in atiixp.c but similar check should be added to eighty_ninty_three() from ide-iops.c.

Is there any chance to have a fix for this troubles in some recent kernel ?
I don't know how to help to make this fixed upstream. I would like not to have a personnal patch for making my system running.

Erwan,

#6 lore raw
In reply to Bruno Harbulot
Quoted 9 lines · Bruno Harbulot

I had a closer look at the problem, and I've written the patch for ide-iops.c attached to this message. I wasn't sure about using hw_config or ata_id_is_sata to read word 93.
Should other checks be performed? I'm not sure whether there should be a test similar to "(ap->cbl == ATA_CBL_SATA)" mentionned in the patch posted on this list in "[PATCH] libata ATA vs SATA detection and workaround." on 30/09/04.

Bartlomiej, I've tried the latest 2.6.17-rc5 and the atiixp still doesn't works out of the shelf. Bruno's patch sounds to integrate the remarks you made about my crappy initial patch but it is not integrated. I've applied it, and uncommenting its ata_id_is_sata() call.
On my ATIIXP (pundit-R), my performances are good ~55MB/sec. Without this patch I'm sticked at 14MB/sec.

It is possible to apply that patch upstream to fix this issue ? This patch applies to 2.6.17-rc5.

drivers/ide/ide-iops.c 2006-05-31 23:51:53.000000000 +0200 renamed from drivers/ide/ide-iops.c.old 2006-03-20 06:53:29.000000000 +0100 +0 -0
@@ -1,6 +1,10 @@

/*
+ * linux/drivers/ide/ide-iops.c Version 0.38 Nov 05, 2005
* linux/drivers/ide/ide-iops.c Version 0.37 Mar 05, 2003
*
+ * Version 0.38 80pin cable detection for SATA drive
+ * ([email protected])
+ *
* Copyright (C) 2000-2002 Andre Hedrick <[email protected]>
* Copyright (C) 2003 Red Hat <[email protected]>
*
@@ -24,6 +28,7 @@
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/bitops.h>
+#include <linux/ata.h>

#include <asm/byteorder.h>
#include <asm/irq.h>
@@ -595,6 +600,12 @@
*/
u8 eighty_ninty_three (ide_drive_t *drive)
{
+ /* On SATA drives, word 93 (i.e. hw_config) should be 0.
+ * This can be tested with the hw_config or this: */
+ if (ata_id_is_sata((u16*)(drive->id)))
+ return 1;
+ if (drive->id->hw_config == 0)

+        return 1;
    if(HWIF(drive)->udma_four == 0)
        return 0;
    if (!(drive->id->hw_config & 0x6000))
#7 lore raw

Nobody cares about the ATIIXP troubles reported since October ?

I've been trying since a while helping people who knows about clean kernel hacking to solve a bug in ATIIXP but nobody seems to be interested to fix this bug. I'm always trying to help when I can (kernel but other projects too) but I feel quite depressed about the reaction of this list.

This sure, I'm not a kernel hacker but I do my best to help in detecting the trouble/propose a fix/testing but nobody care about it :/

This bugs has been reported since a while (10.10.05) and it still exists, even in the latest RC kernel.

Why should I do to make this bug fixed ?

#8 lore raw

Re: Nobody cares about the ATIIXP troubles reported since October ?

Hi,

I must say I agree with you. I think we've made a modest but successful effort in fixing this problem. I sent the patch to this list ages ago. I'm just not quite sure what to do next...
Would someone guide us towards the next step we should follow to get this into the kernel?

Cheers,

Bruno.

Quoted 7 lines · --- Velu Erwan

I've been trying since a while helping people who knows about clean kernel hacking to solve a bug in ATIIXP but nobody seems to be interested to fix this bug.
I'm always trying to help when I can (kernel but other projects too) but
I feel quite depressed about the reaction of this list.

Quoted 8 lines

This sure, I'm not a kernel hacker but I do my best to help in detecting
the trouble/propose a fix/testing but nobody care about it :/

This bugs has been reported since a while (10.10.05) and it still exists, even in the latest RC kernel.

Why should I do to make this bug fixed ?

Send instant messages to your online friends http://uk.messenger.yahoo.com

#9 lore raw
In reply to Velu Erwan
Quoted 11 lines · On Thu, 01 Jun 2006 00:00:25 +0200 Velu Erwan wrote:
Quoted 9 lines · Bruno Harbulot

I had a closer look at the problem, and I've written the patch for ide-iops.c attached to this message. I wasn't sure about using hw_config or ata_id_is_sata to read word 93.
Should other checks be performed? I'm not sure whether there should be a test similar to "(ap->cbl == ATA_CBL_SATA)" mentionned in the patch posted on this list in "[PATCH] libata ATA vs SATA detection and workaround." on 30/09/04.

Quoted 7 lines

Bartlomiej, I've tried the latest 2.6.17-rc5 and the atiixp still doesn't works out of the shelf.
Bruno's patch sounds to integrate the remarks you made about my crappy initial patch but it is not integrated.
I've applied it, and uncommenting its ata_id_is_sata() call. On my ATIIXP (pundit-R), my performances are good ~55MB/sec. Without this patch I'm sticked at 14MB/sec.

Where's Bart lately ??

Quoted 27 lines

It is possible to apply that patch upstream to fix this issue ? This patch applies to 2.6.17-rc5.

--- linux-2.6.17-rc5.20mdk/drivers/ide/ide-iops.c.old 2006-03-20
06:53:29.000000000 +0100
+++ linux-2.6.17-rc5.20mdk/drivers/ide/ide-iops.c 2006-05-31
23:51:53.000000000 +0200

(quoted diff) +5 -0
@@ -1,6 +1,10 @@
 /*
+ * linux/drivers/ide/ide-iops.c    Version 0.38    Nov 05, 2005
  * linux/drivers/ide/ide-iops.c    Version 0.37    Mar 05, 2003
  *
+ *  Version 0.38        80pin cable detection for SATA drive
+ *                  ([email protected])
+ * 
  *  Copyright (C) 2000-2002    Andre Hedrick <[email protected]>
  *  Copyright (C) 2003        Red Hat <[email protected]>
  *
@@ -24,6 +28,7 @@
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/bitops.h>
+#include <linux/ata.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>

Review line 608

Quoted 9 lines
(quoted diff) +6 -0
@@ -595,6 +600,12 @@
  */
 u8 eighty_ninty_three (ide_drive_t *drive)
 {
+    /* On SATA drives, word 93 (i.e. hw_config) should be 0.
+     * This can be tested with the hw_config or this: */
+    if (ata_id_is_sata((u16*)(drive->id)))
+        return 1;
+    if (drive->id->hw_config == 0)
+        return 1;

You don't need both of the if-tests above. In the previous patch revision (from Bruno), the first one was inside the comment block.

Review line 611

Quoted 3 lines
(quoted diff) +0 -0
     if(HWIF(drive)->udma_four == 0)
         return 0;
     if (!(drive->id->hw_config & 0x6000))

---
~Randy

#10 lore raw
Quoted 1 line · Randy.Dunlap

Where's Bart lately ??

Looks like he doesn't seems to be around this times...

Is it possible to apply the patch we were discussing without its presence ? The bug and a possible fix has been reported many months ago, it could be nice to apply it since it's tested and working.

Erwan,

#11 lore raw
Quoted 7 lines · On Mon, 19 Jun 2006 10:12:48 +0200 Velu Erwan wrote:
Quoted 1 line · Randy.Dunlap

Where's Bart lately ??

Looks like he doesn't seems to be around this times...

Is it possible to apply the patch we were discussing without its presence ? The bug and a possible fix has been reported many months ago, it could be nice to apply it since it's tested and working.

Well, some maintainer has to apply the patch and then cause it to be merged upstream into mainline.

We can probably get the patch merged into -mm, but it's not clear if that would help you. At least it might give the patch more testing/exposure.

If Bart is missing, we'll need to do something about that. or did he check out with anyone?

---
~Randy

#12 lore raw

Randy.Dunlap a écrit :
[..]

Quoted 3 lines

We can probably get the patch merged into -mm, but it's not clear if that would help you. At least it might give the patch more testing/exposure.

This could be a first step to check if this patch works fine for more than us (3 people which have tested it successfully).

If this step is successfull (maybe 1 month or 2 without a bug), what could make it then merged upstream ?

Thx for your help Randy,
Erwan

#13 lore raw
Quoted 11 lines · On Tue, 20 Jun 2006 10:57:18 +0200 Velu Erwan wrote:

Randy.Dunlap a écrit :
[..]

Quoted 3 lines

We can probably get the patch merged into -mm, but it's not clear if that would help you. At least it might give the patch more testing/exposure.

This could be a first step to check if this patch works fine for more than us (3 people which have tested it successfully).

If this step is successfull (maybe 1 month or 2 without a bug), what could make it then merged upstream ?

I suggest that you send the patch (probably Bruno's patch) to Andrew ([email protected]) and copy Bart and linux-ide mailing list on it. Andrew will likely include it in his -mm patchset. However, if it causes a problem, he will probably drop it like a hot potato.

---
~Randy