Mailing List Archive

Fwd: Xen Passthrough in ARM ZCU104
I will give more information about my problem when trying to passthrough gpio.

On the Dom0 device tree I have added xen,passthrough to gpio@ff0a0000:
gpio {
compatible = "xlnx,zynqmp-gpio-modepin";
gpio-controller;
#gpio-cells = <0x02>;
phandle = <0x20>;
};

gpio@ff0a0000 {
#gpio-cells = < 0x02 >;
#interrupt-cells = < 0x02 >;
clocks = < 0x03 0x1f >;
compatible = "xlnx,zynqmp-gpio-1.0";
emio-gpio-width = < 0x20 >;
gpio-controller;
gpio-mask-high = < 0x00 >;
gpio-mask-low = < 0x5600 >;
interrupt-controller;
interrupt-parent = < 0x04 >;
interrupts = < 0x00 0x10 0x04 >;
phandle = < 0x14 >;
power-domains = < 0x0c 0x2e >;
reg = < 0x00 0xff0a0000 0x00 0x1000 >;
status = "okay";
xen,passthrough;
};

Then on the domU config file I put the following:
name = "guest"
# Rootfs and Image
kernel = "Image"
ramdisk = "rootfs.cpio.gz"
extra = "console=hvc0 rdinit=/sbin/init root=/dev/ram0"
memory = 800
vcpus = 1
vif=[ 'bridge=xenbr0' ]

dtdev = [ '/axi/gpio@ff0a0000' ] # but I don't know if it should be "/proc/device-tree/axi/gpio@ff0a0000" or if I should put this at all since I already put xen, passthrough before
device_tree = "partial_device_tree.dtb"

And the partial device_tree.dtb:
/dts-v1/;
/ {
/* #*cells are here to keep DTC happy */
#address-cells = <2>;
#size-cells = <2>;

passthrough {
compatible = "simple-bus";
ranges;
#address-cells = <2>;
#size-cells = <2>;
gpio@ff0a0000 {
#gpio-cells = < 0x02 >;
#interrupt-cells = < 0x02 >;
clocks = < 0x03 0x1f >;
compatible = "xlnx,zynqmp-gpio-1.0";
emio-gpio-width = < 0x20 >;
gpio-controller;
gpio-mask-high = < 0x00 >;
gpio-mask-low = < 0x5600 >;
interrupt-controller;
interrupt-parent = < 0x04 >;
interrupts = < 0x00 0x10 0x04 >;
phandle = < 0x14 >;
power-domains = < 0x0c 0x2e >;
reg = < 0x00 0xff0a0000 0x00 0x1000 >;
status = "okay";
};
};
};
And when running "xl create -c guest.cfg" I get the following:
Parsing config from guest.cfg
libxl: error: libxl_create.c:1870:libxl__add_dtdevs: Domain 22:xc_assign_dtdevice failed: -1
libxl: error: libxl_create.c:1934:domcreate_attach_devices: Domain 22:unable to add none devices
libxl: error: libxl_domain.c:1183:libxl__destroy_domid: Domain 22:Non-existant domain
libxl: error: libxl_domain.c:1137:domain_destroy_callback: Domain 22:Unable to destroy guest
libxl: error: libxl_domain.c:1064:domain_destroy_cb: Domain 22:Destruction of domain failed
(XEN) XEN_DOMCTL_assign_dt_device: assign "/axi/gpio@ff0a0000" to dom22 failed (-22)

Since this error appears, if I take out the dtdev option in the guest.cfg file, then DomU boots and when I am in DomU, if I run the following, I get:
root@zcu104:~# ls /sys/class/gpio/
export gpiochip508 unexport
root@zcu104:~# ls -l /sys/class/gpio/gpiochip508
lrwxrwxrwx 1 root root 0 Feb 1 16:18 /sys/class/gpio/gpiochip508 -> ../../devices/platform/passthrough/passthrough:gpio/gpio/gpiochip508
root@zcu104:~# echo 416 > /sys/class/gpio/export
[ 115.482333] export_store: invalid GPIO 416
-sh: echo: write error: Invalid argument

So I am not able to access pin 416, that I was able to access without the passthrough. Hope someone can help me.

>>Hello,
>>
>>I have problems on implementing passthrough of devices in the ZCU104. I have tried to passthrough a gpio by configuring the device tree in dom0, or changing what is in the domU config file at the moment of creation. Can someone >>tell me what should I change in the device tree, what to add in the config file etc to be able to passthrough two gpios (for example 416 and 417) to my Linux domU? An example on how to do this would be really really helpful
>>For my domU I have an "Image" and a "rootfs.cpio.gz" that I created with Yocto. If more information is needed please let me know.
>>
>>Regards,
>>Maria