Google luky.org euqset.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mount PCI-express RAM memory as block device


On Fri, 7 Jan 2005, Shakthi Kannan wrote:

Greetings!

I would like to know as to how we can mount a
filesystem for RAM memory on a PCI-express card.
System for development is x86 with 2.4.22 kernel.

I, initially wrote a ramdisk driver to read/write data
between buffer and RAM. Here, I have used:
device->data = vmalloc (device->size);
where:
- device is the device driver structure variable
- data = unsigned char *
- size = unsigned int

I am able to load the above block driver and mount a
filesystem using:
dd if=/dev/zero of=/dev/sbull bs=1k count=64
mkdir /mnt/mysbull
mke2fs -vm0 /dev/sbull 64
mount /dev/sbull /mnt/mysbull

For PCI device driver, I have modifed the above to
directly ioremap device->data as follows:
device->data = ioremap_nocache (BASE_ADDRESS,
BASE_SIZE);
Have successfully done:
dd if=/dev/zero of=/dev/sbull bs=1k count=64
mkdir /mnt/mysbull
mke2fs -vm0 /dev/sbull 64

But, when I proceed to mount a filesystem, it fails.
mount /dev/sbull /mnt/mysbull

mount:error while guessing filesystem type
mount: you must specify the filesystem type

Also, if I give "fsck -v /dev/sbull", it returns with
improper filesystem super block. Even if I specify "-t
ext2" for mount, it fails. I even tried a
loopback device mount, but it fails too:
mount -o loop /dev/sbull /mnt/mysbull

FAT: bogus logical sector size 0
VFS: Can't find a valid FAT filesystem on dev FA:00

How can I map the RAM memory on the PCI card, even
though I don't allocate any memory (during ioremap)
and display that to the end user as a mounted
filesystem so that he/she can read/write files to it?

Any help/pointers to links is appreciated.

Thanks,

K Shakthi


When you ioremap() in the kernel, you get a cookie that you can use (in the kernel) to copy data to and from the device.

This doesn't allow a user to copy data directly. Instead,
in your read() and write() routines, you use the appropriate
copy_to/from_user() routines. If the device is not a
block device, then you will have to mount it through the
loop device. If it is a block device, you can mount it
directly after initialization.

From your explanation, it looks like the BASE_ADDRESS is not
the device's on-board memory, but instead, its control
registers, i.e., a simple implementation bug.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
 Notice : All mail here is now cached for review by Dictator Bush.
                 98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


$B$3$N>pJs$,$"$J$?$NC5$7$F$$?$b$N$+$I$&$+A*Br$7$F$/$@$5$!#(B
yes/$B$^$5$K$3$l$@!*(B   no/$B0c$&$J$!(B   part/$B0lIt8+$D$+$C$?(B   try/$B$3$l$G;n$7$F$_$k(B

$B$"$J$?$,C5$7$F$$?>pJs$O$I$N$h$&$J$3$H$+!"$4<+M3$K5-F~2<$5$!#FC$K!V$^$5$K$3$l$@!*!W$H8@$&>l9g$O5-F~$r$*4j$$7$^$9!#(B
$BNc(B:$B!VJ#?t$N%^%7%s$+$i(BCATV$B7PM3$G(Bipmasquerade$B$rMxMQ$7$F(BWeb$B$r;2>H$7$?$>l9g$N@_Dj$K$D$$F!W(B
Follow-Ups: References: