How to disable DMA for compact-flash disk?
I'm trying to use Fedora 11 with default kernel on an old via system that boots from compact flash. DMA is not supported on the CF for whatever reason, and in previous kernels, I've always disabled DMA, first with ide=nodma, and then later with ide_core.nodma=0.0 ide_core.nodma=0.1 ...
However, this no longer works in the 2.6.29.6 kernel.
Fedora 11 32-bit
Kernel 2.6.29.6-217.2.3.fc11.i686.PAE
(I can't get a custom built & somewhat hacked 2.6.31-rc5 to find a ramdisk or root-disk, but the errors about unknown boot option are the same).
From dmesg output:
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 255649 Kernel command line: ro root=UUID=6f65a5dd-7872-4715-be9c-3741bd6ac7d3 ide_core.nodma=0.0 ide_core.nodma=0.1 ide_core.nodma=1.0 ide_core.nodm a=1.1 console=ttyS0,38400
Unknown boot option `ide_core.nodma=0.0': ignoring
Unknown boot option `ide_core.nodma=0.1': ignoring
Unknown boot option `ide_core.nodma=1.0': ignoring
Unknown boot option `ide_core.nodma=1.1': ignoring
....
Gscsi0 : pata_via
scsi1 : pata_via
ata1: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xe900 irq 14
ata2: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xe908 irq 15
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input2 ata1.01: CFA: TRANSCEND, 20081024, max UDMA/66
ata1.01: 3980592 sectors, multi 0: LBA
ata1.01: limited to UDMA/33 due to 40-wire cable
ata1.01: configured for UDMA/33
scsi 0:0:1:0: Direct-Access ATA TRANSCEND 2008 PQ: 0 ANSI: 5
sd 0:0:1:0: [sda] 3980592 512-byte hardware sectors: (2.03 GB/1.89 GiB)
sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sd 0:0:1:0: [sda] 3980592 512-byte hardware sectors: (2.03 GB/1.89 GiB)
sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sda:<3>ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.01: cmd c8/00:08:00:00:00/00:00:00:00:00/f0 tag 0 dma 4096 in
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.01: status: { DRDY }
ata1: soft resetting link
ata1.01: configured for UDMA/33
ata1: EH complete
ata1.01: limiting speed to UDMA/25:PIO4
ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen ata1.01: cmd c8/00:08:00:00:00/00:00:00:00:00/f0 tag 0 dma 4096 in
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.01: status: { DRDY }
ata1: soft resetting link
ata1.01: configured for UDMA/25
ata1: EH complete
ata1.01: limiting speed to PIO4
ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen ata1.01: cmd c8/00:08:00:00:00/00:00:00:00:00/f0 tag 0 dma 4096 in
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.01: status: { DRDY }
ata1: soft resetting link
ata1.01: configured for PIO4
ata1: EH complete
sda1
sd 0:0:1:0: [sda] Attached SCSI disk
sd 0:0:1:0: Attached scsi generic sg0 type 0
kjournald starting. Commit interval 5 seconds
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 5 lines · On Tue, 11 Aug 2009 11:51:18 -0700 Ben Greear <[email protected]> wrote:
I'm trying to use Fedora 11 with default kernel on an old via system that boots from compact flash. DMA is not supported on the CF for whatever reason, and in previous kernels, I've always disabled DMA, first with ide=nodma, and then later with ide_core.nodma=0.0 ide_core.nodma=0.1 ...
Fedora switched to libata some releases ago so
libata.dma=n
0 - off
1 - disk only
+ 2 disk/CD
+ 4 disk/CD/CFA
(so you can turn DMA off just for CFA devices providing they admit they are CFA)
Quoted 13 lines · Alan Cox
Quoted 5 lines · On Tue, 11 Aug 2009 11:51:18 -0700 Ben Greear<[email protected]> wrote:
I'm trying to use Fedora 11 with default kernel on an old via system that boots from compact flash. DMA is not supported on the CF for whatever reason, and in previous kernels, I've always disabled DMA, first with ide=nodma, and then later with ide_core.nodma=0.0 ide_core.nodma=0.1 ...
Fedora switched to libata some releases ago so
libata.dma=n
Quoted 8 lines
0 - off
1 - disk only+ 2 disk/CD
+ 4 disk/CD/CFA(so you can turn DMA off just for CFA devices providing they admit they are CFA)
This worked fine, but now I'm having some more issues. Using libata is 1/2 as fast as using IDE mode. I *think* the problem might be that libsata may not be using 32-bit PIO mode, but I'm not certain of that. It seems that ide mode uses PIO2 v/s PIO4 for libsata too.
I'm going to try configuring a .31 kernel with ide instead of libsata. In case it helps anyone, here are more more details:
On Fedora 8, using a 2.6.29-6 kernel compiled for ide instead of libata, I get about 6MB/s read (according to hdparm -t).
[root@lanforge-D0-20 lanforge]# hdparm -tT /dev/hdb1
/dev/hdb1:
Timing cached reads: 460 MB in 2.00 seconds = 230.00 MB/sec
Timing buffered disk reads: 18 MB in 3.24 seconds = 5.56 MB/sec
[root@lanforge-D0-20 lanforge]# hdparm -tT /dev/hdb1
/dev/hdb1:
Timing cached reads: 460 MB in 2.00 seconds = 229.78 MB/sec
Timing buffered disk reads: 18 MB in 3.23 seconds = 5.57 MB/sec
dmesg output:
Uniform Multi-Platform E-IDE driver
via82cxxx 0000:00:0f.1: VIA vt8237 (rev 00) IDE UDMA133 via82cxxx 0000:00:0f.1: IDE controller (0x1106:0x0571 rev 0x06) via82cxxx 0000:00:0f.1: not 100% native mode: will probe irqs later
ide: disallowing DMA for hda
ide: disallowing DMA for hdb
ide0: BM-DMA at 0xe900-0xe907
ide1: BM-DMA at 0xe908-0xe90fProbing IDE interface ide0...
hdb: Ridata CF, CFA DISK drive
hdb: host max PIO5 wanted PIO255(auto-tune) selected PIO2
hdb: host max PIO5 wanted PIO255(auto-tune) selected PIO2
Probing IDE interface ide1...
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15ide_generic: please use "probe_mask=0x3f" module parameter for probing all legacy ISA IDE ports ide-gd driver 1.18
hdb: max request size: 128KiB
hdb: 15662304 sectors (8019 MB) w/1KiB Cache, CHS=15538/16/63
hdb: hdb1
[root@lanforge-D0-20 lanforge]# hdparm /dev/hdb1
/dev/hdb1:
multcount = 0 (off) IO_support = 1 (32-bit) unmaskirq = 1 (on) using_dma = 0 (off) keepsettings = 0 (off) readonly = 0 (off) readahead = 256 (on) geometry = 15538/16/63, sectors = 3887667, start = 63
On F11, using a kernel compiled for libata, I'm getting about 1/2 that speed. I get similar results for a 2.6.31-rc5 kernel and the official F11 2.6.29-6-ish kernel. I also get similar results on FC8 with the default FC8 2.6.26 kernel (using libsata).
Gscsi0 : pata_via
scsi1 : pata_via
ata1: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xe900 irq 14
ata2: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xe908 irq 15
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input2 ata1.01: CFA: Ridata CF, 20080820, max UDMA/133
ata1.01: 15662304 sectors, multi 0: LBA
ata1.01: limited to UDMA/33 due to 40-wire cable
ata1.01: configured for PIO4
scsi 0:0:1:0: Direct-Access ATA Ridata CF 2008 PQ: 0 ANSI: 5
sd 0:0:1:0: [sda] 15662304 512-byte hardware sectors: (8.01 GB/7.46 GiB) sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sd 0:0:1:0: [sda] 15662304 512-byte hardware sectors: (8.01 GB/7.46 GiB) sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1
sd 0:0:1:0: [sda] Attached SCSI disk
sd 0:0:1:0: Attached scsi generic sg0 type 0
[root@lanforge-D0-20 ~]# hdparm /dev/sda1
/dev/sda1:
IO_support = 0 (default) readonly = 0 (off) readahead = 256 (on) geometry = 974/255/63, sectors = 14336000, start = 63
[root@lanforge-D0-20 ~]# hdparm -Tt /dev/sda1
/dev/sda1:
Timing cached reads: 280 MB in 2.00 seconds = 139.98 MB/sec
Timing buffered disk reads: 10 MB in 3.69 seconds = 2.71 MB/sec
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 4 lines
This worked fine, but now I'm having some more issues. Using libata is 1/2 as fast as using IDE mode. I *think* the problem might be that libsata may not be using 32-bit PIO mode, but I'm not certain of that. It seems that ide mode uses PIO2 v/s PIO4 for libsata too.
As of 2.6.29 libata doesn't use 32bit PIO (it shouldn't make a difference for most chipsets but it does for some). 2.6.30 does for some and you can turn it on for others if you want to test by inheriting ata_bmdma32_port_ops instead of ata_bmdma_port_ops
Quoted 3 lines
hdb: Ridata CF, CFA DISK drive
hdb: host max PIO5 wanted PIO255(auto-tune) selected PIO2
hdb: host max PIO5 wanted PIO255(auto-tune) selected PIO2
Very odd it picked PIO2, but the numbers you quote for hdparm doesn't sound like PIO2 so its hard to guess.
Quoted 1 line
ata1.01: configured for PIO4
So libata picked a faster rate (PIO4 is the fastest the controller is properly specced for according to my docs - it probably can do PIO5 (CF specific))
Quoted 3 lines
/dev/sda1:
Timing cached reads: 280 MB in 2.00 seconds = 139.98 MB/sec
Timing buffered disk reads: 10 MB in 3.69 seconds = 2.71 MB/sec
Would be very interested to know if bmdma32_port_ops gives you the speed.
Quoted 9 lines · Alan Cox
Quoted 4 lines
This worked fine, but now I'm having some more issues. Using libata is 1/2 as fast as using IDE mode. I *think* the problem might be that libsata may not be using 32-bit PIO mode, but I'm not certain of that. It seems that ide mode uses PIO2 v/s PIO4 for libsata too.
As of 2.6.29 libata doesn't use 32bit PIO (it shouldn't make a difference for most chipsets but it does for some). 2.6.30 does for some and you can turn it on for others if you want to test by inheriting
ata_bmdma32_port_opsinstead ofata_bmdma_port_ops
Can you give me a clue as to what code needs poking? I'm working on the latest 31-rc5 tree, btw.
PS. Can't get an ide based 2.6.31-rc5 kernel to boot in F11, though it doesn't seem to be related to ide. I probably have something wrong in my .config.
Thanks,
ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 6 lines
Can you give me a clue as to what code needs poking? I'm working on the latest 31-rc5 tree, btw.
PS. Can't get an ide based 2.6.31-rc5 kernel to boot in F11, though it doesn't seem to be related to ide. I probably have something wrong in my .config.
Tejun made it all very class based so you have inheriting operations structures thus in pata_via.c find
static struct ata_port_operations via_port_ops = {
.inherits = &ata_bmdma_port_ops,
and change it to
static struct ata_port_operations via_port_ops = {
.inherits = &ata_bmdma32_port_ops,
Quoted 10 lines · Alan Cox
Quoted 6 lines
Can you give me a clue as to what code needs poking? I'm working on the latest 31-rc5 tree, btw.
PS. Can't get an ide based 2.6.31-rc5 kernel to boot in F11, though it doesn't seem to be related to ide. I probably have something wrong in my .config.
Tejun made it all very class based so you have inheriting operations structures thus in
pata_via.cfind
Quoted 7 lines
static struct
ata_port_operationsvia_port_ops= {
.inherits =&ata_bmdma_port_ops,and change it to
static struct
ata_port_operationsvia_port_ops= {
.inherits =&ata_bmdma32_port_ops,
Ok, I notice that my system has sata_via loaded as well, and it is also not using the 32-bit port ops. Should I change it as well?
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 10 lines · Alan Cox
Quoted 6 lines
Can you give me a clue as to what code needs poking? I'm working on the latest 31-rc5 tree, btw.
PS. Can't get an ide based 2.6.31-rc5 kernel to boot in F11, though it doesn't seem to be related to ide. I probably have something wrong in my .config.
Tejun made it all very class based so you have inheriting operations structures thus in
pata_via.cfind
Quoted 8 lines
static struct
ata_port_operationsvia_port_ops= {
.inherits =&ata_bmdma_port_ops,and change it to
static struct
ata_port_operationsvia_port_ops= {
.inherits =&ata_bmdma32_port_ops,
--
I can't see that it made any difference:
pata_via 0000:00:0f.1: version 0.3.4pata_via 0000:00:0f.1: PCI->APIC IRQ transform: INT A -> IRQ 20
scsi0 : pata_via
scsi1 : pata_via
ata1: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xe900 irq 14
ata2: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xe908 irq 15
ata1.01: CFA: Ridata CF, 20080820, max UDMA/133
ata1.01: 15662304 sectors, multi 0: LBA
ata1.01: limited to UDMA/33 due to 40-wire cable
ata1.01: configured for PIO4
scsi 0:0:1:0: Direct-Access ATA Ridata CF 2008 PQ: 0 ANSI: 5
sd 0:0:1:0: [sda] 15662304 512-byte logical blocks: (8.01 GB/7.46 GiB)
sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sda:
sd 0:0:1:0: Attached scsi generic sg0 type 0
sda1
sd 0:0:1:0: [sda] Attached SCSI disk
[root@lanforge-D0-20 lanforge]# hdparm /dev/sda1
/dev/sda1:
IO_support = 0 (default) readonly = 0 (off) readahead = 256 (on) geometry = 974/255/63, sectors = 14336000, start = 63
(read speed is still just under 3MB/s)
I used this patch:
drivers/ata/pata_via.c +1 -1
@@ -420,7 +420,7 @@ static struct scsi_host_template via_sht = { };static struct ata_port_operations via_port_ops = { - .inherits = &ata_bmdma_port_ops, + .inherits = &ata_bmdma32_port_ops, .cable_detect = via_cable_detect, .set_piomode = via_set_piomode, .set_dmamode = via_set_dmamode,
drivers/ata/sata_via.c +1 -1
@@ -114,7 +114,7 @@ static struct scsi_host_template svia_sht = { };static struct ata_port_operations svia_base_ops = { - .inherits = &ata_bmdma_port_ops, + .inherits = &ata_bmdma32_port_ops, .sff_tf_load = svia_tf_load, };
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 3 lines · Ben Greear
I'm trying to use Fedora 11 with default kernel on an old via system that boots from compact flash. DMA is not supported on the CF for whatever reason,
BTW if you are using a PATA-CF adapter... perhaps the DMA request and ack lines are not connected. Newer adapters may have them.
A similar issue is 80-wire cable detection (DMA-66+). Adapters plugged directly into the PATA connector (no cable) need to connect one of the lines to GND. Never seen an adapter with this connection.
Both issues can be easily fixed in hardware. DMA-66+ can also be forced in software.
Signature · 1 line
Krzysztof Halasa