hdlguy / zcu104_ubuntu

A project to demonstrate Xilinx MPSOC running Ubuntu
MIT License
20 stars 12 forks source link

UIO? #5

Closed pkimelman-nxp closed 4 years ago

pkimelman-nxp commented 4 years ago

I want to use the UIO model for my IRQ from the PL side. The pure Petalinux model adds an amba_pl entry to the device tree with compatible="generic-bio", but I am not sure if that works with this mixed Ubuntu/BOOT.BIN where the .bin file is loaded later at runtime. Has anyone tried this? That is, I want to be able to open /dev/uioN (maybe uio0 since nothing else is likely using this) from my user app to get "interrupts" (ie. blocking read() or a thread which blocks on read and does the ISR work). Thanks in advance.

hdlguy commented 4 years ago

I'm a big fan of UIO and loading the fpga at runtime.

I am normally testing with a number of different fpga designs and I don't want to redo Petalinux or even reboot the Zynq each time I change bitstreams. This seems fundamental to the idea of reconfigurable logic. Xilinx has tried to support reconfiguration under linux with device tree overlays. For me this adds another layer on top of device trees which are already fragile and poorly documented. To get read/write access to the fpga address map I use /dev/mem and mmap() as root. This simplistic approach can't really support interrupts or DMA well though.

Pretty soon I am going to need interrupts and I guess that means I will have to grow up.

Pete


From: Paul Kimelman notifications@github.com Sent: Friday, March 6, 2020 10:28 AM To: hdlguy/zcu104_ubuntu zcu104_ubuntu@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [hdlguy/zcu104_ubuntu] UIO? (#5)

I want to use the UIO model for my IRQ from the PL side. The pure Petalinux model adds an amba_pl entry to the device tree with compatible="generic-bio", but I am not sure if that works with this mixed Ubuntu/BOOT.BIN where the .bin file is loaded later at runtime. Has anyone tried this? That is, I want to be able to open /dev/uioN (maybe uio0 since nothing else is likely using this) from my user app to get "interrupts" (ie. blocking read() or a thread which blocks on read and does the ISR work). Thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/hdlguy/zcu104_ubuntu/issues/5?email_source=notifications&email_token=AB6I7Z7SJPQQAKCBK62HYXTRGEXFTA5CNFSM4LDEUKI2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITFOVPA, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB6I7Z4ZA7ZHZQKR6P3DJBLRGEXFTANCNFSM4LDEUKIQ.

pkimelman-nxp commented 4 years ago

OK, we got this sorted. You can do this using the system-user.dtsi file. What I did not realize is that the UIO has to be inside of an amba_pl group. So, you can use: &amba_pl { compatible = "generic-uio"; interrupt-parent = <&gic>; interrupts = <0 89 1>; };

This works fine. You can leave off the interrupt details (last 2 lines) and it will pick it up from the config of course.