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: 
Adventurer
Adventurer
314 Views
Registered: ‎02-19-2018

How do I use Linux drivers generated for my HLS IP?

I have an IP block generated from HLS and it has drivers associated with it that I can see in Xilinx SDK. Specifically, there is a driver file called xmymodule_linux.c. This file seems to expect my device to be mapped to a user IO driver under /sys/class/uio/ in Linux; however, I am not sure how to create that mapping.

I found this page on the wiki and tried following the steps therein but have not had success. I have device tree sources for my module that look like this:

 

/ {
	amba_pl: amba_pl@0 {
		#address-cells = <2>;
		#size-cells = <2>;
		compatible = "simple-bus";
		ranges ;
		mymodule: mymodule@a0000000 {
			/* This is a place holder node for a custom IP, user may need to update the entries */
			clock-names = "ap_clk";
			clocks = <&clk 71>;
			compatible = "generic-uio";
			reg = <0x0 0xa0000000 0x0 0x10000>;
			xlnx,s-axi-axilites-addr-width = <0x5>;
			xlnx,s-axi-axilites-data-width = <0x20>;
		};
		psu_ctrl_ipi: PERIPHERAL@ff380000 {
			/* This is a place holder node for a custom IP, user may need to update the entries */
			compatible = "xlnx,PERIPHERAL-1.0";
			reg = <0x0 0xff380000 0x0 0x80000>;
		};
		psu_message_buffers: PERIPHERAL@ff990000 {
			/* This is a place holder node for a custom IP, user may need to update the entries */
			compatible = "xlnx,PERIPHERAL-1.0";
			reg = <0x0 0xff990000 0x0 0x10000>;
		};
	};
};

and I also included the following in both the chosen DT node and my uEnv.txt U-Boot file:

 

 

uio_pdrv_genirq.of_id=generic-uio

The only thing listed under /sys/class/uio is 

uio0 -> ../../devices/platform/amba/ffa00000.perf-monitor/uio/uio0

How do I create a uio node for my custom IP so that I can use the Vivado generated Linux drivers?

 

0 Kudos
2 Replies
Adventurer
Adventurer
237 Views
Registered: ‎02-19-2018

Re: How do I use Linux drivers generated for my HLS IP?

I was able to get Linux to recognize the IP by adding quotes around generic-uio in the uEnv.txt file. I can now see my "device" under /sys/class/uio.

 

However, I am running into another problem. Any time I try to read from the AXI-Lite control registers (e.g. ap_idle) the entire system hangs and eventually crashes. I am using the unmodified drivers generated by HLS. Here is my simple test application:

#include <stdio.h>
#include <stdlib.h>

#include "drivers/xmatrix_multiply.h"

int main(int argc, char **argv) {

    XMatrix_multiply matrix_multiply;

    int rc;
    if ((rc = XMatrix_multiply_Initialize(&matrix_multiply, "matrix_multiply")) != XST_SUCCESS) {
        fprintf(stderr, "Initialization failed. Return code: %d\n", rc);
        exit(EXIT_FAILURE);
    }

    printf("Initialization successful.\n");

    u32 is_idle = XMatrix_multiply_IsIdle(&matrix_multiply);
    printf("is_idle = %u\n", is_idle);

    if ((rc = XMatrix_multiply_Release(&matrix_multiply)) != XST_SUCCESS) {
        fprintf(stderr, "Release failed. Return code: %d\n", rc);
        exit(EXIT_FAILURE);
    }

    return 0;
}

This file compiles just fine but when I execute it with sudo ./matrix_multiply it prints "Initialization successful." and then the kernel hangs. After a few seconds I see the following in my serial console:

[  265.576532] INFO: rcu_sched detected stalls on CPUs/tasks:
[  265.581943]  3-...: (0 ticks this GP) idle=c1a/140000000000000/0 softirq=12569/12569 fqs=2626
[  265.590528]  (detected by 1, t=5254 jiffies, g=920, c=919, q=124)

Does anyone have any insight into what the problem here is?

0 Kudos
Adventurer
Adventurer
147 Views
Registered: ‎02-19-2018

Re: How do I use Linux drivers generated for my HLS IP?

Bump to maybe get some attention on this issue. I'm still having the same problem.

Is there a User Guide or other piece of documentation that perhaps I missed that fully outlines the process of creating IP in Vivado HLS and using it in Linux?

0 Kudos