All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFT] sata_promise: intermittent errors bug hunting
@ 2007-02-27 22:25 Mikael Pettersson
  2007-02-27 23:16 ` Jeff Garzik
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mikael Pettersson @ 2007-02-27 22:25 UTC (permalink / raw)
  To: linux-ide

There have been some reports of intermittent errors
with sata_promise, especially with newer disks.
My theory is that the driver isn't initialisating the
controller properly for SATAII 3Gbps transfer speeds.

It would be helpful if people seeing intermittent errors
with sata_promise could do the following:

1. Check if affected disks have jumpers for selecting
   between 1.5Gbps and 3Gbps operation, and adjust the
   jumpers for 1.5Gbps operation.

   This is exactly what happened to me last year:
   I replaced an older SATA disk with a new Seagate SATAII
   disk on a SATA 300 TX2plus controller, and immediately
   started getting errors. Resetting the disk's jumper to
   1.5Gbps operation eliminated the problems.
   
2. Try the patch included below, on top of a 2.6.21-rc1
   or newer kernel. This patch ports all initialisation
   quirks I could find in Promise's SATAII driver to
   sata_promise. I've tested it and the one quirk that does
   seem to actually change something is the "phy quality"
   reprogramming.

   If you find that this patch makes a difference, you can
   then test each quirk individually simply by editing the
   "#if 1" that precedes the quirk.

/Mikael

--- linux-2.6.21-rc1/drivers/ata/sata_promise.c.~1~	2007-02-27 18:22:49.000000000 +0100
+++ linux-2.6.21-rc1/drivers/ata/sata_promise.c	2007-02-27 21:51:23.000000000 +0100
@@ -113,6 +113,7 @@ struct pdc_port_priv {
 struct pdc_host_priv {
 	unsigned long		flags;
 	unsigned long		port_flags[ATA_MAX_PORTS];
+	unsigned char		asic_rev;
 };
 
 static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
@@ -349,6 +350,22 @@ static int pdc_port_start(struct ata_por
 		writel(tmp, mmio + 0x014);
 	}
 
+#if 1
+	/* set suitable value for PHY quality */
+	if ((hp->flags & PDC_FLAG_GEN_II) && sata_scr_valid(ap)) {
+		void __iomem *mmio = ap->ioaddr.scr_addr;
+		unsigned int tmp;
+
+		tmp = readl(mmio + 0x02C);
+		printk("%s: port %u: Old PHY Quality: %#x\n",
+		       __FUNCTION__, ap->port_no, tmp);
+		tmp = 0x405500A0;
+		printk("%s: port %u: New PHY Quality: %#x\n",
+		       __FUNCTION__, ap->port_no, tmp);
+		writel(tmp, mmio + 0x02C); /* PHY Quality Reg */
+	}
+#endif
+
 	return 0;
 }
 
@@ -830,6 +847,17 @@ static void pdc_host_init(unsigned int c
 	tmp = readl(mmio + hotplug_offset);
 	writel(tmp | 0xff0000, mmio + hotplug_offset);
 
+#if 1
+	/* disable BMR burst on 2nd generation chips prior to revision 2 */
+	if ((hp->flags & PDC_FLAG_GEN_II) && hp->asic_rev < 2) {
+		tmp = readl(mmio + PDC_FLASH_CTL);
+		tmp &= ~0x02000;	/* disable bmr burst */
+		writel(tmp, mmio + PDC_FLASH_CTL);
+		printk("%s: disabled BMR burst due to asic_rev %d\n",
+		       __FUNCTION__, hp->asic_rev);
+	}
+#endif
+
 	/* don't initialise TBG or SLEW on 2nd generation chips */
 	if (hp->flags & PDC_FLAG_GEN_II)
 		return;
@@ -945,6 +973,28 @@ static int pdc_ata_init_one (struct pci_
 		break;
 	}
 
+	if (hp->flags & PDC_FLAG_GEN_II) {
+		/* record ASIC rev */
+		pci_read_config_byte(pdev, PCI_REVISION_ID, &hp->asic_rev);
+
+#if 1
+		/* set cache line size = 1 */
+		pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &tmp);
+		printk("%s: changing pci_cache_line_size from %#02x to 0x01\n",
+		       __FUNCTION__, tmp);
+		pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x01);
+#endif
+
+#if 1
+		/* set WMI = 1 */
+		pci_read_config_byte(pdev, 0x42, &tmp);
+		printk("%s: changing pci config byte 0x42 from %#02x to %#02x\n",
+		       __FUNCTION__, tmp, tmp | 0x04);
+		tmp |= 0x04;
+		pci_write_config_byte(pdev, 0x42, tmp);
+#endif
+	}
+
 	pci_set_master(pdev);
 
 	/* initialize adapter */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFT] sata_promise: intermittent errors bug hunting
  2007-02-27 22:25 [RFT] sata_promise: intermittent errors bug hunting Mikael Pettersson
@ 2007-02-27 23:16 ` Jeff Garzik
  2007-02-28 21:29 ` Andreas Arens
  2007-03-02 11:51 ` Tomi Orava
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2007-02-27 23:16 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-ide

Mikael Pettersson wrote:
> +	if (hp->flags & PDC_FLAG_GEN_II) {
> +		/* record ASIC rev */
> +		pci_read_config_byte(pdev, PCI_REVISION_ID, &hp->asic_rev);
> +
> +#if 1
> +		/* set cache line size = 1 */
> +		pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &tmp);
> +		printk("%s: changing pci_cache_line_size from %#02x to 0x01\n",
> +		       __FUNCTION__, tmp);
> +		pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x01);
> +#endif


This bit strikes me as somewhat dubious.  If this proves to actually fix 
something, I would start by exporting pci_set_cacheline_size() in 
drivers/pci/pci.c, using it, and seeing if that helps.

	Jeff



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFT] sata_promise: intermittent errors bug hunting
  2007-02-27 22:25 [RFT] sata_promise: intermittent errors bug hunting Mikael Pettersson
  2007-02-27 23:16 ` Jeff Garzik
@ 2007-02-28 21:29 ` Andreas Arens
  2007-03-02 11:51 ` Tomi Orava
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Arens @ 2007-02-28 21:29 UTC (permalink / raw)
  To: linux-ide

Mikael Pettersson wrote:

> There have been some reports of intermittent errors
> with sata_promise, especially with newer disks.
> My theory is that the driver isn't initialisating the
> controller properly for SATAII 3Gbps transfer speeds.
> 
Just to confirm a working set-up with a 3Gbps capable
drive on the TX2plus: The drive is not jumpered to
limit itself to 1.5Gbps (it can do so), but still works
flawlessly on the controller. Here's the relevant part
of the dmesg (out of 2.6.20):

sata_promise 0000:00:08.0: version 1.05
ACPI: PCI Interrupt 0000:00:08.0[A] -> GSI 18 (level, low) -> IRQ 18
sata_promise PATA port found
ata1: SATA max UDMA/133 cmd 0xFFFFC20000078200 ctl 0xFFFFC20000078238 bmdma 0x0 irq 18
ata2: SATA max UDMA/133 cmd 0xFFFFC20000078280 ctl 0xFFFFC200000782B8 bmdma 0x0 irq 18
ata3: PATA max UDMA/133 cmd 0xFFFFC20000078300 ctl 0xFFFFC20000078338 bmdma 0x0 irq 18
scsi0 : sata_promise
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: ATA-7, max UDMA7, 781422768 sectors: LBA48 NCQ (depth 0/32)
ata1.00: configured for UDMA/133
scsi1 : sata_promise
ata2: SATA link down (SStatus 0 SControl 0)
scsi2 : sata_promise
ata3.00: ATA-7, max UDMA/133, 312581808 sectors: LBA48
ata3.01: ATA-7, max UDMA/133, 390721968 sectors: LBA48
ata3.00: configured for UDMA/133
ata3.01: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA      SAMSUNG HD401LJ  ZZ10 PQ: 0 ANSI: 5
SCSI device sda: 781422768 512-byte hdwr sectors (400088 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA

The two IDE drives also work flawlessly (with your patchset to support them backported
from 2.6.21git).

00:08.0 RAID bus controller: Promise Technology, Inc. PDC20378 (FastTrak 378/SATA 378) (rev 02)
        Subsystem: ASUSTeK Computer Inc. K8V Deluxe/PC-DL Deluxe motherboard
        Flags: bus master, 66MHz, medium devsel, latency 96, IRQ 18
        I/O ports at a000 [size=64]
        I/O ports at 9800 [size=16]
        I/O ports at 9400 [size=128]
        Memory at f9900000 (32-bit, non-prefetchable) [size=4K]
        Memory at f9800000 (32-bit, non-prefetchable) [size=128K]
        Capabilities: [60] Power Management version 2

The drive (Samsung HD401LJ) btw fails to be detected by the sata_via driver
in 3Gpbs default setup. It has to be jumpered to 1.5Gbps on that controller.
On the TX2plus it works without limiting (but still at 1.5 as you can see, which
as far as I know is the controllers hard limitation anyhow).

Andy



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFT] sata_promise: intermittent errors bug hunting
  2007-02-27 22:25 [RFT] sata_promise: intermittent errors bug hunting Mikael Pettersson
  2007-02-27 23:16 ` Jeff Garzik
  2007-02-28 21:29 ` Andreas Arens
@ 2007-03-02 11:51 ` Tomi Orava
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Orava @ 2007-03-02 11:51 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-ide


Hi,

> There have been some reports of intermittent errors
> with sata_promise, especially with newer disks.
> My theory is that the driver isn't initialisating the
> controller properly for SATAII 3Gbps transfer speeds.

I did a test run with 2.6.21-rc2-git1 & your patch and
still got similar errors as without your patch ...

My hardware consists of Promise PDC40718 (SATA 300 TX4)
4-port sata-card & 2 older 7200.7 Seagates (200GB) and
2 newer 7200.10 Seagates (500GB).

It's only the 7200.10 models which creates the following type of
complaints in the system logs:

Mar  2 11:13:40 alderan kernel: ata2.00: exception Emask 0x0 SAct 0x0 SErr
0x0 action 0x0
Mar  2 11:13:40 alderan kernel: ata2.00: cmd
25/00:00:3f:6f:a1/00:02:07:00:00/e0 tag 0 cdb 0x0 data 262144 in
Mar  2 11:13:40 alderan kernel:          res
50/00:00:3e:71:a1/00:00:9e:03:76/e0 Emask 0x1 (device error)
Mar  2 11:13:40 alderan kernel: ata2.00: configured for UDMA/133
Mar  2 11:13:40 alderan kernel: ata2: EH complete
Mar  2 11:13:40 alderan kernel: SCSI device sdb: 976773168 512-byte hdwr
sectors (500108 MB)
Mar  2 11:13:40 alderan kernel: sdb: Write Protect is off
Mar  2 11:13:40 alderan kernel: SCSI device sdb: write cache: enabled,
read cache: enabled, doesn't support DPO or FUA
Mar  2 11:13:57 alderan kernel: ata2.00: exception Emask 0x0 SAct 0x0 SErr
0x0 action 0x0
Mar  2 11:13:57 alderan kernel: ata2.00: cmd
c8/00:00:6f:ca:c0/00:00:00:00:00/e7 tag 0 cdb 0x0 data 131072 in
Mar  2 11:13:57 alderan kernel:          res
50/00:00:6e:cb:c0/00:00:6e:ca:c0/e7 Emask 0x1 (device error)
Mar  2 11:13:57 alderan kernel: ata2.00: configured for UDMA/133
Mar  2 11:13:57 alderan kernel: ata2: EH complete
Mar  2 11:13:57 alderan kernel: SCSI device sdb: 976773168 512-byte hdwr
sectors (500108 MB)
Mar  2 11:13:57 alderan kernel: sdb: Write Protect is off
Mar  2 11:13:57 alderan kernel: SCSI device sdb: write cache: enabled,
read cache: enabled, doesn't support DPO or FUA
Mar  2 11:13:58 alderan kernel: ata4.00: exception Emask 0x0 SAct 0x0 SErr
0x0 action 0x0
Mar  2 11:13:58 alderan kernel: ata4.00: cmd
c8/00:00:8f:c6:c3/00:00:00:00:00/e7 tag 0 cdb 0x0 data 131072 in
Mar  2 11:13:58 alderan kernel:          res
50/00:00:8e:c7:c3/00:00:d6:de:b4/e7 Emask 0x1 (device error)
Mar  2 11:13:59 alderan kernel: ata4.00: configured for UDMA/133
Mar  2 11:13:59 alderan kernel: ata4: EH complete
Mar  2 11:13:59 alderan kernel: SCSI device sdd: 976773168 512-byte hdwr
sectors (500108 MB)
Mar  2 11:13:59 alderan kernel: sdd: Write Protect is off
Mar  2 11:13:59 alderan kernel: SCSI device sdd: write cache: enabled,
read cache: enabled, doesn't support DPO or FUA
Mar  2 11:13:59 alderan kernel: ata4.00: exception Emask 0x0 SAct 0x0 SErr
0x0 action 0x0
Mar  2 11:13:59 alderan kernel: ata4.00: cmd
c8/00:00:3f:52:c5/00:00:00:00:00/e7 tag 0 cdb 0x0 data 131072 in
Mar  2 11:13:59 alderan kernel:          res
50/00:00:3e:53:c5/00:00:d6:de:b4/e7 Emask 0x1 (device error)
Mar  2 11:13:59 alderan kernel: ata4.00: configured for UDMA/133
Mar  2 11:13:59 alderan kernel: ata4: EH complete
Mar  2 11:13:59 alderan kernel: SCSI device sdd: 976773168 512-byte hdwr
sectors (500108 MB)
Mar  2 11:13:59 alderan kernel: sdd: Write Protect is off
Mar  2 11:13:59 alderan kernel: SCSI device sdd: write cache: enabled,
read cache: enabled, doesn't support DPO or FUA
Mar  2 11:32:04 alderan kernel: possible SYN flooding on port 52223.
Sending cookies.

The older 7200.7 disks work just fine without any complaints.
The same type of error messages are reported no matter if the 7200.10
model drives have been jumpered into 1,5GB mode or in 3,0GB mode.


Regards,
Tomi Orava


--- dmesg logs for promise ---

pdc_ata_init_one: changing pci_cache_line_size from 0x1 to 0x01
pdc_ata_init_one: changing pci config byte 0x42 from 0x5 to 0x5
pdc_port_start: port 0: Old PHY Quality: 0x10086880
pdc_port_start: port 0: New PHY Quality: 0x405500a0
ata1: SATA max UDMA/133 cmd 0xf880a200 ctl 0xf880a238 bmdma 0x00000000 irq 16
pdc_port_start: port 1: Old PHY Quality: 0x7536880
pdc_port_start: port 1: New PHY Quality: 0x405500a0
ata2: SATA max UDMA/133 cmd 0xf880a280 ctl 0xf880a2b8 bmdma 0x00000000 irq 16
pdc_port_start: port 2: Old PHY Quality: 0x156e6880
pdc_port_start: port 2: New PHY Quality: 0x405500a0
ata3: SATA max UDMA/133 cmd 0xf880a300 ctl 0xf880a338 bmdma 0x00000000 irq 16
pdc_port_start: port 3: Old PHY Quality: 0x7056880
pdc_port_start: port 3: New PHY Quality: 0x405500a0
ata4: SATA max UDMA/133 cmd 0xf880a380 ctl 0xf880a3b8 bmdma 0x00000000 irq 16
scsi0 : sata_promise
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: ATA-6: ST3200822AS, 3.01, max UDMA/133
ata1.00: 390721968 sectors, multi 0: LBA48
ata1.00: configured for UDMA/133
scsi1 : sata_promise
ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata2.00: ATA-7: ST3500630AS, 3.AAK, max UDMA/133
ata2.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 0/32)
ata2.00: configured for UDMA/133
scsi2 : sata_promise
ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata3.00: ATA-6: ST3200822AS, 3.01, max UDMA/133
ata3.00: 390721968 sectors, multi 0: LBA48
ata3.00: configured for UDMA/133
scsi3 : sata_promise
ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata4.00: ATA-7: ST3500630AS, 3.AAK, max UDMA/133
ata4.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 0/32)
ata4.00: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA      ST3200822AS      3.01 PQ: 0 ANSI: 5
SCSI device sda: 390721968 512-byte hdwr sectors (200050 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
SCSI device sda: 390721968 512-byte hdwr sectors (200050 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
SCSI device sda: 390721968 512-byte hdwr sectors (200050 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
 sda: sda1 sda2
sd 0:0:0:0: Attached scsi disk sda
sd 0:0:0:0: Attached scsi generic sg0 type 0
scsi 1:0:0:0: Direct-Access     ATA      ST3500630AS      3.AA PQ: 0 ANSI: 5
SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
sdb: Write Protect is off
sdb: Mode Sense: 00 3a 00 00
SCSI device sdb: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
sdb: Write Protect is off
sdb: Mode Sense: 00 3a 00 00
SCSI device sdb: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
 sdb: sdb1 sdb2
sd 1:0:0:0: Attached scsi disk sdb
sd 1:0:0:0: Attached scsi generic sg1 type 0
scsi 2:0:0:0: Direct-Access     ATA      ST3200822AS      3.01 PQ: 0 ANSI: 5
SCSI device sdc: 390721968 512-byte hdwr sectors (200050 MB)
sdc: Write Protect is off
sdc: Mode Sense: 00 3a 00 00
SCSI device sdc: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
SCSI device sdc: 390721968 512-byte hdwr sectors (200050 MB)
sdc: Write Protect is off
sdc: Mode Sense: 00 3a 00 00
SCSI device sdc: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
 sdc: sdc1 sdc2
sd 2:0:0:0: Attached scsi disk sdc
sd 2:0:0:0: Attached scsi generic sg2 type 0
scsi 3:0:0:0: Direct-Access     ATA      ST3500630AS      3.AA PQ: 0 ANSI: 5
SCSI device sdd: 976773168 512-byte hdwr sectors (500108 MB)
sdd: Write Protect is off
sdd: Mode Sense: 00 3a 00 00
SCSI device sdd: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
SCSI device sdd: 976773168 512-byte hdwr sectors (500108 MB)
sdd: Write Protect is off
sdd: Mode Sense: 00 3a 00 00
SCSI device sdd: write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
 sdd: sdd1 sdd2
sd 3:0:0:0: Attached scsi disk sdd
sd 3:0:0:0: Attached scsi generic sg3 type 0

-- 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFT] sata_promise: intermittent errors bug hunting
@ 2007-03-02 12:52 Mikael Pettersson
  0 siblings, 0 replies; 5+ messages in thread
From: Mikael Pettersson @ 2007-03-02 12:52 UTC (permalink / raw)
  To: Tomi.Orava; +Cc: linux-ide

On Fri, 2 Mar 2007 13:51:19 +0200 (EET), Tomi Orava wrote:
> > There have been some reports of intermittent errors
> > with sata_promise, especially with newer disks.
> > My theory is that the driver isn't initialisating the
> > controller properly for SATAII 3Gbps transfer speeds.
> 
> I did a test run with 2.6.21-rc2-git1 & your patch and
> still got similar errors as without your patch ...
> 
> My hardware consists of Promise PDC40718 (SATA 300 TX4)
> 4-port sata-card & 2 older 7200.7 Seagates (200GB) and
> 2 newer 7200.10 Seagates (500GB).
> 
> It's only the 7200.10 models which creates the following type of
> complaints in the system logs:
> 
> Mar  2 11:13:40 alderan kernel: ata2.00: exception Emask 0x0 SAct 0x0 SEr=
> r
> 0x0 action 0x0
> Mar  2 11:13:40 alderan kernel: ata2.00: cmd
> 25/00:00:3f:6f:a1/00:02:07:00:00/e0 tag 0 cdb 0x0 data 262144 in
> Mar  2 11:13:40 alderan kernel:          res
> 50/00:00:3e:71:a1/00:00:9e:03:76/e0 Emask 0x1 (device error)
etc

Thanks for testing. Did you see my second patch to improve
error decoding and reporting in sata_promise? It would be very
interesting to see what additional information it logs.

<http://marc.theaimsgroup.com/?l=linux-ide&m=117271432801920&w=2>
is the patch I'm referring to.

/Mikael

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-02 12:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 22:25 [RFT] sata_promise: intermittent errors bug hunting Mikael Pettersson
2007-02-27 23:16 ` Jeff Garzik
2007-02-28 21:29 ` Andreas Arens
2007-03-02 11:51 ` Tomi Orava
2007-03-02 12:52 Mikael Pettersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.