Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
05-25-2022, 01:07 AM
|
#1
|
LQ Newbie
Registered: Nov 2021
Posts: 20
Rep: 
|
Map a device to NTB
Hi,
I am working with AMD EPYC 7643 server machine. I have connected 2 AMD machines via PCIe SFF 8644 cable. I have enabled NTB on one of the machines. I would like to read the configuration space of the device(any PCIe endpoint), from the other machine. I was able to create a shared memory window between the systems using ntb_tool. Now, I want to map a device to this shared memory window, so that I can access the device from the other machine.
I was trying to figure out how to achieve this, but I could not find any solution. It's been quite a long time since I am trying this. Could someone help me out here? It would be of great help to me, if someone could point out some resources or forums where I could get some help.
Thanks in advance.
Regards,
Sai Kiran.
|
|
|
05-25-2022, 12:06 PM
|
#2
|
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,291
|
I didn't get very far with NTB when I tried working on it (10 years ago). We wanted to use it for a dual-machine failover application.
It sounds like instead of allocating a contiguous physical RAM region and mapping that on the peer, you want to map to memory-mapped PCI device configuration space. PCI configuration space is part of the physical address map of the CPU, but it is not at all clear to me that the same address coming from a PCI device (your non-transparent bridge) can access PCI config space on a different device.
|
|
|
05-25-2022, 12:13 PM
|
#3
|
LQ Newbie
Registered: Nov 2021
Posts: 20
Original Poster
Rep: 
|
Hi,
Thanks for your reply. I am not sure how to map NTB to memory mapped PCIe configuration space. I tried to create NTB shared memory window at the device location. I thought that it's close to mapping device to NTB. However, when I try to access the memory window, from the other machine, I get, IO_PAGE_FAULT error in the dmesg.
|
|
|
05-25-2022, 01:01 PM
|
#4
|
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,291
|
Computers aren't like old PC's with everything on one bus and one address space. I doubt a device address means anything to another device. Maybe an IOMMU can be configured to make access possible; I don't know.
|
|
|
05-27-2022, 12:29 AM
|
#5
|
LQ Newbie
Registered: Nov 2021
Posts: 20
Original Poster
Rep: 
|
I was looking at the source of ntb_tool. I found that the memory window is created using the API dma_alloc_coherent(). I tried to create memory window using kzalloc(). But once I do this, I get IO_PAGE_FAULT in the dmesg, when I am accessing the memory window. So, does this mean that only DMAable memory can be used for NTB memory window? Looking deeper into the NTB source code for IO_PAGE_FAULT error, I see that there is no issue with DMA, if this error is printed on screen. I am not sure what it means. Could it be some permission issue with the kernel pages allocated or is it DMA related?
|
|
|
05-28-2022, 04:35 PM
|
#6
|
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,291
|
Access by NTB is DMA since it doesn't go through the CPU, so I suppose it must be a DMAable address.
|
|
|
05-29-2022, 11:56 PM
|
#7
|
LQ Newbie
Registered: Nov 2021
Posts: 20
Original Poster
Rep: 
|
Okay. The NTB memory window is DMAable. I want to map a device's memory, to this memory window. I mean, when data is written to the memory window, it should actually be written to the device's memory. Any inputs on how to do this?
|
|
|
All times are GMT -5. The time now is 10:14 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|