Hello,
I am writing this post because I am having issues booting linux on BlackParrot on an alveo u280 card.
I am using the vu37p project available in [1].
(1)
This project allows me to load the kernel through pcie which is connected to an xdma bridge with an axi-lite interface. To write through such an interface the kernel should be 32-bits aligned. Before jumping to linux I have decided to start with a simple program such as bubble sort. After compiling the program I end up with an nbf file. Every line in nbf file is in the following format (eg: 03_0000200001_0000000000000001). in the host side I wrote a script to parse each line and write it through dma to address 0x10 in the following way:
data_1="0x"$(echo $line | cut -c23-30)
data_2="0x"$(echo $line | cut -c15-22)
data_3="0x"$(echo $line | cut -c6-13)
data_4="0x0000"$(echo $line | cut -c1-2)"00"
dma-ctl qdma08000 reg write bar 2 0x10 $data_1
dma-ctl qdma08000 reg write bar 2 0x10 $data_2
dma-ctl qdma08000 reg write bar 2 0x10 $data_3
dma-ctl qdma08000 reg write bar 2 0x10 $data_4
After the program is loaded, I issue multiple read commands to address 0x20 and print the output on the console (eg: dma-ctl qdma08000 reg read bar 2 0x20).
For a simple program such as bubble sort I am able to see correct output similar to the simulation with Verilator. However, when it comes to linux, it first takes about 4 hours to load (mainly due to line parsing and line by line kernel loading) and second when I issue read command, after loading the kernel, I only get deadbeef.
I obtained the linux kernel by typing “make linux” in bp_common/test then converted .riscv to .nbf using the makefiles made available in BlackParrot git repository.
So what I wanted to ask is, is the approach I took allows me to boot linux and whether I am doing things right ? What’s confusing is I was able to run a simple program and not linux kernel but both are compiled using the same method.
(2) On a different note, I have discovered subsequently that you guys are using Litex to boot linux with simple instructions in README. I have tried to follow the instructions up until the FPGA command where I believe I have to modify genesys2.py with the pinout of alveo u280. And here I would like to ask a question.
It was indicated that the path is LITEX/litex/boards/genesys2.py but there are two genesys2.py files and located in one level down the hierarchy i.e in LITEX/litex/boards/platforms and LITEX/litex/boards/targets. I would really appreciate if you could indicate which one of them is expected to be used so that I can modify accordingly.
[1] https://github.com/black-parrot-examples/bsg_fpga/tree/master/vu37p
Thanks for taking the time to read my post.
--
You received this message because you are subscribed to the Google Groups "black-parrot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to black-parrot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/64b1f392-2a6f-405d-994e-c65dc29fbdbfn%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "black-parrot" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/black-parrot/ZeVnolEHkQg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to black-parrot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/5dbc86bb-e797-4192-af05-604a990104abn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/CABXpatpx4rU171OKZxDDoctxh1RhB5BepTY8yZGGC0ZEQg%2BXRg%40mail.gmail.com.
git clone g...@github.com:black-parrot-examples/bsg_fpga.git
cd bsg_fpga/vu37p
make
make generate_bitstream program_fpga
cd black-parrot
make prep -j 20
<wait 20 minutes>
make -C bp_common/test/ linux
git clone https://github.com/gaozihou/dma_ip_drivers
cd dma_ip_drivers/XDMA/linux-kernel/tools
make linux.run BLACKPARROT_DIR=<black-parrot-directory>
Best, Dan
On Feb 17, 2021, at 17:19, Dan Petrisko <petr...@cs.washington.edu> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/CABXpatoKTDVVWgD5imkMq1Y_V4YHN72Tmko8MW%2Bks1EVY1L%2BnA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/e847ca78-da32-4e2f-a77f-db55d79a3a42n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/0f09bef5-9ab5-46ec-962b-5aef0076406cn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/12f3a2e0-d438-478c-a9d4-e2be3d0ca494n%40googlegroups.com.
On another note, I would like to ask about the booting process. After examining the RTL, I realized that when the instructions are loaded through NBF, they go directly to L2$. Then instructions would then move up the memory hierarchy to be executed. At the same time the instructions are looped back to HBM. The instructions are fetched from HBM, only when the program cannot fit in L2$. My conjecture is based on the fact that when I disable the HBM in FPGA example or DRAM in simulation and run a simple program, it actually executes without any problem. The premise based on this conjecture seems unorthodox because traditionally when booting linux or running a simple program a bootloader would load the whole kernel in memory and only upon completion, the instructions start to be fetched and executed. Did I understand correctly the booting process or am I missing something ?
Best regards
------------ Modifications done on vu37p to adapt to au280 ----------------
1) design_1_wrapper.v
Disabled the following (because I do not know where they should map in au280 and do not seem critical):
PCIE1_FPGA_CPERSTN,PCIE0_FPGA_CPRSNT,PCIE0_FPGA_CPWRON,PCIE0_FPGA_CWAKE
PCIE0_SWITCH,PCIE1_FPGA_CPRSNT,PCIE1_FPGA_CPWRON,PCIE1_FPGA_CWAKE, PCIE1_SWITCH
Changed the following:
pcie_perstn = !PCIE0_FPGA_CPERSTN —> pcie_perstn = PCIE0_FPGA_CPERSTN; (because PCIE0_FPGA_CPERSTN pinout is set to active low pin)
2) bp_fpga.tcl
Changed the following to avoid compilation errors and to adapt to alveo u280
CONFIG.pcie_blk_locn {PCIE4_X1Y0} —> CONFIG.pcie_blk_locn {PCIE4_X0Y1}
CONFIG.select_quad {GTY_Quad_233} —> CONFIG.select_quad {GTY_Quad_227}
xcvu37p-fsvh2892-2LV-e —> xcu280-fsvh2892-2L-e
3) design_1.xdc
# PCIe Refclk
set_property PACKAGE_PIN AR14 [get_ports {pcie_refclk_clk_n}]
set_property PACKAGE_PIN AR15 [get_ports {pcie_refclk_clk_p}]
create_clock -period 10.000 -name pcie_refclk_n [get_ports {pcie_refclk_clk_n}]
create_clock -period 10.000 -name pcie_refclk_p [get_ports {pcie_refclk_clk_p}]
# PCIe x4 channel
# First step: reset locations to default
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxn[0]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxn[1]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxn[2]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxn[3]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxp[0]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxp[1]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxp[2]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_rxp[3]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txn[0]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txn[1]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txn[2]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txn[3]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txp[0]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txp[1]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txp[2]}]
set_property PACKAGE_PIN {} [get_ports {pci_express_x4_txp[3]}]
# Second step: set new locations
set_property PACKAGE_PIN AL1 [get_ports {pci_express_x4_rxn[0]}]
set_property PACKAGE_PIN AM3 [get_ports {pci_express_x4_rxn[1]}]
set_property PACKAGE_PIN AN5 [get_ports {pci_express_x4_rxn[2]}]
set_property PACKAGE_PIN AN1 [get_ports {pci_express_x4_rxn[3]}]
set_property PACKAGE_PIN AL2 [get_ports {pci_express_x4_rxp[0]}]
set_property PACKAGE_PIN AM4 [get_ports {pci_express_x4_rxp[1]}]
set_property PACKAGE_PIN AN6 [get_ports {pci_express_x4_rxp[2]}]
set_property PACKAGE_PIN AN2 [get_ports {pci_express_x4_rxp[3]}]
set_property PACKAGE_PIN AL10 [get_ports {pci_express_x4_txn[0]}]
set_property PACKAGE_PIN AM8 [get_ports {pci_express_x4_txn[1]}]
set_property PACKAGE_PIN AN10 [get_ports {pci_express_x4_txn[2]}]
set_property PACKAGE_PIN AP8 [get_ports {pci_express_x4_txn[3]}]
set_property PACKAGE_PIN AL11 [get_ports {pci_express_x4_txp[0]}]
set_property PACKAGE_PIN AM9 [get_ports {pci_express_x4_txp[1]}]
set_property PACKAGE_PIN AN11 [get_ports {pci_express_x4_txp[2]}]
set_property PACKAGE_PIN AP9 [get_ports {pci_express_x4_txp[3]}]
# PCIe Sideband
set_property PACKAGE_PIN BH26 [get_ports {PCIE0_FPGA_CPERSTN}]
set_property IOSTANDARD LVCMOS18 [get_ports {PCIE0_FPGA_CPERSTN}]
# Reset
set_property PACKAGE_PIN L30 [get_ports {rstn}]
set_property IOSTANDARD LVCMOS18 [get_ports {rstn}]
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/a4477895-87d0-4d6f-9463-8f30f64277fbn%40googlegroups.com.
On Feb 25, 2021, at 18:23, Dan Petrisko <petr...@cs.washington.edu> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/CABXpatr-1JE3g5TkVTv-GOH5rCgphi4C93eTjKAyS6r_%2B04TEg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/42405aa1-9e37-41f9-aa8d-c93a28f09756n%40googlegroups.com.
Hi Dan,
Thanks for the feedback. I appreciate it.
Currently I have a working linux kernel in the simulation side but I am still experiencing a kernel freeze in FPGA. So I made a comparison between the host’s behavior on the FPGA (i.e nbf.c) and the host’s behavior in the simulation project (i.e bp_nonsynth_host) and I found few differences, that I am not sure why they exist.
You have mentioned that the freeze happens because of spurious I$ fetch to an uncached address and it is handled by sending 0 as a loopback. However the latest reads I get before the freeze have 0x00100000 addresses and that is handled by the condition else if ((addr_result>>12) == 0x100) in nbf.c which writes 0xFFFFFFFF twice and not 0. Below I have written the log of the latest address I get before the freeze.
On the other hand in the simulation side. The response is handled by assign domain_io_resp_lo = '{header: io_cmd_lo.header, data: '0}; in bp_nonsynth_host which returns the same address as the one that came in (i.e header) and always 0 for data. When the address 0x00100000 comes in pop(); is called which is a c++ implementation of queue pop. So in contrast with the nbf.c, receiving this address doesn’t prompt writing back 0xFFFFFFFF twice.
I believe the header is handled the same way in the FPGA project in bp_stream_mmio but the data is handled differently (i.e what’s sent through the dma either 0 or FFFFFFFF according to the address).
That is my understanding and please correct me if I am missing something here.
I am hoping this comparison could shed some light on what might have gone wrong causing the kernel freeze on FPGA.
Best regards
------ LOG when running nbf.c -------
read_result = 2
addr_result = 101000
data_result = a
read_result = 2
addr_result = 100000
data_result = a
ff twice
read_result = 2
addr_result = 100000
data_result = a
ff twice
read_result = 2
addr_result = 100000
data_result = a
ff twice
read_result = 2
addr_result = 100000
data_result = a
ff twice
read_result = 2
addr_result = 100000
data_result = a
ff twice
read_result = 2
addr_result = 100000
data_result = a
ff twice
read_result = 2
addr_result = 100000
data_result = a
ff tw
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/0e7891c2-cfcc-492f-93ea-d8c390c948c0n%40googlegroups.com.
glenn@xxxx:~/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma(master)$ makeMakefile:10: XVC_FLAGS: .make -C /lib/modules/5.4.0-66-generic/build M=/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma modulesmake[1]: Entering directory '/usr/src/linux-headers-5.4.0-66-generic'/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma/Makefile:10: XVC_FLAGS: .CC [M] /home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.c: In function ‘engine_start’:/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.c:642:2: error: implicit declaration of function ‘mmiowb’ [-Werror=implicit-function-declaration]mmiowb();^~~~~~cc1: some warnings being treated as errorsscripts/Makefile.build:269: recipe for target '/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o' failedmake[2]: *** [/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o] Error 1Makefile:1760: recipe for target '/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma' failedmake[1]: *** [/home/glenn/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma] Error 2make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-66-generic'Makefile:27: recipe for target 'all' failedmake: *** [all] Error 2glenn@xxxx:~/work/black-parrot/dma_ip_drivers/XDMA/linux-kernel/xdma(master)$ uname -aLinux xxxx 5.4.0-66-generic #74~18.04.2-Ubuntu SMP Fri Feb 5 11:17:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
glenn@hal:~$ uname -aLinux hal 5.3.0-46-lowlatency #38 SMP PREEMPT Tue Apr 21 18:56:08 MDT 2020 x86_64 x86_64 x86_64 GNU/Linux
dmesg | grep xdma[ 6.201409] xdma: loading out-of-tree module taints kernel.[ 6.231944] xdma:xdma_mod_init: Xilinx XDMA Reference Driver xdma v2020.1.8[ 6.231946] xdma:xdma_mod_init: desc_blen_max: 0xfffffff/268435455, timeout: h2c 10 c2h 10 sec.[ 6.235145] xdma:xdma_device_open: xdma device 0000:42:00.0, 0x00000000b4b9ec63.[ 6.235427] xdma:map_single_bar: BAR0 at 0x82300000 mapped at 0x000000009c213a7c, length=1048576(/1048576)[ 6.639077] xdma:map_single_bar: BAR1 at 0x82400000 mapped at 0x000000002a573bdb, length=65536(/65536)[ 7.042563] xdma:map_bars: Failed to detect XDMA config BAR[ 7.453031] xdma:probe_one: pdev 0x00000000b4b9ec63, err -22.[ 7.453037] xdma:xpdev_free: xpdev 0x0000000021856d67, destroy_interfaces, xdev 0x00000000787221fd.[ 7.453038] xdma:xpdev_free: xpdev 0x0000000021856d67, xdev 0x00000000787221fd xdma_device_close.[ 7.453095] xdma: probe of 0000:42:00.0 failed with error -22
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/42DF55A1-674B-45CC-842E-D1C5295EB256%40petacat.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/black-parrot/A9D997D2-EF9F-480D-BC0B-BFB7AAA10324%40petacat.com.