OpenAMP / meta-openamp

Yocto/OE meta layer to add OpenAMP support to your BSP or distro
MIT License
51 stars 33 forks source link

device tree microzed zynq-7000 #1

Closed gpresazzi closed 7 years ago

gpresazzi commented 7 years ago

Hi,

I'm working with yocto and meta-openamp for Microzed Zynq-7000. I've a problem when loading module zynq_remoteproc. The error is:

bus: 'platform': add driver zynq_remoteproc bus: 'platform': driver_probe_device: matched device 0.zynq_remoteproc with driver zynq_remoteproc bus: 'platform': really_probe: probing driver zynq_remoteproc with device 0.zynq_remoteproc zynq_remoteproc 0.zynq_remoteproc: no pinctrl handle devices_kset: Moving 0.zynq_remoteproc to end of list device: 'remoteproc0': device_add PM: Adding info for No Bus:remoteproc0 remoteproc remoteproc0: 0.zynq_remoteproc is available remoteproc remoteproc0: Note: remoteproc is still under development and considered experimental. remoteproc remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed. __allocate_fw_buf: fw-firmware buf=ee93b8c0 remoteproc remoteproc0: loading /lib/firmware/updates/4.9.0-xilinx-v2017.1/firmware failed with error -2 root@microzed-zynq7:~# driver: 'zynq_remoteproc': driver_bound: bound to device '0.zynq_remoteproc' bus: 'platform': really_probe: bound device 0.zynq_remoteproc to driver zynq_remoteproc remoteproc remoteproc0: loading /lib/firmware/updates/firmware failed with error -2 remoteproc remoteproc0: loading /lib/firmware/4.9.0-xilinx-v2017.1/firmware failed with error -2 remoteproc remoteproc0: direct-loading firmware fw_set_page_data: fw-firmware buf=ee93b8c0 data=f0b2e000 size=522972 remoteproc remoteproc0: powering up 0.zynq_remoteproc fw_set_page_data: fw-firmware buf=ee93b8c0 data=f0b2e000 size=522972 remoteproc remoteproc0: Booting fw image firmware, size 522972 zynq_remoteproc 0.zynq_remoteproc: iommu not present remoteproc remoteproc0: rsc: type 4 remoteproc remoteproc0: failed to declare rproc mem as DMA mem. remoteproc remoteproc0: Failed to declare rproc memory resource: -12 __fw_free_buf: fw-firmware buf=ee93b8c0 data=f0b2e000 size=522972

Do you have any advice ? Thx

wjliang commented 7 years ago

which zynq_remotperoc driver do you use? how do you probe the module and how do you specify the firmware? with 4.9 2017.1 Xilinx kernel, you can use sysfs API to specify the firmware.

There is a bug in the 2017.1 kernel remoteproc, if you failed to load the firmware for the 1st time, you will get the "failed to declare rproc mem as DMA mem" when you try to reload it without reboot.

gpresazzi commented 7 years ago

I'm using zynq_remoteproc from : https://github.com/Xilinx/meta-xilinx/tree/rel-v2017.1 I moved the zynq_remoteproc.ko from /lib/modules into /home folder and I probe it manually "insmod zynq_remoteproc.ko", the firmware is stored in /lib/firmware folder. I think it's successfully found.

Do you think the issue is related to DT ? Do you suggest to load the module at startup ?

DT:

amba { elf_ddr_0: ddr@3ed00000 { compatible = "mmio-sram"; reg = <0x200000 0x100000>; }; };

zynq_remoteproc@0 { compatible = "xlnx,zynq_remoteproc"; vring0 = <15>; vring1 = <14>; sram_0 = <&elf_ddr_0>; firmware = "firmware"; };

wjliang commented 7 years ago

where is your kernel starts? I think it will need to start higher than "reg = <0x200000 0x100000>;"

gpresazzi commented 7 years ago

I moved the kernel load address to 0x10000000 and it solve the previus issue, but I still have an ERROR during the module probe:

zynq_remoteproc zynq_remoteproc@0: iommu not present remoteproc remoteproc0: rsc: type 4 remoteproc remoteproc0: rsc: type 3 remoteproc remoteproc0: rsc: type 4 remoteproc remoteproc0: rsc: type 3 remoteproc remoteproc0: vdev rsc: id 7, dfeatures 0x1, cfg len 0, 2 vrings remoteproc remoteproc0: vdev rsc: vring0: da 0x8000000, qsz 256, align 4096 remoteproc remoteproc0: vdev rsc: vring1: da 0x8004000, qsz 256, align 4096 device: 'virtio0': device_add bus: 'virtio': add device virtio0 PM: Adding info for virtio:virtio0 remoteproc remoteproc0: registered virtio0 (type 7) remoteproc remoteproc0: rsc: type 4 bus: 'rpmsg': registered bus: 'virtio': add driver virtio_rpmsg_bus bus: 'virtio': driver_probe_device: matched device virtio0 with driver virtio_rpmsg_bus bus: 'virtio': really_probe: probing driver virtio_rpmsg_bus with device virtio0 virtio_rpmsg_bus virtio0: no default pinctrl state devices_kset: Moving virtio0 to end of list remoteproc remoteproc0: vring0: va b0c00000 dma 0x00200000 size 0x3000 idr 1 remoteproc remoteproc0: vring1: va b0c04000 dma 0x00204000 size 0x3000 idr 2 virtio_rpmsg_bus virtio0: rpmsg host is online driver: 'virtio_rpmsg_bus': driver_bound: bound to device 'virtio0' bus: 'virtio': really_probe: bound device virtio0 to driver virtio_rpmsg_bus remoteproc remoteproc0: rsc: type 3 remoteproc remoteproc0: bad phdr da 0x100000 mem 0x28480 remoteproc remoteproc0: Failed to load program segments: -22 device: 'virtio0': device_unregister bus: 'virtio': remove device virtio0 PM: Removing info for virtio:virtio0 __fw_free_buf: fw-firmware buf=ae4956c0 data=b0ac2000 size=522972

I'm using echo_test example.

gpresazzi commented 7 years ago

I solved the issue changing the dts with values: reg = <0x100000 0x80000>; Thanks !

abilbaotm commented 6 years ago

Hi. I am trying to reproduce this, but I am not able to moved the kernel load address to 0x10000000. My menuconfig is not displaying the PHYS_OFFEST option.

I am also using https://github.com/Xilinx/meta-xilinx/tree/rel-v2017.1

Any suggestion? Thanks!

wjliang commented 6 years ago

you don't need to put the kernel to high address. you can use higher memory as shared memory If you want to put the kernel to 0x10000000, the newer version of kernel, you don't need to set in the kernel config, but you will need to set the UIMAGE_LOADADDR which is in: meta-xilinx/conf/machine/include/tune-zynq.inc

you will need to change to 0x10008000

abilbaotm commented 6 years ago

@wjliang Thank you a lot! 🥇

I changed the UIMAGE_LOADADDR to 0x10008000 and I also updated my kernel to https://github.com/Xilinx/meta-xilinx/tree/rel-v2017.2 (In order to fix one issue).

My DT :

/ {
     reserved-memory {
          #address-cells = <1>;
          #size-cells = <1>;
          ranges;
          rproc_0_reserved: rproc@3e000000 {
               no-map;
               reg = <0x3e000000 0x01000000>;
          };
     };
     amba {
          elf_ddr_0: ddr@0 {
               compatible = "mmio-sram";
               reg = <0x3e000000 0x400000>;
          };
     };
     remoteproc0: remoteproc@0 {
               compatible = "xlnx,zynq_remoteproc";
               firmware = "firmware";
               vring0 = <15>;
               vring1 = <14>;
               srams = <&elf_ddr_0>;
     };
};

Now it works perfectly!

LanderU commented 6 years ago

Hi!

I'm follow the steps described by @abilbaotm and I'm getting this error:

root@zc702-zynq7:~# echo start > /sys/class/remoteproc/remoteproc0/state 
remoteproc remoteproc0: powering up amba:remoteproc@0
remoteproc remoteproc0: Booting fw image image_matrix_multiply, size 2436036
remoteproc remoteproc0: registered virtio0 (type 7)
remoteproc remoteproc0: bad phdr da 0x3e000000 mem 0x1fd9c
remoteproc remoteproc0: Failed to load program segments: -22
virtio_rpmsg_bus virtio0: rpmsg host is online
remoteproc remoteproc0: Boot failed: -22
-sh: echo: write error: Invalid argument

Any idea? @wjliang

Thanks in advance!

wjliang commented 6 years ago

The remoteproc driver failed to recognize the memory. You can refer to ug1186, which version of kernel did u use? If you use xilinx-v2017.1 kernel please refer to ug1186 2017.1 version. If you use xilinx-v2017.3 version of Linux kernel, please refer to ug1186 2017.3 version. The difference between the two version is the property of firmware memories. In Xilinx-v2017.1 version, the firmware memory property in dots is "sram_0", in Xilinx-v2017.3 version, the firmware memory property in dts is "srams".

LanderU commented 6 years ago

@wjliang, thanks for the hints. I have updated the kernel to the v3 and now everything is working well.

Thank you!