UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor favoryoung
Visitor
840 Views
Registered: ‎04-10-2018

Question about PYNQ Linux driver architecture

Hi, I'm trying to understand the architecture about PYNQ Linux drivers. But I can't understand why they can bypass Linux kernel and directly operate hardware registers.

 

From the source code of PYNQ https://github.com/xilinx/pynq , I find out that the drivers are all built upon some C code that directly calls assembly code to read/write hardware registers, without any interaction with Linux Loadable Kernel Module (LKM) system.

 

For example, the DMA driver is defined in PYNQ/pynq/lib/dma.py, which calls a shared object libdma.so, whose data structures and functions are defined in PYNQ/pynq/lib/_pynq/_apf/axidma_v9_1/xaxidma.h, which in the end includes some assembly code defined in PYNQ/pynq/lib/_pynq/_apf/include/xpseudo_asm_gcc.h. Nothing is mentioned about Linux kernel module.

 

How does that work? It seems to me that it totally bypasses the whole Linux memory management system. What have I missed?

Tags (4)
0 Kudos
2 Replies
Visitor favoryoung
Visitor
796 Views
Registered: ‎04-10-2018

Re: Question about PYNQ Linux driver architecture

UPDATE: I looked into more of dma.py, xlnk.py, overlay.py and mmio.py. It seems more clear to me.

 

In dma.py, there is 2 DMA class: LegacyDMA and DMA.

 

LegacyDMA calls /usr/lib/libsds_lib.so to allocate host buffers and do the phy_addr-virt_addr convertion, and calls libdma.so to operate registers and do the transfers.

 

The newer DMA needs an array allocated by Xlnk, which still calls /usr/lib/libsds_lib.so to allocate host buffers and do the phy_addr-virt_addr convertion. Mean while, it utilizes Python's built in mmap API to operate registers and do the transfers.

 

I'm looking for the source code compiling /usr/lib/libsds_lib.so, but with no luck. Does anybody know where to find it?

Thanks!

0 Kudos
Adventurer
Adventurer
751 Views
Registered: ‎10-04-2017

Re: Question about PYNQ Linux driver architecture

I think you misunderstand what pynq is doing.  It is doing nothing more than memory mapping the address space of the IP and programming the registers.   Just look at PL and MMIO.  They python parses the bd.tcl to get the addresses of the IP blocks and then calls mmap with those addresses.  This is the same thing an userspace driver does or commands like devmem do.  

 

jeff

0 Kudos