From nobody Sun May 5 02:32:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660484941; cv=none; d=zohomail.com; s=zohoarc; b=jLtbER+s0bJfwQHck6/owpmV48mPUj2l+pzNjiiCmwyRTAfScMOA7t8J4PsoB/VKVTkHGCxPVCwY+RKI8VWrYgZqEn0PSxB6aj0fDTZuahqsyGIJHPb6ceFa0Aja5cvcvWttWM7Akb6Sj/mU4u66Iln27cFc2PNXeLRdafv9iXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660484941; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2DJYZM3aFwey+M0xE9dcbEKZGi5URIHdT3tZNs3ERiI=; b=J/1u35uJ4CRgizTNADi4wk1lNmG/wxjMAB7Ev3Ra5wBvBLCTtflyirsG2SQ3bS24krTiToDAJEt3oTeHUQ9pGgC7IyRtsHap8zyfv4DjUygW5VYJkPuwXz6i5tF/1xjP/NDefRlTsMrrA6xMPFbt9FxfmRoXZVmpOwTN7r4ecGs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166048494159991.62579227339836; Sun, 14 Aug 2022 06:49:01 -0700 (PDT) Received: from localhost ([::1]:54792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNDz9-0007zt-5o for importer@patchew.org; Sun, 14 Aug 2022 09:48:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNDyA-0006fX-Ib for qemu-devel@nongnu.org; Sun, 14 Aug 2022 09:47:58 -0400 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]:41971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNDy8-0006gE-EE for qemu-devel@nongnu.org; Sun, 14 Aug 2022 09:47:58 -0400 Received: by mail-qt1-x82b.google.com with SMTP id c20so3937154qtw.8 for ; Sun, 14 Aug 2022 06:47:55 -0700 (PDT) Received: from stoup.. ([50.233.235.3]) by smtp.gmail.com with ESMTPSA id u67-20020ae9d846000000b006b89b9024ddsm6224456qkf.24.2022.08.14.06.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Aug 2022 06:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=2DJYZM3aFwey+M0xE9dcbEKZGi5URIHdT3tZNs3ERiI=; b=Xhkw16K6hAK7+xJKJpateW6UhVRzW/yFvtpW3XgFPlSocAuQklLD+1l7DzEVqkzNJ+ I/2ikn7INkLxNqGJSfGQo/ysP7AG2I1j8DGC8SVvgRI2djiFkaJFHr/XCMwFPc0KoXOi GDF8FV1l9lszvIaVJEad5B7U1To1kreunh2FEnKZDfULICVN3nIAgGcShsColSKYlMqv kqKwX9Rq3eRgnLe8I7RFpXwX6jIVqR1qSRtfpGA+UABmzP/iDKU4nX7jKYrn7AO2SKIZ wrvEPUOEDPw/StyRDo6BtmuAics+YCIqZK0qL0PuoJe6IMl5kjN62X3fVACneBl2q233 VvmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=2DJYZM3aFwey+M0xE9dcbEKZGi5URIHdT3tZNs3ERiI=; b=XVSTvapQ5qmVJh3YzU9TsQMRK+xRxZSSED/nZaSB+2KqGu0uBTgX9WY7ceuOY+TYIU ZXOGiqRqlUtGKiXesx7/MXqOIrO//eRzp8W74xa/tiPRSjJr98CLS/ytz2goaUD4pCfa 9xrqVIe3ntEzEmyy+UltCmPGrKmhoLnICae3Qyy9pyEIzi7eybJSGJQP6ljtTZ8IG8Se YsJTFuf6kr1gYBDKIpIbZIw+WGcHEDOwob3amdyvU5VKJugQ9Esdxx3p/I2HQAzs0/zG NzfupvslE16xfK8sASso3JD5X3AwI23tEuAmk8amhhucYy6WAv4phHrqNw4ltlUkTnoP eu8g== X-Gm-Message-State: ACgBeo0h51MabaIgTSDwOkcWAJw/lQ/WxtExA8g3Wv3T39KIQFgCsKUk PGqHsdjLfk9lb9B8hNVFcHjVoCbBoO1/UA== X-Google-Smtp-Source: AA6agR4F59wTcGEbM2GFK6OzrMwNfvOehA2k5pgPQ9q8mXhQrZpbDTMaIssiQPqTLNAsG7ugmqjz4A== X-Received: by 2002:ac8:5901:0:b0:344:5846:129e with SMTP id 1-20020ac85901000000b003445846129emr1473172qty.469.1660484874935; Sun, 14 Aug 2022 06:47:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang , Song Gao Subject: [PULL 1/1] docs/system/loongarch: Update the LoongArch document Date: Sun, 14 Aug 2022 08:47:45 -0500 Message-Id: <20220814134745.8824-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220814134745.8824-1-richard.henderson@linaro.org> References: <20220814134745.8824-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::82b; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660484942228100001 Content-Type: text/plain; charset="utf-8" From: Xiaojuan Yang 1. Add some information about how to boot the LoongArch virt machine by uefi bios and linux kernel and how to access the source code or binary file. 2. Move the explanation of LoongArch system emulation in the target/loongarch/README to docs/system/loongarch/loongson3.rst Signed-off-by: Xiaojuan Yang Reviewed-by: Song Gao Message-Id: <20220812091957.3338126-1-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- docs/system/loongarch/loongson3.rst | 104 +++++++++++++++++++++++++--- target/loongarch/README | 49 +------------ 2 files changed, 97 insertions(+), 56 deletions(-) diff --git a/docs/system/loongarch/loongson3.rst b/docs/system/loongarch/lo= ongson3.rst index fa3acd01c0..1bdab44e27 100644 --- a/docs/system/loongarch/loongson3.rst +++ b/docs/system/loongarch/loongson3.rst @@ -15,27 +15,115 @@ The ``virt`` machine supports: - Gpex host bridge - Ls7a RTC device - Ls7a IOAPIC device -- Ls7a ACPI device +- ACPI GED device - Fw_cfg device - PCI/PCIe devices - Memory device -- CPU device. Type: Loongson-3A5000. +- CPU device. Type: la464-loongarch-cpu. =20 CPU and machine Type -------------------- =20 The ``qemu-system-loongarch64`` provides emulation for virt machine. You can specify the machine type ``virt`` and -cpu type ``Loongson-3A5000``. +cpu type ``la464-loongarch-cpu``. =20 Boot options ------------ =20 -Now the ``virt`` machine can run test program in ELF format and the -method of compiling is in target/loongarch/README. +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: =20 .. code-block:: bash =20 - $ qemu-system-loongarch64 -machine virt -m 4G -cpu Loongson-3A5000 \ - -smp 1 -kernel hello -monitor none -display none \ - -chardev file,path=3Dhello.out,id=3Doutput -serial chardev:output + $ 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=3D/dev/ram rdinit=3D/sbin/init consol e=3DttyS0,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=3Dusr \ + --target-list=3D"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 + +(4) uefi bios source code and compile method: + +.. code-block:: bash + + git clone https://github.com/loongson/edk2-LoongarchVirt.git + + cd edk2-LoongarchVirt + + git submodule update --init + + export PATH=3D$YOUR_COMPILER_PATH/bin:$PATH + + export WORKSPACE=3D`pwd` + + export PACKAGES_PATH=3D$WORKSPACE/edk2-LoongarchVirt + + export GCC5_LOONGARCH64_PREFIX=3Dloongarch64-unknown-linux-gnu- + + edk2-LoongarchVirt/edksetup.sh + + make -C edk2-LoongarchVirt/BaseTools + + build --buildtarget=3DDEBUG --tagname=3DGCC5 --arch=3DLOONGARCH64 --pla= tform=3DOvmfPkg/LoongArchQemu/Loongson.dsc + + build --buildtarget=3DRELEASE --tagname=3DGCC5 --arch=3DLOONGARCH64 --p= latform=3DOvmfPkg/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: + +.. code-block:: bash + + git clone https://github.com/loongson/linux.git + + export PATH=3D$YOUR_COMPILER_PATH/bin:$PATH + + export LD_LIBRARY_PATH=3D$YOUR_COMPILER_PATH/lib:$LD_LIBRARY_PATH + + export LD_LIBRARY_PATH=3D$YOUR_COMPILER_PATH/loongarch64-unknown-linux-g= nu/lib/:$LD_LIBRARY_PATH + + make ARCH=3Dloongarch CROSS_COMPILE=3Dloongarch64-unknown-linux-gnu- loo= ngson3_defconfig + + make ARCH=3Dloongarch CROSS_COMPILE=3Dloongarch64-unknown-linux-gnu- + + make ARCH=3Dloongarch CROSS_COMPILE=3Dloongarch64-unknown-linux-gnu- ins= tall + + make ARCH=3Dloongarch CROSS_COMPILE=3Dloongarch64-unknown-linux-gnu- mod= ules_install + +Note: The branch of linux source code is loongarch-next. + +(6) initrd file: + + 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 diff --git a/target/loongarch/README b/target/loongarch/README index 1823375d04..0b9dc0d40a 100644 --- a/target/loongarch/README +++ b/target/loongarch/README @@ -11,54 +11,7 @@ =20 - System emulation =20 - Mainly emulate a virt 3A5000 board and ls7a bridge that is not exactly t= he same as the host. - 3A5000 support multiple interrupt cascading while here we just emulate t= he extioi interrupt - cascading. LS7A1000 host bridge support multiple devices, such as sata, = gmac, uart, rtc - and so on. But we just realize the rtc. Others use the qemu common devic= es. It does not affect - the general use. We also introduced the emulation of devices at docs/sys= tem/loongarch/virt.rst. - - This version only supports running binary files in ELF format, and does = not depend on BIOS and kernel file. - You can compile the test program with 'make & make check-tcg' and run th= e test case with the following command: - - 1. Install LoongArch cross-tools on X86 machines. - - Download cross-tools. - - 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 -C /opt - - Config cross-tools env. - - . setenv.sh - - setenv.sh: - - #!/bin/sh - set -x - CC_PREFIX=3D/opt/cross-tools - - export PATH=3D$CC_PREFIX/bin:$PATH - export LD_LIBRARY_PATH=3D$CC_PREFIX/lib:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH=3D$CC_PREFIX/loongarch64-unknown-linux-gn= u/lib/:$LD_LIBRARY_PATH - set +x - - 2. Test tests/tcg/multiarch. - - ./configure --disable-rdma --disable-pvrdma --prefix=3D/usr \ - --target-list=3D"loongarch64-softmmu" \ - --disable-libiscsi --disable-libnfs --disable-libpmem \ - --disable-glusterfs --enable-libusb --enable-usb-redir \ - --disable-opengl --disable-xen --enable-spice --disable-werror= \ - --enable-debug --disable-capstone --disable-kvm --enable-profi= ler - - cd build/ - - make && make check-tcg - - or - - ./build/qemu-system-loongarch64 -machine virt -m 4G -cpu Loongson-3A50= 00 -smp 1 -kernel build/tests/tcg/loongarch64-softmmu/hello -monitor none -= display none -chardev file,path=3Dhello.out,id=3Doutput -serial chardev:out= put + You can reference docs/system/loongarch/loongson3.rst to get the informa= tion about system emulation of LoongArch. =20 - Linux-user emulation =20 --=20 2.34.1