Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 11-08-2017, 02:05 AM   #1
LQ Newbie
Registered: Aug 2017
Posts: 1

Rep: Reputation: Disabled
Question Conflict PCIE region size in /sys and /proc!

I and writing a PCIE driver for my custom FPGA base board, where bar0 and bar2 are adopted for io. However, after I insert this board to Openwrt router board, I find that the region size information given by /sys/devices/pci0000:00/0000:00:00.0/resource and /proc/iomem is conflict.

Content of /sys/devices/pci0000:00/0000:00:00.0/resource is (for bar0 and bar2):

0x0000000010008000 0x0000000010009000 0x0000000000040200
0x0000000010000000 0x0000000010008000 0x0000000000040200

While content of /proc/iomem is (for bar0 and bar2):

10000000-13ffffff : mem_base
10000000-13ffffff : PCI memory space
10000000-10007fff : 0000:00:00.0
10008000-10008fff : 0000:00:00.0

Obviously, the region size given by the former one is 4097, while the region size given by the latter one is 4096. According to the PCIE protocol, the region size should always be power of two, isn't it?

So what is the reason that cause this problem and how to fix it?
Old 11-11-2017, 11:44 AM   #2
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 9,359

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Welcome to LQ.

As one of the few hardware heads about here, let me have a go at this.
Am I correct in assuming the relevant figures are highlighted?
0x0000000010008000 0x0000000010009000 0x0000000000040200
That, indeed gives some dubious multiple of 4096 on a calculator, but in fact 4097 in hardware- my calculator is very odd. This one
10008000-10008fff : 0000:00:00.0
The first of those gives 0x7fff of a difference, the second 0x0fff, or 4095; when you look at that from a hardware perspective, it's 4096, remembering the days of limited address lines, number ranges go from 0x00-0xFF for 256 addressable bits with 8 lines. 0x00 is a valid address, 255 is the top address, giving 256 bits

Applying this logic to your figures, the output of /sys/devices/pci0000:00/0000:00:00.0/resource is suspect. You notice the address 0x0000000010008000 is assigned to both blocks? I suspect it shouldn't be. That looks like a kernel bug or system bug to me.
For your purposes, treat it as 0x0000 - 7FFF & 8000 - 8fff, and report the bug. There's a time penalty in doing that, but pay it.

I must say in passing, that I expected to be fingering your code, and not the kernel.
Old 11-12-2017, 07:47 PM   #3
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
Also: the number of inclusive values in any range is hi - lo + 1 ... The number of values in the inclusive range [000...fff] is 4,096.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I cannot see my PCIe device in /sys/devices rob18767 Linux - Hardware 4 08-26-2017 11:35 AM
[SOLVED] Clarification of Proc Filesystem for PCIe khhyle Linux - Newbie 3 12-05-2016 04:32 PM
whats the difference between /proc/sys and /sys sigint-ninja Linux - Newbie 1 01-15-2015 10:38 PM
[SOLVED] How serious is this conflict? ACPI: I/O resource... conflicts with region SMBI holister Linux - Hardware 9 11-10-2010 05:56 PM
[SOLVED] how to increase the size of '/proc/sys/vm/min_free_kbytes' from ... warnold Linux - Networking 2 11-05-2008 11:21 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:40 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration