xref: /openbmc/qemu/target/loongarch/README (revision de799beb)
1- Introduction
2
3  LoongArch is the general processor architecture of Loongson.
4
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
8
9  We can get the latest loongarch documents at https://github.com/loongson/LoongArch-Documentation/tags.
10
11
12- System emulation
13
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.
19
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:
22
23  1. Install LoongArch cross-tools on X86 machines.
24
25    Download cross-tools.
26
27      wget https://github.com/loongson/build-tools/releases/latest/download/loongarch64-clfs-20211202-cross-tools.tar.xz
28
29      tar -vxf loongarch64-clfs-20211202-cross-tools.tar.xz -C /opt
30
31    Config cross-tools env.
32
33      . setenv.sh
34
35      setenv.sh:
36
37          #!/bin/sh
38          set -x
39          CC_PREFIX=/opt/cross-tools
40
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
45
46  2. Test tests/tcg/multiarch.
47
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
54
55    cd  build/
56
57    make && make check-tcg
58
59    or
60
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
62
63- Note.
64  We can get the latest LoongArch documents or LoongArch tools at https://github.com/loongson/
65