pull-loongarch-20230303

-----BEGIN PGP SIGNATURE-----
 
 iLMEAAEIAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCZAFb5wAKCRBAov/yOSY+
 35hmA/sHIGXU5zQV6p6DBILFGEE6x91sPtV8WKY3zujVY0hsfD4SF6bKTaKJYisZ
 EztZZ5/EunQcu/vfgO46YtYysEWzrzGiinbZ5lAjxk6sdlBYlfcTQLAQEEW3zPbP
 qB3SiiGmGQ0iYFHIlkyi1tCF5OEmqqQKrHYrNVk6cGBoJle2PA==
 =giPH
 -----END PGP SIGNATURE-----

Merge tag 'pull-loongarch-20230303' of https://gitlab.com/gaosong/qemu into staging

pull-loongarch-20230303

# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEIAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCZAFb5wAKCRBAov/yOSY+
# 35hmA/sHIGXU5zQV6p6DBILFGEE6x91sPtV8WKY3zujVY0hsfD4SF6bKTaKJYisZ
# EztZZ5/EunQcu/vfgO46YtYysEWzrzGiinbZ5lAjxk6sdlBYlfcTQLAQEEW3zPbP
# qB3SiiGmGQ0iYFHIlkyi1tCF5OEmqqQKrHYrNVk6cGBoJle2PA==
# =giPH
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 Mar 2023 02:31:03 GMT
# gpg:                using RSA key B8FF1DA0D2FDCB2DA09C6C2C40A2FFF239263EDF
# gpg: Good signature from "Song Gao <m17746591750@163.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B8FF 1DA0 D2FD CB2D A09C  6C2C 40A2 FFF2 3926 3EDF

* tag 'pull-loongarch-20230303' of https://gitlab.com/gaosong/qemu:
  hw/loongarch/virt: add system_powerdown hmp command support
  target/loongarch: Implement Chip Configuraiton Version Register(0x0000)
  docs/system/loongarch: update loongson3.rst and rename it to virt.rst
  loongarch: Add smbios command line option.
  hw/loongarch/virt: rename PCH_PIC_IRQ_OFFSET with VIRT_GSI_BASE

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2023-03-03 17:11:13 +00:00
commit bfbcaae963
8 changed files with 70 additions and 73 deletions

View file

@ -19,14 +19,14 @@ The ``virt`` machine supports:
- Fw_cfg device
- PCI/PCIe devices
- Memory device
- CPU device. Type: la464-loongarch-cpu.
- CPU device. Type: la464.
CPU and machine Type
--------------------
The ``qemu-system-loongarch64`` provides emulation for virt
machine. You can specify the machine type ``virt`` and
cpu type ``la464-loongarch-cpu``.
cpu type ``la464``.
Boot options
------------
@ -35,95 +35,74 @@ We can boot the LoongArch virt machine by specifying the uefi bios,
initrd, and linux kernel. And those source codes and binary files
can be accessed by following steps.
(1) booting command:
(1) Build qemu-system-loongarch64:
.. code-block:: bash
$ qemu-system-loongarch64 -machine virt -m 4G -cpu la464-loongarch-cpu \
-smp 1 -bios QEMU_EFI.fd -kernel vmlinuz.efi -initrd initrd.img \
-append "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200" \
--nographic
Note: The running speed may be a little slow, as the performance of our
qemu and uefi bios is not perfect, and it is being fixed.
(2) cross compiler tools:
.. code-block:: bash
wget https://github.com/loongson/build-tools/releases/download/ \
2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
tar -vxf loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
(3) qemu compile configure option:
.. code-block:: bash
./configure --disable-rdma --disable-pvrdma --prefix=usr \
./configure --disable-rdma --disable-pvrdma --prefix=/usr \
--target-list="loongarch64-softmmu" \
--disable-libiscsi --disable-libnfs --disable-libpmem \
--disable-glusterfs --enable-libusb --enable-usb-redir \
--disable-opengl --disable-xen --enable-spice \
--enable-debug --disable-capstone --disable-kvm \
--enable-profiler
make
make -j8
(4) uefi bios source code and compile method:
(2) Set cross tools:
.. code-block:: bash
git clone https://github.com/loongson/edk2-LoongarchVirt.git
wget https://github.com/loongson/build-tools/releases/download/2022.09.06/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz
cd edk2-LoongarchVirt
tar -vxf loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz -C /opt
git submodule update --init
export PATH=/opt/cross-tools/bin:$PATH
export LD_LIBRARY_PATH=/opt/cross-tools/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/cross-tools/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
export PATH=$YOUR_COMPILER_PATH/bin:$PATH
Note: You need get the latest cross-tools at https://github.com/loongson/build-tools
export WORKSPACE=`pwd`
(3) Build BIOS:
export PACKAGES_PATH=$WORKSPACE/edk2-LoongarchVirt
See: https://github.com/tianocore/edk2-platforms/tree/master/Platform/Loongson/LoongArchQemuPkg#readme
export GCC5_LOONGARCH64_PREFIX=loongarch64-unknown-linux-gnu-
Note: To build the release version of the bios, set --buildtarget=RELEASE,
the bios file path: Build/LoongArchQemu/RELEASE_GCC5/FV/QEMU_EFI.fd
edk2-LoongarchVirt/edksetup.sh
make -C edk2-LoongarchVirt/BaseTools
build --buildtarget=DEBUG --tagname=GCC5 --arch=LOONGARCH64 --platform=OvmfPkg/LoongArchQemu/Loongson.dsc
build --buildtarget=RELEASE --tagname=GCC5 --arch=LOONGARCH64 --platform=OvmfPkg/LoongArchQemu/Loongson.dsc
The efi binary file path:
Build/LoongArchQemu/DEBUG_GCC5/FV/QEMU_EFI.fd
Build/LoongArchQemu/RELEASE_GCC5/FV/QEMU_EFI.fd
(5) linux kernel source code and compile method:
(4) Build kernel:
.. code-block:: bash
git clone https://github.com/loongson/linux.git
export PATH=$YOUR_COMPILER_PATH/bin:$PATH
cd linux
export LD_LIBRARY_PATH=$YOUR_COMPILER_PATH/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$YOUR_COMPILER_PATH/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
git checkout loongarch-next
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- loongson3_defconfig
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu-
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- install
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- modules_install
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- -j32
Note: The branch of linux source code is loongarch-next.
the kernel file: arch/loongarch/boot/vmlinuz.efi
(6) initrd file:
(5) Get initrd:
You can use busybox tool and the linux modules to make a initrd file. Or you can access the
binary files: https://github.com/yangxiaojuan-loongson/qemu-binary
.. code-block:: bash
git clone https://github.com/yangxiaojuan-loongson/qemu-binary
Note: the initrd file is ramdisk
(6) Booting LoongArch:
.. code-block:: bash
$ ./build/qemu-system-loongarch64 -machine virt -m 4G -cpu la464 \
-smp 1 -bios QEMU_EFI.fd -kernel vmlinuz.efi -initrd ramdisk \
-serial stdio -monitor telnet:localhost:4495,server,nowait \
-append "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200" \
--nographic