3 LoongArch is the general processor architecture of Loongson.
5 The following versions of the LoongArch core are supported
7 https://github.com/loongson/LoongArch-Documentation/releases/download/2021.08.17/LoongArch-Vol1-v1.00-EN.pdf
9 We can get the latest loongarch documents at https://github.com/loongson/LoongArch-Documentation/tags.
14 Mainly emulate a virt 3A5000 board and ls7a bridge that is not exactly the same as the host.
15 3A5000 support multiple interrupt cascading while here we just emulate the extioi interrupt
16 cascading. LS7A1000 host bridge support multiple devices, such as sata, gmac, uart, rtc
17 and so on. But we just realize the rtc. Others use the qemu common devices. It does not affect
18 the general use. We also introduced the emulation of devices at docs/system/loongarch/loongson3.rst.
20 This version only supports running binary files in ELF format, and does not depend on BIOS and kernel file.
21 You can compile the test program with 'make & make check-tcg' and run the test case with the following command:
23 1. Install LoongArch cross-tools on X86 machines.
27 wget https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
29 tar -vxf loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz -C /opt
31 Config cross-tools env.
39 CC_PREFIX=/opt/cross-tools
41 export PATH=$CC_PREFIX/bin:$PATH
42 export LD_LIBRARY_PATH=$CC_PREFIX/lib:$LD_LIBRARY_PATH
43 export LD_LIBRARY_PATH=$CC_PREFIX/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
46 2. Test tests/tcg/multiarch.
48 ./configure --disable-rdma --disable-pvrdma --prefix=/usr \
49 --target-list="loongarch64-softmmu" \
50 --disable-libiscsi --disable-libnfs --disable-libpmem \
51 --disable-glusterfs --enable-libusb --enable-usb-redir \
52 --disable-opengl --disable-xen --enable-spice --disable-werror \
53 --enable-debug --disable-capstone --disable-kvm --enable-profiler
57 make && make check-tcg
61 ./build/qemu-system-loongarch64 -machine virt -m 4G -cpu Loongson-3A5000 -smp 1 -kernel build/tests/tcg/loongarch64-softmmu/hello -monitor none -display none -chardev file,path=hello.out,id=output -serial chardev:output
63 - Linux-user emulation
65 We already support Linux user emulation. We can use LoongArch cross-tools to build LoongArch executables on X86 machines,
66 and We can also use qemu-loongarch64 to run LoongArch executables.
68 1. Config cross-tools env.
72 2. Test tests/tcg/multiarch.
74 ./configure --static --prefix=/usr --disable-werror --target-list="loongarch64-linux-user" --enable-debug
78 make && make check-tcg
80 3. Run LoongArch system basic command with loongarch-clfs-system.
84 wget https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-system-5.0.tar.bz2
86 tar -vxf loongarch64-clfs-system-5.0.tar.bz2 -C /opt/clfs
88 cp /opt/clfs/lib64/ld-linux-loongarch-lp64d.so.1 /lib64
90 export LD_LIBRARY_PATH="/opt/clfs/lib64"
92 - Run LoongArch system basic command.
94 ./qemu-loongarch64 /opt/clfs/usr/bin/bash
95 ./qemu-loongarch64 /opt/clfs/usr/bin/ls
96 ./qemu-loongarch64 /opt/clfs/usr/bin/pwd
99 We can get the latest LoongArch documents or LoongArch tools at https://github.com/loongson/