cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rwk
Visitor
Visitor
448 Views
Registered: ‎06-18-2018

QEMU Linux - PS-PL Co-Simulation hangs - libsystemc-soc

Hello.

I am trying to set up co-simulation between QEMU and libsystemCTLM-SoC. I use UG1169 QEMU user guide and https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842109/QEMU+SystemC+and+TLM+CoSimulation as a reference.

 

I have a PetaLinux project from which I built my linux kernel and QEMU instance. In this project I added the device tree for the remote port in the following file : /path/to/petalinuxproject/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

 

/include/ "system-conf.dtsi"
/include/ "zynq-pl-remoteport.dtsi"
/ {
};

 

The device tree lies in /path/to/petalinuxproject/components/plnx_workspace/device-tree/device-tree/zynq-pl-remoteport.dtsi and has the following contents

This device tree is the one from : https://github.com/Xilinx/qemu-devicetrees/blob/master/zynq-pl-remoteport.dtsi

 

With this I can launch QEMU with the following command :

 

petalinux-boot --qemu --kernel --qemu-args "-machine-path ./qemu-tmp -icount 1 -sync-quantum 10000"

 

Once launched it does wait for the connection :

 

INFO: sourcing build tools
INFO: The image provided is a zImage
INFO: Set QEMU tftp to /opt/pkg/projects/petalinuxproject/images/linux 
INFO: TCP PORT is free 
INFO: Starting arm QEMU
INFO:  qemu-system-aarch64 -M arm-generic-fdt-7series -machine linux=on   -serial mon:stdio -serial /dev/null -display none -kernel /opt/pkg/projects/petalinuxproject/build/qemu_image.elf -gdb tcp::9000 -dtb /opt/pkg/projects/petalinuxproject/images/linux/system.dtb  -net nic,netdev=eth0 -netdev user,id=eth0,tftp=/opt/pkg/projects/petalinuxproject/images/linux -net nic -device loader,addr=0xf8000008,data=0xDF0D,data-len=4 -device loader,addr=0xf8000140,data=0x00500801,data-len=4 -device loader,addr=0xf800012c,data=0x1ed044d,data-len=4 -device loader,addr=0xf8000108,data=0x0001e008,data-len=4 -device loader,addr=0xF8000910,data=0xF,data-len=0x4  -machine-path ./qemu-tmp -icount 1 -sync-quantum 10000  
qemu-system-aarch64: Failed to connect socket ./qemu-tmp/qemu-rport-_cosim@0: Connection refused
qemu-system-aarch64: info: QEMU waiting for connection on: disconnected:unix:./qemu-tmp/qemu-rport-_cosim@0,server

 

 

I try to use the demo from : https://github.com/Xilinx/systemctlm-cosim-demo

I can compile and launch the demo, it also connects to QEMU :

 

LD_LIBRARY_PATH=/usr/local/systemc-2.3.2/lib-linux64/ ./zynq_demo unix:/opt/pkg/projects/petalinuxproject/qemu-tmp/qemu-rport-_cosim@0 10000

        SystemC 2.3.2-Accellera --- Apr  7 2020 10:52:59
        Copyright (c) 1996-2017 by all Contributors,
        ALL RIGHTS RESERVED
open socket
connect to /opt/pkg/projects/petalinuxproject/qemu-tmp/qemu-rport-_cosim@0

 

QEMU continues executions and show the two following lines before hanging :

 

qemu-system-aarch64: warning: vlan 0 is not connected to host network
rom: requested regions overlap (rom bootloader. free=0x00000000019e2eb0, addr=0x0000000000000000)

 

which are the two next message that pop up on startup (same as when I launch without Co-Simulation) but then QEMU is stuck and the simulation is also stuck.

I added some messages in the zynq-demo.cc file and the code runs until the sc_start(1, SC_US); simulation command between the reset toggles (if I comment this, the simulation runs until the next sc_start();)

 

	top->rst.write(true);
	sc_start(1, SC_US);
	top->rst.write(false);

 

 

When I kill ./zynq_demo with ctrl-c QEMU finishes with the following message. Therefore at least I can connect QEMU with SystemCTLM-SoC.

 

qemu-system-aarch64: /cosim@0: Disconnected clk=99999964 ns

 

 

 

Can anyone point me to what is missing in order to launch the linux Kernel with Co-Simulation enabled ?

 

Is there another Co-Simulation example with the Linux kernel on QEMU and LibsystemCTLM-SoC ?

 

I found the following : http://users.ece.utexas.edu/~gerstl/ee382m_f18/labs/QEMU_SystemC_Tutorial.htm which had similar instructions to what I did.

The only differences I could think of is that my PL has some additional devices (two GPIO modules on addresses 0x4120000 and 0x41201000 connected on GP0) that are in the device tree used by the kernel, but I can't see how this can cause the current issue, especially when the FSBL does not seem to be loaded yet (nor is U-Boot).

 

Thanks.
Regards
Rick

edit : typo

0 Kudos
Reply
1 Reply
rwk
Visitor
Visitor
394 Views
Registered: ‎06-18-2018

I posted this as an issue on the git and got an answer and solution.

 

Solutionhttps://github.com/Xilinx/systemctlm-cosim-demo/issues/7

 

Thanks to the developer.

Regards
Rick

0 Kudos
Reply