Git Product home page Git Product logo

Comments (4)

108anup avatar 108anup commented on July 27, 2024

FYI, I did not use the setup device script while loading the shell bitstream.

from open-nic.

solidgoldbomb avatar solidgoldbomb commented on July 27, 2024

Under /sys/devices, you will find a hierarchy of devices that matches the bus hierarchy. Under /sys/bus/pci/devices, you will find a flattened view of all of the devices.

As an example, here are my devices as seen by lspci. I have a U280 card but it should be very similar for you.

$ lspci -D -d 10ee:
0000:65:00.0 Memory controller: Xilinx Corporation Device 903f
0000:65:00.1 Memory controller: Xilinx Corporation Device 913f

however, if I look in /sys/devices, I don't see them there (as expected) because the U280 or U50 is not a PCIe root complex.

$ ls /sys/devices | grep pci0000
pci0000:00
pci0000:16
pci0000:64
pci0000:b2

They're not PCIe root ports so they show up under their appropriate bus hierarchy like this:

$ lspci -tnnv | grep Xilinx
 +-[0000:64]-+-00.0-[65]--+-00.0  Xilinx Corporation Device [10ee:903f]
 |           |            \-00.1  Xilinx Corporation Device [10ee:913f]

Note the root port they're attached to is way up at 0000:64 which does show up directly under /sys/devices. And, if we go looking deeper under that tree, we can find our devices here:

$ find /sys/devices/ -type d -name '0000:65:00*'
/sys/devices/pci0000:64/0000:64:00.0/0000:65:00.0
/sys/devices/pci0000:64/0000:64:00.0/0000:65:00.1

My U280 device shows up in lshw like this:

$ sudo lshw -businfo | grep '0000:65:00'
pci@0000:65:00.0               memory         Memory controller
pci@0000:65:00.1               memory         Memory controller

Note that in my case, I don't have the kernel driver bound to it so I'm not sure if that changes how it looks under lshw for me.

from open-nic.

108anup avatar 108anup commented on July 27, 2024

Thanks for this great explanation.

The lspci -vt tree shows that device 0000:3b:00.0 is actually connected via the bridge on bus 3a (physically there is a PCIe riser that connects to the motherboard and exposes 2x PCIe x16 slots. I don't know if the tree represents this physical characteristic or if there is a bridge on the motherboard itself).

 +-[0000:3a]-+-00.0-[3b]----00.0  Xilinx Corporation Device 903f

And so, the device is actually in "/sys/devices/pci0000:3a/0000:3a:00.0/0000:3b:00.0" instead of "/sys/devices/pci0000:3b/0000:3b:00.0". The same device in the flat hierarchy is also in /sys/bus/pci/devices/0000:3b:00.0.

I can actually use:
sudo ./pcimem /sys/bus/pci/devices/0000:3b:00.0/resource2 0x8090
to read mmaped registers on BAR2:

/sys/bus/pci/devices/0000:3b:00.0/resource2 opened. 
Target offset is 0x8090, page size is 4096 mmap(0, 4096, 0x3, 0x1, 3, 0x8090)
PCI Memory mapped to address 0x7f21855bc000.
0x8090: 0x00000000

from open-nic.

108anup avatar 108anup commented on July 27, 2024

lshw also shows device as:

sudo lshw -businfo | grep '0000:3b:00'
pci@0000:3b:00.0  enp59s0    memory         Ethernet interface

from open-nic.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.