Signed-off-by: Xiaojuan Yang <yangxiaoj...@loongson.cn>
Signed-off-by: Song Gao <gaos...@loongson.cn>
---
 docs/system/loongarch/loongson3.rst | 78 +++++++++++++++++++++++++++++
 target/loongarch/README             | 28 +++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 docs/system/loongarch/loongson3.rst

diff --git a/docs/system/loongarch/loongson3.rst 
b/docs/system/loongarch/loongson3.rst
new file mode 100644
index 0000000000..1840ec5e75
--- /dev/null
+++ b/docs/system/loongarch/loongson3.rst
@@ -0,0 +1,78 @@
+loongson3-ls7a generic platform (``loongson3-ls7a``)
+====================================================
+
+Use ``loongson3-ls7a`` machine type to emulate the loongson7a board.
+There are some devices on loongson7a board, such as RTC device,
+IOAPIC device, ACPI device and so on.
+
+Supported devices
+-----------------
+
+The ``loongson3-ls7a`` machine supports:
+- PCI/PCIe devices
+- Memory device
+- CPU device
+- Ls7a host bridge
+- Ls7a RTC device
+- Ls7a IOAPIC device
+- Ls7a ACPI device
+- Fw_cfg device
+- CPU device. Type: Loongson-3A5000.
+
+CPU and machine Type
+--------------------
+
+The ``qemu-system-loongarch64`` provides emulation for loongson7a
+machine. You can specify the machine type ``loongson3-ls7a`` and
+cpu type ``Loongson-3A5000``.
+
+Boot options
+------------
+
+Now the ``loongson3-ls7a`` machine can start using -bios parameter:
+
+.. code-block:: bash
+
+  $ qemu-system-loongarch64 -M loongson3-ls7a -cpu Loongson-3A5000 -smp 2 -m 
1G \
+      -display none -serial stdio \
+      -bios loongarch_bios.bini
+
+Info mtree
+----------
+address-space: memory
+  0000000000000000-ffffffffffffffff (prio 0, i/o): system
+    0000000000000000-ffffffffffffffff (prio 0, i/o): ls7a_mmio
+      00000000000a0000-00000000000bffff (prio 1, i/o): cirrus-lowmem-container
+        00000000000a0000-00000000000bffff (prio 0, i/o): cirrus-low-memory
+    0000000000000000-000000000fffffff (prio 0, ram): alias loongarch.lowram 
@loongarch.ram 0000000000000000-000000000fffffff
+    0000000010000000-00000000100000ff (prio 0, i/o): 
loongarch_pch_pic.reg32_part1
+    0000000010000100-000000001000039f (prio 0, i/o): loongarch_pch_pic.reg8
+    00000000100003a0-0000000010000fff (prio 0, i/o): 
loongarch_pch_pic.reg32_part2
+    000000001001041c-000000001001041f (prio -1000, i/o): pci-dma-cfg
+    0000000010013ffc-0000000010013fff (prio -1000, i/o): mmio fallback 1
+    00000000100d0000-00000000100d00ff (prio 0, i/o): ls7a_pm
+      00000000100d000c-00000000100d0013 (prio 0, i/o): acpi-evt
+      00000000100d0014-00000000100d0017 (prio 0, i/o): acpi-cnt
+      00000000100d0018-00000000100d001b (prio 0, i/o): acpi-tmr
+      00000000100d0028-00000000100d002f (prio 0, i/o): acpi-gpe0
+      00000000100d0030-00000000100d0033 (prio 0, i/o): acpi-reset
+    00000000100d0100-00000000100d01ff (prio 0, i/o): ls7a_rtc
+    0000000018000000-0000000018003fff (prio 0, i/o): alias isa-io @io 
0000000000000000-0000000000003fff
+    0000000018004000-000000001800ffff (prio 0, i/o): alias ls7a-pci-io @io 
0000000000004000-000000000000ffff
+    000000001a000000-000000001bffffff (prio 0, i/o): ls7a_pci_conf
+    000000001c000000-000000001c3fffff (prio 0, rom): loongarch.bios
+    000000001e020000-000000001e020001 (prio 0, i/o): fwcfg.ctl
+    000000001e020008-000000001e02000f (prio 0, i/o): fwcfg.data
+    000000001fe001e0-000000001fe001e7 (prio 0, i/o): serial
+    0000000020000000-0000000027ffffff (prio 0, i/o): pcie-mmcfg-mmio
+    000000002ff00000-000000002ff00007 (prio 0, i/o): loongarch_pch_msi
+    0000000090000000-000000017fffffff (prio 0, ram): alias loongarch.highmem 
@loongarch.ram 0000000010000000-00000000ffffffff
+
+address-space: IOCSR
+  0000000000000000-ffffffffffffffff (prio 0, i/o): iocsr
+    0000000000000008-0000000000000427 (prio 0, i/o): iocsr_misc
+    0000000000001000-00000000000010ff (prio 0, i/o): loongarch_ipi
+    0000000000001400-00000000000014bf (prio 0, i/o): loongarch_extioi.nodetype
+    00000000000014c0-000000000000167f (prio 0, i/o): 
loongarch_extioi.ipmap_enable
+    0000000000001680-0000000000001bff (prio 0, i/o): 
loongarch_extioi.bounce_coreisr
+    0000000000001c00-0000000000001cff (prio 0, i/o): loongarch_extioi.coremap
diff --git a/target/loongarch/README b/target/loongarch/README
index 383db6cc15..de44d39561 100644
--- a/target/loongarch/README
+++ b/target/loongarch/README
@@ -71,6 +71,34 @@
       ./qemu-loongarch64  /opt/clfs/usr/bin/pwd
       ...
 
+- System emulation
+
+  Mainly emulate a virt 3A5000 board and ls7a bridge that is not exactly the 
same as the host.
+  3A5000 support multiple interrupt cascading while here we just emulate the 
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 devices. 
It does not affect
+  the general use. We also introduced the emulation of devices at 
docs/system/loongarch/loongson3.rst.
+
+  You can compile the binaries by youself or just get all required binaries 
from the github for testing.
+
+  1.Download kernel and the cross-tools.(vmlinux)
+
+      https://github.com/loongson/linux/tree/loongarch-next
+      
https://github.com/loongson/build-tools/releases/latest/download/loongarch64-clfs-20211202-cross-tools.tar.xz
+
+  2.Download uefi code.(loongarch_bios.bin)
+
+      https://github.com/loongson/edk2/tree/LoongArch
+      https://github.com/loongson/edk2-platforms
+
+  3.Download the clfs-system and make a ramdisk with busybox.(ramdisk)
+
+  4.Run with command,eg:
+
+   ./build/qemu-system-loongarch64 -m 4G -smp 4 --cpu Loongson-3A5000 
--machine loongson3-ls7a -kernel ./vmlinux -initrd ./ramdisk  -append 
"root=/dev/ram console=ttyS0,115200 rdinit=/sbin/init loglevel=8" -monitor 
tcp::4000,server,nowait -nographic
+
+All binaries can get from here directly:
+    git clone https://github.com/yangxiaojuan-loongson/qemu-binary
 
 - Note.
   We can get the latest LoongArch documents or LoongArch tools at 
https://github.com/loongson/
-- 
2.27.0


Reply via email to