2007-05-15 10:53:34

by Thomas Kuther

[permalink] [raw]
Subject: IT821x: no DMA since 2.6.21

Hi!

Since 2.6.21 I have a problem with the it821x driver on my ITE 8212
controller.
Now I saw some updates to it821x in 2.6.22-rc1 and gave that a try, but
the problem persists.

It seems that DMA is broken on it8212 somehow since the merge of
the it8213 driver.

dmesg shows some BUG DMA OFF:
-----------------8<-----------------
IT8212: IDE controller at PCI slot 0000:00:09.0
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
IT8212: chipset revision 17
it821x: controller in smart mode.
IT8212: 100% native mode on irq 18
ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
Probing IDE interface ide2...
hde: SAMSUNG SP2514N, ATA DISK drive
hdf: Maxtor 6Y120L0, ATA DISK drive
hde: selected mode 0x45
hdf: selected mode 0x46
hde: Performing identify fixups.
hdf: Performing identify fixups.
ide2 at 0xec00-0xec07,0xe802 on irq 18
hde: max request size: 128KiB
hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63,
BUG DMA OFF
hde:hde: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hde:recal_intr: error=0x04 { DriveStatusError }
ide: failed opcode was: unknown hde1
hdf: max request size: 128KiB
hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63,
BUG DMA OFF
hdf:hdf: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hdf:recal_intr: error=0x04 { DriveStatusError }
ide: failed opcode was: unknown hdf1
------------------------>8-----------------------

Until 2.6.20 (since 2.6.10) the driver worked quite fine, but since
2.6.21 moving/copying files from/to any drive on the controller is
a) really slow,
b) music starts skipping,
c) mouse stopps moving for short periods,
and hdparm does not work anymore:

# hdparm -d1 /dev/hde
/dev/hde:
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Input/output error
using_dma = 0 (off)

This has not been a problem before. hdparm -tT showed something around
40MB/s for buffered reads, now it looks like this:

# hdparm -tT /dev/hde

/dev/hde:
Timing cached reads: 356 MB in 2.01 seconds = 177.30 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Input/output
error
Timing buffered disk reads: 10 MB in 3.28 seconds = 3.05 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Input/output
error

more: http://phpfi.com/234217

If there is more info needed, please tell me what. And please CC as I
am not subscribed.

Thanks,
Thomas


Attachments:
signature.asc (189.00 B)

2007-05-15 11:27:09

by Thomas Kuther

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Di, 15.05.07 12:53 Thomas Kuther wrote:

> Hi!
>
> Since 2.6.21 I have a problem with the it821x driver on my ITE 8212
> controller.
> Now I saw some updates to it821x in 2.6.22-rc1 and gave that a try,
> but the problem persists.
>

Back on 2.6.20 - here is some output from the working driver.

There is actually no difference in dmesg:
-------------------------8<---------------------------
IT8212: IDE controller at PCI slot 0000:00:09.0
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
IT8212: chipset revision 17
it821x: controller in smart mode.
IT8212: 100% native mode on irq 18
ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
Probing IDE interface ide2...
hde: SAMSUNG SP2514N, ATA DISK drive
hdf: Maxtor 6Y120L0, ATA DISK drive
hde: Performing identify fixups.
hdf: Performing identify fixups.
ide2 at 0xec00-0xec07,0xe802 on irq 18
hde: max request size: 128KiB
hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63,
BUG DMA OFF
hde:hde: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hde:recal_intr: error=0x04 { DriveStatusError } ide: failed opcode was:
unknown
hde1
hdf: max request size: 128KiB
hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63,
BUG DMA OFF
hdf:hdf: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hdf:recal_intr: error=0x04 { DriveStatusError } ide: failed opcode was:
unknown hdf1
------------------------------>8-------------------------------

But hdparm works:
---------------
# hdparm -d1 /dev/hde
/dev/hde:
setting using_dma to 1 (on)
using_dma = 1 (on)
----------------
# hdparm -tT /dev/hde

/dev/hde:
Timing cached reads: 372 MB in 2.01 seconds = 185.17 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Input/output
error
Timing buffered disk reads: 124 MB in 3.01 seconds = 41.18 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Input/output
error
----------------
hdparm version is 7.3.
DMA is enabled in the controller's BIOS, of course.

Hope this helps a bit.

Thanks,
Thomas


Attachments:
signature.asc (189.00 B)

2007-05-15 11:27:30

by Alan

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Tue, 15 May 2007 12:53:08 +0200
Thomas Kuther <[email protected]> wrote:

> Hi!
>
> Since 2.6.21 I have a problem with the it821x driver on my ITE 8212
> controller.
> Now I saw some updates to it821x in 2.6.22-rc1 and gave that a try, but
> the problem persists.

I've had multiple reports of this. I would recommend you use the libata
driver. IT821x hasn't changed over the past few releases so its someting
in the core IDE code that broke it [note it might not of course be that
the problem is in the core code..].

I have no plans at this point to debug the old IT821x driver due to time
constraints, and if anyone wants to have a crack at debugging this and
fixing it go for it.

BTW: I also note you have the controller in smart mode but are not using
the hardware raid functions. In that situation it generally runs faster
(and does CD-ROM) if you flash the ATAPI firmware to the controller or
boot with the noraid option "it8212.noraid=1"

Alan

2007-05-15 11:36:18

by Thomas Kuther

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Di, 15.05.07 12:31 Alan Cox <[email protected]> wrote:

> On Tue, 15 May 2007 12:53:08 +0200
> Thomas Kuther <[email protected]> wrote:
>
> > Hi!
> >
> > Since 2.6.21 I have a problem with the it821x driver on my ITE 8212
> > controller.
> > Now I saw some updates to it821x in 2.6.22-rc1 and gave that a try,
> > but the problem persists.
>
> I've had multiple reports of this. I would recommend you use the
> libata driver. IT821x hasn't changed over the past few releases so
> its someting in the core IDE code that broke it [note it might not of
> course be that the problem is in the core code..].
>
> I have no plans at this point to debug the old IT821x driver due to
> time constraints, and if anyone wants to have a crack at debugging
> this and fixing it go for it.
>
> BTW: I also note you have the controller in smart mode but are not
> using the hardware raid functions. In that situation it generally
> runs faster (and does CD-ROM) if you flash the ATAPI firmware to the
> controller or boot with the noraid option "it8212.noraid=1"
>
> Alan

Hi Alan,
thanks for the suggestion.

I already tried pata_it821x and it failed to recognize the second
harddisk hdf. I use the controller only for additional harddrives, no
RAID, no cd-rom.

But I will try again. Maybe I just did something wrong then.

Thanks,
Thomas


Attachments:
signature.asc (189.00 B)

2007-05-15 11:44:17

by Alan

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

> I already tried pata_it821x and it failed to recognize the second
> harddisk hdf. I use the controller only for additional harddrives, no
> RAID, no cd-rom.

Logs from that would be most helpful as I am maintaining the pata_it821x
driver.

Alan

2007-05-15 12:20:55

by Thomas Kuther

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Di, 15.05.07 12:48 Alan Cox <[email protected]> wrote:

> > I already tried pata_it821x and it failed to recognize the second
> > harddisk hdf. I use the controller only for additional harddrives,
> > no RAID, no cd-rom.
>
> Logs from that would be most helpful as I am maintaining the
> pata_it821x driver.
>
> Alan

Okay, I removed the IDE one and tried your libata driver again.

What I maybe just did wrong on my first try, was loading it without any
parameters, as:
--------------------------
pata_it821x: Unknown parameter `it8212.noraid'
pata_it821x: Unknown parameter `it8212_noraid'
--------------------------
Loading without any parameters on this kernel resulted in:
--------------------------
pata_it821x: controller in smart mode.
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
scsi3 : pata_it821x
scsi4 : pata_it821x
ata3: PATA max MWDMA2 cmd 0x0001ec00 ctl 0x0001e802 bmdma 0x0001dc00
irq 0
ata4: PATA max MWDMA2 cmd 0x0001e400 ctl 0x0001e002 bmdma 0x0001dc08
irq 0
ata3: SRST failed (errno=-16)
ata3: SRST failed (errno=-16)
ata3: SRST failed (errno=-16)
ata3: SRST failed (errno=-16)
ata3: reset failed, giving up
---------------------------

Now I tried with "noraid=1", and now all seems to be working fine.

Thanks very much!
Thomas


Attachments:
signature.asc (189.00 B)
Subject: Re: IT821x: no DMA since 2.6.21


Hi,

On Tuesday 15 May 2007, Alan Cox wrote:
> On Tue, 15 May 2007 12:53:08 +0200
> Thomas Kuther <[email protected]> wrote:
>
> > Hi!
> >
> > Since 2.6.21 I have a problem with the it821x driver on my ITE 8212
> > controller.
> > Now I saw some updates to it821x in 2.6.22-rc1 and gave that a try, but
> > the problem persists.
>
> I've had multiple reports of this. I would recommend you use the libata
> driver. IT821x hasn't changed over the past few releases so its someting

commit 0e9b4e535fec7e2a189952670937adfbe2826b63
Author: Bartlomiej Zolnierkiewicz <[email protected]>
Date: Sat May 5 22:03:50 2007 +0200

it821x: PIO mode setup fixes

...

*cough, cough* ;)

> in the core IDE code that broke it [note it might not of course be that
> the problem is in the core code..].

The real problem seems to be that IT821x "virtual" ID misses info
about supported DMA modes (while it seems to contain enabled DMA
mode info).

This would be the logical explanation why the driver broke after:

commit 71ef51cc1756d1c56b57c70e7cc27a3559c81ee6
Author: Jens Axboe <[email protected]>
Date: Fri Jul 28 09:02:17 2006 +0200

[PATCH] it821x: fix ide dma setup bug

Only enable dma for a valid speed setting.

Signed-off-by: Jens Axboe <[email protected]>

commit 0a8348d08677ad77ee353f96eb8745c693a05a13
Author: Jens Axboe <[email protected]>
Date: Fri Jul 28 08:58:26 2006 +0200

[PATCH] ide: if the id fields looks screwy, disable DMA

It's the safer choice. Originally due to a bug in itx821x, but a
generally sound thing to do.

Signed-off-by: Jens Axboe <[email protected]>


Bogus ide_dma_enable() usage in it821x.c + loosy check in ide_dma_verbose()
allowed the hardware to operate in DMA mode, when these bugs were fixed
DMA support broke...

> I have no plans at this point to debug the old IT821x driver due to time
> constraints, and if anyone wants to have a crack at debugging this and
> fixing it go for it.

It seems that somebody has already debugged this issue to
the aforementioned changes:

http://lkml.org/lkml/2007/1/14/110


Thomas, does the following patch against 2.6.22-rc1 fix the issue?

[ Patch is based on the above theory and Alan's work on pata_it821x.
Sorry for no real description (TODO) but it's almost 3:00 am ... ]
---
drivers/ide/ide-probe.c | 12 ++++++------
drivers/ide/pci/it821x.c | 36 +++++++++++++++++++++---------------
2 files changed, 27 insertions(+), 21 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave);
* This routine only knows how to look for drive units 0 and 1
* on an interface, so any setting of MAX_DRIVES > 2 won't work here.
*/
-static void probe_hwif(ide_hwif_t *hwif)
+static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
{
unsigned int unit;
unsigned long flags;
@@ -820,6 +820,9 @@ static void probe_hwif(ide_hwif_t *hwif)
return;
}

+ if (fixup)
+ fixup(hwif);
+
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];

@@ -874,10 +877,7 @@ static int hwif_init(ide_hwif_t *hwif);

int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
{
- probe_hwif(hwif);
-
- if (fixup)
- fixup(hwif);
+ probe_hwif(hwif, fixup);

if (!hwif_init(hwif)) {
printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -1404,7 +1404,7 @@ int ideprobe_init (void)

for (index = 0; index < MAX_HWIFS; ++index)
if (probe[index])
- probe_hwif(&ide_hwifs[index]);
+ probe_hwif(&ide_hwifs[index], NULL);
for (index = 0; index < MAX_HWIFS; ++index)
if (probe[index])
hwif_init(&ide_hwifs[index]);
Index: b/drivers/ide/pci/it821x.c
===================================================================
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -262,7 +262,7 @@ static int it821x_tunepio(ide_drive_t *d
}

if (itdev->smart)
- goto set_drive_speed;
+ return 0;

/* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
itdev->want[unit][1] = pio_want[set_pio];
@@ -271,7 +271,6 @@ static int it821x_tunepio(ide_drive_t *d
it821x_clock_strategy(drive);
it821x_program(drive, itdev->pio[unit]);

-set_drive_speed:
return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
}

@@ -455,12 +454,12 @@ static int it821x_tune_chipset (ide_driv
default:
return 1;
}
+
+ return ide_config_drive_speed(drive, speed);
}
- /*
- * In smart mode the clocking is done by the host controller
- * snooping the mode we picked. The rest of it is not our problem
- */
- return ide_config_drive_speed(drive, speed);
+
+ /* don't touch anything in the smart mode */
+ return 0;
}

/**
@@ -556,6 +555,7 @@ static void __devinit it821x_fixups(ide_
ide_drive_t *drive = &hwif->drives[i];
struct hd_driveid *id;
u16 *idbits;
+ u8 unit = drive->dn & 1;

if(!drive->present)
continue;
@@ -567,9 +567,22 @@ static void __devinit it821x_fixups(ide_
/* In raid mode the ident block is slightly buggy
We need to set the bits so that the IDE layer knows
LBA28. LBA48 and DMA ar valid */
- id->capability |= 3; /* LBA28, DMA */
+ id->capability |= 2; /* LBA28 */
id->command_set_2 |= 0x0400; /* LBA48 valid */
id->cfs_enable_2 |= 0x0400; /* LBA48 on */
+ /*
+ * If BIOS configured the device for DMA then set
+ * MWDMA0 mode as enabled/support - just to tell
+ * IDE core that DMA is supported (it821x hardware
+ * takes care of DMA mode programming).
+ */
+ if (inb(hwif->dma_status) & (1 << (5 + unit))) {
+ id->capability |= 1;
+ id->dma_mword |= 0x0101;
+ drive->current_speed = XFER_MW_DMA_0;
+ } else {
+ drive->current_speed = XFER_PIO_0;
+ }
/* Reporting logic */
printk(KERN_INFO "%s: IT8212 %sRAID %d volume",
drive->name,
@@ -578,13 +591,6 @@ static void __devinit it821x_fixups(ide_
if(idbits[129] != 1)
printk("(%dK stripe)", idbits[146]);
printk(".\n");
- /* Now the core code will have wrongly decided no DMA
- so we need to fix this */
- hwif->dma_off_quietly(drive);
-#ifdef CONFIG_IDEDMA_ONLYDISK
- if (drive->media == ide_disk)
-#endif
- ide_set_dma(drive);
} else {
/* Non RAID volume. Fixups to stop the core code
doing unsupported things */

2007-05-16 08:09:54

by Thomas Kuther

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Mi, 16.05.07 02:58 Bartlomiej Zolnierkiewicz wrote:

>
> Hi,
>
> On Tuesday 15 May 2007, Alan Cox wrote:
> > On Tue, 15 May 2007 12:53:08 +0200
> > Thomas Kuther <[email protected]> wrote:
> >
> > > Hi!
> > >
> > > Since 2.6.21 I have a problem with the it821x driver on my ITE
> > > 8212 controller.
> > > Now I saw some updates to it821x in 2.6.22-rc1 and gave that a
> > > try, but the problem persists.
> >
> > I've had multiple reports of this. I would recommend you use the
> > libata driver. IT821x hasn't changed over the past few releases so
> > its someting
>
> commit 0e9b4e535fec7e2a189952670937adfbe2826b63
> Author: Bartlomiej Zolnierkiewicz <[email protected]>
> Date: Sat May 5 22:03:50 2007 +0200
>
> it821x: PIO mode setup fixes
>
> ...
>
> *cough, cough* ;)
>
> > in the core IDE code that broke it [note it might not of course be
> > that the problem is in the core code..].
>
> The real problem seems to be that IT821x "virtual" ID misses info
> about supported DMA modes (while it seems to contain enabled DMA
> mode info).
>
> This would be the logical explanation why the driver broke after:
>
> [...]
>
> It seems that somebody has already debugged this issue to
> the aforementioned changes:
>
> http://lkml.org/lkml/2007/1/14/110
>
>
> Thomas, does the following patch against 2.6.22-rc1 fix the issue?
>

Hi Bartlomiej,

yes, this patch completely fixes it. Looks very good now even.
I loaded it with option noraid=1

------------------------------8<----------------------------
IT8212: IDE controller at PCI slot 0000:00:09.0
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
IT8212: chipset revision 17
it8212: forcing bypass mode.
it821x: controller in pass through mode.
IT8212: 100% native mode on irq 18
ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
Probing IDE interface ide2...
hde: SAMSUNG SP2514N, ATA DISK drive
hdf: Maxtor 6Y120L0, ATA DISK drive
hde: selected mode 0x45
hdf: selected mode 0x46
ide2 at 0xec00-0xec07,0xe802 on irq 18
hde: max request size: 512KiB
hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63,
UDMA(100) hde: cache flushes supported
hde: hde1
hdf: max request size: 128KiB
hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63,
UDMA(133) hdf: cache flushes supported
-------------------------------------->8------------------------------
So all those drive seek errors are gone too.
Hdparm does not complain anymore, speed is OK.
Nice, so I can get rid of libata again, as all other drives run with the
IDE layer too.

Many thanks!

Shall I test it without "noraid=1" too?

Regards,
Thomas


Attachments:
signature.asc (189.00 B)
Subject: Re: IT821x: no DMA since 2.6.21


Hi,

On Wednesday 16 May 2007, Thomas Kuther wrote:
> On Mi, 16.05.07 02:58 Bartlomiej Zolnierkiewicz wrote:
>
> >
> > Hi,
> >
> > On Tuesday 15 May 2007, Alan Cox wrote:
> > > On Tue, 15 May 2007 12:53:08 +0200
> > > Thomas Kuther <[email protected]> wrote:
> > >
> > > > Hi!
> > > >
> > > > Since 2.6.21 I have a problem with the it821x driver on my ITE
> > > > 8212 controller.
> > > > Now I saw some updates to it821x in 2.6.22-rc1 and gave that a
> > > > try, but the problem persists.
> > >
> > > I've had multiple reports of this. I would recommend you use the
> > > libata driver. IT821x hasn't changed over the past few releases so
> > > its someting
> >
> > commit 0e9b4e535fec7e2a189952670937adfbe2826b63
> > Author: Bartlomiej Zolnierkiewicz <[email protected]>
> > Date: Sat May 5 22:03:50 2007 +0200
> >
> > it821x: PIO mode setup fixes
> >
> > ...
> >
> > *cough, cough* ;)
> >
> > > in the core IDE code that broke it [note it might not of course be
> > > that the problem is in the core code..].
> >
> > The real problem seems to be that IT821x "virtual" ID misses info
> > about supported DMA modes (while it seems to contain enabled DMA
> > mode info).

Close but not really it, the it821x_fixup() was done after probe_hwif()
so IDE core code was using the original (incorrect) value of id->field_valid
(before "id->field_valid &= 1" fixup).

The rest of the problem analysis is still valid (DMA worked by pure luck
before Jens' fixes).

> > This would be the logical explanation why the driver broke after:
> >
> > [...]
> >
> > It seems that somebody has already debugged this issue to
> > the aforementioned changes:
> >
> > http://lkml.org/lkml/2007/1/14/110
> >
> >
> > Thomas, does the following patch against 2.6.22-rc1 fix the issue?
> >
>
> Hi Bartlomiej,
>
> yes, this patch completely fixes it. Looks very good now even.
> I loaded it with option noraid=1
>
> ------------------------------8<----------------------------
> IT8212: IDE controller at PCI slot 0000:00:09.0
> ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
> IT8212: chipset revision 17
> it8212: forcing bypass mode.
> it821x: controller in pass through mode.
> IT8212: 100% native mode on irq 18
> ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
> ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
> Probing IDE interface ide2...
> hde: SAMSUNG SP2514N, ATA DISK drive
> hdf: Maxtor 6Y120L0, ATA DISK drive
> hde: selected mode 0x45
> hdf: selected mode 0x46
> ide2 at 0xec00-0xec07,0xe802 on irq 18
> hde: max request size: 512KiB
> hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63,
> UDMA(100) hde: cache flushes supported
> hde: hde1
> hdf: max request size: 128KiB
> hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63,
> UDMA(133) hdf: cache flushes supported
> -------------------------------------->8------------------------------
> So all those drive seek errors are gone too.
> Hdparm does not complain anymore, speed is OK.
> Nice, so I can get rid of libata again, as all other drives run with the
> IDE layer too.
>
> Many thanks!
>
> Shall I test it without "noraid=1" too?

Please do, the main goal of the patch was to fix "RAID mode"
("noraid=1" should work fine also without the patch?).

Thanks,
Bart

2007-05-16 12:35:58

by Alan

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

> The real problem seems to be that IT821x "virtual" ID misses info
> about supported DMA modes (while it seems to contain enabled DMA
> mode info).

It does at least for the RAID volumes which are quite peculiar and seem
to have been defined by flipping bits until Windows worked 8)


> [ Patch is based on the above theory and Alan's work on pata_it821x.
> Sorry for no real description (TODO) but it's almost 3:00 am ... ]

Thanks for doing that. I've got a potential patch for libata and the
smart mode problem. Turns out that Tejun's sanity checks in the bus reset
path are too smart for the firmware ;)

Alan

2007-05-18 09:47:44

by Thomas Kuther

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Mi, 16.05.07 11:46 Bartlomiej Zolnierkiewicz <[email protected]>
wrote:

> > Shall I test it without "noraid=1" too?
>
> Please do, the main goal of the patch was to fix "RAID mode"
> ("noraid=1" should work fine also without the patch?).
>
> Thanks,
> Bart

Hi,

sorry for late response. Now the results in smart mode:
---------------------------------------------------
IT8212: IDE controller at PCI slot 0000:00:09.0
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
IT8212: chipset revision 17
it821x: controller in smart mode.
IT8212: 100% native mode on irq 18
ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
Probing IDE interface ide2...
hde: SAMSUNG SP2514N, ATA DISK drive
hdf: Maxtor 6Y120L0, ATA DISK drive
hde: Performing identify fixups.
hdf: Performing identify fixups.
ide2 at 0xec00-0xec07,0xe802 on irq 18
hde: max request size: 128KiB
hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63
hde:hde: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hde: recal_intr: error=0x04 { DriveStatusError }
ide: failed opcode was: unknown
hde1
hdf: max request size: 128KiB
hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63
hdf:hdf: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hdf: recal_intr: error=0x04 { DriveStatusError }
ide: failed opcode was: unknown
hdf1
------------------------------------------------------

# hdparm -d1 /dev/hde

/dev/hde:
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Input/output error
using_dma = 0 (off)

-------------------------------------------------------

Buffered reads: 3.06MB/s

Seems I shot too quick, DMA in smart mode still does not work.
"noraid=1" also works without the patch, correct.

Best,
Tom


Attachments:
signature.asc (189.00 B)
Subject: Re: IT821x: no DMA since 2.6.21


Hi,

On Friday 18 May 2007, Thomas Kuther wrote:
> On Mi, 16.05.07 11:46 Bartlomiej Zolnierkiewicz <[email protected]>
> wrote:
>
> > > Shall I test it without "noraid=1" too?
> >
> > Please do, the main goal of the patch was to fix "RAID mode"
> > ("noraid=1" should work fine also without the patch?).
> >
> > Thanks,
> > Bart
>
> Hi,
>
> sorry for late response. Now the results in smart mode:
> ---------------------------------------------------
> IT8212: IDE controller at PCI slot 0000:00:09.0
> ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
> IT8212: chipset revision 17
> it821x: controller in smart mode.
> IT8212: 100% native mode on irq 18
> ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
> ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
> Probing IDE interface ide2...
> hde: SAMSUNG SP2514N, ATA DISK drive
> hdf: Maxtor 6Y120L0, ATA DISK drive
> hde: Performing identify fixups.
> hdf: Performing identify fixups.
> ide2 at 0xec00-0xec07,0xe802 on irq 18
> hde: max request size: 128KiB
> hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63
> hde:hde: recal_intr: status=0x51 { DriveReady SeekComplete Error }
> hde: recal_intr: error=0x04 { DriveStatusError }
> ide: failed opcode was: unknown
> hde1
> hdf: max request size: 128KiB
> hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63
> hdf:hdf: recal_intr: status=0x51 { DriveReady SeekComplete Error }
> hdf: recal_intr: error=0x04 { DriveStatusError }
> ide: failed opcode was: unknown
> hdf1
> ------------------------------------------------------
>
> # hdparm -d1 /dev/hde
>
> /dev/hde:
> setting using_dma to 1 (on)
> HDIO_SET_DMA failed: Input/output error
> using_dma = 0 (off)
>
> -------------------------------------------------------
>
> Buffered reads: 3.06MB/s
>
> Seems I shot too quick, DMA in smart mode still does not work.
> "noraid=1" also works without the patch, correct.

Improved patch - this time the issue should be fixed for good (I was
looking only at the RAID specific part of the fixups and I overlooked
the fact that the original code was clearing too much of id->field_valid),
there is now also an extra debugging printk to give us some more info.

Please give it a try.

[ recal_intr warning (which should be harmless) is not fixed by this
patch because it is a different problem and requires some more work. ]

---
drivers/ide/ide-probe.c | 12 ++++++------
drivers/ide/pci/it821x.c | 38 +++++++++++++++++++++++---------------
2 files changed, 29 insertions(+), 21 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave);
* This routine only knows how to look for drive units 0 and 1
* on an interface, so any setting of MAX_DRIVES > 2 won't work here.
*/
-static void probe_hwif(ide_hwif_t *hwif)
+static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
{
unsigned int unit;
unsigned long flags;
@@ -820,6 +820,9 @@ static void probe_hwif(ide_hwif_t *hwif)
return;
}

+ if (fixup)
+ fixup(hwif);
+
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];

@@ -874,10 +877,7 @@ static int hwif_init(ide_hwif_t *hwif);

int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
{
- probe_hwif(hwif);
-
- if (fixup)
- fixup(hwif);
+ probe_hwif(hwif, fixup);

if (!hwif_init(hwif)) {
printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -1404,7 +1404,7 @@ int ideprobe_init (void)

for (index = 0; index < MAX_HWIFS; ++index)
if (probe[index])
- probe_hwif(&ide_hwifs[index]);
+ probe_hwif(&ide_hwifs[index], NULL);
for (index = 0; index < MAX_HWIFS; ++index)
if (probe[index])
hwif_init(&ide_hwifs[index]);
Index: b/drivers/ide/pci/it821x.c
===================================================================
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -262,7 +262,7 @@ static int it821x_tunepio(ide_drive_t *d
}

if (itdev->smart)
- goto set_drive_speed;
+ return 0;

/* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
itdev->want[unit][1] = pio_want[set_pio];
@@ -271,7 +271,6 @@ static int it821x_tunepio(ide_drive_t *d
it821x_clock_strategy(drive);
it821x_program(drive, itdev->pio[unit]);

-set_drive_speed:
return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
}

@@ -455,12 +454,12 @@ static int it821x_tune_chipset (ide_driv
default:
return 1;
}
+
+ return ide_config_drive_speed(drive, speed);
}
- /*
- * In smart mode the clocking is done by the host controller
- * snooping the mode we picked. The rest of it is not our problem
- */
- return ide_config_drive_speed(drive, speed);
+
+ /* don't touch anything in the smart mode */
+ return 0;
}

/**
@@ -543,6 +542,13 @@ static void __devinit it821x_fixups(ide_
id = drive->id;
idbits = (u16 *)drive->id;

+ /* debug */
+ printk(KERN_INFO "%s: field_valid=%04x capability=%02x "
+ "dma_mword=%04x dma_status=%02x\n",
+ drive->name,
+ id->field_valid, id->capability,
+ id->dma_mword, inb(hwif->dma_status));
+
/* Check for RAID v native */
if(strstr(id->model, "Integrated Technology Express")) {
/* In raid mode the ident block is slightly buggy
@@ -559,17 +565,10 @@ static void __devinit it821x_fixups(ide_
if(idbits[129] != 1)
printk("(%dK stripe)", idbits[146]);
printk(".\n");
- /* Now the core code will have wrongly decided no DMA
- so we need to fix this */
- hwif->dma_off_quietly(drive);
-#ifdef CONFIG_IDEDMA_ONLYDISK
- if (drive->media == ide_disk)
-#endif
- ide_set_dma(drive);
} else {
/* Non RAID volume. Fixups to stop the core code
doing unsupported things */
- id->field_valid &= 1;
+ id->field_valid &= 3;
id->queue_depth = 0;
id->command_set_1 = 0;
id->command_set_2 &= 0xC400;
@@ -584,6 +583,15 @@ static void __devinit it821x_fixups(ide_
printk(KERN_INFO "%s: Performing identify fixups.\n",
drive->name);
}
+
+ /*
+ * Set MWDMA0 mode as enabled/support - just to tell
+ * IDE core that DMA is supported (it821x hardware
+ * takes care of DMA mode programming).
+ */
+ id->capability |= 1;
+ id->dma_mword |= 0x0101;
+ drive->current_speed = XFER_MW_DMA_0;
}

}

2007-05-31 19:23:53

by Thomas Kuther

[permalink] [raw]
Subject: Re: IT821x: no DMA since 2.6.21

On Do, 24.05.07 11:46 Bartlomiej Zolnierkiewicz <[email protected]>
wrote:

>
> Hi,
>
> [...]
>
> Improved patch - this time the issue should be fixed for good (I was
> looking only at the RAID specific part of the fixups and I overlooked
> the fact that the original code was clearing too much of
> id->field_valid), there is now also an extra debugging printk to give
> us some more info.
>
> Please give it a try.
>
> [ recal_intr warning (which should be harmless) is not fixed by this
> patch because it is a different problem and requires some more
> work. ]
>

Hi,

Sorry again for late response.

This patch works. At least it restores the behaviour before .21 :)
----------------------------
IT8212: IDE controller at PCI slot 0000:00:09.0
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
IT8212: chipset revision 17
it821x: controller in smart mode.
IT8212: 100% native mode on irq 18
ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
Probing IDE interface ide2...
hde: SAMSUNG SP2514N, ATA DISK drive
hdf: Maxtor 6Y120L0, ATA DISK drive
hde: field_valid=0007 capability=2f dma_mword=0007 dma_status=04
hde: Performing identify fixups.
hdf: field_valid=0007 capability=2f dma_mword=0007 dma_status=04
hdf: Performing identify fixups.
hde: selected mode 0x22
hdf: selected mode 0x22
ide2 at 0xec00-0xec07,0xe802 on irq 18
hde: max request size: 128KiB
hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63,
DMA hde:hde: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hde: recal_intr: error=0x04 { DriveStatusError }
ide: failed opcode was: unknown
hde1
hdf: max request size: 128KiB
hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63, DMA
hdf:hdf: recal_intr: status=0x51 { DriveReady SeekComplete Error }
hdf: recal_intr: error=0x04 { DriveStatusError }
ide: failed opcode was: unknown
hdf1
----------------------------------------

hdparm does not complain, and disk IO speed is OK.

Regards,
Tom


Attachments:
signature.asc (189.00 B)
Subject: Re: IT821x: no DMA since 2.6.21

On Thursday 31 May 2007, Thomas Kuther wrote:
> On Do, 24.05.07 11:46 Bartlomiej Zolnierkiewicz <[email protected]>
> wrote:
>
> >
> > Hi,
> >
> > [...]
> >
> > Improved patch - this time the issue should be fixed for good (I was
> > looking only at the RAID specific part of the fixups and I overlooked
> > the fact that the original code was clearing too much of
> > id->field_valid), there is now also an extra debugging printk to give
> > us some more info.
> >
> > Please give it a try.
> >
> > [ recal_intr warning (which should be harmless) is not fixed by this
> > patch because it is a different problem and requires some more
> > work. ]
> >
>
> Hi,
>
> Sorry again for late response.
>
> This patch works. At least it restores the behaviour before .21 :)
> ----------------------------
> IT8212: IDE controller at PCI slot 0000:00:09.0
> ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 18
> IT8212: chipset revision 17
> it821x: controller in smart mode.
> IT8212: 100% native mode on irq 18
> ide2: BM-DMA at 0xdc00-0xdc07, BIOS settings: hde:pio, hdf:pio
> ide3: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdg:pio, hdh:pio
> Probing IDE interface ide2...
> hde: SAMSUNG SP2514N, ATA DISK drive
> hdf: Maxtor 6Y120L0, ATA DISK drive
> hde: field_valid=0007 capability=2f dma_mword=0007 dma_status=04
> hde: Performing identify fixups.
> hdf: field_valid=0007 capability=2f dma_mword=0007 dma_status=04
> hdf: Performing identify fixups.
> hde: selected mode 0x22
> hdf: selected mode 0x22
> ide2 at 0xec00-0xec07,0xe802 on irq 18
> hde: max request size: 128KiB
> hde: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63,
> DMA hde:hde: recal_intr: status=0x51 { DriveReady SeekComplete Error }
> hde: recal_intr: error=0x04 { DriveStatusError }
> ide: failed opcode was: unknown
> hde1
> hdf: max request size: 128KiB
> hdf: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=65535/16/63, DMA
> hdf:hdf: recal_intr: status=0x51 { DriveReady SeekComplete Error }
> hdf: recal_intr: error=0x04 { DriveStatusError }
> ide: failed opcode was: unknown
> hdf1
> ----------------------------------------
>
> hdparm does not complain, and disk IO speed is OK.

I'm glad that the issue is finally fixed. :)

Thanks,
Bart