From: Huacai Chen <zltjiangshi@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
Huacai Chen <chenhuacai@gmail.com>,
qemu-devel@nongnu.org,
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
Huacai Chen <chenhc@lemote.com>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: [PATCH V17 0/6] mips: Add Loongson-3 machine support
Date: Fri, 6 Nov 2020 12:21:44 +0800 [thread overview]
Message-ID: <1604636510-8347-1-git-send-email-chenhc@lemote.com> (raw)
Loongson-3 CPU family include Loongson-3A R1/R2/R3/R4 and Loongson-3B
R1/R2. Loongson-3A R1 is the oldest and its ISA is the smallest, while
Loongson-3A R4 is the newest and its ISA is almost the superset of all
others. To reduce complexity, in QEMU we just define two CPU types:
1, "Loongson-3A1000" CPU which is corresponding to Loongson-3A R1. It is
suitable for TCG because Loongson-3A R1 has fewest ASE.
2, "Loongson-3A4000" CPU which is corresponding to Loongson-3A R4. It is
suitable for KVM because Loongson-3A R4 has the VZ ASE.
Loongson-3 lacks English documents. I've tried to translated them with
translate.google.com, and the machine translated documents (together
with their original Chinese versions) are available here.
Loongson-3A R1 (Loongson-3A1000)
User Manual Part 1:
http://ftp.godson.ac.cn/lemote/3A1000_p1.pdf
http://ftp.godson.ac.cn/lemote/Loongson3A1000_processor_user_manual_P1.pdf (Chinese Version)
User Manual Part 2:
http://ftp.godson.ac.cn/lemote/3A1000_p2.pdf
http://ftp.godson.ac.cn/lemote/Loongson3A1000_processor_user_manual_P2.pdf (Chinese Version)
Loongson-3A R2 (Loongson-3A2000)
User Manual Part 1:
http://ftp.godson.ac.cn/lemote/3A2000_p1.pdf
http://ftp.godson.ac.cn/lemote/Loongson3A2000_user1.pdf (Chinese Version)
User Manual Part 2:
http://ftp.godson.ac.cn/lemote/3A2000_p2.pdf
http://ftp.godson.ac.cn/lemote/Loongson3A2000_user2.pdf (Chinese Version)
Loongson-3A R3 (Loongson-3A3000)
User Manual Part 1:
http://ftp.godson.ac.cn/lemote/3A3000_p1.pdf
http://ftp.godson.ac.cn/lemote/Loongson3A3000_3B3000usermanual1.pdf (Chinese Version)
User Manual Part 2:
http://ftp.godson.ac.cn/lemote/3A3000_p2.pdf
http://ftp.godson.ac.cn/lemote/Loongson3A3000_3B3000usermanual2.pdf (Chinese Version)
Loongson-3A R4 (Loongson-3A4000)
User Manual Part 1:
http://ftp.godson.ac.cn/lemote/3A4000_p1.pdf
http://ftp.godson.ac.cn/lemote/3A4000user.pdf (Chinese Version)
User Manual Part 2:
I'm sorry that it is unavailable now.
And human-translated documents (W.I.P) are available here now:
https://github.com/loongson-community/docs/tree/master/English-translation-of-Loongson-manual
Both KVM and TCG are available now!
We now already have a full functional Linux kernel (based on Linux-5.4.x
LTS) here:
https://github.com/chenhuacai/linux
Of course the upstream kernel is also usable (the kvm host side and
guest side have both been upstream in Linux-5.9):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
How to use QEMU/Loongson-3?
1, Download kernel source from the above URL;
2, Build a kernel with arch/mips/configs/loongson3_{def,hpc}config;
3, Boot a Loongson-3A4000 host with this kernel (for KVM mode);
4, Build QEMU-master with this patchset;
5, modprobe kvm (only necessary for KVM mode);
6, Use QEMU with TCG:
qemu-system-mips64el -M loongson3-virt,accel=tcg -cpu Loongson-3A1000 -kernel <path_to_kernel> -append ...
Use QEMU with KVM:
qemu-system-mips64el -M loongson3-virt,accel=kvm -cpu Loongson-3A4000 -kernel <path_to_kernel> -append ...
The "-cpu" parameter is optional here and QEMU will use the correct type for TCG/KVM automatically.
V1 -> V2:
1, Add a cover letter;
2, Improve CPU definitions;
3, Remove LS7A-related things (Use GPEX instead);
4, Add a description of how to run QEMU/Loongson-3.
V2 -> V3:
1, Fix all possible checkpatch.pl errors and warnings.
V3 -> V4:
1, Sync code with upstream;
2, Remove merged patches;
3, Fix build failure without CONFIG_KVM;
4, Add Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>.
V4 -> V5:
1, Improve coding style;
2, Remove merged patches;
3, Rename machine name from "loongson3" to "loongson3-virt";
4, Rework the "loongson3-virt" machine to drop any ISA things;
5, Rework "hw/mips: Implement the kvm_type() hook in MachineClass";
6, Add Jiaxun Yang as a reviewer of Loongson-3.
V5 -> V6:
1, Fix license preamble;
2, Improve commit messages;
3, Add hw/intc/loongson_liointc.c to MAINTAINERS;
4, Fix all possible checkpatch.pl errors and warnings.
V7 and V8 have only one patch (machine definition) with some minor improvements.
V8 -> V9:
1, Update KVM type definition from kernel;
2, Fix PageMask with variable page size for TCG;
3, Add TCG support (add Loongson-EXT instructions).
V9 -> V10:
1, Split fw_cfg to a separate patch;
2, Split boot parameters definition to a local header;
3, Update MIPS machine documentation;
4, Many other improvements suggested by Philippe Mathieu-Daudé.
V10 -> V11:
1, Fix some typos;
2, Add Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>.
V11 -> V12:
1, Split boot parameter helpers to loongson3_bootp.c;
2, Support both BE and LE host (Loongson guests are always LE).
V12 -> V13:
1, Sync code with upstream;
2, Re-enable KVM support for MIPS in meson;
V13 -> V14:
1, Remove merged patches;
2, Split boot parameter helpers to a separate patch;
3, Many other improvements suggested by Philippe Mathieu-Daudé.
V14 -> V15:
1, Remove merged patches;
2, Fix malta breakage caused by variable page size;
3, Add unaligned access support for Loongson-3's TCG mode;
4, Many other improvements suggested by Philippe Mathieu-Daudé.
V15 -> V16:
1, Remove some unused code;
2, Add Reviewed-by: Richard Henderson <richard.henderson@linaro.org>.
V16 -> V17:
1, Remove merged patches;
2, Rework Loongson LIOINTC;
3, Fix update_pagemask() for MIPS R6;
4, Add Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>.
Huacai Chen and Jiaxun Yang (6):
target/mips: Fix PageMask with variable page size
hw/intc: Rework Loongson LIOINTC
hw/mips: Implement fw_cfg_arch_key_name()
hw/mips: Add Loongson-3 boot parameter helpers
hw/mips: Add Loongson-3 machine support
docs/system: Update MIPS machine documentation
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
default-configs/devices/mips64el-softmmu.mak | 1 +
docs/system/target-mips.rst | 10 +
hw/intc/loongson_liointc.c | 49 +--
hw/mips/Kconfig | 12 +
hw/mips/fw_cfg.c | 35 ++
hw/mips/fw_cfg.h | 19 +
hw/mips/loongson3_bootp.c | 165 +++++++
hw/mips/loongson3_bootp.h | 241 +++++++++++
hw/mips/loongson3_virt.c | 614 +++++++++++++++++++++++++++
hw/mips/meson.build | 3 +-
include/hw/intc/loongson_liointc.h | 39 ++
target/mips/cp0_helper.c | 27 +-
target/mips/cpu.h | 1 +
13 files changed, 1174 insertions(+), 42 deletions(-)
create mode 100644 hw/mips/fw_cfg.c
create mode 100644 hw/mips/fw_cfg.h
create mode 100644 hw/mips/loongson3_bootp.c
create mode 100644 hw/mips/loongson3_bootp.h
create mode 100644 hw/mips/loongson3_virt.c
create mode 100644 include/hw/intc/loongson_liointc.h
--
2.7.0
next reply other threads:[~2020-11-06 4:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 4:21 Huacai Chen [this message]
2020-11-06 4:21 ` [PATCH V17 1/6] target/mips: Fix PageMask with variable page size Huacai Chen
2020-11-07 12:11 ` Philippe Mathieu-Daudé
2020-11-08 1:34 ` Huacai Chen
2020-11-08 23:15 ` Philippe Mathieu-Daudé
2020-11-06 4:21 ` [PATCH V17 2/6] hw/intc: Rework Loongson LIOINTC Huacai Chen
2020-11-23 20:52 ` Philippe Mathieu-Daudé
2020-11-23 22:24 ` Philippe Mathieu-Daudé
2020-11-28 6:20 ` Huacai Chen
2020-11-28 6:19 ` Huacai Chen
2020-11-30 10:08 ` Philippe Mathieu-Daudé
2020-12-02 1:16 ` Huacai Chen
2020-11-06 4:21 ` [PATCH V17 3/6] hw/mips: Implement fw_cfg_arch_key_name() Huacai Chen
2020-11-06 4:21 ` [PATCH V17 4/6] hw/mips: Add Loongson-3 boot parameter helpers Huacai Chen
2020-11-23 22:25 ` Philippe Mathieu-Daudé
2020-12-02 1:14 ` Huacai Chen
2020-12-02 9:32 ` Philippe Mathieu-Daudé
2020-12-11 2:46 ` Huacai Chen
2020-12-11 11:32 ` Philippe Mathieu-Daudé
2020-12-13 22:17 ` Philippe Mathieu-Daudé
2020-12-13 23:09 ` Philippe Mathieu-Daudé
2020-12-14 2:37 ` Huacai Chen
2020-12-14 13:49 ` Philippe Mathieu-Daudé
2020-12-15 5:34 ` Huacai Chen
2020-12-15 10:21 ` Philippe Mathieu-Daudé
2020-12-13 23:24 ` Philippe Mathieu-Daudé
2020-11-06 4:21 ` [PATCH V17 5/6] hw/mips: Add Loongson-3 machine support Huacai Chen
2020-11-23 21:54 ` Philippe Mathieu-Daudé
2020-11-28 7:04 ` Huacai Chen
2020-11-06 4:21 ` [PATCH V17 6/6] docs/system: Update MIPS machine documentation Huacai Chen
2020-11-23 20:52 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1604636510-8347-1-git-send-email-chenhc@lemote.com \
--to=zltjiangshi@gmail.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=aurelien@aurel32.net \
--cc=chenhc@lemote.com \
--cc=chenhuacai@gmail.com \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).