LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-05-2013, 07:18 PM   #1
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 183

Rep: Reputation: 28
Kernel fails to assign memory to PCIe device


I'm attempting to workaround an issue where a PCIe card does not show up on the PCIe bus after boot. I have discovered issuing a rescan of the PCIe bus via "echo 1 > /sys/bus/pci/rescan" results in the card showing up, but the kernel fails to assign memory to the device. I have tried loading the PCIe hotplug driver before doing the rescan but that doesn't help. I have also tried adding "pci=nobios" to the kernel commamnd line but that doesn't help either.

Here is a dump from the failure:
Code:
[   54.539874] pci 0000:0b:00.0: BAR 6: can't assign mem pref (size 0x200000)
[   54.546719] pci 0000:0b:00.0: BAR 3: can't assign mem (size 0x10000)
[   54.553042] pci 0000:0b:00.0: BAR 1: can't assign mem (size 0x4000)
[   54.559277] pci 0000:0b:00.0: BAR 0: assigned [io  0x5000-0x50ff]
[   54.565344] pci 0000:0b:00.0: BAR 0: set to [io  0x5000-0x50ff] (PCI address [0x5000-0x50ff])
I am running Fedora 15 kernel 3.0.3.

Any ideas what I can do to get the kernel to successful assign memory to a new pcie device post boot?
 
Old 12-06-2013, 01:50 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 & 7
Posts: 3,162

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
The message is printed by _pci_assign_resource when it tries to allocate the space requested by the PCI config registers (BARs) on the card. The most likely reason for failure is a conflict - it thinks the resources are already assigned. It probably found the card at boot, but the driver failed to start and did not properly release the resources. Bad driver, no cookie. This is not a BIOS problem or kernel problem. Get a new driver.
 
Old 12-06-2013, 03:21 PM   #3
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 183

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by smallpond View Post
The message is printed by _pci_assign_resource when it tries to allocate the space requested by the PCI config registers (BARs) on the card. The most likely reason for failure is a conflict - it thinks the resources are already assigned. It probably found the card at boot, but the driver failed to start and did not properly release the resources. Bad driver, no cookie. This is not a BIOS problem or kernel problem. Get a new driver.
I have added the driver to the blacklist (/etc/modprobe.d/blacklist.conf) so it is not being loaded at all. Also the pci device doesn't show up at boot, only after I issue the rescan.
 
Old 12-06-2013, 05:06 PM   #4
dbrazeau
Member
 
Registered: Aug 2009
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Posts: 183

Original Poster
Rep: Reputation: 28
So I've found the solution. If I remove the Root Port from the PCI bus before doing the retrain the memory windows get successfully assigned to the PCI device.

Code:
# lspci
00:00.0 Host bridge: Intel Corporation Ivy Bridge DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Ivy Bridge PCI Express Root Port (rev 09)
00:01.1 PCI bridge: Intel Corporation Ivy Bridge PCI Express Root Port (rev 09)
...

#echo 1 > /sys/bus/pci/devices/0000\:00\:01.1/remove
#echo 1 > /sys/bus/pci/rescan
 
Old 12-06-2013, 06:03 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,845

Rep: Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839Reputation: 2839
Thanks for the post-back. Might help some-one on a search one day.
 
Old 03-27-2018, 11:32 AM   #6
Clarkage
LQ Newbie
 
Registered: Mar 2018
Posts: 1

Rep: Reputation: Disabled
Thanks very much indeed, helped me out with some experiments I'm doing related to downstream port containment.
I was getting BAR issues depending on how the system booted up but removing the entire upstream bridge (that is DPC capable) and then re-scanning looks to have solved that aspect.
 
  


Reply


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
Regarding accessing memory mapping of the pcie device tamilvanan Programming 6 03-21-2013 09:12 AM
Efficient data copy from PCIe device to RAM in kernel PeterWurmsdobler Linux - Kernel 6 07-16-2010 10:18 AM
PCIe dma-able memory location in physical memory for Intel Nehalem / Tylersburg arch robvoo Linux - Kernel 4 07-31-2009 06:21 AM
Writing PCIe device driver pythonarms Linux - Kernel 0 02-23-2009 01:45 PM
Assign one USB-storage device to one device file Misel Linux - Hardware 1 08-28-2004 03:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:36 PM.

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