cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
softwd
Contributor
Contributor
623 Views
Registered: ‎09-18-2018

Baremetal DomU application with AXI_DMA passthrough? (Xen Hypervisor Question)

Hi all,

I have been playing with the idea of using Xen Hypervisor for my project for a while, and I really like the possibility of running a Baremetal Application in DomU with a Linux Dom0.

One critical step to make Baremetal application works is route the Vivado hardware through Xen-passthrough. I followed Xen Hypervisor 2018.1 and successfully made both GPIO and AXI_TIMER works in Baremetal DomU.

The challenge came in when I try to do the same thing with AXI_DMA. I used the following syntax to passthrough the AXI_DMA:

axi_dma_0 {
          xen,passthrough = <0x1>;
};

This syntax worked well for me for AXI_TIMER and AXI_GPIO, but has no effect for AXI_DMA at all. i.e. the two interrupt ports of AXI_DMA does not get opened up for Baremetal use.

So I wonder:

1. Is it possible to run AXI_DMA in in DomU Baremetal?

2. If so, what do I need to do except adding a passthrough in the device tree?

Thanks for your help. 

0 Kudos
2 Replies
deeptuuk
Visitor
Visitor
231 Views
Registered: ‎12-02-2020

hi

i meet the same question, want ps led work,but it doesn't work

below is my code 

 

#include <stdio.h>
//#include "platform.h"
//#include "xil_printf.h"
#include <xen_console.h>
#include "xgpiops.h"
#include "sleep.h"

#define GPIO_DEVICE_ID XPAR_XGPIOPS_0_DEVICE_ID

/*
* The following are declared globally so they are zeroed and can be
* easily accessible from a debugger.
*/
XGpioPs Gpio; /* The driver instance for GPIO Device. */

int main()
{
//init_platform();
init_console();

int Status;
XGpioPs_Config *ConfigPtr;

//print("Hello World\n\r");
/* Initialize the GPIO driver. */
ConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);

Status = XGpioPs_CfgInitialize(&Gpio, ConfigPtr,
ConfigPtr->BaseAddr);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}

/*
* Set the direction for the pin to be output and
* Enable the Output enable for the LED Pin.
*/
XGpioPs_SetDirectionPin(&Gpio, 44, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 44, 1);

while(1){
/* Set the GPIO output to be low. */
XGpioPs_WritePin(&Gpio, 44, 0x0);
printk("This is cpu_01 low! \n");
sleep(1) ;
/* Set the GPIO output to be high. */
XGpioPs_WritePin(&Gpio, 44, 0x1);
printk("This is cpu_01 high! \n");
sleep(1) ;
}

//cleanup_platform();
return 0;
}

 

can you show me your .cfg file and baremetal code , example for axi_gpio

thank you so much!!!!!!!!!!!!!!!!!!!!!

0 Kudos
softwd
Contributor
Contributor
176 Views
Registered: ‎09-18-2018

It was quite a while ago since I worked on passthrough, and the project file is long gone for GPIO setup.

However, I would say setting up GPIO passthrough is more of a device tree setup challenge, not how you code your PS domain code. A few suggestions: 

1. Use Xen Aware Debugging to put break points in your code, so you can observe what is happening

2. PassThrough your baremetal to console so you can also use printf to assist your debug 

3. Following the link above, you should also exam your device tree to make sure your LED is passed through, search "PS LED" in ug1209 to see how to add LED to device tree.

4. The most challenging part, at least to me, is to add the device to irq=[] and iomem=[]. These two number can be found in "xparameters.h" or "xparameters_ps.h" in SDK (or VITIS if you are using newer version)

5. Don't give up and keep trying; look around the forum most people eventually struggled through and worked out a solution, sometimes it takes a few days, sometimes a few weeks, and sometimes a few months

0 Kudos