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: 
Visitor mbroz
Visitor
6,647 Views
Registered: ‎09-20-2015

Linux hangs when writes into dynamic partition of PL

Hello,

I'm trying to write into registers of a component instantiated into reconfigurable partition, but when I write into those registers Linux freezes and the only action that I can do is to reset the board (a Zedboard on which runs Linaro). The static design is which provided by Analog devices (ADV7511) in order to use the HDMI interface (it works) plus a my custom component and some signals like clocks, resets and AXIs which will be used by the partition dynamically loaded (in this case is an RSA core).

 

adi_static.png

 

Into the red rectangle there are signals to reconfigurable partition. The PS_Mx_AXI signals are connected to the M_AXI_GP1 port by an AXI Interconnect and the clock associated is the PS_AXI_CLK (100MHz) which is used by partial design (it is connected to AXI_interconnect blocks). The other clock used is PS_CLK10Mhz.

 

The design works well in a C bare-metal application (the only strange behaviour is that I can't perform reads of data which reside into reconfigurable partition, even with XMD), so I assume that it is correct for my purpose because I only perform writes and manage interrupts.

 

As said before I'm unable to write into the reconfigurable partition because Linaro hangs.

 

Here there are all actions performed in order to detect and solve the problem:

  1. I verified if all clocks involved are "active" by checking the clk_summary file into /sys/kernel/debug/clk. All clocks are enabled and all have the correct frequency. I checked the SCLR_FCLKx registers using devmem2 and the values are the same of the PL_INIT.HTML file generated from Vivado when I exported the hardware. In addition I've checked the configuration of the FSBL and it is ok (the .xml is attached).

  2. I've also applied a reset to PL by writing 0xF and then 0x0 into SCLR_RST register (0xF8000240) (SCLR is unlocked, obviously).

  3. In my C application I used both /dev/uioX and /dev/mem to write into registers, but the only writes performed without freezes are those into static partition. (the same actions have been performed using the devmem2 tool, and the behaviour is the same).

  4. I've used different version of Linaro

All these attempts have been performed using various BOOT.bin files with

  •  full bitstreams (so static+partial)
  •  only static, and after the boot I program the PL with the partial bitstream using cat bitstream.bit > /dev/xdevcfg after setting the is_partial_reconfiguration flag (I've also tried with bitstream.bin)

and various device trees, such as a complete one (zynq-zed-adv7511.dtb + my_peripheral included into the same file) and one without information of my peripherals (only zynq-zed.dtb without HDMI support, in this case I only used devmem2 and /dev/mem in my application, obviously)

 

In addition I've also loaded a bitstream without partial reconfiguration (I placed the "partial" design into the static partition without big changes, the only changes made are the connections) and in this case I can read and write into all my peripherals.

 

Can someone give me an hint to solve this problem? I've read a lot of threads but no one has been usefull for my problem.

0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
6,610 Views
Registered: ‎09-10-2008

Re: Linux hangs when writes into dynamic partition of PL

Sorry I've not done anything with dynamic reconfiguration but it sounds like you've done all the right stuff. It's time for a ILA/chipscope to check some signals I'd say.
0 Kudos
Visitor mbroz
Visitor
6,592 Views
Registered: ‎09-20-2015

Re: Linux hangs when writes into dynamic partition of PL

Thanks for reply, linnj.
I'm going to see what happens with ILA (I will put it on the M_AXI_GP1 port). 

However I have two questions:

  1. Does someone used a component under Linux with partial reconfiguration without problems?
  2. Could be u-boot the cause? The u-boot should configure the PL just after the u-boots prompt appears on the screen. (I'm using the u-boot 2014-4 because I had problem during the compilation of the master branch.)
0 Kudos
Highlighted
Visitor mbroz
Visitor
6,582 Views
Registered: ‎09-20-2015

Re: Linux hangs when writes into dynamic partition of PL

I did several attempts and the problem is the read operation on the PS (the PL works fine).

First, let me show the waveform signals using ILA.

linux_hangs.png

This is a screen. The write on the address 0x43C00000 is related to a custom component which resides into static logic, while the write at the address 0x83C10000 is related to the component into reconfigurable partition. As you can see linux (or better, the PS) hangs.
Here there is the screenshot of the waveform when I performed that write.

ila_read.png

The devmem2 tool every time performs a read and then a write, which is followed by another read (see the write on the address 0x43C00000). Now, as you can see the first read is correct but the write is not performed because the PS is freezed.

 

So I ran my C application under Linaro which writes using dev/mem and mmap.

ila_write.png

 

Again, the write executed correctly but the PS hangs just after that write. Why? I will explain you very soon.

 

Another attept has been made using a simple bare-metal helloworld code like this:

    init_platform();
    Xil_DCacheDisable();
    Xil_ICacheDisable();

    xil_printf("Hello World\n\r");
    volatile uint32_t *ptr=(uint32_t*)0x83C10000;
    xil_printf("I'm writing!\n\r");
    (*((volatile uint32_t*)ptr))=0x12345678;
    xil_printf("Write done!\n\r");

    uint32_t k=(*((volatile uint32_t*)ptr));// <---- ps hangs here!

    xil_printf("Now print the value > %X \n\r",k);
    print("BYE!\n\r");

And here the waveform related to the read:

ila_read_baremetal.png

The read is executed correctly but, as above, the PS hangs just after (I think it happens when the data should be transferred into memory).

 

Now, I understood that the problem is the read operation, but why the PS hangs even with the write on linux? Simply because the instruction (*(char*(mmaped_ptr+offset))) = VALUE performs a read (left operand) and then the write.

 

The last attempt is to  avoid the first read, but I don't understand how I can do.

The code is this:

	int mem_fd = open("/dev/mem", O_RDWR);
	if(mem_fd>0){
		printf("ERRNO %s\n",strerror(errno));
		char* mem_pointer = (char *)mmap(0, RANGE_MAP, PROT_WRITE, MAP_SHARED, mem_fd, PERIPH_TRUE_BASEADDR);
		if(mem_pointer>0){

			(*(char*)(mem_pointer+CNTRL))=RESET_CMD;
			
                        printf("ERRNO %s\n",strerror(errno));
			//mem_pointer[CNTRL]=RESET_CMD;

			munmap(rsa_mem_pointer,RANGE_MAP);
		}
		close(mem_fd);
	}

If I open /dev/mem with O_WRONLY flag I get a segmentation fault (permission denied). I tried to change mmap parameters (es. MAP_PRIVATE) but the results are either a segmentation fault (the mem_pointer is 0xFFFFFFFF) or freeze of the PS.

I don't understand why the reads freeze the PS (just to remember, they work when I read from components into static partition).
 

0 Kudos