[SOLVED] Compact flash DMA doesn't work, and I can't disable it.
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Compact flash DMA doesn't work, and I can't disable it.
First, I know this question has been asked before, but I haven't found an answer that works or makes sense for me, so I hope you all will pardon me for asking similar questions.
Now, the hardware:
AMD Geode SBC
5GB IDE harddrive - works
Compact flash cards:
1GB Toshiba "THNCF1G02QG 3.00" - works
1GB Kingston Tech "9930622-001.A00LF" - doesn't work
1GB Myflash A Data "20060703" - doesn't work
2GB Kingston Tech "CF CARD 2GB Ver2.19k" - doesn't work
The operating system:
It's a custom built system mostly following the LinuxFromScratch / CrossLinuxFromScratch instructions. I have used kernel 2.6.27.10 and 2.6.30. The system boots through grub, kernel, initramfs, and finally "joins" the initramfs with the disk file system to boot to X.
Here is the part I don't understand... I believe it's still in the kernel, before the initramfs and init script, when the kernel looks at the drives and throws the dma errors.
Then after the kernel has transferred execution to INIT, I get these errors:
Code:
[ 33.888690] Freeing unused kernel memory: 388k freed
I believe this is where it transfers from kernel to INIT, then to udev.
[ 34.077949] usb 1-1: configuration #1 chosen from 1 choice
[ 34.277961] usb 1-2: new low speed USB device using ohci_hcd and address 3
[ 34.505975] usb 1-2: configuration #1 chosen from 1 choice
[ 34.541977] input: Semtek Semtek USB MSR as /devices/pci0000:00/0000:00:0f.4/usb1/1-2/1-2:1.0/input/input0
[ 34.557977] generic-usb 0003:0C9D:0170.0001: input,hidraw0: USB HID v1.00 Keyboard [Semtek Semtek USB MSR] on usb-0000:00:0f.4-2/input0
[ 42.265342] udev: starting version 130
[ 65.112259] hdb: ide_dma_sff_timer_expiry: DMA status (0x41)
[ 75.112352] hdb: DMA timeout error
[ 75.112352] hdb: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }
[ 75.112352] hdb: possibly failed opcode: 0xc8
[ 75.112352] hdb: DMA disabled
[ 75.160345] ide0: reset: success
[ 75.776327] ieee80211: 802.11 data/management/control stack, git-1.1.13
[ 75.781344] ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>
[ 95.801529] hdb: ide_dma_sff_timer_expiry: DMA status (0x41)
[ 105.802131] hdb: DMA timeout error
[ 105.802131] hdb: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }
[ 105.802131] hdb: possibly failed opcode: 0xc8
[ 105.802131] hdb: DMA disabled
[ 105.850134] ide0: reset: success
[ 126.368939] hdb: ide_dma_sff_timer_expiry: DMA status (0x41)
[ 136.368404] hdb: DMA timeout error
[ 136.368404] hdb: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }
[ 136.368404] hdb: possibly failed opcode: 0xc8
[ 136.368404] hdb: DMA disabled
[ 136.416398] ide0: reset: success
These errors came while running from hda which is the IDE harddrive, with the compact flash card as hdb, just preset. The errors are nominally the same when I boot from the compact flash, which is the intended behavior.
I have added the patch from LinuxFromScratch to the initramfs init script, which should allow ide=nodma as a boot option, but it doesn't change anything.
I see various kernel options in the .config file, but I can't find them in the configuration. I have tried manually editing them out, but the kernel scripts overwrite the changes.
CONFIG_GENERIC_ISA_DMA
CONFIG_ISA_DMA_API
CONFIG_BLK_DEV_IDEDMA_SFF
CONFIG_BLK_DEV_IDEDMA_PCI
CONFIG_BLK_DEV_IDEDMA
I tried changing them in the arch/x86/configs/i386_defconfig, but this also is overwritten somewhere along the way.
At this point, I would even turn off DMA for the entire system (I found mention of that once but can't find it...), though I would rather turn DMA off just for the compact flash.
Anybody have thoughts? Or even better a solution?
Thanks, Paulcsf.
Last edited by paulcsf; 06-21-2009 at 09:40 PM.
Reason: formatting
Not sure if this will work whereas that is a CF type disk on USB subsystem, but since it identifies as hda, one never knows.. Have you tried the hdparm utility? `hdparm -d` allows you to get/set the 'using DMA or not' characteristic of a HDD.
(for your case, it would be `hdparm -d 0 /dev/hdb`)
There's a SCSI alternative, called sdparm, as well as a more complex but full-featured package called 'sg3-utils' also for SCSI-generic options.
The kernel config option you seek are (at least from what I can see here in my 2.6.30 kernel) enabled by default, and the options are hidden unless you click the OPTIONS tab atop Xconfig and select VIEW ALL OPTIONS which still does not let you adjust them, but atleast you can see where they are located.
I can't remember right off, but there *is* a way to manually change config options directly in the .config file, but in order for the changes to not be overwritten automatically, there needs to be some other option changed somewhere; but it has been a long time since I had to do this, and I cannot remember how it was done. Maybe Google can help?
Anyhow, if you have any success with hdparm or sdparm, you can set up some early-during-boot or early-during-init script entries to run the hdparm/sdparm commands you want.
Hope this at least gave you some ideas..... Though the utilities I mentioned, I'm not sure if you could execute them *early enough* to avoid/avert the error messages.
Sasha
Last edited by GrapefruiTgirl; 06-21-2009 at 12:28 AM.
Reason: clarity.
On further examination, and reading the links and messages at the link above, it seems some/many CF readers and CF adapters do not support DMA.
One option mentioned was to turn off DMA in the BIOS, but as mentioned also, it slows down disk access for the machine in general, unless the BIOS has DMA on/off options individually for each hardware system (PCI, IDE, etc..).
I went back this morning to verify the bios settings which don't seem to have any affect.
I have these options:
IDE Primary Master UDMA
IDE Primary Slave UDMA
HDD S.M.A.R.T. Capability
I have disabled all three, and bios still shows
Pri Master Disk: LBA, DMA 2, 6495MB
Pri Slave Disk: LBA, DMA 2, 2017MB
The messages that I believe are the kernel now show:
Code:
[ 1.895437] Uniform Multi-Platform E-IDE driver
[ 1.902950] cs5535 0000:00:0f.2: IDE controller (0x100b:0x002d rev 0x00)
[ 1.909877] cs5535 0000:00:0f.2: not 100% native mode: will probe irqs later
[ 1.916914] ide0: BM-DMA at 0xff00-0xff07
[ 1.923776] Probing IDE interface ide0...
[ 2.212429] hda: IBM-DBCA-206480, ATA DISK drive
[ 2.552096] hdb: CF CARD 2GB, ATA DISK drive
[ 2.559359] hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
[ 2.559719] hda: UDMA/33 mode selected
[ 2.566671] hdb: host max PIO4 wanted PIO255(auto-tune) selected PIO2
[ 2.566744] hdb: host side 80-wire cable detection failed, limiting max speed to UDMA33
[ 2.580462] hdb: UDMA/33 mode selected
[ 2.587566] ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
[ 2.596791] ide_generic: please use "probe_mask=0x3f" module parameter for probing all legacy ISA IDE ports
[ 2.610671] ide-gd driver 1.18
[ 2.617525] hda: max request size: 128KiB
[ 2.681804] hda: 12685680 sectors (6495 MB) w/420KiB Cache, CHS=13424/15/63
[ 2.688984] hda: cache flushes not supported
[ 2.696287] hda: hda1 hda2
[ 2.731836] hdb: max request size: 128KiB
[ 2.738827] hdb: 3940272 sectors (2017 MB) w/1KiB Cache, CHS=3909/16/63
[ 2.746364] hdb:<4>hdb: ide_dma_sff_timer_expiry: DMA status (0x61)
[ 32.752062] hdb: DMA timeout error
[ 32.756024] hdb: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }
[ 32.756024] hdb: possibly failed opcode: 0xc8
[ 32.756024] hda: DMA disabled
[ 32.756024] hdb: DMA disabled
[ 32.848060] ide0: reset: success
[ 32.867201] hdb1
[ 32.879252] Error: Driver 'pata_platform' is already registered, aborting...
These new messages are somewhat disappointing because now it's detecting the drives as UDMA/33, which I would think it shouldn't be given that I disabled UDMA in BIOS.
I don't see any other options related to DMA, and looked up S.M.A.R.T. as I was writing this and found out it should have nothing to do with DMA.
I will see if I can figure out how to change the kernel options manually, as those options sure look tempting.
Just for completeness sake, I re-enabled the BIOS options:
IDE Primary Master UDMA = AUTO
IDE Primary Slave UDMA = AUTO
HDD S.M.A.R.T. Capability = Enabled
And BIOS shows:
Pri Master Disk: LBA, ATA 33, 6495MB
Pri Slave Disk: LBA, ATA 33, 2017MB
The BIOS settings do change some of the details of the messages, but don't change the behavior of the system.
Now, back to the task at hand. I setup the initramfs init script to "install" busybox's hdparm, and added hdparm -d0 /dev/hda and hdparm -d0 /dev/hdb. This removes the DMA errors above at 65 and 95 seconds. However, the DMA errors at 2-3 and ~30 seconds persist, further confirming to me that these are in the kernel before init scripts.
Just FYI: bintools hdparm will accept hdparm -d 0 /dev/hda. Busybox requires the -d and 0 to be concatenated.
So, any ideas on getting DMA turned off for the kernel?
Thanks, Paulcsf.
Last edited by paulcsf; 06-21-2009 at 09:39 PM.
Reason: add detail of bios settings affects
ide-core.nodma= [HW] (E)IDE subsystem
Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc
.vlb_clock .pci_clock .noflush .noprobe .nowerr .cdrom
.chs .ignore_cable are additional options
See Documentation/ide/ide.txt.
libata.dma= [LIBATA] DMA control
libata.dma=0 Disable all PATA and SATA DMA
libata.dma=1 PATA and SATA Disk DMA only
libata.dma=2 ATAPI (CDROM) DMA only
libata.dma=4 Compact Flash DMA only
Combinations also work, so libata.dma=3 enables DMA
for disks and CDROMs, but not CFs.
I find the above documentation very interesting, both because it looks like it could help YOU, AND because there are SO MANY neat options in this file that I did not know about.
The above are just two examples/sections of the file '/Documentation/kernel-parameters.txt' which you find in the kernel source (for me it's 2.6.30) and the second one looks like what you want. The options are for use in your lilo.conf or grub.menu or wherever it is you set your boot parameters (maybe in your initrd?)
I gave up trying to remember how to get manual .config configuration options to stick.
This file shows how to implement options both for pluggable kernel modules, and also for in-kernel modules and subsystems, such as the DMA functionality for during early boot, which I think is what you want.
Cheers,
Sasha
PS - Open the file and do a search for 'DMA' to see all occurrences.
Last edited by GrapefruiTgirl; 06-21-2009 at 10:52 PM.
Reason: PS - ...
You're better off starting a fresh thread for your topic, since this one has been inactive for some time.
Start a new thread, provide a link to reference THIS thread if you feel it will help, and describe your hardware involved, what exactly the problem is, and what you have done so far to try to fix it. Then we can try to help you figure it out
Thank you very much... That got it handled, no kernel time DMA errors.
ide-core.nodma=0.1 - worked, turned off kernel dma at boot for hdb. libata.dma=0 - didn't work, I didn't detect any change in behavior.
So, let me recap for future reference.
In the kernel options (for me grub's menu.lst) I added ide-core.nodma=0.1. In init in my initramfs I added hdparm -d0 /dev/hdb.
With those changes the system boots without dma errors from the compact flash disk which previously gave dma errors and timeouts.
Thanks again, Paulcsf.
A question in regard to "Init" in the "Initramfs".
Where is the init file? (in order to include hdparm -d0 /dev/hdx in it). I have a similar issue with knoppix on 8GB SanDisk CF.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.