# DMA not working on VIA controller

## eroth

Hi Folks,

Overnight, my mythbox has gone from playing dvds with no problems to stuttering (then freezing) a few frames in.  As I haven't emerged or changed anything in several weeks, and stuff has been working great since then, i'm at a loss as to what the trouble could be.  

The motherboard is a VIA EPIA SP13000 with a BENQ DW1655 dvd attached via standard ide cable.  the hdd is then on SATA.

My initial thoughts are DMA issues...

here's some hdparm output:

```
hdparm -i /dev/dvd

/dev/dvd:

 Model=BENQ DVD LS DW1655, FwRev=BCHB, SerialNo=KWS2601636SC0

 Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }

 RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0

 BuffType=unknown, BuffSize=0kB, MaxMultSect=0

 (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0

 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 *udma2

 AdvancedPM=no

 Drive conforms to: Unspecified:  ATA/ATAPI-3 ATA/ATAPI-6

 * signifies the current active mode

```

and

```
hdparm -tT /dev/dvd

/dev/dvd:

 Timing cached reads:   188 MB in  2.02 seconds =  93.05 MB/sec

BLKFLSBUF failed: Function not implemented

 Timing buffered disk reads:   18 MB in  3.27 seconds =   5.50 MB/sec

BLKFLSBUF failed: Function not implemented

```

- What is that failure, and shouldn't this be able to do better than udma2?

lspci:

```
00:00.0 Host bridge: VIA Technologies, Inc. CN400/PM880 Host Bridge

00:00.1 Host bridge: VIA Technologies, Inc. CN400/PM880 Host Bridge

00:00.2 Host bridge: VIA Technologies, Inc. CN400/PM880 Host Bridge

00:00.3 Host bridge: VIA Technologies, Inc. CN400/PM880 Host Bridge

00:00.4 Host bridge: VIA Technologies, Inc. CN400/PM880 Host Bridge

00:00.7 Host bridge: VIA Technologies, Inc. CN400/PM880 Host Bridge

00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge

00:0d.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 80)

00:0f.0 IDE interface: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)

00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)

00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)

00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]

00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)

00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 78)

01:00.0 VGA compatible controller: VIA Technologies, Inc. S3 Unichrome Pro VGA Adapter (rev 02)

```

and relevant kernel config for linux-2.6.20-gentoo-r8 :

```
# Block devices

#

CONFIG_BLK_DEV_FD=m

# CONFIG_BLK_DEV_XD is not set

# CONFIG_PARIDE is not set

# CONFIG_BLK_CPQ_DA is not set

# CONFIG_BLK_CPQ_CISS_DA is not set

# CONFIG_BLK_DEV_DAC960 is not set

# CONFIG_BLK_DEV_UMEM is not set

# CONFIG_BLK_DEV_COW_COMMON is not set

CONFIG_BLK_DEV_LOOP=y

# CONFIG_BLK_DEV_CRYPTOLOOP is not set

# CONFIG_BLK_DEV_NBD is not set

# CONFIG_BLK_DEV_SX8 is not set

# CONFIG_BLK_DEV_UB is not set

CONFIG_BLK_DEV_RAM=y

CONFIG_BLK_DEV_RAM_COUNT=16

CONFIG_BLK_DEV_RAM_SIZE=8192

CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024

CONFIG_BLK_DEV_INITRD=y

CONFIG_CDROM_PKTCDVD=m

CONFIG_CDROM_PKTCDVD_BUFFERS=8

# CONFIG_CDROM_PKTCDVD_WCACHE is not set

# CONFIG_ATA_OVER_ETH is not set

#

# ATA/ATAPI/MFM/RLL support

#

CONFIG_IDE=y

CONFIG_IDE_MAX_HWIFS=4

CONFIG_BLK_DEV_IDE=y

#

# CONFIG_BLK_DEV_IDE_SATA is not set

# CONFIG_BLK_DEV_HD_IDE is not set

CONFIG_BLK_DEV_IDEDISK=y

CONFIG_IDEDISK_MULTI_MODE=y

CONFIG_BLK_DEV_IDECD=y

# CONFIG_BLK_DEV_IDETAPE is not set

CONFIG_BLK_DEV_IDEFLOPPY=m

# CONFIG_BLK_DEV_IDESCSI is not set

# CONFIG_IDE_TASK_IOCTL is not set

#

# IDE chipset support/bugfixes

#

CONFIG_IDE_GENERIC=y

# CONFIG_BLK_DEV_CMD640 is not set

CONFIG_BLK_DEV_IDEPNP=y

CONFIG_BLK_DEV_IDEPCI=y

CONFIG_IDEPCI_SHARE_IRQ=y

# CONFIG_BLK_DEV_OFFBOARD is not set

CONFIG_IDEPCI_SHARE_IRQ=y

# CONFIG_BLK_DEV_OFFBOARD is not set

CONFIG_BLK_DEV_GENERIC=y

# CONFIG_BLK_DEV_OPTI621 is not set

# CONFIG_BLK_DEV_RZ1000 is not set

CONFIG_BLK_DEV_IDEDMA_PCI=y

# CONFIG_BLK_DEV_IDEDMA_FORCED is not set

CONFIG_IDEDMA_PCI_AUTO=y

# CONFIG_IDEDMA_ONLYDISK is not set

# CONFIG_BLK_DEV_AEC62XX is not set

# CONFIG_BLK_DEV_ALI15X3 is not set

# CONFIG_BLK_DEV_AMD74XX is not set

# CONFIG_BLK_DEV_ATIIXP is not set

# CONFIG_BLK_DEV_CMD64X is not set

# CONFIG_BLK_DEV_TRIFLEX is not set

# CONFIG_BLK_DEV_CY82C693 is not set

# CONFIG_BLK_DEV_CS5520 is not set

# CONFIG_BLK_DEV_CS5530 is not set

# CONFIG_BLK_DEV_CS5535 is not set

# CONFIG_BLK_DEV_HPT34X is not set

# CONFIG_BLK_DEV_HPT366 is not set

# CONFIG_BLK_DEV_JMICRON is not set

# CONFIG_BLK_DEV_SC1200 is not set

# CONFIG_BLK_DEV_PIIX is not set

# CONFIG_BLK_DEV_IT821X is not set

# CONFIG_BLK_DEV_NS87415 is not set

# CONFIG_BLK_DEV_PDC202XX_OLD is not set

# CONFIG_BLK_DEV_PDC202XX_NEW is not set

# CONFIG_BLK_DEV_SVWKS is not set

# CONFIG_BLK_DEV_SIIMAGE is not set

# CONFIG_BLK_DEV_SIS5513 is not set

# CONFIG_BLK_DEV_SLC90E66 is not set

# CONFIG_BLK_DEV_TRM290 is not set

CONFIG_BLK_DEV_VIA82CXXX=y

# CONFIG_IDE_ARM is not set

# CONFIG_IDE_CHIPSETS is not set

CONFIG_BLK_DEV_IDEDMA=y

CONFIG_IDEDMA_IVB=y

CONFIG_IDEDMA_AUTO=y

CONFIG_IDEDMA_IVB=y

CONFIG_IDEDMA_AUTO=y

# CONFIG_BLK_DEV_HD is not set

#

# Serial ATA (prod) and Parallel ATA (experimental) drivers

#

CONFIG_ATA=y

# CONFIG_ATA_NONSTANDARD is not set

CONFIG_SATA_AHCI=y

#

#[bunch of disabled drivers]

CONFIG_SATA_VIA=y

#[more disabled drivers]

CONFIG_PATA_VIA=y

# CONFIG_PATA_WINBOND is not set

# CONFIG_PATA_WINBOND_VLB is not set

CONFIG_PATA_PLATFORM=y

```

- Am I missing anything, or is that incorrect?

and from dmesg:

```

VP_IDE: chipset revision 6

VP_IDE: not 100% native mode: will probe irqs later

VP_IDE: VIA vt8237 (rev 00) IDE UDMA133 controller on pci0000:00:0f.1

    ide0: BM-DMA at 0xcc00-0xcc07, BIOS settings: hda:DMA, hdb:pio

Probing IDE interface ide0...

hdb: BENQ DVD LS DW1655, ATAPI CD/DVD-ROM drive

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

Probing IDE interface ide1...

hdb: ATAPI 94X DVD-ROM DVD-R CD-R/RW drive, 2048kB Cache, UDMA(33)

Uniform CD-ROM driver Revision: 3.20

sata_via 0000:00:0f.0: version 2.0

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10

PCI: setting IRQ 10 as level-triggered

ACPI: PCI Interrupt 0000:00:0f.0[B] -> Link [LNKB] -> GSI 10 (level, low) -> IRQ 10

PCI: VIA VLink IRQ fixup for 0000:00:0f.0, from 15 to 10

sata_via 0000:00:0f.0: routed to hard irq line 10

ata1: SATA max UDMA/133 cmd 0xB400 ctl 0xB802 bmdma 0xC400 irq 10

ata2: SATA max UDMA/133 cmd 0xBC00 ctl 0xC002 bmdma 0xC408 irq 10

scsi0 : sata_via

ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ATA: abnormal status 0x7F on port 0xB407

ATA: abnormal status 0x7F on port 0xB407

ata1.00: ATA-7, max UDMA7, 586072368 sectors: LBA48 NCQ (depth 0/32)

ata1.00: ata1: dev 0 multi count 16

ata1.00: configured for UDMA/133

scsi1 : sata_via

ata2: SATA link down 1.5 Gbps (SStatus 0 SControl 300)

ATA: abnormal status 0x7F on port 0xBC07

scsi 0:0:0:0: Direct-Access     ATA      SAMSUNG HD300LJ  ZT10 PQ: 0 ANSI: 5

SCSI device sda: 586072368 512-byte hdwr sectors (300069 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: 586072368 512-byte hdwr sectors (300069 MB)
```

Any help would be greatly appreciated, many thanks in advance.

----------

## eroth

i've played around with the kernel config based on what i've read from other topics with similar issues.

i've switched everything over to libata, which puts the dvd on /dev/sr0.  performance is still pretty weak.

when i do hdparm -tT:

```
/dev/dvd:

 Timing cached reads:   196 MB in  2.01 seconds =  97.69 MB/sec

 Timing buffered disk reads:   14 MB in  3.05 seconds =   4.59 MB/sec
```

I assume that I should be able to do way more than 4.59MB a second.

dmesg now shows the following:

```
sata_via 0000:00:0f.0: version 2.0

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10

PCI: setting IRQ 10 as level-triggered

ACPI: PCI Interrupt 0000:00:0f.0[B] -> Link [LNKB] -> GSI 10 (level, low) -> IRQ 10

PCI: VIA VLink IRQ fixup for 0000:00:0f.0, from 15 to 10

sata_via 0000:00:0f.0: routed to hard irq line 10

ata1: SATA max UDMA/133 cmd 0xB400 ctl 0xB802 bmdma 0xC400 irq 10

ata2: SATA max UDMA/133 cmd 0xBC00 ctl 0xC002 bmdma 0xC408 irq 10

scsi0 : sata_via

ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ATA: abnormal status 0x7F on port 0xB407

ATA: abnormal status 0x7F on port 0xB407

ata1.00: ATA-7, max UDMA7, 586072368 sectors: LBA48 NCQ (depth 0/32)

ata1.00: ata1: dev 0 multi count 16

ata1.00: configured for UDMA/133

scsi1 : sata_via

ata2: SATA link down 1.5 Gbps (SStatus 0 SControl 300)

ATA: abnormal status 0x7F on port 0xBC07

scsi 0:0:0:0: Direct-Access     ATA      SAMSUNG HD300LJ  ZT10 PQ: 0 ANSI: 5

SCSI device sda: 586072368 512-byte hdwr sectors (300069 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: 586072368 512-byte hdwr sectors (300069 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 sda3 sda4

sd 0:0:0:0: Attached scsi disk sda

pata_via 0000:00:0f.1: version 0.2.1

ACPI: PCI Interrupt 0000:00:0f.1[A] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11

PCI: VIA VLink IRQ fixup for 0000:00:0f.1, from 255 to 11

ata3: PATA max UDMA/133 cmd 0x1F0 ctl 0x3F6 bmdma 0xCC00 irq 14

ata4: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xCC08 irq 15

scsi2 : pata_via

ata3.01: ATAPI, max UDMA/33

ata3.01: configured for UDMA/33

scsi3 : pata_via

ata4: port disabled. ignoring.

ata4: reset failed, giving up

scsi 2:0:1:0: CD-ROM            BENQ     DVD LS DW1655    BCHB PQ: 0 ANSI: 5

```

Does anyone have any ideas on how I can speed that up, so that dvds would play?

Thanks in advance...

----------

## eroth

even though it seems that my calls for help are falling on deaf ears, i'm still struggling to overcome this issue.  

i've been reinstalling the kernel like crazy, trying different combos of options, but to no avail.

currently dmesg gives me the following:

```
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

VP_IDE: IDE controller at PCI slot 0000:00:0f.1

ACPI: PCI Interrupt 0000:00:0f.1[A] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11

PCI: VIA VLink IRQ fixup for 0000:00:0f.1, from 255 to 11

VP_IDE: chipset revision 6

VP_IDE: not 100% native mode: will probe irqs later

VP_IDE: VIA vt8237 (rev 00) IDE UDMA133 controller on pci0000:00:0f.1

    ide0: BM-DMA at 0xcc00-0xcc07, BIOS settings: hda:pio, hdb:DMA

Probing IDE interface ide0...

hdb: BENQ DVD LS DW1655, ATAPI CD/DVD-ROM drive

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

hdb: ATAPI 94X DVD-ROM DVD-R CD-R/RW drive, 2048kB Cache, UDMA(33)

Uniform CD-ROM driver Revision: 3.20

sata_via 0000:00:0f.0: version 2.0

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10

PCI: setting IRQ 10 as level-triggered

ACPI: PCI Interrupt 0000:00:0f.0[B] -> Link [LNKB] -> GSI 10 (level, low) -> IRQ 10

PCI: VIA VLink IRQ fixup for 0000:00:0f.0, from 15 to 10

sata_via 0000:00:0f.0: routed to hard irq line 10

ata1: SATA max UDMA/133 cmd 0xB400 ctl 0xB802 bmdma 0xC400 irq 10

ata2: SATA max UDMA/133 cmd 0xBC00 ctl 0xC002 bmdma 0xC408 irq 10

scsi0 : sata_via

ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ATA: abnormal status 0x7F on port 0xB407

ATA: abnormal status 0x7F on port 0xB407

ata1.00: ATA-7, max UDMA7, 586072368 sectors: LBA48 NCQ (depth 0/32)

ata1.00: ata1: dev 0 multi count 16

ata1.00: configured for UDMA/133

scsi1 : sata_via

ata2: SATA link down 1.5 Gbps (SStatus 0 SControl 300)

ATA: abnormal status 0x7F on port 0xBC07

scsi 0:0:0:0: Direct-Access     ATA      SAMSUNG HD300LJ  ZT10 PQ: 0 ANSI: 5

SCSI device sda: 586072368 512-byte hdwr sectors (300069 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: 586072368 512-byte hdwr sectors (300069 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 sda3 sda4

sd 0:0:0:0: Attached scsi disk sda

```

the dvd is on hdb whereas the hd is on sda.  

i get the following from hdparm:

```
/dev/dvd:

 IO_support    =  1 (32-bit)

 unmaskirq     =  1 (on)

 using_dma     =  1 (on)

 keepsettings  =  0 (off)

 readonly      =  0 (off)

 readahead     = 256 (on)

 HDIO_GETGEO failed: Inappropriate ioctl for device

 hdparm -tT /dev/dvd

/dev/dvd:

 Timing cached reads:   188 MB in  2.02 seconds =  93.12 MB/sec

BLKFLSBUF failed: Function not implemented

 Timing buffered disk reads:   18 MB in  3.30 seconds =   5.46 MB/sec

BLKFLSBUF failed: Function not implemented

# hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:   202 MB in  2.02 seconds = 100.22 MB/sec

 Timing buffered disk reads:  142 MB in  3.04 seconds =  46.77 MB/sec

```

does anyone have any ideas that might be helpful?   is it possible that something on the motherboard is toast?

----------

## dsd

measuring transfer rates involving a dvd drive seems pointless. optical media is slow. any reason why you're so set on doing this?

----------

## eroth

well, i had just gleaned from other somewhat related posts that the speed would drastically improve once DMA was working properly.

but the output from hdparm also distrubs me with the "BLKFLSBUF failed: Function not implemented"  error.

I've changed to the 2.6.21-r3 kernel (from gentoo-sources) and i'm back to being able to play DVDs, but the strange output is still there.  i'd like to at least understand what's going on there.

----------

## eroth

ok, the current status of this problem:

 some DVDs work.  it seems that DVDs from Warner Bros crap out when hitting start from the dvd menu.  it seems as if they stutter between menu and beginning of the film (flashing the 2 images back and forth) before freezing.

when posting my original problem in this thread, i had tried 4 dvds which i had from blockbuster...after getting a new one yesterday, it played fine.  seeing the dvd laying there, it struck me that they were all from the same company.

Is this possible?  is there a way to catch the output from xine, before it freezes the machine, in order to figure out what's going on?

for reference, my command from within mythtv to launch xine is as follows:

```
xine -A alsa -V xxmc -pfq --no-logo -Z dvd://
```

----------

