From: Andreas Schallenberg <embedded@gmx.net>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: UIO: missing resource mapping
Date: Thu, 12 Jul 2012 09:26:23 +0200 [thread overview]
Message-ID: <4FFE7C1F.7080702@gmx.net> (raw)
Hello,
I'm doing experiments with the Userspace IO driver (UIO_PCI_GENERIC) and
a set of PCIe cards. The kernel version is 3.4.4, CPU is a Marvell
MV78200 (ARMv5te). Example with an Intel ethernet card:
This makes /dev/uio0 appear
echo -n "8086 10d3" >/sys/bus/pci/drivers/uio_pci_generic/new_id
# lspci -v -k -s 0000:00:01.0
00:01.0 Ethernet controller: Intel Corporation 82574L Gigabit Network
Connection
Subsystem: Intel Corporation Gigabit CT Desktop Adapter
Flags: bus master, fast devsel, latency 0, IRQ 36
Memory at c00c0000 (32-bit, non-prefetchable) [size=128K]
Memory at c0000000 (32-bit, non-prefetchable) [size=512K]
I/O ports at f0800000 [size=32]
Memory at c00e0000 (32-bit, non-prefetchable) [size=16K]
[virtual] Expansion ROM at c0080000 [disabled] [size=256K]
Capabilities: [c8] Power Management version 2
Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [e0] Express Endpoint, MSI 00
Capabilities: [a0] MSI-X: Enable- Count=5 Masked-
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Device Serial Number 00-1b-21-ff-ff-c4-f7-2f
Kernel driver in use: uio_pci_generic
Suprisingly, there is no "maps" directory in /sys/class/uio/uio0 now. I
made a small change to the UIO code:
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index a783d53..b639654 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -274,8 +274,10 @@ static int uio_dev_add_attributes(struct uio_device
*idev)
for (mi = 0; mi < MAX_UIO_MAPS; mi++) {
mem = &idev->info->mem[mi];
- if (mem->size == 0)
- break;
+ if (mem->size == 0) {
+ dev_err(idev->dev, "map %d has zero size\n", mi);
+ continue; // was: break
+ }
if (!map_found) {
map_found = 1;
idev->map_dir = kobject_create_and_add("maps",
If I have this in the kernel and give the "echo" command as shown above
I get:
[ 43.761723] uio uio0: map 0 has zero size
[ 43.765760] uio uio0: map 1 has zero size
[ 43.769787] uio uio0: map 2 has zero size
[ 43.774298] uio uio0: map 3 has zero size
[ 43.778333] uio uio0: map 4 has zero size
On the other hand, I can see the resources:
# cat /sys/class/uio/uio0/device/resource
0x00000000c00c0000 0x00000000c00dffff 0x0000000000040200
0x00000000c0000000 0x00000000c007ffff 0x0000000000040200
0x00000000f0800000 0x00000000f080001f 0x0000000000040101
0x00000000c00e0000 0x00000000c00e3fff 0x0000000000040200
...more...
Looking further at the code, I cannot see where the mem fields are being
filled at all.
Which code is supposed to write the struct uio_mem?
Best,
Andreas
next reply other threads:[~2012-07-12 7:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 7:26 Andreas Schallenberg [this message]
2012-07-12 19:44 ` UIO: missing resource mapping Hans J. Koch
2012-07-12 23:16 ` Michael S. Tsirkin
2012-07-12 23:40 ` Hans J. Koch
2012-07-12 23:58 ` Michael S. Tsirkin
2012-07-13 8:09 ` Dominic Eschweiler
2012-07-13 13:22 ` Michael S. Tsirkin
2012-07-13 14:18 ` Hans J. Koch
2012-07-13 14:44 ` Dominic Eschweiler
2012-07-13 14:42 ` Dominic Eschweiler
2012-07-13 18:19 ` Michael S. Tsirkin
2012-07-16 18:16 ` Dominic Eschweiler
2012-07-16 21:58 ` Hans J. Koch
2012-07-18 10:40 ` Dominic Eschweiler
2012-07-18 23:47 ` Hans J. Koch
2012-08-06 11:49 ` Dominic Eschweiler
2012-08-08 22:08 ` Hans J. Koch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FFE7C1F.7080702@gmx.net \
--to=embedded@gmx.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.