target/loongarch: Add system emulation introduction
[qemu/ar7.git] / target / loongarch / README
blob4dcd0f1682cd7b6ba2977eb53a8d4ecc2cdd8deb
1 - Introduction
3   LoongArch is the general processor architecture of Loongson.
5   The following versions of the LoongArch core are supported
6     core: 3A5000
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.
12 - System emulation
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.
25     Download cross-tools.
27       wget https://github.com/loongson/build-tools/releases/latest/download/loongarch64-clfs-20211202-cross-tools.tar.xz
29       tar -vxf loongarch64-clfs-20211202-cross-tools.tar.xz -C /opt
31     Config cross-tools env.
33       . setenv.sh
35       setenv.sh:
37           #!/bin/sh
38           set -x
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
44           set +x
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
55     cd  build/
57     make && make check-tcg
59     or
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 - Note.
64   We can get the latest LoongArch documents or LoongArch tools at https://github.com/loongson/