LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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


Reply
  Search this Thread
Old 05-25-2022, 01:07 AM   #1
tosaikiran
LQ Newbie
 
Registered: Nov 2021
Posts: 20

Rep: Reputation: Disabled
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.
 
Old 05-25-2022, 12:06 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,291

Rep: Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323
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.
 
Old 05-25-2022, 12:13 PM   #3
tosaikiran
LQ Newbie
 
Registered: Nov 2021
Posts: 20

Original Poster
Rep: Reputation: Disabled
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.
 
Old 05-25-2022, 01:01 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,291

Rep: Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323
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.
 
Old 05-27-2022, 12:29 AM   #5
tosaikiran
LQ Newbie
 
Registered: Nov 2021
Posts: 20

Original Poster
Rep: Reputation: Disabled
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?
 
Old 05-28-2022, 04:35 PM   #6
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,291

Rep: Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323
Access by NTB is DMA since it doesn't go through the CPU, so I suppose it must be a DMAable address.
 
Old 05-29-2022, 11:56 PM   #7
tosaikiran
LQ Newbie
 
Registered: Nov 2021
Posts: 20

Original Poster
Rep: Reputation: Disabled
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?
 
  


Reply

Tags
amd, device.map, pcie


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
LXer: Intel Provides Linux PCI Express NTB Support LXer Syndicated Linux News 0 07-14-2012 06:31 PM
Configuring NTB rakri2k2 Linux - Newbie 1 06-19-2012 06:42 AM
How to enable NTB Non Transparent Bridging rakri2k2 Linux - Newbie 0 06-19-2012 05:48 AM
SYSERR(root): hash map "generics": missing map file /etc/mail/genericstable.db? singying304 Linux - Networking 4 02-28-2005 06:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:14 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
Open Source Consulting | Domain Registration